Skip to content

Commit 56f3f08

Browse files
authored
Merge branch 'main' into feature/2824-e2e-limitFSSButtons
2 parents 7fff30b + e691f89 commit 56f3f08

File tree

6 files changed

+54
-7
lines changed

6 files changed

+54
-7
lines changed

Diff for: CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## <small>5.0.350 (2025-02-18)</small>
2+
3+
* add timing data to xprops (#2471) ([7975ee4](https://github.com/paypal/paypal-checkout-components/commit/7975ee4)), closes [#2471](https://github.com/paypal/paypal-checkout-components/issues/2471)
4+
5+
6+
17
## <small>5.0.349 (2025-02-05)</small>
28

39
* chore(release): 5.0.348 🎉 ([0b923aa](https://github.com/paypal/paypal-checkout-components/commit/0b923aa))

Diff for: dist/button.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/test/button.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@paypal/checkout-components",
3-
"version": "5.0.349",
3+
"version": "5.0.350",
44
"description": "PayPal Checkout components, for integrating checkout products.",
55
"main": "index.js",
66
"scripts": {

Diff for: src/three-domain-secure/interface.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
} from "@paypal/sdk-client/src";
99
import { destroy as zoidDestroy } from "@krakenjs/zoid/src";
1010

11-
import { devEnvOnlyExport } from "../lib";
1211
import type { LazyExport } from "../types";
1312

1413
import {
@@ -46,9 +45,9 @@ export const ThreeDomainSecureClient: LazyExport<ThreeDomainSecureComponentInter
4645
clientID: getClientID(),
4746
},
4847
});
49-
return devEnvOnlyExport({
48+
return {
5049
isEligible: (payload) => threeDomainSecureInstance.isEligible(payload),
5150
show: () => threeDomainSecureInstance.show(),
52-
});
51+
};
5352
},
5453
};

Diff for: src/zoid/buttons/component.jsx

+43-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import {
4444
wasShopperInsightsUsed,
4545
isPayPalTrustedUrl,
4646
getSDKToken,
47+
getSDKInitTime,
4748
} from "@paypal/sdk-client/src";
4849
import {
4950
rememberFunding,
@@ -304,7 +305,7 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
304305
type: "function",
305306
sendToChild: true,
306307
value: () => (url) => {
307-
if (isPayPalTrustedUrl(url)) {
308+
if (getEnv() === ENV.LOCAL || isPayPalTrustedUrl(url)) {
308309
location.href = url;
309310
} else {
310311
throw new Error(`Unable to redirect to provided url ${url}`);
@@ -1068,6 +1069,47 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
10681069
queryParam: true,
10691070
},
10701071

1072+
sdkInitTimings: {
1073+
type: "object",
1074+
queryParam: false,
1075+
required: false,
1076+
value: () => {
1077+
// eslint-disable-next-line compat/compat
1078+
const sdkScript = window?.performance
1079+
?.getEntriesByType("resource")
1080+
// eslint-disable-next-line security/detect-unsafe-regex
1081+
.find(({ name }) => /paypal\.com(?::\d+)?\/sdk\/js/.test(name));
1082+
1083+
const isCached = (performanceEntry) => {
1084+
if (
1085+
!performanceEntry ||
1086+
typeof performanceEntry.duration === "undefined"
1087+
) {
1088+
return "unknown";
1089+
}
1090+
1091+
return performanceEntry.duration === 0 ? "yes" : "no";
1092+
};
1093+
1094+
let sdkInitTimeStamp;
1095+
1096+
// this technically isn't possible with the way paypal-sdk-client
1097+
// is set up but one day it could be refactored and this would throw
1098+
// an error and block the button from rendering
1099+
try {
1100+
sdkInitTimeStamp = getSDKInitTime();
1101+
} catch (error) {
1102+
// do nothing
1103+
}
1104+
1105+
return {
1106+
sdkInitTimeStamp,
1107+
sdkScriptDownloadDuration: sdkScript?.duration,
1108+
isSdkCached: isCached(sdkScript),
1109+
};
1110+
},
1111+
},
1112+
10711113
sdkMeta: {
10721114
type: "string",
10731115
queryParam: true,

0 commit comments

Comments
 (0)