@paypal/checkout-components 5.0.426-alpha-ea5d1e6.0 → 5.0.427

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 (67) hide show
  1. package/dist/button.js +1 -1
  2. package/dist/test/button.js +1 -1
  3. package/package.json +8 -8
  4. package/src/connect/component.jsx +1 -1
  5. package/src/connect/component.test.js +2 -2
  6. package/src/funding/card/config.jsx +3 -3
  7. package/src/funding/card/config.test.jsx +10 -10
  8. package/src/funding/funding.js +6 -6
  9. package/src/funding/funding.test.js +3 -3
  10. package/src/funding/paylater/config.jsx +2 -2
  11. package/src/funding/paypal/template.jsx +8 -8
  12. package/src/funding/util.js +2 -2
  13. package/src/funding/util.test.js +16 -16
  14. package/src/hosted-buttons/index.test.js +9 -9
  15. package/src/hosted-buttons/types.js +3 -3
  16. package/src/hosted-buttons/utils.js +8 -8
  17. package/src/hosted-buttons/utils.test.js +43 -43
  18. package/src/lib/api.js +2 -2
  19. package/src/lib/appSwitchResume.js +1 -1
  20. package/src/lib/perceived-latency-instrumentation.js +1 -1
  21. package/src/lib/security.js +1 -1
  22. package/src/marks/component.jsx +4 -4
  23. package/src/marks/templateRebrand.test.jsx +1 -1
  24. package/src/shopper-insights/shopperSession.js +13 -13
  25. package/src/shopper-insights/shopperSession.test.js +25 -25
  26. package/src/three-domain-secure/api.js +1 -1
  27. package/src/three-domain-secure/api.test.js +4 -4
  28. package/src/three-domain-secure/component.jsx +3 -3
  29. package/src/three-domain-secure/component.test.js +14 -14
  30. package/src/ui/buttons/buttons.jsx +2 -2
  31. package/src/ui/buttons/buttons.test.js +4 -4
  32. package/src/ui/buttons/config.js +1 -1
  33. package/src/ui/buttons/poweredBy.jsx +1 -1
  34. package/src/ui/buttons/props.bnpl.test.js +1 -1
  35. package/src/ui/buttons/props.js +43 -43
  36. package/src/ui/buttons/props.test.js +8 -8
  37. package/src/ui/buttons/script.jsx +10 -10
  38. package/src/ui/buttons/styles/button.js +2 -2
  39. package/src/ui/buttons/styles/disableMaxHeightConfig.test.js +1 -1
  40. package/src/ui/buttons/styles/labelContainerHeight.test.js +5 -5
  41. package/src/ui/buttons/styles/labels.js +7 -7
  42. package/src/ui/buttons/styles/page.js +1 -1
  43. package/src/ui/buttons/styles/responsive.js +137 -137
  44. package/src/ui/buttons/styles/styleUtils.js +14 -12
  45. package/src/ui/buttons/styles/styleUtils.test.constants.js +731 -0
  46. package/src/ui/buttons/styles/styleUtils.test.js +198 -610
  47. package/src/ui/buttons/util.js +4 -4
  48. package/src/ui/overlay/paypal-app-switch/style.jsx +1 -1
  49. package/src/ui/overlay/three-domain-secure/overlay.jsx +1 -1
  50. package/src/ui/overlay/three-domain-secure/style.jsx +1 -1
  51. package/src/ui/saved-payment-methods/template.jsx +1 -1
  52. package/src/ui/text/text.jsx +1 -1
  53. package/src/zoid/buttons/component.jsx +13 -13
  54. package/src/zoid/buttons/container.jsx +2 -2
  55. package/src/zoid/buttons/prerender.jsx +3 -3
  56. package/src/zoid/buttons/util.js +10 -10
  57. package/src/zoid/buttons/util.test.js +2 -2
  58. package/src/zoid/card-fields/component.jsx +8 -9
  59. package/src/zoid/card-form/component.js +3 -3
  60. package/src/zoid/checkout/component.jsx +2 -2
  61. package/src/zoid/payment-fields/component.jsx +1 -1
  62. package/src/zoid/qr-code/container.test.jsx +2 -2
  63. package/src/zoid/qr-code/prerender.test.jsx +1 -1
  64. package/src/zoid/saved-payment-methods/component.jsx +8 -8
  65. package/src/zoid/saved-payment-methods/util.js +2 -2
  66. package/src/zoid/saved-payment-methods/util.test.js +14 -14
  67. package/src/zoid/wallet/component.jsx +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paypal/checkout-components",
3
- "version": "5.0.426-alpha-ea5d1e6.0",
3
+ "version": "5.0.427",
4
4
  "description": "PayPal Checkout components, for integrating checkout products.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -41,8 +41,8 @@
41
41
  "screenshot-server": "babel-node ./test/percy/server/index.js"
42
42
  },
43
43
  "engines": {
44
- "node": "^18",
45
- "npm": "8"
44
+ "node": "^22",
45
+ "npm": "10"
46
46
  },
47
47
  "files": [
48
48
  "src/",
@@ -78,7 +78,7 @@
78
78
  "@krakenjs/grumbler-scripts": "^8.1.5",
79
79
  "@krakenjs/sync-browser-mocks": "^3.0.0",
80
80
  "@percy/cli": "1.28.5",
81
- "@percy/playwright": "^1.0.4",
81
+ "@percy/playwright": "1.1.1",
82
82
  "@playwright/test": "^1.38.1",
83
83
  "@vitest/coverage-v8": "^1.3.1",
84
84
  "babel-core": "^7.0.0-bridge.0",
@@ -103,8 +103,8 @@
103
103
  "pixelmatch": "^5.2.1",
104
104
  "playwright": "^1.29.1",
105
105
  "pngjs": "^6.0.0",
106
- "prettier": "^2.5.1",
107
- "prettier-plugin-sh": "^0.10.0",
106
+ "prettier": "^3.9.6",
107
+ "prettier-plugin-sh": "^0.19.0",
108
108
  "puppeteer": "^1.20.0",
109
109
  "serve": "^14.0.0",
110
110
  "vite": "^3.2.4",
@@ -117,9 +117,9 @@
117
117
  "@krakenjs/jsx-pragmatic": "^3",
118
118
  "@krakenjs/post-robot": "^11.0.0",
119
119
  "@krakenjs/zalgo-promise": "^2.0.0",
120
- "@krakenjs/zoid": "10.6.0-alpha.2",
121
- "@paypal/fastlane-sdk-loader": "^1.2.1",
120
+ "@krakenjs/zoid": "^10.6.0",
122
121
  "@paypal/common-components": "^1.0.35",
122
+ "@paypal/fastlane-sdk-loader": "^1.2.1",
123
123
  "@paypal/funding-components": "^1.0.31",
124
124
  "@paypal/sdk-client": "^4.0.199",
125
125
  "@paypal/sdk-constants": "^1.0.158",
@@ -56,7 +56,7 @@ export function getSdkVersion(version: string | null): string {
56
56
  });
57
57
 
58
58
  throw new Error(
59
- `The braintree version: ${version} does not support Connect. Please use version ${MIN_BT_VERSION} or above`
59
+ `The braintree version: ${version} does not support Connect. Please use version ${MIN_BT_VERSION} or above`,
60
60
  );
61
61
  }
62
62
 
@@ -100,7 +100,7 @@ describe("getConnectComponent: returns ConnectComponent", () => {
100
100
  loadAxo.mockRejectedValue(errorMessage);
101
101
 
102
102
  await expect(() => getConnectComponent(mockProps)).rejects.toThrow(
103
- errorMessage
103
+ errorMessage,
104
104
  );
105
105
  });
106
106
 
@@ -109,7 +109,7 @@ describe("getConnectComponent: returns ConnectComponent", () => {
109
109
  window.braintree.connect.create.mockRejectedValue(expectedError);
110
110
 
111
111
  await expect(() => getConnectComponent(mockProps)).rejects.toThrow(
112
- expectedError
112
+ expectedError,
113
113
  );
114
114
  });
115
115
 
@@ -67,9 +67,9 @@ export function getCardConfig(): FundingSourceConfig {
67
67
  const cardBranded = Boolean(cardEligibility && cardEligibility.branded);
68
68
  const cardVaulted = Boolean(
69
69
  wallet &&
70
- wallet.card &&
71
- wallet.card.instruments &&
72
- wallet.card.instruments.length
70
+ wallet.card &&
71
+ wallet.card.instruments &&
72
+ wallet.card.instruments.length,
73
73
  );
74
74
 
75
75
  // If card is not eligible, never show card buttons
@@ -46,7 +46,7 @@ describe("card eligibility", () => {
46
46
  // $FlowIssue
47
47
  wallet: getWallet(),
48
48
  flow: BUTTON_FLOW.PURCHASE,
49
- })
49
+ }),
50
50
  ).toEqual(false);
51
51
  });
52
52
 
@@ -58,7 +58,7 @@ describe("card eligibility", () => {
58
58
  fundingEligibility: getEligibility({ branded: true }),
59
59
  wallet: getWallet(),
60
60
  flow: BUTTON_FLOW.PURCHASE,
61
- })
61
+ }),
62
62
  ).toEqual(true);
63
63
  });
64
64
 
@@ -70,7 +70,7 @@ describe("card eligibility", () => {
70
70
  fundingEligibility: getEligibility(),
71
71
  wallet: getWallet(),
72
72
  flow: BUTTON_FLOW.PURCHASE,
73
- })
73
+ }),
74
74
  ).toEqual(true);
75
75
  });
76
76
 
@@ -83,7 +83,7 @@ describe("card eligibility", () => {
83
83
  fundingEligibility: getEligibility(),
84
84
  wallet: getWallet(),
85
85
  flow: BUTTON_FLOW.PURCHASE,
86
- })
86
+ }),
87
87
  ).toEqual(false);
88
88
  });
89
89
 
@@ -98,7 +98,7 @@ describe("card eligibility", () => {
98
98
  card: ["some instrument"],
99
99
  }),
100
100
  flow: BUTTON_FLOW.PURCHASE,
101
- })
101
+ }),
102
102
  ).toEqual(false);
103
103
  });
104
104
 
@@ -112,7 +112,7 @@ describe("card eligibility", () => {
112
112
  card: ["some instrument"],
113
113
  }),
114
114
  flow: BUTTON_FLOW.PURCHASE,
115
- })
115
+ }),
116
116
  ).toEqual(true);
117
117
  });
118
118
 
@@ -124,7 +124,7 @@ describe("card eligibility", () => {
124
124
  fundingEligibility: getEligibility(),
125
125
  wallet: getWallet(),
126
126
  flow: BUTTON_FLOW.PURCHASE,
127
- })
127
+ }),
128
128
  ).toEqual(false);
129
129
  });
130
130
 
@@ -136,7 +136,7 @@ describe("card eligibility", () => {
136
136
  fundingEligibility: getEligibility(),
137
137
  wallet: getWallet(),
138
138
  flow: BUTTON_FLOW.PURCHASE,
139
- })
139
+ }),
140
140
  ).toEqual(true);
141
141
  });
142
142
  });
@@ -145,7 +145,7 @@ describe("rebrand card config", () => {
145
145
  test("should have standard colors", () => {
146
146
  const colors = getCardConfig().colors;
147
147
  expect(colors).toEqual(
148
- expect.arrayContaining([BUTTON_COLOR.BLACK, BUTTON_COLOR.WHITE])
148
+ expect.arrayContaining([BUTTON_COLOR.BLACK, BUTTON_COLOR.WHITE]),
149
149
  );
150
150
  });
151
151
 
@@ -154,7 +154,7 @@ describe("rebrand card config", () => {
154
154
  expect(logoColors).toEqual(
155
155
  expect.objectContaining({
156
156
  [BUTTON_COLOR.WHITE]: BUTTON_COLOR.BLACK,
157
- })
157
+ }),
158
158
  );
159
159
  });
160
160
  });
@@ -57,7 +57,7 @@ function isFundingVaultable({
57
57
 
58
58
  // If any vendors are both eligible & vaultable, card is vaultable
59
59
  return Object.keys(vendors).some(
60
- (vendor) => vendors[vendor]?.eligible && vendors[vendor]?.vaultable
60
+ (vendor) => vendors[vendor]?.eligible && vendors[vendor]?.vaultable,
61
61
  );
62
62
  }
63
63
 
@@ -92,7 +92,7 @@ export function isFundingEligible(
92
92
  experiment,
93
93
  displayOnly,
94
94
  userAgent,
95
- }: IsFundingEligibleOptions
95
+ }: IsFundingEligibleOptions,
96
96
  ): boolean {
97
97
  // Temporary: Force credit to be eligible if the experiment is enabled
98
98
  // but honor merchant opt-out via disableFunding
@@ -145,9 +145,9 @@ export function isFundingEligible(
145
145
  layout,
146
146
  shippingChange: Boolean(
147
147
  hasShippingCallback ||
148
- onShippingChange ||
149
- onShippingAddressChange ||
150
- onShippingOptionsChange
148
+ onShippingChange ||
149
+ onShippingAddressChange ||
150
+ onShippingOptionsChange,
151
151
  ),
152
152
  wallet,
153
153
  displayOnly,
@@ -283,7 +283,7 @@ export function determineEligibleFunding({
283
283
  experiment,
284
284
  displayOnly,
285
285
  userAgent,
286
- })
286
+ }),
287
287
  );
288
288
 
289
289
  if (layout === BUTTON_LAYOUT.HORIZONTAL) {
@@ -102,7 +102,7 @@ describe("Funding eligibility", () => {
102
102
  test("should not be eligible if funding source is missing from fundingEligibility", () => {
103
103
  const fundingEligible = isFundingEligible(
104
104
  FUNDING.WECHATPAY,
105
- defaultMockFundingOptions
105
+ defaultMockFundingOptions,
106
106
  );
107
107
 
108
108
  expect(fundingEligible).toBe(false);
@@ -164,7 +164,7 @@ describe("Funding eligibility", () => {
164
164
  test("should not be eligible if fundingSource.eligible is false", () => {
165
165
  const fundingEligible = isFundingEligible(
166
166
  FUNDING.SEPA,
167
- defaultMockFundingOptions
167
+ defaultMockFundingOptions,
168
168
  );
169
169
 
170
170
  expect(fundingEligible).toBe(false);
@@ -173,7 +173,7 @@ describe("Funding eligibility", () => {
173
173
  test("should not be eligible if fundingSource.eligible is false and fundingSource.vaultable is true", () => {
174
174
  const fundingEligible = isFundingEligible(
175
175
  FUNDING.OXXO,
176
- defaultMockFundingOptions
176
+ defaultMockFundingOptions,
177
177
  );
178
178
 
179
179
  expect(fundingEligible).toBe(false);
@@ -22,7 +22,7 @@ import css from "./style.scoped.scss";
22
22
 
23
23
  function getLabelText(
24
24
  fundingEligibility: FundingEligibilityType,
25
- locale?: LocaleType
25
+ locale?: LocaleType,
26
26
  ): ?string {
27
27
  const { paylater } = fundingEligibility;
28
28
  const { lang } = locale || {};
@@ -31,7 +31,7 @@ function getLabelText(
31
31
 
32
32
  if (
33
33
  paylater?.products?.paylater?.eligible &&
34
- paylater?.products?.paylater?.variant === "DE"
34
+ ["DE", "AT"].includes(paylater?.products?.paylater?.variant)
35
35
  ) {
36
36
  labelText = "Später Bezahlen";
37
37
  }
@@ -134,16 +134,16 @@ function getButtonPersonalizationStyle(opts: LabelOptions): ?ChildType {
134
134
  innerHTML={`
135
135
  @media only screen and (max-width: ${MIN_WIDTH}px) {
136
136
  .${CLASS.DOM_READY} ${PAYPAL_BUTTON} .${
137
- CLASS.PERSONALIZATION_TEXT
138
- } {
137
+ CLASS.PERSONALIZATION_TEXT
138
+ } {
139
139
  ${HIDDEN}
140
140
  }
141
141
  }
142
142
 
143
143
  @media only screen and (min-width: ${MIN_WIDTH}px) {
144
144
  .${CLASS.DOM_READY} ${PAYPAL_BUTTON} .${LOGO_CLASS.LOGO}.${
145
- LOGO_CLASS.LOGO
146
- }-${FUNDING.PAYPAL} {
145
+ LOGO_CLASS.LOGO
146
+ }-${FUNDING.PAYPAL} {
147
147
  animation: ${
148
148
  personalizationText
149
149
  ? `toggle-paypal-logo ${PERSONALIZATION_DURATION}s 0s forwards`
@@ -152,8 +152,8 @@ function getButtonPersonalizationStyle(opts: LabelOptions): ?ChildType {
152
152
  }
153
153
 
154
154
  .${CLASS.DOM_READY} ${PAYPAL_BUTTON} .${CLASS.TEXT}:not(.${
155
- CLASS.PERSONALIZATION_TEXT
156
- }):not(.${CLASS.HIDDEN}) {
155
+ CLASS.PERSONALIZATION_TEXT
156
+ }):not(.${CLASS.HIDDEN}) {
157
157
  ${COMPRESSED}
158
158
  ${VISIBLE}
159
159
  animation: ${
@@ -164,8 +164,8 @@ function getButtonPersonalizationStyle(opts: LabelOptions): ?ChildType {
164
164
  }
165
165
 
166
166
  .${CLASS.DOM_READY} ${PAYPAL_BUTTON} .${
167
- CLASS.PERSONALIZATION_TEXT
168
- } {
167
+ CLASS.PERSONALIZATION_TEXT
168
+ } {
169
169
  ${COMPRESSED}
170
170
  ${VISIBLE}
171
171
  animation: show-personalization-text ${PERSONALIZATION_DURATION}s 0s forwards;
@@ -85,7 +85,7 @@ export function getFundingSourceColors({
85
85
  export function supportsVenmoPopups(
86
86
  experiment?: Experiment,
87
87
  supportsPopups: boolean,
88
- userAgent: string
88
+ userAgent: string,
89
89
  ): boolean {
90
90
  if (__WEB__ && isVenmoSupportedWebView(userAgent)) {
91
91
  if (window.popupBridge) {
@@ -102,7 +102,7 @@ export function supportsVenmoPopups(
102
102
 
103
103
  export function isSupportedNativeVenmoBrowser(
104
104
  experiment?: Experiment,
105
- userAgent: string
105
+ userAgent: string,
106
106
  ): boolean {
107
107
  if (__WEB__ && isVenmoSupportedWebView(userAgent)) {
108
108
  if (window.popupBridge) {
@@ -115,7 +115,7 @@ describe("funding/util", () => {
115
115
  expect(result.colors).toBe(mockFundingConfig.colorsRebrand);
116
116
  expect(result.logoColors).toBe(mockFundingConfig.logoColorsRebrand);
117
117
  expect(result.secondaryColors).toBe(
118
- mockFundingConfig.secondaryColorsRebrand
118
+ mockFundingConfig.secondaryColorsRebrand,
119
119
  );
120
120
  expect(result.textColors).toBe(mockFundingConfig.textColorsRebrand);
121
121
  });
@@ -148,13 +148,13 @@ describe("funding/util", () => {
148
148
  });
149
149
 
150
150
  expect(result.logoColors).toBe(
151
- configWithoutColorsRebrand.logoColorsRebrand
151
+ configWithoutColorsRebrand.logoColorsRebrand,
152
152
  );
153
153
  expect(result.secondaryColors).toBe(
154
- configWithoutColorsRebrand.secondaryColorsRebrand
154
+ configWithoutColorsRebrand.secondaryColorsRebrand,
155
155
  );
156
156
  expect(result.textColors).toBe(
157
- configWithoutColorsRebrand.textColorsRebrand
157
+ configWithoutColorsRebrand.textColorsRebrand,
158
158
  );
159
159
  });
160
160
  });
@@ -182,7 +182,7 @@ describe("funding/util", () => {
182
182
  const experiment = { venmoEnableWebOnNonNativeBrowser: true };
183
183
 
184
184
  expect(supportsVenmoPopups(experiment, true, defaultUserAgent)).toBe(
185
- true
185
+ true,
186
186
  );
187
187
  });
188
188
 
@@ -191,7 +191,7 @@ describe("funding/util", () => {
191
191
  const experiment = { venmoEnableWebOnNonNativeBrowser: true };
192
192
 
193
193
  expect(supportsVenmoPopups(experiment, false, defaultUserAgent)).toBe(
194
- false
194
+ false,
195
195
  );
196
196
  });
197
197
 
@@ -200,7 +200,7 @@ describe("funding/util", () => {
200
200
  const experiment = { venmoEnableWebOnNonNativeBrowser: true };
201
201
 
202
202
  expect(supportsVenmoPopups(experiment, false, defaultUserAgent)).toBe(
203
- false
203
+ false,
204
204
  );
205
205
  });
206
206
 
@@ -209,7 +209,7 @@ describe("funding/util", () => {
209
209
  const experiment = { venmoEnableWebOnNonNativeBrowser: true };
210
210
 
211
211
  expect(supportsVenmoPopups(experiment, false, defaultUserAgent)).toBe(
212
- false
212
+ false,
213
213
  );
214
214
  });
215
215
 
@@ -218,7 +218,7 @@ describe("funding/util", () => {
218
218
  const experiment = { venmoEnableWebOnNonNativeBrowser: true };
219
219
 
220
220
  expect(supportsVenmoPopups(experiment, false, defaultUserAgent)).toBe(
221
- false
221
+ false,
222
222
  );
223
223
  });
224
224
 
@@ -227,7 +227,7 @@ describe("funding/util", () => {
227
227
  const experiment = { venmoEnableWebOnNonNativeBrowser: true };
228
228
 
229
229
  expect(supportsVenmoPopups(experiment, false, defaultUserAgent)).toBe(
230
- false
230
+ false,
231
231
  );
232
232
  });
233
233
 
@@ -236,7 +236,7 @@ describe("funding/util", () => {
236
236
  const experiment = {};
237
237
 
238
238
  expect(supportsVenmoPopups(experiment, true, defaultUserAgent)).toBe(
239
- true
239
+ true,
240
240
  );
241
241
  });
242
242
 
@@ -245,7 +245,7 @@ describe("funding/util", () => {
245
245
  const experiment = { venmoEnableWebOnNonNativeBrowser: false };
246
246
 
247
247
  expect(supportsVenmoPopups(experiment, false, defaultUserAgent)).toBe(
248
- false
248
+ false,
249
249
  );
250
250
  });
251
251
 
@@ -253,7 +253,7 @@ describe("funding/util", () => {
253
253
  vi.mocked(supportsPopups).mockReturnValue(true);
254
254
 
255
255
  expect(supportsVenmoPopups(undefined, true, defaultUserAgent)).toBe(
256
- true
256
+ true,
257
257
  );
258
258
  });
259
259
  });
@@ -310,7 +310,7 @@ describe("funding/util", () => {
310
310
  const experiment = { venmoEnableWebOnNonNativeBrowser: true };
311
311
 
312
312
  expect(
313
- isSupportedNativeVenmoBrowser(experiment, defaultUserAgent)
313
+ isSupportedNativeVenmoBrowser(experiment, defaultUserAgent),
314
314
  ).toBe(true);
315
315
  });
316
316
 
@@ -327,7 +327,7 @@ describe("funding/util", () => {
327
327
  const experiment = { venmoEnableWebOnNonNativeBrowser: true };
328
328
 
329
329
  expect(
330
- isSupportedNativeVenmoBrowser(experiment, defaultUserAgent)
330
+ isSupportedNativeVenmoBrowser(experiment, defaultUserAgent),
331
331
  ).toBe(true);
332
332
  });
333
333
 
@@ -349,7 +349,7 @@ describe("funding/util", () => {
349
349
  vi.mocked(isSafari).mockReturnValue(true);
350
350
 
351
351
  expect(isSupportedNativeVenmoBrowser(undefined, defaultUserAgent)).toBe(
352
- true
352
+ true,
353
353
  );
354
354
  });
355
355
 
@@ -92,7 +92,7 @@ describe("HostedButtons v1", () => {
92
92
  // $FlowIssue
93
93
  request.mockImplementationOnce(() =>
94
94
  // eslint-disable-next-line compat/compat
95
- Promise.resolve(hostedButtonDetailsResponse)
95
+ Promise.resolve(hostedButtonDetailsResponse),
96
96
  );
97
97
  await HostedButtons({
98
98
  hostedButtonId,
@@ -102,7 +102,7 @@ describe("HostedButtons v1", () => {
102
102
  expect.objectContaining({
103
103
  hostedButtonId,
104
104
  style: expect.objectContaining({ tagline: true }),
105
- })
105
+ }),
106
106
  );
107
107
  expect(Buttons).toHaveBeenCalledTimes(1);
108
108
  expect.assertions(2);
@@ -121,7 +121,7 @@ describe("HostedButtons v1", () => {
121
121
  // $FlowIssue
122
122
  request.mockImplementationOnce(() =>
123
123
  // eslint-disable-next-line compat/compat
124
- Promise.resolve(hostedButtonDetailsResponse)
124
+ Promise.resolve(hostedButtonDetailsResponse),
125
125
  );
126
126
  await HostedButtons({
127
127
  hostedButtonId,
@@ -130,7 +130,7 @@ describe("HostedButtons v1", () => {
130
130
  expect(Buttons).toHaveBeenCalledWith(
131
131
  expect.objectContaining({
132
132
  hostedButtonId,
133
- })
133
+ }),
134
134
  );
135
135
  expect(Buttons).toHaveBeenCalledTimes(1);
136
136
  expect(renderMock).toHaveBeenCalledTimes(1);
@@ -181,7 +181,7 @@ describe("HostedButtons v1", () => {
181
181
  ],
182
182
  },
183
183
  },
184
- })
184
+ }),
185
185
  );
186
186
  await HostedButtons({
187
187
  hostedButtonId,
@@ -191,7 +191,7 @@ describe("HostedButtons v1", () => {
191
191
  expect.objectContaining({
192
192
  hostedButtonId,
193
193
  style: expect.objectContaining({ tagline: false }),
194
- })
194
+ }),
195
195
  );
196
196
  expect(Buttons).toHaveBeenCalledTimes(1);
197
197
  expect(renderMock).toHaveBeenCalledTimes(1);
@@ -238,7 +238,7 @@ describe("HostedButtons v2", () => {
238
238
  // $FlowIssue
239
239
  request.mockImplementationOnce(() =>
240
240
  // eslint-disable-next-line compat/compat
241
- Promise.resolve(hostedButtonDetailsResponse)
241
+ Promise.resolve(hostedButtonDetailsResponse),
242
242
  );
243
243
 
244
244
  await HostedButtons({
@@ -251,13 +251,13 @@ describe("HostedButtons v2", () => {
251
251
  expect(renderStandaloneButton).toHaveBeenCalledWith(
252
252
  expect.objectContaining({
253
253
  fundingSource: "paypal",
254
- })
254
+ }),
255
255
  );
256
256
 
257
257
  expect(renderDefaultButton).toHaveBeenCalledWith(
258
258
  expect.objectContaining({
259
259
  eligibleDefaultButtons: ["venmo", "paylater"],
260
- })
260
+ }),
261
261
  );
262
262
  });
263
263
  });
@@ -33,7 +33,7 @@ export type OnShippingAddressChange = (
33
33
  |},
34
34
  actions: {|
35
35
  reject: (arg: string) => void,
36
- |}
36
+ |},
37
37
  ) => Promise<mixed>;
38
38
 
39
39
  export type OnShippingOptionsChange = (
@@ -48,7 +48,7 @@ export type OnShippingOptionsChange = (
48
48
  |},
49
49
  actions: {|
50
50
  reject: (arg: string) => void,
51
- |}
51
+ |},
52
52
  ) => Promise<mixed>;
53
53
 
54
54
  export type FundingSources = string;
@@ -93,7 +93,7 @@ export type HostedButtonOptions = {|
93
93
  |};
94
94
 
95
95
  export type ButtonPreferences = $ReadOnlyArray<
96
- $Values<typeof FUNDING> | "default"
96
+ $Values<typeof FUNDING> | "default",
97
97
  >;
98
98
 
99
99
  export type HostedButtonPreferences = {|
@@ -92,7 +92,7 @@ export const createAccessToken: CreateAccessToken = memoize<CreateAccessToken>(
92
92
  accessToken,
93
93
  nonce,
94
94
  };
95
- }
95
+ },
96
96
  );
97
97
 
98
98
  export const buildRequestHeaders: BuildRequestHeaders = async ({
@@ -137,7 +137,7 @@ export const getButtonPreferences = ({
137
137
  throw new Error(
138
138
  `Expected preferences to be populated, received: ${JSON.stringify({
139
139
  preferences,
140
- })}`
140
+ })}`,
141
141
  );
142
142
  }
143
143
 
@@ -148,11 +148,11 @@ export const getButtonPreferences = ({
148
148
  buttonPreferences: buttonPreferences.filter(
149
149
  (fundingMethod) =>
150
150
  eligibleFundingMethods.includes(fundingMethod) ||
151
- fundingMethod === "default"
151
+ fundingMethod === "default",
152
152
  ),
153
153
  // Sort the eligible funding methods returned from /ncp/api/form-fields in the order that they would appear in the smart stack.
154
154
  eligibleFundingMethods: SUPPORTED_FUNDING_SOURCES.filter((fundingMethod) =>
155
- eligibleFundingMethods.includes(fundingMethod)
155
+ eligibleFundingMethods.includes(fundingMethod),
156
156
  ),
157
157
  };
158
158
  };
@@ -218,7 +218,7 @@ export const getHostedButtonDetails: HostedButtonDetailsParams = async ({
218
218
  };
219
219
 
220
220
  export function getElementFromSelector(
221
- selector: string | HTMLElement
221
+ selector: string | HTMLElement,
222
222
  ): HTMLElement | null {
223
223
  return typeof selector === "string"
224
224
  ? document.querySelector(selector)
@@ -446,7 +446,7 @@ export const getFlexDirection = ({
446
446
  export const getButtonColor = (
447
447
  color: Color,
448
448
  fundingSource: FundingSources,
449
- shouldApplyRebrandedStyles?: boolean
449
+ shouldApplyRebrandedStyles?: boolean,
450
450
  ): Color => {
451
451
  const colorMap = {
452
452
  gold: {
@@ -504,7 +504,7 @@ export const getDefaultButtonOptions = ({
504
504
  eligibleFundingMethods,
505
505
  }: HostedButtonPreferences): ButtonPreferences => {
506
506
  return eligibleFundingMethods.filter(
507
- (fundingSource: string) => !buttonPreferences.includes(fundingSource)
507
+ (fundingSource: string) => !buttonPreferences.includes(fundingSource),
508
508
  );
509
509
  };
510
510
 
@@ -529,7 +529,7 @@ export const getButtons = ({
529
529
  color: getButtonColor(
530
530
  style.color,
531
531
  fundingSource,
532
- style.shouldApplyRebrandedStyles
532
+ style.shouldApplyRebrandedStyles,
533
533
  ),
534
534
  },
535
535
  });