@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,741 @@
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 {
287
+ ...state,
288
+ loading: true,
289
+ };
290
+ case DaffAuthActionTypes.AuthCheckSuccessAction:
291
+ return {
292
+ ...state,
293
+ loading: false,
294
+ };
295
+ case DaffAuthActionTypes.AuthCheckFailureAction:
296
+ return {
297
+ ...state,
298
+ loading: false,
299
+ errors: [action.errorMessage],
300
+ };
301
+ default:
302
+ return state;
303
+ }
304
+ }
305
+
306
+ const daffAuthLoginInitialState = {
307
+ loading: false,
308
+ errors: [],
309
+ };
310
+
311
+ function daffAuthLoginReducer(state = daffAuthLoginInitialState, action) {
312
+ switch (action.type) {
313
+ case DaffAuthLoginActionTypes.LoginAction:
314
+ case DaffAuthLoginActionTypes.LogoutAction:
315
+ return {
316
+ ...state,
317
+ loading: true,
318
+ };
319
+ case DaffAuthLoginActionTypes.LoginSuccessAction:
320
+ case DaffAuthLoginActionTypes.LogoutSuccessAction:
321
+ return {
322
+ ...state,
323
+ loading: false,
324
+ };
325
+ case DaffAuthLoginActionTypes.LoginFailureAction:
326
+ case DaffAuthLoginActionTypes.LogoutFailureAction:
327
+ return {
328
+ ...state,
329
+ loading: false,
330
+ errors: [action.errorMessage],
331
+ };
332
+ default:
333
+ return state;
334
+ }
335
+ }
336
+
337
+ const daffAuthRegisterInitialState = {
338
+ loading: false,
339
+ errors: [],
340
+ };
341
+
342
+ function daffAuthRegisterReducer(state = daffAuthRegisterInitialState, action) {
343
+ switch (action.type) {
344
+ case DaffAuthRegisterActionTypes.RegisterAction:
345
+ return {
346
+ ...state,
347
+ loading: true,
348
+ };
349
+ case DaffAuthRegisterActionTypes.RegisterSuccessAction:
350
+ return {
351
+ ...state,
352
+ loading: false,
353
+ };
354
+ case DaffAuthRegisterActionTypes.RegisterFailureAction:
355
+ return {
356
+ ...state,
357
+ loading: false,
358
+ errors: [action.errorMessage],
359
+ };
360
+ default:
361
+ return state;
362
+ }
363
+ }
364
+
365
+ const daffAuthResetPasswordInitialState = {
366
+ loading: false,
367
+ errors: [],
368
+ token: null,
369
+ };
370
+
371
+ function daffAuthResetPasswordReducer(state = daffAuthResetPasswordInitialState, action) {
372
+ switch (action.type) {
373
+ case DaffAuthResetPasswordActionTypes.ResetPasswordAction:
374
+ case DaffAuthResetPasswordActionTypes.SendResetEmailAction:
375
+ return {
376
+ ...state,
377
+ loading: true,
378
+ };
379
+ case DaffAuthResetPasswordActionTypes.ResetPasswordSuccessAction:
380
+ case DaffAuthResetPasswordActionTypes.SendResetEmailSuccessAction:
381
+ return {
382
+ ...state,
383
+ loading: false,
384
+ };
385
+ case DaffAuthResetPasswordActionTypes.ResetPasswordFailureAction:
386
+ case DaffAuthResetPasswordActionTypes.SendResetEmailFailureAction:
387
+ return {
388
+ ...state,
389
+ loading: false,
390
+ errors: [action.errorMessage],
391
+ };
392
+ case DaffAuthResetPasswordActionTypes.ResetPasswordLandingAction:
393
+ return {
394
+ ...state,
395
+ token: action.token,
396
+ };
397
+ default:
398
+ return state;
399
+ }
400
+ }
401
+
402
+ const DAFF_AUTH_STORE_FEATURE_KEY = 'daffAuth';
403
+
404
+ const daffAuthReducers = {
405
+ auth: daffAuthReducer,
406
+ login: daffAuthLoginReducer,
407
+ register: daffAuthRegisterReducer,
408
+ resetPassword: daffAuthResetPasswordReducer,
409
+ };
410
+
411
+ /**
412
+ * Feature State Selector
413
+ */
414
+ const getDaffAuthFeatureStateSelector = (() => {
415
+ let cache;
416
+ return () => cache = cache || createFeatureSelector(DAFF_AUTH_STORE_FEATURE_KEY);
417
+ })();
418
+
419
+ const createAuthSelectors = () => {
420
+ const selectAuthState = createSelector(getDaffAuthFeatureStateSelector(), state => state.auth);
421
+ const selectAuthLoading = createSelector(selectAuthState, state => state.loading);
422
+ const selectAuthErrors = createSelector(selectAuthState, state => state.errors);
423
+ return {
424
+ selectAuthState,
425
+ selectAuthLoading,
426
+ selectAuthErrors,
427
+ };
428
+ };
429
+ const getAuthSelectors = (() => {
430
+ let cache;
431
+ return () => cache = cache || createAuthSelectors();
432
+ })();
433
+
434
+ const createLoginSelectors = () => {
435
+ const selectAuthLoginState = createSelector(getDaffAuthFeatureStateSelector(), state => state.login);
436
+ const selectAuthLoginLoading = createSelector(selectAuthLoginState, state => state.loading);
437
+ const selectAuthLoginErrors = createSelector(selectAuthLoginState, state => state.errors);
438
+ return {
439
+ selectAuthLoginState,
440
+ selectAuthLoginLoading,
441
+ selectAuthLoginErrors,
442
+ };
443
+ };
444
+ const getDaffAuthLoginSelectors = (() => {
445
+ let cache;
446
+ return () => cache = cache || createLoginSelectors();
447
+ })();
448
+
449
+ const createRegisterSelectors = () => {
450
+ const selectAuthRegisterState = createSelector(getDaffAuthFeatureStateSelector(), state => state.register);
451
+ const selectAuthRegisterLoading = createSelector(selectAuthRegisterState, state => state.loading);
452
+ const selectAuthRegisterErrors = createSelector(selectAuthRegisterState, state => state.errors);
453
+ return {
454
+ selectAuthRegisterState,
455
+ selectAuthRegisterLoading,
456
+ selectAuthRegisterErrors,
457
+ };
458
+ };
459
+ const getDaffAuthRegisterSelectors = (() => {
460
+ let cache;
461
+ return () => cache = cache || createRegisterSelectors();
462
+ })();
463
+
464
+ const createResetPasswordSelectors = () => {
465
+ const selectAuthResetPasswordState = createSelector(getDaffAuthFeatureStateSelector(), state => state.resetPassword);
466
+ const selectAuthResetPasswordLoading = createSelector(selectAuthResetPasswordState, state => state.loading);
467
+ const selectAuthResetPasswordErrors = createSelector(selectAuthResetPasswordState, state => state.errors);
468
+ const selectAuthResetPasswordToken = createSelector(selectAuthResetPasswordState, state => state.token);
469
+ return {
470
+ selectAuthResetPasswordState,
471
+ selectAuthResetPasswordLoading,
472
+ selectAuthResetPasswordErrors,
473
+ selectAuthResetPasswordToken,
474
+ };
475
+ };
476
+ const getDaffAuthResetPasswordSelectors = (() => {
477
+ let cache;
478
+ return () => cache = cache || createResetPasswordSelectors();
479
+ })();
480
+
481
+ const getDaffAuthSelectors = (() => {
482
+ let cache;
483
+ return () => cache = cache || {
484
+ ...getAuthSelectors(),
485
+ ...getDaffAuthLoginSelectors(),
486
+ ...getDaffAuthRegisterSelectors(),
487
+ ...getDaffAuthResetPasswordSelectors(),
488
+ selectAuthFeatureState: getDaffAuthFeatureStateSelector(),
489
+ };
490
+ })();
491
+
492
+ /**
493
+ * @inheritdoc
494
+ */
495
+ class DaffAuthFacade {
496
+ constructor(store) {
497
+ this.store = store;
498
+ const { selectAuthLoading, selectAuthErrors, } = getDaffAuthSelectors();
499
+ this.loading$ = this.store.pipe(select(selectAuthLoading));
500
+ this.errors$ = this.store.pipe(select(selectAuthErrors));
501
+ }
502
+ dispatch(action) {
503
+ this.store.dispatch(action);
504
+ }
505
+ }
506
+ /** @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 });
507
+ /** @nocollapse */ DaffAuthFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthFacade, providedIn: 'root' });
508
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthFacade, decorators: [{
509
+ type: Injectable,
510
+ args: [{
511
+ providedIn: 'root',
512
+ }]
513
+ }], ctorParameters: function () { return [{ type: i1.Store }]; } });
514
+
515
+ /**
516
+ * @inheritdoc
517
+ */
518
+ class DaffAuthLoginFacade {
519
+ constructor(store) {
520
+ this.store = store;
521
+ const { selectAuthLoginLoading, selectAuthLoginErrors, } = getDaffAuthSelectors();
522
+ this.loading$ = this.store.pipe(select(selectAuthLoginLoading));
523
+ this.errors$ = this.store.pipe(select(selectAuthLoginErrors));
524
+ }
525
+ dispatch(action) {
526
+ this.store.dispatch(action);
527
+ }
528
+ }
529
+ /** @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 });
530
+ /** @nocollapse */ DaffAuthLoginFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthLoginFacade, providedIn: 'root' });
531
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthLoginFacade, decorators: [{
532
+ type: Injectable,
533
+ args: [{
534
+ providedIn: 'root',
535
+ }]
536
+ }], ctorParameters: function () { return [{ type: i1.Store }]; } });
537
+
538
+ /**
539
+ * @inheritdoc
540
+ */
541
+ class DaffAuthRegisterFacade {
542
+ constructor(store) {
543
+ this.store = store;
544
+ const { selectAuthRegisterLoading, selectAuthRegisterErrors, } = getDaffAuthSelectors();
545
+ this.loading$ = this.store.pipe(select(selectAuthRegisterLoading));
546
+ this.errors$ = this.store.pipe(select(selectAuthRegisterErrors));
547
+ }
548
+ dispatch(action) {
549
+ this.store.dispatch(action);
550
+ }
551
+ }
552
+ /** @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 });
553
+ /** @nocollapse */ DaffAuthRegisterFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRegisterFacade, providedIn: 'root' });
554
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRegisterFacade, decorators: [{
555
+ type: Injectable,
556
+ args: [{
557
+ providedIn: 'root',
558
+ }]
559
+ }], ctorParameters: function () { return [{ type: i1.Store }]; } });
560
+
561
+ /**
562
+ * @inheritdoc
563
+ */
564
+ class DaffAuthResetPasswordFacade {
565
+ constructor(store) {
566
+ this.store = store;
567
+ const { selectAuthResetPasswordLoading, selectAuthResetPasswordErrors, selectAuthResetPasswordToken, } = getDaffAuthSelectors();
568
+ this.token$ = this.store.pipe(select(selectAuthResetPasswordToken));
569
+ this.loading$ = this.store.pipe(select(selectAuthResetPasswordLoading));
570
+ this.errors$ = this.store.pipe(select(selectAuthResetPasswordErrors));
571
+ }
572
+ dispatch(action) {
573
+ this.store.dispatch(action);
574
+ }
575
+ }
576
+ /** @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 });
577
+ /** @nocollapse */ DaffAuthResetPasswordFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthResetPasswordFacade, providedIn: 'root' });
578
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthResetPasswordFacade, decorators: [{
579
+ type: Injectable,
580
+ args: [{
581
+ providedIn: 'root',
582
+ }]
583
+ }], ctorParameters: function () { return [{ type: i1.Store }]; } });
584
+
585
+ const TWENTY_MINUTES = 1.2e6;
586
+ const daffAuthStateDefaultConfig = {
587
+ checkInterval: TWENTY_MINUTES,
588
+ };
589
+
590
+ const DAFF_AUTH_STATE_CONFIG = new InjectionToken('DAFF_AUTH_STATE_CONFIG', { factory: () => daffAuthStateDefaultConfig });
591
+ const provideDaffAuthStateConfig = (config) => ({
592
+ provide: DAFF_AUTH_STATE_CONFIG,
593
+ useValue: config,
594
+ });
595
+
596
+ class DaffAuthEffects {
597
+ constructor(actions$, authDriver, errorMatcher, storage, config) {
598
+ this.actions$ = actions$;
599
+ this.authDriver = authDriver;
600
+ this.errorMatcher = errorMatcher;
601
+ this.storage = storage;
602
+ this.config = config;
603
+ this.check$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthActionTypes.AuthCheckAction), switchMap((action) => this.authDriver.check().pipe(map(() => new DaffAuthCheckSuccess()), catchError((error) => {
604
+ this.storage.removeAuthToken();
605
+ return of(new DaffAuthCheckFailure(this.errorMatcher(error)));
606
+ })))));
607
+ this.guardCheck$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthActionTypes.AuthGuardCheckAction), switchMap((action) => this.authDriver.check().pipe(map(() => new DaffAuthGuardCheckCompletion(true)), catchError((error) => {
608
+ this.storage.removeAuthToken();
609
+ return of(new DaffAuthGuardCheckCompletion(false));
610
+ })))));
611
+ // this needs to be defined after `check$` or else the driver call won't be run
612
+ this.authCheckInterval$ = createEffect(() => of(new DaffAuthCheck()).pipe(repeat({ delay: this.config.checkInterval }), filter(() => !!this.storage.getAuthToken())));
613
+ }
614
+ }
615
+ /** @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 });
616
+ /** @nocollapse */ DaffAuthEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthEffects });
617
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthEffects, decorators: [{
618
+ type: Injectable
619
+ }], ctorParameters: function () { return [{ type: i1$1.Actions }, { type: undefined, decorators: [{
620
+ type: Inject,
621
+ args: [DaffAuthDriver]
622
+ }] }, { type: undefined, decorators: [{
623
+ type: Inject,
624
+ args: [DAFF_AUTH_ERROR_MATCHER]
625
+ }] }, { type: i2.DaffAuthStorageService }, { type: undefined, decorators: [{
626
+ type: Inject,
627
+ args: [DAFF_AUTH_STATE_CONFIG]
628
+ }] }]; } });
629
+
630
+ class DaffAuthLoginEffects {
631
+ constructor(actions$, loginDriver, errorMatcher, storage) {
632
+ this.actions$ = actions$;
633
+ this.loginDriver = loginDriver;
634
+ this.errorMatcher = errorMatcher;
635
+ this.storage = storage;
636
+ 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))))))));
637
+ this.logout$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthLoginActionTypes.LogoutAction), switchMap((action) => this.loginDriver.logout().pipe(map(() => new DaffAuthLogoutSuccess()), tap(() => {
638
+ this.storage.removeAuthToken();
639
+ }), catchError((error) => of(new DaffAuthLogoutFailure(this.errorMatcher(error))))))));
640
+ this.storeAuthToken$ = createEffect(() => this.actions$.pipe(ofType(DaffAuthLoginActionTypes.LoginSuccessAction), tap((action) => {
641
+ this.storage.setAuthToken(action.auth.token);
642
+ }), map(() => new DaffAuthComplete()), catchError((error) => of(new DaffAuthStorageFailure(this.errorMatcher(error))))));
643
+ }
644
+ }
645
+ /** @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 });
646
+ /** @nocollapse */ DaffAuthLoginEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthLoginEffects });
647
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthLoginEffects, decorators: [{
648
+ type: Injectable
649
+ }], ctorParameters: function () { return [{ type: i1$1.Actions }, { type: undefined, decorators: [{
650
+ type: Inject,
651
+ args: [DaffLoginDriver]
652
+ }] }, { type: undefined, decorators: [{
653
+ type: Inject,
654
+ args: [DAFF_AUTH_ERROR_MATCHER]
655
+ }] }, { type: i2.DaffAuthStorageService }]; } });
656
+
657
+ class DaffAuthRegisterEffects {
658
+ constructor(actions$, registerDriver, errorMatcher, storage) {
659
+ this.actions$ = actions$;
660
+ this.registerDriver = registerDriver;
661
+ this.errorMatcher = errorMatcher;
662
+ this.storage = storage;
663
+ 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))))))));
664
+ }
665
+ }
666
+ /** @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 });
667
+ /** @nocollapse */ DaffAuthRegisterEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRegisterEffects });
668
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthRegisterEffects, decorators: [{
669
+ type: Injectable
670
+ }], ctorParameters: function () { return [{ type: i1$1.Actions }, { type: undefined, decorators: [{
671
+ type: Inject,
672
+ args: [DaffRegisterDriver]
673
+ }] }, { type: undefined, decorators: [{
674
+ type: Inject,
675
+ args: [DAFF_AUTH_ERROR_MATCHER]
676
+ }] }, { type: i2.DaffAuthStorageService }]; } });
677
+
678
+ class DaffAuthResetPasswordEffects {
679
+ constructor(actions$, driver, errorMatcher, storage) {
680
+ this.actions$ = actions$;
681
+ this.driver = driver;
682
+ this.errorMatcher = errorMatcher;
683
+ this.storage = storage;
684
+ 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))))))));
685
+ 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))))))));
686
+ }
687
+ }
688
+ /** @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 });
689
+ /** @nocollapse */ DaffAuthResetPasswordEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthResetPasswordEffects });
690
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthResetPasswordEffects, decorators: [{
691
+ type: Injectable
692
+ }], ctorParameters: function () { return [{ type: i1$1.Actions }, { type: undefined, decorators: [{
693
+ type: Inject,
694
+ args: [DaffResetPasswordDriver]
695
+ }] }, { type: undefined, decorators: [{
696
+ type: Inject,
697
+ args: [DAFF_AUTH_ERROR_MATCHER]
698
+ }] }, { type: i2.DaffAuthStorageService }]; } });
699
+
700
+ class DaffAuthStateModule {
701
+ static withConfig(config) {
702
+ return {
703
+ ngModule: DaffAuthStateModule,
704
+ providers: [
705
+ provideDaffAuthStateConfig(config),
706
+ ],
707
+ };
708
+ }
709
+ }
710
+ /** @nocollapse */ DaffAuthStateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
711
+ /** @nocollapse */ DaffAuthStateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthStateModule, imports: [i1.StoreFeatureModule, i1$1.EffectsFeatureModule] });
712
+ /** @nocollapse */ DaffAuthStateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthStateModule, imports: [[
713
+ StoreModule.forFeature(DAFF_AUTH_STORE_FEATURE_KEY, daffAuthReducers),
714
+ EffectsModule.forFeature([
715
+ DaffAuthEffects,
716
+ DaffAuthLoginEffects,
717
+ DaffAuthRegisterEffects,
718
+ DaffAuthResetPasswordEffects,
719
+ ]),
720
+ ]] });
721
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffAuthStateModule, decorators: [{
722
+ type: NgModule,
723
+ args: [{
724
+ imports: [
725
+ StoreModule.forFeature(DAFF_AUTH_STORE_FEATURE_KEY, daffAuthReducers),
726
+ EffectsModule.forFeature([
727
+ DaffAuthEffects,
728
+ DaffAuthLoginEffects,
729
+ DaffAuthRegisterEffects,
730
+ DaffAuthResetPasswordEffects,
731
+ ]),
732
+ ],
733
+ }]
734
+ }] });
735
+
736
+ /**
737
+ * Generated bundle index. Do not edit.
738
+ */
739
+
740
+ 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 };
741
+ //# sourceMappingURL=daffodil-auth-state.mjs.map