@mychoice/mychoice-sdk-modules 2.1.35 → 2.1.36
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 +119 -59
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +119 -59
- package/dist/esm/index.js.map +1 -1
- package/package.json +3 -3
package/dist/esm/index.js
CHANGED
|
@@ -1742,7 +1742,7 @@ const BlockEndorsements = () => {
|
|
|
1742
1742
|
};
|
|
1743
1743
|
|
|
1744
1744
|
const SectionQuoteRecalc$1 = () => {
|
|
1745
|
-
const { appConfigState: { appType } } = useStoreAppConfig();
|
|
1745
|
+
const { appConfigState: { appType }, } = useStoreAppConfig();
|
|
1746
1746
|
const isTheBig = appType === AppTypes.TheBig;
|
|
1747
1747
|
const mychoiceCls = appType === AppTypes.MyChoice ? 'mychoice' : '';
|
|
1748
1748
|
const { vehicleState, dispatchVehicleState } = useStoreFormCarVehicle();
|
|
@@ -3123,28 +3123,25 @@ const PageLifeQuote = () => {
|
|
|
3123
3123
|
behavior: 'smooth',
|
|
3124
3124
|
});
|
|
3125
3125
|
});
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
? (jsx("div", { className: "offer-container", children: jsx(OfferSection, { isBestOffer: true, offerCompany: items[0]?.company, brokerCompany: items[0]?.brokerProfile, offerPrice: {
|
|
3130
|
-
monthly: items[0]?.priceMonthly,
|
|
3131
|
-
yearly: items[0]?.priceYearly,
|
|
3132
|
-
}, operationHours: {
|
|
3133
|
-
saturdayHours: items[0]?.brokerProfile.hoursSaturday,
|
|
3134
|
-
sundayHours: items[0]?.brokerProfile.hoursSunday,
|
|
3135
|
-
weekdayHours: items[0]?.brokerProfile.hoursWorkdays,
|
|
3136
|
-
}, phoneNumber: formatPhoneObject(items[0]?.brokerProfile.phone), redirectUrl: items[0]?.brokerProfile.redirectUrl || '' }) }))
|
|
3137
|
-
: jsx(SplashScreen, {}) })) })), jsx(SectionQuoteEdit, {})] }), appDeviceType !== DeviceTypes.Mobile && quoteState.showCallMessage
|
|
3138
|
-
&& jsx(SplashScreen, {}), !quoteState.showCallMessage
|
|
3139
|
-
&& (jsx("div", { className: "offer-container", children: !!items?.length
|
|
3140
|
-
&& items.map(({ company, brokerProfile, priceMonthly, priceYearly, }, index) => (jsx("div", { children: (appDeviceType !== DeviceTypes.Mobile || (appDeviceType === DeviceTypes.Mobile && index !== 0)) && (jsx(OfferSection, { isBestOffer: index === 0, offerCompany: company, brokerCompany: brokerProfile, offerPrice: {
|
|
3141
|
-
monthly: priceMonthly,
|
|
3142
|
-
yearly: priceYearly,
|
|
3126
|
+
return (jsx("div", { className: "quote-page-content", children: !appLoaderState.isOpen && (jsxs(Fragment, { children: [jsxs("div", { className: "form-section-container", children: [appDeviceType === DeviceTypes.Mobile && (jsx(Fragment, { children: !!items?.length && (jsx(Fragment, { children: !quoteState.showCallMessage ? (jsx("div", { className: "offer-container", children: jsx(OfferSection, { isBestOffer: true, offerCompany: items[0]?.company, brokerCompany: items[0]?.brokerProfile, offerPrice: {
|
|
3127
|
+
monthly: items[0]?.priceMonthly,
|
|
3128
|
+
yearly: items[0]?.priceYearly,
|
|
3143
3129
|
}, operationHours: {
|
|
3144
|
-
saturdayHours: brokerProfile.hoursSaturday,
|
|
3145
|
-
sundayHours: brokerProfile.hoursSunday,
|
|
3146
|
-
weekdayHours: brokerProfile.hoursWorkdays,
|
|
3147
|
-
}, phoneNumber: formatPhoneObject(brokerProfile.phone), redirectUrl: brokerProfile.redirectUrl || '' }))
|
|
3130
|
+
saturdayHours: items[0]?.brokerProfile.hoursSaturday,
|
|
3131
|
+
sundayHours: items[0]?.brokerProfile.hoursSunday,
|
|
3132
|
+
weekdayHours: items[0]?.brokerProfile.hoursWorkdays,
|
|
3133
|
+
}, phoneNumber: formatPhoneObject(items[0]?.brokerProfile.phone), redirectUrl: items[0]?.brokerProfile.redirectUrl || '' }) })) : (jsx(SplashScreen, {})) })) })), jsx(SectionQuoteEdit, {})] }), appDeviceType !== DeviceTypes.Mobile &&
|
|
3134
|
+
quoteState.showCallMessage && jsx(SplashScreen, {}), !quoteState.showCallMessage && (jsx("div", { className: "offer-container", children: !!items?.length &&
|
|
3135
|
+
items.map(({ company, brokerProfile, priceMonthly, priceYearly, }, index) => (jsx("div", { children: (appDeviceType !== DeviceTypes.Mobile ||
|
|
3136
|
+
(appDeviceType === DeviceTypes.Mobile &&
|
|
3137
|
+
index !== 0)) && (jsx(OfferSection, { isBestOffer: index === 0, offerCompany: company, brokerCompany: brokerProfile, offerPrice: {
|
|
3138
|
+
monthly: priceMonthly,
|
|
3139
|
+
yearly: priceYearly,
|
|
3140
|
+
}, operationHours: {
|
|
3141
|
+
saturdayHours: brokerProfile.hoursSaturday,
|
|
3142
|
+
sundayHours: brokerProfile.hoursSunday,
|
|
3143
|
+
weekdayHours: brokerProfile.hoursWorkdays,
|
|
3144
|
+
}, phoneNumber: formatPhoneObject(brokerProfile.phone), redirectUrl: brokerProfile.redirectUrl || '' })) }, index))) }))] })) }));
|
|
3148
3145
|
};
|
|
3149
3146
|
|
|
3150
3147
|
const getFormattedAddress = (unitNumber, streetAddress, city, provinceCode, postalCode, country) => {
|
|
@@ -3771,14 +3768,14 @@ const AppRouterListener = () => {
|
|
|
3771
3768
|
|
|
3772
3769
|
const AppRouteWrapper = (props) => {
|
|
3773
3770
|
const { children } = props;
|
|
3774
|
-
const { appConfigState: { isReady, appType, insuranceType, localIndex
|
|
3771
|
+
const { appConfigState: { isReady, appType, insuranceType, localIndex }, } = useStoreAppConfig();
|
|
3775
3772
|
const { dispatchAppModalState } = useStoreAppModal();
|
|
3776
3773
|
const { postRequestQuote: carPostRequestQuote } = CarQuoteDataHandler();
|
|
3777
3774
|
const { postRequestQuote: homePostRequestQuote } = HomeQuoteDataHandler();
|
|
3778
3775
|
const { postRequestQuote: lifePostRequestQuote } = LifeQuoteDataHandler();
|
|
3779
|
-
const { postalState: { item: { postalCode: carPostal } } } = useStoreFormCarPostal();
|
|
3780
|
-
const { postalState: { item: { postalCode: homePostal } } } = useStoreFormHomePostal();
|
|
3781
|
-
const { postalState: { item: { postalCode: lifePostal } } } = useStoreFormLifePostal();
|
|
3776
|
+
const { postalState: { item: { postalCode: carPostal }, }, } = useStoreFormCarPostal();
|
|
3777
|
+
const { postalState: { item: { postalCode: homePostal }, }, } = useStoreFormHomePostal();
|
|
3778
|
+
const { postalState: { item: { postalCode: lifePostal }, }, } = useStoreFormLifePostal();
|
|
3782
3779
|
// Car insurance states
|
|
3783
3780
|
const { vehicleState } = useStoreFormCarVehicle();
|
|
3784
3781
|
const { driverState } = useStoreFormCarDriverBase();
|
|
@@ -3804,9 +3801,9 @@ const AppRouteWrapper = (props) => {
|
|
|
3804
3801
|
const { homeDiscountFormValidate, homeDiscountFormIsValid } = useValidationHomeDiscount();
|
|
3805
3802
|
// life insurance validation
|
|
3806
3803
|
const { coverageFormValidate, coverageFormIsValid } = useValidationCoverage();
|
|
3807
|
-
const { applicantFormValidate: lifeApplicantFormValidate, applicantFormIsValid: lifeApplicantFormIsValid } = useValidationLifeApplicant();
|
|
3804
|
+
const { applicantFormValidate: lifeApplicantFormValidate, applicantFormIsValid: lifeApplicantFormIsValid, } = useValidationLifeApplicant();
|
|
3808
3805
|
let postalCode = carPostal;
|
|
3809
|
-
const { clearFormData, checkIsExpired, checkIsExpiredWithModal
|
|
3806
|
+
const { clearFormData, checkIsExpired, checkIsExpiredWithModal } = ClearFormDataHandler();
|
|
3810
3807
|
const { appLoaderState } = useStoreAppLoader();
|
|
3811
3808
|
const isMychoice = appType === AppTypes.MyChoice;
|
|
3812
3809
|
switch (insuranceType) {
|
|
@@ -3832,19 +3829,28 @@ const AppRouteWrapper = (props) => {
|
|
|
3832
3829
|
key: 0,
|
|
3833
3830
|
path: '/',
|
|
3834
3831
|
name: 'Step 1',
|
|
3835
|
-
validateOptions: {
|
|
3832
|
+
validateOptions: {
|
|
3833
|
+
validate: vehicleFormValidate,
|
|
3834
|
+
isValid: vehicleFormIsValid,
|
|
3835
|
+
},
|
|
3836
3836
|
},
|
|
3837
3837
|
{
|
|
3838
3838
|
key: 1,
|
|
3839
3839
|
path: '/driver',
|
|
3840
3840
|
name: 'Step 2',
|
|
3841
|
-
validateOptions: {
|
|
3841
|
+
validateOptions: {
|
|
3842
|
+
validate: driverFormValidate,
|
|
3843
|
+
isValid: driverFormIsValid,
|
|
3844
|
+
},
|
|
3842
3845
|
},
|
|
3843
3846
|
{
|
|
3844
3847
|
key: 2,
|
|
3845
3848
|
path: '/discount',
|
|
3846
3849
|
name: 'Step 3',
|
|
3847
|
-
validateOptions: {
|
|
3850
|
+
validateOptions: {
|
|
3851
|
+
validate: carDiscountFormValidate,
|
|
3852
|
+
isValid: carDiscountFormIsValid,
|
|
3853
|
+
},
|
|
3848
3854
|
requestFn: carPostRequestQuote,
|
|
3849
3855
|
},
|
|
3850
3856
|
],
|
|
@@ -3853,25 +3859,37 @@ const AppRouteWrapper = (props) => {
|
|
|
3853
3859
|
key: 0,
|
|
3854
3860
|
path: '/',
|
|
3855
3861
|
name: 'Step 1',
|
|
3856
|
-
validateOptions: {
|
|
3862
|
+
validateOptions: {
|
|
3863
|
+
validate: addressFormValidate,
|
|
3864
|
+
isValid: addressFormIsValid,
|
|
3865
|
+
},
|
|
3857
3866
|
},
|
|
3858
3867
|
{
|
|
3859
3868
|
key: 1,
|
|
3860
3869
|
path: '/applicant',
|
|
3861
3870
|
name: 'Step 2',
|
|
3862
|
-
validateOptions: {
|
|
3871
|
+
validateOptions: {
|
|
3872
|
+
validate: applicantFormValidate,
|
|
3873
|
+
isValid: applicantFormIsValid,
|
|
3874
|
+
},
|
|
3863
3875
|
},
|
|
3864
3876
|
{
|
|
3865
3877
|
key: 2,
|
|
3866
3878
|
path: '/property',
|
|
3867
3879
|
name: 'Step 3',
|
|
3868
|
-
validateOptions: {
|
|
3880
|
+
validateOptions: {
|
|
3881
|
+
validate: dwellingFormValidate,
|
|
3882
|
+
isValid: dwellingFormIsValid,
|
|
3883
|
+
},
|
|
3869
3884
|
},
|
|
3870
3885
|
{
|
|
3871
3886
|
key: 3,
|
|
3872
3887
|
path: '/discount',
|
|
3873
3888
|
name: 'Step 4',
|
|
3874
|
-
validateOptions: {
|
|
3889
|
+
validateOptions: {
|
|
3890
|
+
validate: homeDiscountFormValidate,
|
|
3891
|
+
isValid: homeDiscountFormIsValid,
|
|
3892
|
+
},
|
|
3875
3893
|
requestFn: homePostRequestQuote,
|
|
3876
3894
|
},
|
|
3877
3895
|
],
|
|
@@ -3880,25 +3898,37 @@ const AppRouteWrapper = (props) => {
|
|
|
3880
3898
|
key: 0,
|
|
3881
3899
|
path: '/',
|
|
3882
3900
|
name: 'Step 1',
|
|
3883
|
-
validateOptions: {
|
|
3901
|
+
validateOptions: {
|
|
3902
|
+
validate: addressFormValidate,
|
|
3903
|
+
isValid: addressFormIsValid,
|
|
3904
|
+
},
|
|
3884
3905
|
},
|
|
3885
3906
|
{
|
|
3886
3907
|
key: 1,
|
|
3887
3908
|
path: '/applicant',
|
|
3888
3909
|
name: 'Step 2',
|
|
3889
|
-
validateOptions: {
|
|
3910
|
+
validateOptions: {
|
|
3911
|
+
validate: applicantFormValidate,
|
|
3912
|
+
isValid: applicantFormIsValid,
|
|
3913
|
+
},
|
|
3890
3914
|
},
|
|
3891
3915
|
{
|
|
3892
3916
|
key: 2,
|
|
3893
3917
|
path: '/property',
|
|
3894
3918
|
name: 'Step 3',
|
|
3895
|
-
validateOptions: {
|
|
3919
|
+
validateOptions: {
|
|
3920
|
+
validate: dwellingFormValidate,
|
|
3921
|
+
isValid: dwellingFormIsValid,
|
|
3922
|
+
},
|
|
3896
3923
|
},
|
|
3897
3924
|
{
|
|
3898
3925
|
key: 3,
|
|
3899
3926
|
path: '/discount',
|
|
3900
3927
|
name: 'Step 4',
|
|
3901
|
-
validateOptions: {
|
|
3928
|
+
validateOptions: {
|
|
3929
|
+
validate: homeDiscountFormValidate,
|
|
3930
|
+
isValid: homeDiscountFormIsValid,
|
|
3931
|
+
},
|
|
3902
3932
|
requestFn: homePostRequestQuote,
|
|
3903
3933
|
},
|
|
3904
3934
|
],
|
|
@@ -3907,25 +3937,37 @@ const AppRouteWrapper = (props) => {
|
|
|
3907
3937
|
key: 0,
|
|
3908
3938
|
path: '/',
|
|
3909
3939
|
name: 'Step 1',
|
|
3910
|
-
validateOptions: {
|
|
3940
|
+
validateOptions: {
|
|
3941
|
+
validate: addressFormValidate,
|
|
3942
|
+
isValid: addressFormIsValid,
|
|
3943
|
+
},
|
|
3911
3944
|
},
|
|
3912
3945
|
{
|
|
3913
3946
|
key: 1,
|
|
3914
3947
|
path: '/applicant',
|
|
3915
3948
|
name: 'Step 2',
|
|
3916
|
-
validateOptions: {
|
|
3949
|
+
validateOptions: {
|
|
3950
|
+
validate: applicantFormValidate,
|
|
3951
|
+
isValid: applicantFormIsValid,
|
|
3952
|
+
},
|
|
3917
3953
|
},
|
|
3918
3954
|
{
|
|
3919
3955
|
key: 2,
|
|
3920
3956
|
path: '/property',
|
|
3921
3957
|
name: 'Step 3',
|
|
3922
|
-
validateOptions: {
|
|
3958
|
+
validateOptions: {
|
|
3959
|
+
validate: dwellingFormValidate,
|
|
3960
|
+
isValid: dwellingFormIsValid,
|
|
3961
|
+
},
|
|
3923
3962
|
},
|
|
3924
3963
|
{
|
|
3925
3964
|
key: 3,
|
|
3926
3965
|
path: '/discount',
|
|
3927
3966
|
name: 'Step 4',
|
|
3928
|
-
validateOptions: {
|
|
3967
|
+
validateOptions: {
|
|
3968
|
+
validate: homeDiscountFormValidate,
|
|
3969
|
+
isValid: homeDiscountFormIsValid,
|
|
3970
|
+
},
|
|
3929
3971
|
requestFn: homePostRequestQuote,
|
|
3930
3972
|
},
|
|
3931
3973
|
],
|
|
@@ -3934,13 +3976,19 @@ const AppRouteWrapper = (props) => {
|
|
|
3934
3976
|
key: 0,
|
|
3935
3977
|
path: '/',
|
|
3936
3978
|
name: 'Step 1',
|
|
3937
|
-
validateOptions: {
|
|
3979
|
+
validateOptions: {
|
|
3980
|
+
validate: coverageFormValidate,
|
|
3981
|
+
isValid: coverageFormIsValid,
|
|
3982
|
+
},
|
|
3938
3983
|
},
|
|
3939
3984
|
{
|
|
3940
3985
|
key: 1,
|
|
3941
3986
|
path: '/applicant',
|
|
3942
3987
|
name: 'Step 2',
|
|
3943
|
-
validateOptions: {
|
|
3988
|
+
validateOptions: {
|
|
3989
|
+
validate: lifeApplicantFormValidate,
|
|
3990
|
+
isValid: lifeApplicantFormIsValid,
|
|
3991
|
+
},
|
|
3944
3992
|
requestFn: lifePostRequestQuote,
|
|
3945
3993
|
},
|
|
3946
3994
|
],
|
|
@@ -3951,7 +3999,10 @@ const AppRouteWrapper = (props) => {
|
|
|
3951
3999
|
useEffect(() => {
|
|
3952
4000
|
let filteredSteps = formSteps[insuranceType];
|
|
3953
4001
|
let filteredHooks = formValidationHooks[insuranceType];
|
|
3954
|
-
if (isCompleted &&
|
|
4002
|
+
if (isCompleted &&
|
|
4003
|
+
(insuranceType === InsuranceTypes.Home ||
|
|
4004
|
+
insuranceType === InsuranceTypes.Condo ||
|
|
4005
|
+
insuranceType === InsuranceTypes.Tenant)) {
|
|
3955
4006
|
filteredSteps = formSteps[insuranceType].filter((item) => item.path !== '/property');
|
|
3956
4007
|
filteredHooks = formValidationHooks[insuranceType].filter((item) => item.path !== '/property');
|
|
3957
4008
|
}
|
|
@@ -4018,7 +4069,12 @@ const AppRouteWrapper = (props) => {
|
|
|
4018
4069
|
}
|
|
4019
4070
|
}
|
|
4020
4071
|
}, [carPostal, homePostal, lifePostal, isReady]);
|
|
4021
|
-
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
|
|
4072
|
+
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
|
|
4073
|
+
? 'step-progress-bar-partner'
|
|
4074
|
+
: 'step-progress-bar', children: jsx("span", { style: { width: progressLength } }) })), jsx("div", { className: `${insuranceType ? 'form-page-content' : ''} ${insuranceType && appType === AppTypes.MyChoice ? 'mychoice' : ''}`, children: insuranceType &&
|
|
4075
|
+
appType === AppTypes.MyChoice &&
|
|
4076
|
+
isDesktop &&
|
|
4077
|
+
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, {})] })) }));
|
|
4022
4078
|
};
|
|
4023
4079
|
const NestedRoutes = () => {
|
|
4024
4080
|
const insuranceType = getInsuranceType();
|
|
@@ -4029,10 +4085,11 @@ const NestedRoutes = () => {
|
|
|
4029
4085
|
payload: true,
|
|
4030
4086
|
});
|
|
4031
4087
|
});
|
|
4032
|
-
return (jsx(Fragment, { children: appConfigState.drawWrapper && (jsx(Fragment, { children: jsxs(Routes, { children: [jsx(Route, { path: "*", element: jsx(Navigate, { to: {
|
|
4033
|
-
|
|
4088
|
+
return (jsx(Fragment, { children: appConfigState.drawWrapper && (jsx(Fragment, { children: jsxs(Routes, { children: [jsx(Route, { path: "*", element: jsx(Navigate, { to: {
|
|
4089
|
+
pathname: `/${appConfigState.localIndex || defaultLocalIndex}/${insuranceType}`,
|
|
4090
|
+
} }) }), 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, {}) }) }) })] })] }) })) }));
|
|
4034
4091
|
};
|
|
4035
|
-
const RedirectWithSearchParams = ({ to, path }) => {
|
|
4092
|
+
const RedirectWithSearchParams = ({ to, path, }) => {
|
|
4036
4093
|
const insuranceType = getInsuranceType();
|
|
4037
4094
|
useStoreAppConfig();
|
|
4038
4095
|
const [isRender, setIsRender] = useState(false);
|
|
@@ -4044,10 +4101,12 @@ const RedirectWithSearchParams = ({ to, path }) => {
|
|
|
4044
4101
|
const toBasePath = to?.split('/')?.slice(-1)?.[0];
|
|
4045
4102
|
useEffectOnce(() => {
|
|
4046
4103
|
if (queryRoot.length > 1) {
|
|
4047
|
-
const query = JSON.parse(`{"${decodeURI(queryRoot[1])
|
|
4048
|
-
|
|
4104
|
+
const query = JSON.parse(`{"${decodeURI(queryRoot[1])
|
|
4105
|
+
.replace(/"/g, '\\"')
|
|
4106
|
+
.replace(/&/g, '","')
|
|
4107
|
+
.replace(/=/g, '":"')}"}`);
|
|
4049
4108
|
if (!isRender) {
|
|
4050
|
-
if (query.postal_code &&
|
|
4109
|
+
if (query.postal_code && insuranceType !== InsuranceTypes.Life) {
|
|
4051
4110
|
const formattedPostalCode = query.postal_code.replace(' ', '');
|
|
4052
4111
|
getPostal(formattedPostalCode).then(() => {
|
|
4053
4112
|
setIsRender(true);
|
|
@@ -4076,7 +4135,9 @@ const RedirectWithSearchParams = ({ to, path }) => {
|
|
|
4076
4135
|
});
|
|
4077
4136
|
}
|
|
4078
4137
|
}
|
|
4079
|
-
if (insuranceType === InsuranceTypes.Home ||
|
|
4138
|
+
if (insuranceType === InsuranceTypes.Home ||
|
|
4139
|
+
insuranceType === InsuranceTypes.Condo ||
|
|
4140
|
+
insuranceType === InsuranceTypes.Tenant) {
|
|
4080
4141
|
if (query.utm_source) {
|
|
4081
4142
|
dispatchHomeDiscountState({
|
|
4082
4143
|
type: StoreFormHomeDiscountActionTypes.FormHomeUtmSourceSet,
|
|
@@ -4089,7 +4150,8 @@ const RedirectWithSearchParams = ({ to, path }) => {
|
|
|
4089
4150
|
payload: { utmCampaign: query.utm_campaign },
|
|
4090
4151
|
});
|
|
4091
4152
|
}
|
|
4092
|
-
if (path === 'broker' ||
|
|
4153
|
+
if (path === 'broker' ||
|
|
4154
|
+
['home', 'condo', 'tenant'].includes(toBasePath)) {
|
|
4093
4155
|
dispatchHomeDiscountState({
|
|
4094
4156
|
type: StoreFormHomeDiscountActionTypes.FormHomeQuoterBrokerInfoSet,
|
|
4095
4157
|
payload: query,
|
|
@@ -4121,10 +4183,8 @@ const RedirectWithSearchParams = ({ to, path }) => {
|
|
|
4121
4183
|
const AppRoutes = (props) => {
|
|
4122
4184
|
const { appType } = props;
|
|
4123
4185
|
const defaultInsuranceType = getInsuranceType();
|
|
4124
|
-
const { appConfigState: { localIndex, insuranceType } } = useStoreAppConfig();
|
|
4125
|
-
return (jsxs(BrowserRouter, { children: [jsx(AppTitle, { appType: appType, insuranceType: insuranceType }), jsx(AppRouterListener, {}), jsxs(Routes, { children: [jsx(Route, { path: "/", element:
|
|
4126
|
-
// <BrokerKeys redirectURL={`/${localIndex}/${defaultInsuranceType}`} />
|
|
4127
|
-
) }), jsx(Route, { path: `/${localIndex}`, element: (jsx(NestedRoutes, { appType: appType })) }), jsx(Route, { path: `/${localIndex}/*`, element: (jsx(NestedRoutes, { appType: appType })) }), jsx(Route, { path: "/postal/*", element: (jsx(RedirectWithSearchParams, { to: `/${localIndex}/${defaultInsuranceType}` })) }), jsx(Route, { path: "/auto/postal/*", element: (jsx(RedirectWithSearchParams, { to: `/${localIndex}/${defaultInsuranceType}` })) })] })] }));
|
|
4186
|
+
const { appConfigState: { localIndex, insuranceType }, } = useStoreAppConfig();
|
|
4187
|
+
return (jsxs(BrowserRouter, { children: [jsx(AppTitle, { appType: appType, insuranceType: insuranceType }), jsx(AppRouterListener, {}), jsxs(Routes, { children: [jsx(Route, { path: "/", element: jsx(RedirectWithSearchParams, { to: `/${localIndex}/${defaultInsuranceType}` }) }), jsx(Route, { path: `/${localIndex}`, element: jsx(RedirectWithSearchParams, { to: `/${localIndex}/${defaultInsuranceType}` }) }), jsx(Route, { path: "*", element: jsx(RedirectWithSearchParams, { to: `/${localIndex}/${defaultInsuranceType}` }) }), jsx(Route, { path: "/broker", element: jsx(RedirectWithSearchParams, { to: `/${localIndex}/${defaultInsuranceType}`, path: "broker" }) }), jsx(Route, { path: `/${localIndex}`, element: jsx(NestedRoutes, { appType: appType }) }), jsx(Route, { path: `/${localIndex}/*`, element: jsx(NestedRoutes, { appType: appType }) }), jsx(Route, { path: "/postal/*", element: jsx(RedirectWithSearchParams, { to: `/${localIndex}/${defaultInsuranceType}` }) }), jsx(Route, { path: "/auto/postal/*", element: jsx(RedirectWithSearchParams, { to: `/${localIndex}/${defaultInsuranceType}` }) })] })] }));
|
|
4128
4188
|
};
|
|
4129
4189
|
|
|
4130
4190
|
const AppLoader = () => {
|