Merge pull request #2401 from Safelite/rlsmerge/2025.04.10-to-develop
Release Merge 2025.04.10 to develop
This commit is contained in:
commit
b1f4f9696d
22 changed files with 251 additions and 207 deletions
|
|
@ -192,6 +192,10 @@ const endpoints = {
|
|||
url: "/account/api/v1/account/bill-to-account-number",
|
||||
method: "GET",
|
||||
},
|
||||
AddDonationPart: {
|
||||
url: "/order/api/v1/order/add-donation-part",
|
||||
method: "POST",
|
||||
},
|
||||
};
|
||||
|
||||
export { endpoints };
|
||||
|
|
|
|||
3
src/constants/session-storage.js
Normal file
3
src/constants/session-storage.js
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export const sessionStorageKeyConstants = {
|
||||
SUBMITTED_STATE: "submittedState",
|
||||
};
|
||||
|
|
@ -109,9 +109,9 @@ const storeActions = {
|
|||
SAVE_IS_RECAL_ACK_OPT_IN: "saveIsRecalAckOptIn",
|
||||
SAVE_IS_MSR_FEE_APPLICABLE: "saveIsMSRFeeApplicable",
|
||||
|
||||
CREATE_SUBMITTED_ORDER: "createSubmittedOrder",
|
||||
RESET_SUBMITTED_ORDER: "resetSubmittedOrder",
|
||||
ADD_DONATION_TO_SUBMITTED_ORDER: "addDonationToSubmittedOrder",
|
||||
CREATE_SUBMITTED_STATE: "createSubmittedState",
|
||||
RESET_SUBMITTED_STATE: "resetSubmittedState",
|
||||
ADD_DONATION_TO_SUBMITTED_STATE: "addDonationToSubmittedState",
|
||||
RESET_EXTERNAL_PARAMETER_STATE: "resetExternalParameterState",
|
||||
UPDATE_EXTERNAL_PARAMETER_MMS: "updateExternalParameterMMS",
|
||||
|
||||
|
|
|
|||
|
|
@ -62,11 +62,11 @@
|
|||
<div class="col-12">
|
||||
<div
|
||||
v-if="showDonationSuccess"
|
||||
class="d-flex justify-content-center align-items-center btn-success w-100"
|
||||
class="d-flex justify-content-center align-items-center btn-success w-100 mb-2"
|
||||
v-html="DonationThanksAlertWidget"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row px-4 mt-2">
|
||||
<div class="row px-4">
|
||||
<div class="col">
|
||||
<alert
|
||||
v-if="showDonationError"
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<p class="mt-0 mb-4 mx-0 text-center caption" v-html="DonationFooterText"></p>
|
||||
<p class="mt-2 mb-4 mx-0 text-center caption" v-html="DonationFooterText"></p>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
@ -261,6 +261,8 @@ export default {
|
|||
}
|
||||
.alert {
|
||||
border: 1px solid $red;
|
||||
margin-top: 0.5rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.btn-success {
|
||||
background: $green-100;
|
||||
|
|
|
|||
|
|
@ -401,11 +401,15 @@ export default {
|
|||
if (!this.lineItems || this.lineItems.length < 1) {
|
||||
return [];
|
||||
}
|
||||
let supportingItemsToAdd = [];
|
||||
if (this.lineItems.supportingItems) {
|
||||
supportingItemsToAdd = this.lineItems.supportingItems.filter(
|
||||
(item) => item.partType !== partTypeStrings.DONATION
|
||||
);
|
||||
}
|
||||
return [
|
||||
...(this.lineItems.glassParts ?? []),
|
||||
...(this.lineItems.supportingItems.filter(
|
||||
(item) => item.partType !== partTypeStrings.DONATION
|
||||
) ?? []),
|
||||
...supportingItemsToAdd,
|
||||
...(this.availableVaps ?? []),
|
||||
];
|
||||
},
|
||||
|
|
@ -1074,11 +1078,7 @@ export default {
|
|||
const donationLineItem = this.lineItems.supportingItems.find(
|
||||
(item) => item.partType === partTypeStrings.DONATION
|
||||
);
|
||||
if (donationLineItem?.sellingPrice !== 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return !!donationLineItem;
|
||||
},
|
||||
donationCartItemName() {
|
||||
return this.getCmsContent("DonationCartTextWidget", "Text");
|
||||
|
|
@ -1092,7 +1092,7 @@ export default {
|
|||
(item) => item.partType === partTypeStrings.DONATION
|
||||
);
|
||||
|
||||
if (donationLineItem?.sellingPrice > 0) {
|
||||
if (donationLineItem) {
|
||||
return {
|
||||
name: this.donationCartItemName,
|
||||
category: cartItemCategories.SUPPORTING_ITEMS,
|
||||
|
|
|
|||
20
src/helpers/experiment-helper.js
Normal file
20
src/helpers/experiment-helper.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
export function getExperimentSettingsFromExperimentList(experimentList) {
|
||||
return (
|
||||
experimentList
|
||||
.filter((x) => !!x.isActive)
|
||||
.map((x) => x.settings)
|
||||
.reduce((r, c) => Object.assign(r, c), {}) ?? {}
|
||||
);
|
||||
}
|
||||
|
||||
export function getSettingValue(settingName, experimentSettings) {
|
||||
return hasSetting(settingName, experimentSettings) ? experimentSettings[settingName] : null;
|
||||
}
|
||||
|
||||
export function hasSettingEqualTo(settingName, settingValue, experimentSettings) {
|
||||
return experimentSettings[settingName] == settingValue;
|
||||
}
|
||||
|
||||
export function hasSetting(settingName, experimentSettings) {
|
||||
return Object.hasOwn(experimentSettings, settingName);
|
||||
}
|
||||
|
|
@ -115,7 +115,7 @@ export default {
|
|||
},
|
||||
ServiceType() {
|
||||
const isRepair = this.getSubmittedOrder()?.damage.isRepair;
|
||||
const funnelHasRecalibrationPart = store.getters.isRecalibrationOnSubmittedOrder;
|
||||
const funnelHasRecalibrationPart = store.getters.isRecalibrationOnSubmittedState;
|
||||
if (!isRepair) {
|
||||
if (funnelHasRecalibrationPart) {
|
||||
return serviceType.REPLACEMENT_AND_RECALIBRATION;
|
||||
|
|
|
|||
|
|
@ -63,11 +63,9 @@
|
|||
:isExpandedOnLoad="false"
|
||||
:isItac="isItac"
|
||||
:isNoComp="isNoComp"
|
||||
:isMSRFeeApplicable="isMSRFeeApplicable"
|
||||
:donationAmount="donationAmount"
|
||||
@update-donation-amount="updateDonationAmount" />
|
||||
:isMSRFeeApplicable="isMSRFeeApplicable" />
|
||||
|
||||
<div class="mt-3" v-if="DisplayFosterLove">
|
||||
<div class="mt-3" v-if="shouldDisplayFosterLove">
|
||||
<donationBlock
|
||||
cmsWidgetName="DonationWidget"
|
||||
v-model="donationAmount"
|
||||
|
|
@ -118,8 +116,6 @@ import { coverageStatus } from "@/constants/insurance";
|
|||
import { getDisplayTextForDurationLength } from "@/helpers/duration-length-helper";
|
||||
import { experimentSettings } from "@/constants/experiments";
|
||||
import experimentMixin from "@/mixins/experiment-mixin.js";
|
||||
import { partTypeStrings } from "@/constants/part-type-strings";
|
||||
import { containsLineItemWithPartType } from "@/helpers/service-package-helper";
|
||||
import { containsRecalParts } from "@/helpers/recal-helper.js";
|
||||
import donationBlock from "@/experiment-components/donation-block.vue";
|
||||
import { partNumberStrings } from "@/constants/part-number-strings";
|
||||
|
|
@ -127,7 +123,16 @@ import { partNumberStrings } from "@/constants/part-number-strings";
|
|||
export default {
|
||||
name: "confirmation",
|
||||
async beforeRouteEnter(to, from, next) {
|
||||
// Experiments
|
||||
const hasRecalPriceRemoveExperiment = await store.getters.shouldHideRecalibration;
|
||||
let applicationUser = baseMixin.methods.hasSubmittedApplicationUser()
|
||||
? baseMixin.methods.getSubmittedApplicationUser()
|
||||
: store.getters.applicationUser;
|
||||
let hasFosterLoveExperiment = experimentMixin.methods.hasSettingEqualTo(
|
||||
experimentSettings.FOSTER_LOVE,
|
||||
"true",
|
||||
applicationUser.experiments
|
||||
);
|
||||
|
||||
// send part question data to SPS API for logging
|
||||
const orderFromStore = await deepClone(store.getters.order);
|
||||
|
|
@ -166,7 +171,7 @@ export default {
|
|||
}
|
||||
|
||||
// Create order
|
||||
await baseMixin.methods.dispatchStoreAction(storeActions.CREATE_SUBMITTED_ORDER); // This nulls the Store order
|
||||
await baseMixin.methods.dispatchStoreAction(storeActions.CREATE_SUBMITTED_STATE); // This nulls the Store order
|
||||
|
||||
// Call APIs
|
||||
const submittedOrder = baseMixin.methods.getSubmittedOrder();
|
||||
|
|
@ -215,7 +220,6 @@ export default {
|
|||
if (isNoComp || isItac) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return hasRecalPriceRemoveExperiment && isRecalibrationOnOrder;
|
||||
};
|
||||
|
||||
|
|
@ -231,6 +235,7 @@ export default {
|
|||
vm.vaps = availableVaps;
|
||||
vm.submittedOrder = submittedOrder;
|
||||
vm.shouldHideRecalibration = shouldHideRecalibration();
|
||||
vm.shouldDisplayFosterLove = hasFosterLoveExperiment;
|
||||
vm.donationAmount = donationAmount;
|
||||
});
|
||||
},
|
||||
|
|
@ -240,28 +245,20 @@ export default {
|
|||
vaps: [],
|
||||
submittedOrder: null,
|
||||
shouldHideRecalibration: null,
|
||||
shouldDisplayFosterLove: null,
|
||||
donationAmount: 0,
|
||||
showDonationSuccess: null,
|
||||
showDonationError: null,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
DisplayFosterLove() {
|
||||
return experimentMixin.methods.hasSettingEqualTo(
|
||||
experimentSettings.FOSTER_LOVE,
|
||||
"true"
|
||||
);
|
||||
},
|
||||
isRecalibrationOnOrder() {
|
||||
return containsRecalParts(this?.lineItems);
|
||||
},
|
||||
ShowCart() {
|
||||
if (this.isPia && this.submittedOrder?.settledTenderAmount == 0) {
|
||||
// settleTenderAmount always shows 0 via localhost or dev.
|
||||
// Temporarily set return true to see cart in localhost or dev environment
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
ScheduleConfirmationText() {
|
||||
|
|
@ -539,7 +536,7 @@ export default {
|
|||
this.showDonationSuccess = true;
|
||||
this.showDonationError = false;
|
||||
await baseMixin.methods.dispatchStoreAction(
|
||||
storeActions.ADD_DONATION_TO_SUBMITTED_ORDER,
|
||||
storeActions.ADD_DONATION_TO_SUBMITTED_STATE,
|
||||
parseInt(this.donationAmount),
|
||||
false
|
||||
);
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ export default {
|
|||
}
|
||||
|
||||
this.$refs.loadingModal.isModalVisible = false;
|
||||
await baseMixin.methods.dispatchStoreAction(storeActions.CREATE_SUBMITTED_ORDER);
|
||||
await baseMixin.methods.dispatchStoreAction(storeActions.CREATE_SUBMITTED_STATE);
|
||||
this.$router.navigateWithoutSaving(this.navigationScenarios.PIA_SUCCESS, this.$route);
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -683,7 +683,7 @@ export default {
|
|||
submitAfterSave: true,
|
||||
});
|
||||
|
||||
await baseMixin.methods.dispatchStoreAction(storeActions.CREATE_SUBMITTED_ORDER);
|
||||
await baseMixin.methods.dispatchStoreAction(storeActions.CREATE_SUBMITTED_STATE);
|
||||
window.location = applicationConfig.CONFIRMATION_URL;
|
||||
} catch (error) {
|
||||
console.log("error: response from submit work order(payment pg):" + error.message);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import { getMountOptions } from "@/helpers/unit-test-helper.js";
|
|||
import store from "@/store";
|
||||
import router from "@/router";
|
||||
import baseMixin from "../../mixins/base-mixin";
|
||||
import { experimentSettings } from "../../constants/experiments";
|
||||
|
||||
// Mock basemixin
|
||||
jest.mock("@/mixins/base-mixin.js", () => ({
|
||||
|
|
@ -147,6 +146,9 @@ beforeEach(() => {
|
|||
jest.restoreAllMocks();
|
||||
jest.clearAllMocks();
|
||||
store.getters = {
|
||||
applicationUser: {
|
||||
experiments: [],
|
||||
},
|
||||
order: {
|
||||
schedule: {
|
||||
date: "2019-01-01",
|
||||
|
|
|
|||
|
|
@ -269,6 +269,8 @@ export default {
|
|||
const priceString = getAmountDue(lineItemsToBePriced, false); // pass the IncludeTax param as false
|
||||
const priceStringIntegerRoundedDown = priceString?.split(".")[0]; // same method used as getDisplayPrice() in service-package-radio used on /quote
|
||||
const pricingByDayBasePrice = parseInt(priceStringIntegerRoundedDown);
|
||||
const payment = store.getters.order.payment;
|
||||
const isInsurance = payment?.isInsurance;
|
||||
|
||||
// Check to see if includePricingByDayUpcharge should already be set (based on order lineItems)
|
||||
let includePricingByDayUpcharge = false;
|
||||
|
|
@ -276,7 +278,7 @@ export default {
|
|||
const pricingByDayUpchargeFeeIndex = supportingItemsFromStore?.findIndex(
|
||||
(item) => item.partType == PRICING_BY_DAY_PART_TYPE
|
||||
);
|
||||
if (pricingByDayUpchargeFeeIndex > -1) {
|
||||
if (pricingByDayUpchargeFeeIndex > -1 && !isInsurance) {
|
||||
includePricingByDayUpcharge = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -630,26 +632,25 @@ export default {
|
|||
const supportingItems = this.getSupportingItems();
|
||||
|
||||
// if we have a pricing by day upcharge, then save/update supporting items with it
|
||||
if (this.showPricingByDay) {
|
||||
const pricingByDayUpchargeFeeIndex = supportingItems?.findIndex(
|
||||
(item) => item.partType == PRICING_BY_DAY_PART_TYPE
|
||||
);
|
||||
const pricingByDayUpchargeFeeIndex = supportingItems?.findIndex(
|
||||
(item) => item.partType == PRICING_BY_DAY_PART_TYPE
|
||||
);
|
||||
|
||||
if (this.includePricingByDayUpcharge) {
|
||||
if (pricingByDayUpchargeFeeIndex > -1) {
|
||||
supportingItems[pricingByDayUpchargeFeeIndex].laborAmount =
|
||||
this.pricingByDayUpchargeLineItem.laborAmount;
|
||||
supportingItems[pricingByDayUpchargeFeeIndex].sellingPrice =
|
||||
this.pricingByDayUpchargeLineItem.sellingPrice;
|
||||
supportingItems[pricingByDayUpchargeFeeIndex].kitPrice =
|
||||
this.pricingByDayUpchargeLineItem.kitPrice;
|
||||
} else {
|
||||
supportingItems.push(this.pricingByDayUpchargeLineItem);
|
||||
}
|
||||
if (this.includePricingByDayUpcharge && this.showPricingByDay) {
|
||||
if (pricingByDayUpchargeFeeIndex && pricingByDayUpchargeFeeIndex > -1) {
|
||||
supportingItems[pricingByDayUpchargeFeeIndex].laborAmount =
|
||||
this.pricingByDayUpchargeLineItem.laborAmount;
|
||||
supportingItems[pricingByDayUpchargeFeeIndex].sellingPrice =
|
||||
this.pricingByDayUpchargeLineItem.sellingPrice;
|
||||
supportingItems[pricingByDayUpchargeFeeIndex].kitPrice =
|
||||
this.pricingByDayUpchargeLineItem.kitPrice;
|
||||
} else {
|
||||
if (pricingByDayUpchargeFeeIndex >= 0) {
|
||||
supportingItems.splice(pricingByDayUpchargeFeeIndex, 1);
|
||||
}
|
||||
supportingItems.push(this.pricingByDayUpchargeLineItem);
|
||||
}
|
||||
} else {
|
||||
if (pricingByDayUpchargeFeeIndex >= 0) {
|
||||
// remove pricing by day upcharge if it already was in store
|
||||
supportingItems.splice(pricingByDayUpchargeFeeIndex, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -174,6 +174,7 @@ const mockMixin = {
|
|||
|
||||
beforeEach(() => {
|
||||
store.getters = {
|
||||
applicationUser: { experiments: [] },
|
||||
lineItems: {
|
||||
supportingItems: [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -173,9 +173,14 @@ function resetMockStoreData() {
|
|||
};
|
||||
}
|
||||
|
||||
const applicationUser = {
|
||||
experiments: [],
|
||||
};
|
||||
|
||||
function applyMockStoreDataToGetters() {
|
||||
store.getters = {
|
||||
experimentSettings: mockExperimentSettings,
|
||||
applicationUser: applicationUser,
|
||||
order: mockStoreData,
|
||||
damage: mockStoreData.damage,
|
||||
payment: mockStoreData.payment,
|
||||
|
|
|
|||
|
|
@ -448,7 +448,7 @@ export default {
|
|||
this.displayNoServiceAlert = false;
|
||||
},
|
||||
async forwardButtonAction() {
|
||||
await this.dispatchStoreAction(storeActions.RESET_SUBMITTED_ORDER);
|
||||
await this.dispatchStoreAction(storeActions.RESET_SUBMITTED_STATE);
|
||||
this.dispatchStoreAction(
|
||||
storeActions.SAVE_VEHICLE,
|
||||
{
|
||||
|
|
|
|||
|
|
@ -337,7 +337,7 @@ export default {
|
|||
|
||||
// Recalibration
|
||||
if (hasSubmittedOrder) {
|
||||
payload.isRecalibrationOnOrder = store.getters.isRecalibrationOnSubmittedOrder;
|
||||
payload.isRecalibrationOnOrder = store.getters.isRecalibrationOnSubmittedState;
|
||||
} else {
|
||||
payload.isRecalibrationOnOrder = store.getters.isRecalibrationOnOrder;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -425,7 +425,7 @@ describe("analyticsMixin.js", () => {
|
|||
workOrderId: "222222222222",
|
||||
};
|
||||
store.getters.isRecalibrationOnOrder = true;
|
||||
store.getters.isRecalibrationOnSubmittedOrder = false;
|
||||
store.getters.isRecalibrationOnSubmittedState = false;
|
||||
});
|
||||
|
||||
test("Pushes to data layer if nominal", () => {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import store from "@/store";
|
||||
import { storeActions } from "@/constants/store-actions.js";
|
||||
import { storeMutations } from "@/constants/store-mutations.js";
|
||||
import { sessionStorageKeyConstants } from "@/constants/session-storage.js";
|
||||
import { navigationScenarios } from "@/router/router-constants/navigation-scenarios";
|
||||
import { vehicleCategories } from "@/constants/vehicle-categories.js";
|
||||
import { routerParams } from "@/router/router-constants/router-params";
|
||||
|
|
@ -198,10 +199,26 @@ export default {
|
|||
}
|
||||
},
|
||||
getSubmittedOrder() {
|
||||
return JSON.parse(window.sessionStorage.getItem("submittedOrder"));
|
||||
return JSON.parse(
|
||||
window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE)
|
||||
)?.order;
|
||||
},
|
||||
hasSubmittedOrder() {
|
||||
return window.sessionStorage.getItem("submittedOrder") !== null;
|
||||
const submittedState = window.sessionStorage.getItem(
|
||||
sessionStorageKeyConstants.SUBMITTED_STATE
|
||||
);
|
||||
return submittedState !== null && submittedState.order !== null;
|
||||
},
|
||||
getSubmittedApplicationUser() {
|
||||
return JSON.parse(
|
||||
window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE)
|
||||
)?.applicationUser;
|
||||
},
|
||||
hasSubmittedApplicationUser() {
|
||||
const submittedState = window.sessionStorage.getItem(
|
||||
sessionStorageKeyConstants.SUBMITTED_STATE
|
||||
);
|
||||
return submittedState !== null && submittedState.applicationUser !== null;
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
|
|
|
|||
|
|
@ -1,17 +1,36 @@
|
|||
import store from "@/store";
|
||||
import * as experimentHelper from "../helpers/experiment-helper";
|
||||
|
||||
/*
|
||||
This is a wrapper around experiment-helper.js methods that allows an override
|
||||
to provide a custom list of experiments. At the time of implementation this
|
||||
was necessary for checking submittedState for experiments
|
||||
*/
|
||||
|
||||
export default {
|
||||
methods: {
|
||||
hasSettingEqualTo(settingName, settingValue) {
|
||||
return store.getters.experimentSettings[settingName] == settingValue;
|
||||
hasSettingEqualTo(
|
||||
settingName,
|
||||
settingValue,
|
||||
experimentList = store.getters.applicationUser.experiments
|
||||
) {
|
||||
const experimentSettings =
|
||||
experimentHelper.getExperimentSettingsFromExperimentList(experimentList);
|
||||
return experimentHelper.hasSettingEqualTo(
|
||||
settingName,
|
||||
settingValue,
|
||||
experimentSettings
|
||||
);
|
||||
},
|
||||
hasSetting(settingName) {
|
||||
return Object.hasOwn(store.getters.experimentSettings, settingName);
|
||||
hasSetting(settingName, experimentList = store.getters.applicationUser.experiments) {
|
||||
const experimentSettings =
|
||||
experimentHelper.getExperimentSettingsFromExperimentList(experimentList);
|
||||
return experimentHelper.hasSetting(settingName, experimentSettings);
|
||||
},
|
||||
getSettingValue(settingName) {
|
||||
return this.hasSetting(settingName)
|
||||
? store.getters.experimentSettings[settingName]
|
||||
: null;
|
||||
getSettingValue(settingName, experimentList = store.getters.applicationUser.experiments) {
|
||||
const experimentSettings =
|
||||
experimentHelper.getExperimentSettingsFromExperimentList(experimentList);
|
||||
return experimentHelper.getSettingValue(settingName, experimentSettings);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -135,6 +135,15 @@ function setupMocks({ experimentSettings }) {
|
|||
|
||||
store.getters = {
|
||||
experimentSettings: experimentSettings ?? testExperimentSettings,
|
||||
applicationUser: {
|
||||
experiments: [
|
||||
{
|
||||
isActive: true,
|
||||
isExposed: true,
|
||||
settings: experimentSettings ?? testExperimentSettings,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const mockComponent = {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
import { createWebHistory, createRouter } from "vue-router";
|
||||
import { storeActions } from "@/constants/store-actions";
|
||||
import { storeMutations } from "../constants/store-mutations";
|
||||
import { sessionStorageKeyConstants } from "@/constants/session-storage.js";
|
||||
import { lazyLoadComponent } from "@/router/dynamic-routing/component-loader.js";
|
||||
import { routingTable } from "@/router/router-constants/routing-table.js";
|
||||
import { globalEvents, globalEventTypes } from "@/constants/events";
|
||||
|
|
@ -98,10 +99,15 @@ const routes = [
|
|||
log(" --to.query.fmgPage ", to.query?.fmgPage);
|
||||
|
||||
// Intercept all navigation if a submitted order exists in storage
|
||||
if (window.sessionStorage.getItem("submittedOrder") !== null) {
|
||||
if (
|
||||
window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE) !==
|
||||
null
|
||||
) {
|
||||
if (to.query.fmgPage !== funnelStartPageName) {
|
||||
to.query.fmgPage = fmgPageValues.CONFIRMATION;
|
||||
log(" --has submittedOrder go to confirmation");
|
||||
log(
|
||||
` --has ${sessionStorageKeyConstants.SUBMITTED_STATE} go to confirmation`
|
||||
);
|
||||
}
|
||||
}
|
||||
// On entering the funnel "fresh", read cookie information, decide what to do next.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { createStore } from "vuex";
|
||||
import { endpoints } from "@/constants/endpoints.js";
|
||||
import { storeMutations } from "@/constants/store-mutations";
|
||||
import { sessionStorageKeyConstants } from "@/constants/session-storage.js";
|
||||
import { getDateForSavedSessionTimeout } from "@/helpers/heritage-integration/session-helper";
|
||||
import createPersistedState from "vuex-persistedstate";
|
||||
import globalMethods from "@/global-methods";
|
||||
|
|
@ -20,6 +21,10 @@ import {
|
|||
} from "@/constants/schedule-constants";
|
||||
import { getQuerystringParameter } from "@/helpers/querystring-helper";
|
||||
import { deepClone } from "@/helpers/object-helper";
|
||||
import {
|
||||
getExperimentSettingsFromExperimentList,
|
||||
hasSettingEqualTo,
|
||||
} from "../helpers/experiment-helper";
|
||||
import { queryStrings } from "@/constants/query-strings";
|
||||
import { partTypeStrings } from "@/constants/part-type-strings";
|
||||
import {
|
||||
|
|
@ -822,8 +827,10 @@ export const getters = {
|
|||
},
|
||||
coverageIsVerified: (state) => {
|
||||
let order;
|
||||
if (window.sessionStorage.getItem("submittedOrder") !== null) {
|
||||
order = JSON.parse(window.sessionStorage.getItem("submittedOrder"));
|
||||
if (window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE) !== null) {
|
||||
order = JSON.parse(
|
||||
window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE)
|
||||
).order;
|
||||
} else {
|
||||
order = state.order;
|
||||
}
|
||||
|
|
@ -850,31 +857,34 @@ export const getters = {
|
|||
isRecalibrationOnOrder: (state) => {
|
||||
return getHasRecalibrationPart(state);
|
||||
},
|
||||
isRecalibrationOnSubmittedOrder: (state) => {
|
||||
if (window.sessionStorage.getItem("submittedOrder") !== null) {
|
||||
isRecalibrationOnSubmittedState: (state) => {
|
||||
if (window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE) !== null) {
|
||||
return getHasRecalibrationPart({
|
||||
order: JSON.parse(window.sessionStorage.getItem("submittedOrder")),
|
||||
order: JSON.parse(
|
||||
window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE)
|
||||
).order,
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
shouldHideRecalibration: (state) => {
|
||||
var order;
|
||||
if (window.sessionStorage.getItem("submittedOrder") !== null) {
|
||||
order = JSON.parse(window.sessionStorage.getItem("submittedOrder"));
|
||||
} else {
|
||||
order = state.order;
|
||||
if (window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE) !== null) {
|
||||
state = JSON.parse(
|
||||
window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE)
|
||||
);
|
||||
}
|
||||
|
||||
let order = state.order;
|
||||
let applicationUser = state.applicationUser;
|
||||
if (order.payment.isInsurance) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (
|
||||
experimentMixin.methods
|
||||
.getSettingValue(experimentSettings.RECAL_PRICE_REMOVE)
|
||||
?.toLowerCase() === "true" && getters.isRecalibrationOnOrder(state)
|
||||
hasSettingEqualTo(
|
||||
experimentSettings.RECAL_PRICE_REMOVE,
|
||||
"true",
|
||||
getExperimentSettingsFromExperimentList(applicationUser.experiments)
|
||||
) && getters.isRecalibrationOnOrder(state)
|
||||
);
|
||||
},
|
||||
areRearWipersOnOrder: (state) => {
|
||||
|
|
@ -974,10 +984,7 @@ export const getters = {
|
|||
};
|
||||
},
|
||||
experimentSettings: (state) =>
|
||||
state.applicationUser.experiments
|
||||
.filter((x) => !!x.isActive)
|
||||
.map((x) => x.settings)
|
||||
.reduce((r, c) => Object.assign(r, c), {}) ?? {},
|
||||
getExperimentSettingsFromExperimentList(state.applicationUser.experiments),
|
||||
|
||||
isVerifiedAndDeductibleZeroConfirmed: (state) => {
|
||||
// used in CMS on /payment-method in Header Sub Text, for FunnelSubHeaderWidget on cart pages
|
||||
|
|
@ -1892,96 +1899,48 @@ export const actions = {
|
|||
pageNameToLog: pageNameToLog,
|
||||
});
|
||||
},
|
||||
submitDonationPartToSV2(
|
||||
async submitDonationPartToSV2(
|
||||
context,
|
||||
{ payload: { donationAmount, submittedOrder }, pageNameToLog }
|
||||
) {
|
||||
donationAmount = parseInt(donationAmount);
|
||||
/* Request contract
|
||||
{
|
||||
"donationAmount": 5,
|
||||
"savedSessionId": "96b1a16e-410a-4d08-8421-fe36e82b2275",
|
||||
"paymentInfo": {
|
||||
"parentAccountNumber": 167132,
|
||||
"billToAccountNumber": 87291,
|
||||
"providerNumber": "005819",
|
||||
"carId": "CR00069266",
|
||||
"make": "Acura",
|
||||
"model": "MDX",
|
||||
"year": 2020,
|
||||
"eon": "S1820397",
|
||||
"zipCode": "43015",
|
||||
"state": "OH",
|
||||
"referralNumber": "1821895",
|
||||
"referralDate": "2025-03-20T16:27:38.93",
|
||||
"referralSequenceNumber": "1821895",
|
||||
"serviceZipCode": "43015",
|
||||
"isReplacement": true,
|
||||
"deduct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n9Q82G4v5brtQdiMDMY3HS6mxPb1IiKiqFX6Jgju8sIMxkJFZQ3iIkAJuOqUYkG1ZW7s4uI6hT46bRqzYaQA18CFu56qaMblOBFuxlJIsYsnMePh2xAH89oay5Kc88xwT2T/4+dzYQ0CqhQ4MTBB7nXelav2rMCjaLQ/V/a5r1TnLr2n0GbvODQeNl97qzi5lDYKlnuF8nOfOqZNOsPSsrsk3UZJJYZwNxDZaweHIeeg5P2ZW5agswPx/U5DkU1MzE1VAQ+DQAenaE2SLo4dSPBHMmt2gLpgu0LaCuzTR2IL/EM+Tpdn/Pcv1E7lPJIycIIwO7QGJcVkwCx8CJ/WCo6xDMq+9zjSVbqAaL5MzySZCeFCMyZxvEk7qXig6rflB3K3Jay4qSFjBxBXhOEuT6zKXyhR41IXRtZRmtPkscypFEUXvR5nJV7AQUIbljGEcikOLmSiCEnl8dI2Ny9xCHLOro8UXqVUy8dHGmTRGTE/mS1JNZ3y4XaZSyHcABVWbZcR3KIXVxd6rtUA/pBvWpbq8nH3WWlJGqkoxUVEridtXqcBuzTKg3/i6vLs0/pHGwdM38XizKcIxykvJrur3vEQ=="
|
||||
}
|
||||
}
|
||||
*/
|
||||
const state = JSON.parse(
|
||||
window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE)
|
||||
);
|
||||
const order = state.order;
|
||||
const payload = {
|
||||
donationAmount: parseInt(donationAmount),
|
||||
savedSessionId: state.applicationUser.savedSessionId,
|
||||
paymentInfo: {
|
||||
parentAccountNumber: order.payment.parentAccountNumber,
|
||||
billToAccountNumber: order.payment.billToAccountNumber,
|
||||
providerNumber: order.serviceLocation.provider.providerNumber,
|
||||
carId: order.vehicle.carId,
|
||||
make: order.vehicle.make,
|
||||
model: order.vehicle.model,
|
||||
year: order.vehicle.year,
|
||||
eon: order.eon,
|
||||
zipCode: order.serviceLocation.zipCode,
|
||||
state: order.serviceLocation.state,
|
||||
referralNumber: order.referralNumber,
|
||||
referralDate: order.referralDate,
|
||||
referralSequenceNumber: order.referralSequenceNumber,
|
||||
serviceZipCode: order.serviceLocation.zipCode,
|
||||
isReplacement: !order.damage.isRepair,
|
||||
deductible: order.policy.currentDeductible,
|
||||
coverageStatus: order.payment.insuranceCoverage.coverageStatus,
|
||||
coverageSubStatus: order.payment.insuranceCoverage.coverageSubStatus,
|
||||
serverData: order.lineItems.serverData,
|
||||
},
|
||||
};
|
||||
|
||||
/* Uncomment and use when endpoint integration is finalized
|
||||
return globalMethods.callHttpClient({
|
||||
const response = await globalMethods.callHttpClient({
|
||||
method: endpoints.AddDonationPart.method,
|
||||
endpoint: endpoints.AddDonationPart.url,
|
||||
payload: {
|
||||
donationAmount: donationAmount,
|
||||
savedSessionId: "96b1a16e-410a-4d08-8421-fe36e82b2275",
|
||||
paymentInfo: {
|
||||
parentAccountNumber: submittedSessionData.parentAccountNumber,
|
||||
billToAccountNumber: submittedSessionData.billToAccountNumber,
|
||||
providerNumber: submittedSessionData.providerNumber,
|
||||
carId: "CR00069266",
|
||||
make: "Acura",
|
||||
model: "MDX",
|
||||
year: 2020,
|
||||
eon: "S1820397",
|
||||
zipCode: "43015",
|
||||
state: "OH",
|
||||
referralNumber: "1821895",
|
||||
referralDate: "2025-03-20T16:27:38.93",
|
||||
referralSequenceNumber: "1821895",
|
||||
serviceZipCode: "43015",
|
||||
isReplacement: true,
|
||||
deductible: 0,
|
||||
coverageStatus: null,
|
||||
coverageSubStatus: null,
|
||||
serverData: "ZtCNOF1tCLQBAx2NRKHE/n/fqD8zUxRfYtDuTu7uUiPpeg7i6TmwXwggssX5KsXVQbeft+PN+vXYfBFJytLVYgbafNDR0JH3izVTIOh7KGTeB6YaPuCJmodF4SfgVVDHD9LEmEH9wNzM9j3pFjgfXehOFH11SH9dNwTkXIbsGzAeu64DRyJsDdpamM/BPOxlJj60S/R8vnUM8mjyM7B9a63NskFI6BCVIh5mxDE4cSMUgb4zFtwvDgTPxJSwXqKShtoY6ryB8n5UPNkG/Z5tjVuJ7/8RV7WrURM7PN7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Co6xDMq+9zjSVbqAaL5MzySZCeFCMyZxvEk7qXig6rflB3K3Jay4qSFjBxBXhOEuT6zKXyhR41IXRtZRmtPkscypFEUXvR5nJV7AQUIbljGEcikOLmSiCEnl8dI2Ny9xCHLOro8UXqVUy8dHGmTRGTE/mS1JNZ3y4XaZSyHcABVWbZcR3KIXVxd6rtUA/pBvWpbq8nH3WWlJGqkoxUVEridtXqcBuzTKg3/i6vLs0/pHGwdM38XizKcIxykvJrur3vEQ=="
|
||||
}
|
||||
},
|
||||
payload: payload,
|
||||
logApiCall: true,
|
||||
pageNameToLog: pageNameToLog,
|
||||
});
|
||||
*/
|
||||
|
||||
/* Response contract
|
||||
{
|
||||
"wasSuccessful": true,
|
||||
"wasLocked": true
|
||||
}
|
||||
*/
|
||||
let result;
|
||||
|
||||
switch (donationAmount) {
|
||||
case 1:
|
||||
result = { wasSuccessful: true, wasLocked: false };
|
||||
break;
|
||||
case 3:
|
||||
result = { wasSuccessful: false, wasLocked: true };
|
||||
break;
|
||||
case 5:
|
||||
result = { wasSuccessful: false, wasLocked: false };
|
||||
break;
|
||||
default:
|
||||
result = { wasSuccessful: null, wasLocked: null }; // Default case if amount doesn't match
|
||||
}
|
||||
|
||||
return result;
|
||||
return response.data;
|
||||
},
|
||||
|
||||
getPartFromCapabilityQuestionAnswer(context, { payload, pageNameToLog }) {
|
||||
|
|
@ -3257,19 +3216,25 @@ export const actions = {
|
|||
return false;
|
||||
},
|
||||
|
||||
createSubmittedOrder(context) {
|
||||
if (window.sessionStorage.getItem("submittedOrder") !== null) {
|
||||
createSubmittedState(context) {
|
||||
if (window.sessionStorage.getItem(sessionStorageKeyConstants.SUBMITTED_STATE) !== null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// create a submitted order object from vuex.
|
||||
const submittedOrder = context.state.order;
|
||||
const submittedState = {
|
||||
order: context.state.order,
|
||||
applicationUser: context.state.applicationUser,
|
||||
};
|
||||
|
||||
const experiments = context.state.applicationUser.experiments;
|
||||
const affiliateCookies = context.state.applicationUser.affiliateCookies;
|
||||
|
||||
// set to local storage
|
||||
window.sessionStorage.setItem("submittedOrder", JSON.stringify(submittedOrder));
|
||||
window.sessionStorage.setItem(
|
||||
sessionStorageKeyConstants.SUBMITTED_STATE,
|
||||
JSON.stringify(submittedState)
|
||||
);
|
||||
window.sessionStorage.setItem("createNewSessionForHeritage", true);
|
||||
|
||||
// clear vuex
|
||||
|
|
@ -3288,45 +3253,38 @@ export const actions = {
|
|||
context.commit(storeMutations.UPDATE_AFFILIATE_COOKIES, affiliateCookies);
|
||||
},
|
||||
|
||||
addDonationToSubmittedOrder(context, donationAmount) {
|
||||
console.log("running addDonationToSubmittedOrder()... donationAmount: ", donationAmount);
|
||||
|
||||
addDonationToSubmittedState(context, donationAmount) {
|
||||
const submittedOrder = deepClone(baseMixin.methods.getSubmittedOrder());
|
||||
const submittedApplicationUser = deepClone(baseMixin.methods.getSubmittedApplicationUser());
|
||||
|
||||
if (donationAmount > 0) {
|
||||
console.log(
|
||||
"running addDonationToSubmittedOrder()... adding donation to supportingItems in session storage "
|
||||
);
|
||||
submittedOrder.lineItems.supportingItems.push({
|
||||
partNumber: `DONATION_${donationAmount}`,
|
||||
description: `DONATION $${donationAmount}`,
|
||||
partType: partTypeStrings.DONATION,
|
||||
isInsurable: false,
|
||||
isChildPart: false,
|
||||
laborAmount: 0,
|
||||
sellingPrice: donationAmount,
|
||||
kitPrice: 0,
|
||||
salesTax: 0,
|
||||
id: `donation-${donationAmount}`,
|
||||
});
|
||||
} else {
|
||||
// filter out all donations
|
||||
console.log(
|
||||
"running addDonationToSubmittedOrder()... removing all donation items in supportingItems in session storage "
|
||||
);
|
||||
submittedOrder.lineItems.supportingItems.push({
|
||||
partNumber: `DONATION_${donationAmount}`,
|
||||
description: `DONATION $${donationAmount}`,
|
||||
partType: partTypeStrings.DONATION,
|
||||
isInsurable: false,
|
||||
isChildPart: false,
|
||||
laborAmount: 0,
|
||||
sellingPrice: donationAmount,
|
||||
kitPrice: 0,
|
||||
salesTax: 0,
|
||||
});
|
||||
|
||||
const nonDonationItems = submittedOrder.lineItems.supportingItems.filter((item) => {
|
||||
return item.partType !== "DONATION";
|
||||
});
|
||||
submittedOrder.lineItems.supportingItems = nonDonationItems;
|
||||
}
|
||||
addGuidToLineItemsIfNotAlreadyThere(submittedOrder.lineItems.supportingItems);
|
||||
|
||||
const submittedState = {
|
||||
order: submittedOrder,
|
||||
applicationUser: submittedApplicationUser,
|
||||
};
|
||||
// set to local storage
|
||||
window.sessionStorage.setItem("submittedOrder", JSON.stringify(submittedOrder));
|
||||
window.sessionStorage.setItem(
|
||||
sessionStorageKeyConstants.SUBMITTED_STATE,
|
||||
JSON.stringify(submittedState)
|
||||
);
|
||||
},
|
||||
|
||||
resetSubmittedOrder(context) {
|
||||
resetSubmittedState(context) {
|
||||
// clear from local storage
|
||||
window.sessionStorage.removeItem("submittedOrder");
|
||||
window.sessionStorage.removeItem(sessionStorageKeyConstants.SUBMITTED_STATE);
|
||||
},
|
||||
resetExternalParameterState(context) {
|
||||
if (context.getters.isExternalParameter) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue