This commit is contained in:
Jeremy Zimmerman 2023-02-17 13:23:01 -05:00
parent 42057df157
commit 329a9fbae3
7 changed files with 159 additions and 15 deletions

View file

@ -8,6 +8,7 @@ const applicationConfig = {
SITE_ENTRY_TRIGGER_VALUE: "SelfService",
APPLICATION_ABBREVIATION: "iss",
PAGE_QUERYSTRING: 'issPage',
CLIENTTAG_QUERYSTRING: 'CientTag',
GOOGLE_PLACES_API_KEY: process.env.VUE_APP_GOOGLE_PLACES_API_KEY,
ISS_DEV_CMS_DOMAIN: "https://digitalisscms.dev.safelite.io",
};

View file

@ -4,17 +4,17 @@ export function validateISSClientTag(clientTag) {
const store = useMainStore()
const clientName = store.issConfig.clientName;
store.validateClientTag(clientTag)
.then(
(response) => {
// Success
console.log(response);
},
(error) => {
// Error
console.log("error: " + error);
}
);
return true;
};
return store.validateClientTag(clientTag)
.then(
(response) => {
// Success
//console.log(response);
return response;
},
(error) => {
// Error
console.log("error: " + error);
return null;
}
);
}

View file

@ -0,0 +1,125 @@
<template>
</template>
<script>
// Components
import { useRoute } from 'vue-router';
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
import { settleAllPromises } from "@/helpers/layout-helper";
import { validateISSClientTag } from "@/helpers/clientauth-helper";
import siteHeader from '@/iss-components/site-header/site-header';
import siteSubHeader from '@/iss-components/site-sub-header/site-sub-header';
import siteFooter from "@/iss-components/site-footer/site-footer";
import textBlock from "@/digital-components/text-block/text-block";
// Supporting files
import { useMainStore } from '@/store';
export default {
name: "entry-page",
mixins: [],
data() {
},
setup() {
const mainStore = useMainStore();
mainStore.$reset();
//const resp = validateISSClientTag("8953C31B-165D-4E4E-9827-C90FBF77017B");
//const resp = validateISSClientTag("asdf");
return { mainStore };
},
mounted() {
const mainStore = useMainStore();
mainStore.$reset();
mainStore.issConfig.clientName = "";
this.validateClientTagOnEntry();
},
async beforeRouteEnter(to, from, next)
{
// validate clienttag + signature here?
// Call APIs
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
// Settle promises and get results
const promiseResultMap = [
{
resultKey: "cmsContent",
promise: cmsContentPromise,
},
];
//use resultMap to populate layout content.
let resultMap = await settleAllPromises(promiseResultMap);
next((vm) => {
vm.setCmsContent(resultMap.cmsContent);
});
},
methods:
{
navigateForward() {
this.$router.navigate(
this.navigationScenarios.MOVE_FORWARD_ENTRY_PAGE,
this.$route
);
},
async validateClientTagOnEntry() {
const mainStore = useMainStore();
console.log("Client Name: " + mainStore.issConfig.clientName);
const clientTag = this.$route.query.ClientTag;
if ( !clientTag )
{
}
const resp = await validateISSClientTag(clientTag);
console.log(resp);
if ( resp === null )
{
}
else if ( resp.data.active && resp.data.accountName.length > 0 )
{
this.mainStore.issConfig.clientName = resp.data.accountName;
}
//this.navigateForward();
//this.$router.push({ path: '/?issPage=welcome-page' });
//window.location = "/?issPage=welcome-page";
},
},
computed:{
},
components: {
siteHeader,
siteSubHeader,
siteFooter,
textBlock,
},
}
</script>
<style lang="scss">
</style>

View file

@ -186,7 +186,8 @@
setup() {
const mainStore = useMainStore();
const resp = validateISSClientTag("asdf");
console.log(mainStore.issConfig.clientName);
return { mainStore };
},
async beforeRouteEnter(to, from, next)

View file

@ -1,4 +1,5 @@
export const issPageValues = {
ENTRY_PAGE: "entry-page",
WELCOME_PAGE: "welcome-page",
POLICY_HOLDER_DETAILS: "policy-holder-details",
VEHICLE_MAKE: "vehicle-make",

View file

@ -3,6 +3,9 @@ const navigationScenarios = {
CLICKED_BACK: "CLICKED_BACK",
CLICKED_FORWARD: "CLICKED_FORWARD",
// Entry
MOVE_FORWARD_ENTRY_PAGE: "MOVE_FORWARD_ENTRY_PAGE",
// YMMS
SELECTED_YEAR: "SELECTED_YEAR",
SELECTED_MAKE: "SELECTED_MAKE",

View file

@ -354,6 +354,19 @@ const routingTable = function(store) {
},
],
},
{
issPageValue: issPageValues.ENTRY_PAGE,
maps: [
{
scenario: navigationScenarios.CLICKED_BACK,
destinationIssPageValue: issPageValues.ENTRY_PAGE
},
{
scenario: navigationScenarios.MOVE_FORWARD_ENTRY_PAGE,
destinationIssPageValue: issPageValues.WELCOME_PAGE
},
],
},
{
issPageValue: issPageValues.WELCOME_PAGE,
maps: [