@mychoice/mychoice-sdk-store 2.2.12 → 2.2.17
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 +82 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/services/api/carInsuranceApi.interfaces.d.ts +235 -0
- package/dist/cjs/services/api/index.d.ts +1 -0
- package/dist/cjs/states/reducers/states/formStates/FormCarState/ConfigState/hoox.d.ts +3 -0
- package/dist/cjs/states/reducers/states/formStates/FormCarState/DiscountState/interfaces.d.ts +1 -0
- package/dist/cjs/states/reducers/states/formStates/FormCarState/QuoteState/interfaces.d.ts +3 -1
- package/dist/cjs/states/reducers/states/formStates/FormCarState/VehicleState/actions.d.ts +5 -1
- package/dist/cjs/states/reducers/states/formStates/FormCarState/VehicleState/helper.d.ts +2 -2
- package/dist/cjs/states/reducers/states/formStates/FormCarState/VehicleState/initialState.d.ts +5 -0
- package/dist/cjs/states/reducers/states/formStates/FormCarState/VehicleState/interfaces.d.ts +28 -0
- package/dist/cjs/states/reducers/states/formStates/FormHomeState/QuoteState/interfaces.d.ts +3 -1
- package/dist/cjs/states/reducers/states/formStates/FormLifeState/QuoteState/interfaces.d.ts +1 -0
- package/dist/esm/index.js +82 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/services/api/carInsuranceApi.interfaces.d.ts +235 -0
- package/dist/esm/services/api/index.d.ts +1 -0
- package/dist/esm/states/reducers/states/formStates/FormCarState/ConfigState/hoox.d.ts +3 -0
- package/dist/esm/states/reducers/states/formStates/FormCarState/DiscountState/interfaces.d.ts +1 -0
- package/dist/esm/states/reducers/states/formStates/FormCarState/QuoteState/interfaces.d.ts +3 -1
- package/dist/esm/states/reducers/states/formStates/FormCarState/VehicleState/actions.d.ts +5 -1
- package/dist/esm/states/reducers/states/formStates/FormCarState/VehicleState/helper.d.ts +2 -2
- package/dist/esm/states/reducers/states/formStates/FormCarState/VehicleState/initialState.d.ts +5 -0
- package/dist/esm/states/reducers/states/formStates/FormCarState/VehicleState/interfaces.d.ts +28 -0
- package/dist/esm/states/reducers/states/formStates/FormHomeState/QuoteState/interfaces.d.ts +3 -1
- package/dist/esm/states/reducers/states/formStates/FormLifeState/QuoteState/interfaces.d.ts +1 -0
- package/dist/index.d.ts +45 -4
- package/package.json +3 -3
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Car insurance API integration interfaces.
|
|
3
|
+
* Request/response contracts for all auto (car) insurance endpoints.
|
|
4
|
+
*/
|
|
5
|
+
/** GET postal/auto/?postal_code={postalCode} */
|
|
6
|
+
export interface CarPostalGetParams {
|
|
7
|
+
postal_code: string;
|
|
8
|
+
}
|
|
9
|
+
export interface CarPostalResponse {
|
|
10
|
+
postalCode?: string;
|
|
11
|
+
city?: string;
|
|
12
|
+
locationIndex?: string;
|
|
13
|
+
provinceCode: string;
|
|
14
|
+
provinceName: string;
|
|
15
|
+
}
|
|
16
|
+
/** GET vehicle/year/{year} - response item */
|
|
17
|
+
export interface CarVehicleMakeItem {
|
|
18
|
+
make: string;
|
|
19
|
+
}
|
|
20
|
+
/** GET vehicle/year/{year}/make/{make} - response item */
|
|
21
|
+
export interface CarVehicleModelItem {
|
|
22
|
+
model: string;
|
|
23
|
+
}
|
|
24
|
+
export type CarVehicleMakeResponse = CarVehicleMakeItem[];
|
|
25
|
+
export type CarVehicleModelResponse = CarVehicleModelItem[];
|
|
26
|
+
export interface CarApiVehicleCoverage {
|
|
27
|
+
coverage: boolean;
|
|
28
|
+
deductible: number;
|
|
29
|
+
}
|
|
30
|
+
export interface CarApiVehicleLiabilityCoverage {
|
|
31
|
+
coverage: boolean;
|
|
32
|
+
limit: number;
|
|
33
|
+
}
|
|
34
|
+
export interface CarApiVehicleItem {
|
|
35
|
+
year: string | undefined;
|
|
36
|
+
make: string | undefined;
|
|
37
|
+
model: string | undefined;
|
|
38
|
+
leased: boolean;
|
|
39
|
+
purchaseDate: string;
|
|
40
|
+
winterTires: boolean;
|
|
41
|
+
parkingLocation: string;
|
|
42
|
+
primaryUse: string;
|
|
43
|
+
distanceDaily: number;
|
|
44
|
+
distanceBusiness?: number;
|
|
45
|
+
distanceYearly: number;
|
|
46
|
+
comprehensive: CarApiVehicleCoverage;
|
|
47
|
+
collision: CarApiVehicleCoverage;
|
|
48
|
+
liability: CarApiVehicleLiabilityCoverage;
|
|
49
|
+
lossofuse: CarApiVehicleLiabilityCoverage;
|
|
50
|
+
liabilityfordamage: CarApiVehicleLiabilityCoverage;
|
|
51
|
+
limitedwaiverofdepreciation: CarApiVehicleLiabilityCoverage;
|
|
52
|
+
postalCode?: string;
|
|
53
|
+
locationIndex?: string;
|
|
54
|
+
city?: string;
|
|
55
|
+
condition: string;
|
|
56
|
+
}
|
|
57
|
+
export interface CarApiDriverLicenceInfo {
|
|
58
|
+
licenceType: string;
|
|
59
|
+
firstLicenceAge: number;
|
|
60
|
+
g1LicenceDate?: string;
|
|
61
|
+
g2LicenceDate?: string;
|
|
62
|
+
gLicenceDate?: string;
|
|
63
|
+
passedDriverTraining?: boolean;
|
|
64
|
+
previousLicence?: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface CarApiDriverCancellationItem {
|
|
67
|
+
reason: string;
|
|
68
|
+
startDate: string;
|
|
69
|
+
endDate: string;
|
|
70
|
+
}
|
|
71
|
+
export interface CarApiDriverSuspensionItem {
|
|
72
|
+
reason: string;
|
|
73
|
+
suspensionDate: string;
|
|
74
|
+
reinstatementDate: string;
|
|
75
|
+
}
|
|
76
|
+
export interface CarApiDriverAccidentItem {
|
|
77
|
+
accidentDate: string;
|
|
78
|
+
}
|
|
79
|
+
export interface CarApiDriverTicketItem {
|
|
80
|
+
reason: string;
|
|
81
|
+
ticketDate: string;
|
|
82
|
+
}
|
|
83
|
+
export interface CarApiDriverItem {
|
|
84
|
+
firstName: string;
|
|
85
|
+
dateOfBirth: string;
|
|
86
|
+
maritalStatus: string;
|
|
87
|
+
gender: string;
|
|
88
|
+
occupation: string;
|
|
89
|
+
applicantRelationship?: string;
|
|
90
|
+
licenceInfo: CarApiDriverLicenceInfo;
|
|
91
|
+
listed: boolean;
|
|
92
|
+
listedYear?: string;
|
|
93
|
+
insured: boolean;
|
|
94
|
+
insuredYear?: string;
|
|
95
|
+
insuranceCancellation: boolean;
|
|
96
|
+
insuranceCancellationList?: CarApiDriverCancellationItem[];
|
|
97
|
+
licenceSuspension: boolean;
|
|
98
|
+
licenceSuspensionList?: CarApiDriverSuspensionItem[];
|
|
99
|
+
accident: boolean;
|
|
100
|
+
accidentList?: CarApiDriverAccidentItem[];
|
|
101
|
+
ticket: boolean;
|
|
102
|
+
ticketList?: CarApiDriverTicketItem[];
|
|
103
|
+
}
|
|
104
|
+
export interface CarApiQuoterInfo {
|
|
105
|
+
firstName: string;
|
|
106
|
+
lastName: string;
|
|
107
|
+
phone: string;
|
|
108
|
+
recalculate: boolean;
|
|
109
|
+
utmSource?: string;
|
|
110
|
+
utmCampaign?: string;
|
|
111
|
+
utmProducer?: string;
|
|
112
|
+
partner?: string;
|
|
113
|
+
initial: boolean;
|
|
114
|
+
hasToBeConfirmed?: boolean;
|
|
115
|
+
/** TheBig-specific */
|
|
116
|
+
brokerInfo?: Record<string, string | number | boolean>;
|
|
117
|
+
driverLicense?: string;
|
|
118
|
+
splashScreen?: boolean;
|
|
119
|
+
caslConsent?: boolean;
|
|
120
|
+
}
|
|
121
|
+
/** Driver–vehicle link: priority is 'Prn' | 'Occ' */
|
|
122
|
+
export interface CarApiVehLink {
|
|
123
|
+
driverIndex: number;
|
|
124
|
+
vehicleIndex: number;
|
|
125
|
+
priority: string;
|
|
126
|
+
}
|
|
127
|
+
export interface CarQuoteRequest {
|
|
128
|
+
vehicles: CarApiVehicleItem[];
|
|
129
|
+
drivers: CarApiDriverItem[];
|
|
130
|
+
vehlinks: CarApiVehLink[];
|
|
131
|
+
appInstallDiscount: boolean;
|
|
132
|
+
caaMemberDiscount: boolean;
|
|
133
|
+
multiplePoliciesDiscount: boolean;
|
|
134
|
+
policyStart: string;
|
|
135
|
+
quoterInfo: CarApiQuoterInfo;
|
|
136
|
+
emailTo: string;
|
|
137
|
+
provinceCode: string;
|
|
138
|
+
provinceName: string;
|
|
139
|
+
/** Present for TheBig app type */
|
|
140
|
+
postalCode?: string;
|
|
141
|
+
city?: string;
|
|
142
|
+
locationIndex?: string;
|
|
143
|
+
}
|
|
144
|
+
export interface CarQuoteCoverageItem {
|
|
145
|
+
annualPremium: number;
|
|
146
|
+
code: string;
|
|
147
|
+
deductible: string;
|
|
148
|
+
limit1: string;
|
|
149
|
+
limit2: string;
|
|
150
|
+
}
|
|
151
|
+
export interface CarQuoteBrokerProfile {
|
|
152
|
+
description: string;
|
|
153
|
+
hoursSaturday: string;
|
|
154
|
+
hoursSunday: string;
|
|
155
|
+
hoursWorkdays: string;
|
|
156
|
+
logo: string;
|
|
157
|
+
phone: string;
|
|
158
|
+
title: string;
|
|
159
|
+
redirectUrl?: string;
|
|
160
|
+
}
|
|
161
|
+
export interface CarQuoteCompany {
|
|
162
|
+
description: string;
|
|
163
|
+
logo: string;
|
|
164
|
+
name: string;
|
|
165
|
+
}
|
|
166
|
+
export interface CarQuoteNonStandardCoverages {
|
|
167
|
+
20: boolean;
|
|
168
|
+
27: boolean;
|
|
169
|
+
43: boolean;
|
|
170
|
+
aCCW: boolean;
|
|
171
|
+
}
|
|
172
|
+
export interface CarBrokerIntegration {
|
|
173
|
+
type: string;
|
|
174
|
+
data: Record<string, unknown>;
|
|
175
|
+
}
|
|
176
|
+
export interface CarQuoteItemResponse {
|
|
177
|
+
brokerProfile: CarQuoteBrokerProfile;
|
|
178
|
+
company: CarQuoteCompany;
|
|
179
|
+
date: string;
|
|
180
|
+
id: number | null;
|
|
181
|
+
priceMonthly: string;
|
|
182
|
+
priceYearly: string;
|
|
183
|
+
confirmQuote?: boolean;
|
|
184
|
+
coverages: CarQuoteCoverageItem[];
|
|
185
|
+
nonStandardCoverages: CarQuoteNonStandardCoverages;
|
|
186
|
+
brokerIntegration?: CarBrokerIntegration;
|
|
187
|
+
}
|
|
188
|
+
export type CarQuoteResponse = CarQuoteItemResponse[];
|
|
189
|
+
/** Request body same as CarQuoteRequest. Response: */
|
|
190
|
+
export interface CarOnliaRedirectResponse {
|
|
191
|
+
redirectUrl: string;
|
|
192
|
+
}
|
|
193
|
+
export interface CarSendLeadRequest {
|
|
194
|
+
quote_id: number | null;
|
|
195
|
+
first_name: string;
|
|
196
|
+
last_name: string;
|
|
197
|
+
phone: string;
|
|
198
|
+
}
|
|
199
|
+
export interface CarInsuranceApiEndpoints {
|
|
200
|
+
/** GET - resolve postal code; params: CarPostalGetParams */
|
|
201
|
+
getPostal: {
|
|
202
|
+
params: CarPostalGetParams;
|
|
203
|
+
response: CarPostalResponse;
|
|
204
|
+
};
|
|
205
|
+
/** GET - list makes for year; path: vehicle/year/{year} */
|
|
206
|
+
getVehicleMakes: {
|
|
207
|
+
params: {
|
|
208
|
+
year: string;
|
|
209
|
+
};
|
|
210
|
+
response: CarVehicleMakeResponse;
|
|
211
|
+
};
|
|
212
|
+
/** GET - list models for year and make; path: vehicle/year/{year}/make/{make} */
|
|
213
|
+
getVehicleModels: {
|
|
214
|
+
params: {
|
|
215
|
+
year: string;
|
|
216
|
+
make: string;
|
|
217
|
+
};
|
|
218
|
+
response: CarVehicleModelResponse;
|
|
219
|
+
};
|
|
220
|
+
/** POST - submit quote; body: CarQuoteRequest */
|
|
221
|
+
postQuote: {
|
|
222
|
+
body: CarQuoteRequest;
|
|
223
|
+
response: CarQuoteResponse;
|
|
224
|
+
};
|
|
225
|
+
/** POST - get Onlia redirect URL; body: CarQuoteRequest */
|
|
226
|
+
postQuoteOnliaUrl: {
|
|
227
|
+
body: CarQuoteRequest;
|
|
228
|
+
response: CarOnliaRedirectResponse;
|
|
229
|
+
};
|
|
230
|
+
/** POST - send lead after quote; body: CarSendLeadRequest */
|
|
231
|
+
postSendLead: {
|
|
232
|
+
body: CarSendLeadRequest;
|
|
233
|
+
response: unknown;
|
|
234
|
+
};
|
|
235
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './carInsuranceApi.interfaces';
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { FormCarConfigHookInterface, ProvinceHookInterface } from './interfaces';
|
|
2
2
|
export declare const useStoreFormCarConfig: () => FormCarConfigHookInterface;
|
|
3
3
|
export declare const useProvince: () => ProvinceHookInterface;
|
|
4
|
+
export declare const useAbReform: () => {
|
|
5
|
+
isAbReformActive: boolean;
|
|
6
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { StoreFormCarQuoteActionTypes } from './actions';
|
|
2
2
|
export declare enum CarBrokerTypeEnum {
|
|
3
|
-
Youset = "youset"
|
|
3
|
+
Youset = "youset",
|
|
4
|
+
Mitch = "mitch"
|
|
4
5
|
}
|
|
5
6
|
export interface BrokerProfileInterface {
|
|
6
7
|
description: string;
|
|
@@ -26,6 +27,7 @@ export interface CarQuoteCoverageInterface {
|
|
|
26
27
|
}
|
|
27
28
|
export interface CarBrokerIntegrationInterface {
|
|
28
29
|
type: CarBrokerTypeEnum;
|
|
30
|
+
ux?: 'contactonly';
|
|
29
31
|
data: Record<string, any>;
|
|
30
32
|
}
|
|
31
33
|
export interface CarQuoteItemInterface {
|
|
@@ -30,5 +30,9 @@ export declare enum StoreFormCarVehicleActionTypes {
|
|
|
30
30
|
FormCarVehicleValidateSet = "FormCarVehicleValidateSet",
|
|
31
31
|
FormCarLossOfUseCoverageSelect = "FormCarLossOfUseCoverageSelect",
|
|
32
32
|
FormCarLiabilityForDamageCoverageSelect = "FormCarLiabilityForDamageCoverageSelect",
|
|
33
|
-
FormCarLimitedWaiverOfDepreciationCoverageSelect = "FormCarLimitedWaiverOfDepreciationCoverageSelect"
|
|
33
|
+
FormCarLimitedWaiverOfDepreciationCoverageSelect = "FormCarLimitedWaiverOfDepreciationCoverageSelect",
|
|
34
|
+
FormCarAccidentBenefitsBaseCoverageSelect = "FormCarAccidentBenefitsBaseCoverageSelect",
|
|
35
|
+
FormCarAccidentBenefitsAdditionalCoveragesSet = "FormCarAccidentBenefitsAdditionalCoveragesSet",
|
|
36
|
+
FormCarAccidentBenefitsAdditionalCoverageRemove = "FormCarAccidentBenefitsAdditionalCoverageRemove",
|
|
37
|
+
FormCarAccidentBenefitsAcknowledge = "FormCarAccidentBenefitsAcknowledge"
|
|
34
38
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { VehicleConditionTypes } from '@mychoice/mychoice-sdk-components';
|
|
2
|
-
import { FormCarVehicleStateInterface } from './interfaces';
|
|
2
|
+
import { VehicleAccidentBenefitsInterface, FormCarVehicleStateInterface } from './interfaces';
|
|
3
3
|
export declare const removeVehicleItem: (state: FormCarVehicleStateInterface, vehicleIndex: number) => FormCarVehicleStateInterface;
|
|
4
4
|
export declare const createVehicleItem: (state: FormCarVehicleStateInterface) => FormCarVehicleStateInterface;
|
|
5
5
|
export declare const setVehicleProperty: (state: FormCarVehicleStateInterface, name: string, value: boolean) => FormCarVehicleStateInterface;
|
|
6
6
|
export declare const setVehicleYear: (state: FormCarVehicleStateInterface, vehicleYear: string) => FormCarVehicleStateInterface;
|
|
7
7
|
export declare const setVehicleMake: (state: FormCarVehicleStateInterface, vehicleMake: string) => FormCarVehicleStateInterface;
|
|
8
8
|
export declare const setVehicleModel: (state: FormCarVehicleStateInterface, vehicleModel: string) => FormCarVehicleStateInterface;
|
|
9
|
-
export declare const setItemProperty: (state: FormCarVehicleStateInterface, name: string, value: string | boolean | VehicleConditionTypes) => FormCarVehicleStateInterface;
|
|
9
|
+
export declare const setItemProperty: (state: FormCarVehicleStateInterface, name: string, value: string | string[] | boolean | VehicleConditionTypes | VehicleAccidentBenefitsInterface) => FormCarVehicleStateInterface;
|
|
10
10
|
export declare const setCarCoverageProperty: (state: FormCarVehicleStateInterface, name: string, coverage: boolean, value: number) => FormCarVehicleStateInterface;
|
package/dist/cjs/states/reducers/states/formStates/FormCarState/VehicleState/initialState.d.ts
CHANGED
|
@@ -23,5 +23,10 @@ export declare const limitedWaiverOfDepreciationInitialState: {
|
|
|
23
23
|
coverage: boolean;
|
|
24
24
|
limit: number;
|
|
25
25
|
};
|
|
26
|
+
export declare const vehicleAccidentBenefitsInitialState: {
|
|
27
|
+
baseCoverage: string;
|
|
28
|
+
additionalCoverages: never[];
|
|
29
|
+
abAcknowledged: boolean;
|
|
30
|
+
};
|
|
26
31
|
export declare const vehicleItemInitialState: VehicleItemInterface;
|
|
27
32
|
export declare const carFormVehicleInitialState: FormCarVehicleStateInterface;
|
package/dist/cjs/states/reducers/states/formStates/FormCarState/VehicleState/interfaces.d.ts
CHANGED
|
@@ -25,6 +25,11 @@ export interface VehicleLimitedWaiverOfDepreciationInterface {
|
|
|
25
25
|
coverage: boolean;
|
|
26
26
|
limit: number;
|
|
27
27
|
}
|
|
28
|
+
export interface VehicleAccidentBenefitsInterface {
|
|
29
|
+
baseCoverage: string;
|
|
30
|
+
additionalCoverages: string[];
|
|
31
|
+
abAcknowledged?: boolean;
|
|
32
|
+
}
|
|
28
33
|
export interface VehicleItemInterface {
|
|
29
34
|
year: string | undefined;
|
|
30
35
|
make: string | undefined;
|
|
@@ -46,6 +51,7 @@ export interface VehicleItemInterface {
|
|
|
46
51
|
lossofuse: VehicleLossOfUseInterface;
|
|
47
52
|
liabilityfordamage: VehicleLiabilityForDamageInterface;
|
|
48
53
|
limitedwaiverofdepreciation: VehicleLimitedWaiverOfDepreciationInterface;
|
|
54
|
+
accidentbenefits: VehicleAccidentBenefitsInterface;
|
|
49
55
|
postalCode: string;
|
|
50
56
|
locationIndex: string;
|
|
51
57
|
city: string;
|
|
@@ -224,6 +230,28 @@ export type FormCarVehicleStateActionType = {
|
|
|
224
230
|
limit: number;
|
|
225
231
|
};
|
|
226
232
|
localIndex?: string;
|
|
233
|
+
} | {
|
|
234
|
+
type: StoreFormCarVehicleActionTypes.FormCarAccidentBenefitsBaseCoverageSelect;
|
|
235
|
+
payload: {
|
|
236
|
+
baseCoverage: string;
|
|
237
|
+
};
|
|
238
|
+
localIndex?: string;
|
|
239
|
+
} | {
|
|
240
|
+
type: StoreFormCarVehicleActionTypes.FormCarAccidentBenefitsAdditionalCoveragesSet;
|
|
241
|
+
payload: {
|
|
242
|
+
additionalCoverages: string[];
|
|
243
|
+
};
|
|
244
|
+
localIndex?: string;
|
|
245
|
+
} | {
|
|
246
|
+
type: StoreFormCarVehicleActionTypes.FormCarAccidentBenefitsAdditionalCoverageRemove;
|
|
247
|
+
payload: {
|
|
248
|
+
coverageValue: string;
|
|
249
|
+
};
|
|
250
|
+
localIndex?: string;
|
|
251
|
+
} | {
|
|
252
|
+
type: StoreFormCarVehicleActionTypes.FormCarAccidentBenefitsAcknowledge;
|
|
253
|
+
payload?: null;
|
|
254
|
+
localIndex?: string;
|
|
227
255
|
};
|
|
228
256
|
export type FormCarVehicleStateReducerInterface = (state: FormCarVehicleStateInterface, action: FormCarVehicleStateActionType) => void;
|
|
229
257
|
export interface ClientHookInterface {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { StoreFormHomeQuoteActionTypes } from './actions';
|
|
2
2
|
export declare enum HomeBrokerTypeEnum {
|
|
3
|
-
Youset = "youset"
|
|
3
|
+
Youset = "youset",
|
|
4
|
+
Mitch = "mitch"
|
|
4
5
|
}
|
|
5
6
|
export interface HomeBrokerIntegrationInterface {
|
|
6
7
|
type: HomeBrokerTypeEnum;
|
|
8
|
+
ux?: 'contactonly';
|
|
7
9
|
data: Record<string, any>;
|
|
8
10
|
}
|
|
9
11
|
export interface BrokerProfileInterface {
|
package/dist/esm/index.js
CHANGED
|
@@ -420,6 +420,7 @@ const globalStateReducer = combineReducers({
|
|
|
420
420
|
var CarBrokerTypeEnum;
|
|
421
421
|
(function (CarBrokerTypeEnum) {
|
|
422
422
|
CarBrokerTypeEnum["Youset"] = "youset";
|
|
423
|
+
CarBrokerTypeEnum["Mitch"] = "mitch";
|
|
423
424
|
})(CarBrokerTypeEnum || (CarBrokerTypeEnum = {}));
|
|
424
425
|
|
|
425
426
|
const vehicleComprehensiveInitialState = {
|
|
@@ -446,6 +447,11 @@ const limitedWaiverOfDepreciationInitialState = {
|
|
|
446
447
|
coverage: true,
|
|
447
448
|
limit: 1,
|
|
448
449
|
};
|
|
450
|
+
const vehicleAccidentBenefitsInitialState = {
|
|
451
|
+
baseCoverage: 'minimum_required',
|
|
452
|
+
additionalCoverages: [],
|
|
453
|
+
abAcknowledged: false,
|
|
454
|
+
};
|
|
449
455
|
const vehicleItemInitialState = {
|
|
450
456
|
year: '',
|
|
451
457
|
make: '',
|
|
@@ -468,6 +474,7 @@ const vehicleItemInitialState = {
|
|
|
468
474
|
lossofuse: { ...vehicleLossOfUseInitialState },
|
|
469
475
|
liabilityfordamage: { ...vehicleLiabilityForDamageInitialState },
|
|
470
476
|
limitedwaiverofdepreciation: { ...limitedWaiverOfDepreciationInitialState },
|
|
477
|
+
accidentbenefits: { ...vehicleAccidentBenefitsInitialState },
|
|
471
478
|
postalCode: '',
|
|
472
479
|
locationIndex: '',
|
|
473
480
|
city: '',
|
|
@@ -523,6 +530,10 @@ var StoreFormCarVehicleActionTypes;
|
|
|
523
530
|
StoreFormCarVehicleActionTypes["FormCarLossOfUseCoverageSelect"] = "FormCarLossOfUseCoverageSelect";
|
|
524
531
|
StoreFormCarVehicleActionTypes["FormCarLiabilityForDamageCoverageSelect"] = "FormCarLiabilityForDamageCoverageSelect";
|
|
525
532
|
StoreFormCarVehicleActionTypes["FormCarLimitedWaiverOfDepreciationCoverageSelect"] = "FormCarLimitedWaiverOfDepreciationCoverageSelect";
|
|
533
|
+
StoreFormCarVehicleActionTypes["FormCarAccidentBenefitsBaseCoverageSelect"] = "FormCarAccidentBenefitsBaseCoverageSelect";
|
|
534
|
+
StoreFormCarVehicleActionTypes["FormCarAccidentBenefitsAdditionalCoveragesSet"] = "FormCarAccidentBenefitsAdditionalCoveragesSet";
|
|
535
|
+
StoreFormCarVehicleActionTypes["FormCarAccidentBenefitsAdditionalCoverageRemove"] = "FormCarAccidentBenefitsAdditionalCoverageRemove";
|
|
536
|
+
StoreFormCarVehicleActionTypes["FormCarAccidentBenefitsAcknowledge"] = "FormCarAccidentBenefitsAcknowledge";
|
|
526
537
|
})(StoreFormCarVehicleActionTypes || (StoreFormCarVehicleActionTypes = {}));
|
|
527
538
|
|
|
528
539
|
const createTab = (name, id) => ({
|
|
@@ -556,6 +567,7 @@ const createVehicleItem = (state) => ({
|
|
|
556
567
|
comprehensive: state.items[0].comprehensive,
|
|
557
568
|
collision: state.items[0].collision,
|
|
558
569
|
liability: state.items[0].liability,
|
|
570
|
+
accidentbenefits: state.items[0].accidentbenefits,
|
|
559
571
|
},
|
|
560
572
|
],
|
|
561
573
|
tabs: [...state.tabs, { ...createTab('Vehicle', state.tabs.length) }],
|
|
@@ -687,6 +699,26 @@ const formCarVehicleStateReducer = (state = { ...carFormVehicleInitialState }, a
|
|
|
687
699
|
return setLocalVehicles(action.localIndex, setCarCoverageProperty(state, 'liabilityfordamage', action.payload.coverage, action.payload.limit));
|
|
688
700
|
case StoreFormCarVehicleActionTypes.FormCarLimitedWaiverOfDepreciationCoverageSelect:
|
|
689
701
|
return setLocalVehicles(action.localIndex, setCarCoverageProperty(state, 'limitedwaiverofdepreciation', action.payload.coverage, action.payload.limit));
|
|
702
|
+
case StoreFormCarVehicleActionTypes.FormCarAccidentBenefitsBaseCoverageSelect:
|
|
703
|
+
return setLocalVehicles(action.localIndex, setItemProperty(state, 'accidentbenefits', {
|
|
704
|
+
...state.items[state.activeIndex].accidentbenefits,
|
|
705
|
+
baseCoverage: action.payload.baseCoverage,
|
|
706
|
+
}));
|
|
707
|
+
case StoreFormCarVehicleActionTypes.FormCarAccidentBenefitsAdditionalCoveragesSet:
|
|
708
|
+
return setLocalVehicles(action.localIndex, setItemProperty(state, 'accidentbenefits', {
|
|
709
|
+
...state.items[state.activeIndex].accidentbenefits,
|
|
710
|
+
additionalCoverages: action.payload.additionalCoverages,
|
|
711
|
+
}));
|
|
712
|
+
case StoreFormCarVehicleActionTypes.FormCarAccidentBenefitsAdditionalCoverageRemove:
|
|
713
|
+
return setLocalVehicles(action.localIndex, setItemProperty(state, 'accidentbenefits', {
|
|
714
|
+
...state.items[state.activeIndex].accidentbenefits,
|
|
715
|
+
additionalCoverages: state.items[state.activeIndex].accidentbenefits.additionalCoverages.filter((coverage) => coverage !== action.payload.coverageValue),
|
|
716
|
+
}));
|
|
717
|
+
case StoreFormCarVehicleActionTypes.FormCarAccidentBenefitsAcknowledge:
|
|
718
|
+
return setLocalVehicles(action.localIndex, setItemProperty(state, 'accidentbenefits', {
|
|
719
|
+
...state.items[state.activeIndex].accidentbenefits,
|
|
720
|
+
abAcknowledged: true,
|
|
721
|
+
}));
|
|
690
722
|
default:
|
|
691
723
|
return state;
|
|
692
724
|
}
|
|
@@ -2254,6 +2286,7 @@ const getDwellingInitialState = (type) => {
|
|
|
2254
2286
|
var HomeBrokerTypeEnum;
|
|
2255
2287
|
(function (HomeBrokerTypeEnum) {
|
|
2256
2288
|
HomeBrokerTypeEnum["Youset"] = "youset";
|
|
2289
|
+
HomeBrokerTypeEnum["Mitch"] = "mitch";
|
|
2257
2290
|
})(HomeBrokerTypeEnum || (HomeBrokerTypeEnum = {}));
|
|
2258
2291
|
|
|
2259
2292
|
const formHomePostalInitialState = {
|
|
@@ -3712,6 +3745,16 @@ const useProvince = () => {
|
|
|
3712
3745
|
isOntarioProvince: code === OntarioCode,
|
|
3713
3746
|
};
|
|
3714
3747
|
};
|
|
3748
|
+
const useAbReform = () => {
|
|
3749
|
+
const { isOntarioProvince } = useProvince();
|
|
3750
|
+
const { discountState } = useTypedSelector((state) => state).formCarState;
|
|
3751
|
+
const { policyStartYear, policyStartMonth, policyStartDay, policyStart, } = discountState;
|
|
3752
|
+
const policyStartDate = policyStartYear && policyStartMonth && policyStartDay
|
|
3753
|
+
? `${policyStartYear}-${policyStartMonth}-${policyStartDay}`
|
|
3754
|
+
: policyStart;
|
|
3755
|
+
const isAbReformActive = isOntarioProvince && policyStartDate >= '2026-07-01';
|
|
3756
|
+
return { isAbReformActive };
|
|
3757
|
+
};
|
|
3715
3758
|
|
|
3716
3759
|
const useStoreFormHomeQuote = () => {
|
|
3717
3760
|
const { appConfigState } = useStoreAppConfig();
|
|
@@ -5045,9 +5088,12 @@ const CarQuoteDataHandler = () => {
|
|
|
5045
5088
|
const postal = deepClone(postalState).item;
|
|
5046
5089
|
const discount = deepClone(discountState);
|
|
5047
5090
|
const { policyStartYear, policyStartMonth, policyStartDay } = discountState;
|
|
5091
|
+
const policyStartDate = policyStartYear && policyStartMonth && policyStartDay
|
|
5092
|
+
? `${policyStartYear}-${policyStartMonth}-${policyStartDay}`
|
|
5093
|
+
: discountState.policyStart;
|
|
5048
5094
|
// dispatchQuoteState({ type: StoreFormCarQuoteActionTypes.UpdateCarCallMessage, payload: { showCallMessage: false } });
|
|
5049
5095
|
if (policyStartYear && policyStartMonth && policyStartDay) {
|
|
5050
|
-
discount.policyStart =
|
|
5096
|
+
discount.policyStart = policyStartDate;
|
|
5051
5097
|
delete discount.policyStartYear;
|
|
5052
5098
|
delete discount.policyStartMonth;
|
|
5053
5099
|
delete discount.policyStartDay;
|
|
@@ -5064,6 +5110,13 @@ const CarQuoteDataHandler = () => {
|
|
|
5064
5110
|
provinceName: postal.provinceName,
|
|
5065
5111
|
};
|
|
5066
5112
|
requestBody.quoterInfo.recalculate = isRecalc;
|
|
5113
|
+
const isAbReformEligible = requestBody.provinceCode === 'ON' && policyStartDate >= '2026-07-01';
|
|
5114
|
+
// Flag if any Accident Benefits buy-ups are selected (Ontario only)
|
|
5115
|
+
if (isRecalc && isAbReformEligible) {
|
|
5116
|
+
const hasAbChanges = vehicles.some((v) => v.accidentbenefits?.baseCoverage !== 'minimum_required'
|
|
5117
|
+
|| v.accidentbenefits?.additionalCoverages?.length > 0);
|
|
5118
|
+
requestBody.quoterInfo.accidentBenefitsChanged = hasAbChanges;
|
|
5119
|
+
}
|
|
5067
5120
|
delete requestBody.isValid;
|
|
5068
5121
|
delete requestBody.inValidation;
|
|
5069
5122
|
if (hasToBeConfirmed !== undefined) {
|
|
@@ -5273,7 +5326,20 @@ const CarQuoteDataHandler = () => {
|
|
|
5273
5326
|
vehicle.comprehensive.coverage = false;
|
|
5274
5327
|
vehicle.comprehensive.deductible = 1000;
|
|
5275
5328
|
}
|
|
5276
|
-
|
|
5329
|
+
const { accidentbenefits, ...vehiclePayload } = vehicle;
|
|
5330
|
+
const transformedVehicle = { ...vehiclePayload };
|
|
5331
|
+
if (accidentbenefits) {
|
|
5332
|
+
const { baseCoverage, additionalCoverages } = accidentbenefits;
|
|
5333
|
+
if (isAbReformEligible
|
|
5334
|
+
&& (baseCoverage !== 'minimum_required' || additionalCoverages.length > 0)) {
|
|
5335
|
+
transformedVehicle.accidentBenefits = {
|
|
5336
|
+
baseCoverage,
|
|
5337
|
+
additionalCoverages,
|
|
5338
|
+
};
|
|
5339
|
+
}
|
|
5340
|
+
}
|
|
5341
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5342
|
+
return transformedVehicle;
|
|
5277
5343
|
});
|
|
5278
5344
|
requestBody.vehlinks = localVehlinks;
|
|
5279
5345
|
return {
|
|
@@ -5854,6 +5920,7 @@ const useValidationVehicle = () => {
|
|
|
5854
5920
|
const { inValidation: vehicleFormIsInValidation = false, isValid: vehicleFormIsValid = false, } = vehicleState;
|
|
5855
5921
|
const { appConfigState } = useStoreAppConfig();
|
|
5856
5922
|
const { dispatchAppModalState } = useStoreAppModal();
|
|
5923
|
+
const { isAbReformActive } = useAbReform();
|
|
5857
5924
|
const navigate = useNavigate();
|
|
5858
5925
|
const vehicleFormValidate = (isRedirect = true) => {
|
|
5859
5926
|
let formIsValid = false;
|
|
@@ -5884,6 +5951,13 @@ const useValidationVehicle = () => {
|
|
|
5884
5951
|
return item;
|
|
5885
5952
|
});
|
|
5886
5953
|
});
|
|
5954
|
+
if (isAbReformActive) {
|
|
5955
|
+
vehicleState.items.forEach((item) => {
|
|
5956
|
+
if (!item.accidentbenefits.abAcknowledged) {
|
|
5957
|
+
errors.push('abAcknowledged');
|
|
5958
|
+
}
|
|
5959
|
+
});
|
|
5960
|
+
}
|
|
5887
5961
|
if (!errors.length) {
|
|
5888
5962
|
dispatchVehicleState({
|
|
5889
5963
|
type: StoreFormCarVehicleActionTypes.FormCarVehicleValidateSet,
|
|
@@ -5896,12 +5970,15 @@ const useValidationVehicle = () => {
|
|
|
5896
5970
|
formIsValid = true;
|
|
5897
5971
|
}
|
|
5898
5972
|
else {
|
|
5899
|
-
const element = document.getElementsByName(errors[0])[0];
|
|
5973
|
+
const element = document.getElementsByName(errors[0])[0] ?? document.getElementById(errors[0]);
|
|
5900
5974
|
element?.scrollIntoView({ block: 'center', behavior: 'smooth' });
|
|
5975
|
+
const hasOnlyAbError = errors.every((e) => e === 'abAcknowledged');
|
|
5901
5976
|
dispatchAppModalState({
|
|
5902
5977
|
type: StoreConfigAppModalActionTypes.AppModalMessageModal,
|
|
5903
5978
|
payload: {
|
|
5904
|
-
title:
|
|
5979
|
+
title: hasOnlyAbError
|
|
5980
|
+
? 'Please review the Accident Benefits section'
|
|
5981
|
+
: 'Please enter missing values of required fields',
|
|
5905
5982
|
},
|
|
5906
5983
|
});
|
|
5907
5984
|
dispatchVehicleState({
|
|
@@ -7439,5 +7516,5 @@ const useAutofillLifeForm = (options) => {
|
|
|
7439
7516
|
}, [dispatchPostalState, dispatchCoverageState, dispatchApplicantState, dispatchQuoteState, dispatchAppModalState]);
|
|
7440
7517
|
};
|
|
7441
7518
|
|
|
7442
|
-
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, 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 };
|
|
7519
|
+
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 };
|
|
7443
7520
|
//# sourceMappingURL=index.js.map
|