diff --git a/blocks/found-pet-report/found-pet-report.js b/blocks/found-pet-report/found-pet-report.js index 953f5aee..310daded 100644 --- a/blocks/found-pet-report/found-pet-report.js +++ b/blocks/found-pet-report/found-pet-report.js @@ -1,5 +1,6 @@ import { jsx, loadScript } from '../../scripts/scripts.js'; import { getConfigValue } from '../../scripts/configs.js'; +import { isCanada } from '../../scripts/lib-franklin.js'; async function executeSubmit(block, requestBody) { const reportLostEndpoint = await getConfigValue('found-pet-endpoint'); @@ -15,7 +16,8 @@ async function executeSubmit(block, requestBody) { }); if (response.ok) { - window.location.href = '/lost-pet-protection/report-lost-found-pet/thank-you'; + const urlPath = isCanada ? '/ca/lost-pet-protection/report-lost-found-pet/thank-you' : '/lost-pet-protection/report-lost-found-pet/thank-you'; + window.location.href = urlPath; } else { form.classList.add('submission-message'); form.innerHTML = 'There was an error with your submission. Please try again.'; diff --git a/blocks/plans-quote/costco-promo.js b/blocks/plans-quote/costco-promo.js index 0fff91d8..2912816f 100644 --- a/blocks/plans-quote/costco-promo.js +++ b/blocks/plans-quote/costco-promo.js @@ -1,19 +1,18 @@ import { PET_PLANS_ANNUAL_URL, - LS_KEY_FIGO_COSTCO, + LS_KEY_COSTCO_FIGO, } from '../../scripts/24petwatch-utils.js'; import APIClient, { getAPIBaseUrl } from '../../scripts/24petwatch-api.js'; import { getConfigValue } from '../../scripts/configs.js'; export const COSTCO_FIGO_PROMO_ITEMS = { policyIdKey: 'poid', - subId: 'SBSUN000016', + subId: 'COSTCOFIGO', }; // set eligibility flag based on the following values const eligibilityCriteria = { level: ['Executive'], - type: ['Costco', 'Employee-family'], status: 'Active', policyStatus: ['Future', 'Active'], }; @@ -21,7 +20,7 @@ const eligibilityCriteria = { const apiBaseUrl = await getAPIBaseUrl(); const APIClientObj = new APIClient(apiBaseUrl); const costcoFigoService = await getConfigValue('costco-figo-proxy'); -const costcoFigoStoredData = localStorage.getItem(LS_KEY_FIGO_COSTCO); +const costcoFigoStoredData = localStorage.getItem(LS_KEY_COSTCO_FIGO); const costcoFigoStoredValues = costcoFigoStoredData ? JSON.parse(costcoFigoStoredData) : {}; const costcoFigosubId = COSTCO_FIGO_PROMO_ITEMS.subId; const hasCostcoFigoStored = costcoFigoStoredData !== null; @@ -75,13 +74,11 @@ async function isCostcoFigoEligible(policyId) { const record = await getCostcoPolicyData(policyId); if (record) { const status = record.Status__c ?? null; - const type = record.Type__c ?? null; const level = record.Level__c ?? null; const policyStatus = record.Insurance_Policy__r?.Status ?? null; if (status === eligibilityCriteria.status && eligibilityCriteria.level.includes(level) - && eligibilityCriteria.type.includes(type) && eligibilityCriteria.policyStatus.includes(policyStatus)) { eligibilityFlag = true; } @@ -113,7 +110,7 @@ export async function checkCostcoFigoPromo(policyId, countryCode) { isEligible, }; // store object for next steps - localStorage.setItem(LS_KEY_FIGO_COSTCO, JSON.stringify(storedCostcoFigoData)); + localStorage.setItem(LS_KEY_COSTCO_FIGO, JSON.stringify(storedCostcoFigoData)); costcoFigoCouponData = storedCostcoFigoData; } } catch (status) { @@ -129,6 +126,6 @@ export async function checkCostcoFigoPromo(policyId, countryCode) { // remove storage data export async function resetCostcoFigoData() { if (hasCostcoFigoStored) { - localStorage.removeItem(LS_KEY_FIGO_COSTCO); + localStorage.removeItem(LS_KEY_COSTCO_FIGO); } } diff --git a/blocks/plans-quote/plans-quote.css b/blocks/plans-quote/plans-quote.css index b6821977..c6bbeffd 100644 --- a/blocks/plans-quote/plans-quote.css +++ b/blocks/plans-quote/plans-quote.css @@ -78,8 +78,10 @@ main .plans-quote form input:not(:placeholder-shown)~label { main .plans-quote form .wrapper.disabled-field > input { cursor: not-allowed; + cursor: unset; pointer-events: none; user-select: none; + -webkit-user-select: none; position: relative; } diff --git a/blocks/plans-quote/summary-quote.js b/blocks/plans-quote/summary-quote.js index 4d382e47..6022beee 100644 --- a/blocks/plans-quote/summary-quote.js +++ b/blocks/plans-quote/summary-quote.js @@ -16,7 +16,7 @@ import { import { isCanada } from '../../scripts/lib-franklin.js'; import { trackGTMEvent } from '../../scripts/lib-analytics.js'; import { getConfigValue } from '../../scripts/configs.js'; -import { getIsMultiPet } from './costco-promo.js'; +import { getIsMultiPet, isCostcoFigo } from './costco-promo.js'; export default async function decorateSummaryQuote(block, apiBaseUrl) { // initialize form based on results from the previous step @@ -266,8 +266,13 @@ export default async function decorateSummaryQuote(block, apiBaseUrl) { function getAutoRenewTet(itemId) { if (itemId === 'Annual Plan-DOGS' || itemId === 'Annual Plan-CATS') { + if (!isCostcoFigo) { + return jsx` + Your Annual Membership will automatically renew on your renewal date which is one year from today. The renewal rate is currently $19.95, plus applicable taxes (price is subject to change). + `; + } return jsx` - Your Annual Membership will automatically renew on your renewal date which is one year from today. The renewal rate is currently $19.95, plus applicable taxes (price is subject to change). + Your Annual Membership will automatically renew on your renewal date which is one year from today. The renewal rate is currently $0 (price is subject to change). `; } @@ -313,7 +318,7 @@ export default async function decorateSummaryQuote(block, apiBaseUrl) {
${pet.petName}
$${selectedProduct.salesPrice}
-
${getSelectedProductAdditionalInfo(selectedProduct.itemId).priceComment}
+
${!isCostcoFigo ? getSelectedProductAdditionalInfo(selectedProduct.itemId).priceComment : getSelectedProductAdditionalInfo(selectedProduct.itemId).priceCommentPromo}
diff --git a/blocks/thank-you/thank-you.js b/blocks/thank-you/thank-you.js index 20d86f53..e22923a6 100644 --- a/blocks/thank-you/thank-you.js +++ b/blocks/thank-you/thank-you.js @@ -4,7 +4,7 @@ import { COOKIE_NAME_SAVED_OWNER_ID, deleteCookie, SS_KEY_FORM_ENTRY_URL, - LS_KEY_FIGO_COSTCO, + LS_KEY_COSTCO_FIGO, CURRENCY_CANADA, CURRENCY_US, } from '../../scripts/24petwatch-utils.js'; @@ -99,7 +99,7 @@ export default async function decorate() { // unset sessionStorage form entry URL sessionStorage.removeItem(SS_KEY_FORM_ENTRY_URL); // unset localStorage values related to Costco promo - localStorage.removeItem(LS_KEY_FIGO_COSTCO); + localStorage.removeItem(LS_KEY_COSTCO_FIGO); const urlParams = new URLSearchParams(window.location.search); const paymentProcessorId = urlParams.get('PaymentProcessorCustomerId'); diff --git a/scripts/24petwatch-api.js b/scripts/24petwatch-api.js index 2e5ae930..b0ee3199 100644 --- a/scripts/24petwatch-api.js +++ b/scripts/24petwatch-api.js @@ -306,6 +306,12 @@ export default class APIClient { }); } + /** Returns an object with a couponCode and allowMultiPet. + * @param subscriberId - string + * @param externalPolicyId - string + * @param country - number + * @returns {Promise} + */ assignNextAvailableCoupon(subscriberId, externalPolicyId, country) { const path = 'Product/NonInsurance/AssignNextAvailableCoupon'; const params = { diff --git a/scripts/24petwatch-utils.js b/scripts/24petwatch-utils.js index d0113e70..a13b8917 100644 --- a/scripts/24petwatch-utils.js +++ b/scripts/24petwatch-utils.js @@ -36,7 +36,7 @@ export const DL_EVENTS = { // ----- sessionStorage / localStorage helpers ----- export const SS_KEY_FORM_ENTRY_URL = 'formEntryURL'; export const SS_KEY_SUMMARY_ACTION = 'summaryAction'; -export const LS_KEY_FIGO_COSTCO = 'costcoFigoPromo'; +export const LS_KEY_COSTCO_FIGO = 'costcoFigoPromo'; // ----- cookie helpers ----- export const COOKIE_NAME_FOR_PET_TAGS = 'ph.PetTagQuote'; @@ -126,12 +126,14 @@ export function getSelectedProductAdditionalInfo(itemId) { 'Annual Plan-DOGS': { name: 'Annual Protection Membership', priceComment: 'for the first year $19.95/year thereafter', + priceCommentPromo: 'for the first year $0/year thereafter', pageLink: PET_PLANS_ANNUAL_URL, fragmentLink: '/lost-pet-protection/fragments/annual-info', }, 'Annual Plan-CATS': { name: 'Annual Protection Membership', priceComment: 'for the first year $19.95/year thereafter', + priceCommentPromo: 'for the first year $0/year thereafter', pageLink: PET_PLANS_ANNUAL_URL, fragmentLink: '/lost-pet-protection/fragments/annual-info', },