Skip to content

Commit

Permalink
set up the initial environment for testing vlaicu
Browse files Browse the repository at this point in the history
  • Loading branch information
iconstantin-bd committed Oct 22, 2024
1 parent 09eef42 commit 2a6e673
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
4 changes: 4 additions & 0 deletions _src/scripts/libs/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@ export const Constants = {

ZUROA_LOCALES: ['nl-nl'],

VLAICU_LOCALES: ['en-us'],

VLAICU_PAGES: ['total-security'],

DEV_DOMAINS: ["localhost", "stage", ".hlx."],
}
7 changes: 7 additions & 0 deletions _src/scripts/libs/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ export default class Page {
*/
static locale;

/**
* @type {string} - 'consumer', 'total-security'
*/
static pageName;

/**
* @type {'dev' | 'stage' | 'prod'}
*/
Expand All @@ -31,6 +36,8 @@ export default class Page {
this.langauge = this.locale.split('-')[0];

this.environment = this.#getEnvironment();

this.pageName = window.location.pathname.split('/').filter(Boolean).pop();
}

static #getLocale() {
Expand Down
16 changes: 14 additions & 2 deletions _src/scripts/libs/store/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -955,9 +955,9 @@ class StoreConfig {
constructor() {
/**
* Api used to fetch the prices
* @type {"init"|"zuora"}
* @type {"init"|"zuora"|"vlaicu"}
*/
this.provider = Constants.ZUROA_LOCALES.includes(Page.locale) ? "zuora" : "init";
this.provider = this.#getProvider();

/**
* default promotion
Expand All @@ -984,6 +984,18 @@ class StoreConfig {
this.httpMethod = "GET";
}

/**
*
* @returns {string} the prices provider to be used
*/
#getProvider() {
if (Constants.VLAICU_LOCALES.includes(Page.locale) && Constants.VLAICU_PAGES.includes(Page.pageName)) {
return "vlaicu";
}

return Constants.ZUROA_LOCALES.includes(Page.locale) ? "zuora" : "init";
}

async getCampaign() {
const jsonFilePath = 'https://www.bitdefender.com/pages/fragment-collection/zuoracampaign.json';

Expand Down

0 comments on commit 2a6e673

Please sign in to comment.