PluginProbe
Pay with Vipps and MobilePay for WooCommerce / 6.3.1
Pay with Vipps and MobilePay for WooCommerce v6.3.1
6.3.1 6.2.6 6.3.0 6.2.5 6.2.4 6.2.3 6.2.2 6.2.1 6.2.0 6.1.10 6.1.9 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1.0 6.0.5 6.0.4 6.0.3 6.0.2 6.0.1 All 190 releases
woo-vipps / recurring / assets / js / vipps-recurring-payment-method-block.js

vipps-recurring-payment-method-block.js in Pay with Vipps and MobilePay for WooCommerce 6.3.1, at recurring/assets/js/vipps-recurring-payment-method-block.js

61 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function () {
2 registerVippsRecurringGateway()
3 }());
4
5 function registerVippsRecurringGateway() {
6 const {decodeEntities} = window.wp.htmlEntities;
7 const {getSetting} = window.wc.wcSettings;
8 const {registerPaymentMethod} = window.wc.wcBlocksRegistry;
9 const {applyFilters} = window.wp.hooks;
10
11 const settings = getSetting('vipps_recurring_data', {});
12 const ariaLabel = decodeEntities(settings.title);
13 const logo = settings.logo;
14
15 const Content = () => {
16 const content = React.createElement('div', null, decodeEntities(settings.description || ''));
17 return applyFilters('wc_vipps_recurring_checkout_description', content, settings);
18 };
19
20 const Label = props => {
21 const { PaymentMethodLabel } = props.components;
22
23 const title = decodeEntities(settings.title || '')
24 let label;
25
26 if (logo && logo.length > 0) {
27 label = React.createElement('img', { alt: title, title: title, className: 'vipps-recurring-payment-logo', src: logo });
28 } else {
29 label = React.createElement(PaymentMethodLabel, {
30 text: React.createElement('span', null, title)
31 });
32 }
33
34 return applyFilters('wc_vipps_recurring_checkout_label', label, settings);
35 };
36
37 const canMakePayment = () => {
38 return applyFilters('wc_vipps_recurring_checkout_show_gateway', true, settings);
39 };
40
41 /**
42 * Vipps/MobilePay Recurring payment method config object.
43 */
44 const paymentMethod = {
45 name: 'vipps_recurring',
46 // translators: %s: brand name, Vipps or MobilePay
47 placeOrderButtonLabel: wp.i18n.sprintf(wp.i18n.__("Continue with %s", 'woo-vipps'), settings.title),
48 supports: {
49 features: settings.supports || []
50 },
51 label: React.createElement(Label, null),
52 content: React.createElement(Content, null),
53 edit: React.createElement(Content, null),
54 icons: null,
55 canMakePayment,
56 ariaLabel
57 };
58
59 registerPaymentMethod(paymentMethod);
60 }
61