@mychoice/mychoice-sdk-modules 2.2.33 → 2.2.34

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
@@ -1670,6 +1670,8 @@ const SectionDriverInsurancePolicy = () => {
1670
1670
  const { appConfigState: { appType }, } = mychoiceSdkStore.useStoreAppConfig();
1671
1671
  const mychoiceCls = mychoiceSdkComponents.isMyChoiceLike(appType) ? 'mychoice' : '';
1672
1672
  const isTheBig = appType === mychoiceSdkComponents.AppTypes.TheBig;
1673
+ const { isOntarioProvince } = mychoiceSdkStore.useProvince();
1674
+ const isOntarioFlow = isOntarioProvince && mychoiceSdkComponents.isMyChoiceLike(appType);
1673
1675
  const getPeriodOptions = (year, month) => {
1674
1676
  const options = [{ value: '', name: 'Date Period', disabled: true }];
1675
1677
  if (year && month) {
@@ -1748,6 +1750,10 @@ const SectionDriverInsurancePolicy = () => {
1748
1750
  if (listedYear && listedMonth && listed) {
1749
1751
  const listedDate = mychoiceSdkComponents.addDaysToDate(`${listedYear}-${listedMonth}-01`, birthDay ? +birthDay + 1 : 1);
1750
1752
  const setMessage = (licenceYear, licenceMonth) => {
1753
+ if (!licenceYear || !licenceMonth) {
1754
+ setHintMessage('');
1755
+ return;
1756
+ }
1751
1757
  const licenceDate = mychoiceSdkComponents.addDaysToDate(`${licenceYear}-${licenceMonth}-01`, birthDay ? +birthDay + 1 : 1);
1752
1758
  const yearsPeriod = mychoiceSdkComponents.getDifferenceInYears(listedDate, licenceDate);
1753
1759
  if (yearsPeriod >= 5) {
@@ -1761,7 +1767,10 @@ you had insurance. If this is correct, please continue with the form.`);
1761
1767
  if (birthDate) {
1762
1768
  const defaultMinDate = birthDate && firstLicenceAge ? mychoiceSdkComponents.addYearsToDate(birthDate, +firstLicenceAge) : '';
1763
1769
  const isOnlyG = mychoiceSdkComponents.checkDateIsSpecial(defaultMinDate, configState.minDates.g.specialDate);
1764
- if (isOnlyG) {
1770
+ if (isOntarioFlow) {
1771
+ setMessage(g1LicenceYear, g1LicenceMonth);
1772
+ }
1773
+ else if (isOnlyG) {
1765
1774
  setMessage(gLicenceYear, gLicenceMonth);
1766
1775
  }
1767
1776
  else if (licenceType === mychoiceSdkComponents.DriverLicenceTypes.G1) {
@@ -1778,7 +1787,7 @@ you had insurance. If this is correct, please continue with the form.`);
1778
1787
  else {
1779
1788
  setHintMessage('');
1780
1789
  }
1781
- }, [listedYear, listedMonth, g1LicenceYear, g1LicenceMonth, firstLicenceAge, birthDate, gLicenceYear, gLicenceMonth]);
1790
+ }, [listedYear, listedMonth, g1LicenceYear, g1LicenceMonth, firstLicenceAge, birthDate, gLicenceYear, gLicenceMonth, licenceType, isOntarioFlow]);
1782
1791
  const handleInsuredChange = ({ value }) => {
1783
1792
  dispatchDriverInsuranceState({
1784
1793
  type: mychoiceSdkStore.StoreFormCarDriverInsuranceActionTypes.FormCarDriverInsuredSelect,