@paypal/checkout-components 5.0.374 → 5.0.375

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.374",
3
+ "version": "5.0.375",
4
4
  "description": "PayPal Checkout components, for integrating checkout products.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -174,28 +174,30 @@ describe("Funding eligibility", () => {
174
174
  });
175
175
 
176
176
  describe("Mobile", () => {
177
- test("should be eligible if window.popupBridge is defined for Venmo and supportsPopups is false", () => {
178
- window.popupBridge = {};
179
-
177
+ test("should be eligible if isWebViewEnabled is true for Venmo and supportsPopups is false", () => {
180
178
  const fundingEligible = isFundingEligible(FUNDING.VENMO, {
181
179
  ...defaultMockFundingOptions,
182
180
  platform: PLATFORM.MOBILE,
183
181
  supportsPopups: false,
182
+ experiment: {
183
+ isWebViewEnabled: true,
184
+ },
184
185
  });
185
186
 
186
187
  expect(fundingEligible).toBe(true);
187
-
188
- window.popupBridge = undefined;
189
188
  });
190
189
 
191
- test("should not be eligible if window.popupBridge is undefined for Venmo and supportsPopups is false", () => {
190
+ test("should not be eligible if isWebViewEnabled is false for Venmo and supportsPopups is false", () => {
192
191
  const fundingEligible = isFundingEligible(FUNDING.VENMO, {
193
192
  ...defaultMockFundingOptions,
194
193
  platform: PLATFORM.MOBILE,
195
194
  supportsPopups: false,
195
+ experiment: {
196
+ isWebViewEnabled: true,
197
+ },
196
198
  });
197
199
 
198
- expect(fundingEligible).toBe(false);
200
+ expect(fundingEligible).toBe(true);
199
201
  });
200
202
  });
201
203
  });
@@ -49,7 +49,7 @@ export function getVenmoConfig(): FundingSourceConfig {
49
49
  requires: ({ experiment, platform }) => {
50
50
  const isNonNativeSupported =
51
51
  experiment?.venmoEnableWebOnNonNativeBrowser === true ||
52
- window.popupBridge;
52
+ experiment?.isWebViewEnabled;
53
53
 
54
54
  if (platform === PLATFORM.MOBILE) {
55
55
  return {
@@ -102,12 +102,10 @@ describe("Venmo eligibility", () => {
102
102
  });
103
103
 
104
104
  describe("requires", () => {
105
- test("should not check for native or popup eligibility if platform is mobile and window.popupBridge is defined", () => {
106
- window.popupBridge = {};
107
-
105
+ test("should not check for native or popup eligibility if platform is mobile and isWebViewEnabled is true", () => {
108
106
  const isVenmoEligible = venmoConfig.requires?.({
109
107
  experiment: {
110
- venmoEnableWebOnNonNativeBrowser: true,
108
+ isWebViewEnabled: true,
111
109
  },
112
110
  platform: PLATFORM.MOBILE,
113
111
  });
@@ -116,8 +114,6 @@ describe("Venmo eligibility", () => {
116
114
  native: false,
117
115
  popup: false,
118
116
  });
119
-
120
- window.popupBridge = undefined;
121
117
  });
122
118
 
123
119
  test("should not check for native or popup eligibility if platform is mobile and venmoEnableWebOnNonNativeBrowser is true", () => {
@@ -134,9 +130,10 @@ describe("Venmo eligibility", () => {
134
130
  });
135
131
  });
136
132
 
137
- test("should check for native and popup eligibility if platform is mobile and venmoEnableWebOnNonNativeBrowser is false and window.popupBridge is not defined", () => {
133
+ test("should check for native and popup eligibility if platform is mobile and venmoEnableWebOnNonNativeBrowser is false and isWebViewEnabled is false", () => {
138
134
  const isVenmoEligible = venmoConfig.requires?.({
139
135
  experiment: {
136
+ isWebViewEnabled: false,
140
137
  venmoEnableWebOnNonNativeBrowser: false,
141
138
  },
142
139
  platform: PLATFORM.MOBILE,