Updated for 314 and 316

This commit is contained in:
David Back 2023-04-17 16:54:55 -04:00
parent 89b96a77f7
commit 02dc99b2ff
17 changed files with 488 additions and 510 deletions

View file

@ -1,8 +1,8 @@
const damageCustomLabels = Object.freeze({ const damageCustomLabels = Object.freeze({
MATCH: 'match', MATCH: 'match',
REAR_WINDOW: 'rear window', REAR_WINDOW: 'rear window',
SIDE_WINDOW: 'side window', SIDE_WINDOW: 'side window',
WINDSHIELD: 'windshield' WINDSHIELD: 'windshield'
}); });
export default damageCustomLabels; export default damageCustomLabels;

View file

@ -1,8 +1,8 @@
const damageLocationsCms = { const damageLocationsCms = {
WINDSHIELD: "WINDSHIELD", WINDSHIELD: "WINDSHIELD",
SIDEDOOR: "SIDEDOOR", SIDEDOOR: "SIDEDOOR",
REARWINDOW: "REARWINDOW", REARWINDOW: "REARWINDOW",
DRIVERSIDE: "DRIVERSIDE", DRIVERSIDE: "DRIVERSIDE",
PASSENGERSIDE: "PASSENGERSIDE" PASSENGERSIDE: "PASSENGERSIDE"
}; };

View file

@ -1,21 +1,21 @@
const damageLocationsSelected = { const damageLocationsSelected = {
WINDSHIELD: "Windshield", WINDSHIELD: "Windshield",
SIDEDOOR: "SideDoor", SIDEDOOR: "SideDoor",
REARWINDOW: "RearWindow", REARWINDOW: "RearWindow",
REPAIR: "Repair", REPAIR: "Repair",
REPLACE: "Replace", REPLACE: "Replace",
DRIVER: "Driver", DRIVER: "Driver",
PASSENGER: "Passenger", PASSENGER: "Passenger",
FRONT: "Front", FRONT: "Front",
REAR: "Rear", REAR: "Rear",
BACK: "Back", BACK: "Back",
QUARTER: "Quarter", QUARTER: "Quarter",
VENT: "Vent", VENT: "Vent",
SINGLE: "Single", SINGLE: "Single",
DRIVERSIDE: "DriverSide", DRIVERSIDE: "DriverSide",
PASSENGERSIDE: "PassengerSide", PASSENGERSIDE: "PassengerSide",
STATIONARY: "Stationary", STATIONARY: "Stationary",
SLIDER: "Slider" SLIDER: "Slider"
}; };
export { damageLocationsSelected }; export { damageLocationsSelected };

View file

@ -1,8 +1,8 @@
const dynamicStrings = { const dynamicStrings = {
GLOBAL_STATE: "globalState", GLOBAL_STATE: "globalState",
CUSTOM: "custom", CUSTOM: "custom",
ROUTER_LINK: "routerLink:", ROUTER_LINK: "routerLink:",
MODAL_LINK: "modalLink" MODAL_LINK: "modalLink"
}; };
export { dynamicStrings }; export { dynamicStrings };

View file

@ -1,7 +1,7 @@
const partTypeStrings = { const partTypeStrings = {
FRONT_WIPER: 'FRONT WIPER', FRONT_WIPER: 'FRONT WIPER',
REAR_WIPER: 'REAR WIPER', REAR_WIPER: 'REAR WIPER',
RAIN_DEFENSE: 'RAIN DEFENSE', RAIN_DEFENSE: 'RAIN DEFENSE',
RECALIBRATION: 'RECALIBRATION' RECALIBRATION: 'RECALIBRATION'
}; };

View file

@ -1,7 +1,7 @@
const vinLookupMethodSelections = Object.freeze({ const vinLookupMethodSelections = Object.freeze({
MANUALVIN: 'ManualVin', MANUALVIN: 'ManualVin',
LICENSEPLATE: 'LicensePlate', LICENSEPLATE: 'LicensePlate',
HOMEADDRESS: 'HomeAddress' HOMEADDRESS: 'HomeAddress'
}); });
export {vinLookupMethodSelections}; export {vinLookupMethodSelections};

View file

@ -2,9 +2,9 @@ import { dynamicStrings } from '@/constants/dynamic-strings';
import { useMainStore } from '@/store'; import { useMainStore } from '@/store';
export function fetchCmsContentForPage(issPage) { export function fetchCmsContentForPage(issPage) {
const store = useMainStore() const store = useMainStore()
const clientName = store.issConfig.clientName; const clientName = store.issConfig.clientName;
const accountNumber = store.issConfig.accountNumber; const accountNumber = store.issConfig.accountNumber;
const clientOverride = (clientName.length > 0 && accountNumber > 0); const clientOverride = (clientName.length > 0 && accountNumber > 0);
return store.getPageData(issPage) return store.getPageData(issPage)
@ -43,7 +43,7 @@ export function fetchCmsContentForPage(issPage) {
// clientResponse = contains the widgets from the client override page. (null if none) // clientResponse = contains the widgets from the client override page. (null if none)
function processPageData(baseResponse, clientResponse) { function processPageData(baseResponse, clientResponse) {
const pageDataFromCms = {}; const pageDataFromCms = {};
let widgets = []; let widgets = [];
if (!baseResponse?.data?.Result) { if (!baseResponse?.data?.Result) {
console.error('No result data found'); // Something has gone terribly wrong. console.error('No result data found'); // Something has gone terribly wrong.
@ -93,7 +93,7 @@ function processPageData(baseResponse, clientResponse) {
widgets.forEach((widget) => { widgets.forEach((widget) => {
// Global state value replacement. // Global state value replacement.
let widgetWithReplacements = findAndReplaceGlobalStateValues( const widgetWithReplacements = findAndReplaceGlobalStateValues(
widget.Model, widget.Model,
widget.Name widget.Name
); );
@ -107,7 +107,7 @@ function processPageData(baseResponse, clientResponse) {
} }
pageDataFromCms[widgetWithReplacements.Name] = [ pageDataFromCms[widgetWithReplacements.Name] = [
widgetWithReplacements.Model, widgetWithReplacements.Model
]; ];
}); });
@ -125,7 +125,7 @@ function processPageData(baseResponse, clientResponse) {
function findAndReplaceGlobalStateValues(widgetModel, widgetName) { function findAndReplaceGlobalStateValues(widgetModel, widgetName) {
const objWithReplacements = { const objWithReplacements = {
Name: widgetName, Name: widgetName,
Model: {}, Model: {}
}; };
Object.keys(widgetModel).forEach((key) => { Object.keys(widgetModel).forEach((key) => {
@ -176,22 +176,27 @@ function processWidgetItemForReplacement(widgetModel, key) {
} }
function mapStringToModal(str) { function mapStringToModal(str) {
let startIndex = str.indexOf('{' + dynamicStrings.MODAL_LINK); const startIndex = str.indexOf('{' + dynamicStrings.MODAL_LINK);
let linkToReplace = str.substring(startIndex, str.length); const linkToReplace = str.substring(startIndex, str.length);
linkToReplace = linkToReplace.substring(0, linkToReplace.indexOf('}') + 1); linkToReplace = linkToReplace.substring(0, linkToReplace.indexOf('}') + 1);
let params = linkToReplace.substring((dynamicStrings.MODAL_LINK).length + 2, linkToReplace.length -1) const params = linkToReplace.substring((dynamicStrings.MODAL_LINK).length + 2, linkToReplace.length -1)
let splitParams = params.split(','); const splitParams = params.split(',');
let bodyText = '<a href="#!" data-bs-toggle="modal" data-bs-target="#' + splitParams[0] + '" aria-label="Modal window">' + splitParams[1] + '</a>';
return str.replace(linkToReplace, bodyText); const bodyText = '<a modalTarget="' + splitParams[0] + '" class="modal-text" aria-label="Modal window">' + splitParams[1] + '</a>';
let returnVal = str.replace(linkToReplace, bodyText);
if (returnVal.includes(dynamicStrings.MODAL_LINK)) {
returnVal = mapStringToModal(returnVal)
}
return returnVal
} }
// Function to convert a string, into a matching global state item. // Function to convert a string, into a matching global state item.
function mapStringToState(str) { function mapStringToState(str) {
// Pull all matches out of the string. // Pull all matches out of the string.
const regexExp = new RegExp('{(.*?):(.*?)}', 'g'); const regexExp = new RegExp('{([^{}]*?):([^{}]*?)}', 'g');
const regexMatches = [...str.matchAll(regexExp)]; const regexMatches = [...str.matchAll(regexExp)];
const globalStateMatches = regexMatches.filter(match => { const globalStateMatches = regexMatches.filter(match => {
return match[1] === dynamicStrings.GLOBAL_STATE; return match[1] === dynamicStrings.GLOBAL_STATE;
}); });
@ -203,7 +208,8 @@ function mapStringToState(str) {
// Reset store state for each match. // Reset store state for each match.
const valueFromStore = getStoreValueFromString(match[2]); const valueFromStore = getStoreValueFromString(match[2]);
if (!valueFromStore) { if (!valueFromStore) {
return ''; console.warning('Unable to resolve global state data.');
return '' // if we can't map our string to state data, return an empty string.
} }
const stringWithReplacement = str.replace(match[0], valueFromStore); const stringWithReplacement = str.replace(match[0], valueFromStore);
@ -220,16 +226,18 @@ function mapStringToState(str) {
} }
function getStoreValueFromString(str) { function getStoreValueFromString(str) {
if (!str) return '';
let storeOrStateObject = useMainStore(); let storeOrStateObject = useMainStore();
for (const s of str.split('.')) { for (const s of str.split('.')) {
if (s === 'getters') continue; if (s === 'getters') continue; //For backward compatability
if (storeOrStateObject[s] != undefined) { if (storeOrStateObject[s] != undefined) {
storeOrStateObject = storeOrStateObject[s]; storeOrStateObject = storeOrStateObject[s];
} else { } else {
return '' break;
} }
} }
return storeOrStateObject; return storeOrStateObject ?? '';
} }
/////////////////////////////////// ///////////////////////////////////
@ -247,9 +255,11 @@ export function processIfStatements(str, ifConditionKeyword, replacePlaceholderC
const containsRelevantIfStatement = new RegExp('{if:' + ifConditionKeyword + ':.+?}', 'g').test( const containsRelevantIfStatement = new RegExp('{if:' + ifConditionKeyword + ':.+?}', 'g').test(
str str
); );
//str = str.replace(/\r?\n|\r/g, '');
const hasEmbeddedCrLf = /\r?\n|\r/g.test(str); const hasEmbeddedCrLf = /\r?\n|\r/g.test(str);
if (hasEmbeddedCrLf) {
console.warning('Processing of conditional string was skipped. String has embedded carriage return/linefeed.');
}
if (!containsRelevantIfStatement || hasEmbeddedCrLf) { if (!containsRelevantIfStatement || hasEmbeddedCrLf) {
return str; return str;
} else { } else {
@ -404,6 +414,7 @@ function getIfStatementRegexExpression() {
// End of If Statement Processing Logic // // End of If Statement Processing Logic //
////////////////////////////////////////// //////////////////////////////////////////
export function doesCopyContainTextLink(copy) { export function doesCopyContainTextLink(copy) {
return copy.includes(dynamicStrings.TEXT_LINK); return copy.includes(dynamicStrings.TEXT_LINK);
} }
@ -412,11 +423,19 @@ export function doesCopyContainRouterLink(copy) {
return copy.includes(this.dynamicStrings.ROUTER_LINK); return copy.includes(this.dynamicStrings.ROUTER_LINK);
} }
/**
* splits copy on { ... } such as {routerlink: ...}
* @returns array of strings
*/
export function splitCopyOnCMSPlaceHolder(copy) { export function splitCopyOnCMSPlaceHolder(copy) {
// splits copy on { ... } such as {routerlink: ...} // splits copy on { ... } such as {routerlink: ...}
return copy.split(/{(.*?)}/g); return copy.split(/{(.*?)}/g);
} }
/**
* Returns string2 of input following this pattern: {string1:string2,string3}
* @returns string
*/
export function getRouterLinkRouteFromCopy(copy) { export function getRouterLinkRouteFromCopy(copy) {
// sample input: {routerLink:estimate,provide your VIN} // sample input: {routerLink:estimate,provide your VIN}
// first split would return 'estimate,provide your VIN' // first split would return 'estimate,provide your VIN'
@ -424,6 +443,10 @@ export function getRouterLinkRouteFromCopy(copy) {
return copy.split(':')[1].split(',')[0]; return copy.split(':')[1].split(',')[0];
} }
/**
* Returns string3 of input following this pattern: { string1: string2, string3 }
* @returns string
*/
export function getRouterLinkDisplayTextFromCopy(copy) { export function getRouterLinkDisplayTextFromCopy(copy) {
// sample input: {routerLink:estimate,provide your VIN} // sample input: {routerLink:estimate,provide your VIN}
// first split would return 'estimate,provide your VIN' // first split would return 'estimate,provide your VIN'

View file

@ -6,18 +6,22 @@ describe("site sub header", () => {
const subHeaderText = "let's fix your glass"; const subHeaderText = "let's fix your glass";
const mockMixin = { const mockMixin = {
methods: { methods: {
getCmsContent: jest.fn().mockImplementation(()=> { getCmsContent: jest.fn().mockImplementation((widgetName, text)=> {
return subHeaderText; return subHeaderText;
}) })
} }
}; };
it("should contain the cms content", () => { it("should contain the cms content", () => {
const wrapper = shallowMount(siteSubHeader, { const wrapper = shallowMount(siteSubHeader, {
propsData: {
justification: '',
issContainingPage: ''
},
mixins: [mockMixin] mixins: [mockMixin]
}); });
wrapper.getCmsContent = jest.fn(); //wrapper.getCmsContent = jest.fn();
const actual = wrapper.find("span"); const actual = wrapper.find("span");
expect(actual.html()).toContain(subHeaderText); expect(actual.html()).toContain(subHeaderText);
}); });

View file

@ -39,7 +39,8 @@ import buttonBack from "@/iss-components/site-sub-header/button-back/button-back
return this.getCmsContent(this.cmsWidgetName, "SubHeaderText") return this.getCmsContent(this.cmsWidgetName, "SubHeaderText")
}, },
subText() { subText() {
return this.getCmsContent(this.cmsWidgetName, "SecondaryText") const subText = this.getCmsContent(this.cmsWidgetName, "SecondaryText");
return subText ?? '';
}, },
backButtonAccessibleText() { backButtonAccessibleText() {
return this.getCmsContent(this.cmsWidgetName, "BackButtonAccessibleText") return this.getCmsContent(this.cmsWidgetName, "BackButtonAccessibleText")
@ -48,13 +49,12 @@ import buttonBack from "@/iss-components/site-sub-header/button-back/button-back
return this.subText ? "dark-header" : "light-header"; return this.subText ? "dark-header" : "light-header";
}, },
justifySubheader() { justifySubheader() {
console.log('-->' + (this.justification.toLowerCase() === 'left'));
return (this.justification?.toLowerCase() === 'left') ? return (this.justification?.toLowerCase() === 'left') ?
'justify-content-left' : 'justify-content-left' :
'justify-content-center'; 'justify-content-center';
}, },
alternateFormatting() { alternateFormatting() {
return (this.issContainingPage === 'service-packages') ? return (this.issContainingPage?.toLowerCase() === 'service-packages') ?
'service-packages-subtext mt-4 mb-2 px-5' : 'service-packages-subtext mt-4 mb-2 px-5' :
'small'; 'small';
} }

View file

@ -52,35 +52,36 @@
}, },
computed: { computed: {
nullSafeAvailableLineItems() { nullSafeAvailableLineItems() {
console.log('Available Line Items = ' + this.availableLineItems)
return this.availableLineItems ?? []; return this.availableLineItems ?? [];
}, },
servicePackageAnswers() { servicePackageAnswers() {
if (!this.cmsWidgetName) return {}; if (!this.cmsWidgetName) return {};
const cmsAnswersContent = [ const cmsAnswersContent = [
{ {
Name: 'EconomyServicePackage', Name: 'TierOne',
cmsWidgetName: 'EconomyServicePackage' cmsWidgetName: 'EconomyServicePackage'
}, },
{ {
Name: 'StandardServicePackage', Name: 'TierTwo',
cmsWidgetName: 'StandardServicePackage' cmsWidgetName: 'StandardServicePackage'
}, },
{ {
Name: 'PremiumServicePackage', Name: 'TierThree',
cmsWidgetName: 'PremiumServicePackage' cmsWidgetName: 'PremiumServicePackage'
} }
]; ];
//if cms content has not yet loaded, skip
if (this.getCmsContent(cmsAnswersContent[0].cmsWidgetName, 'HeaderText') == '') { if (this.getCmsContent(cmsAnswersContent[0].cmsWidgetName, 'HeaderText') == '') {
return {}; return {};
} }
const modifiedAnswers = cmsAnswersContent.map((answer) => ({ const modifiedAnswers = cmsAnswersContent.map((answer) => ({
value: answer.Name, value: answer.Name,
buttonLabel: this.getHeaderTextFromCms(answer.cmsWidgetName), buttonLabel: this.getHeaderTextFromCms(answer.cmsWidgetName),
buttonLabelSubCopy: this.getSubheaderTextFromCms(answer.cmsWidgetName), buttonLabelSubCopy: this.getSubheaderTextFromCms(answer.cmsWidgetName),
buttonBodyCopy: this.getBodyTextFromCms(answer.cmsWidgetName), buttonBodyCopy: this.getBodyTextFromCms(answer.cmsWidgetName),
buttonAuxiliaryCopy: 'TODO', //this.getPackagePriceString(answer.Name), buttonAuxiliaryCopy: this.getPackagePriceString(answer.Name),
buttonFooterCopy: this.getFooterTextFromCms(answer.cmsWidgetName) buttonFooterCopy: this.getFooterTextFromCms(answer.cmsWidgetName)
} }
)); ));
return modifiedAnswers; return modifiedAnswers;
@ -161,14 +162,10 @@
}, },
getPackagePriceString(packageName) { getPackagePriceString(packageName) {
const formattedPriceFloat = parseFloat(this.getPackagePrice(packageName)).toFixed(2); const formattedPriceFloat = parseFloat(this.getPackagePrice(packageName)).toFixed(2);
return 'As little as $' + formattedPriceFloat; return '$' + formattedPriceFloat;
}, },
getPackagePrice(packageName) { getPackagePrice(packageName) {
let priceFloat = this.isInsuranceSelected let priceFloat = 0;
? 0
: baseMixin.methods.getTierOnePackagePrice(
baseMixin.methods.filterOutFees(this.nullSafeAvailableLineItems)
);
if (packageName === packageNames.TIER_TWO) { if (packageName === packageNames.TIER_TWO) {
priceFloat += this.getTierTwoPackageVapsPrice(); priceFloat += this.getTierTwoPackageVapsPrice();
} else if (packageName === packageNames.TIER_THREE) { } else if (packageName === packageNames.TIER_THREE) {
@ -186,7 +183,7 @@
item.partType.toUpperCase() === partTypeStrings.FRONT_WIPER) || item.partType.toUpperCase() === partTypeStrings.FRONT_WIPER) ||
(priceRearWipers && item.partType.toUpperCase() === partTypeStrings.REAR_WIPER) (priceRearWipers && item.partType.toUpperCase() === partTypeStrings.REAR_WIPER)
) { ) {
vapsPrice += baseMixin.methods.getTotalLineItemPrice(item); vapsPrice += this.getTotalLineItemPrice(item);
} }
}); });
return vapsPrice; return vapsPrice;
@ -205,7 +202,7 @@
(priceRainDefense && (priceRainDefense &&
item.partType.toUpperCase() === partTypeStrings.RAIN_DEFENSE) item.partType.toUpperCase() === partTypeStrings.RAIN_DEFENSE)
) { ) {
vapsPrice += baseMixin.methods.getTotalLineItemPrice(item); vapsPrice += this.getTotalLineItemPrice(item);
} }
}); });
return vapsPrice; return vapsPrice;
@ -348,6 +345,9 @@
(glassToReplace) => glassToReplace.glassLocation === glassLocation (glassToReplace) => glassToReplace.glassLocation === glassLocation
) ?? []; ) ?? [];
return !!glassLocationMatches.length; return !!glassLocationMatches.length;
},
getTotalLineItemPrice(lineItem) {
return lineItem.kitPrice + lineItem.laborAmount + lineItem.sellingPrice
} }
}, },
components: { components: {

View file

@ -0,0 +1,127 @@
import { mount } from "@vue/test-utils"
import servicePackageRadio from "./service-package-radio"
import inputButtonWrapperMixin from "@/mixins/input-button-wrapper-mixin"
describe("service-package-radio.vue", () => {
it("Should include buttonLabel in html", async () => {
// Arrange
let { wrapper } = setupMocks({
mountOptionsMockData: {
propsData: mockProps,
},
})
// Act
const outputHtml = wrapper.html()
// Assert
expect(outputHtml).toEqual(expect.stringContaining(mockProps["buttonLabel"]))
})
it("Should include buttonLabelAuxillaryCopy in html", async () => {
// Arrange
let { wrapper } = setupMocks({
mountOptionsMockData: {
propsData: mockProps,
},
})
// Act
const outputHtml = wrapper.html()
// Assert
expect(outputHtml).toEqual(expect.stringContaining(mockProps["buttonLabelAuxillaryCopy"]))
})
it("Should include buttonLabelSubCopy in html", async () => {
// Arrange
let { wrapper } = setupMocks({
mountOptionsMockData: {
propsData: mockProps,
},
})
// Act
const outputHtml = wrapper.html()
// Assert
expect(outputHtml).toEqual(expect.stringContaining(mockProps["buttonLabelSubCopy"]))
})
it("Should include buttonFooterCopy in html", async () => {
// Arrange
let { wrapper } = setupMocks({
mountOptionsMockData: {
propsData: mockProps,
},
})
// Act
const outputHtml = wrapper.html()
// Assert
expect(outputHtml).toEqual(expect.stringContaining(mockProps["buttonFooterCopy"]))
})
it("Should get 5 strings from getArrayOfListItemsFromRawCmsCopy when provided with a dashed (x5) buttonBodyCopy", async () => {
// Arrange
let { wrapper } = setupMocks({
mountOptionsMockData: {
propsData: mockProps,
},
})
// Act
const results = wrapper.vm.getArrayOfListItemsFromRawCmsCopy(wrapper.vm.buttonBodyCopy)
// Assert
expect(results.length).toBe(5)
})
it("Should get strings from getArrayOfListItemsFromRawCmsCopy without dashes when provided with a dashed buttonBodyCopy", async () => {
// Arrange
let { wrapper } = setupMocks({
mountOptionsMockData: {
propsData: mockProps,
},
})
// Act
const results = wrapper.vm.getArrayOfListItemsFromRawCmsCopy(wrapper.vm.buttonBodyCopy)
// Assert
const fileredResults = results.filter((result) => {
return result.includes(" -");
})
expect(fileredResults.length).toBe(0)
})
it("Should get 5 strings from getArrayOfListItemsFromRawCmsCopy when buttonBodyCopy has 6 total dashes, but one is empty ", async () => {
// Arrange
const moddedProps = mockProps
moddedProps["buttonBodyCopy"] = "- buttonBodyCopy test copy - 2 - 3 - 4 - 5 -"
let { wrapper } = setupMocks({
mountOptionsMockData: {
propsData: moddedProps,
},
})
// Act
const results = wrapper.vm.getArrayOfListItemsFromRawCmsCopy(wrapper.vm.buttonBodyCopy)
// Assert
expect(results.length).toBe(5)
})
})
const mockProps = {
buttonLabel: 'buttonLabel test copy',
buttonLabelAuxillaryCopy: 'buttonLabelAuxillaryCopy test copy',
buttonLabelSubCopy: 'buttonLabelSubCopy test copy',
buttonBodyCopy: '- buttonBodyCopy test copy - 2 - 3 - 4 - 5',
buttonFooterCopy: 'buttonFooterCopy test copy'
}
function setupMocks({ mountOptionsMockData = {} }) {
const wrapper = mount(servicePackageRadio, {
...mountOptionsMockData,
mixins: [inputButtonWrapperMixin]
})
return { wrapper }
}

View file

@ -58,9 +58,9 @@
// Call APIs // Call APIs
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage); const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
const wipersPromise = store.getWipers(); const wipersPromise = await store.getWipers();
const rainDefensePromise = store.getRainDefense(); const rainDefensePromise = await store.getRainDefense();
const supportingItemsPromise = store.getSupportingItems(); const supportingItemsPromise = await store.getSupportingItems();
const promiseResultMap = [ const promiseResultMap = [
{ {
resultKey: 'cmsContent', resultKey: 'cmsContent',
@ -91,14 +91,14 @@
...clonedGlassParts, ...clonedGlassParts,
]; ];
//const pricingResults = await store.getPriceOrderItems(availableLineItems); const pricingResults = await store.getPriceOrderItems(availableLineItems);
// Call the "next" function to complete the transition to this page. // Call the "next" function to complete the transition to this page.
next((vm) => { next((vm) => {
vm.setCmsContent(resultMap.cmsContent); vm.setCmsContent(resultMap.cmsContent);
vm.pricedGlassParts = clonedGlassParts; vm.pricedGlassParts = clonedGlassParts;
vm.supportingItems = resultMap.supportingItems; vm.supportingItems = resultMap.supportingItems;
vm.availableLineItems = availableLineItems; //pricingResults; vm.availableLineItems = pricingResults;
}); });
}, },
data() { data() {
@ -128,32 +128,18 @@
this.selectedVaps = vapsItemsSelected; this.selectedVaps = vapsItemsSelected;
}, },
backButtonAction() { backButtonAction() {
this.$router.navigate( this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
this.navigationScenarios.CLICKED_BACK,
this.$route
);
}, },
forwardButtonAction() { forwardButtonAction() {
//SAVE_PARENT_ACCOUNT_NUMBER, //TODO: save items
//if (this.$store.order.payment.parentAccountNumber != this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE, this.$route);
// applicationConfig.CASH_PARENT_ACCOUNT_NUMBER) {
// this.supportingItems = this.filterOutFees(this.supportingItems);
//}
//if (this.pricedGlassParts.length > 0) {
// this.storeActions.SAVE_GLASS_PARTS,
// this.pricedGlassParts,
//}
//this.storeActions.SAVE_SUPPORTING_ITEMS,
//this.supportingItems,
//this.storeActions.SAVE_VAPS, this.selectedVaps
//navigateToHeritageFunnel({ loadingModal: this.$refs.loadingModal });
} }
}, },
components: { components: {
siteHeader, siteHeader,
siteFooter, siteFooter,
siteSubHeader, siteSubHeader,
Form, Form, /* eslint-disable-line */
textBlock, textBlock,
servicePackageQuestion, servicePackageQuestion,
loadingModal loadingModal

View file

@ -285,8 +285,7 @@ describe("vehicle-questions-mixin", () => {
const testCases = [ const testCases = [
[issPageValues.PART_QUESTIONS, issPageValues.VEHICLE_PARTS, true], [issPageValues.PART_QUESTIONS, issPageValues.VEHICLE_PARTS, true],
[issPageValues.VEHICLE_PARTS, issPageValues.VEHICLE_PARTS, false], [issPageValues.VEHICLE_PARTS, issPageValues.VEHICLE_PARTS, false],
[issPageValues.QUOTE, issPageValues.VEHICLE_PARTS, false], [issPageValues.VEHICLE_PARTS, issPageValues.REVEAL, false],
[issPageValues.QUOTE, issPageValues.QUOTE, false],
[issPageValues.VEHICLE_PARTS, issPageValues.PART_QUESTIONS, false], [issPageValues.VEHICLE_PARTS, issPageValues.PART_QUESTIONS, false],
[issPageValues.PART_QUESTIONS, issPageValues.CAPABILITY_QUESTIONS, true], [issPageValues.PART_QUESTIONS, issPageValues.CAPABILITY_QUESTIONS, true],
[issPageValues.MOLDING_QUESTIONS, issPageValues.CAPABILITY_QUESTIONS, true], [issPageValues.MOLDING_QUESTIONS, issPageValues.CAPABILITY_QUESTIONS, true],
@ -310,8 +309,7 @@ describe("vehicle-questions-mixin", () => {
const testCases = [ const testCases = [
[issPageValues.PART_QUESTIONS, issPageValues.VEHICLE_PARTS, false], [issPageValues.PART_QUESTIONS, issPageValues.VEHICLE_PARTS, false],
[issPageValues.VEHICLE_PARTS, issPageValues.VEHICLE_PARTS, false], [issPageValues.VEHICLE_PARTS, issPageValues.VEHICLE_PARTS, false],
[issPageValues.QUOTE, issPageValues.VEHICLE_PARTS, true], [issPageValues.VEHICLE_PARTS, issPageValues.SERVICE_LOCATION, true],
[issPageValues.QUOTE, issPageValues.QUOTE, false],
[issPageValues.VEHICLE_PARTS, issPageValues.PART_QUESTIONS, true], [issPageValues.VEHICLE_PARTS, issPageValues.PART_QUESTIONS, true],
[issPageValues.PART_QUESTIONS, issPageValues.CAPABILITY_QUESTIONS, false], [issPageValues.PART_QUESTIONS, issPageValues.CAPABILITY_QUESTIONS, false],
[issPageValues.MOLDING_QUESTIONS, issPageValues.CAPABILITY_QUESTIONS, false], [issPageValues.MOLDING_QUESTIONS, issPageValues.CAPABILITY_QUESTIONS, false],
@ -2079,188 +2077,9 @@ describe("vehicle-questions-mixin", () => {
); );
}); });
}); });
// TODO KO UNSKIP FOR QUOTE MVP
describe.skip("should go to quote page", () => {
test("single glass location selected, has no part questions and has one part => go to heritage funnel", async () => {
// Arrange
const partsOrQuestions = [
{
glassName: "Single",
glassLocation: "Windshield",
parts: [
{
partNumber: "FW04186GTYN",
description: "solar, soundproofing, lane keep assist",
color: "Green Tint",
requiresRecalibration: true,
requiresCapabilityQuestions: false,
childParts: [
{
partNumber: "GGG 3563 KIT",
partType: "MOULDING",
description: "Kit, Top & Sides ",
},
],
},
],
partQuestions: null,
},
];
const { wrapper } = setupMocks({
partsOrQuestions: partsOrQuestions,
});
// Act
await wrapper.vm.navigateForward(partsOrQuestions);
// Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
{ query: { issPage: "vin-lookup" } }
);
});
test("multiple glass locations selected, each has one part and no part questions => go to heritage funnel", async () => {
// Arrange
const partsOrQuestions = [
{
glassName: "Single",
glassLocation: "Windshield",
parts: [
{
partNumber: "FW04186GTYN",
description: "solar, soundproofing, lane keep assist",
color: "Green Tint",
requiresRecalibration: true,
requiresCapabilityQuestions: false,
childParts: [
{
partNumber: "GGG 3563 KIT",
partType: "MOULDING",
description: "Kit, Top & Sides ",
},
],
},
],
partQuestions: null,
},
{
glassName: "Back",
glassLocation: "Driver",
parts: [
{
partNumber: "FD25457GTYN",
description: "solar, driver side, rear",
color: "Green Tint",
requiresRecalibration: false,
requiresCapabilityQuestions: false,
childParts: null,
},
],
partQuestions: null,
},
{
glassName: "Front",
glassLocation: "Driver",
parts: [
{
partNumber: "FD27090GTYN",
description: "solar, driver side, front",
color: "Green Tint",
requiresRecalibration: false,
requiresCapabilityQuestions: false,
childParts: null,
},
],
partQuestions: null,
},
{
glassName: "Vent",
glassLocation: "Driver",
parts: [
{
partNumber: "FV25459GTNN",
description: "solar, driver side, rear",
color: "Green Tint",
requiresRecalibration: false,
requiresCapabilityQuestions: false,
childParts: null,
},
],
partQuestions: null,
},
{
glassName: "Stationary",
glassLocation: "Rear",
parts: [
{
partNumber: "FB25460GTYN",
description: "heated glass, solar",
color: "Green Tint",
requiresRecalibration: false,
requiresCapabilityQuestions: false,
childParts: null,
},
],
partQuestions: null,
},
];
const { wrapper } = setupMocks({
partsOrQuestions: partsOrQuestions,
});
// Act
await wrapper.vm.navigateForward(partsOrQuestions);
// Assert
expect(useMainStore.updateGlassParts).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(1);
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
{ query: { issPage: "vin-lookup" } }
);
});
});
}); });
describe("navigateBack", () => { describe("navigateBack", () => {
test("current page is quote and there are capability questions => go to capability questions", () => {
// Arrange
const { wrapper } = setupMocks({ issPage: issPageValues.QUOTE });
wrapper.vm.hasCapabilityQuestions = jest.fn().mockReturnValue(true);
// Act
wrapper.vm.navigateBack();
// Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
navigationScenarios.CLICKED_BACK_WITH_CAPABILITY_QUESTIONS,
{ query: { issPage: issPageValues.QUOTE } }
);
});
test("current page is quote and there are part questions and molding questions => go to molding questions", () => {
// Arrange
const { wrapper } = setupMocks({ issPage: issPageValues.QUOTE });
wrapper.vm.hasPartQuestions = jest.fn().mockReturnValue(true);
wrapper.vm.hasChildPartQuestions = jest.fn().mockReturnValue(true);
// Act
wrapper.vm.navigateBack();
// Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
navigationScenarios.CLICKED_BACK_WITH_MOLDING_QUESTIONS,
{ query: { issPage: issPageValues.QUOTE } }
);
});
test("current page is molding questions and there are part questions, multiple parts to choose, and capability questions => go to vehicle-parts", () => { test("current page is molding questions and there are part questions, multiple parts to choose, and capability questions => go to vehicle-parts", () => {
// Arrange // Arrange
const { wrapper } = setupMocks({ issPage: issPageValues.MOLDING_QUESTIONS }); const { wrapper } = setupMocks({ issPage: issPageValues.MOLDING_QUESTIONS });

View file

@ -1,28 +1,28 @@
export const issPageValues = { export const issPageValues = {
ENTRY_PAGE: 'entry-page', ENTRY_PAGE: 'entry-page',
WELCOME_PAGE: 'welcome-page', WELCOME_PAGE: 'welcome-page',
ADDRESS_LOOKUP: 'address-lookup', ADDRESS_LOOKUP: 'address-lookup',
ADDRESS_VEHICLES: 'address-vehicles', ADDRESS_VEHICLES: 'address-vehicles',
CAPABILITY_QUESTIONS: 'capability-questions', CAPABILITY_QUESTIONS: 'capability-questions',
ESTIMATE: 'estimate', ESTIMATE: 'estimate',
COVERAGE_STATEMENT: 'coverage-statement', COVERAGE_STATEMENT: 'coverage-statement',
LICENSE_PLATE_LOOKUP: 'license-plate-lookup', LICENSE_PLATE_LOOKUP: 'license-plate-lookup',
MOLDING_QUESTIONS: 'molding-questions', MOLDING_QUESTIONS: 'molding-questions',
PART_QUESTIONS: 'part-questions', PART_QUESTIONS: 'part-questions',
POLICY_HOLDER_DETAILS: 'policy-holder-details', POLICY_HOLDER_DETAILS: 'policy-holder-details',
PROVIDER_PREFERENCE: 'provider-preference', PROVIDER_PREFERENCE: 'provider-preference',
REVEAL: 'reveal', REVEAL: 'reveal',
REVIEW_ORDER: 'review-order', REVIEW_ORDER: 'review-order',
SERVICE_LOCATION: 'service-location', SERVICE_LOCATION: 'service-location',
SERVICE_PACKAGE: 'service-package', SERVICE_PACKAGE: 'service-package',
VEHICLE_DAMAGE: 'vehicle-damage', VEHICLE_DAMAGE: 'vehicle-damage',
VEHICLE_LOOKUP: 'vehicle-lookup', VEHICLE_LOOKUP: 'vehicle-lookup',
VEHICLE_MAKE: 'vehicle-make', VEHICLE_MAKE: 'vehicle-make',
VEHICLE_MODEL: 'vehicle-model', VEHICLE_MODEL: 'vehicle-model',
VEHICLE_PARTS: 'vehicle-parts', VEHICLE_PARTS: 'vehicle-parts',
VEHICLE_STYLE: 'vehicle-style', VEHICLE_STYLE: 'vehicle-style',
VEHICLE_YEAR: 'vehicle-year', VEHICLE_YEAR: 'vehicle-year',
VIN_LOOKUP: 'vin-lookup' VIN_LOOKUP: 'vin-lookup'
}; };

View file

@ -1,5 +1,5 @@
import { issPageValues } from "@/router/router-constants/issPage-values"; import { issPageValues } from '@/router/router-constants/issPage-values';
import { navigationScenarios } from "@/router/router-constants/navigation-scenarios"; import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
// Get store from router/index.js instead of importing it here to get updated values // Get store from router/index.js instead of importing it here to get updated values
const routingTable = function(store) { const routingTable = function(store) {
@ -14,8 +14,8 @@ const routingTable = function(store) {
{ {
scenario: navigationScenarios.SELECTED_YEAR, scenario: navigationScenarios.SELECTED_YEAR,
destinationIssPageValue: issPageValues.VEHICLE_MAKE destinationIssPageValue: issPageValues.VEHICLE_MAKE
}, }
], ]
}, },
{ {
issPageValue: issPageValues.VEHICLE_MAKE, issPageValue: issPageValues.VEHICLE_MAKE,
@ -27,19 +27,19 @@ const routingTable = function(store) {
{ {
scenario: navigationScenarios.SELECTED_MAKE, scenario: navigationScenarios.SELECTED_MAKE,
destinationIssPageValue: issPageValues.VEHICLE_MODEL destinationIssPageValue: issPageValues.VEHICLE_MODEL
}, }
], ]
}, },
{ {
issPageValue: issPageValues.VEHICLE_MODEL, issPageValue: issPageValues.VEHICLE_MODEL,
maps: [ maps: [
{ {
scenario: navigationScenarios.CLICKED_BACK, scenario: navigationScenarios.CLICKED_BACK,
destinationIssPageValue: issPageValues.VEHICLE_MAKE, destinationIssPageValue: issPageValues.VEHICLE_MAKE
}, },
{ {
scenario: navigationScenarios.SELECTED_MODEL, scenario: navigationScenarios.SELECTED_MODEL,
destinationIssPageValue: issPageValues.VEHICLE_STYLE, destinationIssPageValue: issPageValues.VEHICLE_STYLE
} }
] ]
}, },
@ -48,11 +48,11 @@ const routingTable = function(store) {
maps: [ maps: [
{ {
scenario: navigationScenarios.CLICKED_BACK, scenario: navigationScenarios.CLICKED_BACK,
destinationIssPageValue: issPageValues.VEHICLE_MODEL, destinationIssPageValue: issPageValues.VEHICLE_MODEL
}, },
{ {
scenario: navigationScenarios.SELECTED_STYLE, scenario: navigationScenarios.SELECTED_STYLE,
destinationIssPageValue: issPageValues.VEHICLE_DAMAGE, destinationIssPageValue: issPageValues.VEHICLE_DAMAGE
} }
] ]
}, },
@ -61,298 +61,298 @@ const routingTable = function(store) {
maps: [ maps: [
{ {
scenario: navigationScenarios.CLICKED_BACK, scenario: navigationScenarios.CLICKED_BACK,
destinationIssPageValue: issPageValues.VEHICLE_STYLE, destinationIssPageValue: issPageValues.VEHICLE_STYLE
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_REPAIR, scenario: navigationScenarios.CLICKED_FORWARD_WITH_REPAIR,
destinationIssPageValue: issPageValues.COVERAGE_STATEMENT, destinationIssPageValue: issPageValues.COVERAGE_STATEMENT
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_VIN, scenario: navigationScenarios.CLICKED_FORWARD_WITH_VIN,
destinationIssPageValue: issPageValues.VEHICLE_LOOKUP, destinationIssPageValue: issPageValues.VEHICLE_LOOKUP
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN, scenario: navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN,
destinationIssPageValue: issPageValues.VEHICLE_LOOKUP, destinationIssPageValue: issPageValues.VEHICLE_LOOKUP
}, }
], ]
}, },
{ {
issPageValue: issPageValues.VEHICLE_LOOKUP, issPageValue: issPageValues.VEHICLE_LOOKUP,
maps: [ maps: [
{ {
scenario: navigationScenarios.CLICKED_BACK, scenario: navigationScenarios.CLICKED_BACK,
destinationIssPageValue: issPageValues.VEHICLE_DAMAGE, destinationIssPageValue: issPageValues.VEHICLE_DAMAGE
}, },
{ {
scenario: navigationScenarios.SELECTED_MANUAL_VIN, scenario: navigationScenarios.SELECTED_MANUAL_VIN,
destinationIssPageValue: issPageValues.VIN_LOOKUP, destinationIssPageValue: issPageValues.VIN_LOOKUP
}, },
{ {
scenario: navigationScenarios.SELECTED_LICENSE_PLATE, scenario: navigationScenarios.SELECTED_LICENSE_PLATE,
destinationIssPageValue: issPageValues.LICENSE_PLATE_LOOKUP, destinationIssPageValue: issPageValues.LICENSE_PLATE_LOOKUP
}, },
{ {
scenario: navigationScenarios.SELECTED_HOME_ADDRESS, scenario: navigationScenarios.SELECTED_HOME_ADDRESS,
destinationIssPageValue: issPageValues.ADDRESS_LOOKUP, destinationIssPageValue: issPageValues.ADDRESS_LOOKUP
}, }
], ]
}, },
{ {
issPageValue: issPageValues.VIN_LOOKUP, issPageValue: issPageValues.VIN_LOOKUP,
maps: [ maps: [
{ {
scenario: navigationScenarios.CLICKED_BACK, scenario: navigationScenarios.CLICKED_BACK,
destinationIssPageValue: issPageValues.VEHICLE_LOOKUP, destinationIssPageValue: issPageValues.VEHICLE_LOOKUP
}, },
{ {
scenario: navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS, scenario: navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS,
destinationIssPageValue: issPageValues.VEHICLE_DAMAGE, destinationIssPageValue: issPageValues.VEHICLE_DAMAGE
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS,
destinationIssPageValue: issPageValues.PART_QUESTIONS, destinationIssPageValue: issPageValues.PART_QUESTIONS
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE, scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE,
destinationIssPageValue: issPageValues.VEHICLE_PARTS, destinationIssPageValue: issPageValues.VEHICLE_PARTS
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS,
destinationIssPageValue: issPageValues.MOLDING_QUESTIONS, destinationIssPageValue: issPageValues.MOLDING_QUESTIONS
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS,
destinationIssPageValue: issPageValues.CAPABILITY_QUESTIONS, destinationIssPageValue: issPageValues.CAPABILITY_QUESTIONS
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
destinationIssPageValue: issPageValues.COVERAGE_STATEMENT, destinationIssPageValue: issPageValues.COVERAGE_STATEMENT
}, }
], ]
}, },
{ {
issPageValue: issPageValues.LICENSE_PLATE_LOOKUP, issPageValue: issPageValues.LICENSE_PLATE_LOOKUP,
maps: [ maps: [
{ {
scenario: navigationScenarios.CLICKED_BACK, scenario: navigationScenarios.CLICKED_BACK,
destinationIssPageValue: issPageValues.VEHICLE_LOOKUP, destinationIssPageValue: issPageValues.VEHICLE_LOOKUP
}, },
{ {
scenario: navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS, scenario: navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS,
destinationIssPageValue: issPageValues.VEHICLE_DAMAGE, destinationIssPageValue: issPageValues.VEHICLE_DAMAGE
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
destinationIssPageValue: issPageValues.COVERAGE_STATEMENT, destinationIssPageValue: issPageValues.COVERAGE_STATEMENT
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS,
destinationIssPageValue: issPageValues.PART_QUESTIONS, destinationIssPageValue: issPageValues.PART_QUESTIONS
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE, scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE,
destinationIssPageValue: issPageValues.VEHICLE_PARTS, destinationIssPageValue: issPageValues.VEHICLE_PARTS
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS,
destinationIssPageValue: issPageValues.MOLDING_QUESTIONS, destinationIssPageValue: issPageValues.MOLDING_QUESTIONS
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS,
destinationIssPageValue: issPageValues.CAPABILITY_QUESTIONS, destinationIssPageValue: issPageValues.CAPABILITY_QUESTIONS
}, }
], ]
}, },
{ {
issPageValue: issPageValues.PART_QUESTIONS, issPageValue: issPageValues.PART_QUESTIONS,
maps: [ maps: [
{ {
scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS, scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS,
destinationIssPageValue: issPageValues.VIN_LOOKUP, destinationIssPageValue: issPageValues.VIN_LOOKUP
}, },
{ {
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS, scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
destinationIssPageValue: issPageValues.VEHICLE_LOOKUP, destinationIssPageValue: issPageValues.VEHICLE_LOOKUP
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE, scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE,
destinationIssPageValue: issPageValues.VEHICLE_PARTS, destinationIssPageValue: issPageValues.VEHICLE_PARTS
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS,
destinationIssPageValue: issPageValues.MOLDING_QUESTIONS, destinationIssPageValue: issPageValues.MOLDING_QUESTIONS
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS,
destinationIssPageValue: issPageValues.CAPABILITY_QUESTIONS, destinationIssPageValue: issPageValues.CAPABILITY_QUESTIONS
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
destinationIssPageValue: issPageValues.COVERAGE_STATEMENT, destinationIssPageValue: issPageValues.COVERAGE_STATEMENT
}, }
], ]
}, },
{ {
issPageValue: issPageValues.VEHICLE_PARTS, issPageValue: issPageValues.VEHICLE_PARTS,
maps: [ maps: [
{ {
scenario: navigationScenarios.CLICKED_FORWARD, scenario: navigationScenarios.CLICKED_FORWARD,
destinationIssPageValue: issPageValues.REVEAL, destinationIssPageValue: issPageValues.REVEAL
}, },
{ {
scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS, scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS,
destinationIssPageValue: issPageValues.PART_QUESTIONS, destinationIssPageValue: issPageValues.PART_QUESTIONS
}, },
{ {
scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS, scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS,
destinationIssPageValue: issPageValues.VIN_LOOKUP, destinationIssPageValue: issPageValues.VIN_LOOKUP
}, },
{ {
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS, scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
destinationIssPageValue: issPageValues.VEHICLE_LOOKUP, destinationIssPageValue: issPageValues.VEHICLE_LOOKUP
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS,
destinationIssPageValue: issPageValues.MOLDING_QUESTIONS, destinationIssPageValue: issPageValues.MOLDING_QUESTIONS
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS,
destinationIssPageValue: issPageValues.CAPABILITY_QUESTIONS, destinationIssPageValue: issPageValues.CAPABILITY_QUESTIONS
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
destinationIssPageValue: issPageValues.COVERAGE_STATEMENT, destinationIssPageValue: issPageValues.COVERAGE_STATEMENT
}, }
], ]
}, },
{ {
issPageValue: issPageValues.MOLDING_QUESTIONS, issPageValue: issPageValues.MOLDING_QUESTIONS,
maps: [ maps: [
{ {
scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS, scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS,
destinationIssPageValue: issPageValues.VIN_LOOKUP, destinationIssPageValue: issPageValues.VIN_LOOKUP
}, },
{ {
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS, scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
destinationIssPageValue: issPageValues.VEHICLE_LOOKUP, destinationIssPageValue: issPageValues.VEHICLE_LOOKUP
}, },
{ {
scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS, scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS,
destinationIssPageValue: issPageValues.PART_QUESTIONS, destinationIssPageValue: issPageValues.PART_QUESTIONS
}, },
{ {
scenario: navigationScenarios.CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE, scenario: navigationScenarios.CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE,
destinationIssPageValue: issPageValues.VEHICLE_PARTS, destinationIssPageValue: issPageValues.VEHICLE_PARTS
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS,
destinationIssPageValue: issPageValues.CAPABILITY_QUESTIONS, destinationIssPageValue: issPageValues.CAPABILITY_QUESTIONS
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
destinationIssPageValue: issPageValues.COVERAGE_STATEMENT, destinationIssPageValue: issPageValues.COVERAGE_STATEMENT
}, }
], ]
}, },
{ {
issPageValue: issPageValues.CAPABILITY_QUESTIONS, issPageValue: issPageValues.CAPABILITY_QUESTIONS,
maps: [ maps: [
{ {
scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS, scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS,
destinationIssPageValue: issPageValues.VIN_LOOKUP, destinationIssPageValue: issPageValues.VIN_LOOKUP
}, },
{ {
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS, scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
destinationIssPageValue: issPageValues.VEHICLE_LOOKUP, destinationIssPageValue: issPageValues.VEHICLE_LOOKUP
}, },
{ {
scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS, scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS,
destinationIssPageValue: issPageValues.PART_QUESTIONS, destinationIssPageValue: issPageValues.PART_QUESTIONS
}, },
{ {
scenario: navigationScenarios.CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE, scenario: navigationScenarios.CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE,
destinationIssPageValue: issPageValues.VEHICLE_PARTS, destinationIssPageValue: issPageValues.VEHICLE_PARTS
}, },
{ {
scenario: navigationScenarios.CLICKED_BACK_WITH_MOLDING_QUESTIONS, scenario: navigationScenarios.CLICKED_BACK_WITH_MOLDING_QUESTIONS,
destinationIssPageValue: issPageValues.MOLDING_QUESTIONS, destinationIssPageValue: issPageValues.MOLDING_QUESTIONS
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
destinationIssPageValue: issPageValues.COVERAGE_STATEMENT, destinationIssPageValue: issPageValues.COVERAGE_STATEMENT
}, }
], ]
}, },
{ {
issPageValue: issPageValues.ADDRESS_LOOKUP, issPageValue: issPageValues.ADDRESS_LOOKUP,
maps: [ maps: [
{ {
scenario: navigationScenarios.CLICKED_BACK, scenario: navigationScenarios.CLICKED_BACK,
destinationIssPageValue: issPageValues.VEHICLE_LOOKUP, destinationIssPageValue: issPageValues.VEHICLE_LOOKUP
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_VEHICLES, scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_VEHICLES,
destinationIssPageValue: issPageValues.ADDRESS_VEHICLES, destinationIssPageValue: issPageValues.ADDRESS_VEHICLES
}, },
{ {
scenario: navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS, scenario: navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS,
destinationIssPageValue: issPageValues.VEHICLE_DAMAGE, destinationIssPageValue: issPageValues.VEHICLE_DAMAGE
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS,
destinationIssPageValue: issPageValues.PART_QUESTIONS, destinationIssPageValue: issPageValues.PART_QUESTIONS
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE, scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE,
destinationIssPageValue: issPageValues.VEHICLE_PARTS, destinationIssPageValue: issPageValues.VEHICLE_PARTS
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS,
destinationIssPageValue: issPageValues.MOLDING_QUESTIONS, destinationIssPageValue: issPageValues.MOLDING_QUESTIONS
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS,
destinationIssPageValue: issPageValues.CAPABILITY_QUESTIONS, destinationIssPageValue: issPageValues.CAPABILITY_QUESTIONS
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
destinationIssPageValue: issPageValues.COVERAGE_STATEMENT, destinationIssPageValue: issPageValues.COVERAGE_STATEMENT
}, }
], ]
}, },
{ {
issPageValue: issPageValues.ADDRESS_VEHICLES, issPageValue: issPageValues.ADDRESS_VEHICLES,
maps: [ maps: [
{ {
scenario: navigationScenarios.CLICKED_BACK, scenario: navigationScenarios.CLICKED_BACK,
destinationIssPageValue: issPageValues.ADDRESS_LOOKUP, destinationIssPageValue: issPageValues.ADDRESS_LOOKUP
}, },
{ {
scenario: navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS, scenario: navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS,
destinationIssPageValue: issPageValues.VEHICLE_DAMAGE, destinationIssPageValue: issPageValues.VEHICLE_DAMAGE
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS,
destinationIssPageValue: issPageValues.PART_QUESTIONS, destinationIssPageValue: issPageValues.PART_QUESTIONS
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE, scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE,
destinationIssPageValue: issPageValues.VEHICLE_PARTS, destinationIssPageValue: issPageValues.VEHICLE_PARTS
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS,
destinationIssPageValue: issPageValues.MOLDING_QUESTIONS, destinationIssPageValue: issPageValues.MOLDING_QUESTIONS
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS,
destinationIssPageValue: issPageValues.CAPABILITY_QUESTIONS, destinationIssPageValue: issPageValues.CAPABILITY_QUESTIONS
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
destinationIssPageValue: issPageValues.COVERAGE_STATEMENT, destinationIssPageValue: issPageValues.COVERAGE_STATEMENT
}, }
], ]
}, },
{ {
issPageValue: issPageValues.ENTRY_PAGE, issPageValue: issPageValues.ENTRY_PAGE,
@ -364,8 +364,8 @@ const routingTable = function(store) {
{ {
scenario: navigationScenarios.MOVE_FORWARD_ENTRY_PAGE, scenario: navigationScenarios.MOVE_FORWARD_ENTRY_PAGE,
destinationIssPageValue: issPageValues.WELCOME_PAGE destinationIssPageValue: issPageValues.WELCOME_PAGE
}, }
], ]
}, },
{ {
issPageValue: issPageValues.WELCOME_PAGE, issPageValue: issPageValues.WELCOME_PAGE,
@ -377,8 +377,8 @@ const routingTable = function(store) {
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WELCOME_PAGE, scenario: navigationScenarios.CLICKED_FORWARD_WELCOME_PAGE,
destinationIssPageValue: issPageValues.POLICY_HOLDER_DETAILS destinationIssPageValue: issPageValues.POLICY_HOLDER_DETAILS
}, }
], ]
}, },
{ {
issPageValue: issPageValues.POLICY_HOLDER_DETAILS, issPageValue: issPageValues.POLICY_HOLDER_DETAILS,
@ -390,58 +390,58 @@ const routingTable = function(store) {
{ {
scenario: navigationScenarios.CLICKED_FORWARD_POLICY_HOLDER_DETAILS, scenario: navigationScenarios.CLICKED_FORWARD_POLICY_HOLDER_DETAILS,
destinationIssPageValue: issPageValues.VEHICLE_YEAR destinationIssPageValue: issPageValues.VEHICLE_YEAR
}, }
], ]
}, },
{ {
issPageValue: issPageValues.COVERAGE_STATEMENT, issPageValue: issPageValues.COVERAGE_STATEMENT,
maps: [ maps: [
{ {
scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS, scenario: navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS,
destinationIssPageValue: issPageValues.VIN_LOOKUP, destinationIssPageValue: issPageValues.VIN_LOOKUP
}, },
{ {
scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS, scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS,
destinationIssPageValue: issPageValues.VEHICLE_LOOKUP, destinationIssPageValue: issPageValues.VEHICLE_LOOKUP
}, },
{ {
scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS, scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS,
destinationIssPageValue: issPageValues.PART_QUESTIONS, destinationIssPageValue: issPageValues.PART_QUESTIONS
}, },
{ {
scenario: navigationScenarios.CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE, scenario: navigationScenarios.CLICKED_BACK_WITH_MULTIPLE_PARTS_TO_CHOOSE,
destinationIssPageValue: issPageValues.VEHICLE_PARTS, destinationIssPageValue: issPageValues.VEHICLE_PARTS
}, },
{ {
scenario: navigationScenarios.CLICKED_BACK_WITH_MOLDING_QUESTIONS, scenario: navigationScenarios.CLICKED_BACK_WITH_MOLDING_QUESTIONS,
destinationIssPageValue: issPageValues.MOLDING_QUESTIONS, destinationIssPageValue: issPageValues.MOLDING_QUESTIONS
}, },
{ {
scenario: navigationScenarios.CLICKED_BACK_WITH_CAPABILITY_QUESTIONS, scenario: navigationScenarios.CLICKED_BACK_WITH_CAPABILITY_QUESTIONS,
destinationIssPageValue: issPageValues.CAPABILITY_QUESTIONS, destinationIssPageValue: issPageValues.CAPABILITY_QUESTIONS
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_COVERAGE_STATEMENT, scenario: navigationScenarios.CLICKED_FORWARD_COVERAGE_STATEMENT,
destinationIssPageValue: issPageValues.PROVIDER_PREFERENCE, destinationIssPageValue: issPageValues.PROVIDER_PREFERENCE
}, }
], ]
}, },
{ {
issPageValue: issPageValues.PROVIDER_PREFERENCE, issPageValue: issPageValues.PROVIDER_PREFERENCE,
maps: [ maps: [
{ {
scenario: navigationScenarios.CLICKED_BACK, scenario: navigationScenarios.CLICKED_BACK,
destinationIssPageValue: issPageValues.COVERAGE_STATEMENT, destinationIssPageValue: issPageValues.COVERAGE_STATEMENT
}, },
{ {
scenario: navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE, scenario: navigationScenarios.CLICKED_FORWARD_WITH_SAFELITE,
destinationIssPageValue: issPageValues.SERVICE_LOCATION, destinationIssPageValue: issPageValues.SERVICE_LOCATION
}, }
], ]
}, },
{ {
issPageValue: issPageValues.SERVICE_PACKAGE, issPageValue: issPageValues.SERVICE_PACKAGE,
maps: [ maps: [
{ {
scenario: navigationScenarios.CLICKED_BACK, scenario: navigationScenarios.CLICKED_BACK,
destinationIssPageValue: issPageValues.SERVICE_LOCATION destinationIssPageValue: issPageValues.SERVICE_LOCATION

View file

@ -30,8 +30,8 @@ const getDefaultState = () => {
state: null, state: null,
zipCode: null, zipCode: null,
firstName: null, firstName: null,
lastName: null, lastName: null
}, }
}, },
damage: { damage: {
isRepair: null, isRepair: null,
@ -39,7 +39,7 @@ const getDefaultState = () => {
glassToReplace: null, glassToReplace: null,
partQuestionAnswers: null, partQuestionAnswers: null,
moldingQuestionAnswers: null, moldingQuestionAnswers: null,
capabilityQuestionAnswers: null, capabilityQuestionAnswers: null
}, },
policy: { policy: {
policyNumber: null, policyNumber: null,
@ -47,7 +47,7 @@ const getDefaultState = () => {
damageCause: null, damageCause: null,
damageState: null, damageState: null,
damageCity: null, damageCity: null,
isDamageGlassOnly: null, isDamageGlassOnly: null
}, },
customer: { customer: {
address: { address: {
@ -55,12 +55,12 @@ const getDefaultState = () => {
streetAddress2: null, streetAddress2: null,
city: null, city: null,
state: null, state: null,
zipCode: null, zipCode: null
}, },
firstName: null, firstName: null,
lastName: null, lastName: null,
emailAddress: null, emailAddress: null,
phoneNumber: null, phoneNumber: null
}, },
serviceLocation: { serviceLocation: {
address: null, address: null,
@ -78,11 +78,11 @@ const getDefaultState = () => {
payment: { payment: {
isInsurance: true, isInsurance: true,
insuranceCoverage: { insuranceCoverage: {
isVerified: false, isVerified: false
}, }
}, },
referralNumber: null, referralNumber: null,
referralDate: null, referralDate: null
}, },
applicationUser: { applicationUser: {
experiments: [], experiments: [],
@ -93,7 +93,7 @@ const getDefaultState = () => {
savedSessionId: null, savedSessionId: null,
crmCustomerId: null, crmCustomerId: null,
lastPageVisited: null, lastPageVisited: null,
triggeredSiteEntry: false, triggeredSiteEntry: false
}, },
issConfig: { issConfig: {
clientName: "Generic Insurance", // this is the default and will be overriden by the client's name clientName: "Generic Insurance", // this is the default and will be overriden by the client's name
@ -102,7 +102,7 @@ const getDefaultState = () => {
accountNumber: 0, accountNumber: 0,
enableTPAFlow: false, enableTPAFlow: false,
returnURL: null, returnURL: null,
returnURL2: null, returnURL2: null
} }
}; };
}; };
@ -232,8 +232,8 @@ export const useMainStore = defineStore({
licenseLastName: licenseLastName, licenseLastName: licenseLastName,
licenseStreetAddress: licenseStreetAddress, licenseStreetAddress: licenseStreetAddress,
licenseZip: licenseZip, licenseZip: licenseZip,
licenseState: licenseState, licenseState: licenseState
}, }
}); });
}, },
@ -242,14 +242,14 @@ export const useMainStore = defineStore({
method: endpoints.GetRouteInfo.method, method: endpoints.GetRouteInfo.method,
endpoint: endpoints.GetRouteInfo.url(applicationConfig.APPLICATION_ABBREVIATION), endpoint: endpoints.GetRouteInfo.url(applicationConfig.APPLICATION_ABBREVIATION),
payload: { payload: {
pageName: pageName, pageName: pageName
}, },
}); });
}, },
getHomepageName() { getHomepageName() {
return globalMethods.callHttpClient({ return globalMethods.callHttpClient({
method: endpoints.GetHomepageInfo.method, method: endpoints.GetHomepageInfo.method,
endpoint: endpoints.GetHomepageInfo.url(applicationConfig.APPLICATION_ABBREVIATION), endpoint: endpoints.GetHomepageInfo.url(applicationConfig.APPLICATION_ABBREVIATION)
}); });
}, },
@ -257,7 +257,7 @@ export const useMainStore = defineStore({
return globalMethods.callHttpClient({ return globalMethods.callHttpClient({
method: endpoints.GetPageData.method, method: endpoints.GetPageData.method,
endpoint: endpoints.GetPageData.url(applicationConfig.APPLICATION_ABBREVIATION, pageName), endpoint: endpoints.GetPageData.url(applicationConfig.APPLICATION_ABBREVIATION, pageName),
payload: {}, payload: {}
}); });
}, },
@ -266,7 +266,7 @@ export const useMainStore = defineStore({
return globalMethods.callHttpClient({ return globalMethods.callHttpClient({
method: endpoints.GetVehicleYears.method, method: endpoints.GetVehicleYears.method,
endpoint: endpoints.GetVehicleYears.url, endpoint: endpoints.GetVehicleYears.url,
payload: {}, payload: {}
}); });
}, },
@ -274,7 +274,7 @@ export const useMainStore = defineStore({
return globalMethods.callHttpClient({ return globalMethods.callHttpClient({
method: endpoints.GetVehicleMakes.method, method: endpoints.GetVehicleMakes.method,
endpoint: endpoints.GetVehicleMakes.url + this.order.vehicle.year, endpoint: endpoints.GetVehicleMakes.url + this.order.vehicle.year,
payload: {}, payload: {}
}); });
}, },
@ -282,7 +282,7 @@ export const useMainStore = defineStore({
return globalMethods.callHttpClient({ return globalMethods.callHttpClient({
method: endpoints.GetVehicleModels.method, method: endpoints.GetVehicleModels.method,
endpoint: `${endpoints.GetVehicleModels.url}/${this.order.vehicle.year}/${this.order.vehicle.make}`, endpoint: `${endpoints.GetVehicleModels.url}/${this.order.vehicle.year}/${this.order.vehicle.make}`,
payload: {}, payload: {}
}); });
}, },
@ -290,7 +290,7 @@ export const useMainStore = defineStore({
return globalMethods.callHttpClient({ return globalMethods.callHttpClient({
method: endpoints.GetVehicleStyles.method, method: endpoints.GetVehicleStyles.method,
endpoint: `${endpoints.GetVehicleStyles.url}/${this.order.vehicle.year}/${this.order.vehicle.make}/${this.order.vehicle.model}`, endpoint: `${endpoints.GetVehicleStyles.url}/${this.order.vehicle.year}/${this.order.vehicle.make}/${this.order.vehicle.model}`,
payload: {}, payload: {}
}); });
}, },
@ -298,7 +298,7 @@ export const useMainStore = defineStore({
return globalMethods.callHttpClient({ return globalMethods.callHttpClient({
methods: endpoints.GetDamageOptions.method, methods: endpoints.GetDamageOptions.method,
endpoint: `${endpoints.GetDamageOptions.url}/${carId}`, endpoint: `${endpoints.GetDamageOptions.url}/${carId}`,
payload: {}, payload: {}
}); });
}, },
getIsVinbyAddressPermissible(){ getIsVinbyAddressPermissible(){
@ -306,36 +306,36 @@ export const useMainStore = defineStore({
const response = globalMethods.callHttpClient({ const response = globalMethods.callHttpClient({
method:endpoints.IsVinbyAddressPermissible.method, method:endpoints.IsVinbyAddressPermissible.method,
endpoint:`${endpoints.IsVinbyAddressPermissible.url}?state=${this.order.customer.address.state}`, endpoint:`${endpoints.IsVinbyAddressPermissible.url}?state=${this.order.customer.address.state}`,
payload: {}, payload: {}
}); });
return response; return response;
} catch (responseError) { } catch (responseError) {
return { return {
error: { error: {
status: responseError.status, status: responseError.status
}, }
}; };
} }
}, },
async lookupVinByPlate(licensePlate, licenseState) { async lookupVinByPlate(licensePlate, licenseState) {
try { try {
const response = await globalMethods.callHttpClient({ const response = await globalMethods.callHttpClient({
method: endpoints.LookupVinByPlate.method, method: endpoints.LookupVinByPlate.method,
endpoint: endpoints.LookupVinByPlate.url, endpoint: endpoints.LookupVinByPlate.url,
payload: { payload: {
licensePlate: licensePlate, licensePlate: licensePlate,
licenseState: licenseState, licenseState: licenseState
}, }
}); });
return response; return response;
} catch (responseError) { } catch (responseError) {
return { return {
error: { error: {
status: responseError.status, status: responseError.status
}, }
}; };
} }
}, },
// PartsOrQuestions API Actions // PartsOrQuestions API Actions
@ -360,8 +360,8 @@ export const useMainStore = defineStore({
carId: carId, carId: carId,
glassPieces: glassArrayForPayload, glassPieces: glassArrayForPayload,
zip: zipCode, zip: zipCode,
vin: vin, vin: vin
}, }
}); });
// Flatten location and name properties // Flatten location and name properties
@ -395,8 +395,8 @@ export const useMainStore = defineStore({
glassPieces: glassArrayForPayload, glassPieces: glassArrayForPayload,
answerResults: resultsArrayForPayload, answerResults: resultsArrayForPayload,
zip: zipCode, zip: zipCode,
vin: vin, vin: vin
}, }
}); });
// Flatten location and name properties // Flatten location and name properties
@ -410,7 +410,7 @@ export const useMainStore = defineStore({
getCapabilityQuestions(carId, partNumber) { getCapabilityQuestions(carId, partNumber) {
return globalMethods.callHttpClient({ return globalMethods.callHttpClient({
method: endpoints.GetCapabilityQuestions.method, method: endpoints.GetCapabilityQuestions.method,
endpoint: `${endpoints.GetCapabilityQuestions.url}/${carId}/${partNumber}`, endpoint: `${endpoints.GetCapabilityQuestions.url}/${carId}/${partNumber}`
}); });
}, },
@ -428,14 +428,14 @@ export const useMainStore = defineStore({
method: endpoints.GetPartFromCapabilityAnswer.method, method: endpoints.GetPartFromCapabilityAnswer.method,
endpoint: endpoints.GetPartFromCapabilityAnswer.url, endpoint: endpoints.GetPartFromCapabilityAnswer.url,
payload: { payload: {
part, part,
capabilityAnswerResults: capabilityQuestionAnswersForPart, capabilityAnswerResults: capabilityQuestionAnswersForPart
}, }
}); });
}, },
getWipers() { async getWipers() {
const carId = this.order.vehicle.carId; const carId = this.order.vehicle.carId;
///WARNING WARNING DANGER WILL ROBINSON ///WARNING
///TODO: this is temp test code until serviceLocation is complete. ///TODO: this is temp test code until serviceLocation is complete.
//const serviceZipCode = this.order.serviceLocation.zipCode; //const serviceZipCode = this.order.serviceLocation.zipCode;
const serviceZipCode = '44902'; const serviceZipCode = '44902';
@ -451,7 +451,7 @@ export const useMainStore = defineStore({
}); });
}, },
getRainDefense() { async getRainDefense() {
return globalMethods return globalMethods
.callHttpClient({ .callHttpClient({
method: endpoints.GetRainDefense.method, method: endpoints.GetRainDefense.method,
@ -465,12 +465,13 @@ export const useMainStore = defineStore({
}, },
getSupportingItems() { async getSupportingItems() {
const glassPartsArray = this.order.lineItems.glassParts ?? []; const glassPartsArray = this.order.lineItems.glassParts ?? [];
const carId = this.order.vehicle.carId; const carId = this.order.vehicle.carId;
const isRepair = this.order.damage.isRepair; const isRepair = this.order.damage.isRepair;
const numberOfChips = this.order.damage.numberOfChips; const numberOfChips = this.order.damage.numberOfChips;
return globalMethods
return globalMethods
.callHttpClient({ .callHttpClient({
method: endpoints.GetSupportingItems.method, method: endpoints.GetSupportingItems.method,
endpoint: endpoints.GetSupportingItems.url, endpoint: endpoints.GetSupportingItems.url,
@ -491,35 +492,35 @@ export const useMainStore = defineStore({
getLineItemQueryStringForPricing(availableLineItems); getLineItemQueryStringForPricing(availableLineItems);
const vehicle = this.order.vehicle; const vehicle = this.order.vehicle;
//TEMP ///WARNING
zipCodeToUse = "44902"; ///TODO: this is temp test code until serviceLocation is complete.
let accountNumber = 0; /// and ctu is available. Also, EON may need to be implemented.
ctuToUse = 0; zipCodeToUse = "44902"
//eon ctuToUse = "01820"
let queryString = let queryString =
`ParentAccountNumber=${accountNumber}` + `ParentAccountNumber=${applicationConfig.CASH_PARENT_ACCOUNT_NUMBER}` +
`&CTU=${ctuToUse}` + `&CTU=${ctuToUse}` +
`&CarId=${vehicle.carId}` + `&CarId=${vehicle.carId}` +
`&Make=${vehicle.make}` + `&Make=${vehicle.make}` +
`&Model=${vehicle.model}` + `&Model=${vehicle.model}` +
`&Year=${vehicle.year}` + `&Year=${vehicle.year}` +
`&EON=0` +
`&ZipCode=${zipCodeToUse}` + `&ZipCode=${zipCodeToUse}` +
`${availableLineItemsFormattedForRequest}`; `${availableLineItemsFormattedForRequest}`;
//const lineItemServerData = order.lineItems.serverData;
//if (lineItemServerData) { const response = await globalMethods
// queryString += `&ServerData=$(encodeURIComponent(lineItemServerData)}`; .callHttpClient({
//} method: endpoints.GetPriceOrderItems.method,
endpoint: `${endpoints.GetPriceOrderItems.url}?${queryString}`
}).catch((error) => {
console.error(error);
return [];
});
//return globalMethods availableLineItems = addPricesToLineItems(availableLineItems, response.data.lineItems)
// .callHttpClient({
// method: endpoints.GetPriceOrderItems.method, return availableLineItems;
// endpoint: `${endpoints.GetPriceOrderItems.url}?${queryString}`
// }).catch((error) => {
// console.error(error);
// return [];
// });
}, },
lookupVehicleByVin(vin) { lookupVehicleByVin(vin) {
@ -537,7 +538,7 @@ export const useMainStore = defineStore({
.callHttpClient({ .callHttpClient({
methods: endpoints.GetVehicle.method, methods: endpoints.GetVehicle.method,
endpoint: `${endpoints.GetVehicle.url}/${this.order.vehicle.year}/${this.order.vehicle.make}/${this.order.vehicle.model}/${this.order.vehicle.style}`, endpoint: `${endpoints.GetVehicle.url}/${this.order.vehicle.year}/${this.order.vehicle.make}/${this.order.vehicle.model}/${this.order.vehicle.style}`,
payload: {}, payload: {}
}) })
.then((response) => { .then((response) => {
this.updateVehicle(response.data); this.updateVehicle(response.data);
@ -859,7 +860,7 @@ export const useMainStore = defineStore({
this.updateCapabilityQuestionAnswers(null); this.updateCapabilityQuestionAnswers(null);
this.updatePageData({ this.updatePageData({
page: issPageValues.CAPABILITY_QUESTIONS, page: issPageValues.CAPABILITY_QUESTIONS,
data: null, data: null
}); });
} }
@ -934,9 +935,9 @@ export const useMainStore = defineStore({
userPartitionNumber: experiment.userPartitionNumber, userPartitionNumber: experiment.userPartitionNumber,
assignmentId: experiment.assignmentId, assignmentId: experiment.assignmentId,
sessionKey: sessionKey, sessionKey: sessionKey,
pageName: pageName, pageName: pageName
}, }
}, }
}); });
}, },
logPageView({ userId, sessionKey, pageName, sessionId, action, event, shouldUseSessionId, experimentsForUser }) logPageView({ userId, sessionKey, pageName, sessionId, action, event, shouldUseSessionId, experimentsForUser })
@ -957,7 +958,7 @@ export const useMainStore = defineStore({
method: endpoints.LogPageView.method, method: endpoints.LogPageView.method,
endpoint: endpoints.LogPageView.url, endpoint: endpoints.LogPageView.url,
payload: payload, payload: payload,
logApiCall: false, logApiCall: false
}); });
}, },
logCustomEvent({ userId, sessionKey, pageName, sessionId, category, action, label, value, shouldUseSessionId, experimentsForUser}) logCustomEvent({ userId, sessionKey, pageName, sessionId, category, action, label, value, shouldUseSessionId, experimentsForUser})
@ -976,14 +977,14 @@ export const useMainStore = defineStore({
label: label, label: label,
value: value, value: value,
shouldUseSessionId: shouldUseSessionId, shouldUseSessionId: shouldUseSessionId,
experimentsForUser: experimentsForUser, experimentsForUser: experimentsForUser
}; };
return globalMethods.callHttpClient({ return globalMethods.callHttpClient({
method: endpoints.LogCustomEvent.method, method: endpoints.LogCustomEvent.method,
endpoint: endpoints.LogCustomEvent.url, endpoint: endpoints.LogCustomEvent.url,
payload: payload, payload: payload,
logApiCall: false, logApiCall: false
}); });
}, },
initializeSession({ userId, sessionId, userAgent, referrer }) { initializeSession({ userId, sessionId, userAgent, referrer }) {
@ -995,14 +996,14 @@ export const useMainStore = defineStore({
userAgent: userAgent, userAgent: userAgent,
operatorId: "WEB", operatorId: "WEB",
userName: "SafeliteISS", userName: "SafeliteISS",
referrer: referrer, referrer: referrer
}; };
return globalMethods.callHttpClient({ return globalMethods.callHttpClient({
method: endpoints.InitializeSession.method, method: endpoints.InitializeSession.method,
endpoint: endpoints.InitializeSession.url, endpoint: endpoints.InitializeSession.url,
payload: payload, payload: payload,
logApiCall: false, logApiCall: false
}); });
}, },
@ -1021,7 +1022,7 @@ export const useMainStore = defineStore({
return globalMethods.callHttpClient({ return globalMethods.callHttpClient({
method: endpoints.GetExperimentsByUser.method, method: endpoints.GetExperimentsByUser.method,
endpoint: `${endpoints.GetExperimentsByUser.url}/${userId}`, endpoint: `${endpoints.GetExperimentsByUser.url}/${userId}`,
payload: {}, payload: {}
}); });
}, },
@ -1035,13 +1036,13 @@ export const useMainStore = defineStore({
userId: userId, userId: userId,
triggerEvent: triggerEvent, triggerEvent: triggerEvent,
triggerValue: triggerValue, triggerValue: triggerValue,
experimentOrder: this.experimentOrder, experimentOrder: this.experimentOrder
}; };
const response = await globalMethods.callHttpClient({ const response = await globalMethods.callHttpClient({
method: endpoints.RunExperimentsForTrigger.method, method: endpoints.RunExperimentsForTrigger.method,
endpoint: endpoints.RunExperimentsForTrigger.url, endpoint: endpoints.RunExperimentsForTrigger.url,
payload: payload, payload: payload
}); });
this.updateExperiments(response.data.experiments); this.updateExperiments(response.data.experiments);
@ -1050,14 +1051,14 @@ export const useMainStore = defineStore({
async validateZip({ zip }) { async validateZip({ zip }) {
return await globalMethods.callHttpClient({ return await globalMethods.callHttpClient({
methods: endpoints.ValidateZip.method, methods: endpoints.ValidateZip.method,
endpoint: `${endpoints.ValidateZip.url}/${zip}`, endpoint: `${endpoints.ValidateZip.url}/${zip}`
}); });
}, },
async validateClientTag(clientTag) { async validateClientTag(clientTag) {
return await globalMethods.callHttpClient({ return await globalMethods.callHttpClient({
methods: endpoints.ValidateClientTag.method, methods: endpoints.ValidateClientTag.method,
endpoint: `${endpoints.ValidateClientTag.url}/${clientTag}`, endpoint: `${endpoints.ValidateClientTag.url}/${clientTag}`
}); });
}, },
@ -1208,7 +1209,7 @@ function convertGlassPieceNamingForApi(glassArray) {
glassArray.forEach((glass) => { glassArray.forEach((glass) => {
converted.push({ converted.push({
location: glass.glassLocation, location: glass.glassLocation,
name: glass.glassName, name: glass.glassName
}); });
}); });
return converted; return converted;
@ -1221,7 +1222,7 @@ function convertResultsForApi(resultsArray) {
converted.push({ converted.push({
location: answer.glassLocation, location: answer.glassLocation,
name: answer.glassName, name: answer.glassName,
result: answer.result, result: answer.result
}); });
}); });
return converted; return converted;
@ -1249,6 +1250,22 @@ function getAllPartNumbers(partsOrQuestions) {
: []; : [];
} }
function addPricesToLineItems(lineItems, pricingLineItems) {
lineItems.forEach((lineItem) => {
const lineItemIndex = pricingLineItems.findIndex(
(pricingLineItem) => pricingLineItem.partNumber === lineItem.partNumber
)
if (lineItem.childParts) {
addPricesToLineItems(lineItem.childParts, pricingLineItems)
}
const pricedLineItem = pricingLineItems.splice(lineItemIndex, 1)[0]
lineItem.laborAmount = pricedLineItem.laborAmount
lineItem.sellingPrice = pricedLineItem.sellingPrice
lineItem.kitPrice = pricedLineItem.kitPrice
});
return lineItems;
}
function getLineItemQueryStringForPricing(lineItems) { function getLineItemQueryStringForPricing(lineItems) {
return lineItems return lineItems
.map((lineItem) => { .map((lineItem) => {

View file

@ -3,6 +3,7 @@ process.env.VUE_APP_CURRENT_ENVIRONMENT = "Localhost";
process.env.VUE_APP_GOOGLE_PLACES_API_KEY = process.env.VUE_APP_GOOGLE_PLACES_API_KEY =
"AIzaSyCuLhQcDdZTTb4JzpUFms1OCch2dk5lHF0"; "AIzaSyCuLhQcDdZTTb4JzpUFms1OCch2dk5lHF0";
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
// GA & GTM // GA & GTM
// NOTE: Using the old ISS site GTM Cotnainer ID for now, will create a new one soon. // NOTE: Using the old ISS site GTM Cotnainer ID for now, will create a new one soon.
@ -26,7 +27,8 @@ module.exports = {
}, },
}, },
}, },
configureWebpack: { configureWebpack: {
devtool: 'source-map' devtool: 'source-map',
plugins: [new MiniCssExtractPlugin()]
}, },
}; };