PR updates and scenario 3,4 updates
Clear Cookie on Work order submit Goto bailout on previously selected bailout
This commit is contained in:
parent
c15845e380
commit
943a17f8df
7 changed files with 53 additions and 37 deletions
|
|
@ -10,7 +10,8 @@ const bailoutCode = Object.freeze({
|
|||
RequestCallback: 8,
|
||||
HeavyTruckVehicle: 9,
|
||||
NoPartsAvailable: 10,
|
||||
PartsServiceError: 11
|
||||
PartsServiceError: 11,
|
||||
SafeliteNotTheProvider: 12
|
||||
});
|
||||
|
||||
export default bailoutCode;
|
||||
|
|
|
|||
|
|
@ -60,6 +60,10 @@ const bailoutMessage = Object.freeze({
|
|||
PartsServiceError: (error) => ({
|
||||
code: bailoutCode.PartsServiceError,
|
||||
message: `An error occurred in getPartsOrQuestions. Error: ${getItemData(error)}`
|
||||
}),
|
||||
SafeliteNotTheProvider: () => ({
|
||||
code: bailoutCode.SafeliteNotTheProvider,
|
||||
message: 'User selected to continue a referral where a TPA shop was previously selected.'
|
||||
})
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -42,10 +42,7 @@ export default {
|
|||
computed: {
|
||||
getMakeModelString() {
|
||||
const cookie = getISSCookie();
|
||||
if (cookie) {
|
||||
return `${cookie.VehicleMake} ${cookie.VehicleModel}`;
|
||||
}
|
||||
return 'CAR NOT SELECTED';
|
||||
return `${cookie.VehicleMake} ${cookie.VehicleModel}`;
|
||||
},
|
||||
modalBodyText() {
|
||||
return this.getCmsContent('ContinueReferralModalWidget', 'BodyText');
|
||||
|
|
|
|||
|
|
@ -45,11 +45,11 @@ export default {
|
|||
try {
|
||||
// Check cookie
|
||||
const issCookie = getISSCookie();
|
||||
if (issCookie !== null) {
|
||||
const clientNumber = clientData.parentAccountNumber;
|
||||
const cookieClient = issCookie.ReferralParentAccountNumber;
|
||||
if (issCookie !== null && issCookie.VehicleMake && issCookie.VehicleModel) {
|
||||
const clientParentAccountNumber = clientData.parentAccountNumber;
|
||||
const cookieParentAccountNumber = issCookie.ReferralParentAccountNumber;
|
||||
|
||||
if (clientNumber === cookieClient) {
|
||||
if (clientParentAccountNumber === cookieParentAccountNumber) {
|
||||
const savedSessionTimeStamp = new Date(issCookie.SavedSessionTimeoutDate);
|
||||
const isSavedSessionTimedOut = new Date(new Date().toUTCString()) > savedSessionTimeStamp;
|
||||
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ import routerParams from '@/router/router-constants/router-params';
|
|||
import MaskaFormattedMasks from '@/constants/maska-masks';
|
||||
import { getPropertyCaseInsensitive } from '@/helpers/object-helper';
|
||||
import { saveSession } from '@/helpers/order-helper';
|
||||
import { getISSCookie, setISSCookieProperties } from '@/helpers/cookie-helper.js';
|
||||
import { getISSCookie } from '@/helpers/cookie-helper.js';
|
||||
import bailoutMessage from '@/constants/bailoutMessage';
|
||||
|
||||
// define validation rules
|
||||
|
|
@ -439,13 +439,29 @@ export default {
|
|||
parentAccountNumber: issCookie.ReferralParentAccountNumber,
|
||||
correlationId: issCookie.ReferralCorrelationId
|
||||
};
|
||||
await this.mainStore.loadSessionFromCookie(cookieReferral)
|
||||
.then((response) => {
|
||||
this.updateWelcomePageModel(response);
|
||||
this.answeredContinueModal = true;
|
||||
});
|
||||
|
||||
this.$refs.continueModal.closeModal();
|
||||
try {
|
||||
await this.mainStore.loadSessionFromCookie(cookieReferral)
|
||||
.then((response) => {
|
||||
this.answeredContinueModal = true;
|
||||
if (response && !response.provider?.isSafeliteProvider) {
|
||||
this.mainStore.setBailout(bailoutMessage.SafeliteNotTheProvider());
|
||||
this.hasBailedOut = true;
|
||||
this.$router.navigate(
|
||||
this.navigationScenarios.CLICKED_FORWARD_WITH_BAILOUT,
|
||||
this.$route
|
||||
);
|
||||
} else {
|
||||
this.updateWelcomePageModel(response);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(`Error on loading session from cookie ${error}`);
|
||||
this.startNewReferral();
|
||||
} finally {
|
||||
this.$refs.continueModal.closeModal();
|
||||
}
|
||||
}
|
||||
},
|
||||
startNewReferral() {
|
||||
|
|
@ -478,8 +494,4 @@ form {
|
|||
}
|
||||
}
|
||||
}
|
||||
.temp-div {
|
||||
text-decoration: underline;
|
||||
color: blue;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -404,6 +404,10 @@ const routingTable = () => [
|
|||
scenario: navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
|
||||
destinationIssPageValue: issPageValues.POLICY_VEHICLES
|
||||
},
|
||||
{
|
||||
scenario: navigationScenarios.CLICKED_FORWARD_WITH_BAILOUT,
|
||||
destinationIssPageValue: issPageValues.BAILOUT_PAGE
|
||||
},
|
||||
{
|
||||
scenario: navigationScenarios.SAVE_SESSION_FAILED,
|
||||
destinationIssPageValue: issPageValues.BAILOUT_PAGE
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import { findLineItemIndex, getLineItemsFlattened } from '@/helpers/line-items-h
|
|||
import { buildQueryStringParameterFromArrayOfComplexObjects, getLineItemQueryString, getTaxLineItemQueryString } from '@/helpers/querystring-helper';
|
||||
import coverageType from '@/constants/coverage-type';
|
||||
import { getExperimentSettingValue, getFeatureTogglesQueryString } from '@/helpers/experiment-helper';
|
||||
import { getSessionKeyValue, getUserIdValue } from '@/helpers/cookie-helper';
|
||||
import { getSessionKeyValue, getUserIdValue, deleteISSCookie } from '@/helpers/cookie-helper';
|
||||
|
||||
const storeId = 'main';
|
||||
|
||||
|
|
@ -206,6 +206,7 @@ export const getDefaultState = () => ({
|
|||
referralCorrelationId: '00000000-0000-0000-0000-000000000000',
|
||||
referralSequenceNumber: null,
|
||||
eon: null,
|
||||
workOrderId: null,
|
||||
workOrderNumber: null,
|
||||
customerPortalLoginToken: null,
|
||||
originalDeductible: null,
|
||||
|
|
@ -240,7 +241,7 @@ export const getDefaultState = () => ({
|
|||
isCoverageEnabled: false, // Indicates if we should be calling coverage on this flow.
|
||||
isClaimRegistrationRequired: false, // Indicates if the claim registration call needs to be made for a client to complete coverage verification.
|
||||
isAuthenticated: false, // Indicates if user is authenticated or not.
|
||||
enableContinueFromCookie: false, // Indicates if the continue from cookie should appear.
|
||||
enableContinueFromCookie: false, // Indicates if the continue from cookie modal should appear.
|
||||
enableTPAFlow: false, // Indicates if the TPA flow is supported for this client.
|
||||
successReturnURL: null, // Client URL to return the user to upon a successfull flow completetion (order submission).
|
||||
failureReturnURL: null, // Client URL to return the user to when they encounter an error or bailout and are unable to complete the flow.
|
||||
|
|
@ -1410,7 +1411,7 @@ export const useMainStore = defineStore({
|
|||
order.contactInfo.lastName = data?.customer?.lastName;
|
||||
order.contactInfo.emailAddress = data?.customer?.emailAddress;
|
||||
order.contactInfo.homePhone = data?.customer?.homePhone;
|
||||
order.contactInfo.servicephone = data?.customer?.servicePhone;
|
||||
order.contactInfo.servicePhone = data?.customer?.servicePhone;
|
||||
order.contactInfo.alternativePhone = data?.customer?.alternativePhone;
|
||||
order.contactInfo.requestTextUpdates = data?.customer?.isSmsOptIn;
|
||||
|
||||
|
|
@ -1464,15 +1465,9 @@ export const useMainStore = defineStore({
|
|||
},
|
||||
async loadSessionFromCookie(cookie) {
|
||||
const { order, issConfig } = this;
|
||||
// eslint-disable-next-line no-useless-catch
|
||||
try {
|
||||
const response = await this.getReferralByPayload(cookie);
|
||||
const { data } = response;
|
||||
if (!data) {
|
||||
// TODO how should we handle this case?
|
||||
return response;
|
||||
}
|
||||
|
||||
const response = await this.getReferralByPayload(cookie);
|
||||
const { data } = response;
|
||||
if (data) {
|
||||
order.customer.address.streetAddress = data.customer?.address?.streetAddress;
|
||||
order.customer.address.streetAddress2 = data.customer?.address?.streetAddress2;
|
||||
order.customer.address.city = data.customer?.address?.city;
|
||||
|
|
@ -1543,15 +1538,14 @@ export const useMainStore = defineStore({
|
|||
order.referralCorrelationId = data?.referralCorrelationId;
|
||||
order.referralSequenceNumber = data?.referralSequenceNumber;
|
||||
order.eon = data?.eon;
|
||||
order.workOrderId = data?.workOrderId;
|
||||
order.loadedFromCookie = true;
|
||||
order.loadedSessionClearedPreviousData = false;
|
||||
issConfig.enableContinueFromCookie = false;
|
||||
|
||||
return data;
|
||||
} catch (ex) {
|
||||
// TODO how should we handle this case?
|
||||
throw ex;
|
||||
this.updateIsSafeliteProvider(data?.provider?.isSafeliteProvider);
|
||||
}
|
||||
|
||||
return data;
|
||||
},
|
||||
updateCreditCardToken(token) {
|
||||
this.order.payment.creditCardToken.subscriptionId = token.subscriptionId;
|
||||
|
|
@ -1849,6 +1843,7 @@ export const useMainStore = defineStore({
|
|||
this.order.referralSequenceNumber = null;
|
||||
this.order.referralDate = null;
|
||||
this.order.referralSequenceNumber = null;
|
||||
this.order.workOrderId = null;
|
||||
this.order.workOrderNumber = null;
|
||||
this.order.eon = null;
|
||||
this.order.originalDeductible = null;
|
||||
|
|
@ -2663,6 +2658,9 @@ export const useMainStore = defineStore({
|
|||
// clear vuex
|
||||
this.resetState();
|
||||
|
||||
// delete cookie
|
||||
deleteISSCookie();
|
||||
|
||||
// restore issConfig
|
||||
this.issConfig = issConfig;
|
||||
// restore user's experiments
|
||||
|
|
|
|||
Loading…
Reference in a new issue