@mychoice/mychoice-sdk-store 2.2.8 → 2.2.10
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/autofill/index.d.ts +3 -0
- package/dist/cjs/handlers/autofill/types.d.ts +76 -0
- package/dist/cjs/handlers/autofill/useAutofillCarForm.d.ts +8 -0
- package/dist/cjs/handlers/autofill/utils.d.ts +94 -0
- package/dist/cjs/handlers/index.d.ts +1 -0
- package/dist/cjs/index.js +472 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/states/reducers/states/formStates/FormLifeState/QuoteState/interfaces.d.ts +1 -1
- package/dist/esm/handlers/autofill/index.d.ts +3 -0
- package/dist/esm/handlers/autofill/types.d.ts +76 -0
- package/dist/esm/handlers/autofill/useAutofillCarForm.d.ts +8 -0
- package/dist/esm/handlers/autofill/utils.d.ts +94 -0
- package/dist/esm/handlers/index.d.ts +1 -0
- package/dist/esm/index.js +467 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/states/reducers/states/formStates/FormLifeState/QuoteState/interfaces.d.ts +1 -1
- package/dist/index.d.ts +181 -2
- package/package.json +2 -2
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export interface AutofillDriver {
|
|
2
|
+
gender: string;
|
|
3
|
+
listed: boolean;
|
|
4
|
+
ticket: boolean;
|
|
5
|
+
insured: boolean;
|
|
6
|
+
accident: boolean;
|
|
7
|
+
first_name: string;
|
|
8
|
+
occupation: number;
|
|
9
|
+
listed_year?: string;
|
|
10
|
+
insured_year?: string;
|
|
11
|
+
licence_info: {
|
|
12
|
+
licence_type: string;
|
|
13
|
+
g_licence_date?: string;
|
|
14
|
+
g1_licence_date?: string;
|
|
15
|
+
g2_licence_date?: string;
|
|
16
|
+
first_licence_age: number;
|
|
17
|
+
};
|
|
18
|
+
date_of_birth: string;
|
|
19
|
+
marital_status: string;
|
|
20
|
+
licence_suspension: boolean;
|
|
21
|
+
insurance_cancellation: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface AutofillVehicleCoverage {
|
|
24
|
+
coverage: boolean;
|
|
25
|
+
deductible?: number;
|
|
26
|
+
limit?: number;
|
|
27
|
+
}
|
|
28
|
+
export interface AutofillVehicle {
|
|
29
|
+
city: string;
|
|
30
|
+
make: string;
|
|
31
|
+
year: number;
|
|
32
|
+
model: string;
|
|
33
|
+
leased: boolean;
|
|
34
|
+
condition: string;
|
|
35
|
+
liability: AutofillVehicleCoverage;
|
|
36
|
+
collision: AutofillVehicleCoverage;
|
|
37
|
+
lossofuse: AutofillVehicleCoverage;
|
|
38
|
+
comprehensive: AutofillVehicleCoverage;
|
|
39
|
+
liabilityfordamage: AutofillVehicleCoverage;
|
|
40
|
+
limitedwaiverofdepreciation: AutofillVehicleCoverage;
|
|
41
|
+
postal_code: string;
|
|
42
|
+
primary_use: string;
|
|
43
|
+
winter_tires: boolean;
|
|
44
|
+
purchase_date: string;
|
|
45
|
+
distance_daily: number;
|
|
46
|
+
distance_yearly: number;
|
|
47
|
+
parking_location: string;
|
|
48
|
+
distance_business: number;
|
|
49
|
+
location_index: number;
|
|
50
|
+
bodytype: string;
|
|
51
|
+
ext_vicc: string;
|
|
52
|
+
vicc_code: string;
|
|
53
|
+
}
|
|
54
|
+
export interface AutofillVehLink {
|
|
55
|
+
priority: string;
|
|
56
|
+
driver_index: number;
|
|
57
|
+
vehicle_index: number;
|
|
58
|
+
}
|
|
59
|
+
export interface AutofillData {
|
|
60
|
+
uuid: string;
|
|
61
|
+
drivers: AutofillDriver[];
|
|
62
|
+
vehicles: AutofillVehicle[];
|
|
63
|
+
vehlinks: AutofillVehLink[];
|
|
64
|
+
email_to: string;
|
|
65
|
+
policy_start: string;
|
|
66
|
+
province_code: string;
|
|
67
|
+
caa_member_discount: boolean;
|
|
68
|
+
app_install_discount: boolean;
|
|
69
|
+
multiple_policies_discount: boolean;
|
|
70
|
+
}
|
|
71
|
+
export interface MappedAutofillData {
|
|
72
|
+
drivers: any[];
|
|
73
|
+
vehicles: any[];
|
|
74
|
+
postalData: any;
|
|
75
|
+
configData: any;
|
|
76
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { AutofillData } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Parse URL-encoded JSON from query parameter
|
|
4
|
+
*/
|
|
5
|
+
export declare const parseAutofillParam: (urlEncodedJson: string) => AutofillData;
|
|
6
|
+
/**
|
|
7
|
+
* Get province name from code
|
|
8
|
+
*/
|
|
9
|
+
export declare const getProvinceName: (code: string) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Map autofill data to postal state format
|
|
12
|
+
*/
|
|
13
|
+
export declare const mapToPostalState: (autofillData: AutofillData) => {
|
|
14
|
+
city: string;
|
|
15
|
+
postalCode: string;
|
|
16
|
+
locationIndex: string;
|
|
17
|
+
provinceCode: string;
|
|
18
|
+
provinceName: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Map autofill data to vehicle state format
|
|
22
|
+
*/
|
|
23
|
+
export declare const mapToVehicleState: (autofillData: AutofillData) => {
|
|
24
|
+
year: string;
|
|
25
|
+
make: string;
|
|
26
|
+
model: string;
|
|
27
|
+
condition: string;
|
|
28
|
+
leased: boolean;
|
|
29
|
+
purchaseDate: string;
|
|
30
|
+
winterTires: boolean;
|
|
31
|
+
parkingLocation: string;
|
|
32
|
+
primaryUse: string;
|
|
33
|
+
distanceDaily: number;
|
|
34
|
+
distanceBusiness: number;
|
|
35
|
+
distanceYearly: number;
|
|
36
|
+
comprehensive: {
|
|
37
|
+
coverage: boolean;
|
|
38
|
+
deductible: number;
|
|
39
|
+
};
|
|
40
|
+
collision: {
|
|
41
|
+
coverage: boolean;
|
|
42
|
+
deductible: number;
|
|
43
|
+
};
|
|
44
|
+
liability: {
|
|
45
|
+
coverage: boolean;
|
|
46
|
+
limit: number;
|
|
47
|
+
};
|
|
48
|
+
lossofuse: {
|
|
49
|
+
coverage: boolean;
|
|
50
|
+
limit: number;
|
|
51
|
+
};
|
|
52
|
+
liabilityfordamage: {
|
|
53
|
+
coverage: boolean;
|
|
54
|
+
limit: number;
|
|
55
|
+
};
|
|
56
|
+
limitedwaiverofdepreciation: {
|
|
57
|
+
coverage: boolean;
|
|
58
|
+
limit: number;
|
|
59
|
+
};
|
|
60
|
+
postalCode: string;
|
|
61
|
+
locationIndex: string;
|
|
62
|
+
city: string;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Map autofill data to driver state format
|
|
66
|
+
*/
|
|
67
|
+
export declare const mapToDriverState: (autofillData: AutofillData) => {
|
|
68
|
+
firstName: string;
|
|
69
|
+
dateOfBirth: string;
|
|
70
|
+
maritalStatus: string;
|
|
71
|
+
gender: string;
|
|
72
|
+
occupation: number;
|
|
73
|
+
listed: boolean;
|
|
74
|
+
listedYear: string;
|
|
75
|
+
insured: boolean;
|
|
76
|
+
insuredYear: string;
|
|
77
|
+
ticket: boolean;
|
|
78
|
+
accident: boolean;
|
|
79
|
+
licenceSuspension: boolean;
|
|
80
|
+
insuranceCancellation: boolean;
|
|
81
|
+
licenceInfo: {
|
|
82
|
+
licenceType: string;
|
|
83
|
+
firstLicenceAge: number;
|
|
84
|
+
gLicenceDate: string;
|
|
85
|
+
g1LicenceDate: string;
|
|
86
|
+
g2LicenceDate: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Map autofill data to config state format
|
|
91
|
+
*/
|
|
92
|
+
export declare const mapToConfigState: (autofillData: AutofillData) => {
|
|
93
|
+
province: string;
|
|
94
|
+
};
|
package/dist/cjs/index.js
CHANGED
|
@@ -6712,6 +6712,471 @@ const useValidationLifeApplicant = () => {
|
|
|
6712
6712
|
};
|
|
6713
6713
|
};
|
|
6714
6714
|
|
|
6715
|
+
// Province code to name mapping
|
|
6716
|
+
const PROVINCE_NAME_MAP = {
|
|
6717
|
+
ON: 'Ontario',
|
|
6718
|
+
AB: 'Alberta',
|
|
6719
|
+
NS: 'Nova Scotia',
|
|
6720
|
+
NF: 'Newfoundland',
|
|
6721
|
+
NB: 'New Brunswick',
|
|
6722
|
+
BC: 'British Columbia',
|
|
6723
|
+
SK: 'Saskatchewan',
|
|
6724
|
+
MB: 'Manitoba',
|
|
6725
|
+
};
|
|
6726
|
+
/**
|
|
6727
|
+
* Parse URL-encoded JSON from query parameter
|
|
6728
|
+
*/
|
|
6729
|
+
const parseAutofillParam = (urlEncodedJson) => {
|
|
6730
|
+
const decoded = decodeURIComponent(urlEncodedJson);
|
|
6731
|
+
return JSON.parse(decoded);
|
|
6732
|
+
};
|
|
6733
|
+
/**
|
|
6734
|
+
* Get province name from code
|
|
6735
|
+
*/
|
|
6736
|
+
const getProvinceName = (code) => {
|
|
6737
|
+
return PROVINCE_NAME_MAP[code] || code;
|
|
6738
|
+
};
|
|
6739
|
+
/**
|
|
6740
|
+
* Map autofill data to postal state format
|
|
6741
|
+
*/
|
|
6742
|
+
const mapToPostalState = (autofillData) => {
|
|
6743
|
+
const firstVehicle = autofillData.vehicles[0];
|
|
6744
|
+
return {
|
|
6745
|
+
city: firstVehicle.city || '',
|
|
6746
|
+
postalCode: firstVehicle.postal_code || '',
|
|
6747
|
+
locationIndex: String(firstVehicle.location_index || ''),
|
|
6748
|
+
provinceCode: autofillData.province_code || '',
|
|
6749
|
+
provinceName: getProvinceName(autofillData.province_code || ''),
|
|
6750
|
+
};
|
|
6751
|
+
};
|
|
6752
|
+
/**
|
|
6753
|
+
* Map autofill data to vehicle state format
|
|
6754
|
+
*/
|
|
6755
|
+
const mapToVehicleState = (autofillData) => {
|
|
6756
|
+
const firstVehicle = autofillData.vehicles[0];
|
|
6757
|
+
return {
|
|
6758
|
+
year: String(firstVehicle.year || ''),
|
|
6759
|
+
make: firstVehicle.make || '',
|
|
6760
|
+
model: firstVehicle.model || '',
|
|
6761
|
+
condition: firstVehicle.condition || 'N',
|
|
6762
|
+
leased: firstVehicle.leased || false,
|
|
6763
|
+
purchaseDate: firstVehicle.purchase_date || '',
|
|
6764
|
+
winterTires: firstVehicle.winter_tires || false,
|
|
6765
|
+
parkingLocation: firstVehicle.parking_location || 'driveway',
|
|
6766
|
+
primaryUse: firstVehicle.primary_use || 'Personal',
|
|
6767
|
+
distanceDaily: firstVehicle.distance_daily || 0,
|
|
6768
|
+
distanceBusiness: firstVehicle.distance_business || 0,
|
|
6769
|
+
distanceYearly: firstVehicle.distance_yearly || 0,
|
|
6770
|
+
comprehensive: {
|
|
6771
|
+
coverage: firstVehicle.comprehensive?.coverage ?? true,
|
|
6772
|
+
deductible: firstVehicle.comprehensive?.deductible ?? 1000,
|
|
6773
|
+
},
|
|
6774
|
+
collision: {
|
|
6775
|
+
coverage: firstVehicle.collision?.coverage ?? true,
|
|
6776
|
+
deductible: firstVehicle.collision?.deductible ?? 1000,
|
|
6777
|
+
},
|
|
6778
|
+
liability: {
|
|
6779
|
+
coverage: firstVehicle.liability?.coverage ?? true,
|
|
6780
|
+
limit: firstVehicle.liability?.limit ?? 1000000,
|
|
6781
|
+
},
|
|
6782
|
+
lossofuse: {
|
|
6783
|
+
coverage: firstVehicle.lossofuse?.coverage ?? true,
|
|
6784
|
+
limit: firstVehicle.lossofuse?.limit ?? 2000,
|
|
6785
|
+
},
|
|
6786
|
+
liabilityfordamage: {
|
|
6787
|
+
coverage: firstVehicle.liabilityfordamage?.coverage ?? true,
|
|
6788
|
+
limit: firstVehicle.liabilityfordamage?.limit ?? 50000,
|
|
6789
|
+
},
|
|
6790
|
+
limitedwaiverofdepreciation: {
|
|
6791
|
+
coverage: firstVehicle.limitedwaiverofdepreciation?.coverage ?? true,
|
|
6792
|
+
limit: firstVehicle.limitedwaiverofdepreciation?.limit ?? 1,
|
|
6793
|
+
},
|
|
6794
|
+
postalCode: firstVehicle.postal_code || '',
|
|
6795
|
+
locationIndex: String(firstVehicle.location_index || ''),
|
|
6796
|
+
city: firstVehicle.city || '',
|
|
6797
|
+
};
|
|
6798
|
+
};
|
|
6799
|
+
/**
|
|
6800
|
+
* Map autofill data to driver state format
|
|
6801
|
+
*/
|
|
6802
|
+
const mapToDriverState = (autofillData) => {
|
|
6803
|
+
const firstDriver = autofillData.drivers[0];
|
|
6804
|
+
return {
|
|
6805
|
+
firstName: firstDriver.first_name || '',
|
|
6806
|
+
dateOfBirth: firstDriver.date_of_birth || '',
|
|
6807
|
+
maritalStatus: firstDriver.marital_status || '',
|
|
6808
|
+
gender: firstDriver.gender || '',
|
|
6809
|
+
occupation: firstDriver.occupation || 0,
|
|
6810
|
+
listed: firstDriver.listed || false,
|
|
6811
|
+
listedYear: firstDriver.listed_year || '',
|
|
6812
|
+
insured: firstDriver.insured || false,
|
|
6813
|
+
insuredYear: firstDriver.insured_year || '',
|
|
6814
|
+
ticket: firstDriver.ticket || false,
|
|
6815
|
+
accident: firstDriver.accident || false,
|
|
6816
|
+
licenceSuspension: firstDriver.licence_suspension || false,
|
|
6817
|
+
insuranceCancellation: firstDriver.insurance_cancellation || false,
|
|
6818
|
+
licenceInfo: {
|
|
6819
|
+
licenceType: (firstDriver.licence_info?.licence_type || '').toLowerCase(),
|
|
6820
|
+
firstLicenceAge: firstDriver.licence_info?.first_licence_age || 0,
|
|
6821
|
+
gLicenceDate: firstDriver.licence_info?.g_licence_date || '',
|
|
6822
|
+
g1LicenceDate: firstDriver.licence_info?.g1_licence_date || '',
|
|
6823
|
+
g2LicenceDate: firstDriver.licence_info?.g2_licence_date || '',
|
|
6824
|
+
},
|
|
6825
|
+
};
|
|
6826
|
+
};
|
|
6827
|
+
/**
|
|
6828
|
+
* Map autofill data to config state format
|
|
6829
|
+
*/
|
|
6830
|
+
const mapToConfigState = (autofillData) => {
|
|
6831
|
+
return {
|
|
6832
|
+
province: autofillData.province_code || '',
|
|
6833
|
+
};
|
|
6834
|
+
};
|
|
6835
|
+
|
|
6836
|
+
/**
|
|
6837
|
+
* Hook to initialize car insurance form with autofill data from query parameter
|
|
6838
|
+
*/
|
|
6839
|
+
const useAutofillCarForm = (options) => {
|
|
6840
|
+
const { dispatchPostalState } = useStoreFormCarPostal();
|
|
6841
|
+
const { dispatchVehicleState } = useStoreFormCarVehicle();
|
|
6842
|
+
const { configState, dispatchConfigState } = useStoreFormCarConfig();
|
|
6843
|
+
const { dispatchDriverInfoState } = useStoreFormCarDriverInfo();
|
|
6844
|
+
const { dispatchDriverLicenceState } = useStoreFormCarDriverLicence();
|
|
6845
|
+
const { dispatchDriverInsuranceState } = useStoreFormCarDriverInsurance();
|
|
6846
|
+
const { dispatchDriverSuspensionState } = useStoreFormCarDriverSuspension();
|
|
6847
|
+
const { dispatchDriverCancellationState } = useStoreFormCarDriverCancellation();
|
|
6848
|
+
const { dispatchDriverAccidentState } = useStoreFormCarDriverAccident();
|
|
6849
|
+
const { dispatchDriverTicketState } = useStoreFormCarDriverTicket();
|
|
6850
|
+
const { getVehicleMake } = useHandlerCarMake();
|
|
6851
|
+
const { getVehicleModel } = useHandlerCarModel();
|
|
6852
|
+
const { dispatchAppModalState } = useStoreAppModal();
|
|
6853
|
+
const autofillProcessedRef = react.useRef(false);
|
|
6854
|
+
react.useEffect(() => {
|
|
6855
|
+
// Prevent double execution in development strict mode
|
|
6856
|
+
if (autofillProcessedRef.current) {
|
|
6857
|
+
return;
|
|
6858
|
+
}
|
|
6859
|
+
try {
|
|
6860
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
6861
|
+
const autofillParam = urlParams.get('autofill');
|
|
6862
|
+
if (!autofillParam) {
|
|
6863
|
+
return;
|
|
6864
|
+
}
|
|
6865
|
+
// Parse the autofill data
|
|
6866
|
+
const autofillData = parseAutofillParam(autofillParam);
|
|
6867
|
+
// Dispatch postal state
|
|
6868
|
+
const postalData = mapToPostalState(autofillData);
|
|
6869
|
+
dispatchPostalState({
|
|
6870
|
+
type: exports.StoreFormCarPostalActionTypes.FormCarPostalSet,
|
|
6871
|
+
payload: postalData,
|
|
6872
|
+
});
|
|
6873
|
+
// Close the postal modal since we have postal data from autofill
|
|
6874
|
+
dispatchAppModalState({
|
|
6875
|
+
type: exports.StoreConfigAppModalActionTypes.AppModalClose,
|
|
6876
|
+
});
|
|
6877
|
+
// Dispatch config state
|
|
6878
|
+
const configData = mapToConfigState(autofillData);
|
|
6879
|
+
dispatchConfigState({
|
|
6880
|
+
type: exports.StoreFormCarConfigActionTypes.FormCarConfigSet,
|
|
6881
|
+
payload: configData,
|
|
6882
|
+
});
|
|
6883
|
+
// Dispatch vehicle state with mapped data
|
|
6884
|
+
const vehicleData = mapToVehicleState(autofillData);
|
|
6885
|
+
// Update the first vehicle in the form with autofill data
|
|
6886
|
+
dispatchVehicleState({
|
|
6887
|
+
type: exports.StoreFormCarVehicleActionTypes.FormCarVehicleYearSet,
|
|
6888
|
+
payload: {
|
|
6889
|
+
year: vehicleData.year,
|
|
6890
|
+
},
|
|
6891
|
+
});
|
|
6892
|
+
// Update make
|
|
6893
|
+
dispatchVehicleState({
|
|
6894
|
+
type: exports.StoreFormCarVehicleActionTypes.FormCarVehicleMakeSet,
|
|
6895
|
+
payload: {
|
|
6896
|
+
make: vehicleData.make,
|
|
6897
|
+
},
|
|
6898
|
+
});
|
|
6899
|
+
// Update model
|
|
6900
|
+
dispatchVehicleState({
|
|
6901
|
+
type: exports.StoreFormCarVehicleActionTypes.FormCarVehicleModelSet,
|
|
6902
|
+
payload: {
|
|
6903
|
+
model: vehicleData.model,
|
|
6904
|
+
},
|
|
6905
|
+
});
|
|
6906
|
+
// Update condition
|
|
6907
|
+
dispatchVehicleState({
|
|
6908
|
+
type: exports.StoreFormCarVehicleActionTypes.FormCarVehicleConditionSelect,
|
|
6909
|
+
payload: {
|
|
6910
|
+
condition: vehicleData.condition,
|
|
6911
|
+
},
|
|
6912
|
+
});
|
|
6913
|
+
// Update leased status
|
|
6914
|
+
dispatchVehicleState({
|
|
6915
|
+
type: exports.StoreFormCarVehicleActionTypes.FormCarVehicleCarStatusSelect,
|
|
6916
|
+
payload: {
|
|
6917
|
+
leased: vehicleData.leased,
|
|
6918
|
+
},
|
|
6919
|
+
});
|
|
6920
|
+
// Update purchase year
|
|
6921
|
+
if (vehicleData.purchaseDate) {
|
|
6922
|
+
const [year, month, day] = vehicleData.purchaseDate.split('-');
|
|
6923
|
+
dispatchVehicleState({
|
|
6924
|
+
type: exports.StoreFormCarVehicleActionTypes.FormCarVehiclePurchaseYearSelect,
|
|
6925
|
+
payload: {
|
|
6926
|
+
purchaseYear: year,
|
|
6927
|
+
},
|
|
6928
|
+
});
|
|
6929
|
+
dispatchVehicleState({
|
|
6930
|
+
type: exports.StoreFormCarVehicleActionTypes.FormCarVehiclePurchaseMonthSelect,
|
|
6931
|
+
payload: {
|
|
6932
|
+
purchaseMonth: month,
|
|
6933
|
+
},
|
|
6934
|
+
});
|
|
6935
|
+
dispatchVehicleState({
|
|
6936
|
+
type: exports.StoreFormCarVehicleActionTypes.FormCarVehiclePurchaseDaySelect,
|
|
6937
|
+
payload: {
|
|
6938
|
+
purchaseDay: day,
|
|
6939
|
+
},
|
|
6940
|
+
});
|
|
6941
|
+
}
|
|
6942
|
+
// Update winter tires
|
|
6943
|
+
dispatchVehicleState({
|
|
6944
|
+
type: exports.StoreFormCarVehicleActionTypes.FormCarVehicleWinterTiresSelect,
|
|
6945
|
+
payload: {
|
|
6946
|
+
winterTires: vehicleData.winterTires,
|
|
6947
|
+
},
|
|
6948
|
+
});
|
|
6949
|
+
// Update primary use
|
|
6950
|
+
dispatchVehicleState({
|
|
6951
|
+
type: exports.StoreFormCarVehicleActionTypes.FormCarVehicleUsageSelect,
|
|
6952
|
+
payload: {
|
|
6953
|
+
primaryUse: vehicleData.primaryUse,
|
|
6954
|
+
},
|
|
6955
|
+
});
|
|
6956
|
+
// Update parking location
|
|
6957
|
+
dispatchVehicleState({
|
|
6958
|
+
type: exports.StoreFormCarVehicleActionTypes.FormCarParkingLocationSelect,
|
|
6959
|
+
payload: {
|
|
6960
|
+
parkingLocation: vehicleData.parkingLocation,
|
|
6961
|
+
},
|
|
6962
|
+
});
|
|
6963
|
+
// Update distances
|
|
6964
|
+
dispatchVehicleState({
|
|
6965
|
+
type: exports.StoreFormCarVehicleActionTypes.FormCarDailyDistanceSelect,
|
|
6966
|
+
payload: {
|
|
6967
|
+
distanceDaily: String(vehicleData.distanceDaily),
|
|
6968
|
+
},
|
|
6969
|
+
});
|
|
6970
|
+
dispatchVehicleState({
|
|
6971
|
+
type: exports.StoreFormCarVehicleActionTypes.FormCarBusinessDistanceSelect,
|
|
6972
|
+
payload: {
|
|
6973
|
+
distanceBusiness: String(vehicleData.distanceBusiness),
|
|
6974
|
+
},
|
|
6975
|
+
});
|
|
6976
|
+
dispatchVehicleState({
|
|
6977
|
+
type: exports.StoreFormCarVehicleActionTypes.FormCarYearlyDistanceSelect,
|
|
6978
|
+
payload: {
|
|
6979
|
+
distanceYearly: String(vehicleData.distanceYearly),
|
|
6980
|
+
},
|
|
6981
|
+
});
|
|
6982
|
+
// Update coverages and deductibles
|
|
6983
|
+
dispatchVehicleState({
|
|
6984
|
+
type: exports.StoreFormCarVehicleActionTypes.FormCarComprehensiveCoverageSelect,
|
|
6985
|
+
payload: {
|
|
6986
|
+
coverage: vehicleData.comprehensive.coverage,
|
|
6987
|
+
deductible: vehicleData.comprehensive.deductible,
|
|
6988
|
+
},
|
|
6989
|
+
});
|
|
6990
|
+
dispatchVehicleState({
|
|
6991
|
+
type: exports.StoreFormCarVehicleActionTypes.FormCarCollisionCoverageSelect,
|
|
6992
|
+
payload: {
|
|
6993
|
+
coverage: vehicleData.collision.coverage,
|
|
6994
|
+
deductible: vehicleData.collision.deductible,
|
|
6995
|
+
},
|
|
6996
|
+
});
|
|
6997
|
+
dispatchVehicleState({
|
|
6998
|
+
type: exports.StoreFormCarVehicleActionTypes.FormCarLiabilityCoverageSelect,
|
|
6999
|
+
payload: {
|
|
7000
|
+
coverage: vehicleData.liability.coverage,
|
|
7001
|
+
limit: vehicleData.liability.limit,
|
|
7002
|
+
},
|
|
7003
|
+
});
|
|
7004
|
+
dispatchVehicleState({
|
|
7005
|
+
type: exports.StoreFormCarVehicleActionTypes.FormCarLossOfUseCoverageSelect,
|
|
7006
|
+
payload: {
|
|
7007
|
+
coverage: vehicleData.lossofuse.coverage,
|
|
7008
|
+
limit: vehicleData.lossofuse.limit,
|
|
7009
|
+
},
|
|
7010
|
+
});
|
|
7011
|
+
dispatchVehicleState({
|
|
7012
|
+
type: exports.StoreFormCarVehicleActionTypes.FormCarLiabilityForDamageCoverageSelect,
|
|
7013
|
+
payload: {
|
|
7014
|
+
coverage: vehicleData.liabilityfordamage.coverage,
|
|
7015
|
+
limit: vehicleData.liabilityfordamage.limit,
|
|
7016
|
+
},
|
|
7017
|
+
});
|
|
7018
|
+
dispatchVehicleState({
|
|
7019
|
+
type: exports.StoreFormCarVehicleActionTypes.FormCarLimitedWaiverOfDepreciationCoverageSelect,
|
|
7020
|
+
payload: {
|
|
7021
|
+
coverage: vehicleData.limitedwaiverofdepreciation.coverage,
|
|
7022
|
+
limit: vehicleData.limitedwaiverofdepreciation.limit,
|
|
7023
|
+
},
|
|
7024
|
+
});
|
|
7025
|
+
// Dispatch driver state
|
|
7026
|
+
const driverData = mapToDriverState(autofillData);
|
|
7027
|
+
// Update driver basic info
|
|
7028
|
+
dispatchDriverInfoState({
|
|
7029
|
+
type: exports.StoreFormCarDriverInfoActionTypes.FormCarDriverNameSet,
|
|
7030
|
+
payload: {
|
|
7031
|
+
firstName: driverData.firstName,
|
|
7032
|
+
},
|
|
7033
|
+
});
|
|
7034
|
+
dispatchDriverInfoState({
|
|
7035
|
+
type: exports.StoreFormCarDriverInfoActionTypes.FormCarDriverMaritalStatusSelect,
|
|
7036
|
+
payload: {
|
|
7037
|
+
maritalStatus: driverData.maritalStatus,
|
|
7038
|
+
},
|
|
7039
|
+
});
|
|
7040
|
+
dispatchDriverInfoState({
|
|
7041
|
+
type: exports.StoreFormCarDriverInfoActionTypes.FormCarDriverGenderSelect,
|
|
7042
|
+
payload: {
|
|
7043
|
+
gender: driverData.gender,
|
|
7044
|
+
},
|
|
7045
|
+
});
|
|
7046
|
+
dispatchDriverInfoState({
|
|
7047
|
+
type: exports.StoreFormCarDriverInfoActionTypes.FormCarDriverOccupationSelect,
|
|
7048
|
+
payload: {
|
|
7049
|
+
occupation: driverData.occupation,
|
|
7050
|
+
},
|
|
7051
|
+
});
|
|
7052
|
+
// Update driver birth date
|
|
7053
|
+
if (driverData.dateOfBirth) {
|
|
7054
|
+
const [year, month, day] = driverData.dateOfBirth.split('-');
|
|
7055
|
+
dispatchDriverInfoState({
|
|
7056
|
+
type: exports.StoreFormCarDriverInfoActionTypes.FormCarDriverBirthYearSelect,
|
|
7057
|
+
payload: { birthYear: year, config: configState },
|
|
7058
|
+
});
|
|
7059
|
+
dispatchDriverInfoState({
|
|
7060
|
+
type: exports.StoreFormCarDriverInfoActionTypes.FormCarDriverBirthMonthSelect,
|
|
7061
|
+
payload: { birthMonth: month, config: configState },
|
|
7062
|
+
});
|
|
7063
|
+
dispatchDriverInfoState({
|
|
7064
|
+
type: exports.StoreFormCarDriverInfoActionTypes.FormCarDriverBirthDaySelect,
|
|
7065
|
+
payload: { birthDay: day, config: configState },
|
|
7066
|
+
});
|
|
7067
|
+
}
|
|
7068
|
+
// Update driver licence info
|
|
7069
|
+
dispatchDriverLicenceState({
|
|
7070
|
+
type: exports.StoreFormCarDriverLicenceActionTypes.FormCarDriverLicenceAgeSelect,
|
|
7071
|
+
payload: {
|
|
7072
|
+
firstLicenceAge: String(driverData.licenceInfo.firstLicenceAge),
|
|
7073
|
+
config: configState,
|
|
7074
|
+
},
|
|
7075
|
+
});
|
|
7076
|
+
if (driverData.licenceInfo.licenceType) {
|
|
7077
|
+
dispatchDriverLicenceState({
|
|
7078
|
+
type: exports.StoreFormCarDriverLicenceActionTypes.FormCarDriverLicenceTypeSelect,
|
|
7079
|
+
payload: {
|
|
7080
|
+
licenceType: driverData.licenceInfo.licenceType,
|
|
7081
|
+
config: configState,
|
|
7082
|
+
},
|
|
7083
|
+
});
|
|
7084
|
+
}
|
|
7085
|
+
// Update driver insurance info
|
|
7086
|
+
dispatchDriverInsuranceState({
|
|
7087
|
+
type: exports.StoreFormCarDriverInsuranceActionTypes.FormCarDriverListedSelect,
|
|
7088
|
+
payload: {
|
|
7089
|
+
listed: driverData.listed,
|
|
7090
|
+
},
|
|
7091
|
+
});
|
|
7092
|
+
if (driverData.listedYear) {
|
|
7093
|
+
const [year, month] = driverData.listedYear.split('-');
|
|
7094
|
+
if (year) {
|
|
7095
|
+
dispatchDriverInsuranceState({
|
|
7096
|
+
type: exports.StoreFormCarDriverInsuranceActionTypes.FormCarDriverListedYearSelect,
|
|
7097
|
+
payload: { listedYear: year },
|
|
7098
|
+
});
|
|
7099
|
+
}
|
|
7100
|
+
if (month) {
|
|
7101
|
+
dispatchDriverInsuranceState({
|
|
7102
|
+
type: exports.StoreFormCarDriverInsuranceActionTypes.FormCarDriverListedMonthSelect,
|
|
7103
|
+
payload: { listedMonth: month },
|
|
7104
|
+
});
|
|
7105
|
+
}
|
|
7106
|
+
}
|
|
7107
|
+
dispatchDriverInsuranceState({
|
|
7108
|
+
type: exports.StoreFormCarDriverInsuranceActionTypes.FormCarDriverInsuredSelect,
|
|
7109
|
+
payload: {
|
|
7110
|
+
insured: driverData.insured,
|
|
7111
|
+
},
|
|
7112
|
+
});
|
|
7113
|
+
if (driverData.insuredYear) {
|
|
7114
|
+
dispatchDriverInsuranceState({
|
|
7115
|
+
type: exports.StoreFormCarDriverInsuranceActionTypes.FormCarDriverInsuredDateSelect,
|
|
7116
|
+
payload: { insuredDate: driverData.insuredYear },
|
|
7117
|
+
});
|
|
7118
|
+
}
|
|
7119
|
+
// Update driver suspension and cancellation status
|
|
7120
|
+
dispatchDriverSuspensionState({
|
|
7121
|
+
type: exports.StoreFormCarDriverSuspensionActionTypes.FormCarDriverLicenceSuspensionSelect,
|
|
7122
|
+
payload: {
|
|
7123
|
+
licenceSuspension: driverData.licenceSuspension,
|
|
7124
|
+
},
|
|
7125
|
+
});
|
|
7126
|
+
dispatchDriverCancellationState({
|
|
7127
|
+
type: exports.StoreFormCarDriverCancellationActionTypes.FormCarDriverInsuranceCancellationSelect,
|
|
7128
|
+
payload: {
|
|
7129
|
+
insuranceCancellation: driverData.insuranceCancellation,
|
|
7130
|
+
},
|
|
7131
|
+
});
|
|
7132
|
+
// Update accident and ticket status
|
|
7133
|
+
dispatchDriverAccidentState({
|
|
7134
|
+
type: exports.StoreFormCarDriverAccidentActionTypes.FormCarDriverAccidentSelect,
|
|
7135
|
+
payload: {
|
|
7136
|
+
accident: driverData.accident,
|
|
7137
|
+
},
|
|
7138
|
+
});
|
|
7139
|
+
dispatchDriverTicketState({
|
|
7140
|
+
type: exports.StoreFormCarDriverTicketActionTypes.FormCarDriverTrafficTicketSelect,
|
|
7141
|
+
payload: {
|
|
7142
|
+
ticket: driverData.ticket,
|
|
7143
|
+
},
|
|
7144
|
+
});
|
|
7145
|
+
// Pre-fetch vehicle makes for the year
|
|
7146
|
+
if (vehicleData.year) {
|
|
7147
|
+
getVehicleMake(vehicleData.year);
|
|
7148
|
+
}
|
|
7149
|
+
// Pre-fetch vehicle models for year + make
|
|
7150
|
+
if (vehicleData.year && vehicleData.make) {
|
|
7151
|
+
getVehicleModel(vehicleData.year, vehicleData.make);
|
|
7152
|
+
}
|
|
7153
|
+
autofillProcessedRef.current = true;
|
|
7154
|
+
if (options?.onComplete) {
|
|
7155
|
+
options.onComplete();
|
|
7156
|
+
}
|
|
7157
|
+
}
|
|
7158
|
+
catch (error) {
|
|
7159
|
+
// Silently fail - let the app continue with normal flow
|
|
7160
|
+
console.error('Autofill initialization error:', error);
|
|
7161
|
+
}
|
|
7162
|
+
}, [
|
|
7163
|
+
configState,
|
|
7164
|
+
dispatchPostalState,
|
|
7165
|
+
dispatchVehicleState,
|
|
7166
|
+
dispatchConfigState,
|
|
7167
|
+
dispatchDriverInfoState,
|
|
7168
|
+
dispatchDriverLicenceState,
|
|
7169
|
+
dispatchDriverInsuranceState,
|
|
7170
|
+
dispatchDriverSuspensionState,
|
|
7171
|
+
dispatchDriverCancellationState,
|
|
7172
|
+
dispatchDriverAccidentState,
|
|
7173
|
+
dispatchDriverTicketState,
|
|
7174
|
+
dispatchAppModalState,
|
|
7175
|
+
getVehicleMake,
|
|
7176
|
+
getVehicleModel,
|
|
7177
|
+
]);
|
|
7178
|
+
};
|
|
7179
|
+
|
|
6715
7180
|
exports.CarQuoteDataHandler = CarQuoteDataHandler;
|
|
6716
7181
|
exports.ClearFormDataHandler = ClearFormDataHandler;
|
|
6717
7182
|
exports.HomeQuoteDataHandler = HomeQuoteDataHandler;
|
|
@@ -6727,10 +7192,17 @@ exports.formHomeReducer = formHomeReducer;
|
|
|
6727
7192
|
exports.formLifeReducer = formLifeReducer;
|
|
6728
7193
|
exports.formTenantDwellingInitialState = formTenantDwellingInitialState;
|
|
6729
7194
|
exports.getDwellingInitialState = getDwellingInitialState;
|
|
7195
|
+
exports.getProvinceName = getProvinceName;
|
|
6730
7196
|
exports.globalStateReducer = globalStateReducer;
|
|
6731
7197
|
exports.initHttpResponse = initHttpResponse;
|
|
7198
|
+
exports.mapToConfigState = mapToConfigState;
|
|
7199
|
+
exports.mapToDriverState = mapToDriverState;
|
|
7200
|
+
exports.mapToPostalState = mapToPostalState;
|
|
7201
|
+
exports.mapToVehicleState = mapToVehicleState;
|
|
7202
|
+
exports.parseAutofillParam = parseAutofillParam;
|
|
6732
7203
|
exports.reducers = reducers;
|
|
6733
7204
|
exports.token = default_1;
|
|
7205
|
+
exports.useAutofillCarForm = useAutofillCarForm;
|
|
6734
7206
|
exports.useHandlerAuth = useHandlerAuth;
|
|
6735
7207
|
exports.useHandlerCarMake = useHandlerCarMake;
|
|
6736
7208
|
exports.useHandlerCarModel = useHandlerCarModel;
|