commit
2145be049e
3 changed files with 134 additions and 17 deletions
|
|
@ -34,7 +34,14 @@
|
|||
},
|
||||
async validateClientTagOnEntry() {
|
||||
|
||||
const clientTag = this.$route.query.ClientTag;
|
||||
// Dump the query string parameters into an array. Remove casing on the key for easy compare.
|
||||
let queryStringParams = [];
|
||||
for ( let param in this.$route.query)
|
||||
{
|
||||
queryStringParams[param.toLowerCase()] = this.$route.query[param];
|
||||
}
|
||||
|
||||
const clientTag = queryStringParams["clienttag"];
|
||||
const clientTagPresent = !!clientTag;
|
||||
let authorized = false;
|
||||
|
||||
|
|
@ -44,10 +51,15 @@
|
|||
|
||||
if ( resp?.data.active && resp?.data.accountName.length > 0 )
|
||||
{
|
||||
this.mainStore.issConfig.clientName = resp.data.accountName;
|
||||
this.mainStore.issConfig.accountNumber = resp.data.accountNumber;
|
||||
this.mainStore.issConfig.styleSheet = resp.data.styleSheet;
|
||||
this.populateISSConfigValues(resp.data);
|
||||
|
||||
authorized = true;
|
||||
|
||||
if ( resp.data.parameters?.length > 0 )
|
||||
{
|
||||
const finalParams = this.combineClientParameters(resp.data.parameters, queryStringParams);
|
||||
this.populateStoreItemsFromParams(finalParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -59,6 +71,96 @@
|
|||
window.location = "/?issPage=" + issPageValues.WELCOME_PAGE;
|
||||
}
|
||||
},
|
||||
populateISSConfigValues(data)
|
||||
{
|
||||
this.mainStore.issConfig.clientName = data.accountName;
|
||||
this.mainStore.issConfig.accountNumber = data.accountNumber;
|
||||
this.mainStore.issConfig.styleSheet = data.styleSheet;
|
||||
|
||||
try
|
||||
{
|
||||
const clientFlags = JSON.parse(data.clientFlags);
|
||||
|
||||
if ( clientFlags.TPAEnabled )
|
||||
{
|
||||
this.mainStore.issConfig.enableTPAFlow = true;
|
||||
}
|
||||
|
||||
if ( clientFlags.clientDisplayName != null )
|
||||
{
|
||||
this.mainStore.issConfig.clientDisplayName = clientFlags.clientDisplayName;
|
||||
}
|
||||
}
|
||||
catch ( e )
|
||||
{
|
||||
console.error("Error parsing client flags: " + e);
|
||||
}
|
||||
},
|
||||
combineClientParameters(configParams, queryStringParams)
|
||||
{
|
||||
let finalParams = [];
|
||||
|
||||
try
|
||||
{
|
||||
const clientParams = JSON.parse(configParams);
|
||||
|
||||
for ( let cparam in clientParams)
|
||||
{
|
||||
let cname = clientParams[cparam].toLowerCase();
|
||||
|
||||
for ( let qsparam in queryStringParams)
|
||||
{
|
||||
let qsname = qsparam.toLowerCase();
|
||||
|
||||
if ( cname === qsname )
|
||||
{
|
||||
finalParams[cname] = queryStringParams[cname];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ( e )
|
||||
{
|
||||
console.error("Error combining client parameters: " + e);
|
||||
}
|
||||
|
||||
return finalParams;
|
||||
},
|
||||
populateStoreItemsFromParams(params) {
|
||||
|
||||
// Populate store items from parameters.
|
||||
for ( let param in params)
|
||||
{
|
||||
let name = param.toLowerCase();
|
||||
let value = params[param];
|
||||
|
||||
switch (name)
|
||||
{
|
||||
case "policynumber":
|
||||
this.mainStore.order.policy.policyNumber = value;
|
||||
break;
|
||||
|
||||
case "lossdate":
|
||||
// NOTE: May need some date parsing logic in here depending on client.
|
||||
this.mainStore.order.policy.dateOfLoss = value;
|
||||
break;
|
||||
|
||||
case "returnurl":
|
||||
this.mainStore.iisConfig.returnURL = value;
|
||||
break;
|
||||
|
||||
case "returnurl2":
|
||||
this.mainStore.iisConfig.returnURL2 = value;
|
||||
break;
|
||||
|
||||
// Not stored
|
||||
case "timestamp":
|
||||
case "token":
|
||||
case "signature":
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
computed:{
|
||||
},
|
||||
|
|
|
|||
|
|
@ -23,15 +23,19 @@ const routes = [
|
|||
async beforeEnter(to, from, next) {
|
||||
try {
|
||||
to.query.issPage = !to.query.issPage ? issPageValues.WELCOME_PAGE : to.query.issPage;
|
||||
|
||||
if (analyticsMixin.methods.noSession()) {
|
||||
await analyticsMixin.methods.initSession();
|
||||
} else {
|
||||
updateSessionIdCookie();
|
||||
|
||||
// Do not run these for the main entry page - as it is not part of the user flow.
|
||||
if ( to.query.issPage != issPageValues.ENTRY_PAGE )
|
||||
{
|
||||
if (analyticsMixin.methods.noSession()) {
|
||||
await analyticsMixin.methods.initSession();
|
||||
} else {
|
||||
updateSessionIdCookie();
|
||||
}
|
||||
|
||||
await runExperiments(to.query.issPage);
|
||||
}
|
||||
|
||||
await runExperiments(to.query.issPage);
|
||||
|
||||
|
||||
// Process ISS cookie.
|
||||
updateOrCreateISSCookie();
|
||||
|
||||
|
|
@ -78,11 +82,14 @@ router.afterEach((to, from) => {
|
|||
// Update lastPageVisited in the store
|
||||
store.updateLastPageVisited(to.name);
|
||||
|
||||
// Push page view to GA
|
||||
analyticsMixin.methods.pushPageViewToGA();
|
||||
if ( to.query.issPage != issPageValues.ENTRY_PAGE )
|
||||
{
|
||||
// Push page view to GA
|
||||
analyticsMixin.methods.pushPageViewToGA();
|
||||
|
||||
// Push experiments to Data Layer
|
||||
analyticsMixin.methods.pushExperimentsToDataLayer();
|
||||
// Push experiments to Data Layer
|
||||
analyticsMixin.methods.pushExperimentsToDataLayer();
|
||||
}
|
||||
});
|
||||
|
||||
// Get route information by page name.
|
||||
|
|
|
|||
|
|
@ -99,8 +99,12 @@ const getDefaultState = () => {
|
|||
},
|
||||
issConfig: {
|
||||
clientName: "Generic Insurance", // this is the default and will be overriden by the client's name
|
||||
clientDisplayName: "Generic Insurance",
|
||||
styleSheet: "",
|
||||
accountNumber: 0,
|
||||
enableTPAFlow: false,
|
||||
returnURL: null,
|
||||
returnURL2: null,
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
@ -601,9 +605,13 @@ export const useMainStore = defineStore({
|
|||
|
||||
resetISSConfigState()
|
||||
{
|
||||
this.issConfig.clientName = "";
|
||||
this.issConfig.clientName = "Generic Insurance";
|
||||
this.issConfig.clientDisplayName = "Generic Insurance";
|
||||
this.issConfig.accountNumber = 0;
|
||||
this.issConfig.styleSheet = "";
|
||||
this.issConfig.enableTPAFlow = false;
|
||||
this.issConfig.returnURL = null;
|
||||
this.issConfig.returnURL2 = null;
|
||||
},
|
||||
|
||||
updateVehicleYear(year) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue