@mychoice/mychoice-sdk-store 1.0.1 → 2.0.1

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.
Files changed (260) hide show
  1. package/dist/cjs/handlers/dataHandlers/AuthDataHandler/interfaces.d.ts +1 -1
  2. package/dist/cjs/handlers/dataHandlers/ClearFormDataHandler/interfaces.d.ts +1 -1
  3. package/dist/cjs/handlers/dataHandlers/PartnerDataHandler/interfaces.d.ts +1 -1
  4. package/dist/cjs/handlers/dataHandlers/PostalDataHandler/interfaces.d.ts +6 -2
  5. package/dist/cjs/handlers/dataHandlers/QuoteDataHandler/CarQuoteDataHandler.d.ts +2 -0
  6. package/dist/cjs/handlers/dataHandlers/QuoteDataHandler/HomeQuoteDataHandler.d.ts +2 -0
  7. package/dist/cjs/handlers/dataHandlers/QuoteDataHandler/LifeQuoteDataHandler.d.ts +2 -0
  8. package/dist/cjs/handlers/dataHandlers/QuoteDataHandler/index.d.ts +3 -1
  9. package/dist/cjs/handlers/dataHandlers/QuoteDataHandler/interfaces.d.ts +1 -1
  10. package/dist/cjs/handlers/dataHandlers/QuoterEmailDataHandler/QuoterEmailDataHandler.d.ts +3 -1
  11. package/dist/cjs/handlers/dataHandlers/QuoterEmailDataHandler/index.d.ts +1 -1
  12. package/dist/cjs/handlers/dataHandlers/QuoterEmailDataHandler/interfaces.d.ts +1 -1
  13. package/dist/cjs/handlers/dataHandlers/VehicleDataHandlers/interfaces.d.ts +2 -2
  14. package/dist/cjs/handlers/dataHandlers/shared/dataReducer/interfaces.d.ts +2 -2
  15. package/dist/cjs/handlers/validationHandlers/index.d.ts +1 -0
  16. package/dist/cjs/handlers/validationHandlers/insurances/home/interfaces.d.ts +2 -2
  17. package/dist/cjs/handlers/validationHandlers/insurances/life/ApplicantValidationHandler.d.ts +2 -0
  18. package/dist/cjs/handlers/validationHandlers/insurances/life/CoverageValidationHandler.d.ts +2 -0
  19. package/dist/cjs/handlers/validationHandlers/insurances/life/index.d.ts +2 -0
  20. package/dist/cjs/handlers/validationHandlers/insurances/life/interfaces.d.ts +15 -0
  21. package/dist/cjs/index.js +2051 -511
  22. package/dist/cjs/index.js.map +1 -1
  23. package/dist/cjs/services/httpRequest/hoox.d.ts +2 -2
  24. package/dist/cjs/services/httpRequest/interfaces.d.ts +5 -5
  25. package/dist/cjs/states/reducers/interfaces.d.ts +8 -2
  26. package/dist/cjs/states/reducers/reducers.d.ts +8 -2
  27. package/dist/cjs/states/reducers/states/ConfigState/AppConfigState/interfaces.d.ts +2 -2
  28. package/dist/cjs/states/reducers/states/ConfigState/AppDeviceState/interfaces.d.ts +2 -2
  29. package/dist/cjs/states/reducers/states/ConfigState/AppLoaderState/interfaces.d.ts +2 -2
  30. package/dist/cjs/states/reducers/states/ConfigState/AppModalState/actions.d.ts +1 -0
  31. package/dist/cjs/states/reducers/states/ConfigState/AppModalState/interfaces.d.ts +6 -3
  32. package/dist/cjs/states/reducers/states/GlobalState/ClientState/interfaces.d.ts +2 -2
  33. package/dist/cjs/states/reducers/states/GlobalState/PartnerState/interfaces.d.ts +2 -2
  34. package/dist/cjs/states/reducers/states/formStates/FormCarState/ConfigState/constants.d.ts +5 -0
  35. package/dist/cjs/states/reducers/states/formStates/FormCarState/ConfigState/hoox.d.ts +2 -1
  36. package/dist/cjs/states/reducers/states/formStates/FormCarState/ConfigState/index.d.ts +1 -1
  37. package/dist/cjs/states/reducers/states/formStates/FormCarState/ConfigState/interfaces.d.ts +9 -2
  38. package/dist/cjs/states/reducers/states/formStates/FormCarState/DiscountState/index.d.ts +1 -1
  39. package/dist/cjs/states/reducers/states/formStates/FormCarState/DiscountState/interfaces.d.ts +2 -2
  40. package/dist/cjs/states/reducers/states/formStates/FormCarState/DriverState/DriverAccidentState/interfaces.d.ts +2 -2
  41. package/dist/cjs/states/reducers/states/formStates/FormCarState/DriverState/DriverBaseState/interfaces.d.ts +2 -2
  42. package/dist/cjs/states/reducers/states/formStates/FormCarState/DriverState/DriverCancellationState/interfaces.d.ts +2 -2
  43. package/dist/cjs/states/reducers/states/formStates/FormCarState/DriverState/DriverInfoState/interfaces.d.ts +2 -2
  44. package/dist/cjs/states/reducers/states/formStates/FormCarState/DriverState/DriverInsuranceState/interfaces.d.ts +2 -2
  45. package/dist/cjs/states/reducers/states/formStates/FormCarState/DriverState/DriverLicenceState/interfaces.d.ts +2 -2
  46. package/dist/cjs/states/reducers/states/formStates/FormCarState/DriverState/DriverSuspensionState/interfaces.d.ts +2 -2
  47. package/dist/cjs/states/reducers/states/formStates/FormCarState/DriverState/DriverTicketState/interfaces.d.ts +2 -2
  48. package/dist/cjs/states/reducers/states/formStates/FormCarState/DriverState/interfaces.d.ts +6 -6
  49. package/dist/cjs/states/reducers/states/formStates/FormCarState/DriverState/reducer.d.ts +1 -1
  50. package/dist/cjs/states/reducers/states/formStates/FormCarState/PostalState/interfaces.d.ts +2 -2
  51. package/dist/cjs/states/reducers/states/formStates/FormCarState/QuoteState/actions.d.ts +2 -2
  52. package/dist/cjs/states/reducers/states/formStates/FormCarState/QuoteState/helper.d.ts +2 -2
  53. package/dist/cjs/states/reducers/states/formStates/FormCarState/QuoteState/index.d.ts +1 -1
  54. package/dist/cjs/states/reducers/states/formStates/FormCarState/QuoteState/interfaces.d.ts +6 -6
  55. package/dist/cjs/states/reducers/states/formStates/FormCarState/VehicleState/helper.d.ts +1 -1
  56. package/dist/cjs/states/reducers/states/formStates/FormCarState/VehicleState/interfaces.d.ts +2 -2
  57. package/dist/cjs/states/reducers/states/formStates/FormHomeState/ApplicantState/ApplicantBaseState/interfaces.d.ts +2 -2
  58. package/dist/cjs/states/reducers/states/formStates/FormHomeState/ApplicantState/ApplicantCancellationState/interfaces.d.ts +2 -2
  59. package/dist/cjs/states/reducers/states/formStates/FormHomeState/ApplicantState/ApplicantClaimState/interfaces.d.ts +2 -2
  60. package/dist/cjs/states/reducers/states/formStates/FormHomeState/ApplicantState/ApplicantInfoState/actions.d.ts +0 -2
  61. package/dist/cjs/states/reducers/states/formStates/FormHomeState/ApplicantState/ApplicantInfoState/interfaces.d.ts +2 -14
  62. package/dist/cjs/states/reducers/states/formStates/FormHomeState/ApplicantState/ApplicantInsuranceState/actions.d.ts +0 -2
  63. package/dist/cjs/states/reducers/states/formStates/FormHomeState/ApplicantState/ApplicantInsuranceState/interfaces.d.ts +2 -14
  64. package/dist/cjs/states/reducers/states/formStates/FormHomeState/ApplicantState/index.d.ts +1 -1
  65. package/dist/cjs/states/reducers/states/formStates/FormHomeState/ApplicantState/initialState.d.ts +4 -3
  66. package/dist/cjs/states/reducers/states/formStates/FormHomeState/ApplicantState/interfaces.d.ts +13 -23
  67. package/dist/cjs/states/reducers/states/formStates/FormHomeState/ApplicantState/reducer.d.ts +1 -1
  68. package/dist/cjs/states/reducers/states/formStates/FormHomeState/DiscountState/actions.d.ts +9 -1
  69. package/dist/cjs/states/reducers/states/formStates/FormHomeState/DiscountState/index.d.ts +1 -1
  70. package/dist/cjs/states/reducers/states/formStates/FormHomeState/DiscountState/interfaces.d.ts +65 -2
  71. package/dist/cjs/states/reducers/states/formStates/FormHomeState/DwellingState/actions.d.ts +11 -2
  72. package/dist/cjs/states/reducers/states/formStates/FormHomeState/DwellingState/helper.d.ts +3 -1
  73. package/dist/cjs/states/reducers/states/formStates/FormHomeState/DwellingState/index.d.ts +2 -0
  74. package/dist/cjs/states/reducers/states/formStates/FormHomeState/DwellingState/initialState.d.ts +3 -13
  75. package/dist/cjs/states/reducers/states/formStates/FormHomeState/DwellingState/interfaces.d.ts +74 -16
  76. package/dist/cjs/states/reducers/states/formStates/FormHomeState/DwellingState/localStore.d.ts +2 -0
  77. package/dist/cjs/states/reducers/states/formStates/FormHomeState/PostalState/actions.d.ts +6 -0
  78. package/dist/cjs/states/reducers/states/formStates/FormHomeState/PostalState/helper.d.ts +1 -1
  79. package/dist/cjs/states/reducers/states/formStates/FormHomeState/PostalState/interfaces.d.ts +50 -4
  80. package/dist/cjs/states/reducers/states/formStates/FormHomeState/QuoteState/actions.d.ts +9 -0
  81. package/dist/cjs/states/reducers/states/formStates/FormHomeState/QuoteState/helper.d.ts +2 -0
  82. package/dist/cjs/states/reducers/states/formStates/FormHomeState/QuoteState/hoox.d.ts +2 -0
  83. package/dist/cjs/states/reducers/states/formStates/FormHomeState/QuoteState/index.d.ts +1 -0
  84. package/dist/cjs/states/reducers/states/formStates/FormHomeState/QuoteState/initialState.d.ts +2 -0
  85. package/dist/cjs/states/reducers/states/formStates/FormHomeState/QuoteState/interfaces.d.ts +69 -0
  86. package/dist/cjs/states/reducers/states/formStates/FormHomeState/QuoteState/localStore.d.ts +3 -0
  87. package/dist/cjs/states/reducers/states/formStates/FormHomeState/QuoteState/reducer.d.ts +2 -0
  88. package/dist/cjs/states/reducers/states/formStates/FormHomeState/actions.d.ts +1 -1
  89. package/dist/cjs/states/reducers/states/formStates/FormHomeState/hoox.d.ts +1 -1
  90. package/dist/cjs/states/reducers/states/formStates/FormHomeState/index.d.ts +1 -1
  91. package/dist/cjs/states/reducers/states/formStates/FormHomeState/reducer.d.ts +2 -2
  92. package/dist/cjs/states/reducers/states/formStates/FormLifeState/ApplicantState/actions.d.ts +18 -0
  93. package/dist/cjs/states/reducers/states/formStates/FormLifeState/ApplicantState/hoox.d.ts +2 -0
  94. package/dist/cjs/states/reducers/states/formStates/FormLifeState/ApplicantState/index.d.ts +1 -0
  95. package/dist/cjs/states/reducers/states/formStates/FormLifeState/ApplicantState/initialState.d.ts +2 -0
  96. package/dist/cjs/states/reducers/states/formStates/FormLifeState/ApplicantState/interfaces.d.ts +119 -0
  97. package/dist/cjs/states/reducers/states/formStates/FormLifeState/ApplicantState/localStore.d.ts +4 -0
  98. package/dist/cjs/states/reducers/states/formStates/FormLifeState/ApplicantState/reducer.d.ts +2 -0
  99. package/dist/cjs/states/reducers/states/formStates/FormLifeState/CoverageState/actions.d.ts +9 -0
  100. package/dist/cjs/states/reducers/states/formStates/FormLifeState/CoverageState/hoox.d.ts +2 -0
  101. package/dist/cjs/states/reducers/states/formStates/FormLifeState/CoverageState/index.d.ts +1 -0
  102. package/dist/cjs/states/reducers/states/formStates/FormLifeState/CoverageState/initialState.d.ts +2 -0
  103. package/dist/cjs/states/reducers/states/formStates/FormLifeState/CoverageState/interfaces.d.ts +51 -0
  104. package/dist/cjs/states/reducers/states/formStates/FormLifeState/CoverageState/localStore.d.ts +3 -0
  105. package/dist/cjs/states/reducers/states/formStates/FormLifeState/CoverageState/reducer.d.ts +2 -0
  106. package/dist/cjs/states/reducers/states/formStates/FormLifeState/PostalState/actions.d.ts +5 -0
  107. package/dist/cjs/states/reducers/states/formStates/FormLifeState/PostalState/helper.d.ts +3 -0
  108. package/dist/cjs/states/reducers/states/formStates/FormLifeState/PostalState/hoox.d.ts +2 -0
  109. package/dist/cjs/states/reducers/states/formStates/FormLifeState/PostalState/index.d.ts +1 -0
  110. package/dist/cjs/states/reducers/states/formStates/FormLifeState/PostalState/initialState.d.ts +2 -0
  111. package/dist/cjs/states/reducers/states/formStates/FormLifeState/PostalState/interfaces.d.ts +28 -0
  112. package/dist/cjs/states/reducers/states/formStates/FormLifeState/PostalState/localStore.d.ts +3 -0
  113. package/dist/cjs/states/reducers/states/formStates/FormLifeState/PostalState/reducer.d.ts +2 -0
  114. package/dist/cjs/states/reducers/states/formStates/FormLifeState/QuoteState/actions.d.ts +9 -0
  115. package/dist/cjs/states/reducers/states/formStates/FormLifeState/QuoteState/helper.d.ts +2 -0
  116. package/dist/cjs/states/reducers/states/formStates/FormLifeState/QuoteState/hoox.d.ts +2 -0
  117. package/dist/cjs/states/reducers/states/formStates/FormLifeState/QuoteState/index.d.ts +1 -0
  118. package/dist/cjs/states/reducers/states/formStates/FormLifeState/QuoteState/initialState.d.ts +2 -0
  119. package/dist/cjs/states/reducers/states/formStates/FormLifeState/QuoteState/interfaces.d.ts +68 -0
  120. package/dist/cjs/states/reducers/states/formStates/FormLifeState/QuoteState/localStore.d.ts +3 -0
  121. package/dist/cjs/states/reducers/states/formStates/FormLifeState/QuoteState/reducer.d.ts +2 -0
  122. package/dist/cjs/states/reducers/states/formStates/FormLifeState/actions.d.ts +4 -0
  123. package/dist/cjs/states/reducers/states/formStates/FormLifeState/hoox.d.ts +4 -0
  124. package/dist/cjs/states/reducers/states/formStates/FormLifeState/index.d.ts +5 -0
  125. package/dist/cjs/states/reducers/states/formStates/FormLifeState/reducer.d.ts +6 -0
  126. package/dist/cjs/states/reducers/states/formStates/actions.d.ts +1 -0
  127. package/dist/cjs/states/reducers/states/formStates/hoox.d.ts +1 -0
  128. package/dist/cjs/states/reducers/states/formStates/index.d.ts +1 -0
  129. package/dist/cjs/states/store.d.ts +10 -2
  130. package/dist/esm/handlers/dataHandlers/AuthDataHandler/interfaces.d.ts +1 -1
  131. package/dist/esm/handlers/dataHandlers/ClearFormDataHandler/interfaces.d.ts +1 -1
  132. package/dist/esm/handlers/dataHandlers/PartnerDataHandler/interfaces.d.ts +1 -1
  133. package/dist/esm/handlers/dataHandlers/PostalDataHandler/interfaces.d.ts +6 -2
  134. package/dist/esm/handlers/dataHandlers/QuoteDataHandler/CarQuoteDataHandler.d.ts +2 -0
  135. package/dist/esm/handlers/dataHandlers/QuoteDataHandler/HomeQuoteDataHandler.d.ts +2 -0
  136. package/dist/esm/handlers/dataHandlers/QuoteDataHandler/LifeQuoteDataHandler.d.ts +2 -0
  137. package/dist/esm/handlers/dataHandlers/QuoteDataHandler/index.d.ts +3 -1
  138. package/dist/esm/handlers/dataHandlers/QuoteDataHandler/interfaces.d.ts +1 -1
  139. package/dist/esm/handlers/dataHandlers/QuoterEmailDataHandler/QuoterEmailDataHandler.d.ts +3 -1
  140. package/dist/esm/handlers/dataHandlers/QuoterEmailDataHandler/index.d.ts +1 -1
  141. package/dist/esm/handlers/dataHandlers/QuoterEmailDataHandler/interfaces.d.ts +1 -1
  142. package/dist/esm/handlers/dataHandlers/VehicleDataHandlers/interfaces.d.ts +2 -2
  143. package/dist/esm/handlers/dataHandlers/shared/dataReducer/interfaces.d.ts +2 -2
  144. package/dist/esm/handlers/validationHandlers/index.d.ts +1 -0
  145. package/dist/esm/handlers/validationHandlers/insurances/home/interfaces.d.ts +2 -2
  146. package/dist/esm/handlers/validationHandlers/insurances/life/ApplicantValidationHandler.d.ts +2 -0
  147. package/dist/esm/handlers/validationHandlers/insurances/life/CoverageValidationHandler.d.ts +2 -0
  148. package/dist/esm/handlers/validationHandlers/insurances/life/index.d.ts +2 -0
  149. package/dist/esm/handlers/validationHandlers/insurances/life/interfaces.d.ts +15 -0
  150. package/dist/esm/index.js +2033 -509
  151. package/dist/esm/index.js.map +1 -1
  152. package/dist/esm/services/httpRequest/hoox.d.ts +2 -2
  153. package/dist/esm/services/httpRequest/interfaces.d.ts +5 -5
  154. package/dist/esm/states/reducers/interfaces.d.ts +8 -2
  155. package/dist/esm/states/reducers/reducers.d.ts +8 -2
  156. package/dist/esm/states/reducers/states/ConfigState/AppConfigState/interfaces.d.ts +2 -2
  157. package/dist/esm/states/reducers/states/ConfigState/AppDeviceState/interfaces.d.ts +2 -2
  158. package/dist/esm/states/reducers/states/ConfigState/AppLoaderState/interfaces.d.ts +2 -2
  159. package/dist/esm/states/reducers/states/ConfigState/AppModalState/actions.d.ts +1 -0
  160. package/dist/esm/states/reducers/states/ConfigState/AppModalState/interfaces.d.ts +6 -3
  161. package/dist/esm/states/reducers/states/GlobalState/ClientState/interfaces.d.ts +2 -2
  162. package/dist/esm/states/reducers/states/GlobalState/PartnerState/interfaces.d.ts +2 -2
  163. package/dist/esm/states/reducers/states/formStates/FormCarState/ConfigState/constants.d.ts +5 -0
  164. package/dist/esm/states/reducers/states/formStates/FormCarState/ConfigState/hoox.d.ts +2 -1
  165. package/dist/esm/states/reducers/states/formStates/FormCarState/ConfigState/index.d.ts +1 -1
  166. package/dist/esm/states/reducers/states/formStates/FormCarState/ConfigState/interfaces.d.ts +9 -2
  167. package/dist/esm/states/reducers/states/formStates/FormCarState/DiscountState/index.d.ts +1 -1
  168. package/dist/esm/states/reducers/states/formStates/FormCarState/DiscountState/interfaces.d.ts +2 -2
  169. package/dist/esm/states/reducers/states/formStates/FormCarState/DriverState/DriverAccidentState/interfaces.d.ts +2 -2
  170. package/dist/esm/states/reducers/states/formStates/FormCarState/DriverState/DriverBaseState/interfaces.d.ts +2 -2
  171. package/dist/esm/states/reducers/states/formStates/FormCarState/DriverState/DriverCancellationState/interfaces.d.ts +2 -2
  172. package/dist/esm/states/reducers/states/formStates/FormCarState/DriverState/DriverInfoState/interfaces.d.ts +2 -2
  173. package/dist/esm/states/reducers/states/formStates/FormCarState/DriverState/DriverInsuranceState/interfaces.d.ts +2 -2
  174. package/dist/esm/states/reducers/states/formStates/FormCarState/DriverState/DriverLicenceState/interfaces.d.ts +2 -2
  175. package/dist/esm/states/reducers/states/formStates/FormCarState/DriverState/DriverSuspensionState/interfaces.d.ts +2 -2
  176. package/dist/esm/states/reducers/states/formStates/FormCarState/DriverState/DriverTicketState/interfaces.d.ts +2 -2
  177. package/dist/esm/states/reducers/states/formStates/FormCarState/DriverState/interfaces.d.ts +6 -6
  178. package/dist/esm/states/reducers/states/formStates/FormCarState/DriverState/reducer.d.ts +1 -1
  179. package/dist/esm/states/reducers/states/formStates/FormCarState/PostalState/interfaces.d.ts +2 -2
  180. package/dist/esm/states/reducers/states/formStates/FormCarState/QuoteState/actions.d.ts +2 -2
  181. package/dist/esm/states/reducers/states/formStates/FormCarState/QuoteState/helper.d.ts +2 -2
  182. package/dist/esm/states/reducers/states/formStates/FormCarState/QuoteState/index.d.ts +1 -1
  183. package/dist/esm/states/reducers/states/formStates/FormCarState/QuoteState/interfaces.d.ts +6 -6
  184. package/dist/esm/states/reducers/states/formStates/FormCarState/VehicleState/helper.d.ts +1 -1
  185. package/dist/esm/states/reducers/states/formStates/FormCarState/VehicleState/interfaces.d.ts +2 -2
  186. package/dist/esm/states/reducers/states/formStates/FormHomeState/ApplicantState/ApplicantBaseState/interfaces.d.ts +2 -2
  187. package/dist/esm/states/reducers/states/formStates/FormHomeState/ApplicantState/ApplicantCancellationState/interfaces.d.ts +2 -2
  188. package/dist/esm/states/reducers/states/formStates/FormHomeState/ApplicantState/ApplicantClaimState/interfaces.d.ts +2 -2
  189. package/dist/esm/states/reducers/states/formStates/FormHomeState/ApplicantState/ApplicantInfoState/actions.d.ts +0 -2
  190. package/dist/esm/states/reducers/states/formStates/FormHomeState/ApplicantState/ApplicantInfoState/interfaces.d.ts +2 -14
  191. package/dist/esm/states/reducers/states/formStates/FormHomeState/ApplicantState/ApplicantInsuranceState/actions.d.ts +0 -2
  192. package/dist/esm/states/reducers/states/formStates/FormHomeState/ApplicantState/ApplicantInsuranceState/interfaces.d.ts +2 -14
  193. package/dist/esm/states/reducers/states/formStates/FormHomeState/ApplicantState/index.d.ts +1 -1
  194. package/dist/esm/states/reducers/states/formStates/FormHomeState/ApplicantState/initialState.d.ts +4 -3
  195. package/dist/esm/states/reducers/states/formStates/FormHomeState/ApplicantState/interfaces.d.ts +13 -23
  196. package/dist/esm/states/reducers/states/formStates/FormHomeState/ApplicantState/reducer.d.ts +1 -1
  197. package/dist/esm/states/reducers/states/formStates/FormHomeState/DiscountState/actions.d.ts +9 -1
  198. package/dist/esm/states/reducers/states/formStates/FormHomeState/DiscountState/index.d.ts +1 -1
  199. package/dist/esm/states/reducers/states/formStates/FormHomeState/DiscountState/interfaces.d.ts +65 -2
  200. package/dist/esm/states/reducers/states/formStates/FormHomeState/DwellingState/actions.d.ts +11 -2
  201. package/dist/esm/states/reducers/states/formStates/FormHomeState/DwellingState/helper.d.ts +3 -1
  202. package/dist/esm/states/reducers/states/formStates/FormHomeState/DwellingState/index.d.ts +2 -0
  203. package/dist/esm/states/reducers/states/formStates/FormHomeState/DwellingState/initialState.d.ts +3 -13
  204. package/dist/esm/states/reducers/states/formStates/FormHomeState/DwellingState/interfaces.d.ts +74 -16
  205. package/dist/esm/states/reducers/states/formStates/FormHomeState/DwellingState/localStore.d.ts +2 -0
  206. package/dist/esm/states/reducers/states/formStates/FormHomeState/PostalState/actions.d.ts +6 -0
  207. package/dist/esm/states/reducers/states/formStates/FormHomeState/PostalState/helper.d.ts +1 -1
  208. package/dist/esm/states/reducers/states/formStates/FormHomeState/PostalState/interfaces.d.ts +50 -4
  209. package/dist/esm/states/reducers/states/formStates/FormHomeState/QuoteState/actions.d.ts +9 -0
  210. package/dist/esm/states/reducers/states/formStates/FormHomeState/QuoteState/helper.d.ts +2 -0
  211. package/dist/esm/states/reducers/states/formStates/FormHomeState/QuoteState/hoox.d.ts +2 -0
  212. package/dist/esm/states/reducers/states/formStates/FormHomeState/QuoteState/index.d.ts +1 -0
  213. package/dist/esm/states/reducers/states/formStates/FormHomeState/QuoteState/initialState.d.ts +2 -0
  214. package/dist/esm/states/reducers/states/formStates/FormHomeState/QuoteState/interfaces.d.ts +69 -0
  215. package/dist/esm/states/reducers/states/formStates/FormHomeState/QuoteState/localStore.d.ts +3 -0
  216. package/dist/esm/states/reducers/states/formStates/FormHomeState/QuoteState/reducer.d.ts +2 -0
  217. package/dist/esm/states/reducers/states/formStates/FormHomeState/actions.d.ts +1 -1
  218. package/dist/esm/states/reducers/states/formStates/FormHomeState/hoox.d.ts +1 -1
  219. package/dist/esm/states/reducers/states/formStates/FormHomeState/index.d.ts +1 -1
  220. package/dist/esm/states/reducers/states/formStates/FormHomeState/reducer.d.ts +2 -2
  221. package/dist/esm/states/reducers/states/formStates/FormLifeState/ApplicantState/actions.d.ts +18 -0
  222. package/dist/esm/states/reducers/states/formStates/FormLifeState/ApplicantState/hoox.d.ts +2 -0
  223. package/dist/esm/states/reducers/states/formStates/FormLifeState/ApplicantState/index.d.ts +1 -0
  224. package/dist/esm/states/reducers/states/formStates/FormLifeState/ApplicantState/initialState.d.ts +2 -0
  225. package/dist/esm/states/reducers/states/formStates/FormLifeState/ApplicantState/interfaces.d.ts +119 -0
  226. package/dist/esm/states/reducers/states/formStates/FormLifeState/ApplicantState/localStore.d.ts +4 -0
  227. package/dist/esm/states/reducers/states/formStates/FormLifeState/ApplicantState/reducer.d.ts +2 -0
  228. package/dist/esm/states/reducers/states/formStates/FormLifeState/CoverageState/actions.d.ts +9 -0
  229. package/dist/esm/states/reducers/states/formStates/FormLifeState/CoverageState/hoox.d.ts +2 -0
  230. package/dist/esm/states/reducers/states/formStates/FormLifeState/CoverageState/index.d.ts +1 -0
  231. package/dist/esm/states/reducers/states/formStates/FormLifeState/CoverageState/initialState.d.ts +2 -0
  232. package/dist/esm/states/reducers/states/formStates/FormLifeState/CoverageState/interfaces.d.ts +51 -0
  233. package/dist/esm/states/reducers/states/formStates/FormLifeState/CoverageState/localStore.d.ts +3 -0
  234. package/dist/esm/states/reducers/states/formStates/FormLifeState/CoverageState/reducer.d.ts +2 -0
  235. package/dist/esm/states/reducers/states/formStates/FormLifeState/PostalState/actions.d.ts +5 -0
  236. package/dist/esm/states/reducers/states/formStates/FormLifeState/PostalState/helper.d.ts +3 -0
  237. package/dist/esm/states/reducers/states/formStates/FormLifeState/PostalState/hoox.d.ts +2 -0
  238. package/dist/esm/states/reducers/states/formStates/FormLifeState/PostalState/index.d.ts +1 -0
  239. package/dist/esm/states/reducers/states/formStates/FormLifeState/PostalState/initialState.d.ts +2 -0
  240. package/dist/esm/states/reducers/states/formStates/FormLifeState/PostalState/interfaces.d.ts +28 -0
  241. package/dist/esm/states/reducers/states/formStates/FormLifeState/PostalState/localStore.d.ts +3 -0
  242. package/dist/esm/states/reducers/states/formStates/FormLifeState/PostalState/reducer.d.ts +2 -0
  243. package/dist/esm/states/reducers/states/formStates/FormLifeState/QuoteState/actions.d.ts +9 -0
  244. package/dist/esm/states/reducers/states/formStates/FormLifeState/QuoteState/helper.d.ts +2 -0
  245. package/dist/esm/states/reducers/states/formStates/FormLifeState/QuoteState/hoox.d.ts +2 -0
  246. package/dist/esm/states/reducers/states/formStates/FormLifeState/QuoteState/index.d.ts +1 -0
  247. package/dist/esm/states/reducers/states/formStates/FormLifeState/QuoteState/initialState.d.ts +2 -0
  248. package/dist/esm/states/reducers/states/formStates/FormLifeState/QuoteState/interfaces.d.ts +68 -0
  249. package/dist/esm/states/reducers/states/formStates/FormLifeState/QuoteState/localStore.d.ts +3 -0
  250. package/dist/esm/states/reducers/states/formStates/FormLifeState/QuoteState/reducer.d.ts +2 -0
  251. package/dist/esm/states/reducers/states/formStates/FormLifeState/actions.d.ts +4 -0
  252. package/dist/esm/states/reducers/states/formStates/FormLifeState/hoox.d.ts +4 -0
  253. package/dist/esm/states/reducers/states/formStates/FormLifeState/index.d.ts +5 -0
  254. package/dist/esm/states/reducers/states/formStates/FormLifeState/reducer.d.ts +6 -0
  255. package/dist/esm/states/reducers/states/formStates/actions.d.ts +1 -0
  256. package/dist/esm/states/reducers/states/formStates/hoox.d.ts +1 -0
  257. package/dist/esm/states/reducers/states/formStates/index.d.ts +1 -0
  258. package/dist/esm/states/store.d.ts +10 -2
  259. package/dist/index.d.ts +716 -182
  260. package/package.json +4 -4
package/dist/cjs/index.js CHANGED
@@ -10,7 +10,6 @@ var reactRedux = require('react-redux');
10
10
  var redux = require('redux');
11
11
  var thunk = require('redux-thunk');
12
12
  var extension = require('@redux-devtools/extension');
13
- var mychoiceSdkModules = require('@mychoice/mychoice-sdk-modules');
14
13
  var humps = require('humps');
15
14
  var reactRouterDom = require('react-router-dom');
16
15
 
@@ -119,6 +118,7 @@ exports.StoreConfigAppModalActionTypes = void 0;
119
118
  StoreConfigAppModalActionTypes["AppModalMessageModal"] = "AppModalMessageModal";
120
119
  StoreConfigAppModalActionTypes["AppModalConfirmModal"] = "AppModalConfirmModal";
121
120
  StoreConfigAppModalActionTypes["AppModalPostalModal"] = "AppModalPostalModal";
121
+ StoreConfigAppModalActionTypes["AppModalAddressModal"] = "AppModalAddressModal";
122
122
  StoreConfigAppModalActionTypes["AppModalFinaleModal"] = "AppModalFinaleModal";
123
123
  StoreConfigAppModalActionTypes["AppModalClose"] = "AppModalClose";
124
124
  })(exports.StoreConfigAppModalActionTypes || (exports.StoreConfigAppModalActionTypes = {}));
@@ -146,6 +146,13 @@ const appModalStateReducer = (state = { ...appModalInitialState }, action) => {
146
146
  ...action.payload,
147
147
  modalType: mychoiceSdkComponents.ModalTypes.PostalModal,
148
148
  };
149
+ case exports.StoreConfigAppModalActionTypes.AppModalAddressModal:
150
+ return {
151
+ ...state,
152
+ isOpen: true,
153
+ ...action.payload,
154
+ modalType: mychoiceSdkComponents.ModalTypes.AddressModal,
155
+ };
149
156
  case exports.StoreConfigAppModalActionTypes.AppModalFinaleModal:
150
157
  return {
151
158
  ...state,
@@ -179,8 +186,10 @@ exports.StoreConfigAppDeviceActionTypes = void 0;
179
186
 
180
187
  const detectDeviceType = (width) => {
181
188
  switch (true) {
182
- case (width > mychoiceSdkComponents.DeviceTypeWidthList[1].minWidth):
189
+ case (width >= mychoiceSdkComponents.DeviceTypeWidthList[1].minWidth && width < mychoiceSdkComponents.DeviceTypeWidthList[2].minWidth):
183
190
  return mychoiceSdkComponents.DeviceTypeWidthList[1].type;
191
+ case (width >= mychoiceSdkComponents.DeviceTypeWidthList[2].minWidth):
192
+ return mychoiceSdkComponents.DeviceTypeWidthList[2].type;
184
193
  default:
185
194
  return mychoiceSdkComponents.DeviceTypes.Mobile;
186
195
  }
@@ -568,7 +577,7 @@ const setItemProperty = (state, name, value) => {
568
577
  newState.items[newState.activeIndex][name] = value;
569
578
  return newState;
570
579
  };
571
- const setCoverageProperty = (state, name, coverage, value) => {
580
+ const setCarCoverageProperty = (state, name, coverage, value) => {
572
581
  const newState = mychoiceSdkComponents.deepClone(state);
573
582
  newState.items.map((item) => {
574
583
  const newItem = item;
@@ -594,13 +603,13 @@ const setCoverageProperty = (state, name, coverage, value) => {
594
603
  return newState;
595
604
  };
596
605
 
597
- const localStateName$9 = 'car_vehicles';
606
+ const localStateName$d = 'car_vehicles';
598
607
  const getLocalVehicles = (localIndex = '') => {
599
- const localVehicles = localStorage.getItem(`${localIndex}_${localStateName$9}`) ? JSON.parse(localStorage.getItem(`${localIndex}_${localStateName$9}`) || '') : null;
608
+ const localVehicles = localStorage.getItem(`${localIndex}_${localStateName$d}`) ? JSON.parse(localStorage.getItem(`${localIndex}_${localStateName$d}`) || '') : null;
600
609
  return localVehicles || { ...carFormVehicleInitialState };
601
610
  };
602
611
  const setLocalVehicles = (localIndex, state) => {
603
- localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$9}`, JSON.stringify(state));
612
+ localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$d}`, JSON.stringify(state));
604
613
  return state;
605
614
  };
606
615
 
@@ -653,11 +662,11 @@ const formCarVehicleStateReducer = (state = { ...carFormVehicleInitialState }, a
653
662
  return setLocalVehicles(action.localIndex, setItemProperty(state, 'distanceYearly', action.payload.distanceYearly));
654
663
  // coverage
655
664
  case exports.StoreFormCarVehicleActionTypes.FormCarComprehensiveCoverageSelect:
656
- return setLocalVehicles(action.localIndex, setCoverageProperty(state, 'comprehensive', action.payload.coverage, action.payload.deductible));
665
+ return setLocalVehicles(action.localIndex, setCarCoverageProperty(state, 'comprehensive', action.payload.coverage, action.payload.deductible));
657
666
  case exports.StoreFormCarVehicleActionTypes.FormCarCollisionCoverageSelect:
658
- return setLocalVehicles(action.localIndex, setCoverageProperty(state, 'collision', action.payload.coverage, action.payload.deductible));
667
+ return setLocalVehicles(action.localIndex, setCarCoverageProperty(state, 'collision', action.payload.coverage, action.payload.deductible));
659
668
  case exports.StoreFormCarVehicleActionTypes.FormCarLiabilityCoverageSelect:
660
- return setLocalVehicles(action.localIndex, setCoverageProperty(state, 'liability', action.payload.coverage, action.payload.limit));
669
+ return setLocalVehicles(action.localIndex, setCarCoverageProperty(state, 'liability', action.payload.coverage, action.payload.limit));
661
670
  case exports.StoreFormCarVehicleActionTypes.FormCarVehicleClear:
662
671
  return setLocalVehicles(action.localIndex, { ...carFormVehicleInitialState });
663
672
  default:
@@ -867,13 +876,13 @@ const carFormDriverInitialState = {
867
876
  isValid: false,
868
877
  };
869
878
 
870
- const localStateName$8 = 'car_drivers';
879
+ const localStateName$c = 'car_drivers';
871
880
  const getLocalDrivers = (localIndex = '') => {
872
- const localDrivers = localStorage.getItem(`${localIndex}_${localStateName$8}`) ? JSON.parse(localStorage.getItem(`${localIndex}_${localStateName$8}`) || '') : null;
881
+ const localDrivers = localStorage.getItem(`${localIndex}_${localStateName$c}`) ? JSON.parse(localStorage.getItem(`${localIndex}_${localStateName$c}`) || '') : null;
873
882
  return localDrivers || { ...carFormDriverInitialState };
874
883
  };
875
884
  const setLocalDrivers = (localIndex, state) => {
876
- localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$8}`, JSON.stringify(state));
885
+ localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$c}`, JSON.stringify(state));
877
886
  return state;
878
887
  };
879
888
 
@@ -1029,7 +1038,7 @@ const setDriverLicenceInfoDate = (state, type, payload) => {
1029
1038
  const { g2LicenceMonth, g2LicenceYear } = newState.items[newState.activeIndex].licenceInfo;
1030
1039
  if (g2LicenceMonth && g2LicenceYear && config) {
1031
1040
  const g2Date = mychoiceSdkComponents.addDaysToDate(`${g2LicenceYear}-${g2LicenceMonth}-01`, birthDay ? +birthDay + 1 : 1);
1032
- const gMinDefaultDate = mychoiceSdkModules.getLicenceMinDate(licenceType, g2Date, config);
1041
+ const gMinDefaultDate = mychoiceSdkComponents.getLicenceMinDate(licenceType, g2Date, config);
1033
1042
  const gMinDate = mychoiceSdkComponents.compareDates(gMinDefaultDate, currentDate) > 0
1034
1043
  ? currentDate : gMinDefaultDate;
1035
1044
  const { minMaxDates } = newState.items[newState.activeIndex];
@@ -1482,33 +1491,33 @@ exports.StoreFormCarPostalActionTypes = void 0;
1482
1491
  StoreFormCarPostalActionTypes["FormCarPostalGetLocal"] = "FormCarPostalGetLocal";
1483
1492
  })(exports.StoreFormCarPostalActionTypes || (exports.StoreFormCarPostalActionTypes = {}));
1484
1493
 
1485
- const setPostalStateProperty$1 = (state, name, value) => {
1494
+ const setPostalStateProperty$2 = (state, name, value) => {
1486
1495
  const newState = mychoiceSdkComponents.deepClone(state);
1487
1496
  newState.isReady = true;
1488
1497
  newState[name] = value;
1489
1498
  return newState;
1490
1499
  };
1491
1500
 
1492
- const localStateName$7 = 'car_postal';
1493
- const setLocalPostal$1 = (localIndex, state) => {
1494
- localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$7}`, JSON.stringify(state));
1501
+ const localStateName$b = 'car_postal';
1502
+ const setLocalPostal$2 = (localIndex, state) => {
1503
+ localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$b}`, JSON.stringify(state));
1495
1504
  return state;
1496
1505
  };
1497
- const getLocalPostal$1 = (localIndex = '') => {
1498
- const localPostal = localStorage.getItem(`${localIndex}_${localStateName$7}`) ? JSON.parse(localStorage.getItem(`${localIndex}_${localStateName$7}`) || '') : null;
1506
+ const getLocalPostal$2 = (localIndex = '') => {
1507
+ const localPostal = localStorage.getItem(`${localIndex}_${localStateName$b}`) ? JSON.parse(localStorage.getItem(`${localIndex}_${localStateName$b}`) || '') : null;
1499
1508
  return localPostal || { ...formCarPostalInitialState };
1500
1509
  };
1501
1510
 
1502
1511
  const formCarPostalStateReducer = (state = { ...formCarPostalInitialState }, action) => {
1503
1512
  switch (action.type) {
1504
1513
  case exports.StoreFormCarPostalActionTypes.FormCarPostalSet:
1505
- return setLocalPostal$1(action.localIndex, setPostalStateProperty$1(state, 'item', action.payload));
1514
+ return setLocalPostal$2(action.localIndex, setPostalStateProperty$2(state, 'item', action.payload));
1506
1515
  case exports.StoreFormCarPostalActionTypes.FormCarPostalGetLocal:
1507
1516
  return {
1508
- ...getLocalPostal$1(action.localIndex),
1517
+ ...getLocalPostal$2(action.localIndex),
1509
1518
  };
1510
1519
  case exports.StoreFormCarPostalActionTypes.FormCarPostalClear:
1511
- return setLocalPostal$1(action.localIndex, { ...formCarPostalInitialState });
1520
+ return setLocalPostal$2(action.localIndex, { ...formCarPostalInitialState });
1512
1521
  default:
1513
1522
  return state;
1514
1523
  }
@@ -1520,10 +1529,15 @@ exports.StoreFormCarConfigActionTypes = void 0;
1520
1529
  StoreFormCarConfigActionTypes["FormCarConfigClear"] = "FormCarConfigClear";
1521
1530
  })(exports.StoreFormCarConfigActionTypes || (exports.StoreFormCarConfigActionTypes = {}));
1522
1531
 
1532
+ const OntarioCode = 'ON';
1533
+ const AlbertaCode = 'AB';
1534
+ const NovaScotiaCode = 'NS';
1535
+ const NewfoundlandCode = 'NF';
1536
+ const NewBrunswickCode = 'NB';
1523
1537
  const provinceList = [
1524
1538
  {
1525
1539
  name: 'Ontario',
1526
- code: 'ON',
1540
+ code: OntarioCode,
1527
1541
  toolTip: {
1528
1542
  // eslint-disable-next-line max-len
1529
1543
  licenceAge: 'The selection indicates how old the primary driver was when they received their original driver’s licence. It includes motorcycle and commercial licences, too. If you do not remember your age, it is acceptable to provide a best estimate for the purposes of the policy or quote.',
@@ -1570,7 +1584,7 @@ const provinceList = [
1570
1584
  },
1571
1585
  {
1572
1586
  name: 'Alberta',
1573
- code: 'AB',
1587
+ code: AlbertaCode,
1574
1588
  toolTip: {
1575
1589
  // eslint-disable-next-line max-len
1576
1590
  licenceAge: 'Please indicate the age at which this driver first received a driver\'s licence of any type in Alberta. If you don\'t remember the age at which the licence was received, please make your best estimate.',
@@ -1617,7 +1631,7 @@ const provinceList = [
1617
1631
  },
1618
1632
  {
1619
1633
  name: 'Nova Scotia',
1620
- code: 'NS',
1634
+ code: NovaScotiaCode,
1621
1635
  toolTip: {
1622
1636
  // eslint-disable-next-line max-len
1623
1637
  licenceAge: 'The selection indicates how old the primary driver was when they received their original driver’s licence. It includes motorcycle and commercial licences, too. If you do not remember your age, it is acceptable to provide a best estimate for the purposes of the policy or quote.',
@@ -1664,7 +1678,7 @@ const provinceList = [
1664
1678
  },
1665
1679
  {
1666
1680
  name: 'Newfoundland',
1667
- code: 'NF',
1681
+ code: NewfoundlandCode,
1668
1682
  toolTip: {
1669
1683
  // eslint-disable-next-line max-len
1670
1684
  licenceAge: 'The selection indicates how old the primary driver was when they received their original driver’s licence. It includes motorcycle and commercial licences, too. If you do not remember your age, it is acceptable to provide a best estimate for the purposes of the policy or quote.',
@@ -1711,7 +1725,7 @@ const provinceList = [
1711
1725
  },
1712
1726
  {
1713
1727
  name: 'New Brunswick',
1714
- code: 'NB',
1728
+ code: NewBrunswickCode,
1715
1729
  toolTip: {
1716
1730
  // eslint-disable-next-line max-len
1717
1731
  licenceAge: 'The selection indicates how old the primary driver was when they received their original driver’s licence. It includes motorcycle and commercial licences, too. If you do not remember your age, it is acceptable to provide a best estimate for the purposes of the policy or quote.',
@@ -1910,27 +1924,27 @@ const setDiscountQuoterProperty = (state, name, value) => {
1910
1924
  return newState;
1911
1925
  };
1912
1926
 
1913
- const localStateName$6 = 'car_discounts';
1927
+ const localStateName$a = 'car_discounts';
1914
1928
  const getLocalDiscounts$1 = (localIndex = '') => {
1915
- const localDiscounts = localStorage.getItem(`${localIndex}_${localStateName$6}`) ? JSON.parse(localStorage.getItem(`${localIndex}_${localStateName$6}`) || '') : null;
1929
+ const localDiscounts = localStorage.getItem(`${localIndex}_${localStateName$a}`) ? JSON.parse(localStorage.getItem(`${localIndex}_${localStateName$a}`) || '') : null;
1916
1930
  return localDiscounts || { ...formCarDiscountStateInitialState };
1917
1931
  };
1918
1932
  const setLocalDiscounts$1 = (localIndex, state) => {
1919
1933
  if (state.emailTo.emailStatus === mychoiceSdkComponents.ValidationStatusTypes.Approved) {
1920
- localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$6}`, JSON.stringify(state));
1934
+ localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$a}`, JSON.stringify(state));
1921
1935
  return state;
1922
1936
  }
1923
- localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$6}`, JSON.stringify(state));
1937
+ localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$a}`, JSON.stringify(state));
1924
1938
  return state;
1925
1939
  };
1926
1940
  const setLocalDiscountsEmail$1 = (localIndex, state) => {
1927
1941
  if (state.emailTo.emailStatus === mychoiceSdkComponents.ValidationStatusTypes.Approved) {
1928
- localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$6}`, JSON.stringify(state));
1942
+ localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$a}`, JSON.stringify(state));
1929
1943
  }
1930
1944
  else {
1931
1945
  const newState = mychoiceSdkComponents.deepClone(state);
1932
1946
  newState.emailTo = { email: '', emailStatus: mychoiceSdkComponents.ValidationStatusTypes.Initial };
1933
- localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$6}`, JSON.stringify(newState));
1947
+ localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$a}`, JSON.stringify(newState));
1934
1948
  }
1935
1949
  return state;
1936
1950
  };
@@ -2001,47 +2015,47 @@ const formCarQuoteInitialState = {
2001
2015
 
2002
2016
  exports.StoreFormCarQuoteActionTypes = void 0;
2003
2017
  (function (StoreFormCarQuoteActionTypes) {
2004
- StoreFormCarQuoteActionTypes["UpdateQuoteResponse"] = "UpdateQuoteResponse";
2018
+ StoreFormCarQuoteActionTypes["UpdateCarQuoteResponse"] = "UpdateCarQuoteResponse";
2005
2019
  StoreFormCarQuoteActionTypes["FormCarQuoteIsRequestedSet"] = "FormCarQuoteIsRequestedSet";
2006
2020
  StoreFormCarQuoteActionTypes["FormCarQuoteRequestDateSet"] = "FormCarQuoteRequestDateSet";
2007
2021
  StoreFormCarQuoteActionTypes["FormCarQuotesSet"] = "FormCarQuotesSet";
2008
2022
  StoreFormCarQuoteActionTypes["FormCarQuoteGetLocal"] = "FormCarQuoteGetLocal";
2009
2023
  StoreFormCarQuoteActionTypes["FormCarQuoteClear"] = "FormCarQuoteClear";
2010
- StoreFormCarQuoteActionTypes["UpdateCallMessage"] = "UpdateCallMessage";
2024
+ StoreFormCarQuoteActionTypes["UpdateCarCallMessage"] = "UpdateCarCallMessage";
2011
2025
  })(exports.StoreFormCarQuoteActionTypes || (exports.StoreFormCarQuoteActionTypes = {}));
2012
2026
 
2013
- const setQuoteStateProperty = (state, name, value) => {
2027
+ const setQuoteStateProperty$2 = (state, name, value) => {
2014
2028
  const newState = mychoiceSdkComponents.deepClone(state);
2015
2029
  newState[name] = value;
2016
2030
  return newState;
2017
2031
  };
2018
2032
 
2019
- const localStateName$5 = 'car_quotes';
2020
- const setLocalQuotes = (localIndex, state) => {
2021
- localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$5}`, JSON.stringify(state));
2033
+ const localStateName$9 = 'car_quotes';
2034
+ const setLocalQuotes$2 = (localIndex, state) => {
2035
+ localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$9}`, JSON.stringify(state));
2022
2036
  return state;
2023
2037
  };
2024
- const getLocalQuotes = (localIndex = '') => {
2025
- const localQuotes = localStorage.getItem(`${localIndex}_${localStateName$5}`) ? JSON.parse(localStorage.getItem(`${localIndex}_${localStateName$5}`) || '') : null;
2038
+ const getLocalQuotes$2 = (localIndex = '') => {
2039
+ const localQuotes = localStorage.getItem(`${localIndex}_${localStateName$9}`) ? JSON.parse(localStorage.getItem(`${localIndex}_${localStateName$9}`) || '') : null;
2026
2040
  return localQuotes || { ...formCarQuoteInitialState };
2027
2041
  };
2028
2042
 
2029
2043
  const formCarQuoteStateReducer = (state = { ...formCarQuoteInitialState }, action) => {
2030
2044
  switch (action.type) {
2031
2045
  case exports.StoreFormCarQuoteActionTypes.FormCarQuoteIsRequestedSet:
2032
- return setLocalQuotes(action.localIndex, setQuoteStateProperty(state, 'isRequested', action.payload.isRequested));
2046
+ return setLocalQuotes$2(action.localIndex, setQuoteStateProperty$2(state, 'isRequested', action.payload.isRequested));
2033
2047
  case exports.StoreFormCarQuoteActionTypes.FormCarQuotesSet:
2034
- return setLocalQuotes(action.localIndex, setQuoteStateProperty(state, 'items', action.payload.items));
2048
+ return setLocalQuotes$2(action.localIndex, setQuoteStateProperty$2(state, 'items', action.payload.items));
2035
2049
  case exports.StoreFormCarQuoteActionTypes.FormCarQuoteRequestDateSet:
2036
- return setLocalQuotes(action.localIndex, setQuoteStateProperty(state, 'requestDate', action.payload.requestDate));
2050
+ return setLocalQuotes$2(action.localIndex, setQuoteStateProperty$2(state, 'requestDate', action.payload.requestDate));
2037
2051
  case exports.StoreFormCarQuoteActionTypes.FormCarQuoteGetLocal:
2038
2052
  return {
2039
- ...getLocalQuotes(action.localIndex),
2053
+ ...getLocalQuotes$2(action.localIndex),
2040
2054
  };
2041
2055
  case exports.StoreFormCarQuoteActionTypes.FormCarQuoteClear:
2042
- return setLocalQuotes(action.localIndex, { ...formCarQuoteInitialState });
2043
- case exports.StoreFormCarQuoteActionTypes.UpdateCallMessage:
2044
- return setLocalQuotes(action.localIndex, setQuoteStateProperty(state, 'showCallMessage', action.payload.showCallMessage));
2056
+ return setLocalQuotes$2(action.localIndex, { ...formCarQuoteInitialState });
2057
+ case exports.StoreFormCarQuoteActionTypes.UpdateCarCallMessage:
2058
+ return setLocalQuotes$2(action.localIndex, setQuoteStateProperty$2(state, 'showCallMessage', action.payload.showCallMessage));
2045
2059
  default:
2046
2060
  return state;
2047
2061
  }
@@ -2056,27 +2070,202 @@ const formCarReducer = redux.combineReducers({
2056
2070
  quoteState: formCarQuoteStateReducer,
2057
2071
  });
2058
2072
 
2073
+ const dwellingHeatingItemInitialState = {
2074
+ type: 'naturalgas',
2075
+ };
2076
+ const formHomeDwellingInitialState = {
2077
+ type: mychoiceSdkComponents.InsuranceTypes.Home,
2078
+ isCompleted: true,
2079
+ builtDate: '',
2080
+ builtYear: '1952',
2081
+ buildingStructure: 'detached',
2082
+ livingArea: 1149,
2083
+ exteriorFinish: 'brick',
2084
+ constructionType: 'brick',
2085
+ garageType: 'none',
2086
+ basementFinishPercent: 0,
2087
+ storeysCount: 1,
2088
+ roofReplacedDate: '',
2089
+ roofReplacedYear: mychoiceSdkComponents.getFormattedDate(mychoiceSdkComponents.subYearsFromDate('', 10), 'yyyy'),
2090
+ fireHallDistance: '5',
2091
+ fireHydrantDistance: '150',
2092
+ heatings: [
2093
+ { ...dwellingHeatingItemInitialState },
2094
+ { type: 'unknown' },
2095
+ ],
2096
+ replacementCost: 300000,
2097
+ unitsCount: 1,
2098
+ // applicant page
2099
+ familiesCount: '',
2100
+ occupiedDate: '',
2101
+ occupiedYear: '',
2102
+ // discount page
2103
+ burglarAlarm: false,
2104
+ fireAlarm: false,
2105
+ sprinkler: false,
2106
+ deadbolt: false,
2107
+ fireExtinguishersCount: '2',
2108
+ mortgagesCount: '2',
2109
+ // quote page
2110
+ deductible: '1000',
2111
+ liability: '1000000',
2112
+ waterCoverage: true,
2113
+ inValidation: false,
2114
+ isValid: false,
2115
+ // for square one
2116
+ roofType: null,
2117
+ poolType: null,
2118
+ bathroomsCount: null,
2119
+ };
2120
+ const formCondoDwellingInitialState = {
2121
+ type: mychoiceSdkComponents.InsuranceTypes.Condo,
2122
+ isCompleted: false,
2123
+ builtDate: '',
2124
+ builtYear: '',
2125
+ buildingStructure: '',
2126
+ livingArea: 1149,
2127
+ exteriorFinish: 'brick',
2128
+ constructionType: 'brick',
2129
+ garageType: 'none',
2130
+ basementFinishPercent: 0,
2131
+ storeysCount: 1,
2132
+ roofReplacedDate: '',
2133
+ roofReplacedYear: mychoiceSdkComponents.getFormattedDate(mychoiceSdkComponents.subYearsFromDate('', 10), 'yyyy'),
2134
+ fireHallDistance: '5',
2135
+ fireHydrantDistance: '150',
2136
+ heatings: [
2137
+ { ...dwellingHeatingItemInitialState },
2138
+ { type: 'unknown' },
2139
+ ],
2140
+ replacementCost: 150000,
2141
+ unitsCount: 1,
2142
+ pp: '40000',
2143
+ // applicant page
2144
+ familiesCount: '',
2145
+ occupiedDate: '',
2146
+ occupiedYear: '',
2147
+ // discount page
2148
+ burglarAlarm: false,
2149
+ fireAlarm: false,
2150
+ sprinkler: false,
2151
+ deadbolt: false,
2152
+ fireExtinguishersCount: '2',
2153
+ mortgagesCount: '2',
2154
+ // quote page
2155
+ deductible: '1000',
2156
+ liability: '1000000',
2157
+ waterCoverage: true,
2158
+ inValidation: false,
2159
+ isValid: false,
2160
+ // for square one
2161
+ roofType: null,
2162
+ poolType: null,
2163
+ bathroomsCount: null,
2164
+ };
2165
+ const formTenantDwellingInitialState = {
2166
+ type: mychoiceSdkComponents.InsuranceTypes.Tenant,
2167
+ isCompleted: false,
2168
+ builtDate: '',
2169
+ builtYear: '',
2170
+ buildingStructure: '',
2171
+ livingArea: 1149,
2172
+ exteriorFinish: 'brick',
2173
+ constructionType: 'brick',
2174
+ garageType: 'none',
2175
+ basementFinishPercent: 0,
2176
+ storeysCount: 1,
2177
+ roofReplacedDate: '',
2178
+ roofReplacedYear: mychoiceSdkComponents.getFormattedDate(mychoiceSdkComponents.subYearsFromDate('', 10), 'yyyy'),
2179
+ fireHallDistance: '5',
2180
+ fireHydrantDistance: '150',
2181
+ heatings: [
2182
+ { ...dwellingHeatingItemInitialState },
2183
+ { type: 'unknown' },
2184
+ ],
2185
+ replacementCost: 150000,
2186
+ unitsCount: 1,
2187
+ pp: '30000',
2188
+ // applicant page
2189
+ familiesCount: '',
2190
+ occupiedDate: '',
2191
+ occupiedYear: '',
2192
+ // discount page
2193
+ burglarAlarm: false,
2194
+ fireAlarm: false,
2195
+ sprinkler: false,
2196
+ deadbolt: false,
2197
+ fireExtinguishersCount: '2',
2198
+ mortgagesCount: '2',
2199
+ // quote page
2200
+ deductible: '1000',
2201
+ liability: '1000000',
2202
+ waterCoverage: true,
2203
+ inValidation: false,
2204
+ isValid: false,
2205
+ // for square one
2206
+ roofType: null,
2207
+ poolType: null,
2208
+ bathroomsCount: null,
2209
+ };
2210
+
2211
+ // This function isn't used yet
2212
+ const setHomeCoverageProperty = (state, name, value) => {
2213
+ const newState = mychoiceSdkComponents.deepClone(state);
2214
+ newState[name] = value;
2215
+ return newState;
2216
+ };
2217
+ const getDwellingInitialState = (type) => {
2218
+ switch (type) {
2219
+ case mychoiceSdkComponents.InsuranceTypes.Home:
2220
+ return formHomeDwellingInitialState;
2221
+ case mychoiceSdkComponents.InsuranceTypes.Condo:
2222
+ return formCondoDwellingInitialState;
2223
+ case mychoiceSdkComponents.InsuranceTypes.Tenant:
2224
+ return formTenantDwellingInitialState;
2225
+ default:
2226
+ return formHomeDwellingInitialState;
2227
+ }
2228
+ };
2229
+
2059
2230
  const formHomePostalInitialState = {
2060
2231
  isReady: false,
2061
2232
  item: {
2062
2233
  ...postalItemInitialState,
2234
+ errorMessage: '',
2235
+ streetAddress: '',
2236
+ unitNumber: '',
2237
+ addressObject: { label: 'Type in Your Street Address', value: {} }, // sync with search autocomplate package
2063
2238
  },
2239
+ isValid: false,
2240
+ inValidation: false,
2064
2241
  };
2065
2242
 
2066
2243
  exports.StoreFormHomePostalActionTypes = void 0;
2067
2244
  (function (StoreFormHomePostalActionTypes) {
2068
2245
  StoreFormHomePostalActionTypes["FormHomePostalSet"] = "FormHomePostalSet";
2246
+ StoreFormHomePostalActionTypes["FormHomePostalStreetAddressSet"] = "FormHomePostalStreetAddressSet";
2247
+ StoreFormHomePostalActionTypes["FormHomePostalUnitNumberSet"] = "FormHomePostalUnitNumberSet";
2069
2248
  StoreFormHomePostalActionTypes["FormHomePostalCitySet"] = "FormHomePostalCitySet";
2249
+ StoreFormHomePostalActionTypes["FormHomePostalProvinceSet"] = "FormHomePostalProvinceSet";
2070
2250
  StoreFormHomePostalActionTypes["FormHomePostalCodeSet"] = "FormHomePostalCodeSet";
2071
2251
  StoreFormHomePostalActionTypes["FormHomePostalClear"] = "FormHomePostalClear";
2252
+ StoreFormHomePostalActionTypes["FormHomePostalValidate"] = "FormHomePostalValidate";
2253
+ StoreFormHomePostalActionTypes["FormHomePostalValidateSet"] = "FormHomePostalValidateSet";
2254
+ StoreFormHomePostalActionTypes["FormHomePostalErrorMessageSet"] = "FormHomePostalErrorMessageSet";
2072
2255
  StoreFormHomePostalActionTypes["FormHomePostalGetLocal"] = "FormHomePostalGetLocal";
2073
2256
  })(exports.StoreFormHomePostalActionTypes || (exports.StoreFormHomePostalActionTypes = {}));
2074
2257
 
2075
- const setPostalStateProperty = (state, name, value) => {
2258
+ const setPostalStateProperty$1 = (state, name, value) => {
2076
2259
  const newState = mychoiceSdkComponents.deepClone(state);
2077
2260
  newState.isReady = true;
2078
- if (name === 'item') {
2079
- newState[name] = value;
2261
+ newState.isValid = false;
2262
+ if (name === 'item' || name === 'inValidation' || name === 'isValid') {
2263
+ if (typeof value === 'object') {
2264
+ newState[name] = { ...newState[name], ...value };
2265
+ }
2266
+ else {
2267
+ newState[name] = value;
2268
+ }
2080
2269
  }
2081
2270
  else {
2082
2271
  newState.item[name] = value;
@@ -2084,30 +2273,42 @@ const setPostalStateProperty = (state, name, value) => {
2084
2273
  return newState;
2085
2274
  };
2086
2275
 
2087
- const localStateName$4 = 'home_postal';
2088
- const setLocalPostal = (localIndex, state) => {
2089
- localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$4}`, JSON.stringify(state));
2276
+ const localStateName$8 = 'home_postal';
2277
+ const setLocalPostal$1 = (localIndex, state) => {
2278
+ localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$8}`, JSON.stringify(state));
2090
2279
  return state;
2091
2280
  };
2092
- const getLocalPostal = (localIndex = '') => {
2093
- const localPostal = localStorage.getItem(`${localIndex}_${localStateName$4}`) ? JSON.parse(localStorage.getItem(`${localIndex}_${localStateName$4}`) || '') : null;
2281
+ const getLocalPostal$1 = (localIndex = '') => {
2282
+ const localPostal = localStorage.getItem(`${localIndex}_${localStateName$8}`) ? JSON.parse(localStorage.getItem(`${localIndex}_${localStateName$8}`) || '') : null;
2094
2283
  return localPostal || { ...formHomePostalInitialState };
2095
2284
  };
2096
2285
 
2097
2286
  const formHomePostalStateReducer = (state = { ...formHomePostalInitialState }, action) => {
2098
2287
  switch (action.type) {
2288
+ case exports.StoreFormHomePostalActionTypes.FormHomePostalValidate:
2289
+ return setLocalPostal$1(action.localIndex, setPostalStateProperty$1(state, 'inValidation', action.payload.inValidation));
2290
+ case exports.StoreFormHomePostalActionTypes.FormHomePostalValidateSet:
2291
+ return setLocalPostal$1(action.localIndex, setPostalStateProperty$1(state, 'isValid', action.payload.isValid));
2292
+ case exports.StoreFormHomePostalActionTypes.FormHomePostalErrorMessageSet:
2293
+ return setLocalPostal$1(action.localIndex, setPostalStateProperty$1(state, 'errorMessage', action.payload.errorMessage));
2099
2294
  case exports.StoreFormHomePostalActionTypes.FormHomePostalSet:
2100
- return setLocalPostal(action.localIndex, setPostalStateProperty(state, 'item', action.payload));
2295
+ return setLocalPostal$1(action.localIndex, setPostalStateProperty$1(state, 'item', action.payload));
2296
+ case exports.StoreFormHomePostalActionTypes.FormHomePostalUnitNumberSet:
2297
+ return setLocalPostal$1(action.localIndex, setPostalStateProperty$1(state, 'unitNumber', action.payload.unitNumber));
2298
+ case exports.StoreFormHomePostalActionTypes.FormHomePostalStreetAddressSet:
2299
+ return setLocalPostal$1(action.localIndex, setPostalStateProperty$1(state, 'streetAddress', action.payload.streetAddress));
2101
2300
  case exports.StoreFormHomePostalActionTypes.FormHomePostalCitySet:
2102
- return setLocalPostal(action.localIndex, setPostalStateProperty(state, 'city', action.payload.city));
2301
+ return setLocalPostal$1(action.localIndex, setPostalStateProperty$1(state, 'city', action.payload.city));
2302
+ case exports.StoreFormHomePostalActionTypes.FormHomePostalProvinceSet:
2303
+ return setLocalPostal$1(action.localIndex, setPostalStateProperty$1(state, 'provinceCode', action.payload.province));
2103
2304
  case exports.StoreFormHomePostalActionTypes.FormHomePostalCodeSet:
2104
- return setLocalPostal(action.localIndex, setPostalStateProperty(state, 'postalCode', action.payload.postalCode));
2305
+ return setLocalPostal$1(action.localIndex, setPostalStateProperty$1(state, 'postalCode', action.payload.postalCode));
2105
2306
  case exports.StoreFormHomePostalActionTypes.FormHomePostalGetLocal:
2106
2307
  return {
2107
- ...getLocalPostal(action.localIndex),
2308
+ ...getLocalPostal$1(action.localIndex),
2108
2309
  };
2109
2310
  case exports.StoreFormHomePostalActionTypes.FormHomePostalClear:
2110
- return setLocalPostal(action.localIndex, { ...formHomePostalInitialState });
2311
+ return setLocalPostal$1(action.localIndex, { ...formHomePostalInitialState });
2111
2312
  default:
2112
2313
  return state;
2113
2314
  }
@@ -2115,8 +2316,6 @@ const formHomePostalStateReducer = (state = { ...formHomePostalInitialState }, a
2115
2316
 
2116
2317
  exports.StoreFormHomeApplicantInsuranceActionTypes = void 0;
2117
2318
  (function (StoreFormHomeApplicantInsuranceActionTypes) {
2118
- StoreFormHomeApplicantInsuranceActionTypes["FormHomeApplicantPolicyStartYearSelect"] = "FormHomeApplicantListedYearSelect";
2119
- StoreFormHomeApplicantInsuranceActionTypes["FormHomeApplicantPolicyStartMonthSelect"] = "FormHomeApplicantListedMonthSelect";
2120
2319
  StoreFormHomeApplicantInsuranceActionTypes["FormHomeApplicantInsuredCurrentSelect"] = "FormHomeApplicantInsuredCurrentSelect";
2121
2320
  StoreFormHomeApplicantInsuranceActionTypes["FormHomeApplicantDateInsuredCurrentSelect"] = "FormHomeApplicantDateInsuredCurrentSelect";
2122
2321
  StoreFormHomeApplicantInsuranceActionTypes["FormHomeApplicantDateInsuredSinceSelect"] = "FormHomeApplicantDateInsuredSinceSelect";
@@ -2126,12 +2325,15 @@ exports.StoreFormHomeApplicantInsuranceActionTypes = void 0;
2126
2325
  exports.StoreFormHomeApplicantInfoActionTypes = void 0;
2127
2326
  (function (StoreFormHomeApplicantInfoActionTypes) {
2128
2327
  StoreFormHomeApplicantInfoActionTypes["FormHomeApplicantFirstNameSet"] = "FormHomeApplicantFirstNameSet";
2129
- StoreFormHomeApplicantInfoActionTypes["FormHomeApplicantLastNameSet"] = "FormHomeApplicantLastNameSet";
2130
- StoreFormHomeApplicantInfoActionTypes["FormHomeApplicantPhoneSet"] = "FormHomeApplicantPhoneSet";
2328
+ // FormHomeApplicantLastNameSet = 'FormHomeApplicantLastNameSet',
2329
+ // FormHomeApplicantPhoneSet = 'FormHomeApplicantPhoneSet',
2131
2330
  StoreFormHomeApplicantInfoActionTypes["FormHomeApplicantBirthYearSelect"] = "FormHomeApplicantBirthYearSelect";
2132
2331
  StoreFormHomeApplicantInfoActionTypes["FormHomeApplicantBirthMonthSelect"] = "FormHomeApplicantBirthMonthSelect";
2133
2332
  StoreFormHomeApplicantInfoActionTypes["FormHomeApplicantBirthDaySelect"] = "FormHomeApplicantBirthDaySelect";
2134
2333
  StoreFormHomeApplicantInfoActionTypes["FormHomeApplicantNonsmokerSelect"] = "FormHomeApplicantNonsmokerSelect";
2334
+ // FormHomeUtmCampaignSet = 'FormHomeUtmCampaignSet',
2335
+ // FormHomeUtmSourceSet = 'FormHomeUtmSourceSet',
2336
+ // FormHomeQuoterBrokerInfoSet = 'FormHomeQuoterBrokerInfoSet',
2135
2337
  })(exports.StoreFormHomeApplicantInfoActionTypes || (exports.StoreFormHomeApplicantInfoActionTypes = {}));
2136
2338
 
2137
2339
  exports.StoreFormHomeApplicantCancellationActionTypes = void 0;
@@ -2162,32 +2364,14 @@ exports.StoreFormHomeApplicantBaseActionTypes = void 0;
2162
2364
  StoreFormHomeApplicantBaseActionTypes["FormHomeApplicantInitialList"] = "FormHomeApplicantInitialList";
2163
2365
  })(exports.StoreFormHomeApplicantBaseActionTypes || (exports.StoreFormHomeApplicantBaseActionTypes = {}));
2164
2366
 
2165
- // import {
2166
- // GenderTypes,
2167
- // OccupationTypes,
2168
- // } from '@mychoice/mychoice-sdk-components';
2169
- // export const applicantItemMinMaxDates: ApplicantMinMaxDates = {
2170
- // gMax: '',
2171
- // gMin: '',
2172
- // gBlock: true,
2173
- // gDefault: '',
2174
- // gOneMax: '',
2175
- // gOneMin: '',
2176
- // gOneBlock: true,
2177
- // gOneDefault: '',
2178
- // gTwoMax: '',
2179
- // gTwoMin: '',
2180
- // gTwoBlock: true,
2181
- // gTwoDefault: '',
2182
- // licenceAgeMax: 16,
2183
- // };
2184
2367
  const applicantCancellationItemInitialState = {
2185
- cancellationDate: '',
2368
+ date: '',
2186
2369
  cancellationMonth: '',
2187
2370
  cancellationYear: '',
2188
2371
  };
2189
2372
  const applicantClaimItemInitialState = {
2190
- claimDate: '',
2373
+ date: '',
2374
+ type: '',
2191
2375
  claimMonth: '',
2192
2376
  claimYear: '',
2193
2377
  claimType: '',
@@ -2197,14 +2381,7 @@ const applicantListInitialStates = {
2197
2381
  insuranceClaimList: { ...applicantClaimItemInitialState },
2198
2382
  };
2199
2383
  const homeFormApplicantInitialState = {
2200
- quoterInfo: {
2201
- firstName: '',
2202
- lastName: '',
2203
- phone: '',
2204
- recalculate: false,
2205
- utmCampaign: '',
2206
- utmSource: '',
2207
- },
2384
+ firstName: '',
2208
2385
  insured: {
2209
2386
  birthYear: '',
2210
2387
  birthMonth: '',
@@ -2214,8 +2391,8 @@ const homeFormApplicantInitialState = {
2214
2391
  dateInsuredCurrent: '',
2215
2392
  nonsmoker: true,
2216
2393
  },
2217
- insuredCurrent: null,
2218
- insuredBefore: null,
2394
+ insuredCurrent: undefined,
2395
+ insuredBefore: undefined,
2219
2396
  insuranceClaim: false,
2220
2397
  insuranceClaimList: [{ ...applicantClaimItemInitialState }],
2221
2398
  insuranceCancellation: false,
@@ -2224,22 +2401,25 @@ const homeFormApplicantInitialState = {
2224
2401
  isValid: false,
2225
2402
  };
2226
2403
 
2227
- const localStateName$3 = 'home_applicants';
2404
+ const localStateName$7 = 'home_applicants';
2228
2405
  const getLocalApplicants = (localIndex = '') => {
2229
- const localApplicants = localStorage.getItem(`${localIndex}_${localStateName$3}`) ? JSON.parse(localStorage.getItem(`${localIndex}_${localStateName$3}`) || '') : null;
2406
+ const localApplicants = localStorage.getItem(`${localIndex}_${localStateName$7}`) ? JSON.parse(localStorage.getItem(`${localIndex}_${localStateName$7}`) || '') : null;
2230
2407
  return localApplicants || { ...homeFormApplicantInitialState };
2231
2408
  };
2232
2409
  const setLocalApplicants = (localIndex, state) => {
2233
- localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$3}`, JSON.stringify(state));
2410
+ localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$7}`, JSON.stringify(state));
2234
2411
  return state;
2235
2412
  };
2236
2413
 
2237
2414
  function setStateProperty(state, key, value, objectKey) {
2238
- const newState = mychoiceSdkComponents.deepClone(state);
2415
+ let newState = mychoiceSdkComponents.deepClone(state);
2239
2416
  if (key !== 'isValid' && key !== 'inValidation') {
2240
2417
  newState.isValid = false;
2241
2418
  }
2242
- if (objectKey) {
2419
+ if (key === 'dwelling') {
2420
+ newState = { ...newState, ...value };
2421
+ }
2422
+ else if (objectKey) {
2243
2423
  newState[objectKey][key] = value;
2244
2424
  }
2245
2425
  else {
@@ -2257,11 +2437,59 @@ function setListItemProperty(state, listKey, itemIndex, itemKey, value) {
2257
2437
  const formHomeApplicantInfoStateReducer = (state = { ...homeFormApplicantInitialState }, action) => {
2258
2438
  switch (action.type) {
2259
2439
  case exports.StoreFormHomeApplicantInfoActionTypes.FormHomeApplicantFirstNameSet:
2260
- return setLocalApplicants(action?.localIndex, setStateProperty(state, 'firstName', action.payload.firstName, 'quoterInfo'));
2261
- case exports.StoreFormHomeApplicantInfoActionTypes.FormHomeApplicantLastNameSet:
2262
- return setLocalApplicants(action?.localIndex, setStateProperty(state, 'lastName', action.payload.lastName, 'quoterInfo'));
2263
- case exports.StoreFormHomeApplicantInfoActionTypes.FormHomeApplicantPhoneSet:
2264
- return setLocalApplicants(action?.localIndex, setStateProperty(state, 'phone', action.payload.phone, 'quoterInfo'));
2440
+ return setLocalApplicants(action?.localIndex, setStateProperty(state, 'firstName', action.payload.firstName));
2441
+ // case StoreFormHomeApplicantInfoActionTypes.FormHomeApplicantLastNameSet:
2442
+ // return setLocalApplicants(
2443
+ // action?.localIndex,
2444
+ // setStateProperty(
2445
+ // state,
2446
+ // 'lastName',
2447
+ // action.payload.lastName,
2448
+ // 'quoterInfo',
2449
+ // ),
2450
+ // );
2451
+ //
2452
+ // case StoreFormHomeApplicantInfoActionTypes.FormHomeApplicantPhoneSet:
2453
+ // return setLocalApplicants(
2454
+ // action?.localIndex,
2455
+ // setStateProperty(
2456
+ // state,
2457
+ // 'phone',
2458
+ // action.payload.phone,
2459
+ // 'quoterInfo',
2460
+ // ),
2461
+ // );
2462
+ // case StoreFormHomeApplicantInfoActionTypes.FormHomeUtmCampaignSet:
2463
+ // return setLocalApplicants(
2464
+ // action?.localIndex,
2465
+ // setStateProperty(
2466
+ // state,
2467
+ // 'utmCampaign',
2468
+ // action.payload.utmCampaign,
2469
+ // 'quoterInfo',
2470
+ // ),
2471
+ // );
2472
+ //
2473
+ // case StoreFormHomeApplicantInfoActionTypes.FormHomeUtmSourceSet:
2474
+ // return setLocalApplicants(
2475
+ // action?.localIndex,
2476
+ // setStateProperty(
2477
+ // state,
2478
+ // 'utmSource',
2479
+ // action.payload.utmSource,
2480
+ // 'quoterInfo',
2481
+ // ),
2482
+ // );
2483
+ // case StoreFormHomeApplicantInfoActionTypes.FormHomeQuoterBrokerInfoSet:
2484
+ // return setLocalApplicants(
2485
+ // action?.localIndex,
2486
+ // setStateProperty(
2487
+ // state,
2488
+ // 'brokerInfo',
2489
+ // action.payload.brokerInfo,
2490
+ // 'quoterInfo',
2491
+ // ),
2492
+ // );
2265
2493
  case exports.StoreFormHomeApplicantInfoActionTypes.FormHomeApplicantBirthYearSelect:
2266
2494
  return setLocalApplicants(action?.localIndex, setStateProperty(state, 'birthYear', action.payload.birthYear, 'insured'));
2267
2495
  case exports.StoreFormHomeApplicantInfoActionTypes.FormHomeApplicantBirthMonthSelect:
@@ -2277,10 +2505,6 @@ const formHomeApplicantInfoStateReducer = (state = { ...homeFormApplicantInitial
2277
2505
 
2278
2506
  const formHomeApplicantInsuranceStateReducer = (state = { ...homeFormApplicantInitialState }, action) => {
2279
2507
  switch (action.type) {
2280
- case exports.StoreFormHomeApplicantInsuranceActionTypes.FormHomeApplicantPolicyStartYearSelect:
2281
- return setLocalApplicants(action?.localIndex, setStateProperty(state, 'policyStartYear', action.payload.policyStartYear));
2282
- case exports.StoreFormHomeApplicantInsuranceActionTypes.FormHomeApplicantPolicyStartMonthSelect:
2283
- return setLocalApplicants(action?.localIndex, setStateProperty(state, 'policyStartYear', action.payload.policyStartMonth));
2284
2508
  case exports.StoreFormHomeApplicantInsuranceActionTypes.FormHomeApplicantInsuredCurrentSelect:
2285
2509
  return setLocalApplicants(action?.localIndex, setStateProperty(state, 'insuredCurrent', action.payload.insuredCurrent));
2286
2510
  case exports.StoreFormHomeApplicantInsuranceActionTypes.FormHomeApplicantDateInsuredSinceSelect:
@@ -2405,45 +2629,11 @@ const formHomeApplicantStateReducer = (state = { ...homeFormApplicantInitialStat
2405
2629
  return state;
2406
2630
  };
2407
2631
 
2408
- const dwellingHeatingItemInitialState = {
2409
- type: '',
2410
- };
2411
- const carFormDwellingInitialState = {
2412
- builtDate: '',
2413
- builtYear: '',
2414
- livingArea: '',
2415
- exteriorFinish: '',
2416
- constructionType: '',
2417
- garageType: '',
2418
- basementFinishPercent: 0,
2419
- storeysCount: '',
2420
- roofReplaceDate: '',
2421
- roofReplaceYear: '',
2422
- fireHallDistance: 0,
2423
- fireHydrantDistance: 0,
2424
- heatings: [
2425
- { ...dwellingHeatingItemInitialState },
2426
- { ...dwellingHeatingItemInitialState },
2427
- ],
2428
- buildingStructure: '',
2429
- replacementCost: '',
2430
- // applicant page
2431
- familiesCount: null,
2432
- occupiedDate: '',
2433
- occupiedYear: '',
2434
- // discount page
2435
- burglarAlarm: false,
2436
- fireAlarm: false,
2437
- sprinkler: false,
2438
- deadbolt: false,
2439
- fireExtinguishersCount: 0,
2440
- mortgageCount: 0,
2441
- inValidation: false,
2442
- isValid: false,
2443
- };
2444
-
2445
2632
  exports.StoreFormHomeDwellingActionTypes = void 0;
2446
2633
  (function (StoreFormHomeDwellingActionTypes) {
2634
+ StoreFormHomeDwellingActionTypes["FormHomeDwellingSet"] = "FormHomeDwellingSet";
2635
+ StoreFormHomeDwellingActionTypes["FormHomeDwellingIsCompleted"] = "FormHomeDwellingIsCompleted";
2636
+ StoreFormHomeDwellingActionTypes["FormHomeDwellingInsuranceTypeSelect"] = "FormHomeDwellingInsuranceTypeSelect";
2447
2637
  StoreFormHomeDwellingActionTypes["FormHomeDwellingBuiltYearSelect"] = "FormHomeDwellingBuiltYearSelect";
2448
2638
  StoreFormHomeDwellingActionTypes["FormHomeDwellingLivingAreaSelect"] = "FormHomeDwellingLivingAreaSelect";
2449
2639
  StoreFormHomeDwellingActionTypes["FormHomeDwellingExteriorFinishSelect"] = "FormHomeDwellingExteriorFinishSelect";
@@ -2464,34 +2654,78 @@ exports.StoreFormHomeDwellingActionTypes = void 0;
2464
2654
  StoreFormHomeDwellingActionTypes["FormHomeDwellingSprinklerSelect"] = "FormHomeDwellingSprinklerSelect";
2465
2655
  StoreFormHomeDwellingActionTypes["FormHomeDwellingDeadboltSelect"] = "FormHomeDwellingDeadboltSelect";
2466
2656
  StoreFormHomeDwellingActionTypes["FormHomeDwellingFireExtinguishersCountSelect"] = "FormHomeDwellingFireExtinguishersCountSelect";
2467
- StoreFormHomeDwellingActionTypes["FormHomeDwellingMortgageCountSelect"] = "FormHomeDwellingMortgageCountSelect";
2657
+ StoreFormHomeDwellingActionTypes["FormHomeDwellingMortgagesCountSelect"] = "FormHomeDwellingMortgagesCountSelect";
2658
+ StoreFormHomeDwellingActionTypes["FormHomeDwellingUnitsCountSelect"] = "FormHomeDwellingUnitsCountSelect";
2468
2659
  StoreFormHomeDwellingActionTypes["FormHomeDwellingValidate"] = "FormHomeDwellingValidate";
2469
2660
  StoreFormHomeDwellingActionTypes["FormHomeDwellingValidateSet"] = "FormHomeDwellingValidateSet";
2470
2661
  StoreFormHomeDwellingActionTypes["FormHomeDwellingGetLocal"] = "FormHomeDwellingGetLocal";
2662
+ StoreFormHomeDwellingActionTypes["FormHomeDeductibleCoverageSelect"] = "FormHomeDeductibleCoverageSelect";
2663
+ StoreFormHomeDwellingActionTypes["FormHomeLiabilityCoverageSelect"] = "FormHomeLiabilityCoverageSelect";
2664
+ StoreFormHomeDwellingActionTypes["FormHomePpSelect"] = "FormHomePpSelect";
2665
+ StoreFormHomeDwellingActionTypes["FormHomeWaterCoverageSelect"] = "FormHomeWaterCoverageSelect";
2666
+ StoreFormHomeDwellingActionTypes["FormHomeDwellingClear"] = "FormHomeDwellingClear";
2471
2667
  })(exports.StoreFormHomeDwellingActionTypes || (exports.StoreFormHomeDwellingActionTypes = {}));
2472
2668
 
2473
- const localStateName$2 = 'home_dwellings';
2669
+ const getInsuranceType$1 = () => {
2670
+ const pathParts = window.location.pathname.split('/');
2671
+ if (pathParts.includes('car')) {
2672
+ return mychoiceSdkComponents.InsuranceTypes.Car;
2673
+ }
2674
+ if (pathParts.includes('home')) {
2675
+ return mychoiceSdkComponents.InsuranceTypes.Home;
2676
+ }
2677
+ if (pathParts.includes('condo')) {
2678
+ return mychoiceSdkComponents.InsuranceTypes.Condo;
2679
+ }
2680
+ if (pathParts.includes('tenant')) {
2681
+ return mychoiceSdkComponents.InsuranceTypes.Tenant;
2682
+ }
2683
+ return mychoiceSdkComponents.InsuranceTypes.Car;
2684
+ };
2685
+ const localStateName$6 = `${getInsuranceType$1()}_dwellings`;
2474
2686
  const getLocalDwellings = (localIndex = '') => {
2475
- const localDwellings = localStorage.getItem(`${localIndex}_${localStateName$2}`) ? JSON.parse(localStorage.getItem(`${localIndex}_${localStateName$2}`) || '') : null;
2476
- return localDwellings || { ...carFormDwellingInitialState };
2687
+ const localDwellings = localStorage.getItem(`${localIndex}_${localStateName$6}`) ? JSON.parse(localStorage.getItem(`${localIndex}_${localStateName$6}`) || '') : null;
2688
+ return localDwellings || { ...getDwellingInitialState(getInsuranceType$1()) };
2477
2689
  };
2478
2690
  const setLocalDwellings = (localIndex, state) => {
2479
- localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$2}`, JSON.stringify(state));
2691
+ localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$6}`, JSON.stringify(state));
2480
2692
  return state;
2481
2693
  };
2482
2694
 
2483
- const formHomeDwellingStateReducer = (state = { ...carFormDwellingInitialState }, action) => {
2695
+ const getInsuranceType = () => {
2696
+ const pathParts = window.location.pathname.split('/');
2697
+ if (pathParts.includes('car')) {
2698
+ return mychoiceSdkComponents.InsuranceTypes.Car;
2699
+ }
2700
+ if (pathParts.includes('home')) {
2701
+ return mychoiceSdkComponents.InsuranceTypes.Home;
2702
+ }
2703
+ if (pathParts.includes('condo')) {
2704
+ return mychoiceSdkComponents.InsuranceTypes.Condo;
2705
+ }
2706
+ if (pathParts.includes('tenant')) {
2707
+ return mychoiceSdkComponents.InsuranceTypes.Tenant;
2708
+ }
2709
+ return mychoiceSdkComponents.InsuranceTypes.Car;
2710
+ };
2711
+ const formHomeDwellingStateReducer = (state = { ...getDwellingInitialState(getInsuranceType()) }, action) => {
2484
2712
  switch (action.type) {
2485
2713
  case exports.StoreFormHomeDwellingActionTypes.FormHomeDwellingValidate:
2486
2714
  return setLocalDwellings(action.localIndex, setStateProperty(state, 'inValidation', action.payload.inValidation));
2715
+ case exports.StoreFormHomeDwellingActionTypes.FormHomeDwellingSet:
2716
+ return setLocalDwellings(action.localIndex, setStateProperty(state, 'dwelling', action.payload));
2487
2717
  case exports.StoreFormHomeDwellingActionTypes.FormHomeDwellingValidateSet:
2488
2718
  return setLocalDwellings(action.localIndex, setStateProperty(state, 'isValid', action.payload.isValid));
2489
2719
  case exports.StoreFormHomeDwellingActionTypes.FormHomeDwellingGetLocal:
2490
2720
  return {
2491
2721
  ...getLocalDwellings(action.localIndex),
2492
2722
  };
2723
+ case exports.StoreFormHomeDwellingActionTypes.FormHomeDwellingIsCompleted:
2724
+ return setLocalDwellings(action.localIndex, setStateProperty(state, 'isCompleted', action.payload.isCompleted));
2493
2725
  case exports.StoreFormHomeDwellingActionTypes.FormHomeDwellingBuiltYearSelect:
2494
2726
  return setLocalDwellings(action.localIndex, setStateProperty(state, 'builtYear', action.payload.builtYear));
2727
+ case exports.StoreFormHomeDwellingActionTypes.FormHomeDwellingBuildingStructureSelect:
2728
+ return setLocalDwellings(action.localIndex, setStateProperty(state, 'buildingStructure', action.payload.buildingStructure));
2495
2729
  case exports.StoreFormHomeDwellingActionTypes.FormHomeDwellingLivingAreaSelect:
2496
2730
  return setLocalDwellings(action.localIndex, setStateProperty(state, 'livingArea', action.payload.livingArea));
2497
2731
  case exports.StoreFormHomeDwellingActionTypes.FormHomeDwellingExteriorFinishSelect:
@@ -2505,15 +2739,15 @@ const formHomeDwellingStateReducer = (state = { ...carFormDwellingInitialState }
2505
2739
  case exports.StoreFormHomeDwellingActionTypes.FormHomeDwellingStoreysCountSelect:
2506
2740
  return setLocalDwellings(action.localIndex, setStateProperty(state, 'storeysCount', action.payload.storeysCount));
2507
2741
  case exports.StoreFormHomeDwellingActionTypes.FormHomeDwellingRoofReplaceYearSelect:
2508
- return setLocalDwellings(action.localIndex, setStateProperty(state, 'roofReplaceYear', action.payload.roofReplaceYear));
2742
+ return setLocalDwellings(action.localIndex, setStateProperty(state, 'roofReplacedYear', action.payload.roofReplacedYear));
2509
2743
  case exports.StoreFormHomeDwellingActionTypes.FormHomeDwellingFireHallDistanceSelect:
2510
2744
  return setLocalDwellings(action.localIndex, setStateProperty(state, 'fireHallDistance', action.payload.fireHallDistance));
2511
2745
  case exports.StoreFormHomeDwellingActionTypes.FormHomeDwellingFireHydrantDistanceSelect:
2512
2746
  return setLocalDwellings(action.localIndex, setStateProperty(state, 'fireHydrantDistance', action.payload.fireHydrantDistance));
2513
2747
  case exports.StoreFormHomeDwellingActionTypes.FormHomeDwellingHeatingSelect:
2514
2748
  return setLocalDwellings(action.localIndex, setListItemProperty(state, 'heatings', action.payload.index, 'type', action.payload.type));
2515
- case exports.StoreFormHomeDwellingActionTypes.FormHomeDwellingBuildingStructureSelect:
2516
- return setLocalDwellings(action.localIndex, setStateProperty(state, 'buildingStructure', action.payload.buildingStructure));
2749
+ case exports.StoreFormHomeDwellingActionTypes.FormHomeDwellingUnitsCountSelect:
2750
+ return setLocalDwellings(action.localIndex, setStateProperty(state, 'unitsCount', action.payload.unitsCount));
2517
2751
  case exports.StoreFormHomeDwellingActionTypes.FormHomeDwellingReplacementCostSelect:
2518
2752
  return setLocalDwellings(action.localIndex, setStateProperty(state, 'replacementCost', action.payload.replacementCost));
2519
2753
  case exports.StoreFormHomeDwellingActionTypes.FormHomeDwellingFamiliesCountSelect:
@@ -2530,24 +2764,18 @@ const formHomeDwellingStateReducer = (state = { ...carFormDwellingInitialState }
2530
2764
  return setLocalDwellings(action.localIndex, setStateProperty(state, 'deadbolt', action.payload.deadbolt));
2531
2765
  case exports.StoreFormHomeDwellingActionTypes.FormHomeDwellingFireExtinguishersCountSelect:
2532
2766
  return setLocalDwellings(action.localIndex, setStateProperty(state, 'fireExtinguishersCount', action.payload.fireExtinguishersCount));
2533
- case exports.StoreFormHomeDwellingActionTypes.FormHomeDwellingMortgageCountSelect:
2534
- return setLocalDwellings(action.localIndex, setStateProperty(state, 'mortgageCount', action.payload.mortgageCount));
2535
- // case StoreFormHomeDwellingActionTypes.FormHomeCollisionCoverageSelect:
2536
- // return setLocalDwellings(
2537
- // action.localIndex,
2538
- // setCoverageProperty(state, 'collision', action.payload.coverage, action.payload.deductible),
2539
- // );
2540
- //
2541
- // case StoreFormHomeDwellingActionTypes.FormHomeLiabilityCoverageSelect:
2542
- // return setLocalDwellings(
2543
- // action.localIndex,
2544
- // setCoverageProperty(state, 'liability', action.payload.coverage, action.payload.limit),
2545
- // );
2546
- // case StoreFormHomeDwellingActionTypes.FormHomeDwellingClear:
2547
- // return setLocalDwellings(
2548
- // action.localIndex,
2549
- // { ...carFormDwellingInitialState },
2550
- // );
2767
+ case exports.StoreFormHomeDwellingActionTypes.FormHomeDwellingMortgagesCountSelect:
2768
+ return setLocalDwellings(action.localIndex, setStateProperty(state, 'mortgagesCount', action.payload.mortgagesCount));
2769
+ case exports.StoreFormHomeDwellingActionTypes.FormHomeDeductibleCoverageSelect:
2770
+ return setLocalDwellings(action.localIndex, setHomeCoverageProperty(state, 'deductible', action.payload.deductible));
2771
+ case exports.StoreFormHomeDwellingActionTypes.FormHomeLiabilityCoverageSelect:
2772
+ return setLocalDwellings(action.localIndex, setHomeCoverageProperty(state, 'liability', action.payload.liability));
2773
+ case exports.StoreFormHomeDwellingActionTypes.FormHomePpSelect:
2774
+ return setLocalDwellings(action.localIndex, setHomeCoverageProperty(state, 'pp', action.payload.pp));
2775
+ case exports.StoreFormHomeDwellingActionTypes.FormHomeWaterCoverageSelect:
2776
+ return setLocalDwellings(action.localIndex, setHomeCoverageProperty(state, 'waterCoverage', action.payload.waterCoverage));
2777
+ case exports.StoreFormHomeDwellingActionTypes.FormHomeDwellingClear:
2778
+ return setLocalDwellings(action.localIndex, { ...getDwellingInitialState(action.payload.type) });
2551
2779
  default:
2552
2780
  return state;
2553
2781
  }
@@ -2558,11 +2786,25 @@ const formHomeDiscountStateInitialState = {
2558
2786
  email: '',
2559
2787
  emailStatus: mychoiceSdkComponents.ValidationStatusTypes.Initial,
2560
2788
  },
2789
+ quoterInfo: {
2790
+ firstName: '',
2791
+ lastName: '',
2792
+ phone: '',
2793
+ recalculate: false,
2794
+ utmCampaign: '',
2795
+ utmSource: '',
2796
+ brokerInfo: {
2797
+ phone: mychoiceSdkComponents.defaultBrokerPhone,
2798
+ },
2799
+ splashScreen: false,
2800
+ caslConsent: false,
2801
+ initial: true,
2802
+ },
2561
2803
  multiplePoliciesDiscount: true,
2562
2804
  policyStart: mychoiceSdkComponents.getFormattedDate('', 'yyyy-MM-dd'),
2563
- policyStartDay: mychoiceSdkComponents.getFormattedDate('', 'dd'),
2564
- policyStartMonth: mychoiceSdkComponents.getFormattedDate('', 'MM'),
2565
- policyStartYear: mychoiceSdkComponents.getFormattedDate('', 'yyyy'),
2805
+ policyStartDay: mychoiceSdkComponents.getFormattedDate(mychoiceSdkComponents.addDaysToDate('', 1), 'dd'),
2806
+ policyStartMonth: mychoiceSdkComponents.getFormattedDate(mychoiceSdkComponents.addDaysToDate('', 1), 'MM'),
2807
+ policyStartYear: mychoiceSdkComponents.getFormattedDate(mychoiceSdkComponents.addDaysToDate('', 1), 'yyyy'),
2566
2808
  inValidation: false,
2567
2809
  isValid: false,
2568
2810
  };
@@ -2576,32 +2818,40 @@ exports.StoreFormHomeDiscountActionTypes = void 0;
2576
2818
  StoreFormHomeDiscountActionTypes["FormHomeDiscountMultiplePoliciesSelect"] = "FormHomeDiscountMultiplePoliciesSelect";
2577
2819
  StoreFormHomeDiscountActionTypes["FormHomeDiscountQuoterEmailSet"] = "FormHomeDiscountQuoterEmailSet";
2578
2820
  StoreFormHomeDiscountActionTypes["FormHomeDiscountQuoterEmailStatusSet"] = "FormHomeDiscountQuoterEmailStatusSet";
2821
+ StoreFormHomeDiscountActionTypes["FormHomeDiscountQuoterCaslConsentSet"] = "FormHomeDiscountQuoterCaslConsentSet";
2579
2822
  StoreFormHomeDiscountActionTypes["FormHomeDiscountValidate"] = "FormHomeDiscountValidate";
2580
2823
  StoreFormHomeDiscountActionTypes["FormHomeDiscountValidateSet"] = "FormHomeDiscountValidateSet";
2581
2824
  StoreFormHomeDiscountActionTypes["FormHomeDiscountClear"] = "FormHomeDiscountClear";
2825
+ StoreFormHomeDiscountActionTypes["FormHomeQuoterFirstNameSet"] = "FormHomeQuoterFirstNameSet";
2826
+ StoreFormHomeDiscountActionTypes["FormHomeQuoterLastNameSet"] = "FormHomeQuoterLastNameSet";
2827
+ StoreFormHomeDiscountActionTypes["FormHomeQuoterPhoneSet"] = "FormHomeQuoterPhoneSet";
2828
+ StoreFormHomeDiscountActionTypes["FormHomeUtmCampaignSet"] = "FormHomeUtmCampaignSet";
2829
+ StoreFormHomeDiscountActionTypes["FormHomeUtmSourceSet"] = "FormHomeUtmSourceSet";
2830
+ StoreFormHomeDiscountActionTypes["FormHomeQuoterBrokerInfoSet"] = "FormHomeQuoterBrokerInfoSet";
2831
+ StoreFormHomeDiscountActionTypes["FormHomeDiscountQuoterInitialSet"] = "FormHomeDiscountQuoterInitialSet";
2582
2832
  })(exports.StoreFormHomeDiscountActionTypes || (exports.StoreFormHomeDiscountActionTypes = {}));
2583
2833
 
2584
- const localStateName$1 = 'home_discounts';
2834
+ const localStateName$5 = 'home_discounts';
2585
2835
  const getLocalDiscounts = (localIndex = '') => {
2586
- const localDiscounts = localStorage.getItem(`${localIndex}_${localStateName$1}`) ? JSON.parse(localStorage.getItem(`${localIndex}_${localStateName$1}`) || '') : null;
2836
+ const localDiscounts = localStorage.getItem(`${localIndex}_${localStateName$5}`) ? JSON.parse(localStorage.getItem(`${localIndex}_${localStateName$5}`) || '') : null;
2587
2837
  return localDiscounts || { ...formHomeDiscountStateInitialState };
2588
2838
  };
2589
2839
  const setLocalDiscounts = (localIndex, state) => {
2590
2840
  if (state.emailTo.emailStatus === mychoiceSdkComponents.ValidationStatusTypes.Approved) {
2591
- localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$1}`, JSON.stringify(state));
2841
+ localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$5}`, JSON.stringify(state));
2592
2842
  return state;
2593
2843
  }
2594
- localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$1}`, JSON.stringify(state));
2844
+ localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$5}`, JSON.stringify(state));
2595
2845
  return state;
2596
2846
  };
2597
2847
  const setLocalDiscountsEmail = (localIndex, state) => {
2598
2848
  if (state.emailTo.emailStatus === mychoiceSdkComponents.ValidationStatusTypes.Approved) {
2599
- localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$1}`, JSON.stringify(state));
2849
+ localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$5}`, JSON.stringify(state));
2600
2850
  }
2601
2851
  else {
2602
2852
  const newState = mychoiceSdkComponents.deepClone(state);
2603
2853
  newState.emailTo = { email: '', emailStatus: mychoiceSdkComponents.ValidationStatusTypes.Initial };
2604
- localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$1}`, JSON.stringify(newState));
2854
+ localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$5}`, JSON.stringify(newState));
2605
2855
  }
2606
2856
  return state;
2607
2857
  };
@@ -2626,6 +2876,22 @@ const formHomeDiscountStateReducer = (state = { ...formHomeDiscountStateInitialS
2626
2876
  return setLocalDiscounts(action.localIndex, setStateProperty(state, 'policyStartMonth', action.payload.policyStartMonth));
2627
2877
  case exports.StoreFormHomeDiscountActionTypes.FormHomeDiscountPolicyStartYearSelect:
2628
2878
  return setLocalDiscounts(action.localIndex, setStateProperty(state, 'policyStartYear', action.payload.policyStartYear));
2879
+ case exports.StoreFormHomeDiscountActionTypes.FormHomeDiscountQuoterCaslConsentSet:
2880
+ return setLocalDiscounts(action.localIndex, setStateProperty(state, 'caslConsent', action.payload.caslConsent, 'quoterInfo'));
2881
+ case exports.StoreFormHomeDiscountActionTypes.FormHomeQuoterFirstNameSet:
2882
+ return setLocalDiscounts(action.localIndex, setStateProperty(state, 'firstName', action.payload.firstName, 'quoterInfo'));
2883
+ case exports.StoreFormHomeDiscountActionTypes.FormHomeQuoterLastNameSet:
2884
+ return setLocalDiscounts(action.localIndex, setStateProperty(state, 'lastName', action.payload.lastName, 'quoterInfo'));
2885
+ case exports.StoreFormHomeDiscountActionTypes.FormHomeQuoterPhoneSet:
2886
+ return setLocalDiscounts(action.localIndex, setStateProperty(state, 'phone', action.payload.phone, 'quoterInfo'));
2887
+ case exports.StoreFormHomeDiscountActionTypes.FormHomeUtmSourceSet:
2888
+ return setLocalDiscounts(action.localIndex, setStateProperty(state, 'utmSource', action.payload.utmSource, 'quoterInfo'));
2889
+ case exports.StoreFormHomeDiscountActionTypes.FormHomeUtmCampaignSet:
2890
+ return setLocalDiscounts(action.localIndex, setStateProperty(state, 'utmCampaign', action.payload.utmCampaign, 'quoterInfo'));
2891
+ case exports.StoreFormHomeDiscountActionTypes.FormHomeDiscountQuoterInitialSet:
2892
+ return setLocalDiscounts(action.localIndex, setStateProperty(state, 'initial', action.payload.initial, 'quoterInfo'));
2893
+ case exports.StoreFormHomeDiscountActionTypes.FormHomeQuoterBrokerInfoSet:
2894
+ return setLocalDiscounts(action.localIndex, setStateProperty(state, 'brokerInfo', action.payload.brokerInfo, 'quoterInfo'));
2629
2895
  case exports.StoreFormHomeDiscountActionTypes.FormHomeDiscountClear:
2630
2896
  return setLocalDiscounts(action.localIndex, { ...formHomeDiscountStateInitialState });
2631
2897
  default:
@@ -2633,53 +2899,56 @@ const formHomeDiscountStateReducer = (state = { ...formHomeDiscountStateInitialS
2633
2899
  }
2634
2900
  };
2635
2901
 
2636
- const formHomeAddressStateInitialState = {
2637
- type: null,
2638
- addressStreet: '',
2639
- unitApartmentNumber: '',
2640
- inValidation: false,
2641
- isValid: false,
2902
+ const formHomeQuoteInitialState = {
2903
+ items: [],
2904
+ isRequested: false,
2905
+ requestDate: new Date().toISOString(),
2906
+ showCallMessage: false,
2642
2907
  };
2643
2908
 
2644
- exports.StoreFormHomeAddressActionTypes = void 0;
2645
- (function (StoreFormHomeAddressActionTypes) {
2646
- StoreFormHomeAddressActionTypes["FormHomeAddressGetLocal"] = "FormHomeAddressGetLocal";
2647
- StoreFormHomeAddressActionTypes["FormHomeAddressTypeSelect"] = "FormHomeAddressTypeSelect";
2648
- StoreFormHomeAddressActionTypes["FormHomeAddressStreetSet"] = "FormHomeAddressStreetSet";
2649
- StoreFormHomeAddressActionTypes["FormHomeAddressUnitApartmentNumberSet"] = "FormHomeAddressUnitApartmentNumberSet";
2650
- StoreFormHomeAddressActionTypes["FormHomeAddressValidate"] = "FormHomeAddressValidate";
2651
- StoreFormHomeAddressActionTypes["FormHomeAddressValidateSet"] = "FormHomeAddressValidateSet";
2652
- StoreFormHomeAddressActionTypes["FormHomeAddressClear"] = "FormHomeAddressClear";
2653
- })(exports.StoreFormHomeAddressActionTypes || (exports.StoreFormHomeAddressActionTypes = {}));
2909
+ exports.StoreFormHomeQuoteActionTypes = void 0;
2910
+ (function (StoreFormHomeQuoteActionTypes) {
2911
+ StoreFormHomeQuoteActionTypes["UpdateHomeQuoteResponse"] = "UpdateHomeQuoteResponse";
2912
+ StoreFormHomeQuoteActionTypes["FormHomeQuoteIsRequestedSet"] = "FormHomeQuoteIsRequestedSet";
2913
+ StoreFormHomeQuoteActionTypes["FormHomeQuoteRequestDateSet"] = "FormHomeQuoteRequestDateSet";
2914
+ StoreFormHomeQuoteActionTypes["FormHomeQuotesSet"] = "FormHomeQuotesSet";
2915
+ StoreFormHomeQuoteActionTypes["FormHomeQuoteGetLocal"] = "FormHomeQuoteGetLocal";
2916
+ StoreFormHomeQuoteActionTypes["FormHomeQuoteClear"] = "FormHomeQuoteClear";
2917
+ StoreFormHomeQuoteActionTypes["UpdateHomeCallMessage"] = "UpdateHomeCallMessage";
2918
+ })(exports.StoreFormHomeQuoteActionTypes || (exports.StoreFormHomeQuoteActionTypes = {}));
2654
2919
 
2655
- const localStateName = 'home_address';
2656
- const getLocalAddresss = (localIndex = '') => {
2657
- const localAddress = localStorage.getItem(`${localIndex}_${localStateName}`) ? JSON.parse(localStorage.getItem(`${localIndex}_${localStateName}`) || '') : null;
2658
- return localAddress || { ...formHomeAddressStateInitialState };
2920
+ const setQuoteStateProperty$1 = (state, name, value) => {
2921
+ const newState = mychoiceSdkComponents.deepClone(state);
2922
+ newState[name] = value;
2923
+ return newState;
2659
2924
  };
2660
- const setLocalAddresss = (localIndex, state) => {
2661
- localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName}`, JSON.stringify(state));
2925
+
2926
+ const localStateName$4 = 'home_quotes';
2927
+ const setLocalQuotes$1 = (localIndex, state) => {
2928
+ localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$4}`, JSON.stringify(state));
2662
2929
  return state;
2663
2930
  };
2931
+ const getLocalQuotes$1 = (localIndex = '') => {
2932
+ const localQuotes = localStorage.getItem(`${localIndex}_${localStateName$4}`) ? JSON.parse(localStorage.getItem(`${localIndex}_${localStateName$4}`) || '') : null;
2933
+ return localQuotes || { ...formHomeQuoteInitialState };
2934
+ };
2664
2935
 
2665
- const formHomeAddressStateReducer = (state = { ...formHomeAddressStateInitialState }, action) => {
2936
+ const formHomeQuoteStateReducer = (state = { ...formHomeQuoteInitialState }, action) => {
2666
2937
  switch (action.type) {
2667
- case exports.StoreFormHomeAddressActionTypes.FormHomeAddressValidate:
2668
- return setLocalAddresss(action.localIndex, setStateProperty(state, 'inValidation', action.payload.inValidation));
2669
- case exports.StoreFormHomeAddressActionTypes.FormHomeAddressValidateSet:
2670
- return setLocalAddresss(action.localIndex, setStateProperty(state, 'isValid', action.payload.isValid));
2671
- case exports.StoreFormHomeAddressActionTypes.FormHomeAddressGetLocal:
2938
+ case exports.StoreFormHomeQuoteActionTypes.FormHomeQuoteIsRequestedSet:
2939
+ return setLocalQuotes$1(action.localIndex, setQuoteStateProperty$1(state, 'isRequested', action.payload.isRequested));
2940
+ case exports.StoreFormHomeQuoteActionTypes.FormHomeQuotesSet:
2941
+ return setLocalQuotes$1(action.localIndex, setQuoteStateProperty$1(state, 'items', action.payload.items));
2942
+ case exports.StoreFormHomeQuoteActionTypes.FormHomeQuoteRequestDateSet:
2943
+ return setLocalQuotes$1(action.localIndex, setQuoteStateProperty$1(state, 'requestDate', action.payload.requestDate));
2944
+ case exports.StoreFormHomeQuoteActionTypes.FormHomeQuoteGetLocal:
2672
2945
  return {
2673
- ...getLocalAddresss(action.localIndex),
2946
+ ...getLocalQuotes$1(action.localIndex),
2674
2947
  };
2675
- case exports.StoreFormHomeAddressActionTypes.FormHomeAddressTypeSelect:
2676
- return setLocalAddresss(action.localIndex, setStateProperty(state, 'type', action.payload.type));
2677
- case exports.StoreFormHomeAddressActionTypes.FormHomeAddressStreetSet:
2678
- return setLocalAddresss(action.localIndex, setStateProperty(state, 'addressStreet', action.payload.addressStreet));
2679
- case exports.StoreFormHomeAddressActionTypes.FormHomeAddressUnitApartmentNumberSet:
2680
- return setLocalAddresss(action.localIndex, setStateProperty(state, 'unitApartmentNumber', action.payload.unitApartmentNumber));
2681
- case exports.StoreFormHomeAddressActionTypes.FormHomeAddressClear:
2682
- return setLocalAddresss(action.localIndex, { ...formHomeAddressStateInitialState });
2948
+ case exports.StoreFormHomeQuoteActionTypes.FormHomeQuoteClear:
2949
+ return setLocalQuotes$1(action.localIndex, { ...formHomeQuoteInitialState });
2950
+ case exports.StoreFormHomeQuoteActionTypes.UpdateHomeCallMessage:
2951
+ return setLocalQuotes$1(action.localIndex, setQuoteStateProperty$1(state, 'showCallMessage', action.payload.showCallMessage));
2683
2952
  default:
2684
2953
  return state;
2685
2954
  }
@@ -2687,48 +2956,301 @@ const formHomeAddressStateReducer = (state = { ...formHomeAddressStateInitialSta
2687
2956
 
2688
2957
  const formHomeReducer = redux.combineReducers({
2689
2958
  postalState: formHomePostalStateReducer,
2690
- addressState: formHomeAddressStateReducer,
2691
2959
  applicantState: formHomeApplicantStateReducer,
2692
2960
  dwellingState: formHomeDwellingStateReducer,
2693
2961
  discountState: formHomeDiscountStateReducer,
2694
- // quoteState: formHomeQuoteStateReducer,
2962
+ quoteState: formHomeQuoteStateReducer,
2695
2963
  });
2696
2964
 
2697
- const reducers = redux.combineReducers({
2698
- globalState: globalStateReducer,
2699
- configState: configStateReducer,
2700
- formCarState: formCarReducer,
2701
- formHomeState: formHomeReducer,
2702
- });
2965
+ const formLifeCoverageStateInitialState = {
2966
+ province: '',
2967
+ type: '',
2968
+ coverage: '',
2969
+ inValidation: false,
2970
+ isValid: false,
2971
+ };
2703
2972
 
2704
- const store = redux.createStore(reducers, extension.composeWithDevTools(redux.applyMiddleware(thunk__default["default"])));
2973
+ exports.StoreFormLifeCoverageActionTypes = void 0;
2974
+ (function (StoreFormLifeCoverageActionTypes) {
2975
+ StoreFormLifeCoverageActionTypes["FormLifeCoverageGetLocal"] = "FormLifeCoverageGetLocal";
2976
+ StoreFormLifeCoverageActionTypes["FormLifeProvinceSelect"] = "FormLifeProvinceSelect";
2977
+ StoreFormLifeCoverageActionTypes["FormLifeCoverageTypeSelect"] = "FormLifeCoverageTypeSelect";
2978
+ StoreFormLifeCoverageActionTypes["FormLifeCoverageSelect"] = "FormLifeCoverageSelect";
2979
+ StoreFormLifeCoverageActionTypes["FormLifeCoverageValidate"] = "FormLifeCoverageValidate";
2980
+ StoreFormLifeCoverageActionTypes["FormLifeCoverageValidateSet"] = "FormLifeCoverageValidateSet";
2981
+ StoreFormLifeCoverageActionTypes["FormLifeCoverageClear"] = "FormLifeCoverageClear";
2982
+ })(exports.StoreFormLifeCoverageActionTypes || (exports.StoreFormLifeCoverageActionTypes = {}));
2705
2983
 
2706
- const StoreProvider = ({ children }) => (jsxRuntime.jsx(reactRedux.Provider, { store: store, children: children
2707
- && children }));
2984
+ const localStateName$3 = 'life_coverage';
2985
+ const getLocalCoverages = (localIndex = '') => {
2986
+ const localCoverage = localStorage.getItem(`${localIndex}_${localStateName$3}`) ? JSON.parse(localStorage.getItem(`${localIndex}_${localStateName$3}`) || '') : null;
2987
+ return localCoverage || { ...formLifeCoverageStateInitialState };
2988
+ };
2989
+ const setLocalCoverages = (localIndex, state) => {
2990
+ localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$3}`, JSON.stringify(state));
2991
+ return state;
2992
+ };
2708
2993
 
2709
- const useTypedSelector = reactRedux.useSelector;
2994
+ const formLifeCoverageStateReducer = (state = { ...formLifeCoverageStateInitialState }, action) => {
2995
+ switch (action.type) {
2996
+ case exports.StoreFormLifeCoverageActionTypes.FormLifeCoverageValidate:
2997
+ return setLocalCoverages(action.localIndex, setStateProperty(state, 'inValidation', action.payload.inValidation));
2998
+ case exports.StoreFormLifeCoverageActionTypes.FormLifeCoverageValidateSet:
2999
+ return setLocalCoverages(action.localIndex, setStateProperty(state, 'isValid', action.payload.isValid));
3000
+ case exports.StoreFormLifeCoverageActionTypes.FormLifeCoverageGetLocal:
3001
+ return {
3002
+ ...getLocalCoverages(action.localIndex),
3003
+ };
3004
+ case exports.StoreFormLifeCoverageActionTypes.FormLifeProvinceSelect:
3005
+ return setLocalCoverages(action.localIndex, setStateProperty(state, 'province', action.payload.province));
3006
+ case exports.StoreFormLifeCoverageActionTypes.FormLifeCoverageTypeSelect:
3007
+ return setLocalCoverages(action.localIndex, setStateProperty(state, 'type', action.payload.type));
3008
+ case exports.StoreFormLifeCoverageActionTypes.FormLifeCoverageSelect:
3009
+ return setLocalCoverages(action.localIndex, setStateProperty(state, 'coverage', action.payload.coverage));
3010
+ case exports.StoreFormLifeCoverageActionTypes.FormLifeCoverageClear:
3011
+ return setLocalCoverages(action.localIndex, { ...formLifeCoverageStateInitialState });
3012
+ default:
3013
+ return state;
3014
+ }
3015
+ };
2710
3016
 
2711
- const useStoreAppConfig = () => {
2712
- const { appConfigState } = useTypedSelector((state) => state).configState;
2713
- const dispatch = reactRedux.useDispatch();
2714
- return {
2715
- appConfigState,
2716
- dispatchAppConfigState: dispatch,
2717
- };
3017
+ const lifeFormApplicantInitialState = {
3018
+ birthYear: '',
3019
+ birthMonth: '',
3020
+ birthDay: '',
3021
+ gender: mychoiceSdkComponents.GenderTypes.Male,
3022
+ smoker: false,
3023
+ emailTo: {
3024
+ email: '',
3025
+ emailStatus: mychoiceSdkComponents.ValidationStatusTypes.Initial,
3026
+ },
3027
+ quoterInfo: {
3028
+ firstName: '',
3029
+ lastName: '',
3030
+ phone: '',
3031
+ recalculate: false,
3032
+ utmCampaign: '',
3033
+ utmSource: '',
3034
+ },
3035
+ inValidation: false,
3036
+ isValid: false,
2718
3037
  };
2719
3038
 
2720
- const useStoreClient = () => {
2721
- const { appConfigState } = useStoreAppConfig();
2722
- const { clientState } = useTypedSelector((state) => state).globalState;
2723
- const dispatch = reactRedux.useDispatch();
2724
- const dispatchClientState = react.useMemo(() => (props) => {
2725
- dispatch({
2726
- ...props,
2727
- payload: props.payload,
2728
- index: appConfigState.localIndex,
2729
- });
2730
- }, [appConfigState.localIndex]);
2731
- return {
3039
+ const localStateName$2 = 'life_applicants';
3040
+ const getLocalApplicant = (localIndex = '') => {
3041
+ const localApplicants = localStorage.getItem(`${localIndex}_${localStateName$2}`) ? JSON.parse(localStorage.getItem(`${localIndex}_${localStateName$2}`) || '') : null;
3042
+ return localApplicants || { ...lifeFormApplicantInitialState };
3043
+ };
3044
+ const setLocalApplicant = (localIndex, state) => {
3045
+ localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$2}`, JSON.stringify(state));
3046
+ return state;
3047
+ };
3048
+
3049
+ exports.StoreFormLifeApplicantActionTypes = void 0;
3050
+ (function (StoreFormLifeApplicantActionTypes) {
3051
+ StoreFormLifeApplicantActionTypes["FormLifeApplicantGetLocal"] = "FormLifeApplicantGetLocal";
3052
+ StoreFormLifeApplicantActionTypes["FormLifeApplicantValidate"] = "FormLifeApplicantValidate";
3053
+ StoreFormLifeApplicantActionTypes["FormLifeApplicantValidateSet"] = "FormLifeApplicantValidateSet";
3054
+ StoreFormLifeApplicantActionTypes["FormLifeApplicantClear"] = "FormLifeApplicantClear";
3055
+ StoreFormLifeApplicantActionTypes["FormLifeApplicantGenderSelect"] = "FormLifeApplicantGenderSelect";
3056
+ StoreFormLifeApplicantActionTypes["FormLifeApplicantBirthYearSelect"] = "FormLifeApplicantBirthYearSelect";
3057
+ StoreFormLifeApplicantActionTypes["FormLifeApplicantBirthMonthSelect"] = "FormLifeApplicantBirthMonthSelect";
3058
+ StoreFormLifeApplicantActionTypes["FormLifeApplicantBirthDaySelect"] = "FormLifeApplicantBirthDaySelect";
3059
+ StoreFormLifeApplicantActionTypes["FormLifeApplicantSmokerSelect"] = "FormLifeApplicantSmokerSelect";
3060
+ StoreFormLifeApplicantActionTypes["FormLifeApplicantEmailSet"] = "FormLifeApplicantEmailSet";
3061
+ StoreFormLifeApplicantActionTypes["FormLifeApplicantEmailStatusSet"] = "FormLifeApplicantEmailStatusSet";
3062
+ // Quoter info
3063
+ StoreFormLifeApplicantActionTypes["FormLifeQuoterFirstNameSet"] = "FormLifeQuoterFirstNameSet";
3064
+ StoreFormLifeApplicantActionTypes["FormLifeQuoterLastNameSet"] = "FormLifeQuoterLastNameSet";
3065
+ StoreFormLifeApplicantActionTypes["FormLifeQuoterPhoneSet"] = "FormLifeQuoterPhoneSet";
3066
+ StoreFormLifeApplicantActionTypes["FormLifeUtmCampaignSet"] = "FormLifeUtmCampaignSet";
3067
+ StoreFormLifeApplicantActionTypes["FormLifeUtmSourceSet"] = "FormLifeUtmSourceSet";
3068
+ })(exports.StoreFormLifeApplicantActionTypes || (exports.StoreFormLifeApplicantActionTypes = {}));
3069
+
3070
+ const formLifeApplicantStateReducer = (state = { ...lifeFormApplicantInitialState }, action) => {
3071
+ switch (action.type) {
3072
+ case exports.StoreFormLifeApplicantActionTypes.FormLifeApplicantValidate:
3073
+ return setLocalApplicant(action.localIndex, setStateProperty(state, 'inValidation', action.payload.inValidation));
3074
+ case exports.StoreFormLifeApplicantActionTypes.FormLifeApplicantValidateSet:
3075
+ return setLocalApplicant(action.localIndex, setStateProperty(state, 'isValid', action.payload.isValid));
3076
+ case exports.StoreFormLifeApplicantActionTypes.FormLifeApplicantGetLocal:
3077
+ return {
3078
+ ...getLocalApplicant(action?.localIndex),
3079
+ };
3080
+ case exports.StoreFormLifeApplicantActionTypes.FormLifeApplicantClear:
3081
+ return setLocalApplicant(action.localIndex, { ...lifeFormApplicantInitialState });
3082
+ case exports.StoreFormLifeApplicantActionTypes.FormLifeApplicantGenderSelect:
3083
+ return setLocalApplicant(action?.localIndex, setStateProperty(state, 'gender', action.payload.gender));
3084
+ case exports.StoreFormLifeApplicantActionTypes.FormLifeApplicantBirthYearSelect:
3085
+ return setLocalApplicant(action?.localIndex, setStateProperty(state, 'birthYear', action.payload.birthYear));
3086
+ case exports.StoreFormLifeApplicantActionTypes.FormLifeApplicantBirthMonthSelect:
3087
+ return setLocalApplicant(action?.localIndex, setStateProperty(state, 'birthMonth', action.payload.birthMonth));
3088
+ case exports.StoreFormLifeApplicantActionTypes.FormLifeApplicantBirthDaySelect:
3089
+ return setLocalApplicant(action?.localIndex, setStateProperty(state, 'birthDay', action.payload.birthDay));
3090
+ case exports.StoreFormLifeApplicantActionTypes.FormLifeApplicantSmokerSelect:
3091
+ return setLocalApplicant(action?.localIndex, setStateProperty(state, 'nonsmoker', action.payload.smoker));
3092
+ case exports.StoreFormLifeApplicantActionTypes.FormLifeApplicantEmailSet:
3093
+ return setLocalApplicant(action.localIndex, setStateProperty(state, 'emailTo', action.payload));
3094
+ // quoter info
3095
+ case exports.StoreFormLifeApplicantActionTypes.FormLifeQuoterFirstNameSet:
3096
+ return setLocalApplicant(action?.localIndex, setStateProperty(state, 'firstName', action.payload.firstName, 'quoterInfo'));
3097
+ case exports.StoreFormLifeApplicantActionTypes.FormLifeQuoterLastNameSet:
3098
+ return setLocalApplicant(action?.localIndex, setStateProperty(state, 'lastName', action.payload.lastName, 'quoterInfo'));
3099
+ case exports.StoreFormLifeApplicantActionTypes.FormLifeQuoterPhoneSet:
3100
+ return setLocalApplicant(action?.localIndex, setStateProperty(state, 'phone', action.payload.phone, 'quoterInfo'));
3101
+ case exports.StoreFormLifeApplicantActionTypes.FormLifeUtmSourceSet:
3102
+ return setLocalApplicant(action?.localIndex, setStateProperty(state, 'utmSource', action.payload.utmSource, 'quoterInfo'));
3103
+ case exports.StoreFormLifeApplicantActionTypes.FormLifeUtmCampaignSet:
3104
+ return setLocalApplicant(action?.localIndex, setStateProperty(state, 'utmCampaign', action.payload.utmCampaign, 'quoterInfo'));
3105
+ default:
3106
+ return state;
3107
+ }
3108
+ };
3109
+
3110
+ const formLifeQuoteInitialState = {
3111
+ items: [],
3112
+ isRequested: false,
3113
+ requestDate: new Date().toISOString(),
3114
+ showCallMessage: false,
3115
+ };
3116
+
3117
+ exports.StoreFormLifeQuoteActionTypes = void 0;
3118
+ (function (StoreFormLifeQuoteActionTypes) {
3119
+ StoreFormLifeQuoteActionTypes["UpdateLifeQuoteResponse"] = "UpdateLifeQuoteResponse";
3120
+ StoreFormLifeQuoteActionTypes["FormLifeQuoteIsRequestedSet"] = "FormLifeQuoteIsRequestedSet";
3121
+ StoreFormLifeQuoteActionTypes["FormLifeQuoteRequestDateSet"] = "FormLifeQuoteRequestDateSet";
3122
+ StoreFormLifeQuoteActionTypes["FormLifeQuotesSet"] = "FormLifeQuotesSet";
3123
+ StoreFormLifeQuoteActionTypes["FormLifeQuoteGetLocal"] = "FormLifeQuoteGetLocal";
3124
+ StoreFormLifeQuoteActionTypes["FormLifeQuoteClear"] = "FormLifeQuoteClear";
3125
+ StoreFormLifeQuoteActionTypes["UpdateLifeCallMessage"] = "UpdateLifeCallMessage";
3126
+ })(exports.StoreFormLifeQuoteActionTypes || (exports.StoreFormLifeQuoteActionTypes = {}));
3127
+
3128
+ const setQuoteStateProperty = (state, name, value) => {
3129
+ const newState = mychoiceSdkComponents.deepClone(state);
3130
+ newState[name] = value;
3131
+ return newState;
3132
+ };
3133
+
3134
+ const localStateName$1 = 'life_quotes';
3135
+ const setLocalQuotes = (localIndex, state) => {
3136
+ localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName$1}`, JSON.stringify(state));
3137
+ return state;
3138
+ };
3139
+ const getLocalQuotes = (localIndex = '') => {
3140
+ const localQuotes = localStorage.getItem(`${localIndex}_${localStateName$1}`) ? JSON.parse(localStorage.getItem(`${localIndex}_${localStateName$1}`) || '') : null;
3141
+ return localQuotes || { ...formLifeQuoteInitialState };
3142
+ };
3143
+
3144
+ const formLifeQuoteStateReducer = (state = { ...formLifeQuoteInitialState }, action) => {
3145
+ switch (action.type) {
3146
+ case exports.StoreFormLifeQuoteActionTypes.FormLifeQuoteIsRequestedSet:
3147
+ return setLocalQuotes(action.localIndex, setQuoteStateProperty(state, 'isRequested', action.payload.isRequested));
3148
+ case exports.StoreFormLifeQuoteActionTypes.FormLifeQuotesSet:
3149
+ return setLocalQuotes(action.localIndex, setQuoteStateProperty(state, 'items', action.payload.items));
3150
+ case exports.StoreFormLifeQuoteActionTypes.FormLifeQuoteRequestDateSet:
3151
+ return setLocalQuotes(action.localIndex, setQuoteStateProperty(state, 'requestDate', action.payload.requestDate));
3152
+ case exports.StoreFormLifeQuoteActionTypes.FormLifeQuoteGetLocal:
3153
+ return {
3154
+ ...getLocalQuotes(action.localIndex),
3155
+ };
3156
+ case exports.StoreFormLifeQuoteActionTypes.FormLifeQuoteClear:
3157
+ return setLocalQuotes(action.localIndex, { ...formLifeQuoteInitialState });
3158
+ case exports.StoreFormLifeQuoteActionTypes.UpdateLifeCallMessage:
3159
+ return setLocalQuotes(action.localIndex, setQuoteStateProperty(state, 'showCallMessage', action.payload.showCallMessage));
3160
+ default:
3161
+ return state;
3162
+ }
3163
+ };
3164
+
3165
+ const formLifePostalInitialState = {
3166
+ isReady: false,
3167
+ item: {
3168
+ ...postalItemInitialState,
3169
+ },
3170
+ };
3171
+
3172
+ exports.StoreFormLifePostalActionTypes = void 0;
3173
+ (function (StoreFormLifePostalActionTypes) {
3174
+ StoreFormLifePostalActionTypes["FormLifePostalSet"] = "FormLifePostalSet";
3175
+ StoreFormLifePostalActionTypes["FormLifePostalClear"] = "FormLifePostalClear";
3176
+ StoreFormLifePostalActionTypes["FormLifePostalGetLocal"] = "FormLifePostalGetLocal";
3177
+ })(exports.StoreFormLifePostalActionTypes || (exports.StoreFormLifePostalActionTypes = {}));
3178
+
3179
+ const setPostalStateProperty = (state, name, value) => {
3180
+ const newState = mychoiceSdkComponents.deepClone(state);
3181
+ newState.isReady = true;
3182
+ newState[name] = value;
3183
+ return newState;
3184
+ };
3185
+
3186
+ const localStateName = 'life_postal';
3187
+ const setLocalPostal = (localIndex, state) => {
3188
+ localStorage.setItem(`${localIndex || mychoiceSdkComponents.defaultLocalIndex}_${localStateName}`, JSON.stringify(state));
3189
+ return state;
3190
+ };
3191
+ const getLocalPostal = (localIndex = '') => {
3192
+ const localPostal = localStorage.getItem(`${localIndex}_${localStateName}`) ? JSON.parse(localStorage.getItem(`${localIndex}_${localStateName}`) || '') : null;
3193
+ return localPostal || { ...formLifePostalInitialState };
3194
+ };
3195
+
3196
+ const formLifePostalStateReducer = (state = { ...formLifePostalInitialState }, action) => {
3197
+ switch (action.type) {
3198
+ case exports.StoreFormLifePostalActionTypes.FormLifePostalSet:
3199
+ return setLocalPostal(action.localIndex, setPostalStateProperty(state, 'item', action.payload));
3200
+ case exports.StoreFormLifePostalActionTypes.FormLifePostalGetLocal:
3201
+ return {
3202
+ ...getLocalPostal(action.localIndex),
3203
+ };
3204
+ case exports.StoreFormLifePostalActionTypes.FormLifePostalClear:
3205
+ return setLocalPostal(action.localIndex, { ...formLifePostalInitialState });
3206
+ default:
3207
+ return state;
3208
+ }
3209
+ };
3210
+
3211
+ const formLifeReducer = redux.combineReducers({
3212
+ postalState: formLifePostalStateReducer,
3213
+ coverageState: formLifeCoverageStateReducer,
3214
+ applicantState: formLifeApplicantStateReducer,
3215
+ quoteState: formLifeQuoteStateReducer,
3216
+ });
3217
+
3218
+ const reducers = redux.combineReducers({
3219
+ globalState: globalStateReducer,
3220
+ configState: configStateReducer,
3221
+ formCarState: formCarReducer,
3222
+ formHomeState: formHomeReducer,
3223
+ formLifeState: formLifeReducer,
3224
+ });
3225
+
3226
+ const store = redux.createStore(reducers, extension.composeWithDevTools(redux.applyMiddleware(thunk__default["default"])));
3227
+
3228
+ const StoreProvider = ({ children }) => (jsxRuntime.jsx(reactRedux.Provider, { store: store, children: children
3229
+ && children }));
3230
+
3231
+ const useTypedSelector = reactRedux.useSelector;
3232
+
3233
+ const useStoreAppConfig = () => {
3234
+ const { appConfigState } = useTypedSelector((state) => state).configState;
3235
+ const dispatch = reactRedux.useDispatch();
3236
+ return {
3237
+ appConfigState,
3238
+ dispatchAppConfigState: dispatch,
3239
+ };
3240
+ };
3241
+
3242
+ const useStoreClient = () => {
3243
+ const { appConfigState } = useStoreAppConfig();
3244
+ const { clientState } = useTypedSelector((state) => state).globalState;
3245
+ const dispatch = reactRedux.useDispatch();
3246
+ const dispatchClientState = react.useMemo(() => (props) => {
3247
+ dispatch({
3248
+ ...props,
3249
+ payload: props.payload,
3250
+ index: appConfigState.localIndex,
3251
+ });
3252
+ }, [appConfigState.localIndex]);
3253
+ return {
2732
3254
  clientState,
2733
3255
  dispatchClientState,
2734
3256
  };
@@ -3076,7 +3598,9 @@ const useStoreFormCarDiscount = () => {
3076
3598
  const dispatch = reactRedux.useDispatch();
3077
3599
  const { quoteState: { isRequested }, dispatchQuoteState } = useStoreFormCarQuote();
3078
3600
  const dispatchDiscountState = react.useMemo(() => (props) => {
3079
- if (isRequested) {
3601
+ if (isRequested
3602
+ && props.type !== exports.StoreFormCarDiscountActionTypes.FormCarDiscountValidate
3603
+ && props.type !== exports.StoreFormCarDiscountActionTypes.FormCarDiscountValidateSet) {
3080
3604
  dispatchQuoteState({
3081
3605
  type: exports.StoreFormCarQuoteActionTypes.FormCarQuoteIsRequestedSet,
3082
3606
  payload: { isRequested: false },
@@ -3133,12 +3657,22 @@ const useStoreFormCarConfig = () => {
3133
3657
  dispatchConfigState,
3134
3658
  };
3135
3659
  };
3660
+ const useProvince = () => {
3661
+ const { configState: { code } } = useStoreFormCarConfig();
3662
+ return {
3663
+ isAlbertaProvince: code === AlbertaCode,
3664
+ isNewBrunswickProvince: code === NewBrunswickCode,
3665
+ isNovaScotiaProvince: code === NovaScotiaCode,
3666
+ isNewfoundlandProvince: code === NewfoundlandCode,
3667
+ isOntarioProvince: code === OntarioCode,
3668
+ };
3669
+ };
3136
3670
 
3137
- const useStoreFormHomePostal = () => {
3671
+ const useStoreFormHomeQuote = () => {
3138
3672
  const { appConfigState } = useStoreAppConfig();
3139
- const { postalState } = useTypedSelector((state) => state).formHomeState;
3673
+ const { quoteState } = useTypedSelector((state) => state).formHomeState;
3140
3674
  const dispatch = reactRedux.useDispatch();
3141
- const dispatchPostalState = react.useMemo(() => (props) => {
3675
+ const dispatchQuoteState = react.useMemo(() => (props) => {
3142
3676
  dispatch({
3143
3677
  ...props,
3144
3678
  payload: {
@@ -3148,53 +3682,50 @@ const useStoreFormHomePostal = () => {
3148
3682
  });
3149
3683
  }, [appConfigState.localIndex]);
3150
3684
  return {
3151
- postalState,
3152
- dispatchPostalState,
3685
+ quoteState,
3686
+ dispatchQuoteState,
3153
3687
  };
3154
3688
  };
3155
3689
 
3156
- // import { useStoreFormHomeQuote } from '../QuoteState/hoox';
3157
- // import { StoreFormHomeQuoteActionTypes } from '../QuoteState/actions';
3158
- const useStoreFormHomeAddress = () => {
3690
+ const useStoreFormHomePostal = () => {
3159
3691
  const { appConfigState } = useStoreAppConfig();
3160
- const { addressState } = useTypedSelector((state) => state).formHomeState;
3692
+ const { postalState } = useTypedSelector((state) => state).formHomeState;
3161
3693
  const dispatch = reactRedux.useDispatch();
3162
- // const { quoteState: { isRequested }, dispatchQuoteState } = useStoreFormHomeQuote();
3163
- const dispatchAddressState = (props) => {
3164
- // if (isRequested) {
3165
- // dispatchQuoteState({
3166
- // type: StoreFormHomeQuoteActionTypes.FormHomeQuoteIsRequestedSet,
3167
- // payload: { isRequested: false },
3168
- // });
3169
- // }
3694
+ const { quoteState, dispatchQuoteState } = useStoreFormHomeQuote();
3695
+ const dispatchPostalState = react.useMemo(() => (props) => {
3696
+ if (quoteState.isRequested) {
3697
+ dispatchQuoteState({
3698
+ type: exports.StoreFormHomeQuoteActionTypes.FormHomeQuoteIsRequestedSet,
3699
+ payload: { isRequested: false },
3700
+ });
3701
+ }
3170
3702
  dispatch({
3171
3703
  ...props,
3172
3704
  payload: {
3705
+ isValid: false,
3173
3706
  ...props.payload,
3174
3707
  },
3175
3708
  localIndex: appConfigState.localIndex,
3176
3709
  });
3177
- };
3710
+ }, [appConfigState.localIndex]);
3178
3711
  return {
3179
- addressState,
3180
- dispatchAddressState,
3712
+ postalState,
3713
+ dispatchPostalState,
3181
3714
  };
3182
3715
  };
3183
3716
 
3184
- // import { useStoreFormHomeQuote } from '../../QuoteState/hoox';
3185
- // import { StoreFormHomeQuoteActionTypes } from '../../QuoteState/actions';
3186
3717
  const useStoreFormHomeApplicantInsurance = () => {
3187
3718
  const { appConfigState } = useStoreAppConfig();
3188
3719
  const { applicantState } = useTypedSelector((state) => state).formHomeState;
3189
3720
  const dispatch = reactRedux.useDispatch();
3190
- // const { quoteState: { isRequested }, dispatchQuoteState } = useStoreFormHomeQuote();
3721
+ const { quoteState: { isRequested }, dispatchQuoteState } = useStoreFormHomeQuote();
3191
3722
  const dispatchApplicantInsuranceState = react.useMemo(() => (props) => {
3192
- // if (isRequested) {
3193
- // dispatchQuoteState({
3194
- // type: StoreFormHomeQuoteActionTypes.FormHomeQuoteIsRequestedSet,
3195
- // payload: { isRequested: false },
3196
- // });
3197
- // }
3723
+ if (isRequested) {
3724
+ dispatchQuoteState({
3725
+ type: exports.StoreFormHomeQuoteActionTypes.FormHomeQuoteIsRequestedSet,
3726
+ payload: { isRequested: false },
3727
+ });
3728
+ }
3198
3729
  dispatch({
3199
3730
  ...props,
3200
3731
  payload: {
@@ -3202,27 +3733,25 @@ const useStoreFormHomeApplicantInsurance = () => {
3202
3733
  },
3203
3734
  localIndex: appConfigState.localIndex,
3204
3735
  });
3205
- }, [appConfigState.localIndex]);
3736
+ }, [isRequested, appConfigState.localIndex]);
3206
3737
  return {
3207
3738
  applicantState,
3208
3739
  dispatchApplicantInsuranceState,
3209
3740
  };
3210
3741
  };
3211
3742
 
3212
- // import { useStoreFormHomeQuote } from '../../QuoteState/hoox';
3213
- // import { StoreFormHomeQuoteActionTypes } from '../../QuoteState/actions';
3214
3743
  const useStoreFormHomeApplicantInfo = () => {
3215
3744
  const { appConfigState } = useStoreAppConfig();
3216
3745
  const { applicantState } = useTypedSelector((state) => state).formHomeState;
3217
3746
  const dispatch = reactRedux.useDispatch();
3218
- // const { quoteState: { isRequested }, dispatchQuoteState } = useStoreFormHomeQuote();
3747
+ const { quoteState: { isRequested }, dispatchQuoteState } = useStoreFormHomeQuote();
3219
3748
  const dispatchApplicantInfoState = react.useMemo(() => (props) => {
3220
- // if (isRequested) {
3221
- // dispatchQuoteState({
3222
- // type: StoreFormHomeQuoteActionTypes.FormHomeQuoteIsRequestedSet,
3223
- // payload: { isRequested: false },
3224
- // });
3225
- // }
3749
+ if (isRequested) {
3750
+ dispatchQuoteState({
3751
+ type: exports.StoreFormHomeQuoteActionTypes.FormHomeQuoteIsRequestedSet,
3752
+ payload: { isRequested: false },
3753
+ });
3754
+ }
3226
3755
  dispatch({
3227
3756
  ...props,
3228
3757
  payload: {
@@ -3230,27 +3759,25 @@ const useStoreFormHomeApplicantInfo = () => {
3230
3759
  },
3231
3760
  localIndex: appConfigState.localIndex,
3232
3761
  });
3233
- }, [appConfigState.localIndex]);
3762
+ }, [isRequested, appConfigState.localIndex]);
3234
3763
  return {
3235
3764
  applicantState,
3236
3765
  dispatchApplicantInfoState,
3237
3766
  };
3238
3767
  };
3239
3768
 
3240
- // import { useStoreFormHomeQuote } from '../../QuoteState/hoox';
3241
- // import { StoreFormHomeQuoteActionTypes } from '../../QuoteState/actions';
3242
3769
  const useStoreFormHomeApplicantCancellation = () => {
3243
3770
  const { appConfigState } = useStoreAppConfig();
3244
3771
  const { applicantState } = useTypedSelector((state) => state).formHomeState;
3245
3772
  const dispatch = reactRedux.useDispatch();
3246
- // const { quoteState: { isRequested }, dispatchQuoteState } = useStoreFormHomeQuote();
3773
+ const { quoteState: { isRequested }, dispatchQuoteState } = useStoreFormHomeQuote();
3247
3774
  const dispatchApplicantCancellationState = react.useMemo(() => (props) => {
3248
- // if (isRequested) {
3249
- // dispatchQuoteState({
3250
- // type: StoreFormHomeQuoteActionTypes.FormHomeQuoteIsRequestedSet,
3251
- // payload: { isRequested: false },
3252
- // });
3253
- // }
3775
+ if (isRequested) {
3776
+ dispatchQuoteState({
3777
+ type: exports.StoreFormHomeQuoteActionTypes.FormHomeQuoteIsRequestedSet,
3778
+ payload: { isRequested: false },
3779
+ });
3780
+ }
3254
3781
  dispatch({
3255
3782
  ...props,
3256
3783
  payload: {
@@ -3258,27 +3785,25 @@ const useStoreFormHomeApplicantCancellation = () => {
3258
3785
  },
3259
3786
  localIndex: appConfigState.localIndex,
3260
3787
  });
3261
- }, [appConfigState.localIndex]);
3788
+ }, [isRequested, appConfigState.localIndex]);
3262
3789
  return {
3263
3790
  applicantState,
3264
3791
  dispatchApplicantCancellationState,
3265
3792
  };
3266
3793
  };
3267
3794
 
3268
- // import { useStoreFormHomeQuote } from '../../QuoteState/hoox';
3269
- // import { StoreFormHomeQuoteActionTypes } from '../../QuoteState/actions';
3270
3795
  const useStoreFormHomeApplicantClaim = () => {
3271
3796
  const { appConfigState } = useStoreAppConfig();
3272
3797
  const { applicantState } = useTypedSelector((state) => state).formHomeState;
3273
3798
  const dispatch = reactRedux.useDispatch();
3274
- // const { quoteState: { isRequested }, dispatchQuoteState } = useStoreFormHomeQuote();
3799
+ const { quoteState: { isRequested }, dispatchQuoteState } = useStoreFormHomeQuote();
3275
3800
  const dispatchApplicantClaimState = react.useMemo(() => (props) => {
3276
- // if (isRequested) {
3277
- // dispatchQuoteState({
3278
- // type: StoreFormHomeQuoteActionTypes.FormHomeQuoteIsRequestedSet,
3279
- // payload: { isRequested: false },
3280
- // });
3281
- // }
3801
+ if (isRequested) {
3802
+ dispatchQuoteState({
3803
+ type: exports.StoreFormHomeQuoteActionTypes.FormHomeQuoteIsRequestedSet,
3804
+ payload: { isRequested: false },
3805
+ });
3806
+ }
3282
3807
  dispatch({
3283
3808
  ...props,
3284
3809
  payload: {
@@ -3286,28 +3811,25 @@ const useStoreFormHomeApplicantClaim = () => {
3286
3811
  },
3287
3812
  localIndex: appConfigState.localIndex,
3288
3813
  });
3289
- }, [appConfigState.localIndex]);
3814
+ }, [isRequested, appConfigState.localIndex]);
3290
3815
  return {
3291
3816
  applicantState,
3292
3817
  dispatchApplicantClaimState,
3293
3818
  };
3294
3819
  };
3295
3820
 
3296
- // import { StoreFormHomeQuoteActionTypes } from '../../QuoteState/actions';
3297
- // import { useStoreFormHomeQuote } from '../../QuoteState/hoox';
3298
- // import { StoreFormHomeApplicantBaseActionTypes } from './actions';
3299
3821
  const useStoreFormHomeApplicantBase = () => {
3300
3822
  const { appConfigState } = useStoreAppConfig();
3301
3823
  const { applicantState } = useTypedSelector((state) => state).formHomeState;
3302
3824
  const dispatch = reactRedux.useDispatch();
3303
- // const { quoteState: { isRequested }, dispatchQuoteState } = useStoreFormHomeQuote();
3825
+ const { quoteState: { isRequested }, dispatchQuoteState } = useStoreFormHomeQuote();
3304
3826
  const dispatchApplicantBaseState = react.useMemo(() => (props) => {
3305
- // if (isRequested && (props.type !== StoreFormHomeApplicantBaseActionTypes.FormHomeApplicantSelect)) {
3306
- // dispatchQuoteState({
3307
- // type: StoreFormHomeQuoteActionTypes.FormHomeQuoteIsRequestedSet,
3308
- // payload: { isRequested: false },
3309
- // });
3310
- // }
3827
+ if (isRequested) {
3828
+ dispatchQuoteState({
3829
+ type: exports.StoreFormHomeQuoteActionTypes.FormHomeQuoteIsRequestedSet,
3830
+ payload: { isRequested: false },
3831
+ });
3832
+ }
3311
3833
  dispatch({
3312
3834
  ...props,
3313
3835
  payload: {
@@ -3315,28 +3837,25 @@ const useStoreFormHomeApplicantBase = () => {
3315
3837
  },
3316
3838
  localIndex: appConfigState.localIndex,
3317
3839
  });
3318
- }, [appConfigState.localIndex]);
3840
+ }, [isRequested, appConfigState.localIndex]);
3319
3841
  return {
3320
3842
  applicantState,
3321
3843
  dispatchApplicantBaseState,
3322
3844
  };
3323
3845
  };
3324
3846
 
3325
- // import { StoreFormHomeQuoteActionTypes } from '../QuoteState/actions';
3326
- // import { useStoreFormHomeQuote } from '../QuoteState/hoox';
3327
- // import { StoreFormHomeDwellingActionTypes } from './actions';
3328
3847
  const useStoreFormHomeDwelling = () => {
3329
3848
  const { appConfigState } = useStoreAppConfig();
3330
3849
  const { dwellingState } = useTypedSelector((state) => state).formHomeState;
3331
3850
  const dispatch = reactRedux.useDispatch();
3332
- // const { quoteState, dispatchQuoteState } = useStoreFormHomeQuote();
3851
+ const { quoteState: { isRequested }, dispatchQuoteState } = useStoreFormHomeQuote();
3333
3852
  const dispatchDwellingState = react.useMemo(() => (props) => {
3334
- // if (quoteState.isRequested && (props.type !== StoreFormHomeDwellingActionTypes.FormHomeDwellingSelect)) {
3335
- // dispatchQuoteState({
3336
- // type: StoreFormHomeQuoteActionTypes.FormHomeQuoteIsRequestedSet,
3337
- // payload: { isRequested: false },
3338
- // });
3339
- // }
3853
+ if (isRequested) {
3854
+ dispatchQuoteState({
3855
+ type: exports.StoreFormHomeQuoteActionTypes.FormHomeQuoteIsRequestedSet,
3856
+ payload: { isRequested: false },
3857
+ });
3858
+ }
3340
3859
  dispatch({
3341
3860
  ...props,
3342
3861
  payload: {
@@ -3345,27 +3864,27 @@ const useStoreFormHomeDwelling = () => {
3345
3864
  },
3346
3865
  localIndex: appConfigState.localIndex,
3347
3866
  });
3348
- }, []);
3867
+ }, [isRequested, appConfigState.localIndex]);
3349
3868
  return {
3350
3869
  dwellingState,
3351
3870
  dispatchDwellingState,
3352
3871
  };
3353
3872
  };
3354
3873
 
3355
- // import { useStoreFormHomeQuote } from '../QuoteState/hoox';
3356
- // import { StoreFormHomeQuoteActionTypes } from '../QuoteState/actions';
3357
3874
  const useStoreFormHomeDiscount = () => {
3358
3875
  const { appConfigState } = useStoreAppConfig();
3359
3876
  const { discountState } = useTypedSelector((state) => state).formHomeState;
3360
3877
  const dispatch = reactRedux.useDispatch();
3361
- // const { quoteState: { isRequested }, dispatchQuoteState } = useStoreFormHomeQuote();
3362
- const dispatchDiscountState = (props) => {
3363
- // if (isRequested) {
3364
- // dispatchQuoteState({
3365
- // type: StoreFormHomeQuoteActionTypes.FormHomeQuoteIsRequestedSet,
3366
- // payload: { isRequested: false },
3367
- // });
3368
- // }
3878
+ const { quoteState: { isRequested }, dispatchQuoteState } = useStoreFormHomeQuote();
3879
+ const dispatchDiscountState = react.useMemo(() => (props) => {
3880
+ if (isRequested
3881
+ && props.type !== exports.StoreFormHomeDiscountActionTypes.FormHomeDiscountValidate
3882
+ && props.type !== exports.StoreFormHomeDiscountActionTypes.FormHomeDiscountValidateSet) {
3883
+ dispatchQuoteState({
3884
+ type: exports.StoreFormHomeQuoteActionTypes.FormHomeQuoteIsRequestedSet,
3885
+ payload: { isRequested: false },
3886
+ });
3887
+ }
3369
3888
  dispatch({
3370
3889
  ...props,
3371
3890
  payload: {
@@ -3373,36 +3892,127 @@ const useStoreFormHomeDiscount = () => {
3373
3892
  },
3374
3893
  localIndex: appConfigState.localIndex,
3375
3894
  });
3376
- };
3895
+ }, [isRequested, appConfigState.localIndex]);
3377
3896
  return {
3378
3897
  discountState,
3379
3898
  dispatchDiscountState,
3380
3899
  };
3381
3900
  };
3382
3901
 
3383
- const useCancelToken = () => {
3384
- // const { dispatchAppLoaderState } = useStoreAppLoader();
3385
- const cancelToken = axios__default["default"].CancelToken.source();
3386
- mychoiceSdkComponents.useEffectOnce(() => () => {
3387
- // dispatchAppLoaderState({ type: StoreConfigAppLoaderActionTypes.AppLoaderClose });
3388
- cancelToken.cancel();
3389
- });
3902
+ const useStoreFormLifePostal = () => {
3903
+ const { appConfigState } = useStoreAppConfig();
3904
+ const { postalState } = useTypedSelector((state) => state).formLifeState;
3905
+ const dispatch = reactRedux.useDispatch();
3906
+ const dispatchPostalState = react.useMemo(() => (props) => {
3907
+ dispatch({
3908
+ ...props,
3909
+ payload: {
3910
+ ...props.payload,
3911
+ },
3912
+ localIndex: appConfigState.localIndex,
3913
+ });
3914
+ }, [appConfigState.localIndex]);
3390
3915
  return {
3391
- cancelToken: cancelToken.token,
3916
+ postalState,
3917
+ dispatchPostalState,
3392
3918
  };
3393
3919
  };
3394
3920
 
3395
- const initHttpResponse = () => {
3396
- axios__default["default"].interceptors.response.use((response) => {
3397
- if (response.data
3398
- && response.headers['content-type'] === 'application/json') {
3399
- response.data = humps.camelizeKeys(response.data);
3921
+ const useStoreFormLifeQuote = () => {
3922
+ const { appConfigState } = useStoreAppConfig();
3923
+ const { quoteState } = useTypedSelector((state) => state).formLifeState;
3924
+ const dispatch = reactRedux.useDispatch();
3925
+ const dispatchQuoteState = react.useMemo(() => (props) => {
3926
+ dispatch({
3927
+ ...props,
3928
+ payload: {
3929
+ ...props.payload,
3930
+ },
3931
+ localIndex: appConfigState.localIndex,
3932
+ });
3933
+ }, [appConfigState.localIndex]);
3934
+ return {
3935
+ quoteState,
3936
+ dispatchQuoteState,
3937
+ };
3938
+ };
3939
+
3940
+ const useStoreFormLifeCoverage = () => {
3941
+ const { appConfigState } = useStoreAppConfig();
3942
+ const { coverageState } = useTypedSelector((state) => state).formLifeState;
3943
+ const dispatch = reactRedux.useDispatch();
3944
+ const { quoteState: { isRequested }, dispatchQuoteState } = useStoreFormLifeQuote();
3945
+ const dispatchCoverageState = (props) => {
3946
+ if (isRequested) {
3947
+ dispatchQuoteState({
3948
+ type: exports.StoreFormLifeQuoteActionTypes.FormLifeQuoteIsRequestedSet,
3949
+ payload: { isRequested: false },
3950
+ });
3400
3951
  }
3401
- return response;
3402
- }, (error) => {
3403
- const originalRequest = error.config;
3404
- if (!error || !error?.response) {
3405
- return { message: 'cancel request' };
3952
+ dispatch({
3953
+ ...props,
3954
+ payload: {
3955
+ ...props.payload,
3956
+ },
3957
+ localIndex: appConfigState.localIndex,
3958
+ });
3959
+ };
3960
+ return {
3961
+ coverageState,
3962
+ dispatchCoverageState,
3963
+ };
3964
+ };
3965
+
3966
+ const useStoreFormLifeApplicant = () => {
3967
+ const { appConfigState } = useStoreAppConfig();
3968
+ const { applicantState } = useTypedSelector((state) => state).formLifeState;
3969
+ const dispatch = reactRedux.useDispatch();
3970
+ const { quoteState: { isRequested }, dispatchQuoteState } = useStoreFormLifeQuote();
3971
+ const dispatchApplicantState = react.useMemo(() => (props) => {
3972
+ if (isRequested) {
3973
+ dispatchQuoteState({
3974
+ type: exports.StoreFormLifeQuoteActionTypes.FormLifeQuoteIsRequestedSet,
3975
+ payload: { isRequested: false },
3976
+ });
3977
+ }
3978
+ dispatch({
3979
+ ...props,
3980
+ payload: {
3981
+ ...props.payload,
3982
+ },
3983
+ localIndex: appConfigState.localIndex,
3984
+ });
3985
+ }, [appConfigState.localIndex]);
3986
+ return {
3987
+ applicantState,
3988
+ dispatchApplicantState,
3989
+ };
3990
+ };
3991
+
3992
+ const useCancelToken = () => {
3993
+ // const { dispatchAppLoaderState } = useStoreAppLoader();
3994
+ const cancelToken = axios__default["default"].CancelToken.source();
3995
+ mychoiceSdkComponents.useEffectOnce(() => () => {
3996
+ // dispatchAppLoaderState({ type: StoreConfigAppLoaderActionTypes.AppLoaderClose });
3997
+ cancelToken.cancel();
3998
+ });
3999
+ return {
4000
+ cancelToken: cancelToken.token,
4001
+ };
4002
+ };
4003
+
4004
+ const initHttpResponse = () => {
4005
+ const type = mychoiceSdkComponents.getInsuranceType();
4006
+ axios__default["default"].interceptors.response.use((response) => {
4007
+ if (response.data
4008
+ && response.headers['content-type'] === 'application/json') {
4009
+ response.data = humps.camelizeKeys(response.data);
4010
+ }
4011
+ return response;
4012
+ }, (error) => {
4013
+ const originalRequest = error.config;
4014
+ if (!error || !error?.response) {
4015
+ return { message: 'cancel request' };
3406
4016
  }
3407
4017
  if (error?.response?.status === 404) {
3408
4018
  return { message: error.response.data.detail };
@@ -3445,7 +4055,7 @@ const initHttpResponse = () => {
3445
4055
  newConfig.params = humps.decamelizeKeys(config.params);
3446
4056
  }
3447
4057
  if (config.data) {
3448
- newConfig.data = humps.decamelizeKeys(config.data, { separator: '_' });
4058
+ newConfig.data = type !== mychoiceSdkComponents.InsuranceTypes.Life ? humps.decamelizeKeys(config.data, { separator: '_' }) : config.data;
3449
4059
  newConfig.paramsSerializer = () => JSON.stringify(humps.decamelizeKeys(config.params || {}));
3450
4060
  }
3451
4061
  return newConfig;
@@ -3597,27 +4207,69 @@ const addDayToDate = (value, days) => {
3597
4207
  const differenceInHoursFromNow = (date) => mychoiceSdkComponents.getDifferenceInHours('', date);
3598
4208
 
3599
4209
  const ClearFormDataHandler = () => {
4210
+ // car insurance states
4211
+ const { dispatchPostalState: dispatchCarPostalState } = useStoreFormCarPostal();
3600
4212
  const { dispatchVehicleState } = useStoreFormCarVehicle();
3601
4213
  const { dispatchDriverBaseState } = useStoreFormCarDriverBase();
3602
- const { dispatchDiscountState } = useStoreFormCarDiscount();
3603
- const { quoteState, dispatchQuoteState } = useStoreFormCarQuote();
3604
- const { dispatchPostalState } = useStoreFormCarPostal();
4214
+ const { dispatchDiscountState: dispatchCarDiscountState } = useStoreFormCarDiscount();
4215
+ const { quoteState: carQuoteState, dispatchQuoteState: dispatchCarQuoteState } = useStoreFormCarQuote();
4216
+ // home insurance states
4217
+ const { dispatchPostalState: dispatchHomePostalState } = useStoreFormHomePostal();
4218
+ const { dispatchApplicantBaseState } = useStoreFormHomeApplicantBase();
4219
+ const { dispatchDwellingState } = useStoreFormHomeDwelling();
4220
+ const { dispatchDiscountState: dispatchHomeDiscountState } = useStoreFormHomeDiscount();
4221
+ const { quoteState: homeQuoteState, dispatchQuoteState: dispatchHomeQuoteState } = useStoreFormHomeQuote();
4222
+ // life insurance states
4223
+ const { dispatchCoverageState } = useStoreFormLifeCoverage();
4224
+ const { dispatchApplicantState } = useStoreFormLifeApplicant();
4225
+ const { quoteState: lifeQuoteState, dispatchQuoteState: dispatchLifeQuoteState } = useStoreFormLifeQuote();
3605
4226
  const { dispatchAppModalState } = useStoreAppModal();
3606
- const { appConfigState } = useStoreAppConfig();
4227
+ const { appConfigState: { localIndex, insuranceType, appType } } = useStoreAppConfig();
3607
4228
  const navigate = reactRouterDom.useNavigate();
3608
- const inactiveHours = differenceInHoursFromNow(quoteState.requestDate);
4229
+ const isThebig = appType === mychoiceSdkComponents.AppTypes.TheBig;
4230
+ const maxHours = isThebig ? mychoiceSdkComponents.MAX_LOCAL_STORAGE_HOURS_THEBIG : mychoiceSdkComponents.MAX_LOCAL_STORAGE_HOURS;
3609
4231
  const clearFormData = () => {
3610
- dispatchQuoteState({ type: exports.StoreFormCarQuoteActionTypes.FormCarQuoteClear });
3611
- dispatchDiscountState({ type: exports.StoreFormCarDiscountActionTypes.FormCarDiscountClear });
3612
- dispatchDriverBaseState({ type: exports.StoreFormCarDriverBaseActionTypes.FormCarDriverClear });
3613
- dispatchVehicleState({ type: exports.StoreFormCarVehicleActionTypes.FormCarVehicleClear });
3614
- dispatchPostalState({ type: exports.StoreFormCarPostalActionTypes.FormCarPostalClear });
4232
+ if (insuranceType === mychoiceSdkComponents.InsuranceTypes.Car) {
4233
+ dispatchCarQuoteState({ type: exports.StoreFormCarQuoteActionTypes.FormCarQuoteClear });
4234
+ dispatchCarDiscountState({ type: exports.StoreFormCarDiscountActionTypes.FormCarDiscountClear });
4235
+ dispatchDriverBaseState({ type: exports.StoreFormCarDriverBaseActionTypes.FormCarDriverClear });
4236
+ dispatchVehicleState({ type: exports.StoreFormCarVehicleActionTypes.FormCarVehicleClear });
4237
+ dispatchCarPostalState({ type: exports.StoreFormCarPostalActionTypes.FormCarPostalClear });
4238
+ }
4239
+ if (insuranceType === mychoiceSdkComponents.InsuranceTypes.Home || insuranceType === mychoiceSdkComponents.InsuranceTypes.Condo || insuranceType === mychoiceSdkComponents.InsuranceTypes.Tenant) {
4240
+ dispatchHomeQuoteState({ type: exports.StoreFormHomeQuoteActionTypes.FormHomeQuoteClear });
4241
+ dispatchHomeDiscountState({ type: exports.StoreFormHomeDiscountActionTypes.FormHomeDiscountClear });
4242
+ dispatchDwellingState({ type: exports.StoreFormHomeDwellingActionTypes.FormHomeDwellingClear, payload: { type: insuranceType } });
4243
+ dispatchApplicantBaseState({ type: exports.StoreFormHomeApplicantBaseActionTypes.FormHomeApplicantClear });
4244
+ dispatchHomePostalState({ type: exports.StoreFormHomePostalActionTypes.FormHomePostalClear });
4245
+ }
4246
+ if (insuranceType === mychoiceSdkComponents.InsuranceTypes.Life) {
4247
+ dispatchLifeQuoteState({ type: exports.StoreFormLifeQuoteActionTypes.FormLifeQuoteClear });
4248
+ dispatchApplicantState({ type: exports.StoreFormLifeApplicantActionTypes.FormLifeApplicantClear });
4249
+ dispatchCoverageState({ type: exports.StoreFormLifeCoverageActionTypes.FormLifeCoverageClear });
4250
+ }
3615
4251
  };
3616
4252
  const checkIsExpiredWithClear = () => {
3617
- if (quoteState.isRequested && (inactiveHours > (mychoiceSdkComponents.MAX_LOCAL_STORAGE_HOURS - 1))) {
3618
- dispatchPostalState({ type: exports.StoreFormCarPostalActionTypes.FormCarPostalClear });
3619
- clearFormData();
3620
- navigate(`/${appConfigState.localIndex}/${appConfigState.insuranceType}/car`);
4253
+ if (insuranceType === mychoiceSdkComponents.InsuranceTypes.Car) {
4254
+ const inactiveHours = differenceInHoursFromNow(carQuoteState.requestDate);
4255
+ if (carQuoteState.isRequested && (inactiveHours > (maxHours - 1))) {
4256
+ clearFormData();
4257
+ navigate(`/${localIndex}/${insuranceType}/`);
4258
+ }
4259
+ }
4260
+ if (insuranceType === mychoiceSdkComponents.InsuranceTypes.Home || insuranceType === mychoiceSdkComponents.InsuranceTypes.Condo || insuranceType === mychoiceSdkComponents.InsuranceTypes.Tenant) {
4261
+ const inactiveHours = differenceInHoursFromNow(homeQuoteState.requestDate);
4262
+ if (homeQuoteState.isRequested && (inactiveHours > (maxHours - 1))) {
4263
+ clearFormData();
4264
+ navigate(`/${localIndex}/${insuranceType}/`);
4265
+ }
4266
+ }
4267
+ if (insuranceType === mychoiceSdkComponents.InsuranceTypes.Life) {
4268
+ const inactiveHours = differenceInHoursFromNow(lifeQuoteState.requestDate);
4269
+ if (lifeQuoteState.isRequested && (inactiveHours > (maxHours - 1))) {
4270
+ clearFormData();
4271
+ navigate(`/${localIndex}/${insuranceType}/`);
4272
+ }
3621
4273
  }
3622
4274
  };
3623
4275
  const checkIsExpiredWithModal = () => {
@@ -3630,7 +4282,21 @@ const ClearFormDataHandler = () => {
3630
4282
  });
3631
4283
  checkIsExpiredWithClear();
3632
4284
  };
3633
- const checkIsExpired = () => (quoteState.isRequested && (inactiveHours > (mychoiceSdkComponents.MAX_LOCAL_STORAGE_HOURS - 1)));
4285
+ const checkIsExpired = () => {
4286
+ if (insuranceType === mychoiceSdkComponents.InsuranceTypes.Car) {
4287
+ const inactiveHours = differenceInHoursFromNow(carQuoteState.requestDate);
4288
+ return carQuoteState.isRequested && (inactiveHours > (maxHours - 1));
4289
+ }
4290
+ if (insuranceType === mychoiceSdkComponents.InsuranceTypes.Home || insuranceType === mychoiceSdkComponents.InsuranceTypes.Condo || insuranceType === mychoiceSdkComponents.InsuranceTypes.Tenant) {
4291
+ const inactiveHours = differenceInHoursFromNow(homeQuoteState.requestDate);
4292
+ return homeQuoteState.isRequested && (inactiveHours > (maxHours - 1));
4293
+ }
4294
+ if (insuranceType === mychoiceSdkComponents.InsuranceTypes.Life) {
4295
+ const inactiveHours = differenceInHoursFromNow(lifeQuoteState.requestDate);
4296
+ return lifeQuoteState.isRequested && (inactiveHours > (maxHours - 1));
4297
+ }
4298
+ return false;
4299
+ };
3634
4300
  return {
3635
4301
  checkIsExpiredWithClear,
3636
4302
  checkIsExpiredWithModal,
@@ -3692,6 +4358,8 @@ const useHandlerPartner = () => {
3692
4358
  const useHandlerPostal = (insuranceType) => {
3693
4359
  const { dispatchPostalState: dispatchCarPostalState } = useStoreFormCarPostal();
3694
4360
  const { dispatchPostalState: dispatchHomePostalState } = useStoreFormHomePostal();
4361
+ // const { dispatchPostalState: dispatchLifePostalState } = useStoreFormLifePostal();
4362
+ const { dwellingState, dispatchDwellingState } = useStoreFormHomeDwelling();
3695
4363
  const { dispatchConfigState: dispatchCarConfigState } = useStoreFormCarConfig();
3696
4364
  const { dispatchAppModalState } = useStoreAppModal();
3697
4365
  const [requestState, setRequestState] = react.useReducer(dataHandlerReducer, { ...initialHandlerRequestState });
@@ -3707,44 +4375,156 @@ const useHandlerPostal = (insuranceType) => {
3707
4375
  withoutToken: true,
3708
4376
  cancelToken,
3709
4377
  });
3710
- dispatchCarPostalState({
3711
- type: exports.StoreFormCarPostalActionTypes.FormCarPostalSet,
3712
- payload: { ...response.data },
3713
- });
3714
- setRequestState({ type: DataHandlerActionTypes.SetSuccess, payload: response.data });
3715
- if (response.data?.postalCode) {
3716
- dispatchCarConfigState({ type: exports.StoreFormCarConfigActionTypes.FormCarConfigSet, payload: { province: response.data.provinceCode } });
3717
- dispatchAppModalState({ type: exports.StoreConfigAppModalActionTypes.AppModalClose });
3718
- setRequestState({ type: DataHandlerActionTypes.SetSuccess, payload: response.data });
3719
- }
3720
- else {
4378
+ if (mychoiceSdkComponents.supportedProvinceCodes.includes(response.data.provinceCode)) {
4379
+ if (response.data?.postalCode) {
4380
+ dispatchCarPostalState({
4381
+ type: exports.StoreFormCarPostalActionTypes.FormCarPostalSet,
4382
+ payload: { ...response.data },
4383
+ });
4384
+ dispatchCarConfigState({
4385
+ type: exports.StoreFormCarConfigActionTypes.FormCarConfigSet,
4386
+ payload: { province: response.data.provinceCode },
4387
+ });
4388
+ dispatchAppModalState({ type: exports.StoreConfigAppModalActionTypes.AppModalClose });
4389
+ setRequestState({ type: DataHandlerActionTypes.SetSuccess, payload: response.data });
4390
+ return { errorMessage: '' };
4391
+ }
3721
4392
  setRequestState({
3722
4393
  type: DataHandlerActionTypes.SetError,
3723
4394
  payload: 'Something went wrong! Please try again.',
3724
4395
  });
4396
+ return { errorMessage: 'Something went wrong! Please try again.' };
3725
4397
  }
4398
+ setRequestState({
4399
+ type: DataHandlerActionTypes.SetError,
4400
+ payload: 'Postal Code Is Not Supported',
4401
+ });
4402
+ return { errorMessage: 'Postal Code Is Not Supported' };
3726
4403
  }
3727
- if (insuranceType === mychoiceSdkComponents.InsuranceTypes.Home) {
4404
+ if (insuranceType === mychoiceSdkComponents.InsuranceTypes.Home || insuranceType === mychoiceSdkComponents.InsuranceTypes.Condo || insuranceType === mychoiceSdkComponents.InsuranceTypes.Tenant) {
3728
4405
  const response = await httpRequest({
3729
4406
  url: `${mychoiceSdkComponents.API_FORM_HOME.GET_POSTAL}?postal_code=${postalCode}`,
3730
4407
  method: mychoiceSdkComponents.RequestTypes.Get,
3731
4408
  withoutToken: true,
3732
4409
  cancelToken,
3733
4410
  });
4411
+ if (mychoiceSdkComponents.supportedProvinceCodes.includes(response.data.provinceCode)) {
4412
+ if (response.data?.postalCode) {
4413
+ dispatchHomePostalState({
4414
+ type: exports.StoreFormHomePostalActionTypes.FormHomePostalSet,
4415
+ payload: { ...response.data },
4416
+ });
4417
+ dispatchAppModalState({ type: exports.StoreConfigAppModalActionTypes.AppModalClose });
4418
+ setRequestState({ type: DataHandlerActionTypes.SetSuccess, payload: response.data });
4419
+ return { errorMessage: '', data: response.data };
4420
+ }
4421
+ dispatchHomePostalState({
4422
+ type: exports.StoreFormHomePostalActionTypes.FormHomePostalErrorMessageSet,
4423
+ payload: { errorMessage: 'Something went wrong! Please try again.' },
4424
+ });
4425
+ return { errorMessage: 'Something went wrong! Please try again.' };
4426
+ }
3734
4427
  dispatchHomePostalState({
3735
- type: exports.StoreFormHomePostalActionTypes.FormHomePostalSet,
3736
- payload: { ...response.data },
4428
+ type: exports.StoreFormHomePostalActionTypes.FormHomePostalErrorMessageSet,
4429
+ payload: { errorMessage: 'Postal Code Is Not Supported' },
3737
4430
  });
3738
- if (response.data?.postalCode) {
3739
- dispatchAppModalState({ type: exports.StoreConfigAppModalActionTypes.AppModalClose });
3740
- setRequestState({ type: DataHandlerActionTypes.SetSuccess, payload: response.data });
4431
+ return { errorMessage: 'Postal Code Is Not Supported', data: response.data };
4432
+ }
4433
+ // if (insuranceType === InsuranceTypes.Life) {
4434
+ // const response = await httpRequest({
4435
+ // url: `${API_FORM_LIFE.GET_POSTAL}?postal_code=${postalCode}`,
4436
+ // method: RequestTypes.Get,
4437
+ // withoutToken: true,
4438
+ // cancelToken,
4439
+ // });
4440
+ //
4441
+ // if (supportedProvinceCodes.includes(response.data.provinceCode)) {
4442
+ // if (response.data?.postalCode) {
4443
+ // dispatchLifePostalState({
4444
+ // type: StoreFormLifePostalActionTypes.FormLifePostalSet,
4445
+ // payload: { ...response.data },
4446
+ // });
4447
+ // dispatchAppModalState({ type: StoreConfigAppModalActionTypes.AppModalClose });
4448
+ // setRequestState({ type: DataHandlerActionTypes.SetSuccess, payload: response.data });
4449
+ // return { errorMessage: '' };
4450
+ // }
4451
+ // setRequestState({
4452
+ // type: DataHandlerActionTypes.SetError,
4453
+ // payload: 'Something went wrong! Please try again.',
4454
+ // });
4455
+ // return { errorMessage: 'Something went wrong! Please try again.' };
4456
+ // }
4457
+ // setRequestState({
4458
+ // type: DataHandlerActionTypes.SetError,
4459
+ // payload: 'Postal Code Is Not Supported',
4460
+ // });
4461
+ // return { errorMessage: 'Postal Code Is Not Supported' };
4462
+ // }
4463
+ return { errorMessage: 'No Selected Insurance' };
4464
+ }
4465
+ catch (error) {
4466
+ const requestError = error;
4467
+ if (insuranceType === mychoiceSdkComponents.InsuranceTypes.Home) {
4468
+ dispatchHomePostalState({
4469
+ type: exports.StoreFormHomePostalActionTypes.FormHomePostalErrorMessageSet,
4470
+ payload: { errorMessage: requestError.response?.data?.postalCode[0] },
4471
+ });
4472
+ }
4473
+ setRequestState({
4474
+ type: DataHandlerActionTypes.SetError,
4475
+ payload: requestError.response?.data?.postalCode[0],
4476
+ });
4477
+ return { errorMessage: requestError.response?.data?.postalCode[0] };
4478
+ }
4479
+ };
4480
+ const getPlaceByAddress = async (streetAddress, city, postalCode, province) => {
4481
+ setRequestState({ type: DataHandlerActionTypes.SetLoading, payload: true });
4482
+ try {
4483
+ if (insuranceType === mychoiceSdkComponents.InsuranceTypes.Home) {
4484
+ const response = await httpRequest({
4485
+ url: `${mychoiceSdkComponents.API_FORM_HOME.GET_PLACE}`,
4486
+ method: mychoiceSdkComponents.RequestTypes.Post,
4487
+ data: {
4488
+ streetAddress, city, postalCode, province,
4489
+ },
4490
+ withoutToken: true,
4491
+ cancelToken,
4492
+ });
4493
+ console.log('dwelling', response?.data);
4494
+ const { auxiliaryHeating, basementFinishPercent: dataBasementFinishPercent, buildingStructure: dataBuildingStructure, builtDate: dataBuiltDate, exteriorFinish: dataExteriorFinish, garageType: dataGarageType, livingArea: dataLivingArea, primaryHeating, replacementCost: dataReplacementCost, storeysCount: dataStoreysCount, roofType: dataRoofType, poolType: dataPoolType, bathroomsCount: dataBathroomsCount, } = response.data;
4495
+ const { basementFinishPercent, buildingStructure, builtYear, exteriorFinish, garageType, livingArea, heatings, replacementCost, storeysCount, roofReplacedYear, roofType, poolType, bathroomsCount, } = getDwellingInitialState(mychoiceSdkComponents.getInsuranceType());
4496
+ let roofYear = roofReplacedYear;
4497
+ if (dataBuiltDate && (Number(dataBuiltDate) > Number(roofReplacedYear))) {
4498
+ roofYear = dataBuiltDate;
4499
+ }
4500
+ const dwellingInfoUpdatedState = {
4501
+ basementFinishPercent: dataBasementFinishPercent || basementFinishPercent,
4502
+ buildingStructure: dataBuildingStructure || buildingStructure,
4503
+ builtYear: dataBuiltDate || builtYear,
4504
+ exteriorFinish: dataExteriorFinish || exteriorFinish,
4505
+ garageType: dataGarageType || garageType,
4506
+ livingArea: dataLivingArea || livingArea,
4507
+ heatings: [{ type: primaryHeating || heatings[0].type }, { type: auxiliaryHeating || heatings[1].type }],
4508
+ replacementCost: dataReplacementCost || replacementCost,
4509
+ storeysCount: +dataStoreysCount || storeysCount,
4510
+ roofReplacedYear: roofYear,
4511
+ roofType: dataRoofType || roofType,
4512
+ poolType: dataPoolType || poolType,
4513
+ bathroomsCount: dataBathroomsCount || bathroomsCount,
4514
+ };
4515
+ if (!response.data.primaryHeating) {
4516
+ dispatchDwellingState({
4517
+ type: exports.StoreFormHomeDwellingActionTypes.FormHomeDwellingSet,
4518
+ payload: { ...dwellingState, ...dwellingInfoUpdatedState, isCompleted: false },
4519
+ });
3741
4520
  }
3742
4521
  else {
3743
- setRequestState({
3744
- type: DataHandlerActionTypes.SetError,
3745
- payload: 'Something went wrong! Please try again.',
4522
+ dispatchDwellingState({
4523
+ type: exports.StoreFormHomeDwellingActionTypes.FormHomeDwellingSet,
4524
+ payload: { ...dwellingState, ...dwellingInfoUpdatedState },
3746
4525
  });
3747
4526
  }
4527
+ setRequestState({ type: DataHandlerActionTypes.SetSuccess, payload: response.data });
3748
4528
  }
3749
4529
  }
3750
4530
  catch (error) {
@@ -3758,6 +4538,7 @@ const useHandlerPostal = (insuranceType) => {
3758
4538
  return {
3759
4539
  status,
3760
4540
  getPostal,
4541
+ getPlaceByAddress,
3761
4542
  successMessage,
3762
4543
  responseData,
3763
4544
  errorMessage,
@@ -3841,7 +4622,7 @@ const useHandlerCarModel = () => {
3841
4622
  };
3842
4623
  };
3843
4624
 
3844
- const useHandlerQuoterEmail = () => {
4625
+ const useHandlerCarQuoterEmail = () => {
3845
4626
  const [requestState, setRequestState] = react.useReducer(dataHandlerReducer, {
3846
4627
  ...initialHandlerRequestState,
3847
4628
  });
@@ -3917,8 +4698,160 @@ const useHandlerQuoterEmail = () => {
3917
4698
  responseError,
3918
4699
  };
3919
4700
  };
4701
+ const useHandlerHomeQuoterEmail = () => {
4702
+ const [requestState, setRequestState] = react.useReducer(dataHandlerReducer, {
4703
+ ...initialHandlerRequestState,
4704
+ });
4705
+ const { dispatchDiscountState } = useStoreFormHomeDiscount();
4706
+ const { cancelToken } = useCancelToken();
4707
+ const { status, successMessage, responseData, errorMessage, isFirstRequest, responseError, } = requestState;
4708
+ const validateEmail = async (email) => {
4709
+ dispatchDiscountState({
4710
+ type: exports.StoreFormHomeDiscountActionTypes.FormHomeDiscountQuoterEmailSet,
4711
+ payload: {
4712
+ email,
4713
+ emailStatus: mychoiceSdkComponents.ValidationStatusTypes.Loading,
4714
+ },
4715
+ });
4716
+ if (email) {
4717
+ try {
4718
+ const response = await httpRequest({
4719
+ url: mychoiceSdkComponents.API_AUTH.POST_EMAIL_VALIDATION,
4720
+ method: mychoiceSdkComponents.RequestTypes.Post,
4721
+ data: { email },
4722
+ withoutToken: true,
4723
+ cancelToken,
4724
+ });
4725
+ if (response.data.valid) {
4726
+ dispatchDiscountState({
4727
+ type: exports.StoreFormHomeDiscountActionTypes.FormHomeDiscountQuoterEmailSet,
4728
+ payload: {
4729
+ email,
4730
+ emailStatus: mychoiceSdkComponents.ValidationStatusTypes.Approved,
4731
+ },
4732
+ });
4733
+ }
4734
+ else {
4735
+ dispatchDiscountState({
4736
+ type: exports.StoreFormHomeDiscountActionTypes.FormHomeDiscountQuoterEmailSet,
4737
+ payload: {
4738
+ email,
4739
+ emailStatus: mychoiceSdkComponents.ValidationStatusTypes.Declined,
4740
+ },
4741
+ });
4742
+ setRequestState({ type: DataHandlerActionTypes.SetError, payload: 'Enter a valid email address.' });
4743
+ }
4744
+ }
4745
+ catch (error) {
4746
+ dispatchDiscountState({
4747
+ type: exports.StoreFormHomeDiscountActionTypes.FormHomeDiscountQuoterEmailSet,
4748
+ payload: {
4749
+ email,
4750
+ emailStatus: mychoiceSdkComponents.ValidationStatusTypes.Declined,
4751
+ },
4752
+ });
4753
+ setRequestState({ type: DataHandlerActionTypes.SetError, payload: 'Enter a valid email address.' });
4754
+ }
4755
+ }
4756
+ else {
4757
+ dispatchDiscountState({
4758
+ type: exports.StoreFormHomeDiscountActionTypes.FormHomeDiscountQuoterEmailSet,
4759
+ payload: {
4760
+ email,
4761
+ emailStatus: mychoiceSdkComponents.ValidationStatusTypes.Declined,
4762
+ },
4763
+ });
4764
+ setRequestState({ type: DataHandlerActionTypes.SetError, payload: 'This field may not be blank.' });
4765
+ }
4766
+ };
4767
+ return {
4768
+ status,
4769
+ validateEmail,
4770
+ successMessage,
4771
+ responseData,
4772
+ errorMessage,
4773
+ isFirstRequest,
4774
+ responseError,
4775
+ };
4776
+ };
4777
+ const useHandlerLifeQuoterEmail = () => {
4778
+ const [requestState, setRequestState] = react.useReducer(dataHandlerReducer, {
4779
+ ...initialHandlerRequestState,
4780
+ });
4781
+ const { dispatchApplicantState } = useStoreFormLifeApplicant();
4782
+ const { cancelToken } = useCancelToken();
4783
+ const { status, successMessage, responseData, errorMessage, isFirstRequest, responseError, } = requestState;
4784
+ const validateEmail = async (email) => {
4785
+ dispatchApplicantState({
4786
+ type: exports.StoreFormLifeApplicantActionTypes.FormLifeApplicantEmailSet,
4787
+ payload: {
4788
+ email,
4789
+ emailStatus: mychoiceSdkComponents.ValidationStatusTypes.Loading,
4790
+ },
4791
+ });
4792
+ if (email) {
4793
+ try {
4794
+ const response = await httpRequest({
4795
+ url: mychoiceSdkComponents.API_AUTH.POST_EMAIL_VALIDATION,
4796
+ method: mychoiceSdkComponents.RequestTypes.Post,
4797
+ data: { email },
4798
+ withoutToken: true,
4799
+ cancelToken,
4800
+ });
4801
+ if (response.data.valid) {
4802
+ dispatchApplicantState({
4803
+ type: exports.StoreFormLifeApplicantActionTypes.FormLifeApplicantEmailSet,
4804
+ payload: {
4805
+ email,
4806
+ emailStatus: mychoiceSdkComponents.ValidationStatusTypes.Approved,
4807
+ },
4808
+ });
4809
+ }
4810
+ else {
4811
+ dispatchApplicantState({
4812
+ type: exports.StoreFormLifeApplicantActionTypes.FormLifeApplicantEmailSet,
4813
+ payload: {
4814
+ email,
4815
+ emailStatus: mychoiceSdkComponents.ValidationStatusTypes.Declined,
4816
+ },
4817
+ });
4818
+ setRequestState({ type: DataHandlerActionTypes.SetError, payload: 'Enter a valid email address.' });
4819
+ }
4820
+ }
4821
+ catch (error) {
4822
+ dispatchApplicantState({
4823
+ type: exports.StoreFormLifeApplicantActionTypes.FormLifeApplicantEmailSet,
4824
+ payload: {
4825
+ email,
4826
+ emailStatus: mychoiceSdkComponents.ValidationStatusTypes.Declined,
4827
+ },
4828
+ });
4829
+ setRequestState({ type: DataHandlerActionTypes.SetError, payload: 'Enter a valid email address.' });
4830
+ }
4831
+ }
4832
+ else {
4833
+ dispatchApplicantState({
4834
+ type: exports.StoreFormLifeApplicantActionTypes.FormLifeApplicantEmailSet,
4835
+ payload: {
4836
+ email,
4837
+ emailStatus: mychoiceSdkComponents.ValidationStatusTypes.Declined,
4838
+ },
4839
+ });
4840
+ setRequestState({ type: DataHandlerActionTypes.SetError, payload: 'This field may not be blank.' });
4841
+ }
4842
+ };
4843
+ return {
4844
+ status,
4845
+ validateEmail,
4846
+ successMessage,
4847
+ responseData,
4848
+ errorMessage,
4849
+ isFirstRequest,
4850
+ responseError,
4851
+ };
4852
+ };
3920
4853
 
3921
- const QuoteDataHandler = () => {
4854
+ const CarQuoteDataHandler = () => {
3922
4855
  const { configState } = useStoreFormCarConfig();
3923
4856
  const { vehicleState } = useStoreFormCarVehicle();
3924
4857
  const { driverState } = useStoreFormCarDriverBase();
@@ -3949,13 +4882,13 @@ const QuoteDataHandler = () => {
3949
4882
  // updateViewLoader({ type: viewLoaderActionTypes.UpdateLoader, payload: false });
3950
4883
  // updateLocalState({ type: DataManagerActionTypes.RequestState, payload: requestStatusTypes.Error });
3951
4884
  // }
3952
- const constructRequestBody = async (isRecalc) => {
4885
+ const constructRequestBody = (isRecalc) => {
3953
4886
  const vehicles = mychoiceSdkComponents.deepClone(vehicleState).items;
3954
4887
  const drivers = mychoiceSdkComponents.deepClone(driverState).items;
3955
4888
  const postal = mychoiceSdkComponents.deepClone(postalState).item;
3956
4889
  const discount = mychoiceSdkComponents.deepClone(discountState);
3957
4890
  const { policyStartYear, policyStartMonth, policyStartDay } = discountState;
3958
- // dispatchQuoteState({ type: StoreFormCarQuoteActionTypes.UpdateCallMessage, payload: { showCallMessage: false } });
4891
+ // dispatchQuoteState({ type: StoreFormCarQuoteActionTypes.UpdateCarCallMessage, payload: { showCallMessage: false } });
3959
4892
  if (policyStartYear && policyStartMonth && policyStartDay) {
3960
4893
  discount.policyStart = `${policyStartYear}-${policyStartMonth}-${policyStartDay}`;
3961
4894
  delete discount.policyStartYear;
@@ -4022,7 +4955,7 @@ const QuoteDataHandler = () => {
4022
4955
  // || driver.licenceInfo.licenceType === DriverLicenceTypes.G2
4023
4956
  // || (driver.insuranceCancellation && insuranceNonPaymentList.length > 1)) {
4024
4957
  // dispatchQuoteState({
4025
- // type: StoreFormCarQuoteActionTypes.UpdateCallMessage,
4958
+ // type: StoreFormCarQuoteActionTypes.UpdateCarCallMessage,
4026
4959
  // payload: { showCallMessage: true },
4027
4960
  // });
4028
4961
  // discount.quoterInfo.splashScreen = true;
@@ -4191,7 +5124,7 @@ const QuoteDataHandler = () => {
4191
5124
  if (isLoader) {
4192
5125
  openLoader('Please wait for getting redirect url.');
4193
5126
  }
4194
- const requestBody = await constructRequestBody(true);
5127
+ const requestBody = constructRequestBody(true);
4195
5128
  if (requestBody) {
4196
5129
  const response = await httpRequest({
4197
5130
  url: mychoiceSdkComponents.API_FORM_CAR.POST_QUOTE_ONLIA_URL,
@@ -4204,69 +5137,460 @@ const QuoteDataHandler = () => {
4204
5137
  if (response.status === 200 || response.status === 201) {
4205
5138
  const url = response.data.redirectUrl || redirectUrl;
4206
5139
  dispatchAppLoaderState({ type: exports.StoreConfigAppLoaderActionTypes.AppLoaderClose });
4207
- window.location.href = url;
5140
+ window.location.href = url;
5141
+ }
5142
+ else {
5143
+ setRequestState({
5144
+ type: DataHandlerActionTypes.SetError,
5145
+ payload: `Axios request error: ${response}`,
5146
+ });
5147
+ }
5148
+ }
5149
+ }
5150
+ };
5151
+ const postRequestQuote = async (isRecalc = false) => {
5152
+ const quoteLocalState = JSON.parse(localStorage.getItem('insurance_car_quotes') || '{}');
5153
+ const { isRequested } = quoteLocalState;
5154
+ // if (appConfigState.appType === AppTypes.TheBig) {
5155
+ // driverState.items.forEach((item) => {
5156
+ // const nonPayList = item.insuranceCancellationList?.filter((cancellation) => (cancellation.reason === 'NonPay')) || [];
5157
+ // if (nonPayList.length > 1 || (item.licenceInfo.licenceType === DriverLicenceTypes.G2) || !item.listed) {
5158
+ // isSplashScreen = true;
5159
+ // }
5160
+ // });
5161
+ // }
5162
+ if (checkIsExpired()) {
5163
+ checkIsExpiredWithModal();
5164
+ }
5165
+ else if (!isRequested) {
5166
+ if (!isRecalc) {
5167
+ if (appConfigState.appType === mychoiceSdkComponents.AppTypes.TheBig) {
5168
+ openLoader('Please wait while we fetch your lowest rates from our insurance partners.');
5169
+ }
5170
+ else {
5171
+ openLoader('Please note: As insurance premiums are based on the information you provide it is important that it be 100% accurate and up to date. If you are not sure it is best to check and edit your information in the next step.');
5172
+ }
5173
+ }
5174
+ else {
5175
+ openLoader('Please wait while we fetch your lowest rates from our insurance partners.');
5176
+ }
5177
+ const requestBody = constructRequestBody(quoteState.isRequested || isRecalc);
5178
+ if (requestBody) {
5179
+ try {
5180
+ const response = await httpRequest({
5181
+ url: mychoiceSdkComponents.API_FORM_CAR.POST_QUOTE_DATA,
5182
+ method: mychoiceSdkComponents.RequestTypes.Post,
5183
+ data: requestBody,
5184
+ withoutToken: true,
5185
+ cancelToken,
5186
+ });
5187
+ if (discountState.quoterInfo.initial) {
5188
+ dispatchDiscountState({
5189
+ type: exports.StoreFormCarDiscountActionTypes.FormCarDiscountQuoterInitialSet,
5190
+ payload: { initial: false },
5191
+ });
5192
+ }
5193
+ if (!quoteState.isRequested) {
5194
+ dispatchQuoteState({
5195
+ type: exports.StoreFormCarQuoteActionTypes.FormCarQuoteIsRequestedSet,
5196
+ payload: { isRequested: true },
5197
+ });
5198
+ }
5199
+ dispatchQuoteState({
5200
+ type: exports.StoreFormCarQuoteActionTypes.FormCarQuoteRequestDateSet,
5201
+ payload: { requestDate: new Date().toISOString() },
5202
+ });
5203
+ dispatchQuoteState({
5204
+ type: exports.StoreFormCarQuoteActionTypes.FormCarQuotesSet,
5205
+ payload: { items: response.data },
5206
+ });
5207
+ setRequestState({
5208
+ type: DataHandlerActionTypes.SetSuccess,
5209
+ });
5210
+ dispatchAppLoaderState({ type: exports.StoreConfigAppLoaderActionTypes.AppLoaderClose });
5211
+ if (!isRecalc) {
5212
+ navigate(`/${appConfigState.localIndex}/car/quotes`);
5213
+ }
5214
+ }
5215
+ catch (error) {
5216
+ setRequestState({
5217
+ type: DataHandlerActionTypes.SetError,
5218
+ payload: 'Axios request error',
5219
+ });
5220
+ dispatchAppLoaderState({ type: exports.StoreConfigAppLoaderActionTypes.AppLoaderClose });
5221
+ }
5222
+ }
5223
+ }
5224
+ };
5225
+ return ({
5226
+ status,
5227
+ successMessage,
5228
+ responseData,
5229
+ errorMessage,
5230
+ isFirstRequest,
5231
+ responseError,
5232
+ postRequestQuoteOnliaUrl,
5233
+ postRequestQuote,
5234
+ });
5235
+ };
5236
+
5237
+ const HomeQuoteDataHandler = () => {
5238
+ const { postalState } = useStoreFormHomePostal();
5239
+ const { applicantState } = useStoreFormHomeApplicantBase();
5240
+ const { dwellingState } = useStoreFormHomeDwelling();
5241
+ const { discountState, dispatchDiscountState } = useStoreFormHomeDiscount();
5242
+ const { quoteState, dispatchQuoteState } = useStoreFormHomeQuote();
5243
+ const { dispatchAppLoaderState } = useStoreAppLoader();
5244
+ const { appConfigState } = useStoreAppConfig();
5245
+ const { insuranceType } = appConfigState;
5246
+ const navigate = reactRouterDom.useNavigate();
5247
+ const { checkIsExpired, checkIsExpiredWithModal } = ClearFormDataHandler();
5248
+ const [requestState, setRequestState] = react.useReducer(dataHandlerReducer, { ...initialHandlerRequestState });
5249
+ const { status, successMessage, responseData, errorMessage, isFirstRequest, responseError, } = requestState;
5250
+ const { cancelToken } = useCancelToken();
5251
+ const openLoader = (loaderDescription = '') => {
5252
+ dispatchAppLoaderState({
5253
+ type: exports.StoreConfigAppLoaderActionTypes.AppLoaderOpen,
5254
+ payload: {
5255
+ description: loaderDescription,
5256
+ },
5257
+ });
5258
+ };
5259
+ const constructRequestBody = (isRecalc) => {
5260
+ const postal = mychoiceSdkComponents.deepClone(postalState).item;
5261
+ const applicant = mychoiceSdkComponents.deepClone(applicantState);
5262
+ const dwelling = mychoiceSdkComponents.deepClone(dwellingState);
5263
+ const discount = mychoiceSdkComponents.deepClone(discountState);
5264
+ const { policyStartYear, policyStartMonth, policyStartDay } = discountState;
5265
+ const { builtYear, roofReplacedYear, occupiedYear, } = dwellingState;
5266
+ const { insured: { dateInsuredCurrent, dateInsuredSince, birthMonth, birthDay, birthYear, nonsmoker, }, insuranceClaimList, insuranceCancellationList, } = applicant;
5267
+ const lists = {
5268
+ claims: insuranceClaimList?.map((item) => ({
5269
+ date: addDayToDate(`${item.claimYear}-${item.claimMonth}`, 1),
5270
+ type: item.claimType,
5271
+ })),
5272
+ cancellations: insuranceCancellationList?.map((item) => ({
5273
+ date: addDayToDate(`${item.cancellationYear}-${item.cancellationMonth}`, 1),
5274
+ })),
5275
+ };
5276
+ if (!applicant.insuredCurrent && !applicant.insuredBefore) {
5277
+ delete lists.claims;
5278
+ delete lists.cancellations;
5279
+ }
5280
+ else {
5281
+ if (!applicant.insuranceCancellation) {
5282
+ delete lists.cancellations;
5283
+ }
5284
+ if (!applicant.insuranceClaim) {
5285
+ delete lists.claims;
5286
+ }
5287
+ }
5288
+ dwelling.type = insuranceType || mychoiceSdkComponents.InsuranceTypes.Home;
5289
+ dwelling.builtDate = `${builtYear}-01-01`;
5290
+ dwelling.roofReplacedDate = `${roofReplacedYear}-01-01`;
5291
+ dwelling.occupiedDate = `${occupiedYear}-${birthMonth}-${birthDay}`;
5292
+ dwelling.familiesCount = Number(dwelling.familiesCount);
5293
+ dwelling.basementFinishPercent = Number(dwelling.basementFinishPercent);
5294
+ dwelling.mortgagesCount = Number(dwelling.mortgagesCount) - 1;
5295
+ dwelling.deductible = Number(dwelling.deductible);
5296
+ dwelling.liability = Number(dwelling.liability);
5297
+ dwelling.fireHydrantDistance = Number(dwelling.fireHydrantDistance);
5298
+ dwelling.fireHallDistance = Number(dwelling.fireHallDistance);
5299
+ if ((insuranceType !== mychoiceSdkComponents.InsuranceTypes.Home) && dwelling.pp) {
5300
+ dwelling.replacementCost = Number(dwelling.pp);
5301
+ }
5302
+ const heatingExpectedDate = mychoiceSdkComponents.subYearsFromDate('', 20);
5303
+ const heatingDate = mychoiceSdkComponents.compareDates(dwelling.builtDate, heatingExpectedDate) >= 0 ? dwelling.builtDate : heatingExpectedDate;
5304
+ if (dwelling.heatings.length) {
5305
+ dwelling.heatings = dwelling.heatings.map((heating) => ({ type: heating.type, date: heatingDate }));
5306
+ }
5307
+ if (dwelling.pp) {
5308
+ dwelling.pp = Number(dwelling.pp);
5309
+ }
5310
+ else {
5311
+ delete dwelling.pp;
5312
+ }
5313
+ if (dwelling.unitsCount) {
5314
+ dwelling.unitsCount = Number(dwelling.unitsCount);
5315
+ }
5316
+ else {
5317
+ delete dwelling.unitsCount;
5318
+ }
5319
+ if (dwelling.fireExtinguishersCount) {
5320
+ dwelling.fireExtinguishersCount = Number(dwelling.fireExtinguishersCount) - 1;
5321
+ }
5322
+ else {
5323
+ delete dwelling.fireExtinguishersCount;
5324
+ }
5325
+ delete dwelling.isCompleted;
5326
+ delete dwelling.builtYear;
5327
+ delete dwelling.roofReplacedYear;
5328
+ delete dwelling.occupiedYear;
5329
+ delete dwelling.isValid;
5330
+ delete dwelling.inValidation;
5331
+ delete discount.isValid;
5332
+ delete discount.inValidation;
5333
+ // dispatchQuoteState({ type: StoreFormHomeQuoteActionTypes.UpdateHomeCallMessage, payload: { showCallMessage: false } });
5334
+ if (policyStartYear && policyStartMonth && policyStartDay) {
5335
+ discount.policyStart = `${policyStartYear}-${policyStartMonth}-${policyStartDay}`;
5336
+ delete discount.policyStartYear;
5337
+ delete discount.policyStartMonth;
5338
+ delete discount.policyStartDay;
5339
+ }
5340
+ const requestBody = {
5341
+ dwellings: [{
5342
+ ...dwelling,
5343
+ postalCode: postal.postalCode,
5344
+ locationIndex: postal.locationIndex,
5345
+ city: postal.city,
5346
+ streetAddress: postal.streetAddress,
5347
+ ...lists,
5348
+ }],
5349
+ ...discount,
5350
+ insured: {
5351
+ dateOfBirth: `${birthYear}-${birthMonth}-${birthDay}`,
5352
+ dateInsuredCurrent,
5353
+ dateInsuredSince,
5354
+ nonsmoker,
5355
+ },
5356
+ policyStart: discountState.policyStart,
5357
+ multiplePoliciesDiscount: discountState.multiplePoliciesDiscount,
5358
+ emailTo: discountState.emailTo.email,
5359
+ provinceCode: postal.provinceCode,
5360
+ quoterInfo: discount.quoterInfo || {},
5361
+ };
5362
+ requestBody.quoterInfo.recalculate = isRecalc;
5363
+ if (requestBody.quoterInfo?.utmSource === '') {
5364
+ delete requestBody.quoterInfo.utmSource;
5365
+ }
5366
+ if (requestBody.quoterInfo?.utmCampaign === '') {
5367
+ delete requestBody.quoterInfo.utmCampaign;
5368
+ }
5369
+ if (!applicant.insuredCurrent) {
5370
+ delete requestBody.insured.dateInsuredCurrent;
5371
+ delete requestBody.insured.dateInsuredSince;
5372
+ }
5373
+ else {
5374
+ requestBody.insured.dateInsuredCurrent = mychoiceSdkComponents.subYearsFromDate('', Number(requestBody.insured.dateInsuredCurrent));
5375
+ requestBody.insured.dateInsuredSince = mychoiceSdkComponents.subYearsFromDate('', Number(requestBody.insured.dateInsuredSince));
5376
+ }
5377
+ // ==================================
5378
+ // thebig additional properties
5379
+ if (appConfigState.appType !== mychoiceSdkComponents.AppTypes.TheBig) {
5380
+ delete requestBody.quoterInfo.brokerInfo;
5381
+ delete requestBody.quoterInfo.splashScreen;
5382
+ delete requestBody.quoterInfo.caslConsent;
5383
+ }
5384
+ // ===================================
5385
+ return {
5386
+ ...requestBody,
5387
+ };
5388
+ };
5389
+ const postRequestQuoteOnliaUrl = async (isLoader, redirectUrl) => {
5390
+ if (isLoader) {
5391
+ openLoader('Please wait for getting redirect url.');
5392
+ }
5393
+ const requestBody = constructRequestBody(true);
5394
+ if (requestBody) {
5395
+ const response = await httpRequest({
5396
+ url: mychoiceSdkComponents.API_FORM_CAR.POST_QUOTE_ONLIA_URL,
5397
+ method: mychoiceSdkComponents.RequestTypes.Post,
5398
+ data: requestBody,
5399
+ withoutToken: true,
5400
+ cancelToken,
5401
+ });
5402
+ if (response) {
5403
+ if (response.status === 200 || response.status === 201) {
5404
+ const url = response.data.redirectUrl || redirectUrl;
5405
+ dispatchAppLoaderState({ type: exports.StoreConfigAppLoaderActionTypes.AppLoaderClose });
5406
+ window.location.href = url;
5407
+ }
5408
+ else {
5409
+ setRequestState({
5410
+ type: DataHandlerActionTypes.SetError,
5411
+ payload: `Axios request error: ${response}`,
5412
+ });
5413
+ }
5414
+ }
5415
+ }
5416
+ };
5417
+ const postRequestQuote = async (isRecalc = false) => {
5418
+ const quoteLocalState = JSON.parse(localStorage.getItem('insurance_home_quotes') || '{}');
5419
+ const { isRequested } = quoteLocalState;
5420
+ if (checkIsExpired()) {
5421
+ checkIsExpiredWithModal();
5422
+ }
5423
+ else if (!isRequested) {
5424
+ if (!isRecalc) {
5425
+ if (appConfigState.appType === mychoiceSdkComponents.AppTypes.TheBig) {
5426
+ openLoader('Please wait while we fetch your lowest rates from our insurance partners.');
5427
+ }
5428
+ else {
5429
+ openLoader('Please note: As insurance premiums are based on the information you provide it is important that it be 100% accurate and up to date. If you are not sure it is best to check and edit your information in the next step.');
5430
+ }
5431
+ }
5432
+ else {
5433
+ openLoader('Please wait while we fetch your lowest rates from our insurance partners.');
5434
+ }
5435
+ const requestBody = constructRequestBody(quoteState.isRequested || isRecalc);
5436
+ if (requestBody) {
5437
+ try {
5438
+ const response = await httpRequest({
5439
+ url: mychoiceSdkComponents.API_FORM_HOME.POST_QUOTE_DATA,
5440
+ method: mychoiceSdkComponents.RequestTypes.Post,
5441
+ data: requestBody,
5442
+ withoutToken: true,
5443
+ cancelToken,
5444
+ });
5445
+ if (discountState.quoterInfo?.initial) {
5446
+ dispatchDiscountState({
5447
+ type: exports.StoreFormHomeDiscountActionTypes.FormHomeDiscountQuoterInitialSet,
5448
+ payload: { initial: false },
5449
+ });
5450
+ }
5451
+ if (!quoteState.isRequested) {
5452
+ dispatchQuoteState({
5453
+ type: exports.StoreFormHomeQuoteActionTypes.FormHomeQuoteIsRequestedSet,
5454
+ payload: { isRequested: true },
5455
+ });
5456
+ }
5457
+ dispatchQuoteState({
5458
+ type: exports.StoreFormHomeQuoteActionTypes.FormHomeQuoteRequestDateSet,
5459
+ payload: { requestDate: new Date().toISOString() },
5460
+ });
5461
+ dispatchQuoteState({
5462
+ type: exports.StoreFormHomeQuoteActionTypes.FormHomeQuotesSet,
5463
+ payload: { items: response.data },
5464
+ });
5465
+ setRequestState({
5466
+ type: DataHandlerActionTypes.SetSuccess,
5467
+ });
5468
+ dispatchAppLoaderState({ type: exports.StoreConfigAppLoaderActionTypes.AppLoaderClose });
5469
+ if (!isRecalc) {
5470
+ navigate(`/${appConfigState.localIndex}/${insuranceType}/quotes`);
5471
+ }
4208
5472
  }
4209
- else {
5473
+ catch (error) {
4210
5474
  setRequestState({
4211
5475
  type: DataHandlerActionTypes.SetError,
4212
- payload: `Axios request error: ${response}`,
5476
+ payload: 'Axios request error',
4213
5477
  });
5478
+ dispatchAppLoaderState({ type: exports.StoreConfigAppLoaderActionTypes.AppLoaderClose });
4214
5479
  }
4215
5480
  }
4216
5481
  }
4217
5482
  };
5483
+ return ({
5484
+ status,
5485
+ successMessage,
5486
+ responseData,
5487
+ errorMessage,
5488
+ isFirstRequest,
5489
+ responseError,
5490
+ postRequestQuoteOnliaUrl,
5491
+ postRequestQuote,
5492
+ });
5493
+ };
5494
+
5495
+ const LifeQuoteDataHandler = () => {
5496
+ const { coverageState } = useStoreFormLifeCoverage();
5497
+ const { applicantState } = useStoreFormLifeApplicant();
5498
+ const { quoteState, dispatchQuoteState } = useStoreFormLifeQuote();
5499
+ const { dispatchAppLoaderState } = useStoreAppLoader();
5500
+ const { appConfigState } = useStoreAppConfig();
5501
+ const navigate = reactRouterDom.useNavigate();
5502
+ const { checkIsExpired, checkIsExpiredWithModal } = ClearFormDataHandler();
5503
+ const [requestState, setRequestState] = react.useReducer(dataHandlerReducer, { ...initialHandlerRequestState });
5504
+ const { status, successMessage, responseData, errorMessage, isFirstRequest, responseError, } = requestState;
5505
+ const { cancelToken } = useCancelToken();
5506
+ const openLoader = (loaderDescription = '') => {
5507
+ dispatchAppLoaderState({
5508
+ type: exports.StoreConfigAppLoaderActionTypes.AppLoaderOpen,
5509
+ payload: {
5510
+ description: loaderDescription,
5511
+ },
5512
+ });
5513
+ };
5514
+ const constructRequestBody = () => {
5515
+ const coverage = mychoiceSdkComponents.deepClone(coverageState);
5516
+ const applicant = mychoiceSdkComponents.deepClone(applicantState);
5517
+ delete coverage.isValid;
5518
+ delete coverage.inValidation;
5519
+ delete applicant.isValid;
5520
+ delete applicant.inValidation;
5521
+ // In life insurance we haven't mapping from backend,
5522
+ // and structure ob request body in this step will be
5523
+ // the same as endpoint body,
5524
+ // and we will ignore axios.interceptors formatting
5525
+ const requestBody = {
5526
+ State: coverage.province,
5527
+ BirthMonth: Number(applicant.birthMonth).toString(),
5528
+ Birthday: Number(applicant.birthDay).toString(),
5529
+ BirthYear: Number(applicant.birthYear).toString(),
5530
+ Sex: applicant.gender,
5531
+ Smoker: applicant.smoker ? 'Y' : 'N',
5532
+ Health: 'PP',
5533
+ NewCategory: coverage.type,
5534
+ FaceAmount: Number(coverage.coverage),
5535
+ ModeUsed: 'M',
5536
+ email_to: applicant.emailTo.email,
5537
+ quoter_info: {
5538
+ first_name: applicant.quoterInfo?.firstName,
5539
+ last_name: applicant.quoterInfo?.lastName,
5540
+ phone: Number(applicant.quoterInfo?.phone),
5541
+ recalculate: false,
5542
+ utm_source: applicant.quoterInfo?.utmSource,
5543
+ utm_campaign: applicant.quoterInfo?.utmCampaign,
5544
+ },
5545
+ };
5546
+ if (requestBody.quoter_info?.utm_source === '') {
5547
+ delete requestBody.quoter_info.utm_source;
5548
+ }
5549
+ if (requestBody.quoter_info?.utm_campaign === '') {
5550
+ delete requestBody.quoter_info.utm_campaign;
5551
+ }
5552
+ if (requestBody.Sex === mychoiceSdkComponents.GenderTypes.Other) {
5553
+ requestBody.Sex = mychoiceSdkComponents.GenderTypes.Male;
5554
+ }
5555
+ return {
5556
+ ...requestBody,
5557
+ };
5558
+ };
4218
5559
  const postRequestQuote = async (isRecalc) => {
4219
- // if (appConfigState.appType === AppTypes.TheBig) {
4220
- // driverState.items.forEach((item) => {
4221
- // const nonPayList = item.insuranceCancellationList?.filter((cancellation) => (cancellation.reason === 'NonPay')) || [];
4222
- // if (nonPayList.length > 1 || (item.licenceInfo.licenceType === DriverLicenceTypes.G2) || !item.listed) {
4223
- // isSplashScreen = true;
4224
- // }
4225
- // });
4226
- // }
5560
+ const quoteLocalState = JSON.parse(localStorage.getItem('insurance_life_quotes') || '{}');
5561
+ const { isRequested } = quoteLocalState;
4227
5562
  if (checkIsExpired()) {
4228
5563
  checkIsExpiredWithModal();
4229
5564
  }
4230
- else if (!quoteState.isRequested) {
5565
+ else if (!isRequested) {
4231
5566
  if (!isRecalc) {
4232
- if (appConfigState.appType === mychoiceSdkComponents.AppTypes.TheBig) {
4233
- openLoader('Please wait while we fetch your lowest rates from our insurance partners.');
4234
- }
4235
- else {
4236
- openLoader('Please note: As insurance premiums are based on the information you provide it is important that it be 100% accurate and up to date. If you are not sure it is best to check and edit your information in the next step.');
4237
- }
5567
+ openLoader('Please note: As insurance premiums are based on the information you provide it is important that it be 100% accurate and up to date. If you are not sure it is best to check and edit your information in the next step.');
4238
5568
  }
4239
5569
  else {
4240
5570
  openLoader('Please wait while we fetch your lowest rates from our insurance partners.');
4241
5571
  }
4242
- const requestBody = await constructRequestBody(quoteState.isRequested || isRecalc);
5572
+ const requestBody = constructRequestBody(); // isRecalc is removed in life insurance
4243
5573
  if (requestBody) {
4244
5574
  try {
4245
5575
  const response = await httpRequest({
4246
- url: mychoiceSdkComponents.API_FORM_CAR.POST_QUOTE_DATA,
5576
+ url: mychoiceSdkComponents.API_FORM_LIFE.POST_QUOTE_DATA,
4247
5577
  method: mychoiceSdkComponents.RequestTypes.Post,
4248
5578
  data: requestBody,
4249
5579
  withoutToken: true,
4250
5580
  cancelToken,
4251
5581
  });
4252
- if (discountState.quoterInfo.initial) {
4253
- dispatchDiscountState({
4254
- type: exports.StoreFormCarDiscountActionTypes.FormCarDiscountQuoterInitialSet,
4255
- payload: { initial: false },
4256
- });
4257
- }
4258
5582
  if (!quoteState.isRequested) {
4259
5583
  dispatchQuoteState({
4260
- type: exports.StoreFormCarQuoteActionTypes.FormCarQuoteIsRequestedSet,
5584
+ type: exports.StoreFormLifeQuoteActionTypes.FormLifeQuoteIsRequestedSet,
4261
5585
  payload: { isRequested: true },
4262
5586
  });
4263
5587
  }
4264
5588
  dispatchQuoteState({
4265
- type: exports.StoreFormCarQuoteActionTypes.FormCarQuoteRequestDateSet,
5589
+ type: exports.StoreFormLifeQuoteActionTypes.FormLifeQuoteRequestDateSet,
4266
5590
  payload: { requestDate: new Date().toISOString() },
4267
5591
  });
4268
5592
  dispatchQuoteState({
4269
- type: exports.StoreFormCarQuoteActionTypes.FormCarQuotesSet,
5593
+ type: exports.StoreFormLifeQuoteActionTypes.FormLifeQuotesSet,
4270
5594
  payload: { items: response.data },
4271
5595
  });
4272
5596
  setRequestState({
@@ -4274,7 +5598,7 @@ const QuoteDataHandler = () => {
4274
5598
  });
4275
5599
  dispatchAppLoaderState({ type: exports.StoreConfigAppLoaderActionTypes.AppLoaderClose });
4276
5600
  if (!isRecalc) {
4277
- navigate(`/${appConfigState.localIndex}/car/quotes`);
5601
+ navigate(`/${appConfigState.localIndex}/life/quotes`);
4278
5602
  }
4279
5603
  }
4280
5604
  catch (error) {
@@ -4294,8 +5618,8 @@ const QuoteDataHandler = () => {
4294
5618
  errorMessage,
4295
5619
  isFirstRequest,
4296
5620
  responseError,
4297
- postRequestQuoteOnliaUrl,
4298
5621
  postRequestQuote,
5622
+ postRequestQuoteOnliaUrl: () => { },
4299
5623
  });
4300
5624
  };
4301
5625
 
@@ -4552,9 +5876,6 @@ const useValidationCarDiscount = () => {
4552
5876
  }
4553
5877
  });
4554
5878
  if (!errors.length) {
4555
- if (requestFn) {
4556
- requestFn();
4557
- }
4558
5879
  dispatchDiscountState({
4559
5880
  type: exports.StoreFormCarDiscountActionTypes.FormCarDiscountValidate,
4560
5881
  payload: { inValidation: false },
@@ -4564,6 +5885,9 @@ const useValidationCarDiscount = () => {
4564
5885
  payload: { isValid: true },
4565
5886
  });
4566
5887
  formIsValid = true;
5888
+ if (requestFn) {
5889
+ requestFn();
5890
+ }
4567
5891
  }
4568
5892
  else {
4569
5893
  const element = document.getElementsByName(errors[0])[0];
@@ -4591,60 +5915,93 @@ const useValidationCarDiscount = () => {
4591
5915
  };
4592
5916
  };
4593
5917
 
4594
- // import { useHandlerPostal } from '../../../dataHandlers';
4595
5918
  const useValidationAddress = () => {
4596
- // const {
4597
- // // getPostal, status,
4598
- // } = useHandlerPostal(InsuranceTypes.Home);
4599
- const { addressState, dispatchAddressState } = useStoreFormHomeAddress();
4600
- const { postalState } = useStoreFormHomePostal();
4601
- const { inValidation = false, isValid = false, } = addressState;
4602
- const { appConfigState } = useStoreAppConfig();
5919
+ const { dwellingState } = useStoreFormHomeDwelling();
5920
+ const { dispatchAppLoaderState } = useStoreAppLoader();
5921
+ const { postalState, dispatchPostalState } = useStoreFormHomePostal();
5922
+ const { getPlaceByAddress } = useHandlerPostal(mychoiceSdkComponents.InsuranceTypes.Home);
5923
+ const { inValidation = false, isValid = false, item: { streetAddress, city, postalCode, provinceCode, }, } = postalState;
5924
+ const { appConfigState: { localIndex, insuranceType } } = useStoreAppConfig();
4603
5925
  const { dispatchAppModalState } = useStoreAppModal();
4604
5926
  const navigate = reactRouterDom.useNavigate();
4605
- const addressFormValidate = (isRedirect = true) => {
5927
+ const isHomeOwner = insuranceType === mychoiceSdkComponents.InsuranceTypes.Home;
5928
+ const addressFormValidate = async (isRedirect = true) => {
4606
5929
  let formIsValid = false;
4607
- // getPostal(postalCodeFormat(postalState.item.postalCode as string));
4608
5930
  const postalKeys = [
5931
+ 'errorMessage',
5932
+ 'streetAddress',
4609
5933
  'city',
4610
5934
  'postalCode',
4611
5935
  'provinceCode',
4612
5936
  ];
4613
- const addressKeys = [
5937
+ const dwellingKeys = [
4614
5938
  'type',
4615
- 'addressStreet',
4616
5939
  ];
4617
5940
  const errors = [];
4618
- dispatchAddressState({
4619
- type: exports.StoreFormHomeAddressActionTypes.FormHomeAddressValidate,
5941
+ dispatchPostalState({
5942
+ type: exports.StoreFormHomePostalActionTypes.FormHomePostalValidate,
4620
5943
  payload: { inValidation: true },
4621
5944
  });
4622
- Object.keys(addressState).forEach((key) => {
4623
- if (addressKeys.includes(key) && !addressState[key]) {
4624
- errors.push(key);
4625
- }
4626
- // if (key === 'postalCode' && (status === RequestStatusTypes.Error) && addressState[key]) {
4627
- // errors.push(key);
4628
- // }
4629
- if (key === 'addressStreet' && !/\b\s+\b/.test(addressState[key])) {
5945
+ Object.keys(dwellingState).forEach((key) => {
5946
+ if (dwellingKeys.includes(key) && !dwellingState[key]) {
4630
5947
  errors.push(key);
4631
5948
  }
4632
5949
  });
4633
5950
  Object.keys(postalState.item).forEach((key) => {
4634
- if (postalKeys.includes(key) && !postalState.item[key]) {
5951
+ if (postalKeys.includes(key) && !postalState.item[key] && key !== 'errorMessage') {
5952
+ errors.push(key);
5953
+ }
5954
+ if ((key === 'errorMessage') && postalState.item[key]) {
4635
5955
  errors.push(key);
4636
5956
  }
4637
5957
  });
4638
5958
  if (!errors.length) {
4639
- dispatchAddressState({
4640
- type: exports.StoreFormHomeAddressActionTypes.FormHomeAddressValidate,
4641
- payload: { inValidation: false },
4642
- });
4643
- dispatchAddressState({
4644
- type: exports.StoreFormHomeAddressActionTypes.FormHomeAddressValidateSet,
4645
- payload: { isValid: true },
4646
- });
4647
- formIsValid = true;
5959
+ if (isHomeOwner) {
5960
+ try {
5961
+ dispatchAppLoaderState({
5962
+ type: exports.StoreConfigAppLoaderActionTypes.AppLoaderOpen,
5963
+ payload: {
5964
+ description: '',
5965
+ },
5966
+ });
5967
+ await getPlaceByAddress(streetAddress, city, postalCode, provinceCode);
5968
+ dispatchPostalState({
5969
+ type: exports.StoreFormHomePostalActionTypes.FormHomePostalValidate,
5970
+ payload: { inValidation: false },
5971
+ });
5972
+ dispatchPostalState({
5973
+ type: exports.StoreFormHomePostalActionTypes.FormHomePostalValidateSet,
5974
+ payload: { isValid: true },
5975
+ });
5976
+ formIsValid = true;
5977
+ dispatchAppLoaderState({ type: exports.StoreConfigAppLoaderActionTypes.AppLoaderClose });
5978
+ }
5979
+ catch (e) {
5980
+ console.log('dwelling get error:', e);
5981
+ dispatchPostalState({
5982
+ type: exports.StoreFormHomePostalActionTypes.FormHomePostalValidate,
5983
+ payload: { inValidation: false },
5984
+ });
5985
+ dispatchPostalState({
5986
+ type: exports.StoreFormHomePostalActionTypes.FormHomePostalValidateSet,
5987
+ payload: { isValid: true },
5988
+ });
5989
+ formIsValid = true;
5990
+ dispatchAppLoaderState({ type: exports.StoreConfigAppLoaderActionTypes.AppLoaderClose });
5991
+ }
5992
+ }
5993
+ else {
5994
+ dispatchPostalState({
5995
+ type: exports.StoreFormHomePostalActionTypes.FormHomePostalValidate,
5996
+ payload: { inValidation: false },
5997
+ });
5998
+ dispatchPostalState({
5999
+ type: exports.StoreFormHomePostalActionTypes.FormHomePostalValidateSet,
6000
+ payload: { isValid: true },
6001
+ });
6002
+ formIsValid = true;
6003
+ dispatchAppLoaderState({ type: exports.StoreConfigAppLoaderActionTypes.AppLoaderClose });
6004
+ }
4648
6005
  }
4649
6006
  else {
4650
6007
  const element = document.getElementsByName(errors[0])[0];
@@ -4655,13 +6012,13 @@ const useValidationAddress = () => {
4655
6012
  title: 'Please enter missing values of required fields',
4656
6013
  },
4657
6014
  });
4658
- dispatchAddressState({
4659
- type: exports.StoreFormHomeAddressActionTypes.FormHomeAddressValidateSet,
6015
+ dispatchPostalState({
6016
+ type: exports.StoreFormHomePostalActionTypes.FormHomePostalValidateSet,
4660
6017
  payload: { isValid: false },
4661
6018
  });
4662
6019
  }
4663
6020
  if (errors.length && isRedirect) {
4664
- navigate(`/${appConfigState.localIndex || mychoiceSdkComponents.defaultLocalIndex}/home/address`);
6021
+ navigate(`/${localIndex || mychoiceSdkComponents.defaultLocalIndex}/${insuranceType}`);
4665
6022
  }
4666
6023
  return formIsValid;
4667
6024
  };
@@ -4677,8 +6034,9 @@ const useValidationApplicant = () => {
4677
6034
  const { discountState } = useStoreFormHomeDiscount();
4678
6035
  const { dwellingState } = useStoreFormHomeDwelling();
4679
6036
  const { inValidation: applicantFormIsInValidation = false, isValid: applicantFormIsValid = false, } = applicantState;
4680
- const { appConfigState } = useStoreAppConfig();
6037
+ const { appConfigState: { localIndex, insuranceType } } = useStoreAppConfig();
4681
6038
  const { dispatchAppModalState } = useStoreAppModal();
6039
+ // const flowIsPaused: boolean = insuranceClaimList?.length > 2 || insuranceCancellationList?.length > 2;
4682
6040
  const navigate = reactRouterDom.useNavigate();
4683
6041
  const applicantFormValidate = (isRedirect = true) => {
4684
6042
  let formIsValid = false;
@@ -4691,13 +6049,14 @@ const useValidationApplicant = () => {
4691
6049
  'policyStartMonth',
4692
6050
  'policyStartYear',
4693
6051
  ];
6052
+ const applicantKeys = [
6053
+ 'firstName',
6054
+ 'insuredCurrent',
6055
+ 'insuredBefore',
6056
+ ];
4694
6057
  const objectKeys = [
4695
- 'quoterInfo',
4696
6058
  'insured',
4697
6059
  ];
4698
- const quoterInfoKeys = [
4699
- 'firstName',
4700
- ];
4701
6060
  const insuredKeys = [
4702
6061
  'birthDay',
4703
6062
  'birthMonth',
@@ -4716,6 +6075,27 @@ const useValidationApplicant = () => {
4716
6075
  });
4717
6076
  // === check errors in applicant state ===
4718
6077
  Object.keys(applicantState).forEach((key) => {
6078
+ if (applicantKeys.includes(key)) {
6079
+ if (key === 'insuredCurrent') {
6080
+ if (applicantState[key] === undefined) {
6081
+ errors.push(key);
6082
+ }
6083
+ else if (applicantState[key]) { // insuredCurrent: true
6084
+ if (!applicantState.insured.dateInsuredCurrent) {
6085
+ errors.push('dateInsuredCurrent');
6086
+ }
6087
+ if (!applicantState.insured.dateInsuredSince) {
6088
+ errors.push('dateInsuredSince');
6089
+ }
6090
+ }
6091
+ else if (applicantState.insuredBefore === undefined) {
6092
+ errors.push('insuredBefore');
6093
+ }
6094
+ }
6095
+ if (key === 'firstName' && !applicantState[key]) {
6096
+ errors.push(key);
6097
+ }
6098
+ }
4719
6099
  if (objectKeys.includes(key)) {
4720
6100
  Object.keys(applicantState[key]).forEach((objectKey) => {
4721
6101
  if (!applicantState[key][objectKey]) {
@@ -4724,23 +6104,23 @@ const useValidationApplicant = () => {
4724
6104
  errors.push(objectKey);
4725
6105
  }
4726
6106
  }
4727
- if (quoterInfoKeys.includes(objectKey)) {
4728
- errors.push(objectKey);
4729
- }
4730
6107
  }
4731
6108
  });
4732
6109
  }
4733
- if (arrayKeys.includes(key)) {
4734
- applicantState[key].forEach((listItem, listItemIndex) => {
4735
- Object.keys(listItem).forEach((objectKey) => {
4736
- if (!listItem[objectKey] && objectKey.indexOf('Date') === -1) {
4737
- if (!((!applicantState.insuranceCancellation && key === 'insuranceCancellationList')
4738
- || (!applicantState.insuranceClaim && key === 'insuranceClaimList'))) {
4739
- errors.push(`${objectKey}-${listItemIndex}`);
6110
+ if (applicantState.insuredCurrent || applicantState.insuredBefore) {
6111
+ if (arrayKeys.includes(key)) {
6112
+ applicantState[key].forEach((listItem, listItemIndex) => {
6113
+ Object.keys(listItem).forEach((objectKey) => {
6114
+ const canSkipFields = ['date', 'type'].includes(objectKey);
6115
+ if (!listItem[objectKey] && objectKey.indexOf('Date') === -1 && !canSkipFields) {
6116
+ if (!((!applicantState.insuranceCancellation && key === 'insuranceCancellationList')
6117
+ || (!applicantState.insuranceClaim && key === 'insuranceClaimList'))) {
6118
+ errors.push(`${objectKey}-${listItemIndex}`);
6119
+ }
4740
6120
  }
4741
- }
6121
+ });
4742
6122
  });
4743
- });
6123
+ }
4744
6124
  }
4745
6125
  });
4746
6126
  // === check errors in discount state ===
@@ -4781,7 +6161,7 @@ const useValidationApplicant = () => {
4781
6161
  });
4782
6162
  }
4783
6163
  if (errors.length && isRedirect) {
4784
- navigate(`/${appConfigState.localIndex || mychoiceSdkComponents.defaultLocalIndex}/home/applicant`);
6164
+ navigate(`/${localIndex || mychoiceSdkComponents.defaultLocalIndex}/${insuranceType}/applicant`);
4785
6165
  }
4786
6166
  return formIsValid;
4787
6167
  };
@@ -4795,7 +6175,7 @@ const useValidationApplicant = () => {
4795
6175
  const useValidationDwelling = () => {
4796
6176
  const { dwellingState, dispatchDwellingState } = useStoreFormHomeDwelling();
4797
6177
  const { inValidation: dwellingFormIsInValidation = false, isValid: dwellingFormIsValid = false, } = dwellingState;
4798
- const { appConfigState } = useStoreAppConfig();
6178
+ const { appConfigState: { localIndex, insuranceType } } = useStoreAppConfig();
4799
6179
  const { dispatchAppModalState } = useStoreAppModal();
4800
6180
  const navigate = reactRouterDom.useNavigate();
4801
6181
  const dwellingFormValidate = (isRedirect = true) => {
@@ -4803,7 +6183,7 @@ const useValidationDwelling = () => {
4803
6183
  const keys = [
4804
6184
  'builtYear',
4805
6185
  'livingArea',
4806
- 'roofReplaceYear',
6186
+ 'roofReplacedYear',
4807
6187
  'fireHallDistance',
4808
6188
  'fireHydrantDistance',
4809
6189
  'buildingStructure',
@@ -4840,7 +6220,7 @@ const useValidationDwelling = () => {
4840
6220
  }
4841
6221
  else {
4842
6222
  if (isRedirect) {
4843
- navigate(`/${appConfigState.localIndex || mychoiceSdkComponents.defaultLocalIndex}/home/property`);
6223
+ navigate(`/${localIndex || mychoiceSdkComponents.defaultLocalIndex}/${insuranceType}/property`);
4844
6224
  }
4845
6225
  const element = document.getElementsByName(errors[0])[0];
4846
6226
  element?.scrollIntoView({ block: 'center', behavior: 'smooth' });
@@ -4866,18 +6246,17 @@ const useValidationDwelling = () => {
4866
6246
 
4867
6247
  const useValidationHomeDiscount = () => {
4868
6248
  const { discountState, dispatchDiscountState } = useStoreFormHomeDiscount();
4869
- const { applicantState } = useStoreFormHomeApplicantBase();
4870
6249
  const { dwellingState } = useStoreFormHomeDwelling();
4871
- const { inValidation = false, isValid = false, } = discountState;
4872
- const { appConfigState } = useStoreAppConfig();
6250
+ const { inValidation = false, isValid = false, quoterInfo, } = discountState;
6251
+ const { appConfigState: { localIndex, insuranceType } } = useStoreAppConfig();
4873
6252
  const { dispatchAppModalState } = useStoreAppModal();
4874
6253
  const navigate = reactRouterDom.useNavigate();
4875
- const homeDiscountFormValidate = (isRedirect = true) => {
6254
+ const homeDiscountFormValidate = (isRedirect = true, requestFn) => {
4876
6255
  let formIsValid = false;
4877
6256
  // const dwellingKeys = [
4878
- // 'mortgageCount',
6257
+ // 'mortgagesCount',
4879
6258
  // ];
4880
- const applicantKeys = [
6259
+ const discountKeys = [
4881
6260
  'firstName',
4882
6261
  'lastName',
4883
6262
  'phone',
@@ -4887,12 +6266,15 @@ const useValidationHomeDiscount = () => {
4887
6266
  type: exports.StoreFormHomeDiscountActionTypes.FormHomeDiscountValidate,
4888
6267
  payload: { inValidation: true },
4889
6268
  });
4890
- if (!dwellingState.mortgageCount) {
4891
- errors.push('mortgageCount');
6269
+ if (!dwellingState.mortgagesCount) {
6270
+ errors.push('mortgagesCount');
6271
+ }
6272
+ if (!dwellingState.fireExtinguishersCount) {
6273
+ errors.push('fireExtinguishersCount');
4892
6274
  }
4893
- if (applicantState.quoterInfo) {
4894
- Object.keys(applicantState.quoterInfo).forEach((key) => {
4895
- if (applicantKeys.includes(key) && !applicantState.quoterInfo?.[key]) {
6275
+ if (quoterInfo) {
6276
+ Object.keys(quoterInfo).forEach((key) => {
6277
+ if (discountKeys.includes(key) && !quoterInfo?.[key]) {
4896
6278
  errors.push(key);
4897
6279
  }
4898
6280
  });
@@ -4909,6 +6291,9 @@ const useValidationHomeDiscount = () => {
4909
6291
  type: exports.StoreFormHomeDiscountActionTypes.FormHomeDiscountValidateSet,
4910
6292
  payload: { isValid: true },
4911
6293
  });
6294
+ if (requestFn) {
6295
+ requestFn();
6296
+ }
4912
6297
  formIsValid = true;
4913
6298
  }
4914
6299
  else {
@@ -4925,8 +6310,8 @@ const useValidationHomeDiscount = () => {
4925
6310
  payload: { isValid: false },
4926
6311
  });
4927
6312
  }
4928
- if (errors.length && isRedirect) {
4929
- navigate(`/${appConfigState.localIndex || mychoiceSdkComponents.defaultLocalIndex}/home/discount`);
6313
+ if (errors.length && isRedirect && (window.location.pathname !== `/${localIndex || mychoiceSdkComponents.defaultLocalIndex}/${insuranceType}/discount`)) {
6314
+ navigate(`/${localIndex || mychoiceSdkComponents.defaultLocalIndex}/${insuranceType}/discount`);
4930
6315
  }
4931
6316
  return formIsValid;
4932
6317
  };
@@ -4937,14 +6322,160 @@ const useValidationHomeDiscount = () => {
4937
6322
  };
4938
6323
  };
4939
6324
 
6325
+ const useValidationCoverage = () => {
6326
+ const { coverageState, dispatchCoverageState } = useStoreFormLifeCoverage();
6327
+ const { inValidation = false, isValid = false, } = coverageState;
6328
+ const { appConfigState } = useStoreAppConfig();
6329
+ const { dispatchAppModalState } = useStoreAppModal();
6330
+ const navigate = reactRouterDom.useNavigate();
6331
+ const coverageFormValidate = (isRedirect = true) => {
6332
+ let formIsValid = false;
6333
+ const keys = [
6334
+ 'province',
6335
+ 'type',
6336
+ 'coverage',
6337
+ ];
6338
+ const errors = [];
6339
+ dispatchCoverageState({
6340
+ type: exports.StoreFormLifeCoverageActionTypes.FormLifeCoverageValidate,
6341
+ payload: { inValidation: true },
6342
+ });
6343
+ Object.keys(coverageState).forEach((key) => {
6344
+ if (keys.includes(key) && !coverageState[key]) {
6345
+ errors.push(key);
6346
+ }
6347
+ });
6348
+ if (!errors.length) {
6349
+ dispatchCoverageState({
6350
+ type: exports.StoreFormLifeCoverageActionTypes.FormLifeCoverageValidate,
6351
+ payload: { inValidation: false },
6352
+ });
6353
+ dispatchCoverageState({
6354
+ type: exports.StoreFormLifeCoverageActionTypes.FormLifeCoverageValidateSet,
6355
+ payload: { isValid: true },
6356
+ });
6357
+ formIsValid = true;
6358
+ }
6359
+ else {
6360
+ const element = document.getElementsByName(errors[0])[0];
6361
+ element?.scrollIntoView({ block: 'center', behavior: 'smooth' });
6362
+ dispatchAppModalState({
6363
+ type: exports.StoreConfigAppModalActionTypes.AppModalMessageModal,
6364
+ payload: {
6365
+ title: 'Please enter missing values of required fields',
6366
+ },
6367
+ });
6368
+ dispatchCoverageState({
6369
+ type: exports.StoreFormLifeCoverageActionTypes.FormLifeCoverageValidateSet,
6370
+ payload: { isValid: false },
6371
+ });
6372
+ }
6373
+ if (errors.length && isRedirect) {
6374
+ navigate(`/${appConfigState.localIndex || mychoiceSdkComponents.defaultLocalIndex}/life/coverage`);
6375
+ }
6376
+ return formIsValid;
6377
+ };
6378
+ return {
6379
+ coverageFormValidate,
6380
+ coverageFormIsInValidation: inValidation,
6381
+ coverageFormIsValid: isValid,
6382
+ };
6383
+ };
6384
+
6385
+ const useValidationLifeApplicant = () => {
6386
+ const { applicantState, dispatchApplicantState } = useStoreFormLifeApplicant();
6387
+ const { quoterInfo, inValidation: applicantFormIsInValidation = false, isValid: applicantFormIsValid = false, } = applicantState;
6388
+ const { appConfigState } = useStoreAppConfig();
6389
+ const { dispatchAppModalState } = useStoreAppModal();
6390
+ const navigate = reactRouterDom.useNavigate();
6391
+ const applicantFormValidate = (isRedirect = true, requestFn) => {
6392
+ let formIsValid = false;
6393
+ const keys = [
6394
+ 'birthDay',
6395
+ 'birthMonth',
6396
+ 'birthYear',
6397
+ 'gender',
6398
+ ];
6399
+ const quoterInfoKeys = [
6400
+ 'firstName',
6401
+ 'lastName',
6402
+ 'phone',
6403
+ ];
6404
+ const errors = [];
6405
+ dispatchApplicantState({
6406
+ type: exports.StoreFormLifeApplicantActionTypes.FormLifeApplicantValidate,
6407
+ payload: { inValidation: true },
6408
+ });
6409
+ Object.keys(applicantState).forEach((key) => {
6410
+ if (keys.includes(key) && !applicantState[key]) {
6411
+ errors.push(key);
6412
+ }
6413
+ });
6414
+ if (applicantState.emailTo.emailStatus !== mychoiceSdkComponents.ValidationStatusTypes.Approved) {
6415
+ errors.push('email');
6416
+ }
6417
+ if (quoterInfo) {
6418
+ Object.keys(quoterInfo).forEach((key) => {
6419
+ if (quoterInfoKeys.includes(key) && !quoterInfo?.[key]) {
6420
+ errors.push(key);
6421
+ }
6422
+ });
6423
+ }
6424
+ if (!errors.length) {
6425
+ dispatchApplicantState({
6426
+ type: exports.StoreFormLifeApplicantActionTypes.FormLifeApplicantValidateSet,
6427
+ payload: { isValid: true },
6428
+ });
6429
+ dispatchApplicantState({
6430
+ type: exports.StoreFormLifeApplicantActionTypes.FormLifeApplicantValidate,
6431
+ payload: { inValidation: false },
6432
+ });
6433
+ if (requestFn) {
6434
+ requestFn();
6435
+ }
6436
+ formIsValid = true;
6437
+ }
6438
+ else {
6439
+ const element = document.getElementsByName(errors[0])[0];
6440
+ element?.scrollIntoView({ block: 'center', behavior: 'smooth' });
6441
+ dispatchAppModalState({
6442
+ type: exports.StoreConfigAppModalActionTypes.AppModalMessageModal,
6443
+ payload: {
6444
+ title: 'Please enter missing values of required fields',
6445
+ },
6446
+ });
6447
+ dispatchApplicantState({
6448
+ type: exports.StoreFormLifeApplicantActionTypes.FormLifeApplicantValidateSet,
6449
+ payload: { isValid: false },
6450
+ });
6451
+ }
6452
+ if (errors.length && isRedirect) {
6453
+ navigate(`/${appConfigState.localIndex || mychoiceSdkComponents.defaultLocalIndex}/life/applicant`);
6454
+ }
6455
+ return formIsValid;
6456
+ };
6457
+ return {
6458
+ applicantFormValidate,
6459
+ applicantFormIsInValidation,
6460
+ applicantFormIsValid,
6461
+ };
6462
+ };
6463
+
6464
+ exports.CarQuoteDataHandler = CarQuoteDataHandler;
4940
6465
  exports.ClearFormDataHandler = ClearFormDataHandler;
4941
- exports.QuoteDataHandler = QuoteDataHandler;
6466
+ exports.HomeQuoteDataHandler = HomeQuoteDataHandler;
6467
+ exports.LifeQuoteDataHandler = LifeQuoteDataHandler;
4942
6468
  exports.StoreProvider = StoreProvider;
4943
6469
  exports.addDayToDate = addDayToDate;
4944
6470
  exports.configStateReducer = configStateReducer;
4945
6471
  exports.differenceInHoursFromNow = differenceInHoursFromNow;
4946
6472
  exports.formCarReducer = formCarReducer;
6473
+ exports.formCondoDwellingInitialState = formCondoDwellingInitialState;
6474
+ exports.formHomeDwellingInitialState = formHomeDwellingInitialState;
4947
6475
  exports.formHomeReducer = formHomeReducer;
6476
+ exports.formLifeReducer = formLifeReducer;
6477
+ exports.formTenantDwellingInitialState = formTenantDwellingInitialState;
6478
+ exports.getDwellingInitialState = getDwellingInitialState;
4948
6479
  exports.globalStateReducer = globalStateReducer;
4949
6480
  exports.initHttpResponse = initHttpResponse;
4950
6481
  exports.reducers = reducers;
@@ -4952,9 +6483,12 @@ exports.token = default_1;
4952
6483
  exports.useHandlerAuth = useHandlerAuth;
4953
6484
  exports.useHandlerCarMake = useHandlerCarMake;
4954
6485
  exports.useHandlerCarModel = useHandlerCarModel;
6486
+ exports.useHandlerCarQuoterEmail = useHandlerCarQuoterEmail;
6487
+ exports.useHandlerHomeQuoterEmail = useHandlerHomeQuoterEmail;
6488
+ exports.useHandlerLifeQuoterEmail = useHandlerLifeQuoterEmail;
4955
6489
  exports.useHandlerPartner = useHandlerPartner;
4956
6490
  exports.useHandlerPostal = useHandlerPostal;
4957
- exports.useHandlerQuoterEmail = useHandlerQuoterEmail;
6491
+ exports.useProvince = useProvince;
4958
6492
  exports.useStoreAppConfig = useStoreAppConfig;
4959
6493
  exports.useStoreAppDevice = useStoreAppDevice;
4960
6494
  exports.useStoreAppLoader = useStoreAppLoader;
@@ -4978,7 +6512,6 @@ exports.useStoreFormCarDriverTicket = useStoreFormCarDriverTicket;
4978
6512
  exports.useStoreFormCarPostal = useStoreFormCarPostal;
4979
6513
  exports.useStoreFormCarQuote = useStoreFormCarQuote;
4980
6514
  exports.useStoreFormCarVehicle = useStoreFormCarVehicle;
4981
- exports.useStoreFormHomeAddress = useStoreFormHomeAddress;
4982
6515
  exports.useStoreFormHomeApplicantBase = useStoreFormHomeApplicantBase;
4983
6516
  exports.useStoreFormHomeApplicantCancellation = useStoreFormHomeApplicantCancellation;
4984
6517
  exports.useStoreFormHomeApplicantClaim = useStoreFormHomeApplicantClaim;
@@ -4987,12 +6520,19 @@ exports.useStoreFormHomeApplicantInsurance = useStoreFormHomeApplicantInsurance;
4987
6520
  exports.useStoreFormHomeDiscount = useStoreFormHomeDiscount;
4988
6521
  exports.useStoreFormHomeDwelling = useStoreFormHomeDwelling;
4989
6522
  exports.useStoreFormHomePostal = useStoreFormHomePostal;
6523
+ exports.useStoreFormHomeQuote = useStoreFormHomeQuote;
6524
+ exports.useStoreFormLifeApplicant = useStoreFormLifeApplicant;
6525
+ exports.useStoreFormLifeCoverage = useStoreFormLifeCoverage;
6526
+ exports.useStoreFormLifePostal = useStoreFormLifePostal;
6527
+ exports.useStoreFormLifeQuote = useStoreFormLifeQuote;
4990
6528
  exports.useStorePartner = useStorePartner;
4991
6529
  exports.useValidationAddress = useValidationAddress;
4992
6530
  exports.useValidationApplicant = useValidationApplicant;
4993
6531
  exports.useValidationCarDiscount = useValidationCarDiscount;
6532
+ exports.useValidationCoverage = useValidationCoverage;
4994
6533
  exports.useValidationDriver = useValidationDriver;
4995
6534
  exports.useValidationDwelling = useValidationDwelling;
4996
6535
  exports.useValidationHomeDiscount = useValidationHomeDiscount;
6536
+ exports.useValidationLifeApplicant = useValidationLifeApplicant;
4997
6537
  exports.useValidationVehicle = useValidationVehicle;
4998
6538
  //# sourceMappingURL=index.js.map