@mychoice/mychoice-sdk-modules 2.1.23 → 2.1.25

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
@@ -168,7 +168,7 @@ const OfferSection = ({ offerCompany, brokerCompany, offerPrice, phoneNumber, is
168
168
  postRequestQuoteOnliaUrl(true, redirectUrl);
169
169
  };
170
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
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: "Get details", 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)
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)
172
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 }) })] }))] }));
173
173
  };
174
174
  OfferSection.defaultProps = {
@@ -259,10 +259,11 @@ const LoaderPrimary = () => {
259
259
  const { appLoaderState } = mychoiceSdkStore.useStoreAppLoader();
260
260
  const { appConfigState } = mychoiceSdkStore.useStoreAppConfig();
261
261
  const isLastPage = window.location.pathname.includes('discount') || window.location.pathname.includes('/life/applicant');
262
- return (jsxRuntime.jsxs("div", { className: "loader-wrapper", children: [appConfigState.appType === mychoiceSdkComponents.AppTypes.TheBig || !isLastPage ? jsxRuntime.jsx(mychoiceSdkComponents.IconLoaderPrimary, {}) : jsxRuntime.jsx(LoaderVid, {}), !!appLoaderState.description && appLoaderState.description.includes('accurate')
262
+ const isHome = window.location.pathname.includes('home') || window.location.pathname.includes('condo') || window.location.pathname.includes('tenant');
263
+ return (jsxRuntime.jsxs("div", { className: "loader-wrapper", children: [appConfigState.appType === mychoiceSdkComponents.AppTypes.TheBig || !isLastPage ? jsxRuntime.jsx(mychoiceSdkComponents.IconLoaderPrimary, {}) : jsxRuntime.jsx(LoaderVid, {}), appLoaderState.description
263
264
  ? (jsxRuntime.jsx("h4", { children: appLoaderState.description.split('\n').map((line, index) => (jsxRuntime.jsxs("div", { children: [line, jsxRuntime.jsx("br", {})] }, index))) }))
264
265
  // eslint-disable-next-line react/no-unescaped-entities
265
- : !appLoaderState.description && jsxRuntime.jsx("h4", { children: "'Hang tight, while we collect and process information about your property'" })] }));
266
+ : !appLoaderState.description && isHome && jsxRuntime.jsx("h4", { children: "Hang tight, while we collect and process information about your property." })] }));
266
267
  };
267
268
 
268
269
  const ModalConfirm = () => {
@@ -319,9 +320,10 @@ const ModalPostal = () => {
319
320
 
320
321
  const getVehicleYearRange = () => {
321
322
  const vehicleYear = [];
322
- const currentYear = 2024;
323
+ const currentDate = new Date();
324
+ const currentYear = currentDate.getFullYear();
323
325
  const minYear = currentYear - 25;
324
- for (let year = (currentYear); year > minYear; year -= 1) {
326
+ for (let year = (currentDate.getFullYear()); year > minYear; year -= 1) {
325
327
  vehicleYear.push({ name: `${year}`, value: `${year}` });
326
328
  }
327
329
  vehicleYear.push({ name: `${minYear} or older`, value: `${minYear}` });
@@ -426,14 +428,20 @@ const BlockCarInfo = () => {
426
428
  const { status: statusModel, getVehicleModel, vehicleModelList = [] } = mychoiceSdkStore.useHandlerCarModel();
427
429
  const { vehicleState, dispatchVehicleState } = mychoiceSdkStore.useStoreFormCarVehicle();
428
430
  const { year: currentYear, make: currentMake, model: currentModel, } = vehicleState.items[vehicleState.activeIndex];
429
- const yearIsValid = !currentYear || Number(currentYear) > 1998;
431
+ const yearIsValid = !currentYear || Number(currentYear) > 1999;
430
432
  const yearMessage = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: ["Please contact a licenced representative at Hagerty for classic car insurance:", ' ', jsxRuntime.jsx("a", { href: "tel:18335431540", children: "1-833-543-1540" })] }));
431
433
  const handleVehicleYearChange = ({ value }) => {
434
+ console.log(value);
432
435
  if (value) {
436
+ console.log(dispatchVehicleState({
437
+ type: mychoiceSdkStore.StoreFormCarVehicleActionTypes.FormCarVehicleYearSet,
438
+ payload: { year: value },
439
+ }), 'hm');
433
440
  dispatchVehicleState({
434
441
  type: mychoiceSdkStore.StoreFormCarVehicleActionTypes.FormCarVehicleYearSet,
435
442
  payload: { year: value },
436
443
  });
444
+ console.log(value, 'hmHm');
437
445
  getVehicleMake(value);
438
446
  }
439
447
  };
@@ -3424,7 +3432,7 @@ ButtonsBox.defaultProps = {
3424
3432
 
3425
3433
  const NavigationTop = ({ title, postalCode, validationHooks, formSteps, clearForm, propertyIsCompleted, }) => {
3426
3434
  const { pathname } = reactRouterDom.useLocation();
3427
- const { appConfigState: { appType } } = mychoiceSdkStore.useStoreAppConfig();
3435
+ const { appConfigState: { appType, localIndex } } = mychoiceSdkStore.useStoreAppConfig();
3428
3436
  const isTheBig = appType === mychoiceSdkComponents.AppTypes.TheBig;
3429
3437
  const { appDeviceType } = mychoiceSdkStore.useStoreDeviceType();
3430
3438
  const isDesktop = appDeviceType === mychoiceSdkComponents.DeviceTypes.Desktop;
@@ -3433,7 +3441,24 @@ const NavigationTop = ({ title, postalCode, validationHooks, formSteps, clearFor
3433
3441
  const activeStep = formSteps.find((step) => currentPath[currentPath.length - 1] === step.path?.substring(1));
3434
3442
  let activeIndex = formSteps.indexOf(activeStep);
3435
3443
  activeIndex = activeIndex === -1 ? 0 : activeIndex;
3436
- return (jsxRuntime.jsx("div", { className: "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
3444
+ if (localIndex !== mychoiceSdkComponents.defaultLocalIndex) {
3445
+ const primaryColor = getComputedStyle(document.documentElement).getPropertyValue('--color-primary').trim();
3446
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
3447
+ const rgbaColor = hexToRgba(primaryColor, 0.5);
3448
+ document.documentElement.style.setProperty('--color-primary-with-opacity', rgbaColor);
3449
+ // eslint-disable-next-line no-inner-declarations
3450
+ function hexToRgba(hex, alpha) {
3451
+ const bigint = parseInt(hex.slice(1), 16);
3452
+ // eslint-disable-next-line no-bitwise
3453
+ const r = (bigint >> 16) & 255;
3454
+ // eslint-disable-next-line no-bitwise
3455
+ const g = (bigint >> 8) & 255;
3456
+ // eslint-disable-next-line no-bitwise
3457
+ const b = bigint & 255;
3458
+ return `rgba(${r}, ${g}, ${b}, ${alpha})`;
3459
+ }
3460
+ }
3461
+ 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
3437
3462
  ? (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 })] }) }));
3438
3463
  };
3439
3464
  NavigationTop.defaultProps = {
@@ -4007,7 +4032,7 @@ const AppRouteWrapper = (props) => {
4007
4032
  }
4008
4033
  }
4009
4034
  }, [carPostal, homePostal, lifePostal, isReady]);
4010
- 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: "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, {})] })) }));
4035
+ 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, {})] })) }));
4011
4036
  };
4012
4037
  const NestedRoutes = () => {
4013
4038
  const insuranceType = mychoiceSdkComponents.getInsuranceType();
@@ -4023,6 +4048,7 @@ const NestedRoutes = () => {
4023
4048
  };
4024
4049
  const RedirectWithSearchParams = ({ to, path }) => {
4025
4050
  const insuranceType = mychoiceSdkComponents.getInsuranceType();
4051
+ mychoiceSdkStore.useStoreAppConfig();
4026
4052
  const [isRender, setIsRender] = React.useState(false);
4027
4053
  const { getPostal } = mychoiceSdkStore.useHandlerPostal(insuranceType);
4028
4054
  const { dispatchDiscountState: dispatchCarDiscountState } = mychoiceSdkStore.useStoreFormCarDiscount();
@@ -4033,6 +4059,7 @@ const RedirectWithSearchParams = ({ to, path }) => {
4033
4059
  mychoiceSdkComponents.useEffectOnce(() => {
4034
4060
  if (queryRoot.length > 1) {
4035
4061
  const query = JSON.parse(`{"${decodeURI(queryRoot[1]).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"')}"}`);
4062
+ console.log(query, 'hm');
4036
4063
  if (!isRender) {
4037
4064
  if (query.postal_code && (insuranceType !== mychoiceSdkComponents.InsuranceTypes.Life)) {
4038
4065
  const formattedPostalCode = query.postal_code.replace(' ', '');