Skip to content

Commit

Permalink
MWPW-148609 [Project PEP] Optionally Bypass xLG for Testing (#2339)
Browse files Browse the repository at this point in the history
* Added a way to mock entitlements in non prod environments for testing purposes

* Added the ability to debug pep in prod; added skipPepEntitlements option
  • Loading branch information
sharmrj authored May 23, 2024
1 parent a2d9267 commit 62c25ff
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libs/features/webapp-prompt/webapp-prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ class AppPrompt {
init = async () => {
if (this.isDismissedPrompt() || !this.parent) return;

const entMatch = await this.doesEntitlementMatch();
const skipEntitlements = new URLSearchParams(window.location.search).get('skipPepEntitlements');
const entMatch = skipEntitlements || await this.doesEntitlementMatch();
if (!entMatch) return;

const content = await this.fetchContent();
Expand Down Expand Up @@ -84,7 +85,10 @@ class AppPrompt {
};

doesEntitlementMatch = async () => {
const entitlements = await getConfig().entitlements();
const config = getConfig();
const entitlements = await config.entitlements();
const extraEnts = new URLSearchParams(window.location.search).get('mockPepEnts');
extraEnts?.split(',').forEach((ent) => entitlements.push(ent.trim()));
return entitlements?.length && entitlements.includes(this.entName);
};

Expand Down

0 comments on commit 62c25ff

Please sign in to comment.