Merge branch 'develop' into feature/CSR-2237
This commit is contained in:
commit
fdbe6c8f8d
4 changed files with 56 additions and 49 deletions
|
|
@ -30,7 +30,7 @@
|
||||||
import { splitCopyOnCMSPlaceHolder } from "@/helpers/cms-content-helper";
|
import { splitCopyOnCMSPlaceHolder } from "@/helpers/cms-content-helper";
|
||||||
import baseMixin from "@/mixins/base-mixin.js";
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
import { getPromosThatMatchLineItemsOnOrder } from "@/helpers/promotions-helper";
|
import { getPromosThatMatchLineItemsOnOrder } from "@/helpers/promotions-helper";
|
||||||
import { getArrayOfAllLineItems } from "@/store";
|
import { getArrayOfAllLineItemsAndChildParts } from "@/store";
|
||||||
|
|
||||||
const INLINE_IMAGE_TOKEN = "custom:inlineImage";
|
const INLINE_IMAGE_TOKEN = "custom:inlineImage";
|
||||||
const AFTERPAY_PRICE_TOKEN = "custom:afterpayPrice";
|
const AFTERPAY_PRICE_TOKEN = "custom:afterpayPrice";
|
||||||
|
|
@ -76,7 +76,7 @@ export default {
|
||||||
return this.getCmsContent(this.cmsWidgetName, "SubheaderText");
|
return this.getCmsContent(this.cmsWidgetName, "SubheaderText");
|
||||||
},
|
},
|
||||||
afterpayPrice() {
|
afterpayPrice() {
|
||||||
let allLineItems = getArrayOfAllLineItems(this.lineItems);
|
let allLineItems = getArrayOfAllLineItemsAndChildParts(this.lineItems);
|
||||||
if (this.lineItems.promos) {
|
if (this.lineItems.promos) {
|
||||||
allLineItems = allLineItems?.filter((item) => item.partType !== "PROMO_DISCOUNT");
|
allLineItems = allLineItems?.filter((item) => item.partType !== "PROMO_DISCOUNT");
|
||||||
}
|
}
|
||||||
|
|
@ -91,7 +91,7 @@ export default {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.lineItems.promos) {
|
if (this.lineItems.promos) {
|
||||||
let allLineItems = getArrayOfAllLineItems(this.lineItems);
|
let allLineItems = getArrayOfAllLineItemsAndChildParts(this.lineItems);
|
||||||
const promos = getPromosThatMatchLineItemsOnOrder(
|
const promos = getPromosThatMatchLineItemsOnOrder(
|
||||||
this.lineItems.promos,
|
this.lineItems.promos,
|
||||||
allLineItems
|
allLineItems
|
||||||
|
|
|
||||||
|
|
@ -337,17 +337,10 @@ export default {
|
||||||
experimentSettings.INSURANCE_TAB_TO_DISPLAY_THRESHOLD_INTERNAL
|
experimentSettings.INSURANCE_TAB_TO_DISPLAY_THRESHOLD_INTERNAL
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!store.getters.externalParameterState?.isExternalParameter) {
|
const isExternalParameter = store.getters.externalParameterState?.isExternalParameter;
|
||||||
// there are no external parameters
|
|
||||||
|
|
||||||
if (internalThreshold) thresholdToUse = internalThreshold;
|
if (isExternalParameter !== undefined) {
|
||||||
vm.isInsuranceSelected = getIsInsuranceSelectedValue(
|
// user is from an external source (either has value or is null)
|
||||||
vm.availableLineItems,
|
|
||||||
thresholdToUse
|
|
||||||
);
|
|
||||||
baseMixin.methods.ResetExternalParamsAndHideModal();
|
|
||||||
} else {
|
|
||||||
// there ARE external parameters
|
|
||||||
|
|
||||||
if (store.getters.externalParameterQuote.isInsurance == true) {
|
if (store.getters.externalParameterQuote.isInsurance == true) {
|
||||||
// did user intentionally select insurance?
|
// did user intentionally select insurance?
|
||||||
|
|
@ -361,26 +354,26 @@ export default {
|
||||||
baseMixin.methods.ResetExternalParamsAndHideModal();
|
baseMixin.methods.ResetExternalParamsAndHideModal();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// did user come from external source (LeadGen)?
|
|
||||||
let externalSource = store.getters.externalParameterSource
|
|
||||||
? store.getters.externalParameterSource
|
|
||||||
: null;
|
|
||||||
|
|
||||||
// Business logic to determine what "external" source is
|
|
||||||
if (externalSource?.includes("LeadGen")) {
|
|
||||||
const externalThreshold = experimentMixin.methods.getSettingValue(
|
const externalThreshold = experimentMixin.methods.getSettingValue(
|
||||||
experimentSettings.INSURANCE_TAB_TO_DISPLAY_THRESHOLD_EXTERNAL
|
experimentSettings.INSURANCE_TAB_TO_DISPLAY_THRESHOLD_EXTERNAL
|
||||||
);
|
);
|
||||||
if (externalThreshold) thresholdToUse = externalThreshold;
|
thresholdToUse = externalThreshold;
|
||||||
} else {
|
|
||||||
if (internalThreshold) thresholdToUse = internalThreshold;
|
|
||||||
}
|
|
||||||
vm.isInsuranceSelected = getIsInsuranceSelectedValue(
|
vm.isInsuranceSelected = getIsInsuranceSelectedValue(
|
||||||
vm.availableLineItems,
|
vm.availableLineItems,
|
||||||
thresholdToUse
|
thresholdToUse
|
||||||
);
|
);
|
||||||
baseMixin.methods.ResetExternalParamsAndHideModal();
|
baseMixin.methods.ResetExternalParamsAndHideModal();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// there are no external parameters; use internal threshold
|
||||||
|
if (internalThreshold) thresholdToUse = internalThreshold;
|
||||||
|
|
||||||
|
vm.isInsuranceSelected = getIsInsuranceSelectedValue(
|
||||||
|
vm.availableLineItems,
|
||||||
|
thresholdToUse
|
||||||
|
);
|
||||||
|
baseMixin.methods.ResetExternalParamsAndHideModal();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,10 @@ export default {
|
||||||
if (logFirstShopsDisplayed) {
|
if (logFirstShopsDisplayed) {
|
||||||
gaAction = this.GaActions.SHOPS_FIRST_DISPLAYED;
|
gaAction = this.GaActions.SHOPS_FIRST_DISPLAYED;
|
||||||
}
|
}
|
||||||
if (this.selectedAppointmentType === AppointmentTypeStrings.IN_SHOP) {
|
if (
|
||||||
|
this.selectedAppointmentType === AppointmentTypeStrings.IN_SHOP ||
|
||||||
|
this.selectedAppointmentType === AppointmentTypeStrings.DROP_OFF
|
||||||
|
) {
|
||||||
var shops = mappedData.map((shop) => {
|
var shops = mappedData.map((shop) => {
|
||||||
if (shop.value.length > 5 && shop.value.startsWith("00")) {
|
if (shop.value.length > 5 && shop.value.startsWith("00")) {
|
||||||
return shop.value.substring(1);
|
return shop.value.substring(1);
|
||||||
|
|
@ -179,7 +182,7 @@ export default {
|
||||||
this.pushEventToGA(
|
this.pushEventToGA(
|
||||||
this.GaCategories.SERVICE_LOCATION,
|
this.GaCategories.SERVICE_LOCATION,
|
||||||
gaAction,
|
gaAction,
|
||||||
shops.join("/"),
|
shops.join(","),
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -476,10 +476,6 @@ export const mutations = {
|
||||||
externalParameterState.quote.servicePackage = servicePackage;
|
externalParameterState.quote.servicePackage = servicePackage;
|
||||||
saveExternalParameterState(externalParameterState);
|
saveExternalParameterState(externalParameterState);
|
||||||
},
|
},
|
||||||
updateExternalParameterSource(state, source) {
|
|
||||||
externalParameterState.source = source;
|
|
||||||
saveExternalParameterState(externalParameterState);
|
|
||||||
},
|
|
||||||
//RESET ExternalParameter MUTATIONS
|
//RESET ExternalParameter MUTATIONS
|
||||||
resetExternalParameterVehicleState(state) {
|
resetExternalParameterVehicleState(state) {
|
||||||
externalParameterState.vehicle.year = null;
|
externalParameterState.vehicle.year = null;
|
||||||
|
|
@ -510,10 +506,6 @@ export const mutations = {
|
||||||
externalParameterState.quote.servicePackage = null;
|
externalParameterState.quote.servicePackage = null;
|
||||||
saveExternalParameterState(externalParameterState);
|
saveExternalParameterState(externalParameterState);
|
||||||
},
|
},
|
||||||
resetExternalParameterSourceState(state) {
|
|
||||||
externalParameterState.source = null;
|
|
||||||
saveExternalParameterState(externalParameterState);
|
|
||||||
},
|
|
||||||
resetIsExternalParameter(state) {
|
resetIsExternalParameter(state) {
|
||||||
externalParameterState.isExternalParameter = null;
|
externalParameterState.isExternalParameter = null;
|
||||||
saveExternalParameterState(externalParameterState);
|
saveExternalParameterState(externalParameterState);
|
||||||
|
|
@ -936,7 +928,7 @@ export const getters = {
|
||||||
externalParameterQuote: (state) => externalParameterState?.quote,
|
externalParameterQuote: (state) => externalParameterState?.quote,
|
||||||
externalParameterServiceZip: (state) => externalParameterState?.serviceZip,
|
externalParameterServiceZip: (state) => externalParameterState?.serviceZip,
|
||||||
externalParameterEstimate: (state) => externalParameterState?.estimate,
|
externalParameterEstimate: (state) => externalParameterState?.estimate,
|
||||||
externalParameterSource: (state) => externalParameterState?.source,
|
isExternalParameter: (state) => externalParameterState?.isExternalParameter,
|
||||||
};
|
};
|
||||||
|
|
||||||
function getNonFalseValuesOfPropertyInArrayOfObjects(array, propertyName) {
|
function getNonFalseValuesOfPropertyInArrayOfObjects(array, propertyName) {
|
||||||
|
|
@ -2625,7 +2617,7 @@ export const actions = {
|
||||||
eon: order.eon,
|
eon: order.eon,
|
||||||
isRepair: order.damage.isRepair,
|
isRepair: order.damage.isRepair,
|
||||||
glassToReplace: renameGlassToReplaceAttributes(order.damage.glassToReplace),
|
glassToReplace: renameGlassToReplaceAttributes(order.damage.glassToReplace),
|
||||||
lineItemsOnOrder: getArrayOfAllLineItems(lineItemsToUse),
|
lineItemsOnOrder: getArrayOfAllLineItemsAndChildParts(lineItemsToUse),
|
||||||
parentAccountNumber: useDefaultCashParentAccount
|
parentAccountNumber: useDefaultCashParentAccount
|
||||||
? applicationConfig.CASH_PARENT_ACCOUNT_NUMBER
|
? applicationConfig.CASH_PARENT_ACCOUNT_NUMBER
|
||||||
: order.payment.parentAccountNumber,
|
: order.payment.parentAccountNumber,
|
||||||
|
|
@ -2697,7 +2689,7 @@ export const actions = {
|
||||||
eon: order.eon,
|
eon: order.eon,
|
||||||
isRepair: order.damage.isRepair,
|
isRepair: order.damage.isRepair,
|
||||||
glassToReplace: renameGlassToReplaceAttributes(order.damage.glassToReplace),
|
glassToReplace: renameGlassToReplaceAttributes(order.damage.glassToReplace),
|
||||||
lineItemsOnOrder: getArrayOfAllLineItems(lineItemsToUse),
|
lineItemsOnOrder: getArrayOfAllLineItemsAndChildParts(lineItemsToUse),
|
||||||
parentAccountNumber: useDefaultCashParentAccount
|
parentAccountNumber: useDefaultCashParentAccount
|
||||||
? applicationConfig.CASH_PARENT_ACCOUNT_NUMBER
|
? applicationConfig.CASH_PARENT_ACCOUNT_NUMBER
|
||||||
: order.payment.parentAccountNumber,
|
: order.payment.parentAccountNumber,
|
||||||
|
|
@ -2929,7 +2921,6 @@ export const actions = {
|
||||||
context.commit(storeMutations.RESET_EXTERNAL_PARAMETER_ESTIMATE_STATE);
|
context.commit(storeMutations.RESET_EXTERNAL_PARAMETER_ESTIMATE_STATE);
|
||||||
context.commit(storeMutations.RESET_EXTERNAL_PARAMETER_SERVICEZIP_STATE);
|
context.commit(storeMutations.RESET_EXTERNAL_PARAMETER_SERVICEZIP_STATE);
|
||||||
context.commit(storeMutations.RESET_EXTERNAL_PARAMETER_QUOTE_STATE);
|
context.commit(storeMutations.RESET_EXTERNAL_PARAMETER_QUOTE_STATE);
|
||||||
context.commit(storeMutations.RESET_EXTERNAL_PARAMETER_SOURCE_STATE);
|
|
||||||
context.commit(storeMutations.RESET_IS_EXTERNAL_PARAMETER);
|
context.commit(storeMutations.RESET_IS_EXTERNAL_PARAMETER);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -2950,7 +2941,9 @@ export const actions = {
|
||||||
|
|
||||||
async getRecalPartsAndSaveToLineItems(context, { pageNameToLog }) {
|
async getRecalPartsAndSaveToLineItems(context, { pageNameToLog }) {
|
||||||
// identify each part that needs recal
|
// identify each part that needs recal
|
||||||
const glassParts = context.state.order?.lineItems?.glassParts ?? [];
|
const glassParts = context.state.order?.lineItems?.glassParts
|
||||||
|
? deepClone(context.state.order.lineItems.glassParts)
|
||||||
|
: [];
|
||||||
|
|
||||||
for (let i = 0; i < glassParts.length; i++) {
|
for (let i = 0; i < glassParts.length; i++) {
|
||||||
// does this part need recal?
|
// does this part need recal?
|
||||||
|
|
@ -2983,6 +2976,7 @@ export const actions = {
|
||||||
}
|
}
|
||||||
|
|
||||||
glassParts[i].childParts.push(...recalPartResponse.data.recalibrationParts);
|
glassParts[i].childParts.push(...recalPartResponse.data.recalibrationParts);
|
||||||
|
context.dispatch(storeActions.SAVE_GLASS_PARTS, glassParts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3177,20 +3171,32 @@ export function mapTaxedLineItemsToStoreFormat(availableLineItems, storeLineItem
|
||||||
return lineItems;
|
return lineItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getArrayOfAllLineItems(lineItems) {
|
export function getArrayOfAllLineItemsAndChildParts(lineItems) {
|
||||||
let consolidatedLineItemsArray = [];
|
let consolidatedLineItemsArray = [];
|
||||||
|
|
||||||
if (lineItems.glassParts != null)
|
if (lineItems.glassParts != null)
|
||||||
consolidatedLineItemsArray = [...consolidatedLineItemsArray, ...lineItems.glassParts];
|
consolidatedLineItemsArray = [
|
||||||
|
...consolidatedLineItemsArray,
|
||||||
|
...getFlattenedArrayOfLineItemsWithChildParts(lineItems.glassParts),
|
||||||
|
];
|
||||||
|
|
||||||
if (lineItems.supportingItems != null)
|
if (lineItems.supportingItems != null)
|
||||||
consolidatedLineItemsArray = [...consolidatedLineItemsArray, ...lineItems.supportingItems];
|
consolidatedLineItemsArray = [
|
||||||
|
...consolidatedLineItemsArray,
|
||||||
|
...getFlattenedArrayOfLineItemsWithChildParts(lineItems.supportingItems),
|
||||||
|
];
|
||||||
|
|
||||||
if (lineItems.vaps != null)
|
if (lineItems.vaps != null)
|
||||||
consolidatedLineItemsArray = [...consolidatedLineItemsArray, ...lineItems.vaps];
|
consolidatedLineItemsArray = [
|
||||||
|
...consolidatedLineItemsArray,
|
||||||
|
...getFlattenedArrayOfLineItemsWithChildParts(lineItems.vaps),
|
||||||
|
];
|
||||||
|
|
||||||
if (lineItems.promos != null)
|
if (lineItems.promos != null)
|
||||||
consolidatedLineItemsArray = [...consolidatedLineItemsArray, ...lineItems.promos];
|
consolidatedLineItemsArray = [
|
||||||
|
...consolidatedLineItemsArray,
|
||||||
|
...getFlattenedArrayOfLineItemsWithChildParts(lineItems.promos),
|
||||||
|
];
|
||||||
|
|
||||||
return consolidatedLineItemsArray;
|
return consolidatedLineItemsArray;
|
||||||
}
|
}
|
||||||
|
|
@ -3225,7 +3231,11 @@ function getFlattenedLineItemsWithGlassPartTag(lineItems) {
|
||||||
return {
|
return {
|
||||||
partNumber: lineItem.partNumber,
|
partNumber: lineItem.partNumber,
|
||||||
partType: lineItem.partType,
|
partType: lineItem.partType,
|
||||||
isGlassPart: true,
|
isGlassPart:
|
||||||
|
lineItem.partType == partTypeStrings.RECALIBRATION ||
|
||||||
|
lineItem.partType == partTypeStrings.ADAS_RECALIBRATION
|
||||||
|
? false
|
||||||
|
: true,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -3269,6 +3279,9 @@ function addGuidToLineItemsIfNotAlreadyThere(lineItems) {
|
||||||
if (!lineItem.id) {
|
if (!lineItem.id) {
|
||||||
lineItem.id = crypto.randomUUID();
|
lineItem.id = crypto.randomUUID();
|
||||||
}
|
}
|
||||||
|
if (lineItem.childParts) {
|
||||||
|
addGuidToLineItemsIfNotAlreadyThere(lineItem.childParts);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3450,7 +3463,6 @@ async function resetScheduleIfUnavailable(context, order, pageNameToLog) {
|
||||||
function createExternalParameterDefaultState() {
|
function createExternalParameterDefaultState() {
|
||||||
// create default externalParameter state
|
// create default externalParameter state
|
||||||
const externalParameterDefaultState = {
|
const externalParameterDefaultState = {
|
||||||
isExternalParameter: null,
|
|
||||||
vehicle: {
|
vehicle: {
|
||||||
year: null,
|
year: null,
|
||||||
make: null,
|
make: null,
|
||||||
|
|
@ -3473,7 +3485,6 @@ function createExternalParameterDefaultState() {
|
||||||
isInsurance: null,
|
isInsurance: null,
|
||||||
servicePackage: null,
|
servicePackage: null,
|
||||||
},
|
},
|
||||||
source: null,
|
|
||||||
};
|
};
|
||||||
// set to session storage
|
// set to session storage
|
||||||
saveExternalParameterState(externalParameterDefaultState);
|
saveExternalParameterState(externalParameterDefaultState);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue