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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

prashantjagasia
Copy link

When creating the sdk meta, we will need to check whether the shopper insights api was used. This value will be set in session state.

@prashantjagasia prashantjagasia requested a review from a team as a code owner December 19, 2023 20:03
@@ -21,12 +22,17 @@ export function getSDKMeta(): string {
const url = getScriptUrl();

const scriptAttrs = getSDKAttributes();
const handler = () => {};
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(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants