@mychoice/mychoice-sdk-modules 2.1.33 → 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.
Files changed (30) hide show
  1. package/dist/cjs/index.js +7 -63
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/init/StoryAppWrapper/StoryAppWrapper.d.ts +1 -1
  4. package/dist/cjs/init/StoryAppWrapper/interfaces.d.ts +1 -1
  5. package/dist/cjs/insurances/car/pages/{three-point-five/BestOfferFirst.d.ts → quote/PageAllQuotes.d.ts} +1 -1
  6. package/dist/cjs/insurances/car/pages/quote/sections/blocks/BlockConfirmImages.d.ts +1 -0
  7. package/dist/cjs/insurances/car/pages/quote/sections/blocks/BlockQuoteStatistics.d.ts +2 -0
  8. package/dist/cjs/shared/navigations/interfaces.d.ts +0 -1
  9. package/dist/cjs/shared/sections/quotes/OfferSection/BestOfferSection.d.ts +3 -0
  10. package/dist/cjs/shared/sections/quotes/OfferSection/DummyOfferSection.d.ts +3 -0
  11. package/dist/esm/index.js +7 -63
  12. package/dist/esm/index.js.map +1 -1
  13. package/dist/esm/init/StoryAppWrapper/StoryAppWrapper.d.ts +1 -1
  14. package/dist/esm/init/StoryAppWrapper/interfaces.d.ts +1 -1
  15. package/dist/esm/insurances/car/pages/{three-point-five/BestOfferFirst.d.ts → quote/PageAllQuotes.d.ts} +1 -1
  16. package/dist/esm/insurances/car/pages/quote/sections/blocks/BlockConfirmImages.d.ts +1 -0
  17. package/dist/esm/insurances/car/pages/quote/sections/blocks/BlockQuoteStatistics.d.ts +2 -0
  18. package/dist/esm/shared/navigations/interfaces.d.ts +0 -1
  19. package/dist/esm/shared/sections/quotes/OfferSection/BestOfferSection.d.ts +3 -0
  20. package/dist/esm/shared/sections/quotes/OfferSection/DummyOfferSection.d.ts +3 -0
  21. package/dist/index.d.ts +0 -1
  22. package/package.json +2 -2
  23. package/dist/cjs/insurances/car/pages/three-point-five/index.d.ts +0 -1
  24. package/dist/cjs/insurances/car/pages/three-point-five/sections/OfferSectionCopy.d.ts +0 -3
  25. package/dist/cjs/insurances/car/pages/three-point-five/sections/OfferSectionDupe.d.ts +0 -3
  26. package/dist/cjs/insurances/car/pages/three-point-five/sections/index.d.ts +0 -1
  27. package/dist/esm/insurances/car/pages/three-point-five/index.d.ts +0 -1
  28. package/dist/esm/insurances/car/pages/three-point-five/sections/OfferSectionCopy.d.ts +0 -3
  29. package/dist/esm/insurances/car/pages/three-point-five/sections/OfferSectionDupe.d.ts +0 -3
  30. 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, 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
- };
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,16 +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 currentHour = new Date().getUTCHours() - 5; // EST is UTC-5
3269
- setShowContent(currentHour >= 9 && currentHour < 18);
3270
- };
3271
- checkTime(); // Initial check
3272
- const interval = setInterval(checkTime, 60000); // Check every minute
3273
- return () => clearInterval(interval); // Cleanup
3274
- }, []); // Run effect only once on component mount
3275
3263
  const { pathname } = reactRouterDom.useLocation();
3276
3264
  const currentPath = pathname.split('/');
3277
3265
  const activeStep = formSteps.find((step) => currentPath[currentPath.length - 1] === step.path?.substring(1));
@@ -3335,22 +3323,6 @@ const StepsBox = ({ formSteps, validationHooks, propertyIsCompleted, }) => {
3335
3323
  }
3336
3324
  }
3337
3325
  };
3338
- const [showQR, setShowQr] = React.useState(false);
3339
- const containerRef = React.useRef(null);
3340
- React.useEffect(() => {
3341
- const handleClickOutside = (event) => {
3342
- if (containerRef.current && !containerRef.current.contains(event.target)) {
3343
- setShowQr(false);
3344
- }
3345
- };
3346
- document.addEventListener('mousedown', handleClickOutside);
3347
- return () => {
3348
- document.removeEventListener('mousedown', handleClickOutside);
3349
- };
3350
- }, []);
3351
- const handleHelpButton = () => {
3352
- setShowQr(!showQR);
3353
- };
3354
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) => {
3355
3327
  let cls;
3356
3328
  switch (true) {
@@ -3367,11 +3339,9 @@ const StepsBox = ({ formSteps, validationHooks, propertyIsCompleted, }) => {
3367
3339
  return jsxRuntime.jsx(jsxRuntime.Fragment, {});
3368
3340
  }
3369
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
3370
- ? jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(mychoiceSdkComponents.MychoiceStep, { className: cls, item: item, index: index }, `${index}-${item?.title}`), jsxRuntime.jsx(mychoiceSdkComponents.ButtonBase, {})] })
3342
+ ? jsxRuntime.jsx(mychoiceSdkComponents.MychoiceStep, { className: cls, item: item, index: index }, `${index}-${item?.title}`)
3371
3343
  : jsxRuntime.jsx(mychoiceSdkComponents.Step, { className: cls, item: item, index: index }, `${index}-${item?.title}`) }, `${index}-${item?.title}`));
3372
- }) })) : 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) => {
3373
- e.currentTarget.style.opacity = '1';
3374
- }, 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"] })] })] }))] }));
3375
3345
  };
3376
3346
  StepsBox.defaultProps = {
3377
3347
  partnerId: '',
@@ -3456,7 +3426,7 @@ ButtonsBox.defaultProps = {
3456
3426
  activeIndex: 0,
3457
3427
  };
3458
3428
 
3459
- const NavigationTop = ({ title, postalCode, validationHooks, formSteps, clearForm, propertyIsCompleted, id, }) => {
3429
+ const NavigationTop = ({ title, postalCode, validationHooks, formSteps, clearForm, propertyIsCompleted, }) => {
3460
3430
  const { pathname } = reactRouterDom.useLocation();
3461
3431
  const { appConfigState: { appType, localIndex } } = mychoiceSdkStore.useStoreAppConfig();
3462
3432
  const isTheBig = appType === mychoiceSdkComponents.AppTypes.TheBig;
@@ -3484,8 +3454,8 @@ const NavigationTop = ({ title, postalCode, validationHooks, formSteps, clearFor
3484
3454
  return `rgba(${r}, ${g}, ${b}, ${alpha})`;
3485
3455
  }
3486
3456
  }
3487
- 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
3488
- ? (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 })] }) }));
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 })] }) }));
3489
3459
  };
3490
3460
  NavigationTop.defaultProps = {
3491
3461
  isMobile: false,
@@ -3988,16 +3958,6 @@ const AppRouteWrapper = (props) => {
3988
3958
  const [steps, setSteps] = React.useState(formSteps[insuranceType]);
3989
3959
  const [validationHooks, setValidationHooks] = React.useState(formValidationHooks[insuranceType]);
3990
3960
  const [progressLength, setProgressLength] = React.useState('');
3991
- const [showContent, setShowContent] = React.useState(false);
3992
- React.useEffect(() => {
3993
- const checkTime = () => {
3994
- const currentHour = new Date().getUTCHours() - 5; // EST is UTC-5
3995
- setShowContent(currentHour >= 9 && currentHour < 18);
3996
- };
3997
- checkTime(); // Initial check
3998
- const interval = setInterval(checkTime, 60000); // Check every minute
3999
- return () => clearInterval(interval); // Cleanup
4000
- }, []); // Run effect only once on component mount
4001
3961
  React.useEffect(() => {
4002
3962
  let filteredSteps = formSteps[insuranceType];
4003
3963
  let filteredHooks = formValidationHooks[insuranceType];
@@ -4068,23 +4028,7 @@ const AppRouteWrapper = (props) => {
4068
4028
  }
4069
4029
  }
4070
4030
  }, [carPostal, homePostal, lifePostal, isReady]);
4071
- const isMobile = appDeviceType === mychoiceSdkComponents.DeviceTypes.Mobile;
4072
- const [showStickyBanner, setShowStickyBanner] = React.useState(false);
4073
- React.useEffect(() => {
4074
- const handleScroll = () => {
4075
- const postalCodeDataBox = document.getElementById('postalCodeData');
4076
- if (postalCodeDataBox) {
4077
- const postalCodeDataBoxRect = postalCodeDataBox.getBoundingClientRect();
4078
- 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
4079
- setShowStickyBanner(isScrolledPast);
4080
- }
4081
- };
4082
- window.addEventListener('scroll', handleScroll);
4083
- return () => {
4084
- window.removeEventListener('scroll', handleScroll);
4085
- };
4086
- }, []);
4087
- 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("p", { style: { fontWeight: 700, fontSize: "22px" }, children: "Need Help? Give us a call at" }), jsxRuntime.jsx("a", { style: { marginTop: "5px" }, 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, {})] })) }));
4088
4032
  };
4089
4033
  const NestedRoutes = () => {
4090
4034
  const insuranceType = mychoiceSdkComponents.getInsuranceType();