@mychoice/mychoice-sdk-components 2.1.86 → 2.2.14

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.
@@ -0,0 +1,3 @@
1
+ import { SdkFC } from '../../../interfaces';
2
+ import { OfferDetailProps } from '../interfaces';
3
+ export declare const OfferCoverage: SdkFC<OfferDetailProps>;
@@ -0,0 +1 @@
1
+ export { OfferCoverage } from './OfferCoverage';
@@ -0,0 +1,3 @@
1
+ import { SdkFC } from '../../../interfaces';
2
+ import { VehicleOfferCoverageProps } from '../interfaces';
3
+ export declare const VehicleOfferCoverage: SdkFC<VehicleOfferCoverageProps>;
@@ -0,0 +1 @@
1
+ export { VehicleOfferCoverage } from './VehicleOfferCoverage';
@@ -1,7 +1,8 @@
1
1
  export declare enum AppTypes {
2
2
  MyChoice = "MyChoice",
3
3
  Partner = "Partner",
4
- TheBig = "TheBig"
4
+ TheBig = "TheBig",
5
+ BeginInsurance = "BeginInsurance"
5
6
  }
6
7
  export declare enum InsuranceTypes {
7
8
  Car = "car",
@@ -43,6 +43,11 @@ export declare const limitedWaiverOfDepreciationOptions: {
43
43
  name: string;
44
44
  value: number;
45
45
  }[];
46
+ export declare const accidentBenefitsOptionalOptions: {
47
+ name: string;
48
+ value: string;
49
+ description: string;
50
+ }[];
46
51
  export declare const trafficTicketsGroupOptions: {
47
52
  label: string;
48
53
  options: {
@@ -1,5 +1,14 @@
1
1
  import { SelectOptionInterface } from '../interfaces';
2
- import { DriverLicenceTypes, InsuranceTypes } from '../constants';
2
+ import { AppTypes, DriverLicenceTypes, InsuranceTypes } from '../constants';
3
+ /**
4
+ * Check if the appType is MyChoice-like (MyChoice or BeginInsurance)
5
+ * Both share the same UI structure but with different branding/colors
6
+ */
7
+ export declare const isMyChoiceLike: (appType: AppTypes) => boolean;
8
+ /**
9
+ * Get placeholder email based on appType
10
+ */
11
+ export declare const getPlaceholderEmail: (appType: AppTypes) => string;
3
12
  export declare const getNumericOptions: (start: number, end: number, suffix?: string) => SelectOptionInterface[];
4
13
  export declare const formatPostalCode: (str?: string) => string;
5
14
  export declare const postalCodeFormat: (postalCode?: string) => string;
package/dist/cjs/index.js CHANGED
@@ -204,6 +204,68 @@ const limitedWaiverOfDepreciationOptions = [
204
204
  { name: 'No Coverage', value: 0 },
205
205
  { name: 'Full Coverage', value: 1 },
206
206
  ];
207
+ const accidentBenefitsOptionalOptions = [
208
+ {
209
+ name: 'Medical Rehabilitation and Attendant Care – Catastrophic Impairment',
210
+ value: 'med_rehab_cat_1m',
211
+ description: 'Provides enhanced limits for medical, rehabilitation, and attendant care expenses in the event of a catastrophic impairment. Optional coverage increases the benefit above the standard mandatory amount.',
212
+ },
213
+ {
214
+ name: 'Income Replacement Benefit',
215
+ value: 'income_replacement_400',
216
+ description: 'Provides weekly income payments if you are unable to work due to injuries from an automobile accident. Optional coverage allows you to increase the weekly maximum payable above the standard amount.',
217
+ },
218
+ {
219
+ name: 'Non-Earner Benefit',
220
+ value: 'non_earner_benefits',
221
+ description: 'Provides financial support if you are not employed at the time of an automobile accident and injuries prevent you from continuing your normal life activities.',
222
+ },
223
+ {
224
+ name: 'Caregiver Replacement',
225
+ value: 'caregiver_benefits',
226
+ description: 'Provides a weekly benefit if you are injured and unable to provide care to dependents, allowing funds to help pay for replacement caregiving services.',
227
+ },
228
+ {
229
+ name: 'Lost Education Expenses',
230
+ value: 'lost_educational_expenses',
231
+ description: 'Covers certain education-related expenses, such as tuition and books, if injuries prevent you from completing a school term.',
232
+ },
233
+ {
234
+ name: 'Expenses of Visitors',
235
+ value: 'expenses_of_visitors',
236
+ description: 'Covers reasonable expenses for family members or close relatives to visit you while you are receiving medical treatment as a result of an automobile accident.',
237
+ },
238
+ {
239
+ name: 'Housekeeping and Home Maintenance',
240
+ value: 'housekeeping_home_maintenance',
241
+ description: 'Covers reasonable costs for housekeeping and home maintenance services if injuries sustained in an automobile accident prevent you from performing these tasks yourself.',
242
+ },
243
+ {
244
+ name: 'Damage to Personal Items (clothing, glasses, hearing aids, etc.)',
245
+ value: 'damaged_items',
246
+ description: 'Covers repair or replacement of personal items (such as clothing or eyeglasses) damaged in an automobile accident.',
247
+ },
248
+ {
249
+ name: 'Death Benefit',
250
+ value: 'death_benefits',
251
+ description: 'Provides a lump-sum payment to eligible surviving family members if death results from injuries sustained in an automobile accident.',
252
+ },
253
+ {
254
+ name: 'Funeral Benefit',
255
+ value: 'funeral_benefits',
256
+ description: 'Covers reasonable funeral expenses if death results from an automobile accident.',
257
+ },
258
+ {
259
+ name: 'Dependent Care Benefit',
260
+ value: 'dependant_care_benefits',
261
+ description: 'Provides a weekly benefit to assist with the cost of caring for dependent children if injuries prevent you from providing care yourself.',
262
+ },
263
+ {
264
+ name: 'Indexation Benefit',
265
+ value: 'indexation_benefit',
266
+ description: 'Increases certain Accident Benefit limits over time to help protect against inflation.',
267
+ },
268
+ ];
207
269
  const trafficTicketsGroupOptions = [
208
270
  {
209
271
  label: 'Common',
@@ -288,6 +350,7 @@ exports.AppTypes = void 0;
288
350
  AppTypes["MyChoice"] = "MyChoice";
289
351
  AppTypes["Partner"] = "Partner";
290
352
  AppTypes["TheBig"] = "TheBig";
353
+ AppTypes["BeginInsurance"] = "BeginInsurance";
291
354
  })(exports.AppTypes || (exports.AppTypes = {}));
292
355
  exports.InsuranceTypes = void 0;
293
356
  (function (InsuranceTypes) {
@@ -1263,6 +1326,24 @@ const getDifferenceInYears = (dateLeft, dateRight) => dateFns.differenceInYears(
1263
1326
  const getDifferenceInMonths = (dateLeft, dateRight) => dateFns.differenceInMonths(getDate(dateLeft), getDate(dateRight));
1264
1327
  const getDifferenceInHours = (dateLeft, dateRight) => dateFns.differenceInHours(getDate(dateLeft), getDate(dateRight));
1265
1328
 
1329
+ /**
1330
+ * Check if the appType is MyChoice-like (MyChoice or BeginInsurance)
1331
+ * Both share the same UI structure but with different branding/colors
1332
+ */
1333
+ const isMyChoiceLike = (appType) => appType === exports.AppTypes.MyChoice || appType === exports.AppTypes.BeginInsurance;
1334
+ /**
1335
+ * Get placeholder email based on appType
1336
+ */
1337
+ const getPlaceholderEmail = (appType) => {
1338
+ switch (appType) {
1339
+ case exports.AppTypes.BeginInsurance:
1340
+ return 'johnsmith@begininsurance.ca';
1341
+ case exports.AppTypes.TheBig:
1342
+ return 'johnsmith@thebig.ca';
1343
+ default:
1344
+ return 'johnsmith@mychoice.ca';
1345
+ }
1346
+ };
1266
1347
  const getNumericOptions = (start, end, suffix) => {
1267
1348
  const options = [{ value: '', name: '-' }];
1268
1349
  let i = start;
@@ -1272,17 +1353,22 @@ const getNumericOptions = (start, end, suffix) => {
1272
1353
  }
1273
1354
  return options;
1274
1355
  };
1275
- const formatPostalCode = (str = '') => (str && str.replace(/[^a-zA-Z0-9]/g, '').replace(/ /g, '').replace(/-/g, '').replace(/.{3}(?=.)/g, '$& ')
1276
- .toUpperCase());
1356
+ const formatPostalCode = (str = '') => str &&
1357
+ str
1358
+ .replace(/[^a-zA-Z0-9]/g, '')
1359
+ .replace(/ /g, '')
1360
+ .replace(/-/g, '')
1361
+ .replace(/.{3}(?=.)/g, '$& ')
1362
+ .toUpperCase();
1277
1363
  const postalCodeFormat = (postalCode = '') => postalCode && postalCode.replace(/\s/g, '').substr(0, 6);
1278
1364
  const numberWithCommas = (value) => value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
1279
- const getLicenceTypeOptions = (options, optionValues, disabled) => (options.map((option) => {
1365
+ const getLicenceTypeOptions = (options, optionValues, disabled) => options.map((option) => {
1280
1366
  const newOption = option;
1281
1367
  if (optionValues.includes(option.value)) {
1282
1368
  newOption.disabled = disabled;
1283
1369
  }
1284
1370
  return newOption;
1285
- }));
1371
+ });
1286
1372
  const checkDateIsSpecial = (defaultMinDate, specialDate) => compareDates(specialDate, defaultMinDate) >= 0;
1287
1373
  const getLicenceMinDate = (licenceType, defaultMinDate, config) => {
1288
1374
  if (defaultMinDate) {
@@ -1303,9 +1389,8 @@ const getLicenceMinDate = (licenceType, defaultMinDate, config) => {
1303
1389
  };
1304
1390
  const getLicenceMaxDate = (licenceType, minDate, config) => {
1305
1391
  let maxDate = '';
1306
- const { minDates: { g: { specialDate } } } = config;
1307
- if (licenceType === exports.DriverLicenceTypes.G
1308
- && compareDates(specialDate, minDate) >= 0) {
1392
+ const { minDates: { g: { specialDate }, }, } = config;
1393
+ if (licenceType === exports.DriverLicenceTypes.G && compareDates(specialDate, minDate) >= 0) {
1309
1394
  maxDate = config.minDates.g.specialDate;
1310
1395
  }
1311
1396
  return getFormattedDate(maxDate, 'yyyy-MM-dd');
@@ -1323,7 +1408,7 @@ const getDisabledLicenceTypes = (gBlock, g2Block, g1Block) => {
1323
1408
  }
1324
1409
  return disabledLicenceTypes;
1325
1410
  };
1326
- const getInsuranceYearsOptions = (maxValue) => (insuredYearsOptions.filter((option) => +option.value <= +maxValue));
1411
+ const getInsuranceYearsOptions = (maxValue) => insuredYearsOptions.filter((option) => +option.value <= +maxValue);
1327
1412
  const getInsuranceType = () => {
1328
1413
  const pathParts = window.location.pathname.split('/');
1329
1414
  if (pathParts.includes('car')) {
@@ -1800,6 +1885,7 @@ exports.SelectForm = SelectForm;
1800
1885
  exports.Step = Step;
1801
1886
  exports.TitleForm = TitleForm;
1802
1887
  exports.TooltipForm = TooltipForm;
1888
+ exports.accidentBenefitsOptionalOptions = accidentBenefitsOptionalOptions;
1803
1889
  exports.addDaysToDate = addDaysToDate;
1804
1890
  exports.addMonthsToDate = addMonthsToDate;
1805
1891
  exports.addYearsToDate = addYearsToDate;
@@ -1849,6 +1935,7 @@ exports.getMinDate = getMinDate;
1849
1935
  exports.getMinDateByYears = getMinDateByYears;
1850
1936
  exports.getMonthStartEndDates = getMonthStartEndDates;
1851
1937
  exports.getNumericOptions = getNumericOptions;
1938
+ exports.getPlaceholderEmail = getPlaceholderEmail;
1852
1939
  exports.getStartOfMonth = getStartOfMonth;
1853
1940
  exports.getStartOfYear = getStartOfYear;
1854
1941
  exports.getValueIndexInOptions = getValueIndexInOptions;
@@ -1862,6 +1949,7 @@ exports.homeOwnerTypeOptions = homeOwnerTypeOptions;
1862
1949
  exports.insuranceCancellationReasonOptions = insuranceCancellationReasonOptions;
1863
1950
  exports.insuredYearsOptions = insuredYearsOptions;
1864
1951
  exports.isDateValid = isDateValid;
1952
+ exports.isMyChoiceLike = isMyChoiceLike;
1865
1953
  exports.isValueInOptions = isValueInOptions;
1866
1954
  exports.liabilityForDamageOptions = liabilityForDamageOptions;
1867
1955
  exports.liabilityOptions = liabilityOptions;