@mychoice/mychoice-sdk-modules 2.1.57 → 2.1.58
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 +19 -27
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +20 -28
- package/dist/esm/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/cjs/init/StoryAppWrapper/StoryAppWrapper.d.ts +0 -3
- package/dist/cjs/init/StoryAppWrapper/index.d.ts +0 -1
- package/dist/cjs/init/StoryAppWrapper/interfaces.d.ts +0 -4
- package/dist/cjs/init/helper.d.ts +0 -2
- package/dist/cjs/insurances/car/pages/helpers.d.ts +0 -7
- package/dist/cjs/insurances/car/pages/quote/PageAllQuotes.d.ts +0 -2
- package/dist/cjs/insurances/car/pages/quote/sections/blocks/BlockConfirmImages.d.ts +0 -1
- package/dist/cjs/insurances/car/pages/quote/sections/blocks/BlockQuoteStatistics.d.ts +0 -2
- package/dist/cjs/insurances/home/pages/address/sections/blocks/BlockAddressInfo.d.ts +0 -2
- package/dist/cjs/insurances/home/pages/address/sections/blocks/index.d.ts +0 -1
- package/dist/cjs/insurances/home/pages/helpers.d.ts +0 -4
- package/dist/cjs/shared/sections/quotes/OfferSection/BestOfferSection.d.ts +0 -3
- package/dist/cjs/shared/sections/quotes/OfferSection/DummyOfferSection.d.ts +0 -3
- package/dist/esm/init/StoryAppWrapper/StoryAppWrapper.d.ts +0 -3
- package/dist/esm/init/StoryAppWrapper/index.d.ts +0 -1
- package/dist/esm/init/StoryAppWrapper/interfaces.d.ts +0 -4
- package/dist/esm/init/helper.d.ts +0 -2
- package/dist/esm/insurances/car/pages/helpers.d.ts +0 -7
- package/dist/esm/insurances/car/pages/quote/PageAllQuotes.d.ts +0 -2
- package/dist/esm/insurances/car/pages/quote/sections/blocks/BlockConfirmImages.d.ts +0 -1
- package/dist/esm/insurances/car/pages/quote/sections/blocks/BlockQuoteStatistics.d.ts +0 -2
- package/dist/esm/insurances/home/pages/address/sections/blocks/BlockAddressInfo.d.ts +0 -2
- package/dist/esm/insurances/home/pages/address/sections/blocks/index.d.ts +0 -1
- package/dist/esm/insurances/home/pages/helpers.d.ts +0 -4
- package/dist/esm/shared/sections/quotes/OfferSection/BestOfferSection.d.ts +0 -3
- package/dist/esm/shared/sections/quotes/OfferSection/DummyOfferSection.d.ts +0 -3
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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, 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, 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, lifeInsuranceOntarioTypeOptions, lifeInsuranceTypeOptions,
|
|
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, 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, lifeInsuranceOntarioTypeOptions, lifeInsuranceTypeOptions, lifeCoverageOptions, smokerOptions, MychoiceStep, Step, IconClock, ButtonArrow, DirectionTypes, ButtonTabArrow, ButtonTab, ButtonTabMobile, NavigationCar, NavigationPerson, NavigationDiscount, NavigationQuotes, NavigationAddress, NavigationProperty, ModalTypes } from '@mychoice/mychoice-sdk-components';
|
|
4
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, useMemo } from 'react';
|
|
@@ -196,7 +196,7 @@ const usePathGroups = (insuranceType) => {
|
|
|
196
196
|
const externalPathGroup = [
|
|
197
197
|
{ name: 'Car', link: 'https://quote.mychoice.ca/insurance/car' },
|
|
198
198
|
{ name: 'Home', link: 'https://quote.mychoice.ca/insurance/home' },
|
|
199
|
-
{ name: 'Life', link: 'https://
|
|
199
|
+
{ name: 'Life', link: 'https://quote.mychoice.ca/insurance/life' },
|
|
200
200
|
{ name: 'Learn', link: 'https://www.mychoice.ca/blog/' },
|
|
201
201
|
];
|
|
202
202
|
// @todo: use in future.
|
|
@@ -225,7 +225,7 @@ const HeaderMyChoice = ({ className, }) => {
|
|
|
225
225
|
? InsuranceTypes.Home
|
|
226
226
|
: insuranceType;
|
|
227
227
|
const { externalPathGroup } = usePathGroups(insuranceTypeCls);
|
|
228
|
-
return (jsx("div", { className: `${className} primary-header`, children: jsxs("div", { className: "content", children: [jsx("div", { className: "logo", children: jsx("a", { href: "https://www.mychoice.ca/", rel: "noreferrer", children: jsx("img", { src: logo, alt: "logotype" }) }) }), jsx("div", { className: "nav-links", children: jsx(HeaderNavGroup, { className: insuranceTypeCls, navItems: externalPathGroup }) }), jsx("div", { className: "empty-box" })] }) }));
|
|
228
|
+
return (jsx("div", { className: `${className} primary-header`, children: jsxs("div", { className: "content", children: [jsx("div", { className: "logo", children: jsx("a", { href: "https://www.mychoice.ca/", rel: "noreferrer", children: jsx("img", { src: logo, alt: "logotype" }) }) }), jsx("div", { className: "nav-links", children: jsx(HeaderNavGroup, { className: insuranceTypeCls, navItems: externalPathGroup, isExternal: true }) }), jsx("div", { className: "empty-box" })] }) }));
|
|
229
229
|
};
|
|
230
230
|
HeaderMyChoice.defaultProps = {
|
|
231
231
|
className: '',
|
|
@@ -305,8 +305,8 @@ const ModalMessage = () => {
|
|
|
305
305
|
const ModalPostal = () => {
|
|
306
306
|
const [inputValue, setInputValue] = useState('');
|
|
307
307
|
const insuranceType = getInsuranceType();
|
|
308
|
-
const { getPostal, status, errorMessage
|
|
309
|
-
const { appModalState: { title, submitButtonText, submitCallBack
|
|
308
|
+
const { getPostal, status, errorMessage } = useHandlerPostal(insuranceType);
|
|
309
|
+
const { appModalState: { title, submitButtonText, submitCallBack }, } = useStoreAppModal();
|
|
310
310
|
const loading = status === RequestStatusTypes.Loading;
|
|
311
311
|
const error = status === RequestStatusTypes.Error;
|
|
312
312
|
const onSubmit = (event) => {
|
|
@@ -2988,12 +2988,12 @@ const SectionCoverage = () => {
|
|
|
2988
2988
|
const { coverageState: { type, coverage, province, inValidation }, dispatchCoverageState, } = useStoreFormLifeCoverage();
|
|
2989
2989
|
const { appConfigState: { appType }, } = useStoreAppConfig();
|
|
2990
2990
|
const isMychoice = appType === AppTypes.MyChoice;
|
|
2991
|
-
const handleProvinceChange = ({ value }) => {
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
};
|
|
2991
|
+
// const handleProvinceChange = ({ value }: OnChangeEventInterface) => {
|
|
2992
|
+
// dispatchCoverageState({
|
|
2993
|
+
// type: StoreFormLifeCoverageActionTypes.FormLifeProvinceSelect,
|
|
2994
|
+
// payload: { province: value as string },
|
|
2995
|
+
// });
|
|
2996
|
+
// };
|
|
2997
2997
|
const handleLifeInsuranceTypeChange = ({ value }) => {
|
|
2998
2998
|
dispatchCoverageState({
|
|
2999
2999
|
type: StoreFormLifeCoverageActionTypes.FormLifeCoverageTypeSelect,
|
|
@@ -3017,7 +3017,7 @@ const SectionCoverage = () => {
|
|
|
3017
3017
|
options: lifeInsuranceTypeOptions.filter((option) => option.name.includes('Year Level')),
|
|
3018
3018
|
};
|
|
3019
3019
|
}, [isMychoice, province]);
|
|
3020
|
-
return (jsxs("div", { className: "form-section", children: [jsx("h2", { className: "section-title", style: { textAlign: 'center' }, children: "Get the coverage you need" }), jsx(SelectFormBox, {
|
|
3020
|
+
return (jsxs("div", { className: "form-section", children: [jsx("h2", { className: "section-title", style: { textAlign: 'center' }, children: "Get the coverage you need" }), jsx(SelectFormBox, { ...newLifeOptions, name: "type", onChange: handleLifeInsuranceTypeChange, defaultValue: type, title: "Type of Insurance", description: jsx(Description, {}), placeholder: "Select", autoSelectIfValueIsOutOfOptions: false, error: !type && inValidation, errorMessage: getErrorMessage(type, inValidation) }), jsx(SelectFormBox, { options: lifeCoverageOptions, name: "coverage", onChange: handleCoverageChange, defaultValue: coverage, title: "Required coverage", description: "The extent of coverage you need is determined by several factors, including your expenditure patterns, anticipated future expenses, yearly earnings, and so forth. Generally, individuals opt for a coverage amount that equals five times their current annual income before taxes. On an average, it is observed that Canadians choose a coverage amount of around $500,000.", placeholder: "Select", autoSelectIfValueIsOutOfOptions: false, error: !coverage && inValidation, errorMessage: getErrorMessage(coverage, inValidation) })] }));
|
|
3021
3021
|
};
|
|
3022
3022
|
|
|
3023
3023
|
const PageCoverage = () => {
|
|
@@ -3932,7 +3932,7 @@ const AppRouteWrapper = (props) => {
|
|
|
3932
3932
|
const { homeDiscountFormValidate, homeDiscountFormIsValid } = useValidationHomeDiscount();
|
|
3933
3933
|
// life insurance validation
|
|
3934
3934
|
const { coverageFormValidate, coverageFormIsValid } = useValidationCoverage();
|
|
3935
|
-
const { applicantFormValidate: lifeApplicantFormValidate, applicantFormIsValid: lifeApplicantFormIsValid
|
|
3935
|
+
const { applicantFormValidate: lifeApplicantFormValidate, applicantFormIsValid: lifeApplicantFormIsValid } = useValidationLifeApplicant();
|
|
3936
3936
|
let postalCode = carPostal;
|
|
3937
3937
|
const { clearFormData, checkIsExpired, checkIsExpiredWithModal } = ClearFormDataHandler();
|
|
3938
3938
|
const { appLoaderState } = useStoreAppLoader();
|
|
@@ -4190,7 +4190,8 @@ const AppRouteWrapper = (props) => {
|
|
|
4190
4190
|
});
|
|
4191
4191
|
useEffect(() => {
|
|
4192
4192
|
if (isReady) {
|
|
4193
|
-
if (!carPostal && insuranceType === InsuranceTypes.Car)
|
|
4193
|
+
if ((!carPostal && insuranceType === InsuranceTypes.Car) ||
|
|
4194
|
+
(!lifePostal && insuranceType === InsuranceTypes.Life)) {
|
|
4194
4195
|
dispatchAppModalState({
|
|
4195
4196
|
type: StoreConfigAppModalActionTypes.AppModalPostalModal,
|
|
4196
4197
|
payload: {
|
|
@@ -4200,12 +4201,7 @@ const AppRouteWrapper = (props) => {
|
|
|
4200
4201
|
}
|
|
4201
4202
|
}
|
|
4202
4203
|
}, [carPostal, homePostal, lifePostal, isReady]);
|
|
4203
|
-
return (jsx(Fragment, { children: isReady && (jsxs(Fragment, { children: [jsx(AppHeader, {}), jsx(AppModal, {}), insuranceType && (jsx(NavigationTop, { title: `${insuranceType.replace(/^./, insuranceType[0].toUpperCase())} Insurance Quote`, postalCode: postalCode, formSteps: steps, validationHooks: validationHooks, clearForm: clearFormData, propertyIsCompleted: isCompleted })), insuranceType && appType === AppTypes.MyChoice && (jsx("div", { className: localIndex !== defaultLocalIndex
|
|
4204
|
-
? 'step-progress-bar-partner'
|
|
4205
|
-
: 'step-progress-bar', children: jsx("span", { style: { width: progressLength } }) })), jsx("div", { className: `${insuranceType ? 'form-page-content' : ''} ${insuranceType && appType === AppTypes.MyChoice ? 'mychoice' : ''}`, children: insuranceType &&
|
|
4206
|
-
appType === AppTypes.MyChoice &&
|
|
4207
|
-
isDesktop &&
|
|
4208
|
-
progressLength ? (jsx(Fragment, { children: jsxs("div", { className: "mychoice-content", children: [jsx(StepsBox, { className: "step-box", formSteps: steps, validationHooks: validationHooks, propertyIsCompleted: isCompleted }), children, jsx("div", { className: "empty-steps-container" })] }) })) : (children) }), isMychoice && !appLoaderState.isOpen && jsx(ProviderImageFooter, {})] })) }));
|
|
4204
|
+
return (jsx(Fragment, { children: isReady && (jsxs(Fragment, { children: [jsx(AppHeader, {}), jsx(AppModal, {}), insuranceType && (jsx(NavigationTop, { title: `${insuranceType.replace(/^./, insuranceType[0].toUpperCase())} Insurance Quote`, postalCode: postalCode, formSteps: steps, validationHooks: validationHooks, clearForm: clearFormData, propertyIsCompleted: isCompleted })), insuranceType && appType === AppTypes.MyChoice && (jsx("div", { className: localIndex !== defaultLocalIndex ? 'step-progress-bar-partner' : 'step-progress-bar', children: jsx("span", { style: { width: progressLength } }) })), jsx("div", { className: `${insuranceType ? 'form-page-content' : ''} ${insuranceType && appType === AppTypes.MyChoice ? 'mychoice' : ''}`, children: insuranceType && appType === AppTypes.MyChoice && isDesktop && progressLength ? (jsx(Fragment, { children: jsxs("div", { className: "mychoice-content", children: [jsx(StepsBox, { className: "step-box", formSteps: steps, validationHooks: validationHooks, propertyIsCompleted: isCompleted }), children, jsx("div", { className: "empty-steps-container" })] }) })) : (children) }), isMychoice && !appLoaderState.isOpen && jsx(ProviderImageFooter, {})] })) }));
|
|
4209
4205
|
};
|
|
4210
4206
|
const NestedRoutes = () => {
|
|
4211
4207
|
const insuranceType = getInsuranceType();
|
|
@@ -4220,7 +4216,7 @@ const NestedRoutes = () => {
|
|
|
4220
4216
|
pathname: `/${appConfigState.localIndex || defaultLocalIndex}/${insuranceType}`,
|
|
4221
4217
|
} }) }), insuranceType === InsuranceTypes.Car && (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, {}) }) }) })] })] }) })) }));
|
|
4222
4218
|
};
|
|
4223
|
-
const RedirectWithSearchParams = ({ to, path
|
|
4219
|
+
const RedirectWithSearchParams = ({ to, path }) => {
|
|
4224
4220
|
const insuranceType = getInsuranceType();
|
|
4225
4221
|
const [isRender, setIsRender] = useState(false);
|
|
4226
4222
|
const { getPostal } = useHandlerPostal(insuranceType);
|
|
@@ -4231,12 +4227,9 @@ const RedirectWithSearchParams = ({ to, path, }) => {
|
|
|
4231
4227
|
const toBasePath = to?.split('/')?.slice(-1)?.[0];
|
|
4232
4228
|
useEffectOnce(() => {
|
|
4233
4229
|
if (queryRoot.length > 1) {
|
|
4234
|
-
const query = JSON.parse(`{"${decodeURI(queryRoot[1])
|
|
4235
|
-
.replace(/"/g, '\\"')
|
|
4236
|
-
.replace(/&/g, '","')
|
|
4237
|
-
.replace(/=/g, '":"')}"}`);
|
|
4230
|
+
const query = JSON.parse(`{"${decodeURI(queryRoot[1]).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"')}"}`);
|
|
4238
4231
|
if (!isRender) {
|
|
4239
|
-
if (query.postal_code
|
|
4232
|
+
if (query.postal_code) {
|
|
4240
4233
|
const formattedPostalCode = query.postal_code.replace(' ', '');
|
|
4241
4234
|
getPostal(formattedPostalCode).then(() => {
|
|
4242
4235
|
setIsRender(true);
|
|
@@ -4280,8 +4273,7 @@ const RedirectWithSearchParams = ({ to, path, }) => {
|
|
|
4280
4273
|
payload: { utmCampaign: query.utm_campaign },
|
|
4281
4274
|
});
|
|
4282
4275
|
}
|
|
4283
|
-
if (path === 'broker' ||
|
|
4284
|
-
['home', 'condo', 'tenant'].includes(toBasePath)) {
|
|
4276
|
+
if (path === 'broker' || ['home', 'condo', 'tenant'].includes(toBasePath)) {
|
|
4285
4277
|
dispatchHomeDiscountState({
|
|
4286
4278
|
type: StoreFormHomeDiscountActionTypes.FormHomeQuoterBrokerInfoSet,
|
|
4287
4279
|
payload: query,
|