Skip to content

Commit

Permalink
feature:DTPPCPSDK-1509-Add Shopper Insights Usage into sdkMeta
Browse files Browse the repository at this point in the history
  • Loading branch information
prashantjagasia committed Dec 13, 2023
1 parent df528dc commit e443ae3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { SDK_SETTINGS } from "@paypal/sdk-constants/src";
import { base64encode, ATTRIBUTES } from "@krakenjs/belter/src";

import { getScriptUrl, getSDKAttributes } from "./script";
import { getSessionState } from "./session";

const ALLOWED_ATTRS = [
SDK_SETTINGS.AMOUNT,
Expand All @@ -21,12 +22,17 @@ export function getSDKMeta(): string {
const url = getScriptUrl();

const scriptAttrs = getSDKAttributes();
const handler = () => {};

Check failure on line 25 in src/meta.js

View workflow job for this annotation

GitHub Actions / main

Unexpected empty arrow function
const shopperInsights = getSessionState(handler);

const attrs = {};
for (const attr of Object.keys(scriptAttrs)) {
if (ALLOWED_ATTRS.indexOf(attr) !== -1) {
attrs[attr] = scriptAttrs[attr];
}
}

return base64encode(JSON.stringify({ url, attrs })).replace(/\=+$/, ""); // eslint-disable-line no-useless-escape
return base64encode(JSON.stringify({ url, attrs, shopperInsights })).replace(
/\=+$/,

Check failure on line 35 in src/meta.js

View workflow job for this annotation

GitHub Actions / main

Unnecessary escape character: \=
""
);
}

0 comments on commit e443ae3

Please sign in to comment.