-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkout.js
45 lines (40 loc) · 1.55 KB
/
checkout.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const settings = window.wc.wcSettings.getSetting( 'coinpays_payment_gateway_data', {} );
const coinpays_payment_gateway = settings.coinpays_payment_gateway;
const ContentIframe = () => {
return window.wp.htmlEntities.decodeEntities( coinpays_payment_gateway.description);
};
const LabelComponentIframe = () => {
return window.wp.element.createElement(
"div",
{
style: {
display: "flex",
alignItems: "center",
gap: "5px",
},
},
window.wp.element.createElement("img", {
src: coinpays_payment_gateway.icon,
alt: `${coinpays_payment_gateway.title}`,
style: {
width: "100px",
marginRight: "10px",
maxHeight: "20px",
objectFit: "contain",
display: coinpays_payment_gateway.icon ? "block" : "none"
},
}),
window.wp.element.createElement(
"span", null, coinpays_payment_gateway.title
)
)
}
const Block_Gateway_Iframe = {
name: 'coinpays_payment_gateway',
label: window.wp.element.createElement(LabelComponentIframe, null),
content: Object( window.wp.element.createElement )( ContentIframe, null ),
edit: Object( window.wp.element.createElement )( ContentIframe, null ),
canMakePayment: () => true,
ariaLabel: window.wp.htmlEntities.decodeEntities( coinpays_payment_gateway ? coinpays_payment_gateway.title : ''),
};
window.wc.wcBlocksRegistry.registerPaymentMethod( Block_Gateway_Iframe )