@mychoice/mychoice-sdk-modules 2.1.34 → 2.1.35
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 +7 -73
- 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 +7 -73
- 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 +2 -2
- 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
|
@@ -3246,9 +3246,7 @@ const ModalQuoteRequest = ({ title, description, phoneNumber, }) => (jsxRuntime.
|
|
|
3246
3246
|
&& 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
3247
|
&& (jsxRuntime.jsx("a", { target: "_blank", rel: "noreferrer noopener", href: `tel:1${phoneNumber}`, className: "phoneNumber", children: "Call the Broker" }))] })] }));
|
|
3248
3248
|
|
|
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
|
-
};
|
|
3249
|
+
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
3250
|
PostalCodeDataBox.defaultProps = {
|
|
3253
3251
|
title: '',
|
|
3254
3252
|
postalCode: '',
|
|
@@ -3262,21 +3260,6 @@ const StepsBox = ({ formSteps, validationHooks, propertyIsCompleted, }) => {
|
|
|
3262
3260
|
// const { dispatchAppModalState } = useStoreAppModal();
|
|
3263
3261
|
// const [steps, setSteps] = useState(formSteps);
|
|
3264
3262
|
// 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
3263
|
const { pathname } = reactRouterDom.useLocation();
|
|
3281
3264
|
const currentPath = pathname.split('/');
|
|
3282
3265
|
const activeStep = formSteps.find((step) => currentPath[currentPath.length - 1] === step.path?.substring(1));
|
|
@@ -3340,22 +3323,6 @@ const StepsBox = ({ formSteps, validationHooks, propertyIsCompleted, }) => {
|
|
|
3340
3323
|
}
|
|
3341
3324
|
}
|
|
3342
3325
|
};
|
|
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
3326
|
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
3327
|
let cls;
|
|
3361
3328
|
switch (true) {
|
|
@@ -3372,11 +3339,9 @@ const StepsBox = ({ formSteps, validationHooks, propertyIsCompleted, }) => {
|
|
|
3372
3339
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
3373
3340
|
}
|
|
3374
3341
|
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.
|
|
3342
|
+
? jsxRuntime.jsx(mychoiceSdkComponents.MychoiceStep, { className: cls, item: item, index: index }, `${index}-${item?.title}`)
|
|
3376
3343
|
: 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" }))] })] }))] }))] }));
|
|
3344
|
+
}) })) : 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
3345
|
};
|
|
3381
3346
|
StepsBox.defaultProps = {
|
|
3382
3347
|
partnerId: '',
|
|
@@ -3461,7 +3426,7 @@ ButtonsBox.defaultProps = {
|
|
|
3461
3426
|
activeIndex: 0,
|
|
3462
3427
|
};
|
|
3463
3428
|
|
|
3464
|
-
const NavigationTop = ({ title, postalCode, validationHooks, formSteps, clearForm, propertyIsCompleted,
|
|
3429
|
+
const NavigationTop = ({ title, postalCode, validationHooks, formSteps, clearForm, propertyIsCompleted, }) => {
|
|
3465
3430
|
const { pathname } = reactRouterDom.useLocation();
|
|
3466
3431
|
const { appConfigState: { appType, localIndex } } = mychoiceSdkStore.useStoreAppConfig();
|
|
3467
3432
|
const isTheBig = appType === mychoiceSdkComponents.AppTypes.TheBig;
|
|
@@ -3489,8 +3454,8 @@ const NavigationTop = ({ title, postalCode, validationHooks, formSteps, clearFor
|
|
|
3489
3454
|
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
3490
3455
|
}
|
|
3491
3456
|
}
|
|
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(
|
|
3457
|
+
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
|
|
3458
|
+
? (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
3459
|
};
|
|
3495
3460
|
NavigationTop.defaultProps = {
|
|
3496
3461
|
isMobile: false,
|
|
@@ -3993,21 +3958,6 @@ const AppRouteWrapper = (props) => {
|
|
|
3993
3958
|
const [steps, setSteps] = React.useState(formSteps[insuranceType]);
|
|
3994
3959
|
const [validationHooks, setValidationHooks] = React.useState(formValidationHooks[insuranceType]);
|
|
3995
3960
|
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
3961
|
React.useEffect(() => {
|
|
4012
3962
|
let filteredSteps = formSteps[insuranceType];
|
|
4013
3963
|
let filteredHooks = formValidationHooks[insuranceType];
|
|
@@ -4078,23 +4028,7 @@ const AppRouteWrapper = (props) => {
|
|
|
4078
4028
|
}
|
|
4079
4029
|
}
|
|
4080
4030
|
}, [carPostal, homePostal, lifePostal, isReady]);
|
|
4081
|
-
|
|
4082
|
-
const [showStickyBanner, setShowStickyBanner] = React.useState(false);
|
|
4083
|
-
React.useEffect(() => {
|
|
4084
|
-
const handleScroll = () => {
|
|
4085
|
-
const postalCodeDataBox = document.getElementById('postalCodeData');
|
|
4086
|
-
if (postalCodeDataBox) {
|
|
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, {})] })) }));
|
|
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 ? '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, {})] })) }));
|
|
4098
4032
|
};
|
|
4099
4033
|
const NestedRoutes = () => {
|
|
4100
4034
|
const insuranceType = mychoiceSdkComponents.getInsuranceType();
|