@mychoice/mychoice-sdk-modules 2.1.21 → 2.1.23
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 +16 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +18 -10
- package/dist/esm/index.js.map +1 -1
- package/package.json +3 -3
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
3
|
-
import { AppTypes, TitleForm, TooltipForm, IconDelete, ColorVariablesTypes, InputTypes, InputForm, InputFormPhone, InputFormEmail, InputFormLicence, SelectForm, getFormattedDate, DateTypes, getDateOptions, ButtonForm, OfferHeader, OfferPrice, ButtonBase, ButtonTypes, CategoryTypes, ColorTypes, ButtonVariantTypes, SizeTypes, IconDropdownArrow, OfferDetail, CompanyRoleTypes, OperationHoursInfo, InsuranceTypes, HeaderNavGroup, ButtonMenu, IconLoaderPrimary, getInsuranceType, RequestStatusTypes, formatPostalCode, IconLoaderSecondary, postalCodeFormat, defaultBrokerPhone, useEffectOnce, carCondition, carStatus, carWinterTiresCheck, carKeepPlace, carUsagePurpose, firstDriveDistanceList, dailyDriveBusinessDistanceList, yearlyDriveDistanceList, numberWithCommas, VehiclePrimaryUseTypes, comprehensiveCoverage, collisionCoverage,
|
|
4
|
-
import { useStoreAppConfig, CarQuoteDataHandler, useStorePartner, useStoreAppLoader, useStoreAppModal, StoreConfigAppModalActionTypes, useHandlerPostal, useHandlerCarMake, useHandlerCarModel, useStoreFormCarVehicle, StoreFormCarVehicleActionTypes, useProvince, useStoreFormCarDiscount,
|
|
3
|
+
import { AppTypes, TitleForm, TooltipForm, IconDelete, ColorVariablesTypes, InputTypes, InputForm, InputFormPhone, InputFormEmail, InputFormLicence, SelectForm, getFormattedDate, DateTypes, getDateOptions, ButtonForm, OfferHeader, OfferPrice, ButtonBase, ButtonTypes, CategoryTypes, ColorTypes, ButtonVariantTypes, SizeTypes, IconDropdownArrow, OfferDetail, CompanyRoleTypes, OperationHoursInfo, InsuranceTypes, HeaderNavGroup, ButtonMenu, DeviceTypes, IconLoaderPrimary, getInsuranceType, RequestStatusTypes, formatPostalCode, IconLoaderSecondary, postalCodeFormat, defaultBrokerPhone, useEffectOnce, carCondition, carStatus, carWinterTiresCheck, carKeepPlace, carUsagePurpose, firstDriveDistanceList, dailyDriveBusinessDistanceList, yearlyDriveDistanceList, numberWithCommas, VehiclePrimaryUseTypes, comprehensiveCoverage, collisionCoverage, defaultLocalIndex, maritalStatusOptions, subYearsFromDate, occupationOptions, genderOptions, applicantRelationshipOptions, addYearsToDate, checkDateIsSpecial, DriverLicenceTypes, getDifferenceInYears, getLicenceTypeOptions, getDisabledLicenceTypes, yesNoOptions, addDaysToDate, getMinDate, CheckboxForm, subMonthsFromDate, getMinDateByYears, compareDates, insuranceCancellationReasonOptions, DriverListTypes, licenceSuspensionsReasonOptions, trafficTicketsGroupOptions, DriverPriorityTypes, ValidationStatusTypes, QuoteEdit, coverageOptions, liabilityOptions, homeOwnerTypeOptions, tenantBuildingStructureOptions, condoBuildingStructureOptions, homeBuildingStructureOptions, residentsOptions, insuredYearsOptions, getInsuranceYearsOptions, ApplicantListTypes, claimTypeOptions, exteriorFinishOptions, constructionTypeOptions, garageTypeOptions, getNumericOptions, fireHallDistanceOptions, fireHydrantDistanceOptions, primaryHeatingTypeOptions, auxHeatingTypeOptions, InfoMessage, ppOptions, homeCoverageOptions, homeLiabilityOptions, lifeProvinceOptions, lifeInsuranceTypeOptions, lifeCoverageOptions, smokerOptions, MychoiceStep, Step, IconClock, ButtonArrow, DirectionTypes, ButtonTabArrow, ButtonTab, ButtonTabMobile, NavigationCar, NavigationPerson, NavigationDiscount, NavigationQuotes, NavigationAddress, NavigationProperty, ModalTypes } from '@mychoice/mychoice-sdk-components';
|
|
4
|
+
import { useStoreAppConfig, CarQuoteDataHandler, useStorePartner, useStoreDeviceType, useStoreAppLoader, useStoreAppModal, StoreConfigAppModalActionTypes, useHandlerPostal, useHandlerCarMake, useHandlerCarModel, useStoreFormCarVehicle, StoreFormCarVehicleActionTypes, useProvince, useStoreFormCarDiscount, StoreFormCarDiscountActionTypes, useValidationVehicle, useStoreFormCarDriverBase, StoreFormCarDriverBaseActionTypes, useStoreFormCarConfig, useStoreFormCarDriverInfo, StoreFormCarDriverInfoActionTypes, useStoreFormCarDriverLicence, addDayToDate, StoreFormCarDriverLicenceActionTypes, useStoreFormCarDriverInsurance, useStoreFormCarQuote, StoreFormCarDriverInsuranceActionTypes, useStoreFormCarDriverCancellation, StoreFormCarDriverCancellationActionTypes, useStoreFormCarDriverSuspension, StoreFormCarDriverSuspensionActionTypes, useStoreFormCarDriverAccident, StoreFormCarDriverAccidentActionTypes, useStoreFormCarDriverTicket, StoreFormCarDriverTicketActionTypes, useValidationDriver, useValidationCarDiscount, useHandlerCarQuoterEmail, useStoreFormHomeDwelling, useStoreFormHomePostal, useStoreFormHomeApplicantBase, StoreFormHomePostalActionTypes, StoreFormHomeDwellingActionTypes, StoreConfigAppConfigActionTypes, StoreFormHomeApplicantBaseActionTypes, useValidationAddress, useStoreFormHomeApplicantInfo, useStoreFormHomeDiscount, StoreFormHomeDiscountActionTypes, StoreFormHomeApplicantInfoActionTypes, useStoreFormHomeApplicantInsurance, StoreFormHomeApplicantInsuranceActionTypes, useStoreFormHomeApplicantCancellation, StoreFormHomeApplicantCancellationActionTypes, useStoreFormHomeApplicantClaim, StoreFormHomeApplicantClaimActionTypes, useValidationApplicant, useValidationDwelling, useStoreFormHomeQuote, HomeQuoteDataHandler, useValidationHomeDiscount, useHandlerHomeQuoterEmail, useStoreFormLifeCoverage, StoreFormLifeCoverageActionTypes, useValidationCoverage, useStoreFormLifeQuote, useStoreFormLifeApplicant, LifeQuoteDataHandler, useValidationLifeApplicant, useHandlerLifeQuoterEmail, StoreFormLifeApplicantActionTypes, useStoreFormCarPostal, useStoreFormLifePostal, ClearFormDataHandler, useStoreAppDevice, useStoreClient, useHandlerAuth, useHandlerPartner, StoreConfigAppLoaderActionTypes, StoreFormCarConfigActionTypes, StoreFormCarPostalActionTypes, StoreFormCarQuoteActionTypes, StoreFormHomeQuoteActionTypes, StoreFormLifePostalActionTypes, StoreFormLifeQuoteActionTypes, StoreClientActionTypes, StoreConfigAppDeviceActionTypes, StoreProvider, initHttpResponse } from '@mychoice/mychoice-sdk-store';
|
|
5
5
|
import { useNavigate, useLocation, BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
|
|
6
6
|
import React, { useState, useCallback, useEffect, useRef } from 'react';
|
|
7
7
|
import { random } from 'lodash';
|
|
@@ -238,15 +238,21 @@ HeaderMyChoiceMobile.defaultProps = {
|
|
|
238
238
|
className: '',
|
|
239
239
|
};
|
|
240
240
|
|
|
241
|
-
const LoaderVid = () =>
|
|
242
|
-
|
|
243
|
-
|
|
241
|
+
const LoaderVid = () => {
|
|
242
|
+
const { appDeviceType } = useStoreDeviceType();
|
|
243
|
+
const isMobile = appDeviceType === DeviceTypes.Mobile;
|
|
244
|
+
return (jsx(Fragment, { children: isMobile ? jsx("video", { src: "https://mychoice.ca/wp-content/uploads/2023/05/Pig-Video.mp4", autoPlay: true, loop: true, muted: true, preload: "auto", style: { maxHeight: '300px' } })
|
|
245
|
+
: jsx("video", { src: "https://mychoice.ca/wp-content/uploads/2023/05/Pig-Video.mp4", autoPlay: true, loop: true, muted: true, preload: "auto", style: { maxHeight: '400px' } }) }));
|
|
246
|
+
};
|
|
244
247
|
|
|
245
248
|
const LoaderPrimary = () => {
|
|
246
249
|
const { appLoaderState } = useStoreAppLoader();
|
|
247
250
|
const { appConfigState } = useStoreAppConfig();
|
|
248
251
|
const isLastPage = window.location.pathname.includes('discount') || window.location.pathname.includes('/life/applicant');
|
|
249
|
-
return (jsxs("div", { className: "loader-wrapper", children: [appConfigState.appType === AppTypes.TheBig || !isLastPage ? jsx(IconLoaderPrimary, {}) : jsx(LoaderVid, {}), !!appLoaderState.description &&
|
|
252
|
+
return (jsxs("div", { className: "loader-wrapper", children: [appConfigState.appType === AppTypes.TheBig || !isLastPage ? jsx(IconLoaderPrimary, {}) : jsx(LoaderVid, {}), !!appLoaderState.description && appLoaderState.description.includes('accurate')
|
|
253
|
+
? (jsx("h4", { children: appLoaderState.description.split('\n').map((line, index) => (jsxs("div", { children: [line, jsx("br", {})] }, index))) }))
|
|
254
|
+
// eslint-disable-next-line react/no-unescaped-entities
|
|
255
|
+
: !appLoaderState.description && jsx("h4", { children: "'Hang tight, while we collect and process information about your property'" })] }));
|
|
250
256
|
};
|
|
251
257
|
|
|
252
258
|
const ModalConfirm = () => {
|
|
@@ -1770,8 +1776,10 @@ const SectionConfirm = () => {
|
|
|
1770
1776
|
const { items: quotes } = quoteState;
|
|
1771
1777
|
const { firstName, lastName, phone } = quoterInfo;
|
|
1772
1778
|
const bestQuote = quotes.length ? quotes[0] : null;
|
|
1779
|
+
const { appConfigState: { localIndex, insuranceType } } = useStoreAppConfig();
|
|
1773
1780
|
const [comparedCountMax] = useState(random(1021, 1502));
|
|
1774
1781
|
const [comparedCountMin, setComparedCountMin] = useState(1000);
|
|
1782
|
+
const navigate = useNavigate();
|
|
1775
1783
|
useEffect(() => {
|
|
1776
1784
|
if (comparedCountMin < comparedCountMax) {
|
|
1777
1785
|
const intervalId = setInterval(() => {
|
|
@@ -1807,6 +1815,7 @@ const SectionConfirm = () => {
|
|
|
1807
1815
|
top: 0,
|
|
1808
1816
|
behavior: 'smooth',
|
|
1809
1817
|
});
|
|
1818
|
+
navigate(`/${localIndex || defaultLocalIndex}/${insuranceType}/quotes`);
|
|
1810
1819
|
};
|
|
1811
1820
|
if (!bestQuote)
|
|
1812
1821
|
return null;
|
|
@@ -1856,9 +1865,8 @@ const PageCarQuote = () => {
|
|
|
1856
1865
|
top: 0,
|
|
1857
1866
|
behavior: 'smooth',
|
|
1858
1867
|
});
|
|
1859
|
-
if (hasConfirmStep) {
|
|
1860
|
-
|
|
1861
|
-
navigate(`/${localIndex || defaultLocalIndex}/${insuranceType}/quotes/${uniqueUrl}`);
|
|
1868
|
+
if (hasConfirmStep && !window.location.pathname.includes('/offer')) {
|
|
1869
|
+
navigate(`/${localIndex || defaultLocalIndex}/${insuranceType}/offer`);
|
|
1862
1870
|
}
|
|
1863
1871
|
});
|
|
1864
1872
|
return (jsx("div", { className: `quote-page-content ${hasConfirmStep ? 'confirm-step' : ''}`, children: showContentWhileLoading && (jsxs(Fragment, { children: [hasConfirmStep && jsx(BlockConfirmHeading, {}), jsxs("div", { className: "form-section-container", children: [appDeviceType === DeviceTypes.Mobile && !hasConfirmStep && (jsx(Fragment, { children: !!items?.length && (jsx(Fragment, { children: !quoteState.showCallMessage
|
|
@@ -4001,7 +4009,7 @@ const NestedRoutes = () => {
|
|
|
4001
4009
|
});
|
|
4002
4010
|
});
|
|
4003
4011
|
return (jsx(Fragment, { children: appConfigState.drawWrapper && (jsx(Fragment, { children: jsxs(Routes, { children: [jsx(Route, { path: "*", element: jsx(Navigate, { to: { pathname: `/${appConfigState.localIndex || defaultLocalIndex}/${insuranceType}` } }) }), insuranceType === InsuranceTypes.Car
|
|
4004
|
-
&& (jsxs(Route, { path: "car", children: [jsx(Route, { index: true, element: (jsx(AppRouteWrapper, { insuranceType: insuranceType, children: jsx(RouteWrapperPublic, { children: jsx(PageVehicle, {}) }) })) }), jsx(Route, { path: "driver", element: (jsx(AppRouteWrapper, { insuranceType: insuranceType, children: jsx(RouteWrapperPublic, { children: jsx(PageDriver, {}) }) })) }), jsx(Route, { path: "discount", element: (jsx(AppRouteWrapper, { insuranceType: insuranceType, children: jsx(RouteWrapperPublic, { children: jsx(PageCarDiscount, {}) }) })) }), jsx(Route, { path: "quotes
|
|
4012
|
+
&& (jsxs(Route, { path: "car", children: [jsx(Route, { index: true, element: (jsx(AppRouteWrapper, { insuranceType: insuranceType, children: jsx(RouteWrapperPublic, { children: jsx(PageVehicle, {}) }) })) }), jsx(Route, { path: "driver", element: (jsx(AppRouteWrapper, { insuranceType: insuranceType, children: jsx(RouteWrapperPublic, { children: jsx(PageDriver, {}) }) })) }), jsx(Route, { path: "discount", element: (jsx(AppRouteWrapper, { insuranceType: insuranceType, children: jsx(RouteWrapperPublic, { children: jsx(PageCarDiscount, {}) }) })) }), jsx(Route, { path: "quotes", element: (jsx(AppRouteWrapper, { insuranceType: insuranceType, children: jsx(RouteWrapperPublic, { children: jsx(PageCarQuote, {}) }) })) }), jsx(Route, { path: "offer", element: (jsx(AppRouteWrapper, { insuranceType: insuranceType, children: jsx(RouteWrapperPublic, { children: jsx(PageCarQuote, {}) }) })) })] })), jsxs(Route, { path: "home", children: [jsx(Route, { index: true, element: (jsx(AppRouteWrapper, { insuranceType: InsuranceTypes.Home, children: jsx(RouteWrapperPublic, { children: jsx(PageAddress, {}) }) })) }), jsx(Route, { path: "applicant", element: (jsx(AppRouteWrapper, { insuranceType: InsuranceTypes.Home, children: jsx(RouteWrapperPublic, { children: jsx(PageApplicant, {}) }) })) }), jsx(Route, { path: "property", element: (jsx(AppRouteWrapper, { insuranceType: InsuranceTypes.Home, children: jsx(RouteWrapperPublic, { children: jsx(PageProperty, {}) }) })) }), jsx(Route, { path: "discount", element: (jsx(AppRouteWrapper, { insuranceType: InsuranceTypes.Home, children: jsx(RouteWrapperPublic, { children: jsx(PageHomeDiscount, {}) }) })) }), jsx(Route, { path: "quotes", element: (jsx(AppRouteWrapper, { insuranceType: InsuranceTypes.Home, children: jsx(RouteWrapperPublic, { children: jsx(PageHomeQuote, {}) }) })) })] }), jsxs(Route, { path: "condo", children: [jsx(Route, { index: true, element: (jsx(AppRouteWrapper, { insuranceType: InsuranceTypes.Condo, children: jsx(RouteWrapperPublic, { children: jsx(PageAddress, {}) }) })) }), jsx(Route, { path: "applicant", element: (jsx(AppRouteWrapper, { insuranceType: InsuranceTypes.Condo, children: jsx(RouteWrapperPublic, { children: jsx(PageApplicant, {}) }) })) }), jsx(Route, { path: "property", element: (jsx(AppRouteWrapper, { insuranceType: InsuranceTypes.Condo, children: jsx(RouteWrapperPublic, { children: jsx(PageProperty, {}) }) })) }), jsx(Route, { path: "discount", element: (jsx(AppRouteWrapper, { insuranceType: InsuranceTypes.Condo, children: jsx(RouteWrapperPublic, { children: jsx(PageHomeDiscount, {}) }) })) }), jsx(Route, { path: "quotes", element: (jsx(AppRouteWrapper, { insuranceType: InsuranceTypes.Condo, children: jsx(RouteWrapperPublic, { children: jsx(PageHomeQuote, {}) }) })) })] }), jsxs(Route, { path: "tenant", children: [jsx(Route, { index: true, element: (jsx(AppRouteWrapper, { insuranceType: InsuranceTypes.Tenant, children: jsx(RouteWrapperPublic, { children: jsx(PageAddress, {}) }) })) }), jsx(Route, { path: "applicant", element: (jsx(AppRouteWrapper, { insuranceType: InsuranceTypes.Tenant, children: jsx(RouteWrapperPublic, { children: jsx(PageApplicant, {}) }) })) }), jsx(Route, { path: "property", element: (jsx(AppRouteWrapper, { insuranceType: InsuranceTypes.Tenant, children: jsx(RouteWrapperPublic, { children: jsx(PageProperty, {}) }) })) }), jsx(Route, { path: "discount", element: (jsx(AppRouteWrapper, { insuranceType: InsuranceTypes.Tenant, children: jsx(RouteWrapperPublic, { children: jsx(PageHomeDiscount, {}) }) })) }), jsx(Route, { path: "quotes", element: (jsx(AppRouteWrapper, { insuranceType: InsuranceTypes.Tenant, children: jsx(RouteWrapperPublic, { children: jsx(PageHomeQuote, {}) }) })) })] }), jsxs(Route, { path: "life", children: [jsx(Route, { index: true, element: (jsx(AppRouteWrapper, { insuranceType: InsuranceTypes.Life, children: jsx(RouteWrapperPublic, { children: jsx(PageCoverage, {}) }) })) }), jsx(Route, { path: "applicant", element: (jsx(AppRouteWrapper, { insuranceType: InsuranceTypes.Life, children: jsx(RouteWrapperPublic, { children: jsx(PageLifeApplicant, {}) }) })) }), jsx(Route, { path: "quotes", element: (jsx(AppRouteWrapper, { insuranceType: InsuranceTypes.Life, children: jsx(RouteWrapperPublic, { children: jsx(PageLifeQuote, {}) }) })) })] })] }) })) }));
|
|
4005
4013
|
};
|
|
4006
4014
|
const RedirectWithSearchParams = ({ to, path }) => {
|
|
4007
4015
|
const insuranceType = getInsuranceType();
|