Merge branch 'develop' into rlsmerge/2025.10.23-to-dev
This commit is contained in:
commit
9c5483bf18
16 changed files with 383 additions and 21 deletions
BIN
public/static/assets/Urbanist-Regular.woff
Normal file
BIN
public/static/assets/Urbanist-Regular.woff
Normal file
Binary file not shown.
BIN
public/static/assets/Urbanist-SemiBold.woff
Normal file
BIN
public/static/assets/Urbanist-SemiBold.woff
Normal file
Binary file not shown.
3
public/static/assets/logo.svg
Normal file
3
public/static/assets/logo.svg
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 439.8 73.6" viewBox="0 0 439.8 73.6">
|
||||
<path d="M47.2 22.8c-.8 0-1.4-.6-1.4-1.4v-1.5c0-4.1-2.6-7.5-8.1-7.5-6.1 0-8.8 4.3-8.8 7.4 0 13.7 46.4 7 46.4 32.3 0 14.7-13.6 21.3-38.6 21.3C13.1 73.4 0 68.2 0 53.9v-1c0-.8.6-1.4 1.4-1.4H26c.8 0 1.4.6 1.4 1.4v1.5c0 5.9 3.8 8 9.3 8 5.8 0 9.2-4.2 9.2-8 0-13.7-44.5-6.9-44.5-31.4C1.4 9 13.1 1.4 37.1 1.4c23.8 0 34.5 6 35.2 19.8 0 .8-.6 1.5-1.4 1.5l-23.7.1zm106.4-7.1c0-9.8 6-13.4 23.8-13.4 3.3 0 7.3.1 11 .4.7.1 1.3.7 1.3 1.4v6c0 .8-.7 1.5-1.6 1.4-.8-.1-1.6-.1-2.7-.1-3.1 0-6.1 1-6.1 3.4v6.9c0 .8.6 1.4 1.4 1.4h7.6c.8 0 1.4.6 1.4 1.4v8.1c0 .8-.6 1.4-1.4 1.4h-7.6c-.8 0-1.4.6-1.4 1.4v35.2c0 .8-.6 1.4-1.4 1.4h-22.8c-.8 0-1.4-.6-1.4-1.4l-.1-54.9zM218 50.6c-.8 0-1.4.6-1.4 1.4v6.3c0 5.3 3.4 6.6 7 6.6 4.3 0 6.9-2.7 7.2-8.5 0-.7.7-1.3 1.4-1.3h20.2c.9 0 1.5.7 1.4 1.6-1 10.9-9.9 16.9-30.2 16.9-24.8 0-32.8-7.1-32.8-25.8 0-18.8 9.7-25.9 32.8-25.9 20.5 0 31 5.8 31 23.6v3.6c0 .8-.6 1.4-1.4 1.4l-35.2.1zm12.6-12.4c0-5.2-1.7-7.5-7.1-7.5-5.3 0-7 2.4-7 7.5v2.1c0 .8.6 1.4 1.4 1.4h11.3c.8 0 1.4-.6 1.4-1.4v-2.1zM265.2 0H288c.8 0 1.4.6 1.4 1.4v69.5c0 .8-.6 1.4-1.4 1.4h-22.8c-.8 0-1.4-.6-1.4-1.4V1.4c-.1-.8.6-1.4 1.4-1.4zM302 23.2h22.8c.8 0 1.4.6 1.4 1.4v46.3c0 .8-.6 1.4-1.4 1.4H302c-.8 0-1.4-.6-1.4-1.4V24.6c-.1-.8.6-1.4 1.4-1.4zM302 0h22.8c.8 0 1.4.6 1.4 1.4v12.1c0 .8-.6 1.4-1.4 1.4L302 15c-.8 0-1.4-.6-1.4-1.4V1.5c-.1-.9.6-1.5 1.4-1.5zm101.2 50.6c-.8 0-1.4.6-1.4 1.4v6.3c0 5.3 3.4 6.6 7 6.6 4.2 0 6.9-2.7 7.2-8.5 0-.7.7-1.3 1.4-1.3h20.2c.9 0 1.5.7 1.4 1.6-1 10.9-9.9 16.9-30.1 16.9-24.8 0-32.8-7.1-32.8-25.8 0-18.8 9.7-25.9 32.8-25.9 20.5 0 31 5.8 31 23.6v3.6c0 .8-.6 1.4-1.4 1.4l-35.3.1zm12.7-12.4c0-5.2-1.7-7.5-7.1-7.5-5.3 0-7 2.4-7 7.5v2.1c0 .8.6 1.4 1.4 1.4h11.3c.8 0 1.4-.6 1.4-1.4v-2.1zm-271.5-.5C144.3 25 131.8 22 113.9 22c-11.2 0-28.2 2.3-29.5 14.9-.1.8.6 1.6 1.4 1.6h19.4c.7 0 1.3-.6 1.4-1.3.5-4.3 2.8-6.5 7.2-6.5s6.5 1.5 6.5 4.5v4.4c0 .7-.5 1.3-1.2 1.4-1.2.2-2.9.4-6.3.9l-10.1 1.5c-16.4 2.4-21.4 6.7-21.4 15.8 0 8.4 6 14.4 21.4 14.4 7.3 0 13.9-2.2 17-6.2.2-.2.6-.2.6.1.3 1 .9 2.9 1.2 3.9.2.6.7.9 1.3.9h20c.8 0 1.4-.6 1.4-1.4l.2-33.2zm-32 26.3c-3.9 0-6.3-3.4-6.3-6.7 0-3.3 1.5-5.3 5.3-6.3 2.4-.7 5.5-1.1 7.4-1.4.9-.1 1.6.5 1.6 1.4v4.9c0 5.3-2.2 8.1-8 8.1zm251.8-29.7h7.3c.8 0 1.4-.6 1.4-1.4v-8.1c0-.8-.6-1.4-1.4-1.4h-7.3c-.8 0-1.4-.6-1.4-1.4l-.1-20.4v-.4c0-.6-.5-1.1-1.1-1.1-.2 0-.3 0-.4.1h-.1l-22.6 13.4c-1 .6-1.4.7-1.4 1.4v45.4c0 10.9 6.1 12.5 21.8 12.5 3.9 0 8.3-.2 12.7-.4.7-.1 1.3-.7 1.3-1.4v-6.8c0-.8-.6-1.4-1.4-1.4h-2.6c-4.1 0-6.1-1-6.1-3.8V35.8c0-.9.6-1.5 1.4-1.5z" style="fill:#dc1f26"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.6 KiB |
299
public/static/error/index.html
Normal file
299
public/static/error/index.html
Normal file
|
|
@ -0,0 +1,299 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
|
||||
@font-face {
|
||||
font-family: Urbanist;
|
||||
src: url("/fmg/static/assets/Urbanist-Regular.woff") format("woff");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: UrbanistSemiBold;
|
||||
src: url("/fmg/static/assets/Urbanist-SemiBold.woff") format("woff");
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Urbanist', Roboto, Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 960px;
|
||||
margin: auto;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.header, .copy, .cta {
|
||||
margin-bottom: 3rem;
|
||||
}
|
||||
|
||||
.header .header-image {
|
||||
width: 165px;
|
||||
}
|
||||
|
||||
.subheader {
|
||||
font-weight: normal;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.cta-button {
|
||||
padding-top: 0.75rem;
|
||||
padding-bottom: 0.75rem;
|
||||
padding-left: 2rem;
|
||||
padding-right: 2rem;
|
||||
border-radius: 50rem;
|
||||
background-color: #db0020;
|
||||
color: #ffffff;
|
||||
font-family: inherit;
|
||||
font-size: 1rem;
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
.diagnostic-info {
|
||||
color: #db0020;
|
||||
font-family: 'UrbanistSemiBold', Roboto, Arial, Helvetica, sans-serif;
|
||||
}
|
||||
</style>
|
||||
<title>Error - Safelite</title>
|
||||
<link rel="icon" href="/fmg/favicon.ico">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<img class="header-image" src="/fmg/static/assets/logo.svg" />
|
||||
</div>
|
||||
<div class="copy">
|
||||
<h2 class="subheader">
|
||||
We're not able to schedule at this time. We apologize for the inconvenience
|
||||
</h2>
|
||||
<p>
|
||||
We encountered an error while processing your appointment. You can return to our site and try scheduling again below.
|
||||
</p>
|
||||
</div>
|
||||
<div class="cta">
|
||||
<a href="/">
|
||||
<button class="cta-button">
|
||||
Continue to Safelite.com
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
<div class="diagnostic-info" id="diagnostic-container">
|
||||
<hr />
|
||||
<h2 class="subheader">
|
||||
Bailout Information:
|
||||
</h2>
|
||||
<div id="bailout-info-container">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
// Helpers
|
||||
function getCookieValueByName(name) {
|
||||
const value = "; " + document.cookie;
|
||||
const parts = value.split("; " + name + "=");
|
||||
|
||||
if (parts.length === 2) {
|
||||
return parts.pop().split(";").shift();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function getCurrentEnvironmentData() {
|
||||
const environmentData = [
|
||||
{
|
||||
name: 'Localhost',
|
||||
hostName: 'localhost',
|
||||
apiHostname: 'digitalapi.dev.safelite.io',
|
||||
debug: true,
|
||||
},
|
||||
{
|
||||
name: 'Dev',
|
||||
hostName: 'www-dev2.safelite.com',
|
||||
apiHostname: 'digitalapi.dev.safelite.io',
|
||||
debug: true,
|
||||
},
|
||||
{
|
||||
name: 'Test',
|
||||
hostName: 'www-test2.safelite.com',
|
||||
apiHostname: 'digitalapi.test.safelite.io',
|
||||
debug: true,
|
||||
},
|
||||
{
|
||||
name: 'QA',
|
||||
hostName: 'www-qa2.safelite.com',
|
||||
apiHostname: 'digitalapi.qa.safelite.io',
|
||||
debug: false,
|
||||
},
|
||||
{
|
||||
name: 'Prod',
|
||||
hostName: 'www.safelite.com',
|
||||
apiHostname: 'digitalapi.safelite.io',
|
||||
debug: false,
|
||||
},
|
||||
];
|
||||
|
||||
const hostName = window.location.hostname;
|
||||
|
||||
const match = environmentData.find(
|
||||
data => (data.hostName === hostName)
|
||||
);
|
||||
|
||||
return match;
|
||||
}
|
||||
|
||||
window.onload = async () => {
|
||||
// =============== Check for session info:
|
||||
const existingVuexDataJSON = window.localStorage.getItem('vuex');
|
||||
const existingVuexData = existingVuexDataJSON ? JSON.parse(existingVuexDataJSON) : null;
|
||||
const existingBailoutInfoJSON = window.sessionStorage.getItem('bailoutInfo');
|
||||
const existingBailoutInfo = existingBailoutInfoJSON ? JSON.parse(existingBailoutInfoJSON) : null;
|
||||
|
||||
console.log(`================ VUEX DATA`);
|
||||
console.log(existingVuexData);
|
||||
console.log(`================ PRIOR BAILOUT DATA`);
|
||||
console.log(existingBailoutInfo);
|
||||
|
||||
let bailoutInfo = null;
|
||||
|
||||
if(existingVuexData) {
|
||||
try {
|
||||
// =============== Collect diagnostic data:
|
||||
bailoutInfo = [];
|
||||
|
||||
// App & Site Name
|
||||
bailoutInfo.push({ name: 'App Name', value: 'FixMyGlass' });
|
||||
bailoutInfo.push({ name: 'Site Name', value: 'SafeliteDotcom' });
|
||||
|
||||
// Not included (yet) from heritage:
|
||||
// - Site ID
|
||||
// - Code
|
||||
// - Module
|
||||
// - Page
|
||||
|
||||
bailoutInfo.push({ name: 'Timestamp', value: `${new Date()}` });
|
||||
|
||||
// - URL
|
||||
// - Server
|
||||
|
||||
const sessionId = getCookieValueByName('sid');
|
||||
bailoutInfo.push({ name: 'Session Id', value: sessionId });
|
||||
|
||||
const userAgent = window.navigator.userAgent;
|
||||
bailoutInfo.push({ name: 'User Agent', value: userAgent });
|
||||
|
||||
// - IP
|
||||
// - Session Log Sequence Number
|
||||
|
||||
bailoutInfo.push({ name: 'Referral Seq Number', value: existingVuexData.order?.referralSequenceNumber });
|
||||
bailoutInfo.push({ name: 'Referral Number', value: existingVuexData.order?.referralNumber });
|
||||
bailoutInfo.push({ name: 'Referral Date', value: existingVuexData.order?.referralDate });
|
||||
bailoutInfo.push({ name: 'Referral Provider Number', value: existingVuexData.order?.serviceLocation?.provider?.providerNumber });
|
||||
bailoutInfo.push({ name: 'Referral CTU', value: existingVuexData.order?.serviceLocation?.provider?.address?.zipCodeCtu });
|
||||
|
||||
// - Referral Insured Zip
|
||||
// - Referral Insured Service Zip
|
||||
|
||||
bailoutInfo.push({ name: 'Referral CarID', value: existingVuexData.order?.vehicle?.carId });
|
||||
|
||||
const vehicle = existingVuexData.order?.vehicle;
|
||||
const vehicleString = vehicle?.year
|
||||
? `${vehicle.year} ${vehicle.make} ${vehicle.model} - ${vehicle.style}`
|
||||
: null;
|
||||
bailoutInfo.push({ name: 'Referral Vehicle', value: vehicleString });
|
||||
bailoutInfo.push({ name: 'Work Order Number', value: existingVuexData.order?.workOrderNumber });
|
||||
bailoutInfo.push({ name: 'Work Order ID', value: existingVuexData.order?.workOrderId });
|
||||
bailoutInfo.push({ name: 'Parent Account Number', value: existingVuexData.order?.payment?.parentAccountNumber });
|
||||
|
||||
// - Parent Account Name
|
||||
// - Client GUID
|
||||
} finally {
|
||||
// If any information gathered, write to session storage.
|
||||
if(bailoutInfo) {
|
||||
window.sessionStorage.setItem('bailoutInfo', JSON.stringify(bailoutInfo));
|
||||
}
|
||||
|
||||
// Then *always* clear vuex data.
|
||||
window.localStorage.removeItem('vuex');
|
||||
}
|
||||
} else if(existingBailoutInfo) {
|
||||
// Proceed with prior data.
|
||||
bailoutInfo = existingBailoutInfo;
|
||||
}
|
||||
|
||||
const environmentInfo = getCurrentEnvironmentData();
|
||||
const shouldShowDebugInfo = environmentInfo?.debug;
|
||||
|
||||
if(bailoutInfo && shouldShowDebugInfo) {
|
||||
try {
|
||||
// =============== Display diagnostic data:
|
||||
// Create display nodes
|
||||
const elements = bailoutInfo.map(
|
||||
dataPoint => {
|
||||
const element = document.createElement('li');
|
||||
element.textContent = `${dataPoint.name}: ${dataPoint.value}`;
|
||||
|
||||
return element;
|
||||
}
|
||||
);
|
||||
|
||||
const fragment = new DocumentFragment();
|
||||
|
||||
elements.forEach(
|
||||
(element) => {
|
||||
fragment.append(element);
|
||||
}
|
||||
);
|
||||
|
||||
// Attach nodes to DOM and render
|
||||
const attachNode = document.getElementById('bailout-info-container');
|
||||
if(attachNode) {
|
||||
const ul = attachNode.appendChild(document.createElement('ul'));
|
||||
ul.append(fragment);
|
||||
}
|
||||
} catch(e) {
|
||||
console.error(`=== ERROR DISPLAYING INFO`);
|
||||
console.error(e);
|
||||
|
||||
const diagnosticContainer = document.getElementById('diagnostic-container');
|
||||
diagnosticContainer.remove();
|
||||
}
|
||||
} else {
|
||||
const diagnosticContainer = document.getElementById('diagnostic-container');
|
||||
diagnosticContainer.remove();
|
||||
}
|
||||
|
||||
const apiHostname = environmentInfo?.apiHostname;
|
||||
if(apiHostname) {
|
||||
try {
|
||||
const endpointUrl = `https://${apiHostname}/analytics/api/v1/logging/log-error`;
|
||||
|
||||
const infoString = bailoutInfo?.map(
|
||||
(entry) => `${entry.name}: ${entry.value}`
|
||||
)?.reduce(
|
||||
(prev, next) => `${prev}\n${next}`
|
||||
);
|
||||
const entryString = `User encountered bailout page.\n${new Date()}\n${infoString ?? 'No information recoverable'}`;
|
||||
|
||||
const request = new Request(endpointUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
entry: entryString,
|
||||
}),
|
||||
});
|
||||
|
||||
const response = await fetch(request);
|
||||
// Don't need data from response, but could get it here with:
|
||||
// const responseData = await response.json();
|
||||
} catch(e) {
|
||||
console.error(`=== ERROR SENDING LOGGING`);
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -121,7 +121,7 @@ export default {
|
|||
endpoint: endpoint,
|
||||
};
|
||||
|
||||
router.bailout(errorPayload);
|
||||
router.handleSoftError(errorPayload);
|
||||
|
||||
// do not log 404 errors from services because we return NotFound
|
||||
// when a service doesn't return an object
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ it("Global Methods - Call Http Client - Should Reject Promise", () => {
|
|||
isError: true,
|
||||
});
|
||||
analyticsMixIn.methods.pushEventToGA = jest.fn();
|
||||
router.bailout = jest.fn();
|
||||
router.handleSoftError = jest.fn();
|
||||
|
||||
//Act
|
||||
globalMethods.callHttpClient(httpArgs).catch((err) => {
|
||||
|
|
|
|||
|
|
@ -125,6 +125,16 @@ export function getSessionKeyValue() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
export function getskeyValue() {
|
||||
const cookieValue = getCookieValueByName(cookieNames.SESSION_KEY);
|
||||
|
||||
if (cookieValue) {
|
||||
return cookieValue;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
export function setSessionKeyIfUnset(value) {
|
||||
if (!isCookieSet(cookieNames.FUNNEL_SESSION_KEY)) {
|
||||
setCookieProperties(
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import {
|
|||
areAllSessionCookiesSet,
|
||||
setSessionIdIfUnset,
|
||||
setSessionKeyIfUnset,
|
||||
getskeyValue,
|
||||
} from "@/helpers/heritage-integration/cookie-helper";
|
||||
import { queryStrings } from "@/constants/query-strings";
|
||||
import { experimentSettings, experimentUniverses } from "@/constants/experiments";
|
||||
|
|
@ -231,11 +232,14 @@ export default {
|
|||
(part) => `${part.glassLocation}-${part.glassName}`
|
||||
);
|
||||
|
||||
var appointment = `${order?.schedule?.date ?? ""} ${order?.schedule?.startTime ?? ""}`;
|
||||
|
||||
var sessionData = {};
|
||||
sessionData.currentPage = getPageNameFromRouter();
|
||||
sessionData.sid = getSessionIdValue();
|
||||
sessionData.deviceId = getDeviceIdValue();
|
||||
sessionData.fmgSessionId = applicationUser?.savedSessionId;
|
||||
sessionData.skey = getskeyValue().toString();
|
||||
sessionData.userId = getUserIdValue();
|
||||
sessionData.carId = order?.vehicle?.carId;
|
||||
sessionData.vehicleYear = order?.vehicle?.year;
|
||||
|
|
@ -266,7 +270,7 @@ export default {
|
|||
sessionData.providerCtu = order?.serviceLocation?.provider?.address?.zipCodeCtu
|
||||
? order?.serviceLocation?.provider?.address?.zipCodeCtu
|
||||
: order?.serviceLocation?.zipCodeCtu;
|
||||
sessionData.appointmentDate = `${order?.schedule?.date} ${order?.schedule?.startTime}`;
|
||||
sessionData.appointmentDate = appointment;
|
||||
sessionData.serviceType = order?.serviceLocation?.appointmentType;
|
||||
sessionData.promoCodes = promoCodes;
|
||||
sessionData.hasTechnicianNotes = order?.serviceLocation?.techNotes ? true : false;
|
||||
|
|
@ -280,6 +284,7 @@ export default {
|
|||
sessionData.isItac = order?.policy?.isItac;
|
||||
sessionData.subTotalPrice = getSubTotal(order?.lineItems);
|
||||
sessionData.totalPrice = getAmountDue(order?.lineItems, true);
|
||||
sessionData.userAgent = navigator.userAgent;
|
||||
|
||||
await baseMixin.methods.dispatchStoreAction(
|
||||
storeActions.LOG_FMG_SESSION_DATA,
|
||||
|
|
|
|||
|
|
@ -112,7 +112,6 @@ export const routeData = {
|
|||
path: "/virtual/auto-route",
|
||||
virtual: true,
|
||||
},
|
||||
// TODO: RENAME FROM BAILOUT
|
||||
ERROR: {
|
||||
name: "error",
|
||||
path: "/virtual/error",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { routes } from "@/router/methods/routes";
|
||||
import { afterEach } from "@/router/methods/after-each";
|
||||
import { beforeEach } from "@/router/methods/before-each";
|
||||
import { bailout } from "@/router/methods/error";
|
||||
import { handleSoftError, handleHardError } from "@/router/methods/error";
|
||||
import {
|
||||
navigateWithoutSaving,
|
||||
navigateWithSaving,
|
||||
|
|
@ -32,7 +32,8 @@ router.navigateWithoutSaving = navigateWithoutSaving;
|
|||
router.navigateWithPageData = navigateWithPageData;
|
||||
router.navigateAndForceTopLevelNavigation = navigateAndForceTopLevelNavigation;
|
||||
|
||||
router.bailout = bailout;
|
||||
router.handleSoftError = handleSoftError;
|
||||
router.handleHardError = handleHardError;
|
||||
|
||||
router.navigateToExternalUrl = navigateToExternalUrl;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import analyticsMixin from "@/mixins/analytics-mixin";
|
|||
import { routeData, FUNNEL_START_PAGE } from "@/router/constants/routes";
|
||||
import { runExperiments } from "@/router/methods/helpers/run-experiments";
|
||||
|
||||
import { bailout } from "@/router/methods/error";
|
||||
import { handleSoftError, handleHardError } from "@/router/methods/error";
|
||||
import { checkPagePrerequisites } from "@/router/methods/page-prerequisites";
|
||||
import { checkLogParam } from "@/helpers/debug-log-helper";
|
||||
import { debugLog } from "@/helpers/debug-log-helper";
|
||||
|
|
@ -41,7 +41,7 @@ export async function beforeEach(to, from) {
|
|||
nextPage: to?.name,
|
||||
};
|
||||
|
||||
bailout(errorPayload, true);
|
||||
handleSoftError(errorPayload, true);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ export async function beforeEach(to, from) {
|
|||
nextPage: to?.name,
|
||||
};
|
||||
|
||||
bailout(errorPayload);
|
||||
handleSoftError(errorPayload);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -107,7 +107,8 @@ export async function beforeEach(to, from) {
|
|||
|
||||
console.log(error);
|
||||
|
||||
bailout(errorPayload);
|
||||
// Eject user from Vue app in this scenario and clear localstorage.
|
||||
await handleHardError(errorPayload);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,9 @@ import router from "@/router";
|
|||
import store from "@/store";
|
||||
import { storeActions } from "@/constants/store-actions";
|
||||
import { deleteFunnelCookie } from "@/helpers/heritage-integration/cookie-helper";
|
||||
import experimentMixin from "../../mixins/experiment-mixin";
|
||||
|
||||
export async function bailout(errorPayload, forceRestart = false) {
|
||||
export async function handleSoftError(errorPayload, forceRestart = false) {
|
||||
if (forceRestart) {
|
||||
await store.dispatch(storeActions.RESET_STATE);
|
||||
deleteFunnelCookie();
|
||||
|
|
@ -17,3 +18,23 @@ export async function bailout(errorPayload, forceRestart = false) {
|
|||
name: routeData.ERROR.name,
|
||||
});
|
||||
}
|
||||
|
||||
export async function handleHardError(errorPayload) {
|
||||
try {
|
||||
const isInStaticErrorExperiment = experimentMixin.methods.hasSettingEqualTo(
|
||||
"UseStaticErrorPage",
|
||||
"true"
|
||||
);
|
||||
|
||||
if (isInStaticErrorExperiment) {
|
||||
analyticsMixin?.methods?.pushPageErrorToDataLayer(errorPayload);
|
||||
window.top.location = "/fmg/static/error";
|
||||
return;
|
||||
} else {
|
||||
await handleSoftError(errorPayload, true);
|
||||
return;
|
||||
}
|
||||
} finally {
|
||||
await handleSoftError(errorPayload, true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ export function createRoute(routeDatum, beforeEnter = async (to, from) => undefi
|
|||
return await beforeEnter(to, from);
|
||||
} catch {
|
||||
return {
|
||||
name: routeData.BAILOUT.name,
|
||||
name: routeData.ERROR.name,
|
||||
replace: true,
|
||||
};
|
||||
}
|
||||
|
|
@ -29,7 +29,7 @@ export function createVirtualRoute(routeDatum, beforeEnter = async (to, from) =>
|
|||
} catch (error) {
|
||||
console.log(error);
|
||||
return {
|
||||
name: routeData.BAILOUT.name,
|
||||
name: routeData.ERROR.name,
|
||||
replace: true,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { savePageData } from "@/router/methods/helpers/save-page-data";
|
|||
import router from "@/router";
|
||||
import store from "@/store";
|
||||
|
||||
import { bailout } from "@/router/methods/error";
|
||||
import { handleSoftError } from "@/router/methods/error";
|
||||
|
||||
async function navigate(scenario, currentPageName, withSaving = false, forceTopLevelNav = false) {
|
||||
// Check to see if calling page is same as current page.
|
||||
|
|
@ -30,7 +30,7 @@ async function navigate(scenario, currentPageName, withSaving = false, forceTopL
|
|||
nextPage: nextPage?.name,
|
||||
};
|
||||
|
||||
bailout(errorPayload);
|
||||
handleSoftError(errorPayload);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,15 +5,34 @@ import baseMixin from "@/mixins/base-mixin";
|
|||
import router from "@/router";
|
||||
import { routeData, FUNNEL_START_PAGE } from "@/router/constants/routes";
|
||||
import store from "@/store";
|
||||
import { handleHardError } from "@/router/methods/error";
|
||||
|
||||
export async function errorBeforeEnter(to, from) {
|
||||
// If we've already encountered one error, clear session to avoid more.
|
||||
// Otherwise mark that we encoutnered an error here.
|
||||
if (store.getters.applicationUser.hasAlreadyTriggeredError) {
|
||||
return {
|
||||
name: routeData.RESTART.name,
|
||||
replace: true,
|
||||
// Check if `hasAlreadyTriggeredErrror` is available.
|
||||
// If we cannot check it (store, getters, or applicationUser is null-ish),
|
||||
// act as if the flag is set, as we are in unstable state.
|
||||
if (!store?.getters?.applicationUser) {
|
||||
const errorPayload = {
|
||||
cause: "Cannot access store during error process.",
|
||||
currentPage: from?.name,
|
||||
nextPage: to?.name,
|
||||
};
|
||||
|
||||
handleHardError(errorPayload);
|
||||
return;
|
||||
}
|
||||
|
||||
// If we've already encountered one error, clear session to avoid more.
|
||||
// Otherwise mark that we encountered an error here.
|
||||
if (store.getters.applicationUser.hasAlreadyTriggeredError) {
|
||||
const errorPayload = {
|
||||
cause: "Successive errors triggered.",
|
||||
currentPage: from?.name,
|
||||
nextPage: to?.name,
|
||||
};
|
||||
|
||||
handleHardError(errorPayload);
|
||||
return;
|
||||
} else {
|
||||
await store.dispatch(storeActions.UPDATE_HAS_TRIGGERED_ERROR, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1602,6 +1602,7 @@ export const actions = {
|
|||
sid,
|
||||
deviceId,
|
||||
fmgSessionId,
|
||||
skey,
|
||||
userId,
|
||||
carId,
|
||||
vehicleYear,
|
||||
|
|
@ -1640,6 +1641,7 @@ export const actions = {
|
|||
isItac,
|
||||
subTotalPrice,
|
||||
totalPrice,
|
||||
userAgent,
|
||||
}
|
||||
) {
|
||||
var payload = {
|
||||
|
|
@ -1647,6 +1649,7 @@ export const actions = {
|
|||
sid: sid,
|
||||
deviceId: deviceId,
|
||||
fmgSessionId: fmgSessionId,
|
||||
skey: skey,
|
||||
userId: userId,
|
||||
carId: carId,
|
||||
vehicleYear: vehicleYear,
|
||||
|
|
@ -1685,6 +1688,7 @@ export const actions = {
|
|||
isItac: isItac,
|
||||
subTotalPrice: subTotalPrice,
|
||||
totalPrice: totalPrice,
|
||||
userAgent,
|
||||
};
|
||||
|
||||
return globalMethods.callHttpClient({
|
||||
|
|
|
|||
Loading…
Reference in a new issue