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

Add support for SLAS DNT (do not track) parameter #167

Merged
merged 6 commits into from
Aug 8, 2024
Merged

Add support for SLAS DNT (do not track) parameter #167

merged 6 commits into from
Aug 8, 2024

Conversation

kevinxh
Copy link
Contributor

@kevinxh kevinxh commented Aug 8, 2024

This PR adds a new optional parameter dnt to SLAS helpers: loginGuestUserPrivate, loginGuestUser and loginRegisteredUserB2C

@kevinxh kevinxh requested a review from a team as a code owner August 8, 2024 05:17
@@ -47,6 +47,7 @@ const parameters = {
refreshToken: 'refresh_token',
usid: 'usid',
hint: 'hint',
dnt: 'true',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

well, the API spec says this parameter is string.. which is kinda weird to me, shouldn't it be a boolean? I'm gonna ask

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed that it is a bit weird, but if it changes in the RAML spec from type string to type boolean it'll be a breaking change :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call. I'm going to make the SLAS helpers to accepts booleans and do a .toString() to convert it before calling the API client.

Copy link
Contributor

@joeluong-sfcc joeluong-sfcc left a comment

Choose a reason for hiding this comment

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

Can you update the CHANGELOG? otherwise LGTM

@@ -166,6 +166,7 @@ export async function authorize(
* @param credentials.clientSecret - secret associated with client ID
* @param parameters - parameters to pass in the API calls.
* @param parameters.usid? - Unique Shopper Identifier to enable personalization.
* @param parameters.dnt? - Optional parameter to enable Do Not Track (DNT) for the user.

Choose a reason for hiding this comment

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

Since it is boolean, does it make sense to set default value instead of making the parameter optional?dnt=true

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the default is controlled at the API level, if this parameter is not present, SLAS default to dnt=false.

Copy link
Contributor

@joeluong-sfcc joeluong-sfcc left a comment

Choose a reason for hiding this comment

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

One thing we should be weary of is if this dnt field will be subject to change in the future. If it gets updated to accept other string values besides 'true' and 'false' this implementation will break

If we expect this to be updated in the future we should probably revert to the previous implementation. Given the nature of the field I can't imagine any other options, but better to be safe than sorry, let's check with the SLAS team first if we want to use this approach

@kevinxh kevinxh merged commit a7fc03e into main Aug 8, 2024
8 checks passed
@kevinxh kevinxh deleted the dnt branch August 8, 2024 18:27
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.

3 participants