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

✨ [amp-consent] Sync and store purposeConsents in localStorage #32721

Merged
merged 4 commits into from Feb 26, 2021

Conversation

micajuine-ho
Copy link
Contributor

@micajuine-ho micajuine-ho commented Feb 17, 2021

Partial for #31607

Alter what it means to have a stored value; we now must have consent decisions for every purpose consent listed in the purposeConsentRequired field (either inline or from remote response).

In the case of an already stored consent decision, sync new consent discussions (purposeConsents) via checkConsentHref, which will be reflected on next page visit.

Store the purposeConsents in local storage under the same namespace as the existing consent information under the key pc:

"vv": {
    "amp-consent:_ping_": {
      "v": {
        "s": 1,
        "r": "accept-string",
        "pc": {
          "purpose-ads": 1,
          "purpose-analyltics": 1,
          "purpose-analytics-vendor-a": 2
        }
      },
      "t": 1613518078945
    }
  }

Also did some cleaning up of tests (function* to preferred async/await pattern).

extensions/amp-consent/0.1/amp-consent.js Outdated Show resolved Hide resolved
extensions/amp-consent/0.1/consent-info.js Outdated Show resolved Hide resolved
/** @private {?Object<string, PURPOSE_CONSENT_STATE>} */
this.purposeConsents_ = null;
/** @private {Object<string, PURPOSE_CONSENT_STATE>|undefined} */
this.purposeConsents_ = undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove this assignment. If nothing is assigned, it is implied as undefined.

Copy link
Member

Choose a reason for hiding this comment

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

@micajuine-ho might have made this change due to the type issue i mentioned above.

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.

None yet

4 participants