1.0.4 • Published 4 years ago

ccpa-subs-helper v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

Overview

This is a javascript file that contains helper functions to get information for CCPA users.

How to use

Currently, this file has been manually uploaded to s3 (https://s3.console.aws.amazon.com/s3/buckets/paywall-fe/QA/static/?region=us-east-1&tab=overview). For QA, include this script reference <script src="https://subscribe.digitalink.com/static/ccpa-subs-helper.min.js?_v=1.0.0"></script>. Update the version number to bust the cache on the file.

QA Url: https://subscribe.digitalink.com/static/ccpa-subs-helper.min.js?_v=1.0.0

STAGE Url: https://subs-stage.washingtonpost.com/static/ccpa-subs-helper.min.js?_v=1.0.0

PROD Url: https://subscribe.washingtonpost.com/static/ccpa-subs-helper.min.js?_v=1.0.0

The helper functions make the assumption that you are calling them from the www.washingtonpost.com domain. Some of our apps are on the subscribe.washingtonpost.com domain. In that scenario, you will have to make a GET request to the auth-status API first to set the localStorage value appropriately (https://subscribe.digitalink.com/swagger/?urls.primaryName=User%20Service#/auth-status/isLoggedIn)

Example

This is a high-level example, please update according to your application.

var ccpaInfo = (window!== 'undefined' && window.SubsCCPA && window.SubsCCPA.services && window.SubsCCPA.services.getCCPAInfo({"env":ENV})); //environment being dev, qa, stg, or prod
...
<a href={ccpaInfo.url}>{ccpaInfo.name}</a>

How to minify and uglify script after making changes

npm run build

Future Plans

This Lerna repository is being set up for this to be a private npm module