Updating string file name

This commit is contained in:
Max 2022-04-19 14:41:56 -04:00
parent 44e0539068
commit 70775140e6
3 changed files with 14 additions and 13 deletions

View file

@ -1,7 +1,7 @@
const magicStrings = {
const dynamicStrings = {
GLOBAL_STATE: "globalState",
CUSTOM: "custom",
ROUTER_LINK: "routerLink"
};
export { magicStrings };
export { dynamicStrings };

View file

@ -1,6 +1,6 @@
import { storeActions } from "@/constants/store-actions.js";
import store from "@/store";
import { magicStrings } from "../constants/magic-strings";
import { dynamicStrings } from "../constants/dynamic-strings";
export function fetchCmsContentForPage(fmgPage) {
return store
@ -43,7 +43,7 @@ function mapStringToState(str) {
const regexExp = new RegExp("{(.*?):(.*?)}", "g");
const regexMatches = [...str.matchAll(regexExp)];
const globalStateMatches = regexMatches.filter(match => {
return match[1] === magicStrings.GLOBAL_STATE;
return match[1] === dynamicStrings.GLOBAL_STATE;
})
// Our final string value that will be built from the matches.
@ -64,7 +64,7 @@ function mapStringToState(str) {
const stringWithReplacement = str.replace(match[0], storeState);
// If we still have values we need to substitute, call this function again.
if (stringWithReplacement.includes(magicStrings.GLOBAL_STATE)) {
if (stringWithReplacement.includes(dynamicStrings.GLOBAL_STATE)) {
return mapStringToState(stringWithReplacement);
}
@ -100,7 +100,7 @@ function findAndReplaceGlobalStateValues(widgetModel, widgetName) {
function processWidgetItemForReplacement(widgetModel, key) {
// If we have a string, and it needs to be replaced.
if (typeof widgetModel[key] === "string") {
if (widgetModel[key].includes(magicStrings.GLOBAL_STATE)) {
if (widgetModel[key].includes(dynamicStrings.GLOBAL_STATE)) {
widgetModel[key] = mapStringToState(widgetModel[key]);
}
return widgetModel[key];

View file

@ -186,21 +186,24 @@ export default {
this.$refs.funnelFooter.updateButtonText(`Continue with ${vinLookup.data.vin} ${vinLookup.data.vehicle.year} ${vinLookup.data.vehicle.make} ${vinLookup.data.vehicle.model}`);
this.$refs.funnelFooter.removeLoader();
this.vinDoesNotMatchCarId = true;
return;
//return;
}
let vin;
let vehicleInfo;
let glassOptions;
if(this.vinDoesNotMatchCarId) {
vin = vinLookup.data.vin;
vehicleInfo = vinLookup.data.vehicle;
glassOptions = store.dispatch(storeActions.GET_DAMAGE_OPTIONS, { carId: vinLookup.data.vehicle.carId }).data;
} else {
vin = store.getters.vehicle.vin;
vehicleInfo = store.getters.vehicle;
glassOptions = store.getters.damage.glassToReplace;
}
this.updateCustomerInfo(vin, vehicleInfo, zipValidation.data.state);
//this.updateCustomerInfo(vin, vehicleInfo, zipValidation.data.state);
const partsData = await baseMixin.methods.dispatchNonBlockingStoreAction(
this.storeActions.GET_PARTS_OR_QUESTIONS,
@ -212,15 +215,13 @@ export default {
},
false
);
this.navigateForward(partsData);
console.log(partsData)
//this.navigateForward(partsData);
},
navigateForward(partsData){
if(partsData.data.partsOrQuestions[0].partQuestions && partsData.data.partsOrQuestions[0].partQuestions.length > 0){
if(partsData.data){
this.$router.navigateAfterSave(this.navigationScenarios.CONTINUING_WITH_PARTS_QUESTION, this.$route, {}, {}, partsData.data);
return;
} else if((!partsData.data.partsOrQuestions[0].partQuestions || partsData.data.partsOrQuestions[0].partQuestions.length < 1) && partsData.data.partsOrQuestions[0].parts.length > 1) {
this.$router.navigateAfterSave(this.navigationScenarios.CONTINUING_WITH_MULTIPLE_PARTS, this.$route, {}, {}, partsData.data);
return;
} else {
navigateToHeritageFunnel();
return;