@mychoice/mychoice-sdk-modules 2.1.8 → 2.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +12 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/shared/boxes/SelectFormBox/interface.d.ts +1 -1
- package/dist/esm/index.js +12 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/shared/boxes/SelectFormBox/interface.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +4 -4
package/dist/cjs/index.js
CHANGED
|
@@ -188,9 +188,9 @@ const usePathGroups = (insuranceType) => {
|
|
|
188
188
|
// [`${InsuranceTypes.Life}`]: [{ name: 'Life', link: `/${appConfigState.localIndex}/life` }],
|
|
189
189
|
};
|
|
190
190
|
const externalPathGroup = [
|
|
191
|
-
{ name: 'Car', link: 'https://
|
|
192
|
-
{ name: 'Home', link: 'https://
|
|
193
|
-
{ name: 'Life', link: 'https://
|
|
191
|
+
{ name: 'Car', link: 'https://quote.mychoice.ca/insurance/car' },
|
|
192
|
+
{ name: 'Home', link: 'https://quote.mychoice.ca/insurance/home' },
|
|
193
|
+
{ name: 'Life', link: 'https://quote.mychoice.ca/insurance/life' },
|
|
194
194
|
{ name: 'Learn', link: 'https://www.mychoice.ca/blog/' },
|
|
195
195
|
];
|
|
196
196
|
// @todo: use in future.
|
|
@@ -308,10 +308,12 @@ const ModalPostal = () => {
|
|
|
308
308
|
const getVehicleYearRange = () => {
|
|
309
309
|
const currentDate = new Date();
|
|
310
310
|
const vehicleYear = [];
|
|
311
|
-
|
|
311
|
+
const currentYear = currentDate.getFullYear();
|
|
312
|
+
const minYear = currentYear - 25;
|
|
313
|
+
for (let year = (currentDate.getFullYear()); year > minYear; year -= 1) {
|
|
312
314
|
vehicleYear.push({ name: `${year}`, value: `${year}` });
|
|
313
315
|
}
|
|
314
|
-
vehicleYear.push({ name:
|
|
316
|
+
vehicleYear.push({ name: `${minYear} or older`, value: `${minYear}` });
|
|
315
317
|
return vehicleYear;
|
|
316
318
|
};
|
|
317
319
|
const getRecommendedRange = (distanceDaily, distanceBusiness) => {
|
|
@@ -413,7 +415,8 @@ const BlockCarInfo = () => {
|
|
|
413
415
|
const { status: statusModel, getVehicleModel, vehicleModelList = [] } = mychoiceSdkStore.useHandlerCarModel();
|
|
414
416
|
const { vehicleState, dispatchVehicleState } = mychoiceSdkStore.useStoreFormCarVehicle();
|
|
415
417
|
const { year: currentYear, make: currentMake, model: currentModel, } = vehicleState.items[vehicleState.activeIndex];
|
|
416
|
-
const yearIsValid = !currentYear || Number(currentYear) >
|
|
418
|
+
const yearIsValid = !currentYear || Number(currentYear) > 1998;
|
|
419
|
+
const yearMessage = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: ["Please contact a licenced representative at Hargerty for classic car insurance:", ' ', jsxRuntime.jsx("a", { href: "tel:18335431540", children: "1-833-543-1540" })] }));
|
|
417
420
|
const handleVehicleYearChange = ({ value }) => {
|
|
418
421
|
if (value) {
|
|
419
422
|
dispatchVehicleState({
|
|
@@ -448,7 +451,7 @@ const BlockCarInfo = () => {
|
|
|
448
451
|
getVehicleModel(currentYear, currentMake);
|
|
449
452
|
}
|
|
450
453
|
});
|
|
451
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(SelectFormBox, { options: getVehicleYearRange(), name: "carYear", title: "Car Year", placeholder: "Select Year", description: "Every car is different, so for insurers to accurately cover, repair, or replace your vehicle, they need to know the make, model, age, body type, and vehicle history. Each factor will raise or lower your premium\u2014an older vehicle is typically more affordable to repair, for example, since cars lose value each year.", error: !currentYear && vehicleState.inValidation, errorMessage: !yearIsValid ?
|
|
454
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(SelectFormBox, { options: getVehicleYearRange(), name: "carYear", title: "Car Year", placeholder: "Select Year", description: "Every car is different, so for insurers to accurately cover, repair, or replace your vehicle, they need to know the make, model, age, body type, and vehicle history. Each factor will raise or lower your premium\u2014an older vehicle is typically more affordable to repair, for example, since cars lose value each year.", error: !currentYear && vehicleState.inValidation, errorMessage: !yearIsValid ? yearMessage : getErrorMessage(currentYear, vehicleState.inValidation), defaultValue: currentYear, autoSelectIfValueIsOutOfOptions: false, onChange: handleVehicleYearChange }), !!vehicleMakeList.length
|
|
452
455
|
&& yearIsValid
|
|
453
456
|
&& statusMake === mychoiceSdkComponents.RequestStatusTypes.Success
|
|
454
457
|
&& (jsxRuntime.jsx(SelectFormBox, { options: vehicleMakeList, name: "carMakes", title: "Car Manufacturer", placeholder: "Select a Make", description: "The manufacturer of your vehicle is a huge influence on your insurance premium, but it isn\u2019t the only consideration. Some car manufacturers include security features that may qualify for discounts, like anti-theft protection or anti-lock brakes. Insurers also consider repair, risk, injury, and retail prices. If you do not see your vehicle on our list, call us for a telephonic quote.", error: !currentMake && vehicleState.inValidation, errorMessage: getErrorMessage(currentMake, vehicleState.inValidation), defaultValue: currentMake, autoSelectIfValueIsOutOfOptions: false, onChange: handleVehicleMakeChange })), vehicleModelList.length > 0
|
|
@@ -3775,6 +3778,7 @@ const AppRouteWrapper = (props) => {
|
|
|
3775
3778
|
let postalCode = carPostal;
|
|
3776
3779
|
const { clearFormData, checkIsExpired, checkIsExpiredWithModal, } = mychoiceSdkStore.ClearFormDataHandler();
|
|
3777
3780
|
const { appLoaderState } = mychoiceSdkStore.useStoreAppLoader();
|
|
3781
|
+
const isMychoice = appType === mychoiceSdkComponents.AppTypes.MyChoice;
|
|
3778
3782
|
switch (insuranceType) {
|
|
3779
3783
|
case mychoiceSdkComponents.InsuranceTypes.Car:
|
|
3780
3784
|
postalCode = carPostal;
|
|
@@ -3984,7 +3988,7 @@ const AppRouteWrapper = (props) => {
|
|
|
3984
3988
|
}
|
|
3985
3989
|
}
|
|
3986
3990
|
}, [carPostal, homePostal, lifePostal, isReady]);
|
|
3987
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: isReady && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(AppHeader, {}), jsxRuntime.jsx(AppModal, {}), insuranceType && (jsxRuntime.jsx(NavigationTop, { title: `${insuranceType.replace(/^./, insuranceType[0].toUpperCase())} Insurance Quote`, postalCode: postalCode, formSteps: steps, validationHooks: validationHooks, clearForm: clearFormData, propertyIsCompleted: isCompleted })), insuranceType && appType === mychoiceSdkComponents.AppTypes.MyChoice && (jsxRuntime.jsx("div", { className: "step-progress-bar", children: jsxRuntime.jsx("span", { style: { width: progressLength } }) })), jsxRuntime.jsx("div", { className: `${insuranceType ? 'form-page-content' : ''} ${insuranceType && appType === mychoiceSdkComponents.AppTypes.MyChoice ? 'mychoice' : ''}`, children: insuranceType && appType === mychoiceSdkComponents.AppTypes.MyChoice && isDesktop && progressLength ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", { className: "mychoice-content", children: [jsxRuntime.jsx(StepsBox, { className: "step-box", formSteps: steps, validationHooks: validationHooks, propertyIsCompleted: isCompleted }), children, jsxRuntime.jsx("div", { className: "empty-steps-container" })] }) })) : children }), !appLoaderState.isOpen && insuranceType === mychoiceSdkComponents.InsuranceTypes.Car && jsxRuntime.jsx(ProviderImageFooter, {})] })) }));
|
|
3991
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: isReady && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(AppHeader, {}), jsxRuntime.jsx(AppModal, {}), insuranceType && (jsxRuntime.jsx(NavigationTop, { title: `${insuranceType.replace(/^./, insuranceType[0].toUpperCase())} Insurance Quote`, postalCode: postalCode, formSteps: steps, validationHooks: validationHooks, clearForm: clearFormData, propertyIsCompleted: isCompleted })), insuranceType && appType === mychoiceSdkComponents.AppTypes.MyChoice && (jsxRuntime.jsx("div", { className: "step-progress-bar", children: jsxRuntime.jsx("span", { style: { width: progressLength } }) })), jsxRuntime.jsx("div", { className: `${insuranceType ? 'form-page-content' : ''} ${insuranceType && appType === mychoiceSdkComponents.AppTypes.MyChoice ? 'mychoice' : ''}`, children: insuranceType && appType === mychoiceSdkComponents.AppTypes.MyChoice && isDesktop && progressLength ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", { className: "mychoice-content", children: [jsxRuntime.jsx(StepsBox, { className: "step-box", formSteps: steps, validationHooks: validationHooks, propertyIsCompleted: isCompleted }), children, jsxRuntime.jsx("div", { className: "empty-steps-container" })] }) })) : children }), isMychoice && !appLoaderState.isOpen && insuranceType === mychoiceSdkComponents.InsuranceTypes.Car && jsxRuntime.jsx(ProviderImageFooter, {})] })) }));
|
|
3988
3992
|
};
|
|
3989
3993
|
const NestedRoutes = () => {
|
|
3990
3994
|
const insuranceType = mychoiceSdkComponents.getInsuranceType();
|