@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
@@ -1,176 +1,198 @@
1
1
  /* @flow */
2
2
  /** @jsx node */
3
3
 
4
- import { node, type ElementNode } from '@krakenjs/jsx-pragmatic/src';
5
-
6
- export function getComponentScript() : () => void {
7
-
8
- /* istanbul ignore next */
9
- return () => {
10
-
11
- const ATTRIBUTE = {
12
- OPTIONAL: 'optional'
13
- };
14
-
15
- const CLASS = {
16
- HIDDEN: 'hidden',
17
- DOM_READY: 'dom-ready'
18
- };
19
-
20
- const SELECTOR = {
21
- OPTIONAL: `[${ ATTRIBUTE.OPTIONAL }]`
22
- };
23
-
24
- const TAG = {
25
- STYLE: 'style'
26
- };
27
-
28
- function once(handler : Function) : Function {
29
- let called = false;
30
- return (...args) => {
31
- if (!called) {
32
- called = true;
33
- handler(...args);
34
- }
35
- };
36
- }
37
-
38
- function debounce(handler : Function, time : number = 50) : Function {
39
- let timeout;
40
- return (...args) => {
41
- clearTimeout(timeout);
42
- timeout = setTimeout(() => {
43
- handler(...args);
44
- }, time);
45
- };
46
- }
47
-
48
- // eslint-disable-next-line flowtype/no-mutable-array
49
- function toArray<T>(item) : Array<T> {
50
- // $FlowFixMe[method-unbinding]
51
- return Array.prototype.slice.call(item);
52
- }
53
-
54
- function elementArray(elements : HTMLCollection<HTMLElement> | NodeList<HTMLElement> | $ReadOnlyArray<HTMLElement>) : $ReadOnlyArray<HTMLElement> {
55
- return toArray(elements).filter(el => {
56
- return el.tagName.toLowerCase() !== TAG.STYLE;
57
- });
58
- }
59
-
60
- function getElements(selector, parent) : $ReadOnlyArray<HTMLElement> {
61
- parent = parent || document;
62
- return elementArray(parent.querySelectorAll(selector));
63
- }
64
-
65
- function getParent(element : HTMLElement) : HTMLElement {
66
- // $FlowFixMe
67
- return element.parentElement;
68
- }
69
-
70
- function showElement(el : HTMLElement) {
71
- el.classList.remove(CLASS.HIDDEN);
72
- }
73
-
74
- function hideElement(el : HTMLElement) {
75
- el.classList.add(CLASS.HIDDEN);
76
- }
77
-
78
- function sum(arr : $ReadOnlyArray<number>) : number {
79
- let result = 0;
80
- for (const item of arr) {
81
- result += item;
82
- }
83
- return result;
84
- }
85
-
86
- function unique<T>(arr : $ReadOnlyArray<T>) : $ReadOnlyArray<T> {
87
- const result = [];
4
+ import { node, type ElementNode } from "@krakenjs/jsx-pragmatic/src";
88
5
 
89
- for (const el of arr) {
90
- if (result.indexOf(el) === -1) {
91
- result.push(el);
92
- }
93
- }
94
-
95
- return result;
96
- }
97
-
98
- function getAllChildren(element : HTMLElement) : $ReadOnlyArray<HTMLElement> {
99
- return elementArray(element.children);
100
- }
101
-
102
- function getOptionalIndex(element : HTMLElement) : number {
103
- return parseInt(element.getAttribute(ATTRIBUTE.OPTIONAL) || 0, 10);
104
- }
6
+ export function getComponentScript(): () => void {
7
+ /* istanbul ignore next */
8
+ return () => {
9
+ const ATTRIBUTE = {
10
+ OPTIONAL: "optional",
11
+ };
105
12
 
106
- function getElementsTotalWidth(elements : $ReadOnlyArray<HTMLElement>) : number {
107
- return sum(elements.map(child => child.offsetWidth));
108
- }
13
+ const CLASS = {
14
+ HIDDEN: "hidden",
15
+ DOM_READY: "dom-ready",
16
+ };
109
17
 
110
- function getOptionalParents() : $ReadOnlyArray<HTMLElement> {
111
- return unique(getElements(SELECTOR.OPTIONAL).map(getParent).filter(Boolean));
112
- }
18
+ const SELECTOR = {
19
+ OPTIONAL: `[${ATTRIBUTE.OPTIONAL}]`,
20
+ };
113
21
 
114
- function getOptionalChildren(parent : HTMLElement) : $ReadOnlyArray<HTMLElement> {
115
- return toArray(getElements(SELECTOR.OPTIONAL, parent)).sort((first, second) => {
116
- return getOptionalIndex(first) - getOptionalIndex(second);
117
- });
118
- }
22
+ const TAG = {
23
+ STYLE: "style",
24
+ };
119
25
 
120
- const children = getOptionalParents().map(optionalParent => {
121
- const allChildren = getAllChildren(optionalParent);
122
- const optionalChildren = getOptionalChildren(optionalParent);
123
-
124
- return {
125
- optionalParent,
126
- allChildren,
127
- optionalChildren
128
- };
129
- });
130
-
131
- function toggleOptionals() {
132
- for (const { optionalParent, allChildren, optionalChildren } of children) {
133
- const parentWidth = optionalParent.offsetWidth;
134
- let usedWidth = getElementsTotalWidth(allChildren) - getElementsTotalWidth(optionalChildren);
135
-
136
- for (const optionalChild of optionalChildren) {
137
- usedWidth += optionalChild.offsetWidth;
138
-
139
- if (usedWidth > parentWidth) {
140
- hideElement(optionalChild);
141
- } else {
142
- showElement(optionalChild);
143
- }
144
- }
145
- }
146
- }
26
+ function once(handler: Function): Function {
27
+ let called = false;
28
+ return (...args) => {
29
+ if (!called) {
30
+ called = true;
31
+ handler(...args);
32
+ }
33
+ };
34
+ }
35
+
36
+ function debounce(handler: Function, time: number = 50): Function {
37
+ let timeout;
38
+ return (...args) => {
39
+ clearTimeout(timeout);
40
+ timeout = setTimeout(() => {
41
+ handler(...args);
42
+ }, time);
43
+ };
44
+ }
45
+
46
+ // eslint-disable-next-line flowtype/no-mutable-array
47
+ function toArray<T>(item): Array<T> {
48
+ // $FlowFixMe[method-unbinding]
49
+ return Array.prototype.slice.call(item);
50
+ }
51
+
52
+ function elementArray(
53
+ elements:
54
+ | HTMLCollection<HTMLElement>
55
+ | NodeList<HTMLElement>
56
+ | $ReadOnlyArray<HTMLElement>
57
+ ): $ReadOnlyArray<HTMLElement> {
58
+ return toArray(elements).filter((el) => {
59
+ return el.tagName.toLowerCase() !== TAG.STYLE;
60
+ });
61
+ }
62
+
63
+ function getElements(selector, parent): $ReadOnlyArray<HTMLElement> {
64
+ parent = parent || document;
65
+ return elementArray(parent.querySelectorAll(selector));
66
+ }
67
+
68
+ function getParent(element: HTMLElement): HTMLElement {
69
+ // $FlowFixMe
70
+ return element.parentElement;
71
+ }
72
+
73
+ function showElement(el: HTMLElement) {
74
+ el.classList.remove(CLASS.HIDDEN);
75
+ }
76
+
77
+ function hideElement(el: HTMLElement) {
78
+ el.classList.add(CLASS.HIDDEN);
79
+ }
80
+
81
+ function sum(arr: $ReadOnlyArray<number>): number {
82
+ let result = 0;
83
+ for (const item of arr) {
84
+ result += item;
85
+ }
86
+ return result;
87
+ }
88
+
89
+ function unique<T>(arr: $ReadOnlyArray<T>): $ReadOnlyArray<T> {
90
+ const result = [];
91
+
92
+ for (const el of arr) {
93
+ if (result.indexOf(el) === -1) {
94
+ result.push(el);
95
+ }
96
+ }
97
+
98
+ return result;
99
+ }
100
+
101
+ function getAllChildren(element: HTMLElement): $ReadOnlyArray<HTMLElement> {
102
+ return elementArray(element.children);
103
+ }
104
+
105
+ function getOptionalIndex(element: HTMLElement): number {
106
+ return parseInt(element.getAttribute(ATTRIBUTE.OPTIONAL) || 0, 10);
107
+ }
108
+
109
+ function getElementsTotalWidth(
110
+ elements: $ReadOnlyArray<HTMLElement>
111
+ ): number {
112
+ return sum(elements.map((child) => child.offsetWidth));
113
+ }
114
+
115
+ function getOptionalParents(): $ReadOnlyArray<HTMLElement> {
116
+ return unique(
117
+ getElements(SELECTOR.OPTIONAL).map(getParent).filter(Boolean)
118
+ );
119
+ }
120
+
121
+ function getOptionalChildren(
122
+ parent: HTMLElement
123
+ ): $ReadOnlyArray<HTMLElement> {
124
+ return toArray(getElements(SELECTOR.OPTIONAL, parent)).sort(
125
+ (first, second) => {
126
+ return getOptionalIndex(first) - getOptionalIndex(second);
127
+ }
128
+ );
129
+ }
130
+
131
+ const children = getOptionalParents().map((optionalParent) => {
132
+ const allChildren = getAllChildren(optionalParent);
133
+ const optionalChildren = getOptionalChildren(optionalParent);
134
+
135
+ return {
136
+ optionalParent,
137
+ allChildren,
138
+ optionalChildren,
139
+ };
140
+ });
141
+
142
+ function toggleOptionals() {
143
+ for (const {
144
+ optionalParent,
145
+ allChildren,
146
+ optionalChildren,
147
+ } of children) {
148
+ const parentWidth = optionalParent.offsetWidth;
149
+ let usedWidth =
150
+ getElementsTotalWidth(allChildren) -
151
+ getElementsTotalWidth(optionalChildren);
152
+
153
+ for (const optionalChild of optionalChildren) {
154
+ usedWidth += optionalChild.offsetWidth;
155
+
156
+ if (usedWidth > parentWidth) {
157
+ hideElement(optionalChild);
158
+ } else {
159
+ showElement(optionalChild);
160
+ }
161
+ }
162
+ }
163
+ }
164
+
165
+ const setDomReady = once(
166
+ debounce(() => {
167
+ window.addEventListener("resize", toggleOptionals);
168
+ setTimeout(toggleOptionals);
169
+ if (document.body) {
170
+ document.body.classList.add(CLASS.DOM_READY);
171
+ }
172
+ })
173
+ );
147
174
 
148
- const setDomReady = once(debounce(() => {
149
- window.addEventListener('resize', toggleOptionals);
150
- setTimeout(toggleOptionals);
151
- if (document.body) {
152
- document.body.classList.add(CLASS.DOM_READY);
153
- }
154
- }));
155
-
156
- const load = () => {
157
- toggleOptionals();
158
- setDomReady();
159
- };
160
-
161
- toggleOptionals();
162
- document.addEventListener('DOMContentLoaded', load);
163
- window.addEventListener('load', load);
164
- window.addEventListener('resize', load);
175
+ const load = () => {
176
+ toggleOptionals();
177
+ setDomReady();
165
178
  };
179
+
180
+ toggleOptionals();
181
+ document.addEventListener("DOMContentLoaded", load);
182
+ window.addEventListener("load", load);
183
+ window.addEventListener("resize", load);
184
+ };
166
185
  }
167
186
 
168
187
  type ScriptProps = {|
169
- nonce : ?string
188
+ nonce: ?string,
170
189
  |};
171
190
 
172
- export function Script({ nonce } : ScriptProps) : ElementNode {
173
- return (
174
- <script nonce={ nonce } innerHTML={ `(${ getComponentScript().toString() })()` } />
175
- );
191
+ export function Script({ nonce }: ScriptProps): ElementNode {
192
+ return (
193
+ <script
194
+ nonce={nonce}
195
+ innerHTML={`(${getComponentScript().toString()})()`}
196
+ />
197
+ );
176
198
  }
@@ -1,12 +1,10 @@
1
1
  /* @flow */
2
2
  /** @jsx node */
3
3
 
4
- import { node, type ElementNode } from '@krakenjs/jsx-pragmatic/src';
4
+ import { node, type ElementNode } from "@krakenjs/jsx-pragmatic/src";
5
5
 
6
- import { CLASS } from '../../constants';
6
+ import { CLASS } from "../../constants";
7
7
 
8
- export function Spinner() : ?ElementNode {
9
- return (
10
- <div class={ CLASS.SPINNER } />
11
- );
8
+ export function Spinner(): ?ElementNode {
9
+ return <div class={CLASS.SPINNER} />;
12
10
  }
@@ -1,24 +1,25 @@
1
1
  /* @flow */
2
2
  /** @jsx node */
3
3
 
4
- import { node, type ElementNode } from '@krakenjs/jsx-pragmatic/src';
5
- import { type FundingEligibilityType } from '@paypal/sdk-constants/src';
4
+ import { node, type ElementNode } from "@krakenjs/jsx-pragmatic/src";
5
+ import { type FundingEligibilityType } from "@paypal/sdk-constants/src";
6
6
 
7
- import { type ButtonStyle } from './props';
8
- import { componentStyle } from './styles';
7
+ import { type ButtonStyle } from "./props";
8
+ import { componentStyle } from "./styles";
9
9
 
10
10
  type StyleProps = {|
11
- style : ButtonStyle,
12
- nonce : string,
13
- fundingEligibility : FundingEligibilityType
11
+ style: ButtonStyle,
12
+ nonce: string,
13
+ fundingEligibility: FundingEligibilityType,
14
14
  |};
15
15
 
16
- export function Style({ style, nonce, fundingEligibility } : StyleProps) : ElementNode {
16
+ export function Style({
17
+ style,
18
+ nonce,
19
+ fundingEligibility,
20
+ }: StyleProps): ElementNode {
21
+ const { custom = { label: undefined, css: undefined }, height } = style;
22
+ const css = componentStyle({ custom, height, fundingEligibility });
17
23
 
18
- const { custom = { label: undefined, css: undefined }, height } = style;
19
- const css = componentStyle({ custom, height, fundingEligibility });
20
-
21
- return (
22
- <style nonce={ nonce } innerHTML={ css } />
23
- );
24
+ return <style nonce={nonce} innerHTML={css} />;
24
25
  }
@@ -1,23 +1,31 @@
1
1
  /* @flow */
2
2
 
3
- import { type FundingEligibilityType } from '@paypal/sdk-constants/src';
3
+ import { type FundingEligibilityType } from "@paypal/sdk-constants/src";
4
4
 
5
- import type { CustomStyle } from '../../../types';
5
+ import type { CustomStyle } from "../../../types";
6
6
 
7
- import { pageStyle } from './page';
8
- import { buttonStyle } from './button';
9
- import { labelStyle } from './labels';
10
- import { buttonResponsiveStyle } from './responsive';
11
- import { buttonColorStyle } from './color';
12
- import { customStyle } from './custom';
7
+ import { pageStyle } from "./page";
8
+ import { buttonStyle } from "./button";
9
+ import { labelStyle } from "./labels";
10
+ import { buttonResponsiveStyle } from "./responsive";
11
+ import { buttonColorStyle } from "./color";
12
+ import { customStyle } from "./custom";
13
13
 
14
- export function componentStyle({ custom, height, fundingEligibility } : {| custom? : ?CustomStyle, height? : ?number, fundingEligibility : FundingEligibilityType |}) : string {
15
- return `
16
- ${ pageStyle }
17
- ${ buttonStyle }
18
- ${ buttonColorStyle }
19
- ${ labelStyle }
20
- ${ buttonResponsiveStyle({ height, fundingEligibility }) }
21
- ${ customStyle({ custom }) }
14
+ export function componentStyle({
15
+ custom,
16
+ height,
17
+ fundingEligibility,
18
+ }: {|
19
+ custom?: ?CustomStyle,
20
+ height?: ?number,
21
+ fundingEligibility: FundingEligibilityType,
22
+ |}): string {
23
+ return `
24
+ ${pageStyle}
25
+ ${buttonStyle}
26
+ ${buttonColorStyle}
27
+ ${labelStyle}
28
+ ${buttonResponsiveStyle({ height, fundingEligibility })}
29
+ ${customStyle({ custom })}
22
30
  `;
23
31
  }
@@ -1,15 +1,15 @@
1
1
  /* @flow */
2
2
 
3
- import { ENV } from '@paypal/sdk-constants/src';
4
- import { LOGO_CLASS } from '@paypal/sdk-logos/src';
3
+ import { ENV } from "@paypal/sdk-constants/src";
4
+ import { LOGO_CLASS } from "@paypal/sdk-logos/src";
5
5
 
6
- import { CLASS } from '../../../constants';
6
+ import { CLASS } from "../../../constants";
7
7
 
8
8
  const MIN_VAULT_BUTTON_WIDTH = 250;
9
9
 
10
10
  export const buttonStyle = `
11
11
 
12
- .${ CLASS.CONTAINER } {
12
+ .${CLASS.CONTAINER} {
13
13
  display: block;
14
14
  white-space: nowrap;
15
15
  margin: 0;
@@ -25,7 +25,7 @@ export const buttonStyle = `
25
25
  box-sizing: border-box;
26
26
  }
27
27
 
28
- .${ CLASS.BUTTON } {
28
+ .${CLASS.BUTTON} {
29
29
  border: 1px solid transparent;
30
30
  border-radius: 0 3px 3px 0;
31
31
  position: relative;
@@ -37,22 +37,22 @@ export const buttonStyle = `
37
37
  overflow: hidden;
38
38
  }
39
39
 
40
- .${ CLASS.BUTTON } * {
40
+ .${CLASS.BUTTON} * {
41
41
  cursor: pointer;
42
42
  }
43
43
 
44
- .${ CLASS.CONTAINER }.${ CLASS.ENV }-${ ENV.TEST } .${ CLASS.TEXT } {
44
+ .${CLASS.CONTAINER}.${CLASS.ENV}-${ENV.TEST} .${CLASS.TEXT} {
45
45
  font-family: Arial !important;
46
46
  background: rgba(0, 0, 0, 0.5) !important;
47
47
  color: transparent !important;
48
48
  text-shadow: none !important;
49
49
  }
50
50
 
51
- .${ CLASS.CARD } {
51
+ .${CLASS.CARD} {
52
52
  cursor: pointer;
53
53
  }
54
54
 
55
- .${ LOGO_CLASS.LOGO } {
55
+ .${LOGO_CLASS.LOGO} {
56
56
  padding: 0;
57
57
  display: inline-block;
58
58
  background: none;
@@ -60,25 +60,25 @@ export const buttonStyle = `
60
60
  width: auto;
61
61
  }
62
62
 
63
- .${ CLASS.TEXT }, .${ CLASS.SPACE } {
63
+ .${CLASS.TEXT}, .${CLASS.SPACE} {
64
64
  display: inline-block;
65
65
  white-space: pre;
66
66
  vertical-align: top;
67
67
  }
68
68
 
69
- .${ CLASS.BUTTON } > .${ CLASS.BUTTON_LABEL } {
69
+ .${CLASS.BUTTON} > .${CLASS.BUTTON_LABEL} {
70
70
  position: relative;
71
71
  top: 50%;
72
72
  transform: translateY(-50%);
73
73
  }
74
74
 
75
- .${ CLASS.BUTTON } > .${ CLASS.BUTTON_LABEL } * {
75
+ .${CLASS.BUTTON} > .${CLASS.BUTTON_LABEL} * {
76
76
  vertical-align: middle;
77
77
  height: 100%;
78
78
  text-align: left;
79
79
  }
80
80
 
81
- .${ CLASS.TAGLINE } {
81
+ .${CLASS.TAGLINE} {
82
82
  max-width: 100%;
83
83
  font-size: initial;
84
84
  font-weight: normal;
@@ -87,7 +87,7 @@ export const buttonStyle = `
87
87
  width: auto;
88
88
  }
89
89
 
90
- .${ CLASS.BUTTON } .${ CLASS.SPINNER } {
90
+ .${CLASS.BUTTON} .${CLASS.SPINNER} {
91
91
  position: absolute;
92
92
  height: 40px;
93
93
  width: 40px;
@@ -98,10 +98,10 @@ export const buttonStyle = `
98
98
  border: 3px solid rgba(0, 0, 0, .2);
99
99
  border-top-color: rgba(33, 128, 192, 0.8);
100
100
  border-radius: 100%;
101
- animation: ${ CLASS.SPINNER }-rotation .7s infinite linear;
101
+ animation: ${CLASS.SPINNER}-rotation .7s infinite linear;
102
102
  }
103
103
 
104
- @keyframes ${ CLASS.SPINNER }-rotation {
104
+ @keyframes ${CLASS.SPINNER}-rotation {
105
105
  from {
106
106
  transform: translateX(-50%) translateY(-50%) rotate(0deg);
107
107
  }
@@ -110,24 +110,26 @@ export const buttonStyle = `
110
110
  }
111
111
  }
112
112
 
113
- .${ CLASS.BUTTON } .${ CLASS.SPINNER } {
113
+ .${CLASS.BUTTON} .${CLASS.SPINNER} {
114
114
  display: none !important;
115
115
  }
116
116
 
117
- .${ CLASS.BUTTON }.${ CLASS.LOADING } * {
117
+ .${CLASS.BUTTON}.${CLASS.LOADING} * {
118
118
  display: none !important;
119
119
  }
120
120
 
121
- .${ CLASS.BUTTON }.${ CLASS.LOADING } .${ CLASS.SPINNER } {
121
+ .${CLASS.BUTTON}.${CLASS.LOADING} .${CLASS.SPINNER} {
122
122
  display: block !important;
123
123
  }
124
124
 
125
- .${ CLASS.CONTAINER } .${ CLASS.VAULT_HEADER } {
125
+ .${CLASS.CONTAINER} .${CLASS.VAULT_HEADER} {
126
126
  margin-top: 10px;
127
127
  }
128
128
 
129
- @media only screen and (max-width: ${ MIN_VAULT_BUTTON_WIDTH - 1 }px) {
130
- .${ CLASS.CONTAINER } .${ CLASS.BUTTON_ROW }.${ CLASS.WALLET }.${ CLASS.WALLET_MENU } .${ CLASS.BUTTON } {
129
+ @media only screen and (max-width: ${MIN_VAULT_BUTTON_WIDTH - 1}px) {
130
+ .${CLASS.CONTAINER} .${CLASS.BUTTON_ROW}.${CLASS.WALLET}.${
131
+ CLASS.WALLET_MENU
132
+ } .${CLASS.BUTTON} {
131
133
  border-top-right-radius: 4px;
132
134
  border-bottom-right-radius: 4px;
133
135
  width: 100%;