@mychoice/mychoice-sdk-store 2.2.23 → 2.2.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/cjs/handlers/dataHandlers/QuoterPhoneDataHandler/QuoterPhoneDataHandler.d.ts +4 -0
- package/dist/cjs/handlers/dataHandlers/QuoterPhoneDataHandler/index.d.ts +1 -0
- package/dist/cjs/handlers/dataHandlers/QuoterPhoneDataHandler/interfaces.d.ts +4 -0
- package/dist/cjs/handlers/dataHandlers/index.d.ts +1 -0
- package/dist/cjs/index.js +486 -69
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/states/reducers/states/formStates/FormCarState/DiscountState/actions.d.ts +2 -0
- package/dist/cjs/states/reducers/states/formStates/FormCarState/DiscountState/interfaces.d.ts +19 -0
- package/dist/cjs/states/reducers/states/formStates/FormCarState/DriverState/DriverInsuranceState/actions.d.ts +5 -1
- package/dist/cjs/states/reducers/states/formStates/FormCarState/DriverState/DriverInsuranceState/interfaces.d.ts +24 -0
- package/dist/cjs/states/reducers/states/formStates/FormCarState/DriverState/DriverLicenceState/actions.d.ts +2 -0
- package/dist/cjs/states/reducers/states/formStates/FormCarState/DriverState/DriverLicenceState/interfaces.d.ts +12 -0
- package/dist/cjs/states/reducers/states/formStates/FormCarState/DriverState/DriverTicketState/actions.d.ts +1 -0
- package/dist/cjs/states/reducers/states/formStates/FormCarState/DriverState/DriverTicketState/interfaces.d.ts +7 -0
- package/dist/cjs/states/reducers/states/formStates/FormCarState/DriverState/initialState.d.ts +1 -0
- package/dist/cjs/states/reducers/states/formStates/FormCarState/DriverState/interfaces.d.ts +9 -0
- package/dist/cjs/states/reducers/states/formStates/FormCarState/VehicleState/actions.d.ts +1 -0
- package/dist/cjs/states/reducers/states/formStates/FormCarState/VehicleState/interfaces.d.ts +8 -1
- package/dist/cjs/states/reducers/states/formStates/FormHomeState/DiscountState/actions.d.ts +1 -0
- package/dist/cjs/states/reducers/states/formStates/FormHomeState/DiscountState/interfaces.d.ts +8 -0
- package/dist/cjs/states/reducers/states/formStates/FormLifeState/ApplicantState/actions.d.ts +1 -0
- package/dist/cjs/states/reducers/states/formStates/FormLifeState/ApplicantState/interfaces.d.ts +8 -0
- package/dist/esm/handlers/dataHandlers/QuoterPhoneDataHandler/QuoterPhoneDataHandler.d.ts +4 -0
- package/dist/esm/handlers/dataHandlers/QuoterPhoneDataHandler/index.d.ts +1 -0
- package/dist/esm/handlers/dataHandlers/QuoterPhoneDataHandler/interfaces.d.ts +4 -0
- package/dist/esm/handlers/dataHandlers/index.d.ts +1 -0
- package/dist/esm/index.js +485 -71
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/states/reducers/states/formStates/FormCarState/DiscountState/actions.d.ts +2 -0
- package/dist/esm/states/reducers/states/formStates/FormCarState/DiscountState/interfaces.d.ts +19 -0
- package/dist/esm/states/reducers/states/formStates/FormCarState/DriverState/DriverInsuranceState/actions.d.ts +5 -1
- package/dist/esm/states/reducers/states/formStates/FormCarState/DriverState/DriverInsuranceState/interfaces.d.ts +24 -0
- package/dist/esm/states/reducers/states/formStates/FormCarState/DriverState/DriverLicenceState/actions.d.ts +2 -0
- package/dist/esm/states/reducers/states/formStates/FormCarState/DriverState/DriverLicenceState/interfaces.d.ts +12 -0
- package/dist/esm/states/reducers/states/formStates/FormCarState/DriverState/DriverTicketState/actions.d.ts +1 -0
- package/dist/esm/states/reducers/states/formStates/FormCarState/DriverState/DriverTicketState/interfaces.d.ts +7 -0
- package/dist/esm/states/reducers/states/formStates/FormCarState/DriverState/initialState.d.ts +1 -0
- package/dist/esm/states/reducers/states/formStates/FormCarState/DriverState/interfaces.d.ts +9 -0
- package/dist/esm/states/reducers/states/formStates/FormCarState/VehicleState/actions.d.ts +1 -0
- package/dist/esm/states/reducers/states/formStates/FormCarState/VehicleState/interfaces.d.ts +8 -1
- package/dist/esm/states/reducers/states/formStates/FormHomeState/DiscountState/actions.d.ts +1 -0
- package/dist/esm/states/reducers/states/formStates/FormHomeState/DiscountState/interfaces.d.ts +8 -0
- package/dist/esm/states/reducers/states/formStates/FormLifeState/ApplicantState/actions.d.ts +1 -0
- package/dist/esm/states/reducers/states/formStates/FormLifeState/ApplicantState/interfaces.d.ts +8 -0
- package/dist/index.d.ts +118 -4
- package/package.json +3 -3
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
-
import { defaultLocalIndex, HttpRequestHeaderTypes, RequestTypes, ModalTypes, DeviceTypes, ScreenBPTypes, DeviceTypeWidthList, ScreenBPList, AppTypes, InsuranceTypes, VehicleConditionTypes, VehiclePrimaryUseTypes, deepClone, CoverageTypes, getFormattedDate, GenderTypes, OccupationTypes, addDaysToDate, compareDates, DriverLicenceTypes, DateTypes, getLicenceMinDate, addYearsToDate, subMonthsFromDate, getDifferenceInYears, DriverListTypes, addMonthsToDate, ValidationStatusTypes,
|
|
2
|
+
import { defaultLocalIndex, HttpRequestHeaderTypes, RequestTypes, ModalTypes, DeviceTypes, ScreenBPTypes, DeviceTypeWidthList, ScreenBPList, AppTypes, InsuranceTypes, VehicleConditionTypes, VehiclePrimaryUseTypes, deepClone, CoverageTypes, getFormattedDate, GenderTypes, OccupationTypes, addDaysToDate, compareDates, DriverLicenceTypes, DateTypes, getLicenceMinDate, addYearsToDate, subMonthsFromDate, getDifferenceInYears, DriverListTypes, addMonthsToDate, ValidationStatusTypes, defaultBrokerPhone, DriverPriorityTypes, subYearsFromDate, ApplicantListTypes, useEffectOnce, getInsuranceType as getInsuranceType$2, API_AUTH, RequestStatusTypes, PROFILE_API, getDaysOfMonth, getDifferenceInHours, MAX_LOCAL_STORAGE_HOURS_THEBIG, MAX_LOCAL_STORAGE_HOURS, API_APP, API_FORM_CAR, supportedProvinceCodes, API_FORM_HOME, API_FORM_LIFE, isMyChoiceLike, getDifferenceInMonths } from '@mychoice/mychoice-sdk-components';
|
|
3
3
|
import { useMemo, useReducer, useState, useRef, useEffect } from 'react';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
5
5
|
import { Provider, useSelector, useDispatch } from 'react-redux';
|
|
@@ -465,7 +465,7 @@ const vehicleItemInitialState = {
|
|
|
465
465
|
winterTires: true,
|
|
466
466
|
parkingLocation: 'garage',
|
|
467
467
|
primaryUse: VehiclePrimaryUseTypes.Personal,
|
|
468
|
-
distanceDaily:
|
|
468
|
+
distanceDaily: undefined,
|
|
469
469
|
distanceBusiness: 0,
|
|
470
470
|
distanceYearly: 0,
|
|
471
471
|
comprehensive: { ...vehicleComprehensiveInitialState },
|
|
@@ -518,6 +518,7 @@ var StoreFormCarVehicleActionTypes;
|
|
|
518
518
|
StoreFormCarVehicleActionTypes["FormCarParkingLocationSelect"] = "FormCarParkingLocationSelect";
|
|
519
519
|
StoreFormCarVehicleActionTypes["FormCarDailyDistanceSelect"] = "FormCarDailyDistanceSelect";
|
|
520
520
|
StoreFormCarVehicleActionTypes["FormCarBusinessDistanceSelect"] = "FormCarBusinessDistanceSelect";
|
|
521
|
+
StoreFormCarVehicleActionTypes["FormCarBusinessUsePercentSelect"] = "FormCarBusinessUsePercentSelect";
|
|
521
522
|
StoreFormCarVehicleActionTypes["FormCarYearlyDistanceSelect"] = "FormCarYearlyDistanceSelect";
|
|
522
523
|
StoreFormCarVehicleActionTypes["FormCarComprehensiveCoverageSelect"] = "FormCarComprehensiveCoverageSelect";
|
|
523
524
|
StoreFormCarVehicleActionTypes["FormCarComprehensiveDeductibleSelect"] = "FormCarComprehensiveDeductibleSelect";
|
|
@@ -681,6 +682,8 @@ const formCarVehicleStateReducer = (state = { ...carFormVehicleInitialState }, a
|
|
|
681
682
|
return setLocalVehicles(action.localIndex, setItemProperty(state, 'distanceDaily', action.payload.distanceDaily));
|
|
682
683
|
case StoreFormCarVehicleActionTypes.FormCarBusinessDistanceSelect:
|
|
683
684
|
return setLocalVehicles(action.localIndex, setItemProperty(state, 'distanceBusiness', action.payload.distanceBusiness));
|
|
685
|
+
case StoreFormCarVehicleActionTypes.FormCarBusinessUsePercentSelect:
|
|
686
|
+
return setLocalVehicles(action.localIndex, setItemProperty(state, 'businessUsePercent', action.payload.businessUsePercent));
|
|
684
687
|
case StoreFormCarVehicleActionTypes.FormCarYearlyDistanceSelect:
|
|
685
688
|
return setLocalVehicles(action.localIndex, setItemProperty(state, 'distanceYearly', action.payload.distanceYearly));
|
|
686
689
|
case StoreFormCarVehicleActionTypes.FormCarComprehensiveCoverageSelect:
|
|
@@ -765,6 +768,10 @@ var StoreFormCarDriverInsuranceActionTypes;
|
|
|
765
768
|
StoreFormCarDriverInsuranceActionTypes["FormCarDriverListedMonthSelect"] = "FormCarDriverListedMonthSelect";
|
|
766
769
|
StoreFormCarDriverInsuranceActionTypes["FormCarDriverInsuredSelect"] = "FormCarDriverInsuredSelect";
|
|
767
770
|
StoreFormCarDriverInsuranceActionTypes["FormCarDriverInsuredDateSelect"] = "FormCarDriverInsuredDateSelect";
|
|
771
|
+
StoreFormCarDriverInsuranceActionTypes["FormCarDriverNotCurrentlyInsuredSelect"] = "FormCarDriverNotCurrentlyInsuredSelect";
|
|
772
|
+
StoreFormCarDriverInsuranceActionTypes["FormCarDriverLastPolicyEndYearSelect"] = "FormCarDriverLastPolicyEndYearSelect";
|
|
773
|
+
StoreFormCarDriverInsuranceActionTypes["FormCarDriverLastPolicyEndMonthSelect"] = "FormCarDriverLastPolicyEndMonthSelect";
|
|
774
|
+
StoreFormCarDriverInsuranceActionTypes["FormCarDriverLastPolicyCancelReasonSelect"] = "FormCarDriverLastPolicyCancelReasonSelect";
|
|
768
775
|
})(StoreFormCarDriverInsuranceActionTypes || (StoreFormCarDriverInsuranceActionTypes = {}));
|
|
769
776
|
|
|
770
777
|
var StoreFormCarDriverLicenceActionTypes;
|
|
@@ -779,6 +786,8 @@ var StoreFormCarDriverLicenceActionTypes;
|
|
|
779
786
|
StoreFormCarDriverLicenceActionTypes["FormCarDriverG1LicenceMaxSelect"] = "FormCarDriverG1LicenceMaxSelect";
|
|
780
787
|
StoreFormCarDriverLicenceActionTypes["FormCarDriverTrainingSelect"] = "FormCarDriverTrainingSelect";
|
|
781
788
|
StoreFormCarDriverLicenceActionTypes["FormCarDriverPreviousLicenceSelect"] = "FormCarDriverPreviousLicenceSelect";
|
|
789
|
+
StoreFormCarDriverLicenceActionTypes["FormCarDriverReceivedG2Select"] = "FormCarDriverReceivedG2Select";
|
|
790
|
+
StoreFormCarDriverLicenceActionTypes["FormCarDriverReceivedGSelect"] = "FormCarDriverReceivedGSelect";
|
|
782
791
|
StoreFormCarDriverLicenceActionTypes["FormCarDriverLicenceYearSelect"] = "FormCarDriverLicenceYearSelect";
|
|
783
792
|
StoreFormCarDriverLicenceActionTypes["FormCarDriverLicenceMonthSelect"] = "FormCarDriverLicenceMonthSelect";
|
|
784
793
|
})(StoreFormCarDriverLicenceActionTypes || (StoreFormCarDriverLicenceActionTypes = {}));
|
|
@@ -801,6 +810,7 @@ var StoreFormCarDriverTicketActionTypes;
|
|
|
801
810
|
StoreFormCarDriverTicketActionTypes["FormCarDriverTrafficTicketReasonSelect"] = "FormCarDriverTrafficTicketReasonSelect";
|
|
802
811
|
StoreFormCarDriverTicketActionTypes["FormCarDriverTrafficTicketYearSelect"] = "FormCarDriverTrafficTicketYearSelect";
|
|
803
812
|
StoreFormCarDriverTicketActionTypes["FormCarDriverTrafficTicketMonthSelect"] = "FormCarDriverTrafficTicketMonthSelect";
|
|
813
|
+
StoreFormCarDriverTicketActionTypes["FormCarDriverTrafficTicketSpeedSelect"] = "FormCarDriverTrafficTicketSpeedSelect";
|
|
804
814
|
StoreFormCarDriverTicketActionTypes["FormCarDriverTrafficTicketAdd"] = "FormCarDriverTrafficTicketAdd";
|
|
805
815
|
StoreFormCarDriverTicketActionTypes["FormCarDriverTrafficTicketDelete"] = "FormCarDriverTrafficTicketDelete";
|
|
806
816
|
})(StoreFormCarDriverTicketActionTypes || (StoreFormCarDriverTicketActionTypes = {}));
|
|
@@ -900,6 +910,10 @@ const driverItemInitialState = {
|
|
|
900
910
|
listedMonth: '',
|
|
901
911
|
insured: true,
|
|
902
912
|
insuredDate: '',
|
|
913
|
+
notCurrentlyInsured: false,
|
|
914
|
+
lastPolicyEndYear: '',
|
|
915
|
+
lastPolicyEndMonth: '',
|
|
916
|
+
lastPolicyCancelReason: '',
|
|
903
917
|
insuranceCancellation: false,
|
|
904
918
|
insuranceCancellationList: [{ ...driverCancellationItemInitialState }],
|
|
905
919
|
licenceSuspension: false,
|
|
@@ -1060,37 +1074,32 @@ const setDriverLicenceInfoDate = (state, type, payload) => {
|
|
|
1060
1074
|
const { licenceType } = newState.items[newState.activeIndex].licenceInfo;
|
|
1061
1075
|
const { birthDay } = newState.items[newState.activeIndex];
|
|
1062
1076
|
const currentDate = getFormattedDate('', 'yyyy-MM-dd');
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
minMaxDates.gTwoMax = currentDate;
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1077
|
+
// When the picker explicitly targets a different slot (e.g. G1 driver entering G2/G date),
|
|
1078
|
+
// write to that slot rather than the store's current licenceType.
|
|
1079
|
+
const targetSlot = currentLicenceType && currentLicenceType !== licenceType
|
|
1080
|
+
? currentLicenceType
|
|
1081
|
+
: licenceType;
|
|
1082
|
+
switch (type) {
|
|
1083
|
+
case DateTypes.Year:
|
|
1084
|
+
newState.items[newState.activeIndex].licenceInfo[`${targetSlot}LicenceYear`] = value;
|
|
1085
|
+
break;
|
|
1086
|
+
case DateTypes.Month:
|
|
1087
|
+
newState.items[newState.activeIndex].licenceInfo[`${targetSlot}LicenceMonth`] = value;
|
|
1088
|
+
break;
|
|
1078
1089
|
}
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
break;
|
|
1084
|
-
case DateTypes.Month:
|
|
1085
|
-
newState.items[newState.activeIndex].licenceInfo.g2LicenceMonth = value;
|
|
1086
|
-
break;
|
|
1090
|
+
if (targetSlot === DriverLicenceTypes.G2) {
|
|
1091
|
+
const { minMaxDates } = newState.items[newState.activeIndex];
|
|
1092
|
+
if (minMaxDates) {
|
|
1093
|
+
minMaxDates.gTwoMax = currentDate;
|
|
1087
1094
|
}
|
|
1095
|
+
}
|
|
1096
|
+
// Non-Ontario G driver entering G2 date: recompute the G min date (existing behaviour).
|
|
1097
|
+
if (licenceType === DriverLicenceTypes.G && targetSlot === DriverLicenceTypes.G2) {
|
|
1088
1098
|
const { g2LicenceMonth, g2LicenceYear } = newState.items[newState.activeIndex].licenceInfo;
|
|
1089
1099
|
if (g2LicenceMonth && g2LicenceYear && config) {
|
|
1090
1100
|
const g2Date = addDaysToDate(`${g2LicenceYear}-${g2LicenceMonth}-01`, birthDay ? +birthDay + 1 : 1);
|
|
1091
1101
|
const gMinDefaultDate = getLicenceMinDate(licenceType, g2Date, config);
|
|
1092
|
-
const gMinDate = compareDates(gMinDefaultDate, currentDate) > 0
|
|
1093
|
-
? currentDate : gMinDefaultDate;
|
|
1102
|
+
const gMinDate = compareDates(gMinDefaultDate, currentDate) > 0 ? currentDate : gMinDefaultDate;
|
|
1094
1103
|
const { minMaxDates } = newState.items[newState.activeIndex];
|
|
1095
1104
|
if (minMaxDates) {
|
|
1096
1105
|
minMaxDates.gMin = gMinDate;
|
|
@@ -1344,6 +1353,14 @@ const formCarDriverInsuranceStateReducer = (state = { ...carFormDriverInitialSta
|
|
|
1344
1353
|
return setLocalDrivers(action?.localIndex, setDriverItemProperty(state, 'insured', action.payload.insured));
|
|
1345
1354
|
case StoreFormCarDriverInsuranceActionTypes.FormCarDriverInsuredDateSelect:
|
|
1346
1355
|
return setLocalDrivers(action?.localIndex, setDriverItemProperty(state, 'insuredDate', action.payload.insuredDate));
|
|
1356
|
+
case StoreFormCarDriverInsuranceActionTypes.FormCarDriverNotCurrentlyInsuredSelect:
|
|
1357
|
+
return setLocalDrivers(action?.localIndex, setDriverItemProperty(state, 'notCurrentlyInsured', action.payload.notCurrentlyInsured));
|
|
1358
|
+
case StoreFormCarDriverInsuranceActionTypes.FormCarDriverLastPolicyEndYearSelect:
|
|
1359
|
+
return setLocalDrivers(action?.localIndex, setDriverItemProperty(state, 'lastPolicyEndYear', action.payload.lastPolicyEndYear));
|
|
1360
|
+
case StoreFormCarDriverInsuranceActionTypes.FormCarDriverLastPolicyEndMonthSelect:
|
|
1361
|
+
return setLocalDrivers(action?.localIndex, setDriverItemProperty(state, 'lastPolicyEndMonth', action.payload.lastPolicyEndMonth));
|
|
1362
|
+
case StoreFormCarDriverInsuranceActionTypes.FormCarDriverLastPolicyCancelReasonSelect:
|
|
1363
|
+
return setLocalDrivers(action?.localIndex, setDriverItemProperty(state, 'lastPolicyCancelReason', action.payload.lastPolicyCancelReason));
|
|
1347
1364
|
default:
|
|
1348
1365
|
return state;
|
|
1349
1366
|
}
|
|
@@ -1363,6 +1380,10 @@ const formCarDriverLicenceStateReducer = (state = { ...carFormDriverInitialState
|
|
|
1363
1380
|
return setLocalDrivers(action?.localIndex, setDriverLicenceInfo(state, 'passedDriverTraining', action.payload.training));
|
|
1364
1381
|
case StoreFormCarDriverLicenceActionTypes.FormCarDriverPreviousLicenceSelect:
|
|
1365
1382
|
return setLocalDrivers(action?.localIndex, setDriverLicenceInfo(state, 'previousLicence', action.payload.previousLicence));
|
|
1383
|
+
case StoreFormCarDriverLicenceActionTypes.FormCarDriverReceivedG2Select:
|
|
1384
|
+
return setLocalDrivers(action?.localIndex, setDriverLicenceInfo(state, 'receivedG2', action.payload.receivedG2));
|
|
1385
|
+
case StoreFormCarDriverLicenceActionTypes.FormCarDriverReceivedGSelect:
|
|
1386
|
+
return setLocalDrivers(action?.localIndex, setDriverLicenceInfo(state, 'receivedG', action.payload.receivedG));
|
|
1366
1387
|
case StoreFormCarDriverLicenceActionTypes.FormCarDriverGLicenceMinSelect:
|
|
1367
1388
|
return setLocalDrivers(action?.localIndex, setDriverLicenceMinMaxDates(state, 'gMin', action.payload.gMin));
|
|
1368
1389
|
case StoreFormCarDriverLicenceActionTypes.FormCarDriverG1LicenceMinSelect:
|
|
@@ -1457,6 +1478,8 @@ const formCarDriverTicketStateReducer = (state = { ...carFormDriverInitialState
|
|
|
1457
1478
|
return setLocalDrivers(action?.localIndex, setDriverListItemProperty(state, 'ticketList', action.payload.index, 'ticketYear', action.payload.ticketYear));
|
|
1458
1479
|
case StoreFormCarDriverTicketActionTypes.FormCarDriverTrafficTicketMonthSelect:
|
|
1459
1480
|
return setLocalDrivers(action?.localIndex, setDriverListItemProperty(state, 'ticketList', action.payload.index, 'ticketMonth', action.payload.ticketMonth));
|
|
1481
|
+
case StoreFormCarDriverTicketActionTypes.FormCarDriverTrafficTicketSpeedSelect:
|
|
1482
|
+
return setLocalDrivers(action?.localIndex, setDriverListItemProperty(state, 'ticketList', action.payload.index, 'speed', action.payload.speed));
|
|
1460
1483
|
default:
|
|
1461
1484
|
return state;
|
|
1462
1485
|
}
|
|
@@ -1850,6 +1873,7 @@ const discountQuoterInfoInitialState = {
|
|
|
1850
1873
|
firstName: '',
|
|
1851
1874
|
lastName: '',
|
|
1852
1875
|
phone: '',
|
|
1876
|
+
phoneStatus: ValidationStatusTypes.Initial,
|
|
1853
1877
|
recalculate: false,
|
|
1854
1878
|
utmSource: '',
|
|
1855
1879
|
utmCampaign: '',
|
|
@@ -1880,6 +1904,7 @@ const formCarDiscountStateInitialState = {
|
|
|
1880
1904
|
priority: DriverPriorityTypes.Prn,
|
|
1881
1905
|
vehicleIndex: 0,
|
|
1882
1906
|
}],
|
|
1907
|
+
occVehlinks: [],
|
|
1883
1908
|
inValidation: false,
|
|
1884
1909
|
isValid: false,
|
|
1885
1910
|
};
|
|
@@ -1897,10 +1922,12 @@ var StoreFormCarDiscountActionTypes;
|
|
|
1897
1922
|
StoreFormCarDiscountActionTypes["FormCarDiscountQuoterFirstNameSet"] = "FormCarDiscountQuoterFirstNameSet";
|
|
1898
1923
|
StoreFormCarDiscountActionTypes["FormCarDiscountQuoterLastNameSet"] = "FormCarDiscountQuoterLastNameSet";
|
|
1899
1924
|
StoreFormCarDiscountActionTypes["FormCarDiscountQuoterPhoneSet"] = "FormCarDiscountQuoterPhoneSet";
|
|
1925
|
+
StoreFormCarDiscountActionTypes["FormCarDiscountQuoterPhoneStatusSet"] = "FormCarDiscountQuoterPhoneStatusSet";
|
|
1900
1926
|
StoreFormCarDiscountActionTypes["FormCarDiscountVehlinkAdd"] = "FormCarDiscountVehlinkAdd";
|
|
1901
1927
|
StoreFormCarDiscountActionTypes["FormCarDiscountVehlinkSelect"] = "FormCarDiscountVehlinkSelect";
|
|
1902
1928
|
StoreFormCarDiscountActionTypes["FormCarDiscountVehlinkByVehicleDelete"] = "FormCarDiscountVehlinkByVehicleDelete";
|
|
1903
1929
|
StoreFormCarDiscountActionTypes["FormCarDiscountVehlinkByDriverDelete"] = "FormCarDiscountVehlinkByDriverDelete";
|
|
1930
|
+
StoreFormCarDiscountActionTypes["FormCarDiscountOccVehlinkSelect"] = "FormCarDiscountOccVehlinkSelect";
|
|
1904
1931
|
StoreFormCarDiscountActionTypes["FormCarDiscountQuoterEmailStatusSet"] = "FormCarDiscountQuoterEmailStatusSet";
|
|
1905
1932
|
StoreFormCarDiscountActionTypes["FormCarDiscountValidate"] = "FormCarDiscountValidate";
|
|
1906
1933
|
StoreFormCarDiscountActionTypes["FormCarDiscountValidateSet"] = "FormCarDiscountValidateSet";
|
|
@@ -2018,6 +2045,14 @@ const formCarDiscountStateReducer = (state = { ...formCarDiscountStateInitialSta
|
|
|
2018
2045
|
return setLocalDiscounts$1(action.localIndex, deleteVehlinkByDriver(state, action.payload.driverIndex));
|
|
2019
2046
|
case StoreFormCarDiscountActionTypes.FormCarDiscountVehlinkSelect:
|
|
2020
2047
|
return setLocalDiscounts$1(action.localIndex, selectDriverForVehicle(state, action.payload.driverIndex, action.payload.vehicleIndex));
|
|
2048
|
+
case StoreFormCarDiscountActionTypes.FormCarDiscountOccVehlinkSelect: {
|
|
2049
|
+
const { driverIndex, vehicleIndex } = action.payload;
|
|
2050
|
+
const filtered = state.occVehlinks.filter((l) => l.driverIndex !== driverIndex);
|
|
2051
|
+
const updated = vehicleIndex >= 0
|
|
2052
|
+
? [...filtered, { driverIndex, vehicleIndex }]
|
|
2053
|
+
: filtered;
|
|
2054
|
+
return setLocalDiscounts$1(action.localIndex, { ...state, occVehlinks: updated });
|
|
2055
|
+
}
|
|
2021
2056
|
case StoreFormCarDiscountActionTypes.FormCarDiscountMultiplePoliciesSelect:
|
|
2022
2057
|
return setLocalDiscounts$1(action.localIndex, setDiscountStateProperty(state, 'multiplePoliciesDiscount', action.payload.multiplePoliciesDiscount));
|
|
2023
2058
|
case StoreFormCarDiscountActionTypes.FormCarDiscountCaaMemberSelect:
|
|
@@ -2038,6 +2073,10 @@ const formCarDiscountStateReducer = (state = { ...formCarDiscountStateInitialSta
|
|
|
2038
2073
|
return setLocalDiscounts$1(action.localIndex, setDiscountQuoterProperty(state, 'lastName', action.payload.lastName));
|
|
2039
2074
|
case StoreFormCarDiscountActionTypes.FormCarDiscountQuoterPhoneSet:
|
|
2040
2075
|
return setLocalDiscounts$1(action.localIndex, setDiscountQuoterProperty(state, 'phone', action.payload.phone));
|
|
2076
|
+
case StoreFormCarDiscountActionTypes.FormCarDiscountQuoterPhoneStatusSet: {
|
|
2077
|
+
const phoneState = setDiscountQuoterProperty(state, 'phone', action.payload.phone);
|
|
2078
|
+
return setLocalDiscounts$1(action.localIndex, setDiscountQuoterProperty(phoneState, 'phoneStatus', action.payload.phoneStatus));
|
|
2079
|
+
}
|
|
2041
2080
|
case StoreFormCarDiscountActionTypes.FormCarDiscountQuoterUtmSourceSet:
|
|
2042
2081
|
return setLocalDiscounts$1(action.localIndex, setDiscountQuoterProperty(state, 'utmSource', action.payload.utmSource));
|
|
2043
2082
|
case StoreFormCarDiscountActionTypes.FormCarDiscountQuoterUtmCampaignSet:
|
|
@@ -2852,6 +2891,7 @@ const formHomeDiscountStateInitialState = {
|
|
|
2852
2891
|
firstName: '',
|
|
2853
2892
|
lastName: '',
|
|
2854
2893
|
phone: '',
|
|
2894
|
+
phoneStatus: ValidationStatusTypes.Initial,
|
|
2855
2895
|
recalculate: false,
|
|
2856
2896
|
utmCampaign: '',
|
|
2857
2897
|
utmSource: '',
|
|
@@ -2887,6 +2927,7 @@ var StoreFormHomeDiscountActionTypes;
|
|
|
2887
2927
|
StoreFormHomeDiscountActionTypes["FormHomeQuoterFirstNameSet"] = "FormHomeQuoterFirstNameSet";
|
|
2888
2928
|
StoreFormHomeDiscountActionTypes["FormHomeQuoterLastNameSet"] = "FormHomeQuoterLastNameSet";
|
|
2889
2929
|
StoreFormHomeDiscountActionTypes["FormHomeQuoterPhoneSet"] = "FormHomeQuoterPhoneSet";
|
|
2930
|
+
StoreFormHomeDiscountActionTypes["FormHomeQuoterPhoneStatusSet"] = "FormHomeQuoterPhoneStatusSet";
|
|
2890
2931
|
StoreFormHomeDiscountActionTypes["FormHomeUtmCampaignSet"] = "FormHomeUtmCampaignSet";
|
|
2891
2932
|
StoreFormHomeDiscountActionTypes["FormHomeUtmSourceSet"] = "FormHomeUtmSourceSet";
|
|
2892
2933
|
StoreFormHomeDiscountActionTypes["FormHomeUtmProducerSet"] = "FormHomeUtmProducerSet";
|
|
@@ -2947,6 +2988,11 @@ const formHomeDiscountStateReducer = (state = { ...formHomeDiscountStateInitialS
|
|
|
2947
2988
|
return setLocalDiscounts(action.localIndex, setStateProperty(state, 'lastName', action.payload.lastName, 'quoterInfo'));
|
|
2948
2989
|
case StoreFormHomeDiscountActionTypes.FormHomeQuoterPhoneSet:
|
|
2949
2990
|
return setLocalDiscounts(action.localIndex, setStateProperty(state, 'phone', action.payload.phone, 'quoterInfo'));
|
|
2991
|
+
case StoreFormHomeDiscountActionTypes.FormHomeQuoterPhoneStatusSet:
|
|
2992
|
+
return setLocalDiscounts(action.localIndex, {
|
|
2993
|
+
...state,
|
|
2994
|
+
quoterInfo: { ...state.quoterInfo, ...{ phone: action.payload.phone, phoneStatus: action.payload.phoneStatus } },
|
|
2995
|
+
});
|
|
2950
2996
|
case StoreFormHomeDiscountActionTypes.FormHomeUtmSourceSet:
|
|
2951
2997
|
return setLocalDiscounts(action.localIndex, setStateProperty(state, 'utmSource', action.payload.utmSource, 'quoterInfo'));
|
|
2952
2998
|
case StoreFormHomeDiscountActionTypes.FormHomeUtmCampaignSet:
|
|
@@ -3103,6 +3149,7 @@ const lifeFormApplicantInitialState = {
|
|
|
3103
3149
|
firstName: '',
|
|
3104
3150
|
lastName: '',
|
|
3105
3151
|
phone: '',
|
|
3152
|
+
phoneStatus: ValidationStatusTypes.Initial,
|
|
3106
3153
|
recalculate: false,
|
|
3107
3154
|
utmCampaign: '',
|
|
3108
3155
|
utmSource: '',
|
|
@@ -3138,6 +3185,7 @@ var StoreFormLifeApplicantActionTypes;
|
|
|
3138
3185
|
StoreFormLifeApplicantActionTypes["FormLifeQuoterFirstNameSet"] = "FormLifeQuoterFirstNameSet";
|
|
3139
3186
|
StoreFormLifeApplicantActionTypes["FormLifeQuoterLastNameSet"] = "FormLifeQuoterLastNameSet";
|
|
3140
3187
|
StoreFormLifeApplicantActionTypes["FormLifeQuoterPhoneSet"] = "FormLifeQuoterPhoneSet";
|
|
3188
|
+
StoreFormLifeApplicantActionTypes["FormLifeQuoterPhoneStatusSet"] = "FormLifeQuoterPhoneStatusSet";
|
|
3141
3189
|
StoreFormLifeApplicantActionTypes["FormLifeUtmCampaignSet"] = "FormLifeUtmCampaignSet";
|
|
3142
3190
|
StoreFormLifeApplicantActionTypes["FormLifeUtmSourceSet"] = "FormLifeUtmSourceSet";
|
|
3143
3191
|
StoreFormLifeApplicantActionTypes["FormLifeUtmProducerSet"] = "FormLifeUtmProducerSet";
|
|
@@ -3174,6 +3222,11 @@ const formLifeApplicantStateReducer = (state = { ...lifeFormApplicantInitialStat
|
|
|
3174
3222
|
return setLocalApplicant(action?.localIndex, setStateProperty(state, 'lastName', action.payload.lastName, 'quoterInfo'));
|
|
3175
3223
|
case StoreFormLifeApplicantActionTypes.FormLifeQuoterPhoneSet:
|
|
3176
3224
|
return setLocalApplicant(action?.localIndex, setStateProperty(state, 'phone', action.payload.phone, 'quoterInfo'));
|
|
3225
|
+
case StoreFormLifeApplicantActionTypes.FormLifeQuoterPhoneStatusSet:
|
|
3226
|
+
return setLocalApplicant(action?.localIndex, {
|
|
3227
|
+
...state,
|
|
3228
|
+
quoterInfo: { ...state.quoterInfo, ...{ phone: action.payload.phone, phoneStatus: action.payload.phoneStatus } },
|
|
3229
|
+
});
|
|
3177
3230
|
case StoreFormLifeApplicantActionTypes.FormLifeUtmSourceSet:
|
|
3178
3231
|
return setLocalApplicant(action?.localIndex, setStateProperty(state, 'utmSource', action.payload.utmSource, 'quoterInfo'));
|
|
3179
3232
|
case StoreFormLifeApplicantActionTypes.FormLifeUtmCampaignSet:
|
|
@@ -5051,6 +5104,190 @@ const useHandlerLifeQuoterEmail = () => {
|
|
|
5051
5104
|
};
|
|
5052
5105
|
};
|
|
5053
5106
|
|
|
5107
|
+
const useHandlerCarQuoterPhone = () => {
|
|
5108
|
+
const [requestState, setRequestState] = useReducer(dataHandlerReducer, {
|
|
5109
|
+
...initialHandlerRequestState,
|
|
5110
|
+
});
|
|
5111
|
+
const { dispatchDiscountState } = useStoreFormCarDiscount();
|
|
5112
|
+
const { cancelToken } = useCancelToken();
|
|
5113
|
+
const { status, successMessage, responseData, errorMessage, isFirstRequest, responseError, } = requestState;
|
|
5114
|
+
const validatePhone = async (phone) => {
|
|
5115
|
+
dispatchDiscountState({
|
|
5116
|
+
type: StoreFormCarDiscountActionTypes.FormCarDiscountQuoterPhoneStatusSet,
|
|
5117
|
+
payload: {
|
|
5118
|
+
phone,
|
|
5119
|
+
phoneStatus: ValidationStatusTypes.Loading,
|
|
5120
|
+
},
|
|
5121
|
+
});
|
|
5122
|
+
if (phone) {
|
|
5123
|
+
try {
|
|
5124
|
+
const response = await httpRequest({
|
|
5125
|
+
url: `${API_AUTH.GET_PHONE_VALIDATION}?phone=${encodeURIComponent(phone)}`,
|
|
5126
|
+
method: RequestTypes.Get,
|
|
5127
|
+
withoutToken: true,
|
|
5128
|
+
cancelToken,
|
|
5129
|
+
});
|
|
5130
|
+
if (response.data.valid) {
|
|
5131
|
+
dispatchDiscountState({
|
|
5132
|
+
type: StoreFormCarDiscountActionTypes.FormCarDiscountQuoterPhoneStatusSet,
|
|
5133
|
+
payload: {
|
|
5134
|
+
phone,
|
|
5135
|
+
phoneStatus: ValidationStatusTypes.Approved,
|
|
5136
|
+
},
|
|
5137
|
+
});
|
|
5138
|
+
}
|
|
5139
|
+
else {
|
|
5140
|
+
dispatchDiscountState({
|
|
5141
|
+
type: StoreFormCarDiscountActionTypes.FormCarDiscountQuoterPhoneStatusSet,
|
|
5142
|
+
payload: {
|
|
5143
|
+
phone,
|
|
5144
|
+
phoneStatus: ValidationStatusTypes.Declined,
|
|
5145
|
+
},
|
|
5146
|
+
});
|
|
5147
|
+
setRequestState({ type: DataHandlerActionTypes.SetError, payload: 'Enter a valid phone number.' });
|
|
5148
|
+
}
|
|
5149
|
+
}
|
|
5150
|
+
catch (error) {
|
|
5151
|
+
dispatchDiscountState({
|
|
5152
|
+
type: StoreFormCarDiscountActionTypes.FormCarDiscountQuoterPhoneStatusSet,
|
|
5153
|
+
payload: {
|
|
5154
|
+
phone,
|
|
5155
|
+
phoneStatus: ValidationStatusTypes.Declined,
|
|
5156
|
+
},
|
|
5157
|
+
});
|
|
5158
|
+
setRequestState({ type: DataHandlerActionTypes.SetError, payload: 'Enter a valid phone number.' });
|
|
5159
|
+
}
|
|
5160
|
+
}
|
|
5161
|
+
else {
|
|
5162
|
+
dispatchDiscountState({
|
|
5163
|
+
type: StoreFormCarDiscountActionTypes.FormCarDiscountQuoterPhoneStatusSet,
|
|
5164
|
+
payload: {
|
|
5165
|
+
phone,
|
|
5166
|
+
phoneStatus: ValidationStatusTypes.Declined,
|
|
5167
|
+
},
|
|
5168
|
+
});
|
|
5169
|
+
setRequestState({ type: DataHandlerActionTypes.SetError, payload: 'This field may not be blank.' });
|
|
5170
|
+
}
|
|
5171
|
+
};
|
|
5172
|
+
return {
|
|
5173
|
+
status,
|
|
5174
|
+
validatePhone,
|
|
5175
|
+
successMessage,
|
|
5176
|
+
responseData,
|
|
5177
|
+
errorMessage,
|
|
5178
|
+
isFirstRequest,
|
|
5179
|
+
responseError,
|
|
5180
|
+
};
|
|
5181
|
+
};
|
|
5182
|
+
const useHandlerHomeQuoterPhone = () => {
|
|
5183
|
+
const [requestState, setRequestState] = useReducer(dataHandlerReducer, {
|
|
5184
|
+
...initialHandlerRequestState,
|
|
5185
|
+
});
|
|
5186
|
+
const { dispatchDiscountState } = useStoreFormHomeDiscount();
|
|
5187
|
+
const { cancelToken } = useCancelToken();
|
|
5188
|
+
const { status, successMessage, responseData, errorMessage, isFirstRequest, responseError, } = requestState;
|
|
5189
|
+
const validatePhone = async (phone) => {
|
|
5190
|
+
dispatchDiscountState({
|
|
5191
|
+
type: StoreFormHomeDiscountActionTypes.FormHomeQuoterPhoneStatusSet,
|
|
5192
|
+
payload: { phone, phoneStatus: ValidationStatusTypes.Loading },
|
|
5193
|
+
});
|
|
5194
|
+
if (phone) {
|
|
5195
|
+
try {
|
|
5196
|
+
const response = await httpRequest({
|
|
5197
|
+
url: `${API_AUTH.GET_PHONE_VALIDATION}?phone=${encodeURIComponent(phone)}`,
|
|
5198
|
+
method: RequestTypes.Get,
|
|
5199
|
+
withoutToken: true,
|
|
5200
|
+
cancelToken,
|
|
5201
|
+
});
|
|
5202
|
+
if (response.data.valid) {
|
|
5203
|
+
dispatchDiscountState({
|
|
5204
|
+
type: StoreFormHomeDiscountActionTypes.FormHomeQuoterPhoneStatusSet,
|
|
5205
|
+
payload: { phone, phoneStatus: ValidationStatusTypes.Approved },
|
|
5206
|
+
});
|
|
5207
|
+
}
|
|
5208
|
+
else {
|
|
5209
|
+
dispatchDiscountState({
|
|
5210
|
+
type: StoreFormHomeDiscountActionTypes.FormHomeQuoterPhoneStatusSet,
|
|
5211
|
+
payload: { phone, phoneStatus: ValidationStatusTypes.Declined },
|
|
5212
|
+
});
|
|
5213
|
+
setRequestState({ type: DataHandlerActionTypes.SetError, payload: 'Enter a valid phone number.' });
|
|
5214
|
+
}
|
|
5215
|
+
}
|
|
5216
|
+
catch (error) {
|
|
5217
|
+
dispatchDiscountState({
|
|
5218
|
+
type: StoreFormHomeDiscountActionTypes.FormHomeQuoterPhoneStatusSet,
|
|
5219
|
+
payload: { phone, phoneStatus: ValidationStatusTypes.Declined },
|
|
5220
|
+
});
|
|
5221
|
+
setRequestState({ type: DataHandlerActionTypes.SetError, payload: 'Enter a valid phone number.' });
|
|
5222
|
+
}
|
|
5223
|
+
}
|
|
5224
|
+
else {
|
|
5225
|
+
dispatchDiscountState({
|
|
5226
|
+
type: StoreFormHomeDiscountActionTypes.FormHomeQuoterPhoneStatusSet,
|
|
5227
|
+
payload: { phone, phoneStatus: ValidationStatusTypes.Declined },
|
|
5228
|
+
});
|
|
5229
|
+
setRequestState({ type: DataHandlerActionTypes.SetError, payload: 'This field may not be blank.' });
|
|
5230
|
+
}
|
|
5231
|
+
};
|
|
5232
|
+
return {
|
|
5233
|
+
status, validatePhone, successMessage, responseData, errorMessage, isFirstRequest, responseError,
|
|
5234
|
+
};
|
|
5235
|
+
};
|
|
5236
|
+
const useHandlerLifeQuoterPhone = () => {
|
|
5237
|
+
const [requestState, setRequestState] = useReducer(dataHandlerReducer, {
|
|
5238
|
+
...initialHandlerRequestState,
|
|
5239
|
+
});
|
|
5240
|
+
const { dispatchApplicantState } = useStoreFormLifeApplicant();
|
|
5241
|
+
const { cancelToken } = useCancelToken();
|
|
5242
|
+
const { status, successMessage, responseData, errorMessage, isFirstRequest, responseError, } = requestState;
|
|
5243
|
+
const validatePhone = async (phone) => {
|
|
5244
|
+
dispatchApplicantState({
|
|
5245
|
+
type: StoreFormLifeApplicantActionTypes.FormLifeQuoterPhoneStatusSet,
|
|
5246
|
+
payload: { phone, phoneStatus: ValidationStatusTypes.Loading },
|
|
5247
|
+
});
|
|
5248
|
+
if (phone) {
|
|
5249
|
+
try {
|
|
5250
|
+
const response = await httpRequest({
|
|
5251
|
+
url: `${API_AUTH.GET_PHONE_VALIDATION}?phone=${encodeURIComponent(phone)}`,
|
|
5252
|
+
method: RequestTypes.Get,
|
|
5253
|
+
withoutToken: true,
|
|
5254
|
+
cancelToken,
|
|
5255
|
+
});
|
|
5256
|
+
if (response.data.valid) {
|
|
5257
|
+
dispatchApplicantState({
|
|
5258
|
+
type: StoreFormLifeApplicantActionTypes.FormLifeQuoterPhoneStatusSet,
|
|
5259
|
+
payload: { phone, phoneStatus: ValidationStatusTypes.Approved },
|
|
5260
|
+
});
|
|
5261
|
+
}
|
|
5262
|
+
else {
|
|
5263
|
+
dispatchApplicantState({
|
|
5264
|
+
type: StoreFormLifeApplicantActionTypes.FormLifeQuoterPhoneStatusSet,
|
|
5265
|
+
payload: { phone, phoneStatus: ValidationStatusTypes.Declined },
|
|
5266
|
+
});
|
|
5267
|
+
setRequestState({ type: DataHandlerActionTypes.SetError, payload: 'Enter a valid phone number.' });
|
|
5268
|
+
}
|
|
5269
|
+
}
|
|
5270
|
+
catch (error) {
|
|
5271
|
+
dispatchApplicantState({
|
|
5272
|
+
type: StoreFormLifeApplicantActionTypes.FormLifeQuoterPhoneStatusSet,
|
|
5273
|
+
payload: { phone, phoneStatus: ValidationStatusTypes.Declined },
|
|
5274
|
+
});
|
|
5275
|
+
setRequestState({ type: DataHandlerActionTypes.SetError, payload: 'Enter a valid phone number.' });
|
|
5276
|
+
}
|
|
5277
|
+
}
|
|
5278
|
+
else {
|
|
5279
|
+
dispatchApplicantState({
|
|
5280
|
+
type: StoreFormLifeApplicantActionTypes.FormLifeQuoterPhoneStatusSet,
|
|
5281
|
+
payload: { phone, phoneStatus: ValidationStatusTypes.Declined },
|
|
5282
|
+
});
|
|
5283
|
+
setRequestState({ type: DataHandlerActionTypes.SetError, payload: 'This field may not be blank.' });
|
|
5284
|
+
}
|
|
5285
|
+
};
|
|
5286
|
+
return {
|
|
5287
|
+
status, validatePhone, successMessage, responseData, errorMessage, isFirstRequest, responseError,
|
|
5288
|
+
};
|
|
5289
|
+
};
|
|
5290
|
+
|
|
5054
5291
|
const CarQuoteDataHandler = () => {
|
|
5055
5292
|
const { configState } = useStoreFormCarConfig();
|
|
5056
5293
|
const { vehicleState } = useStoreFormCarVehicle();
|
|
@@ -5148,9 +5385,6 @@ const CarQuoteDataHandler = () => {
|
|
|
5148
5385
|
if (driver.applicantRelationship === '') {
|
|
5149
5386
|
delete driver.applicantRelationship;
|
|
5150
5387
|
}
|
|
5151
|
-
if (driver.gender === GenderTypes.Other) {
|
|
5152
|
-
driver.gender = GenderTypes.Male;
|
|
5153
|
-
}
|
|
5154
5388
|
// ==================================
|
|
5155
5389
|
// thebig additional properties
|
|
5156
5390
|
if (appConfigState.appType === AppTypes.TheBig) {
|
|
@@ -5202,9 +5436,20 @@ const CarQuoteDataHandler = () => {
|
|
|
5202
5436
|
delete driver.insuredYear;
|
|
5203
5437
|
delete driver.insuredDate;
|
|
5204
5438
|
}
|
|
5439
|
+
// "Not currently insured": build the open-ended lapse incident.
|
|
5440
|
+
// IncidentDate uses the selected month/year with the day defaulted to the 1st (History 1-4).
|
|
5441
|
+
if (driver.notCurrentlyInsured && driver.lastPolicyEndYear && driver.lastPolicyEndMonth) {
|
|
5442
|
+
driver.lastPolicyEndDate = addDayToDate(`${driver.lastPolicyEndYear}-${driver.lastPolicyEndMonth}`, 1);
|
|
5443
|
+
}
|
|
5444
|
+
else {
|
|
5445
|
+
driver.notCurrentlyInsured = false;
|
|
5446
|
+
delete driver.lastPolicyEndDate;
|
|
5447
|
+
delete driver.lastPolicyCancelReason;
|
|
5448
|
+
}
|
|
5449
|
+
delete driver.lastPolicyEndYear;
|
|
5450
|
+
delete driver.lastPolicyEndMonth;
|
|
5205
5451
|
const defaultMinDate = driver.dateOfBirth && driver.licenceInfo.firstLicenceAge
|
|
5206
|
-
? addYearsToDate(driver.dateOfBirth, +driver.licenceInfo.firstLicenceAge)
|
|
5207
|
-
: '';
|
|
5452
|
+
? addYearsToDate(driver.dateOfBirth, +driver.licenceInfo.firstLicenceAge) : '';
|
|
5208
5453
|
const isOnlyG = compareDates(defaultMinDate, configState.minDates.g.specialDate) < 0;
|
|
5209
5454
|
// licence
|
|
5210
5455
|
const deleteLicenceDates = () => {
|
|
@@ -5215,8 +5460,73 @@ const CarQuoteDataHandler = () => {
|
|
|
5215
5460
|
delete driver.licenceInfo.g2LicenceYear;
|
|
5216
5461
|
delete driver.licenceInfo.g2LicenceMonth;
|
|
5217
5462
|
};
|
|
5218
|
-
const { g1LicenceMonth, g1LicenceYear, g2LicenceMonth, g2LicenceYear, gLicenceYear, gLicenceMonth } = licenceInfo;
|
|
5219
|
-
|
|
5463
|
+
const { g1LicenceMonth, g1LicenceYear, g2LicenceMonth, g2LicenceYear, gLicenceYear, gLicenceMonth, } = licenceInfo;
|
|
5464
|
+
const isOntarioMyChoiceLicence = requestBody.provinceCode === 'ON' && isMyChoiceLike(appConfigState.appType);
|
|
5465
|
+
if (isOntarioMyChoiceLicence) {
|
|
5466
|
+
// Ontario new flow: licenceType = first class received (Q2).
|
|
5467
|
+
// receivedG2/receivedG flags determine the full progression.
|
|
5468
|
+
// Q1 date is stored in the slot matching licenceType.
|
|
5469
|
+
const { receivedG2, receivedG } = driver.licenceInfo;
|
|
5470
|
+
const firstClass = driver.licenceInfo.licenceType;
|
|
5471
|
+
// isOnlyG must use the actual Q1 date the user entered, not DOB+firstLicenceAge.
|
|
5472
|
+
// DOB+16 can predate 1994 for older drivers (e.g. born 1966 → 1982), which falsely
|
|
5473
|
+
// triggers the G-Full path even when the user's actual first licence is much later.
|
|
5474
|
+
const getOntarioQ1Slot = () => {
|
|
5475
|
+
if (firstClass === DriverLicenceTypes.G2)
|
|
5476
|
+
return { year: g2LicenceYear, month: g2LicenceMonth };
|
|
5477
|
+
if (firstClass === DriverLicenceTypes.G)
|
|
5478
|
+
return { year: gLicenceYear, month: gLicenceMonth };
|
|
5479
|
+
return { year: g1LicenceYear, month: g1LicenceMonth };
|
|
5480
|
+
};
|
|
5481
|
+
const { year: ontarioQ1Year, month: ontarioQ1Month } = getOntarioQ1Slot();
|
|
5482
|
+
const ontarioQ1DateStr = ontarioQ1Year && ontarioQ1Month
|
|
5483
|
+
? `${ontarioQ1Year}-${ontarioQ1Month}-01` : '';
|
|
5484
|
+
const ontarioIsOnlyG = !!ontarioQ1DateStr
|
|
5485
|
+
&& compareDates(configState.minDates.g.specialDate, ontarioQ1DateStr) >= 0;
|
|
5486
|
+
// Determine which dates to send and final licence_type for the API.
|
|
5487
|
+
// The backend always requires g1_licence_date as the first licence date.
|
|
5488
|
+
if (ontarioIsOnlyG || firstClass === DriverLicenceTypes.G) {
|
|
5489
|
+
// G Full path: Q1 date is in gLicenceYear/Month slot
|
|
5490
|
+
driver.licenceInfo.gLicenceDate = addDayToDate(`${gLicenceYear}-${gLicenceMonth}`, +birthDay + 1);
|
|
5491
|
+
driver.licenceInfo.licenceType = DriverLicenceTypes.G;
|
|
5492
|
+
delete driver.licenceInfo.passedDriverTraining;
|
|
5493
|
+
}
|
|
5494
|
+
else if (firstClass === DriverLicenceTypes.G1) {
|
|
5495
|
+
// G1 path: Q1 date is in g1LicenceYear/Month
|
|
5496
|
+
driver.licenceInfo.g1LicenceDate = addDayToDate(`${g1LicenceYear}-${g1LicenceMonth}`, +birthDay + 1);
|
|
5497
|
+
if (receivedG2) {
|
|
5498
|
+
driver.licenceInfo.g2LicenceDate = addDayToDate(`${g2LicenceYear}-${g2LicenceMonth}`, +birthDay + 1);
|
|
5499
|
+
if (receivedG) {
|
|
5500
|
+
driver.licenceInfo.gLicenceDate = addDayToDate(`${gLicenceYear}-${gLicenceMonth}`, +birthDay + 1);
|
|
5501
|
+
driver.licenceInfo.licenceType = DriverLicenceTypes.G;
|
|
5502
|
+
}
|
|
5503
|
+
else {
|
|
5504
|
+
driver.licenceInfo.licenceType = DriverLicenceTypes.G2;
|
|
5505
|
+
}
|
|
5506
|
+
}
|
|
5507
|
+
else if (receivedG) {
|
|
5508
|
+
driver.licenceInfo.gLicenceDate = addDayToDate(`${gLicenceYear}-${gLicenceMonth}`, +birthDay + 1);
|
|
5509
|
+
driver.licenceInfo.licenceType = DriverLicenceTypes.G;
|
|
5510
|
+
}
|
|
5511
|
+
else {
|
|
5512
|
+
driver.licenceInfo.licenceType = DriverLicenceTypes.G1;
|
|
5513
|
+
}
|
|
5514
|
+
}
|
|
5515
|
+
else if (firstClass === DriverLicenceTypes.G2) {
|
|
5516
|
+
// G2 path: Q1 (first licence) date is in g2LicenceYear/Month.
|
|
5517
|
+
driver.licenceInfo.g1LicenceDate = addDayToDate(`${g2LicenceYear}-${g2LicenceMonth}`, +birthDay + 1);
|
|
5518
|
+
driver.licenceInfo.g2LicenceDate = addDayToDate(`${g2LicenceYear}-${g2LicenceMonth}`, +birthDay + 1);
|
|
5519
|
+
if (receivedG) {
|
|
5520
|
+
driver.licenceInfo.gLicenceDate = addDayToDate(`${gLicenceYear}-${gLicenceMonth}`, +birthDay + 1);
|
|
5521
|
+
driver.licenceInfo.licenceType = DriverLicenceTypes.G;
|
|
5522
|
+
}
|
|
5523
|
+
else {
|
|
5524
|
+
driver.licenceInfo.licenceType = DriverLicenceTypes.G2;
|
|
5525
|
+
}
|
|
5526
|
+
}
|
|
5527
|
+
deleteLicenceDates();
|
|
5528
|
+
}
|
|
5529
|
+
else if (isOnlyG) {
|
|
5220
5530
|
if (driver.licenceInfo.licenceType === DriverLicenceTypes.G) {
|
|
5221
5531
|
driver.licenceInfo.gLicenceDate = addDayToDate(`${gLicenceYear}-${gLicenceMonth}`, +birthDay + 1);
|
|
5222
5532
|
delete driver.licenceInfo.g1LicenceDate;
|
|
@@ -5246,6 +5556,51 @@ const CarQuoteDataHandler = () => {
|
|
|
5246
5556
|
deleteLicenceDates();
|
|
5247
5557
|
}
|
|
5248
5558
|
}
|
|
5559
|
+
if (isOntarioMyChoiceLicence) {
|
|
5560
|
+
const { receivedG2, receivedG } = driver.licenceInfo;
|
|
5561
|
+
const g1Date = driver.licenceInfo.g1LicenceDate;
|
|
5562
|
+
const g2Date = driver.licenceInfo.g2LicenceDate;
|
|
5563
|
+
const gDate = driver.licenceInfo.gLicenceDate;
|
|
5564
|
+
const training = !!driver.licenceInfo.passedDriverTraining;
|
|
5565
|
+
const hasG1 = driver.licenceInfo.licenceType === DriverLicenceTypes.G1 || !!g1Date;
|
|
5566
|
+
const hasG2 = !!g2Date || receivedG2;
|
|
5567
|
+
const hasG = !!gDate || receivedG;
|
|
5568
|
+
let outside = false;
|
|
5569
|
+
if (hasG1 && hasG2 && g1Date && g2Date) {
|
|
5570
|
+
const monthsG1toG2 = getDifferenceInMonths(g2Date, g1Date);
|
|
5571
|
+
if (!training && monthsG1toG2 < 12)
|
|
5572
|
+
outside = true;
|
|
5573
|
+
if (training && monthsG1toG2 < 8)
|
|
5574
|
+
outside = true;
|
|
5575
|
+
}
|
|
5576
|
+
if (hasG1 && hasG && g1Date && gDate) {
|
|
5577
|
+
const monthsG1toG = getDifferenceInMonths(gDate, g1Date);
|
|
5578
|
+
if (!training && monthsG1toG < 24)
|
|
5579
|
+
outside = true;
|
|
5580
|
+
if (training && monthsG1toG < 20)
|
|
5581
|
+
outside = true;
|
|
5582
|
+
}
|
|
5583
|
+
if (hasG2 && hasG && g2Date && gDate) {
|
|
5584
|
+
const monthsG2toG = getDifferenceInMonths(gDate, g2Date);
|
|
5585
|
+
if (monthsG2toG < 12)
|
|
5586
|
+
outside = true;
|
|
5587
|
+
}
|
|
5588
|
+
if (receivedG2 === undefined && !!g2Date)
|
|
5589
|
+
outside = true;
|
|
5590
|
+
if (hasG1 && hasG && !hasG2)
|
|
5591
|
+
outside = true;
|
|
5592
|
+
driver.licenceInfo.outsideExp = outside;
|
|
5593
|
+
delete driver.licenceInfo.receivedG2;
|
|
5594
|
+
delete driver.licenceInfo.receivedG;
|
|
5595
|
+
// API only accepts passed_driver_training for G2 licence type
|
|
5596
|
+
if (driver.licenceInfo.licenceType !== DriverLicenceTypes.G2) {
|
|
5597
|
+
delete driver.licenceInfo.passedDriverTraining;
|
|
5598
|
+
}
|
|
5599
|
+
}
|
|
5600
|
+
else {
|
|
5601
|
+
driver.licenceInfo.outsideExp = !!driver.licenceInfo.previousLicence;
|
|
5602
|
+
}
|
|
5603
|
+
delete driver.licenceInfo.previousLicence;
|
|
5249
5604
|
delete driver.birthYear;
|
|
5250
5605
|
delete driver.birthMonth;
|
|
5251
5606
|
delete driver.birthDay;
|
|
@@ -5293,27 +5648,68 @@ const CarQuoteDataHandler = () => {
|
|
|
5293
5648
|
}
|
|
5294
5649
|
return driver;
|
|
5295
5650
|
});
|
|
5296
|
-
|
|
5651
|
+
// Build a complete set of vehlinks combining primary assignments + occasional assignments
|
|
5652
|
+
const buildVehlinks = () => {
|
|
5653
|
+
const driverCount = requestBody.drivers.length;
|
|
5654
|
+
const vehicleCount = requestBody.vehicles.length;
|
|
5655
|
+
const result = [];
|
|
5656
|
+
for (let vehicleIndex = 0; vehicleIndex < vehicleCount; vehicleIndex++) {
|
|
5657
|
+
const primaryDriverIndex = requestBody.vehlinks[vehicleIndex]?.driverIndex ?? 0;
|
|
5658
|
+
// Primary driver for this vehicle
|
|
5659
|
+
result.push({
|
|
5660
|
+
driverIndex: Number(primaryDriverIndex + 1),
|
|
5661
|
+
vehicleIndex: Number(vehicleIndex + 1),
|
|
5662
|
+
priority: DriverPriorityTypes.Prn,
|
|
5663
|
+
});
|
|
5664
|
+
if (driverCount > 1) {
|
|
5665
|
+
for (let driverIndex = 0; driverIndex < driverCount; driverIndex++) {
|
|
5666
|
+
if (driverIndex === primaryDriverIndex)
|
|
5667
|
+
continue;
|
|
5668
|
+
if (vehicleCount === 1) {
|
|
5669
|
+
// f) All non-primary drivers are occasional on the only vehicle
|
|
5670
|
+
result.push({
|
|
5671
|
+
driverIndex: Number(driverIndex + 1),
|
|
5672
|
+
vehicleIndex: Number(vehicleIndex + 1),
|
|
5673
|
+
priority: DriverPriorityTypes.Occ,
|
|
5674
|
+
});
|
|
5675
|
+
}
|
|
5676
|
+
else {
|
|
5677
|
+
// g-k) Use user-selected vehicle for extra drivers; skip if they are primary on another vehicle
|
|
5678
|
+
const isPrimaryElsewhere = requestBody.vehlinks.some((l) => l.driverIndex === driverIndex + 1 && l.vehicleIndex !== vehicleIndex);
|
|
5679
|
+
if (isPrimaryElsewhere)
|
|
5680
|
+
continue;
|
|
5681
|
+
const occAssignment = discount.occVehlinks?.find((l) => l.driverIndex === driverIndex);
|
|
5682
|
+
const occVehicleIndex = occAssignment ? occAssignment.vehicleIndex : 0;
|
|
5683
|
+
if (occVehicleIndex === vehicleIndex) {
|
|
5684
|
+
result.push({
|
|
5685
|
+
driverIndex: Number(driverIndex + 1),
|
|
5686
|
+
vehicleIndex: Number(vehicleIndex + 1),
|
|
5687
|
+
priority: DriverPriorityTypes.Occ,
|
|
5688
|
+
});
|
|
5689
|
+
}
|
|
5690
|
+
}
|
|
5691
|
+
}
|
|
5692
|
+
}
|
|
5693
|
+
}
|
|
5694
|
+
return result;
|
|
5695
|
+
};
|
|
5297
5696
|
// vehicle
|
|
5298
|
-
requestBody.vehicles = requestBody.vehicles.map((vehicleItem
|
|
5697
|
+
requestBody.vehicles = requestBody.vehicles.map((vehicleItem) => {
|
|
5299
5698
|
const vehicle = { ...vehicleItem, ...postalState.item };
|
|
5300
5699
|
if (!vehicle.redirectURL) {
|
|
5301
5700
|
delete vehicle.redirectURL;
|
|
5302
5701
|
}
|
|
5303
|
-
const vehlink = requestBody.drivers.map((_, driverIndex) => ({
|
|
5304
|
-
driverIndex: Number(driverIndex + 1),
|
|
5305
|
-
vehicleIndex: Number(vehicleIndex + 1),
|
|
5306
|
-
priority: requestBody.vehlinks[vehicleIndex].driverIndex === driverIndex
|
|
5307
|
-
? DriverPriorityTypes.Prn
|
|
5308
|
-
: DriverPriorityTypes.Occ,
|
|
5309
|
-
}));
|
|
5310
|
-
localVehlinks.push(...vehlink);
|
|
5311
5702
|
vehicle.purchaseDate = addDayToDate(`${vehicle.purchaseYear}-${vehicle.purchaseMonth}`);
|
|
5312
5703
|
delete vehicle.purchaseYear;
|
|
5313
5704
|
delete vehicle.purchaseMonth;
|
|
5314
5705
|
delete vehicle.purchaseDay;
|
|
5315
5706
|
if (vehicle.primaryUse === VehiclePrimaryUseTypes.Personal) {
|
|
5316
5707
|
delete vehicle.distanceBusiness;
|
|
5708
|
+
delete vehicle.businessUsePercent;
|
|
5709
|
+
}
|
|
5710
|
+
else if (vehicle.businessUsePercent) {
|
|
5711
|
+
// Send business_use_percent to the API; backend computes distance_business
|
|
5712
|
+
delete vehicle.distanceBusiness;
|
|
5317
5713
|
}
|
|
5318
5714
|
if (!vehicle.collision.coverage) {
|
|
5319
5715
|
vehicle.collision.deductible = 1000;
|
|
@@ -5343,7 +5739,7 @@ const CarQuoteDataHandler = () => {
|
|
|
5343
5739
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5344
5740
|
return transformedVehicle;
|
|
5345
5741
|
});
|
|
5346
|
-
requestBody.vehlinks =
|
|
5742
|
+
requestBody.vehlinks = buildVehlinks();
|
|
5347
5743
|
return {
|
|
5348
5744
|
...requestBody,
|
|
5349
5745
|
};
|
|
@@ -5936,6 +6332,7 @@ const useValidationVehicle = () => {
|
|
|
5936
6332
|
'distanceDaily',
|
|
5937
6333
|
'distanceBusiness',
|
|
5938
6334
|
'distanceYearly',
|
|
6335
|
+
'businessUsePercent',
|
|
5939
6336
|
'purchaseYear',
|
|
5940
6337
|
'purchaseMonth',
|
|
5941
6338
|
];
|
|
@@ -5946,8 +6343,10 @@ const useValidationVehicle = () => {
|
|
|
5946
6343
|
});
|
|
5947
6344
|
vehicleState.items.forEach((item) => {
|
|
5948
6345
|
Object.keys(item).map((key) => {
|
|
5949
|
-
|
|
5950
|
-
|
|
6346
|
+
const isEmpty = key === 'distanceDaily' ? item[key] === undefined || item[key] === null : !item[key];
|
|
6347
|
+
if (checkableKeys.includes(key) && isEmpty) {
|
|
6348
|
+
if (!(key === 'distanceBusiness' && (item.primaryUse === VehiclePrimaryUseTypes.Personal || item.businessUsePercent))
|
|
6349
|
+
&& !(key === 'businessUsePercent' && item.primaryUse !== VehiclePrimaryUseTypes.Business)) {
|
|
5951
6350
|
errors.push(key);
|
|
5952
6351
|
}
|
|
5953
6352
|
}
|
|
@@ -6006,6 +6405,7 @@ const useValidationDriver = () => {
|
|
|
6006
6405
|
const { discountState } = useStoreFormCarDiscount();
|
|
6007
6406
|
const { inValidation: driverFormIsInValidation = false, isValid: driverFormIsValid = false, } = driverState;
|
|
6008
6407
|
const { appConfigState } = useStoreAppConfig();
|
|
6408
|
+
const { appType } = appConfigState;
|
|
6009
6409
|
const { dispatchAppModalState } = useStoreAppModal();
|
|
6010
6410
|
const navigate = useNavigate();
|
|
6011
6411
|
const driverFormValidate = (isRedirect = true) => {
|
|
@@ -6020,6 +6420,9 @@ const useValidationDriver = () => {
|
|
|
6020
6420
|
'listedYear',
|
|
6021
6421
|
'listedMonth',
|
|
6022
6422
|
'insuredDate',
|
|
6423
|
+
'lastPolicyEndYear',
|
|
6424
|
+
'lastPolicyEndMonth',
|
|
6425
|
+
'lastPolicyCancelReason',
|
|
6023
6426
|
// 'insuredYear',
|
|
6024
6427
|
// 'insuredMonth',
|
|
6025
6428
|
];
|
|
@@ -6052,30 +6455,32 @@ const useValidationDriver = () => {
|
|
|
6052
6455
|
type: StoreFormCarDriverBaseActionTypes.FormCarDriverValidate,
|
|
6053
6456
|
payload: { inValidation: true },
|
|
6054
6457
|
});
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
errors
|
|
6458
|
+
const showPolicyStart = appType !== AppTypes.TheBig && !isMyChoiceLike(appType);
|
|
6459
|
+
if (showPolicyStart) {
|
|
6460
|
+
Object.keys(discountState).forEach((key) => {
|
|
6461
|
+
// checking errors in discountState
|
|
6462
|
+
if (discountKeys.includes(key) && !discountState[key]) {
|
|
6463
|
+
errors.push(key);
|
|
6464
|
+
}
|
|
6465
|
+
});
|
|
6466
|
+
const { policyStartYear = 0, policyStartMonth = 0, policyStartDay = 0 } = discountState;
|
|
6467
|
+
const policyDate = `${policyStartYear}-${policyStartMonth}-${policyStartDay}`;
|
|
6468
|
+
const currentDate = getFormattedDate('', 'yyyy-MM-dd');
|
|
6469
|
+
if (compareDates(currentDate, policyDate) >= 0) {
|
|
6470
|
+
errors.push('policyStartYear');
|
|
6471
|
+
errors.push('policyStartMonth');
|
|
6472
|
+
errors.push('policyStartDay');
|
|
6059
6473
|
}
|
|
6060
|
-
});
|
|
6061
|
-
const { policyStartYear = 0, policyStartMonth = 0, policyStartDay = 0 } = discountState;
|
|
6062
|
-
const policyDate = `${policyStartYear}-${policyStartMonth}-${policyStartDay}`;
|
|
6063
|
-
// const currentDay = new Date().getUTCDate();
|
|
6064
|
-
// const currentMonth = new Date().getUTCMonth();
|
|
6065
|
-
// const currentYear = new Date().getUTCFullYear();
|
|
6066
|
-
const currentDate = getFormattedDate('', 'yyyy-MM-dd');
|
|
6067
|
-
if (compareDates(currentDate, policyDate) >= 0) {
|
|
6068
|
-
errors.push('policyStartYear');
|
|
6069
|
-
errors.push('policyStartMonth');
|
|
6070
|
-
errors.push('policyStartDay');
|
|
6071
6474
|
}
|
|
6072
6475
|
driverState.items.forEach((item, index) => {
|
|
6073
6476
|
Object.keys(item).forEach((key) => {
|
|
6074
6477
|
// checking errors in driverState
|
|
6075
6478
|
if (keys.includes(key) && !item[key]) {
|
|
6076
6479
|
if ((!item.listed
|
|
6077
|
-
&& (key === 'listedYear' || key === 'listedMonth' || key === 'insuredDate'
|
|
6480
|
+
&& (key === 'listedYear' || key === 'listedMonth' || key === 'insuredDate'
|
|
6481
|
+
|| key === 'lastPolicyEndYear' || key === 'lastPolicyEndMonth' || key === 'lastPolicyCancelReason'))
|
|
6078
6482
|
|| (!item.insured && item.listed && (key === 'insuredDate'))
|
|
6483
|
+
|| (item.insured && (key === 'lastPolicyEndYear' || key === 'lastPolicyEndMonth' || key === 'lastPolicyCancelReason'))
|
|
6079
6484
|
|| (index === 0 && key === 'applicantRelationship')) {
|
|
6080
6485
|
return;
|
|
6081
6486
|
}
|
|
@@ -6163,6 +6568,7 @@ const useValidationCarDiscount = () => {
|
|
|
6163
6568
|
'phone',
|
|
6164
6569
|
'email',
|
|
6165
6570
|
'emailStatus',
|
|
6571
|
+
'phoneStatus',
|
|
6166
6572
|
];
|
|
6167
6573
|
const errors = [];
|
|
6168
6574
|
dispatchDiscountState({
|
|
@@ -6176,11 +6582,14 @@ const useValidationCarDiscount = () => {
|
|
|
6176
6582
|
errors.push(objectKey);
|
|
6177
6583
|
}
|
|
6178
6584
|
});
|
|
6179
|
-
if (discountState.emailTo.emailStatus !== ValidationStatusTypes.Approved) {
|
|
6180
|
-
errors.push('email');
|
|
6181
|
-
}
|
|
6182
6585
|
}
|
|
6183
6586
|
});
|
|
6587
|
+
if (discountState.emailTo.emailStatus !== ValidationStatusTypes.Approved) {
|
|
6588
|
+
errors.push('email');
|
|
6589
|
+
}
|
|
6590
|
+
if (discountState.quoterInfo.phoneStatus !== ValidationStatusTypes.Approved) {
|
|
6591
|
+
errors.push('phone');
|
|
6592
|
+
}
|
|
6184
6593
|
if (!errors.length) {
|
|
6185
6594
|
dispatchDiscountState({
|
|
6186
6595
|
type: StoreFormCarDiscountActionTypes.FormCarDiscountValidate,
|
|
@@ -6581,7 +6990,6 @@ const useValidationHomeDiscount = () => {
|
|
|
6581
6990
|
const discountKeys = [
|
|
6582
6991
|
'firstName',
|
|
6583
6992
|
'lastName',
|
|
6584
|
-
'phone',
|
|
6585
6993
|
];
|
|
6586
6994
|
const errors = [];
|
|
6587
6995
|
dispatchDiscountState({
|
|
@@ -6604,6 +7012,9 @@ const useValidationHomeDiscount = () => {
|
|
|
6604
7012
|
if (discountState.emailTo.emailStatus !== ValidationStatusTypes.Approved) {
|
|
6605
7013
|
errors.push('email');
|
|
6606
7014
|
}
|
|
7015
|
+
if (quoterInfo?.phoneStatus !== ValidationStatusTypes.Approved) {
|
|
7016
|
+
errors.push('phone');
|
|
7017
|
+
}
|
|
6607
7018
|
if (!errors.length) {
|
|
6608
7019
|
dispatchDiscountState({
|
|
6609
7020
|
type: StoreFormHomeDiscountActionTypes.FormHomeDiscountValidate,
|
|
@@ -6721,7 +7132,6 @@ const useValidationLifeApplicant = () => {
|
|
|
6721
7132
|
const quoterInfoKeys = [
|
|
6722
7133
|
'firstName',
|
|
6723
7134
|
'lastName',
|
|
6724
|
-
'phone',
|
|
6725
7135
|
];
|
|
6726
7136
|
const errors = [];
|
|
6727
7137
|
dispatchApplicantState({
|
|
@@ -6736,6 +7146,9 @@ const useValidationLifeApplicant = () => {
|
|
|
6736
7146
|
if (applicantState.emailTo.emailStatus !== ValidationStatusTypes.Approved) {
|
|
6737
7147
|
errors.push('email');
|
|
6738
7148
|
}
|
|
7149
|
+
if (quoterInfo?.phoneStatus !== ValidationStatusTypes.Approved) {
|
|
7150
|
+
errors.push('phone');
|
|
7151
|
+
}
|
|
6739
7152
|
if (quoterInfo) {
|
|
6740
7153
|
Object.keys(quoterInfo).forEach((key) => {
|
|
6741
7154
|
if (quoterInfoKeys.includes(key) && !quoterInfo?.[key]) {
|
|
@@ -7480,12 +7893,13 @@ const useAutofillLifeForm = (options) => {
|
|
|
7480
7893
|
},
|
|
7481
7894
|
});
|
|
7482
7895
|
}
|
|
7483
|
-
// Dispatch quoter info - phone
|
|
7896
|
+
// Dispatch quoter info - phone (pre-approved since it comes from a trusted autofill source)
|
|
7484
7897
|
if (applicantData.quoterInfo.phone) {
|
|
7485
7898
|
dispatchApplicantState({
|
|
7486
|
-
type: StoreFormLifeApplicantActionTypes.
|
|
7899
|
+
type: StoreFormLifeApplicantActionTypes.FormLifeQuoterPhoneStatusSet,
|
|
7487
7900
|
payload: {
|
|
7488
7901
|
phone: applicantData.quoterInfo.phone,
|
|
7902
|
+
phoneStatus: ValidationStatusTypes.Approved,
|
|
7489
7903
|
},
|
|
7490
7904
|
});
|
|
7491
7905
|
}
|
|
@@ -7519,5 +7933,5 @@ const useAutofillLifeForm = (options) => {
|
|
|
7519
7933
|
}, [dispatchPostalState, dispatchCoverageState, dispatchApplicantState, dispatchQuoteState, dispatchAppModalState]);
|
|
7520
7934
|
};
|
|
7521
7935
|
|
|
7522
|
-
export { CarBrokerTypeEnum, CarQuoteDataHandler, ClearFormDataHandler, HomeBrokerTypeEnum, HomeQuoteDataHandler, LifeQuoteDataHandler, StoreClientActionTypes, StoreConfigAppConfigActionTypes, StoreConfigAppDeviceActionTypes, StoreConfigAppLoaderActionTypes, StoreConfigAppModalActionTypes, StoreFormCarConfigActionTypes, StoreFormCarDiscountActionTypes, StoreFormCarDriverAccidentActionTypes, StoreFormCarDriverBaseActionTypes, StoreFormCarDriverCancellationActionTypes, StoreFormCarDriverInfoActionTypes, StoreFormCarDriverInsuranceActionTypes, StoreFormCarDriverLicenceActionTypes, StoreFormCarDriverSuspensionActionTypes, StoreFormCarDriverTicketActionTypes, StoreFormCarPostalActionTypes, StoreFormCarQuoteActionTypes, StoreFormCarVehicleActionTypes, StoreFormHomeApplicantBaseActionTypes, StoreFormHomeApplicantCancellationActionTypes, StoreFormHomeApplicantClaimActionTypes, StoreFormHomeApplicantInfoActionTypes, StoreFormHomeApplicantInsuranceActionTypes, StoreFormHomeDiscountActionTypes, StoreFormHomeDwellingActionTypes, StoreFormHomePostalActionTypes, StoreFormHomeQuoteActionTypes, StoreFormLifeApplicantActionTypes, StoreFormLifeCoverageActionTypes, StoreFormLifePostalActionTypes, StoreFormLifeQuoteActionTypes, StorePartnerActionTypes, StoreProvider, addDayToDate, configStateReducer, differenceInHoursFromNow, formCarReducer, formCondoDwellingInitialState, formHomeDwellingInitialState, formHomeReducer, formLifeReducer, formTenantDwellingInitialState, getDwellingInitialState, getProvinceCodeFromState, getProvinceName, globalStateReducer, initHttpResponse, mapToConfigState, mapToDriverState, mapToLifeApplicantState, mapToLifeCoverageState, mapToLifePostalState, mapToPostalState, mapToVehicleState, parseAutofillParam, parseLifeAutofillParam, reducers, default_1 as token, useAbReform, useAutofillCarForm, useAutofillLifeForm, useHandlerAuth, useHandlerCarMake, useHandlerCarModel, useHandlerCarQuoterEmail, useHandlerHomeQuoterEmail, useHandlerLifeQuoterEmail, useHandlerPartner, useHandlerPostal, useProvince, useStoreAppConfig, useStoreAppDevice, useStoreAppLoader, useStoreAppModal, useStoreClient, useStoreClientLoggedIn, useStoreClientProfile, useStoreClientToken, useStoreDeviceBP, useStoreDeviceType, useStoreFormCarConfig, useStoreFormCarDiscount, useStoreFormCarDriverAccident, useStoreFormCarDriverBase, useStoreFormCarDriverCancellation, useStoreFormCarDriverInfo, useStoreFormCarDriverInsurance, useStoreFormCarDriverLicence, useStoreFormCarDriverSuspension, useStoreFormCarDriverTicket, useStoreFormCarPostal, useStoreFormCarQuote, useStoreFormCarVehicle, useStoreFormHomeApplicantBase, useStoreFormHomeApplicantCancellation, useStoreFormHomeApplicantClaim, useStoreFormHomeApplicantInfo, useStoreFormHomeApplicantInsurance, useStoreFormHomeDiscount, useStoreFormHomeDwelling, useStoreFormHomePostal, useStoreFormHomeQuote, useStoreFormLifeApplicant, useStoreFormLifeCoverage, useStoreFormLifePostal, useStoreFormLifeQuote, useStorePartner, useValidationAddress, useValidationApplicant, useValidationCarDiscount, useValidationCoverage, useValidationDriver, useValidationDwelling, useValidationHomeDiscount, useValidationLifeApplicant, useValidationVehicle };
|
|
7936
|
+
export { CarBrokerTypeEnum, CarQuoteDataHandler, ClearFormDataHandler, HomeBrokerTypeEnum, HomeQuoteDataHandler, LifeQuoteDataHandler, StoreClientActionTypes, StoreConfigAppConfigActionTypes, StoreConfigAppDeviceActionTypes, StoreConfigAppLoaderActionTypes, StoreConfigAppModalActionTypes, StoreFormCarConfigActionTypes, StoreFormCarDiscountActionTypes, StoreFormCarDriverAccidentActionTypes, StoreFormCarDriverBaseActionTypes, StoreFormCarDriverCancellationActionTypes, StoreFormCarDriverInfoActionTypes, StoreFormCarDriverInsuranceActionTypes, StoreFormCarDriverLicenceActionTypes, StoreFormCarDriverSuspensionActionTypes, StoreFormCarDriverTicketActionTypes, StoreFormCarPostalActionTypes, StoreFormCarQuoteActionTypes, StoreFormCarVehicleActionTypes, StoreFormHomeApplicantBaseActionTypes, StoreFormHomeApplicantCancellationActionTypes, StoreFormHomeApplicantClaimActionTypes, StoreFormHomeApplicantInfoActionTypes, StoreFormHomeApplicantInsuranceActionTypes, StoreFormHomeDiscountActionTypes, StoreFormHomeDwellingActionTypes, StoreFormHomePostalActionTypes, StoreFormHomeQuoteActionTypes, StoreFormLifeApplicantActionTypes, StoreFormLifeCoverageActionTypes, StoreFormLifePostalActionTypes, StoreFormLifeQuoteActionTypes, StorePartnerActionTypes, StoreProvider, addDayToDate, configStateReducer, differenceInHoursFromNow, formCarReducer, formCondoDwellingInitialState, formHomeDwellingInitialState, formHomeReducer, formLifeReducer, formTenantDwellingInitialState, getDwellingInitialState, getProvinceCodeFromState, getProvinceName, globalStateReducer, initHttpResponse, mapToConfigState, mapToDriverState, mapToLifeApplicantState, mapToLifeCoverageState, mapToLifePostalState, mapToPostalState, mapToVehicleState, parseAutofillParam, parseLifeAutofillParam, reducers, default_1 as token, useAbReform, useAutofillCarForm, useAutofillLifeForm, useHandlerAuth, useHandlerCarMake, useHandlerCarModel, useHandlerCarQuoterEmail, useHandlerCarQuoterPhone, useHandlerHomeQuoterEmail, useHandlerHomeQuoterPhone, useHandlerLifeQuoterEmail, useHandlerLifeQuoterPhone, useHandlerPartner, useHandlerPostal, useProvince, useStoreAppConfig, useStoreAppDevice, useStoreAppLoader, useStoreAppModal, useStoreClient, useStoreClientLoggedIn, useStoreClientProfile, useStoreClientToken, useStoreDeviceBP, useStoreDeviceType, useStoreFormCarConfig, useStoreFormCarDiscount, useStoreFormCarDriverAccident, useStoreFormCarDriverBase, useStoreFormCarDriverCancellation, useStoreFormCarDriverInfo, useStoreFormCarDriverInsurance, useStoreFormCarDriverLicence, useStoreFormCarDriverSuspension, useStoreFormCarDriverTicket, useStoreFormCarPostal, useStoreFormCarQuote, useStoreFormCarVehicle, useStoreFormHomeApplicantBase, useStoreFormHomeApplicantCancellation, useStoreFormHomeApplicantClaim, useStoreFormHomeApplicantInfo, useStoreFormHomeApplicantInsurance, useStoreFormHomeDiscount, useStoreFormHomeDwelling, useStoreFormHomePostal, useStoreFormHomeQuote, useStoreFormLifeApplicant, useStoreFormLifeCoverage, useStoreFormLifePostal, useStoreFormLifeQuote, useStorePartner, useValidationAddress, useValidationApplicant, useValidationCarDiscount, useValidationCoverage, useValidationDriver, useValidationDwelling, useValidationHomeDiscount, useValidationLifeApplicant, useValidationVehicle };
|
|
7523
7937
|
//# sourceMappingURL=index.js.map
|