Added static error page and updated relevant logic.
This commit is contained in:
parent
1955a9023b
commit
b1cc098f70
5 changed files with 76 additions and 54 deletions
|
|
@ -78,8 +78,7 @@ body {
|
|||
</button>
|
||||
</a>
|
||||
</div>
|
||||
-->
|
||||
<!--
|
||||
-->
|
||||
<div class="diagnostic-info" id="diagnostic-container">
|
||||
<hr />
|
||||
<h2 class="subheader">
|
||||
|
|
@ -89,10 +88,9 @@ body {
|
|||
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
<script>
|
||||
/*
|
||||
|
||||
// Helpers
|
||||
function getCookieValueByName(name) {
|
||||
const value = "; " + document.cookie;
|
||||
|
|
@ -114,25 +112,25 @@ body {
|
|||
},
|
||||
{
|
||||
name: 'Dev',
|
||||
hostName: 'www-dev2.safelite.com',
|
||||
hostName: 'selfservice.dev.glassclaim.com',
|
||||
apiHostname: 'digitalapi.dev.safelite.io',
|
||||
debug: true,
|
||||
},
|
||||
{
|
||||
name: 'SysTest',
|
||||
hostName: 'www-test2.safelite.com',
|
||||
hostName: 'selfservice.test.glassclaim.com',
|
||||
apiHostname: 'digitalapi.test.safelite.io',
|
||||
debug: true,
|
||||
},
|
||||
{
|
||||
name: 'QA',
|
||||
hostName: 'www-qa2.safelite.com',
|
||||
hostName: 'selfservice.qa.glassclaim.com',
|
||||
apiHostname: 'digitalapi.qa.safelite.io',
|
||||
debug: false,
|
||||
},
|
||||
{
|
||||
name: 'Prod',
|
||||
hostName: 'www.safelite.com',
|
||||
hostName: 'selfservice.glassclaim.com',
|
||||
apiHostname: 'digitalapi.safelite.io',
|
||||
debug: false,
|
||||
},
|
||||
|
|
@ -147,8 +145,8 @@ body {
|
|||
return match;
|
||||
}
|
||||
|
||||
function getExperimentSettingsFromVuex(vuexData) {
|
||||
const experiments = vuexData?.applicationUser?.experiments;
|
||||
function getExperimentSettingsFromVuex(storeData) {
|
||||
const experiments = storeData?.applicationUser?.experiments;
|
||||
|
||||
if(experiments) {
|
||||
return experiments
|
||||
|
|
@ -160,7 +158,7 @@ body {
|
|||
return {};
|
||||
}
|
||||
|
||||
function extractDataFromVuex(existingVuexData) {
|
||||
function extractDataFromStore(mainStore) {
|
||||
let bailoutInfo = [];
|
||||
let headerInfo = [];
|
||||
|
||||
|
|
@ -169,8 +167,8 @@ body {
|
|||
bailoutInfo = [];
|
||||
|
||||
// App & Site Name
|
||||
bailoutInfo.push({ name: 'App Name', value: 'FixMyGlass' });
|
||||
bailoutInfo.push({ name: 'Site Name', value: 'SafeliteDotcom' });
|
||||
bailoutInfo.push({ name: 'App Name', value: 'ISS' });
|
||||
bailoutInfo.push({ name: 'Site Name', value: 'ISS 2.0' });
|
||||
|
||||
// Not included (yet) from heritage:
|
||||
// - Site ID
|
||||
|
|
@ -192,45 +190,49 @@ body {
|
|||
// - 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 });
|
||||
bailoutInfo.push({ name: 'Referral Seq Number', value: mainStore.order?.referralSequenceNumber });
|
||||
bailoutInfo.push({ name: 'Referral Number', value: mainStore.order?.referralNumber });
|
||||
bailoutInfo.push({ name: 'Referral Date', value: mainStore.order?.referralDate });
|
||||
bailoutInfo.push({ name: 'Referral Provider Number', value: mainStore.order?.serviceLocation?.provider?.providerNumber });
|
||||
bailoutInfo.push({ name: 'Referral CTU', value: mainStore.order?.serviceLocation?.provider?.address?.zipCodeCtu });
|
||||
|
||||
// - Referral Insured Zip
|
||||
// - Referral Insured Service Zip
|
||||
|
||||
bailoutInfo.push({ name: 'Referral CarID', value: existingVuexData.order?.vehicle?.carId });
|
||||
bailoutInfo.push({ name: 'Referral CarID', value: mainStore.order?.vehicle?.carId });
|
||||
|
||||
const vehicle = existingVuexData.order?.vehicle;
|
||||
const vehicle = mainStore.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 });
|
||||
bailoutInfo.push({ name: 'Work Order Number', value: mainStore.order?.workOrderNumber });
|
||||
bailoutInfo.push({ name: 'Work Order ID', value: mainStore.order?.workOrderId });
|
||||
bailoutInfo.push({ name: 'Parent Account Number', value: mainStore.order?.parentAccountNumber });
|
||||
|
||||
const environmentData = getCurrentEnvironmentData();
|
||||
const userIdCookieName = `FunnelUserId-${environmentData?.name}`;
|
||||
const userIdCookieName = `ISSUserId-${environmentData?.name}`;
|
||||
bailoutInfo.push({ name: 'User Id', value: getCookieValueByName(userIdCookieName) });
|
||||
|
||||
bailoutInfo.push({ name: 'Bailout URL', value: mainStore.applicationUser.pageData['bailout-page']?.url });
|
||||
bailoutInfo.push({ name: 'Bailout Code', value: mainStore.applicationUser.pageData['bailout-page']?.bailoutCode });
|
||||
bailoutInfo.push({ name: 'Bailout Message', value: mainStore.applicationUser.pageData['bailout-page']?.errorMessage });
|
||||
|
||||
// - Parent Account Name
|
||||
// - Client GUID
|
||||
|
||||
// =============== Collect header data:
|
||||
headerInfo = [];
|
||||
|
||||
headerInfo.push({ name: 'X-Experiment-Data', value: JSON.stringify(getExperimentSettingsFromVuex(existingVuexData)) });
|
||||
headerInfo.push({ name: 'X-Application-Name', value: 'FixMyGlass' });
|
||||
headerInfo.push({ name: 'X-Experiment-Data', value: JSON.stringify(getExperimentSettingsFromVuex(mainStore)) });
|
||||
headerInfo.push({ name: 'X-Application-Name', value: 'ISS' });
|
||||
|
||||
const sessionKeyCookieName = `FunnelSessionKey-${environmentData?.name}`;
|
||||
const sessionKeyCookieName = `ISSSessionKey-${environmentData?.name}`;
|
||||
|
||||
headerInfo.push({ name: 'X-Session-Sequence-Number', value: getCookieValueByName(sessionKeyCookieName) });
|
||||
headerInfo.push({ name: 'X-Referral-Sequence-Number', value: existingVuexData?.order?.referralSequenceNumber });
|
||||
headerInfo.push({ name: 'X-Enterprise-Order-Number', value: existingVuexData?.order?.eon });
|
||||
headerInfo.push({ name: 'log-enabled', value: existingVuexData?.applicationUser?.loggingOption ?? false });
|
||||
headerInfo.push({ name: 'X-Referral-Sequence-Number', value: mainStore.order?.referralSequenceNumber });
|
||||
headerInfo.push({ name: 'X-Enterprise-Order-Number', value: mainStore.order?.eon });
|
||||
headerInfo.push({ name: 'log-enabled', value: mainStore.applicationUser?.loggingOption ?? false });
|
||||
} finally {
|
||||
return {
|
||||
headerInfo: headerInfo,
|
||||
|
|
@ -264,13 +266,12 @@ body {
|
|||
}
|
||||
|
||||
function clearApplicationData() {
|
||||
window.localStorage.removeItem('vuex');
|
||||
|
||||
/*
|
||||
const environmentData = getCurrentEnvironmentData();
|
||||
const cookieNames = [
|
||||
`FunnelUserId-${environmentData?.name}`,
|
||||
`FunnelSessionKey-${environmentData?.name}`,
|
||||
`FunnelSessionInfo-${environmentData?.name}`,
|
||||
`ISSUserId-${environmentData?.name}`,
|
||||
`ISSSessionKey-${environmentData?.name}`,
|
||||
`ISSSessionInfo-${environmentData?.name}`,
|
||||
`sid`,
|
||||
`dxdev`,
|
||||
];
|
||||
|
|
@ -281,33 +282,33 @@ body {
|
|||
document.cookie = cookieToAdd;
|
||||
}
|
||||
)
|
||||
*/
|
||||
}
|
||||
|
||||
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;
|
||||
const existingHeaderInfoJSON = window.sessionStorage.getItem('headerInfo');
|
||||
const existingHeaderInfo = existingHeaderInfoJSON ? JSON.parse(existingHeaderInfoJSON) : null;
|
||||
const existingStoreDataJSON = window.sessionStorage.getItem('main');
|
||||
const mainStore = existingStoreDataJSON ? JSON.parse(existingStoreDataJSON) : null;
|
||||
const bailoutData = mainStore.applicationUser.pageData['bailout-page'];
|
||||
|
||||
console.log(`================ VUEX DATA`);
|
||||
console.log(existingVuexData);
|
||||
console.log(mainStore);
|
||||
|
||||
/*
|
||||
console.log(`================ PRIOR BAILOUT DATA`);
|
||||
console.log(existingBailoutInfo);
|
||||
console.log(`================ PRIOR HEADER DATA`);
|
||||
console.log(existingHeaderInfo);
|
||||
|
||||
*/
|
||||
let bailoutInfo = null;
|
||||
let headerInfo = null;
|
||||
|
||||
if(existingVuexData) {
|
||||
const results = extractDataFromVuex(existingVuexData);
|
||||
if(mainStore) {
|
||||
const results = extractDataFromStore(mainStore);
|
||||
bailoutInfo = results.bailoutInfo;
|
||||
headerInfo = results.headerInfo;
|
||||
|
||||
clearApplicationData();
|
||||
//clearApplicationData();
|
||||
|
||||
if(bailoutInfo) {
|
||||
window.sessionStorage.setItem('bailoutInfo', JSON.stringify(bailoutInfo));
|
||||
|
|
@ -363,6 +364,8 @@ body {
|
|||
diagnosticContainer.remove();
|
||||
}
|
||||
|
||||
// TODO: Re-enable logging after some further testing.
|
||||
/*
|
||||
const apiHostname = environmentInfo?.apiHostname;
|
||||
if(apiHostname) {
|
||||
try {
|
||||
|
|
@ -399,9 +402,9 @@ body {
|
|||
const headers = generateRequestHeader(headerInfo);
|
||||
|
||||
const payload = {
|
||||
AppName: "FixMyGlass",
|
||||
AppName: "ISS",
|
||||
action: "",
|
||||
applicationName: "FixMyGlassNextGen",
|
||||
applicationName: "ISS",
|
||||
event: "ENTRY",
|
||||
experimentsForUser: [],
|
||||
pageName: "static-error",
|
||||
|
|
@ -425,8 +428,8 @@ body {
|
|||
console.error(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
*/
|
||||
*/
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -125,9 +125,9 @@ export default {
|
|||
global.bailoutOnAxiosError(errorData);
|
||||
}
|
||||
else {
|
||||
console.error("Unable to bailout on the entry page or bailout page.");
|
||||
console.error("Fatal - Unable to bailout on the entry page or bailout page.");
|
||||
// Redirect to a generic static error page on fatal error on entry and bailout page.
|
||||
window.top.location = '/static/error';
|
||||
// TODO: Redirect to a generic static error page.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,15 @@ export class Logger {
|
|||
const store = useMainStore();
|
||||
const sessionKey = getSessionKeyValue();
|
||||
|
||||
// TODO: Work in progress.
|
||||
/*
|
||||
if ( store.applicationUser.logErrorCalls> 10 ) {
|
||||
console.error("Exceeded maximum log error calls for this session. Further logging will be suppressed to prevent potential infinite loops.");
|
||||
return;
|
||||
}
|
||||
|
||||
store.applicationUser.logErrorCalls += 1;
|
||||
*/
|
||||
return new Promise((resolve, reject) => {
|
||||
// If running locally or in the Dev environment show the log entries in the console.
|
||||
if (
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ const routes = [
|
|||
await analyticsMixin.methods.validateSession();
|
||||
|
||||
// Do not run these for the main entry page - as it is not part of the user flow.
|
||||
if (issPageToUse !== issPageValues.ENTRY_PAGE) {
|
||||
if (issPageToUse !== issPageValues.ENTRY_PAGE && issPageToUse !== issPageValues.BAILOUT_PAGE) {
|
||||
try {
|
||||
await runExperiments(issPageToUse);
|
||||
} catch (error) {
|
||||
|
|
@ -82,7 +82,14 @@ const routes = [
|
|||
return next({name: issPageToUse, query: to.query, params: to.params});
|
||||
}
|
||||
|
||||
const routeData = await GetRouteInfoFromPageName(issPageToUse);
|
||||
var routeData = [];
|
||||
|
||||
try {
|
||||
routeData = await GetRouteInfoFromPageName(issPageToUse);
|
||||
}
|
||||
catch ( error ) {
|
||||
window.top.location = '/static/error';
|
||||
}
|
||||
|
||||
if (routeData[0].name.toLowerCase() === 'error') {
|
||||
throw new Error('Page not found!');
|
||||
|
|
@ -284,6 +291,8 @@ function navigate(
|
|||
// Match our maps up and navigate if we have a destination.
|
||||
let matchingScenarioMap = getNavigationMap(scenario, currentRoute);
|
||||
if (!matchingScenarioMap && scenario === navigationScenarios.BAILOUT) {
|
||||
// TODO: Send to static error page here?
|
||||
//console.error("No matching map for bailout page - forced bailout page map");
|
||||
matchingScenarioMap = { destinationIssPageValue: issPageValues.BAILOUT_PAGE }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -245,6 +245,7 @@ export const getDefaultState = () => ({
|
|||
duplicateOrders: [],
|
||||
hasSentSaveQuoteEmail: null,
|
||||
coverageLookupAttempts: 0,
|
||||
//logErrorCalls: 0,
|
||||
firstHit: true
|
||||
},
|
||||
issConfig: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue