From 31f0734615faf38e50a36cd485871983e9f57f02 Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Thu, 3 Aug 2023 16:51:05 -0400 Subject: [PATCH 1/7] Saw the "Use constants file" NOTE --- src/constants/error-messages.js | 1 - src/layouts/bailout-page/bailout-page.vue | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/constants/error-messages.js b/src/constants/error-messages.js index eb6db7ed..caad0dfb 100644 --- a/src/constants/error-messages.js +++ b/src/constants/error-messages.js @@ -33,7 +33,6 @@ const errorMessages = Object.freeze({ POLICY_NUMBER_REQUIRED: 'Please enter your policy number', PHONE_NUMBER_REQUIRED: 'Please enter phone number', PHONE_NUMBER_FORMAT: 'Please enter your phone number. The format must be ###-###-####', - PHONE_NUMBER_FORMAT_SHORT: 'Please enter a valid phone number', POLICY_ZIP_REQUIRED: 'Please enter your policy ZIP', POLICY_ZIP_FORMAT: 'Please enter a valid ZIP', LOSS_CAUSE_REQUIRED: 'Please enter loss cause', diff --git a/src/layouts/bailout-page/bailout-page.vue b/src/layouts/bailout-page/bailout-page.vue index 59652083..200b73b0 100644 --- a/src/layouts/bailout-page/bailout-page.vue +++ b/src/layouts/bailout-page/bailout-page.vue @@ -111,7 +111,7 @@ export default { rules: { firstName: globalRules.FIRST_NAME_REQUIRED, lastName: globalRules.LAST_NAME_REQUIRED, - phoneNumber: `${globalRules.PHONE_NUMBER_REQUIRED}|${globalRules.PHONE_NUMBER_FORMAT_SHORT}`, + phoneNumber: `${globalRules.PHONE_NUMBER_REQUIRED}|${globalRules.PHONE_NUMBER_FORMAT}`, email: `${globalRules.EMAIL_ADDRESS_REQUIRED}|${globalRules.EMAIL_ADDRESS_FORMAT}` } }; From 7053a0ecf874ef467d5a01bfa96eb59a59f94052 Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Thu, 3 Aug 2023 17:05:17 -0400 Subject: [PATCH 2/7] remove rules --- src/constants/global-rules.js | 1 - src/helpers/global-rule-definer.js | 7 ------- 2 files changed, 8 deletions(-) diff --git a/src/constants/global-rules.js b/src/constants/global-rules.js index 317f05b9..d8c6f406 100644 --- a/src/constants/global-rules.js +++ b/src/constants/global-rules.js @@ -13,7 +13,6 @@ const globalRules = Object.freeze({ EMAIL_ADDRESS_FORMAT: 'email-address-format', PHONE_NUMBER_REQUIRED: 'phone-number-required', PHONE_NUMBER_FORMAT: 'phone-number-format', - PHONE_NUMBER_FORMAT_SHORT: 'phone-number-format-short', OPTION_REQUIRED: 'option-required' }); diff --git a/src/helpers/global-rule-definer.js b/src/helpers/global-rule-definer.js index 5a06dad7..1a844fb2 100644 --- a/src/helpers/global-rule-definer.js +++ b/src/helpers/global-rule-definer.js @@ -45,13 +45,6 @@ function defineGlobalPhoneNumberRules() { errorMessages.PHONE_NUMBER_FORMAT ) ); - defineRule( - globalRules.PHONE_NUMBER_FORMAT_SHORT, - regex( - /^(\([0-9]{3}\)|[0-9]{3}) *[-.]? *[0-9]{3} *[-.]? *[0-9]{4}$/, - errorMessages.PHONE_NUMBER_FORMAT_SHORT - ) - ); } /** From ad92c94cca4f3e1f64412db52d655ead47b516ff Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Mon, 14 Aug 2023 10:33:32 -0400 Subject: [PATCH 3/7] red border update --- .../dropdown-question/dropdown-question.vue | 36 ++++++++----------- .../textbox-question/textbox-question.vue | 5 ++- 2 files changed, 16 insertions(+), 25 deletions(-) diff --git a/src/digital-components/dropdown-question/dropdown-question.vue b/src/digital-components/dropdown-question/dropdown-question.vue index ec892fbe..87b432b5 100644 --- a/src/digital-components/dropdown-question/dropdown-question.vue +++ b/src/digital-components/dropdown-question/dropdown-question.vue @@ -17,22 +17,14 @@ :aria-required="isRequired" :validationRules="validationRules" :placeHolderText="placeHolderText"> - - -
+
{{ errorMessage }}
@@ -65,12 +57,12 @@ export default { let initialValue; switch (typeof modelValue) { - case 'number': - initialValue = modelValue; - break; - default: - initialValue = (modelValue && modelValue.length > 0) ? modelValue : ''; - break; + case 'number': + initialValue = modelValue; + break; + default: + initialValue = modelValue && modelValue.length > 0 ? modelValue : ''; + break; } const fieldOptions = { @@ -79,9 +71,11 @@ export default { initialValue }; - const { errorMessage, handleBlur, handleChange, meta, errors } = useField(props.inputId, + const { errorMessage, handleBlur, handleChange, meta, errors } = useField( + props.inputId, props.validationRules, - fieldOptions); + fieldOptions + ); return { errorMessage, @@ -147,8 +141,6 @@ export default { } .form-select { color: $gray-600; - background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 8.89' xml:space='preserve'%3e%3cpath d='M8 8.89c-.24 0-.46-.09-.63-.26L.26 1.53a.901.901 0 0 1 0-1.27C.43.1.66 0 .9 0s.47.1.64.26L8 6.74 14.47.27c.17-.17.4-.27.64-.27s.47.1.63.27c.17.17.26.4.26.64s-.1.47-.27.63l-7.1 7.09a.86.86 0 0 1-.63.26z' fill='%231474a2'/%3e%3c/svg%3e"); - border: 1px solid $gray-500; border-radius: 0.5rem; min-height: 3rem; &:focus, diff --git a/src/digital-components/textbox-question/textbox-question.vue b/src/digital-components/textbox-question/textbox-question.vue index 3a746000..0de58727 100644 --- a/src/digital-components/textbox-question/textbox-question.vue +++ b/src/digital-components/textbox-question/textbox-question.vue @@ -322,11 +322,10 @@ input[type='date']::-webkit-calendar-picker-indicator { margin-bottom: 0.25rem; } .form-control { - border: 1px solid $gray-500; border-radius: 0.5rem; min-height: 3rem; - max-height: 48px; - padding: 12px 16px; + max-height: 3rem; + padding: 0.75rem 1rem; &::placeholder { color: $gray-500; } From f05ff0ddf616b2f6ef9b52f74843d54bb28767a1 Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Mon, 14 Aug 2023 14:36:11 -0400 Subject: [PATCH 4/7] updates to bailout page use tpa flag sub header router link --- src/helpers/cms-content-helper.js | 161 ++++++++++-------- src/helpers/text-helper.js | 8 + .../site-sub-header/site-sub-header.vue | 32 +++- src/layouts/bailout-page/bailout-page.vue | 2 +- 4 files changed, 124 insertions(+), 79 deletions(-) create mode 100644 src/helpers/text-helper.js diff --git a/src/helpers/cms-content-helper.js b/src/helpers/cms-content-helper.js index 7ac4917b..96a6c375 100644 --- a/src/helpers/cms-content-helper.js +++ b/src/helpers/cms-content-helper.js @@ -5,28 +5,32 @@ export function fetchCmsContentForPage(issPage) { const store = useMainStore(); const { clientName } = store.issConfig; const { accountNumber } = store.issConfig; - const clientOverride = (clientName.length > 0 && accountNumber > 0); + const clientOverride = clientName.length > 0 && accountNumber > 0; - return store.getPageData(issPage) - // Get the base/default page first. - .then((baseResponse) => { - if (!clientOverride) { - // Return the base page if there are no client override. - return processPageData(baseResponse, null); - } - // Else get the client override page. - const pageName = `${issPage}_${clientName.toLowerCase().replace(/ /g, '')}`; - - return store.getPageData(pageName) - .then((clientResponse) => - // Process the client override if it exists. - processPageData(baseResponse, clientResponse), - (error) => { - console.error(error); - // Process the just the base if no client override exists. + return ( + store + .getPageData(issPage) + // Get the base/default page first. + .then((baseResponse) => { + if (!clientOverride) { + // Return the base page if there are no client override. return processPageData(baseResponse, null); - }); - }); + } + // Else get the client override page. + const pageName = `${issPage}_${clientName.toLowerCase().replace(/ /g, '')}`; + + return store.getPageData(pageName).then( + (clientResponse) => + // Process the client override if it exists. + processPageData(baseResponse, clientResponse), + (error) => { + console.error(error); + // Process the just the base if no client override exists. + return processPageData(baseResponse, null); + } + ); + }) + ); } // Support method for processing the page data from the CMS call. @@ -44,7 +48,7 @@ function processPageData(baseResponse, clientResponse) { if (!clientResponse?.data?.Result) { widgets = baseResponse.data.Result; } else { - // Override any base widgets with the client override widgets if found. + // Override any base widgets with the client override widgets if found. baseResponse.data.Result.forEach((baseWidget) => { let found = false; clientResponse.data.Result.forEach((clientWidget) => { @@ -75,9 +79,8 @@ function processPageData(baseResponse, clientResponse) { } widgets.forEach((widget) => { - // Global state value replacement. - const widgetWithReplacements = findAndReplaceGlobalStateValues(widget.Model, - widget.Name); + // Global state value replacement. + const widgetWithReplacements = findAndReplaceGlobalStateValues(widget.Model, widget.Name); // If we already have this widget, push it on the collection if (widgetWithReplacements.Name in pageDataFromCms) { @@ -85,9 +88,7 @@ function processPageData(baseResponse, clientResponse) { return; } - pageDataFromCms[widgetWithReplacements.Name] = [ - widgetWithReplacements.Model - ]; + pageDataFromCms[widgetWithReplacements.Name] = [widgetWithReplacements.Model]; }); Object.keys(pageDataFromCms).forEach((key) => { @@ -108,8 +109,7 @@ function findAndReplaceGlobalStateValues(widgetModel, widgetName) { }; Object.keys(widgetModel).forEach((key) => { - const modelWithReplacements = processWidgetItemForReplacement(widgetModel, - key); + const modelWithReplacements = processWidgetItemForReplacement(widgetModel, key); objWithReplacements.Model[key] = modelWithReplacements; }); @@ -123,9 +123,11 @@ function processWidgetItemForReplacement(widgetModel, key) { // If we have a string, and it needs to be replaced. if (typeof widgetModel[key] === 'string') { if (widgetModel[key].includes('{if:')) { - widgetModel[key] = processIfStatements(widgetModel[key], + widgetModel[key] = processIfStatements( + widgetModel[key], dynamicStrings.GLOBAL_STATE, - getStoreValueFromString); + getStoreValueFromString + ); } if (widgetModel[key].includes(dynamicStrings.MODAL_LINK)) { @@ -141,8 +143,7 @@ function processWidgetItemForReplacement(widgetModel, key) { } // If we have an object. array, etc - if (typeof widgetModel[key] === 'object' - && Object.keys(widgetModel[key]).length) { + if (typeof widgetModel[key] === 'object' && Object.keys(widgetModel[key]).length) { Object.keys(widgetModel[key]).forEach((item) => { processWidgetItemForReplacement(widgetModel[key], item); }); @@ -159,11 +160,13 @@ function mapStringToModal(str) { let linkToReplace = str.substring(startIndex, str.length); linkToReplace = linkToReplace.substring(0, linkToReplace.indexOf('}') + 1); - const params = linkToReplace.substring((dynamicStrings.MODAL_LINK).length + 2, linkToReplace.length - 1); + const params = linkToReplace.substring( + dynamicStrings.MODAL_LINK.length + 2, + linkToReplace.length - 1 + ); const splitParams = params.split(','); - const bodyText - = `${splitParams[1]}`; + const bodyText = `${splitParams[1]}`; let returnVal = str.replace(linkToReplace, bodyText); @@ -178,7 +181,10 @@ function mapStringToLink(str) { let linkToReplace = str.substring(startIndex, str.length); linkToReplace = linkToReplace.substring(0, linkToReplace.indexOf('}') + 1); - const params = linkToReplace.substring((dynamicStrings.EXTERNAL_LINK).length + 2, linkToReplace.length - 1); + const params = linkToReplace.substring( + dynamicStrings.EXTERNAL_LINK.length + 2, + linkToReplace.length - 1 + ); const splitParams = params.split(','); const bodyText = `${splitParams[1]}`; @@ -196,7 +202,9 @@ function mapStringToState(str) { // Pull all matches out of the string. const regexExp = /{([^{}]*?):([^{}]*?)}/g; const regexMatches = [...str.matchAll(regexExp)]; - const globalStateMatches = regexMatches.filter((match) => match[1] === dynamicStrings.GLOBAL_STATE); + const globalStateMatches = regexMatches.filter( + (match) => match[1] === dynamicStrings.GLOBAL_STATE + ); // Our final string value that will be built from the matches. const stringBuilder = ''; @@ -257,14 +265,17 @@ export function processIfStatements(str, ifConditionKeyword, replacePlaceholderC } const ifStatementRegexExpression = getIfStatementRegexExpression(); const ifStatementRegexMatches = [...str.matchAll(ifStatementRegexExpression)]; - const completeIfStatementArray = getAndFlagFirstNonNestedIfStatementWithKeyword(ifStatementRegexMatches, - ifConditionKeyword); - executeIfStatementAndSetProcessedStrings(completeIfStatementArray, - replacePlaceholderCallback); + const completeIfStatementArray = getAndFlagFirstNonNestedIfStatementWithKeyword( + ifStatementRegexMatches, + ifConditionKeyword + ); + executeIfStatementAndSetProcessedStrings(completeIfStatementArray, replacePlaceholderCallback); const reconstructedPostProcessedString = joinProcessedRegexArray(ifStatementRegexMatches); - return processIfStatements(reconstructedPostProcessedString, + return processIfStatements( + reconstructedPostProcessedString, ifConditionKeyword, - replacePlaceholderCallback); + replacePlaceholderCallback + ); } function getAndFlagFirstNonNestedIfStatementWithKeyword(matches, ifConditionKeyword) { @@ -357,38 +368,28 @@ function getIfStatementRegexExpression() { // {if:...} or {else} or {end} const anyLogicOperatorNonCapture = '(?:{(?:end|else|if:.*?)})'; // NOTE: ? syntax stores the captured match like so: match.groups.variableName - const matchStartOfString - = '(?^.+?)' // Match and Capture all characters (lazy), cannot be empty - + '(?=(?:{if))'; // Looks ahead but does not capture {if - const matchIfOperator - = '(?{if:)' // Match & Capture {if: - + '(?.*?):' // Match all chars up to and including next ':' - Capture all chars up to ':' - + '(?.*?)}' // Match all chars up to and including next '}' - Capture all chars up to '}' - + '(?.*?)' // Match and Capture all characters (lazy), can be empty - + `(?=${ - anyLogicOperatorNonCapture - })`; // Looks ahead but does not capture the next logic operator - const matchElseOperator - = '(?{else})' // Match & Capture {else} - + '(?.*?)' // Match & Capture all characters (lazy), can be empty - + `(?=${ - anyLogicOperatorNonCapture - })`; // Looks ahead but does not capture the next logic operator - const matchEndOperator - = '(?{end})' // Match & Capture {end} - + '(?.*?)' // Match & Capture all characters (lazy), can be empty - + `(?=${ - anyLogicOperatorNonCapture - }|$)`; // Looks ahead but does not capture the next logic operator + const matchStartOfString = + '(?^.+?)' + // Match and Capture all characters (lazy), cannot be empty + '(?=(?:{if))'; // Looks ahead but does not capture {if + const matchIfOperator = + '(?{if:)' + // Match & Capture {if: + '(?.*?):' + // Match all chars up to and including next ':' - Capture all chars up to ':' + '(?.*?)}' + // Match all chars up to and including next '}' - Capture all chars up to '}' + '(?.*?)' + // Match and Capture all characters (lazy), can be empty + `(?=${anyLogicOperatorNonCapture})`; // Looks ahead but does not capture the next logic operator + const matchElseOperator = + '(?{else})' + // Match & Capture {else} + '(?.*?)' + // Match & Capture all characters (lazy), can be empty + `(?=${anyLogicOperatorNonCapture})`; // Looks ahead but does not capture the next logic operator + const matchEndOperator = + '(?{end})' + // Match & Capture {end} + '(?.*?)' + // Match & Capture all characters (lazy), can be empty + `(?=${anyLogicOperatorNonCapture}|$)`; // Looks ahead but does not capture the next logic operator // Combine all matching patterns, separated by 'or' pipes - return new RegExp(`${matchStartOfString - }|${ - matchIfOperator - }|${ - matchElseOperator - }|${ - matchEndOperator}`, - 'g'); + return new RegExp( + `${matchStartOfString}|${matchIfOperator}|${matchElseOperator}|${matchEndOperator}`, + 'g' + ); } /// /////////////////////////////////////// @@ -446,6 +447,16 @@ export function getRouterLinkDisplayTextFromCopy(copy) { return copy.split(':')[1].split(',')[1]; } +/** + * Returns a router link as an 'a' tag element + * @returns string + */ +export function getRouterLinkHtmlStringFromCopy(copy) { + return `${getRouterLinkDisplayTextFromCopy(copy)}`; +} + // Copy returned from the CMS that has newlines will return blocks wrapped in //

...

// This function returns an array of each paragraph, works with or without html diff --git a/src/helpers/text-helper.js b/src/helpers/text-helper.js new file mode 100644 index 00000000..e1cd64dd --- /dev/null +++ b/src/helpers/text-helper.js @@ -0,0 +1,8 @@ +/** + * Returns string with inline style tag stripped out + * @returns string + */ +export function stripRteStyle(stringWithStyleTag) { + const regexExp = /[\s*]style="(.*?)"/g; + return stringWithStyleTag.replace(regexExp, ''); +} diff --git a/src/iss-components/site-sub-header/site-sub-header.vue b/src/iss-components/site-sub-header/site-sub-header.vue index b11144dd..39e10588 100644 --- a/src/iss-components/site-sub-header/site-sub-header.vue +++ b/src/iss-components/site-sub-header/site-sub-header.vue @@ -24,6 +24,15 @@