@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/esm/index.js CHANGED
@@ -158,7 +158,7 @@ const OfferSection = ({ offerCompany, brokerCompany, offerPrice, phoneNumber, is
158
158
  postRequestQuoteOnliaUrl(true, redirectUrl);
159
159
  };
160
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
161
- ? (jsxs("div", { className: "offer-phone", children: [jsx("h3", { children: "Click below to get this rate" }), jsx(ButtonBase, { className: `offer-phone-number ${mychoiceCls}`, label: "Get details", 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)
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)
162
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 }) })] }))] }));
163
163
  };
164
164
  OfferSection.defaultProps = {
@@ -249,10 +249,11 @@ const LoaderPrimary = () => {
249
249
  const { appLoaderState } = useStoreAppLoader();
250
250
  const { appConfigState } = useStoreAppConfig();
251
251
  const isLastPage = window.location.pathname.includes('discount') || window.location.pathname.includes('/life/applicant');
252
- return (jsxs("div", { className: "loader-wrapper", children: [appConfigState.appType === AppTypes.TheBig || !isLastPage ? jsx(IconLoaderPrimary, {}) : jsx(LoaderVid, {}), !!appLoaderState.description && appLoaderState.description.includes('accurate')
252
+ const isHome = window.location.pathname.includes('home') || window.location.pathname.includes('condo') || window.location.pathname.includes('tenant');
253
+ return (jsxs("div", { className: "loader-wrapper", children: [appConfigState.appType === AppTypes.TheBig || !isLastPage ? jsx(IconLoaderPrimary, {}) : jsx(LoaderVid, {}), appLoaderState.description
253
254
  ? (jsx("h4", { children: appLoaderState.description.split('\n').map((line, index) => (jsxs("div", { children: [line, jsx("br", {})] }, index))) }))
254
255
  // eslint-disable-next-line react/no-unescaped-entities
255
- : !appLoaderState.description && jsx("h4", { children: "'Hang tight, while we collect and process information about your property'" })] }));
256
+ : !appLoaderState.description && isHome && jsx("h4", { children: "Hang tight, while we collect and process information about your property." })] }));
256
257
  };
257
258
 
258
259
  const ModalConfirm = () => {
@@ -309,9 +310,10 @@ const ModalPostal = () => {
309
310
 
310
311
  const getVehicleYearRange = () => {
311
312
  const vehicleYear = [];
312
- const currentYear = 2024;
313
+ const currentDate = new Date();
314
+ const currentYear = currentDate.getFullYear();
313
315
  const minYear = currentYear - 25;
314
- for (let year = (currentYear); year > minYear; year -= 1) {
316
+ for (let year = (currentDate.getFullYear()); year > minYear; year -= 1) {
315
317
  vehicleYear.push({ name: `${year}`, value: `${year}` });
316
318
  }
317
319
  vehicleYear.push({ name: `${minYear} or older`, value: `${minYear}` });
@@ -416,14 +418,20 @@ const BlockCarInfo = () => {
416
418
  const { status: statusModel, getVehicleModel, vehicleModelList = [] } = useHandlerCarModel();
417
419
  const { vehicleState, dispatchVehicleState } = useStoreFormCarVehicle();
418
420
  const { year: currentYear, make: currentMake, model: currentModel, } = vehicleState.items[vehicleState.activeIndex];
419
- const yearIsValid = !currentYear || Number(currentYear) > 1998;
421
+ const yearIsValid = !currentYear || Number(currentYear) > 1999;
420
422
  const yearMessage = (jsxs(Fragment, { children: ["Please contact a licenced representative at Hagerty for classic car insurance:", ' ', jsx("a", { href: "tel:18335431540", children: "1-833-543-1540" })] }));
421
423
  const handleVehicleYearChange = ({ value }) => {
424
+ console.log(value);
422
425
  if (value) {
426
+ console.log(dispatchVehicleState({
427
+ type: StoreFormCarVehicleActionTypes.FormCarVehicleYearSet,
428
+ payload: { year: value },
429
+ }), 'hm');
423
430
  dispatchVehicleState({
424
431
  type: StoreFormCarVehicleActionTypes.FormCarVehicleYearSet,
425
432
  payload: { year: value },
426
433
  });
434
+ console.log(value, 'hmHm');
427
435
  getVehicleMake(value);
428
436
  }
429
437
  };
@@ -3414,7 +3422,7 @@ ButtonsBox.defaultProps = {
3414
3422
 
3415
3423
  const NavigationTop = ({ title, postalCode, validationHooks, formSteps, clearForm, propertyIsCompleted, }) => {
3416
3424
  const { pathname } = useLocation();
3417
- const { appConfigState: { appType } } = useStoreAppConfig();
3425
+ const { appConfigState: { appType, localIndex } } = useStoreAppConfig();
3418
3426
  const isTheBig = appType === AppTypes.TheBig;
3419
3427
  const { appDeviceType } = useStoreDeviceType();
3420
3428
  const isDesktop = appDeviceType === DeviceTypes.Desktop;
@@ -3423,7 +3431,24 @@ const NavigationTop = ({ title, postalCode, validationHooks, formSteps, clearFor
3423
3431
  const activeStep = formSteps.find((step) => currentPath[currentPath.length - 1] === step.path?.substring(1));
3424
3432
  let activeIndex = formSteps.indexOf(activeStep);
3425
3433
  activeIndex = activeIndex === -1 ? 0 : activeIndex;
3426
- return (jsx("div", { className: "navigation-container", children: jsxs("div", { className: `content ${appType === AppTypes.MyChoice ? 'mychoice' : ''}`, children: [jsx(PostalCodeDataBox, { className: isTheBig ? 'thebig' : '', title: title, postalCode: postalCode }), appType === AppTypes.MyChoice
3434
+ if (localIndex !== defaultLocalIndex) {
3435
+ const primaryColor = getComputedStyle(document.documentElement).getPropertyValue('--color-primary').trim();
3436
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
3437
+ const rgbaColor = hexToRgba(primaryColor, 0.5);
3438
+ document.documentElement.style.setProperty('--color-primary-with-opacity', rgbaColor);
3439
+ // eslint-disable-next-line no-inner-declarations
3440
+ function hexToRgba(hex, alpha) {
3441
+ const bigint = parseInt(hex.slice(1), 16);
3442
+ // eslint-disable-next-line no-bitwise
3443
+ const r = (bigint >> 16) & 255;
3444
+ // eslint-disable-next-line no-bitwise
3445
+ const g = (bigint >> 8) & 255;
3446
+ // eslint-disable-next-line no-bitwise
3447
+ const b = bigint & 255;
3448
+ return `rgba(${r}, ${g}, ${b}, ${alpha})`;
3449
+ }
3450
+ }
3451
+ 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
3427
3452
  ? (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 })] }) }));
3428
3453
  };
3429
3454
  NavigationTop.defaultProps = {
@@ -3997,7 +4022,7 @@ const AppRouteWrapper = (props) => {
3997
4022
  }
3998
4023
  }
3999
4024
  }, [carPostal, homePostal, lifePostal, isReady]);
4000
- return (jsx(Fragment, { children: isReady && (jsxs(Fragment, { children: [jsx(AppHeader, {}), jsx(AppModal, {}), insuranceType && (jsx(NavigationTop, { title: `${insuranceType.replace(/^./, insuranceType[0].toUpperCase())} Insurance Quote`, postalCode: postalCode, formSteps: steps, validationHooks: validationHooks, clearForm: clearFormData, propertyIsCompleted: isCompleted })), insuranceType && appType === AppTypes.MyChoice && (jsx("div", { className: "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, {})] })) }));
4025
+ return (jsx(Fragment, { children: isReady && (jsxs(Fragment, { children: [jsx(AppHeader, {}), jsx(AppModal, {}), insuranceType && (jsx(NavigationTop, { title: `${insuranceType.replace(/^./, insuranceType[0].toUpperCase())} Insurance Quote`, postalCode: postalCode, formSteps: steps, validationHooks: validationHooks, clearForm: clearFormData, propertyIsCompleted: isCompleted })), 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, {})] })) }));
4001
4026
  };
4002
4027
  const NestedRoutes = () => {
4003
4028
  const insuranceType = getInsuranceType();
@@ -4013,6 +4038,7 @@ const NestedRoutes = () => {
4013
4038
  };
4014
4039
  const RedirectWithSearchParams = ({ to, path }) => {
4015
4040
  const insuranceType = getInsuranceType();
4041
+ useStoreAppConfig();
4016
4042
  const [isRender, setIsRender] = useState(false);
4017
4043
  const { getPostal } = useHandlerPostal(insuranceType);
4018
4044
  const { dispatchDiscountState: dispatchCarDiscountState } = useStoreFormCarDiscount();
@@ -4023,6 +4049,7 @@ const RedirectWithSearchParams = ({ to, path }) => {
4023
4049
  useEffectOnce(() => {
4024
4050
  if (queryRoot.length > 1) {
4025
4051
  const query = JSON.parse(`{"${decodeURI(queryRoot[1]).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"')}"}`);
4052
+ console.log(query, 'hm');
4026
4053
  if (!isRender) {
4027
4054
  if (query.postal_code && (insuranceType !== InsuranceTypes.Life)) {
4028
4055
  const formattedPostalCode = query.postal_code.replace(' ', '');