@@ -203,7 +203,8 @@ export default {
mixins: [BaseFormMixin],
data() {
return {
- welcomePageModel: this.getWelcomePageModelFromStore()
+ welcomePageModel: this.getWelcomePageModelFromStore(),
+ vehiclesFound: [],
};
},
setup() {
@@ -238,15 +239,79 @@ export default {
{
async forwardButtonAction() {
this.mainStore.updatePolicyData(this.welcomePageModel);
+
+ //call coverage policy lookup if isCoverageEnabled flag enabled
+ if (this.isCoverageEnabled) {
+ const policyLookupResponse = useMainStore().getCoveragePolicyInfo({
+ accountNumber:this.mainStore.order.accountNumber.toString(),
+ policyNumber:this.mainStore.order.policy.policyNumber,
+ dateOfLoss:this.mainStore.order.policy.dateOfLoss
+ });
+
+ // Settle promises and get results
+ const promisePolicyLookupResultMap = [
+ {
+ resultKey: "policyLookupResponse",
+ promise: policyLookupResponse,
+ }
+ ];
+
+ const policyLookupResultMap = await settleAllPromises(promisePolicyLookupResultMap);
+ const policyInfo = policyLookupResultMap.policyLookupResponse;
+
+ // if policy lookup fails, navigate directly to policy-holder-details page
+ if (!policyInfo) {
+ this.navigateForward();
+ }
+
+ const policy = policyInfo.policies?.[0];
+ if (policy) {
+ //populate policy holder details from policy lookup
+ this.mainStore.order.customer.address.streetAddress = policy.insureds?.[0]?.address;
+ this.mainStore.order.customer.address.city = policy.insureds?.[0]?.city;
+ this.mainStore.order.customer.address.state = policy.insureds?.[0]?.state;
+ this.mainStore.order.customer.address.zipCode = policy.insureds?.[0]?.zipCode;
+ this.mainStore.order.customer.firstName = policy.insureds?.[0]?.firstName;
+ this.mainStore.order.customer.lastName = policy.insureds?.[0]?.lastName;
+
+ //populate vehicles
+ this.vehiclesFound = policy.vehicles;
+ }
+ return this.navigateForward(policy);
+ }
return this.navigateForward();
},
- navigateForward() {
- this.$router.navigate(
- this.navigationScenarios.CLICKED_FORWARD,
- this.$route
- );
+ navigateForward(policy) {
+ if (policy) {
+ if (this.vehiclesFound) {
+ // if policy lookup is successful and vehicles are found, navigate to policy-vehicles page
+ this.$router.navigate(
+ this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
+ this.$route,
+ {},
+ {},
+ this.vehiclesFound
+ );
+ }
+ else {
+ // if policy lookup is successful, but no vehicles are associated with the policy
+ // navigate to vehicle-selection page (manual entry)
+ this.$router.navigate(
+ this.navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES,
+ this.$route
+ );
+ }
+ }
+ else {
+ // if policy lookup is unsuccessful, navigate to policy-holder-details page
+ this.$router.navigate(
+ this.navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
+ this.$route
+ );
+ }
},
+
getWelcomePageModelFromStore() {
return {
policyNumber: this.mainStore.order.policy.policyNumber,
@@ -265,7 +330,7 @@ export default {
computed:{
DamageCauseOptions() {
const damageCauseAnswers = this.getCmsContent("DamageCauseQuestion", "Answers");
- const damageCauseAnswersObj ={};
+ const damageCauseAnswersObj = {};
if(damageCauseAnswers)
{
for (let answer of Object.values(damageCauseAnswers)) {
@@ -276,24 +341,22 @@ export default {
}
return damageCauseAnswersObj;
},
- DamageGlassOnlyOptions()
- {
+ DamageGlassOnlyOptions() {
return this.getCmsContent("GlassOnlyQuestion", "Answers");
},
- DamageGlassOnlyQuestion()
- {
+ DamageGlassOnlyQuestion() {
return this.getCmsContent("GlassOnlyQuestion", "QuestionText");
},
- displayDamageCityQuestion(){
+ displayDamageCityQuestion() {
return !!this.getCmsContent("DamageCityQuestion","QuestionText");
},
- displayDamageStateQuestion(){
+ displayDamageStateQuestion() {
return !!this.getCmsContent("DamageStateQuestion","QuestionText");
},
- displayGlassOnlyQuestion(){
+ displayGlassOnlyQuestion() {
return !!this.getCmsContent("GlassOnlyQuestion","QuestionText");
},
- displayPolicyZip(){
+ displayPolicyZip() {
if (this.mainStore.issConfig.isAuthenticated &&
!!this.mainStore.issConfig.disabledFields.policyZipCode) {
return false;
@@ -305,10 +368,12 @@ export default {
getStates() {
return states;
},
- isPolicyHolderEnabled()
- {
+ isPolicyHolderEnabled() {
return !!this.mainStore.issConfig.disabledFields.policyNumber;
- }
+ },
+ isCoverageEnabled() {
+ return this.mainStore.issConfig.isCoverageEnabled;
+ },
},
components: {
siteHeader,
diff --git a/src/router/router-constants/navigation-scenarios.js b/src/router/router-constants/navigation-scenarios.js
index b2fb1fa4..7c9e90da 100644
--- a/src/router/router-constants/navigation-scenarios.js
+++ b/src/router/router-constants/navigation-scenarios.js
@@ -6,6 +6,11 @@ const navigationScenarios = {
// Entry
MOVE_FORWARD_ENTRY_PAGE: "MOVE_FORWARD_ENTRY_PAGE",
+ // Welcome
+ CLICKED_FORWARD_POLICY_UNVERIFIED: "CLICKED_FORWARD_POLICY_UNVERIFIED",
+ CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES: "CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES",
+ CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES: "CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES",
+
// YMMS
SELECTED_YEAR: "SELECTED_YEAR",
SELECTED_MAKE: "SELECTED_MAKE",
@@ -51,6 +56,7 @@ const navigationScenarios = {
CLICKED_FORWARD_WITH_SAFELITE: "CLICKED_FORWARD_WITH_SAFELITE",
CLICKED_FORWARD_WITH_TPA_ENABLED: "CLICKED_FORWARD_WITH_TPA_ENABLED",
CLICKED_FORWARD_WITH_TPA_DISABLED: "CLICKED_FORWARD_WITH_TPA_DISABLED",
+ CLICKED_FORWARD_WITH_POLICY_AND_VEHICLES: "CLICKED_FORWARD_WITH_POLICY_AND_VEHICLES",
//Bailout
CLICKED_FORWARD_WITH_BAILOUT: "CLICKED_FORWARD_WITH_BAILOUT",
diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js
index 082c9e53..b2aba7a7 100644
--- a/src/router/router-constants/routing-table.js
+++ b/src/router/router-constants/routing-table.js
@@ -394,7 +394,19 @@ const routingTable = function(store) {
{
scenario: navigationScenarios.CLICKED_FORWARD,
destinationIssPageValue: issPageValues.POLICY_HOLDER_DETAILS
- }
+ },
+ {
+ scenario: navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
+ destinationIssPageValue: issPageValues.POLICY_HOLDER_DETAILS
+ },
+ {
+ scenario: navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_NO_VEHICLES,
+ destinationIssPageValue: issPageValues.VEHICLE_SELECTION
+ },
+ {
+ scenario: navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED_WITH_VEHICLES,
+ destinationIssPageValue: issPageValues.POLICY_VEHICLES
+ }
]
},
{
@@ -406,12 +418,12 @@ const routingTable = function(store) {
},
{
scenario: navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
- destinationIssPageValue: issPageValues.VEHICLE_YEAR
+ destinationIssPageValue: issPageValues.VEHICLE_SELECTION
},
{
scenario: navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED,
destinationIssPageValue: issPageValues.POLICY_VEHICLES
- }
+ },
]
},
{