PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.1.5
JetFormBuilder — Dynamic Blocks Form Builder v3.1.5
3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / modules / gateways / assets / src / js / editor / paypal / pay-now-scenario.js
jetformbuilder / modules / gateways / assets / src / js / editor / paypal Last commit date
main.js 2 years ago pay-now-scenario.js 2 years ago
pay-now-scenario.js
104 lines
1 const { compose } = wp.compose;
2
3 const {
4 withSelect,
5 withDispatch,
6 } = wp.data;
7
8 const {
9 TextControl,
10 SelectControl,
11 BaseControl,
12 RadioControl,
13 } = wp.components;
14
15 const {
16 withSelectFormFields,
17 withSelectGateways,
18 withDispatchGateways,
19 withSelectActionsByType,
20 } = JetFBHooks;
21
22 const { GatewayFetchButton } = JetFBComponents;
23
24 function PayNowScenario( {
25 gatewayGeneral,
26 gatewaySpecific,
27 setGateway,
28 setGatewaySpecific,
29 formFields,
30 getSpecificOrGlobal,
31 loadingGateway,
32 scenarioSource,
33 noticeOperations,
34 scenarioLabel,
35 globalGatewayLabel,
36 } ) {
37
38 const displayNotice = status => response => {
39 noticeOperations.removeNotice( gatewayGeneral.gateway );
40 noticeOperations.createNotice( {
41 status,
42 content: response.message,
43 id: gatewayGeneral.gateway,
44 } );
45 };
46
47 return <>
48 <BaseControl
49 label={ scenarioLabel( 'fetch_button_label' ) }
50 >
51 <div className="jet-user-fields-map__list">
52 { ( ! loadingGateway.success && ! loadingGateway.loading ) && <span
53 className={ 'description-controls' }
54 >
55 { scenarioLabel( 'fetch_button_help' ) }
56 </span> }
57 <GatewayFetchButton
58 initialLabel={ scenarioLabel( 'fetch_button' ) }
59 label={ scenarioLabel( 'fetch_button_retry' ) }
60 apiArgs={ {
61 ...scenarioSource.fetch,
62 data: {
63 client_id: getSpecificOrGlobal( 'client_id' ),
64 secret: getSpecificOrGlobal( 'secret' ),
65 },
66 } }
67 onFail={ displayNotice( 'error' ) }
68 />
69 </div>
70 </BaseControl>
71 { loadingGateway.success && <>
72 <TextControl
73 label={ scenarioLabel( 'currency' ) }
74 key='paypal_currency_code_setting'
75 value={ gatewaySpecific.currency }
76 onChange={ currency => setGatewaySpecific( { currency } ) }
77 />
78 <SelectControl
79 label={ globalGatewayLabel( 'price_field' ) }
80 key={ 'form_fields_price_field' }
81 value={ gatewayGeneral.price_field }
82 labelPosition='side'
83 onChange={ price_field => {
84 setGateway( { price_field } );
85 } }
86 options={ formFields }
87 />
88 </> }
89 </>;
90 }
91
92 export default compose(
93 withSelect( ( ...props ) => (
94 {
95 ...withSelectFormFields( [], '--' )( ...props ),
96 ...withSelectGateways( ...props ),
97 }
98 ) ),
99 withDispatch( ( ...props ) => (
100 {
101 ...withDispatchGateways( ...props ),
102 }
103 ) ),
104 )( PayNowScenario );