This is just a long string.This is just a long string.This is just a long string.This is just a long string.This is just a long string.This is just a long string.This is just a long string.
";
},
- splitAlertCopyForLink(){
- // Splits content when brackets are found in text so that text can be looped through and router-link can be injected when needed
- return this.alertCopy.split(/{(.*?)}/g);
+ splitAlertCopyForParagraphTag(){
+ // splits the alertCopy on
(with or without attributes) and
+ // filter removes empty strings that are a result of string.split with regex
+ return this.alertCopy.split(/(?:
)|(?:<\/p>)/g).filter(paragraph => paragraph !== "");
+ },
+ },
+ methods: {
+ splitParagraphForRouterLink(paragraph){
+ // splits paragraph on { ... } such as {routerlink: ...}
+ return paragraph.split(/{(.*?)}/g);
}
},
};
From 4ec5217daeb8c56370c5af8f2f7962690de3c1a8 Mon Sep 17 00:00:00 2001
From: Scott Kiener
Date: Fri, 13 May 2022 10:44:43 -0400
Subject: [PATCH 2/2] CSR-408 | Refactor and Fix Unrelated Bugs
Bugs fixed:
-Compile time error regarding logic done in "computed"
-Forward button now updates correctly on license-plate-lookup when VIN is changed.
Refactored alert.vue to make it more readable
---
src/layouts/vin-lookup/vin-lookup.vue | 16 +++++++++++---
src/ux-components/alert/alert.vue | 30 ++++++++++++++++++++-------
2 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue
index f6c3b5ecb..27be92781 100644
--- a/src/layouts/vin-lookup/vin-lookup.vue
+++ b/src/layouts/vin-lookup/vin-lookup.vue
@@ -192,12 +192,17 @@ export default {
vinPopulatedOnPageLoad: this.getVinFromStore()?.length > 0,
};
},
+ watch: {
+ vin() {
+ this.$refs.funnelFooter.updateButtonText(
+ this.getCmsContent("FunnelFooterWidget", "ForwardButtonText")
+ );
+ }
+ },
computed: {
perfectMatchNewVinAlert() {
const isVinPerfectMatch = this.vinPopulatedOnPageLoad && this.vin === this.getVinFromStore();
- if (isVinPerfectMatch) {
- this.isCarIdDifferent = false;
- }
+ this.updateIsCarIdDifferent(isVinPerfectMatch);
return isVinPerfectMatch;
},
MatchedDifferentVehicleAlertHeader(){
@@ -269,6 +274,11 @@ export default {
);
});
},
+ updateIsCarIdDifferent(isVinPerfectMatch){
+ if (isVinPerfectMatch) {
+ this.isCarIdDifferent = false;
+ }
+ },
backButtonAction() {
if (store.getters.vehicle.vin) {
this.$router.navigate(this.navigationScenarios.CLICKED_BACK_WITH_VIN, this.$route);
diff --git a/src/ux-components/alert/alert.vue b/src/ux-components/alert/alert.vue
index 8d04d2972..faff0861c 100644
--- a/src/ux-components/alert/alert.vue
+++ b/src/ux-components/alert/alert.vue
@@ -6,12 +6,12 @@
>
This is just a long string. {routerLink:estimate,provide your VIN} This is just a long string.
How Did you Even manage this?
This is just a long string.This is just a long string.This is just a long string.This is just a long string.This is just a long string.This is just a long string.This is just a long string.
";
},
splitAlertCopyForParagraphTag(){
// splits the alertCopy on
(with or without attributes) and
@@ -68,9 +67,24 @@ export default {
},
},
methods: {
- splitParagraphForRouterLink(paragraph){
- // splits paragraph on { ... } such as {routerlink: ...}
- return paragraph.split(/{(.*?)}/g);
+ doesCopyContainRouterLink(copy) {
+ return copy.includes('routerLink:');
+ },
+ splitCopyForRouterLink(copy){
+ // splits copy on { ... } such as {routerlink: ...}
+ return copy.split(/{(.*?)}/g);
+ },
+ getRouterLinkRouteFromCopy(copy){
+ // sample input: {routerLink:estimate,provide your VIN}
+ // first split would return 'estimate,provide your VIN'
+ // second split would return 'estimate'
+ return copy.split(':')[1].split(',')[0];
+ },
+ getRouterLinkDisplayTextFromCopy(copy){
+ // sample input: {routerLink:estimate,provide your VIN}
+ // first split would return 'estimate,provide your VIN'
+ // second split would return 'provide your VIN'
+ return copy.split(':')[1].split(',')[1];
}
},
};