PluginProbe
PayPlug for WooCommerce (Official) / 3.1.0
PayPlug for WooCommerce (Official) v3.1.0
3.1.0 3.0.0 2.18.0 1.0.17 1.0.18 1.0.19 1.0.20 1.0.21 1.0.22 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.1.0 1.10.0 1.10.1 1.2.1 1.2.10 1.2.11 1.2.2 1.2.3 1.2.4 1.2.5 All 102 releases
payplug / resources / js / frontend / wc-payplug-blocks.js

wc-payplug-blocks.js in PayPlug for WooCommerce (Official) 3.1.0, at resources/js/frontend/wc-payplug-blocks.js

70 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1
2 import { __ } from '@wordpress/i18n';
3 import { registerPaymentMethod } from '@woocommerce/blocks-registry';
4 import { decodeEntities } from '@wordpress/html-entities';
5 import { getSetting } from '@woocommerce/settings';
6 import IntegratedPayment from "./wc-payplug-integratedPayment-blocks";
7 import Popup from "./wc-payplug-popup-blocks";
8 const settings = getSetting( 'payplug_data', {} );
9 const defaultLabel = __('Gateway method title', 'payplug');
10 const label = decodeEntities( settings?.title ) || defaultLabel;
11
12 /**
13 * Content component
14 */
15 const Content = (props) => {
16
17 if(settings?.IP === true){
18 return (
19 <IntegratedPayment settings={settings} props={props} />
20 )
21 }
22
23 if(settings?.popup === true){
24 return (
25 <Popup settings={settings} props={props} />
26 )
27 }
28
29 return window.wp.htmlEntities.decodeEntities( settings?.description || '' );
30
31 };
32 /**
33 * Label component
34 *
35 */
36 const Label = () => {
37 return (
38 <span style={{ width: '100%' }}>
39 {label}
40 <Icon />
41 </span>
42 )
43 }
44
45 const Icon = () => {
46 return (
47 <img src={settings?.icon.src} alt={settings?.icon.icon_alt} className="payplug-payment-icon" style={{float: 'right'}}/>
48 )
49 }
50
51 /**
52 * Payplug payment method config object.
53 */
54 const Payplug = {
55 name: "payplug",
56 label: <Label />,
57 content: <Content />,
58 edit: <Content />,
59 canMakePayment: () => true,
60 ariaLabel: label,
61 supports: {
62 features: settings.supports,
63 showSaveOption: settings?.showSaveOption && settings?.IP,
64 showSavedCards: settings.showSaveOption ?? false
65 },
66 };
67
68 registerPaymentMethod( Payplug );
69
70