CASH-2844 more non C&C cleanup

CASH-2844 more non C&C cleanup.  load session to handle any part changes(fees) changed by safelite api.
dynamic damage types form managed vs unmanaged accounts
This commit is contained in:
Carl Nation 2026-06-24 10:31:30 -04:00
parent 450eb1cc6c
commit c21ff3c249
8 changed files with 115 additions and 16 deletions

View file

@ -208,6 +208,10 @@ const endpoints = {
url: "/account/api/v1/account/bill-to-account-number", url: "/account/api/v1/account/bill-to-account-number",
method: "GET", method: "GET",
}, },
GetAccountDetails: {
url: "/account/api/v1/account/account-details",
method: "GET",
},
ClosestApplicableShops: { ClosestApplicableShops: {
url: "/location/api/v1/location/closest-applicable-shops", url: "/location/api/v1/location/closest-applicable-shops",
method: "GET", method: "GET",

View file

@ -55,6 +55,7 @@ const storeActions = {
REVALIDATE_ORDER_PROMOS_AND_SAVE_SERVER_DATA: "revalidateOrderPromosAndSaveServerData", REVALIDATE_ORDER_PROMOS_AND_SAVE_SERVER_DATA: "revalidateOrderPromosAndSaveServerData",
GET_INSURANCE_COMPANY_LIST: "getInsuranceCompanyList", GET_INSURANCE_COMPANY_LIST: "getInsuranceCompanyList",
GET_BILL_TO_ACCOUNT_NUMBER: "getBillToAccountNumber", GET_BILL_TO_ACCOUNT_NUMBER: "getBillToAccountNumber",
GET_ACCOUNT_DETAILS: "getAccountDetails",
GET_RECAL_PARTS_AND_SAVE_TO_LINE_ITEMS: "getRecalPartsAndSaveToLineItems", GET_RECAL_PARTS_AND_SAVE_TO_LINE_ITEMS: "getRecalPartsAndSaveToLineItems",
GET_CLOSEST_APPLICABLE_SHOPS: "getClosestApplicableShops", GET_CLOSEST_APPLICABLE_SHOPS: "getClosestApplicableShops",
@ -100,8 +101,7 @@ const storeActions = {
SAVE_PAYMENT_METHOD_CHOICE: "savePaymentMethodChoice", SAVE_PAYMENT_METHOD_CHOICE: "savePaymentMethodChoice",
SAVE_PARENT_ACCOUNT_NUMBER: "saveParentAccountNumber", SAVE_PARENT_ACCOUNT_NUMBER: "saveParentAccountNumber",
SAVE_ACCOUNT_NAME: "saveAccountName", SAVE_ACCOUNT_NAME: "saveAccountName",
SAVE_IS_CLAIM_AND_COVERAGE: "saveIsClaimAndCoverage", SAVE_INSURANCE_ACCOUNT_DETAILS: "saveInsuranceAccountDetails",
SAVE_CAN_SCHEDULE_ONLINE: "saveCanScheduleOnline",
SAVE_BILL_TO_ACCOUNT_NUMBER: "saveBillToAccountNumber", SAVE_BILL_TO_ACCOUNT_NUMBER: "saveBillToAccountNumber",
SAVE_SUPPORTING_ITEMS: "saveSupportingItems", SAVE_SUPPORTING_ITEMS: "saveSupportingItems",
SAVE_SUPPORTING_ITEMS_SUPPRESSING_STATE_RESETTING: SAVE_SUPPORTING_ITEMS_SUPPRESSING_STATE_RESETTING:
@ -120,6 +120,7 @@ const storeActions = {
SAVE_IS_OEM_GLASS_SELECTED: "saveIsOemGlassSelected", SAVE_IS_OEM_GLASS_SELECTED: "saveIsOemGlassSelected",
SAVE_IS_MSR_FEE_APPLICABLE: "saveIsMSRFeeApplicable", SAVE_IS_MSR_FEE_APPLICABLE: "saveIsMSRFeeApplicable",
SAVE_IS_MSR_FEE_COVERED_BY_INSURANCE: "saveIsMSRFeeCoveredByInsurance", SAVE_IS_MSR_FEE_COVERED_BY_INSURANCE: "saveIsMSRFeeCoveredByInsurance",
SAVE_IS_NEW_INSURANCE_FLOW: "saveIsNewInsuranceFlow",
CREATE_SUBMITTED_STATE: "createSubmittedState", CREATE_SUBMITTED_STATE: "createSubmittedState",
RESET_SUBMITTED_STATE: "resetSubmittedState", RESET_SUBMITTED_STATE: "resetSubmittedState",

View file

@ -65,6 +65,7 @@ const storeMutations = {
UPDATE_ACCOUNT_NAME: "updateAccountName", UPDATE_ACCOUNT_NAME: "updateAccountName",
UPDATE_IS_CLAIM_AND_COVERAGE: "updateIsClaimAndCoverage", UPDATE_IS_CLAIM_AND_COVERAGE: "updateIsClaimAndCoverage",
UPDATE_CAN_SCHEDULE_ONLINE: "updateCanScheduleOnline", UPDATE_CAN_SCHEDULE_ONLINE: "updateCanScheduleOnline",
UPDATE_IS_MANAGED_ACCOUNT: "updateIsManagedAccount",
UPDATE_BILL_TO_ACCT_NUMBER: "updateBillToAcctNumber", UPDATE_BILL_TO_ACCT_NUMBER: "updateBillToAcctNumber",
UPDATE_EON: "updateEON", UPDATE_EON: "updateEON",
UPDATE_IS_INSURANCE: "updateIsInsurance", UPDATE_IS_INSURANCE: "updateIsInsurance",
@ -83,6 +84,7 @@ const storeMutations = {
UPDATE_IS_OEM_GLASS_SELECTED: "updateIsOemGlassSelected", UPDATE_IS_OEM_GLASS_SELECTED: "updateIsOemGlassSelected",
UPDATE_IS_MSR_FEE_APPLICABLE: "updateIsMSRFeeApplicable", UPDATE_IS_MSR_FEE_APPLICABLE: "updateIsMSRFeeApplicable",
UPDATE_IS_MSR_FEE_COVERED_BY_INSURANCE: "updateIsMSRFeeCoveredByInsurance", UPDATE_IS_MSR_FEE_COVERED_BY_INSURANCE: "updateIsMSRFeeCoveredByInsurance",
UPDATE_IS_NEW_INSURANCE_FLOW: "updateIsNewInsuranceFlow",
UPDATE_CASH_PRICE_SUBTOTAL: "updateCashPriceSubTotal", UPDATE_CASH_PRICE_SUBTOTAL: "updateCashPriceSubTotal",
// EVENT BUS MUTATIONS // EVENT BUS MUTATIONS

View file

@ -87,6 +87,7 @@ import modal from "@/digital-components/modal/modal";
import contentGroupModal from "@/fmg-components/content-group-modal/content-group-modal.vue"; import contentGroupModal from "@/fmg-components/content-group-modal/content-group-modal.vue";
import textBlock from "@/digital-components/text-block/text-block.vue"; import textBlock from "@/digital-components/text-block/text-block.vue";
import { debugLog } from "@/helpers/debug-log-helper"; import { debugLog } from "@/helpers/debug-log-helper";
import { loadSessionIfPresent } from "@/helpers/heritage-integration/order-helper";
export default { export default {
name: "coverage-statement", name: "coverage-statement",
mixins: [], mixins: [],
@ -186,6 +187,13 @@ export default {
); );
}, },
async forwardButtonAction() { async forwardButtonAction() {
// The safelite api will often remove fees when switching cash to insurance. Heritage does the same.
// The heritage flow triggers a load session when returning to pick up new parts to make sure we're in-sync.
// The new insurance flow needs to trigger a load session to pick up these same type of part changes.
if (store.getters.order.isNewInsuranceFlow) {
await loadSessionIfPresent(false, this.pageName);
}
this.$router.navigateWithSaving( this.$router.navigateWithSaving(
this.navigationScenarios.CLICKED_FORWARD, this.navigationScenarios.CLICKED_FORWARD,
this.pageName this.pageName

View file

@ -122,6 +122,7 @@ export default {
accountName: this.accountNameFromStore(), accountName: this.accountNameFromStore(),
isClaimAndCoverage: this.isClaimAndCoverageFromStore(), isClaimAndCoverage: this.isClaimAndCoverageFromStore(),
canScheduleOnline: this.canScheduleOnlineFromStore(), canScheduleOnline: this.canScheduleOnlineFromStore(),
isManagedAccount: this.isManagedAccountFromStore(),
}, },
originalList: [], originalList: [],
}; };
@ -156,6 +157,9 @@ export default {
canScheduleOnlineFromStore() { canScheduleOnlineFromStore() {
return store.getters.order?.payment?.canScheduleOnline; return store.getters.order?.payment?.canScheduleOnline;
}, },
isManagedAccountFromStore() {
return store.getters.order?.payment?.isManagedAccount;
},
arePagePrerequisitesValid() { arePagePrerequisitesValid() {
return store.getters.order.payment.isInsurance === true; return store.getters.order.payment.isInsurance === true;
}, },
@ -192,15 +196,24 @@ export default {
false false
); );
await this.dispatchStoreAction( // Fetch the latest account details for the selected parent account so that
this.storeActions.SAVE_IS_CLAIM_AND_COVERAGE, // routing and the saved values below reflect the current source of truth.
this.selectedAccount.isClaimAndCoverage, const accountDetails = await baseMixin.methods.dispatchStoreActionWithLogging(
storeActions.GET_ACCOUNT_DETAILS,
{ parentAccountNumber: this.selectedAccount.parentAccountNumber },
"insurance-company",
false false
); );
this.selectedAccount.isManagedAccount = accountDetails.isManagedAccount;
await this.dispatchStoreAction( await this.dispatchStoreAction(
this.storeActions.SAVE_CAN_SCHEDULE_ONLINE, this.storeActions.SAVE_INSURANCE_ACCOUNT_DETAILS,
this.selectedAccount.canScheduleOnline, {
isClaimAndCoverage: this.selectedAccount.isClaimAndCoverage,
canScheduleOnline: this.selectedAccount.canScheduleOnline,
isManagedAccount: this.selectedAccount.isManagedAccount,
},
false false
); );
@ -236,6 +249,11 @@ export default {
debugLog( debugLog(
`--- ${this.selectedAccount.parentAccountNumber} C&C experiment active for this parent account number, sending to vue app Policy Info page ---` `--- ${this.selectedAccount.parentAccountNumber} C&C experiment active for this parent account number, sending to vue app Policy Info page ---`
); );
baseMixin.methods.dispatchStoreAction(
storeActions.SAVE_IS_NEW_INSURANCE_FLOW,
true,
false
);
this.$router.navigateWithSaving( this.$router.navigateWithSaving(
this.navigationScenarios.CLICKED_FORWARD_POLICY_INFO, this.navigationScenarios.CLICKED_FORWARD_POLICY_INFO,
this.pageName this.pageName
@ -248,6 +266,11 @@ export default {
debugLog( debugLog(
`--- ${this.selectedAccount.parentAccountNumber} C&C experiment setting is false, but is a C&C client, sending to heritage ---` `--- ${this.selectedAccount.parentAccountNumber} C&C experiment setting is false, but is a C&C client, sending to heritage ---`
); );
baseMixin.methods.dispatchStoreAction(
storeActions.SAVE_IS_NEW_INSURANCE_FLOW,
false,
false
);
navigateToHeritageFunnel({ navigateToHeritageFunnel({
shouldSaveSession: true, shouldSaveSession: true,
pageNameToLog: this.pageName, pageNameToLog: this.pageName,
@ -265,6 +288,11 @@ export default {
debugLog( debugLog(
`--- ${this.selectedAccount.parentAccountNumber} Non integrated experiment setting is true, sending to vue app Insurance Details page ---` `--- ${this.selectedAccount.parentAccountNumber} Non integrated experiment setting is true, sending to vue app Insurance Details page ---`
); );
baseMixin.methods.dispatchStoreAction(
storeActions.SAVE_IS_NEW_INSURANCE_FLOW,
true,
false
);
this.$router.navigateWithSaving( this.$router.navigateWithSaving(
this.navigationScenarios.CLICKED_FORWARD_NON_CLAIM_AND_COVERAGE, this.navigationScenarios.CLICKED_FORWARD_NON_CLAIM_AND_COVERAGE,
this.pageName this.pageName
@ -290,6 +318,11 @@ export default {
debugLog( debugLog(
`--- ${this.selectedAccount.parentAccountNumber} Non integrated experiment setting is false, but a parent account is NON_CLAIM_AND_COVERAGE_TEST_PARENT_ACCOUNT experiment contains a specific parent account number, sending to vue app Insurance Details page ---` `--- ${this.selectedAccount.parentAccountNumber} Non integrated experiment setting is false, but a parent account is NON_CLAIM_AND_COVERAGE_TEST_PARENT_ACCOUNT experiment contains a specific parent account number, sending to vue app Insurance Details page ---`
); );
baseMixin.methods.dispatchStoreAction(
storeActions.SAVE_IS_NEW_INSURANCE_FLOW,
true,
false
);
this.$router.navigateWithSaving( this.$router.navigateWithSaving(
this.navigationScenarios.CLICKED_FORWARD_NON_CLAIM_AND_COVERAGE, this.navigationScenarios.CLICKED_FORWARD_NON_CLAIM_AND_COVERAGE,
this.pageName this.pageName
@ -297,6 +330,11 @@ export default {
return; return;
} }
baseMixin.methods.dispatchStoreAction(
storeActions.SAVE_IS_NEW_INSURANCE_FLOW,
false,
false
);
navigateToHeritageFunnel({ navigateToHeritageFunnel({
shouldSaveSession: true, shouldSaveSession: true,
pageNameToLog: "insurance-company", pageNameToLog: "insurance-company",

View file

@ -57,7 +57,7 @@
:questionText="damageTypesQuestionText" :questionText="damageTypesQuestionText"
class="mb-4" class="mb-4"
v-model="damageCause" v-model="damageCause"
cmsWidgetName="DamageTypesWidget" :cmsWidgetName="damageTypesWidgetName"
customDropdownId="damageTypes" customDropdownId="damageTypes"
:options="damageTypesOptions" :options="damageTypesOptions"
:valueAsKey="true" :valueAsKey="true"
@ -183,6 +183,7 @@ export default {
policyZip: this.getPolicyZipFromStore(), policyZip: this.getPolicyZipFromStore(),
claimNumber: this.getClaimNumberFromStore(), claimNumber: this.getClaimNumberFromStore(),
showSaveProgressModal: null, showSaveProgressModal: null,
isManagedAccount: this.getIsManagedAccountFromStore(),
}; };
}, },
components: { components: {
@ -249,13 +250,22 @@ export default {
stateOptions() { stateOptions() {
return stateOptionsInternational; return stateOptionsInternational;
}, },
damageTypesWidgetName() {
return this.isManagedAccount ? "DamageTypesWidget" : "UnmanagedDamageTypesWidget";
},
damageCauseQuestionText() { damageCauseQuestionText() {
return this.getCmsContent("DamageTypesWidget", "QuestionText"); if (this.isManagedAccount) {
return this.getCmsContent("DamageTypesWidget", "QuestionText");
} else {
return this.getCmsContent("UnmanagedDamageTypesWidget", "QuestionText");
}
}, },
damageTypesOptions() { damageTypesOptions() {
const options = {}; const options = {};
const answers = this.getCmsContent("DamageTypesWidget", "Answers"); const answers = this.isManagedAccount
? this.getCmsContent("DamageTypesWidget", "Answers")
: this.getCmsContent("UnmanagedDamageTypesWidget", "Answers");
if (!Array.isArray(answers)) { if (!Array.isArray(answers)) {
return options; return options;
} }
@ -267,6 +277,9 @@ export default {
}, },
}, },
methods: { methods: {
getIsManagedAccountFromStore() {
return store.getters.order?.payment?.isManagedAccount ?? false;
},
getInsuranceCompanyNameFromStore() { getInsuranceCompanyNameFromStore() {
return store.getters.order.policy.insuranceCompanyName; return store.getters.order.policy.insuranceCompanyName;
}, },

View file

@ -777,6 +777,12 @@ export default {
} }
}, },
async forwardButtonAction() { async forwardButtonAction() {
baseMixin.methods.dispatchStoreAction(
storeActions.SAVE_IS_NEW_INSURANCE_FLOW,
false,
false
);
this.dispatchStoreAction( this.dispatchStoreAction(
this.storeActions.SAVE_PAYMENT_TYPE, this.storeActions.SAVE_PAYMENT_TYPE,
this.isInsuranceSelected, this.isInsuranceSelected,
@ -795,12 +801,15 @@ export default {
false false
); );
this.dispatchStoreAction( this.dispatchStoreAction(
this.storeActions.SAVE_IS_CLAIM_AND_COVERAGE, this.storeActions.SAVE_INSURANCE_ACCOUNT_DETAILS,
false, {
isClaimAndCoverage: false,
canScheduleOnline: false,
isManagedAccount: false,
},
false false
); );
this.dispatchStoreAction(this.storeActions.RESET_INSURANCE_DETAILS, false, false); this.dispatchStoreAction(this.storeActions.RESET_INSURANCE_DETAILS, false, false);
this.dispatchStoreAction(this.storeActions.SAVE_CAN_SCHEDULE_ONLINE, false, false);
this.dispatchStoreAction(this.storeActions.SAVE_ACCOUNT_NAME, null, false); this.dispatchStoreAction(this.storeActions.SAVE_ACCOUNT_NAME, null, false);
} else { } else {
baseMixin.methods.dispatchStoreAction( baseMixin.methods.dispatchStoreAction(

View file

@ -154,6 +154,7 @@ const getDefaultState = () => {
accountName: null, accountName: null,
isClaimAndCoverage: false, isClaimAndCoverage: false,
canScheduleOnline: false, canScheduleOnline: false,
isManagedAccount: false,
billToAccountNumber: null, billToAccountNumber: null,
isPia: null, isPia: null,
piaType: null, piaType: null,
@ -213,6 +214,7 @@ const getDefaultState = () => {
isRecalAcknowledgedForScheduling: "", isRecalAcknowledgedForScheduling: "",
isMSRFeeApplicable: false, isMSRFeeApplicable: false,
isMSRFeeCoveredByInsurance: false, isMSRFeeCoveredByInsurance: false,
isNewInsuranceFlow: false,
}, },
applicationUser: { applicationUser: {
eventBus: [], eventBus: [],
@ -386,6 +388,9 @@ export const mutations = {
updateCanScheduleOnline(state, canScheduleOnline) { updateCanScheduleOnline(state, canScheduleOnline) {
state.order.payment.canScheduleOnline = canScheduleOnline; state.order.payment.canScheduleOnline = canScheduleOnline;
}, },
updateIsManagedAccount(state, isManagedAccount) {
state.order.payment.isManagedAccount = isManagedAccount;
},
updateBillToAcctNumber(state, billToAcctNumber) { updateBillToAcctNumber(state, billToAcctNumber) {
state.order.payment.billToAccountNumber = billToAcctNumber; state.order.payment.billToAccountNumber = billToAcctNumber;
}, },
@ -451,6 +456,9 @@ export const mutations = {
updateIsMSRFeeCoveredByInsurance(state, isMSRFeeCoveredByInsurance) { updateIsMSRFeeCoveredByInsurance(state, isMSRFeeCoveredByInsurance) {
state.order.isMSRFeeCoveredByInsurance = isMSRFeeCoveredByInsurance; state.order.isMSRFeeCoveredByInsurance = isMSRFeeCoveredByInsurance;
}, },
updateIsNewInsuranceFlow(state, isNewInsuranceFlow) {
state.order.isNewInsuranceFlow = isNewInsuranceFlow;
},
updateCashPriceSubTotal(state, cashPriceSubTotal) { updateCashPriceSubTotal(state, cashPriceSubTotal) {
state.order.cashPriceSubTotal = state.order.cashPriceSubTotal =
cashPriceSubTotal === "" ? null : cashPriceSubTotal.toString(); cashPriceSubTotal === "" ? null : cashPriceSubTotal.toString();
@ -2709,6 +2717,7 @@ export const actions = {
billToAccountNumber: order.payment.billToAccountNumber, billToAccountNumber: order.payment.billToAccountNumber,
isClaimAndCoverage: order.payment.isClaimAndCoverage, isClaimAndCoverage: order.payment.isClaimAndCoverage,
canScheduleOnline: order.payment.canScheduleOnline, canScheduleOnline: order.payment.canScheduleOnline,
isManagedAccount: order.payment.isManagedAccount,
inactivePromos: order.payment.inactivePromos, inactivePromos: order.payment.inactivePromos,
isCreditCard: isCreditCard:
order.payment.piaType == paymentMethods.CREDIT_CARD ? true : false, order.payment.piaType == paymentMethods.CREDIT_CARD ? true : false,
@ -3225,17 +3234,23 @@ export const actions = {
); );
}, },
saveIsNewInsuranceFlow(context, isNewInsuranceFlow) {
context.commit(storeMutations.UPDATE_IS_NEW_INSURANCE_FLOW, isNewInsuranceFlow);
},
saveParentAccountNumber(context, parentAccountNumber) { saveParentAccountNumber(context, parentAccountNumber) {
context.commit(storeMutations.UPDATE_PARENT_ACCT_NUMBER, parentAccountNumber); context.commit(storeMutations.UPDATE_PARENT_ACCT_NUMBER, parentAccountNumber);
}, },
saveAccountName(context, accountName) { saveAccountName(context, accountName) {
context.commit(storeMutations.UPDATE_ACCOUNT_NAME, accountName); context.commit(storeMutations.UPDATE_ACCOUNT_NAME, accountName);
}, },
saveIsClaimAndCoverage(context, isClaimAndCoverage) { saveInsuranceAccountDetails(
context,
{ isClaimAndCoverage, canScheduleOnline, isManagedAccount }
) {
context.commit(storeMutations.UPDATE_IS_CLAIM_AND_COVERAGE, isClaimAndCoverage); context.commit(storeMutations.UPDATE_IS_CLAIM_AND_COVERAGE, isClaimAndCoverage);
},
saveCanScheduleOnline(context, canScheduleOnline) {
context.commit(storeMutations.UPDATE_CAN_SCHEDULE_ONLINE, canScheduleOnline); context.commit(storeMutations.UPDATE_CAN_SCHEDULE_ONLINE, canScheduleOnline);
context.commit(storeMutations.UPDATE_IS_MANAGED_ACCOUNT, isManagedAccount);
}, },
saveBillToAccountNumber(context, billToAccountNumber) { saveBillToAccountNumber(context, billToAccountNumber) {
context.commit(storeMutations.UPDATE_BILL_TO_ACCT_NUMBER, billToAccountNumber); context.commit(storeMutations.UPDATE_BILL_TO_ACCT_NUMBER, billToAccountNumber);
@ -3626,6 +3641,15 @@ export const actions = {
return billToAccountNumberResponse.data.toString(); return billToAccountNumberResponse.data.toString();
}, },
// Get Account Details
async getAccountDetails(context, { payload: { parentAccountNumber }, pageNameToLog }) {
const accountDetailsResponse = await globalMethods.callHttpClient({
method: endpoints.GetAccountDetails.method,
endpoint: `${endpoints.GetAccountDetails.url}/${parentAccountNumber}`,
});
return accountDetailsResponse.data;
},
////////////////////////////////// //////////////////////////////////
// END OF Account Service Calls // // END OF Account Service Calls //
////////////////////////////////// //////////////////////////////////