@mychoice/mychoice-sdk-modules 2.1.34 → 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 +125 -131
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/init/StoryAppWrapper/StoryAppWrapper.d.ts +1 -1
- package/dist/cjs/init/StoryAppWrapper/interfaces.d.ts +1 -1
- package/dist/cjs/insurances/car/pages/{three-point-five/BestOfferFirst.d.ts → quote/PageAllQuotes.d.ts} +1 -1
- package/dist/cjs/insurances/car/pages/quote/sections/blocks/BlockConfirmImages.d.ts +1 -0
- package/dist/cjs/insurances/car/pages/quote/sections/blocks/BlockQuoteStatistics.d.ts +2 -0
- package/dist/cjs/shared/navigations/interfaces.d.ts +0 -1
- package/dist/cjs/shared/sections/quotes/OfferSection/BestOfferSection.d.ts +3 -0
- package/dist/cjs/shared/sections/quotes/OfferSection/DummyOfferSection.d.ts +3 -0
- package/dist/esm/index.js +125 -131
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/init/StoryAppWrapper/StoryAppWrapper.d.ts +1 -1
- package/dist/esm/init/StoryAppWrapper/interfaces.d.ts +1 -1
- package/dist/esm/insurances/car/pages/{three-point-five/BestOfferFirst.d.ts → quote/PageAllQuotes.d.ts} +1 -1
- package/dist/esm/insurances/car/pages/quote/sections/blocks/BlockConfirmImages.d.ts +1 -0
- package/dist/esm/insurances/car/pages/quote/sections/blocks/BlockQuoteStatistics.d.ts +2 -0
- package/dist/esm/shared/navigations/interfaces.d.ts +0 -1
- package/dist/esm/shared/sections/quotes/OfferSection/BestOfferSection.d.ts +3 -0
- package/dist/esm/shared/sections/quotes/OfferSection/DummyOfferSection.d.ts +3 -0
- package/dist/index.d.ts +0 -1
- package/package.json +3 -3
- package/dist/cjs/insurances/car/pages/three-point-five/index.d.ts +0 -1
- package/dist/cjs/insurances/car/pages/three-point-five/sections/OfferSectionCopy.d.ts +0 -3
- package/dist/cjs/insurances/car/pages/three-point-five/sections/OfferSectionDupe.d.ts +0 -3
- package/dist/cjs/insurances/car/pages/three-point-five/sections/index.d.ts +0 -1
- package/dist/esm/insurances/car/pages/three-point-five/index.d.ts +0 -1
- package/dist/esm/insurances/car/pages/three-point-five/sections/OfferSectionCopy.d.ts +0 -3
- package/dist/esm/insurances/car/pages/three-point-five/sections/OfferSectionDupe.d.ts +0 -3
- package/dist/esm/insurances/car/pages/three-point-five/sections/index.d.ts +0 -1
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) => {
|
|
@@ -3246,9 +3243,7 @@ const ModalQuoteRequest = ({ title, description, phoneNumber, }) => (jsxRuntime.
|
|
|
3246
3243
|
&& jsxRuntime.jsx("p", { children: description }), jsxRuntime.jsxs("div", { className: "modal-buttons", children: [jsxRuntime.jsx(mychoiceSdkComponents.ButtonBase, { type: mychoiceSdkComponents.ButtonTypes.Button, label: "OK", category: mychoiceSdkComponents.CategoryTypes.Filled, color: mychoiceSdkComponents.ColorTypes.Primary, variant: mychoiceSdkComponents.ButtonVariantTypes.Rectangle, size: mychoiceSdkComponents.SizeTypes.Large }), phoneNumber
|
|
3247
3244
|
&& (jsxRuntime.jsx("a", { target: "_blank", rel: "noreferrer noopener", href: `tel:1${phoneNumber}`, className: "phoneNumber", children: "Call the Broker" }))] })] }));
|
|
3248
3245
|
|
|
3249
|
-
const PostalCodeDataBox = ({ title, postalCode, className,
|
|
3250
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", { id: id, className: `${className} postal-code-data-box`, children: [jsxRuntime.jsx("h2", { children: title }), postalCode && (jsxRuntime.jsxs("p", { children: ["Your postal code:", ' ', postalCode] }))] }) }));
|
|
3251
|
-
};
|
|
3246
|
+
const PostalCodeDataBox = ({ title, postalCode, className }) => (jsxRuntime.jsxs("div", { className: `${className} postal-code-data-box`, children: [jsxRuntime.jsx("h2", { children: title }), postalCode && (jsxRuntime.jsxs("p", { children: ["Your postal code:", ' ', postalCode] }))] }));
|
|
3252
3247
|
PostalCodeDataBox.defaultProps = {
|
|
3253
3248
|
title: '',
|
|
3254
3249
|
postalCode: '',
|
|
@@ -3262,21 +3257,6 @@ const StepsBox = ({ formSteps, validationHooks, propertyIsCompleted, }) => {
|
|
|
3262
3257
|
// const { dispatchAppModalState } = useStoreAppModal();
|
|
3263
3258
|
// const [steps, setSteps] = useState(formSteps);
|
|
3264
3259
|
// const [validations, setValidations] = useState(validationHooks);
|
|
3265
|
-
const [showContent, setShowContent] = React.useState(false);
|
|
3266
|
-
React.useEffect(() => {
|
|
3267
|
-
const checkTime = () => {
|
|
3268
|
-
const currentUTCDate = new Date();
|
|
3269
|
-
const currentHour = currentUTCDate.getUTCHours() - 5; // EST is UTC-5
|
|
3270
|
-
const currentDay = currentUTCDate.getUTCDay(); // Sunday is 0, Monday is 1, ..., Saturday is 6
|
|
3271
|
-
// Check if it's a weekday (Monday to Friday) and if the current hour is between 9 am and 6 pm
|
|
3272
|
-
const isWeekday = currentDay >= 1 && currentDay <= 5;
|
|
3273
|
-
const isWorkingHours = currentHour >= 9 && currentHour < 18;
|
|
3274
|
-
setShowContent(isWeekday && isWorkingHours);
|
|
3275
|
-
};
|
|
3276
|
-
checkTime(); // Initial check
|
|
3277
|
-
const interval = setInterval(checkTime, 60000); // Check every minute
|
|
3278
|
-
return () => clearInterval(interval); // Cleanup
|
|
3279
|
-
}, []); // Run effect only once on component mount
|
|
3280
3260
|
const { pathname } = reactRouterDom.useLocation();
|
|
3281
3261
|
const currentPath = pathname.split('/');
|
|
3282
3262
|
const activeStep = formSteps.find((step) => currentPath[currentPath.length - 1] === step.path?.substring(1));
|
|
@@ -3340,22 +3320,6 @@ const StepsBox = ({ formSteps, validationHooks, propertyIsCompleted, }) => {
|
|
|
3340
3320
|
}
|
|
3341
3321
|
}
|
|
3342
3322
|
};
|
|
3343
|
-
const [showQR, setShowQr] = React.useState(false);
|
|
3344
|
-
const containerRef = React.useRef(null);
|
|
3345
|
-
React.useEffect(() => {
|
|
3346
|
-
const handleClickOutside = (event) => {
|
|
3347
|
-
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
3348
|
-
setShowQr(false);
|
|
3349
|
-
}
|
|
3350
|
-
};
|
|
3351
|
-
document.addEventListener('mousedown', handleClickOutside);
|
|
3352
|
-
return () => {
|
|
3353
|
-
document.removeEventListener('mousedown', handleClickOutside);
|
|
3354
|
-
};
|
|
3355
|
-
}, []);
|
|
3356
|
-
const handleHelpButton = () => {
|
|
3357
|
-
setShowQr(!showQR);
|
|
3358
|
-
};
|
|
3359
3323
|
return (jsxRuntime.jsxs("ol", { className: appType === mychoiceSdkComponents.AppTypes.MyChoice ? 'mychoice-navigation-steps-container' : 'navigation-steps-container', children: [!isMobile ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: formSteps?.map((item, index) => {
|
|
3360
3324
|
let cls;
|
|
3361
3325
|
switch (true) {
|
|
@@ -3372,11 +3336,9 @@ const StepsBox = ({ formSteps, validationHooks, propertyIsCompleted, }) => {
|
|
|
3372
3336
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
3373
3337
|
}
|
|
3374
3338
|
return (jsxRuntime.jsx("div", { role: "presentation", className: appType === mychoiceSdkComponents.AppTypes.MyChoice ? navigationCls : 'navigation-step-container', onKeyDown: handleStepClick(item, index), onClick: handleStepClick(item, index), children: appType === mychoiceSdkComponents.AppTypes.MyChoice
|
|
3375
|
-
? jsxRuntime.
|
|
3339
|
+
? jsxRuntime.jsx(mychoiceSdkComponents.MychoiceStep, { className: cls, item: item, index: index }, `${index}-${item?.title}`)
|
|
3376
3340
|
: jsxRuntime.jsx(mychoiceSdkComponents.Step, { className: cls, item: item, index: index }, `${index}-${item?.title}`) }, `${index}-${item?.title}`));
|
|
3377
|
-
}) })) : jsxRuntime.jsx(mychoiceSdkComponents.Step, { item: formSteps[activeIndex], index: activeIndex, itemsCount: formSteps.length, isMobile: true }), appType === mychoiceSdkComponents.AppTypes.MyChoice && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("hr", {}), jsxRuntime.jsxs("div", { className: "estimated-minutes", children: [jsxRuntime.jsx(mychoiceSdkComponents.IconClock, {}), jsxRuntime.jsxs("div", { children: ["Estimated", ' ', jsxRuntime.jsxs("span", { className: "time", children: [formSteps.length - activeIndex - 1, ' ', formSteps.length - activeIndex - 1 > 1 ? 'minutes' : 'minute'] }), ' ', "to complete"] })] })
|
|
3378
|
-
e.currentTarget.style.opacity = '1';
|
|
3379
|
-
}, src: "https://www.mychoice.ca/wp-content/themes/mychoice-theme/img/svg/qr-phone-with-text.svg", alt: "QR code scan to call" }))] })] }))] }))] }));
|
|
3341
|
+
}) })) : jsxRuntime.jsx(mychoiceSdkComponents.Step, { item: formSteps[activeIndex], index: activeIndex, itemsCount: formSteps.length, isMobile: true }), appType === mychoiceSdkComponents.AppTypes.MyChoice && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("hr", {}), jsxRuntime.jsxs("div", { className: "estimated-minutes", children: [jsxRuntime.jsx(mychoiceSdkComponents.IconClock, {}), jsxRuntime.jsxs("div", { children: ["Estimated", ' ', jsxRuntime.jsxs("span", { className: "time", children: [formSteps.length - activeIndex - 1, ' ', formSteps.length - activeIndex - 1 > 1 ? 'minutes' : 'minute'] }), ' ', "to complete"] })] })] }))] }));
|
|
3380
3342
|
};
|
|
3381
3343
|
StepsBox.defaultProps = {
|
|
3382
3344
|
partnerId: '',
|
|
@@ -3461,7 +3423,7 @@ ButtonsBox.defaultProps = {
|
|
|
3461
3423
|
activeIndex: 0,
|
|
3462
3424
|
};
|
|
3463
3425
|
|
|
3464
|
-
const NavigationTop = ({ title, postalCode, validationHooks, formSteps, clearForm, propertyIsCompleted,
|
|
3426
|
+
const NavigationTop = ({ title, postalCode, validationHooks, formSteps, clearForm, propertyIsCompleted, }) => {
|
|
3465
3427
|
const { pathname } = reactRouterDom.useLocation();
|
|
3466
3428
|
const { appConfigState: { appType, localIndex } } = mychoiceSdkStore.useStoreAppConfig();
|
|
3467
3429
|
const isTheBig = appType === mychoiceSdkComponents.AppTypes.TheBig;
|
|
@@ -3489,8 +3451,8 @@ const NavigationTop = ({ title, postalCode, validationHooks, formSteps, clearFor
|
|
|
3489
3451
|
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
3490
3452
|
}
|
|
3491
3453
|
}
|
|
3492
|
-
return (jsxRuntime.jsx("div", {
|
|
3493
|
-
? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: !isDesktop && (formSteps.length - activeIndex - 1) ? (jsxRuntime.jsxs("div", { className: "estimated-minutes", children: [jsxRuntime.jsx(mychoiceSdkComponents.IconClock, {}), jsxRuntime.jsxs("div", { children: [isMobile ? (jsxRuntime.jsx(
|
|
3454
|
+
return (jsxRuntime.jsx("div", { className: localIndex !== mychoiceSdkComponents.defaultLocalIndex ? 'navigation-container-partner' : 'navigation-container', children: jsxRuntime.jsxs("div", { className: `content ${appType === mychoiceSdkComponents.AppTypes.MyChoice ? 'mychoice' : ''}`, children: [jsxRuntime.jsx(PostalCodeDataBox, { className: isTheBig ? 'thebig' : '', title: title, postalCode: postalCode }), appType === mychoiceSdkComponents.AppTypes.MyChoice
|
|
3455
|
+
? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: !isDesktop && (formSteps.length - activeIndex - 1) ? (jsxRuntime.jsxs("div", { className: "estimated-minutes", children: [jsxRuntime.jsx(mychoiceSdkComponents.IconClock, {}), jsxRuntime.jsxs("div", { children: [isMobile ? (jsxRuntime.jsx("div", { children: jsxRuntime.jsxs("span", { className: "time", children: [formSteps.length - activeIndex - 1, ' ', formSteps.length - activeIndex - 1 > 1 ? 'minutes' : 'minute'] }) })) : (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", { children: ["Estimated", ' ', jsxRuntime.jsxs("span", { className: "time", children: [formSteps.length - activeIndex - 1, ' ', formSteps.length - activeIndex - 1 > 1 ? 'minutes' : 'minute'] }), ' ', "to complete"] }) })), jsxRuntime.jsx("span", { children: `Step ${activeIndex + 1}/${formSteps.length - 1}` })] })] })) : jsxRuntime.jsx("span", {}) })) : (jsxRuntime.jsx(StepsBox, { formSteps: formSteps, validationHooks: validationHooks, propertyIsCompleted: propertyIsCompleted })), jsxRuntime.jsx(ButtonsBox, { formSteps: formSteps, validationHooks: validationHooks, clearForm: clearForm, propertyIsCompleted: propertyIsCompleted })] }) }));
|
|
3494
3456
|
};
|
|
3495
3457
|
NavigationTop.defaultProps = {
|
|
3496
3458
|
isMobile: false,
|
|
@@ -3816,14 +3778,14 @@ const AppRouterListener = () => {
|
|
|
3816
3778
|
|
|
3817
3779
|
const AppRouteWrapper = (props) => {
|
|
3818
3780
|
const { children } = props;
|
|
3819
|
-
const { appConfigState: { isReady, appType, insuranceType, localIndex
|
|
3781
|
+
const { appConfigState: { isReady, appType, insuranceType, localIndex }, } = mychoiceSdkStore.useStoreAppConfig();
|
|
3820
3782
|
const { dispatchAppModalState } = mychoiceSdkStore.useStoreAppModal();
|
|
3821
3783
|
const { postRequestQuote: carPostRequestQuote } = mychoiceSdkStore.CarQuoteDataHandler();
|
|
3822
3784
|
const { postRequestQuote: homePostRequestQuote } = mychoiceSdkStore.HomeQuoteDataHandler();
|
|
3823
3785
|
const { postRequestQuote: lifePostRequestQuote } = mychoiceSdkStore.LifeQuoteDataHandler();
|
|
3824
|
-
const { postalState: { item: { postalCode: carPostal } } } = mychoiceSdkStore.useStoreFormCarPostal();
|
|
3825
|
-
const { postalState: { item: { postalCode: homePostal } } } = mychoiceSdkStore.useStoreFormHomePostal();
|
|
3826
|
-
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();
|
|
3827
3789
|
// Car insurance states
|
|
3828
3790
|
const { vehicleState } = mychoiceSdkStore.useStoreFormCarVehicle();
|
|
3829
3791
|
const { driverState } = mychoiceSdkStore.useStoreFormCarDriverBase();
|
|
@@ -3849,9 +3811,9 @@ const AppRouteWrapper = (props) => {
|
|
|
3849
3811
|
const { homeDiscountFormValidate, homeDiscountFormIsValid } = mychoiceSdkStore.useValidationHomeDiscount();
|
|
3850
3812
|
// life insurance validation
|
|
3851
3813
|
const { coverageFormValidate, coverageFormIsValid } = mychoiceSdkStore.useValidationCoverage();
|
|
3852
|
-
const { applicantFormValidate: lifeApplicantFormValidate, applicantFormIsValid: lifeApplicantFormIsValid } = mychoiceSdkStore.useValidationLifeApplicant();
|
|
3814
|
+
const { applicantFormValidate: lifeApplicantFormValidate, applicantFormIsValid: lifeApplicantFormIsValid, } = mychoiceSdkStore.useValidationLifeApplicant();
|
|
3853
3815
|
let postalCode = carPostal;
|
|
3854
|
-
const { clearFormData, checkIsExpired, checkIsExpiredWithModal
|
|
3816
|
+
const { clearFormData, checkIsExpired, checkIsExpiredWithModal } = mychoiceSdkStore.ClearFormDataHandler();
|
|
3855
3817
|
const { appLoaderState } = mychoiceSdkStore.useStoreAppLoader();
|
|
3856
3818
|
const isMychoice = appType === mychoiceSdkComponents.AppTypes.MyChoice;
|
|
3857
3819
|
switch (insuranceType) {
|
|
@@ -3877,19 +3839,28 @@ const AppRouteWrapper = (props) => {
|
|
|
3877
3839
|
key: 0,
|
|
3878
3840
|
path: '/',
|
|
3879
3841
|
name: 'Step 1',
|
|
3880
|
-
validateOptions: {
|
|
3842
|
+
validateOptions: {
|
|
3843
|
+
validate: vehicleFormValidate,
|
|
3844
|
+
isValid: vehicleFormIsValid,
|
|
3845
|
+
},
|
|
3881
3846
|
},
|
|
3882
3847
|
{
|
|
3883
3848
|
key: 1,
|
|
3884
3849
|
path: '/driver',
|
|
3885
3850
|
name: 'Step 2',
|
|
3886
|
-
validateOptions: {
|
|
3851
|
+
validateOptions: {
|
|
3852
|
+
validate: driverFormValidate,
|
|
3853
|
+
isValid: driverFormIsValid,
|
|
3854
|
+
},
|
|
3887
3855
|
},
|
|
3888
3856
|
{
|
|
3889
3857
|
key: 2,
|
|
3890
3858
|
path: '/discount',
|
|
3891
3859
|
name: 'Step 3',
|
|
3892
|
-
validateOptions: {
|
|
3860
|
+
validateOptions: {
|
|
3861
|
+
validate: carDiscountFormValidate,
|
|
3862
|
+
isValid: carDiscountFormIsValid,
|
|
3863
|
+
},
|
|
3893
3864
|
requestFn: carPostRequestQuote,
|
|
3894
3865
|
},
|
|
3895
3866
|
],
|
|
@@ -3898,25 +3869,37 @@ const AppRouteWrapper = (props) => {
|
|
|
3898
3869
|
key: 0,
|
|
3899
3870
|
path: '/',
|
|
3900
3871
|
name: 'Step 1',
|
|
3901
|
-
validateOptions: {
|
|
3872
|
+
validateOptions: {
|
|
3873
|
+
validate: addressFormValidate,
|
|
3874
|
+
isValid: addressFormIsValid,
|
|
3875
|
+
},
|
|
3902
3876
|
},
|
|
3903
3877
|
{
|
|
3904
3878
|
key: 1,
|
|
3905
3879
|
path: '/applicant',
|
|
3906
3880
|
name: 'Step 2',
|
|
3907
|
-
validateOptions: {
|
|
3881
|
+
validateOptions: {
|
|
3882
|
+
validate: applicantFormValidate,
|
|
3883
|
+
isValid: applicantFormIsValid,
|
|
3884
|
+
},
|
|
3908
3885
|
},
|
|
3909
3886
|
{
|
|
3910
3887
|
key: 2,
|
|
3911
3888
|
path: '/property',
|
|
3912
3889
|
name: 'Step 3',
|
|
3913
|
-
validateOptions: {
|
|
3890
|
+
validateOptions: {
|
|
3891
|
+
validate: dwellingFormValidate,
|
|
3892
|
+
isValid: dwellingFormIsValid,
|
|
3893
|
+
},
|
|
3914
3894
|
},
|
|
3915
3895
|
{
|
|
3916
3896
|
key: 3,
|
|
3917
3897
|
path: '/discount',
|
|
3918
3898
|
name: 'Step 4',
|
|
3919
|
-
validateOptions: {
|
|
3899
|
+
validateOptions: {
|
|
3900
|
+
validate: homeDiscountFormValidate,
|
|
3901
|
+
isValid: homeDiscountFormIsValid,
|
|
3902
|
+
},
|
|
3920
3903
|
requestFn: homePostRequestQuote,
|
|
3921
3904
|
},
|
|
3922
3905
|
],
|
|
@@ -3925,25 +3908,37 @@ const AppRouteWrapper = (props) => {
|
|
|
3925
3908
|
key: 0,
|
|
3926
3909
|
path: '/',
|
|
3927
3910
|
name: 'Step 1',
|
|
3928
|
-
validateOptions: {
|
|
3911
|
+
validateOptions: {
|
|
3912
|
+
validate: addressFormValidate,
|
|
3913
|
+
isValid: addressFormIsValid,
|
|
3914
|
+
},
|
|
3929
3915
|
},
|
|
3930
3916
|
{
|
|
3931
3917
|
key: 1,
|
|
3932
3918
|
path: '/applicant',
|
|
3933
3919
|
name: 'Step 2',
|
|
3934
|
-
validateOptions: {
|
|
3920
|
+
validateOptions: {
|
|
3921
|
+
validate: applicantFormValidate,
|
|
3922
|
+
isValid: applicantFormIsValid,
|
|
3923
|
+
},
|
|
3935
3924
|
},
|
|
3936
3925
|
{
|
|
3937
3926
|
key: 2,
|
|
3938
3927
|
path: '/property',
|
|
3939
3928
|
name: 'Step 3',
|
|
3940
|
-
validateOptions: {
|
|
3929
|
+
validateOptions: {
|
|
3930
|
+
validate: dwellingFormValidate,
|
|
3931
|
+
isValid: dwellingFormIsValid,
|
|
3932
|
+
},
|
|
3941
3933
|
},
|
|
3942
3934
|
{
|
|
3943
3935
|
key: 3,
|
|
3944
3936
|
path: '/discount',
|
|
3945
3937
|
name: 'Step 4',
|
|
3946
|
-
validateOptions: {
|
|
3938
|
+
validateOptions: {
|
|
3939
|
+
validate: homeDiscountFormValidate,
|
|
3940
|
+
isValid: homeDiscountFormIsValid,
|
|
3941
|
+
},
|
|
3947
3942
|
requestFn: homePostRequestQuote,
|
|
3948
3943
|
},
|
|
3949
3944
|
],
|
|
@@ -3952,25 +3947,37 @@ const AppRouteWrapper = (props) => {
|
|
|
3952
3947
|
key: 0,
|
|
3953
3948
|
path: '/',
|
|
3954
3949
|
name: 'Step 1',
|
|
3955
|
-
validateOptions: {
|
|
3950
|
+
validateOptions: {
|
|
3951
|
+
validate: addressFormValidate,
|
|
3952
|
+
isValid: addressFormIsValid,
|
|
3953
|
+
},
|
|
3956
3954
|
},
|
|
3957
3955
|
{
|
|
3958
3956
|
key: 1,
|
|
3959
3957
|
path: '/applicant',
|
|
3960
3958
|
name: 'Step 2',
|
|
3961
|
-
validateOptions: {
|
|
3959
|
+
validateOptions: {
|
|
3960
|
+
validate: applicantFormValidate,
|
|
3961
|
+
isValid: applicantFormIsValid,
|
|
3962
|
+
},
|
|
3962
3963
|
},
|
|
3963
3964
|
{
|
|
3964
3965
|
key: 2,
|
|
3965
3966
|
path: '/property',
|
|
3966
3967
|
name: 'Step 3',
|
|
3967
|
-
validateOptions: {
|
|
3968
|
+
validateOptions: {
|
|
3969
|
+
validate: dwellingFormValidate,
|
|
3970
|
+
isValid: dwellingFormIsValid,
|
|
3971
|
+
},
|
|
3968
3972
|
},
|
|
3969
3973
|
{
|
|
3970
3974
|
key: 3,
|
|
3971
3975
|
path: '/discount',
|
|
3972
3976
|
name: 'Step 4',
|
|
3973
|
-
validateOptions: {
|
|
3977
|
+
validateOptions: {
|
|
3978
|
+
validate: homeDiscountFormValidate,
|
|
3979
|
+
isValid: homeDiscountFormIsValid,
|
|
3980
|
+
},
|
|
3974
3981
|
requestFn: homePostRequestQuote,
|
|
3975
3982
|
},
|
|
3976
3983
|
],
|
|
@@ -3979,13 +3986,19 @@ const AppRouteWrapper = (props) => {
|
|
|
3979
3986
|
key: 0,
|
|
3980
3987
|
path: '/',
|
|
3981
3988
|
name: 'Step 1',
|
|
3982
|
-
validateOptions: {
|
|
3989
|
+
validateOptions: {
|
|
3990
|
+
validate: coverageFormValidate,
|
|
3991
|
+
isValid: coverageFormIsValid,
|
|
3992
|
+
},
|
|
3983
3993
|
},
|
|
3984
3994
|
{
|
|
3985
3995
|
key: 1,
|
|
3986
3996
|
path: '/applicant',
|
|
3987
3997
|
name: 'Step 2',
|
|
3988
|
-
validateOptions: {
|
|
3998
|
+
validateOptions: {
|
|
3999
|
+
validate: lifeApplicantFormValidate,
|
|
4000
|
+
isValid: lifeApplicantFormIsValid,
|
|
4001
|
+
},
|
|
3989
4002
|
requestFn: lifePostRequestQuote,
|
|
3990
4003
|
},
|
|
3991
4004
|
],
|
|
@@ -3993,25 +4006,13 @@ const AppRouteWrapper = (props) => {
|
|
|
3993
4006
|
const [steps, setSteps] = React.useState(formSteps[insuranceType]);
|
|
3994
4007
|
const [validationHooks, setValidationHooks] = React.useState(formValidationHooks[insuranceType]);
|
|
3995
4008
|
const [progressLength, setProgressLength] = React.useState('');
|
|
3996
|
-
const [showContent, setShowContent] = React.useState(false);
|
|
3997
|
-
React.useEffect(() => {
|
|
3998
|
-
const checkTime = () => {
|
|
3999
|
-
const currentUTCDate = new Date();
|
|
4000
|
-
const currentHour = currentUTCDate.getUTCHours() - 5; // EST is UTC-5
|
|
4001
|
-
const currentDay = currentUTCDate.getUTCDay(); // Sunday is 0, Monday is 1, ..., Saturday is 6
|
|
4002
|
-
// Check if it's a weekday (Monday to Friday) and if the current hour is between 9 am and 6 pm
|
|
4003
|
-
const isWeekday = currentDay >= 1 && currentDay <= 5;
|
|
4004
|
-
const isWorkingHours = currentHour >= 9 && currentHour < 18;
|
|
4005
|
-
setShowContent(isWeekday && isWorkingHours);
|
|
4006
|
-
};
|
|
4007
|
-
checkTime(); // Initial check
|
|
4008
|
-
const interval = setInterval(checkTime, 60000); // Check every minute
|
|
4009
|
-
return () => clearInterval(interval); // Cleanup
|
|
4010
|
-
}, []); // Run effect only once on component mount
|
|
4011
4009
|
React.useEffect(() => {
|
|
4012
4010
|
let filteredSteps = formSteps[insuranceType];
|
|
4013
4011
|
let filteredHooks = formValidationHooks[insuranceType];
|
|
4014
|
-
if (isCompleted &&
|
|
4012
|
+
if (isCompleted &&
|
|
4013
|
+
(insuranceType === mychoiceSdkComponents.InsuranceTypes.Home ||
|
|
4014
|
+
insuranceType === mychoiceSdkComponents.InsuranceTypes.Condo ||
|
|
4015
|
+
insuranceType === mychoiceSdkComponents.InsuranceTypes.Tenant)) {
|
|
4015
4016
|
filteredSteps = formSteps[insuranceType].filter((item) => item.path !== '/property');
|
|
4016
4017
|
filteredHooks = formValidationHooks[insuranceType].filter((item) => item.path !== '/property');
|
|
4017
4018
|
}
|
|
@@ -4078,23 +4079,12 @@ const AppRouteWrapper = (props) => {
|
|
|
4078
4079
|
}
|
|
4079
4080
|
}
|
|
4080
4081
|
}, [carPostal, homePostal, lifePostal, isReady]);
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
const postalCodeDataBoxRect = postalCodeDataBox.getBoundingClientRect();
|
|
4088
|
-
const isScrolledPast = postalCodeDataBoxRect.bottom <= 0; // Change to <= if you want the banner to appear when the bottom of the box touches the top of the viewport
|
|
4089
|
-
setShowStickyBanner(isScrolledPast);
|
|
4090
|
-
}
|
|
4091
|
-
};
|
|
4092
|
-
window.addEventListener('scroll', handleScroll);
|
|
4093
|
-
return () => {
|
|
4094
|
-
window.removeEventListener('scroll', handleScroll);
|
|
4095
|
-
};
|
|
4096
|
-
}, []);
|
|
4097
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: isReady && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(AppHeader, {}), jsxRuntime.jsx(AppModal, {}), insuranceType && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(NavigationTop, { title: `${insuranceType.replace(/^./, insuranceType[0].toUpperCase())} Insurance Quote`, postalCode: postalCode, formSteps: steps, validationHooks: validationHooks, clearForm: clearFormData, propertyIsCompleted: isCompleted, id: "postalCodeData" }) })), showStickyBanner && showContent && isMobile && appType === mychoiceSdkComponents.AppTypes.MyChoice && (jsxRuntime.jsxs("div", { id: "stickyBanner", style: { position: "sticky", top: 0, color: "#FFFFFF", backgroundColor: "#8ED6DC", width: "100%", height: "75px", zIndex: 5000, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center" }, children: [jsxRuntime.jsx("a", { style: { fontWeight: 700, fontSize: "22px" }, href: "tel:18884534644", children: "Need Help? Give us a call at" }), jsxRuntime.jsx("a", { style: { marginTop: "5px", textDecoration: "underline", fontWeight: 850 }, href: "tel:18884534644", children: "1-888-453-4644" })] })), insuranceType && appType === mychoiceSdkComponents.AppTypes.MyChoice && (jsxRuntime.jsx("div", { className: localIndex !== mychoiceSdkComponents.defaultLocalIndex ? 'step-progress-bar-partner' : 'step-progress-bar', children: jsxRuntime.jsx("span", { style: { width: progressLength } }) })), jsxRuntime.jsx("div", { className: `${insuranceType ? 'form-page-content' : ''} ${insuranceType && appType === mychoiceSdkComponents.AppTypes.MyChoice ? 'mychoice' : ''}`, children: insuranceType && appType === mychoiceSdkComponents.AppTypes.MyChoice && isDesktop && progressLength ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", { className: "mychoice-content", children: [jsxRuntime.jsx(StepsBox, { className: "step-box", formSteps: steps, validationHooks: validationHooks, propertyIsCompleted: isCompleted }), children, jsxRuntime.jsx("div", { className: "empty-steps-container" })] }) })) : children }), isMychoice && !appLoaderState.isOpen && jsxRuntime.jsx(ProviderImageFooter, {})] })) }));
|
|
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, {})] })) }));
|
|
4098
4088
|
};
|
|
4099
4089
|
const NestedRoutes = () => {
|
|
4100
4090
|
const insuranceType = mychoiceSdkComponents.getInsuranceType();
|
|
@@ -4105,10 +4095,11 @@ const NestedRoutes = () => {
|
|
|
4105
4095
|
payload: true,
|
|
4106
4096
|
});
|
|
4107
4097
|
});
|
|
4108
|
-
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: {
|
|
4109
|
-
|
|
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, {}) }) }) })] })] }) })) }));
|
|
4110
4101
|
};
|
|
4111
|
-
const RedirectWithSearchParams = ({ to, path }) => {
|
|
4102
|
+
const RedirectWithSearchParams = ({ to, path, }) => {
|
|
4112
4103
|
const insuranceType = mychoiceSdkComponents.getInsuranceType();
|
|
4113
4104
|
mychoiceSdkStore.useStoreAppConfig();
|
|
4114
4105
|
const [isRender, setIsRender] = React.useState(false);
|
|
@@ -4120,10 +4111,12 @@ const RedirectWithSearchParams = ({ to, path }) => {
|
|
|
4120
4111
|
const toBasePath = to?.split('/')?.slice(-1)?.[0];
|
|
4121
4112
|
mychoiceSdkComponents.useEffectOnce(() => {
|
|
4122
4113
|
if (queryRoot.length > 1) {
|
|
4123
|
-
const query = JSON.parse(`{"${decodeURI(queryRoot[1])
|
|
4124
|
-
|
|
4114
|
+
const query = JSON.parse(`{"${decodeURI(queryRoot[1])
|
|
4115
|
+
.replace(/"/g, '\\"')
|
|
4116
|
+
.replace(/&/g, '","')
|
|
4117
|
+
.replace(/=/g, '":"')}"}`);
|
|
4125
4118
|
if (!isRender) {
|
|
4126
|
-
if (query.postal_code &&
|
|
4119
|
+
if (query.postal_code && insuranceType !== mychoiceSdkComponents.InsuranceTypes.Life) {
|
|
4127
4120
|
const formattedPostalCode = query.postal_code.replace(' ', '');
|
|
4128
4121
|
getPostal(formattedPostalCode).then(() => {
|
|
4129
4122
|
setIsRender(true);
|
|
@@ -4152,7 +4145,9 @@ const RedirectWithSearchParams = ({ to, path }) => {
|
|
|
4152
4145
|
});
|
|
4153
4146
|
}
|
|
4154
4147
|
}
|
|
4155
|
-
if (insuranceType === mychoiceSdkComponents.InsuranceTypes.Home ||
|
|
4148
|
+
if (insuranceType === mychoiceSdkComponents.InsuranceTypes.Home ||
|
|
4149
|
+
insuranceType === mychoiceSdkComponents.InsuranceTypes.Condo ||
|
|
4150
|
+
insuranceType === mychoiceSdkComponents.InsuranceTypes.Tenant) {
|
|
4156
4151
|
if (query.utm_source) {
|
|
4157
4152
|
dispatchHomeDiscountState({
|
|
4158
4153
|
type: mychoiceSdkStore.StoreFormHomeDiscountActionTypes.FormHomeUtmSourceSet,
|
|
@@ -4165,7 +4160,8 @@ const RedirectWithSearchParams = ({ to, path }) => {
|
|
|
4165
4160
|
payload: { utmCampaign: query.utm_campaign },
|
|
4166
4161
|
});
|
|
4167
4162
|
}
|
|
4168
|
-
if (path === 'broker' ||
|
|
4163
|
+
if (path === 'broker' ||
|
|
4164
|
+
['home', 'condo', 'tenant'].includes(toBasePath)) {
|
|
4169
4165
|
dispatchHomeDiscountState({
|
|
4170
4166
|
type: mychoiceSdkStore.StoreFormHomeDiscountActionTypes.FormHomeQuoterBrokerInfoSet,
|
|
4171
4167
|
payload: query,
|
|
@@ -4197,10 +4193,8 @@ const RedirectWithSearchParams = ({ to, path }) => {
|
|
|
4197
4193
|
const AppRoutes = (props) => {
|
|
4198
4194
|
const { appType } = props;
|
|
4199
4195
|
const defaultInsuranceType = mychoiceSdkComponents.getInsuranceType();
|
|
4200
|
-
const { appConfigState: { localIndex, insuranceType } } = mychoiceSdkStore.useStoreAppConfig();
|
|
4201
|
-
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:
|
|
4202
|
-
// <BrokerKeys redirectURL={`/${localIndex}/${defaultInsuranceType}`} />
|
|
4203
|
-
) }), 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}` }) })] })] }));
|
|
4204
4198
|
};
|
|
4205
4199
|
|
|
4206
4200
|
const AppLoader = () => {
|