Merge branch 'develop' into bug/SSR-1404
This commit is contained in:
commit
e6ab9b6936
23 changed files with 141 additions and 126 deletions
|
|
@ -141,11 +141,11 @@ const endpoints = Object.freeze({
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
},
|
},
|
||||||
LookupVinByAddress: {
|
LookupVinByAddress: {
|
||||||
url: `${VEHICLE_BASE_URL}/lookup-vin-by-address`,
|
url: `${VEHICLE_BASE_URL}/lookup-by-address`,
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
},
|
},
|
||||||
LookupVinByPlate: {
|
LookupVinByPlate: {
|
||||||
url: `${VEHICLE_BASE_URL}/lookup-vin-by-plate`,
|
url: `${VEHICLE_BASE_URL}/lookup-by-plate`,
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
},
|
},
|
||||||
InitializeSession: {
|
InitializeSession: {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,11 @@ const experimentUniverses = Object.freeze({
|
||||||
|
|
||||||
const experimentSettings = Object.freeze({
|
const experimentSettings = Object.freeze({
|
||||||
GOOGLE_CUSTOM_DIMENSION_INDEX: 'Google Custom Dimension Index',
|
GOOGLE_CUSTOM_DIMENSION_INDEX: 'Google Custom Dimension Index',
|
||||||
ISS_DISPLAY_PAY_IN_ADVANCE: 'DisplayPIAInsurance'
|
ISS_DISPLAY_PAY_IN_ADVANCE: 'DisplayPIAInsurance',
|
||||||
|
ISS_FEATURE_TOGGLE_IS_MOBILE_FEE_HIDDEN: 'HideMobileFee',
|
||||||
|
ISS_FEATURE_TOGGLE_IS_MOBILE_FEE_OVERRIDDEN: 'OverrideMobileFee',
|
||||||
|
ISS_FEATURE_TOGGLE_IS_RECYCLE_FEE_HIDDEN: 'HideRecycleFee',
|
||||||
|
ISS_FEATURE_TOGGLE_IS_RECYCLE_FEE_OVERRIDDEN: 'OverrideRecycleFee'
|
||||||
});
|
});
|
||||||
|
|
||||||
const experimentTriggers = Object.freeze({
|
const experimentTriggers = Object.freeze({
|
||||||
|
|
|
||||||
24
src/helpers/experiment-helper.js
Normal file
24
src/helpers/experiment-helper.js
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
/* eslint-disable max-len */
|
||||||
|
import { experimentSettings } from '@/constants/experiments';
|
||||||
|
|
||||||
|
export function hasExperimentSetting(storeExperimentSettings, settingName) {
|
||||||
|
return Object.hasOwn(storeExperimentSettings, settingName);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getExperimentSettingValue(storeExperimentSettings, settingName) {
|
||||||
|
return hasExperimentSetting(storeExperimentSettings, settingName)
|
||||||
|
? storeExperimentSettings[settingName]
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getFeatureTogglesQueryString(storeExperimentSettings) {
|
||||||
|
const isMobileFeeHidden = getExperimentSettingValue(storeExperimentSettings, experimentSettings.ISS_FEATURE_TOGGLE_IS_MOBILE_FEE_HIDDEN) === 'true';
|
||||||
|
const isMobileFeeOverridden = getExperimentSettingValue(storeExperimentSettings, experimentSettings.ISS_FEATURE_TOGGLE_IS_MOBILE_FEE_OVERRIDDEN) === 'true';
|
||||||
|
const isRecycleFeeHidden = getExperimentSettingValue(storeExperimentSettings, experimentSettings.ISS_FEATURE_TOGGLE_IS_RECYCLE_FEE_HIDDEN) === 'true';
|
||||||
|
const isRecycleFeeOverridden = getExperimentSettingValue(storeExperimentSettings, experimentSettings.ISS_FEATURE_TOGGLE_IS_RECYCLE_FEE_OVERRIDDEN) === 'true';
|
||||||
|
|
||||||
|
return `FeatureToggles.IsMobileFeeHidden=${isMobileFeeHidden}`
|
||||||
|
+ `&FeatureToggles.IsMobileFeeOverridden=${isMobileFeeOverridden}`
|
||||||
|
+ `&FeatureToggles.IsRecycleFeeHidden=${isRecycleFeeHidden}`
|
||||||
|
+ `&FeatureToggles.IsRecycleFeeOverridden=${isRecycleFeeOverridden}`;
|
||||||
|
}
|
||||||
|
|
@ -34,15 +34,12 @@ export async function saveSession({ shouldAwaitSaveSessionQueue = false, submitA
|
||||||
Will determine if to submitWorkOrder.
|
Will determine if to submitWorkOrder.
|
||||||
TODO: Add more description to this
|
TODO: Add more description to this
|
||||||
*/
|
*/
|
||||||
export async function submitWorkOrder({
|
export async function submitWorkOrder({ submitType }) {
|
||||||
pageNameToLog,
|
const store = useMainStore();
|
||||||
submitAfterSave = false,
|
store.resetSubmittedOrder();
|
||||||
createDeleteStatusWorkOrderForPia = false
|
|
||||||
}) {
|
|
||||||
await saveSession({
|
await saveSession({
|
||||||
pageNameToLog,
|
|
||||||
shouldAwaitSaveSessionQueue: true,
|
shouldAwaitSaveSessionQueue: true,
|
||||||
submitAfterSave,
|
submitAfterSave: true
|
||||||
createDeleteStatusWorkOrderForPia
|
|
||||||
});
|
});
|
||||||
|
store.createSubmittedOrder(submitType);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { createTestingPinia } from '@pinia/testing';
|
||||||
import cartDropdown from '@/iss-components/cart-dropdown/cart-dropdown.vue';
|
import cartDropdown from '@/iss-components/cart-dropdown/cart-dropdown.vue';
|
||||||
|
|
||||||
// Supporting Files
|
// Supporting Files
|
||||||
import {getEnumName, getMountOptions} from '@/helpers/unit-test-helper.js';
|
import { getEnumName, getMountOptions } from '@/helpers/unit-test-helper.js';
|
||||||
import { useMainStore, getDefaultState } from '@/store';
|
import { useMainStore, getDefaultState } from '@/store';
|
||||||
import { formatAmountInDollars } from '@/helpers/text-helper.js';
|
import { formatAmountInDollars } from '@/helpers/text-helper.js';
|
||||||
import partTypeStrings from '@/constants/part-type-strings';
|
import partTypeStrings from '@/constants/part-type-strings';
|
||||||
|
|
@ -43,6 +43,7 @@ function getMountedComponent(mainInitialState = {}, initialData = {}, propsData
|
||||||
});
|
});
|
||||||
useMainStore(testingPinia);
|
useMainStore(testingPinia);
|
||||||
|
|
||||||
|
mountOptions.global.mixins[0].methods.getSettingValue = jest.fn(() => 'false');
|
||||||
mountOptions.global.plugins = [testingPinia];
|
mountOptions.global.plugins = [testingPinia];
|
||||||
mountOptions.data = () => (initialData);
|
mountOptions.data = () => (initialData);
|
||||||
mountOptions.propsData = propsData;
|
mountOptions.propsData = propsData;
|
||||||
|
|
@ -1338,7 +1339,6 @@ describe('cart-dropdown component', () => {
|
||||||
const { wrapper } = getMountedComponent(storeData);
|
const { wrapper } = getMountedComponent(storeData);
|
||||||
formatAmountInDollars.mockReturnValueOnce(dollarAmount);
|
formatAmountInDollars.mockReturnValueOnce(dollarAmount);
|
||||||
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
const result = wrapper.vm.getDisplayed(0);
|
const result = wrapper.vm.getDisplayed(0);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,7 @@ import { formatAmountInDollars } from '@/helpers/text-helper.js';
|
||||||
import { getHighestFullySatisfiedTier, getPackageContents } from '@/helpers/service-package-helper.js';
|
import { getHighestFullySatisfiedTier, getPackageContents } from '@/helpers/service-package-helper.js';
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
|
import { experimentSettings } from '@/constants/experiments';
|
||||||
import partTypeStrings from '@/constants/part-type-strings.js';
|
import partTypeStrings from '@/constants/part-type-strings.js';
|
||||||
import cartItemType from '@/constants/cart-item-type.js';
|
import cartItemType from '@/constants/cart-item-type.js';
|
||||||
import widgetFields from '@/constants/cms-widget-fields.js';
|
import widgetFields from '@/constants/cms-widget-fields.js';
|
||||||
|
|
@ -322,10 +323,12 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const items = vapsCartItemsNotInPackage.filter((item) => item != null);
|
const items = vapsCartItemsNotInPackage.filter((item) => item != null);
|
||||||
if (this.recycleFeeCartItem) {
|
const isRecycleFeeHidden = this.getSettingValue(experimentSettings.ISS_FEATURE_TOGGLE_IS_RECYCLE_FEE_HIDDEN) === 'true';
|
||||||
|
const isMobileFeeHidden = this.getSettingValue(experimentSettings.ISS_FEATURE_TOGGLE_IS_MOBILE_FEE_HIDDEN) === 'true';
|
||||||
|
if (this.recycleFeeCartItem && !isRecycleFeeHidden) {
|
||||||
items.push(this.recycleFeeCartItem);
|
items.push(this.recycleFeeCartItem);
|
||||||
}
|
}
|
||||||
if (this.mobileFeeCartItem) {
|
if (this.mobileFeeCartItem && !isMobileFeeHidden) {
|
||||||
items.push(this.mobileFeeCartItem);
|
items.push(this.mobileFeeCartItem);
|
||||||
}
|
}
|
||||||
return items;
|
return items;
|
||||||
|
|
|
||||||
|
|
@ -436,19 +436,19 @@ describe('Bailout page', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('forwardButtonAction', () => {
|
describe('forwardButtonAction', () => {
|
||||||
test('should navigate to the next route', () => {
|
test('should navigate to the next route', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = getMountedComponent();
|
const { wrapper } = getMountedComponent();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.forwardButtonAction();
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
|
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
|
||||||
wrapper.vm.navigationScenarios.CLICKED_FORWARD,
|
wrapper.vm.navigationScenarios.CLICKED_FORWARD,
|
||||||
wrapper.vm.$route,
|
wrapper.vm.$route,
|
||||||
{},
|
{},
|
||||||
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
|
{ [routerParams.SKIP_SAVE_SESSION]: true }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,7 @@ import canBailoutNavigateBack from '@/helpers/bailout-helper';
|
||||||
import BailoutCode from '@/constants/bailoutCode';
|
import BailoutCode from '@/constants/bailoutCode';
|
||||||
import issPageValues from '@/router/router-constants/issPage-values';
|
import issPageValues from '@/router/router-constants/issPage-values';
|
||||||
import MaskaFormattedMasks from '@/constants/maska-masks';
|
import MaskaFormattedMasks from '@/constants/maska-masks';
|
||||||
|
import { saveSession } from '@/helpers/order-helper';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'bailout-page',
|
name: 'bailout-page',
|
||||||
|
|
@ -200,13 +201,14 @@ export default {
|
||||||
this.$route
|
this.$route
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
forwardButtonAction() {
|
async forwardButtonAction() {
|
||||||
this.mainStore.setBailoutContactInfo(this.bailoutPageModel);
|
this.mainStore.setBailoutContactInfo(this.bailoutPageModel);
|
||||||
|
await saveSession({ shouldAwaitSaveSessionQueue: true });
|
||||||
this.$router.navigate(
|
this.$router.navigate(
|
||||||
this.navigationScenarios.CLICKED_FORWARD,
|
this.navigationScenarios.CLICKED_FORWARD,
|
||||||
this.$route,
|
this.$route,
|
||||||
{},
|
{},
|
||||||
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
|
{ [routerParams.SKIP_SAVE_SESSION]: true }
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
getBailoutPageModelFromStore() {
|
getBailoutPageModelFromStore() {
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,7 @@ import textBlock from '@/digital-components/text-block/text-block.vue';
|
||||||
// Import Supporting Files
|
// Import Supporting Files
|
||||||
import {
|
import {
|
||||||
fetchCmsContentForPage,
|
fetchCmsContentForPage,
|
||||||
|
setupModalLink,
|
||||||
setupModalLinks,
|
setupModalLinks,
|
||||||
processIfStatements
|
processIfStatements
|
||||||
} from '@/helpers/cms-content-helper.js';
|
} from '@/helpers/cms-content-helper.js';
|
||||||
|
|
@ -334,8 +335,13 @@ export default {
|
||||||
},
|
},
|
||||||
nextStepsBody(newValue, oldValue) {
|
nextStepsBody(newValue, oldValue) {
|
||||||
if (newValue !== oldValue) {
|
if (newValue !== oldValue) {
|
||||||
setupModalLinks(this, 'RecalModal');
|
setupModalLink(this, 'RecalModal');
|
||||||
setupModalLinks(this, 'DeductibleModal');
|
setupModalLink(this, 'DeductibleModal');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
verifiedItacAlertBody(newValue, oldValue) {
|
||||||
|
if (newValue !== oldValue) {
|
||||||
|
setupModalLink(this, 'DeductibleModal');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ export default {
|
||||||
this.unauthorized = !isAuthorized;
|
this.unauthorized = !isAuthorized;
|
||||||
|
|
||||||
if (isAuthorized) {
|
if (isAuthorized) {
|
||||||
await this.populateISSConfigValues(clientData);
|
this.populateISSConfigValues(clientData);
|
||||||
|
|
||||||
if (clientData.parameters?.length > 0) {
|
if (clientData.parameters?.length > 0) {
|
||||||
const finalParams = this.combineClientParameters(clientData.parameters, queryStringParams);
|
const finalParams = this.combineClientParameters(clientData.parameters, queryStringParams);
|
||||||
|
|
@ -100,7 +100,7 @@ export default {
|
||||||
|
|
||||||
return { isAuthorized: authorized, clientData };
|
return { isAuthorized: authorized, clientData };
|
||||||
},
|
},
|
||||||
async populateISSConfigValues(data) {
|
populateISSConfigValues(data) {
|
||||||
this.mainStore.issConfig.clientName = data.accountName;
|
this.mainStore.issConfig.clientName = data.accountName;
|
||||||
this.mainStore.issConfig.clientDisplayName = data.accountName; // Defaults to use the client name.
|
this.mainStore.issConfig.clientDisplayName = data.accountName; // Defaults to use the client name.
|
||||||
this.mainStore.issConfig.parentAccountNumber = data.parentAccountNumber;
|
this.mainStore.issConfig.parentAccountNumber = data.parentAccountNumber;
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||||
import { mount } from '@vue/test-utils';
|
import { mount } from '@vue/test-utils';
|
||||||
import { createTestingPinia } from '@pinia/testing';
|
import { createTestingPinia } from '@pinia/testing';
|
||||||
import { nextTick } from 'vue';
|
import { nextTick } from 'vue';
|
||||||
import coverageStatuses from "@/constants/coverage-statuses";
|
import coverageStatuses from '@/constants/coverage-statuses';
|
||||||
import coverageType from "@/constants/coverage-type";
|
import coverageType from '@/constants/coverage-type';
|
||||||
|
|
||||||
jest.mock('@/helpers/layout-helper.js', () => jest.fn());
|
jest.mock('@/helpers/layout-helper.js', () => jest.fn());
|
||||||
|
|
||||||
|
|
@ -173,6 +173,7 @@ function getMountedComponent(mainInitialState = {}, initialData = {}, methodToRu
|
||||||
useMainStore(testingPinia);
|
useMainStore(testingPinia);
|
||||||
methodToRun();
|
methodToRun();
|
||||||
|
|
||||||
|
mountOptions.global.mixins[0].methods.getSettingValue = jest.fn(() => 'false');
|
||||||
mountOptions.global.plugins = [testingPinia];
|
mountOptions.global.plugins = [testingPinia];
|
||||||
mountOptions.mixins = [mockMixin];
|
mountOptions.mixins = [mockMixin];
|
||||||
mountOptions.data = () => (
|
mountOptions.data = () => (
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,6 @@ export default {
|
||||||
},
|
},
|
||||||
mixins: [BaseFormMixin],
|
mixins: [BaseFormMixin],
|
||||||
async beforeRouteEnter(to, from, next) {
|
async beforeRouteEnter(to, from, next) {
|
||||||
useMainStore().createSubmittedOrder(submitType.SAFELITE);
|
|
||||||
// Call APIs
|
// Call APIs
|
||||||
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,7 @@ import { AppointmentTypeStrings } from '@/constants/schedule-constants';
|
||||||
import VehicleBanner from '@/iss-components/vehicle-banner/vehicle-banner.vue';
|
import VehicleBanner from '@/iss-components/vehicle-banner/vehicle-banner.vue';
|
||||||
import { submitWorkOrder } from '@/helpers/order-helper.js';
|
import { submitWorkOrder } from '@/helpers/order-helper.js';
|
||||||
import { experimentSettings } from '@/constants/experiments';
|
import { experimentSettings } from '@/constants/experiments';
|
||||||
|
import submitType from '@/constants/submit-type';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'payment-method',
|
name: 'payment-method',
|
||||||
|
|
@ -300,12 +301,7 @@ export default {
|
||||||
|
|
||||||
if (this.paymentMethod === paymentMethods.PAY_AT_TIME_OF_SERVICE) {
|
if (this.paymentMethod === paymentMethods.PAY_AT_TIME_OF_SERVICE) {
|
||||||
try {
|
try {
|
||||||
await submitWorkOrder({
|
await submitWorkOrder({ submitType: submitType.SAFELITE }).then(() => {
|
||||||
pageNameToLog: 'payment-method',
|
|
||||||
submitAfterSave: true
|
|
||||||
}).then(() => {
|
|
||||||
useMainStore().resetSubmittedOrder();
|
|
||||||
|
|
||||||
this.$router.navigate(
|
this.$router.navigate(
|
||||||
this.navigationScenarios.CLICKED_FORWARD,
|
this.navigationScenarios.CLICKED_FORWARD,
|
||||||
this.$route
|
this.$route
|
||||||
|
|
|
||||||
|
|
@ -124,12 +124,8 @@ export default {
|
||||||
},
|
},
|
||||||
async saveAndSubmitWorkOrder() {
|
async saveAndSubmitWorkOrder() {
|
||||||
// Final work order submit after returning from pay in advance.
|
// Final work order submit after returning from pay in advance.
|
||||||
useMainStore().resetSubmittedOrder();
|
|
||||||
try {
|
try {
|
||||||
await submitWorkOrder({
|
await submitWorkOrder({ submitType: submitType.SAFELITE });
|
||||||
pageNameToLog: 'payment-return',
|
|
||||||
submitAfterSave: true
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`error: response from submit work order:${error.message}`);
|
console.error(`error: response from submit work order:${error.message}`);
|
||||||
this.navigateOnPayInAdvanceError();
|
this.navigateOnPayInAdvanceError();
|
||||||
|
|
@ -138,7 +134,6 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
showIssLoadingModal(false);
|
showIssLoadingModal(false);
|
||||||
useMainStore().createSubmittedOrder(submitType.SAFELITE);
|
|
||||||
this.$router.navigate(
|
this.$router.navigate(
|
||||||
this.navigationScenarios.PAY_IN_ADVANCE_SUCCESS,
|
this.navigationScenarios.PAY_IN_ADVANCE_SUCCESS,
|
||||||
this.$route
|
this.$route
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import partTypeStrings from '@/constants/part-type-strings';
|
||||||
import { useMainStore } from '@/store';
|
import { useMainStore } from '@/store';
|
||||||
import allGlassPartsAndItemsHavePrices from '@/layouts/service-packages/service-package-helper/service-package-helper';
|
import allGlassPartsAndItemsHavePrices from '@/layouts/service-packages/service-package-helper/service-package-helper';
|
||||||
import { getPriceOfLineItem } from '@/helpers/price-calculator';
|
import { getPriceOfLineItem } from '@/helpers/price-calculator';
|
||||||
|
import { getHighestFullySatisfiedTier } from '@/helpers/service-package-helper.js';
|
||||||
|
|
||||||
const glassLocations = damageLocationsSelected;
|
const glassLocations = damageLocationsSelected;
|
||||||
|
|
||||||
|
|
@ -40,7 +41,10 @@ export default {
|
||||||
groupName: String,
|
groupName: String,
|
||||||
validationRules: String,
|
validationRules: String,
|
||||||
isRequired: Boolean,
|
isRequired: Boolean,
|
||||||
availableLineItems: []
|
availableLineItems: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
}
|
||||||
},
|
},
|
||||||
emits: ['vapsItemsSelected'],
|
emits: ['vapsItemsSelected'],
|
||||||
data() {
|
data() {
|
||||||
|
|
@ -212,51 +216,15 @@ export default {
|
||||||
return vapsPrice;
|
return vapsPrice;
|
||||||
},
|
},
|
||||||
selectDefaultPackage() {
|
selectDefaultPackage() {
|
||||||
const vapsFromStore = store.order.lineItems.vaps;
|
const { glassToReplace, isRepair } = store.order.damage;
|
||||||
let lowestTierForPackage = packageNames.TIER_ONE;
|
const { vaps } = store.order.lineItems;
|
||||||
if (vapsFromStore?.length > 0) {
|
const defaultTier = getHighestFullySatisfiedTier(
|
||||||
vapsFromStore.every((vapsItem) => {
|
glassToReplace ?? [],
|
||||||
const lowestTierForThisItem = this.getLowestTierForThisItem(vapsItem);
|
this.availableLineItems,
|
||||||
if (lowestTierForThisItem === packageNames.TIER_THREE) {
|
isRepair,
|
||||||
lowestTierForPackage = packageNames.TIER_THREE;
|
vaps ?? []
|
||||||
return false;
|
);
|
||||||
} if (lowestTierForThisItem === packageNames.TIER_TWO) {
|
this.selectedPackageName = defaultTier;
|
||||||
lowestTierForPackage = packageNames.TIER_TWO;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.selectedPackageName = lowestTierForPackage;
|
|
||||||
},
|
|
||||||
|
|
||||||
getLowestTierForThisItem(vapsItem) {
|
|
||||||
let lowestTierForThisItem = null;
|
|
||||||
switch (vapsItem.partType) {
|
|
||||||
case partTypeStrings.FRONT_WIPER:
|
|
||||||
if (this.frontWipersApplicableForTierThree) {
|
|
||||||
lowestTierForThisItem = packageNames.TIER_THREE;
|
|
||||||
}
|
|
||||||
if (this.frontWipersApplicableForTierTwo) {
|
|
||||||
lowestTierForThisItem = packageNames.TIER_TWO;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case partTypeStrings.REAR_WIPER:
|
|
||||||
if (this.rearWiperApplicableForTierThree) {
|
|
||||||
lowestTierForThisItem = packageNames.TIER_THREE;
|
|
||||||
}
|
|
||||||
if (this.rearWiperApplicableForTierTwo) {
|
|
||||||
lowestTierForThisItem = packageNames.TIER_TWO;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case partTypeStrings.RAIN_DEFENSE:
|
|
||||||
if (this.rainDefenseApplicableForTierThree) {
|
|
||||||
lowestTierForThisItem = packageNames.TIER_THREE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
return lowestTierForThisItem;
|
|
||||||
},
|
},
|
||||||
getVapsLineItemsForSelectedPackage(packageName) {
|
getVapsLineItemsForSelectedPackage(packageName) {
|
||||||
const vapsLineItemsForSelectedPackage = [];
|
const vapsLineItemsForSelectedPackage = [];
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
ref="theForm"
|
ref="theForm"
|
||||||
v-slot="{ meta }"
|
v-slot="{ meta }"
|
||||||
@submit="onSubmit"
|
@submit="onSubmit"
|
||||||
@invalid-submit="onInvalidSubmit">
|
@invalidSubmit="onInvalidSubmit">
|
||||||
<div class="container-fluid fade-on-route-transition service-packages">
|
<div class="container-fluid fade-on-route-transition service-packages">
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
<div class="col-md-6 px-0 px-md-2">
|
<div class="col-md-6 px-0 px-md-2">
|
||||||
|
|
@ -50,8 +50,8 @@
|
||||||
ref="RearWiperModal"
|
ref="RearWiperModal"
|
||||||
cmsWidgetName="RearWiperModal" />
|
cmsWidgetName="RearWiperModal" />
|
||||||
<contentGroupModal
|
<contentGroupModal
|
||||||
ref="RecalModal"
|
ref="RecalModal"
|
||||||
cmsWidgetName="RecalModal" />
|
cmsWidgetName="RecalModal" />
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -72,7 +72,6 @@ import allGlassPartsAndItemsHavePrices from '@/layouts/service-packages/service-
|
||||||
import globalRules from '@/constants/global-rules';
|
import globalRules from '@/constants/global-rules';
|
||||||
import servicePackageQuestion from '@/layouts/service-packages/service-package-question/service-package-question.vue';
|
import servicePackageQuestion from '@/layouts/service-packages/service-package-question/service-package-question.vue';
|
||||||
import issPageValues from '@/router/router-constants/issPage-values';
|
import issPageValues from '@/router/router-constants/issPage-values';
|
||||||
import bailoutCode from '@/constants/bailoutCode';
|
|
||||||
import bailoutMessage from '@/constants/bailoutMessage';
|
import bailoutMessage from '@/constants/bailoutMessage';
|
||||||
|
|
||||||
const store = useMainStore();
|
const store = useMainStore();
|
||||||
|
|
@ -143,9 +142,7 @@ export default {
|
||||||
if (!hasBailedOut) {
|
if (!hasBailedOut) {
|
||||||
next((vm) => {
|
next((vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
vm.pricedGlassParts = clonedGlassParts;
|
vm.setData(clonedGlassParts, resultMap.supportingItems, pricingResults);
|
||||||
vm.supportingItems = resultMap.supportingItems;
|
|
||||||
vm.availableLineItems = pricingResults;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -185,6 +182,11 @@ export default {
|
||||||
&& store.order.lineItems.glassParts.length > 0))
|
&& store.order.lineItems.glassParts.length > 0))
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
setData(clonedGlassParts, supportingItems, pricingResults) {
|
||||||
|
this.pricedGlassParts = clonedGlassParts;
|
||||||
|
this.supportingItems = supportingItems;
|
||||||
|
this.availableLineItems = pricingResults;
|
||||||
|
},
|
||||||
vapsItemsSelectedAction(vapsItemsSelected) {
|
vapsItemsSelectedAction(vapsItemsSelected) {
|
||||||
this.selectedVaps = vapsItemsSelected;
|
this.selectedVaps = vapsItemsSelected;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -354,11 +354,7 @@ export default {
|
||||||
},
|
},
|
||||||
async forwardButtonAction() {
|
async forwardButtonAction() {
|
||||||
try {
|
try {
|
||||||
await submitWorkOrder({
|
await submitWorkOrder({ submitType: submitType.TPA }).then(() => {
|
||||||
pageNameToLog: 'tpa-submit',
|
|
||||||
submitAfterSave: true
|
|
||||||
}).then(() => {
|
|
||||||
useMainStore().createSubmittedOrder(submitType.TPA);
|
|
||||||
this.navigate(this.navigationScenarios.CLICKED_FORWARD);
|
this.navigate(this.navigationScenarios.CLICKED_FORWARD);
|
||||||
}).catch((submitError) => {
|
}).catch((submitError) => {
|
||||||
useMainStore().setBailout(bailoutMessage.saveSessionError(submitError.data));
|
useMainStore().setBailout(bailoutMessage.saveSessionError(submitError.data));
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,6 @@ describe('navigation', () => {
|
||||||
await wrapper.vm.forwardButtonAction();
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.mainStore.getDuplicateReferrals).toHaveBeenCalledTimes(0);
|
|
||||||
expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(0);
|
expect(wrapper.vm.$router.navigate).toHaveBeenCalledTimes(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -206,7 +205,7 @@ describe('navigation', () => {
|
||||||
navigationScenarios.CLICKED_FORWARD_WITH_DUPLICATES,
|
navigationScenarios.CLICKED_FORWARD_WITH_DUPLICATES,
|
||||||
undefined,
|
undefined,
|
||||||
{},
|
{},
|
||||||
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
|
{ [routerParams.SKIP_SAVE_SESSION]: true }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
test('if policy and vehicles are found but no duplicates, navigate to policy-vehicle page', async () => {
|
test('if policy and vehicles are found but no duplicates, navigate to policy-vehicle page', async () => {
|
||||||
|
|
@ -234,7 +233,7 @@ describe('navigation', () => {
|
||||||
navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
|
navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
|
||||||
undefined,
|
undefined,
|
||||||
{},
|
{},
|
||||||
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
|
{ [routerParams.SKIP_SAVE_SESSION]: true }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
test('if policy is found, but no vehicles and no duplicates, navigate to vehicle-selection page', async () => {
|
test('if policy is found, but no vehicles and no duplicates, navigate to vehicle-selection page', async () => {
|
||||||
|
|
@ -259,7 +258,7 @@ describe('navigation', () => {
|
||||||
navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES,
|
navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES,
|
||||||
undefined,
|
undefined,
|
||||||
{},
|
{},
|
||||||
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
|
{ [routerParams.SKIP_SAVE_SESSION]: true }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
test('if policy is found, but null vehicles and no duplicates, navigate to vehicle-selection page', async () => {
|
test('if policy is found, but null vehicles and no duplicates, navigate to vehicle-selection page', async () => {
|
||||||
|
|
@ -285,7 +284,7 @@ describe('navigation', () => {
|
||||||
navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES,
|
navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES,
|
||||||
undefined,
|
undefined,
|
||||||
{},
|
{},
|
||||||
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
|
{ [routerParams.SKIP_SAVE_SESSION]: true }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
test('if policy is not found and no duplicates, navigate to policy-holder-details page', async () => {
|
test('if policy is not found and no duplicates, navigate to policy-holder-details page', async () => {
|
||||||
|
|
@ -310,7 +309,7 @@ describe('navigation', () => {
|
||||||
navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
|
navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
|
||||||
undefined,
|
undefined,
|
||||||
{},
|
{},
|
||||||
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
|
{ [routerParams.SKIP_SAVE_SESSION]: true }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
test('getDuplicateReferrals throws rejected promise => navigate called', async () => {
|
test('getDuplicateReferrals throws rejected promise => navigate called', async () => {
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,8 @@ import states from '@/constants/states';
|
||||||
import globalRules from '@/constants/global-rules';
|
import globalRules from '@/constants/global-rules';
|
||||||
import routerParams from '@/router/router-constants/router-params';
|
import routerParams from '@/router/router-constants/router-params';
|
||||||
import MaskaFormattedMasks from '@/constants/maska-masks';
|
import MaskaFormattedMasks from '@/constants/maska-masks';
|
||||||
|
import { saveSession } from '@/helpers/order-helper';
|
||||||
|
import bailoutMessage from '@/constants/bailoutMessage';
|
||||||
|
|
||||||
// define validation rules
|
// define validation rules
|
||||||
defineRule(
|
defineRule(
|
||||||
|
|
@ -299,17 +301,22 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
async forwardButtonAction() {
|
async forwardButtonAction() {
|
||||||
try {
|
try {
|
||||||
await this.configureZip();
|
|
||||||
this.mainStore.updatePolicyData(this.welcomePageModel);
|
this.mainStore.updatePolicyData(this.welcomePageModel);
|
||||||
await this.mainStore.getBillToInfo();
|
await Promise.allSettled([
|
||||||
await this.mainStore.getDuplicateReferrals();
|
this.configureZip().then(async () => await this.mainStore.getBillToInfo()),
|
||||||
await this.mainStore.getCoveragePolicyInfo();
|
this.mainStore.getDuplicateReferrals(),
|
||||||
|
this.mainStore.getCoveragePolicyInfo()
|
||||||
|
]);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
// TODO: Bailout?
|
// TODO: Bailout?
|
||||||
} finally {
|
} finally {
|
||||||
if (!this.displayInvalidZipAlert) {
|
if (!this.displayInvalidZipAlert) {
|
||||||
this.navigateForward();
|
await saveSession({ shouldAwaitSaveSessionQueue: true })
|
||||||
|
.catch((error) => {
|
||||||
|
this.mainStore.setBailout(bailoutMessage.saveSessionError(error.data));
|
||||||
|
})
|
||||||
|
.finally(() => this.navigateForward());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -324,12 +331,19 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
navigateForward() {
|
navigateForward() {
|
||||||
if (this.mainStore.applicationUser.duplicateOrders?.length > 0 ?? false) {
|
if (this.mainStore.isBailout) {
|
||||||
|
this.$router.navigate(
|
||||||
|
this.navigationScenarios.SAVE_SESSION_FAILED,
|
||||||
|
this.$route,
|
||||||
|
{},
|
||||||
|
{ [routerParams.SKIP_SAVE_SESSION]: true }
|
||||||
|
);
|
||||||
|
} else if (this.mainStore.applicationUser.duplicateOrders?.length > 0 ?? false) {
|
||||||
this.$router.navigate(
|
this.$router.navigate(
|
||||||
this.navigationScenarios.CLICKED_FORWARD_WITH_DUPLICATES,
|
this.navigationScenarios.CLICKED_FORWARD_WITH_DUPLICATES,
|
||||||
this.$route,
|
this.$route,
|
||||||
{},
|
{},
|
||||||
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
|
{ [routerParams.SKIP_SAVE_SESSION]: true }
|
||||||
);
|
);
|
||||||
} else if (this.mainStore.isPolicyLookupSuccessful) {
|
} else if (this.mainStore.isPolicyLookupSuccessful) {
|
||||||
if (this.mainStore.order.policy.vehicles?.length > 0 ?? false) {
|
if (this.mainStore.order.policy.vehicles?.length > 0 ?? false) {
|
||||||
|
|
@ -339,7 +353,7 @@ export default {
|
||||||
.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
|
.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
|
||||||
this.$route,
|
this.$route,
|
||||||
{},
|
{},
|
||||||
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
|
{ [routerParams.SKIP_SAVE_SESSION]: true }
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// navigate to vehicle-selection page (manual entry)
|
// navigate to vehicle-selection page (manual entry)
|
||||||
|
|
@ -348,7 +362,7 @@ export default {
|
||||||
.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES,
|
.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES,
|
||||||
this.$route,
|
this.$route,
|
||||||
{},
|
{},
|
||||||
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
|
{ [routerParams.SKIP_SAVE_SESSION]: true }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -357,7 +371,7 @@ export default {
|
||||||
this.navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
|
this.navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
|
||||||
this.$route,
|
this.$route,
|
||||||
{},
|
{},
|
||||||
{ [routerParams.SAVE_SESSION_SYNCHRONOUS]: true }
|
{ [routerParams.SKIP_SAVE_SESSION]: true }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -171,17 +171,9 @@ router.afterEach(async (to, from) => {
|
||||||
store.clearSaveSessionPromise();
|
store.clearSaveSessionPromise();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (to.query.issPage !== issPageValues.TPA_CONFIRMATION && to.query.issPage !== issPageValues.ORDER_CONFIRMATION) {
|
const skipSaveSession = !!router.options.history.state[routerParams.SKIP_SAVE_SESSION];
|
||||||
const saveSessionSynchronous = !!router.options.history.state[routerParams.SAVE_SESSION_SYNCHRONOUS];
|
if (!skipSaveSession && !store.hasSubmittedOrder()) {
|
||||||
await saveSession({ shouldAwaitSaveSessionQueue: saveSessionSynchronous }).catch((error) => {
|
await saveSession({});
|
||||||
if (from.name === issPageValues.WELCOME_PAGE) {
|
|
||||||
store.setBailout(bailoutMessage.saveSessionError(error.data));
|
|
||||||
router.navigate(
|
|
||||||
navigationScenarios.SAVE_SESSION_FAILED,
|
|
||||||
{ query: { issPage: issPageValues.WELCOME_PAGE } }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (to.query.issPage !== issPageValues.ENTRY_PAGE) {
|
if (to.query.issPage !== issPageValues.ENTRY_PAGE) {
|
||||||
|
|
@ -203,7 +195,6 @@ router.navigateWithoutSaving = (
|
||||||
optionalParams = {},
|
optionalParams = {},
|
||||||
optionalPageData = {}
|
optionalPageData = {}
|
||||||
) => {
|
) => {
|
||||||
// TODO does not save session
|
|
||||||
navigate(scenario, currentRoute, optionalQuery, optionalParams, optionalPageData);
|
navigate(scenario, currentRoute, optionalQuery, optionalParams, optionalPageData);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
const routerParams = Object.freeze({
|
const routerParams = Object.freeze({
|
||||||
DISPLAY_VEHICLE_CHANGE_ALERT: 'displayVehicleChangeAlert',
|
DISPLAY_VEHICLE_CHANGE_ALERT: 'displayVehicleChangeAlert',
|
||||||
SAVE_SESSION_SYNCHRONOUS: 'saveSessionSynchronous'
|
SKIP_SAVE_SESSION: 'skipSaveSession'
|
||||||
});
|
});
|
||||||
|
|
||||||
export default routerParams;
|
export default routerParams;
|
||||||
|
|
|
||||||
|
|
@ -21,4 +21,19 @@ describe('Router', () => {
|
||||||
router.navigate(scenario, currentRoute);
|
router.navigate(scenario, currentRoute);
|
||||||
expect(router.push.mock.calls[0][0].query.issPage).toBe(issPageValues.POLICY_HOLDER_DETAILS);
|
expect(router.push.mock.calls[0][0].query.issPage).toBe(issPageValues.POLICY_HOLDER_DETAILS);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Should set state as expected', () => {
|
||||||
|
// Arrange
|
||||||
|
const scenario = navigationScenarios.CLICKED_FORWARD;
|
||||||
|
const currentRoute = { query: { issPage: issPageValues.WELCOME_PAGE } };
|
||||||
|
const parameters = {saveSync: true};
|
||||||
|
|
||||||
|
router.push = jest.fn();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
router.navigate(scenario, currentRoute, {}, parameters);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(router.push.mock.calls[0][0].state).toBe(parameters);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ import partNumberStrings from '@/constants/part-number-strings';
|
||||||
import { getLineItemsFlattened } from '@/helpers/line-items-helper';
|
import { getLineItemsFlattened } from '@/helpers/line-items-helper';
|
||||||
import { buildQueryStringParameterFromArrayOfComplexObjects, getLineItemQueryString, getTaxLineItemQueryString } from '@/helpers/querystring-helper';
|
import { buildQueryStringParameterFromArrayOfComplexObjects, getLineItemQueryString, getTaxLineItemQueryString } from '@/helpers/querystring-helper';
|
||||||
import coverageType from '@/constants/coverage-type';
|
import coverageType from '@/constants/coverage-type';
|
||||||
|
import { getFeatureTogglesQueryString } from '@/helpers/experiment-helper';
|
||||||
|
|
||||||
const storeId = 'main';
|
const storeId = 'main';
|
||||||
|
|
||||||
|
|
@ -1034,6 +1035,7 @@ export const useMainStore = defineStore({
|
||||||
async getInsurancePriceOrderItems(availableLineItems) {
|
async getInsurancePriceOrderItems(availableLineItems) {
|
||||||
const { serviceLocation, currentDeductible } = this.order;
|
const { serviceLocation, currentDeductible } = this.order;
|
||||||
const lineItemsQueryString = getLineItemQueryString(availableLineItems, 'lineItems');
|
const lineItemsQueryString = getLineItemQueryString(availableLineItems, 'lineItems');
|
||||||
|
const featureTogglesQueryString = getFeatureTogglesQueryString(this.experimentSettings);
|
||||||
|
|
||||||
let queryString =
|
let queryString =
|
||||||
`ParentAccountNumber=${this.order.parentAccountNumber}`
|
`ParentAccountNumber=${this.order.parentAccountNumber}`
|
||||||
|
|
@ -1041,6 +1043,7 @@ export const useMainStore = defineStore({
|
||||||
+ `&CTU=${serviceLocation.zipCodeCtu}`
|
+ `&CTU=${serviceLocation.zipCodeCtu}`
|
||||||
+ `&Deductible=${currentDeductible ?? 0}`
|
+ `&Deductible=${currentDeductible ?? 0}`
|
||||||
+ `&ZipCode=${serviceLocation.zipCode}`
|
+ `&ZipCode=${serviceLocation.zipCode}`
|
||||||
|
+ `&${featureTogglesQueryString}`
|
||||||
+ `${lineItemsQueryString}`;
|
+ `${lineItemsQueryString}`;
|
||||||
|
|
||||||
const lineItemServerData = this.order.lineItems?.serverData;
|
const lineItemServerData = this.order.lineItems?.serverData;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue