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

CM-1181 - Send page URL to the identity resolution endpoint #352

Merged
merged 9 commits into from
Mar 11, 2024
Merged

Conversation

3link
Copy link
Contributor

@3link 3link commented Mar 11, 2024

Send the page URL to the identity resolution endpoint. This is helpful in cases where the origin header is not available.

Author Todo List:

  • Add/adjust tests (if applicable)
  • Build in CI passes
  • Latest master revision is merged into the branch
  • Self-Review
  • Set Ready For Review status

@3link 3link marked this pull request as ready for review March 11, 2024 14:46
@3link 3link requested a review from a team as a code owner March 11, 2024 14:46
@@ -29,6 +29,17 @@ export function collectUrl(state: UrlState): [string, boolean, string[]] {
return [url.toString(), pathRemoved, blockedParams]
}

export function stripQueryAndPath(pageUrl?: string): string {
Copy link
Contributor

Choose a reason for hiding this comment

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

Empty string will be stripped by the query builder default. In case this is the desired behaviour, I propose more explicitly communicating that in the types by returning undefined

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, desired behaviour. Changed the signature to stripQueryAndPath(pageUrl: string): string and the impl uses onNonNull now.

src/idex.ts Outdated
@@ -59,6 +62,7 @@ export class IdentityResolver {
.addOptional('gpp_as', nonNullConfig.gppApplicableSections?.join(','))
.addOptional('cd', nonNullConfig.cookieDomain)
.addOptional('ic', encodeIdCookie(nonNullConfig.resolvedIdCookie), { stripEmpty: false })
.addOptional('pu', stripQueryAndPath(nonNullConfig.pageUrl))
Copy link
Contributor

Choose a reason for hiding this comment

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

This is fine, but if you want your helper function to only deal with non nullable types, there is a onNonNull helper you could use

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice. Added that.

@3link 3link merged commit 45aaba4 into master Mar 11, 2024
6 of 10 checks passed
@3link 3link deleted the CM-1181 branch March 11, 2024 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants