@mychoice/mychoice-sdk-store 2.1.67 → 2.1.70
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 +35 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/states/reducers/states/formStates/FormCarState/QuoteState/index.d.ts +1 -1
- package/dist/cjs/states/reducers/states/formStates/FormCarState/QuoteState/interfaces.d.ts +14 -0
- package/dist/cjs/states/reducers/states/formStates/FormCarState/VehicleState/actions.d.ts +4 -1
- package/dist/cjs/states/reducers/states/formStates/FormCarState/VehicleState/initialState.d.ts +12 -0
- package/dist/cjs/states/reducers/states/formStates/FormCarState/VehicleState/interfaces.d.ts +36 -0
- package/dist/esm/index.js +35 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/states/reducers/states/formStates/FormCarState/QuoteState/index.d.ts +1 -1
- package/dist/esm/states/reducers/states/formStates/FormCarState/QuoteState/interfaces.d.ts +14 -0
- package/dist/esm/states/reducers/states/formStates/FormCarState/VehicleState/actions.d.ts +4 -1
- package/dist/esm/states/reducers/states/formStates/FormCarState/VehicleState/initialState.d.ts +12 -0
- package/dist/esm/states/reducers/states/formStates/FormCarState/VehicleState/interfaces.d.ts +36 -0
- package/dist/index.d.ts +55 -2
- package/package.json +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -438,6 +438,18 @@ const vehicleLiabilityInitialState = {
|
|
|
438
438
|
coverage: true,
|
|
439
439
|
limit: 1000000,
|
|
440
440
|
};
|
|
441
|
+
const vehicleLossOfUseInitialState = {
|
|
442
|
+
coverage: true,
|
|
443
|
+
limit: 2000,
|
|
444
|
+
};
|
|
445
|
+
const vehicleLiabilityForDamageInitialState = {
|
|
446
|
+
coverage: true,
|
|
447
|
+
limit: 50000,
|
|
448
|
+
};
|
|
449
|
+
const limitedWaiverOfDepreciationInitialState = {
|
|
450
|
+
coverage: true,
|
|
451
|
+
limit: 1,
|
|
452
|
+
};
|
|
441
453
|
const vehicleItemInitialState = {
|
|
442
454
|
year: '',
|
|
443
455
|
make: '',
|
|
@@ -457,6 +469,9 @@ const vehicleItemInitialState = {
|
|
|
457
469
|
comprehensive: { ...vehicleComprehensiveInitialState },
|
|
458
470
|
collision: { ...vehicleCollisionInitialState },
|
|
459
471
|
liability: { ...vehicleLiabilityInitialState },
|
|
472
|
+
lossofuse: { ...vehicleLossOfUseInitialState },
|
|
473
|
+
liabilityfordamage: { ...vehicleLiabilityForDamageInitialState },
|
|
474
|
+
limitedwaiverofdepreciation: { ...limitedWaiverOfDepreciationInitialState },
|
|
460
475
|
postalCode: '',
|
|
461
476
|
locationIndex: '',
|
|
462
477
|
city: '',
|
|
@@ -509,6 +524,9 @@ exports.StoreFormCarVehicleActionTypes = void 0;
|
|
|
509
524
|
StoreFormCarVehicleActionTypes["FormCarLiabilityLimitSelect"] = "FormCarLiabilityLimitSelect";
|
|
510
525
|
StoreFormCarVehicleActionTypes["FormCarVehicleValidate"] = "FormCarVehicleValidate";
|
|
511
526
|
StoreFormCarVehicleActionTypes["FormCarVehicleValidateSet"] = "FormCarVehicleValidateSet";
|
|
527
|
+
StoreFormCarVehicleActionTypes["FormCarLossOfUseCoverageSelect"] = "FormCarLossOfUseCoverageSelect";
|
|
528
|
+
StoreFormCarVehicleActionTypes["FormCarLiabilityForDamageCoverageSelect"] = "FormCarLiabilityForDamageCoverageSelect";
|
|
529
|
+
StoreFormCarVehicleActionTypes["FormCarLimitedWaiverOfDepreciationCoverageSelect"] = "FormCarLimitedWaiverOfDepreciationCoverageSelect";
|
|
512
530
|
})(exports.StoreFormCarVehicleActionTypes || (exports.StoreFormCarVehicleActionTypes = {}));
|
|
513
531
|
|
|
514
532
|
const createTab = (name, id) => ({
|
|
@@ -531,9 +549,7 @@ const removeVehicleItem = (state, vehicleIndex) => {
|
|
|
531
549
|
return {
|
|
532
550
|
items: newItems,
|
|
533
551
|
tabs: newTabs,
|
|
534
|
-
activeIndex: state.activeIndex > newItems.length - 1
|
|
535
|
-
? newItems.length - 1
|
|
536
|
-
: state.activeIndex,
|
|
552
|
+
activeIndex: state.activeIndex > newItems.length - 1 ? newItems.length - 1 : state.activeIndex,
|
|
537
553
|
};
|
|
538
554
|
};
|
|
539
555
|
const createVehicleItem = (state) => ({
|
|
@@ -551,6 +567,7 @@ const createVehicleItem = (state) => ({
|
|
|
551
567
|
});
|
|
552
568
|
const setVehicleProperty = (state, name, value) => {
|
|
553
569
|
const newState = mychoiceSdkComponents.deepClone(state);
|
|
570
|
+
// @ts-ignore
|
|
554
571
|
newState[name] = value;
|
|
555
572
|
return newState;
|
|
556
573
|
};
|
|
@@ -576,6 +593,7 @@ const setVehicleModel = (state, vehicleModel) => {
|
|
|
576
593
|
};
|
|
577
594
|
const setItemProperty = (state, name, value) => {
|
|
578
595
|
const newState = mychoiceSdkComponents.deepClone(state);
|
|
596
|
+
// @ts-ignore
|
|
579
597
|
newState.items[newState.activeIndex][name] = value;
|
|
580
598
|
return newState;
|
|
581
599
|
};
|
|
@@ -585,7 +603,12 @@ const setCarCoverageProperty = (state, name, coverage, value) => {
|
|
|
585
603
|
const newItem = newState.items[vehicleIndex];
|
|
586
604
|
newItem[name].coverage = coverage;
|
|
587
605
|
if (coverage) {
|
|
588
|
-
if (
|
|
606
|
+
if ([
|
|
607
|
+
mychoiceSdkComponents.CoverageTypes.Liability,
|
|
608
|
+
mychoiceSdkComponents.CoverageTypes.LossOfUse,
|
|
609
|
+
mychoiceSdkComponents.CoverageTypes.LiabilityForDamage,
|
|
610
|
+
mychoiceSdkComponents.CoverageTypes.LimitedWaiverOfDepreciation,
|
|
611
|
+
].includes(name)) {
|
|
589
612
|
newItem[name].limit = Number(value);
|
|
590
613
|
}
|
|
591
614
|
else {
|
|
@@ -662,6 +685,12 @@ const formCarVehicleStateReducer = (state = { ...carFormVehicleInitialState }, a
|
|
|
662
685
|
return setLocalVehicles(action.localIndex, {
|
|
663
686
|
...carFormVehicleInitialState,
|
|
664
687
|
});
|
|
688
|
+
case exports.StoreFormCarVehicleActionTypes.FormCarLossOfUseCoverageSelect:
|
|
689
|
+
return setLocalVehicles(action.localIndex, setCarCoverageProperty(state, 'lossofuse', action.payload.coverage, action.payload.limit));
|
|
690
|
+
case exports.StoreFormCarVehicleActionTypes.FormCarLiabilityForDamageCoverageSelect:
|
|
691
|
+
return setLocalVehicles(action.localIndex, setCarCoverageProperty(state, 'liabilityfordamage', action.payload.coverage, action.payload.limit));
|
|
692
|
+
case exports.StoreFormCarVehicleActionTypes.FormCarLimitedWaiverOfDepreciationCoverageSelect:
|
|
693
|
+
return setLocalVehicles(action.localIndex, setCarCoverageProperty(state, 'limitedwaiverofdepreciation', action.payload.coverage, action.payload.limit));
|
|
665
694
|
default:
|
|
666
695
|
return state;
|
|
667
696
|
}
|
|
@@ -3367,9 +3396,9 @@ const useStoreFormCarVehicle = () => {
|
|
|
3367
3396
|
const { appConfigState } = useStoreAppConfig();
|
|
3368
3397
|
const { vehicleState } = useTypedSelector((state) => state).formCarState;
|
|
3369
3398
|
const dispatch = reactRedux.useDispatch();
|
|
3370
|
-
const { quoteState: { isRequested }, dispatchQuoteState } = useStoreFormCarQuote();
|
|
3399
|
+
const { quoteState: { isRequested }, dispatchQuoteState, } = useStoreFormCarQuote();
|
|
3371
3400
|
const dispatchVehicleState = react.useMemo(() => (props) => {
|
|
3372
|
-
if (isRequested &&
|
|
3401
|
+
if (isRequested && props.type !== exports.StoreFormCarVehicleActionTypes.FormCarVehicleSelect) {
|
|
3373
3402
|
dispatchQuoteState({
|
|
3374
3403
|
type: exports.StoreFormCarQuoteActionTypes.FormCarQuoteIsRequestedSet,
|
|
3375
3404
|
payload: { isRequested: false },
|