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

PM-375: Costco Figo Promotion - update eligibility rules #291

Merged
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8930264
Initial setup for Costco Figo campaign
pgilmore-phi Nov 5, 2024
fad21e1
PM-367: Added form and summary logic accomodating promo requirements
pgilmore-phi Nov 12, 2024
d571a13
PM-367: Updated logic based on multipet and active promo
pgilmore-phi Nov 13, 2024
0ae6703
PM-367: Added checks on multipet to identify if we need to clear cook…
pgilmore-phi Nov 14, 2024
cf38e7f
PM-367: Added method to disable field, prevent any mouse interactions…
pgilmore-phi Nov 14, 2024
d2bd9b7
PM-367: Added nullish checks on summary page
pgilmore-phi Nov 14, 2024
27ad70f
PM-367: removing edits to eslint
pgilmore-phi Nov 14, 2024
9653907
PM-367: Adding env config for service
pgilmore-phi Nov 18, 2024
a9c6134
PM-367: Updated config to proxy service
pgilmore-phi Nov 19, 2024
cb7239f
PM-367: moving reset method into costo-promo.js
pgilmore-phi Nov 20, 2024
19d789f
PM-367: adding removed comment back
pgilmore-phi Nov 20, 2024
b3268c2
PM-367: remove unnecessary additional check on policyId
pgilmore-phi Nov 21, 2024
ac02c8f
PM-698: update redirect logic (#284) (#286)
hero-dokane Nov 21, 2024
c6c7f0d
PM-367: Updating subid value for costco figo
pgilmore-phi Nov 25, 2024
8d749c8
Merge branch 'release/costco-figo-promotion' into feature/PM-367-cost…
pgilmore-phi Nov 25, 2024
c6b6094
Merge remote-tracking branch 'origin/main' into feature/PM-375-costco…
pgilmore-phi Nov 25, 2024
165d105
PM-375: Removing type from eligibility rules
pgilmore-phi Nov 25, 2024
8ffe702
PM-375: Adding console logs for testing
pgilmore-phi Nov 26, 2024
cc72924
PM-375: Rename localStorage key for promo
pgilmore-phi Nov 26, 2024
805f855
PM-375: Adding annotations
pgilmore-phi Nov 26, 2024
2badae5
PM-375: remove console logs used for testing
pgilmore-phi Nov 26, 2024
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
Prev Previous commit
Next Next commit
PM-367: moving reset method into costo-promo.js
pgilmore-phi committed Nov 20, 2024
commit cb7239f380bfc8a6e0cd00894200d6b126c4a794
9 changes: 8 additions & 1 deletion blocks/plans-quote/costco-promo.js
Original file line number Diff line number Diff line change
@@ -24,12 +24,12 @@ const costcoFigoService = await getConfigValue('costco-figo-proxy');
const costcoFigoStoredData = localStorage.getItem(LS_KEY_FIGO_COSTCO);
const costcoFigoStoredValues = costcoFigoStoredData ? JSON.parse(costcoFigoStoredData) : {};
const costcoFigosubId = COSTCO_FIGO_PROMO_ITEMS.subId;
const hasCostcoFigoStored = costcoFigoStoredData !== null;

export const getIsMultiPet = costcoFigoStoredValues.multiPet ?? true;
export const isCostcoFigo = costcoFigoStoredValues.isEligible ?? false;
export const getSavedCouponCode = costcoFigoStoredValues.couponCode ?? null;
export const getSavedPolicyId = costcoFigoStoredValues.policyId ?? null;
export const hasCostcoFigoStored = costcoFigoStoredData !== null;

// is costco figo flow
function isCostcoFigoFlow(policyId) {
@@ -129,3 +129,10 @@ export async function checkCostcoFigoPromo(policyId, countryCode) {
}
return costcoFigoCouponData;
}

// remove storage data
export async function resetCostcoFigoData() {
if (hasCostcoFigoStored) {
localStorage.removeItem(LS_KEY_FIGO_COSTCO);
}
}
12 changes: 3 additions & 9 deletions blocks/plans-quote/form.js
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@ import APIClient, { getAPIBaseUrl } from '../../scripts/24petwatch-api.js';
import {
COOKIE_NAME_SAVED_OWNER_ID,
SS_KEY_FORM_ENTRY_URL,
LS_KEY_FIGO_COSTCO,
CURRENCY_CANADA,
CURRENCY_US,
EMAIL_REGEX,
@@ -31,7 +30,7 @@ import {
COSTCO_FIGO_PROMO_ITEMS,
getSavedCouponCode,
getIsMultiPet,
hasCostcoFigoStored,
resetCostcoFigoData,
} from './costco-promo.js';

const US_LEGAL_HEADER = '';
@@ -917,13 +916,6 @@ export default function formDecoration(block) {
return breedName;
}

async function resetCostcoFigoData() {
if (hasCostcoFigoStored) {
localStorage.removeItem(LS_KEY_FIGO_COSTCO);
isMultiPet = true;
}
}

async function executeCostcoFigoPromoCheck() {
// Check if we have a costco figo promo policy id from query string
if (costcoFigoPolicyId) {
@@ -948,10 +940,12 @@ export default function formDecoration(block) {
} else {
// we don't have a valid code and have stored policy data
await resetCostcoFigoData();
isMultiPet = true;
}
} else {
// no policy Id parameter, reset any promo data
await resetCostcoFigoData();
isMultiPet = true;
}
}