+
-
+
-
@@ -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,
diff --git a/src/helpers/clientauth-helper.js b/src/helpers/clientauth-helper.js
index 2466fbc9..3d1a7f58 100644
--- a/src/helpers/clientauth-helper.js
+++ b/src/helpers/clientauth-helper.js
@@ -7,9 +7,8 @@ const validateISSClientTag = (clientTag) => {
.then((response) =>
// Success
response,
- (error) =>
// Error
- null);
+ () => null);
};
export default validateISSClientTag;
diff --git a/src/helpers/cookie-helper.js b/src/helpers/cookie-helper.js
index b52051e9..de642ec3 100644
--- a/src/helpers/cookie-helper.js
+++ b/src/helpers/cookie-helper.js
@@ -2,22 +2,68 @@ import cookieNames from '@/constants/cookie-names';
import applicationConfig from '@/constants/application-config';
import { useMainStore } from '@/store';
-/*
- Will update the cookie if present, or create a new one if not.
-*/
-export function updateOrCreateISSCookie() {
- const store = useMainStore();
+function isLocalhost() {
+ // eslint-disable-next-line no-restricted-globals
+ return location.hostname.includes('localhost');
+}
- // Set up cookie with all the props.
- setISSCookieProperties({
- LastTouched: new Date().toUTCString(),
- SavedSessionTimeoutDate: store.applicationUser.savedSessionTimeout,
- ShouldResetState: false,
- ReferralNumber: store.order.referralNumber,
- ReferralDate: store.order.referralDate,
- ReferralCorrelationId: store.order.referralCorrelationId,
- ReferralParentAccountNumber: store.order.accountNumber
- });
+/*
+ Gets cookie value by name, returns empty string if not found.
+*/
+function getCookieValueByName(name) {
+ const value = `; ${document.cookie}`;
+ const parts = value.split(`; ${name}=`);
+
+ if (parts.length === 2) {
+ return parts.pop().split(';').shift();
+ }
+ return '';
+}
+
+/*
+ Gets current domain without the subdomain for cookie.
+*/
+function getDomainWithoutSubdomain() {
+ // eslint-disable-next-line no-restricted-globals
+ const url = location.hostname;
+ if (isLocalhost()) {
+ return 'localhost';
+ }
+
+ const urlParts = url.split('.');
+
+ return `.${urlParts
+ .slice(0)
+ .slice(-(urlParts.length === 4 ? 3 : 2))
+ .join('.')}`;
+}
+
+/*
+ Gets cookie domain value. Localhost will be empty "".
+*/
+export function getCookieDomainValue() {
+ return isLocalhost() ? '' : `domain=${getDomainWithoutSubdomain()};`;
+}
+
+/*
+ Used to create a cookie.
+ `useDefaultISSCookieAttributes` will set the path and domain to our defaults
+*/
+function createOrUpdateCookie(key, value = '',
+ { useDefaultISSCookieAttributes = true, maxAge, isSecure = true }) {
+ let cookieToAdd = `${key}=${value}; `;
+
+ if (useDefaultISSCookieAttributes) {
+ cookieToAdd += `path=${applicationConfig.COOKIE_PATH}; ${getCookieDomainValue()} `;
+ }
+ if (isSecure && !isLocalhost()) {
+ cookieToAdd += 'secure; ';
+ }
+ if (!Number.isNaN(maxAge)) {
+ cookieToAdd += `max-age=${maxAge};`;
+ }
+
+ document.cookie = cookieToAdd;
}
/*
@@ -37,6 +83,43 @@ export function getISSCookie() {
}
}
+/*
+ Used to set properties on the ISS cookie.
+ Takes an object with properties to set. Will overwrite existing properties.
+*/
+function setISSCookieProperties(properties) {
+ if (typeof properties === 'object') {
+ const cookie = getISSCookie();
+
+ if (cookie !== null) {
+ Object.keys(properties).forEach((key) => {
+ cookie[key] = properties[key];
+ });
+ }
+
+ const cookieValueJson = JSON.stringify(cookie ?? {});
+ createOrUpdateCookie(cookieNames.ISS_SESSION_INFO, cookieValueJson, {});
+ }
+}
+
+/*
+ Will update the cookie if present, or create a new one if not.
+*/
+export function updateOrCreateISSCookie() {
+ const store = useMainStore();
+
+ // Set up cookie with all the props.
+ setISSCookieProperties({
+ LastTouched: new Date().toUTCString(),
+ SavedSessionTimeoutDate: store.applicationUser.savedSessionTimeout,
+ ShouldResetState: false,
+ ReferralNumber: store.order.referralNumber,
+ ReferralDate: store.order.referralDate,
+ ReferralCorrelationId: store.order.referralCorrelationId,
+ ReferralParentAccountNumber: store.order.accountNumber
+ });
+}
+
/*
Removes cookie from browser.
*/
@@ -44,13 +127,6 @@ export function deleteISSCookie() {
createOrUpdateCookie(cookieNames.ISS_SESSION_INFO, undefined, { maxAge: 0 });
}
-/*
- Gets cookie domain value. Localhost will be empty "".
-*/
-export function getCookieDomainValue() {
- return isLocalhost() ? '' : `domain=${getDomainWithoutSubdomain()};`;
-}
-
/*
Gets value of dxdev cookie, and then extracts "did" value from it.
Returns empty string if cookie not found or "did" string not present.
@@ -118,83 +194,3 @@ export function setCookieProperties(properties,
});
}
}
-
-/*
-===========================
-= PRIVATE FUNCTIONS =
-===========================
-*/
-
-/*
- Used to set properties on the ISS cookie.
- Takes an object with properties to set. Will overwrite existing properties.
-*/
-function setISSCookieProperties(properties) {
- if (typeof properties === 'object') {
- const cookie = getISSCookie();
-
- if (cookie !== null) {
- Object.keys(properties).forEach((key) => {
- cookie[key] = properties[key];
- });
- }
-
- const cookieValueJson = JSON.stringify(cookie ?? {});
- createOrUpdateCookie(cookieNames.ISS_SESSION_INFO, cookieValueJson, {});
- }
-}
-
-/*
- Used to create a cookie.
- `useDefaultISSCookieAttributes` will set the path and domain to our defaults
-*/
-function createOrUpdateCookie(key, value = '',
- { useDefaultISSCookieAttributes = true, maxAge, isSecure = true }) {
- let cookieToAdd = `${key}=${value}; `;
-
- if (useDefaultISSCookieAttributes) {
- cookieToAdd += `path=${applicationConfig.COOKIE_PATH}; ${getCookieDomainValue()} `;
- }
- if (isSecure && !isLocalhost()) {
- cookieToAdd += 'secure; ';
- }
- if (!Number.isNaN(maxAge)) {
- cookieToAdd += `max-age=${maxAge};`;
- }
-
- document.cookie = cookieToAdd;
-}
-
-/*
- Gets current domain without the subdomain for cookie.
-*/
-function getDomainWithoutSubdomain() {
- const url = location.hostname;
- if (isLocalhost()) {
- return 'localhost';
- }
-
- const urlParts = url.split('.');
-
- return `.${urlParts
- .slice(0)
- .slice(-(urlParts.length === 4 ? 3 : 2))
- .join('.')}`;
-}
-
-/*
- Gets cookie value by name, returns empty string if not found.
-*/
-function getCookieValueByName(name) {
- const value = `; ${document.cookie}`;
- const parts = value.split(`; ${name}=`);
-
- if (parts.length === 2) {
- return parts.pop().split(';').shift();
- }
- return '';
-}
-
-function isLocalhost() {
- return location.hostname.includes('localhost');
-}
diff --git a/src/helpers/damage-helper.js b/src/helpers/damage-helper.js
index 3c6bfce2..7390167f 100644
--- a/src/helpers/damage-helper.js
+++ b/src/helpers/damage-helper.js
@@ -44,6 +44,7 @@ function hasMatchingReplacementOption(vehicleDamageOptions, selectedGlassToRepla
Rear: 'backGlassOptions'
};
+ // eslint-disable-next-line no-restricted-syntax
for (const glassToReplace of selectedGlassToReplace) {
const propName = optionsMap[glassToReplace.glassLocation];
const { availableReplacementOptions } = vehicleDamageOptions[propName];
diff --git a/src/helpers/data-generation.js b/src/helpers/data-generation.js
index c2d2323a..b156ca5d 100644
--- a/src/helpers/data-generation.js
+++ b/src/helpers/data-generation.js
@@ -1,9 +1,9 @@
import { randomUUID } from 'crypto';
export function getRandomInt(min = 0, max = 1000) {
- min = Math.ceil(min);
- max = Math.floor(max);
- return Math.floor(Math.random() * (max - min) + min); // The maximum is exclusive and the minimum is inclusive
+ const minCeiling = Math.ceil(min);
+ const maxFloor = Math.floor(max);
+ return Math.floor(Math.random() * (maxFloor - minCeiling) + minCeiling); // The maximum is exclusive and the minimum is inclusive
}
export function getRandomGuid() {
diff --git a/src/helpers/event-bus/event-bus.spec.js b/src/helpers/event-bus/event-bus.spec.js
index e6aa9557..16501c4f 100644
--- a/src/helpers/event-bus/event-bus.spec.js
+++ b/src/helpers/event-bus/event-bus.spec.js
@@ -25,6 +25,7 @@ describe('event-bus.js', () => {
it('removes items when readandpop is called', () => {
useMainStore().eventBusItem.mockReturnValueOnce(event);
+ // TODO: Use or remove
const eventValue = eventBus.readAndPopEventFromBus(globalEvents.Categories.GLOBAL_ALERT,
globalEvents.SubCategories.PAGE_NOT_FOUND);
@@ -35,6 +36,7 @@ describe('event-bus.js', () => {
it("doesn't try to remove items when readandpop is called and item doesn't exist", () => {
useMainStore().eventBusItem.mockReturnValueOnce(undefined);
+ // TODO: Use or remove
const eventValue = eventBus.readAndPopEventFromBus(globalEvents.Categories.GLOBAL_ALERT,
globalEvents.SubCategories.PAGE_NOT_FOUND);
diff --git a/src/helpers/global-rule-definer.js b/src/helpers/global-rule-definer.js
index 650fb97e..b06fe946 100644
--- a/src/helpers/global-rule-definer.js
+++ b/src/helpers/global-rule-definer.js
@@ -9,14 +9,10 @@ import { required, regex } from '@/helpers/validation-rules';
function defineGlobalNameRules() {
defineRule(globalRules.FIRST_NAME_REQUIRED, required(errorMessages.FIRST_NAME_REQUIRED));
defineRule(globalRules.LAST_NAME_REQUIRED, required(errorMessages.LAST_NAME_REQUIRED));
- defineRule(
- globalRules.POLICYHOLDER_FIRST_NAME_REQUIRED,
- required(errorMessages.POLICYHOLDER_FIRST_NAME_REQUIRED)
- );
- defineRule(
- globalRules.POLICYHOLDER_LAST_NAME_REQUIRED,
- required(errorMessages.POLICYHOLDER_LAST_NAME_REQUIRED)
- );
+ defineRule(globalRules.POLICYHOLDER_FIRST_NAME_REQUIRED,
+ required(errorMessages.POLICYHOLDER_FIRST_NAME_REQUIRED));
+ defineRule(globalRules.POLICYHOLDER_LAST_NAME_REQUIRED,
+ required(errorMessages.POLICYHOLDER_LAST_NAME_REQUIRED));
}
/**
@@ -24,13 +20,9 @@ function defineGlobalNameRules() {
*/
function defineGlobalEmailRules() {
defineRule(globalRules.EMAIL_ADDRESS_REQUIRED, required(errorMessages.EMAIL_ADDRESS_REQUIRED));
- defineRule(
- globalRules.EMAIL_ADDRESS_FORMAT,
- regex(
- /^([a-zA-Z0-9_\-.+]+)@([a-zA-Z0-9_\-.]+)\.([a-zA-Z]{2,})$/,
- errorMessages.EMAIL_ADDRESS_FORMAT
- )
- );
+ defineRule(globalRules.EMAIL_ADDRESS_FORMAT,
+ regex(/^([a-zA-Z0-9_\-.+]+)@([a-zA-Z0-9_\-.]+)\.([a-zA-Z]{2,})$/,
+ errorMessages.EMAIL_ADDRESS_FORMAT));
}
/**
@@ -38,13 +30,9 @@ function defineGlobalEmailRules() {
*/
function defineGlobalPhoneNumberRules() {
defineRule(globalRules.PHONE_NUMBER_REQUIRED, required(errorMessages.PHONE_NUMBER_REQUIRED));
- defineRule(
- globalRules.PHONE_NUMBER_FORMAT,
- regex(
- /^(\([0-9]{3}\)|[0-9]{3}) *[-.]? *[0-9]{3} *[-.]? *[0-9]{4}$/,
- errorMessages.PHONE_NUMBER_FORMAT
- )
- );
+ defineRule(globalRules.PHONE_NUMBER_FORMAT,
+ regex(/^(\([0-9]{3}\)|[0-9]{3}) *[-.]? *[0-9]{3} *[-.]? *[0-9]{4}$/,
+ errorMessages.PHONE_NUMBER_FORMAT));
}
/**
diff --git a/src/helpers/unit-test-helper.js b/src/helpers/unit-test-helper.js
index 23e7781c..76029faa 100644
--- a/src/helpers/unit-test-helper.js
+++ b/src/helpers/unit-test-helper.js
@@ -1,7 +1,8 @@
-import { navigationScenarios } from '@/router/router-constants/navigation-scenarios.js';
import { RouterLinkStub } from '@vue/test-utils';
+import { createTestingPinia } from '@pinia/testing';
+import { navigationScenarios } from '@/router/router-constants/navigation-scenarios.js';
import vehicleCategories from '@/constants/vehicle-categories.js';
-import { issPageValues } from '@/router/router-constants/issPage-values';
+import issPageValues from '@/router/router-constants/issPage-values';
import cookieNames from '@/constants/cookie-names';
import { Form } from 'vee-validate';
import baseMixin from '@/mixins/base-mixin';
@@ -13,7 +14,6 @@ import { GaActions } from '@/constants/analytics';
import queryStrings from '@/constants/query-strings';
import { useMainStore } from '@/store';
import { mapStores } from 'pinia';
-import { createTestingPinia } from '@pinia/testing';
const pinia = createTestingPinia();
useMainStore(pinia);
@@ -147,10 +147,6 @@ export function getMountOptions(mockData) {
return { global };
}
-
-
-
-
export function getMockOrderInfo(
mockReferralNumber,
mockCorrelationId,
@@ -169,7 +165,4 @@ export function getMockOrderInfo(
};
}
-
-
-
-*/
\ No newline at end of file
+*/
diff --git a/src/iss-components/site-footer/site-footer.vue b/src/iss-components/site-footer/site-footer.vue
index eac378ab..f83d8372 100644
--- a/src/iss-components/site-footer/site-footer.vue
+++ b/src/iss-components/site-footer/site-footer.vue
@@ -49,7 +49,7 @@