@paypal/checkout-components 5.0.436-alpha-46cb544.0 → 5.0.436

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.436-alpha-46cb544.0",
3
+ "version": "5.0.436",
4
4
  "description": "PayPal Checkout components, for integrating checkout products.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -59,7 +59,7 @@ function getLabelText(
59
59
  paylater?.products?.paylater?.variant === "CA" &&
60
60
  lang === "fr"
61
61
  ) {
62
- labelText = "Payer en 4";
62
+ labelText = "Payer plus tard";
63
63
  }
64
64
 
65
65
  if (paylater?.products?.payIn4?.eligible) {
@@ -239,7 +239,6 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
239
239
  return {
240
240
  iframe: {
241
241
  allowpaymentrequest: "allowpaymentrequest",
242
- allow: "payment",
243
242
  scrolling: "no",
244
243
  title: `${FUNDING_BRAND_LABEL.PAYPAL}${fundingSource}`,
245
244
  role: "presentation",
@@ -56,21 +56,3 @@ describe("getButtonsComponent iframe title", () => {
56
56
  );
57
57
  });
58
58
  });
59
-
60
- describe("getButtonsComponent iframe payment permissions policy", () => {
61
- it("delegates the payment permissions policy to the buttons iframe", () => {
62
- getButtonsComponent();
63
- const { attributes } = createMock.mock.calls[0][0];
64
-
65
- expect(attributes({ props: {} }).iframe.allow).toBe("payment");
66
- });
67
-
68
- it("keeps the legacy allowpaymentrequest attribute alongside the modern allow attribute", () => {
69
- getButtonsComponent();
70
- const { attributes } = createMock.mock.calls[0][0];
71
-
72
- const iframeAttrs = attributes({ props: {} }).iframe;
73
- expect(iframeAttrs.allowpaymentrequest).toBe("allowpaymentrequest");
74
- expect(iframeAttrs.allow).toBe("payment");
75
- });
76
- });
@@ -97,9 +97,6 @@ export function getCheckoutComponent(): CheckoutComponent {
97
97
  attributes: {
98
98
  iframe: {
99
99
  scrolling: "yes",
100
- // Delegates the Permissions Policy 'payment' feature so PaymentRequest
101
- // works when this iframe falls back to CONTEXT.IFRAME (supportsPopups() false).
102
- allow: "payment",
103
100
  },
104
101
  },
105
102
 
@@ -1,69 +0,0 @@
1
- /* @flow */
2
-
3
- import { describe, expect, it, vi } from "vitest";
4
- import { supportsPopups } from "@krakenjs/belter/src";
5
-
6
- import { getCheckoutComponent } from "./component";
7
-
8
- // Capture the config object component.jsx passes to zoid's create() so we can
9
- // assert on the real (un-exported) attributes.iframe config, mirroring the
10
- // pattern used in ../buttons/component.test.js.
11
- const { createMock } = vi.hoisted(() => ({
12
- createMock: vi.fn((options) => ({ ...options, isChild: () => false })),
13
- }));
14
-
15
- vi.mock("@krakenjs/zoid/src", () => ({
16
- create: createMock,
17
- CONTEXT: { POPUP: "popup", IFRAME: "iframe" },
18
- EVENT: { FOCUS: "focus" },
19
- }));
20
-
21
- vi.mock("@krakenjs/belter/src", async (importOriginal) => ({
22
- ...(await importOriginal()),
23
- supportsPopups: vi.fn(() => true),
24
- }));
25
-
26
- vi.mock("@paypal/sdk-client/src", async (importOriginal) => ({
27
- ...(await importOriginal()),
28
- getLogger: vi.fn(() => ({
29
- metricCounter: vi.fn(),
30
- track: vi.fn(),
31
- info: vi.fn(),
32
- error: vi.fn(),
33
- })),
34
- getPayPalDomainRegex: vi.fn(() => /paypal\.com/),
35
- getPayPalDomain: vi.fn(() => "https://www.paypal.com"),
36
- }));
37
-
38
- describe("getCheckoutComponent iframe payment permissions policy", () => {
39
- it("delegates the payment permissions policy to the checkout iframe", () => {
40
- getCheckoutComponent();
41
- const { attributes } = createMock.mock.calls[0][0];
42
-
43
- expect(attributes.iframe.allow).toBe("payment");
44
- });
45
-
46
- it("keeps the existing scrolling attribute alongside the new allow attribute", () => {
47
- getCheckoutComponent();
48
- const { attributes } = createMock.mock.calls[0][0];
49
-
50
- expect(attributes.iframe.scrolling).toBe("yes");
51
- expect(attributes.iframe.allow).toBe("payment");
52
- });
53
-
54
- it("still delegates the payment permissions policy when the component falls back to CONTEXT.IFRAME", async () => {
55
- // getCheckoutComponent() is inline-memoized, so the earlier tests' calls
56
- // never re-invoke create(). Reset the module registry to get a fresh,
57
- // un-memoized component that actually re-evaluates supportsPopups().
58
- vi.mocked(supportsPopups).mockReturnValueOnce(false);
59
- vi.resetModules();
60
- const { getCheckoutComponent: getFreshCheckoutComponent } = await import(
61
- "./component"
62
- );
63
-
64
- getFreshCheckoutComponent();
65
-
66
- const { attributes } = createMock.mock.calls.at(-1)[0];
67
- expect(attributes.iframe.allow).toBe("payment");
68
- });
69
- });