INSR-8562: Fix initialization to properly account for PIA disabled
This commit is contained in:
parent
883d1980dc
commit
00dacdbbb8
1 changed files with 7 additions and 14 deletions
|
|
@ -178,6 +178,7 @@ 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 pageData = useMainStore().pageData(to.query.issPage);
|
||||||
|
|
||||||
const promiseResultMap = [
|
const promiseResultMap = [
|
||||||
{
|
{
|
||||||
|
|
@ -192,7 +193,7 @@ export default {
|
||||||
|
|
||||||
next((vm) => {
|
next((vm) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
vm.initializeComponent();
|
vm.initializeComponent(pageData);
|
||||||
vm.updateFooterButtonText(vm.customCallToActionButtonCopy);
|
vm.updateFooterButtonText(vm.customCallToActionButtonCopy);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -382,26 +383,21 @@ export default {
|
||||||
&& customerReqs
|
&& customerReqs
|
||||||
&& contactInfoReqs);
|
&& contactInfoReqs);
|
||||||
},
|
},
|
||||||
initializeComponent() {
|
initializeComponent(pageData) {
|
||||||
const paymentMethodFromStore = this.getPaymentMethodFromStore();
|
if (pageData) {
|
||||||
// SMS Opt In defaults to 'no', but we don't actually want to use it if the user hasn't saved data form this page yet
|
this.smsOptIn = pageData.smsOptIn;
|
||||||
if (paymentMethodFromStore) {
|
|
||||||
this.smsOptIn = this.getSMSOptInFromStore();
|
|
||||||
}
|
}
|
||||||
this.smsPhoneNumber = this.getSMSPhoneFromStore();
|
this.smsPhoneNumber = this.getSMSPhoneFromStore();
|
||||||
},
|
|
||||||
getPaymentMethodFromStore() {
|
|
||||||
if (this.isPayInAdvanceDisabled) {
|
if (this.isPayInAdvanceDisabled) {
|
||||||
return paymentMethods.PAY_AT_TIME_OF_SERVICE;
|
this.paymentMethod = paymentMethods.PAY_AT_TIME_OF_SERVICE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return useMainStore().order.payment.paymentMethod;
|
|
||||||
},
|
},
|
||||||
updateFooterButtonText(newValue) {
|
updateFooterButtonText(newValue) {
|
||||||
this.$refs.siteFooter.updateButtonText(newValue);
|
this.$refs.siteFooter.updateButtonText(newValue);
|
||||||
},
|
},
|
||||||
async forwardButtonAction() {
|
async forwardButtonAction() {
|
||||||
this.mainStore.savePaymentMethodChoice(this.paymentMethod);
|
this.mainStore.savePaymentMethodChoice(this.paymentMethod);
|
||||||
|
this.savePageDataToStore(issPageValues.PAYMENT_METHOD, { smsOptIn: this.smsOptIn });
|
||||||
if (!this.hideSMSOptIn) {
|
if (!this.hideSMSOptIn) {
|
||||||
const requestTextUpdates = this.smsOptIn === 'Yes';
|
const requestTextUpdates = this.smsOptIn === 'Yes';
|
||||||
this.mainStore.updateContactInfo({ requestTextUpdates });
|
this.mainStore.updateContactInfo({ requestTextUpdates });
|
||||||
|
|
@ -439,9 +435,6 @@ export default {
|
||||||
this.$route
|
this.$route
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
getSMSOptInFromStore() {
|
|
||||||
return this.mainStore.contactInfo.requestTextUpdates ? 'Yes' : 'No';
|
|
||||||
},
|
|
||||||
getSMSPhoneFromStore() {
|
getSMSPhoneFromStore() {
|
||||||
return this.mainStore.contactInfo.alternativePhone ?? this.mainStore.contactInfo.servicePhone;
|
return this.mainStore.contactInfo.alternativePhone ?? this.mainStore.contactInfo.servicePhone;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue