@mychoice/mychoice-sdk-modules 2.2.31 → 2.2.33

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 CHANGED
@@ -365,25 +365,23 @@ const BlockNextPageInfo$2 = () => {
365
365
 
366
366
  const BlockSubmit$2 = ({ className, label, buttonSize, isRecalc = false, onSubmitClick, }) => {
367
367
  const { quoteState: { isRequested, quoteConfirm } } = mychoiceSdkStore.useStoreFormCarQuote();
368
- const { discountState: { isValid } } = mychoiceSdkStore.useStoreFormCarDiscount();
369
368
  const { appConfigState: { localIndex, insuranceType } } = mychoiceSdkStore.useStoreAppConfig();
370
369
  const navigate = reactRouterDom.useNavigate();
371
370
  const { postRequestQuote } = mychoiceSdkStore.CarQuoteDataHandler();
372
371
  const { carDiscountFormValidate } = mychoiceSdkStore.useValidationCarDiscount();
373
372
  const handleGetQuotesClick = () => {
374
373
  onSubmitClick?.();
375
- if (!isValid) {
376
- carDiscountFormValidate(false, () => postRequestQuote(isRecalc, quoteConfirm));
377
- }
378
- else if (isRecalc) {
379
- postRequestQuote(isRecalc, quoteConfirm);
380
- }
381
- else if (!isRequested) {
382
- postRequestQuote(false, quoteConfirm);
383
- }
384
- else {
385
- navigate(`/${localIndex || mychoiceSdkComponents.defaultLocalIndex}/${insuranceType}/quotes`);
386
- }
374
+ carDiscountFormValidate(false, () => {
375
+ if (isRecalc) {
376
+ postRequestQuote(isRecalc, quoteConfirm);
377
+ }
378
+ else if (!isRequested) {
379
+ postRequestQuote(false, quoteConfirm);
380
+ }
381
+ else {
382
+ navigate(`/${localIndex || mychoiceSdkComponents.defaultLocalIndex}/${insuranceType}/quotes`);
383
+ }
384
+ });
387
385
  };
388
386
  return (jsxRuntime.jsx(mychoiceSdkComponents.ButtonBase, { className: className, size: buttonSize, category: mychoiceSdkComponents.CategoryTypes.Filled, onClick: handleGetQuotesClick, color: mychoiceSdkComponents.ColorTypes.Primary, label: label }));
389
387
  };
@@ -1345,8 +1343,6 @@ const SectionDriverInfo = () => {
1345
1343
 
1346
1344
  // Max months between consecutive Ontario GDL licence classes (spec 1-2 e/f)
1347
1345
  const ON_MAX_MONTHS_BETWEEN_CLASSES = 60;
1348
- const ON_MIN_MONTHS_G1_TO_G2 = 8;
1349
- const ON_MIN_MONTHS_G1_TO_G = 20;
1350
1346
  const SectionDriverLicence = () => {
1351
1347
  const { appConfigState: { appType }, } = mychoiceSdkStore.useStoreAppConfig();
1352
1348
  const [driverEducation, setDriverEducation] = React.useState(false);
@@ -1377,7 +1373,7 @@ const SectionDriverLicence = () => {
1377
1373
  const policyEffectiveDate = policyStartYear && policyStartMonth && policyStartDay
1378
1374
  ? `${policyStartYear}-${policyStartMonth}-${policyStartDay}`
1379
1375
  : policyStart || today;
1380
- const { g, g1, g2, minLicenceAge } = configState.licenceConfig;
1376
+ const { g, g1, g2, minLicenceAge, } = configState.licenceConfig;
1381
1377
  const licenceTypeOptions = [
1382
1378
  { value: g.name, name: g.title },
1383
1379
  { value: g1.name, name: g1.title },
@@ -1565,22 +1561,31 @@ const SectionDriverLicence = () => {
1565
1561
  && q1Month === birthMonth
1566
1562
  ? `${q1Year}-${birthMonth}-${birthDay}`
1567
1563
  : q1Date;
1564
+ const q1IntervalDate = q1Date;
1568
1565
  const q1MonthsFromEffective = q1BirthdayDate
1569
1566
  ? mychoiceSdkComponents.getDifferenceInMonths(policyEffectiveDate, q1BirthdayDate)
1570
1567
  : Infinity;
1571
- // A G2 requires at least 8 months after G1; a G requires another 12 months.
1572
- const canHaveG2 = !!q1Date && q1MonthsFromEffective >= ON_MIN_MONTHS_G1_TO_G2;
1573
- const canHaveG = !!q1Date && q1MonthsFromEffective >= ON_MIN_MONTHS_G1_TO_G;
1568
+ const q1IntervalMonthsFromEffective = q1IntervalDate
1569
+ ? mychoiceSdkComponents.getDifferenceInMonths(policyEffectiveDate, q1IntervalDate)
1570
+ : Infinity;
1571
+ const q1HasStarted = !!q1IntervalDate && q1IntervalMonthsFromEffective >= 0;
1572
+ const canHaveG2 = q1HasStarted;
1573
+ const canHaveGAfterG2 = !!g2Date && mychoiceSdkComponents.getDifferenceInMonths(policyEffectiveDate, g2Date) >= 0;
1574
+ const canHaveGWithoutG2 = q1HasStarted;
1575
+ const canHaveG = firstClass === mychoiceSdkComponents.DriverLicenceTypes.G2
1576
+ ? q1HasStarted
1577
+ : ((receivedG2 === true && canHaveGAfterG2)
1578
+ || (receivedG2 === false && canHaveGWithoutG2));
1574
1579
  // ── path booleans ──
1575
1580
  const showG2Question = firstClass === mychoiceSdkComponents.DriverLicenceTypes.G1 && canHaveG2;
1576
1581
  const showG2Date = showG2Question && receivedG2 === true;
1577
- // G question shows after G2 date entered (G1G2 path) OR after No-G2 answer (G1No G2 path)
1582
+ // G question shows after G2 date entered (G1->G2 path) OR after No-G2 answer (G1->No G2 path)
1578
1583
  const showGQuestionAfterG1 = firstClass === mychoiceSdkComponents.DriverLicenceTypes.G1
1579
- && canHaveG
1580
- && (receivedG2 === false || showG2Date);
1584
+ && canHaveG;
1581
1585
  const showGQuestionAfterG2 = firstClass === mychoiceSdkComponents.DriverLicenceTypes.G2 && canHaveG;
1582
1586
  const showGDateAfterG1 = showGQuestionAfterG1 && receivedG === true;
1583
1587
  const showGDateAfterG2 = showGQuestionAfterG2 && receivedG === true;
1588
+ const isDirectGWithoutG2 = firstClass === mychoiceSdkComponents.DriverLicenceTypes.G1 && receivedG2 === false;
1584
1589
  // G1 branch: ask once, based on the first licence date (< 5 years / 60 months).
1585
1590
  const showDtcG1Only = firstClass === mychoiceSdkComponents.DriverLicenceTypes.G1
1586
1591
  && !!q1Date
@@ -1593,6 +1598,21 @@ const SectionDriverLicence = () => {
1593
1598
  const showDtcGFull = firstClass === mychoiceSdkComponents.DriverLicenceTypes.G
1594
1599
  && !!q1Date
1595
1600
  && q1MonthsFromEffective < 36;
1601
+ // G preceding date: G2 date if on G1->G2->G path, else Q1 date.
1602
+ const gPrecedingDate = receivedG2 === true && g2Date ? g2Date : q1IntervalDate;
1603
+ // ── Min dates (capped to the policy effective date so a future policy remains selectable) ──
1604
+ const capMinDateToPolicy = (minDate) => (minDate && mychoiceSdkComponents.compareDates(minDate, policyEffectiveDate) > 0 ? policyEffectiveDate : minDate);
1605
+ const g2MinRaw = q1IntervalDate;
1606
+ const gMinRaw = (() => {
1607
+ if (!gPrecedingDate)
1608
+ return '';
1609
+ if ((showGDateAfterG1 && showG2Date) || firstClass === mychoiceSdkComponents.DriverLicenceTypes.G2) {
1610
+ return gPrecedingDate;
1611
+ }
1612
+ return gPrecedingDate;
1613
+ })();
1614
+ const g2MinDate = capMinDateToPolicy(g2MinRaw);
1615
+ const gMinDate = capMinDateToPolicy(gMinRaw);
1596
1616
  // ── Validation error messages ──
1597
1617
  const q1MinDate = getG1MinDate();
1598
1618
  const q1ChronoError = driverState.inValidation
@@ -1602,24 +1622,19 @@ const SectionDriverLicence = () => {
1602
1622
  ? 'License dates cannot be in the future' : '';
1603
1623
  const q1Error = q1FutureError || q1ChronoError || getDateErrorMessage(['01', q1Month, q1Year], driverState.inValidation);
1604
1624
  const g2ChronoError = driverState.inValidation
1605
- ? validateLicenceDate(g2LicenceYear, g2LicenceMonth, q1BirthdayDate)
1625
+ ? validateLicenceDate(g2LicenceYear, g2LicenceMonth, q1IntervalDate)
1606
1626
  : '';
1607
- const g260MonthError = validate60Months(q1BirthdayDate?.slice(0, 4), q1BirthdayDate?.slice(5, 7), g2LicenceYear, g2LicenceMonth);
1627
+ const g260MonthError = validate60Months(q1IntervalDate?.slice(0, 4), q1IntervalDate?.slice(5, 7), g2LicenceYear, g2LicenceMonth);
1608
1628
  const g2FutureError = g2Date && mychoiceSdkComponents.compareDates(g2Date, policyEffectiveDate) > 0 ? 'License dates cannot be in the future' : '';
1609
1629
  const g2Error = g2FutureError || g260MonthError || g2ChronoError || getDateErrorMessage(['01', g2LicenceMonth, g2LicenceYear], driverState.inValidation);
1610
- // G preceding date: G2 date if on G1→G2→G path, else Q1 date
1611
- const gPrecedingDate = showGDateAfterG1 && showG2Date ? g2Date : q1BirthdayDate;
1612
1630
  const gChronoError = driverState.inValidation
1613
1631
  ? validateLicenceDate(gLicenceYear, gLicenceMonth, gPrecedingDate)
1614
1632
  : '';
1615
- const g60MonthError = validate60Months(q1BirthdayDate?.slice(0, 4), q1BirthdayDate?.slice(5, 7), gLicenceYear, gLicenceMonth);
1633
+ const g60MonthError = isDirectGWithoutG2
1634
+ ? ''
1635
+ : validate60Months(gPrecedingDate?.slice(0, 4), gPrecedingDate?.slice(5, 7), gLicenceYear, gLicenceMonth);
1616
1636
  const gFutureError = gDate && mychoiceSdkComponents.compareDates(gDate, policyEffectiveDate) > 0 ? 'License dates cannot be in the future' : '';
1617
1637
  const gError = gFutureError || g60MonthError || gChronoError || getDateErrorMessage(['01', gLicenceMonth, gLicenceYear], driverState.inValidation);
1618
- // ── Min dates (capped to the policy effective date so a future policy remains selectable) ──
1619
- const g2MinRaw = q1BirthdayDate && mychoiceSdkComponents.compareDates(q1BirthdayDate, gTwoMin) > 0 ? q1BirthdayDate : gTwoMin;
1620
- const g2MinDate = mychoiceSdkComponents.compareDates(g2MinRaw, policyEffectiveDate) > 0 ? policyEffectiveDate : g2MinRaw;
1621
- const gMinRaw = gPrecedingDate && mychoiceSdkComponents.compareDates(gPrecedingDate, gMin) > 0 ? gPrecedingDate : gMin;
1622
- const gMinDate = mychoiceSdkComponents.compareDates(gMinRaw, policyEffectiveDate) > 0 ? policyEffectiveDate : gMinRaw;
1623
1638
  const getMonthPickerMinDate = (minDate) => {
1624
1639
  if (!minDate || mychoiceSdkComponents.getFormattedDate(minDate, 'dd') === '01')
1625
1640
  return minDate;
@@ -1633,8 +1648,8 @@ const SectionDriverLicence = () => {
1633
1648
  const max60 = mychoiceSdkComponents.addMonthsToDate(refDate, ON_MAX_MONTHS_BETWEEN_CLASSES);
1634
1649
  return mychoiceSdkComponents.compareDates(policyEffectiveDate, max60) > 0 ? max60 : policyEffectiveDate;
1635
1650
  };
1636
- const g2MaxDate = getMax60Date(q1BirthdayDate);
1637
- const gMaxDate = getMax60Date(q1BirthdayDate);
1651
+ const g2MaxDate = getMax60Date(q1IntervalDate);
1652
+ const gMaxDate = isDirectGWithoutG2 ? policyEffectiveDate : getMax60Date(gPrecedingDate);
1638
1653
  return (jsxRuntime.jsxs("div", { className: `form-section ${mychoiceCls}`, children: [jsxRuntime.jsx(DateSelectFormBox, { name: "firstLicenceDate", dateNames: ['firstLicenceYear', 'firstLicenceMonth'], onDateChange: handleLicenceDateChange(q1SlotType), defaultValue: getDefaultLicenceDate(q1SlotType), title: `When did ${driverName} first receive their drivers license in Canada?`, description: "Select the year and month in which you received your first license to drive an automobile in Canada. This would include a beginners, intermediate or full license.", errorMessage: q1Error, error: driverState.inValidation, minDate: q1MinDate, maxDate: policyEffectiveDate, disabled: !birthDate }), q1Date && (jsxRuntime.jsx(SelectFormBox, { options: isOnlyG ? ontarioOnlyGOptions : ontarioFirstClassOptions, name: "firstLicenceClass", onChange: handleLicenceTypeChange, defaultValue: getSelectedOption(isOnlyG ? ontarioOnlyGOptions : ontarioFirstClassOptions, firstClass), title: "What class of license was it?", placeholder: "Select from the list", description: "Drivers licensed in Ontario under the graduated licensing program would select G1 Beginner. If the driver was licensed outside Ontario or granted an exception for having driving experience from another jurisdiction then select the license class they first received. Select class G Full or equivalent if the driver was licensed in Ontario before 1994 or was licensed in another province. G equivalent classes in Canada are class 5.", autoSelectIfValueIsOutOfOptions: false })), firstClass === mychoiceSdkComponents.DriverLicenceTypes.G1 && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [showDtcG1Only && (jsxRuntime.jsx(SwitchButtonBox, { items: mychoiceSdkComponents.yesNoOptions, onChange: handleTrainingChange, name: "passedDriverTraining", defaultValue: getSelectedOption(mychoiceSdkComponents.yesNoOptions, passedDriverTraining), title: `Has ${driverName} completed a gov't approved drivers education course within the past 3 years?` })), showG2Question && (jsxRuntime.jsx(SwitchButtonBox, { items: mychoiceSdkComponents.yesNoOptions, onChange: handleReceivedG2Change, name: "receivedG2", defaultValue: getSelectedOption(mychoiceSdkComponents.yesNoOptions, receivedG2), title: `Did ${driverName} receive a G2 license?` })), showG2Date && (jsxRuntime.jsx(DateSelectFormBox, { name: "g2LicenceDate", dateNames: ['g2LicenceYear', 'g2LicenceMonth'], onDateChange: handleLicenceDateChange(mychoiceSdkComponents.DriverLicenceTypes.G2), defaultValue: getDefaultLicenceDate(mychoiceSdkComponents.DriverLicenceTypes.G2), title: `When did ${driverName} receive this G2 license?`, errorMessage: g2Error, error: driverState.inValidation, minDate: g2PickerMinDate, maxDate: g2MaxDate })), showGQuestionAfterG1 && (jsxRuntime.jsx(SwitchButtonBox, { items: mychoiceSdkComponents.yesNoOptions, onChange: handleReceivedGChange, name: "receivedG", defaultValue: getSelectedOption(mychoiceSdkComponents.yesNoOptions, receivedG), title: `Did ${driverName} receive a G license?` })), showGDateAfterG1 && (jsxRuntime.jsx(DateSelectFormBox, { name: "gLicenceDate", dateNames: ['gLicenceYear', 'gLicenceMonth'], onDateChange: handleLicenceDateChange(mychoiceSdkComponents.DriverLicenceTypes.G), defaultValue: getDefaultLicenceDate(mychoiceSdkComponents.DriverLicenceTypes.G), title: `When did ${driverName} receive this G license?`, errorMessage: gError, error: driverState.inValidation, minDate: gPickerMinDate, maxDate: gMaxDate }))] })), firstClass === mychoiceSdkComponents.DriverLicenceTypes.G2 && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [showDtcG2Only && (jsxRuntime.jsx(SwitchButtonBox, { items: mychoiceSdkComponents.yesNoOptions, onChange: handleTrainingChange, name: "passedDriverTraining", defaultValue: getSelectedOption(mychoiceSdkComponents.yesNoOptions, passedDriverTraining), title: `Has ${driverName} completed a gov't approved drivers education course within the past 3 years?` })), showGQuestionAfterG2 && (jsxRuntime.jsx(SwitchButtonBox, { items: mychoiceSdkComponents.yesNoOptions, onChange: handleReceivedGChange, name: "receivedG", defaultValue: getSelectedOption(mychoiceSdkComponents.yesNoOptions, receivedG), title: `Did ${driverName} receive a G license?` })), showGDateAfterG2 && (jsxRuntime.jsx(DateSelectFormBox, { name: "gLicenceDate", dateNames: ['gLicenceYear', 'gLicenceMonth'], onDateChange: handleLicenceDateChange(mychoiceSdkComponents.DriverLicenceTypes.G), defaultValue: getDefaultLicenceDate(mychoiceSdkComponents.DriverLicenceTypes.G), title: `When did ${driverName} receive this G license?`, errorMessage: gError, error: driverState.inValidation, minDate: gPickerMinDate, maxDate: gMaxDate }))] })), firstClass === mychoiceSdkComponents.DriverLicenceTypes.G && !isOnlyG && showDtcGFull && (jsxRuntime.jsx(SwitchButtonBox, { items: mychoiceSdkComponents.yesNoOptions, onChange: handleTrainingChange, name: "passedDriverTraining", defaultValue: getSelectedOption(mychoiceSdkComponents.yesNoOptions, passedDriverTraining), title: `Has ${driverName} completed a gov't approved drivers education course within the past 3 years?` })), isOnlyG && showDtcGFull && (jsxRuntime.jsx(SwitchButtonBox, { items: mychoiceSdkComponents.yesNoOptions, onChange: handleTrainingChange, name: "passedDriverTraining", defaultValue: getSelectedOption(mychoiceSdkComponents.yesNoOptions, passedDriverTraining), title: `Has ${driverName} completed a gov't approved drivers education course within the past 3 years?` })), jsxRuntime.jsx(SwitchButtonBox, { items: mychoiceSdkComponents.yesNoOptions, onChange: handlePreviousLicenceChange, name: "previousLicence", defaultValue: getSelectedOption(mychoiceSdkComponents.yesNoOptions, previousLicence), title: `Has ${driverName} ever had a full license anywhere else in Canada or USA?`, description: "If you have driving experience outside Canada or the United States, it may lower your premium. Your insurer may require proof of insurance in these other locations or some proof of driving experience from the country you indicate (like a copy of a previous driver's licence)." })] }));
1639
1654
  }
1640
1655
  return (jsxRuntime.jsxs("div", { className: `form-section ${mychoiceCls}`, children: [jsxRuntime.jsx(InputFormBox, { name: "firstLicenceAge", title: getLicenceAgeTitle(), onChange: handleLicenceAgeChange, type: mychoiceSdkComponents.InputTypes.Number, defaultValue: firstLicenceAge, description: configState.toolTip.licenceAge, hintMessage: birthDate
@@ -2373,7 +2388,8 @@ const SectionDiscountInfo$1 = () => {
2373
2388
  const { validateEmail, errorMessage } = mychoiceSdkStore.useHandlerCarQuoterEmail();
2374
2389
  const { validatePhone, errorMessage: phoneErrorMessage } = mychoiceSdkStore.useHandlerCarQuoterPhone();
2375
2390
  const { multiplePoliciesDiscount, appInstallDiscount, caaMemberDiscount, quoterInfo, emailTo: { email, emailStatus }, } = discountState;
2376
- const { firstName, lastName, phone, phoneStatus, driverLicense = '', caslConsent } = quoterInfo;
2391
+ const { firstName, lastName, phone, phoneStatus, driverLicense = '', caslConsent, } = quoterInfo;
2392
+ const phoneIsIncomplete = (phone || '').replace(/\D/g, '').length !== 10;
2377
2393
  const handleMultiplePolicyChange = ({ value }) => {
2378
2394
  dispatchDiscountState({
2379
2395
  type: mychoiceSdkStore.StoreFormCarDiscountActionTypes.FormCarDiscountMultiplePoliciesSelect,
@@ -2432,10 +2448,10 @@ const SectionDiscountInfo$1 = () => {
2432
2448
  });
2433
2449
  };
2434
2450
  return (jsxRuntime.jsxs("div", { className: `form-section ${mychoiceCls}`, children: [isTheBig ? (jsxRuntime.jsx(LabelFormBox, { title: "You are seconds away from receiving your car insurance quotes,\n please provide your email after completing the discount section so we\n can send you your personalized free car insurance quotes!" })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("h2", { className: "section-title", children: "A little extra info for discounts and connecting you with our partners." }), jsxRuntime.jsx("span", { className: "info-title-message", children: "You are seconds away from receiving your car insurance quotes, please provide your email after completing the discount section so we can send you your personalized free car insurance quotes!" })] })), jsxRuntime.jsx(BlockVehLinks, {}), jsxRuntime.jsx(SwitchButtonBox, { items: mychoiceSdkComponents.yesNoOptions, onChange: handleMultiplePolicyChange, name: "multiplePoliciesDiscount", defaultValue: getSelectedOption(mychoiceSdkComponents.yesNoOptions, multiplePoliciesDiscount), title: "You could receive a 10-15% discount for bundling insurance with multiple policies with the same insurance company. Does that interest you?", description: "Bundling your home and auto insurance can save you significantly on insurance premiums as a whole package. Do you want to learn more about the benefits of multiple policies for home, tenant, condo, or car insurance? All you have to do is select yes.." }), !isTheBig && !isAlbertaProvince && (jsxRuntime.jsx(SwitchButtonBox, { items: mychoiceSdkComponents.yesNoOptions, onChange: handleCaaMemberChange, name: "caaMemberDiscount", defaultValue: getSelectedOption(mychoiceSdkComponents.yesNoOptions, caaMemberDiscount), title: "Please indicate if you are a member of CAA, you could save up to an additional 20%." })), jsxRuntime.jsx(SwitchButtonBox, { items: mychoiceSdkComponents.yesNoOptions, onChange: handleAppInstallChange, name: "appInstallDiscount", defaultValue: getSelectedOption(mychoiceSdkComponents.yesNoOptions, appInstallDiscount), title: "You could receive up to a 30% discount by using an app to track driving habits. Does that interest you?", description: "Get rewarded for safe driving with the click of a button. If you install the app, you may be eligible for a 30% discount on your insurance premiums. Typically, you receive 10% of the discount upfront and the balance after six months of good driving." }), isTheBig ? (jsxRuntime.jsxs("div", { className: "input-form-box-container", children: [jsxRuntime.jsx(LabelFormBox, { title: "Complete this form to see all your personalized\n quotes on the next page, you will also be able to:" }), jsxRuntime.jsxs("ol", { className: "ordered-block", children: [jsxRuntime.jsx("li", { children: "See what rates insurance carriers are offering" }), jsxRuntime.jsx("li", { children: "Get in touch with us and secure your rate" }), jsxRuntime.jsx("li", { children: "Potentially save more by speaking with a broker" })] })] })) : (jsxRuntime.jsx("h2", { children: "Complete the form below to see which companies are offering your quotes." })), jsxRuntime.jsx(InputFormBox, { name: "firstName", title: "First Name", onChange: handleFirstNameChange, defaultValue: firstName, placeholder: "Your First Name", error: !firstName && discountState.inValidation, errorMessage: getErrorMessage(firstName, discountState.inValidation) }), jsxRuntime.jsx(InputFormBox, { name: "lastname", title: "Last Name", onChange: handleLastNameChange, defaultValue: lastName, placeholder: "Your Last Name", error: !lastName && discountState.inValidation, errorMessage: getErrorMessage(lastName, discountState.inValidation) }), isTheBig && (jsxRuntime.jsx(InputFormLicenceBox, { ...getDynamicLicenceBoxProps({ ...allProvinces }), name: "driverLicense", title: "Driver Licence Number (Optional)", onChange: handleDriverLicenseChange, defaultValue: driverLicense, description: "Enter your drivers licence number in to receive a more accurate, prequalified quote from our broker partners. This will enable you to provide less details over the phone if you choose to have a broker contact you. This is an optional input." })), jsxRuntime.jsx(InputFormPhoneBox, { name: "phone", onChange: handlePhoneNumberChange, defaultValue: phone, title: "Phone Number", placeholder: "(855) 325-8444", validationStatus: phoneStatus, error: phoneStatus === mychoiceSdkComponents.ValidationStatusTypes.Declined
2435
- || (phoneStatus === mychoiceSdkComponents.ValidationStatusTypes.Initial && discountState.inValidation)
2436
- || (!phone && discountState.inValidation), errorMessage: phoneStatus === mychoiceSdkComponents.ValidationStatusTypes.Declined
2451
+ || (phoneIsIncomplete && discountState.inValidation), errorMessage: phoneStatus === mychoiceSdkComponents.ValidationStatusTypes.Declined
2437
2452
  ? phoneErrorMessage
2438
- : getErrorMessage(phone, discountState.inValidation) || (discountState.inValidation ? 'Enter a valid phone number.' : '') }), jsxRuntime.jsx(InputFormEmailBox, { validationStatus: emailStatus, errorMessage: emailStatus === mychoiceSdkComponents.ValidationStatusTypes.Declined
2453
+ : getErrorMessage(phone, discountState.inValidation)
2454
+ || (phoneIsIncomplete && discountState.inValidation ? 'Enter a valid phone number.' : '') }), jsxRuntime.jsx(InputFormEmailBox, { validationStatus: emailStatus, errorMessage: emailStatus === mychoiceSdkComponents.ValidationStatusTypes.Declined
2439
2455
  ? errorMessage
2440
2456
  : getErrorMessage(email, discountState.inValidation), error: emailStatus === mychoiceSdkComponents.ValidationStatusTypes.Declined || (!email && discountState.inValidation), name: "email", title: "Please share your email address with us, we'll use it to send you a copy of your quotes.", description: "We will provide you with your insurance quotes immediately after this form completion. If you are not ready to apply today, don\u2019t worry as we will be emailing your quotes to you if you\u2019d like to complete at a later date with the help of one of our trusted broker partners.", onChange: handleEmailChange, defaultValue: email, placeholder: mychoiceSdkComponents.getPlaceholderEmail(appType) }), isTheBig && (jsxRuntime.jsx(mychoiceSdkComponents.CheckboxForm, { className: "casl-consent", name: "caslConsent", label: "Yes, I consent to receiving emails from the Billyard Insurance Group.\n I understand that I can unsubscribe at any time", onChange: handleCaslConsentChange, defaultValue: caslConsent })), jsxRuntime.jsx(BlockSubmit$2, { className: isTheBig ? 'thebig-bold' : 'mychoice' }), jsxRuntime.jsx(BlockNextPageInfo$2, {})] }));
2441
2457
  };