@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/cjs/index.js
CHANGED
|
@@ -1752,7 +1752,7 @@ const BlockEndorsements = () => {
|
|
|
1752
1752
|
};
|
|
1753
1753
|
|
|
1754
1754
|
const SectionQuoteRecalc$1 = () => {
|
|
1755
|
-
const { appConfigState: { appType } } = mychoiceSdkStore.useStoreAppConfig();
|
|
1755
|
+
const { appConfigState: { appType }, } = mychoiceSdkStore.useStoreAppConfig();
|
|
1756
1756
|
const isTheBig = appType === mychoiceSdkComponents.AppTypes.TheBig;
|
|
1757
1757
|
const mychoiceCls = appType === mychoiceSdkComponents.AppTypes.MyChoice ? 'mychoice' : '';
|
|
1758
1758
|
const { vehicleState, dispatchVehicleState } = mychoiceSdkStore.useStoreFormCarVehicle();
|
|
@@ -3133,28 +3133,25 @@ const PageLifeQuote = () => {
|
|
|
3133
3133
|
behavior: 'smooth',
|
|
3134
3134
|
});
|
|
3135
3135
|
});
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
? (jsxRuntime.jsx("div", { className: "offer-container", children: jsxRuntime.jsx(OfferSection, { isBestOffer: true, offerCompany: items[0]?.company, brokerCompany: items[0]?.brokerProfile, offerPrice: {
|
|
3140
|
-
monthly: items[0]?.priceMonthly,
|
|
3141
|
-
yearly: items[0]?.priceYearly,
|
|
3142
|
-
}, operationHours: {
|
|
3143
|
-
saturdayHours: items[0]?.brokerProfile.hoursSaturday,
|
|
3144
|
-
sundayHours: items[0]?.brokerProfile.hoursSunday,
|
|
3145
|
-
weekdayHours: items[0]?.brokerProfile.hoursWorkdays,
|
|
3146
|
-
}, phoneNumber: formatPhoneObject(items[0]?.brokerProfile.phone), redirectUrl: items[0]?.brokerProfile.redirectUrl || '' }) }))
|
|
3147
|
-
: jsxRuntime.jsx(SplashScreen, {}) })) })), jsxRuntime.jsx(SectionQuoteEdit, {})] }), appDeviceType !== mychoiceSdkComponents.DeviceTypes.Mobile && quoteState.showCallMessage
|
|
3148
|
-
&& jsxRuntime.jsx(SplashScreen, {}), !quoteState.showCallMessage
|
|
3149
|
-
&& (jsxRuntime.jsx("div", { className: "offer-container", children: !!items?.length
|
|
3150
|
-
&& items.map(({ company, brokerProfile, priceMonthly, priceYearly, }, index) => (jsxRuntime.jsx("div", { children: (appDeviceType !== mychoiceSdkComponents.DeviceTypes.Mobile || (appDeviceType === mychoiceSdkComponents.DeviceTypes.Mobile && index !== 0)) && (jsxRuntime.jsx(OfferSection, { isBestOffer: index === 0, offerCompany: company, brokerCompany: brokerProfile, offerPrice: {
|
|
3151
|
-
monthly: priceMonthly,
|
|
3152
|
-
yearly: priceYearly,
|
|
3136
|
+
return (jsxRuntime.jsx("div", { className: "quote-page-content", children: !appLoaderState.isOpen && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "form-section-container", children: [appDeviceType === mychoiceSdkComponents.DeviceTypes.Mobile && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: !!items?.length && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: !quoteState.showCallMessage ? (jsxRuntime.jsx("div", { className: "offer-container", children: jsxRuntime.jsx(OfferSection, { isBestOffer: true, offerCompany: items[0]?.company, brokerCompany: items[0]?.brokerProfile, offerPrice: {
|
|
3137
|
+
monthly: items[0]?.priceMonthly,
|
|
3138
|
+
yearly: items[0]?.priceYearly,
|
|
3153
3139
|
}, operationHours: {
|
|
3154
|
-
saturdayHours: brokerProfile.hoursSaturday,
|
|
3155
|
-
sundayHours: brokerProfile.hoursSunday,
|
|
3156
|
-
weekdayHours: brokerProfile.hoursWorkdays,
|
|
3157
|
-
}, phoneNumber: formatPhoneObject(brokerProfile.phone), redirectUrl: brokerProfile.redirectUrl || '' }))
|
|
3140
|
+
saturdayHours: items[0]?.brokerProfile.hoursSaturday,
|
|
3141
|
+
sundayHours: items[0]?.brokerProfile.hoursSunday,
|
|
3142
|
+
weekdayHours: items[0]?.brokerProfile.hoursWorkdays,
|
|
3143
|
+
}, phoneNumber: formatPhoneObject(items[0]?.brokerProfile.phone), redirectUrl: items[0]?.brokerProfile.redirectUrl || '' }) })) : (jsxRuntime.jsx(SplashScreen, {})) })) })), jsxRuntime.jsx(SectionQuoteEdit, {})] }), appDeviceType !== mychoiceSdkComponents.DeviceTypes.Mobile &&
|
|
3144
|
+
quoteState.showCallMessage && jsxRuntime.jsx(SplashScreen, {}), !quoteState.showCallMessage && (jsxRuntime.jsx("div", { className: "offer-container", children: !!items?.length &&
|
|
3145
|
+
items.map(({ company, brokerProfile, priceMonthly, priceYearly, }, index) => (jsxRuntime.jsx("div", { children: (appDeviceType !== mychoiceSdkComponents.DeviceTypes.Mobile ||
|
|
3146
|
+
(appDeviceType === mychoiceSdkComponents.DeviceTypes.Mobile &&
|
|
3147
|
+
index !== 0)) && (jsxRuntime.jsx(OfferSection, { isBestOffer: index === 0, offerCompany: company, brokerCompany: brokerProfile, offerPrice: {
|
|
3148
|
+
monthly: priceMonthly,
|
|
3149
|
+
yearly: priceYearly,
|
|
3150
|
+
}, operationHours: {
|
|
3151
|
+
saturdayHours: brokerProfile.hoursSaturday,
|
|
3152
|
+
sundayHours: brokerProfile.hoursSunday,
|
|
3153
|
+
weekdayHours: brokerProfile.hoursWorkdays,
|
|
3154
|
+
}, phoneNumber: formatPhoneObject(brokerProfile.phone), redirectUrl: brokerProfile.redirectUrl || '' })) }, index))) }))] })) }));
|
|
3158
3155
|
};
|
|
3159
3156
|
|
|
3160
3157
|
const getFormattedAddress = (unitNumber, streetAddress, city, provinceCode, postalCode, country) => {
|
|
@@ -3781,14 +3778,14 @@ const AppRouterListener = () => {
|
|
|
3781
3778
|
|
|
3782
3779
|
const AppRouteWrapper = (props) => {
|
|
3783
3780
|
const { children } = props;
|
|
3784
|
-
const { appConfigState: { isReady, appType, insuranceType, localIndex
|
|
3781
|
+
const { appConfigState: { isReady, appType, insuranceType, localIndex }, } = mychoiceSdkStore.useStoreAppConfig();
|
|
3785
3782
|
const { dispatchAppModalState } = mychoiceSdkStore.useStoreAppModal();
|
|
3786
3783
|
const { postRequestQuote: carPostRequestQuote } = mychoiceSdkStore.CarQuoteDataHandler();
|
|
3787
3784
|
const { postRequestQuote: homePostRequestQuote } = mychoiceSdkStore.HomeQuoteDataHandler();
|
|
3788
3785
|
const { postRequestQuote: lifePostRequestQuote } = mychoiceSdkStore.LifeQuoteDataHandler();
|
|
3789
|
-
const { postalState: { item: { postalCode: carPostal } } } = mychoiceSdkStore.useStoreFormCarPostal();
|
|
3790
|
-
const { postalState: { item: { postalCode: homePostal } } } = mychoiceSdkStore.useStoreFormHomePostal();
|
|
3791
|
-
const { postalState: { item: { postalCode: lifePostal } } } = mychoiceSdkStore.useStoreFormLifePostal();
|
|
3786
|
+
const { postalState: { item: { postalCode: carPostal }, }, } = mychoiceSdkStore.useStoreFormCarPostal();
|
|
3787
|
+
const { postalState: { item: { postalCode: homePostal }, }, } = mychoiceSdkStore.useStoreFormHomePostal();
|
|
3788
|
+
const { postalState: { item: { postalCode: lifePostal }, }, } = mychoiceSdkStore.useStoreFormLifePostal();
|
|
3792
3789
|
// Car insurance states
|
|
3793
3790
|
const { vehicleState } = mychoiceSdkStore.useStoreFormCarVehicle();
|
|
3794
3791
|
const { driverState } = mychoiceSdkStore.useStoreFormCarDriverBase();
|
|
@@ -3814,9 +3811,9 @@ const AppRouteWrapper = (props) => {
|
|
|
3814
3811
|
const { homeDiscountFormValidate, homeDiscountFormIsValid } = mychoiceSdkStore.useValidationHomeDiscount();
|
|
3815
3812
|
// life insurance validation
|
|
3816
3813
|
const { coverageFormValidate, coverageFormIsValid } = mychoiceSdkStore.useValidationCoverage();
|
|
3817
|
-
const { applicantFormValidate: lifeApplicantFormValidate, applicantFormIsValid: lifeApplicantFormIsValid } = mychoiceSdkStore.useValidationLifeApplicant();
|
|
3814
|
+
const { applicantFormValidate: lifeApplicantFormValidate, applicantFormIsValid: lifeApplicantFormIsValid, } = mychoiceSdkStore.useValidationLifeApplicant();
|
|
3818
3815
|
let postalCode = carPostal;
|
|
3819
|
-
const { clearFormData, checkIsExpired, checkIsExpiredWithModal
|
|
3816
|
+
const { clearFormData, checkIsExpired, checkIsExpiredWithModal } = mychoiceSdkStore.ClearFormDataHandler();
|
|
3820
3817
|
const { appLoaderState } = mychoiceSdkStore.useStoreAppLoader();
|
|
3821
3818
|
const isMychoice = appType === mychoiceSdkComponents.AppTypes.MyChoice;
|
|
3822
3819
|
switch (insuranceType) {
|
|
@@ -3842,19 +3839,28 @@ const AppRouteWrapper = (props) => {
|
|
|
3842
3839
|
key: 0,
|
|
3843
3840
|
path: '/',
|
|
3844
3841
|
name: 'Step 1',
|
|
3845
|
-
validateOptions: {
|
|
3842
|
+
validateOptions: {
|
|
3843
|
+
validate: vehicleFormValidate,
|
|
3844
|
+
isValid: vehicleFormIsValid,
|
|
3845
|
+
},
|
|
3846
3846
|
},
|
|
3847
3847
|
{
|
|
3848
3848
|
key: 1,
|
|
3849
3849
|
path: '/driver',
|
|
3850
3850
|
name: 'Step 2',
|
|
3851
|
-
validateOptions: {
|
|
3851
|
+
validateOptions: {
|
|
3852
|
+
validate: driverFormValidate,
|
|
3853
|
+
isValid: driverFormIsValid,
|
|
3854
|
+
},
|
|
3852
3855
|
},
|
|
3853
3856
|
{
|
|
3854
3857
|
key: 2,
|
|
3855
3858
|
path: '/discount',
|
|
3856
3859
|
name: 'Step 3',
|
|
3857
|
-
validateOptions: {
|
|
3860
|
+
validateOptions: {
|
|
3861
|
+
validate: carDiscountFormValidate,
|
|
3862
|
+
isValid: carDiscountFormIsValid,
|
|
3863
|
+
},
|
|
3858
3864
|
requestFn: carPostRequestQuote,
|
|
3859
3865
|
},
|
|
3860
3866
|
],
|
|
@@ -3863,25 +3869,37 @@ const AppRouteWrapper = (props) => {
|
|
|
3863
3869
|
key: 0,
|
|
3864
3870
|
path: '/',
|
|
3865
3871
|
name: 'Step 1',
|
|
3866
|
-
validateOptions: {
|
|
3872
|
+
validateOptions: {
|
|
3873
|
+
validate: addressFormValidate,
|
|
3874
|
+
isValid: addressFormIsValid,
|
|
3875
|
+
},
|
|
3867
3876
|
},
|
|
3868
3877
|
{
|
|
3869
3878
|
key: 1,
|
|
3870
3879
|
path: '/applicant',
|
|
3871
3880
|
name: 'Step 2',
|
|
3872
|
-
validateOptions: {
|
|
3881
|
+
validateOptions: {
|
|
3882
|
+
validate: applicantFormValidate,
|
|
3883
|
+
isValid: applicantFormIsValid,
|
|
3884
|
+
},
|
|
3873
3885
|
},
|
|
3874
3886
|
{
|
|
3875
3887
|
key: 2,
|
|
3876
3888
|
path: '/property',
|
|
3877
3889
|
name: 'Step 3',
|
|
3878
|
-
validateOptions: {
|
|
3890
|
+
validateOptions: {
|
|
3891
|
+
validate: dwellingFormValidate,
|
|
3892
|
+
isValid: dwellingFormIsValid,
|
|
3893
|
+
},
|
|
3879
3894
|
},
|
|
3880
3895
|
{
|
|
3881
3896
|
key: 3,
|
|
3882
3897
|
path: '/discount',
|
|
3883
3898
|
name: 'Step 4',
|
|
3884
|
-
validateOptions: {
|
|
3899
|
+
validateOptions: {
|
|
3900
|
+
validate: homeDiscountFormValidate,
|
|
3901
|
+
isValid: homeDiscountFormIsValid,
|
|
3902
|
+
},
|
|
3885
3903
|
requestFn: homePostRequestQuote,
|
|
3886
3904
|
},
|
|
3887
3905
|
],
|
|
@@ -3890,25 +3908,37 @@ const AppRouteWrapper = (props) => {
|
|
|
3890
3908
|
key: 0,
|
|
3891
3909
|
path: '/',
|
|
3892
3910
|
name: 'Step 1',
|
|
3893
|
-
validateOptions: {
|
|
3911
|
+
validateOptions: {
|
|
3912
|
+
validate: addressFormValidate,
|
|
3913
|
+
isValid: addressFormIsValid,
|
|
3914
|
+
},
|
|
3894
3915
|
},
|
|
3895
3916
|
{
|
|
3896
3917
|
key: 1,
|
|
3897
3918
|
path: '/applicant',
|
|
3898
3919
|
name: 'Step 2',
|
|
3899
|
-
validateOptions: {
|
|
3920
|
+
validateOptions: {
|
|
3921
|
+
validate: applicantFormValidate,
|
|
3922
|
+
isValid: applicantFormIsValid,
|
|
3923
|
+
},
|
|
3900
3924
|
},
|
|
3901
3925
|
{
|
|
3902
3926
|
key: 2,
|
|
3903
3927
|
path: '/property',
|
|
3904
3928
|
name: 'Step 3',
|
|
3905
|
-
validateOptions: {
|
|
3929
|
+
validateOptions: {
|
|
3930
|
+
validate: dwellingFormValidate,
|
|
3931
|
+
isValid: dwellingFormIsValid,
|
|
3932
|
+
},
|
|
3906
3933
|
},
|
|
3907
3934
|
{
|
|
3908
3935
|
key: 3,
|
|
3909
3936
|
path: '/discount',
|
|
3910
3937
|
name: 'Step 4',
|
|
3911
|
-
validateOptions: {
|
|
3938
|
+
validateOptions: {
|
|
3939
|
+
validate: homeDiscountFormValidate,
|
|
3940
|
+
isValid: homeDiscountFormIsValid,
|
|
3941
|
+
},
|
|
3912
3942
|
requestFn: homePostRequestQuote,
|
|
3913
3943
|
},
|
|
3914
3944
|
],
|
|
@@ -3917,25 +3947,37 @@ const AppRouteWrapper = (props) => {
|
|
|
3917
3947
|
key: 0,
|
|
3918
3948
|
path: '/',
|
|
3919
3949
|
name: 'Step 1',
|
|
3920
|
-
validateOptions: {
|
|
3950
|
+
validateOptions: {
|
|
3951
|
+
validate: addressFormValidate,
|
|
3952
|
+
isValid: addressFormIsValid,
|
|
3953
|
+
},
|
|
3921
3954
|
},
|
|
3922
3955
|
{
|
|
3923
3956
|
key: 1,
|
|
3924
3957
|
path: '/applicant',
|
|
3925
3958
|
name: 'Step 2',
|
|
3926
|
-
validateOptions: {
|
|
3959
|
+
validateOptions: {
|
|
3960
|
+
validate: applicantFormValidate,
|
|
3961
|
+
isValid: applicantFormIsValid,
|
|
3962
|
+
},
|
|
3927
3963
|
},
|
|
3928
3964
|
{
|
|
3929
3965
|
key: 2,
|
|
3930
3966
|
path: '/property',
|
|
3931
3967
|
name: 'Step 3',
|
|
3932
|
-
validateOptions: {
|
|
3968
|
+
validateOptions: {
|
|
3969
|
+
validate: dwellingFormValidate,
|
|
3970
|
+
isValid: dwellingFormIsValid,
|
|
3971
|
+
},
|
|
3933
3972
|
},
|
|
3934
3973
|
{
|
|
3935
3974
|
key: 3,
|
|
3936
3975
|
path: '/discount',
|
|
3937
3976
|
name: 'Step 4',
|
|
3938
|
-
validateOptions: {
|
|
3977
|
+
validateOptions: {
|
|
3978
|
+
validate: homeDiscountFormValidate,
|
|
3979
|
+
isValid: homeDiscountFormIsValid,
|
|
3980
|
+
},
|
|
3939
3981
|
requestFn: homePostRequestQuote,
|
|
3940
3982
|
},
|
|
3941
3983
|
],
|
|
@@ -3944,13 +3986,19 @@ const AppRouteWrapper = (props) => {
|
|
|
3944
3986
|
key: 0,
|
|
3945
3987
|
path: '/',
|
|
3946
3988
|
name: 'Step 1',
|
|
3947
|
-
validateOptions: {
|
|
3989
|
+
validateOptions: {
|
|
3990
|
+
validate: coverageFormValidate,
|
|
3991
|
+
isValid: coverageFormIsValid,
|
|
3992
|
+
},
|
|
3948
3993
|
},
|
|
3949
3994
|
{
|
|
3950
3995
|
key: 1,
|
|
3951
3996
|
path: '/applicant',
|
|
3952
3997
|
name: 'Step 2',
|
|
3953
|
-
validateOptions: {
|
|
3998
|
+
validateOptions: {
|
|
3999
|
+
validate: lifeApplicantFormValidate,
|
|
4000
|
+
isValid: lifeApplicantFormIsValid,
|
|
4001
|
+
},
|
|
3954
4002
|
requestFn: lifePostRequestQuote,
|
|
3955
4003
|
},
|
|
3956
4004
|
],
|
|
@@ -3961,7 +4009,10 @@ const AppRouteWrapper = (props) => {
|
|
|
3961
4009
|
React.useEffect(() => {
|
|
3962
4010
|
let filteredSteps = formSteps[insuranceType];
|
|
3963
4011
|
let filteredHooks = formValidationHooks[insuranceType];
|
|
3964
|
-
if (isCompleted &&
|
|
4012
|
+
if (isCompleted &&
|
|
4013
|
+
(insuranceType === mychoiceSdkComponents.InsuranceTypes.Home ||
|
|
4014
|
+
insuranceType === mychoiceSdkComponents.InsuranceTypes.Condo ||
|
|
4015
|
+
insuranceType === mychoiceSdkComponents.InsuranceTypes.Tenant)) {
|
|
3965
4016
|
filteredSteps = formSteps[insuranceType].filter((item) => item.path !== '/property');
|
|
3966
4017
|
filteredHooks = formValidationHooks[insuranceType].filter((item) => item.path !== '/property');
|
|
3967
4018
|
}
|
|
@@ -4028,7 +4079,12 @@ const AppRouteWrapper = (props) => {
|
|
|
4028
4079
|
}
|
|
4029
4080
|
}
|
|
4030
4081
|
}, [carPostal, homePostal, lifePostal, isReady]);
|
|
4031
|
-
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: localIndex !== mychoiceSdkComponents.defaultLocalIndex
|
|
4082
|
+
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: localIndex !== mychoiceSdkComponents.defaultLocalIndex
|
|
4083
|
+
? 'step-progress-bar-partner'
|
|
4084
|
+
: '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 &&
|
|
4085
|
+
appType === mychoiceSdkComponents.AppTypes.MyChoice &&
|
|
4086
|
+
isDesktop &&
|
|
4087
|
+
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 && jsxRuntime.jsx(ProviderImageFooter, {})] })) }));
|
|
4032
4088
|
};
|
|
4033
4089
|
const NestedRoutes = () => {
|
|
4034
4090
|
const insuranceType = mychoiceSdkComponents.getInsuranceType();
|
|
@@ -4039,10 +4095,11 @@ const NestedRoutes = () => {
|
|
|
4039
4095
|
payload: true,
|
|
4040
4096
|
});
|
|
4041
4097
|
});
|
|
4042
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: appConfigState.drawWrapper && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(reactRouterDom.Routes, { children: [jsxRuntime.jsx(reactRouterDom.Route, { path: "*", element: jsxRuntime.jsx(reactRouterDom.Navigate, { to: {
|
|
4043
|
-
|
|
4098
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: appConfigState.drawWrapper && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(reactRouterDom.Routes, { children: [jsxRuntime.jsx(reactRouterDom.Route, { path: "*", element: jsxRuntime.jsx(reactRouterDom.Navigate, { to: {
|
|
4099
|
+
pathname: `/${appConfigState.localIndex || mychoiceSdkComponents.defaultLocalIndex}/${insuranceType}`,
|
|
4100
|
+
} }) }), insuranceType === mychoiceSdkComponents.InsuranceTypes.Car && (jsxRuntime.jsxs(reactRouterDom.Route, { path: "car", children: [jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: jsxRuntime.jsx(AppRouteWrapper, { insuranceType: insuranceType, children: jsxRuntime.jsx(RouteWrapperPublic, { children: jsxRuntime.jsx(PageVehicle, {}) }) }) }), jsxRuntime.jsx(reactRouterDom.Route, { path: "driver", element: jsxRuntime.jsx(AppRouteWrapper, { insuranceType: insuranceType, children: jsxRuntime.jsx(RouteWrapperPublic, { children: jsxRuntime.jsx(PageDriver, {}) }) }) }), jsxRuntime.jsx(reactRouterDom.Route, { path: "discount", element: jsxRuntime.jsx(AppRouteWrapper, { insuranceType: insuranceType, children: jsxRuntime.jsx(RouteWrapperPublic, { children: jsxRuntime.jsx(PageCarDiscount, {}) }) }) }), jsxRuntime.jsx(reactRouterDom.Route, { path: "quotes", element: jsxRuntime.jsx(AppRouteWrapper, { insuranceType: insuranceType, children: jsxRuntime.jsx(RouteWrapperPublic, { children: jsxRuntime.jsx(PageCarQuote, {}) }) }) }), jsxRuntime.jsx(reactRouterDom.Route, { path: "offer", element: jsxRuntime.jsx(AppRouteWrapper, { insuranceType: insuranceType, children: jsxRuntime.jsx(RouteWrapperPublic, { children: jsxRuntime.jsx(PageCarQuote, {}) }) }) })] })), jsxRuntime.jsxs(reactRouterDom.Route, { path: "home", children: [jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: jsxRuntime.jsx(AppRouteWrapper, { insuranceType: mychoiceSdkComponents.InsuranceTypes.Home, children: jsxRuntime.jsx(RouteWrapperPublic, { children: jsxRuntime.jsx(PageAddress, {}) }) }) }), jsxRuntime.jsx(reactRouterDom.Route, { path: "applicant", element: jsxRuntime.jsx(AppRouteWrapper, { insuranceType: mychoiceSdkComponents.InsuranceTypes.Home, children: jsxRuntime.jsx(RouteWrapperPublic, { children: jsxRuntime.jsx(PageApplicant, {}) }) }) }), jsxRuntime.jsx(reactRouterDom.Route, { path: "property", element: jsxRuntime.jsx(AppRouteWrapper, { insuranceType: mychoiceSdkComponents.InsuranceTypes.Home, children: jsxRuntime.jsx(RouteWrapperPublic, { children: jsxRuntime.jsx(PageProperty, {}) }) }) }), jsxRuntime.jsx(reactRouterDom.Route, { path: "discount", element: jsxRuntime.jsx(AppRouteWrapper, { insuranceType: mychoiceSdkComponents.InsuranceTypes.Home, children: jsxRuntime.jsx(RouteWrapperPublic, { children: jsxRuntime.jsx(PageHomeDiscount, {}) }) }) }), jsxRuntime.jsx(reactRouterDom.Route, { path: "quotes", element: jsxRuntime.jsx(AppRouteWrapper, { insuranceType: mychoiceSdkComponents.InsuranceTypes.Home, children: jsxRuntime.jsx(RouteWrapperPublic, { children: jsxRuntime.jsx(PageHomeQuote, {}) }) }) })] }), jsxRuntime.jsxs(reactRouterDom.Route, { path: "condo", children: [jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: jsxRuntime.jsx(AppRouteWrapper, { insuranceType: mychoiceSdkComponents.InsuranceTypes.Condo, children: jsxRuntime.jsx(RouteWrapperPublic, { children: jsxRuntime.jsx(PageAddress, {}) }) }) }), jsxRuntime.jsx(reactRouterDom.Route, { path: "applicant", element: jsxRuntime.jsx(AppRouteWrapper, { insuranceType: mychoiceSdkComponents.InsuranceTypes.Condo, children: jsxRuntime.jsx(RouteWrapperPublic, { children: jsxRuntime.jsx(PageApplicant, {}) }) }) }), jsxRuntime.jsx(reactRouterDom.Route, { path: "property", element: jsxRuntime.jsx(AppRouteWrapper, { insuranceType: mychoiceSdkComponents.InsuranceTypes.Condo, children: jsxRuntime.jsx(RouteWrapperPublic, { children: jsxRuntime.jsx(PageProperty, {}) }) }) }), jsxRuntime.jsx(reactRouterDom.Route, { path: "discount", element: jsxRuntime.jsx(AppRouteWrapper, { insuranceType: mychoiceSdkComponents.InsuranceTypes.Condo, children: jsxRuntime.jsx(RouteWrapperPublic, { children: jsxRuntime.jsx(PageHomeDiscount, {}) }) }) }), jsxRuntime.jsx(reactRouterDom.Route, { path: "quotes", element: jsxRuntime.jsx(AppRouteWrapper, { insuranceType: mychoiceSdkComponents.InsuranceTypes.Condo, children: jsxRuntime.jsx(RouteWrapperPublic, { children: jsxRuntime.jsx(PageHomeQuote, {}) }) }) })] }), jsxRuntime.jsxs(reactRouterDom.Route, { path: "tenant", children: [jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: jsxRuntime.jsx(AppRouteWrapper, { insuranceType: mychoiceSdkComponents.InsuranceTypes.Tenant, children: jsxRuntime.jsx(RouteWrapperPublic, { children: jsxRuntime.jsx(PageAddress, {}) }) }) }), jsxRuntime.jsx(reactRouterDom.Route, { path: "applicant", element: jsxRuntime.jsx(AppRouteWrapper, { insuranceType: mychoiceSdkComponents.InsuranceTypes.Tenant, children: jsxRuntime.jsx(RouteWrapperPublic, { children: jsxRuntime.jsx(PageApplicant, {}) }) }) }), jsxRuntime.jsx(reactRouterDom.Route, { path: "property", element: jsxRuntime.jsx(AppRouteWrapper, { insuranceType: mychoiceSdkComponents.InsuranceTypes.Tenant, children: jsxRuntime.jsx(RouteWrapperPublic, { children: jsxRuntime.jsx(PageProperty, {}) }) }) }), jsxRuntime.jsx(reactRouterDom.Route, { path: "discount", element: jsxRuntime.jsx(AppRouteWrapper, { insuranceType: mychoiceSdkComponents.InsuranceTypes.Tenant, children: jsxRuntime.jsx(RouteWrapperPublic, { children: jsxRuntime.jsx(PageHomeDiscount, {}) }) }) }), jsxRuntime.jsx(reactRouterDom.Route, { path: "quotes", element: jsxRuntime.jsx(AppRouteWrapper, { insuranceType: mychoiceSdkComponents.InsuranceTypes.Tenant, children: jsxRuntime.jsx(RouteWrapperPublic, { children: jsxRuntime.jsx(PageHomeQuote, {}) }) }) })] }), jsxRuntime.jsxs(reactRouterDom.Route, { path: "life", children: [jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: jsxRuntime.jsx(AppRouteWrapper, { insuranceType: mychoiceSdkComponents.InsuranceTypes.Life, children: jsxRuntime.jsx(RouteWrapperPublic, { children: jsxRuntime.jsx(PageCoverage, {}) }) }) }), jsxRuntime.jsx(reactRouterDom.Route, { path: "applicant", element: jsxRuntime.jsx(AppRouteWrapper, { insuranceType: mychoiceSdkComponents.InsuranceTypes.Life, children: jsxRuntime.jsx(RouteWrapperPublic, { children: jsxRuntime.jsx(PageLifeApplicant, {}) }) }) }), jsxRuntime.jsx(reactRouterDom.Route, { path: "quotes", element: jsxRuntime.jsx(AppRouteWrapper, { insuranceType: mychoiceSdkComponents.InsuranceTypes.Life, children: jsxRuntime.jsx(RouteWrapperPublic, { children: jsxRuntime.jsx(PageLifeQuote, {}) }) }) })] })] }) })) }));
|
|
4044
4101
|
};
|
|
4045
|
-
const RedirectWithSearchParams = ({ to, path }) => {
|
|
4102
|
+
const RedirectWithSearchParams = ({ to, path, }) => {
|
|
4046
4103
|
const insuranceType = mychoiceSdkComponents.getInsuranceType();
|
|
4047
4104
|
mychoiceSdkStore.useStoreAppConfig();
|
|
4048
4105
|
const [isRender, setIsRender] = React.useState(false);
|
|
@@ -4054,10 +4111,12 @@ const RedirectWithSearchParams = ({ to, path }) => {
|
|
|
4054
4111
|
const toBasePath = to?.split('/')?.slice(-1)?.[0];
|
|
4055
4112
|
mychoiceSdkComponents.useEffectOnce(() => {
|
|
4056
4113
|
if (queryRoot.length > 1) {
|
|
4057
|
-
const query = JSON.parse(`{"${decodeURI(queryRoot[1])
|
|
4058
|
-
|
|
4114
|
+
const query = JSON.parse(`{"${decodeURI(queryRoot[1])
|
|
4115
|
+
.replace(/"/g, '\\"')
|
|
4116
|
+
.replace(/&/g, '","')
|
|
4117
|
+
.replace(/=/g, '":"')}"}`);
|
|
4059
4118
|
if (!isRender) {
|
|
4060
|
-
if (query.postal_code &&
|
|
4119
|
+
if (query.postal_code && insuranceType !== mychoiceSdkComponents.InsuranceTypes.Life) {
|
|
4061
4120
|
const formattedPostalCode = query.postal_code.replace(' ', '');
|
|
4062
4121
|
getPostal(formattedPostalCode).then(() => {
|
|
4063
4122
|
setIsRender(true);
|
|
@@ -4086,7 +4145,9 @@ const RedirectWithSearchParams = ({ to, path }) => {
|
|
|
4086
4145
|
});
|
|
4087
4146
|
}
|
|
4088
4147
|
}
|
|
4089
|
-
if (insuranceType === mychoiceSdkComponents.InsuranceTypes.Home ||
|
|
4148
|
+
if (insuranceType === mychoiceSdkComponents.InsuranceTypes.Home ||
|
|
4149
|
+
insuranceType === mychoiceSdkComponents.InsuranceTypes.Condo ||
|
|
4150
|
+
insuranceType === mychoiceSdkComponents.InsuranceTypes.Tenant) {
|
|
4090
4151
|
if (query.utm_source) {
|
|
4091
4152
|
dispatchHomeDiscountState({
|
|
4092
4153
|
type: mychoiceSdkStore.StoreFormHomeDiscountActionTypes.FormHomeUtmSourceSet,
|
|
@@ -4099,7 +4160,8 @@ const RedirectWithSearchParams = ({ to, path }) => {
|
|
|
4099
4160
|
payload: { utmCampaign: query.utm_campaign },
|
|
4100
4161
|
});
|
|
4101
4162
|
}
|
|
4102
|
-
if (path === 'broker' ||
|
|
4163
|
+
if (path === 'broker' ||
|
|
4164
|
+
['home', 'condo', 'tenant'].includes(toBasePath)) {
|
|
4103
4165
|
dispatchHomeDiscountState({
|
|
4104
4166
|
type: mychoiceSdkStore.StoreFormHomeDiscountActionTypes.FormHomeQuoterBrokerInfoSet,
|
|
4105
4167
|
payload: query,
|
|
@@ -4131,10 +4193,8 @@ const RedirectWithSearchParams = ({ to, path }) => {
|
|
|
4131
4193
|
const AppRoutes = (props) => {
|
|
4132
4194
|
const { appType } = props;
|
|
4133
4195
|
const defaultInsuranceType = mychoiceSdkComponents.getInsuranceType();
|
|
4134
|
-
const { appConfigState: { localIndex, insuranceType } } = mychoiceSdkStore.useStoreAppConfig();
|
|
4135
|
-
return (jsxRuntime.jsxs(reactRouterDom.BrowserRouter, { children: [jsxRuntime.jsx(AppTitle, { appType: appType, insuranceType: insuranceType }), jsxRuntime.jsx(AppRouterListener, {}), jsxRuntime.jsxs(reactRouterDom.Routes, { children: [jsxRuntime.jsx(reactRouterDom.Route, { path: "/", element:
|
|
4136
|
-
// <BrokerKeys redirectURL={`/${localIndex}/${defaultInsuranceType}`} />
|
|
4137
|
-
) }), jsxRuntime.jsx(reactRouterDom.Route, { path: `/${localIndex}`, element: (jsxRuntime.jsx(NestedRoutes, { appType: appType })) }), jsxRuntime.jsx(reactRouterDom.Route, { path: `/${localIndex}/*`, element: (jsxRuntime.jsx(NestedRoutes, { appType: appType })) }), jsxRuntime.jsx(reactRouterDom.Route, { path: "/postal/*", element: (jsxRuntime.jsx(RedirectWithSearchParams, { to: `/${localIndex}/${defaultInsuranceType}` })) }), jsxRuntime.jsx(reactRouterDom.Route, { path: "/auto/postal/*", element: (jsxRuntime.jsx(RedirectWithSearchParams, { to: `/${localIndex}/${defaultInsuranceType}` })) })] })] }));
|
|
4196
|
+
const { appConfigState: { localIndex, insuranceType }, } = mychoiceSdkStore.useStoreAppConfig();
|
|
4197
|
+
return (jsxRuntime.jsxs(reactRouterDom.BrowserRouter, { children: [jsxRuntime.jsx(AppTitle, { appType: appType, insuranceType: insuranceType }), jsxRuntime.jsx(AppRouterListener, {}), jsxRuntime.jsxs(reactRouterDom.Routes, { children: [jsxRuntime.jsx(reactRouterDom.Route, { path: "/", element: jsxRuntime.jsx(RedirectWithSearchParams, { to: `/${localIndex}/${defaultInsuranceType}` }) }), jsxRuntime.jsx(reactRouterDom.Route, { path: `/${localIndex}`, element: jsxRuntime.jsx(RedirectWithSearchParams, { to: `/${localIndex}/${defaultInsuranceType}` }) }), jsxRuntime.jsx(reactRouterDom.Route, { path: "*", element: jsxRuntime.jsx(RedirectWithSearchParams, { to: `/${localIndex}/${defaultInsuranceType}` }) }), jsxRuntime.jsx(reactRouterDom.Route, { path: "/broker", element: jsxRuntime.jsx(RedirectWithSearchParams, { to: `/${localIndex}/${defaultInsuranceType}`, path: "broker" }) }), jsxRuntime.jsx(reactRouterDom.Route, { path: `/${localIndex}`, element: jsxRuntime.jsx(NestedRoutes, { appType: appType }) }), jsxRuntime.jsx(reactRouterDom.Route, { path: `/${localIndex}/*`, element: jsxRuntime.jsx(NestedRoutes, { appType: appType }) }), jsxRuntime.jsx(reactRouterDom.Route, { path: "/postal/*", element: jsxRuntime.jsx(RedirectWithSearchParams, { to: `/${localIndex}/${defaultInsuranceType}` }) }), jsxRuntime.jsx(reactRouterDom.Route, { path: "/auto/postal/*", element: jsxRuntime.jsx(RedirectWithSearchParams, { to: `/${localIndex}/${defaultInsuranceType}` }) })] })] }));
|
|
4138
4198
|
};
|
|
4139
4199
|
|
|
4140
4200
|
const AppLoader = () => {
|