Merge branch 'develop' into feature/digital/SSR-639

This commit is contained in:
Katie Kroell 2023-08-15 14:04:10 -04:00
commit b1bb5b3588
72 changed files with 935 additions and 486 deletions

View file

@ -4,11 +4,12 @@ module.exports = {
jest: true
},
parserOptions: {
ecmaVersion: 14
ecmaVersion: 'latest'
},
extends: [
'eslint-config-airbnb-base',
'plugin:vue/vue3-recommended'
'plugin:vue/vue3-recommended',
'plugin:jsdoc/recommended'
],
rules: {
'linebreak-style': 'off',
@ -38,7 +39,7 @@ module.exports = {
svg: 'always',
math: 'always'
}],
'import/extensions': ['error', 'always', { vue: 'never', js: 'ignorePackages' }]
'import/extensions': ['error', 'always', { js: 'ignorePackages' }]
},
settings: {
'import/resolver': {

View file

@ -88,7 +88,12 @@ stages:
indexDeployVariables:
__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__: $(__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__)
__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__: $(__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__)
cfDistributionId: $(cfDistributionId)
- template: templates/digital/invalidate-cloudfront-cache.yml@AzureDevOps
parameters:
awsCliContainer: awscli
distributionId: $(cfDistributionId)
paths: /*
awsProfile: $(devDeploymentProfile)
# Test Build/Deploy
- stage: Test
@ -132,6 +137,12 @@ stages:
indexDeployVariables:
__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__: $(__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__)
__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__: $(__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__)
- template: templates/digital/invalidate-cloudfront-cache.yml@AzureDevOps
parameters:
awsCliContainer: awscli
distributionId: $(cfDistributionId)
paths: /*
awsProfile: $(sysDeploymentProfile)
# QA Build/Deploy
- stage: QA
@ -184,7 +195,7 @@ stages:
# Prod Build/Deploy
- stage: Prod
condition: succeeded('Qa')
condition: succeeded('QA')
variables:
- group: ISS-Prod
jobs:

View file

@ -1,26 +1,26 @@
module.exports = {
verbose: true,
coverageReporters: ["html", "text", "cobertura"],
reporters: ["default", "jest-junit"],
testResultsProcessor: "jest-junit",
preset: "@vue/cli-plugin-unit-jest",
transform: { "^.+\\.vue$": "@vue/vue3-jest" },
moduleFileExtensions: ["js", "vue"],
moduleNameMapper: {
axios: 'axios/dist/browser/axios.cjs'
},
collectCoverageFrom: [
"src/**/*.{js,vue}",
"!src/main.js",
"!src/constants/*.js",
"!src/router/**/*.js",
"!src/helpers/unit-test-helper.js"
verbose: true,
coverageReporters: ['html', 'text', 'cobertura'],
reporters: ['default', 'jest-junit'],
testResultsProcessor: 'jest-junit',
preset: '@vue/cli-plugin-unit-jest',
transform: { '^.+\\.vue$': '@vue/vue3-jest' },
moduleFileExtensions: ['js', 'vue'],
moduleNameMapper: {
axios: 'axios/dist/browser/axios.cjs'
},
collectCoverageFrom: [
'src/**/*.{js,vue}',
'!src/main.js',
'!src/constants/*.js',
'!src/router/**/*.js',
'!src/helpers/unit-test-helper.js'
// END
], // ! means exclude from coverage.
testMatch: ["**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"],
coverageThreshold: {
// global: {
// statements: 80,
// },
},
], // ! means exclude from coverage.
testMatch: ['**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)'],
coverageThreshold: {
// global: {
// statements: 80,
// },
}
};

888
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -32,6 +32,8 @@
"@testing-library/jest-dom": "5.16.5",
"@testing-library/user-event": "14.4.3",
"@testing-library/vue": "6.6.1",
"@vitejs/plugin-vue": "4.2.3",
"@vitest/coverage-v8": "^0.34.1",
"@vue/cli-plugin-babel": "^5.0.8",
"@vue/cli-plugin-router": "~5.0.0",
"@vue/cli-plugin-unit-jest": "~5.0.0",
@ -44,12 +46,15 @@
"eslint-config-airbnb-base": "15.0.0",
"eslint-import-resolver-alias": "1.1.2",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-jsdoc": "^46.4.3",
"eslint-plugin-vue": "^9.15.1",
"jest": "^27.0.5",
"jest-junit": "^13.0.0",
"jsdoc": "^4.0.2",
"jsdom": "^22.1.0",
"sass": "^1.32.7",
"sass-loader": "^12.0.0",
"vite": "^4.4.6",
"vitest": "^0.33.0",
"volar-service-vetur": "latest"
}

View file

@ -1,3 +1,8 @@
/**
* @module applicationConfig
* @author T-Wrecks Team
* @copyright Safelite
*/
const applicationConfig = {
CURRENT_ENVIRONMENT: process.env.VUE_APP_CURRENT_ENVIRONMENT, // "Localhost", "Dev", "QA", and "Prod"
CONSUMER_CF_DISTRO: process.env.VUE_APP_CONSUMER_CF_DISTRO,

View file

@ -1,5 +1,11 @@
import applicationConfig from '@/constants/application-config.js';
/**
* @module cookieNames
* @requires applicationConfig
* @author T-Wrecks Team
* @copyright Safelite
*/
const cookieNames = {
ISS_SESSION_INFO: `ISSSessionInfo-${applicationConfig.CURRENT_ENVIRONMENT}`,

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,9 @@
const errorMessages = {
/**
* @module errorMessages
* @author T-Wrecks Team
* @copyright Safelite
*/
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 +51,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

@ -1,13 +1,10 @@
/**
* @file global-rules.js
* @module globalRules
* @summary Contains all the globally defined rules.
* @author MB
* @copyright Safelite
*/
/**
* @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 +15,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,9 @@
export const states = {
/**
* @module states
* @author T-Wrecks Team
* @copyright Safelite
*/
const states = Object.freeze({
AL: 'Alabama',
AK: 'Alaska',
AZ: 'Arizona',
@ -50,4 +55,6 @@ export const states = {
WV: 'West Virginia',
WI: 'Wisconsin',
WY: 'Wyoming'
};
});
export default states;

View file

@ -1,7 +1,7 @@
// TintMap with array keys by location, lowercase to avoid as much string mismatching as possible.
// Src assumes you have a @/assets/img/tints/, making the final value @/assets/img/tints/{Src} in the markup.
// See vehicle-parts for implementation example.
const tintMap = {
const tintMap = Object.freeze({
other: [
// Blue Shade
{ name: 'blue tint, blue shade', src: 'Glass-BlueShade-BlueTint.svg' },
@ -71,23 +71,19 @@ const tintMap = {
// No shade or tint
{ name: 'clear', src: 'Windshield-NoShade-NoTint.svg' }
]
};
});
// Gets the tint image source string given the glass location, and the tint description (like 'Green Tint')
// Use lowered strings here to try to avoid mismatch. Returns an empty string if array key doesn't exist.
// Returns undefined if no items are found.
export function getTintImage(glassLocation, colorString) {
const getTintImage = (glassLocation, colorString) => {
// Windshield glass has special images, all other glass uses the same though.
if (glassLocation.toLowerCase() !== 'windshield') {
glassLocation = 'other';
}
if (tintMap[glassLocation.toLowerCase()] === undefined) {
const glassLoc = (glassLocation.toLowerCase() !== 'windshield') ? 'other' : 'windshield';
if (tintMap[glassLoc] === undefined) {
return '';
}
const tintImageSource = tintMap[glassLocation.toLowerCase()]
.find((item) => item.name.toLowerCase() === colorString.toLowerCase());
return tintMap[glassLoc].find((item) => item.name.toLowerCase() === colorString.toLowerCase());
};
return tintImageSource;
}
export default getTintImage;

View file

@ -1,4 +1,4 @@
const vehicleCategories = {
const vehicleCategories = Object.freeze({
CAR: 'CAR',
TRUCK: 'TRUCK',
VAN: 'VAN',
@ -6,6 +6,6 @@ const vehicleCategories = {
SUV: 'SUV',
MOTORHOME: 'MOTOR HOME',
SEMI: 'SEMI'
};
});
export { vehicleCategories };
export default vehicleCategories;

View file

@ -2,4 +2,4 @@ const vehicleSelectionOptions = Object.freeze({
VEHICLE_NOT_LISTED: 'Vehicle not listed'
});
export { vehicleSelectionOptions };
export default vehicleSelectionOptions;

View file

@ -4,4 +4,4 @@ const vinLookupMethodSelections = Object.freeze({
HOMEADDRESS: 'HomeAddress'
});
export { vinLookupMethodSelections };
export default vinLookupMethodSelections;

View file

@ -30,7 +30,7 @@ import {
handleButtonComponentFocus,
handleInputComponentBlur
} from '@/helpers/button-question-focus-helper';
import { inputButtonProps } from '@/digital-components/base-input-button/button-functionality-props';
import inputButtonProps from '@/digital-components/base-input-button/button-functionality-props';
export default {
name: 'base-input-button',

View file

@ -1,4 +1,4 @@
export const inputButtonProps = {
const inputButtonProps = {
value: {
type: [String, Number],
required: true
@ -36,3 +36,5 @@ export const inputButtonProps = {
},
suppressError: Boolean
};
export default inputButtonProps;

View file

@ -1,7 +1,18 @@
/* eslint-disable max-len */
import { shallowMount } from '@vue/test-utils';
import buttonQuestion from '@/digital-components/button-question/button-question';
import buttonQuestion from '@/digital-components/button-question/button-question.vue';
import { getMountOptions } from '@/helpers/unit-test-helper.js';
/** @ignore */
function setupMocks(mountOptionsMockData = {}) {
const defaultMountOptions = { route: { query: { issPage: 'page-name' } } };
const baseMountOptions
= getMountOptions(Object.assign(defaultMountOptions, mountOptionsMockData));
const allMountOptions = Object.assign(defaultMountOptions, baseMountOptions);
return allMountOptions;
}
describe('buttonQuestion.vue', () => {
it('Fieldset classes should contain row if button type is listCard', () => {
// Act
@ -1009,12 +1020,3 @@ describe('buttonQuestion.vue', () => {
});
});
});
function setupMocks(mountOptionsMockData = {}) {
const defaultMountOptions = { route: { query: { issPage: 'page-name' } } };
const baseMountOptions
= getMountOptions(Object.assign(defaultMountOptions, mountOptionsMockData));
const allMountOptions = Object.assign(defaultMountOptions, baseMountOptions);
return allMountOptions;
}

View file

@ -76,12 +76,12 @@
</template>
<script>
import listButton from '@/ux-components/list-button/list-button';
import listButtonHorizontal from '@/ux-components/list-button-horizontal/list-button-horizontal';
import listCard from '@/ux-components/list-card/list-card';
import radio from '@/ux-components/radio/radio';
import listButton from '@/ux-components/list-button/list-button.vue';
import listButtonHorizontal from '@/ux-components/list-button-horizontal/list-button-horizontal.vue';
import listCard from '@/ux-components/list-card/list-card.vue';
import radio from '@/ux-components/radio/radio.vue';
import { ErrorMessage } from 'vee-validate';
import providerPrefRadio from '@/layouts/provider-preference/provider-pref-radio/provider-pref-radio';
import providerPrefRadio from '@/layouts/provider-preference/provider-pref-radio/provider-pref-radio.vue';
export default {
name: 'button-question',

View file

@ -1,5 +1,5 @@
import { shallowMount } from '@vue/test-utils';
import dropdownQuestion from './dropdown-question';
import dropdownQuestion from '@/digital-components/dropdown-question/dropdown-question.vue';
// Mock CMS content
const questionText = 'Question Text';

View file

@ -111,12 +111,12 @@ export default {
const words = this.questionText.toString().split(/[ ]+/);
words.forEach((word) => {
const position = 1;
word = [
const newWord = [
word.toString().slice(0, position),
noBreakChar,
word.toString().slice(position)
].join('');
questionText += `${word} `;
questionText += `${newWord} `;
});
questionText = questionText.trimEnd();

View file

@ -2,7 +2,7 @@ import { shallowMount } from '@vue/test-utils';
import crypto from 'crypto';
import { useForm } from 'vee-validate';
import { Modal } from 'bootstrap';
import modal from './modal';
import modal from '@/digital-components/modal/modal.vue';
jest.mock('vee-validate', () => ({
useForm: jest.fn()

View file

@ -34,7 +34,7 @@
loaderColor="white"
:buttonText="footerButtonText"
:class="(isButtonDisabled || isFooterButtonDisabled) && 'form-test-invalid'"
@click-event="validateAndEmit" />
@clickEvent="validateAndEmit" />
</div>
</div>
</div>
@ -42,7 +42,7 @@
</template>
<script>
import modalButtonMain from '@/ux-components/modal-button-main/modal-button-main';
import modalButtonMain from '@/ux-components/modal-button-main/modal-button-main.vue';
import { Modal } from 'bootstrap';
import { useForm } from 'vee-validate';
@ -69,6 +69,7 @@ export default {
const { meta, validate, resetForm } = useForm();
// TODO: Correct Duplicate key 'modalId' issue.
return {
modalId,
meta,

View file

@ -1,8 +1,42 @@
import { shallowMount } from '@vue/test-utils';
import questionChain from '@/digital-components/question-chain/question-chain';
import questionChain from '@/digital-components/question-chain/question-chain.vue';
import { getMountOptions } from '@/helpers/unit-test-helper.js';
import { nextTick } from 'vue';
/** @ignore */
function setupMocks({
questionDataProp = [
{
questionSequence: 1,
questionText: 'Does only your center sliding piece need to be replaced?',
answers: [
{
answerResult: 'DB09410',
answerText: 'Yes',
nextQuestionSequence: null
},
{
answerResult: 'DB10840',
answerText: 'No',
nextQuestionSequence: null
}
]
}
]
}) {
Element.prototype.scrollIntoView = jest.fn();
const mountOptions = getMountOptions({});
mountOptions.propsData = {
questionData: questionDataProp
};
mountOptions.attachTo = document.body;
const wrapper = shallowMount(questionChain, mountOptions);
return { wrapper };
}
describe('Question Chain component', () => {
describe('on create...', () => {
test('Should populate questions data array', async () => {
@ -205,7 +239,7 @@ describe('Question Chain component', () => {
wrapper.vm.getQuestionChainAnswerIfComplete(testReturnedAnswer);
// Assert
expect(wrapper.vm.questions[1].answerSelected).toBeUndefined;
expect(wrapper.vm.questions[1].answerSelected).toBeUndefined();
});
test('should return false if returnedAnswer is a nextQuestion (not a final answer)', async () => {
@ -279,36 +313,3 @@ describe('Question Chain component', () => {
});
});
});
function setupMocks({
questionDataProp = [
{
questionSequence: 1,
questionText: 'Does only your center sliding piece need to be replaced?',
answers: [
{
answerResult: 'DB09410',
answerText: 'Yes',
nextQuestionSequence: null
},
{
answerResult: 'DB10840',
answerText: 'No',
nextQuestionSequence: null
}
]
}
]
}) {
Element.prototype.scrollIntoView = jest.fn();
const mountOptions = getMountOptions({});
mountOptions.propsData = {
questionData: questionDataProp
};
mountOptions.attachTo = document.body;
const wrapper = shallowMount(questionChain, mountOptions);
return { wrapper };
}

View file

@ -23,7 +23,7 @@
</template>
<script>
import buttonQuestion from '@/digital-components/button-question/button-question';
import buttonQuestion from '@/digital-components/button-question/button-question.vue';
import { useValidateForm } from 'vee-validate';
export default {

View file

@ -1,5 +1,5 @@
import { shallowMount } from '@vue/test-utils';
import TextBlock from './text-block';
import TextBlock from '@/digital-components/text-block/text-block.vue';
const mockCmsContent = {
Text: 'Sample text here.'

View file

@ -1,5 +1,5 @@
// Components
import textareaQuestion from '@/digital-components/textarea-question/textarea-question';
import textareaQuestion from '@/digital-components/textarea-question/textarea-question.vue';
// Supporting Files
import { shallowMount } from '@vue/test-utils';

View file

@ -105,14 +105,16 @@ export default {
},
computed: {
/**
* @summary Returns the number of characters in the textarea field.
*/
* @summary Returns the number of characters in the textarea field.
* @returns {number}
*/
characterCount() {
return this?.modelValue?.length ?? 0;
},
/**
* @summary Returns the CMS text associated with the question.
*/
* @summary Returns the CMS text associated with the question.
* @returns {string} QuestionText from cms data.
*/
questionText() {
return this.getCmsContent(this.cmsWidgetName, 'QuestionText');
},
@ -127,8 +129,9 @@ export default {
},
methods: {
/**
* @summary Removes whitespace from the end of pasted content.
*/
* @summary Removes whitespace from the end of pasted content.
* @param {event} evt - Browser event
*/
trimOnPaste(evt) {
evt.stopPropagation();
evt.preventDefault();

View file

@ -1,5 +1,5 @@
import { shallowMount } from '@vue/test-utils';
import textboxQuestion from './textbox-question';
import textboxQuestion from '@/digital-components/textbox-question/textbox-question.vue';
// Mock CMS content
const questionText = 'Question Text';

View file

@ -1,5 +1,7 @@
<template>
<div class="textbox-question" :class="(errors && errors.length) || hasError ? 'has-error' : ''">
<div
class="textbox-question"
:class="(errors && errors.length) || hasError ? 'has-error' : ''">
<label
v-if="displayQuestionText"
:for="inputId"
@ -43,7 +45,10 @@
@focus="$emit('focus', $event.target.value)"
@paste="trimOnPaste"
@drop="trimOnPaste" />
<button v-if="includeSearchIcon" type="submit" aria-label="Search button" />
<button
v-if="includeSearchIcon"
type="submit"
aria-label="Search button" />
<button
v-if="includeSelectIcon"
type="submit"
@ -51,8 +56,12 @@
:data-bs-target="'#' + cmsWidgetName"
aria-label="Select button" />
</div>
<div v-show="errorMessage" class="row my-1 form-test-error">
<span class="d-inline-flex mt-0" role="alert">{{ errorMessage }}</span>
<div
v-show="errorMessage"
class="row my-1 form-test-error">
<span
class="d-inline-flex mt-0"
role="alert">{{ errorMessage }}</span>
</div>
</div>
</template>
@ -107,12 +116,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 = {
@ -122,11 +131,9 @@ export default {
};
// eslint-disable-next-line no-shadow
const { errorMessage, handleBlur, handleChange, meta, validate, errors } = useField(
props.inputId,
const { errorMessage, handleBlur, handleChange, meta, validate, errors } = useField(props.inputId,
props.validationRules,
fieldOptions
);
fieldOptions);
return {
errorMessage,

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

@ -1,6 +1,6 @@
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios.js';
import { RouterLinkStub } from '@vue/test-utils';
import { vehicleCategories } from '@/constants/vehicle-categories.js';
import vehicleCategories from '@/constants/vehicle-categories.js';
import { issPageValues } from '@/router/router-constants/issPage-values';
import cookieNames from '@/constants/cookie-names';
import { Form } from 'vee-validate';
@ -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

@ -1,5 +1,5 @@
import { shallowMount } from '@vue/test-utils';
import { vehicleCategories } from '@/constants/vehicle-categories.js';
import vehicleCategories from '@/constants/vehicle-categories.js';
import { useMainStore } from '@/store';
import { createApp } from 'vue';
import { createPinia, mapStores } from 'pinia';

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,10 +7,10 @@ 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';
import vehicleSelectionOptions from '@/constants/vehicle-selection-options';
// Mock fetchCmsContentForPage
jest.mock('@/helpers/cms-content-helper', () => ({

View file

@ -50,8 +50,8 @@ import { fetchCmsContentForPage } from '@/helpers/cms-content-helper.js';
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 vehicleSelectionOptions from '@/constants/vehicle-selection-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

@ -3,7 +3,7 @@ import { mount, flushPromises } from '@vue/test-utils';
import { createTestingPinia } from '@pinia/testing';
import { navigationScenarios } from '@/router/router-constants/navigation-scenarios';
import { routerParams } from '@/router/router-params';
import { vehicleCategories } from '@/constants/vehicle-categories';
import vehicleCategories from '@/constants/vehicle-categories';
import VehicleDamageComponent from '@/layouts/vehicle-damage/vehicle-damage';
const mockRoute = {

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 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

@ -43,7 +43,7 @@ import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
import { settleAllPromises } from '@/helpers/layout-helper';
import { Form } from 'vee-validate';
import BaseFormMixin from '@/mixins/base-form-mixin';
import { vinLookupMethodSelections } from '@/constants/vin-lookup-methods';
import vinLookupMethodSelections from '@/constants/vin-lookup-methods';
import { useMainStore } from '@/store';
// Import Component

View file

@ -13,7 +13,7 @@
// Import Other Supporting Files
import { useMainStore } from '@/store';
import { vinLookupMethodSelections } from '@/constants/vin-lookup-methods';
import vinLookupMethodSelections from '@/constants/vin-lookup-methods';
import { settleAllPromises } from '@/helpers/layout-helper';
import globalRules from '@/constants/global-rules';

View file

@ -46,11 +46,11 @@
import buttonQuestion from '@/digital-components/button-question/button-question';
// Supporting files
import { getTintImage } from '@/constants/tint-mapper';
import { getCustomTransformValue } from '@/constants/dynamictext-mapper';
import getTintImage from '@/constants/tint-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

@ -1,9 +1,9 @@
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 vehicleCategories from '@/constants/vehicle-categories.js';
import queryStrings from '@/constants/query-strings';
import dynamicStrings from '@/constants/dynamic-strings';
import { routerParams } from '@/router/router-constants/router-params';
export default {

View file

@ -1,4 +1,4 @@
import { inputButtonProps } from '@/digital-components/base-input-button/button-functionality-props';
import inputButtonProps from '@/digital-components/base-input-button/button-functionality-props';
export default {
model: {

View file

@ -761,6 +761,9 @@ export const useMainStore = defineStore({
// These could be undefined
this.order.policy.noCoverage = vehicle.noCoverage;
this.order.payment.insuranceCoverage.coverageStatus = vehicle.noCoverage
? coverageStatuses.NO_COMP
: coverageStatuses.PENDING;
this.order.policy.deductible.replace = vehicle.deductible;
this.order.policy.deductible.repair = vehicle?.repairWaived ?? false ? 0 : vehicle.deductible;

View file

@ -197,6 +197,24 @@ describe('Store', () => {
expect(store.order.policy).toMatchObject(expectedPolicy);
});
it.each([
[true, coverageStatuses.NO_COMP],
[false, coverageStatuses.PENDING]
])('UpdateVehicle should set coverageStatus appropriately based on noCoverage value',
(expectedNoCoverage, expectedCoverageStatus) => {
// Arrange
const vehicle = {
noCoverage: expectedNoCoverage
};
// Act
store.updateVehicle(vehicle);
// Assert
expect(store.order.policy.noCoverage).toBe(expectedNoCoverage);
expect(store.order.payment.insuranceCoverage.coverageStatus).toBe(expectedCoverageStatus);
});
// TODO update test to work also checking store values
it('setVehicle should call globalMethods.callHttpClient', () => {
// Arrange

View file

@ -1,31 +1,33 @@
process.env.VUE_APP_CONSUMER_CF_DISTRO ="https://digitalapi.dev.safelite.io";
process.env.VUE_APP_CURRENT_ENVIRONMENT = "Localhost";
process.env.VUE_APP_GOOGLE_PLACES_API_KEY =
"AIzaSyCuLhQcDdZTTb4JzpUFms1OCch2dk5lHF0";
process.env.VUE_APP_CONSUMER_CF_DISTRO = 'https://digitalapi.dev.safelite.io';
process.env.VUE_APP_CURRENT_ENVIRONMENT = 'Localhost';
process.env.VUE_APP_GOOGLE_PLACES_API_KEY
= 'AIzaSyCuLhQcDdZTTb4JzpUFms1OCch2dk5lHF0';
// GA & GTM
// NOTE: Using the old ISS site GTM Cotnainer ID for now, will create a new one soon.
process.env.VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY = "(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-KKNWZ3');";
process.env.VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC = "https://www.googletagmanager.com/ns.html?id=GTM-KKNWZ3&gtm_auth=amlAYNhxUxuskQo7jmjadg&gtm_preview=env-38&gtm_cookies_win=x";
process.env.VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY
= "(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-KKNWZ3');";
process.env.VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC
= 'https://www.googletagmanager.com/ns.html?id=GTM-KKNWZ3&gtm_auth=amlAYNhxUxuskQo7jmjadg&gtm_preview=env-38&gtm_cookies_win=x';
module.exports = {
publicPath: "/",
css: {
loaderOptions: {
sass: {
// Load Order Matters!!!
// Note: only include functions, variables and mixins here
additionalData: `
publicPath: '/',
css: {
loaderOptions: {
sass: {
// Load Order Matters!!!
// Note: only include functions, variables and mixins here
additionalData: `
@import "./node_modules/bootstrap/scss/functions";
@import "@/styles/ux-variables.scss";
@import "./node_modules/bootstrap/scss/variables";
@import "./node_modules/bootstrap/scss/mixins";
@import "@/styles/mixins/customMixins";
`
}
}
},
}
}
},
configureWebpack: {
devtool: 'source-map'
}
devtool: 'source-map'
}
};