@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/esm/index.js CHANGED
@@ -28,12 +28,17 @@ IconDropdownArrow.defaultProps = {
28
28
  };
29
29
 
30
30
  const numberWithCommas$1 = (value) => value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
31
- const dailyKilometresRange = [1, 2, 5, 7, 10, 15, 20, 30, 40, 50, 60, 70, 80, 90, 100, 150, 200];
31
+ const dailyKilometresRange = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
32
+ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
33
+ 50, 60, 70, 80, 90, 100, 150, 200];
32
34
  const dailyKilometresRangeForBusiness = [
33
35
  1, 2, 5, 7, 10, 15, 20, 30, 40, 50, 60, 70, 80, 90, 100, 150, 200, 250, 300, 350, 400,
34
36
  ];
35
37
  const yearlyKilometresRange = [
36
- 500, 1000, 2000, 3000, 5000, 8000, 10000, 15000, 20000, 30000, 50000, 60000, 80000, 100000,
38
+ 500, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000,
39
+ 11000, 12000, 13000, 14000, 15000, 16000, 17000, 18000, 19000, 20000,
40
+ 21000, 22000, 23000, 24000, 25000, 26000, 27000, 28000, 29000, 30000,
41
+ 35000, 40000, 45000, 50000, 60000, 80000, 100000,
37
42
  ];
38
43
  const carCondition = [
39
44
  { value: 'N', name: 'New' },
@@ -69,9 +74,18 @@ const carUsagePurpose = [
69
74
  { value: 'personal', name: 'Personal' },
70
75
  { value: 'business', name: 'Business' },
71
76
  ];
77
+ const businessUsePercentOptions = [
78
+ { value: '25', name: 'Up to 25%' },
79
+ { value: '50', name: '50%' },
80
+ { value: '75', name: '75%' },
81
+ { value: '100', name: '100%' },
82
+ ];
72
83
  const firstDriveDistanceList = dailyKilometresRange.map((item) => {
73
- if (item === 1) {
74
- return { value: `${item}`, name: `${item}KM or Less` };
84
+ if (item === 0) {
85
+ return { value: `${item}`, name: '0KM (No commute)' };
86
+ }
87
+ if (item === 200) {
88
+ return { value: `${item}`, name: '200+ KM' };
75
89
  }
76
90
  return { value: `${item}`, name: `${numberWithCommas$1(item)}KM` };
77
91
  });
@@ -81,10 +95,12 @@ const dailyDriveBusinessDistanceList = dailyKilometresRangeForBusiness.map((item
81
95
  }
82
96
  return { value: `${item}`, name: `${item}KM` };
83
97
  });
84
- const yearlyDriveDistanceList = yearlyKilometresRange.map((item) => ({
85
- value: `${item}`,
86
- name: `${numberWithCommas$1(item)}KM`,
87
- }));
98
+ const yearlyDriveDistanceList = yearlyKilometresRange.map((item) => {
99
+ if (item === 100000) {
100
+ return { value: `${item}`, name: '100,000+ KM' };
101
+ }
102
+ return { value: `${item}`, name: `${numberWithCommas$1(item)}KM` };
103
+ });
88
104
  var VehicleConditionTypes;
89
105
  (function (VehicleConditionTypes) {
90
106
  VehicleConditionTypes["New"] = "N";
@@ -116,7 +132,7 @@ var GenderTypes;
116
132
  (function (GenderTypes) {
117
133
  GenderTypes["Male"] = "M";
118
134
  GenderTypes["Female"] = "F";
119
- GenderTypes["Other"] = "Other";
135
+ GenderTypes["Other"] = "X";
120
136
  })(GenderTypes || (GenderTypes = {}));
121
137
  var OccupationTypes;
122
138
  (function (OccupationTypes) {
@@ -157,10 +173,11 @@ const applicantRelationshipOptions = [
157
173
  ];
158
174
  const insuranceCancellationReasonOptions = [
159
175
  { name: 'Cancelled for non-payment', value: 'NonPay' },
160
- { name: 'Cancelled for other reason', value: 'OtherLapse' },
161
- { name: 'Driving without insurance', value: 'DWOI' },
176
+ { name: 'Out of country/Parked vehicle/Other', value: 'OtherLapse' },
162
177
  { name: 'No car/no insurance needed', value: 'NotReqrd' },
163
178
  { name: 'Cancelled for material misrepresentation', value: 'MatMisrep' },
179
+ { name: "Driver's license was suspended", value: 'LicSusp' },
180
+ { name: 'Non-disclosure due to missing or incomplete information.', value: 'NonDiscl' },
164
181
  ];
165
182
  const licenceSuspensionsReasonOptions = [
166
183
  { name: 'Alcohol related licence suspension', value: 'Alcohol' },
@@ -262,7 +279,6 @@ const trafficTicketsGroupOptions = [
262
279
  {
263
280
  label: 'Common',
264
281
  options: [
265
- { value: 'SP', name: 'Speeding' },
266
282
  { value: 'SS', name: 'Stop sign' },
267
283
  { value: 'TSL', name: 'Traffic light' },
268
284
  { value: 'CPV', name: 'Prohibited use of hand-held device' },
@@ -288,33 +304,33 @@ const trafficTicketsGroupOptions = [
288
304
  { value: 'DH', name: 'Improper use of divided highway' },
289
305
  { value: 'MINOR', name: 'Other minor conviction (not specified)' },
290
306
  { value: 'OT', name: 'Obstructing traffic' },
291
- { value: 'CPV', name: 'Prohibited use of hand-held device' },
292
307
  { value: 'SP', name: 'Speeding' },
293
308
  { value: 'SS', name: 'Stop sign' },
294
309
  { value: 'TSL', name: 'Traffic light' },
295
310
  { value: 'UM', name: 'Unsafe move' },
296
311
  { value: 'UV', name: 'Unsafe vehicle' },
297
312
  { value: 'OW', name: 'Wrong way on one way' },
298
- { value: 'DRD', name: 'Distracted driving' },
299
313
  ],
300
314
  },
301
315
  {
302
316
  label: 'Major',
303
317
  options: [
304
- { value: 'FDH', name: 'Failure to report damage to highway property' },
318
+ { value: 'DRD', name: 'Distracted driving' },
305
319
  { value: 'FRA', name: 'Failure to report accident' },
320
+ { value: 'FDH', name: 'Failure to report damage to highway property' },
306
321
  { value: 'PSB', name: 'Improper passing of a school bus' },
307
322
  { value: 'PSG', name: 'Improper passing/speeding in a school or playground zone' },
308
323
  { value: 'OMVNI', name: 'Operator motor vehicle - no insurance' },
309
324
  { value: 'MAJOR', name: 'Other major conviction (not specified)' },
325
+ { value: 'CPV', name: 'Prohibited use of hand-held device' },
310
326
  { value: 'STN', name: 'Stunting' },
311
327
  ],
312
328
  },
313
329
  {
314
- label: 'Serious',
330
+ label: 'Criminal',
315
331
  options: [
316
- { value: 'ALC', name: 'Class G1/G2 driver with alcohol in blood' },
317
- { value: 'RB', name: 'Class G1/G2 refuse breath sample' },
332
+ { value: 'ALC', name: 'Restricted driver with alcohol in blood' },
333
+ { value: 'RB', name: 'Refusal or failure to submit to a breath or blood test' },
318
334
  { value: 'CN', name: 'Criminal negligence' },
319
335
  { value: 'DD', name: 'Dangerous driving' },
320
336
  { value: 'DUS', name: 'Driving while licence under suspension' },
@@ -803,6 +819,7 @@ const API_AUTH = {
803
819
  POST_EMAIL_VERIFICATION: `${API_ROOT}registration/verify-email/`,
804
820
  POST_TOKEN: `${API_ROOT}token/refresh/`,
805
821
  POST_EMAIL_VALIDATION: `${API_ROOT}email/validate/`,
822
+ GET_PHONE_VALIDATION: `${API_ROOT}phone/validate/`,
806
823
  };
807
824
  const PROFILE_API = {
808
825
  USER: `${API_ROOT}user/me/`,
@@ -1588,7 +1605,7 @@ InputForm.defaultProps = {
1588
1605
  };
1589
1606
 
1590
1607
  const InputFormPhone = React.memo((props) => {
1591
- const { size, className, disabled, defaultValue, name, onChange, placeholder, error, } = props;
1608
+ const { size, className, disabled, defaultValue, name, onChange, placeholder, error, validationStatus, } = props;
1592
1609
  const [value, setValue,] = useReducer(inputValueReducer, defaultValue);
1593
1610
  const handleChange = useCallback((phoneNumber) => {
1594
1611
  setValue({
@@ -1602,12 +1619,20 @@ const InputFormPhone = React.memo((props) => {
1602
1619
  });
1603
1620
  }
1604
1621
  }, []);
1605
- return (jsx(ReactPhoneInput, { buttonClass: "dropdown-button", inputProps: {
1606
- className: `input-form-phone ${size} ${disabled ? 'disabled' : ''} ${className} ${error ? 'error' : ''}`,
1607
- name,
1608
- placeholder: placeholder || '(855) 325-8444',
1609
- }, country: "ca", value: value, onlyCountries: ['ca'], disableDropdown: true, disableCountryCode: true, onChange: handleChange, autoFormat: true }));
1610
- }, (prevProps, nextProps) => (prevProps.defaultValue === nextProps.defaultValue || prevProps.error === nextProps.error));
1622
+ const loadingIcon = (validationStatus === ValidationStatusTypes.Loading)
1623
+ && jsx(IconLoaderPrimary, { width: "1.25rem", height: "1.25rem", className: "icon-validate loader" });
1624
+ const declinedIcon = (validationStatus === ValidationStatusTypes.Declined)
1625
+ && jsx(IconDecline, { width: "1rem", height: "1rem", className: "icon-validate" });
1626
+ const approvedIcon = (validationStatus === ValidationStatusTypes.Approved)
1627
+ && jsx(IconSuccess, { className: "icon-validate" });
1628
+ return (jsxs("div", { className: "input-form-phone-wrapper", children: [jsx(ReactPhoneInput, { buttonClass: "dropdown-button", inputProps: {
1629
+ className: `input-form-phone ${size} ${disabled ? 'disabled' : ''} ${className} ${error ? 'error' : ''}`,
1630
+ name,
1631
+ placeholder: placeholder || '(855) 325-8444',
1632
+ }, country: "ca", value: value, onlyCountries: ['ca'], disableDropdown: true, disableCountryCode: true, onChange: handleChange, autoFormat: true }), loadingIcon || declinedIcon || approvedIcon] }));
1633
+ }, (prevProps, nextProps) => (prevProps.defaultValue === nextProps.defaultValue
1634
+ && prevProps.error === nextProps.error
1635
+ && prevProps.validationStatus === nextProps.validationStatus));
1611
1636
  InputFormPhone.defaultProps = {
1612
1637
  size: SizeTypes.Large,
1613
1638
  type: InputTypes.Text,
@@ -1616,6 +1641,7 @@ InputFormPhone.defaultProps = {
1616
1641
  placeholder: '',
1617
1642
  disabled: false,
1618
1643
  error: false,
1644
+ validationStatus: ValidationStatusTypes.Initial,
1619
1645
  };
1620
1646
 
1621
1647
  const defaultManipulateInput = (value) => value;
@@ -1817,5 +1843,5 @@ InfoMessage.defaultProps = {
1817
1843
  isRemovable: false,
1818
1844
  };
1819
1845
 
1820
- export { API_APP, API_AUTH, API_FORM_CAR, API_FORM_HOME, API_FORM_LIFE, API_ROOT, AlignTypes, AppTypes, ApplicantListTypes, ButtonArrow, ButtonBase, ButtonForm, ButtonMenu, ButtonTab, ButtonTabArrow, ButtonTabMobile, ButtonTypes, ButtonVariantTypes, CategoryTypes, CheckboxForm, ColorTypes, ColorVariablesTypes, CompanyRoleTypes, CoverageTypes, DateTypes, DeviceTypeWidthList, DeviceTypes, DirectionTypes, DriverLicenceTypes, DriverListTypes, DriverPriorityTypes, DwellingInfoTypes, GenderTypes, HeaderDropDown, HeaderNavGroup, HttpRequestHeaderTypes, IconArrow, IconChecked, IconClock, IconDecline, IconDelete, IconDropdownArrow, IconLoaderPrimary, IconLoaderSecondary, IconSuccess, IconTabArrow, IconTooltip, InfoMessage, InputForm, InputFormEmail, InputFormLicence, InputFormPhone, InputTypes, InsuranceTypes, MAX_LOCAL_STORAGE_HOURS, MAX_LOCAL_STORAGE_HOURS_THEBIG, ModalTypes, MychoiceStep, NavigationAddress, NavigationBase, NavigationCar, NavigationDiscount, NavigationPerson, NavigationProperty, NavigationQuotes, OccupationTypes, OfferDetail, OfferDetailTitle, OfferHeader, OfferPrice, OperationHoursInfo, PROFILE_API, QuoteEdit, RequestStatusTypes, RequestTypes, ScreenBPList, ScreenBPTypes, SdkTooltip, SelectForm, SizeTypes, Step, TitleForm, TooltipForm, ValidationStatusTypes, VehicleConditionTypes, VehiclePrimaryUseTypes, accidentBenefitsOptionalOptions, addDaysToDate, addMonthsToDate, addYearsToDate, allAccidentBenefitsCoverageValues, applicantRelationshipOptions, auxHeatingTypeOptions, carCondition, carKeepPlace, carStatus, carUsagePurpose, carWinterTiresCheck, checkDateIsSpecial, claimTypeOptions, collisionCoverage, compareDates, comprehensiveCoverage, comprehensiveCoverages, condoBuildingStructureOptions, constructionTypeOptions, coverageOptions, dailyDriveBusinessDistanceList, deepClone, defaultBrokerPhone, defaultLocalIndex, exteriorFinishOptions, fireHallDistanceOptions, fireHydrantDistanceOptions, firstDriveDistanceList, formatPostalCode, garageTypeOptions, genderOptions, getDateOptions, getDayStartEndDates, getDaysOfMonth, getDifferenceInHours, getDifferenceInMonths, getDifferenceInYears, getDisabledLicenceTypes, getEndOfMonth, getEndOfYear, getFormattedDate, getInsuranceType, getInsuranceYearsOptions, getLicenceMaxDate, getLicenceMinDate, getLicenceTypeOptions, getMinDate, getMinDateByYears, getMonthStartEndDates, getNumericOptions, getPlaceholderEmail, getStartOfMonth, getStartOfYear, getValueIndexInOptions, getValuesFromNumbers, getYearIntervalOptions, getYearStartEndDates, homeBuildingStructureOptions, homeCoverageOptions, homeLiabilityOptions, homeOwnerTypeOptions, insuranceCancellationReasonOptions, insuredYearsOptions, isDateValid, isMyChoiceLike, isValueInOptions, liabilityForDamageOptions, liabilityOptions, licenceSuspensionsReasonOptions, lifeCoverageOptions, lifeInsuranceOntarioTypeOptions, lifeInsuranceTypeOptions, lifeProvinceOptions, lifeProvinceOptionsMC, limitedWaiverOfDepreciationOptions, lossOfUseOptions, maritalStatusOptions, numberWithCommas, occupationOptions, optionsIsEqual, postalCodeFormat, ppOptions, primaryHeatingTypeOptions, residentsOptions, smokerOptions, subDaysFromDate, subMonthsFromDate, subYearsFromDate, supportedProvinceCodes, tenantBuildingStructureOptions, trafficTicketsGroupOptions, useEffectOnce, yearlyDriveDistanceList, yesNoOptions };
1846
+ export { API_APP, API_AUTH, API_FORM_CAR, API_FORM_HOME, API_FORM_LIFE, API_ROOT, AlignTypes, AppTypes, ApplicantListTypes, ButtonArrow, ButtonBase, ButtonForm, ButtonMenu, ButtonTab, ButtonTabArrow, ButtonTabMobile, ButtonTypes, ButtonVariantTypes, CategoryTypes, CheckboxForm, ColorTypes, ColorVariablesTypes, CompanyRoleTypes, CoverageTypes, DateTypes, DeviceTypeWidthList, DeviceTypes, DirectionTypes, DriverLicenceTypes, DriverListTypes, DriverPriorityTypes, DwellingInfoTypes, GenderTypes, HeaderDropDown, HeaderNavGroup, HttpRequestHeaderTypes, IconArrow, IconChecked, IconClock, IconDecline, IconDelete, IconDropdownArrow, IconLoaderPrimary, IconLoaderSecondary, IconSuccess, IconTabArrow, IconTooltip, InfoMessage, InputForm, InputFormEmail, InputFormLicence, InputFormPhone, InputTypes, InsuranceTypes, MAX_LOCAL_STORAGE_HOURS, MAX_LOCAL_STORAGE_HOURS_THEBIG, ModalTypes, MychoiceStep, NavigationAddress, NavigationBase, NavigationCar, NavigationDiscount, NavigationPerson, NavigationProperty, NavigationQuotes, OccupationTypes, OfferDetail, OfferDetailTitle, OfferHeader, OfferPrice, OperationHoursInfo, PROFILE_API, QuoteEdit, RequestStatusTypes, RequestTypes, ScreenBPList, ScreenBPTypes, SdkTooltip, SelectForm, SizeTypes, Step, TitleForm, TooltipForm, ValidationStatusTypes, VehicleConditionTypes, VehiclePrimaryUseTypes, accidentBenefitsOptionalOptions, addDaysToDate, addMonthsToDate, addYearsToDate, allAccidentBenefitsCoverageValues, applicantRelationshipOptions, auxHeatingTypeOptions, businessUsePercentOptions, carCondition, carKeepPlace, carStatus, carUsagePurpose, carWinterTiresCheck, checkDateIsSpecial, claimTypeOptions, collisionCoverage, compareDates, comprehensiveCoverage, comprehensiveCoverages, condoBuildingStructureOptions, constructionTypeOptions, coverageOptions, dailyDriveBusinessDistanceList, deepClone, defaultBrokerPhone, defaultLocalIndex, exteriorFinishOptions, fireHallDistanceOptions, fireHydrantDistanceOptions, firstDriveDistanceList, formatPostalCode, garageTypeOptions, genderOptions, getDateOptions, getDayStartEndDates, getDaysOfMonth, getDifferenceInHours, getDifferenceInMonths, getDifferenceInYears, getDisabledLicenceTypes, getEndOfMonth, getEndOfYear, getFormattedDate, getInsuranceType, getInsuranceYearsOptions, getLicenceMaxDate, getLicenceMinDate, getLicenceTypeOptions, getMinDate, getMinDateByYears, getMonthStartEndDates, getNumericOptions, getPlaceholderEmail, getStartOfMonth, getStartOfYear, getValueIndexInOptions, getValuesFromNumbers, getYearIntervalOptions, getYearStartEndDates, homeBuildingStructureOptions, homeCoverageOptions, homeLiabilityOptions, homeOwnerTypeOptions, insuranceCancellationReasonOptions, insuredYearsOptions, isDateValid, isMyChoiceLike, isValueInOptions, liabilityForDamageOptions, liabilityOptions, licenceSuspensionsReasonOptions, lifeCoverageOptions, lifeInsuranceOntarioTypeOptions, lifeInsuranceTypeOptions, lifeProvinceOptions, lifeProvinceOptionsMC, limitedWaiverOfDepreciationOptions, lossOfUseOptions, maritalStatusOptions, numberWithCommas, occupationOptions, optionsIsEqual, postalCodeFormat, ppOptions, primaryHeatingTypeOptions, residentsOptions, smokerOptions, subDaysFromDate, subMonthsFromDate, subYearsFromDate, supportedProvinceCodes, tenantBuildingStructureOptions, trafficTicketsGroupOptions, useEffectOnce, yearlyDriveDistanceList, yesNoOptions };
1821
1847
  //# sourceMappingURL=index.js.map