Skip to content

Commit

Permalink
add timing data to xprops
Browse files Browse the repository at this point in the history
  • Loading branch information
wsbrunson committed Feb 12, 2025
1 parent 3fc257a commit 04fb010
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/zoid/buttons/component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
getJsSdkLibrary,
wasShopperInsightsUsed,
isPayPalTrustedUrl,
getSDKInitTime,
} from "@paypal/sdk-client/src";
import {
rememberFunding,
Expand Down Expand Up @@ -1067,6 +1068,32 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
queryParam: true,
},

sdkInitTimings: {
type: "object",
queryParam: false,
required: false,
value: () => {
const initTiming = getSDKInitTime();

Check failure on line 1076 in src/zoid/buttons/component.jsx

View workflow job for this annotation

GitHub Actions / main

'initTiming' is assigned a value but never used
const sdkScript = window?.performance

Check failure on line 1077 in src/zoid/buttons/component.jsx

View workflow job for this annotation

GitHub Actions / main

performance.getEntriesByType() is not supported in Safari 5, IE 9, Firefox 30, Chrome 27

Check failure on line 1077 in src/zoid/buttons/component.jsx

View workflow job for this annotation

GitHub Actions / main

performance is not supported in Safari 5
?.getEntriesByType("resource")
.find(({ name }) => /paypal\.com(?::\d+)?\/sdk\/js/.test(name));

Check failure on line 1079 in src/zoid/buttons/component.jsx

View workflow job for this annotation

GitHub Actions / main

Unsafe Regular Expression

const isCached = (sdkScript) => {

Check failure on line 1081 in src/zoid/buttons/component.jsx

View workflow job for this annotation

GitHub Actions / main

'sdkScript' is already declared in the upper scope on line 1077 column 17
if (!sdkScript || typeof sdkScript.duration === "undefined") {
return "unknown";
}

return sdkScript.duration === 0 ? "yes" : "no";
};

return {
sdkInitTimeStamp: getSDKInitTime(),
sdkScriptDownloadDuration: sdkScript?.duration,
isSdkCached: isCached(sdkScript),
};
},
},

sdkMeta: {
type: "string",
queryParam: true,
Expand Down

0 comments on commit 04fb010

Please sign in to comment.