@daffodil/auth 0.47.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 (380) hide show
  1. package/README.md +14 -0
  2. package/daffodil-auth.d.ts +5 -0
  3. package/driver/daffodil-auth-driver.d.ts +5 -0
  4. package/driver/errors/authentication-failed.d.ts +6 -0
  5. package/driver/errors/codes.enum.d.ts +6 -0
  6. package/driver/errors/invalid-api-response.d.ts +6 -0
  7. package/driver/errors/map.d.ts +13 -0
  8. package/driver/errors/public_api.d.ts +6 -0
  9. package/driver/errors/registration-failed.d.ts +9 -0
  10. package/driver/errors/unauthorized.d.ts +6 -0
  11. package/driver/in-memory/backend/auth.service.d.ts +22 -0
  12. package/driver/in-memory/daffodil-auth-driver-in-memory.d.ts +5 -0
  13. package/driver/in-memory/drivers/auth/auth.service.d.ts +15 -0
  14. package/driver/in-memory/drivers/auth-driver.module.d.ts +9 -0
  15. package/driver/in-memory/drivers/login/login.service.d.ts +17 -0
  16. package/driver/in-memory/drivers/public_api.d.ts +4 -0
  17. package/driver/in-memory/drivers/register/register.service.d.ts +19 -0
  18. package/driver/in-memory/drivers/reset-password/service.d.ts +20 -0
  19. package/driver/in-memory/index.d.ts +1 -0
  20. package/driver/in-memory/models/db-customer.type.d.ts +8 -0
  21. package/driver/in-memory/package.json +10 -0
  22. package/driver/in-memory/public_api.d.ts +2 -0
  23. package/driver/index.d.ts +1 -0
  24. package/driver/interfaces/auth-service.interface.d.ts +9 -0
  25. package/driver/interfaces/login-service.interface.d.ts +16 -0
  26. package/driver/interfaces/public_api.d.ts +4 -0
  27. package/driver/interfaces/register-service.interface.d.ts +19 -0
  28. package/driver/interfaces/reset-password-service.interface.d.ts +18 -0
  29. package/driver/magento/apollo-bearer-token-link-generator.d.ts +16 -0
  30. package/driver/magento/auth-driver.module.d.ts +9 -0
  31. package/driver/magento/auth.service.d.ts +14 -0
  32. package/driver/magento/daffodil-auth-driver-magento.d.ts +5 -0
  33. package/driver/magento/errors/codes.d.ts +5 -0
  34. package/driver/magento/errors/map.d.ts +2 -0
  35. package/driver/magento/errors/transform.d.ts +1 -0
  36. package/driver/magento/index.d.ts +1 -0
  37. package/driver/magento/login.service.d.ts +18 -0
  38. package/driver/magento/models/public_api.d.ts +4 -0
  39. package/driver/magento/models/response/auth.d.ts +3 -0
  40. package/driver/magento/models/response/register.type.d.ts +7 -0
  41. package/driver/magento/models/response/reset-password.type.d.ts +3 -0
  42. package/driver/magento/models/response/send-reset-email.type.d.ts +3 -0
  43. package/driver/magento/package.json +10 -0
  44. package/driver/magento/public_api.d.ts +8 -0
  45. package/driver/magento/queries/check-token.d.ts +1 -0
  46. package/driver/magento/queries/create-customer.d.ts +1 -0
  47. package/driver/magento/queries/generate-token.d.ts +1 -0
  48. package/driver/magento/queries/public_api.d.ts +7 -0
  49. package/driver/magento/queries/reset-password.d.ts +1 -0
  50. package/driver/magento/queries/responses/check-token-response.d.ts +5 -0
  51. package/driver/magento/queries/responses/generate-token-response.d.ts +4 -0
  52. package/driver/magento/queries/responses/public_api.d.ts +3 -0
  53. package/driver/magento/queries/responses/revoke-customer-token-response.d.ts +5 -0
  54. package/driver/magento/queries/revoke-customer-token.d.ts +1 -0
  55. package/driver/magento/queries/send-reset-email.d.ts +1 -0
  56. package/driver/magento/register.service.d.ts +18 -0
  57. package/driver/magento/reset-password.service.d.ts +19 -0
  58. package/driver/magento/transforms/auth-transformer.service.d.ts +16 -0
  59. package/driver/magento/validators/check-token.d.ts +3 -0
  60. package/driver/magento/validators/generate-token.d.ts +3 -0
  61. package/driver/magento/validators/public_api.d.ts +5 -0
  62. package/driver/magento/validators/reset-password.d.ts +3 -0
  63. package/driver/magento/validators/revoke-token.d.ts +3 -0
  64. package/driver/magento/validators/send-reset-email.d.ts +3 -0
  65. package/driver/package.json +10 -0
  66. package/driver/public_api.d.ts +2 -0
  67. package/driver/testing/daffodil-auth-driver-testing.d.ts +5 -0
  68. package/driver/testing/drivers/auth/auth.service.d.ts +11 -0
  69. package/driver/testing/drivers/auth-driver.module.d.ts +9 -0
  70. package/driver/testing/drivers/login/login.service.d.ts +16 -0
  71. package/driver/testing/drivers/public_api.d.ts +4 -0
  72. package/driver/testing/drivers/register/register.service.d.ts +16 -0
  73. package/driver/testing/drivers/reset-password/service.d.ts +17 -0
  74. package/driver/testing/index.d.ts +1 -0
  75. package/driver/testing/package.json +10 -0
  76. package/driver/testing/public_api.d.ts +1 -0
  77. package/esm2020/daffodil-auth.mjs +5 -0
  78. package/esm2020/driver/daffodil-auth-driver.mjs +5 -0
  79. package/esm2020/driver/errors/authentication-failed.mjs +10 -0
  80. package/esm2020/driver/errors/codes.enum.mjs +8 -0
  81. package/esm2020/driver/errors/invalid-api-response.mjs +10 -0
  82. package/esm2020/driver/errors/map.mjs +15 -0
  83. package/esm2020/driver/errors/public_api.mjs +7 -0
  84. package/esm2020/driver/errors/registration-failed.mjs +13 -0
  85. package/esm2020/driver/errors/unauthorized.mjs +10 -0
  86. package/esm2020/driver/in-memory/backend/auth.service.mjs +109 -0
  87. package/esm2020/driver/in-memory/daffodil-auth-driver-in-memory.mjs +5 -0
  88. package/esm2020/driver/in-memory/drivers/auth/auth.service.mjs +26 -0
  89. package/esm2020/driver/in-memory/drivers/auth-driver.module.mjs +47 -0
  90. package/esm2020/driver/in-memory/drivers/login/login.service.mjs +30 -0
  91. package/esm2020/driver/in-memory/drivers/public_api.mjs +5 -0
  92. package/esm2020/driver/in-memory/drivers/register/register.service.mjs +32 -0
  93. package/esm2020/driver/in-memory/drivers/reset-password/service.mjs +35 -0
  94. package/esm2020/driver/in-memory/index.mjs +2 -0
  95. package/esm2020/driver/in-memory/models/db-customer.type.mjs +2 -0
  96. package/esm2020/driver/in-memory/public_api.mjs +3 -0
  97. package/esm2020/driver/index.mjs +2 -0
  98. package/esm2020/driver/interfaces/auth-service.interface.mjs +3 -0
  99. package/esm2020/driver/interfaces/login-service.interface.mjs +3 -0
  100. package/esm2020/driver/interfaces/public_api.mjs +5 -0
  101. package/esm2020/driver/interfaces/register-service.interface.mjs +3 -0
  102. package/esm2020/driver/interfaces/reset-password-service.interface.mjs +3 -0
  103. package/esm2020/driver/magento/apollo-bearer-token-link-generator.mjs +38 -0
  104. package/esm2020/driver/magento/auth-driver.module.mjs +47 -0
  105. package/esm2020/driver/magento/auth.service.mjs +29 -0
  106. package/esm2020/driver/magento/daffodil-auth-driver-magento.mjs +5 -0
  107. package/esm2020/driver/magento/errors/codes.mjs +7 -0
  108. package/esm2020/driver/magento/errors/map.mjs +9 -0
  109. package/esm2020/driver/magento/errors/transform.mjs +4 -0
  110. package/esm2020/driver/magento/index.mjs +2 -0
  111. package/esm2020/driver/magento/login.service.mjs +41 -0
  112. package/esm2020/driver/magento/models/public_api.mjs +2 -0
  113. package/esm2020/driver/magento/models/response/auth.mjs +2 -0
  114. package/esm2020/driver/magento/models/response/register.type.mjs +2 -0
  115. package/esm2020/driver/magento/models/response/reset-password.type.mjs +2 -0
  116. package/esm2020/driver/magento/models/response/send-reset-email.type.mjs +2 -0
  117. package/esm2020/driver/magento/public_api.mjs +9 -0
  118. package/esm2020/driver/magento/queries/check-token.mjs +9 -0
  119. package/esm2020/driver/magento/queries/create-customer.mjs +21 -0
  120. package/esm2020/driver/magento/queries/generate-token.mjs +12 -0
  121. package/esm2020/driver/magento/queries/public_api.mjs +8 -0
  122. package/esm2020/driver/magento/queries/reset-password.mjs +11 -0
  123. package/esm2020/driver/magento/queries/responses/check-token-response.mjs +2 -0
  124. package/esm2020/driver/magento/queries/responses/generate-token-response.mjs +2 -0
  125. package/esm2020/driver/magento/queries/responses/public_api.mjs +2 -0
  126. package/esm2020/driver/magento/queries/responses/revoke-customer-token-response.mjs +2 -0
  127. package/esm2020/driver/magento/queries/revoke-customer-token.mjs +9 -0
  128. package/esm2020/driver/magento/queries/send-reset-email.mjs +9 -0
  129. package/esm2020/driver/magento/register.service.mjs +48 -0
  130. package/esm2020/driver/magento/reset-password.service.mjs +50 -0
  131. package/esm2020/driver/magento/transforms/auth-transformer.service.mjs +26 -0
  132. package/esm2020/driver/magento/validators/check-token.mjs +10 -0
  133. package/esm2020/driver/magento/validators/generate-token.mjs +10 -0
  134. package/esm2020/driver/magento/validators/public_api.mjs +6 -0
  135. package/esm2020/driver/magento/validators/reset-password.mjs +10 -0
  136. package/esm2020/driver/magento/validators/revoke-token.mjs +10 -0
  137. package/esm2020/driver/magento/validators/send-reset-email.mjs +10 -0
  138. package/esm2020/driver/public_api.mjs +3 -0
  139. package/esm2020/driver/testing/daffodil-auth-driver-testing.mjs +5 -0
  140. package/esm2020/driver/testing/drivers/auth/auth.service.mjs +20 -0
  141. package/esm2020/driver/testing/drivers/auth-driver.module.mjs +47 -0
  142. package/esm2020/driver/testing/drivers/login/login.service.mjs +28 -0
  143. package/esm2020/driver/testing/drivers/public_api.mjs +5 -0
  144. package/esm2020/driver/testing/drivers/register/register.service.mjs +28 -0
  145. package/esm2020/driver/testing/drivers/reset-password/service.mjs +31 -0
  146. package/esm2020/driver/testing/index.mjs +2 -0
  147. package/esm2020/driver/testing/public_api.mjs +2 -0
  148. package/esm2020/index.mjs +2 -0
  149. package/esm2020/injection-tokens/error-matcher.token.mjs +8 -0
  150. package/esm2020/injection-tokens/public_api.mjs +2 -0
  151. package/esm2020/models/account-registration.mjs +2 -0
  152. package/esm2020/models/auth-token.mjs +2 -0
  153. package/esm2020/models/login-info.mjs +2 -0
  154. package/esm2020/models/public_api.mjs +2 -0
  155. package/esm2020/models/reset-password-info.type.mjs +2 -0
  156. package/esm2020/public_api.mjs +4 -0
  157. package/esm2020/routing/config/default.mjs +4 -0
  158. package/esm2020/routing/config/interface.mjs +2 -0
  159. package/esm2020/routing/config/public_api.mjs +3 -0
  160. package/esm2020/routing/config/token.mjs +9 -0
  161. package/esm2020/routing/daffodil-auth-routing.mjs +5 -0
  162. package/esm2020/routing/guards/guest-only-guard-redirect.token.mjs +3 -0
  163. package/esm2020/routing/guards/guest-only.guard.mjs +42 -0
  164. package/esm2020/routing/guards/member-only-guard-redirect.token.mjs +3 -0
  165. package/esm2020/routing/guards/member-only.guard.mjs +42 -0
  166. package/esm2020/routing/guards/public_api.mjs +6 -0
  167. package/esm2020/routing/guards/reset-password.guard.mjs +32 -0
  168. package/esm2020/routing/index.mjs +2 -0
  169. package/esm2020/routing/module.mjs +35 -0
  170. package/esm2020/routing/public_api.mjs +4 -0
  171. package/esm2020/state/actions/auth.actions.mjs +75 -0
  172. package/esm2020/state/actions/login.actions.mjs +70 -0
  173. package/esm2020/state/actions/public_api.mjs +5 -0
  174. package/esm2020/state/actions/register.actions.mjs +41 -0
  175. package/esm2020/state/actions/reset-password.actions.mjs +79 -0
  176. package/esm2020/state/auth-state.module.mjs +48 -0
  177. package/esm2020/state/config/default.mjs +5 -0
  178. package/esm2020/state/config/public_api.mjs +3 -0
  179. package/esm2020/state/config/token.mjs +8 -0
  180. package/esm2020/state/config/type.mjs +2 -0
  181. package/esm2020/state/daffodil-auth-state.mjs +5 -0
  182. package/esm2020/state/effects/auth.effects.mjs +45 -0
  183. package/esm2020/state/effects/login.effects.mjs +37 -0
  184. package/esm2020/state/effects/register.effects.mjs +31 -0
  185. package/esm2020/state/effects/reset-password.effects.mjs +32 -0
  186. package/esm2020/state/facades/auth/facade.interface.mjs +2 -0
  187. package/esm2020/state/facades/auth/facade.mjs +28 -0
  188. package/esm2020/state/facades/auth/public_api.mjs +2 -0
  189. package/esm2020/state/facades/login/facade.interface.mjs +2 -0
  190. package/esm2020/state/facades/login/facade.mjs +28 -0
  191. package/esm2020/state/facades/login/public_api.mjs +2 -0
  192. package/esm2020/state/facades/public_api.mjs +5 -0
  193. package/esm2020/state/facades/register/facade.interface.mjs +2 -0
  194. package/esm2020/state/facades/register/facade.mjs +28 -0
  195. package/esm2020/state/facades/register/public_api.mjs +2 -0
  196. package/esm2020/state/facades/reset-password/facade.interface.mjs +2 -0
  197. package/esm2020/state/facades/reset-password/facade.mjs +29 -0
  198. package/esm2020/state/facades/reset-password/public_api.mjs +2 -0
  199. package/esm2020/state/index.mjs +2 -0
  200. package/esm2020/state/public_api.mjs +7 -0
  201. package/esm2020/state/reducers/auth/auth-initial-state.mjs +5 -0
  202. package/esm2020/state/reducers/auth/auth-reducer-state.interface.mjs +2 -0
  203. package/esm2020/state/reducers/auth/auth.reducer.mjs +25 -0
  204. package/esm2020/state/reducers/auth/public_api.mjs +3 -0
  205. package/esm2020/state/reducers/auth-feature-state.interface.mjs +2 -0
  206. package/esm2020/state/reducers/auth-reducers.mjs +11 -0
  207. package/esm2020/state/reducers/auth-store-feature-key.mjs +2 -0
  208. package/esm2020/state/reducers/login/login-initial-state.mjs +5 -0
  209. package/esm2020/state/reducers/login/login-reducer-state.interface.mjs +2 -0
  210. package/esm2020/state/reducers/login/login.reducer.mjs +28 -0
  211. package/esm2020/state/reducers/login/public_api.mjs +3 -0
  212. package/esm2020/state/reducers/public_api.mjs +7 -0
  213. package/esm2020/state/reducers/register/public_api.mjs +3 -0
  214. package/esm2020/state/reducers/register/register-initial-state.mjs +5 -0
  215. package/esm2020/state/reducers/register/register-reducer-state.interface.mjs +2 -0
  216. package/esm2020/state/reducers/register/register.reducer.mjs +25 -0
  217. package/esm2020/state/reducers/reset-password/initial-state.mjs +6 -0
  218. package/esm2020/state/reducers/reset-password/public_api.mjs +3 -0
  219. package/esm2020/state/reducers/reset-password/reducer.mjs +33 -0
  220. package/esm2020/state/reducers/reset-password/state.interface.mjs +2 -0
  221. package/esm2020/state/selectors/auth/auth.selector.mjs +17 -0
  222. package/esm2020/state/selectors/auth-all.selector.mjs +16 -0
  223. package/esm2020/state/selectors/auth-feature.selector.mjs +10 -0
  224. package/esm2020/state/selectors/login/login.selector.mjs +17 -0
  225. package/esm2020/state/selectors/public_api.mjs +2 -0
  226. package/esm2020/state/selectors/register/register.selector.mjs +17 -0
  227. package/esm2020/state/selectors/reset-password/selector.mjs +19 -0
  228. package/esm2020/state/testing/auth-testing.module.mjs +29 -0
  229. package/esm2020/state/testing/daffodil-auth-state-testing.mjs +5 -0
  230. package/esm2020/state/testing/index.mjs +2 -0
  231. package/esm2020/state/testing/mock-auth-facade.mjs +21 -0
  232. package/esm2020/state/testing/mock-login-facade.mjs +21 -0
  233. package/esm2020/state/testing/mock-register-facade.mjs +21 -0
  234. package/esm2020/state/testing/mock-reset-password-facade.mjs +22 -0
  235. package/esm2020/state/testing/public_api.mjs +6 -0
  236. package/esm2020/storage/auth-storage.service.mjs +30 -0
  237. package/esm2020/testing/daffodil-auth-testing.mjs +5 -0
  238. package/esm2020/testing/factories/account-registration.factory.mjs +25 -0
  239. package/esm2020/testing/factories/auth-token.factory.mjs +24 -0
  240. package/esm2020/testing/factories/public_api.mjs +4 -0
  241. package/esm2020/testing/factories/reset-password-info.factory.mjs +26 -0
  242. package/esm2020/testing/index.mjs +2 -0
  243. package/esm2020/testing/public_api.mjs +2 -0
  244. package/fesm2015/daffodil-auth-driver-in-memory.mjs +258 -0
  245. package/fesm2015/daffodil-auth-driver-in-memory.mjs.map +1 -0
  246. package/fesm2015/daffodil-auth-driver-magento.mjs +363 -0
  247. package/fesm2015/daffodil-auth-driver-magento.mjs.map +1 -0
  248. package/fesm2015/daffodil-auth-driver-testing.mjs +141 -0
  249. package/fesm2015/daffodil-auth-driver-testing.mjs.map +1 -0
  250. package/fesm2015/daffodil-auth-driver.mjs +70 -0
  251. package/fesm2015/daffodil-auth-driver.mjs.map +1 -0
  252. package/fesm2015/daffodil-auth-routing.mjs +158 -0
  253. package/fesm2015/daffodil-auth-routing.mjs.map +1 -0
  254. package/fesm2015/daffodil-auth-state-testing.mjs +106 -0
  255. package/fesm2015/daffodil-auth-state-testing.mjs.map +1 -0
  256. package/fesm2015/daffodil-auth-state.mjs +700 -0
  257. package/fesm2015/daffodil-auth-state.mjs.map +1 -0
  258. package/fesm2015/daffodil-auth-testing.mjs +74 -0
  259. package/fesm2015/daffodil-auth-testing.mjs.map +1 -0
  260. package/fesm2015/daffodil-auth.mjs +46 -0
  261. package/fesm2015/daffodil-auth.mjs.map +1 -0
  262. package/fesm2020/daffodil-auth-driver-in-memory.mjs +258 -0
  263. package/fesm2020/daffodil-auth-driver-in-memory.mjs.map +1 -0
  264. package/fesm2020/daffodil-auth-driver-magento.mjs +366 -0
  265. package/fesm2020/daffodil-auth-driver-magento.mjs.map +1 -0
  266. package/fesm2020/daffodil-auth-driver-testing.mjs +141 -0
  267. package/fesm2020/daffodil-auth-driver-testing.mjs.map +1 -0
  268. package/fesm2020/daffodil-auth-driver.mjs +70 -0
  269. package/fesm2020/daffodil-auth-driver.mjs.map +1 -0
  270. package/fesm2020/daffodil-auth-routing.mjs +152 -0
  271. package/fesm2020/daffodil-auth-routing.mjs.map +1 -0
  272. package/fesm2020/daffodil-auth-state-testing.mjs +106 -0
  273. package/fesm2020/daffodil-auth-state-testing.mjs.map +1 -0
  274. package/fesm2020/daffodil-auth-state.mjs +741 -0
  275. package/fesm2020/daffodil-auth-state.mjs.map +1 -0
  276. package/fesm2020/daffodil-auth-testing.mjs +74 -0
  277. package/fesm2020/daffodil-auth-testing.mjs.map +1 -0
  278. package/fesm2020/daffodil-auth.mjs +44 -0
  279. package/fesm2020/daffodil-auth.mjs.map +1 -0
  280. package/index.d.ts +1 -0
  281. package/injection-tokens/error-matcher.token.d.ts +7 -0
  282. package/injection-tokens/public_api.d.ts +1 -0
  283. package/models/account-registration.d.ts +2 -0
  284. package/models/auth-token.d.ts +3 -0
  285. package/models/login-info.d.ts +4 -0
  286. package/models/public_api.d.ts +4 -0
  287. package/models/reset-password-info.type.d.ts +14 -0
  288. package/package.json +115 -0
  289. package/public_api.d.ts +3 -0
  290. package/routing/config/default.d.ts +2 -0
  291. package/routing/config/interface.d.ts +9 -0
  292. package/routing/config/public_api.d.ts +3 -0
  293. package/routing/config/token.d.ts +6 -0
  294. package/routing/daffodil-auth-routing.d.ts +5 -0
  295. package/routing/guards/guest-only-guard-redirect.token.d.ts +2 -0
  296. package/routing/guards/guest-only.guard.d.ts +16 -0
  297. package/routing/guards/member-only-guard-redirect.token.d.ts +2 -0
  298. package/routing/guards/member-only.guard.d.ts +16 -0
  299. package/routing/guards/public_api.d.ts +5 -0
  300. package/routing/guards/reset-password.guard.d.ts +13 -0
  301. package/routing/index.d.ts +1 -0
  302. package/routing/module.d.ts +9 -0
  303. package/routing/package.json +10 -0
  304. package/routing/public_api.d.ts +3 -0
  305. package/state/actions/auth.actions.d.ts +62 -0
  306. package/state/actions/login.actions.d.ts +64 -0
  307. package/state/actions/public_api.d.ts +4 -0
  308. package/state/actions/register.actions.d.ts +40 -0
  309. package/state/actions/reset-password.actions.d.ts +72 -0
  310. package/state/auth-state.module.d.ts +11 -0
  311. package/state/config/default.d.ts +2 -0
  312. package/state/config/public_api.d.ts +3 -0
  313. package/state/config/token.d.ts +4 -0
  314. package/state/config/type.d.ts +7 -0
  315. package/state/daffodil-auth-state.d.ts +5 -0
  316. package/state/effects/auth.effects.d.ts +21 -0
  317. package/state/effects/login.effects.d.ts +19 -0
  318. package/state/effects/register.effects.d.ts +16 -0
  319. package/state/effects/reset-password.effects.d.ts +18 -0
  320. package/state/facades/auth/facade.d.ts +19 -0
  321. package/state/facades/auth/facade.interface.d.ts +8 -0
  322. package/state/facades/auth/public_api.d.ts +2 -0
  323. package/state/facades/login/facade.d.ts +18 -0
  324. package/state/facades/login/facade.interface.d.ts +8 -0
  325. package/state/facades/login/public_api.d.ts +2 -0
  326. package/state/facades/public_api.d.ts +4 -0
  327. package/state/facades/register/facade.d.ts +18 -0
  328. package/state/facades/register/facade.interface.d.ts +8 -0
  329. package/state/facades/register/public_api.d.ts +2 -0
  330. package/state/facades/reset-password/facade.d.ts +20 -0
  331. package/state/facades/reset-password/facade.interface.d.ts +10 -0
  332. package/state/facades/reset-password/public_api.d.ts +2 -0
  333. package/state/index.d.ts +1 -0
  334. package/state/package.json +10 -0
  335. package/state/public_api.d.ts +6 -0
  336. package/state/reducers/auth/auth-initial-state.d.ts +2 -0
  337. package/state/reducers/auth/auth-reducer-state.interface.d.ts +5 -0
  338. package/state/reducers/auth/auth.reducer.d.ts +3 -0
  339. package/state/reducers/auth/public_api.d.ts +3 -0
  340. package/state/reducers/auth-feature-state.interface.d.ts +14 -0
  341. package/state/reducers/auth-reducers.d.ts +3 -0
  342. package/state/reducers/auth-store-feature-key.d.ts +1 -0
  343. package/state/reducers/login/login-initial-state.d.ts +2 -0
  344. package/state/reducers/login/login-reducer-state.interface.d.ts +5 -0
  345. package/state/reducers/login/login.reducer.d.ts +4 -0
  346. package/state/reducers/login/public_api.d.ts +3 -0
  347. package/state/reducers/public_api.d.ts +7 -0
  348. package/state/reducers/register/public_api.d.ts +3 -0
  349. package/state/reducers/register/register-initial-state.d.ts +2 -0
  350. package/state/reducers/register/register-reducer-state.interface.d.ts +5 -0
  351. package/state/reducers/register/register.reducer.d.ts +4 -0
  352. package/state/reducers/reset-password/initial-state.d.ts +2 -0
  353. package/state/reducers/reset-password/public_api.d.ts +3 -0
  354. package/state/reducers/reset-password/reducer.d.ts +4 -0
  355. package/state/reducers/reset-password/state.interface.d.ts +7 -0
  356. package/state/selectors/auth/auth.selector.d.ts +10 -0
  357. package/state/selectors/auth-all.selector.d.ts +10 -0
  358. package/state/selectors/auth-feature.selector.d.ts +6 -0
  359. package/state/selectors/login/login.selector.d.ts +9 -0
  360. package/state/selectors/public_api.d.ts +1 -0
  361. package/state/selectors/register/register.selector.d.ts +10 -0
  362. package/state/selectors/reset-password/selector.d.ts +11 -0
  363. package/state/testing/auth-testing.module.d.ts +6 -0
  364. package/state/testing/daffodil-auth-state-testing.d.ts +5 -0
  365. package/state/testing/index.d.ts +1 -0
  366. package/state/testing/mock-auth-facade.d.ts +15 -0
  367. package/state/testing/mock-login-facade.d.ts +15 -0
  368. package/state/testing/mock-register-facade.d.ts +15 -0
  369. package/state/testing/mock-reset-password-facade.d.ts +16 -0
  370. package/state/testing/package.json +10 -0
  371. package/state/testing/public_api.d.ts +5 -0
  372. package/storage/auth-storage.service.d.ts +12 -0
  373. package/testing/daffodil-auth-testing.d.ts +5 -0
  374. package/testing/factories/account-registration.factory.d.ts +12 -0
  375. package/testing/factories/auth-token.factory.d.ts +11 -0
  376. package/testing/factories/public_api.d.ts +3 -0
  377. package/testing/factories/reset-password-info.factory.d.ts +13 -0
  378. package/testing/index.d.ts +1 -0
  379. package/testing/package.json +10 -0
  380. package/testing/public_api.d.ts +1 -0
@@ -0,0 +1,700 @@
1
+ import * as i1 from '@ngrx/store';
2
+ import { createFeatureSelector, createSelector, select, StoreModule } from '@ngrx/store';
3
+ import * as i0 from '@angular/core';
4
+ import { Injectable, InjectionToken, Inject, NgModule } from '@angular/core';
5
+ import * as i1$1 from '@ngrx/effects';
6
+ import { createEffect, ofType, EffectsModule } from '@ngrx/effects';
7
+ import { of, iif, defer } from 'rxjs';
8
+ import { switchMap, map, catchError, repeat, filter, tap } from 'rxjs/operators';
9
+ import * as i2 from '@daffodil/auth';
10
+ import { DAFF_AUTH_ERROR_MATCHER } from '@daffodil/auth';
11
+ import { DaffAuthDriver, DaffLoginDriver, DaffRegisterDriver, DaffResetPasswordDriver } from '@daffodil/auth/driver';
12
+
13
+ var DaffAuthActionTypes;
14
+ (function (DaffAuthActionTypes) {
15
+ DaffAuthActionTypes["AuthGuardCheckAction"] = "[@daffodil/auth] Auth Guard Check Action";
16
+ DaffAuthActionTypes["AuthGuardCheckCompletionAction"] = "[@daffodil/auth] Auth Guard Check Completion Action";
17
+ DaffAuthActionTypes["AuthStorageFailureAction"] = "[@daffodil/auth] Auth Storage Failure Action";
18
+ DaffAuthActionTypes["AuthCheckAction"] = "[@daffodil/auth] Auth Check Action";
19
+ DaffAuthActionTypes["AuthCheckSuccessAction"] = "[@daffodil/auth] Auth Check Success Action";
20
+ DaffAuthActionTypes["AuthCheckFailureAction"] = "[@daffodil/auth] Auth Check Failure Action";
21
+ DaffAuthActionTypes["AuthCompleteAction"] = "[@daffodil/auth] Auth Complete Action";
22
+ })(DaffAuthActionTypes || (DaffAuthActionTypes = {}));
23
+ /**
24
+ * An action triggered by guards to initialize an auth check request.
25
+ */
26
+ class DaffAuthGuardCheck {
27
+ constructor() {
28
+ this.type = DaffAuthActionTypes.AuthGuardCheckAction;
29
+ }
30
+ }
31
+ /**
32
+ * An action triggered on the completion of a guard token check.
33
+ */
34
+ class DaffAuthGuardCheckCompletion {
35
+ constructor(result) {
36
+ this.result = result;
37
+ this.type = DaffAuthActionTypes.AuthGuardCheckCompletionAction;
38
+ }
39
+ }
40
+ /*
41
+ * An action triggered upon a failed auth storage operation.
42
+ */
43
+ class DaffAuthStorageFailure {
44
+ constructor(errorMessage) {
45
+ this.errorMessage = errorMessage;
46
+ this.type = DaffAuthActionTypes.AuthStorageFailureAction;
47
+ }
48
+ }
49
+ /**
50
+ * An action triggered to initialize an auth check request.
51
+ */
52
+ class DaffAuthCheck {
53
+ constructor() {
54
+ this.type = DaffAuthActionTypes.AuthCheckAction;
55
+ }
56
+ }
57
+ /**
58
+ * An action triggered upon a successful auth check.
59
+ *
60
+ * @param token - the customer access token
61
+ */
62
+ class DaffAuthCheckSuccess {
63
+ constructor() {
64
+ this.type = DaffAuthActionTypes.AuthCheckSuccessAction;
65
+ }
66
+ }
67
+ /**
68
+ * An action triggered upon a failed auth check request.
69
+ *
70
+ * @param errorMessage - an error message
71
+ */
72
+ class DaffAuthCheckFailure {
73
+ constructor(errorMessage) {
74
+ this.errorMessage = errorMessage;
75
+ this.type = DaffAuthActionTypes.AuthCheckFailureAction;
76
+ }
77
+ }
78
+ /**
79
+ * An action triggered when the user authentication flow is completed.
80
+ * The auth token is in storage at this point.
81
+ */
82
+ class DaffAuthComplete {
83
+ constructor() {
84
+ this.type = DaffAuthActionTypes.AuthCompleteAction;
85
+ }
86
+ }
87
+
88
+ var DaffAuthLoginActionTypes;
89
+ (function (DaffAuthLoginActionTypes) {
90
+ DaffAuthLoginActionTypes["LoginAction"] = "[@daffodil/auth] Login Action";
91
+ DaffAuthLoginActionTypes["LoginSuccessAction"] = "[@daffodil/auth] Login Success Action";
92
+ DaffAuthLoginActionTypes["LoginFailureAction"] = "[@daffodil/auth] Login Failure Action";
93
+ DaffAuthLoginActionTypes["LogoutAction"] = "[@daffodil/auth] Logout Action";
94
+ DaffAuthLoginActionTypes["LogoutSuccessAction"] = "[@daffodil/auth] Logout Success Action";
95
+ DaffAuthLoginActionTypes["LogoutFailureAction"] = "[@daffodil/auth] Logout Failure Action";
96
+ })(DaffAuthLoginActionTypes || (DaffAuthLoginActionTypes = {}));
97
+ /**
98
+ * An action triggered to initialize a auth login request.
99
+ */
100
+ class DaffAuthLogin {
101
+ constructor(loginInfo) {
102
+ this.loginInfo = loginInfo;
103
+ this.type = DaffAuthLoginActionTypes.LoginAction;
104
+ }
105
+ }
106
+ /**
107
+ * An action triggered upon a successful auth login.
108
+ *
109
+ * @param token - the customer access token
110
+ */
111
+ class DaffAuthLoginSuccess {
112
+ constructor(auth) {
113
+ this.auth = auth;
114
+ this.type = DaffAuthLoginActionTypes.LoginSuccessAction;
115
+ }
116
+ }
117
+ /**
118
+ * An action triggered upon a failed auth login request.
119
+ *
120
+ * @param errorMessage - an error message
121
+ */
122
+ class DaffAuthLoginFailure {
123
+ constructor(errorMessage) {
124
+ this.errorMessage = errorMessage;
125
+ this.type = DaffAuthLoginActionTypes.LoginFailureAction;
126
+ }
127
+ }
128
+ /**
129
+ * An action triggered to initialize a logout request.
130
+ */
131
+ class DaffAuthLogout {
132
+ constructor() {
133
+ this.type = DaffAuthLoginActionTypes.LogoutAction;
134
+ }
135
+ }
136
+ /**
137
+ * An action triggered upon a successful logout.
138
+ *
139
+ * @param token - the customer access token
140
+ */
141
+ class DaffAuthLogoutSuccess {
142
+ constructor() {
143
+ this.type = DaffAuthLoginActionTypes.LogoutSuccessAction;
144
+ }
145
+ }
146
+ /**
147
+ * An action triggered upon a failed logout request.
148
+ *
149
+ * @param errorMessage - an error message
150
+ */
151
+ class DaffAuthLogoutFailure {
152
+ constructor(errorMessage) {
153
+ this.errorMessage = errorMessage;
154
+ this.type = DaffAuthLoginActionTypes.LogoutFailureAction;
155
+ }
156
+ }
157
+
158
+ var DaffAuthRegisterActionTypes;
159
+ (function (DaffAuthRegisterActionTypes) {
160
+ DaffAuthRegisterActionTypes["RegisterAction"] = "[@daffodil/auth] Register Action";
161
+ DaffAuthRegisterActionTypes["RegisterSuccessAction"] = "[@daffodil/auth] Register Success Action";
162
+ DaffAuthRegisterActionTypes["RegisterFailureAction"] = "[@daffodil/auth] Register Failure Action";
163
+ })(DaffAuthRegisterActionTypes || (DaffAuthRegisterActionTypes = {}));
164
+ /**
165
+ * An action triggered to initialize a auth register request.
166
+ *
167
+ * @param registration
168
+ */
169
+ class DaffAuthRegister {
170
+ constructor(registration, autoLogin = true) {
171
+ this.registration = registration;
172
+ this.autoLogin = autoLogin;
173
+ this.type = DaffAuthRegisterActionTypes.RegisterAction;
174
+ }
175
+ }
176
+ /**
177
+ * An action triggered upon a successful auth register request.
178
+ *
179
+ * @param token - the customer access token
180
+ */
181
+ class DaffAuthRegisterSuccess {
182
+ constructor(token) {
183
+ this.token = token;
184
+ this.type = DaffAuthRegisterActionTypes.RegisterSuccessAction;
185
+ }
186
+ }
187
+ /**
188
+ * An action triggered upon a failed auth request.
189
+ *
190
+ * @param errorMessage - an error message
191
+ */
192
+ class DaffAuthRegisterFailure {
193
+ constructor(errorMessage) {
194
+ this.errorMessage = errorMessage;
195
+ this.type = DaffAuthRegisterActionTypes.RegisterFailureAction;
196
+ }
197
+ }
198
+
199
+ var DaffAuthResetPasswordActionTypes;
200
+ (function (DaffAuthResetPasswordActionTypes) {
201
+ DaffAuthResetPasswordActionTypes["SendResetEmailAction"] = "[@daffodil/auth] Send Reset Email Action";
202
+ DaffAuthResetPasswordActionTypes["SendResetEmailSuccessAction"] = "[@daffodil/auth] Send Reset Email Success Action";
203
+ DaffAuthResetPasswordActionTypes["SendResetEmailFailureAction"] = "[@daffodil/auth] Send Reset Email Failure Action";
204
+ DaffAuthResetPasswordActionTypes["ResetPasswordAction"] = "[@daffodil/auth] Reset Password Action";
205
+ DaffAuthResetPasswordActionTypes["ResetPasswordSuccessAction"] = "[@daffodil/auth] Reset Password Success Action";
206
+ DaffAuthResetPasswordActionTypes["ResetPasswordFailureAction"] = "[@daffodil/auth] Reset Password Failure Action";
207
+ DaffAuthResetPasswordActionTypes["ResetPasswordLandingAction"] = "[@daffodil/auth] Reset Password Landing Action";
208
+ })(DaffAuthResetPasswordActionTypes || (DaffAuthResetPasswordActionTypes = {}));
209
+ /**
210
+ * An action triggered to send the specified customer an email to reset their password.
211
+ */
212
+ class DaffSendResetEmail {
213
+ constructor(email) {
214
+ this.email = email;
215
+ this.type = DaffAuthResetPasswordActionTypes.SendResetEmailAction;
216
+ }
217
+ }
218
+ /**
219
+ * An action triggered upon a successfully sent reset password email.
220
+ */
221
+ class DaffSendResetEmailSuccess {
222
+ constructor() {
223
+ this.type = DaffAuthResetPasswordActionTypes.SendResetEmailSuccessAction;
224
+ }
225
+ }
226
+ /**
227
+ * An action triggered upon a failure to send the reset password email.
228
+ *
229
+ * @param errorMessage - an error message
230
+ */
231
+ class DaffSendResetEmailFailure {
232
+ constructor(errorMessage) {
233
+ this.errorMessage = errorMessage;
234
+ this.type = DaffAuthResetPasswordActionTypes.SendResetEmailFailureAction;
235
+ }
236
+ }
237
+ /**
238
+ * An action triggered to initialize a logout request.
239
+ */
240
+ class DaffResetPassword {
241
+ constructor(info, autoLogin = true) {
242
+ this.info = info;
243
+ this.autoLogin = autoLogin;
244
+ this.type = DaffAuthResetPasswordActionTypes.ResetPasswordAction;
245
+ }
246
+ }
247
+ /**
248
+ * An action triggered upon a successful logout.
249
+ */
250
+ class DaffResetPasswordSuccess {
251
+ constructor() {
252
+ this.type = DaffAuthResetPasswordActionTypes.ResetPasswordSuccessAction;
253
+ }
254
+ }
255
+ /**
256
+ * An action triggered upon a failed logout request.
257
+ *
258
+ * @param errorMessage - an error message
259
+ */
260
+ class DaffResetPasswordFailure {
261
+ constructor(errorMessage) {
262
+ this.errorMessage = errorMessage;
263
+ this.type = DaffAuthResetPasswordActionTypes.ResetPasswordFailureAction;
264
+ }
265
+ }
266
+ /**
267
+ * An action triggered upon the user navigating to the reset password page from the link in their email.
268
+ *
269
+ * @param token - The token with which the password can be reset
270
+ */
271
+ class DaffResetPasswordLanding {
272
+ constructor(token) {
273
+ this.token = token;
274
+ this.type = DaffAuthResetPasswordActionTypes.ResetPasswordLandingAction;
275
+ }
276
+ }
277
+
278
+ const daffAuthInitialState = {
279
+ loading: false,
280
+ errors: [],
281
+ };
282
+
283
+ function daffAuthReducer(state = daffAuthInitialState, action) {
284
+ switch (action.type) {
285
+ case DaffAuthActionTypes.AuthCheckAction:
286
+ return Object.assign(Object.assign({}, state), { loading: true });
287
+ case DaffAuthActionTypes.AuthCheckSuccessAction:
288
+ return Object.assign(Object.assign({}, state), { loading: false });
289
+ case DaffAuthActionTypes.AuthCheckFailureAction:
290
+ return Object.assign(Object.assign({}, state), { loading: false, errors: [action.errorMessage] });
291
+ default:
292
+ return state;
293
+ }
294
+ }
295
+
296
+ const daffAuthLoginInitialState = {
297
+ loading: false,
298
+ errors: [],
299
+ };
300
+
301
+ function daffAuthLoginReducer(state = daffAuthLoginInitialState, action) {
302
+ switch (action.type) {
303
+ case DaffAuthLoginActionTypes.LoginAction:
304
+ case DaffAuthLoginActionTypes.LogoutAction:
305
+ return Object.assign(Object.assign({}, state), { loading: true });
306
+ case DaffAuthLoginActionTypes.LoginSuccessAction:
307
+ case DaffAuthLoginActionTypes.LogoutSuccessAction:
308
+ return Object.assign(Object.assign({}, state), { loading: false });
309
+ case DaffAuthLoginActionTypes.LoginFailureAction:
310
+ case DaffAuthLoginActionTypes.LogoutFailureAction:
311
+ return Object.assign(Object.assign({}, state), { loading: false, errors: [action.errorMessage] });
312
+ default:
313
+ return state;
314
+ }
315
+ }
316
+
317
+ const daffAuthRegisterInitialState = {
318
+ loading: false,
319
+ errors: [],
320
+ };
321
+
322
+ function daffAuthRegisterReducer(state = daffAuthRegisterInitialState, action) {
323
+ switch (action.type) {
324
+ case DaffAuthRegisterActionTypes.RegisterAction:
325
+ return Object.assign(Object.assign({}, state), { loading: true });
326
+ case DaffAuthRegisterActionTypes.RegisterSuccessAction:
327
+ return Object.assign(Object.assign({}, state), { loading: false });
328
+ case DaffAuthRegisterActionTypes.RegisterFailureAction:
329
+ return Object.assign(Object.assign({}, state), { loading: false, errors: [action.errorMessage] });
330
+ default:
331
+ return state;
332
+ }
333
+ }
334
+
335
+ const daffAuthResetPasswordInitialState = {
336
+ loading: false,
337
+ errors: [],
338
+ token: null,
339
+ };
340
+
341
+ function daffAuthResetPasswordReducer(state = daffAuthResetPasswordInitialState, action) {
342
+ switch (action.type) {
343
+ case DaffAuthResetPasswordActionTypes.ResetPasswordAction:
344
+ case DaffAuthResetPasswordActionTypes.SendResetEmailAction:
345
+ return Object.assign(Object.assign({}, state), { loading: true });
346
+ case DaffAuthResetPasswordActionTypes.ResetPasswordSuccessAction:
347
+ case DaffAuthResetPasswordActionTypes.SendResetEmailSuccessAction:
348
+ return Object.assign(Object.assign({}, state), { loading: false });
349
+ case DaffAuthResetPasswordActionTypes.ResetPasswordFailureAction:
350
+ case DaffAuthResetPasswordActionTypes.SendResetEmailFailureAction:
351
+ return Object.assign(Object.assign({}, state), { loading: false, errors: [action.errorMessage] });
352
+ case DaffAuthResetPasswordActionTypes.ResetPasswordLandingAction:
353
+ return Object.assign(Object.assign({}, state), { token: action.token });
354
+ default:
355
+ return state;
356
+ }
357
+ }
358
+
359
+ const DAFF_AUTH_STORE_FEATURE_KEY = 'daffAuth';
360
+
361
+ const daffAuthReducers = {
362
+ auth: daffAuthReducer,
363
+ login: daffAuthLoginReducer,
364
+ register: daffAuthRegisterReducer,
365
+ resetPassword: daffAuthResetPasswordReducer,
366
+ };
367
+
368
+ /**
369
+ * Feature State Selector
370
+ */
371
+ const getDaffAuthFeatureStateSelector = (() => {
372
+ let cache;
373
+ return () => cache = cache || createFeatureSelector(DAFF_AUTH_STORE_FEATURE_KEY);
374
+ })();
375
+
376
+ const createAuthSelectors = () => {
377
+ const selectAuthState = createSelector(getDaffAuthFeatureStateSelector(), state => state.auth);
378
+ const selectAuthLoading = createSelector(selectAuthState, state => state.loading);
379
+ const selectAuthErrors = createSelector(selectAuthState, state => state.errors);
380
+ return {
381
+ selectAuthState,
382
+ selectAuthLoading,
383
+ selectAuthErrors,
384
+ };
385
+ };
386
+ const getAuthSelectors = (() => {
387
+ let cache;
388
+ return () => cache = cache || createAuthSelectors();
389
+ })();
390
+
391
+ const createLoginSelectors = () => {
392
+ const selectAuthLoginState = createSelector(getDaffAuthFeatureStateSelector(), state => state.login);
393
+ const selectAuthLoginLoading = createSelector(selectAuthLoginState, state => state.loading);
394
+ const selectAuthLoginErrors = createSelector(selectAuthLoginState, state => state.errors);
395
+ return {
396
+ selectAuthLoginState,
397
+ selectAuthLoginLoading,
398
+ selectAuthLoginErrors,
399
+ };
400
+ };
401
+ const getDaffAuthLoginSelectors = (() => {
402
+ let cache;
403
+ return () => cache = cache || createLoginSelectors();
404
+ })();
405
+
406
+ const createRegisterSelectors = () => {
407
+ const selectAuthRegisterState = createSelector(getDaffAuthFeatureStateSelector(), state => state.register);
408
+ const selectAuthRegisterLoading = createSelector(selectAuthRegisterState, state => state.loading);
409
+ const selectAuthRegisterErrors = createSelector(selectAuthRegisterState, state => state.errors);
410
+ return {
411
+ selectAuthRegisterState,
412
+ selectAuthRegisterLoading,
413
+ selectAuthRegisterErrors,
414
+ };
415
+ };
416
+ const getDaffAuthRegisterSelectors = (() => {
417
+ let cache;
418
+ return () => cache = cache || createRegisterSelectors();
419
+ })();
420
+
421
+ const createResetPasswordSelectors = () => {
422
+ const selectAuthResetPasswordState = createSelector(getDaffAuthFeatureStateSelector(), state => state.resetPassword);
423
+ const selectAuthResetPasswordLoading = createSelector(selectAuthResetPasswordState, state => state.loading);
424
+ const selectAuthResetPasswordErrors = createSelector(selectAuthResetPasswordState, state => state.errors);
425
+ const selectAuthResetPasswordToken = createSelector(selectAuthResetPasswordState, state => state.token);
426
+ return {
427
+ selectAuthResetPasswordState,
428
+ selectAuthResetPasswordLoading,
429
+ selectAuthResetPasswordErrors,
430
+ selectAuthResetPasswordToken,
431
+ };
432
+ };
433
+ const getDaffAuthResetPasswordSelectors = (() => {
434
+ let cache;
435
+ return () => cache = cache || createResetPasswordSelectors();
436
+ })();
437
+
438
+ const getDaffAuthSelectors = (() => {
439
+ let cache;
440
+ return () => cache = cache || Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, getAuthSelectors()), getDaffAuthLoginSelectors()), getDaffAuthRegisterSelectors()), getDaffAuthResetPasswordSelectors()), { selectAuthFeatureState: getDaffAuthFeatureStateSelector() });
441
+ })();
442
+
443
+ /**
444
+ * @inheritdoc
445
+ */
446
+ class DaffAuthFacade {
447
+ constructor(store) {
448
+ this.store = store;
449
+ const { selectAuthLoading, selectAuthErrors, } = getDaffAuthSelectors();
450
+ this.loading$ = this.store.pipe(select(selectAuthLoading));
451
+ this.errors$ = this.store.pipe(select(selectAuthErrors));
452
+ }
453
+ dispatch(action) {
454
+ this.store.dispatch(action);
455
+ }
456
+ }
457
+ /** @nocollapse */ DaffAuthFacade.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthFacade, deps: [{ token: i1.Store }], target: i0.ɵɵFactoryTarget.Injectable });
458
+ /** @nocollapse */ DaffAuthFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthFacade, providedIn: 'root' });
459
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthFacade, decorators: [{
460
+ type: Injectable,
461
+ args: [{
462
+ providedIn: 'root',
463
+ }]
464
+ }], ctorParameters: function () { return [{ type: i1.Store }]; } });
465
+
466
+ /**
467
+ * @inheritdoc
468
+ */
469
+ class DaffAuthLoginFacade {
470
+ constructor(store) {
471
+ this.store = store;
472
+ const { selectAuthLoginLoading, selectAuthLoginErrors, } = getDaffAuthSelectors();
473
+ this.loading$ = this.store.pipe(select(selectAuthLoginLoading));
474
+ this.errors$ = this.store.pipe(select(selectAuthLoginErrors));
475
+ }
476
+ dispatch(action) {
477
+ this.store.dispatch(action);
478
+ }
479
+ }
480
+ /** @nocollapse */ DaffAuthLoginFacade.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthLoginFacade, deps: [{ token: i1.Store }], target: i0.ɵɵFactoryTarget.Injectable });
481
+ /** @nocollapse */ DaffAuthLoginFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthLoginFacade, providedIn: 'root' });
482
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthLoginFacade, decorators: [{
483
+ type: Injectable,
484
+ args: [{
485
+ providedIn: 'root',
486
+ }]
487
+ }], ctorParameters: function () { return [{ type: i1.Store }]; } });
488
+
489
+ /**
490
+ * @inheritdoc
491
+ */
492
+ class DaffAuthRegisterFacade {
493
+ constructor(store) {
494
+ this.store = store;
495
+ const { selectAuthRegisterLoading, selectAuthRegisterErrors, } = getDaffAuthSelectors();
496
+ this.loading$ = this.store.pipe(select(selectAuthRegisterLoading));
497
+ this.errors$ = this.store.pipe(select(selectAuthRegisterErrors));
498
+ }
499
+ dispatch(action) {
500
+ this.store.dispatch(action);
501
+ }
502
+ }
503
+ /** @nocollapse */ DaffAuthRegisterFacade.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRegisterFacade, deps: [{ token: i1.Store }], target: i0.ɵɵFactoryTarget.Injectable });
504
+ /** @nocollapse */ DaffAuthRegisterFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRegisterFacade, providedIn: 'root' });
505
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRegisterFacade, decorators: [{
506
+ type: Injectable,
507
+ args: [{
508
+ providedIn: 'root',
509
+ }]
510
+ }], ctorParameters: function () { return [{ type: i1.Store }]; } });
511
+
512
+ /**
513
+ * @inheritdoc
514
+ */
515
+ class DaffAuthResetPasswordFacade {
516
+ constructor(store) {
517
+ this.store = store;
518
+ const { selectAuthResetPasswordLoading, selectAuthResetPasswordErrors, selectAuthResetPasswordToken, } = getDaffAuthSelectors();
519
+ this.token$ = this.store.pipe(select(selectAuthResetPasswordToken));
520
+ this.loading$ = this.store.pipe(select(selectAuthResetPasswordLoading));
521
+ this.errors$ = this.store.pipe(select(selectAuthResetPasswordErrors));
522
+ }
523
+ dispatch(action) {
524
+ this.store.dispatch(action);
525
+ }
526
+ }
527
+ /** @nocollapse */ DaffAuthResetPasswordFacade.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthResetPasswordFacade, deps: [{ token: i1.Store }], target: i0.ɵɵFactoryTarget.Injectable });
528
+ /** @nocollapse */ DaffAuthResetPasswordFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthResetPasswordFacade, providedIn: 'root' });
529
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthResetPasswordFacade, decorators: [{
530
+ type: Injectable,
531
+ args: [{
532
+ providedIn: 'root',
533
+ }]
534
+ }], ctorParameters: function () { return [{ type: i1.Store }]; } });
535
+
536
+ const TWENTY_MINUTES = 1.2e6;
537
+ const daffAuthStateDefaultConfig = {
538
+ checkInterval: TWENTY_MINUTES,
539
+ };
540
+
541
+ const DAFF_AUTH_STATE_CONFIG = new InjectionToken('DAFF_AUTH_STATE_CONFIG', { factory: () => daffAuthStateDefaultConfig });
542
+ const provideDaffAuthStateConfig = (config) => ({
543
+ provide: DAFF_AUTH_STATE_CONFIG,
544
+ useValue: config,
545
+ });
546
+
547
+ class DaffAuthEffects {
548
+ constructor(actions$, authDriver, errorMatcher, storage, config) {
549
+ this.actions$ = actions$;
550
+ this.authDriver = authDriver;
551
+ this.errorMatcher = errorMatcher;
552
+ this.storage = storage;
553
+ this.config = config;
554
+ this.check$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthActionTypes.AuthCheckAction), switchMap((action) => this.authDriver.check().pipe(map(() => new DaffAuthCheckSuccess()), catchError((error) => {
555
+ this.storage.removeAuthToken();
556
+ return of(new DaffAuthCheckFailure(this.errorMatcher(error)));
557
+ })))));
558
+ this.guardCheck$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthActionTypes.AuthGuardCheckAction), switchMap((action) => this.authDriver.check().pipe(map(() => new DaffAuthGuardCheckCompletion(true)), catchError((error) => {
559
+ this.storage.removeAuthToken();
560
+ return of(new DaffAuthGuardCheckCompletion(false));
561
+ })))));
562
+ // this needs to be defined after `check$` or else the driver call won't be run
563
+ this.authCheckInterval$ = createEffect(() => of(new DaffAuthCheck()).pipe(repeat({ delay: this.config.checkInterval }), filter(() => !!this.storage.getAuthToken())));
564
+ }
565
+ }
566
+ /** @nocollapse */ DaffAuthEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthEffects, deps: [{ token: i1$1.Actions }, { token: DaffAuthDriver }, { token: DAFF_AUTH_ERROR_MATCHER }, { token: i2.DaffAuthStorageService }, { token: DAFF_AUTH_STATE_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
567
+ /** @nocollapse */ DaffAuthEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthEffects });
568
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthEffects, decorators: [{
569
+ type: Injectable
570
+ }], ctorParameters: function () {
571
+ return [{ type: i1$1.Actions }, { type: undefined, decorators: [{
572
+ type: Inject,
573
+ args: [DaffAuthDriver]
574
+ }] }, { type: undefined, decorators: [{
575
+ type: Inject,
576
+ args: [DAFF_AUTH_ERROR_MATCHER]
577
+ }] }, { type: i2.DaffAuthStorageService }, { type: undefined, decorators: [{
578
+ type: Inject,
579
+ args: [DAFF_AUTH_STATE_CONFIG]
580
+ }] }];
581
+ } });
582
+
583
+ class DaffAuthLoginEffects {
584
+ constructor(actions$, loginDriver, errorMatcher, storage) {
585
+ this.actions$ = actions$;
586
+ this.loginDriver = loginDriver;
587
+ this.errorMatcher = errorMatcher;
588
+ this.storage = storage;
589
+ this.login$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthLoginActionTypes.LoginAction), switchMap((action) => this.loginDriver.login(action.loginInfo).pipe(map((resp) => new DaffAuthLoginSuccess(resp)), catchError((error) => of(new DaffAuthLoginFailure(this.errorMatcher(error))))))));
590
+ this.logout$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthLoginActionTypes.LogoutAction), switchMap((action) => this.loginDriver.logout().pipe(map(() => new DaffAuthLogoutSuccess()), tap(() => {
591
+ this.storage.removeAuthToken();
592
+ }), catchError((error) => of(new DaffAuthLogoutFailure(this.errorMatcher(error))))))));
593
+ this.storeAuthToken$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthLoginActionTypes.LoginSuccessAction), tap((action) => {
594
+ this.storage.setAuthToken(action.auth.token);
595
+ }), map(() => new DaffAuthComplete()), catchError((error) => of(new DaffAuthStorageFailure(this.errorMatcher(error))))));
596
+ }
597
+ }
598
+ /** @nocollapse */ DaffAuthLoginEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthLoginEffects, deps: [{ token: i1$1.Actions }, { token: DaffLoginDriver }, { token: DAFF_AUTH_ERROR_MATCHER }, { token: i2.DaffAuthStorageService }], target: i0.ɵɵFactoryTarget.Injectable });
599
+ /** @nocollapse */ DaffAuthLoginEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthLoginEffects });
600
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthLoginEffects, decorators: [{
601
+ type: Injectable
602
+ }], ctorParameters: function () {
603
+ return [{ type: i1$1.Actions }, { type: undefined, decorators: [{
604
+ type: Inject,
605
+ args: [DaffLoginDriver]
606
+ }] }, { type: undefined, decorators: [{
607
+ type: Inject,
608
+ args: [DAFF_AUTH_ERROR_MATCHER]
609
+ }] }, { type: i2.DaffAuthStorageService }];
610
+ } });
611
+
612
+ class DaffAuthRegisterEffects {
613
+ constructor(actions$, registerDriver, errorMatcher, storage) {
614
+ this.actions$ = actions$;
615
+ this.registerDriver = registerDriver;
616
+ this.errorMatcher = errorMatcher;
617
+ this.storage = storage;
618
+ this.register$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthRegisterActionTypes.RegisterAction), switchMap((action) => iif(() => action.autoLogin, defer(() => this.registerDriver.register(action.registration).pipe(tap(token => this.storage.setAuthToken(token)), switchMap(() => of(new DaffAuthRegisterSuccess(), new DaffAuthComplete())))), defer(() => this.registerDriver.registerOnly(action.registration).pipe(map(() => new DaffAuthRegisterSuccess())))).pipe(catchError((error) => of(new DaffAuthRegisterFailure(this.errorMatcher(error))))))));
619
+ }
620
+ }
621
+ /** @nocollapse */ DaffAuthRegisterEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRegisterEffects, deps: [{ token: i1$1.Actions }, { token: DaffRegisterDriver }, { token: DAFF_AUTH_ERROR_MATCHER }, { token: i2.DaffAuthStorageService }], target: i0.ɵɵFactoryTarget.Injectable });
622
+ /** @nocollapse */ DaffAuthRegisterEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRegisterEffects });
623
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRegisterEffects, decorators: [{
624
+ type: Injectable
625
+ }], ctorParameters: function () {
626
+ return [{ type: i1$1.Actions }, { type: undefined, decorators: [{
627
+ type: Inject,
628
+ args: [DaffRegisterDriver]
629
+ }] }, { type: undefined, decorators: [{
630
+ type: Inject,
631
+ args: [DAFF_AUTH_ERROR_MATCHER]
632
+ }] }, { type: i2.DaffAuthStorageService }];
633
+ } });
634
+
635
+ class DaffAuthResetPasswordEffects {
636
+ constructor(actions$, driver, errorMatcher, storage) {
637
+ this.actions$ = actions$;
638
+ this.driver = driver;
639
+ this.errorMatcher = errorMatcher;
640
+ this.storage = storage;
641
+ this.sendResetEmail$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthResetPasswordActionTypes.SendResetEmailAction), switchMap((action) => this.driver.sendResetEmail(action.email).pipe(map(() => new DaffSendResetEmailSuccess()), catchError((error) => of(new DaffSendResetEmailFailure(this.errorMatcher(error))))))));
642
+ this.resetPassword$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthResetPasswordActionTypes.ResetPasswordAction), switchMap((action) => iif(() => action.autoLogin, defer(() => this.driver.resetPassword(action.info).pipe(tap(token => this.storage.setAuthToken(token)), switchMap(() => of(new DaffResetPasswordSuccess(), new DaffAuthComplete())))), defer(() => this.driver.resetPasswordOnly(action.info).pipe(map(() => new DaffResetPasswordSuccess())))).pipe(catchError((error) => of(new DaffResetPasswordFailure(this.errorMatcher(error))))))));
643
+ }
644
+ }
645
+ /** @nocollapse */ DaffAuthResetPasswordEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthResetPasswordEffects, deps: [{ token: i1$1.Actions }, { token: DaffResetPasswordDriver }, { token: DAFF_AUTH_ERROR_MATCHER }, { token: i2.DaffAuthStorageService }], target: i0.ɵɵFactoryTarget.Injectable });
646
+ /** @nocollapse */ DaffAuthResetPasswordEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthResetPasswordEffects });
647
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthResetPasswordEffects, decorators: [{
648
+ type: Injectable
649
+ }], ctorParameters: function () {
650
+ return [{ type: i1$1.Actions }, { type: undefined, decorators: [{
651
+ type: Inject,
652
+ args: [DaffResetPasswordDriver]
653
+ }] }, { type: undefined, decorators: [{
654
+ type: Inject,
655
+ args: [DAFF_AUTH_ERROR_MATCHER]
656
+ }] }, { type: i2.DaffAuthStorageService }];
657
+ } });
658
+
659
+ class DaffAuthStateModule {
660
+ static withConfig(config) {
661
+ return {
662
+ ngModule: DaffAuthStateModule,
663
+ providers: [
664
+ provideDaffAuthStateConfig(config),
665
+ ],
666
+ };
667
+ }
668
+ }
669
+ /** @nocollapse */ DaffAuthStateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
670
+ /** @nocollapse */ DaffAuthStateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthStateModule, imports: [i1.StoreFeatureModule, i1$1.EffectsFeatureModule] });
671
+ /** @nocollapse */ DaffAuthStateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthStateModule, imports: [[
672
+ StoreModule.forFeature(DAFF_AUTH_STORE_FEATURE_KEY, daffAuthReducers),
673
+ EffectsModule.forFeature([
674
+ DaffAuthEffects,
675
+ DaffAuthLoginEffects,
676
+ DaffAuthRegisterEffects,
677
+ DaffAuthResetPasswordEffects,
678
+ ]),
679
+ ]] });
680
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthStateModule, decorators: [{
681
+ type: NgModule,
682
+ args: [{
683
+ imports: [
684
+ StoreModule.forFeature(DAFF_AUTH_STORE_FEATURE_KEY, daffAuthReducers),
685
+ EffectsModule.forFeature([
686
+ DaffAuthEffects,
687
+ DaffAuthLoginEffects,
688
+ DaffAuthRegisterEffects,
689
+ DaffAuthResetPasswordEffects,
690
+ ]),
691
+ ],
692
+ }]
693
+ }] });
694
+
695
+ /**
696
+ * Generated bundle index. Do not edit.
697
+ */
698
+
699
+ export { DAFF_AUTH_STATE_CONFIG, DAFF_AUTH_STORE_FEATURE_KEY, DaffAuthActionTypes, DaffAuthCheck, DaffAuthCheckFailure, DaffAuthCheckSuccess, DaffAuthComplete, DaffAuthFacade, DaffAuthGuardCheck, DaffAuthGuardCheckCompletion, DaffAuthLogin, DaffAuthLoginActionTypes, DaffAuthLoginFacade, DaffAuthLoginFailure, DaffAuthLoginSuccess, DaffAuthLogout, DaffAuthLogoutFailure, DaffAuthLogoutSuccess, DaffAuthRegister, DaffAuthRegisterActionTypes, DaffAuthRegisterFacade, DaffAuthRegisterFailure, DaffAuthRegisterSuccess, DaffAuthResetPasswordActionTypes, DaffAuthResetPasswordFacade, DaffAuthStateModule, DaffAuthStorageFailure, DaffResetPassword, DaffResetPasswordFailure, DaffResetPasswordLanding, DaffResetPasswordSuccess, DaffSendResetEmail, DaffSendResetEmailFailure, DaffSendResetEmailSuccess, daffAuthInitialState, daffAuthLoginInitialState, daffAuthLoginReducer, daffAuthReducer, daffAuthReducers, daffAuthRegisterInitialState, daffAuthRegisterReducer, daffAuthResetPasswordInitialState, daffAuthResetPasswordReducer, daffAuthStateDefaultConfig, getDaffAuthSelectors, provideDaffAuthStateConfig };
700
+ //# sourceMappingURL=daffodil-auth-state.mjs.map