@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,370 +2,401 @@
2
2
  /** @jsx node */
3
3
  /* eslint max-lines: 0 */
4
4
 
5
- import { node, dom } from '@krakenjs/jsx-pragmatic/src';
6
- import { ZalgoPromise } from '@krakenjs/zalgo-promise/src';
7
- import { create, type ZoidComponent } from '@krakenjs/zoid/src';
8
- import type { CrossDomainWindowType } from '@krakenjs/cross-domain-utils/src';
9
- import { memoize, uniqueID } from '@krakenjs/belter/src';
10
- import { getLocale, getEnv, getSDKMeta, getDisableCard, getPayPalDomain, getClientID, getDebug, getCurrency, getIntent,
11
- getCommit, getVault, getCorrelationID, getPartnerAttributionID, getMerchantID, getUserIDToken } from '@paypal/sdk-client/src';
12
- import { getRefinedFundingEligibility } from '@paypal/funding-components/src';
13
- import { CARD, CURRENCY, INTENT, type FundingEligibilityType } from '@paypal/sdk-constants/src';
14
-
15
- import { getSessionID } from '../../lib';
16
-
17
- import { CardPrerender } from './prerender';
5
+ import { node, dom } from "@krakenjs/jsx-pragmatic/src";
6
+ import { ZalgoPromise } from "@krakenjs/zalgo-promise/src";
7
+ import { create, type ZoidComponent } from "@krakenjs/zoid/src";
8
+ import type { CrossDomainWindowType } from "@krakenjs/cross-domain-utils/src";
9
+ import { memoize, uniqueID } from "@krakenjs/belter/src";
10
+ import {
11
+ getLocale,
12
+ getEnv,
13
+ getSDKMeta,
14
+ getDisableCard,
15
+ getPayPalDomain,
16
+ getClientID,
17
+ getDebug,
18
+ getCurrency,
19
+ getIntent,
20
+ getCommit,
21
+ getVault,
22
+ getCorrelationID,
23
+ getPartnerAttributionID,
24
+ getMerchantID,
25
+ getUserIDToken,
26
+ } from "@paypal/sdk-client/src";
27
+ import { getRefinedFundingEligibility } from "@paypal/funding-components/src";
28
+ import {
29
+ CARD,
30
+ CURRENCY,
31
+ INTENT,
32
+ type FundingEligibilityType,
33
+ } from "@paypal/sdk-constants/src";
34
+
35
+ import { getSessionID } from "../../lib";
36
+
37
+ import { CardPrerender } from "./prerender";
18
38
 
19
39
  const CARD_FIELD_TYPE = {
20
- SINGLE: 'single',
21
- NUMBER: 'number',
22
- CVV: 'cvv',
23
- EXPIRY: 'expiry',
24
- NAME: 'name',
25
- POSTAL: 'postal'
40
+ SINGLE: "single",
41
+ NUMBER: "number",
42
+ CVV: "cvv",
43
+ EXPIRY: "expiry",
44
+ NAME: "name",
45
+ POSTAL: "postal",
26
46
  };
27
47
 
28
48
  type CardFieldsProps = {|
29
- clientID : string,
30
- style? : {|
31
- height : number
32
- |},
33
- env? : string,
34
- locale? : string,
35
- nonce : string,
36
- logLevel : string,
37
- sessionID : string,
38
- cardFieldsSessionID : string,
39
- debug : boolean,
40
- sdkMeta : string,
41
- fundingEligibility : FundingEligibilityType,
42
- disableCard? : $ReadOnlyArray<$Values<typeof CARD>>,
43
- currency : $Values<typeof CURRENCY>,
44
- intent : $Values<typeof INTENT>,
45
- commit : boolean,
46
- vault : boolean,
47
- branded? : boolean,
48
- minLength?: number,
49
- maxLength?: number,
49
+ clientID: string,
50
+ style?: {|
51
+ height: number,
52
+ |},
53
+ env?: string,
54
+ locale?: string,
55
+ nonce: string,
56
+ logLevel: string,
57
+ sessionID: string,
58
+ cardFieldsSessionID: string,
59
+ debug: boolean,
60
+ sdkMeta: string,
61
+ fundingEligibility: FundingEligibilityType,
62
+ disableCard?: $ReadOnlyArray<$Values<typeof CARD>>,
63
+ currency: $Values<typeof CURRENCY>,
64
+ intent: $Values<typeof INTENT>,
65
+ commit: boolean,
66
+ vault: boolean,
67
+ branded?: boolean,
68
+ minLength?: number,
69
+ maxLength?: number,
70
+ onChange?: () => ZalgoPromise<Object> | Object,
71
+ inputEvents?: {|
50
72
  onChange?: () => ZalgoPromise<Object> | Object,
51
- inputEvents?: {|
52
- onChange?: () => ZalgoPromise<Object> | Object,
53
- onBlur?: () => ZalgoPromise<Object> | Object,
54
- onFocus?: () => ZalgoPromise<Object> | Object,
55
- onInputSubmitRequest?: () => ZalgoPromise<Object> | Object,
56
- |},
57
- createOrder : () => ZalgoPromise<string> | string,
58
- onApprove : ({| returnUrl : string |}, {| redirect : (?CrossDomainWindowType, ?string) => ZalgoPromise<void> |}) => ?ZalgoPromise<void>,
59
- onComplete : ({| returnUrl : string |}, {| redirect : (?CrossDomainWindowType, ?string) => ZalgoPromise<void> |}) => ?ZalgoPromise<void>,
60
- onCancel ? : ({| cancelUrl : string |}, {| redirect : (? CrossDomainWindowType, ? string) => ZalgoPromise<void> |}) => ?ZalgoPromise<void>,
61
- action: Object,
62
- sdkCorrelationID: string,
63
- hcfSessionID: string,
64
- partnerAttributionID: string,
65
- merchantID: $ReadOnlyArray<string>,
66
- save: {|
67
- createVaultSetupToken: () => ZalgoPromise<string>,
68
- onApprove: ({|vaultSetupToken: string|}) => ?ZalgoPromise<void>
69
- |}
73
+ onBlur?: () => ZalgoPromise<Object> | Object,
74
+ onFocus?: () => ZalgoPromise<Object> | Object,
75
+ onInputSubmitRequest?: () => ZalgoPromise<Object> | Object,
76
+ |},
77
+ createOrder: () => ZalgoPromise<string> | string,
78
+ onApprove: (
79
+ {| returnUrl: string |},
80
+ {| redirect: (?CrossDomainWindowType, ?string) => ZalgoPromise<void> |}
81
+ ) => ?ZalgoPromise<void>,
82
+ onComplete: (
83
+ {| returnUrl: string |},
84
+ {| redirect: (?CrossDomainWindowType, ?string) => ZalgoPromise<void> |}
85
+ ) => ?ZalgoPromise<void>,
86
+ onCancel?: (
87
+ {| cancelUrl: string |},
88
+ {| redirect: (?CrossDomainWindowType, ?string) => ZalgoPromise<void> |}
89
+ ) => ?ZalgoPromise<void>,
90
+ action: Object,
91
+ sdkCorrelationID: string,
92
+ hcfSessionID: string,
93
+ partnerAttributionID: string,
94
+ merchantID: $ReadOnlyArray<string>,
95
+ save: {|
96
+ createVaultSetupToken: () => ZalgoPromise<string>,
97
+ onApprove: ({| vaultSetupToken: string |}) => ?ZalgoPromise<void>,
98
+ |},
70
99
  |};
71
100
 
72
101
  type CardFieldProps = {|
73
- ...CardFieldsProps,
102
+ ...CardFieldsProps,
74
103
 
75
- parent : {|
76
- props : CardFieldsProps
77
- |}
104
+ parent: {|
105
+ props: CardFieldsProps,
106
+ |},
78
107
  |};
79
108
 
80
109
  export type CardFieldComponent = ZoidComponent<CardFieldProps>;
81
110
 
82
111
  type CardFieldsExports = {|
83
- submit : () => ZalgoPromise<void>,
84
- setAttribute : () => ZalgoPromise<void>,
85
- removeAttribute : () => ZalgoPromise<void>,
86
- addClass : () => ZalgoPromise<void>,
87
- removeClass : () => ZalgoPromise<void>,
88
- getState : () => ZalgoPromise<Object>
112
+ submit: () => ZalgoPromise<void>,
113
+ setAttribute: () => ZalgoPromise<void>,
114
+ removeAttribute: () => ZalgoPromise<void>,
115
+ addClass: () => ZalgoPromise<void>,
116
+ removeClass: () => ZalgoPromise<void>,
117
+ getState: () => ZalgoPromise<Object>,
89
118
  |};
90
119
 
91
120
  type CardFieldsChildren = {|
92
- NumberField : CardFieldComponent,
93
- CVVField : CardFieldComponent,
94
- ExpiryField : CardFieldComponent,
95
- NameField : CardFieldComponent,
96
- PostalCodeField: CardFieldComponent
121
+ NumberField: CardFieldComponent,
122
+ CVVField: CardFieldComponent,
123
+ ExpiryField: CardFieldComponent,
124
+ NameField: CardFieldComponent,
125
+ PostalCodeField: CardFieldComponent,
97
126
  |};
98
127
 
99
- const url = () => `${ getPayPalDomain() }${ __PAYPAL_CHECKOUT__.__URI__.__CARD_FIELD__ }`;
128
+ const url = () =>
129
+ `${getPayPalDomain()}${__PAYPAL_CHECKOUT__.__URI__.__CARD_FIELD__}`;
100
130
 
101
131
  const prerenderTemplate = ({ props, doc }) => {
102
- return (
103
- <CardPrerender
104
- nonce={ props.nonce }
105
- height={ props.style?.height }
106
- />
107
- ).render(dom({ doc }));
132
+ return (
133
+ <CardPrerender nonce={props.nonce} height={props.style?.height} />
134
+ ).render(dom({ doc }));
108
135
  };
109
136
 
110
- export type CardFieldsComponent = ZoidComponent<CardFieldsProps, CardFieldsExports, CardFieldsChildren>;
111
-
112
- export const getCardFieldsComponent : () => CardFieldsComponent = memoize(() : CardFieldsComponent => {
137
+ export type CardFieldsComponent = ZoidComponent<
138
+ CardFieldsProps,
139
+ CardFieldsExports,
140
+ CardFieldsChildren
141
+ >;
113
142
 
143
+ export const getCardFieldsComponent: () => CardFieldsComponent = memoize(
144
+ (): CardFieldsComponent => {
114
145
  const genericCardField = (type) => {
115
- return create({
116
- tag: `paypal-card-${ type }-field`,
117
- url,
146
+ return create({
147
+ tag: `paypal-card-${type}-field`,
148
+ url,
118
149
 
119
- dimensions: {
120
- height: '30px',
121
- width: '100%'
122
- },
150
+ dimensions: {
151
+ height: "30px",
152
+ width: "100%",
153
+ },
123
154
 
124
- attributes: {
125
- iframe: {
126
- scrolling: 'no'
127
- }
128
- },
155
+ attributes: {
156
+ iframe: {
157
+ scrolling: "no",
158
+ },
159
+ },
129
160
 
130
- autoResize: {
131
- height: true,
132
- width: false
133
- },
161
+ autoResize: {
162
+ height: true,
163
+ width: false,
164
+ },
134
165
 
135
- prerenderTemplate,
136
-
137
- exports: {
138
- setAttribute: {
139
- type: 'function'
140
- },
141
- removeAttribute: {
142
- type: 'function'
143
- },
144
- addClass: {
145
- type: 'function'
146
- },
147
- removeClass: {
148
- type: 'function'
149
- },
150
- clear: {
151
- type: 'function'
152
- },
153
- focus: {
154
- type: 'function'
155
- },
156
- setMessage: {
157
- type: 'function'
158
- }
159
- },
166
+ prerenderTemplate,
167
+
168
+ exports: {
169
+ setAttribute: {
170
+ type: "function",
171
+ },
172
+ removeAttribute: {
173
+ type: "function",
174
+ },
175
+ addClass: {
176
+ type: "function",
177
+ },
178
+ removeClass: {
179
+ type: "function",
180
+ },
181
+ clear: {
182
+ type: "function",
183
+ },
184
+ focus: {
185
+ type: "function",
186
+ },
187
+ setMessage: {
188
+ type: "function",
189
+ },
190
+ },
160
191
 
161
- props: {
162
- save: {
163
- type: 'object',
164
- required: false,
165
- value: ({props}) => {
166
- if (props.save) {
167
- return props.save
168
- } else if (props.parent.props) {
169
- return props.parent.props.save
170
- }
171
- }
172
- },
173
-
174
- type: {
175
- type: 'string',
176
- value: () => type,
177
- queryParam: true
178
- },
179
-
180
- clientID: {
181
- type: 'string',
182
- value: ({ props }) => props.parent.props.clientID,
183
- queryParam: true
184
- },
185
-
186
- sessionID: {
187
- type: 'string',
188
- value: ({ props }) => props.parent.props.sessionID,
189
- queryParam: true
190
- },
191
-
192
- createOrder: {
193
- type: 'function',
194
- required: false,
195
- value: ({ props }) => props.parent.props.createOrder
196
- },
197
-
198
- cardFieldsSessionID: {
199
- type: 'string',
200
- queryParam: true,
201
- value: ({ props }) => props.parent.props.cardFieldsSessionID
202
- },
203
-
204
- env: {
205
- type: 'string',
206
- queryParam: true,
207
- value: ({ props }) => props.parent.props.env
208
- },
209
-
210
- debug: {
211
- type: 'boolean',
212
- value: ({ props }) => props.parent.props.debug,
213
- queryParam: true
214
- },
215
-
216
- locale: {
217
- type: 'object',
218
- queryParam: true,
219
- allowDelegate: true,
220
- value: ({ props }) => props.parent.props.locale
221
- },
222
-
223
- onApprove: {
224
- type: 'function',
225
- required: false,
226
- value: ({ props }) => props.parent.props.onApprove
227
- },
228
-
229
- onComplete: {
230
- type: 'function',
231
- required: false,
232
- value: ({ props }) => props.parent.props.onComplete
233
- },
234
-
235
- onCancel: {
236
- type: 'function',
237
- required: false,
238
- value: ({ props }) => props.parent.props.onCancel
239
- },
240
-
241
- sdkMeta: {
242
- type: 'string',
243
- queryParam: true,
244
- value: ({ props }) => props.parent.props.sdkMeta
245
- },
246
-
247
- style: {
248
- type: 'object',
249
- required: false,
250
- queryParam: true,
251
- value: ({ props }) => {
252
- return {
253
- ...props.parent.props.style,
254
- // $FlowFixMe
255
- ...props.style
256
- };
257
- }
258
- },
259
-
260
- onChange: {
261
- type: 'function',
262
- required: false,
263
- value: ({props}) => {
264
- if (props.onChange) {
265
- return props.onChange
266
- } else {
267
- return props.parent.props.onChange
268
- }
269
- }
270
- },
271
-
272
- inputEvents: {
273
- type: 'object',
274
- required: false,
275
- value: ({props}) => {
276
- if (props.inputEvents) {
277
- return props.inputEvents
278
- } else {
279
- return props.parent.props.inputEvents
280
- }
281
- }
282
- },
283
-
284
- minLength: {
285
- type: 'number',
286
- required: false,
287
- value: ({props}) => props.minLength
288
- },
289
-
290
- maxLength: {
291
- type: 'number',
292
- required: false,
293
- value: ({props}) => props.maxLength
294
- },
295
-
296
- fundingEligibility: {
297
- type: 'object',
298
- value: ({ props }) => props.parent.props.fundingEligibility
299
- },
300
-
301
- disableCard: {
302
- type: 'array',
303
- queryParam: 'disable-card',
304
- allowDelegate: true,
305
- queryValue({ value }) : string {
306
- return value.join(',');
307
- },
308
- value: ({ props }) => props.parent.props.disableCard
309
- },
310
-
311
- currency: {
312
- type: 'string',
313
- queryParam: true,
314
- value: ({ props }) => props.parent.props.currency
315
- },
316
-
317
- intent: {
318
- type: 'string',
319
- queryParam: true,
320
- value: ({ props }) => props.parent.props.intent
321
- },
322
-
323
- commit: {
324
- type: 'boolean',
325
- queryParam: true,
326
- value: ({ props }) => props.parent.props.commit
327
- },
328
-
329
- vault: {
330
- type: 'boolean',
331
- queryParam: true,
332
- value: ({ props }) => props.parent.props.vault
333
- },
334
-
335
- branded: {
336
- type: 'boolean',
337
- queryParam: true,
338
- required: false,
339
- value: ({ props }) => props.parent.props.branded
340
- },
341
- sdkCorrelationID: {
342
- type: 'string',
343
- required: false,
344
- value: ({ props }) => props.parent.props.sdkCorrelationID,
345
- queryParam: true
346
- },
347
- hcfSessionID : {
348
- type: 'string',
349
- required: false,
350
- value: ({ props }) => props.parent.props.hcfSessionID
351
- },
352
- partnerAttributionID: {
353
- type: 'string',
354
- required: false,
355
- value: ({ props }) => props.parent.props.partnerAttributionID
356
- },
357
- merchantID: {
358
- type: 'array',
359
- queryParam: true,
360
- value: ({ props }) => props.parent.props.merchantID
361
- },
362
- userIDToken: {
363
- type: 'string',
364
- default: getUserIDToken,
365
- required: false,
366
- },
367
- }
368
- });
192
+ props: {
193
+ save: {
194
+ type: "object",
195
+ required: false,
196
+ value: ({ props }) => {
197
+ if (props.save) {
198
+ return props.save;
199
+ } else if (props.parent.props) {
200
+ return props.parent.props.save;
201
+ }
202
+ },
203
+ },
204
+
205
+ type: {
206
+ type: "string",
207
+ value: () => type,
208
+ queryParam: true,
209
+ },
210
+
211
+ clientID: {
212
+ type: "string",
213
+ value: ({ props }) => props.parent.props.clientID,
214
+ queryParam: true,
215
+ },
216
+
217
+ sessionID: {
218
+ type: "string",
219
+ value: ({ props }) => props.parent.props.sessionID,
220
+ queryParam: true,
221
+ },
222
+
223
+ createOrder: {
224
+ type: "function",
225
+ required: false,
226
+ value: ({ props }) => props.parent.props.createOrder,
227
+ },
228
+
229
+ cardFieldsSessionID: {
230
+ type: "string",
231
+ queryParam: true,
232
+ value: ({ props }) => props.parent.props.cardFieldsSessionID,
233
+ },
234
+
235
+ env: {
236
+ type: "string",
237
+ queryParam: true,
238
+ value: ({ props }) => props.parent.props.env,
239
+ },
240
+
241
+ debug: {
242
+ type: "boolean",
243
+ value: ({ props }) => props.parent.props.debug,
244
+ queryParam: true,
245
+ },
246
+
247
+ locale: {
248
+ type: "object",
249
+ queryParam: true,
250
+ allowDelegate: true,
251
+ value: ({ props }) => props.parent.props.locale,
252
+ },
253
+
254
+ onApprove: {
255
+ type: "function",
256
+ required: false,
257
+ value: ({ props }) => props.parent.props.onApprove,
258
+ },
259
+
260
+ onComplete: {
261
+ type: "function",
262
+ required: false,
263
+ value: ({ props }) => props.parent.props.onComplete,
264
+ },
265
+
266
+ onCancel: {
267
+ type: "function",
268
+ required: false,
269
+ value: ({ props }) => props.parent.props.onCancel,
270
+ },
271
+
272
+ sdkMeta: {
273
+ type: "string",
274
+ queryParam: true,
275
+ value: ({ props }) => props.parent.props.sdkMeta,
276
+ },
277
+
278
+ style: {
279
+ type: "object",
280
+ required: false,
281
+ queryParam: true,
282
+ value: ({ props }) => {
283
+ return {
284
+ ...props.parent.props.style,
285
+ // $FlowFixMe
286
+ ...props.style,
287
+ };
288
+ },
289
+ },
290
+
291
+ onChange: {
292
+ type: "function",
293
+ required: false,
294
+ value: ({ props }) => {
295
+ if (props.onChange) {
296
+ return props.onChange;
297
+ } else {
298
+ return props.parent.props.onChange;
299
+ }
300
+ },
301
+ },
302
+
303
+ inputEvents: {
304
+ type: "object",
305
+ required: false,
306
+ value: ({ props }) => {
307
+ if (props.inputEvents) {
308
+ return props.inputEvents;
309
+ } else {
310
+ return props.parent.props.inputEvents;
311
+ }
312
+ },
313
+ },
314
+
315
+ minLength: {
316
+ type: "number",
317
+ required: false,
318
+ value: ({ props }) => props.minLength,
319
+ },
320
+
321
+ maxLength: {
322
+ type: "number",
323
+ required: false,
324
+ value: ({ props }) => props.maxLength,
325
+ },
326
+
327
+ fundingEligibility: {
328
+ type: "object",
329
+ value: ({ props }) => props.parent.props.fundingEligibility,
330
+ },
331
+
332
+ disableCard: {
333
+ type: "array",
334
+ queryParam: "disable-card",
335
+ allowDelegate: true,
336
+ queryValue({ value }): string {
337
+ return value.join(",");
338
+ },
339
+ value: ({ props }) => props.parent.props.disableCard,
340
+ },
341
+
342
+ currency: {
343
+ type: "string",
344
+ queryParam: true,
345
+ value: ({ props }) => props.parent.props.currency,
346
+ },
347
+
348
+ intent: {
349
+ type: "string",
350
+ queryParam: true,
351
+ value: ({ props }) => props.parent.props.intent,
352
+ },
353
+
354
+ commit: {
355
+ type: "boolean",
356
+ queryParam: true,
357
+ value: ({ props }) => props.parent.props.commit,
358
+ },
359
+
360
+ vault: {
361
+ type: "boolean",
362
+ queryParam: true,
363
+ value: ({ props }) => props.parent.props.vault,
364
+ },
365
+
366
+ branded: {
367
+ type: "boolean",
368
+ queryParam: true,
369
+ required: false,
370
+ value: ({ props }) => props.parent.props.branded,
371
+ },
372
+ sdkCorrelationID: {
373
+ type: "string",
374
+ required: false,
375
+ value: ({ props }) => props.parent.props.sdkCorrelationID,
376
+ queryParam: true,
377
+ },
378
+ hcfSessionID: {
379
+ type: "string",
380
+ required: false,
381
+ value: ({ props }) => props.parent.props.hcfSessionID,
382
+ },
383
+ partnerAttributionID: {
384
+ type: "string",
385
+ required: false,
386
+ value: ({ props }) => props.parent.props.partnerAttributionID,
387
+ },
388
+ merchantID: {
389
+ type: "array",
390
+ queryParam: true,
391
+ value: ({ props }) => props.parent.props.merchantID,
392
+ },
393
+ userIDToken: {
394
+ type: "string",
395
+ default: getUserIDToken,
396
+ required: false,
397
+ },
398
+ },
399
+ });
369
400
  };
370
401
 
371
402
  const NumberField = genericCardField(CARD_FIELD_TYPE.NUMBER);
@@ -375,253 +406,254 @@ export const getCardFieldsComponent : () => CardFieldsComponent = memoize(() : C
375
406
  const PostalCodeField = genericCardField(CARD_FIELD_TYPE.POSTAL);
376
407
 
377
408
  const CardFields = create({
378
- tag: 'paypal-card-fields',
379
- url,
409
+ tag: "paypal-card-fields",
410
+ url,
380
411
 
381
- dimensions: {
382
- height: '30px',
383
- width: '100%'
384
- },
412
+ dimensions: {
413
+ height: "30px",
414
+ width: "100%",
415
+ },
385
416
 
386
- attributes: {
387
- iframe: {
388
- scrolling: 'no'
389
- }
417
+ attributes: {
418
+ iframe: {
419
+ scrolling: "no",
390
420
  },
391
-
392
- autoResize: {
393
- height: true,
394
- width: false
421
+ },
422
+
423
+ autoResize: {
424
+ height: true,
425
+ width: false,
426
+ },
427
+
428
+ prerenderTemplate,
429
+
430
+ children: () => {
431
+ return {
432
+ NumberField,
433
+ CVVField,
434
+ ExpiryField,
435
+ NameField,
436
+ PostalCodeField,
437
+ };
438
+ },
439
+
440
+ exports: {
441
+ submit: {
442
+ type: "function",
395
443
  },
396
-
397
- prerenderTemplate,
398
-
399
- children: () => {
400
- return {
401
- NumberField,
402
- CVVField,
403
- ExpiryField,
404
- NameField,
405
- PostalCodeField
406
- };
444
+ setAttribute: {
445
+ type: "function",
407
446
  },
408
-
409
- exports: {
410
- submit: {
411
- type: 'function'
412
- },
413
- setAttribute: {
414
- type: 'function'
415
- },
416
- removeAttribute: {
417
- type: 'function'
418
- },
419
- addClass: {
420
- type: 'function'
421
- },
422
- removeClass: {
423
- type: 'function'
424
- },
425
- clear: {
426
- type: 'function'
427
- },
428
- focus: {
429
- type: 'function'
430
- },
431
- getState: {
432
- type: 'function'
433
- },
447
+ removeAttribute: {
448
+ type: "function",
434
449
  },
435
-
436
- eligible: () => {
437
- const fundingEligibility = getRefinedFundingEligibility();
438
- if (fundingEligibility?.card?.eligible) {
439
- return {
440
- eligible: true
441
- };
442
- }
443
- return {
444
- eligible: false,
445
- reason: 'card payments are not eligible'
446
- };
450
+ addClass: {
451
+ type: "function",
452
+ },
453
+ removeClass: {
454
+ type: "function",
455
+ },
456
+ clear: {
457
+ type: "function",
458
+ },
459
+ focus: {
460
+ type: "function",
461
+ },
462
+ getState: {
463
+ type: "function",
464
+ },
465
+ },
466
+
467
+ eligible: () => {
468
+ const fundingEligibility = getRefinedFundingEligibility();
469
+ if (fundingEligibility?.card?.eligible) {
470
+ return {
471
+ eligible: true,
472
+ };
473
+ }
474
+ return {
475
+ eligible: false,
476
+ reason: "card payments are not eligible",
477
+ };
478
+ },
479
+
480
+ props: {
481
+ save: {
482
+ type: "object",
483
+ required: false,
447
484
  },
448
485
 
449
- props: {
450
- save: {
451
- type: 'object',
452
- required: false,
453
- },
486
+ type: {
487
+ type: "string",
488
+ value: () => CARD_FIELD_TYPE.SINGLE,
489
+ queryParam: true,
490
+ },
454
491
 
455
- type: {
456
- type: 'string',
457
- value: () => CARD_FIELD_TYPE.SINGLE,
458
- queryParam: true
459
- },
460
-
461
- clientID: {
462
- type: 'string',
463
- value: getClientID,
464
- queryParam: true
465
- },
492
+ clientID: {
493
+ type: "string",
494
+ value: getClientID,
495
+ queryParam: true,
496
+ },
466
497
 
467
- sessionID: {
468
- type: 'string',
469
- required: false,
470
- value: getSessionID,
471
- queryParam: true
472
- },
498
+ sessionID: {
499
+ type: "string",
500
+ required: false,
501
+ value: getSessionID,
502
+ queryParam: true,
503
+ },
473
504
 
474
- createOrder: {
475
- type: 'function',
476
- required: false
477
- },
505
+ createOrder: {
506
+ type: "function",
507
+ required: false,
508
+ },
478
509
 
479
- cardFieldsSessionID: {
480
- type: 'string',
481
- queryParam: true,
482
- value: uniqueID
483
- },
510
+ cardFieldsSessionID: {
511
+ type: "string",
512
+ queryParam: true,
513
+ value: uniqueID,
514
+ },
484
515
 
485
- env: {
486
- type: 'string',
487
- queryParam: true,
488
- value: getEnv
489
- },
516
+ env: {
517
+ type: "string",
518
+ queryParam: true,
519
+ value: getEnv,
520
+ },
490
521
 
491
- debug: {
492
- type: 'boolean',
493
- value: getDebug,
494
- queryParam: true
495
- },
522
+ debug: {
523
+ type: "boolean",
524
+ value: getDebug,
525
+ queryParam: true,
526
+ },
496
527
 
497
- locale: {
498
- type: 'object',
499
- queryParam: true,
500
- allowDelegate: true,
501
- value: getLocale
502
- },
528
+ locale: {
529
+ type: "object",
530
+ queryParam: true,
531
+ allowDelegate: true,
532
+ value: getLocale,
533
+ },
503
534
 
504
- onApprove: {
505
- type: 'function',
506
- required: false
507
- },
535
+ onApprove: {
536
+ type: "function",
537
+ required: false,
538
+ },
508
539
 
509
- onComplete: {
510
- type: 'function',
511
- required: false
512
- },
540
+ onComplete: {
541
+ type: "function",
542
+ required: false,
543
+ },
513
544
 
514
- onCancel: {
515
- type: 'function',
516
- required: false
517
- },
545
+ onCancel: {
546
+ type: "function",
547
+ required: false,
548
+ },
518
549
 
519
- sdkMeta: {
520
- type: 'string',
521
- queryParam: true,
522
- value: getSDKMeta
523
- },
550
+ sdkMeta: {
551
+ type: "string",
552
+ queryParam: true,
553
+ value: getSDKMeta,
554
+ },
524
555
 
525
- style: {
526
- type: 'object',
527
- required: false,
528
- queryParam: true
529
- },
556
+ style: {
557
+ type: "object",
558
+ required: false,
559
+ queryParam: true,
560
+ },
530
561
 
531
- onChange: {
532
- type: 'function',
533
- required: false
534
- },
562
+ onChange: {
563
+ type: "function",
564
+ required: false,
565
+ },
535
566
 
536
- inputEvents: {
537
- type: 'object',
538
- required: false
539
- },
567
+ inputEvents: {
568
+ type: "object",
569
+ required: false,
570
+ },
540
571
 
541
- minLength: {
542
- type: 'number',
543
- required: false,
544
- value: ({props}) => props.minLength
545
- },
572
+ minLength: {
573
+ type: "number",
574
+ required: false,
575
+ value: ({ props }) => props.minLength,
576
+ },
546
577
 
547
- maxLength: {
548
- type: 'number',
549
- required: false,
550
- value: ({props}) => props.maxLength
551
- },
578
+ maxLength: {
579
+ type: "number",
580
+ required: false,
581
+ value: ({ props }) => props.maxLength,
582
+ },
552
583
 
553
- fundingEligibility: {
554
- type: 'object',
555
- value: getRefinedFundingEligibility
556
- },
584
+ fundingEligibility: {
585
+ type: "object",
586
+ value: getRefinedFundingEligibility,
587
+ },
557
588
 
558
- disableCard: {
559
- type: 'array',
560
- queryParam: 'disable-card',
561
- allowDelegate: true,
562
- queryValue({ value }) : string {
563
- return value.join(',');
564
- },
565
- value: getDisableCard
566
- },
589
+ disableCard: {
590
+ type: "array",
591
+ queryParam: "disable-card",
592
+ allowDelegate: true,
593
+ queryValue({ value }): string {
594
+ return value.join(",");
595
+ },
596
+ value: getDisableCard,
597
+ },
567
598
 
568
- currency: {
569
- type: 'string',
570
- queryParam: true,
571
- value: getCurrency
572
- },
599
+ currency: {
600
+ type: "string",
601
+ queryParam: true,
602
+ value: getCurrency,
603
+ },
573
604
 
574
- intent: {
575
- type: 'string',
576
- queryParam: true,
577
- value: getIntent
578
- },
605
+ intent: {
606
+ type: "string",
607
+ queryParam: true,
608
+ value: getIntent,
609
+ },
579
610
 
580
- commit: {
581
- type: 'boolean',
582
- queryParam: true,
583
- value: getCommit
584
- },
611
+ commit: {
612
+ type: "boolean",
613
+ queryParam: true,
614
+ value: getCommit,
615
+ },
585
616
 
586
- vault: {
587
- type: 'boolean',
588
- queryParam: true,
589
- value: getVault
590
- },
617
+ vault: {
618
+ type: "boolean",
619
+ queryParam: true,
620
+ value: getVault,
621
+ },
591
622
 
592
- branded: {
593
- type: 'boolean',
594
- queryParam: true,
595
- required: false
596
- },
597
- sdkCorrelationID: {
598
- type: 'string',
599
- required: false,
600
- value: getCorrelationID,
601
- queryParam: true
602
- },
603
- hcfSessionID : {
604
- type: 'string',
605
- required: false,
606
- value: uniqueID
607
- },
608
- partnerAttributionID: {
609
- type: 'string',
610
- required: false,
611
- value: getPartnerAttributionID
612
- },
613
- merchantID: {
614
- type: 'array',
615
- queryParam: true,
616
- value: getMerchantID
617
- },
618
- userIDToken: {
619
- type: 'string',
620
- default: getUserIDToken,
621
- required: false,
622
- },
623
- }
623
+ branded: {
624
+ type: "boolean",
625
+ queryParam: true,
626
+ required: false,
627
+ },
628
+ sdkCorrelationID: {
629
+ type: "string",
630
+ required: false,
631
+ value: getCorrelationID,
632
+ queryParam: true,
633
+ },
634
+ hcfSessionID: {
635
+ type: "string",
636
+ required: false,
637
+ value: uniqueID,
638
+ },
639
+ partnerAttributionID: {
640
+ type: "string",
641
+ required: false,
642
+ value: getPartnerAttributionID,
643
+ },
644
+ merchantID: {
645
+ type: "array",
646
+ queryParam: true,
647
+ value: getMerchantID,
648
+ },
649
+ userIDToken: {
650
+ type: "string",
651
+ default: getUserIDToken,
652
+ required: false,
653
+ },
654
+ },
624
655
  });
625
656
 
626
657
  return CardFields;
627
- });
658
+ }
659
+ );