Merge remote-tracking branch 'origin/develop' into feature/CSR-2194
This commit is contained in:
commit
6f48f0ae4d
11 changed files with 214 additions and 33 deletions
|
|
@ -31,6 +31,7 @@ const applicationConfig = {
|
||||||
"https://outlook.office.com/calendar/deeplink/compose?path=/calendar/action/compose&rru=addevent",
|
"https://outlook.office.com/calendar/deeplink/compose?path=/calendar/action/compose&rru=addevent",
|
||||||
FRONTEND_LOGGER_PATH: "/analytics/api/v1/logging",
|
FRONTEND_LOGGER_PATH: "/analytics/api/v1/logging",
|
||||||
AFFILIATE_COOKIE_CONTAINING_NAME: "_Track",
|
AFFILIATE_COOKIE_CONTAINING_NAME: "_Track",
|
||||||
|
COOKIE_NAME_LENGTH_MAX_LIMIT: 44,
|
||||||
};
|
};
|
||||||
|
|
||||||
export { applicationConfig };
|
export { applicationConfig };
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,9 @@ const cookieNames = {
|
||||||
DXDEV: "dxdev",
|
DXDEV: "dxdev",
|
||||||
SESSION_ID: "sid",
|
SESSION_ID: "sid",
|
||||||
SESSION_KEY: "skey",
|
SESSION_KEY: "skey",
|
||||||
|
|
||||||
|
//Commission Junction Cookie
|
||||||
|
CJE: "cje",
|
||||||
};
|
};
|
||||||
|
|
||||||
const cookieExpirations = {
|
const cookieExpirations = {
|
||||||
|
|
@ -17,6 +20,8 @@ const cookieExpirations = {
|
||||||
DXDEV: convertToSeconds({ years: 1 }),
|
DXDEV: convertToSeconds({ years: 1 }),
|
||||||
FUNNEL_USER_ID: convertToSeconds({ weeks: 1 }),
|
FUNNEL_USER_ID: convertToSeconds({ weeks: 1 }),
|
||||||
FUNNEL_SESSION_KEY: convertToSeconds({ minutes: 30 }),
|
FUNNEL_SESSION_KEY: convertToSeconds({ minutes: 30 }),
|
||||||
|
CJE: convertToSeconds({ days: 395 }),
|
||||||
|
NON_CJ: convertToSeconds({ days: 100000 }),
|
||||||
};
|
};
|
||||||
|
|
||||||
export { cookieNames, cookieExpirations };
|
export { cookieNames, cookieExpirations };
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,13 @@ const queryStrings = {
|
||||||
VIN_SELECTION: "vinselection",
|
VIN_SELECTION: "vinselection",
|
||||||
SERVICE_PACKAGE: "servicepackage",
|
SERVICE_PACKAGE: "servicepackage",
|
||||||
NUMBER_OF_CHIPS: "numberofchips",
|
NUMBER_OF_CHIPS: "numberofchips",
|
||||||
|
UTM_SOURCE: "_source",
|
||||||
|
UTM_MEDIUM: "_medium",
|
||||||
|
UTM_CAMPAIGN: "_campaign",
|
||||||
|
CJ_EVENT: "cjevent",
|
||||||
|
CJUNCTION: "cjunction",
|
||||||
|
ORGANIC: "organic",
|
||||||
|
ORGANIC_SOCIAL: "organic_social",
|
||||||
};
|
};
|
||||||
|
|
||||||
export { queryStrings };
|
export { queryStrings };
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="my-2 lh-1 applied-promo-tag"
|
class="my-2 lh-1 applied-promo-tag"
|
||||||
v-for="(promoCode, i) in this.getPromoCodeList()"
|
v-for="(promoCode, i) in getPromoCodeList"
|
||||||
:key="i">
|
:key="i">
|
||||||
<span class="caption"
|
<span class="caption"
|
||||||
>Promo code <span class="promo-code">{{ promoCode }}</span> applied
|
>Promo code <span class="promo-code">{{ promoCode }}</span> applied
|
||||||
|
|
@ -184,6 +184,7 @@ export default {
|
||||||
allowItemRemoval: Boolean,
|
allowItemRemoval: Boolean,
|
||||||
recyclingModalCmsWidgetName: String,
|
recyclingModalCmsWidgetName: String,
|
||||||
showAsPaid: Boolean,
|
showAsPaid: Boolean,
|
||||||
|
isInsurance: Boolean,
|
||||||
insuranceDeductible: Number,
|
insuranceDeductible: Number,
|
||||||
insuranceCompanyName: String,
|
insuranceCompanyName: String,
|
||||||
showInsuranceCoverageAs: String,
|
showInsuranceCoverageAs: String,
|
||||||
|
|
@ -283,6 +284,7 @@ export default {
|
||||||
(lineItemsToKeep) => lineItemsToKeep.cartItemType != cartItemType
|
(lineItemsToKeep) => lineItemsToKeep.cartItemType != cartItemType
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
getPromoCodeList() {
|
getPromoCodeList() {
|
||||||
if (this.$refs["promoModalQuestion"]) {
|
if (this.$refs["promoModalQuestion"]) {
|
||||||
return this.$refs["promoModalQuestion"].getPromoCodeList();
|
return this.$refs["promoModalQuestion"].getPromoCodeList();
|
||||||
|
|
@ -299,6 +301,14 @@ export default {
|
||||||
this.$emit("update:modelValue", newValue);
|
this.$emit("update:modelValue", newValue);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
lineItemsWithoutRecal() {
|
||||||
|
if (!this.lineItems || this.lineItems.length < 1) return;
|
||||||
|
const lineItemsCopy = deepClone(this.lineItems);
|
||||||
|
lineItemsCopy.supportingItems = baseMixin.methods.filterOutRecalibration(
|
||||||
|
lineItemsCopy.supportingItems
|
||||||
|
);
|
||||||
|
return lineItemsCopy;
|
||||||
|
},
|
||||||
showCoverageAsPending() {
|
showCoverageAsPending() {
|
||||||
return this.showInsuranceCoverageAs === coverageStatus.PENDING;
|
return this.showInsuranceCoverageAs === coverageStatus.PENDING;
|
||||||
},
|
},
|
||||||
|
|
@ -427,7 +437,14 @@ export default {
|
||||||
packagePrice() {
|
packagePrice() {
|
||||||
let packagePrice = 0;
|
let packagePrice = 0;
|
||||||
|
|
||||||
if (!this.showCoverageAsVerified && !this.showCoverageAsPending) {
|
if (!this.isInsurance) {
|
||||||
|
// CASH ONLY
|
||||||
|
packagePrice = baseMixin.methods.getTierOnePackagePrice(
|
||||||
|
baseMixin.methods.filterOutFees(
|
||||||
|
baseMixin.methods.filterOutRecalibration(this.availableLineItems)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else if (!this.showCoverageAsVerified && !this.showCoverageAsPending) {
|
||||||
packagePrice = baseMixin.methods.getTierOnePackagePrice(
|
packagePrice = baseMixin.methods.getTierOnePackagePrice(
|
||||||
baseMixin.methods.filterOutFees(this.availableLineItems)
|
baseMixin.methods.filterOutFees(this.availableLineItems)
|
||||||
);
|
);
|
||||||
|
|
@ -916,8 +933,6 @@ export default {
|
||||||
promoCartItems() {
|
promoCartItems() {
|
||||||
const promoCartItems = [];
|
const promoCartItems = [];
|
||||||
|
|
||||||
// clone the promos array
|
|
||||||
const promosClone = deepClone(this.promo);
|
|
||||||
// get unique promo codes
|
// get unique promo codes
|
||||||
const uniquePromoCodes = [
|
const uniquePromoCodes = [
|
||||||
...new Set(
|
...new Set(
|
||||||
|
|
@ -983,16 +998,23 @@ export default {
|
||||||
return this.getCmsContent("SubtotalTextWidget", "Text");
|
return this.getCmsContent("SubtotalTextWidget", "Text");
|
||||||
},
|
},
|
||||||
subTotal() {
|
subTotal() {
|
||||||
return baseMixin.methods.getSubTotal(this.lineItems);
|
if (!this.lineItems || this.lineItems.length < 1) return;
|
||||||
|
return this.isInsurance
|
||||||
|
? baseMixin.methods.getSubTotal(this.lineItems)
|
||||||
|
: baseMixin.methods.getSubTotal(this.lineItemsWithoutRecal);
|
||||||
},
|
},
|
||||||
salesTax() {
|
salesTax() {
|
||||||
return baseMixin.methods.getSalesTax(this.lineItems);
|
if (!this.lineItems || this.lineItems.length < 1) return;
|
||||||
|
return this.isInsurance
|
||||||
|
? baseMixin.methods.getSalesTax(this.lineItems)
|
||||||
|
: baseMixin.methods.getSalesTax(this.lineItemsWithoutRecal);
|
||||||
},
|
},
|
||||||
amountDue() {
|
amountDue() {
|
||||||
if (this.showAsPaid) {
|
if (!this.lineItems || this.lineItems.length < 1) return;
|
||||||
return 0;
|
if (this.showAsPaid) return 0;
|
||||||
}
|
return this.isInsurance
|
||||||
return baseMixin.methods.getAmountDue(this.lineItems);
|
? baseMixin.methods.getAmountDue(this.lineItems)
|
||||||
|
: baseMixin.methods.getAmountDue(this.lineItemsWithoutRecal);
|
||||||
},
|
},
|
||||||
amountPaid() {
|
amountPaid() {
|
||||||
if (!this.showAsPaid) {
|
if (!this.showAsPaid) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
import { cookieNames, cookieExpirations } from "@/constants/cookie-names";
|
import { cookieNames, cookieExpirations } from "@/constants/cookie-names";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import { applicationConfig } from "@/constants/application-config";
|
import { applicationConfig } from "@/constants/application-config";
|
||||||
|
import { getQuerystringParameter } from "@/helpers/querystring-helper";
|
||||||
|
import { queryStrings } from "@/constants/query-strings";
|
||||||
|
//import { cookieParameters } from "@/constants/cookie-parameters";
|
||||||
/*
|
/*
|
||||||
Will update the cookie if present, or create a new one if not.
|
Will update the cookie if present, or create a new one if not.
|
||||||
*/
|
*/
|
||||||
|
|
@ -221,6 +223,79 @@ export function getAffiliateCookies() {
|
||||||
return affiliateCookies;
|
return affiliateCookies;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function setupAdvertiserTracking() {
|
||||||
|
var utmSource = getQuerystringParameter(queryStrings.UTM_SOURCE);
|
||||||
|
var utmMedium = getQuerystringParameter(queryStrings.UTM_MEDIUM);
|
||||||
|
var utmCampaign = getQuerystringParameter(queryStrings.UTM_CAMPAIGN);
|
||||||
|
const cjEvent = getQuerystringParameter(queryStrings.CJ_EVENT);
|
||||||
|
// helper check for if an object is defined (but maybe falsey)
|
||||||
|
const isDefined = (x) => x !== null && x !== undefined;
|
||||||
|
if (isDefined(cjEvent) != "") {
|
||||||
|
const cjeCookieName = cookieNames.CJE;
|
||||||
|
if (!isCookieSet(cjeCookieName)) {
|
||||||
|
createCJEventCookie(cjEvent, cjeCookieName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Firstly, Can't continue without utm-source or utm-medium.
|
||||||
|
//Secondly, Ignore the advertiser for CJ-affiliate-click and Email-click.
|
||||||
|
if (
|
||||||
|
!isDefined(utmSource) ||
|
||||||
|
isDefined(utmSource) == "" ||
|
||||||
|
!isDefined(utmMedium) ||
|
||||||
|
isDefined(utmMedium) == "" ||
|
||||||
|
utmSource?.toLowerCase() == queryStrings.CJUNCTION ||
|
||||||
|
utmMedium?.toLowerCase() == queryStrings.EMAIL ||
|
||||||
|
utmMedium?.toLowerCase() == queryStrings.ORGANIC ||
|
||||||
|
utmMedium?.toLowerCase() == queryStrings.ORGANIC_SOCIAL
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//UTC date time format yyyy-MM-dd/HH:mm:ss
|
||||||
|
const currentDateTime = new Date().toISOString().replace(/T/, "/").replace(/\..+/, "");
|
||||||
|
|
||||||
|
//Format cookie, by removing spaces and special characters.
|
||||||
|
utmSource = FormatCookieElementName(utmSource);
|
||||||
|
utmMedium = FormatCookieElementName(utmMedium);
|
||||||
|
utmCampaign = FormatCookieElementName(utmCampaign);
|
||||||
|
|
||||||
|
var cookieNameBuilder = utmSource + "_" + utmMedium;
|
||||||
|
//Since utmCampaign is optional, ignore the rest.
|
||||||
|
if (isDefined(utmCampaign) && utmCampaign != "") {
|
||||||
|
cookieNameBuilder = cookieNameBuilder + "_" + utmCampaign;
|
||||||
|
}
|
||||||
|
const cookieName =
|
||||||
|
(cookieNameBuilder.length > applicationConfig.COOKIE_NAME_LENGTH_MAX_LIMIT
|
||||||
|
? cookieNameBuilder.substring(0, applicationConfig.COOKIE_NAME_LENGTH_MAX_LIMIT)
|
||||||
|
: cookieNameBuilder) + applicationConfig.AFFILIATE_COOKIE_CONTAINING_NAME;
|
||||||
|
|
||||||
|
if (!isCookieSet(cookieName)) {
|
||||||
|
const values = [
|
||||||
|
`utm_source= ${utmSource}`,
|
||||||
|
`utm_medium= ${utmMedium}`,
|
||||||
|
`utm_campaign= ${utmCampaign}`,
|
||||||
|
`timestamp= ${currentDateTime}`,
|
||||||
|
`tagEvent= ${cjEvent}`,
|
||||||
|
];
|
||||||
|
let valueString = values.join("&");
|
||||||
|
createOrUpdateCookie(cookieName, valueString, {
|
||||||
|
useDefaultFunnelCookieAttributes: true,
|
||||||
|
maxAge: cookieExpirations.NON_CJ,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const cookieValue = getCookieValueByName(cookieName);
|
||||||
|
if (cookieValue) {
|
||||||
|
let cookieValueObj = convertStringToObject(cookieValue);
|
||||||
|
cookieValueObj.timestamp = currentDateTime; // Update the property
|
||||||
|
// Set the updated cookie
|
||||||
|
const cookieValueString = objectToString(cookieValueObj);
|
||||||
|
createOrUpdateCookie(cookieName, cookieValueString, {
|
||||||
|
useDefaultFunnelCookieAttributes: true,
|
||||||
|
maxAge: cookieExpirations.NON_CJ,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===========================
|
===========================
|
||||||
= PRIVATE FUNCTIONS =
|
= PRIVATE FUNCTIONS =
|
||||||
|
|
@ -253,7 +328,7 @@ function setFunnelCookieProperties(properties) {
|
||||||
function createOrUpdateCookie(
|
function createOrUpdateCookie(
|
||||||
key,
|
key,
|
||||||
value = "",
|
value = "",
|
||||||
{ useDefaultFunnelCookieAttributes = true, maxAge, isSecure = true }
|
{ useDefaultFunnelCookieAttributes = true, maxAge, isSecure = true, crossSiteAccess = false }
|
||||||
) {
|
) {
|
||||||
let cookieToAdd = `${key}=${value}; `;
|
let cookieToAdd = `${key}=${value}; `;
|
||||||
|
|
||||||
|
|
@ -266,6 +341,9 @@ function createOrUpdateCookie(
|
||||||
if (!isNaN(maxAge)) {
|
if (!isNaN(maxAge)) {
|
||||||
cookieToAdd += `max-age=${maxAge};`;
|
cookieToAdd += `max-age=${maxAge};`;
|
||||||
}
|
}
|
||||||
|
if (crossSiteAccess && isSecure) {
|
||||||
|
cookieToAdd += `sameSite=None;`;
|
||||||
|
}
|
||||||
|
|
||||||
document.cookie = cookieToAdd;
|
document.cookie = cookieToAdd;
|
||||||
}
|
}
|
||||||
|
|
@ -315,3 +393,42 @@ function getCookiesContainingName(name) {
|
||||||
}
|
}
|
||||||
return matchingCookies;
|
return matchingCookies;
|
||||||
}
|
}
|
||||||
|
function createCJEventCookie(cjEvent, cookieName) {
|
||||||
|
createOrUpdateCookie(cookieName, cjEvent, {
|
||||||
|
useDefaultFunnelCookieAttributes: true,
|
||||||
|
maxAge: cookieExpirations.CJE,
|
||||||
|
isSecure: true,
|
||||||
|
crossSiteAccess: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function FormatCookieElementName(cookie) {
|
||||||
|
// Source: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie
|
||||||
|
const problemSymbols = '\\s\\(\\)<>@,;:\\\\/\\[\\]\\?=\\{}"';
|
||||||
|
const otherSymbols = "!#$%^&+\\-*|~`";
|
||||||
|
const symbolsToIgnore = new RegExp("[" + problemSymbols + otherSymbols + "]+", "g");
|
||||||
|
|
||||||
|
return (cookie || "").replace(symbolsToIgnore, ".");
|
||||||
|
}
|
||||||
|
|
||||||
|
function convertStringToObject(str) {
|
||||||
|
let obj = {};
|
||||||
|
let pairs = str.split("&");
|
||||||
|
|
||||||
|
pairs.forEach((pair) => {
|
||||||
|
let [key, value] = pair.split("=");
|
||||||
|
obj[key] = value;
|
||||||
|
});
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
function objectToString(obj) {
|
||||||
|
let str = "";
|
||||||
|
for (let key in obj) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||||
|
str += key + "=" + obj[key] + "&";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Remove the trailing '&'
|
||||||
|
return str.slice(0, -1);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
pageName="payment-method"
|
pageName="payment-method"
|
||||||
servicePackageOptionsCmsName="ServicePackageTitle"
|
servicePackageOptionsCmsName="ServicePackageTitle"
|
||||||
recyclingModalCmsWidgetName="RecycleModal"
|
recyclingModalCmsWidgetName="RecycleModal"
|
||||||
|
:isInsurance="isInsurance"
|
||||||
:insuranceDeductible="currentDeductible"
|
:insuranceDeductible="currentDeductible"
|
||||||
:insuranceCompanyName="insuranceCompanyName"
|
:insuranceCompanyName="insuranceCompanyName"
|
||||||
:showInsuranceCoverageAs="showInsuranceCoverageAs" />
|
:showInsuranceCoverageAs="showInsuranceCoverageAs" />
|
||||||
|
|
@ -525,14 +526,18 @@ export default {
|
||||||
await submitWorkOrder({ pageNameToLog: "payment-method", submitAfterSave: true });
|
await submitWorkOrder({ pageNameToLog: "payment-method", submitAfterSave: true });
|
||||||
this.$router.navigateWithoutSaving(
|
this.$router.navigateWithoutSaving(
|
||||||
this.navigationScenarios.CLICKED_FORWARD,
|
this.navigationScenarios.CLICKED_FORWARD,
|
||||||
this.$route
|
this.$route,
|
||||||
|
{},
|
||||||
|
{ [routerParams.DISPLAY_PIA_ALERT]: false }
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if (this.paymentMethod == paymentMethods.INSURANCE) {
|
if (this.paymentMethod == paymentMethods.INSURANCE) {
|
||||||
this.dispatchStoreAction(this.storeActions.SAVE_PAYMENT_TYPE, true, false);
|
this.dispatchStoreAction(this.storeActions.SAVE_PAYMENT_TYPE, true, false);
|
||||||
this.$router.navigateWithoutSaving(
|
this.$router.navigateWithoutSaving(
|
||||||
this.navigationScenarios.CLICKED_INSURANCE,
|
this.navigationScenarios.CLICKED_INSURANCE,
|
||||||
this.$route
|
this.$route,
|
||||||
|
{},
|
||||||
|
{ [routerParams.DISPLAY_PIA_ALERT]: false }
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this.setupPia();
|
this.setupPia();
|
||||||
|
|
@ -554,14 +559,16 @@ export default {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("error: response from pia submit work order:" + error.message);
|
console.log("error: response from pia submit work order:" + error.message);
|
||||||
this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE);
|
this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE);
|
||||||
this.$route.params[routerParams.DISPLAY_PIA_ALERT] = true;
|
this.$route.query[queryStrings.DISPLAY_PIA_ALERT] = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE);
|
this.dispatchStoreAction(storeActions.RESET_SAVE_SESSION_PROMISE);
|
||||||
this.$router.navigateWithoutSaving(
|
this.$router.navigateWithoutSaving(
|
||||||
this.navigationScenarios.CLICKED_PAY_NOW,
|
this.navigationScenarios.CLICKED_PAY_NOW,
|
||||||
this.$route
|
this.$route,
|
||||||
|
{},
|
||||||
|
{ [routerParams.DISPLAY_PIA_ALERT]: false }
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
hasSubmittedOrder() {
|
hasSubmittedOrder() {
|
||||||
|
|
@ -682,7 +689,7 @@ export default {
|
||||||
shouldDisplayPiaAlert() {
|
shouldDisplayPiaAlert() {
|
||||||
return (
|
return (
|
||||||
this.$route.query[queryStrings.DISPLAY_PIA_ALERT] ||
|
this.$route.query[queryStrings.DISPLAY_PIA_ALERT] ||
|
||||||
this.$route.params[routerParams.DISPLAY_PIA_ALERT]
|
eval(window.history.state.displayPiaAlert)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
// Necessary to make the watcher of lineItems work
|
// Necessary to make the watcher of lineItems work
|
||||||
|
|
|
||||||
|
|
@ -747,7 +747,7 @@ export default {
|
||||||
shouldDisplayPiaAlert(payMethod) {
|
shouldDisplayPiaAlert(payMethod) {
|
||||||
return (
|
return (
|
||||||
this.$route.query[queryStrings.DISPLAY_PIA_ALERT] === payMethod ||
|
this.$route.query[queryStrings.DISPLAY_PIA_ALERT] === payMethod ||
|
||||||
this.$route.params[routerParams.DISPLAY_PIA_ALERT] === payMethod
|
eval(window.history.state.displayPiaAlert)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -310,12 +310,11 @@ describe("vehicle-damage.vue", () => {
|
||||||
describe("alert", () => {
|
describe("alert", () => {
|
||||||
test("when displayVehicleChangeAlert router params is true, the alert: 'vehicleChangeAlert' should be rendered", () => {
|
test("when displayVehicleChangeAlert router params is true, the alert: 'vehicleChangeAlert' should be rendered", () => {
|
||||||
// Arrange & Act
|
// Arrange & Act
|
||||||
|
window.history.pushState({ displayVehicleChangeAlert: "true" }, "", "");
|
||||||
const { wrapper } = setupMocks({
|
const { wrapper } = setupMocks({
|
||||||
mountOptionsMockData: {
|
mountOptionsMockData: {
|
||||||
route: {
|
route: {
|
||||||
params: {
|
state: { displayVehicleChangeAlert: true },
|
||||||
[routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -325,21 +324,24 @@ describe("vehicle-damage.vue", () => {
|
||||||
|
|
||||||
test("when displayVehicleChangeAlert router params is false, the alert: 'vehicleChangeAlert' should not be rendered", () => {
|
test("when displayVehicleChangeAlert router params is false, the alert: 'vehicleChangeAlert' should not be rendered", () => {
|
||||||
// Arrange & Act
|
// Arrange & Act
|
||||||
|
window.history.pushState({ displayVehicleChangeAlert: "false" }, "", "");
|
||||||
const { wrapper } = setupMocks({
|
const { wrapper } = setupMocks({
|
||||||
mountOptionsMockData: {
|
mountOptionsMockData: {
|
||||||
route: {
|
route: {
|
||||||
params: {
|
state: {
|
||||||
[routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: false,
|
[routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.findComponent({ ref: "vehicleChangeAlert" }).exists()).toBe(false);
|
expect(wrapper.findComponent({ ref: "vehicleChangeAlert" }).exists()).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("when displayVehicleChangeAlert router params is undefined, the alert: 'vehicleChangeAlert' should not be rendered", () => {
|
test("when displayVehicleChangeAlert router params is undefined, the alert: 'vehicleChangeAlert' should not be rendered", () => {
|
||||||
// Arrange & Act
|
// Arrange & Act
|
||||||
|
window.history.pushState({ displayVehicleChangeAlert: "false" }, "", "");
|
||||||
const { wrapper } = setupMocks({
|
const { wrapper } = setupMocks({
|
||||||
mountOptionsMockData: {
|
mountOptionsMockData: {
|
||||||
route: {
|
route: {
|
||||||
|
|
@ -850,7 +852,7 @@ function setupMocks({ pageHeaderWidgetHeaderText, mountOptionsMockData, funnelCo
|
||||||
navigateWithSaving: jest.fn(),
|
navigateWithSaving: jest.fn(),
|
||||||
},
|
},
|
||||||
route: {
|
route: {
|
||||||
params: {
|
state: {
|
||||||
[routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: false,
|
[routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,7 @@ import { errorMessages } from "@/constants/error-messages";
|
||||||
import { damageLocationsCms } from "@/constants/damage-locations-cms.js";
|
import { damageLocationsCms } from "@/constants/damage-locations-cms.js";
|
||||||
import { damageLocationsSelected } from "@/constants/damage-locations-selected.js";
|
import { damageLocationsSelected } from "@/constants/damage-locations-selected.js";
|
||||||
import { getFunnelCookie } from "@/helpers/heritage-integration/cookie-helper";
|
import { getFunnelCookie } from "@/helpers/heritage-integration/cookie-helper";
|
||||||
|
import { routerParams } from "@/router/router-constants/router-params";
|
||||||
|
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import baseMixin from "@/mixins/base-mixin";
|
import baseMixin from "@/mixins/base-mixin";
|
||||||
|
|
@ -435,20 +436,26 @@ export default {
|
||||||
if (skipVin) {
|
if (skipVin) {
|
||||||
this.$router.navigateWithSaving(
|
this.$router.navigateWithSaving(
|
||||||
this.navigationScenarios.CLICKED_FORWARD_WITH_SKIP_VIN,
|
this.navigationScenarios.CLICKED_FORWARD_WITH_SKIP_VIN,
|
||||||
this.$route
|
this.$route,
|
||||||
|
{},
|
||||||
|
{ [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: false }
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if (store.getters.damage.isRepair) {
|
if (store.getters.damage.isRepair) {
|
||||||
this.$router.navigateWithSaving(
|
this.$router.navigateWithSaving(
|
||||||
this.navigationScenarios
|
this.navigationScenarios
|
||||||
.CLICKED_FORWARD_WITH_REPAIR_AND_VERIFIED_INSURANCE,
|
.CLICKED_FORWARD_WITH_REPAIR_AND_VERIFIED_INSURANCE,
|
||||||
this.$route
|
this.$route,
|
||||||
|
{},
|
||||||
|
{ [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: false }
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this.$router.navigateWithSaving(
|
this.$router.navigateWithSaving(
|
||||||
this.navigationScenarios
|
this.navigationScenarios
|
||||||
.CLICKED_FORWARD_WITH_REPLACE_AND_VERIFIED_INSURANCE,
|
.CLICKED_FORWARD_WITH_REPLACE_AND_VERIFIED_INSURANCE,
|
||||||
this.$route
|
this.$route,
|
||||||
|
{},
|
||||||
|
{ [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: false }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -457,17 +464,23 @@ export default {
|
||||||
else if (store.getters.vehicle.vin) {
|
else if (store.getters.vehicle.vin) {
|
||||||
this.$router.navigateWithSaving(
|
this.$router.navigateWithSaving(
|
||||||
this.navigationScenarios.CLICKED_FORWARD_WITH_VIN,
|
this.navigationScenarios.CLICKED_FORWARD_WITH_VIN,
|
||||||
this.$route
|
this.$route,
|
||||||
|
{},
|
||||||
|
{ [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: false }
|
||||||
);
|
);
|
||||||
} else if (skipVin) {
|
} else if (skipVin) {
|
||||||
this.$router.navigateWithSaving(
|
this.$router.navigateWithSaving(
|
||||||
this.navigationScenarios.CLICKED_FORWARD_WITH_SKIP_VIN,
|
this.navigationScenarios.CLICKED_FORWARD_WITH_SKIP_VIN,
|
||||||
this.$route
|
this.$route,
|
||||||
|
{},
|
||||||
|
{ [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: false }
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this.$router.navigateWithSaving(
|
this.$router.navigateWithSaving(
|
||||||
this.navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN,
|
this.navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN,
|
||||||
this.$route
|
this.$route,
|
||||||
|
{},
|
||||||
|
{ [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: false }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -596,7 +609,7 @@ export default {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
shouldDisplayVehicleChangeAlert() {
|
shouldDisplayVehicleChangeAlert() {
|
||||||
return this.$route.params[this.routerParams.DISPLAY_VEHICLE_CHANGE_ALERT];
|
return eval(window.history.state.displayVehicleChangeAlert);
|
||||||
},
|
},
|
||||||
shouldHideBackButton() {
|
shouldHideBackButton() {
|
||||||
return this.$store.getters.requiresVerifiedRedirecting;
|
return this.$store.getters.requiresVerifiedRedirecting;
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,12 @@ export default {
|
||||||
});
|
});
|
||||||
return filteredLineItems;
|
return filteredLineItems;
|
||||||
},
|
},
|
||||||
|
filterOutRecalibration(lineItems) {
|
||||||
|
const filteredLineItems = lineItems.filter((item) => {
|
||||||
|
return item.partType != partTypeStrings.RECALIBRATION;
|
||||||
|
});
|
||||||
|
return filteredLineItems;
|
||||||
|
},
|
||||||
getTotalPriceOfAllLineItemsAndChildParts(lineItems, includeTax) {
|
getTotalPriceOfAllLineItemsAndChildParts(lineItems, includeTax) {
|
||||||
let totalPrice = 0;
|
let totalPrice = 0;
|
||||||
lineItems.forEach((lineItem) => {
|
lineItems.forEach((lineItem) => {
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import {
|
||||||
updateSessionIdCookie,
|
updateSessionIdCookie,
|
||||||
deleteFunnelCookie,
|
deleteFunnelCookie,
|
||||||
getAffiliateCookies,
|
getAffiliateCookies,
|
||||||
|
setupAdvertiserTracking,
|
||||||
} from "@/helpers/heritage-integration/cookie-helper";
|
} from "@/helpers/heritage-integration/cookie-helper";
|
||||||
import { loadSessionIfPresent, saveSession } from "@/helpers/heritage-integration/order-helper";
|
import { loadSessionIfPresent, saveSession } from "@/helpers/heritage-integration/order-helper";
|
||||||
import {
|
import {
|
||||||
|
|
@ -103,7 +104,7 @@ const routes = [
|
||||||
if (affiliateCookies != null && affiliateCookies.length > 0) {
|
if (affiliateCookies != null && affiliateCookies.length > 0) {
|
||||||
store.commit(storeMutations.UPDATE_AFFILIATE_COOKIES, affiliateCookies);
|
store.commit(storeMutations.UPDATE_AFFILIATE_COOKIES, affiliateCookies);
|
||||||
}
|
}
|
||||||
|
setupAdvertiserTracking();
|
||||||
const loadSessionResponse = await loadSessionIfPresent(
|
const loadSessionResponse = await loadSessionIfPresent(
|
||||||
to.query.isInsurance != null
|
to.query.isInsurance != null
|
||||||
? to.query.isInsurance == "true"
|
? to.query.isInsurance == "true"
|
||||||
|
|
@ -286,7 +287,7 @@ router.afterEach(async (to, from) => {
|
||||||
store.commit(storeMutations.UPDATE_LAST_PAGE_VISITED, to.name);
|
store.commit(storeMutations.UPDATE_LAST_PAGE_VISITED, to.name);
|
||||||
|
|
||||||
// If saving on navigation is requested, check for saved SessionId or EmailAddress to determine if saving is appropriate
|
// If saving on navigation is requested, check for saved SessionId or EmailAddress to determine if saving is appropriate
|
||||||
if (eval(to.params.isSavingNavigation)) {
|
if (eval(window.history.state.isSavingNavigation)) {
|
||||||
if (
|
if (
|
||||||
store.getters.applicationUser.savedSessionId ||
|
store.getters.applicationUser.savedSessionId ||
|
||||||
store.getters.order.customer?.emailAddress
|
store.getters.order.customer?.emailAddress
|
||||||
|
|
@ -430,7 +431,7 @@ async function navigate(
|
||||||
router.push({
|
router.push({
|
||||||
name: "root",
|
name: "root",
|
||||||
query: Object.assign(optionalQuery, queryStringsObject),
|
query: Object.assign(optionalQuery, queryStringsObject),
|
||||||
params: optionalParams,
|
state: optionalParams,
|
||||||
});
|
});
|
||||||
} else if (matchingScenarioMap.destinationUrl !== undefined) {
|
} else if (matchingScenarioMap.destinationUrl !== undefined) {
|
||||||
navigateToUrl(matchingScenarioMap.destinationUrl, optionalQuery);
|
navigateToUrl(matchingScenarioMap.destinationUrl, optionalQuery);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue