@mychoice/mychoice-sdk-modules 2.1.43 → 2.1.45

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
@@ -1,9 +1,9 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { ErrorBoundary } from 'react-error-boundary';
3
- import { AppTypes, TitleForm, TooltipForm, IconDelete, ColorVariablesTypes, InputTypes, InputForm, InputFormPhone, InputFormEmail, InputFormLicence, SelectForm, getFormattedDate, DateTypes, getDateOptions, ButtonForm, OfferHeader, OfferPrice, ButtonBase, ButtonTypes, CategoryTypes, ColorTypes, ButtonVariantTypes, SizeTypes, IconDropdownArrow, OfferDetail, CompanyRoleTypes, OperationHoursInfo, InsuranceTypes, HeaderNavGroup, ButtonMenu, DeviceTypes, IconLoaderPrimary, getInsuranceType, RequestStatusTypes, formatPostalCode, IconLoaderSecondary, postalCodeFormat, defaultBrokerPhone, useEffectOnce, carCondition, carStatus, carWinterTiresCheck, carKeepPlace, carUsagePurpose, firstDriveDistanceList, dailyDriveBusinessDistanceList, yearlyDriveDistanceList, numberWithCommas, VehiclePrimaryUseTypes, comprehensiveCoverage, collisionCoverage, defaultLocalIndex, maritalStatusOptions, subYearsFromDate, occupationOptions, genderOptions, applicantRelationshipOptions, addYearsToDate, checkDateIsSpecial, DriverLicenceTypes, getDifferenceInYears, getLicenceTypeOptions, getDisabledLicenceTypes, yesNoOptions, addDaysToDate, getMinDate, CheckboxForm, getMinDateByYears, compareDates, insuranceCancellationReasonOptions, DriverListTypes, licenceSuspensionsReasonOptions, trafficTicketsGroupOptions, DriverPriorityTypes, ValidationStatusTypes, QuoteEdit, coverageOptions, liabilityOptions, homeOwnerTypeOptions, tenantBuildingStructureOptions, condoBuildingStructureOptions, homeBuildingStructureOptions, residentsOptions, insuredYearsOptions, getInsuranceYearsOptions, ApplicantListTypes, claimTypeOptions, exteriorFinishOptions, constructionTypeOptions, garageTypeOptions, getNumericOptions, fireHallDistanceOptions, fireHydrantDistanceOptions, primaryHeatingTypeOptions, auxHeatingTypeOptions, InfoMessage, ppOptions, homeCoverageOptions, homeLiabilityOptions, lifeInsuranceTypeOptions, lifeProvinceOptionsMC, lifeProvinceOptions, lifeCoverageOptions, smokerOptions, MychoiceStep, Step, IconClock, ButtonArrow, DirectionTypes, ButtonTabArrow, ButtonTab, ButtonTabMobile, NavigationCar, NavigationPerson, NavigationDiscount, NavigationQuotes, NavigationAddress, NavigationProperty, ModalTypes } from '@mychoice/mychoice-sdk-components';
3
+ import { AppTypes, TitleForm, TooltipForm, IconDelete, ColorVariablesTypes, InputTypes, InputForm, InputFormPhone, InputFormEmail, InputFormLicence, SelectForm, getFormattedDate, DateTypes, getDateOptions, ButtonForm, OfferHeader, OfferPrice, ButtonBase, ButtonTypes, CategoryTypes, ColorTypes, ButtonVariantTypes, SizeTypes, IconDropdownArrow, OfferDetail, CompanyRoleTypes, OperationHoursInfo, InsuranceTypes, HeaderNavGroup, ButtonMenu, DeviceTypes, IconLoaderPrimary, getInsuranceType, RequestStatusTypes, formatPostalCode, IconLoaderSecondary, postalCodeFormat, defaultBrokerPhone, useEffectOnce, carCondition, carStatus, carWinterTiresCheck, carKeepPlace, carUsagePurpose, firstDriveDistanceList, dailyDriveBusinessDistanceList, yearlyDriveDistanceList, numberWithCommas, VehiclePrimaryUseTypes, comprehensiveCoverage, collisionCoverage, defaultLocalIndex, maritalStatusOptions, subYearsFromDate, occupationOptions, genderOptions, applicantRelationshipOptions, addYearsToDate, checkDateIsSpecial, DriverLicenceTypes, getDifferenceInYears, getLicenceTypeOptions, getDisabledLicenceTypes, yesNoOptions, addDaysToDate, getMinDate, CheckboxForm, getMinDateByYears, compareDates, insuranceCancellationReasonOptions, DriverListTypes, licenceSuspensionsReasonOptions, trafficTicketsGroupOptions, DriverPriorityTypes, ValidationStatusTypes, QuoteEdit, coverageOptions, liabilityOptions, homeOwnerTypeOptions, tenantBuildingStructureOptions, condoBuildingStructureOptions, homeBuildingStructureOptions, residentsOptions, insuredYearsOptions, getInsuranceYearsOptions, ApplicantListTypes, claimTypeOptions, exteriorFinishOptions, constructionTypeOptions, garageTypeOptions, getNumericOptions, fireHallDistanceOptions, fireHydrantDistanceOptions, primaryHeatingTypeOptions, auxHeatingTypeOptions, InfoMessage, ppOptions, homeCoverageOptions, homeLiabilityOptions, lifeInsuranceOntarioTypeOptions, lifeInsuranceTypeOptions, lifeProvinceOptionsMC, lifeProvinceOptions, lifeCoverageOptions, smokerOptions, MychoiceStep, Step, IconClock, ButtonArrow, DirectionTypes, ButtonTabArrow, ButtonTab, ButtonTabMobile, NavigationCar, NavigationPerson, NavigationDiscount, NavigationQuotes, NavigationAddress, NavigationProperty, ModalTypes } from '@mychoice/mychoice-sdk-components';
4
4
  import { useStoreAppConfig, CarQuoteDataHandler, useStorePartner, useStoreDeviceType, useStoreAppLoader, useStoreAppModal, StoreConfigAppModalActionTypes, useHandlerPostal, useHandlerCarMake, useHandlerCarModel, useStoreFormCarVehicle, StoreFormCarVehicleActionTypes, useProvince, useStoreFormCarDiscount, StoreFormCarDiscountActionTypes, useValidationVehicle, useStoreFormCarDriverBase, StoreFormCarDriverBaseActionTypes, useStoreFormCarConfig, useStoreFormCarDriverInfo, StoreFormCarDriverInfoActionTypes, useStoreFormCarDriverLicence, addDayToDate, StoreFormCarDriverLicenceActionTypes, useStoreFormCarDriverInsurance, useStoreFormCarQuote, StoreFormCarDriverInsuranceActionTypes, useStoreFormCarDriverCancellation, StoreFormCarDriverCancellationActionTypes, useStoreFormCarDriverSuspension, StoreFormCarDriverSuspensionActionTypes, useStoreFormCarDriverAccident, StoreFormCarDriverAccidentActionTypes, useStoreFormCarDriverTicket, StoreFormCarDriverTicketActionTypes, useValidationDriver, useValidationCarDiscount, useHandlerCarQuoterEmail, useStoreFormHomeDwelling, useStoreFormHomePostal, useStoreFormHomeApplicantBase, StoreFormHomePostalActionTypes, StoreFormHomeDwellingActionTypes, StoreConfigAppConfigActionTypes, StoreFormHomeApplicantBaseActionTypes, useValidationAddress, useStoreFormHomeApplicantInfo, useStoreFormHomeDiscount, StoreFormHomeDiscountActionTypes, StoreFormHomeApplicantInfoActionTypes, useStoreFormHomeApplicantInsurance, StoreFormHomeApplicantInsuranceActionTypes, useStoreFormHomeApplicantCancellation, StoreFormHomeApplicantCancellationActionTypes, useStoreFormHomeApplicantClaim, StoreFormHomeApplicantClaimActionTypes, useValidationApplicant, useValidationDwelling, useStoreFormHomeQuote, HomeQuoteDataHandler, useValidationHomeDiscount, useHandlerHomeQuoterEmail, useStoreFormLifeCoverage, StoreFormLifeCoverageActionTypes, useValidationCoverage, useStoreFormLifeQuote, useStoreFormLifeApplicant, LifeQuoteDataHandler, useValidationLifeApplicant, useHandlerLifeQuoterEmail, StoreFormLifeApplicantActionTypes, useStoreFormCarPostal, useStoreFormLifePostal, ClearFormDataHandler, useStoreAppDevice, useStoreClient, useHandlerAuth, useHandlerPartner, StoreConfigAppLoaderActionTypes, StoreFormCarConfigActionTypes, StoreFormCarPostalActionTypes, StoreFormCarQuoteActionTypes, StoreFormHomeQuoteActionTypes, StoreFormLifePostalActionTypes, StoreFormLifeQuoteActionTypes, StoreClientActionTypes, StoreConfigAppDeviceActionTypes, StoreProvider, initHttpResponse } from '@mychoice/mychoice-sdk-store';
5
5
  import { useNavigate, useLocation, BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
6
- import React, { useState, useCallback, useEffect, useRef } from 'react';
6
+ import React, { useState, useCallback, useEffect, useRef, useMemo } from 'react';
7
7
  import { random } from 'lodash';
8
8
  import GooglePlacesAutocomplete, { geocodeByPlaceId } from 'react-google-places-autocomplete';
9
9
  import { components } from 'react-select';
@@ -241,8 +241,7 @@ HeaderMyChoiceMobile.defaultProps = {
241
241
  const LoaderVid = () => {
242
242
  const { appDeviceType } = useStoreDeviceType();
243
243
  const isMobile = appDeviceType === DeviceTypes.Mobile;
244
- return (jsx(Fragment, { children: isMobile ? jsx("video", { src: "https://mychoice.ca/wp-content/uploads/2023/05/Pig-Video.mp4", autoPlay: true, loop: true, muted: true, preload: "auto", style: { maxHeight: '300px' } })
245
- : jsx("video", { src: "https://mychoice.ca/wp-content/uploads/2023/05/Pig-Video.mp4", autoPlay: true, loop: true, muted: true, preload: "auto", style: { maxHeight: '400px' } }) }));
244
+ return (jsx(Fragment, { children: isMobile ? (jsx("video", { src: "https://mychoice.ca/wp-content/uploads/2023/05/Pig-Video.mp4", playsInline: true, autoPlay: true, loop: true, muted: true, preload: "auto", style: { maxHeight: '300px' } })) : (jsx("video", { src: "https://mychoice.ca/wp-content/uploads/2023/05/Pig-Video.mp4", playsInline: true, autoPlay: true, loop: true, muted: true, preload: "auto", style: { maxHeight: '400px' } })) }));
246
245
  };
247
246
 
248
247
  const LoaderPrimary = () => {
@@ -2928,10 +2927,11 @@ const PageHomeQuote = () => {
2928
2927
  }, phoneNumber: formatPhoneObject(brokerProfile.phone), redirectUrl: brokerProfile.redirectUrl || '', fulfillmentUrl: fulfillmentUrl })) }, index))) }))] })) }));
2929
2928
  };
2930
2929
 
2931
- const Description = () => (jsxs("div", { children: [jsx("span", { children: jsx("p", { children: "There are two primary categories of life insurance policies: term life insurance and permanent life insurance." }) }), jsx("h4", { children: "Term Life Insurance Options" }), jsx("h5", { children: "Options include 10, 15, 20, 30-year plans" }), jsx("p", { children: "These policies provide coverage for a specific term of either 10, 15, 20, or 30 years. The premiums are consistent throughout the term. At the end of the term, policyholders have the choice to renew or convert their policy." }), jsx("h5", { children: "Coverage Until Ages 65, 70, 75" }), jsx("p", { children: "These are term life policies that extend coverage until the policyholder reaches the age of 65, 70, or 75. Premiums are consistent for the entirety of the policy's duration. However, renewal options are not available after reaching the specified age." }), jsx("h5", { children: "Coverage Until Age 100" }), jsx("p", { children: "Although it's sometimes categorized as a permanent life insurance plan, the Term to 100 plan is, in fact, a term life policy. This plan offers coverage until the policyholder reaches the age of 100 and cannot be renewed." }), jsx("h4", { children: "Permanent Life Insurance Options" }), jsx("h5", { children: "Universal Life Insurance" }), jsx("p", { children: "This policy is valid for the entirety of the policyholder's life and includes a cash value component. The premium can be modified by reducing the death benefit or utilizing the cash value within the plan. The premiums for this type of plan are typically higher than those for term life insurance." }), jsx("h5", { children: "Whole Life Insurance" }), jsx("p", { children: "This is a lifetime policy where the premiums are fixed and never increase (without exception). The policy also has a cash value feature, which the policyholder can borrow against in a tax-free manner. Similar to universal life insurance, the premiums for whole life insurance are generally higher than those for term life insurance." })] }));
2930
+ const Description = () => (jsxs("div", { children: [jsx("span", { children: jsx("p", { children: "There are two primary categories of life insurance policies: term life insurance and permanent life insurance." }) }), jsx("h4", { children: "Term Life Insurance Options" }), jsx("h5", { children: "Options include 15 - 40-year plans" }), jsx("p", { children: "These policies provide coverage for a specific term of either 15, 20, 25, 30, 35 or 40 years. The premiums are consistent throughout the term. At the end of the term, policyholders have the choice to renew or convert their policy." }), jsx("h5", { children: "Level Term Until Ages 65 - 80" }), jsx("p", { children: "These are term life policies that extend coverage until the policyholder reaches the age of 65, 70, 75 or 80. Premiums are consistent for the entirety of the policy's duration. However, renewal options are not available after reaching the specified age." }), jsx("h5", { children: "Term Until Age 100" }), jsx("p", { children: "Although it's sometimes categorized as a permanent life insurance plan, the Term to 100 plan is, in fact, a term life policy. This plan offers coverage until the policyholder reaches the age of 100 and cannot be renewed. For Guaranteed Life Pay premiums are guaranteed to remain level until age 100, providing lifelong coverage. 20 Pay is similar but you pay premiums for only 20 years. After 20 years, the policy is paid in full, and coverage continues until age 100." }), jsx("h4", { children: "Permanent Life Insurance Options" }), jsx("h5", { children: "Whole Life Insurance" }), jsx("p", { children: "This is a lifetime policy where the premiums are fixed and never increase (without exception). The policy also has a cash value feature, which the policyholder can borrow against in a tax-free manner. The premiums for this type of plan are typically higher than those for term life insurance." }), jsx("h5", { children: "Whole Life Guaranteed 10 - 25 Pay" }), jsx("p", { children: "Premiums are paid for a set period (10, 15, 20, or 25 years). After the payment period, the policy is paid in full, and coverage continues for life. This provides the advantage of shorter premium payment terms." }), jsx("h5", { children: "Whole Life Guaranteed Pay to 65" }), jsx("p", { children: "Premiums are paid until you reach age 65. After that, the policy is paid in full, and coverage continues for life." }), jsx("h5", { children: "Whole Life Guaranteed Life Pay" }), jsx("p", { children: "Premiums are paid for your entire life, offering consistent coverage and premium payments." }), jsx("h5", { children: "Universal Life Insurance" }), jsx("p", { children: "This policy is valid for the entirety of the policyholder's life and includes a cash value component. The premium can be modified by reducing the death benefit or utilizing the cash value within the plan. Similar to whole life insurance, the premiums for universal life insurance are generally higher than those for term life insurance." }), jsx("h5", { children: "T100 Minimum Premium" }), jsx("p", { children: "This refers to a Universal Life Insurance policy designed to have the lowest possible premium payment to keep the policy in force until age 100." }), jsx("h5", { children: "T100 Minimum Premium Pay to 65" }), jsx("p", { children: "Similar to \"T100 Minimum Premium\" but structured to have the minimum premium payments until age 65." }), jsx("h5", { children: "T100 Minimum Premium 10 - 20 Pay" }), jsx("p", { children: "Similar to above, but premiums are paid for a shorter period (10, 15 or 20 years) with the goal of keeping the policy in force until age 100. This option requires larger premium payments during the initial term." })] }));
2932
2931
  const SectionCoverage = () => {
2933
2932
  const { coverageState: { type, coverage, province, inValidation }, dispatchCoverageState, } = useStoreFormLifeCoverage();
2934
2933
  const { appConfigState: { appType }, } = useStoreAppConfig();
2934
+ const isMychoice = appType === AppTypes.MyChoice;
2935
2935
  const handleProvinceChange = ({ value }) => {
2936
2936
  dispatchCoverageState({
2937
2937
  type: StoreFormLifeCoverageActionTypes.FormLifeProvinceSelect,
@@ -2950,8 +2950,13 @@ const SectionCoverage = () => {
2950
2950
  payload: { coverage: value },
2951
2951
  });
2952
2952
  };
2953
- const newLifeOptions = lifeInsuranceTypeOptions.filter((option) => option.name.includes('Year Level'));
2954
- const isMychoice = appType === AppTypes.MyChoice;
2953
+ const newLifeOptions = useMemo(() => {
2954
+ // Use different options for Ontario
2955
+ if (province === '9') {
2956
+ return lifeInsuranceOntarioTypeOptions;
2957
+ }
2958
+ return lifeInsuranceTypeOptions.filter((option) => option.name.includes('Year Level'));
2959
+ }, [isMychoice, province]);
2955
2960
  return (jsxs("div", { className: "form-section", children: [jsx("h2", { className: "section-title", style: { textAlign: 'center' }, children: "Get the coverage you need" }), jsx(SelectFormBox, { options: isMychoice ? lifeProvinceOptionsMC : lifeProvinceOptions, name: "province", onChange: handleProvinceChange, defaultValue: province, title: "Province", placeholder: "Select", autoSelectIfValueIsOutOfOptions: false, error: !province && inValidation, errorMessage: getErrorMessage(type, inValidation) }), jsx(SelectFormBox, { options: newLifeOptions, name: "type", onChange: handleLifeInsuranceTypeChange, defaultValue: type, title: "Type of Insurance", description: jsx(Description, {}), placeholder: "Select", autoSelectIfValueIsOutOfOptions: false, error: !type && inValidation, errorMessage: getErrorMessage(type, inValidation) }), jsx(SelectFormBox, { options: lifeCoverageOptions, name: "coverage", onChange: handleCoverageChange, defaultValue: coverage, title: "Required coverage", description: "The extent of coverage you need is determined by several factors,\n including your expenditure patterns, anticipated future expenses, yearly earnings,\n and so forth. Generally, individuals opt for a coverage amount that equals five\n times their current annual income before taxes. On an average,\n it is observed that Canadians choose a coverage amount of around $500,000.", placeholder: "Select", autoSelectIfValueIsOutOfOptions: false, error: !coverage && inValidation, errorMessage: getErrorMessage(coverage, inValidation) })] }));
2956
2961
  };
2957
2962