@mychoice/mychoice-sdk-modules 2.1.32 → 2.1.33
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 +64 -9
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/shared/navigations/interfaces.d.ts +1 -0
- package/dist/esm/index.js +64 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/shared/navigations/interfaces.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -157,9 +157,8 @@ const OfferSection = ({ offerCompany, brokerCompany, offerPrice, phoneNumber, is
|
|
|
157
157
|
}
|
|
158
158
|
postRequestQuoteOnliaUrl(true, redirectUrl);
|
|
159
159
|
};
|
|
160
|
-
console.log(offerCompany, "offer c");
|
|
161
160
|
return (jsxs("div", { className: `offer-section ${mychoiceCls}`, children: [jsx(OfferHeader, { className: isTheBig ? 'thebig-bold' : '', companyName: offerCompany?.name, isBestOffer: isBestOffer }), jsx(OfferPrice, { className: isTheBig ? 'thebig' : '', companyLogo: offerCompany?.logo, price: offerPrice }), !isTheBig && offsiteUrl
|
|
162
|
-
? (jsxs("div", { className: "offer-phone", children: [jsx("h3", { children: "Click below to get this rate" }), jsx(ButtonBase, { className: `offer-phone-number ${mychoiceCls}`, label: "Buy Online", type: ButtonTypes.Button, category: CategoryTypes.Filled, color: ColorTypes.Primary, variant: ButtonVariantTypes.Rectangle, size: SizeTypes.Medium, onClick: handleCTAClick })] })) : (jsxs("div", { className: "offer-phone", children: [jsx("h3", { className: isTheBig ? 'thebig-bold' : '', children: "Call now to get this rate" }), jsx("a", { target: "_blank", rel: "noreferrer noopener", href: `tel:${phoneNumber?.number}`, children: jsx(ButtonBase, { className: `${isTheBig ? 'thebig-bold' : 'mychoice'} offer-phone-number`, label: phoneNumber?.title, type: ButtonTypes.Button, category: CategoryTypes.Filled, color: ColorTypes.Primary, variant: ButtonVariantTypes.Rectangle, size: SizeTypes.Medium }) })] })), jsxs("button", { className: "dropdown", onClick: handleDropdownClick, children: [jsx("span", { children: detailsIsOpen ? 'Less Info' : 'More Info' }), jsx(IconDropdownArrow, { color: "grey", className: detailsIsOpen ? 'rotated' : '' })] }), detailsIsOpen && (jsxs("div", { className: "offer-details", children: [jsx(OfferDetail, { className: isTheBig ? 'thebig-bold' : '', name: offerCompany?.name,
|
|
161
|
+
? (jsxs("div", { className: "offer-phone", children: [jsx("h3", { children: "Click below to get this rate" }), jsx(ButtonBase, { className: `offer-phone-number ${mychoiceCls}`, label: "Buy Online", type: ButtonTypes.Button, category: CategoryTypes.Filled, color: ColorTypes.Primary, variant: ButtonVariantTypes.Rectangle, size: SizeTypes.Medium, onClick: handleCTAClick })] })) : (jsxs("div", { className: "offer-phone", children: [jsx("h3", { className: isTheBig ? 'thebig-bold' : '', children: "Call now to get this rate" }), jsx("a", { target: "_blank", rel: "noreferrer noopener", href: `tel:${phoneNumber?.number}`, children: jsx(ButtonBase, { className: `${isTheBig ? 'thebig-bold' : 'mychoice'} offer-phone-number`, label: phoneNumber?.title, type: ButtonTypes.Button, category: CategoryTypes.Filled, color: ColorTypes.Primary, variant: ButtonVariantTypes.Rectangle, size: SizeTypes.Medium }) })] })), jsxs("button", { className: "dropdown", onClick: handleDropdownClick, children: [jsx("span", { children: detailsIsOpen ? 'Less Info' : 'More Info' }), jsx(IconDropdownArrow, { color: "grey", className: detailsIsOpen ? 'rotated' : '' })] }), detailsIsOpen && (jsxs("div", { className: "offer-details", children: [jsx(OfferDetail, { className: isTheBig ? 'thebig-bold' : '', name: offerCompany?.name, companyType: CompanyRoleTypes.Offering, description: offerCompany?.description }), jsx("hr", {}), (isTheBig || !offsiteUrl)
|
|
163
162
|
&& (jsxs(Fragment, { children: [jsx(OfferDetail, { className: isTheBig ? 'thebig-bold' : '', logo: brokerCompany?.logo, name: brokerCompany?.title, companyType: CompanyRoleTypes.Broker, description: brokerCompany?.description }), jsx("hr", {})] })), jsx(OfferDetail, { className: isTheBig ? 'thebig-bold' : '', name: "Hours of Operation", children: jsx(OperationHoursInfo, { weekdayHours: weekdayHours, saturdayHours: saturdayHours, sundayHours: sundayHours }) })] }))] }));
|
|
164
163
|
};
|
|
165
164
|
OfferSection.defaultProps = {
|
|
@@ -3237,7 +3236,9 @@ const ModalQuoteRequest = ({ title, description, phoneNumber, }) => (jsxs("div",
|
|
|
3237
3236
|
&& jsx("p", { children: description }), jsxs("div", { className: "modal-buttons", children: [jsx(ButtonBase, { type: ButtonTypes.Button, label: "OK", category: CategoryTypes.Filled, color: ColorTypes.Primary, variant: ButtonVariantTypes.Rectangle, size: SizeTypes.Large }), phoneNumber
|
|
3238
3237
|
&& (jsx("a", { target: "_blank", rel: "noreferrer noopener", href: `tel:1${phoneNumber}`, className: "phoneNumber", children: "Call the Broker" }))] })] }));
|
|
3239
3238
|
|
|
3240
|
-
const PostalCodeDataBox = ({ title, postalCode, className
|
|
3239
|
+
const PostalCodeDataBox = ({ title, postalCode, className, id }) => {
|
|
3240
|
+
return (jsx(Fragment, { children: jsxs("div", { id: id, className: `${className} postal-code-data-box`, children: [jsx("h2", { children: title }), postalCode && (jsxs("p", { children: ["Your postal code:", ' ', postalCode] }))] }) }));
|
|
3241
|
+
};
|
|
3241
3242
|
PostalCodeDataBox.defaultProps = {
|
|
3242
3243
|
title: '',
|
|
3243
3244
|
postalCode: '',
|
|
@@ -3251,6 +3252,16 @@ const StepsBox = ({ formSteps, validationHooks, propertyIsCompleted, }) => {
|
|
|
3251
3252
|
// const { dispatchAppModalState } = useStoreAppModal();
|
|
3252
3253
|
// const [steps, setSteps] = useState(formSteps);
|
|
3253
3254
|
// const [validations, setValidations] = useState(validationHooks);
|
|
3255
|
+
const [showContent, setShowContent] = useState(false);
|
|
3256
|
+
useEffect(() => {
|
|
3257
|
+
const checkTime = () => {
|
|
3258
|
+
const currentHour = new Date().getUTCHours() - 5; // EST is UTC-5
|
|
3259
|
+
setShowContent(currentHour >= 9 && currentHour < 18);
|
|
3260
|
+
};
|
|
3261
|
+
checkTime(); // Initial check
|
|
3262
|
+
const interval = setInterval(checkTime, 60000); // Check every minute
|
|
3263
|
+
return () => clearInterval(interval); // Cleanup
|
|
3264
|
+
}, []); // Run effect only once on component mount
|
|
3254
3265
|
const { pathname } = useLocation();
|
|
3255
3266
|
const currentPath = pathname.split('/');
|
|
3256
3267
|
const activeStep = formSteps.find((step) => currentPath[currentPath.length - 1] === step.path?.substring(1));
|
|
@@ -3314,6 +3325,22 @@ const StepsBox = ({ formSteps, validationHooks, propertyIsCompleted, }) => {
|
|
|
3314
3325
|
}
|
|
3315
3326
|
}
|
|
3316
3327
|
};
|
|
3328
|
+
const [showQR, setShowQr] = useState(false);
|
|
3329
|
+
const containerRef = useRef(null);
|
|
3330
|
+
useEffect(() => {
|
|
3331
|
+
const handleClickOutside = (event) => {
|
|
3332
|
+
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
3333
|
+
setShowQr(false);
|
|
3334
|
+
}
|
|
3335
|
+
};
|
|
3336
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
3337
|
+
return () => {
|
|
3338
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
3339
|
+
};
|
|
3340
|
+
}, []);
|
|
3341
|
+
const handleHelpButton = () => {
|
|
3342
|
+
setShowQr(!showQR);
|
|
3343
|
+
};
|
|
3317
3344
|
return (jsxs("ol", { className: appType === AppTypes.MyChoice ? 'mychoice-navigation-steps-container' : 'navigation-steps-container', children: [!isMobile ? (jsx(Fragment, { children: formSteps?.map((item, index) => {
|
|
3318
3345
|
let cls;
|
|
3319
3346
|
switch (true) {
|
|
@@ -3330,9 +3357,11 @@ const StepsBox = ({ formSteps, validationHooks, propertyIsCompleted, }) => {
|
|
|
3330
3357
|
return jsx(Fragment, {});
|
|
3331
3358
|
}
|
|
3332
3359
|
return (jsx("div", { role: "presentation", className: appType === AppTypes.MyChoice ? navigationCls : 'navigation-step-container', onKeyDown: handleStepClick(item, index), onClick: handleStepClick(item, index), children: appType === AppTypes.MyChoice
|
|
3333
|
-
? jsx(MychoiceStep, { className: cls, item: item, index: index }, `${index}-${item?.title}`)
|
|
3360
|
+
? jsxs(Fragment, { children: [jsx(MychoiceStep, { className: cls, item: item, index: index }, `${index}-${item?.title}`), jsx(ButtonBase, {})] })
|
|
3334
3361
|
: jsx(Step, { className: cls, item: item, index: index }, `${index}-${item?.title}`) }, `${index}-${item?.title}`));
|
|
3335
|
-
}) })) : jsx(Step, { item: formSteps[activeIndex], index: activeIndex, itemsCount: formSteps.length, isMobile: true }), appType === AppTypes.MyChoice && (jsxs(Fragment, { children: [jsx("hr", {}), jsxs("div", { className: "estimated-minutes", children: [jsx(IconClock, {}), jsxs("div", { children: ["Estimated", ' ', jsxs("span", { className: "time", children: [formSteps.length - activeIndex - 1, ' ', formSteps.length - activeIndex - 1 > 1 ? 'minutes' : 'minute'] }), ' ', "to complete"] })] })
|
|
3362
|
+
}) })) : jsx(Step, { item: formSteps[activeIndex], index: activeIndex, itemsCount: formSteps.length, isMobile: true }), appType === AppTypes.MyChoice && (jsxs(Fragment, { children: [jsx("hr", {}), jsxs("div", { className: "estimated-minutes", children: [jsx(IconClock, {}), jsxs("div", { children: ["Estimated", ' ', jsxs("span", { className: "time", children: [formSteps.length - activeIndex - 1, ' ', formSteps.length - activeIndex - 1 > 1 ? 'minutes' : 'minute'] }), ' ', "to complete"] })] }), showContent && appType === AppTypes.MyChoice && (jsxs("div", { style: { gap: "1em", display: "flex", flexDirection: "column", marginTop: "1em", alignItems: "center", justifyContent: "center", marginLeft: "2em" }, children: [jsx("p", { style: { fontWeight: "600" }, children: "Need help? Call us at" }), jsxs("div", { ref: containerRef, style: { position: "relative", width: '180px' }, children: [jsx(ButtonBase, { size: SizeTypes.Medium, className: "button-with-text button-circle-medium", category: CategoryTypes.Filled, color: ColorTypes.Secondary, variant: ButtonVariantTypes.Circle, onClick: handleHelpButton, children: jsx("span", { style: { padding: "0 1rem", fontWeight: "700" }, children: "1-888-453-4644" }) }), showQR && (jsx("img", { style: { position: 'absolute', top: '355%', left: '50%', transform: 'translate(-50%, -50%)', opacity: 0, transition: 'opacity 500ms ease-in-out' }, onLoad: (e) => {
|
|
3363
|
+
e.currentTarget.style.opacity = '1';
|
|
3364
|
+
}, src: "https://www.mychoice.ca/wp-content/themes/mychoice-theme/img/svg/qr-phone-with-text.svg", alt: "QR code scan to call" }))] })] }))] }))] }));
|
|
3336
3365
|
};
|
|
3337
3366
|
StepsBox.defaultProps = {
|
|
3338
3367
|
partnerId: '',
|
|
@@ -3417,7 +3446,7 @@ ButtonsBox.defaultProps = {
|
|
|
3417
3446
|
activeIndex: 0,
|
|
3418
3447
|
};
|
|
3419
3448
|
|
|
3420
|
-
const NavigationTop = ({ title, postalCode, validationHooks, formSteps, clearForm, propertyIsCompleted, }) => {
|
|
3449
|
+
const NavigationTop = ({ title, postalCode, validationHooks, formSteps, clearForm, propertyIsCompleted, id, }) => {
|
|
3421
3450
|
const { pathname } = useLocation();
|
|
3422
3451
|
const { appConfigState: { appType, localIndex } } = useStoreAppConfig();
|
|
3423
3452
|
const isTheBig = appType === AppTypes.TheBig;
|
|
@@ -3445,8 +3474,8 @@ const NavigationTop = ({ title, postalCode, validationHooks, formSteps, clearFor
|
|
|
3445
3474
|
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
3446
3475
|
}
|
|
3447
3476
|
}
|
|
3448
|
-
return (jsx("div", { className: localIndex !== defaultLocalIndex ? 'navigation-container-partner' : 'navigation-container', children: jsxs("div", { className: `content ${appType === AppTypes.MyChoice ? 'mychoice' : ''}`, children: [jsx(PostalCodeDataBox, { className: isTheBig ? 'thebig' : '', title: title, postalCode: postalCode }), appType === AppTypes.MyChoice
|
|
3449
|
-
? (jsx(Fragment, { children: !isDesktop && (formSteps.length - activeIndex - 1) ? (jsxs("div", { className: "estimated-minutes", children: [jsx(IconClock, {}), jsxs("div", { children: [isMobile ? (jsx("div", { children: jsxs("span", { className: "time", children: [formSteps.length - activeIndex - 1, ' ', formSteps.length - activeIndex - 1 > 1 ? 'minutes' : 'minute'] }) })) : (jsx(Fragment, { children: jsxs("div", { children: ["Estimated", ' ', jsxs("span", { className: "time", children: [formSteps.length - activeIndex - 1, ' ', formSteps.length - activeIndex - 1 > 1 ? 'minutes' : 'minute'] }), ' ', "to complete"] }) })), jsx("span", { children: `Step ${activeIndex + 1}/${formSteps.length - 1}` })] })] })) : jsx("span", {}) })) : (jsx(StepsBox, { formSteps: formSteps, validationHooks: validationHooks, propertyIsCompleted: propertyIsCompleted })), jsx(ButtonsBox, { formSteps: formSteps, validationHooks: validationHooks, clearForm: clearForm, propertyIsCompleted: propertyIsCompleted })] }) }));
|
|
3477
|
+
return (jsx("div", { id: id, className: localIndex !== defaultLocalIndex ? 'navigation-container-partner' : 'navigation-container', children: jsxs("div", { className: `content ${appType === AppTypes.MyChoice ? 'mychoice' : ''}`, children: [jsx(PostalCodeDataBox, { className: isTheBig ? 'thebig' : '', title: title, postalCode: postalCode }), appType === AppTypes.MyChoice
|
|
3478
|
+
? (jsx(Fragment, { children: !isDesktop && (formSteps.length - activeIndex - 1) ? (jsxs("div", { className: "estimated-minutes", children: [jsx(IconClock, {}), jsxs("div", { children: [isMobile ? (jsx(Fragment, { children: jsx("div", { children: jsxs("span", { className: "time", children: [formSteps.length - activeIndex - 1, ' ', formSteps.length - activeIndex - 1 > 1 ? 'minutes' : 'minute'] }) }) })) : (jsx(Fragment, { children: jsxs("div", { children: ["Estimated", ' ', jsxs("span", { className: "time", children: [formSteps.length - activeIndex - 1, ' ', formSteps.length - activeIndex - 1 > 1 ? 'minutes' : 'minute'] }), ' ', "to complete"] }) })), jsx("span", { children: `Step ${activeIndex + 1}/${formSteps.length - 1}` })] })] })) : jsx("span", {}) })) : (jsx(StepsBox, { formSteps: formSteps, validationHooks: validationHooks, propertyIsCompleted: propertyIsCompleted })), jsx(ButtonsBox, { formSteps: formSteps, validationHooks: validationHooks, clearForm: clearForm, propertyIsCompleted: propertyIsCompleted })] }) }));
|
|
3450
3479
|
};
|
|
3451
3480
|
NavigationTop.defaultProps = {
|
|
3452
3481
|
isMobile: false,
|
|
@@ -3949,6 +3978,16 @@ const AppRouteWrapper = (props) => {
|
|
|
3949
3978
|
const [steps, setSteps] = useState(formSteps[insuranceType]);
|
|
3950
3979
|
const [validationHooks, setValidationHooks] = useState(formValidationHooks[insuranceType]);
|
|
3951
3980
|
const [progressLength, setProgressLength] = useState('');
|
|
3981
|
+
const [showContent, setShowContent] = useState(false);
|
|
3982
|
+
useEffect(() => {
|
|
3983
|
+
const checkTime = () => {
|
|
3984
|
+
const currentHour = new Date().getUTCHours() - 5; // EST is UTC-5
|
|
3985
|
+
setShowContent(currentHour >= 9 && currentHour < 18);
|
|
3986
|
+
};
|
|
3987
|
+
checkTime(); // Initial check
|
|
3988
|
+
const interval = setInterval(checkTime, 60000); // Check every minute
|
|
3989
|
+
return () => clearInterval(interval); // Cleanup
|
|
3990
|
+
}, []); // Run effect only once on component mount
|
|
3952
3991
|
useEffect(() => {
|
|
3953
3992
|
let filteredSteps = formSteps[insuranceType];
|
|
3954
3993
|
let filteredHooks = formValidationHooks[insuranceType];
|
|
@@ -4019,7 +4058,23 @@ const AppRouteWrapper = (props) => {
|
|
|
4019
4058
|
}
|
|
4020
4059
|
}
|
|
4021
4060
|
}, [carPostal, homePostal, lifePostal, isReady]);
|
|
4022
|
-
|
|
4061
|
+
const isMobile = appDeviceType === DeviceTypes.Mobile;
|
|
4062
|
+
const [showStickyBanner, setShowStickyBanner] = useState(false);
|
|
4063
|
+
useEffect(() => {
|
|
4064
|
+
const handleScroll = () => {
|
|
4065
|
+
const postalCodeDataBox = document.getElementById('postalCodeData');
|
|
4066
|
+
if (postalCodeDataBox) {
|
|
4067
|
+
const postalCodeDataBoxRect = postalCodeDataBox.getBoundingClientRect();
|
|
4068
|
+
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
|
|
4069
|
+
setShowStickyBanner(isScrolledPast);
|
|
4070
|
+
}
|
|
4071
|
+
};
|
|
4072
|
+
window.addEventListener('scroll', handleScroll);
|
|
4073
|
+
return () => {
|
|
4074
|
+
window.removeEventListener('scroll', handleScroll);
|
|
4075
|
+
};
|
|
4076
|
+
}, []);
|
|
4077
|
+
return (jsx(Fragment, { children: isReady && (jsxs(Fragment, { children: [jsx(AppHeader, {}), jsx(AppModal, {}), insuranceType && (jsx(Fragment, { children: 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 === AppTypes.MyChoice && (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: [jsx("p", { style: { fontWeight: 700, fontSize: "22px" }, children: "Need Help? Give us a call at" }), jsx("a", { style: { marginTop: "5px" }, href: "tel:18884534644", children: "1-888-453-4644" })] })), insuranceType && appType === AppTypes.MyChoice && (jsx("div", { className: localIndex !== defaultLocalIndex ? 'step-progress-bar-partner' : 'step-progress-bar', children: jsx("span", { style: { width: progressLength } }) })), jsx("div", { className: `${insuranceType ? 'form-page-content' : ''} ${insuranceType && appType === AppTypes.MyChoice ? 'mychoice' : ''}`, children: insuranceType && appType === AppTypes.MyChoice && isDesktop && progressLength ? (jsx(Fragment, { children: jsxs("div", { className: "mychoice-content", children: [jsx(StepsBox, { className: "step-box", formSteps: steps, validationHooks: validationHooks, propertyIsCompleted: isCompleted }), children, jsx("div", { className: "empty-steps-container" })] }) })) : children }), isMychoice && !appLoaderState.isOpen && jsx(ProviderImageFooter, {})] })) }));
|
|
4023
4078
|
};
|
|
4024
4079
|
const NestedRoutes = () => {
|
|
4025
4080
|
const insuranceType = getInsuranceType();
|