220 lines
No EOL
8.3 KiB
HTML
220 lines
No EOL
8.3 KiB
HTML
<!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 "";
|
|
}
|
|
|
|
window.onload = () => {
|
|
// =============== 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;
|
|
} else {
|
|
// If neither fresh nor prior data exists, remove diagnostic section.
|
|
const diagnosticContainer = document.getElementById('diagnostic-container');
|
|
diagnosticContainer.remove();
|
|
return;
|
|
}
|
|
|
|
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);
|
|
}
|
|
} finally {
|
|
// =============== Clear User Data
|
|
// ======== To avoid reproducing the same issue due to invalid states.
|
|
window.localStorage.removeItem('vuex');
|
|
}
|
|
};
|
|
</script>
|
|
</body>
|
|
</html> |