| 1 |
const settings = window.wc.wcSettings.getSetting("wp_subscription_paypal_data", {}); |
| 2 |
|
| 3 |
const createLabel = (title, iconUrl) => { |
| 4 |
return wp.element.createElement( |
| 5 |
"span", |
| 6 |
{ |
| 7 |
style: { width: "100%" }, |
| 8 |
}, |
| 9 |
title, |
| 10 |
wp.element.createElement("img", { |
| 11 |
src: iconUrl, |
| 12 |
alt: title, |
| 13 |
style: { float: "right" }, |
| 14 |
}), |
| 15 |
); |
| 16 |
}; |
| 17 |
const Content = () => { |
| 18 |
return window.wp.htmlEntities.decodeEntities(settings.description || ""); |
| 19 |
}; |
| 20 |
|
| 21 |
const Block_Gateway = { |
| 22 |
name: "wp_subscription_paypal", |
| 23 |
label: createLabel(settings.title, settings.icon), |
| 24 |
content: Object(window.wp.element.createElement)(Content, null), |
| 25 |
edit: Object(window.wp.element.createElement)(Content, null), |
| 26 |
canMakePayment: () => true, |
| 27 |
ariaLabel: window.wp.htmlEntities.decodeEntities(settings.title) || window.wp.i18n.__("PayPal", "subscription"), |
| 28 |
supports: { |
| 29 |
features: settings.features, |
| 30 |
}, |
| 31 |
}; |
| 32 |
window.wc.wcBlocksRegistry.registerPaymentMethod(Block_Gateway); |
| 33 |
|