Hide/display fields based on the authentication of client

SSR-334
This commit is contained in:
Jethe 2023-04-20 14:53:58 +05:30
parent 4df7578879
commit bbcb61b6f6
4 changed files with 6 additions and 23 deletions

View file

@ -13,12 +13,10 @@ export function fetchCmsContentForPage(issPage) {
(baseResponse) => { (baseResponse) => {
if ( !clientOverride ) if ( !clientOverride )
{ {
setClientTag(clientName,accountNumber);
// Return the base page if there are no client override. // Return the base page if there are no client override.
return processPageData(baseResponse, null); return processPageData(baseResponse, null);
} }
else { else {
setClientTag(clientName,accountNumber);
// Else get the client override page. // Else get the client override page.
const pageName = issPage + "_" + clientName.toLowerCase().replace(/ /g, ""); const pageName = issPage + "_" + clientName.toLowerCase().replace(/ /g, "");
@ -116,17 +114,6 @@ function processPageData(baseResponse, clientResponse) {
}); });
return pageDataFromCms; return pageDataFromCms;
}
//ClientTag function to identify essential or advance flow
function setClientTag(clientName,accountNumber)
{
const storeState = useMainStore();
if(clientName !="Generic Insurance" && accountNumber){
storeState.issConfig.flowType = "Advanced Flow";
}
if(clientName =="Generic Insurance" && accountNumber==0){
storeState.issConfig.flowType = "Essential Flow";
}
} }
// Parent function for processWidgetItemForReplacement. This will loop through the parent // Parent function for processWidgetItemForReplacement. This will loop through the parent
// object and pass any objects that need additional processing to the processWidgetItemForReplacement function. // object and pass any objects that need additional processing to the processWidgetItemForReplacement function.

View file

@ -35,7 +35,6 @@ describe("welcome-page.vue", () => {
const glassOnlyDamage = wrapper.findComponent({ ref: "glassOnlyDamage" }); const glassOnlyDamage = wrapper.findComponent({ ref: "glassOnlyDamage" });
const phoneNumber = wrapper.findComponent({ ref: "phoneNumber" }); const phoneNumber = wrapper.findComponent({ ref: "phoneNumber" });
const email = wrapper.findComponent({ ref: "email" }); const email = wrapper.findComponent({ ref: "email" });
const policyZip = wrapper.findComponent({ ref: "policyZip" });
// Assert // Assert
@ -47,7 +46,6 @@ describe("welcome-page.vue", () => {
expect(glassOnlyDamage.exists()).toBe(false); expect(glassOnlyDamage.exists()).toBe(false);
expect(phoneNumber.exists()).toBe(true); expect(phoneNumber.exists()).toBe(true);
expect(email.exists()).toBe(true); expect(email.exists()).toBe(true);
expect(policyZip.exists()).toBe(false);
}); });
}); });

View file

@ -17,16 +17,13 @@
validationRules="policy-number-required" /> validationRules="policy-number-required" />
</div> </div>
</div> </div>
<div class="row mt-4 px-3"> <div class="row mt-4 px-3" v-if="this.displayPolicyZip">
<div class="col"> <div class="col">
<textboxQuestion <textboxQuestion
inputId="policyZipCode" inputId="policyZipCode"
cmsWidgetName="PolicyZipQuestion" cmsWidgetName="PolicyZipQuestion"
v-model="welcomePageModel.policyZip"
isRequired isRequired
ref="policyZip" ref="policyZip" />
v-if="this.displayPolicyZip"
validationRules="policy-zip-required|policy-zip-format" />
</div> </div>
</div> </div>
<div class="row mt-4 px-3"> <div class="row mt-4 px-3">
@ -349,7 +346,10 @@ export default {
return !!this.getCmsContent("GlassOnlyQuestion","QuestionText"); return !!this.getCmsContent("GlassOnlyQuestion","QuestionText");
}, },
displayPolicyZip(){ displayPolicyZip(){
if(this.mainStore.issConfig.flowType=="Essential Flow"){ if(this.mainStore.issConfig.isAuthenticated){
return false;
}
else{
return true; return true;
} }
} }

View file

@ -107,7 +107,6 @@ const getDefaultState = () => {
enableTPAFlow: false, // Indicates if the TPA flow is supported for this client. enableTPAFlow: false, // Indicates if the TPA flow is supported for this client.
returnURL: null, returnURL: null,
returnURL2: null, returnURL2: null,
flowType:"",
} }
}; };
}; };
@ -618,7 +617,6 @@ export const useMainStore = defineStore({
this.issConfig.enableTPAFlow = false; this.issConfig.enableTPAFlow = false;
this.issConfig.returnURL = null; this.issConfig.returnURL = null;
this.issConfig.returnURL2 = null; this.issConfig.returnURL2 = null;
this.issConfig.flowType="";
}, },
updateVehicleYear(year) { updateVehicleYear(year) {