@mychoice/mychoice-sdk-modules 2.1.61 → 2.1.63
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 +17 -18
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +18 -19
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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,
|
|
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, lifeInsuranceOntarioTypeOptions, 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
6
|
import React, { useState, useCallback, useEffect, useRef, useMemo } from 'react';
|
|
@@ -189,19 +189,15 @@ const NoQuotesMessage = ({ type }) => {
|
|
|
189
189
|
const usePathGroups = (insuranceType) => {
|
|
190
190
|
const { appConfigState } = useStoreAppConfig();
|
|
191
191
|
const insurancePathGroup = {
|
|
192
|
-
[`${InsuranceTypes.Car}`]: [
|
|
193
|
-
|
|
194
|
-
],
|
|
195
|
-
[`${InsuranceTypes.Home}`]: [
|
|
196
|
-
{ name: 'Home', link: `/${appConfigState.localIndex}/home` },
|
|
197
|
-
],
|
|
192
|
+
[`${InsuranceTypes.Car}`]: [{ name: 'Car', link: `/${appConfigState.localIndex}/car` }],
|
|
193
|
+
[`${InsuranceTypes.Home}`]: [{ name: 'Home', link: `/${appConfigState.localIndex}/home` }],
|
|
198
194
|
// @todo: will be used in future
|
|
199
195
|
// [`${InsuranceTypes.Life}`]: [{ name: 'Life', link: `/${appConfigState.localIndex}/life` }],
|
|
200
196
|
};
|
|
201
197
|
const externalPathGroup = [
|
|
202
|
-
{ name: 'Car', link: '
|
|
203
|
-
{ name: 'Home', link: '
|
|
204
|
-
{ name: 'Life', link: '
|
|
198
|
+
{ name: 'Car', link: '/insurance/car' },
|
|
199
|
+
{ name: 'Home', link: '/insurance/home' },
|
|
200
|
+
{ name: 'Life', link: '/insurance/life' },
|
|
205
201
|
{ name: 'Learn', link: 'https://www.mychoice.ca/blog/' },
|
|
206
202
|
];
|
|
207
203
|
// @todo: use in future.
|
|
@@ -3009,6 +3005,11 @@ const SectionCoverage = () => {
|
|
|
3009
3005
|
});
|
|
3010
3006
|
};
|
|
3011
3007
|
const newLifeOptions = useMemo(() => {
|
|
3008
|
+
if (process.env.REACT_APP_ENV !== 'production') {
|
|
3009
|
+
return {
|
|
3010
|
+
options: lifeInsuranceTypeOptions,
|
|
3011
|
+
};
|
|
3012
|
+
}
|
|
3012
3013
|
// Use different set for Ontario
|
|
3013
3014
|
if (isMychoice && province === '9') {
|
|
3014
3015
|
return {
|
|
@@ -3633,7 +3634,7 @@ NavigationBottomTheBig.defaultProps = {
|
|
|
3633
3634
|
|
|
3634
3635
|
const NavigationTab = React.memo((props) => {
|
|
3635
3636
|
const { className, name, addButtonLabel, items, selectItem, removeItem, createItem, activeItemIndex = 0, maxItemCount = 5, readOnly, } = props;
|
|
3636
|
-
const { appConfigState: { appType } } = useStoreAppConfig();
|
|
3637
|
+
const { appConfigState: { appType }, } = useStoreAppConfig();
|
|
3637
3638
|
const isThebig = appType === AppTypes.TheBig;
|
|
3638
3639
|
const handleButtonClick = (index) => () => {
|
|
3639
3640
|
if (selectItem) {
|
|
@@ -3649,20 +3650,18 @@ const NavigationTab = React.memo((props) => {
|
|
|
3649
3650
|
const handleArrowClick = (direction) => {
|
|
3650
3651
|
if (selectItem) {
|
|
3651
3652
|
if (direction === DirectionTypes.Left) {
|
|
3652
|
-
selectItem(
|
|
3653
|
+
selectItem(activeItemIndex - 1 > -1 ? activeItemIndex - 1 : 0);
|
|
3653
3654
|
}
|
|
3654
3655
|
if (direction === DirectionTypes.Right) {
|
|
3655
|
-
selectItem(
|
|
3656
|
+
selectItem(activeItemIndex + 1 < maxItemCount ? activeItemIndex + 1 : maxItemCount);
|
|
3656
3657
|
}
|
|
3657
3658
|
}
|
|
3658
3659
|
};
|
|
3659
3660
|
const reduceCount = activeItemIndex === 4 ? 2 : 1;
|
|
3660
|
-
return (jsxs("div", { className: `navigation-tab-box ${className}`, children: [
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
}, (prevProps, nextProps) => !((prevProps.items !== nextProps.items
|
|
3665
|
-
|| prevProps.activeItemIndex !== nextProps.activeItemIndex)));
|
|
3661
|
+
return (jsxs("div", { className: `navigation-tab-box ${className}`, children: [activeItemIndex > 1 && jsx(ButtonTabArrow, { onClick: () => handleArrowClick(DirectionTypes.Left) }), activeItemIndex <= items.length - 2 &&
|
|
3662
|
+
activeItemIndex < 3 &&
|
|
3663
|
+
((items.length > 2 && createItem) || (items.length > 3 && !createItem)) && (jsx(ButtonTabArrow, { onClick: () => handleArrowClick(DirectionTypes.Right), direction: DirectionTypes.Right })), jsxs("div", { className: "navigation-tab-container", style: { marginLeft: `${activeItemIndex > 1 ? `-${(activeItemIndex - reduceCount) * 9.875}rem` : '0'}` }, children: [items.map((tab, index) => (jsx(ButtonTab, { className: `${activeItemIndex === index ? 'active-tab' : 'inactive-tab'} ${isThebig ? 'thebig-bold' : 'mychoice'}`, label: tab.name, buttonClick: handleButtonClick(index), iconClick: handleIconClick(index), selfDelete: index !== 0 && !readOnly }, `${name}-${index}`))), items.length < maxItemCount && createItem && (jsx(ButtonTab, { className: isThebig ? 'add-thebig-medium' : 'add mychoice', label: addButtonLabel, buttonClick: createItem, selfDelete: false }))] })] }));
|
|
3664
|
+
}, (prevProps, nextProps) => !(prevProps.items !== nextProps.items || prevProps.activeItemIndex !== nextProps.activeItemIndex));
|
|
3666
3665
|
NavigationTab.defaultProps = {
|
|
3667
3666
|
className: '',
|
|
3668
3667
|
items: [],
|