From a37020341f29d7d1736647d6f5f589c8b30ac8e9 Mon Sep 17 00:00:00 2001 From: Jeremy-Z Date: Wed, 20 May 2026 13:58:01 -0400 Subject: [PATCH 1/3] Refactored front end entry-page loading and session initialization. --- src/layouts/entry-page/entry-page.vue | 8 ++- src/mixins/analytics-mixin.js | 2 +- src/router/index.js | 81 +++++++++++++++------------ src/store/index.js | 12 ++-- 4 files changed, 59 insertions(+), 44 deletions(-) diff --git a/src/layouts/entry-page/entry-page.vue b/src/layouts/entry-page/entry-page.vue index 8b83f988..503827ac 100644 --- a/src/layouts/entry-page/entry-page.vue +++ b/src/layouts/entry-page/entry-page.vue @@ -15,6 +15,7 @@ import { useMainStore } from '@/store'; import showIssLoadingModal from '@/helpers/loading-modal-helper'; import applicationConfig from '@/constants/application-config'; import { toPossessive } from '@/helpers/text-helper'; +import analyticsMixin from '@/mixins/analytics-mixin'; export default { name: 'entry-page', @@ -36,7 +37,6 @@ export default { async mounted() { try { const queryStringParams = this.parseQueryParms(); - const { isAuthorized, clientData, decryptedParams } = await this.validateClientTagOnEntry(queryStringParams); this.unauthorized = !isAuthorized; @@ -46,7 +46,11 @@ export default { return; } + // Populate all the ISS Config values from the service call returns. this.populateISSConfigValues(clientData); + + // Session should only be created / validated on successful client tag validation to avoid unnecessary sessions for unauthorized users. + await analyticsMixin.methods.validateSession(); try { // Check cookie @@ -143,7 +147,7 @@ export default { isAuthorized = true; } - if (isAuthorized) { + if (isAuthorized) { clientData = resp; } } diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index 29165735..d3c139c7 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -558,9 +558,9 @@ export default { const clientTag = store.issConfig.clientTag; const siteType = store.issConfig.siteType; - const payload = { clientTag, + siteType: siteType, deviceId, referrer, sessionId: sid, diff --git a/src/router/index.js b/src/router/index.js index f5d4517f..e0f34881 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -35,30 +35,6 @@ const routes = [ return await GoToAccessIsDenied(next); } - // This is a quick fix for a prod issue.... better fix will come later. - // This and experiment call for entry-page probably need to be called directly in the mounted - // secion of the entry-page. Can be here for every other page. - if (issPageToUse === issPageValues.ENTRY_PAGE ) - { - const store = useMainStore(); - const queryStringParams = parseQueryParms(to.query); - - if (queryStringParams.clienttag) { - store.issConfig.clientTag = queryStringParams.clienttag; - } - } - - 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 && issPageToUse !== issPageValues.BAILOUT_PAGE) { - try { - await runExperiments(issPageToUse); - } catch (error) { - console.error('Failed to run experiments during route navigation.', error); - } - } - // Intercept all navigation if a submitted order exists in storage if (useMainStore().hasSubmittedOrder()) { if (to.query.issPage !== issPageValues.ENTRY_PAGE) { @@ -97,15 +73,31 @@ const routes = [ var routeData = []; - try { - routeData = await GetRouteInfoFromPageName(issPageToUse); - } - catch ( error ) { - window.top.location = '/static/error/index.html'; - } + // Only load the routes if we are not on entry-page (this page is the default route and should always be valid) + if ( issPageToUse !== issPageValues.ENTRY_PAGE) { + try { + routeData = await GetRouteInfoFromPageName(issPageToUse); + } + catch ( error ) { + window.top.location = '/static/error/index.html'; + } - if (routeData[0].name.toLowerCase() === 'error') { - throw new Error('Page not found!'); + if (routeData[0].name.toLowerCase() === 'error') { + throw new Error('Page not found!'); + } + } + else { + try { + // Manually create the entry-page route. + routeData.push({ + path: '/', + name: issPageValues.ENTRY_PAGE, + component: lazyLoadComponent(issPageValues.ENTRY_PAGE) + }); + } + catch ( error ) { + window.top.location = '/static/error/index.html'; + } } // Add our dynamic route. @@ -190,14 +182,29 @@ router.afterEach(async (to, from) => { store.clearSaveSessionPromise(); } - const skipSaveSession = !!router.options.history.state[routerParams.SKIP_SAVE_SESSION]; - if (from.name !== undefined && !skipSaveSession && !store.hasSubmittedOrder()) { - await saveSession({ bailoutOnError: from.name === issPageValues.ENTRY_PAGE}); - } - if (to.query.issPage !== issPageValues.ENTRY_PAGE) { + await analyticsMixin.methods.validateSession(); + + const skipSaveSession = !!router.options.history.state[routerParams.SKIP_SAVE_SESSION]; + if (from.name !== undefined && !skipSaveSession && !store.hasSubmittedOrder()) { + await saveSession({ bailoutOnError: from.name === issPageValues.ENTRY_PAGE}); + } + document.title = routerTitles[to.query.issPage] || 'Safelite Solutions®'; + // Do not run experiments for entry page or the bailout page. + if (to.query.issPage !== issPageValues.BAILOUT_PAGE) { + try { + console.error(`Running experiments for page: ${to.query.issPage}`); + + // Run experiments for page. + await runExperiments(to.query.issPage); + + } catch (error) { + console.error('Failed to run experiments during route navigation.', error); + } + } + // digital consumer logging analyticsMixin.methods.logDigitalConsumer(); diff --git a/src/store/index.js b/src/store/index.js index ad3c7e40..b23f4d47 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -2635,10 +2635,10 @@ export const useMainStore = defineStore({ this.logExperimentIfExists(issPage, experimentUniverses.ISS_FEATURETOGGLE_AREFEES_OVERRIDDEN); }, async initializeSession({ userId, clientTag, siteType, sessionId, userAgent, referrer }) { - //TODO: Add SubType passing ... that is also missing. const payload = { applicationName: applicationConfig.APPLICATION_NAME, - clientTag: clientTag, + clientTag: clientTag, + subType: siteType, userId, deviceId: userId, sessionId, @@ -2946,7 +2946,9 @@ export const useMainStore = defineStore({ async validateClientTag(clientTag) { return globalMethods.callHttpClient({ method: endpoints.ValidateClientTag.method, - endpoint: `${endpoints.ValidateClientTag.url}/${clientTag}` + endpoint: `${endpoints.ValidateClientTag.url}/${clientTag}`, + logApiCall: false, + bailoutOnError: false }); }, @@ -2960,7 +2962,9 @@ export const useMainStore = defineStore({ return await globalMethods.callHttpClient({ method: endpoints.ValidateClientSignature.method, endpoint: endpoints.ValidateClientSignature.url, - payload + payload, + logApiCall: false, + bailoutOnError: false }); }, From 71aa3594123830de96854682fa84a4188985ad64 Mon Sep 17 00:00:00 2001 From: Jeremy-Z Date: Wed, 20 May 2026 15:36:00 -0400 Subject: [PATCH 2/3] Addressed some code review recommendations. --- src/router/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/router/index.js b/src/router/index.js index e0f34881..f6345aa6 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -80,6 +80,7 @@ const routes = [ } catch ( error ) { window.top.location = '/static/error/index.html'; + return null; } if (routeData[0].name.toLowerCase() === 'error') { @@ -97,6 +98,7 @@ const routes = [ } catch ( error ) { window.top.location = '/static/error/index.html'; + return null; } } From 1bb496315668f2d5c462631f3781a31f569d234e Mon Sep 17 00:00:00 2001 From: Jeremy-Z Date: Thu, 21 May 2026 11:12:49 -0400 Subject: [PATCH 3/3] Added access-denied as part of the ignore logging / experiment logic. --- src/router/index.js | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index f6345aa6..1fbe148f 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -74,7 +74,10 @@ const routes = [ var routeData = []; // Only load the routes if we are not on entry-page (this page is the default route and should always be valid) - if ( issPageToUse !== issPageValues.ENTRY_PAGE) { + // or the access-denied page (which is an error page) + const shouldGetRouteInfo = (issPageToUse !== issPageValues.ENTRY_PAGE && issPageToUse !== issPageValues.ACCESS_DENIED); + + if (shouldGetRouteInfo) { try { routeData = await GetRouteInfoFromPageName(issPageToUse); } @@ -89,11 +92,11 @@ const routes = [ } else { try { - // Manually create the entry-page route. + // Manually create the page route. routeData.push({ path: '/', - name: issPageValues.ENTRY_PAGE, - component: lazyLoadComponent(issPageValues.ENTRY_PAGE) + name: issPageToUse, + component: lazyLoadComponent(issPageToUse) }); } catch ( error ) { @@ -184,7 +187,13 @@ router.afterEach(async (to, from) => { store.clearSaveSessionPromise(); } - if (to.query.issPage !== issPageValues.ENTRY_PAGE) { + // Do not run base page logic (GA logging, session logging etc..) on the entry page or access denied page. + const shouldRunPageLogic = (to.query.issPage !== issPageValues.ENTRY_PAGE && to.query.issPage !== issPageValues.ACCESS_DENIED); + + if (shouldRunPageLogic) { + // Do not run experiments for the bailout page. + const shouldRunExperiments = (to.query.issPage !== issPageValues.BAILOUT_PAGE); + await analyticsMixin.methods.validateSession(); const skipSaveSession = !!router.options.history.state[routerParams.SKIP_SAVE_SESSION]; @@ -194,11 +203,8 @@ router.afterEach(async (to, from) => { document.title = routerTitles[to.query.issPage] || 'Safelite Solutions®'; - // Do not run experiments for entry page or the bailout page. - if (to.query.issPage !== issPageValues.BAILOUT_PAGE) { + if (shouldRunExperiments) { try { - console.error(`Running experiments for page: ${to.query.issPage}`); - // Run experiments for page. await runExperiments(to.query.issPage);