Merge pull request #409 from Safelite/refactor/preferdefault3

Another prefer-default update
This commit is contained in:
Jeremy-Z 2023-08-11 11:52:21 -04:00 committed by GitHub
commit 8af52ad2b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 73 additions and 68 deletions

View file

@ -1,10 +1,10 @@
const dynamicStrings = {
const dynamicStrings = Object.freeze({
GLOBAL_STATE: 'globalState',
CUSTOM: 'custom',
ROUTER_LINK: 'routerLink:',
MODAL_LINK: 'modalLink',
TEXT_LINK: 'textLink',
EXTERNAL_LINK: 'externalLink'
};
});
export { dynamicStrings };
export default dynamicStrings;

View file

@ -2,7 +2,7 @@
// Example: {custom:glassName}, each key in the array is the value after custom:, like 'glassname'
// Please use lowercase only so that we don't have to worry about case sensitivity.
const customMappings = {
const customMappings = Object.freeze({
formattedglassname: [
{ key: 'Windshield Single', transformedValue: 'windshield' },
{ key: 'Windshield Driver', transformedValue: 'driver side split windshield' },
@ -20,12 +20,12 @@ const customMappings = {
{ key: 'Passenger Quarter', transformedValue: 'passenger side quarter panel' },
{ key: 'Passenger SlideDoor', transformedValue: 'passenger side sliding door' }
]
};
});
// Gets an instance of a string where the dynamic portion of the text {custom:KeyName}
// is replaced by a value from the above map.
// If the value isn't found, return the original dynamic string without replacement
export function getCustomTransformValue(dynamicString, key) {
const getCustomTransformValue = (dynamicString, key) => {
// Get array key from the dynamic string
const regexExp = /{(.*?):(.*?)}/g;
const matches = [...dynamicString.matchAll(regexExp)];
@ -53,4 +53,6 @@ export function getCustomTransformValue(dynamicString, key) {
const finalString = dynamicString.replace(`{custom:${arrayKey}}`, mapObject.transformedValue);
return finalString;
}
};
export default getCustomTransformValue;

View file

@ -1,9 +1,9 @@
const endorsementOptions = {
const endorsementOptions = Object.freeze({
EDUCATOR: 'Educator',
OEM_APPROVED: 'OEM Approved',
FULL_GLASS: 'Full Glass Coverage',
PARKING_GUARD: 'Parking Guard',
REPAIR_WAIVED: 'Repair Waived'
};
});
export { endorsementOptions };
export default endorsementOptions;

View file

@ -1,4 +1,4 @@
const errorMessages = {
const errorMessages = Object.freeze({
DAMAGE_LOCATION_REQUIRED: 'Please select damage location',
DAMAGE_SIDE_REQUIRED: 'Please select vehicle side',
DRIVER_SIDE_OPTIONS_REQUIRED: 'Please select window',
@ -46,6 +46,6 @@ const errorMessages = {
MAKE_REQUIRED: 'Please select your vehicle make',
MODEL_REQUIRED: 'Please select your vehicle model',
STYLE_REQUIRED: 'Please select your vehicle style'
};
});
export { errorMessages };
export default errorMessages;

View file

@ -1,17 +1,17 @@
const globalEvents = {
const globalEvents = Object.freeze({
Categories: {
GLOBAL_ALERT: 'GLOBAL_ALERT'
},
SubCategories: {
PAGE_NOT_FOUND: 'PAGE_NOT_FOUND'
}
};
});
const globalEventTypes = {
const globalEventTypes = Object.freeze({
Success: 'alert-success',
Warning: 'alert-warning',
Info: 'alert-info',
Danger: 'alert-danger'
};
});
export { globalEvents, globalEventTypes };

View file

@ -1,14 +1,14 @@
const experimentUniverses = {
const experimentUniverses = Object.freeze({
ISS_FUNNEL: 'ISSFunnel'
};
});
const experimentSettings = {
const experimentSettings = Object.freeze({
GOOGLE_CUSTOM_DIMENSION_INDEX: 'Google Custom Dimension Index'
};
});
const experimentTriggers = {
const experimentTriggers = Object.freeze({
SITE_ENTRY: 'SiteEntry',
PAGE_ENTRY: 'PageEntry'
};
});
export { experimentUniverses, experimentSettings, experimentTriggers };

View file

@ -7,7 +7,7 @@
/**
* @summary Contains all the globally defined rules.
*/
const globalRules = {
const globalRules = Object.freeze({
POLICYHOLDER_FIRST_NAME_REQUIRED: 'policyholder-first-name-required',
POLICYHOLDER_LAST_NAME_REQUIRED: 'policyholder-last-name-required',
FIRST_NAME_REQUIRED: 'first-name-required',
@ -18,6 +18,6 @@ const globalRules = {
PHONE_NUMBER_FORMAT: 'phone-number-format',
PHONE_NUMBER_FORMAT_SHORT: 'phone-number-format-short',
OPTION_REQUIRED: 'option-required'
};
});
export default globalRules;

View file

@ -1,8 +1,8 @@
const partTypeStrings = {
const partTypeStrings = Object.freeze({
FRONT_WIPER: 'FRONT WIPER',
REAR_WIPER: 'REAR WIPER',
RAIN_DEFENSE: 'RAIN DEFENSE',
RECALIBRATION: 'RECALIBRATION'
};
});
export { partTypeStrings };
export default partTypeStrings;

View file

@ -1,5 +1,5 @@
const queryStrings = {
const queryStrings = Object.freeze({
ISS_PAGE: 'issPage'
};
});
export { queryStrings };
export default queryStrings;

View file

@ -1,4 +1,4 @@
export const states = {
const states = Object.freeze({
AL: 'Alabama',
AK: 'Alaska',
AZ: 'Arizona',
@ -50,4 +50,6 @@ export const states = {
WV: 'West Virginia',
WI: 'Wisconsin',
WY: 'Wyoming'
};
});
export default states;

View file

@ -1,4 +1,4 @@
import { dynamicStrings } from '@/constants/dynamic-strings';
import dynamicStrings from '@/constants/dynamic-strings';
import { useMainStore } from '@/store';
export function fetchCmsContentForPage(issPage) {

View file

@ -1,5 +1,5 @@
import { defineRule } from 'vee-validate';
import { errorMessages } from '@/constants/error-messages';
import errorMessages from '@/constants/error-messages';
import globalRules from '@/constants/global-rules';
import { required, regex } from '@/helpers/validation-rules';

View file

@ -10,7 +10,7 @@ import {
setCookieProperties
} from '@/helpers/cookie-helper';
import { GaActions } from '@/constants/analytics';
import { queryStrings } from '@/constants/query-strings';
import queryStrings from '@/constants/query-strings';
import { useMainStore } from '@/store';
import { mapStores } from 'pinia';
import { createTestingPinia } from '@pinia/testing';

View file

@ -95,8 +95,8 @@ import alert from '@/ux-components/alert/alert';
import applicationConfig from '@/constants/application-config.js';
import { defineRule } from 'vee-validate';
import { required, regex } from '@/helpers/validation-rules';
import { errorMessages } from '@/constants/error-messages';
import { states } from '@/constants/states';
import errorMessages from '@/constants/error-messages';
import states from '@/constants/states';
import { endpoints } from '@/constants/endpoints';
// DEFINE VALIDATION RULES

View file

@ -68,7 +68,7 @@
import { settleAllPromises } from '@/helpers/layout-helper';
import { useMainStore } from '@/store';
import { issPageValues } from '@/router/router-constants/issPage-values';
import { errorMessages } from '@/constants/error-messages';
import errorMessages from '@/constants/error-messages';
import { required } from '@/helpers/validation-rules';
import { Form, defineRule } from 'vee-validate';
import { isGlassAvailableForCarId } from '@/helpers/damage-helper';

View file

@ -80,12 +80,12 @@
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
import { settleAllPromises } from '@/helpers/layout-helper';
import { useMainStore } from '@/store';
import { errorMessages } from '@/constants/error-messages';
import errorMessages from '@/constants/error-messages';
import { required } from '@/helpers/validation-rules';
import { defineRule, Form } from 'vee-validate';
import { getDamageString, isGlassAvailableForCarId } from '@/helpers/damage-helper.js';
import { routerParams } from '@/router/router-params.js';
import { states } from '@/constants/states';
import states from '@/constants/states';
// Import Component
import baseFormMixin from '@/mixins/base-form-mixin';

View file

@ -7,7 +7,7 @@ import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
import baseMixin from '@/mixins/base-mixin';
import { getRandomString, getRandomInt } from '@/helpers/data-generation';
import { endorsementOptions } from '@/constants/endorsement-options';
import endorsementOptions from '@/constants/endorsement-options';
import { createTestingPinia } from '@pinia/testing';
import { issPageValues } from '@/router/router-constants/issPage-values';
import { vehicleSelectionOptions } from '@/constants/vehicle-selection-options';

View file

@ -51,7 +51,7 @@ import { Form } from 'vee-validate';
import BaseFormMixin from '@/mixins/base-form-mixin.js';
import { issPageValues } from '@/router/router-constants/issPage-values.js';
import { vehicleSelectionOptions } from '@/constants/vehicle-selection-options.js';
import { endorsementOptions } from '@/constants/endorsement-options.js';
import endorsementOptions from '@/constants/endorsement-options.js';
import globalRules from '@/constants/global-rules.js';
import { useMainStore } from '@/store/index.js';

View file

@ -53,7 +53,7 @@
// Import Supporting Files
import { fetchCmsContentForPage, setupModalLinks } from '@/helpers/cms-content-helper';
import { settleAllPromises } from '@/helpers/layout-helper';
import { errorMessages } from '@/constants/error-messages';
import errorMessages from '@/constants/error-messages';
import buttonQuestion from '@/digital-components/button-question/button-question';
import { issPageValues } from '@/router/router-constants/issPage-values';

View file

@ -23,7 +23,7 @@
<script>
import modal from '@/digital-components/modal/modal';
import { states } from '@/constants/states';
import states from '@/constants/states';
export default {
name: 'content-group-modal',

View file

@ -21,7 +21,7 @@
<script>
import modal from '@/digital-components/modal/modal';
import { processIfStatements } from '@/helpers/cms-content-helper';
import { states } from '@/constants/states';
import states from '@/constants/states';
export default {
name: 'content-group-modal',

View file

@ -2,7 +2,7 @@
import { render } from '@testing-library/vue';
import userEvent from '@testing-library/user-event';
import { issPageValues } from '@/router/router-constants/issPage-values';
import { queryStrings } from '@/constants/query-strings';
import queryStrings from '@/constants/query-strings';
import { GaActions } from '@/constants/analytics';
import tpaRecalToggle from './tpa-recal-toggle';

View file

@ -60,7 +60,7 @@
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
import { settleAllPromises } from '@/helpers/layout-helper';
import { required } from '@/helpers/validation-rules';
import { errorMessages } from '@/constants/error-messages';
import errorMessages from '@/constants/error-messages';
import buttonQuestion from '@/digital-components/button-question/button-question';
import { useMainStore } from '@/store';
import { getServiceabilityDetails, getZipCodeData } from '@/helpers/service-location-helper';

View file

@ -18,7 +18,7 @@ import textboxQuestion from '@/digital-components/textbox-question/textbox-quest
// Supporting Files
import { defineRule } from 'vee-validate';
import { required, regex } from '@/helpers/validation-rules';
import { errorMessages } from '@/constants/error-messages';
import errorMessages from '@/constants/error-messages';
// Define Validation Rules
defineRule('zip-required', required(errorMessages.SERVICE_ZIP_REQUIRED));

View file

@ -15,9 +15,10 @@ import buttonQuestion from '@/digital-components/button-question/button-question
import { processIfStatements } from '@/helpers/cms-content-helper';
import damageLocationsSelected from '@/constants/damage-locations-selected';
import servicePackageRadio from '@/layouts/service-packages/service-package-question/service-package-radio/service-package-radio';
import { partTypeStrings } from '@/constants/part-type-strings';
import partTypeStrings from '@/constants/part-type-strings';
import { useMainStore } from '@/store';
import { allGlassPartsAndItemsHavePrices } from '@/layouts/service-packages/service-package-helper/service-package-helper';
const glassLocations = damageLocationsSelected;
const packageNames = {

View file

@ -16,7 +16,7 @@
import buttonQuestion from '@/digital-components/button-question/button-question';
import { defineRule } from 'vee-validate';
import { required } from '@/helpers/validation-rules';
import { errorMessages } from '@/constants/error-messages';
import errorMessages from '@/constants/error-messages';
// DEFINE VALIDATION RULES
defineRule('damage-location-required', required(errorMessages.DAMAGE_LOCATION_REQUIRED));

View file

@ -46,7 +46,7 @@ import buttonQuestion from '@/digital-components/button-question/button-question
import replaceOptionsQuestion from '@/layouts/vehicle-damage/replace-options-question/replace-options-question';
import { defineRule } from 'vee-validate';
import { required } from '@/helpers/validation-rules';
import { errorMessages } from '@/constants/error-messages';
import errorMessages from '@/constants/error-messages';
import damageLocationsSelected from '@/constants/damage-locations-selected';
// DEFINE VALIDATION RULES

View file

@ -88,7 +88,7 @@ import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
import { settleAllPromises } from '@/helpers/layout-helper';
import { Form, defineRule } from 'vee-validate';
import { required } from '@/helpers/validation-rules';
import { errorMessages } from '@/constants/error-messages';
import errorMessages from '@/constants/error-messages';
import damageLocationsCms from '@/constants/damage-locations-cms.js';
import damageLocationsSelected from '@/constants/damage-locations-selected.js';
import { useMainStore } from '@/store';

View file

@ -48,7 +48,7 @@ import alert from '@/ux-components/alert/alert';
import { defineRule } from 'vee-validate';
import { required } from '@/helpers/validation-rules';
import { errorMessages } from '@/constants/error-messages';
import errorMessages from '@/constants/error-messages';
import damageLocationsSelected from '@/constants/damage-locations-selected.js';
// DEFINE VALIDATION RULES

View file

@ -1,14 +1,14 @@
/* eslint-env jest */
import { mount } from '@vue/test-utils';
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
import { queryStrings } from '@/constants/query-strings';
import queryStrings from '@/constants/query-strings';
import { GaActions } from '@/constants/analytics';
import { vinLookupMethodSelections } from '@/constants/vin-lookup-methods';
import { useMainStore } from '@/store';
import { createTestingPinia } from '@pinia/testing';
import { mapStores } from 'pinia';
import { defineRule } from 'vee-validate';
import { errorMessages } from '@/constants/error-messages';
import errorMessages from '@/constants/error-messages';
import globalRules from '@/constants/global-rules';
import { required } from '@/helpers/validation-rules';
import VehicleLookup from '@/layouts/vehicle-lookup/vehicle-lookup';

View file

@ -47,10 +47,10 @@ import buttonQuestion from '@/digital-components/button-question/button-question
// Supporting files
import { getTintImage } from '@/constants/tint-mapper';
import { getCustomTransformValue } from '@/constants/dynamictext-mapper';
import getCustomTransformValue from '@/constants/dynamictext-mapper';
import { defineRule } from 'vee-validate';
import { required } from '@/helpers/validation-rules';
import { errorMessages } from '@/constants/error-messages';
import errorMessages from '@/constants/error-messages';
export default {
name: 'glass-part-question',

View file

@ -89,7 +89,7 @@ import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
import { settleAllPromises } from '@/helpers/layout-helper';
import { Form, defineRule } from 'vee-validate';
import { required } from '@/helpers/validation-rules';
import { errorMessages } from '@/constants/error-messages';
import errorMessages from '@/constants/error-messages';
// define validation rules
defineRule('year-required', required(errorMessages.YEAR_REQUIRED));

View file

@ -3,7 +3,7 @@ import { render } from '@testing-library/vue';
import userEvent from '@testing-library/user-event';
import '@testing-library/jest-dom';
import { issPageValues } from '@/router/router-constants/issPage-values';
import { queryStrings } from '@/constants/query-strings';
import queryStrings from '@/constants/query-strings';
import { GaActions } from '@/constants/analytics';
import VinLocationInformationComponent from '@/layouts/vin-lookup/vin-location-information/vin-location-information';

View file

@ -4,9 +4,9 @@ import { flushPromises } from '@vue/test-utils';
import { render, waitFor } from '@testing-library/vue';
import { createTestingPinia } from '@pinia/testing';
import userEvent from '@testing-library/user-event';
import { errorMessages } from '@/constants/error-messages';
import errorMessages from '@/constants/error-messages';
import { issPageValues } from '@/router/router-constants/issPage-values';
import { queryStrings } from '@/constants/query-strings';
import queryStrings from '@/constants/query-strings';
import { GaActions } from '@/constants/analytics';
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
import { routerParams } from '@/router/router-params';

View file

@ -13,7 +13,7 @@
// Import Other Supporting File(s)
import { defineRule } from 'vee-validate';
import { regex, required } from '@/helpers/validation-rules';
import { errorMessages } from '@/constants/error-messages';
import errorMessages from '@/constants/error-messages';
// Import Component(s)
import textboxQuestion from '@/digital-components/textbox-question/textbox-question';

View file

@ -169,10 +169,10 @@ import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
import { settleAllPromises } from '@/helpers/layout-helper';
import { Form, defineRule } from 'vee-validate';
import { required, regex } from '@/helpers/validation-rules';
import { errorMessages } from '@/constants/error-messages';
import errorMessages from '@/constants/error-messages';
import BaseFormMixin from '@/mixins/base-form-mixin.js';
import { useMainStore } from '@/store';
import { states } from '@/constants/states';
import states from '@/constants/states';
import globalRules from '@/constants/global-rules';
// define validation rules

View file

@ -4,7 +4,7 @@ import {
getSessionIdValue,
getSessionKeyValue
} from '@/helpers/cookie-helper';
import { queryStrings } from '@/constants/query-strings';
import queryStrings from '@/constants/query-strings';
import { experimentSettings } from '@/constants/experiments';
import {
analyticsPageEvents,

View file

@ -2,8 +2,8 @@ import { mapStores } from 'pinia';
import { useMainStore } from '@/store';
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
import { vehicleCategories } from '@/constants/vehicle-categories.js';
import { queryStrings } from '@/constants/query-strings';
import { dynamicStrings } from '@/constants/dynamic-strings';
import queryStrings from '@/constants/query-strings';
import dynamicStrings from '@/constants/dynamic-strings';
import { routerParams } from '@/router/router-constants/router-params';
export default {