@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/esm/index.js CHANGED
@@ -1660,6 +1660,8 @@ const SectionDriverInsurancePolicy = () => {
1660
1660
  const { appConfigState: { appType }, } = useStoreAppConfig();
1661
1661
  const mychoiceCls = isMyChoiceLike(appType) ? 'mychoice' : '';
1662
1662
  const isTheBig = appType === AppTypes.TheBig;
1663
+ const { isOntarioProvince } = useProvince();
1664
+ const isOntarioFlow = isOntarioProvince && isMyChoiceLike(appType);
1663
1665
  const getPeriodOptions = (year, month) => {
1664
1666
  const options = [{ value: '', name: 'Date Period', disabled: true }];
1665
1667
  if (year && month) {
@@ -1738,6 +1740,10 @@ const SectionDriverInsurancePolicy = () => {
1738
1740
  if (listedYear && listedMonth && listed) {
1739
1741
  const listedDate = addDaysToDate(`${listedYear}-${listedMonth}-01`, birthDay ? +birthDay + 1 : 1);
1740
1742
  const setMessage = (licenceYear, licenceMonth) => {
1743
+ if (!licenceYear || !licenceMonth) {
1744
+ setHintMessage('');
1745
+ return;
1746
+ }
1741
1747
  const licenceDate = addDaysToDate(`${licenceYear}-${licenceMonth}-01`, birthDay ? +birthDay + 1 : 1);
1742
1748
  const yearsPeriod = getDifferenceInYears(listedDate, licenceDate);
1743
1749
  if (yearsPeriod >= 5) {
@@ -1751,7 +1757,10 @@ you had insurance. If this is correct, please continue with the form.`);
1751
1757
  if (birthDate) {
1752
1758
  const defaultMinDate = birthDate && firstLicenceAge ? addYearsToDate(birthDate, +firstLicenceAge) : '';
1753
1759
  const isOnlyG = checkDateIsSpecial(defaultMinDate, configState.minDates.g.specialDate);
1754
- if (isOnlyG) {
1760
+ if (isOntarioFlow) {
1761
+ setMessage(g1LicenceYear, g1LicenceMonth);
1762
+ }
1763
+ else if (isOnlyG) {
1755
1764
  setMessage(gLicenceYear, gLicenceMonth);
1756
1765
  }
1757
1766
  else if (licenceType === DriverLicenceTypes.G1) {
@@ -1768,7 +1777,7 @@ you had insurance. If this is correct, please continue with the form.`);
1768
1777
  else {
1769
1778
  setHintMessage('');
1770
1779
  }
1771
- }, [listedYear, listedMonth, g1LicenceYear, g1LicenceMonth, firstLicenceAge, birthDate, gLicenceYear, gLicenceMonth]);
1780
+ }, [listedYear, listedMonth, g1LicenceYear, g1LicenceMonth, firstLicenceAge, birthDate, gLicenceYear, gLicenceMonth, licenceType, isOntarioFlow]);
1772
1781
  const handleInsuredChange = ({ value }) => {
1773
1782
  dispatchDriverInsuranceState({
1774
1783
  type: StoreFormCarDriverInsuranceActionTypes.FormCarDriverInsuredSelect,