@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.
Files changed (185) hide show
  1. package/README.md +8 -0
  2. package/__sdk__.js +72 -76
  3. package/dist/button.js +1 -1
  4. package/globals.js +28 -30
  5. package/package.json +6 -4
  6. package/src/constants/button.js +37 -36
  7. package/src/constants/class.js +32 -30
  8. package/src/constants/index.js +3 -3
  9. package/src/constants/misc.js +14 -12
  10. package/src/declarations.js +19 -19
  11. package/src/funding/applepay/config.jsx +51 -50
  12. package/src/funding/applepay/index.js +1 -1
  13. package/src/funding/applepay/style.scoped.scss +1 -1
  14. package/src/funding/applepay/template.jsx +16 -11
  15. package/src/funding/bancontact/config.jsx +48 -37
  16. package/src/funding/bancontact/index.js +1 -2
  17. package/src/funding/blik/config.jsx +48 -37
  18. package/src/funding/blik/index.js +1 -2
  19. package/src/funding/boleto/config.jsx +50 -39
  20. package/src/funding/boleto/index.js +1 -2
  21. package/src/funding/card/amex/config.js +9 -8
  22. package/src/funding/card/amex/index.js +1 -2
  23. package/src/funding/card/config.jsx +246 -177
  24. package/src/funding/card/discover/config.js +9 -7
  25. package/src/funding/card/discover/index.js +1 -2
  26. package/src/funding/card/elo/config.js +6 -7
  27. package/src/funding/card/elo/index.js +1 -2
  28. package/src/funding/card/hiper/config.js +9 -7
  29. package/src/funding/card/hiper/index.js +1 -2
  30. package/src/funding/card/index.js +1 -1
  31. package/src/funding/card/jcb/config.js +6 -7
  32. package/src/funding/card/jcb/index.js +1 -2
  33. package/src/funding/card/mastercard/config.js +9 -7
  34. package/src/funding/card/mastercard/index.js +1 -2
  35. package/src/funding/card/visa/config.js +9 -7
  36. package/src/funding/card/visa/index.js +1 -2
  37. package/src/funding/common.jsx +242 -216
  38. package/src/funding/config.js +212 -65
  39. package/src/funding/content.jsx +1946 -337
  40. package/src/funding/credit/config.jsx +74 -57
  41. package/src/funding/credit/index.js +1 -2
  42. package/src/funding/eps/config.jsx +45 -37
  43. package/src/funding/eps/index.js +1 -2
  44. package/src/funding/funding.js +193 -100
  45. package/src/funding/giropay/config.jsx +48 -38
  46. package/src/funding/giropay/index.js +1 -2
  47. package/src/funding/ideal/config.jsx +48 -37
  48. package/src/funding/ideal/index.js +1 -2
  49. package/src/funding/index.js +2 -2
  50. package/src/funding/itau/config.jsx +41 -41
  51. package/src/funding/itau/index.js +1 -1
  52. package/src/funding/maxima/config.jsx +25 -19
  53. package/src/funding/maxima/index.js +1 -2
  54. package/src/funding/mercadopago/config.jsx +48 -37
  55. package/src/funding/mercadopago/index.js +1 -2
  56. package/src/funding/multibanco/config.jsx +50 -39
  57. package/src/funding/multibanco/index.js +1 -2
  58. package/src/funding/mybank/config.jsx +48 -37
  59. package/src/funding/mybank/index.js +1 -2
  60. package/src/funding/oxxo/config.jsx +50 -39
  61. package/src/funding/oxxo/index.js +1 -2
  62. package/src/funding/p24/config.jsx +45 -37
  63. package/src/funding/p24/index.js +1 -2
  64. package/src/funding/paidy/config.jsx +50 -39
  65. package/src/funding/paidy/index.js +1 -1
  66. package/src/funding/paylater/config.jsx +118 -111
  67. package/src/funding/paylater/index.js +1 -2
  68. package/src/funding/paypal/config.jsx +44 -46
  69. package/src/funding/paypal/index.js +1 -2
  70. package/src/funding/paypal/style.scoped.scss +80 -74
  71. package/src/funding/paypal/template.jsx +450 -354
  72. package/src/funding/payu/config.jsx +50 -39
  73. package/src/funding/payu/index.js +1 -1
  74. package/src/funding/satispay/config.jsx +50 -39
  75. package/src/funding/satispay/index.js +1 -1
  76. package/src/funding/sepa/config.jsx +19 -13
  77. package/src/funding/sepa/index.js +1 -2
  78. package/src/funding/sofort/config.jsx +48 -37
  79. package/src/funding/sofort/index.js +1 -2
  80. package/src/funding/trustly/config.jsx +50 -39
  81. package/src/funding/trustly/index.js +1 -2
  82. package/src/funding/venmo/config.jsx +80 -75
  83. package/src/funding/venmo/index.js +1 -2
  84. package/src/funding/venmo/style.scoped.scss +30 -32
  85. package/src/funding/venmo/template.jsx +56 -57
  86. package/src/funding/verkkopankki/config.jsx +50 -39
  87. package/src/funding/verkkopankki/index.js +1 -1
  88. package/src/funding/wechatpay/config.jsx +48 -37
  89. package/src/funding/wechatpay/index.js +1 -2
  90. package/src/funding/zimpler/config.jsx +19 -13
  91. package/src/funding/zimpler/index.js +1 -2
  92. package/src/interface/button.js +60 -44
  93. package/src/interface/card-fields.js +11 -8
  94. package/src/interface/fields.js +7 -4
  95. package/src/interface/marks.js +4 -4
  96. package/src/interface/payment-fields.js +7 -4
  97. package/src/interface/wallet.js +4 -4
  98. package/src/lib/errors.js +7 -7
  99. package/src/lib/index.js +5 -5
  100. package/src/lib/isRTLLanguage.js +3 -3
  101. package/src/lib/perceived-latency-instrumentation.js +54 -36
  102. package/src/lib/security.js +21 -17
  103. package/src/lib/session.js +39 -35
  104. package/src/marks/component.jsx +114 -65
  105. package/src/marks/index.js +1 -2
  106. package/src/marks/template.jsx +79 -65
  107. package/src/types.js +48 -48
  108. package/src/ui/buttons/button.jsx +311 -249
  109. package/src/ui/buttons/buttonDesigns/control.jsx +3 -5
  110. package/src/ui/buttons/buttonDesigns/divideLogoAnimation.jsx +127 -99
  111. package/src/ui/buttons/buttonDesigns/index.js +78 -75
  112. package/src/ui/buttons/buttonDesigns/inlineLogoTextDesign.jsx +102 -82
  113. package/src/ui/buttons/buttonDesigns/script.jsx +24 -18
  114. package/src/ui/buttons/buttonDesigns/types.js +6 -7
  115. package/src/ui/buttons/buttons.jsx +318 -212
  116. package/src/ui/buttons/config.js +62 -59
  117. package/src/ui/buttons/content.jsx +304 -119
  118. package/src/ui/buttons/index.js +1 -1
  119. package/src/ui/buttons/menu-button/index.js +1 -1
  120. package/src/ui/buttons/menu-button/menu-button.jsx +29 -22
  121. package/src/ui/buttons/menu-button/menu-button.scoped.scss +16 -17
  122. package/src/ui/buttons/poweredBy.jsx +23 -23
  123. package/src/ui/buttons/props.js +680 -529
  124. package/src/ui/buttons/script.jsx +182 -160
  125. package/src/ui/buttons/spinner.jsx +4 -6
  126. package/src/ui/buttons/style.jsx +15 -14
  127. package/src/ui/buttons/styles/base.js +24 -16
  128. package/src/ui/buttons/styles/button.js +24 -22
  129. package/src/ui/buttons/styles/color.js +118 -118
  130. package/src/ui/buttons/styles/custom.js +30 -24
  131. package/src/ui/buttons/styles/index.js +1 -1
  132. package/src/ui/buttons/styles/labels.js +17 -13
  133. package/src/ui/buttons/styles/page.js +3 -3
  134. package/src/ui/buttons/styles/responsive.js +226 -118
  135. package/src/ui/buttons/tagline.jsx +53 -54
  136. package/src/ui/chevron.jsx +27 -16
  137. package/src/ui/index.js +3 -3
  138. package/src/ui/loading.jsx +25 -18
  139. package/src/ui/text/index.js +1 -1
  140. package/src/ui/text/style.scoped.scss +25 -26
  141. package/src/ui/text/text.jsx +42 -20
  142. package/src/ui/tracking.jsx +18 -11
  143. package/src/zoid/buttons/component.jsx +836 -684
  144. package/src/zoid/buttons/container.jsx +140 -107
  145. package/src/zoid/buttons/index.js +1 -1
  146. package/src/zoid/buttons/prerender.jsx +84 -64
  147. package/src/zoid/buttons/util.js +355 -254
  148. package/src/zoid/card-fields/component.jsx +581 -549
  149. package/src/zoid/card-fields/index.js +1 -1
  150. package/src/zoid/card-fields/prerender.jsx +20 -17
  151. package/src/zoid/card-form/component.js +155 -141
  152. package/src/zoid/card-form/index.js +1 -1
  153. package/src/zoid/checkout/component.jsx +314 -282
  154. package/src/zoid/checkout/config.js +2 -2
  155. package/src/zoid/checkout/content.js +190 -154
  156. package/src/zoid/checkout/hacks.js +31 -28
  157. package/src/zoid/checkout/index.js +2 -2
  158. package/src/zoid/checkout/props.js +27 -33
  159. package/src/zoid/installments/component.jsx +83 -70
  160. package/src/zoid/installments/index.js +1 -1
  161. package/src/zoid/installments/props.js +1 -1
  162. package/src/zoid/menu/component.jsx +53 -48
  163. package/src/zoid/menu/index.js +1 -1
  164. package/src/zoid/menu/props.js +1 -3
  165. package/src/zoid/modal/component.jsx +119 -106
  166. package/src/zoid/modal/index.js +1 -1
  167. package/src/zoid/modal/props.js +1 -3
  168. package/src/zoid/payment-fields/component.jsx +215 -191
  169. package/src/zoid/payment-fields/container.jsx +73 -64
  170. package/src/zoid/payment-fields/index.js +1 -1
  171. package/src/zoid/payment-fields/prerender.jsx +16 -14
  172. package/src/zoid/payment-fields/props.js +6 -6
  173. package/src/zoid/qr-code/component.jsx +131 -115
  174. package/src/zoid/qr-code/container.jsx +74 -68
  175. package/src/zoid/qr-code/index.js +1 -1
  176. package/src/zoid/qr-code/prerender.jsx +17 -12
  177. package/src/zoid/qr-code/types.js +2 -2
  178. package/src/zoid/wallet/component.jsx +298 -260
  179. package/src/zoid/wallet/container.jsx +73 -64
  180. package/src/zoid/wallet/index.js +1 -1
  181. package/src/zoid/wallet/prerender.jsx +14 -14
  182. package/src/zoid/wallet/props.js +4 -4
  183. package/src/actions/save/index.js +0 -40
  184. package/src/interface/actions.js +0 -14
  185. package/src/lib/getLogoCDNExperiment.js +0 -25
@@ -2,292 +2,324 @@
2
2
  /** @jsx node */
3
3
  /* eslint max-lines: 0 */
4
4
 
5
- import { node, dom } from '@krakenjs/jsx-pragmatic/src';
5
+ import { node, dom } from "@krakenjs/jsx-pragmatic/src";
6
6
  import {
7
- getPayPalDomainRegex, getLogger, getLocale,
8
- getEnv, getClientID, getCommit, getSDKMeta, getCSPNonce, getBuyerCountry, getVersion, getPayPalDomain, getClientMetadataID
9
- } from '@paypal/sdk-client/src';
10
- import { ZalgoPromise } from '@krakenjs/zalgo-promise/src';
11
- import { create, CONTEXT, type ZoidComponent, EVENT } from '@krakenjs/zoid/src';
12
- import { isDevice, memoize, noop, supportsPopups, inlineMemoize } from '@krakenjs/belter/src';
13
- import { FUNDING } from '@paypal/sdk-constants/src';
14
- import { SpinnerPage, Overlay } from '@paypal/common-components/src';
15
-
16
- import { getSessionID } from '../../lib';
17
-
18
- import type { CheckoutPropsType } from './props';
19
- import { containerContent } from './content';
20
- import { fixCreditRedirect } from './hacks';
21
- import { DEFAULT_POPUP_SIZE } from './config';
7
+ getPayPalDomainRegex,
8
+ getLogger,
9
+ getLocale,
10
+ getEnv,
11
+ getClientID,
12
+ getCommit,
13
+ getSDKMeta,
14
+ getCSPNonce,
15
+ getBuyerCountry,
16
+ getVersion,
17
+ getPayPalDomain,
18
+ getClientMetadataID,
19
+ } from "@paypal/sdk-client/src";
20
+ import { ZalgoPromise } from "@krakenjs/zalgo-promise/src";
21
+ import { create, CONTEXT, type ZoidComponent, EVENT } from "@krakenjs/zoid/src";
22
+ import {
23
+ isDevice,
24
+ memoize,
25
+ noop,
26
+ supportsPopups,
27
+ inlineMemoize,
28
+ } from "@krakenjs/belter/src";
29
+ import { FUNDING } from "@paypal/sdk-constants/src";
30
+ import { SpinnerPage, Overlay } from "@paypal/common-components/src";
31
+
32
+ import { getSessionID } from "../../lib";
33
+
34
+ import type { CheckoutPropsType } from "./props";
35
+ import { containerContent } from "./content";
36
+ import { fixCreditRedirect } from "./hacks";
37
+ import { DEFAULT_POPUP_SIZE } from "./config";
22
38
 
23
39
  export type CheckoutComponent = ZoidComponent<CheckoutPropsType>;
24
40
 
25
- export function getCheckoutComponent() : CheckoutComponent {
26
- return inlineMemoize(getCheckoutComponent, () => {
27
- const component = create({
28
- tag: 'paypal-checkout',
29
- url: () => `${ getPayPalDomain() }${ __PAYPAL_CHECKOUT__.__URI__.__CHECKOUT__ }`,
30
-
31
- attributes: {
32
- iframe: {
33
- scrolling: 'yes'
34
- }
35
- },
36
-
37
- defaultContext: supportsPopups() ? CONTEXT.POPUP : CONTEXT.IFRAME,
38
-
39
- domain: getPayPalDomainRegex(),
40
-
41
- logger: getLogger(),
42
-
43
- prerenderTemplate: ({ doc, props }) => {
44
- const { nonce } = props;
45
- return (
46
- <SpinnerPage
47
- nonce={ nonce }
48
- />
49
- ).render(dom({ doc }));
50
- },
51
-
52
- containerTemplate: ({ context, close, focus, doc, event, frame, prerenderFrame, props }) => {
53
- const { nonce, locale: { lang }, inlinexo } = props;
54
- const content = containerContent[lang];
55
- return (
56
- <Overlay
57
- context={ context }
58
- close={ close }
59
- focus={ focus }
60
- event={ event }
61
- frame={ frame }
62
- prerenderFrame={ prerenderFrame }
63
- content={ content }
64
- nonce={ nonce }
65
- fullScreen={ inlinexo === true }
66
- />
67
- ).render(dom({ doc }));
68
- },
69
-
70
- props: {
71
- clientID: {
72
- type: 'string',
73
- value: () => getClientID(),
74
- queryParam: true
75
- },
76
-
77
- sessionID: {
78
- type: 'string',
79
- value: getSessionID,
80
- queryParam: true
81
- },
82
-
83
- buttonSessionID: {
84
- type: 'string',
85
- queryParam: true,
86
- required: false
87
- },
88
-
89
- stickinessID: {
90
- type: 'string',
91
- queryParam: true,
92
- required: false
93
- },
94
-
95
- env: {
96
- type: 'string',
97
- queryParam: true,
98
- value: getEnv
99
- },
100
-
101
- sdkMeta: {
102
- type: 'string',
103
- queryParam: true,
104
- value: getSDKMeta
105
- },
106
-
107
- nonce: {
108
- type: 'string',
109
- required: false,
110
- value: getCSPNonce,
111
- allowDelegate: true
112
- },
113
-
114
- createAuthCode: {
115
- type: 'function',
116
- queryParam: 'code',
117
- required: false,
118
- // $FlowFixMe
119
- queryValue: ({ value }) => ZalgoPromise.try(value),
120
- // $FlowFixMe
121
- decorate: ({ value }) => memoize(value)
122
- },
123
-
124
- buyerCountry: {
125
- type: 'string',
126
- queryParam: true,
127
- required: false,
128
- default: getBuyerCountry
129
- },
130
-
131
- locale: {
132
- type: 'object',
133
- queryParam: 'locale.x',
134
- allowDelegate: true,
135
- queryValue: ({ value }) => `${ value.lang }_${ value.country }`,
136
- value: getLocale
137
- },
138
-
139
- createOrder: {
140
- type: 'function',
141
- queryParam: 'token',
142
- alias: 'payment',
143
- // $FlowFixMe
144
- queryValue: ({ value }) => ZalgoPromise.try(value),
145
- decorate: ({ value }) => memoize(value)
146
- },
147
-
148
- xcomponent: {
149
- type: 'string',
150
- queryParam: true,
151
- value: () => '1'
152
- },
153
-
154
- version: {
155
- type: 'string',
156
- queryParam: true,
157
- value: getVersion
158
- },
159
-
160
- commit: {
161
- type: 'boolean',
162
- queryParam: true,
163
- value: getCommit
164
- },
165
-
166
- fundingSource: {
167
- type: 'string',
168
- queryParam: true,
169
- default: () => FUNDING.PAYPAL
170
- },
171
-
172
- standaloneFundingSource: {
173
- type: 'string',
174
- queryParam: true,
175
- required: false
176
- },
177
-
178
- branded: {
179
- type: 'boolean',
180
- queryParam: true,
181
- required: false
182
- },
183
-
184
- enableFunding: {
185
- type: 'array',
186
- queryParam: true,
187
- required: false
188
- },
189
-
190
- onApprove: {
191
- type: 'function',
192
- alias: 'onAuthorize'
193
- },
194
-
195
- onComplete: {
196
- type: 'function',
197
- required: false
198
- },
199
-
200
- onShippingChange: {
201
- type: 'function',
202
- required: false
203
- },
204
-
205
- onShippingAddressChange: {
206
- type: 'function',
207
- required: false
208
- },
209
-
210
- onShippingOptionsChange: {
211
- type: 'function',
212
- required: false
213
- },
214
-
215
- clientMetadataID: {
216
- type: 'string',
217
- required: false,
218
- default: getClientMetadataID,
219
- queryParam: 'client-metadata-id'
220
- },
221
-
222
- onAuth: {
223
- type: 'function',
224
- required: false,
225
- sameDomain: true
226
- },
227
-
228
- onSmartWalletEligible: {
229
- type: 'function',
230
- required: false,
231
- sameDomain: true
232
- },
233
-
234
- accessToken: {
235
- type: 'string',
236
- required: false
237
- },
238
-
239
- onCancel: {
240
- type: 'function',
241
- required: false
242
- },
243
-
244
- onFocused: {
245
- type: 'function',
246
- value: ({ event }) => {
247
- return (handler) => event.on(EVENT.FOCUS, handler);
248
- }
249
- },
250
-
251
- test: {
252
- type: 'object',
253
- default: () => (window.__test__ || { action: 'checkout' })
254
- },
255
-
256
- inlinexo: {
257
- type: 'boolean',
258
- required: false,
259
- queryParam: true,
260
- allowDelegate: true
261
- },
262
-
263
- smokeHash: {
264
- type: 'string',
265
- required: false,
266
- queryParam: true
267
- }
268
- },
269
-
270
- dimensions: ({ props }) => {
271
- if (typeof props.dimensions === 'object') {
272
- return { width: `${ props.dimensions.width }px`, height: `${ props.dimensions.height }px` };
273
- } else {
274
- return isDevice()
275
- ? { width: '100%', height: `${ DEFAULT_POPUP_SIZE.HEIGHT }px` }
276
- : { width: `${ DEFAULT_POPUP_SIZE.WIDTH }px`, height: `${ DEFAULT_POPUP_SIZE.HEIGHT }px` };
277
- }
278
- }
279
- });
280
-
281
- if (component.isChild()) {
282
- window.xchild = {
283
- props: component.xprops,
284
- show: noop,
285
- hide: noop
286
- };
287
-
288
- fixCreditRedirect();
41
+ export function getCheckoutComponent(): CheckoutComponent {
42
+ return inlineMemoize(getCheckoutComponent, () => {
43
+ const component = create({
44
+ tag: "paypal-checkout",
45
+ url: () =>
46
+ `${getPayPalDomain()}${__PAYPAL_CHECKOUT__.__URI__.__CHECKOUT__}`,
47
+
48
+ attributes: {
49
+ iframe: {
50
+ scrolling: "yes",
51
+ },
52
+ },
53
+
54
+ defaultContext: supportsPopups() ? CONTEXT.POPUP : CONTEXT.IFRAME,
55
+
56
+ domain: getPayPalDomainRegex(),
57
+
58
+ logger: getLogger(),
59
+
60
+ prerenderTemplate: ({ doc, props }) => {
61
+ const { nonce } = props;
62
+ return (<SpinnerPage nonce={nonce} />).render(dom({ doc }));
63
+ },
64
+
65
+ containerTemplate: ({
66
+ context,
67
+ close,
68
+ focus,
69
+ doc,
70
+ event,
71
+ frame,
72
+ prerenderFrame,
73
+ props,
74
+ }) => {
75
+ const {
76
+ nonce,
77
+ locale: { lang },
78
+ inlinexo,
79
+ } = props;
80
+ const content = containerContent[lang];
81
+ return (
82
+ <Overlay
83
+ context={context}
84
+ close={close}
85
+ focus={focus}
86
+ event={event}
87
+ frame={frame}
88
+ prerenderFrame={prerenderFrame}
89
+ content={content}
90
+ nonce={nonce}
91
+ fullScreen={inlinexo === true}
92
+ />
93
+ ).render(dom({ doc }));
94
+ },
95
+
96
+ props: {
97
+ clientID: {
98
+ type: "string",
99
+ value: () => getClientID(),
100
+ queryParam: true,
101
+ },
102
+
103
+ sessionID: {
104
+ type: "string",
105
+ value: getSessionID,
106
+ queryParam: true,
107
+ },
108
+
109
+ buttonSessionID: {
110
+ type: "string",
111
+ queryParam: true,
112
+ required: false,
113
+ },
114
+
115
+ stickinessID: {
116
+ type: "string",
117
+ queryParam: true,
118
+ required: false,
119
+ },
120
+
121
+ env: {
122
+ type: "string",
123
+ queryParam: true,
124
+ value: getEnv,
125
+ },
126
+
127
+ sdkMeta: {
128
+ type: "string",
129
+ queryParam: true,
130
+ value: getSDKMeta,
131
+ },
132
+
133
+ nonce: {
134
+ type: "string",
135
+ required: false,
136
+ value: getCSPNonce,
137
+ allowDelegate: true,
138
+ },
139
+
140
+ createAuthCode: {
141
+ type: "function",
142
+ queryParam: "code",
143
+ required: false,
144
+ // $FlowFixMe
145
+ queryValue: ({ value }) => ZalgoPromise.try(value),
146
+ // $FlowFixMe
147
+ decorate: ({ value }) => memoize(value),
148
+ },
149
+
150
+ buyerCountry: {
151
+ type: "string",
152
+ queryParam: true,
153
+ required: false,
154
+ default: getBuyerCountry,
155
+ },
156
+
157
+ locale: {
158
+ type: "object",
159
+ queryParam: "locale.x",
160
+ allowDelegate: true,
161
+ queryValue: ({ value }) => `${value.lang}_${value.country}`,
162
+ value: getLocale,
163
+ },
164
+
165
+ createOrder: {
166
+ type: "function",
167
+ queryParam: "token",
168
+ alias: "payment",
169
+ // $FlowFixMe
170
+ queryValue: ({ value }) => ZalgoPromise.try(value),
171
+ decorate: ({ value }) => memoize(value),
172
+ },
173
+
174
+ xcomponent: {
175
+ type: "string",
176
+ queryParam: true,
177
+ value: () => "1",
178
+ },
179
+
180
+ version: {
181
+ type: "string",
182
+ queryParam: true,
183
+ value: getVersion,
184
+ },
185
+
186
+ commit: {
187
+ type: "boolean",
188
+ queryParam: true,
189
+ value: getCommit,
190
+ },
191
+
192
+ fundingSource: {
193
+ type: "string",
194
+ queryParam: true,
195
+ default: () => FUNDING.PAYPAL,
196
+ },
197
+
198
+ standaloneFundingSource: {
199
+ type: "string",
200
+ queryParam: true,
201
+ required: false,
202
+ },
203
+
204
+ branded: {
205
+ type: "boolean",
206
+ queryParam: true,
207
+ required: false,
208
+ },
209
+
210
+ enableFunding: {
211
+ type: "array",
212
+ queryParam: true,
213
+ required: false,
214
+ },
215
+
216
+ onApprove: {
217
+ type: "function",
218
+ alias: "onAuthorize",
219
+ },
220
+
221
+ onComplete: {
222
+ type: "function",
223
+ required: false,
224
+ },
225
+
226
+ onShippingChange: {
227
+ type: "function",
228
+ required: false,
229
+ },
230
+
231
+ onShippingAddressChange: {
232
+ type: "function",
233
+ required: false,
234
+ },
235
+
236
+ onShippingOptionsChange: {
237
+ type: "function",
238
+ required: false,
239
+ },
240
+
241
+ clientMetadataID: {
242
+ type: "string",
243
+ required: false,
244
+ default: getClientMetadataID,
245
+ queryParam: "client-metadata-id",
246
+ },
247
+
248
+ onAuth: {
249
+ type: "function",
250
+ required: false,
251
+ sameDomain: true,
252
+ },
253
+
254
+ onSmartWalletEligible: {
255
+ type: "function",
256
+ required: false,
257
+ sameDomain: true,
258
+ },
259
+
260
+ accessToken: {
261
+ type: "string",
262
+ required: false,
263
+ },
264
+
265
+ onCancel: {
266
+ type: "function",
267
+ required: false,
268
+ },
269
+
270
+ onFocused: {
271
+ type: "function",
272
+ value: ({ event }) => {
273
+ return (handler) => event.on(EVENT.FOCUS, handler);
274
+ },
275
+ },
276
+
277
+ test: {
278
+ type: "object",
279
+ default: () => window.__test__ || { action: "checkout" },
280
+ },
281
+
282
+ inlinexo: {
283
+ type: "boolean",
284
+ required: false,
285
+ queryParam: true,
286
+ allowDelegate: true,
287
+ },
288
+
289
+ smokeHash: {
290
+ type: "string",
291
+ required: false,
292
+ queryParam: true,
293
+ },
294
+ },
295
+
296
+ dimensions: ({ props }) => {
297
+ if (typeof props.dimensions === "object") {
298
+ return {
299
+ width: `${props.dimensions.width}px`,
300
+ height: `${props.dimensions.height}px`,
301
+ };
302
+ } else {
303
+ return isDevice()
304
+ ? { width: "100%", height: `${DEFAULT_POPUP_SIZE.HEIGHT}px` }
305
+ : {
306
+ width: `${DEFAULT_POPUP_SIZE.WIDTH}px`,
307
+ height: `${DEFAULT_POPUP_SIZE.HEIGHT}px`,
308
+ };
289
309
  }
290
-
291
- return component;
310
+ },
292
311
  });
312
+
313
+ if (component.isChild()) {
314
+ window.xchild = {
315
+ props: component.xprops,
316
+ show: noop,
317
+ hide: noop,
318
+ };
319
+
320
+ fixCreditRedirect();
321
+ }
322
+
323
+ return component;
324
+ });
293
325
  }
@@ -1,6 +1,6 @@
1
1
  /* @flow */
2
2
 
3
3
  export const DEFAULT_POPUP_SIZE = {
4
- WIDTH: 500,
5
- HEIGHT: 590
4
+ WIDTH: 500,
5
+ HEIGHT: 590,
6
6
  };