@mychoice/mychoice-sdk-modules 2.1.32 → 2.1.34

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 CHANGED
@@ -167,9 +167,8 @@ const OfferSection = ({ offerCompany, brokerCompany, offerPrice, phoneNumber, is
167
167
  }
168
168
  postRequestQuoteOnliaUrl(true, redirectUrl);
169
169
  };
170
- console.log(offerCompany, "offer c");
171
170
  return (jsxRuntime.jsxs("div", { className: `offer-section ${mychoiceCls}`, children: [jsxRuntime.jsx(mychoiceSdkComponents.OfferHeader, { className: isTheBig ? 'thebig-bold' : '', companyName: offerCompany?.name, isBestOffer: isBestOffer }), jsxRuntime.jsx(mychoiceSdkComponents.OfferPrice, { className: isTheBig ? 'thebig' : '', companyLogo: offerCompany?.logo, price: offerPrice }), !isTheBig && offsiteUrl
172
- ? (jsxRuntime.jsxs("div", { className: "offer-phone", children: [jsxRuntime.jsx("h3", { children: "Click below to get this rate" }), jsxRuntime.jsx(mychoiceSdkComponents.ButtonBase, { className: `offer-phone-number ${mychoiceCls}`, label: "Buy Online", type: mychoiceSdkComponents.ButtonTypes.Button, category: mychoiceSdkComponents.CategoryTypes.Filled, color: mychoiceSdkComponents.ColorTypes.Primary, variant: mychoiceSdkComponents.ButtonVariantTypes.Rectangle, size: mychoiceSdkComponents.SizeTypes.Medium, onClick: handleCTAClick })] })) : (jsxRuntime.jsxs("div", { className: "offer-phone", children: [jsxRuntime.jsx("h3", { className: isTheBig ? 'thebig-bold' : '', children: "Call now to get this rate" }), jsxRuntime.jsx("a", { target: "_blank", rel: "noreferrer noopener", href: `tel:${phoneNumber?.number}`, children: jsxRuntime.jsx(mychoiceSdkComponents.ButtonBase, { className: `${isTheBig ? 'thebig-bold' : 'mychoice'} offer-phone-number`, label: phoneNumber?.title, type: mychoiceSdkComponents.ButtonTypes.Button, category: mychoiceSdkComponents.CategoryTypes.Filled, color: mychoiceSdkComponents.ColorTypes.Primary, variant: mychoiceSdkComponents.ButtonVariantTypes.Rectangle, size: mychoiceSdkComponents.SizeTypes.Medium }) })] })), jsxRuntime.jsxs("button", { className: "dropdown", onClick: handleDropdownClick, children: [jsxRuntime.jsx("span", { children: detailsIsOpen ? 'Less Info' : 'More Info' }), jsxRuntime.jsx(mychoiceSdkComponents.IconDropdownArrow, { color: "grey", className: detailsIsOpen ? 'rotated' : '' })] }), detailsIsOpen && (jsxRuntime.jsxs("div", { className: "offer-details", children: [jsxRuntime.jsx(mychoiceSdkComponents.OfferDetail, { className: isTheBig ? 'thebig-bold' : '', name: offerCompany?.name, logo: offerCompany?.logo, companyType: mychoiceSdkComponents.CompanyRoleTypes.Offering, description: offerCompany?.description }), jsxRuntime.jsx("hr", {}), (isTheBig || !offsiteUrl)
171
+ ? (jsxRuntime.jsxs("div", { className: "offer-phone", children: [jsxRuntime.jsx("h3", { children: "Click below to get this rate" }), jsxRuntime.jsx(mychoiceSdkComponents.ButtonBase, { className: `offer-phone-number ${mychoiceCls}`, label: "Buy Online", type: mychoiceSdkComponents.ButtonTypes.Button, category: mychoiceSdkComponents.CategoryTypes.Filled, color: mychoiceSdkComponents.ColorTypes.Primary, variant: mychoiceSdkComponents.ButtonVariantTypes.Rectangle, size: mychoiceSdkComponents.SizeTypes.Medium, onClick: handleCTAClick })] })) : (jsxRuntime.jsxs("div", { className: "offer-phone", children: [jsxRuntime.jsx("h3", { className: isTheBig ? 'thebig-bold' : '', children: "Call now to get this rate" }), jsxRuntime.jsx("a", { target: "_blank", rel: "noreferrer noopener", href: `tel:${phoneNumber?.number}`, children: jsxRuntime.jsx(mychoiceSdkComponents.ButtonBase, { className: `${isTheBig ? 'thebig-bold' : 'mychoice'} offer-phone-number`, label: phoneNumber?.title, type: mychoiceSdkComponents.ButtonTypes.Button, category: mychoiceSdkComponents.CategoryTypes.Filled, color: mychoiceSdkComponents.ColorTypes.Primary, variant: mychoiceSdkComponents.ButtonVariantTypes.Rectangle, size: mychoiceSdkComponents.SizeTypes.Medium }) })] })), jsxRuntime.jsxs("button", { className: "dropdown", onClick: handleDropdownClick, children: [jsxRuntime.jsx("span", { children: detailsIsOpen ? 'Less Info' : 'More Info' }), jsxRuntime.jsx(mychoiceSdkComponents.IconDropdownArrow, { color: "grey", className: detailsIsOpen ? 'rotated' : '' })] }), detailsIsOpen && (jsxRuntime.jsxs("div", { className: "offer-details", children: [jsxRuntime.jsx(mychoiceSdkComponents.OfferDetail, { className: isTheBig ? 'thebig-bold' : '', name: offerCompany?.name, companyType: mychoiceSdkComponents.CompanyRoleTypes.Offering, description: offerCompany?.description }), jsxRuntime.jsx("hr", {}), (isTheBig || !offsiteUrl)
173
172
  && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(mychoiceSdkComponents.OfferDetail, { className: isTheBig ? 'thebig-bold' : '', logo: brokerCompany?.logo, name: brokerCompany?.title, companyType: mychoiceSdkComponents.CompanyRoleTypes.Broker, description: brokerCompany?.description }), jsxRuntime.jsx("hr", {})] })), jsxRuntime.jsx(mychoiceSdkComponents.OfferDetail, { className: isTheBig ? 'thebig-bold' : '', name: "Hours of Operation", children: jsxRuntime.jsx(mychoiceSdkComponents.OperationHoursInfo, { weekdayHours: weekdayHours, saturdayHours: saturdayHours, sundayHours: sundayHours }) })] }))] }));
174
173
  };
175
174
  OfferSection.defaultProps = {
@@ -3247,7 +3246,9 @@ const ModalQuoteRequest = ({ title, description, phoneNumber, }) => (jsxRuntime.
3247
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
3248
3247
  && (jsxRuntime.jsx("a", { target: "_blank", rel: "noreferrer noopener", href: `tel:1${phoneNumber}`, className: "phoneNumber", children: "Call the Broker" }))] })] }));
3249
3248
 
3250
- 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] }))] }));
3249
+ const PostalCodeDataBox = ({ title, postalCode, className, id }) => {
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
+ };
3251
3252
  PostalCodeDataBox.defaultProps = {
3252
3253
  title: '',
3253
3254
  postalCode: '',
@@ -3261,6 +3262,21 @@ const StepsBox = ({ formSteps, validationHooks, propertyIsCompleted, }) => {
3261
3262
  // const { dispatchAppModalState } = useStoreAppModal();
3262
3263
  // const [steps, setSteps] = useState(formSteps);
3263
3264
  // 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
3264
3280
  const { pathname } = reactRouterDom.useLocation();
3265
3281
  const currentPath = pathname.split('/');
3266
3282
  const activeStep = formSteps.find((step) => currentPath[currentPath.length - 1] === step.path?.substring(1));
@@ -3324,6 +3340,22 @@ const StepsBox = ({ formSteps, validationHooks, propertyIsCompleted, }) => {
3324
3340
  }
3325
3341
  }
3326
3342
  };
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
+ };
3327
3359
  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) => {
3328
3360
  let cls;
3329
3361
  switch (true) {
@@ -3340,9 +3372,11 @@ const StepsBox = ({ formSteps, validationHooks, propertyIsCompleted, }) => {
3340
3372
  return jsxRuntime.jsx(jsxRuntime.Fragment, {});
3341
3373
  }
3342
3374
  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
3343
- ? jsxRuntime.jsx(mychoiceSdkComponents.MychoiceStep, { className: cls, item: item, index: index }, `${index}-${item?.title}`)
3375
+ ? jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(mychoiceSdkComponents.MychoiceStep, { className: cls, item: item, index: index }, `${index}-${item?.title}`), jsxRuntime.jsx(mychoiceSdkComponents.ButtonBase, {})] })
3344
3376
  : jsxRuntime.jsx(mychoiceSdkComponents.Step, { className: cls, item: item, index: index }, `${index}-${item?.title}`) }, `${index}-${item?.title}`));
3345
- }) })) : 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"] })] })] }))] }));
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"] })] }), showContent && appType === mychoiceSdkComponents.AppTypes.MyChoice && (jsxRuntime.jsxs("div", { style: { gap: "1em", display: "flex", flexDirection: "column", marginTop: "1em", alignItems: "center", justifyContent: "center", marginLeft: "2em" }, children: [jsxRuntime.jsx("p", { style: { fontWeight: "600" }, children: "Need help? Call us at" }), jsxRuntime.jsxs("div", { ref: containerRef, style: { position: "relative", width: '180px' }, children: [jsxRuntime.jsx(mychoiceSdkComponents.ButtonBase, { size: mychoiceSdkComponents.SizeTypes.Medium, className: "button-with-text button-circle-medium", category: mychoiceSdkComponents.CategoryTypes.Filled, color: mychoiceSdkComponents.ColorTypes.Secondary, variant: mychoiceSdkComponents.ButtonVariantTypes.Circle, onClick: handleHelpButton, children: jsxRuntime.jsx("span", { style: { padding: "0 1rem", fontWeight: "700" }, children: "1-888-453-4644" }) }), showQR && (jsxRuntime.jsx("img", { style: { position: 'absolute', top: '355%', left: '50%', transform: 'translate(-50%, -50%)', opacity: 0, transition: 'opacity 500ms ease-in-out' }, onLoad: (e) => {
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" }))] })] }))] }))] }));
3346
3380
  };
3347
3381
  StepsBox.defaultProps = {
3348
3382
  partnerId: '',
@@ -3427,7 +3461,7 @@ ButtonsBox.defaultProps = {
3427
3461
  activeIndex: 0,
3428
3462
  };
3429
3463
 
3430
- const NavigationTop = ({ title, postalCode, validationHooks, formSteps, clearForm, propertyIsCompleted, }) => {
3464
+ const NavigationTop = ({ title, postalCode, validationHooks, formSteps, clearForm, propertyIsCompleted, id, }) => {
3431
3465
  const { pathname } = reactRouterDom.useLocation();
3432
3466
  const { appConfigState: { appType, localIndex } } = mychoiceSdkStore.useStoreAppConfig();
3433
3467
  const isTheBig = appType === mychoiceSdkComponents.AppTypes.TheBig;
@@ -3455,8 +3489,8 @@ const NavigationTop = ({ title, postalCode, validationHooks, formSteps, clearFor
3455
3489
  return `rgba(${r}, ${g}, ${b}, ${alpha})`;
3456
3490
  }
3457
3491
  }
3458
- 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
3459
- ? (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 })] }) }));
3492
+ return (jsxRuntime.jsx("div", { id: id, 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
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(jsxRuntime.Fragment, { children: 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 })] }) }));
3460
3494
  };
3461
3495
  NavigationTop.defaultProps = {
3462
3496
  isMobile: false,
@@ -3959,6 +3993,21 @@ const AppRouteWrapper = (props) => {
3959
3993
  const [steps, setSteps] = React.useState(formSteps[insuranceType]);
3960
3994
  const [validationHooks, setValidationHooks] = React.useState(formValidationHooks[insuranceType]);
3961
3995
  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
3962
4011
  React.useEffect(() => {
3963
4012
  let filteredSteps = formSteps[insuranceType];
3964
4013
  let filteredHooks = formValidationHooks[insuranceType];
@@ -4029,7 +4078,23 @@ const AppRouteWrapper = (props) => {
4029
4078
  }
4030
4079
  }
4031
4080
  }, [carPostal, homePostal, lifePostal, isReady]);
4032
- 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, {})] })) }));
4081
+ const isMobile = appDeviceType === mychoiceSdkComponents.DeviceTypes.Mobile;
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, {})] })) }));
4033
4098
  };
4034
4099
  const NestedRoutes = () => {
4035
4100
  const insuranceType = mychoiceSdkComponents.getInsuranceType();