@paypal/checkout-components 5.0.256-alpha.1 → 5.0.257

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 (184) hide show
  1. package/README.md +8 -0
  2. package/__sdk__.js +76 -76
  3. package/dist/button.js +1 -1
  4. package/globals.js +28 -30
  5. package/package.json +7 -5
  6. package/src/actions/save/index.js +17 -12
  7. package/src/constants/button.js +36 -36
  8. package/src/constants/class.js +32 -30
  9. package/src/constants/index.js +3 -3
  10. package/src/constants/misc.js +14 -12
  11. package/src/declarations.js +19 -19
  12. package/src/funding/applepay/config.jsx +51 -49
  13. package/src/funding/applepay/index.js +1 -1
  14. package/src/funding/applepay/style.scoped.scss +1 -1
  15. package/src/funding/applepay/template.jsx +16 -9
  16. package/src/funding/bancontact/config.jsx +48 -36
  17. package/src/funding/bancontact/index.js +1 -2
  18. package/src/funding/blik/config.jsx +48 -36
  19. package/src/funding/blik/index.js +1 -2
  20. package/src/funding/boleto/config.jsx +50 -38
  21. package/src/funding/boleto/index.js +1 -2
  22. package/src/funding/card/amex/config.js +9 -7
  23. package/src/funding/card/amex/index.js +1 -2
  24. package/src/funding/card/config.jsx +246 -178
  25. package/src/funding/card/discover/config.js +9 -6
  26. package/src/funding/card/discover/index.js +1 -2
  27. package/src/funding/card/elo/config.js +6 -6
  28. package/src/funding/card/elo/index.js +1 -2
  29. package/src/funding/card/hiper/config.js +9 -6
  30. package/src/funding/card/hiper/index.js +1 -2
  31. package/src/funding/card/index.js +1 -1
  32. package/src/funding/card/jcb/config.js +6 -6
  33. package/src/funding/card/jcb/index.js +1 -2
  34. package/src/funding/card/mastercard/config.js +9 -6
  35. package/src/funding/card/mastercard/index.js +1 -2
  36. package/src/funding/card/visa/config.js +9 -6
  37. package/src/funding/card/visa/index.js +1 -2
  38. package/src/funding/common.jsx +242 -216
  39. package/src/funding/config.js +212 -65
  40. package/src/funding/content.jsx +1946 -337
  41. package/src/funding/credit/config.jsx +74 -54
  42. package/src/funding/credit/index.js +1 -2
  43. package/src/funding/eps/config.jsx +45 -36
  44. package/src/funding/eps/index.js +1 -2
  45. package/src/funding/funding.js +193 -100
  46. package/src/funding/giropay/config.jsx +48 -37
  47. package/src/funding/giropay/index.js +1 -2
  48. package/src/funding/ideal/config.jsx +48 -36
  49. package/src/funding/ideal/index.js +1 -2
  50. package/src/funding/index.js +2 -2
  51. package/src/funding/itau/config.jsx +41 -40
  52. package/src/funding/itau/index.js +1 -1
  53. package/src/funding/maxima/config.jsx +25 -18
  54. package/src/funding/maxima/index.js +1 -2
  55. package/src/funding/mercadopago/config.jsx +48 -36
  56. package/src/funding/mercadopago/index.js +1 -2
  57. package/src/funding/multibanco/config.jsx +50 -38
  58. package/src/funding/multibanco/index.js +1 -2
  59. package/src/funding/mybank/config.jsx +48 -36
  60. package/src/funding/mybank/index.js +1 -2
  61. package/src/funding/oxxo/config.jsx +50 -38
  62. package/src/funding/oxxo/index.js +1 -2
  63. package/src/funding/p24/config.jsx +45 -36
  64. package/src/funding/p24/index.js +1 -2
  65. package/src/funding/paidy/config.jsx +50 -38
  66. package/src/funding/paidy/index.js +1 -1
  67. package/src/funding/paylater/config.jsx +118 -110
  68. package/src/funding/paylater/index.js +1 -2
  69. package/src/funding/paypal/config.jsx +43 -46
  70. package/src/funding/paypal/index.js +1 -2
  71. package/src/funding/paypal/style.scoped.scss +80 -74
  72. package/src/funding/paypal/template.jsx +450 -355
  73. package/src/funding/payu/config.jsx +50 -38
  74. package/src/funding/payu/index.js +1 -1
  75. package/src/funding/satispay/config.jsx +50 -38
  76. package/src/funding/satispay/index.js +1 -1
  77. package/src/funding/sepa/config.jsx +19 -12
  78. package/src/funding/sepa/index.js +1 -2
  79. package/src/funding/sofort/config.jsx +48 -36
  80. package/src/funding/sofort/index.js +1 -2
  81. package/src/funding/trustly/config.jsx +50 -38
  82. package/src/funding/trustly/index.js +1 -2
  83. package/src/funding/venmo/config.jsx +80 -74
  84. package/src/funding/venmo/index.js +1 -2
  85. package/src/funding/venmo/style.scoped.scss +30 -32
  86. package/src/funding/venmo/template.jsx +56 -56
  87. package/src/funding/verkkopankki/config.jsx +50 -38
  88. package/src/funding/verkkopankki/index.js +1 -1
  89. package/src/funding/wechatpay/config.jsx +48 -36
  90. package/src/funding/wechatpay/index.js +1 -2
  91. package/src/funding/zimpler/config.jsx +19 -12
  92. package/src/funding/zimpler/index.js +1 -2
  93. package/src/interface/actions.js +1 -1
  94. package/src/interface/button.js +60 -44
  95. package/src/interface/card-fields.js +11 -8
  96. package/src/interface/fields.js +7 -4
  97. package/src/interface/marks.js +4 -4
  98. package/src/interface/payment-fields.js +7 -4
  99. package/src/interface/wallet.js +4 -4
  100. package/src/lib/errors.js +7 -7
  101. package/src/lib/index.js +5 -5
  102. package/src/lib/isRTLLanguage.js +3 -3
  103. package/src/lib/perceived-latency-instrumentation.js +54 -36
  104. package/src/lib/security.js +21 -17
  105. package/src/lib/session.js +39 -35
  106. package/src/marks/component.jsx +114 -65
  107. package/src/marks/index.js +1 -2
  108. package/src/marks/template.jsx +79 -65
  109. package/src/types.js +48 -48
  110. package/src/ui/buttons/button.jsx +311 -249
  111. package/src/ui/buttons/buttonDesigns/control.jsx +3 -5
  112. package/src/ui/buttons/buttonDesigns/divideLogoAnimation.jsx +127 -99
  113. package/src/ui/buttons/buttonDesigns/index.js +78 -75
  114. package/src/ui/buttons/buttonDesigns/inlineLogoTextDesign.jsx +102 -82
  115. package/src/ui/buttons/buttonDesigns/script.jsx +24 -18
  116. package/src/ui/buttons/buttonDesigns/types.js +6 -7
  117. package/src/ui/buttons/buttons.jsx +318 -212
  118. package/src/ui/buttons/config.js +62 -59
  119. package/src/ui/buttons/content.jsx +304 -119
  120. package/src/ui/buttons/index.js +1 -1
  121. package/src/ui/buttons/menu-button/index.js +1 -1
  122. package/src/ui/buttons/menu-button/menu-button.jsx +29 -22
  123. package/src/ui/buttons/menu-button/menu-button.scoped.scss +16 -17
  124. package/src/ui/buttons/poweredBy.jsx +23 -23
  125. package/src/ui/buttons/props.js +677 -529
  126. package/src/ui/buttons/script.jsx +182 -160
  127. package/src/ui/buttons/spinner.jsx +4 -6
  128. package/src/ui/buttons/style.jsx +15 -14
  129. package/src/ui/buttons/styles/base.js +24 -16
  130. package/src/ui/buttons/styles/button.js +24 -22
  131. package/src/ui/buttons/styles/color.js +118 -118
  132. package/src/ui/buttons/styles/custom.js +30 -24
  133. package/src/ui/buttons/styles/index.js +1 -1
  134. package/src/ui/buttons/styles/labels.js +17 -13
  135. package/src/ui/buttons/styles/page.js +3 -3
  136. package/src/ui/buttons/styles/responsive.js +226 -118
  137. package/src/ui/buttons/tagline.jsx +53 -54
  138. package/src/ui/chevron.jsx +27 -16
  139. package/src/ui/index.js +3 -3
  140. package/src/ui/loading.jsx +25 -18
  141. package/src/ui/text/index.js +1 -1
  142. package/src/ui/text/style.scoped.scss +25 -26
  143. package/src/ui/text/text.jsx +42 -20
  144. package/src/ui/tracking.jsx +18 -11
  145. package/src/zoid/buttons/component.jsx +820 -677
  146. package/src/zoid/buttons/container.jsx +140 -107
  147. package/src/zoid/buttons/index.js +1 -1
  148. package/src/zoid/buttons/prerender.jsx +84 -64
  149. package/src/zoid/buttons/util.js +346 -254
  150. package/src/zoid/card-fields/component.jsx +581 -549
  151. package/src/zoid/card-fields/index.js +1 -1
  152. package/src/zoid/card-fields/prerender.jsx +20 -17
  153. package/src/zoid/card-form/component.js +155 -141
  154. package/src/zoid/card-form/index.js +1 -1
  155. package/src/zoid/checkout/component.jsx +314 -282
  156. package/src/zoid/checkout/config.js +2 -2
  157. package/src/zoid/checkout/content.js +190 -154
  158. package/src/zoid/checkout/hacks.js +31 -28
  159. package/src/zoid/checkout/index.js +2 -2
  160. package/src/zoid/checkout/props.js +27 -33
  161. package/src/zoid/installments/component.jsx +83 -70
  162. package/src/zoid/installments/index.js +1 -1
  163. package/src/zoid/installments/props.js +1 -1
  164. package/src/zoid/menu/component.jsx +53 -48
  165. package/src/zoid/menu/index.js +1 -1
  166. package/src/zoid/menu/props.js +1 -3
  167. package/src/zoid/modal/component.jsx +119 -106
  168. package/src/zoid/modal/index.js +1 -1
  169. package/src/zoid/modal/props.js +1 -3
  170. package/src/zoid/payment-fields/component.jsx +215 -191
  171. package/src/zoid/payment-fields/container.jsx +73 -64
  172. package/src/zoid/payment-fields/index.js +1 -1
  173. package/src/zoid/payment-fields/prerender.jsx +16 -14
  174. package/src/zoid/payment-fields/props.js +6 -6
  175. package/src/zoid/qr-code/component.jsx +131 -115
  176. package/src/zoid/qr-code/container.jsx +74 -68
  177. package/src/zoid/qr-code/index.js +1 -1
  178. package/src/zoid/qr-code/prerender.jsx +17 -12
  179. package/src/zoid/qr-code/types.js +2 -2
  180. package/src/zoid/wallet/component.jsx +298 -260
  181. package/src/zoid/wallet/container.jsx +73 -64
  182. package/src/zoid/wallet/index.js +1 -1
  183. package/src/zoid/wallet/prerender.jsx +14 -14
  184. package/src/zoid/wallet/props.js +4 -4
@@ -1,67 +1,83 @@
1
1
  /* @flow */
2
2
  /** @jsx node */
3
3
 
4
- import { FUNDING, ENV } from '@paypal/sdk-constants/src';
5
- import { node, type ChildNodeType, type ElementNode } from '@krakenjs/jsx-pragmatic/src';
6
- import { getLocale, type FundingEligibilityType } from '@paypal/sdk-client/src';
7
- import { toPx } from '@krakenjs/belter/src';
4
+ import { FUNDING, ENV } from "@paypal/sdk-constants/src";
5
+ import {
6
+ node,
7
+ type ChildNodeType,
8
+ type ElementNode,
9
+ } from "@krakenjs/jsx-pragmatic/src";
10
+ import { getLocale, type FundingEligibilityType } from "@paypal/sdk-client/src";
11
+ import { toPx } from "@krakenjs/belter/src";
8
12
 
9
- import type { Experiment } from '../types';
10
- import { getFundingConfig } from '../funding';
11
- import { CLASS } from '../constants';
13
+ import type { Experiment } from "../types";
14
+ import { getFundingConfig } from "../funding";
15
+ import { CLASS } from "../constants";
12
16
 
13
17
  type MarkOptions = {|
14
- fundingSource : $Values<typeof FUNDING>,
15
- fundingEligibility : FundingEligibilityType,
16
- experiment : Experiment,
17
- env : $Values<typeof ENV>
18
+ fundingSource: $Values<typeof FUNDING>,
19
+ fundingEligibility: FundingEligibilityType,
20
+ experiment: Experiment,
21
+ env: $Values<typeof ENV>,
18
22
  |};
19
23
 
20
- function Mark({ fundingSource, fundingEligibility, experiment, env } : MarkOptions) : ChildNodeType {
21
- const fundingConfig = getFundingConfig()[fundingSource];
24
+ function Mark({
25
+ fundingSource,
26
+ fundingEligibility,
27
+ experiment,
28
+ env,
29
+ }: MarkOptions): ChildNodeType {
30
+ const fundingConfig = getFundingConfig()[fundingSource];
22
31
 
23
- if (!fundingConfig) {
24
- throw new Error(`Can not find funding config for ${ fundingSource }`);
25
- }
32
+ if (!fundingConfig) {
33
+ throw new Error(`Can not find funding config for ${fundingSource}`);
34
+ }
26
35
 
27
- const { Logo } = fundingConfig;
28
- const MarkLogo = fundingConfig.Mark;
29
- const marksDefined = typeof MarkLogo !== 'undefined';
36
+ const { Logo } = fundingConfig;
37
+ const MarkLogo = fundingConfig.Mark;
38
+ const marksDefined = typeof MarkLogo !== "undefined";
30
39
 
31
- return (
32
- <div class='paypal-mark'>
33
- { marksDefined && MarkLogo
34
- ? <MarkLogo
35
- fundingEligibility={ fundingEligibility }
36
- locale={ getLocale() }
37
- experiment={ experiment }
38
- env={ env }
39
- />
40
- : <Logo
41
- fundingEligibility={ fundingEligibility }
42
- locale={ getLocale() }
43
- experiment={ experiment }
44
- env={ env }
45
- /> }
46
-
47
- </div>
48
- );
40
+ return (
41
+ <div class="paypal-mark">
42
+ {marksDefined && MarkLogo ? (
43
+ <MarkLogo
44
+ fundingEligibility={fundingEligibility}
45
+ locale={getLocale()}
46
+ experiment={experiment}
47
+ env={env}
48
+ />
49
+ ) : (
50
+ <Logo
51
+ fundingEligibility={fundingEligibility}
52
+ locale={getLocale()}
53
+ experiment={experiment}
54
+ env={env}
55
+ />
56
+ )}
57
+ </div>
58
+ );
49
59
  }
50
60
 
51
61
  type MarksElementOptions = {|
52
- fundingEligibility : FundingEligibilityType,
53
- fundingSources : $ReadOnlyArray<$Values<typeof FUNDING>>,
54
- height : number,
55
- experiment : Experiment,
56
- env : $Values<typeof ENV>
62
+ fundingEligibility: FundingEligibilityType,
63
+ fundingSources: $ReadOnlyArray<$Values<typeof FUNDING>>,
64
+ height: number,
65
+ experiment: Experiment,
66
+ env: $Values<typeof ENV>,
57
67
  |};
58
68
 
59
- export function MarksElement({ fundingEligibility, fundingSources, height, experiment, env } : MarksElementOptions) : ElementNode {
60
- return (
61
- <div class='paypal-marks'>
62
- <style>
63
- {`
64
- .${ CLASS.TEXT } {
69
+ export function MarksElement({
70
+ fundingEligibility,
71
+ fundingSources,
72
+ height,
73
+ experiment,
74
+ env,
75
+ }: MarksElementOptions): ElementNode {
76
+ return (
77
+ <div class="paypal-marks">
78
+ <style>
79
+ {`
80
+ .${CLASS.TEXT} {
65
81
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
66
82
  font-size: 12px;
67
83
  vertical-align: middle;
@@ -70,10 +86,10 @@ export function MarksElement({ fundingEligibility, fundingSources, height, exper
70
86
  .paypal-mark {
71
87
  display: inline-block;
72
88
  line-height: 0;
73
- padding: ${ toPx(height / 4) } ${ toPx(height / 3) };
89
+ padding: ${toPx(height / 4)} ${toPx(height / 3)};
74
90
  background: #fff;
75
91
  border-radius: 3px;
76
- margin: ${ toPx(height / 5) };
92
+ margin: ${toPx(height / 5)};
77
93
  white-space: nowrap;
78
94
  position: relative;
79
95
  background: #fff;
@@ -85,31 +101,29 @@ export function MarksElement({ fundingEligibility, fundingSources, height, exper
85
101
  }
86
102
 
87
103
  .paypal-mark img {
88
- height: ${ toPx(height) };
104
+ height: ${toPx(height)};
89
105
  display: inline-block;
90
106
  vertical-align: middle;
91
107
  }
92
108
 
93
109
  .paypal-button-card {
94
110
  display: inline-block;
95
- margin-right: ${ toPx(height / 4) };
111
+ margin-right: ${toPx(height / 4)};
96
112
  }
97
113
 
98
114
  .paypal-button-card:last-child {
99
115
  margin-right: 0px;
100
116
  }
101
117
  `}
102
- </style>
103
- {
104
- fundingSources.map(fundingSource => (
105
- <Mark
106
- fundingEligibility={ fundingEligibility }
107
- fundingSource={ fundingSource }
108
- experiment={ experiment }
109
- env={ env }
110
- />
111
- ))
112
- }
113
- </div>
114
- );
118
+ </style>
119
+ {fundingSources.map((fundingSource) => (
120
+ <Mark
121
+ fundingEligibility={fundingEligibility}
122
+ fundingSource={fundingSource}
123
+ experiment={experiment}
124
+ env={env}
125
+ />
126
+ ))}
127
+ </div>
128
+ );
115
129
  }
package/src/types.js CHANGED
@@ -1,83 +1,83 @@
1
1
  /* @flow */
2
2
 
3
- import { CARD, WALLET_INSTRUMENT } from '@paypal/sdk-constants/src';
3
+ import { CARD, WALLET_INSTRUMENT } from "@paypal/sdk-constants/src";
4
4
 
5
5
  export type SecondaryInstruments = $ReadOnlyArray<{|
6
- type : string,
7
- label : string,
8
- instrumentID : string
6
+ type: string,
7
+ label: string,
8
+ instrumentID: string,
9
9
  |}>;
10
10
 
11
11
  export type WalletInstrument = {|
12
- type? : $Values<typeof WALLET_INSTRUMENT>,
13
- label? : string,
14
- logoUrl? : string,
15
- instrumentID? : string,
16
- tokenID? : string,
17
- vendor? : $Values<typeof CARD>,
18
- oneClick : boolean,
19
- branded : boolean,
20
- secondaryInstruments? : SecondaryInstruments
12
+ type?: $Values<typeof WALLET_INSTRUMENT>,
13
+ label?: string,
14
+ logoUrl?: string,
15
+ instrumentID?: string,
16
+ tokenID?: string,
17
+ vendor?: $Values<typeof CARD>,
18
+ oneClick: boolean,
19
+ branded: boolean,
20
+ secondaryInstruments?: SecondaryInstruments,
21
21
  |};
22
22
 
23
23
  export type WalletPaymentType = {|
24
- instruments : $ReadOnlyArray<WalletInstrument>
24
+ instruments: $ReadOnlyArray<WalletInstrument>,
25
25
  |};
26
26
 
27
27
  export type Wallet = {|
28
- paypal : WalletPaymentType,
29
- card : WalletPaymentType,
30
- credit : WalletPaymentType,
31
- venmo : WalletPaymentType
28
+ paypal: WalletPaymentType,
29
+ card: WalletPaymentType,
30
+ credit: WalletPaymentType,
31
+ venmo: WalletPaymentType,
32
32
  |};
33
33
 
34
34
  export type ContentType = {|
35
- instantlyPayWith : string,
36
- poweredBy : string,
37
- chooseCardOrShipping : string,
38
- useDifferentAccount : string,
39
- deleteVaultedAccount : string,
40
- deleteVaultedCard : string,
41
- chooseCard : string,
42
- balance : string,
43
- payNow : string,
44
- payWithDebitOrCreditCard : string,
45
- credit : string,
46
- payWith : string,
47
- payLater : string,
48
- flex : string,
49
- payPalBalance: string,
50
- moreOptions: string
35
+ instantlyPayWith: string,
36
+ poweredBy: string,
37
+ chooseCardOrShipping: string,
38
+ useDifferentAccount: string,
39
+ deleteVaultedAccount: string,
40
+ deleteVaultedCard: string,
41
+ chooseCard: string,
42
+ balance: string,
43
+ payNow: string,
44
+ payWithDebitOrCreditCard: string,
45
+ credit: string,
46
+ payWith: string,
47
+ payLater: string,
48
+ flex: string,
49
+ payPalBalance: string,
50
+ moreOptions: string,
51
51
  |};
52
52
 
53
53
  export type Experiment = {|
54
- enableVenmo? : boolean,
55
- disablePaylater? : boolean,
56
- enableVenmoAppLabel? : boolean
54
+ enableVenmo?: boolean,
55
+ disablePaylater?: boolean,
56
+ enableVenmoAppLabel?: boolean,
57
57
  |};
58
58
 
59
59
  export type Requires = {|
60
- applepay? : boolean,
61
- popup? : boolean,
62
- native? : boolean
60
+ applepay?: boolean,
61
+ popup?: boolean,
62
+ native?: boolean,
63
63
  |};
64
64
 
65
65
  export type CustomStyle = {|
66
- css? : {|
67
- [string] : string
68
- |},
69
- label? : string
66
+ css?: {|
67
+ [string]: string,
68
+ |},
69
+ label?: string,
70
70
  |};
71
71
 
72
72
  export type LazyExport<T> = {|
73
- __get__ : () => T
73
+ __get__: () => T,
74
74
  |};
75
75
 
76
76
  export type LazyProtectedExport<T> = {|
77
- __get__ : () => ?T
77
+ __get__: () => ?T,
78
78
  |};
79
79
 
80
80
  export type InlineXOEligibilityType = {|
81
- eligible : boolean,
82
- ineligibilityReason : string
81
+ eligible: boolean,
82
+ ineligibilityReason: string,
83
83
  |};