commit
2fc636df77
11 changed files with 9786 additions and 5285 deletions
14932
package-lock.json
generated
14932
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -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",
|
||||
};
|
||||
|
|
|
|||
|
|
@ -89,7 +89,11 @@ const endpoints = {
|
|||
},
|
||||
GooglePlaces: {
|
||||
url: "https://maps.googleapis.com/maps/api/js?key={apiKey}&libraries=places"
|
||||
}
|
||||
},
|
||||
ValidateClientTag: {
|
||||
url: "/clientauth/api/v1/clientauth/validateClientTag",
|
||||
method: "GET",
|
||||
},
|
||||
};
|
||||
|
||||
export { endpoints };
|
||||
|
|
|
|||
17
src/helpers/clientauth-helper.js
Normal file
17
src/helpers/clientauth-helper.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { useMainStore } from '@/store';
|
||||
|
||||
export function validateISSClientTag(clientTag) {
|
||||
const store = useMainStore()
|
||||
|
||||
return store.validateClientTag(clientTag)
|
||||
.then(
|
||||
(response) => {
|
||||
// Success
|
||||
return response;
|
||||
},
|
||||
(error) => {
|
||||
// Error
|
||||
return null;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
@ -4,7 +4,8 @@ import { useMainStore } from '@/store';
|
|||
export function fetchCmsContentForPage(issPage) {
|
||||
const store = useMainStore()
|
||||
const clientName = store.issConfig.clientName;
|
||||
const clientOverride = (clientName.length > 0);
|
||||
const accountNumber = store.issConfig.accountNumber;
|
||||
const clientOverride = (clientName.length > 0 && accountNumber > 0);
|
||||
|
||||
return store.getPageData(issPage)
|
||||
.then(
|
||||
|
|
|
|||
75
src/layouts/entry-page/entry-page.vue
Normal file
75
src/layouts/entry-page/entry-page.vue
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
<template>
|
||||
<p id="message" v-show="unauthorized">Unauthorized Access.</p>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// Supporting files
|
||||
import { issPageValues } from "@/router/router-constants/issPage-values";
|
||||
import { validateISSClientTag } from "@/helpers/clientauth-helper";
|
||||
import { useMainStore } from '@/store';
|
||||
|
||||
export default {
|
||||
name: "entry-page",
|
||||
mixins: [],
|
||||
data() {
|
||||
return {
|
||||
unauthorized: false,
|
||||
}
|
||||
},
|
||||
setup() {
|
||||
const mainStore = useMainStore();
|
||||
mainStore.resetISSConfigState();
|
||||
return { mainStore };
|
||||
},
|
||||
mounted() {
|
||||
this.validateClientTagOnEntry();
|
||||
},
|
||||
methods:
|
||||
{
|
||||
navigateForward() {
|
||||
this.$router.navigate(
|
||||
this.navigationScenarios.MOVE_FORWARD_ENTRY_PAGE,
|
||||
this.$route
|
||||
);
|
||||
},
|
||||
async validateClientTagOnEntry() {
|
||||
|
||||
const mainStore = useMainStore();
|
||||
const clientTag = this.$route.query.ClientTag;
|
||||
const clientTagPresent = !!clientTag;
|
||||
let authorized = false;
|
||||
|
||||
if ( clientTagPresent )
|
||||
{
|
||||
const resp = await validateISSClientTag(clientTag);
|
||||
|
||||
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;
|
||||
authorized = true;
|
||||
}
|
||||
}
|
||||
|
||||
this.unauthorized = !authorized;
|
||||
|
||||
if ( authorized )
|
||||
{
|
||||
// Forced full location redirect here. We do not want the entry page as part of the router/flow/path history.
|
||||
window.location = "/?issPage=" + issPageValues.WELCOME_PAGE;
|
||||
}
|
||||
},
|
||||
},
|
||||
computed:{
|
||||
},
|
||||
components: {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
#message {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -184,6 +184,10 @@
|
|||
},
|
||||
setup() {
|
||||
const mainStore = useMainStore();
|
||||
|
||||
// Set order account number from the issConfig.
|
||||
mainStore.order.accountNumber = mainStore.issConfig.accountNumber;
|
||||
|
||||
return { mainStore };
|
||||
},
|
||||
async beforeRouteEnter(to, from, next)
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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: [
|
||||
|
|
|
|||
|
|
@ -100,8 +100,8 @@ const getDefaultState = () => {
|
|||
},
|
||||
issConfig: {
|
||||
clientName: "",
|
||||
accountNumber: 0,
|
||||
styleSheet: "",
|
||||
clientTag: "",
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
@ -480,6 +480,13 @@ export const useMainStore = defineStore({
|
|||
this.order.vehicle.registration.lastName = null;
|
||||
},
|
||||
|
||||
resetISSConfigState()
|
||||
{
|
||||
this.issConfig.clientName = "";
|
||||
this.issConfig.accountNumber = 0;
|
||||
this.issConfig.styleSheet = "";
|
||||
},
|
||||
|
||||
updateSupportingItems(partsData) {
|
||||
this.order.lineItems.supportingItems = partsData;
|
||||
},
|
||||
|
|
@ -915,6 +922,13 @@ export const useMainStore = defineStore({
|
|||
});
|
||||
},
|
||||
|
||||
async validateClientTag(clientTag) {
|
||||
return await globalMethods.callHttpClient({
|
||||
methods: endpoints.ValidateClientTag.method,
|
||||
endpoint: `${endpoints.ValidateClientTag.url}/${clientTag}`,
|
||||
});
|
||||
},
|
||||
|
||||
saveServiceLocation(serviceLocationInfo) {
|
||||
this.updateServiceLocation(serviceLocationInfo);
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue