@mychoice/mychoice-sdk-components 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/components/inputs/InputFormPhone/InputFormPhone.d.ts +2 -2
- package/dist/cjs/components/inputs/interfaces.d.ts +6 -0
- package/dist/cjs/constants/api.d.ts +1 -0
- package/dist/cjs/constants/forms/user.d.ts +1 -1
- package/dist/cjs/constants/insurances/car/pages/vehicle.d.ts +4 -0
- package/dist/cjs/index.js +52 -25
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/inputs/InputFormPhone/InputFormPhone.d.ts +2 -2
- package/dist/esm/components/inputs/interfaces.d.ts +6 -0
- package/dist/esm/constants/api.d.ts +1 -0
- package/dist/esm/constants/forms/user.d.ts +1 -1
- package/dist/esm/constants/insurances/car/pages/vehicle.d.ts +4 -0
- package/dist/esm/index.js +52 -26
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +14 -3
- package/package.json +2 -2
- package/dist/cjs/components/quotes/OfferCoverage/OfferCoverage.d.ts +0 -3
- package/dist/cjs/components/quotes/OfferCoverage/index.d.ts +0 -1
- package/dist/cjs/components/quotes/VehicleOfferCoverage/VehicleOfferCoverage.d.ts +0 -3
- package/dist/cjs/components/quotes/VehicleOfferCoverage/index.d.ts +0 -1
- package/dist/esm/components/quotes/OfferCoverage/OfferCoverage.d.ts +0 -3
- package/dist/esm/components/quotes/OfferCoverage/index.d.ts +0 -1
- package/dist/esm/components/quotes/VehicleOfferCoverage/VehicleOfferCoverage.d.ts +0 -3
- package/dist/esm/components/quotes/VehicleOfferCoverage/index.d.ts +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SdkFC } from '../../../interfaces';
|
|
2
|
-
import {
|
|
3
|
-
export declare const InputFormPhone: SdkFC<
|
|
2
|
+
import { PhoneInputProps } from '../interfaces';
|
|
3
|
+
export declare const InputFormPhone: SdkFC<PhoneInputProps>;
|
|
@@ -18,3 +18,9 @@ export type EmailInputProps = DefaultInputProps & {
|
|
|
18
18
|
validationStatus?: ValidationStatusTypes;
|
|
19
19
|
onChange?: (option: OnChangeEventInterface) => void;
|
|
20
20
|
};
|
|
21
|
+
export type PhoneInputProps = DefaultInputProps & {
|
|
22
|
+
size?: SizeTypes;
|
|
23
|
+
type?: InputTypes;
|
|
24
|
+
onChange?: (option: OnChangeEventInterface) => void;
|
|
25
|
+
validationStatus?: ValidationStatusTypes;
|
|
26
|
+
};
|
|
@@ -26,6 +26,10 @@ export declare const carUsagePurpose: {
|
|
|
26
26
|
value: string;
|
|
27
27
|
name: string;
|
|
28
28
|
}[];
|
|
29
|
+
export declare const businessUsePercentOptions: {
|
|
30
|
+
value: string;
|
|
31
|
+
name: string;
|
|
32
|
+
}[];
|
|
29
33
|
export declare const firstDriveDistanceList: {
|
|
30
34
|
value: string;
|
|
31
35
|
name: string;
|
package/dist/cjs/index.js
CHANGED
|
@@ -37,12 +37,17 @@ IconDropdownArrow.defaultProps = {
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
const numberWithCommas$1 = (value) => value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
40
|
-
const dailyKilometresRange = [1, 2, 5, 7,
|
|
40
|
+
const dailyKilometresRange = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
|
41
|
+
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
|
|
42
|
+
50, 60, 70, 80, 90, 100, 150, 200];
|
|
41
43
|
const dailyKilometresRangeForBusiness = [
|
|
42
44
|
1, 2, 5, 7, 10, 15, 20, 30, 40, 50, 60, 70, 80, 90, 100, 150, 200, 250, 300, 350, 400,
|
|
43
45
|
];
|
|
44
46
|
const yearlyKilometresRange = [
|
|
45
|
-
500, 1000, 2000, 3000,
|
|
47
|
+
500, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000,
|
|
48
|
+
11000, 12000, 13000, 14000, 15000, 16000, 17000, 18000, 19000, 20000,
|
|
49
|
+
21000, 22000, 23000, 24000, 25000, 26000, 27000, 28000, 29000, 30000,
|
|
50
|
+
35000, 40000, 45000, 50000, 60000, 80000, 100000,
|
|
46
51
|
];
|
|
47
52
|
const carCondition = [
|
|
48
53
|
{ value: 'N', name: 'New' },
|
|
@@ -78,9 +83,18 @@ const carUsagePurpose = [
|
|
|
78
83
|
{ value: 'personal', name: 'Personal' },
|
|
79
84
|
{ value: 'business', name: 'Business' },
|
|
80
85
|
];
|
|
86
|
+
const businessUsePercentOptions = [
|
|
87
|
+
{ value: '25', name: 'Up to 25%' },
|
|
88
|
+
{ value: '50', name: '50%' },
|
|
89
|
+
{ value: '75', name: '75%' },
|
|
90
|
+
{ value: '100', name: '100%' },
|
|
91
|
+
];
|
|
81
92
|
const firstDriveDistanceList = dailyKilometresRange.map((item) => {
|
|
82
|
-
if (item ===
|
|
83
|
-
return { value: `${item}`, name:
|
|
93
|
+
if (item === 0) {
|
|
94
|
+
return { value: `${item}`, name: '0KM (No commute)' };
|
|
95
|
+
}
|
|
96
|
+
if (item === 200) {
|
|
97
|
+
return { value: `${item}`, name: '200+ KM' };
|
|
84
98
|
}
|
|
85
99
|
return { value: `${item}`, name: `${numberWithCommas$1(item)}KM` };
|
|
86
100
|
});
|
|
@@ -90,10 +104,12 @@ const dailyDriveBusinessDistanceList = dailyKilometresRangeForBusiness.map((item
|
|
|
90
104
|
}
|
|
91
105
|
return { value: `${item}`, name: `${item}KM` };
|
|
92
106
|
});
|
|
93
|
-
const yearlyDriveDistanceList = yearlyKilometresRange.map((item) =>
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
107
|
+
const yearlyDriveDistanceList = yearlyKilometresRange.map((item) => {
|
|
108
|
+
if (item === 100000) {
|
|
109
|
+
return { value: `${item}`, name: '100,000+ KM' };
|
|
110
|
+
}
|
|
111
|
+
return { value: `${item}`, name: `${numberWithCommas$1(item)}KM` };
|
|
112
|
+
});
|
|
97
113
|
exports.VehicleConditionTypes = void 0;
|
|
98
114
|
(function (VehicleConditionTypes) {
|
|
99
115
|
VehicleConditionTypes["New"] = "N";
|
|
@@ -125,7 +141,7 @@ exports.GenderTypes = void 0;
|
|
|
125
141
|
(function (GenderTypes) {
|
|
126
142
|
GenderTypes["Male"] = "M";
|
|
127
143
|
GenderTypes["Female"] = "F";
|
|
128
|
-
GenderTypes["Other"] = "
|
|
144
|
+
GenderTypes["Other"] = "X";
|
|
129
145
|
})(exports.GenderTypes || (exports.GenderTypes = {}));
|
|
130
146
|
exports.OccupationTypes = void 0;
|
|
131
147
|
(function (OccupationTypes) {
|
|
@@ -166,10 +182,11 @@ const applicantRelationshipOptions = [
|
|
|
166
182
|
];
|
|
167
183
|
const insuranceCancellationReasonOptions = [
|
|
168
184
|
{ name: 'Cancelled for non-payment', value: 'NonPay' },
|
|
169
|
-
{ name: '
|
|
170
|
-
{ name: 'Driving without insurance', value: 'DWOI' },
|
|
185
|
+
{ name: 'Out of country/Parked vehicle/Other', value: 'OtherLapse' },
|
|
171
186
|
{ name: 'No car/no insurance needed', value: 'NotReqrd' },
|
|
172
187
|
{ name: 'Cancelled for material misrepresentation', value: 'MatMisrep' },
|
|
188
|
+
{ name: "Driver's license was suspended", value: 'LicSusp' },
|
|
189
|
+
{ name: 'Non-disclosure due to missing or incomplete information.', value: 'NonDiscl' },
|
|
173
190
|
];
|
|
174
191
|
const licenceSuspensionsReasonOptions = [
|
|
175
192
|
{ name: 'Alcohol related licence suspension', value: 'Alcohol' },
|
|
@@ -271,7 +288,6 @@ const trafficTicketsGroupOptions = [
|
|
|
271
288
|
{
|
|
272
289
|
label: 'Common',
|
|
273
290
|
options: [
|
|
274
|
-
{ value: 'SP', name: 'Speeding' },
|
|
275
291
|
{ value: 'SS', name: 'Stop sign' },
|
|
276
292
|
{ value: 'TSL', name: 'Traffic light' },
|
|
277
293
|
{ value: 'CPV', name: 'Prohibited use of hand-held device' },
|
|
@@ -297,33 +313,33 @@ const trafficTicketsGroupOptions = [
|
|
|
297
313
|
{ value: 'DH', name: 'Improper use of divided highway' },
|
|
298
314
|
{ value: 'MINOR', name: 'Other minor conviction (not specified)' },
|
|
299
315
|
{ value: 'OT', name: 'Obstructing traffic' },
|
|
300
|
-
{ value: 'CPV', name: 'Prohibited use of hand-held device' },
|
|
301
316
|
{ value: 'SP', name: 'Speeding' },
|
|
302
317
|
{ value: 'SS', name: 'Stop sign' },
|
|
303
318
|
{ value: 'TSL', name: 'Traffic light' },
|
|
304
319
|
{ value: 'UM', name: 'Unsafe move' },
|
|
305
320
|
{ value: 'UV', name: 'Unsafe vehicle' },
|
|
306
321
|
{ value: 'OW', name: 'Wrong way on one way' },
|
|
307
|
-
{ value: 'DRD', name: 'Distracted driving' },
|
|
308
322
|
],
|
|
309
323
|
},
|
|
310
324
|
{
|
|
311
325
|
label: 'Major',
|
|
312
326
|
options: [
|
|
313
|
-
{ value: '
|
|
327
|
+
{ value: 'DRD', name: 'Distracted driving' },
|
|
314
328
|
{ value: 'FRA', name: 'Failure to report accident' },
|
|
329
|
+
{ value: 'FDH', name: 'Failure to report damage to highway property' },
|
|
315
330
|
{ value: 'PSB', name: 'Improper passing of a school bus' },
|
|
316
331
|
{ value: 'PSG', name: 'Improper passing/speeding in a school or playground zone' },
|
|
317
332
|
{ value: 'OMVNI', name: 'Operator motor vehicle - no insurance' },
|
|
318
333
|
{ value: 'MAJOR', name: 'Other major conviction (not specified)' },
|
|
334
|
+
{ value: 'CPV', name: 'Prohibited use of hand-held device' },
|
|
319
335
|
{ value: 'STN', name: 'Stunting' },
|
|
320
336
|
],
|
|
321
337
|
},
|
|
322
338
|
{
|
|
323
|
-
label: '
|
|
339
|
+
label: 'Criminal',
|
|
324
340
|
options: [
|
|
325
|
-
{ value: 'ALC', name: '
|
|
326
|
-
{ value: 'RB', name: '
|
|
341
|
+
{ value: 'ALC', name: 'Restricted driver with alcohol in blood' },
|
|
342
|
+
{ value: 'RB', name: 'Refusal or failure to submit to a breath or blood test' },
|
|
327
343
|
{ value: 'CN', name: 'Criminal negligence' },
|
|
328
344
|
{ value: 'DD', name: 'Dangerous driving' },
|
|
329
345
|
{ value: 'DUS', name: 'Driving while licence under suspension' },
|
|
@@ -812,6 +828,7 @@ const API_AUTH = {
|
|
|
812
828
|
POST_EMAIL_VERIFICATION: `${API_ROOT}registration/verify-email/`,
|
|
813
829
|
POST_TOKEN: `${API_ROOT}token/refresh/`,
|
|
814
830
|
POST_EMAIL_VALIDATION: `${API_ROOT}email/validate/`,
|
|
831
|
+
GET_PHONE_VALIDATION: `${API_ROOT}phone/validate/`,
|
|
815
832
|
};
|
|
816
833
|
const PROFILE_API = {
|
|
817
834
|
USER: `${API_ROOT}user/me/`,
|
|
@@ -1597,7 +1614,7 @@ InputForm.defaultProps = {
|
|
|
1597
1614
|
};
|
|
1598
1615
|
|
|
1599
1616
|
const InputFormPhone = React__default["default"].memo((props) => {
|
|
1600
|
-
const { size, className, disabled, defaultValue, name, onChange, placeholder, error, } = props;
|
|
1617
|
+
const { size, className, disabled, defaultValue, name, onChange, placeholder, error, validationStatus, } = props;
|
|
1601
1618
|
const [value, setValue,] = React.useReducer(inputValueReducer, defaultValue);
|
|
1602
1619
|
const handleChange = React.useCallback((phoneNumber) => {
|
|
1603
1620
|
setValue({
|
|
@@ -1611,12 +1628,20 @@ const InputFormPhone = React__default["default"].memo((props) => {
|
|
|
1611
1628
|
});
|
|
1612
1629
|
}
|
|
1613
1630
|
}, []);
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1631
|
+
const loadingIcon = (validationStatus === exports.ValidationStatusTypes.Loading)
|
|
1632
|
+
&& jsxRuntime.jsx(IconLoaderPrimary, { width: "1.25rem", height: "1.25rem", className: "icon-validate loader" });
|
|
1633
|
+
const declinedIcon = (validationStatus === exports.ValidationStatusTypes.Declined)
|
|
1634
|
+
&& jsxRuntime.jsx(IconDecline, { width: "1rem", height: "1rem", className: "icon-validate" });
|
|
1635
|
+
const approvedIcon = (validationStatus === exports.ValidationStatusTypes.Approved)
|
|
1636
|
+
&& jsxRuntime.jsx(IconSuccess, { className: "icon-validate" });
|
|
1637
|
+
return (jsxRuntime.jsxs("div", { className: "input-form-phone-wrapper", children: [jsxRuntime.jsx(ReactPhoneInput__default["default"], { buttonClass: "dropdown-button", inputProps: {
|
|
1638
|
+
className: `input-form-phone ${size} ${disabled ? 'disabled' : ''} ${className} ${error ? 'error' : ''}`,
|
|
1639
|
+
name,
|
|
1640
|
+
placeholder: placeholder || '(855) 325-8444',
|
|
1641
|
+
}, country: "ca", value: value, onlyCountries: ['ca'], disableDropdown: true, disableCountryCode: true, onChange: handleChange, autoFormat: true }), loadingIcon || declinedIcon || approvedIcon] }));
|
|
1642
|
+
}, (prevProps, nextProps) => (prevProps.defaultValue === nextProps.defaultValue
|
|
1643
|
+
&& prevProps.error === nextProps.error
|
|
1644
|
+
&& prevProps.validationStatus === nextProps.validationStatus));
|
|
1620
1645
|
InputFormPhone.defaultProps = {
|
|
1621
1646
|
size: exports.SizeTypes.Large,
|
|
1622
1647
|
type: exports.InputTypes.Text,
|
|
@@ -1625,6 +1650,7 @@ InputFormPhone.defaultProps = {
|
|
|
1625
1650
|
placeholder: '',
|
|
1626
1651
|
disabled: false,
|
|
1627
1652
|
error: false,
|
|
1653
|
+
validationStatus: exports.ValidationStatusTypes.Initial,
|
|
1628
1654
|
};
|
|
1629
1655
|
|
|
1630
1656
|
const defaultManipulateInput = (value) => value;
|
|
@@ -1893,6 +1919,7 @@ exports.addYearsToDate = addYearsToDate;
|
|
|
1893
1919
|
exports.allAccidentBenefitsCoverageValues = allAccidentBenefitsCoverageValues;
|
|
1894
1920
|
exports.applicantRelationshipOptions = applicantRelationshipOptions;
|
|
1895
1921
|
exports.auxHeatingTypeOptions = auxHeatingTypeOptions;
|
|
1922
|
+
exports.businessUsePercentOptions = businessUsePercentOptions;
|
|
1896
1923
|
exports.carCondition = carCondition;
|
|
1897
1924
|
exports.carKeepPlace = carKeepPlace;
|
|
1898
1925
|
exports.carStatus = carStatus;
|