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

Provide default id for privacy #764

Merged
merged 1 commit into from
May 24, 2023
Merged
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
4 changes: 3 additions & 1 deletion libs/scripts/delayed.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ export const loadJarvisChat = async (getConfig, getMetadata, loadScript, loadSty
};

export const loadPrivacy = async (getConfig, loadScript) => {
const acom = '7a5eb705-95ed-4cc4-a11d-0cc5760e93db';
Copy link
Contributor

@mokimo mokimo May 24, 2023

Choose a reason for hiding this comment

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

Should those go into the configs?

Copy link
Contributor

Choose a reason for hiding this comment

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

I know there was some discussion around this recently, would be curious to know the outcome as well, whether such things belong to config or individual variables.

Copy link
Contributor Author

@narcis-radu narcis-radu May 24, 2023

Choose a reason for hiding this comment

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

The value is defined in configs, but those properties are not inherited by consuming projects. We need a default value to be set for Privacy and use the configured value only if available

Copy link
Contributor

@mokimo mokimo May 24, 2023

Choose a reason for hiding this comment

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

As discussed outside of Github, having the default here is a perfect backup in case consumers don't define their privacyId.
Consumers will need to set their own privacyId in their configs e.g. here for example

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, thanks for the context 👍

const ids = {
'hlx.page': '3a6a37fe-9e07-4aa9-8640-8f358a623271-test',
'hlx.live': '926b16ce-cc88-4c6a-af45-21749f3167f3-test',
};

const otDomainId = ids?.[Object.keys(ids)
.find((domainId) => window.location.host.includes(domainId))] ?? getConfig()?.privacyId;
.find((domainId) => window.location.host.includes(domainId))]
?? (getConfig()?.privacyId || acom);
mokimo marked this conversation as resolved.
Show resolved Hide resolved
window.fedsConfig = {
privacy: { otDomainId },
documentLanguage: true,
Expand Down