@mychoice/mychoice-sdk-store 2.1.58 → 2.1.69

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.
@@ -1 +1 @@
1
- export type { FormCarQuoteStateInterface, FormCarQuoteStateReducerInterface, CarQuoteItemInterface, } from './interfaces';
1
+ export type { FormCarQuoteStateInterface, FormCarQuoteStateReducerInterface, CarQuoteItemInterface, CarQuoteCoverageInterface, } from './interfaces';
@@ -14,6 +14,13 @@ export interface QuoteCompanyInterface {
14
14
  logo: string;
15
15
  name: string;
16
16
  }
17
+ export interface CarQuoteCoverageInterface {
18
+ annualPremium: number;
19
+ code: string;
20
+ deductible: string;
21
+ limit1: string;
22
+ limit2: string;
23
+ }
17
24
  export interface CarQuoteItemInterface {
18
25
  brokerProfile: BrokerProfileInterface;
19
26
  company: QuoteCompanyInterface;
@@ -22,6 +29,13 @@ export interface CarQuoteItemInterface {
22
29
  priceMonthly: string;
23
30
  priceYearly: string;
24
31
  confirmQuote?: boolean;
32
+ coverages: CarQuoteCoverageInterface[];
33
+ nonStandardCoverages: {
34
+ 20: boolean;
35
+ 27: boolean;
36
+ 43: boolean;
37
+ ACCW: boolean;
38
+ };
25
39
  }
26
40
  export interface FormCarQuoteStateInterface {
27
41
  items: CarQuoteItemInterface[];
@@ -27,5 +27,8 @@ export declare enum StoreFormCarVehicleActionTypes {
27
27
  FormCarLiabilityCoverageSelect = "FormCarLiabilityCoverageSelect",
28
28
  FormCarLiabilityLimitSelect = "FormCarLiabilityLimitSelect",
29
29
  FormCarVehicleValidate = "FormCarVehicleValidate",
30
- FormCarVehicleValidateSet = "FormCarVehicleValidateSet"
30
+ FormCarVehicleValidateSet = "FormCarVehicleValidateSet",
31
+ FormCarLossOfUseCoverageSelect = "FormCarLossOfUseCoverageSelect",
32
+ FormCarLiabilityForDamageCoverageSelect = "FormCarLiabilityForDamageCoverageSelect",
33
+ FormCarLimitedWaiverOfDepreciationCoverageSelect = "FormCarLimitedWaiverOfDepreciationCoverageSelect"
31
34
  }
@@ -11,5 +11,17 @@ export declare const vehicleLiabilityInitialState: {
11
11
  coverage: boolean;
12
12
  limit: number;
13
13
  };
14
+ export declare const vehicleLossOfUseInitialState: {
15
+ coverage: boolean;
16
+ limit: number;
17
+ };
18
+ export declare const vehicleLiabilityForDamageInitialState: {
19
+ coverage: boolean;
20
+ limit: number;
21
+ };
22
+ export declare const limitedWaiverOfDepreciationInitialState: {
23
+ coverage: boolean;
24
+ limit: number;
25
+ };
14
26
  export declare const vehicleItemInitialState: VehicleItemInterface;
15
27
  export declare const carFormVehicleInitialState: FormCarVehicleStateInterface;
@@ -13,6 +13,18 @@ export interface VehicleLiabilityInterface {
13
13
  coverage: boolean;
14
14
  limit: number;
15
15
  }
16
+ export interface VehicleLossOfUseInterface {
17
+ coverage: boolean;
18
+ limit: number;
19
+ }
20
+ export interface VehicleLiabilityForDamageInterface {
21
+ coverage: boolean;
22
+ limit: number;
23
+ }
24
+ export interface VehicleLimitedWaiverOfDepreciationInterface {
25
+ coverage: boolean;
26
+ limit: number;
27
+ }
16
28
  export interface VehicleItemInterface {
17
29
  year: string | undefined;
18
30
  make: string | undefined;
@@ -31,6 +43,9 @@ export interface VehicleItemInterface {
31
43
  comprehensive: VehicleComprehensiveInterface;
32
44
  collision: VehicleCollisionInterface;
33
45
  liability: VehicleLiabilityInterface;
46
+ lossofuse: VehicleLossOfUseInterface;
47
+ liabilityfordamage: VehicleLiabilityForDamageInterface;
48
+ limitedwaiverofdepreciation: VehicleLimitedWaiverOfDepreciationInterface;
34
49
  postalCode: string;
35
50
  locationIndex: string;
36
51
  city: string;
@@ -188,6 +203,27 @@ export type FormCarVehicleStateActionType = {
188
203
  limit: number;
189
204
  };
190
205
  localIndex?: string;
206
+ } | {
207
+ type: StoreFormCarVehicleActionTypes.FormCarLossOfUseCoverageSelect;
208
+ payload: {
209
+ coverage: boolean;
210
+ limit: number;
211
+ };
212
+ localIndex?: string;
213
+ } | {
214
+ type: StoreFormCarVehicleActionTypes.FormCarLiabilityForDamageCoverageSelect;
215
+ payload: {
216
+ coverage: boolean;
217
+ limit: number;
218
+ };
219
+ localIndex?: string;
220
+ } | {
221
+ type: StoreFormCarVehicleActionTypes.FormCarLimitedWaiverOfDepreciationCoverageSelect;
222
+ payload: {
223
+ coverage: boolean;
224
+ limit: number;
225
+ };
226
+ localIndex?: string;
191
227
  };
192
228
  export type FormCarVehicleStateReducerInterface = (state: FormCarVehicleStateInterface, action: FormCarVehicleStateActionType) => void;
193
229
  export interface ClientHookInterface {
package/dist/esm/index.js CHANGED
@@ -429,6 +429,18 @@ const vehicleLiabilityInitialState = {
429
429
  coverage: true,
430
430
  limit: 1000000,
431
431
  };
432
+ const vehicleLossOfUseInitialState = {
433
+ coverage: true,
434
+ limit: 2000,
435
+ };
436
+ const vehicleLiabilityForDamageInitialState = {
437
+ coverage: true,
438
+ limit: 50000,
439
+ };
440
+ const limitedWaiverOfDepreciationInitialState = {
441
+ coverage: true,
442
+ limit: 1,
443
+ };
432
444
  const vehicleItemInitialState = {
433
445
  year: '',
434
446
  make: '',
@@ -448,6 +460,9 @@ const vehicleItemInitialState = {
448
460
  comprehensive: { ...vehicleComprehensiveInitialState },
449
461
  collision: { ...vehicleCollisionInitialState },
450
462
  liability: { ...vehicleLiabilityInitialState },
463
+ lossofuse: { ...vehicleLossOfUseInitialState },
464
+ liabilityfordamage: { ...vehicleLiabilityForDamageInitialState },
465
+ limitedwaiverofdepreciation: { ...limitedWaiverOfDepreciationInitialState },
451
466
  postalCode: '',
452
467
  locationIndex: '',
453
468
  city: '',
@@ -500,6 +515,9 @@ var StoreFormCarVehicleActionTypes;
500
515
  StoreFormCarVehicleActionTypes["FormCarLiabilityLimitSelect"] = "FormCarLiabilityLimitSelect";
501
516
  StoreFormCarVehicleActionTypes["FormCarVehicleValidate"] = "FormCarVehicleValidate";
502
517
  StoreFormCarVehicleActionTypes["FormCarVehicleValidateSet"] = "FormCarVehicleValidateSet";
518
+ StoreFormCarVehicleActionTypes["FormCarLossOfUseCoverageSelect"] = "FormCarLossOfUseCoverageSelect";
519
+ StoreFormCarVehicleActionTypes["FormCarLiabilityForDamageCoverageSelect"] = "FormCarLiabilityForDamageCoverageSelect";
520
+ StoreFormCarVehicleActionTypes["FormCarLimitedWaiverOfDepreciationCoverageSelect"] = "FormCarLimitedWaiverOfDepreciationCoverageSelect";
503
521
  })(StoreFormCarVehicleActionTypes || (StoreFormCarVehicleActionTypes = {}));
504
522
 
505
523
  const createTab = (name, id) => ({
@@ -522,9 +540,7 @@ const removeVehicleItem = (state, vehicleIndex) => {
522
540
  return {
523
541
  items: newItems,
524
542
  tabs: newTabs,
525
- activeIndex: state.activeIndex > newItems.length - 1
526
- ? newItems.length - 1
527
- : state.activeIndex,
543
+ activeIndex: state.activeIndex > newItems.length - 1 ? newItems.length - 1 : state.activeIndex,
528
544
  };
529
545
  };
530
546
  const createVehicleItem = (state) => ({
@@ -542,6 +558,7 @@ const createVehicleItem = (state) => ({
542
558
  });
543
559
  const setVehicleProperty = (state, name, value) => {
544
560
  const newState = deepClone(state);
561
+ // @ts-ignore
545
562
  newState[name] = value;
546
563
  return newState;
547
564
  };
@@ -567,6 +584,7 @@ const setVehicleModel = (state, vehicleModel) => {
567
584
  };
568
585
  const setItemProperty = (state, name, value) => {
569
586
  const newState = deepClone(state);
587
+ // @ts-ignore
570
588
  newState.items[newState.activeIndex][name] = value;
571
589
  return newState;
572
590
  };
@@ -576,7 +594,12 @@ const setCarCoverageProperty = (state, name, coverage, value) => {
576
594
  const newItem = newState.items[vehicleIndex];
577
595
  newItem[name].coverage = coverage;
578
596
  if (coverage) {
579
- if (name === CoverageTypes.Liability) {
597
+ if ([
598
+ CoverageTypes.Liability,
599
+ CoverageTypes.LossOfUse,
600
+ CoverageTypes.LiabilityForDamage,
601
+ CoverageTypes.LimitedWaiverOfDepreciation,
602
+ ].includes(name)) {
580
603
  newItem[name].limit = Number(value);
581
604
  }
582
605
  else {
@@ -653,6 +676,12 @@ const formCarVehicleStateReducer = (state = { ...carFormVehicleInitialState }, a
653
676
  return setLocalVehicles(action.localIndex, {
654
677
  ...carFormVehicleInitialState,
655
678
  });
679
+ case StoreFormCarVehicleActionTypes.FormCarLossOfUseCoverageSelect:
680
+ return setLocalVehicles(action.localIndex, setCarCoverageProperty(state, 'lossofuse', action.payload.coverage, action.payload.limit));
681
+ case StoreFormCarVehicleActionTypes.FormCarLiabilityForDamageCoverageSelect:
682
+ return setLocalVehicles(action.localIndex, setCarCoverageProperty(state, 'liabilityfordamage', action.payload.coverage, action.payload.limit));
683
+ case StoreFormCarVehicleActionTypes.FormCarLimitedWaiverOfDepreciationCoverageSelect:
684
+ return setLocalVehicles(action.localIndex, setCarCoverageProperty(state, 'limitedwaiverofdepreciation', action.payload.coverage, action.payload.limit));
656
685
  default:
657
686
  return state;
658
687
  }
@@ -3358,9 +3387,9 @@ const useStoreFormCarVehicle = () => {
3358
3387
  const { appConfigState } = useStoreAppConfig();
3359
3388
  const { vehicleState } = useTypedSelector((state) => state).formCarState;
3360
3389
  const dispatch = useDispatch();
3361
- const { quoteState: { isRequested }, dispatchQuoteState } = useStoreFormCarQuote();
3390
+ const { quoteState: { isRequested }, dispatchQuoteState, } = useStoreFormCarQuote();
3362
3391
  const dispatchVehicleState = useMemo(() => (props) => {
3363
- if (isRequested && (props.type !== StoreFormCarVehicleActionTypes.FormCarVehicleSelect)) {
3392
+ if (isRequested && props.type !== StoreFormCarVehicleActionTypes.FormCarVehicleSelect) {
3364
3393
  dispatchQuoteState({
3365
3394
  type: StoreFormCarQuoteActionTypes.FormCarQuoteIsRequestedSet,
3366
3395
  payload: { isRequested: false },
@@ -6076,13 +6105,7 @@ const useValidationAddress = () => {
6076
6105
  const isHomeOwner = insuranceType === InsuranceTypes.Home;
6077
6106
  const addressFormValidate = async (isRedirect = true) => {
6078
6107
  let formIsValid = false;
6079
- const postalKeys = [
6080
- 'errorMessage',
6081
- 'streetAddress',
6082
- 'city',
6083
- 'postalCode',
6084
- 'provinceCode',
6085
- ];
6108
+ const postalKeys = ['errorMessage', 'streetAddress', 'city', 'postalCode', 'provinceCode'];
6086
6109
  const dwellingKeys = ['type'];
6087
6110
  const errors = [];
6088
6111
  dispatchPostalState({
@@ -6095,9 +6118,7 @@ const useValidationAddress = () => {
6095
6118
  }
6096
6119
  });
6097
6120
  Object.keys(postalState.item).forEach((key) => {
6098
- if (postalKeys.includes(key) &&
6099
- !postalState.item[key] &&
6100
- key !== 'errorMessage') {
6121
+ if (postalKeys.includes(key) && !postalState.item[key] && key !== 'errorMessage') {
6101
6122
  errors.push(key);
6102
6123
  }
6103
6124
  if (key === 'errorMessage' && postalState.item[key]) {