@paypal/checkout-components 5.0.436 → 5.0.437-alpha-ca07432.0
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/dist/button.js +1 -1
- package/dist/test/button.js +1 -1
- package/package.json +1 -1
- package/src/types.js +1 -0
- package/src/zoid/buttons/component.jsx +10 -6
- package/src/zoid/buttons/component.test.js +29 -0
package/package.json
CHANGED
package/src/types.js
CHANGED
|
@@ -236,13 +236,17 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
|
|
|
236
236
|
fundingSource = `-${props.fundingSource}`;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
+
const baseIframeAttributes = {
|
|
240
|
+
allowpaymentrequest: "allowpaymentrequest",
|
|
241
|
+
scrolling: "no",
|
|
242
|
+
title: `${FUNDING_BRAND_LABEL.PAYPAL}${fundingSource}`,
|
|
243
|
+
role: "presentation",
|
|
244
|
+
};
|
|
245
|
+
|
|
239
246
|
return {
|
|
240
|
-
iframe:
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
title: `${FUNDING_BRAND_LABEL.PAYPAL}${fundingSource}`,
|
|
244
|
-
role: "presentation",
|
|
245
|
-
},
|
|
247
|
+
iframe: props.experiment?.isWebMCPEnabled
|
|
248
|
+
? { ...baseIframeAttributes, allow: "tools" }
|
|
249
|
+
: baseIframeAttributes,
|
|
246
250
|
};
|
|
247
251
|
},
|
|
248
252
|
|
|
@@ -56,3 +56,32 @@ describe("getButtonsComponent iframe title", () => {
|
|
|
56
56
|
);
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
|
+
|
|
60
|
+
describe("getButtonsComponent iframe allow attribute", () => {
|
|
61
|
+
it("does not set allow when the WebMCP first-render experiment flag is absent", () => {
|
|
62
|
+
getButtonsComponent();
|
|
63
|
+
const { attributes } = createMock.mock.calls[0][0];
|
|
64
|
+
|
|
65
|
+
expect(attributes({ props: {} }).iframe.allow).toBeUndefined();
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("does not set allow when the WebMCP first-render experiment flag is disabled", () => {
|
|
69
|
+
getButtonsComponent();
|
|
70
|
+
const { attributes } = createMock.mock.calls[0][0];
|
|
71
|
+
|
|
72
|
+
expect(
|
|
73
|
+
attributes({ props: { experiment: { isWebMCPEnabled: false } } }).iframe
|
|
74
|
+
.allow,
|
|
75
|
+
).toBeUndefined();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("sets allow to 'tools' when the WebMCP first-render experiment flag is enabled", () => {
|
|
79
|
+
getButtonsComponent();
|
|
80
|
+
const { attributes } = createMock.mock.calls[0][0];
|
|
81
|
+
|
|
82
|
+
expect(
|
|
83
|
+
attributes({ props: { experiment: { isWebMCPEnabled: true } } }).iframe
|
|
84
|
+
.allow,
|
|
85
|
+
).toBe("tools");
|
|
86
|
+
});
|
|
87
|
+
});
|