@paypal/checkout-components 5.0.256 → 5.0.258
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/__sdk__.js +72 -76
- package/dist/button.js +1 -1
- package/globals.js +28 -30
- package/package.json +6 -4
- package/src/constants/button.js +37 -36
- package/src/constants/class.js +32 -30
- package/src/constants/index.js +3 -3
- package/src/constants/misc.js +14 -12
- package/src/declarations.js +19 -19
- package/src/funding/applepay/config.jsx +51 -50
- package/src/funding/applepay/index.js +1 -1
- package/src/funding/applepay/style.scoped.scss +1 -1
- package/src/funding/applepay/template.jsx +16 -11
- package/src/funding/bancontact/config.jsx +48 -37
- package/src/funding/bancontact/index.js +1 -2
- package/src/funding/blik/config.jsx +48 -37
- package/src/funding/blik/index.js +1 -2
- package/src/funding/boleto/config.jsx +50 -39
- package/src/funding/boleto/index.js +1 -2
- package/src/funding/card/amex/config.js +9 -8
- package/src/funding/card/amex/index.js +1 -2
- package/src/funding/card/config.jsx +246 -177
- package/src/funding/card/discover/config.js +9 -7
- package/src/funding/card/discover/index.js +1 -2
- package/src/funding/card/elo/config.js +6 -7
- package/src/funding/card/elo/index.js +1 -2
- package/src/funding/card/hiper/config.js +9 -7
- package/src/funding/card/hiper/index.js +1 -2
- package/src/funding/card/index.js +1 -1
- package/src/funding/card/jcb/config.js +6 -7
- package/src/funding/card/jcb/index.js +1 -2
- package/src/funding/card/mastercard/config.js +9 -7
- package/src/funding/card/mastercard/index.js +1 -2
- package/src/funding/card/visa/config.js +9 -7
- package/src/funding/card/visa/index.js +1 -2
- package/src/funding/common.jsx +242 -216
- package/src/funding/config.js +212 -65
- package/src/funding/content.jsx +1946 -337
- package/src/funding/credit/config.jsx +74 -57
- package/src/funding/credit/index.js +1 -2
- package/src/funding/eps/config.jsx +45 -37
- package/src/funding/eps/index.js +1 -2
- package/src/funding/funding.js +193 -100
- package/src/funding/giropay/config.jsx +48 -38
- package/src/funding/giropay/index.js +1 -2
- package/src/funding/ideal/config.jsx +48 -37
- package/src/funding/ideal/index.js +1 -2
- package/src/funding/index.js +2 -2
- package/src/funding/itau/config.jsx +41 -41
- package/src/funding/itau/index.js +1 -1
- package/src/funding/maxima/config.jsx +25 -19
- package/src/funding/maxima/index.js +1 -2
- package/src/funding/mercadopago/config.jsx +48 -37
- package/src/funding/mercadopago/index.js +1 -2
- package/src/funding/multibanco/config.jsx +50 -39
- package/src/funding/multibanco/index.js +1 -2
- package/src/funding/mybank/config.jsx +48 -37
- package/src/funding/mybank/index.js +1 -2
- package/src/funding/oxxo/config.jsx +50 -39
- package/src/funding/oxxo/index.js +1 -2
- package/src/funding/p24/config.jsx +45 -37
- package/src/funding/p24/index.js +1 -2
- package/src/funding/paidy/config.jsx +50 -39
- package/src/funding/paidy/index.js +1 -1
- package/src/funding/paylater/config.jsx +118 -111
- package/src/funding/paylater/index.js +1 -2
- package/src/funding/paypal/config.jsx +44 -46
- package/src/funding/paypal/index.js +1 -2
- package/src/funding/paypal/style.scoped.scss +80 -74
- package/src/funding/paypal/template.jsx +450 -354
- package/src/funding/payu/config.jsx +50 -39
- package/src/funding/payu/index.js +1 -1
- package/src/funding/satispay/config.jsx +50 -39
- package/src/funding/satispay/index.js +1 -1
- package/src/funding/sepa/config.jsx +19 -13
- package/src/funding/sepa/index.js +1 -2
- package/src/funding/sofort/config.jsx +48 -37
- package/src/funding/sofort/index.js +1 -2
- package/src/funding/trustly/config.jsx +50 -39
- package/src/funding/trustly/index.js +1 -2
- package/src/funding/venmo/config.jsx +80 -75
- package/src/funding/venmo/index.js +1 -2
- package/src/funding/venmo/style.scoped.scss +30 -32
- package/src/funding/venmo/template.jsx +56 -57
- package/src/funding/verkkopankki/config.jsx +50 -39
- package/src/funding/verkkopankki/index.js +1 -1
- package/src/funding/wechatpay/config.jsx +48 -37
- package/src/funding/wechatpay/index.js +1 -2
- package/src/funding/zimpler/config.jsx +19 -13
- package/src/funding/zimpler/index.js +1 -2
- package/src/interface/button.js +60 -44
- package/src/interface/card-fields.js +11 -8
- package/src/interface/fields.js +7 -4
- package/src/interface/marks.js +4 -4
- package/src/interface/payment-fields.js +7 -4
- package/src/interface/wallet.js +4 -4
- package/src/lib/errors.js +7 -7
- package/src/lib/index.js +5 -5
- package/src/lib/isRTLLanguage.js +3 -3
- package/src/lib/perceived-latency-instrumentation.js +54 -36
- package/src/lib/security.js +21 -17
- package/src/lib/session.js +39 -35
- package/src/marks/component.jsx +114 -65
- package/src/marks/index.js +1 -2
- package/src/marks/template.jsx +79 -65
- package/src/types.js +48 -48
- package/src/ui/buttons/button.jsx +311 -249
- package/src/ui/buttons/buttonDesigns/control.jsx +3 -5
- package/src/ui/buttons/buttonDesigns/divideLogoAnimation.jsx +127 -99
- package/src/ui/buttons/buttonDesigns/index.js +78 -75
- package/src/ui/buttons/buttonDesigns/inlineLogoTextDesign.jsx +102 -82
- package/src/ui/buttons/buttonDesigns/script.jsx +24 -18
- package/src/ui/buttons/buttonDesigns/types.js +6 -7
- package/src/ui/buttons/buttons.jsx +318 -212
- package/src/ui/buttons/config.js +62 -59
- package/src/ui/buttons/content.jsx +304 -119
- package/src/ui/buttons/index.js +1 -1
- package/src/ui/buttons/menu-button/index.js +1 -1
- package/src/ui/buttons/menu-button/menu-button.jsx +29 -22
- package/src/ui/buttons/menu-button/menu-button.scoped.scss +16 -17
- package/src/ui/buttons/poweredBy.jsx +23 -23
- package/src/ui/buttons/props.js +680 -529
- package/src/ui/buttons/script.jsx +182 -160
- package/src/ui/buttons/spinner.jsx +4 -6
- package/src/ui/buttons/style.jsx +15 -14
- package/src/ui/buttons/styles/base.js +24 -16
- package/src/ui/buttons/styles/button.js +24 -22
- package/src/ui/buttons/styles/color.js +118 -118
- package/src/ui/buttons/styles/custom.js +30 -24
- package/src/ui/buttons/styles/index.js +1 -1
- package/src/ui/buttons/styles/labels.js +17 -13
- package/src/ui/buttons/styles/page.js +3 -3
- package/src/ui/buttons/styles/responsive.js +226 -118
- package/src/ui/buttons/tagline.jsx +53 -54
- package/src/ui/chevron.jsx +27 -16
- package/src/ui/index.js +3 -3
- package/src/ui/loading.jsx +25 -18
- package/src/ui/text/index.js +1 -1
- package/src/ui/text/style.scoped.scss +25 -26
- package/src/ui/text/text.jsx +42 -20
- package/src/ui/tracking.jsx +18 -11
- package/src/zoid/buttons/component.jsx +836 -684
- package/src/zoid/buttons/container.jsx +140 -107
- package/src/zoid/buttons/index.js +1 -1
- package/src/zoid/buttons/prerender.jsx +84 -64
- package/src/zoid/buttons/util.js +355 -254
- package/src/zoid/card-fields/component.jsx +581 -549
- package/src/zoid/card-fields/index.js +1 -1
- package/src/zoid/card-fields/prerender.jsx +20 -17
- package/src/zoid/card-form/component.js +155 -141
- package/src/zoid/card-form/index.js +1 -1
- package/src/zoid/checkout/component.jsx +314 -282
- package/src/zoid/checkout/config.js +2 -2
- package/src/zoid/checkout/content.js +190 -154
- package/src/zoid/checkout/hacks.js +31 -28
- package/src/zoid/checkout/index.js +2 -2
- package/src/zoid/checkout/props.js +27 -33
- package/src/zoid/installments/component.jsx +83 -70
- package/src/zoid/installments/index.js +1 -1
- package/src/zoid/installments/props.js +1 -1
- package/src/zoid/menu/component.jsx +53 -48
- package/src/zoid/menu/index.js +1 -1
- package/src/zoid/menu/props.js +1 -3
- package/src/zoid/modal/component.jsx +119 -106
- package/src/zoid/modal/index.js +1 -1
- package/src/zoid/modal/props.js +1 -3
- package/src/zoid/payment-fields/component.jsx +215 -191
- package/src/zoid/payment-fields/container.jsx +73 -64
- package/src/zoid/payment-fields/index.js +1 -1
- package/src/zoid/payment-fields/prerender.jsx +16 -14
- package/src/zoid/payment-fields/props.js +6 -6
- package/src/zoid/qr-code/component.jsx +131 -115
- package/src/zoid/qr-code/container.jsx +74 -68
- package/src/zoid/qr-code/index.js +1 -1
- package/src/zoid/qr-code/prerender.jsx +17 -12
- package/src/zoid/qr-code/types.js +2 -2
- package/src/zoid/wallet/component.jsx +298 -260
- package/src/zoid/wallet/container.jsx +73 -64
- package/src/zoid/wallet/index.js +1 -1
- package/src/zoid/wallet/prerender.jsx +14 -14
- package/src/zoid/wallet/props.js +4 -4
- package/src/actions/save/index.js +0 -40
- package/src/interface/actions.js +0 -14
- package/src/lib/getLogoCDNExperiment.js +0 -25
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/* @flow */
|
|
2
2
|
|
|
3
|
-
import type { LocaleType } from
|
|
3
|
+
import type { LocaleType } from "@paypal/sdk-constants/src";
|
|
4
4
|
|
|
5
|
-
import type { StateGetSet } from
|
|
5
|
+
import type { StateGetSet } from "../../lib";
|
|
6
6
|
|
|
7
7
|
export type PaymentFieldsProps = {|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
nonce: ?string,
|
|
9
|
+
locale: LocaleType,
|
|
10
|
+
storageState: StateGetSet,
|
|
11
|
+
sessionState: StateGetSet,
|
|
12
12
|
|};
|
|
@@ -1,125 +1,141 @@
|
|
|
1
1
|
/* @flow */
|
|
2
2
|
/** @jsx node */
|
|
3
3
|
|
|
4
|
-
import { inlineMemoize, uniqueID } from
|
|
5
|
-
import { create, type ZoidComponent } from
|
|
6
|
-
import {
|
|
4
|
+
import { inlineMemoize, uniqueID } from "@krakenjs/belter/src";
|
|
5
|
+
import { create, type ZoidComponent } from "@krakenjs/zoid/src";
|
|
6
|
+
import {
|
|
7
|
+
getLogger,
|
|
8
|
+
getPayPalDomainRegex,
|
|
9
|
+
getPayPalDomain,
|
|
10
|
+
getCSPNonce,
|
|
11
|
+
getSDKMeta,
|
|
12
|
+
getDebug,
|
|
13
|
+
getEnv,
|
|
14
|
+
getSessionID,
|
|
15
|
+
getLocale,
|
|
16
|
+
getClientID,
|
|
17
|
+
getCorrelationID,
|
|
18
|
+
getBuyerCountry,
|
|
19
|
+
} from "@paypal/sdk-client/src";
|
|
7
20
|
|
|
8
|
-
import { containerTemplate } from
|
|
9
|
-
import { prerenderTemplate } from
|
|
10
|
-
import { type QRCodeProps } from
|
|
21
|
+
import { containerTemplate } from "./container";
|
|
22
|
+
import { prerenderTemplate } from "./prerender";
|
|
23
|
+
import { type QRCodeProps } from "./types";
|
|
11
24
|
|
|
12
25
|
export type QRCodeComponent = ZoidComponent<QRCodeProps>;
|
|
13
26
|
|
|
14
|
-
export function getQRCodeComponent()
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
export function getQRCodeComponent(): QRCodeComponent {
|
|
28
|
+
return inlineMemoize(getQRCodeComponent, () => {
|
|
29
|
+
return create({
|
|
30
|
+
tag: "paypal-qr-modal",
|
|
31
|
+
url: ({ props }) =>
|
|
32
|
+
`${getPayPalDomain()}${__PAYPAL_CHECKOUT__.__URI__.__QRCODE__}?${
|
|
33
|
+
props.qrPath
|
|
34
|
+
}`,
|
|
35
|
+
domain: getPayPalDomainRegex(),
|
|
36
|
+
dimensions: {
|
|
37
|
+
width: "100%",
|
|
38
|
+
height: "100%",
|
|
39
|
+
},
|
|
40
|
+
logger: getLogger(),
|
|
41
|
+
prerenderTemplate,
|
|
26
42
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
});
|
|
43
|
+
containerTemplate,
|
|
44
|
+
autoResize: {
|
|
45
|
+
width: true,
|
|
46
|
+
height: true,
|
|
47
|
+
},
|
|
48
|
+
attributes: {
|
|
49
|
+
iframe: {
|
|
50
|
+
scrolling: "no",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
props: {
|
|
54
|
+
onEscapePath: {
|
|
55
|
+
type: "function",
|
|
56
|
+
required: true,
|
|
57
|
+
},
|
|
58
|
+
qrPath: {
|
|
59
|
+
type: "string",
|
|
60
|
+
queryParam: true,
|
|
61
|
+
required: true,
|
|
62
|
+
},
|
|
63
|
+
cspNonce: {
|
|
64
|
+
type: "string",
|
|
65
|
+
queryParam: false,
|
|
66
|
+
required: false,
|
|
67
|
+
value: getCSPNonce,
|
|
68
|
+
},
|
|
69
|
+
debug: {
|
|
70
|
+
type: "boolean",
|
|
71
|
+
value: getDebug,
|
|
72
|
+
queryParam: true,
|
|
73
|
+
required: false,
|
|
74
|
+
},
|
|
75
|
+
state: {
|
|
76
|
+
type: "string",
|
|
77
|
+
queryParam: false,
|
|
78
|
+
required: false,
|
|
79
|
+
},
|
|
80
|
+
errorText: {
|
|
81
|
+
type: "string",
|
|
82
|
+
queryParam: false,
|
|
83
|
+
required: false,
|
|
84
|
+
},
|
|
85
|
+
sdkMeta: {
|
|
86
|
+
type: "string",
|
|
87
|
+
queryParam: true,
|
|
88
|
+
sendToChild: false,
|
|
89
|
+
value: getSDKMeta,
|
|
90
|
+
},
|
|
91
|
+
env: {
|
|
92
|
+
type: "string",
|
|
93
|
+
queryParam: true,
|
|
94
|
+
required: false,
|
|
95
|
+
value: getEnv,
|
|
96
|
+
},
|
|
97
|
+
sessionID: {
|
|
98
|
+
type: "string",
|
|
99
|
+
queryParam: true,
|
|
100
|
+
required: false,
|
|
101
|
+
value: getSessionID,
|
|
102
|
+
},
|
|
103
|
+
locale: {
|
|
104
|
+
type: "object",
|
|
105
|
+
queryParam: true,
|
|
106
|
+
required: false,
|
|
107
|
+
value: getLocale,
|
|
108
|
+
},
|
|
109
|
+
clientID: {
|
|
110
|
+
type: "string",
|
|
111
|
+
queryParam: true,
|
|
112
|
+
required: false,
|
|
113
|
+
value: getClientID,
|
|
114
|
+
},
|
|
115
|
+
orderID: {
|
|
116
|
+
type: "string",
|
|
117
|
+
queryParam: true,
|
|
118
|
+
required: false,
|
|
119
|
+
},
|
|
120
|
+
sdkCorrelationID: {
|
|
121
|
+
type: "string",
|
|
122
|
+
required: false,
|
|
123
|
+
value: getCorrelationID,
|
|
124
|
+
queryParam: true,
|
|
125
|
+
},
|
|
126
|
+
buyerCountry: {
|
|
127
|
+
type: "string",
|
|
128
|
+
queryParam: true,
|
|
129
|
+
required: false,
|
|
130
|
+
value: getBuyerCountry,
|
|
131
|
+
},
|
|
132
|
+
buttonSessionID: {
|
|
133
|
+
type: "string",
|
|
134
|
+
queryParam: true,
|
|
135
|
+
required: false,
|
|
136
|
+
value: uniqueID,
|
|
137
|
+
},
|
|
138
|
+
},
|
|
124
139
|
});
|
|
140
|
+
});
|
|
125
141
|
}
|
|
@@ -1,64 +1,64 @@
|
|
|
1
1
|
/* @flow */
|
|
2
2
|
/** @jsx node */
|
|
3
3
|
|
|
4
|
-
import { destroyElement, type EventEmitterType } from
|
|
5
|
-
import { EVENT, type RenderOptionsType } from
|
|
6
|
-
import { node, dom, type ChildType } from
|
|
4
|
+
import { destroyElement, type EventEmitterType } from "@krakenjs/belter/src";
|
|
5
|
+
import { EVENT, type RenderOptionsType } from "@krakenjs/zoid/src";
|
|
6
|
+
import { node, dom, type ChildType } from "@krakenjs/jsx-pragmatic/src";
|
|
7
7
|
|
|
8
|
-
import { type QRCodeProps } from
|
|
8
|
+
import { type QRCodeProps } from "./types";
|
|
9
9
|
|
|
10
10
|
const CLASS = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
VISIBLE: "visible",
|
|
12
|
+
INVISIBLE: "invisible",
|
|
13
|
+
COMPONENT_FRAME: "component-frame",
|
|
14
|
+
PRERENDER_FRAME: "prerender-frame",
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
export function QRCodeContainer({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|})
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
18
|
+
uid,
|
|
19
|
+
frame,
|
|
20
|
+
prerenderFrame,
|
|
21
|
+
event,
|
|
22
|
+
cspNonce,
|
|
23
|
+
}: {|
|
|
24
|
+
uid: string,
|
|
25
|
+
frame: ?HTMLIFrameElement,
|
|
26
|
+
prerenderFrame: ?HTMLIFrameElement,
|
|
27
|
+
event: EventEmitterType,
|
|
28
|
+
cspNonce?: ?string,
|
|
29
|
+
|}): ?ChildType {
|
|
30
|
+
if (!frame || !prerenderFrame) {
|
|
31
|
+
throw new Error(`Expected frame and prerenderframe`);
|
|
32
|
+
}
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
frame.classList.add(CLASS.COMPONENT_FRAME);
|
|
35
|
+
prerenderFrame.classList.add(CLASS.PRERENDER_FRAME);
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
frame.classList.add(CLASS.INVISIBLE);
|
|
38
|
+
prerenderFrame.classList.add(CLASS.VISIBLE);
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
event.on(EVENT.RENDERED, () => {
|
|
41
|
+
prerenderFrame.classList.remove(CLASS.VISIBLE);
|
|
42
|
+
prerenderFrame.classList.add(CLASS.INVISIBLE);
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
frame.classList.remove(CLASS.INVISIBLE);
|
|
45
|
+
frame.classList.add(CLASS.VISIBLE);
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
setTimeout(() => {
|
|
48
|
+
destroyElement(prerenderFrame);
|
|
49
|
+
}, 1);
|
|
50
|
+
});
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
return (
|
|
53
|
+
<div id={uid}>
|
|
54
|
+
<style
|
|
55
|
+
nonce={cspNonce}
|
|
56
|
+
innerHTML={`
|
|
57
57
|
* {
|
|
58
58
|
box-sizing: border-box;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
#${
|
|
61
|
+
#${uid} {
|
|
62
62
|
display: flex;
|
|
63
63
|
position: fixed;
|
|
64
64
|
width: 100%;
|
|
@@ -70,7 +70,7 @@ export function QRCodeContainer({
|
|
|
70
70
|
justify-content: center;
|
|
71
71
|
background-color: rgba(0, 0, 0, 0.4);
|
|
72
72
|
}
|
|
73
|
-
#${
|
|
73
|
+
#${uid} iframe {
|
|
74
74
|
display: flex;
|
|
75
75
|
align-items: center;
|
|
76
76
|
justify-content: center;
|
|
@@ -81,10 +81,10 @@ export function QRCodeContainer({
|
|
|
81
81
|
left: 0;
|
|
82
82
|
transition: opacity .2s ease-in-out;
|
|
83
83
|
}
|
|
84
|
-
#${
|
|
84
|
+
#${uid} > iframe.${CLASS.VISIBLE} {
|
|
85
85
|
opacity: 1;
|
|
86
86
|
}
|
|
87
|
-
#${
|
|
87
|
+
#${uid} > iframe.${CLASS.INVISIBLE} {
|
|
88
88
|
opacity: 0;
|
|
89
89
|
pointer-events: none;
|
|
90
90
|
}
|
|
@@ -100,31 +100,37 @@ export function QRCodeContainer({
|
|
|
100
100
|
flex-direction: column;
|
|
101
101
|
position: relative;
|
|
102
102
|
}
|
|
103
|
-
`
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
103
|
+
`}
|
|
104
|
+
/>
|
|
105
|
+
<div id="qrModal">
|
|
106
|
+
<node el={frame} />
|
|
107
|
+
<node el={prerenderFrame} />
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
);
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
export function containerTemplate({
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
export function containerTemplate({
|
|
114
|
+
frame,
|
|
115
|
+
prerenderFrame,
|
|
116
|
+
props,
|
|
117
|
+
doc,
|
|
118
|
+
uid,
|
|
119
|
+
event,
|
|
120
|
+
}: RenderOptionsType<QRCodeProps>): ?HTMLElement {
|
|
121
|
+
if (!frame || !prerenderFrame) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
117
124
|
|
|
118
|
-
|
|
125
|
+
const { cspNonce } = props;
|
|
119
126
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
).render(dom({ doc }));
|
|
127
|
+
return (
|
|
128
|
+
<QRCodeContainer
|
|
129
|
+
uid={uid}
|
|
130
|
+
cspNonce={cspNonce}
|
|
131
|
+
event={event}
|
|
132
|
+
frame={frame}
|
|
133
|
+
prerenderFrame={prerenderFrame}
|
|
134
|
+
/>
|
|
135
|
+
).render(dom({ doc }));
|
|
130
136
|
}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
/* @flow */
|
|
2
2
|
/** @jsx node */
|
|
3
3
|
|
|
4
|
-
import { type RenderOptionsType } from
|
|
5
|
-
import { node, dom } from
|
|
6
|
-
import { SpinnerPage } from
|
|
4
|
+
import { type RenderOptionsType } from "@krakenjs/zoid/src";
|
|
5
|
+
import { node, dom } from "@krakenjs/jsx-pragmatic/src";
|
|
6
|
+
import { SpinnerPage } from "@paypal/common-components/src";
|
|
7
7
|
|
|
8
|
-
import { type QRCodeProps } from
|
|
8
|
+
import { type QRCodeProps } from "./types";
|
|
9
9
|
|
|
10
|
-
export function prerenderTemplate({
|
|
11
|
-
|
|
10
|
+
export function prerenderTemplate({
|
|
11
|
+
doc,
|
|
12
|
+
props,
|
|
13
|
+
close,
|
|
14
|
+
}: RenderOptionsType<QRCodeProps>): ?HTMLElement {
|
|
15
|
+
const style = `
|
|
12
16
|
#close {
|
|
13
17
|
position: absolute;
|
|
14
18
|
right: 16px;
|
|
@@ -37,11 +41,12 @@ export function prerenderTemplate({ doc, props, close } : (RenderOptionsType<QRC
|
|
|
37
41
|
}
|
|
38
42
|
`;
|
|
39
43
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
const children = [
|
|
45
|
+
<style nonce={props.cspNonce} innerHTML={style} />,
|
|
46
|
+
<a href="#" id="close" aria-label="close" role="button" onClick={close} />,
|
|
47
|
+
];
|
|
44
48
|
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
return new SpinnerPage({ nonce: props.cspNonce }, children).render(
|
|
50
|
+
dom({ doc })
|
|
51
|
+
);
|
|
47
52
|
}
|