Merge pull request #560 from Safelite/feature/SSR-1105

Feature/ssr 1105
This commit is contained in:
katiekroell 2024-02-26 16:32:52 -05:00 committed by GitHub
commit 1d9b7f88f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 29 additions and 7 deletions

View file

@ -99,6 +99,10 @@ const endpoints = Object.freeze({
url: '/vehicle/api/v1/vehicle/lookup', url: '/vehicle/api/v1/vehicle/lookup',
method: 'GET' method: 'GET'
}, },
GetAccountInfo: {
url: '/account/api/v1/account/',
method: 'GET'
},
LogExperimentExposureIfAssigned: { LogExperimentExposureIfAssigned: {
url: '/experiments/api/v1/experiments/log-exposure', url: '/experiments/api/v1/experiments/log-exposure',
method: 'POST' method: 'POST'

View file

@ -99,13 +99,19 @@ export default {
async beforeRouteEnter(to, from, next) { async beforeRouteEnter(to, from, next) {
// Call APIs // Call APIs
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage); const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
const accountInfoPromise = useMainStore().getCarrierAccountInfo();
// Settle promises and get results // Settle promises and get results
const promiseResultMap = [ const promiseResultMap = [
{ {
resultKey: 'cmsContent', resultKey: 'cmsContent',
promise: cmsContentPromise promise: cmsContentPromise
}]; },
// use resultMap to populate layout content. {
resultKey: 'accountInfo',
promise: accountInfoPromise
}
];
// use resultMap to populate layout content.
const resultMap = await settleAllPromises(promiseResultMap); const resultMap = await settleAllPromises(promiseResultMap);
next((vm) => { next((vm) => {
vm.setCmsContent(resultMap.cmsContent); vm.setCmsContent(resultMap.cmsContent);
@ -161,15 +167,14 @@ export default {
isVerified() { isVerified() {
return useMainStore().order.payment.insuranceCoverage.isVerified; return useMainStore().order.payment.insuranceCoverage.isVerified;
}, },
// TODO: Replace with actual carrier number when account service is ready
carrierPhoneNumber() {
return '800-000-0000';
},
carrierName() { carrierName() {
return this.mainStore.issConfig.clientName; return this.mainStore.issConfig.clientName;
}, },
carrierUrl() { carrierUrl() {
return this.mainStore.issConfig.successReturnURL; return this.mainStore.issConfig.successReturnURL;
},
carrierPhoneNumber() {
return this.toDisplayPhoneNumber(useMainStore().order.carrierPhoneNumber);
} }
}, },
mounted() { mounted() {

View file

@ -175,7 +175,8 @@ const getDefaultState = () => ({
eon: null, eon: null,
workOrderNumber: null, workOrderNumber: null,
originalDeductible: null, originalDeductible: null,
currentDeductible: null currentDeductible: null,
carrierPhoneNumber: null
}, },
applicationUser: { applicationUser: {
experiments: [], experiments: [],
@ -925,6 +926,18 @@ export const useMainStore = defineStore({
}); });
}, },
getCarrierAccountInfo() {
return new Promise((resolve, reject) => {
globalMethods.callHttpClient({
method: endpoints.GetAccountInfo.method,
endpoint: endpoints.GetAccountInfo.url + this.issConfig.parentAccountNumber
}).then((response) => {
this.order.carrierPhoneNumber = response.data.phoneNumber;
return resolve(response.data);
}).catch((error) => reject(error));
});
},
async getSupportingItems() { async getSupportingItems() {
const glassPartsArray = this.order.lineItems.glassParts ?? []; const glassPartsArray = this.order.lineItems.glassParts ?? [];
const { carId } = this.order.vehicle; const { carId } = this.order.vehicle;