Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature:DTPPCPSDK-1509-Add Shopper Insights Usage into sdkMeta #179

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 { 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 @@
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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const shopperInsights = getSessionState(handler);
const shopperInsightsUsed = getSessionState(state => state.shopperInsights.getRecommendedPaymentMethodsUsed)

https://github.com/paypal/paypal-checkout-components/pull/2286/files#diff-6d1caeaa7a4f194561101db7781e6ff562dd9a95c9cb07852bc69ce6443af15eR18


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(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return base64encode(JSON.stringify({ url, attrs, shopperInsights })).replace(
const sdkMeta = {
url,
attrs,
features: {
shopperInsightsUsed
},
}
return base64encode(JSON.stringify(sdkMeta)).replace(

/\=+$/,

Check failure on line 35 in src/meta.js

View workflow job for this annotation

GitHub Actions / main

Unnecessary escape character: \=
""
);
}
Loading