@paypal/checkout-components 5.0.394 → 5.0.396

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paypal/checkout-components",
3
- "version": "5.0.394",
3
+ "version": "5.0.396",
4
4
  "description": "PayPal Checkout components, for integrating checkout products.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -144,6 +144,7 @@ export type FundingSourceConfig = {|
144
144
  fundingEligibility: ?FundingEligibilityType,
145
145
  label?: string,
146
146
  period?: number,
147
+ locale?: LocaleType,
147
148
  |}) => string),
148
149
  showWalletMenu: ({|
149
150
  instrument: WalletInstrument,
@@ -16,7 +16,6 @@ import type { Wallet, Experiment } from "../types";
16
16
  import { BUTTON_LAYOUT, BUTTON_FLOW } from "../constants";
17
17
 
18
18
  import { getFundingConfig } from "./config";
19
- import { supportsVenmoPopups, isSupportedNativeVenmoBrowser } from "./util";
20
19
 
21
20
  type IsFundingEligibleOptions = {|
22
21
  layout?: $Values<typeof BUTTON_LAYOUT>,
@@ -33,6 +32,8 @@ type IsFundingEligibleOptions = {|
33
32
  wallet?: ?Wallet,
34
33
  applePaySupport: boolean,
35
34
  supportsPopups: boolean,
35
+ supportsVenmoPopups: boolean,
36
+ supportedNativeVenmoBrowser: boolean,
36
37
  supportedNativeBrowser: boolean,
37
38
  experiment?: Experiment,
38
39
  displayOnly?: $ReadOnlyArray<$Values<typeof DISPLAY_ONLY_VALUES>>,
@@ -83,7 +84,9 @@ export function isFundingEligible(
83
84
  wallet,
84
85
  applePaySupport,
85
86
  supportsPopups,
87
+ supportsVenmoPopups,
86
88
  supportedNativeBrowser,
89
+ supportedNativeVenmoBrowser,
87
90
  experiment,
88
91
  displayOnly,
89
92
  userAgent,
@@ -171,12 +174,10 @@ export function isFundingEligible(
171
174
  if (fundingConfig.requires && userAgent) {
172
175
  const required = fundingConfig.requires({ experiment, platform });
173
176
  const popupSupport =
174
- source === FUNDING.VENMO
175
- ? supportsVenmoPopups(experiment, supportsPopups, userAgent)
176
- : supportsPopups;
177
+ source === FUNDING.VENMO ? supportsVenmoPopups : supportsPopups;
177
178
  const nativeBrowserSupport =
178
179
  source === FUNDING.VENMO
179
- ? isSupportedNativeVenmoBrowser(experiment, userAgent)
180
+ ? supportedNativeVenmoBrowser
180
181
  : supportedNativeBrowser;
181
182
  if (required.popup === true && popupSupport === false) {
182
183
  return false;
@@ -221,6 +222,8 @@ export function determineEligibleFunding({
221
222
  applePaySupport,
222
223
  supportsPopups,
223
224
  supportedNativeBrowser,
225
+ supportsVenmoPopups,
226
+ supportedNativeVenmoBrowser,
224
227
  experiment,
225
228
  displayOnly = [],
226
229
  userAgent = "",
@@ -241,6 +244,8 @@ export function determineEligibleFunding({
241
244
  applePaySupport: boolean,
242
245
  supportsPopups: boolean,
243
246
  supportedNativeBrowser: boolean,
247
+ supportsVenmoPopups: boolean,
248
+ supportedNativeVenmoBrowser: boolean,
244
249
  experiment: Experiment,
245
250
  displayOnly?: $ReadOnlyArray<$Values<typeof DISPLAY_ONLY_VALUES>>,
246
251
  userAgent?: string,
@@ -265,7 +270,9 @@ export function determineEligibleFunding({
265
270
  wallet,
266
271
  applePaySupport,
267
272
  supportsPopups,
273
+ supportsVenmoPopups,
268
274
  supportedNativeBrowser,
275
+ supportedNativeVenmoBrowser,
269
276
  experiment,
270
277
  displayOnly,
271
278
  userAgent,
@@ -5,15 +5,8 @@ import { describe, expect, vi, beforeEach, afterEach } from "vitest";
5
5
  import { BUTTON_FLOW } from "../constants";
6
6
 
7
7
  import { isFundingEligible, isWalletFundingEligible } from "./funding";
8
- import { supportsVenmoPopups, isSupportedNativeVenmoBrowser } from "./util";
9
8
  import { getFundingConfig } from "./config";
10
9
 
11
- // Mock the venmo utility functions
12
- vi.mock("./util", () => ({
13
- supportsVenmoPopups: vi.fn(),
14
- isSupportedNativeVenmoBrowser: vi.fn(),
15
- }));
16
-
17
10
  // Mock getFundingConfig to control funding config behavior
18
11
  vi.mock("./config", () => ({
19
12
  getFundingConfig: vi.fn(),
@@ -65,6 +58,8 @@ const defaultMockFundingOptions = {
65
58
  applePaySupport: false,
66
59
  supportsPopups: true,
67
60
  supportedNativeBrowser: true,
61
+ supportsVenmoPopups: false,
62
+ supportedNativeVenmoBrowser: false,
68
63
  onShippingChange: null,
69
64
  onShippingAddressChange: null,
70
65
  onShippingOptionsChange: null,
@@ -265,91 +260,66 @@ describe("Funding eligibility", () => {
265
260
  });
266
261
 
267
262
  test("should use supportsVenmoPopups for venmo funding source when popup is required", () => {
268
- vi.mocked(supportsVenmoPopups).mockReturnValue(true);
269
- vi.mocked(isSupportedNativeVenmoBrowser).mockReturnValue(true);
270
-
271
263
  const options = {
272
264
  ...defaultMockFundingOptions,
273
265
  fundingSource: FUNDING.VENMO,
274
266
  platform: "mobile",
275
267
  experiment: { venmoEnableWebOnNonNativeBrowser: true },
268
+ supportsVenmoPopups: true,
269
+ supportedNativeVenmoBrowser: true,
276
270
  };
277
271
 
278
272
  const result = isFundingEligible(FUNDING.VENMO, options);
279
273
 
280
- expect(supportsVenmoPopups).toHaveBeenCalledWith(
281
- options.experiment,
282
- true,
283
- options.userAgent
284
- );
285
274
  expect(result).toBe(true);
286
275
  });
287
276
 
288
277
  test("should use isSupportedNativeVenmoBrowser for venmo funding source when native is required", () => {
289
- vi.mocked(supportsVenmoPopups).mockReturnValue(true);
290
- vi.mocked(isSupportedNativeVenmoBrowser).mockReturnValue(true);
291
-
292
278
  const options = {
293
279
  ...defaultMockFundingOptions,
294
280
  fundingSource: FUNDING.VENMO,
295
281
  platform: "mobile",
296
282
  experiment: { venmoEnableWebOnNonNativeBrowser: true },
283
+ supportedNativeVenmoBrowser: true,
284
+ supportsVenmoPopups: true,
297
285
  };
298
286
 
299
287
  const result = isFundingEligible(FUNDING.VENMO, options);
300
288
 
301
- expect(isSupportedNativeVenmoBrowser).toHaveBeenCalledWith(
302
- options.experiment,
303
- options.userAgent
304
- );
305
289
  expect(result).toBe(true);
306
290
  });
307
291
 
308
292
  test("should return false when venmo popup support is required but supportsVenmoPopups returns false", () => {
309
- vi.mocked(supportsVenmoPopups).mockReturnValue(false);
310
- vi.mocked(isSupportedNativeVenmoBrowser).mockReturnValue(true);
311
-
312
293
  const options = {
313
294
  ...defaultMockFundingOptions,
314
295
  fundingSource: FUNDING.VENMO,
315
296
  platform: "mobile",
316
297
  experiment: {},
298
+ supportsVenmoPopups: false,
299
+ supportedNativeVenmoBrowser: true,
317
300
  };
318
301
 
319
302
  const result = isFundingEligible(FUNDING.VENMO, options);
320
303
 
321
- expect(supportsVenmoPopups).toHaveBeenCalledWith(
322
- options.experiment,
323
- true,
324
- options.userAgent
325
- );
326
304
  expect(result).toBe(false);
327
305
  });
328
306
 
329
307
  test("should return false when venmo native support is required but isSupportedNativeVenmoBrowser returns false", () => {
330
- vi.mocked(supportsVenmoPopups).mockReturnValue(true);
331
- vi.mocked(isSupportedNativeVenmoBrowser).mockReturnValue(false);
332
-
333
308
  const options = {
334
309
  ...defaultMockFundingOptions,
335
310
  fundingSource: FUNDING.VENMO,
336
311
  platform: "mobile",
337
312
  experiment: {},
313
+ supportedNativeVenmoBrowser: false,
314
+ supportsVenmoPopups: true,
338
315
  };
339
316
 
340
317
  const result = isFundingEligible(FUNDING.VENMO, options);
341
318
 
342
- expect(isSupportedNativeVenmoBrowser).toHaveBeenCalledWith(
343
- options.experiment,
344
- options.userAgent
345
- );
346
319
  expect(result).toBe(false);
347
320
  });
348
321
 
349
322
  test("should use standard supportsPopups for non-venmo funding sources", () => {
350
- vi.mocked(supportsVenmoPopups).mockReturnValue(false);
351
- vi.mocked(isSupportedNativeVenmoBrowser).mockReturnValue(false);
352
-
353
323
  // Update the mock to not require popup and native for PayPal to isolate the test
354
324
  vi.mocked(getFundingConfig).mockReturnValue({
355
325
  [FUNDING.PAYLATER]: {
@@ -402,41 +372,25 @@ describe("Funding eligibility", () => {
402
372
 
403
373
  const result = isFundingEligible(FUNDING.PAYPAL, options);
404
374
 
405
- // Venmo functions should not be called for non-venmo sources
406
- expect(supportsVenmoPopups).not.toHaveBeenCalled();
407
- expect(isSupportedNativeVenmoBrowser).not.toHaveBeenCalled();
408
375
  expect(result).toBe(true);
409
376
  });
410
377
 
411
378
  test("should handle undefined experiment parameter for venmo", () => {
412
- vi.mocked(supportsVenmoPopups).mockReturnValue(true);
413
- vi.mocked(isSupportedNativeVenmoBrowser).mockReturnValue(true);
414
-
415
379
  const options = {
416
380
  ...defaultMockFundingOptions,
417
381
  fundingSource: FUNDING.VENMO,
418
382
  platform: "mobile",
419
383
  experiment: undefined,
384
+ supportsVenmoPopups: true,
385
+ supportedNativeVenmoBrowser: true,
420
386
  };
421
387
 
422
388
  const result = isFundingEligible(FUNDING.VENMO, options);
423
389
 
424
- expect(supportsVenmoPopups).toHaveBeenCalledWith(
425
- undefined,
426
- true,
427
- options.userAgent
428
- );
429
- expect(isSupportedNativeVenmoBrowser).toHaveBeenCalledWith(
430
- undefined,
431
- options.userAgent
432
- );
433
390
  expect(result).toBe(true);
434
391
  });
435
392
 
436
393
  test("should pass through experiment flags to venmo utility functions", () => {
437
- vi.mocked(supportsVenmoPopups).mockReturnValue(true);
438
- vi.mocked(isSupportedNativeVenmoBrowser).mockReturnValue(true);
439
-
440
394
  const experimentFlags = {
441
395
  venmoEnableWebOnNonNativeBrowser: true,
442
396
  venmoVaultWithoutPurchase: false,
@@ -447,32 +401,23 @@ describe("Funding eligibility", () => {
447
401
  fundingSource: FUNDING.VENMO,
448
402
  platform: "mobile",
449
403
  experiment: experimentFlags,
404
+ supportsVenmoPopups: true,
405
+ supportedNativeVenmoBrowser: true,
450
406
  };
451
407
 
452
408
  const result = isFundingEligible(FUNDING.VENMO, options);
453
409
 
454
- expect(supportsVenmoPopups).toHaveBeenCalledWith(
455
- experimentFlags,
456
- true,
457
- options.userAgent
458
- );
459
- expect(isSupportedNativeVenmoBrowser).toHaveBeenCalledWith(
460
- experimentFlags,
461
- options.userAgent
462
- );
463
410
  expect(result).toBe(true);
464
411
  });
465
412
 
466
413
  test("should respect combination of venmo popup and native requirements", () => {
467
- // Test case where popup succeeds but native fails
468
- vi.mocked(supportsVenmoPopups).mockReturnValue(true);
469
- vi.mocked(isSupportedNativeVenmoBrowser).mockReturnValue(false);
470
-
471
414
  const options = {
472
415
  ...defaultMockFundingOptions,
473
416
  fundingSource: FUNDING.VENMO,
474
417
  platform: "mobile",
475
418
  experiment: {},
419
+ supportsVenmoPopups: true,
420
+ supportedNativeVenmoBrowser: false,
476
421
  };
477
422
 
478
423
  const result = isFundingEligible(FUNDING.VENMO, options);
@@ -480,7 +425,7 @@ describe("Funding eligibility", () => {
480
425
  expect(result).toBe(false);
481
426
 
482
427
  // Test case where both succeed
483
- vi.mocked(isSupportedNativeVenmoBrowser).mockReturnValue(true);
428
+ options.supportedNativeVenmoBrowser = true;
484
429
 
485
430
  const result2 = isFundingEligible(FUNDING.VENMO, options);
486
431
  expect(result2).toBe(true);
@@ -2,7 +2,7 @@
2
2
  /** @jsx node */
3
3
 
4
4
  import type { FundingEligibilityType } from "@paypal/sdk-client/src";
5
- import { FUNDING } from "@paypal/sdk-constants/src";
5
+ import { FUNDING, type LocaleType } from "@paypal/sdk-constants/src";
6
6
  import { node, Style } from "@krakenjs/jsx-pragmatic/src";
7
7
  import {
8
8
  PPLogoExternalImage,
@@ -22,9 +22,11 @@ import css from "./style.scoped.scss";
22
22
 
23
23
  function getLabelText(
24
24
  fundingEligibility: FundingEligibilityType,
25
+ locale?: LocaleType,
25
26
  shouldApplyRebrandedStyles?: boolean
26
27
  ): ?string {
27
28
  const { paylater } = fundingEligibility;
29
+ const { lang } = locale || {};
28
30
 
29
31
  let labelText;
30
32
 
@@ -53,6 +55,14 @@ function getLabelText(
53
55
  labelText = "Paga a rate";
54
56
  }
55
57
 
58
+ if (
59
+ paylater?.products?.paylater?.eligible &&
60
+ paylater?.products?.paylater?.variant === "CA" &&
61
+ lang === "fr"
62
+ ) {
63
+ labelText = "Payer en 4";
64
+ }
65
+
56
66
  if (paylater?.products?.payIn4?.eligible) {
57
67
  labelText = "Pay in 4";
58
68
  }
@@ -104,7 +114,9 @@ export function getPaylaterConfig(): FundingSourceConfig {
104
114
  ) : (
105
115
  <PPLogoInlineSVG logoColor={logoColor} />
106
116
  )}
107
- <Text>{getLabelText(fundingEligibility) || "Pay Later"}</Text>
117
+ <Text>
118
+ {getLabelText(fundingEligibility, locale) || "Pay Later"}
119
+ </Text>
108
120
  </Style>
109
121
  );
110
122
  }
@@ -125,8 +137,11 @@ export function getPaylaterConfig(): FundingSourceConfig {
125
137
  <PPRebrandLogoInlineSVG logoColor={logoColorPP} />
126
138
  )}
127
139
  <Text>
128
- {getLabelText(fundingEligibility, shouldApplyRebrandedStyles) ||
129
- "Pay Later"}
140
+ {getLabelText(
141
+ fundingEligibility,
142
+ locale,
143
+ shouldApplyRebrandedStyles
144
+ ) || "Pay Later"}
130
145
  </Text>
131
146
  </Style>
132
147
  );
@@ -175,9 +190,9 @@ export function getPaylaterConfig(): FundingSourceConfig {
175
190
  [BUTTON_COLOR.REBRAND_BLACK]: LOGO_COLOR.WHITE,
176
191
  },
177
192
 
178
- labelText: ({ fundingEligibility }) => {
193
+ labelText: ({ fundingEligibility, locale }) => {
179
194
  return (
180
- (fundingEligibility && getLabelText(fundingEligibility)) ||
195
+ (fundingEligibility && getLabelText(fundingEligibility, locale)) ||
181
196
  `${FUNDING.PAYPAL} ${FUNDING.PAYLATER}`
182
197
  );
183
198
  },
@@ -50,16 +50,16 @@ export function supportsVenmoPopups(
50
50
  supportsPopups: boolean,
51
51
  userAgent: string
52
52
  ): boolean {
53
- if (isVenmoSupportedWebView(userAgent)) {
54
- if (typeof window !== "undefined" && window.popupBridge) {
53
+ if (__WEB__ && isVenmoSupportedWebView(userAgent)) {
54
+ if (window.popupBridge) {
55
55
  return true;
56
56
  }
57
- return false;
58
57
  }
59
58
 
60
59
  if (experiment?.venmoEnableWebOnNonNativeBrowser === true) {
61
60
  return venmoUserAgentSupportsPopups(userAgent);
62
61
  }
62
+
63
63
  return supportsPopups;
64
64
  }
65
65
 
@@ -67,11 +67,10 @@ export function isSupportedNativeVenmoBrowser(
67
67
  experiment?: Experiment,
68
68
  userAgent: string
69
69
  ): boolean {
70
- if (isVenmoSupportedWebView(userAgent)) {
71
- if (typeof window !== "undefined" && window.popupBridge) {
70
+ if (__WEB__ && isVenmoSupportedWebView(userAgent)) {
71
+ if (window.popupBridge) {
72
72
  return true;
73
73
  }
74
- return false;
75
74
  }
76
75
 
77
76
  if (isTablet(userAgent)) {
@@ -89,7 +89,7 @@ describe("funding/util", () => {
89
89
  });
90
90
 
91
91
  it("should return false when popupBridge is not available", () => {
92
- expect(supportsVenmoPopups({}, true, defaultUserAgent)).toBe(false);
92
+ expect(supportsVenmoPopups({}, false, defaultUserAgent)).toBe(false);
93
93
  });
94
94
  });
95
95
 
@@ -31,6 +31,10 @@ import type {
31
31
  } from "../ui/buttons/props";
32
32
  import { BUTTON_LAYOUT, BUTTON_FLOW } from "../constants";
33
33
  import { determineEligibleFunding, isFundingEligible } from "../funding";
34
+ import {
35
+ supportsVenmoPopups,
36
+ isSupportedNativeVenmoBrowser,
37
+ } from "../funding/util";
34
38
  import {
35
39
  isSupportedNativeBrowser,
36
40
  getButtonExperiments,
@@ -80,6 +84,15 @@ export const getMarksComponent: () => MarksComponent = memoize(() => {
80
84
  const supportsPopups = userAgentSupportsPopups();
81
85
  const supportedNativeBrowser = isSupportedNativeBrowser();
82
86
  const experiment = getButtonExperiments();
87
+ const supportsVenmoPopup = supportsVenmoPopups(
88
+ experiment,
89
+ supportsPopups,
90
+ userAgent
91
+ );
92
+ const supportedNativeVenmoBrowser = isSupportedNativeVenmoBrowser(
93
+ experiment,
94
+ userAgent
95
+ );
83
96
 
84
97
  const hasShippingCallback = Boolean(
85
98
  onShippingChange || onShippingAddressChange || onShippingOptionsChange
@@ -100,6 +113,8 @@ export const getMarksComponent: () => MarksComponent = memoize(() => {
100
113
  hasShippingCallback,
101
114
  supportsPopups,
102
115
  supportedNativeBrowser,
116
+ supportsVenmoPopups: supportsVenmoPopup,
117
+ supportedNativeVenmoBrowser,
103
118
  experiment,
104
119
  displayOnly,
105
120
  userAgent,
@@ -124,7 +139,9 @@ export const getMarksComponent: () => MarksComponent = memoize(() => {
124
139
  flow,
125
140
  applePaySupport,
126
141
  supportsPopups,
142
+ supportsVenmoPopups: supportsVenmoPopup,
127
143
  supportedNativeBrowser,
144
+ supportedNativeVenmoBrowser,
128
145
  experiment,
129
146
  displayOnly,
130
147
  userAgent,
@@ -185,6 +185,7 @@ export function Button({
185
185
  fundingEligibility,
186
186
  label: eligibleLabel,
187
187
  period,
188
+ locale,
188
189
  })
189
190
  : fundingConfig.labelText || fundingSource;
190
191
 
@@ -165,6 +165,8 @@ export function Buttons(props: ButtonsProps): ElementNode {
165
165
  style,
166
166
  supportedNativeBrowser,
167
167
  supportsPopups,
168
+ supportsVenmoPopups,
169
+ supportedNativeVenmoBrowser,
168
170
  userIDToken,
169
171
  vault,
170
172
  wallet,
@@ -189,6 +191,8 @@ export function Buttons(props: ButtonsProps): ElementNode {
189
191
  applePaySupport,
190
192
  supportsPopups,
191
193
  supportedNativeBrowser,
194
+ supportsVenmoPopups,
195
+ supportedNativeVenmoBrowser,
192
196
  experiment,
193
197
  displayOnly,
194
198
  userAgent,
@@ -487,6 +487,8 @@ export type RenderButtonProps = {|
487
487
  applePaySupport: boolean,
488
488
  supportsPopups: boolean,
489
489
  supportedNativeBrowser: boolean,
490
+ supportsVenmoPopups: boolean,
491
+ supportedNativeVenmoBrowser: boolean,
490
492
  showPayLabel: boolean,
491
493
  displayOnly?: $ReadOnlyArray<$Values<typeof DISPLAY_ONLY_VALUES>>,
492
494
  message?: ButtonMessage,
@@ -624,6 +626,8 @@ export type ButtonProps = {|
624
626
  components: $ReadOnlyArray<$Values<typeof COMPONENTS>>,
625
627
  supportsPopups: boolean,
626
628
  supportedNativeBrowser: boolean,
629
+ supportsVenmoPopups: boolean,
630
+ supportedNativeVenmoBrowser: boolean,
627
631
  applePaySupport: boolean,
628
632
  applePay: ApplePaySessionConfigRequest,
629
633
  meta: {||},
@@ -679,6 +683,8 @@ export type ButtonPropsInputs = {
679
683
  applePaySupport: boolean,
680
684
  supportsPopups: boolean,
681
685
  supportedNativeBrowser: boolean,
686
+ supportsVenmoPopups: boolean,
687
+ supportedNativeVenmoBrowser: boolean,
682
688
  showPayLabel: boolean,
683
689
  displayOnly: $ReadOnlyArray<$Values<typeof DISPLAY_ONLY_VALUES>>,
684
690
  message?: ButtonMessageInputs | void,
@@ -1260,6 +1266,8 @@ export function normalizeButtonProps(
1260
1266
  applePaySupport = false,
1261
1267
  supportsPopups = false,
1262
1268
  supportedNativeBrowser = false,
1269
+ supportsVenmoPopups = false,
1270
+ supportedNativeVenmoBrowser = false,
1263
1271
  showPayLabel = true,
1264
1272
  displayOnly = [],
1265
1273
  message,
@@ -1319,6 +1327,8 @@ export function normalizeButtonProps(
1319
1327
  applePaySupport,
1320
1328
  supportsPopups,
1321
1329
  supportedNativeBrowser,
1330
+ supportsVenmoPopups,
1331
+ supportedNativeVenmoBrowser,
1322
1332
  displayOnly,
1323
1333
  userAgent,
1324
1334
  })
@@ -1368,6 +1378,8 @@ export function normalizeButtonProps(
1368
1378
  applePaySupport,
1369
1379
  supportsPopups,
1370
1380
  supportedNativeBrowser,
1381
+ supportsVenmoPopups,
1382
+ supportedNativeVenmoBrowser,
1371
1383
  showPayLabel,
1372
1384
  displayOnly,
1373
1385
  message,
@@ -91,7 +91,7 @@ import {
91
91
  } from "../../ui/buttons/props";
92
92
  import { isFundingEligible } from "../../funding";
93
93
  import {
94
- supportsVenmoPopups,
94
+ supportsVenmoPopups as supportsVenmoPopupsUtil,
95
95
  isSupportedNativeVenmoBrowser,
96
96
  } from "../../funding/util";
97
97
  import { getPixelComponent } from "../pixel";
@@ -249,16 +249,17 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
249
249
  style = {},
250
250
  enableFunding = getEnableFunding(),
251
251
  fundingEligibility = getRefinedFundingEligibility(),
252
- supportsPopups = props.fundingSource === FUNDING.VENMO
253
- ? supportsVenmoPopups(
254
- props.experiment,
255
- userAgentSupportsPopups(),
256
- getUserAgent()
257
- )
258
- : userAgentSupportsPopups(),
259
- supportedNativeBrowser = props.fundingSource === FUNDING.VENMO
260
- ? isSupportedNativeVenmoBrowser(props.experiment, getUserAgent())
261
- : isSupportedNativeBrowser(),
252
+ supportsPopups = userAgentSupportsPopups(),
253
+ supportedNativeBrowser = isSupportedNativeBrowser(),
254
+ supportsVenmoPopups = supportsVenmoPopupsUtil(
255
+ props.experiment,
256
+ userAgentSupportsPopups(),
257
+ getUserAgent()
258
+ ),
259
+ supportedNativeVenmoBrowser = isSupportedNativeVenmoBrowser(
260
+ props.experiment,
261
+ getUserAgent()
262
+ ),
262
263
  experiment = getButtonExperiments(),
263
264
  createBillingAgreement,
264
265
  createSubscription,
@@ -305,6 +306,8 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
305
306
  flow,
306
307
  applePaySupport,
307
308
  supportsPopups,
309
+ supportsVenmoPopups,
310
+ supportedNativeVenmoBrowser,
308
311
  supportedNativeBrowser,
309
312
  experiment,
310
313
  displayOnly,
@@ -725,6 +728,8 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
725
728
  applePaySupport,
726
729
  supportsPopups,
727
730
  supportedNativeBrowser,
731
+ supportsVenmoPopups,
732
+ supportedNativeVenmoBrowser,
728
733
  createBillingAgreement,
729
734
  createSubscription,
730
735
  createVaultSetupToken,
@@ -758,6 +763,8 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
758
763
  flow,
759
764
  applePaySupport,
760
765
  supportsPopups,
766
+ supportsVenmoPopups,
767
+ supportedNativeVenmoBrowser,
761
768
  supportedNativeBrowser,
762
769
  displayOnly,
763
770
  userAgent,
@@ -1277,35 +1284,43 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
1277
1284
 
1278
1285
  supportedNativeBrowser: {
1279
1286
  type: "boolean",
1280
- value: ({ props }) => {
1281
- if (props.fundingSource === FUNDING.VENMO) {
1282
- return isSupportedNativeVenmoBrowser(
1283
- props.experiment,
1284
- props.userAgent
1285
- );
1286
- }
1287
+ value: isSupportedNativeBrowser,
1288
+ queryParam: true,
1289
+ },
1287
1290
 
1288
- return isSupportedNativeBrowser();
1291
+ supportedNativeVenmoBrowser: {
1292
+ type: "boolean",
1293
+ value: ({ props }) => {
1294
+ return isSupportedNativeVenmoBrowser(
1295
+ props.experiment,
1296
+ props.userAgent
1297
+ );
1289
1298
  },
1290
1299
  queryParam: true,
1300
+ required: false,
1291
1301
  },
1292
1302
 
1293
1303
  supportsPopups: {
1294
1304
  type: "boolean",
1295
- value: ({ props }) => {
1296
- if (props.fundingSource === FUNDING.VENMO) {
1297
- return supportsVenmoPopups(
1298
- props.experiment,
1299
- userAgentSupportsPopups(),
1300
- props.userAgent
1301
- );
1302
- }
1303
-
1305
+ value: () => {
1304
1306
  return userAgentSupportsPopups();
1305
1307
  },
1306
1308
  queryParam: true,
1307
1309
  },
1308
1310
 
1311
+ supportsVenmoPopups: {
1312
+ type: "boolean",
1313
+ value: ({ props }) => {
1314
+ return supportsVenmoPopupsUtil(
1315
+ props.experiment,
1316
+ userAgentSupportsPopups(),
1317
+ props.userAgent
1318
+ );
1319
+ },
1320
+ queryParam: true,
1321
+ required: false,
1322
+ },
1323
+
1309
1324
  test: {
1310
1325
  type: "object",
1311
1326
  default(): Object {
@@ -149,6 +149,8 @@ export function getRenderedButtons(
149
149
  applePaySupport,
150
150
  supportsPopups = userAgentSupportsPopups(),
151
151
  supportedNativeBrowser = isSupportedNativeBrowser(),
152
+ supportsVenmoPopups,
153
+ supportedNativeVenmoBrowser,
152
154
  createBillingAgreement,
153
155
  createSubscription,
154
156
  createVaultSetupToken,
@@ -181,6 +183,8 @@ export function getRenderedButtons(
181
183
  applePaySupport,
182
184
  supportsPopups,
183
185
  supportedNativeBrowser,
186
+ supportsVenmoPopups,
187
+ supportedNativeVenmoBrowser,
184
188
  experiment,
185
189
  displayOnly,
186
190
  });