@bravobit/bb-foundation 0.16.4 → 0.20.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 (426) hide show
  1. package/README.md +47 -47
  2. package/auth/bravobit-bb-foundation-auth.d.ts +5 -5
  3. package/auth/lib/auth.interceptor.d.ts +21 -21
  4. package/auth/lib/auth.module.d.ts +15 -15
  5. package/auth/lib/auth.service.d.ts +59 -59
  6. package/auth/lib/auth.session.d.ts +34 -34
  7. package/auth/lib/directives/authenticated.directive.d.ts +14 -14
  8. package/auth/lib/directives/permission.directive.d.ts +24 -24
  9. package/auth/lib/directives/role.directive.d.ts +16 -16
  10. package/auth/lib/guards/anonymous.guard.d.ts +11 -11
  11. package/auth/lib/guards/authenticated.guard.d.ts +11 -11
  12. package/auth/lib/helpers/jwt.helper.d.ts +8 -8
  13. package/auth/lib/helpers/mapper.helper.d.ts +23 -23
  14. package/auth/lib/interfaces/config.interface.d.ts +12 -12
  15. package/auth/lib/interfaces/mapper.interface.d.ts +19 -19
  16. package/auth/lib/interfaces/provider.interface.d.ts +16 -16
  17. package/auth/lib/interfaces/token.interface.d.ts +11 -11
  18. package/auth/lib/permissions.service.d.ts +14 -14
  19. package/auth/lib/providers/email.provider.d.ts +15 -15
  20. package/auth/lib/providers/verify.provider.d.ts +13 -13
  21. package/auth/lib/tokens/use-authorization.token.d.ts +2 -2
  22. package/auth/public_api.d.ts +18 -18
  23. package/bravobit-bb-foundation.d.ts +5 -5
  24. package/collections/bravobit-bb-foundation-collections.d.ts +5 -5
  25. package/collections/lib/collection.d.ts +43 -43
  26. package/collections/lib/collections.module.d.ts +10 -10
  27. package/collections/lib/components/collections-pager/collections-pager.component.d.ts +34 -34
  28. package/collections/lib/components/collections-viewer/collections-viewer.component.d.ts +12 -12
  29. package/collections/lib/components/collections.directive.d.ts +17 -17
  30. package/collections/lib/interfaces/collection.interface.d.ts +26 -26
  31. package/collections/lib/providers/api-collection.provider.d.ts +19 -15
  32. package/collections/lib/providers/collection.provider.d.ts +6 -6
  33. package/collections/lib/providers/local-collection.provider.d.ts +8 -8
  34. package/collections/public_api.d.ts +9 -9
  35. package/controls/bravobit-bb-foundation-controls.d.ts +5 -5
  36. package/controls/lib/checkbox/checkbox/checkbox.component.d.ts +47 -47
  37. package/controls/lib/checkbox/checkbox-group/checkbox-group.component.d.ts +18 -18
  38. package/controls/lib/checkbox/checkbox.module.d.ts +9 -9
  39. package/controls/lib/controls.module.d.ts +7 -7
  40. package/controls/public_api.d.ts +4 -4
  41. package/dashboard/bravobit-bb-foundation-dashboard.d.ts +5 -5
  42. package/dashboard/lib/dashboard/dashboard.component.d.ts +19 -19
  43. package/dashboard/lib/dashboard-header/dashboard-header.component.d.ts +11 -11
  44. package/dashboard/lib/dashboard-menu/dashboard-menu.component.d.ts +9 -9
  45. package/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.d.ts +11 -11
  46. package/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.d.ts +21 -21
  47. package/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.d.ts +27 -27
  48. package/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.d.ts +16 -16
  49. package/dashboard/lib/dashboard.module.d.ts +16 -16
  50. package/dashboard/public_api.d.ts +8 -8
  51. package/dialog/bravobit-bb-foundation-dialog.d.ts +5 -5
  52. package/dialog/lib/dialog-actions/dialog-actions.component.d.ts +5 -5
  53. package/dialog/lib/dialog-confirm/dialog-confirm.component.d.ts +16 -16
  54. package/dialog/lib/dialog-container/dialog-container.component.d.ts +24 -24
  55. package/dialog/lib/dialog-header/dialog-header.component.d.ts +9 -9
  56. package/dialog/lib/dialog-link/dialog-link.component.d.ts +5 -5
  57. package/dialog/lib/dialog-modal/dialog-modal.component.d.ts +12 -12
  58. package/dialog/lib/dialog-overlay/dialog-overlay.component.d.ts +22 -22
  59. package/dialog/lib/dialog.injector.d.ts +8 -8
  60. package/dialog/lib/dialog.insertion.d.ts +8 -8
  61. package/dialog/lib/dialog.interfaces.d.ts +3 -3
  62. package/dialog/lib/dialog.module.d.ts +19 -19
  63. package/dialog/lib/dialog.ref.d.ts +8 -8
  64. package/dialog/lib/dialog.service.d.ts +19 -19
  65. package/dialog/public_api.d.ts +9 -9
  66. package/elements/bravobit-bb-foundation-elements.d.ts +5 -5
  67. package/elements/lib/avatar/avatar.component.d.ts +25 -25
  68. package/elements/lib/button/button.component.d.ts +23 -23
  69. package/elements/lib/checkbox/checkbox.component.d.ts +27 -27
  70. package/elements/lib/date-picker/date-picker.component.d.ts +69 -69
  71. package/elements/lib/directives/addon.directive.d.ts +9 -9
  72. package/elements/lib/directives/autosize.directive.d.ts +18 -18
  73. package/elements/lib/directives/focus-trap.directive.d.ts +17 -17
  74. package/elements/lib/directives/focus.directive.d.ts +14 -14
  75. package/elements/lib/directives/form-submit.directive.d.ts +17 -17
  76. package/elements/lib/directives/input.directive.d.ts +38 -38
  77. package/elements/lib/directives/template.directive.d.ts +10 -10
  78. package/elements/lib/dropdown/dropdown.component.d.ts +21 -21
  79. package/elements/lib/elements.interfaces.d.ts +25 -25
  80. package/elements/lib/elements.module.d.ts +116 -116
  81. package/elements/lib/file-picker/file-picker.component.d.ts +49 -49
  82. package/elements/lib/form-control/form-control.component.d.ts +21 -21
  83. package/elements/lib/form-error/form-error.component.d.ts +29 -29
  84. package/elements/lib/form-group/form-group.component.d.ts +10 -10
  85. package/elements/lib/icon/icon.component.d.ts +22 -22
  86. package/elements/lib/image-picker/image-picker.component.d.ts +38 -38
  87. package/elements/lib/pipes/file-image.pipe.d.ts +13 -13
  88. package/elements/lib/pipes/file-size.pipe.d.ts +8 -8
  89. package/elements/lib/pipes/relative-time.pipe.d.ts +19 -19
  90. package/elements/lib/spinner/spinner.component.d.ts +12 -12
  91. package/elements/lib/tag/tag.component.d.ts +7 -7
  92. package/elements/public_api.d.ts +25 -25
  93. package/esm2020/auth/bravobit-bb-foundation-auth.mjs +4 -4
  94. package/esm2020/auth/lib/auth.interceptor.mjs +93 -94
  95. package/esm2020/auth/lib/auth.module.mjs +54 -54
  96. package/esm2020/auth/lib/auth.service.mjs +281 -276
  97. package/esm2020/auth/lib/auth.session.mjs +131 -131
  98. package/esm2020/auth/lib/directives/authenticated.directive.mjs +31 -31
  99. package/esm2020/auth/lib/directives/permission.directive.mjs +80 -80
  100. package/esm2020/auth/lib/directives/role.directive.mjs +37 -37
  101. package/esm2020/auth/lib/guards/anonymous.guard.mjs +34 -34
  102. package/esm2020/auth/lib/guards/authenticated.guard.mjs +35 -35
  103. package/esm2020/auth/lib/helpers/jwt.helper.mjs +69 -69
  104. package/esm2020/auth/lib/helpers/mapper.helper.mjs +35 -35
  105. package/esm2020/auth/lib/interfaces/config.interface.mjs +3 -3
  106. package/esm2020/auth/lib/interfaces/mapper.interface.mjs +2 -2
  107. package/esm2020/auth/lib/interfaces/provider.interface.mjs +2 -2
  108. package/esm2020/auth/lib/interfaces/token.interface.mjs +2 -2
  109. package/esm2020/auth/lib/permissions.service.mjs +56 -56
  110. package/esm2020/auth/lib/providers/email.provider.mjs +25 -25
  111. package/esm2020/auth/lib/providers/verify.provider.mjs +19 -19
  112. package/esm2020/auth/lib/tokens/use-authorization.token.mjs +3 -3
  113. package/esm2020/auth/public_api.mjs +19 -19
  114. package/esm2020/bravobit-bb-foundation.mjs +4 -4
  115. package/esm2020/collections/bravobit-bb-foundation-collections.mjs +4 -4
  116. package/esm2020/collections/lib/collection.mjs +102 -102
  117. package/esm2020/collections/lib/collections.module.mjs +54 -54
  118. package/esm2020/collections/lib/components/collections-pager/collections-pager.component.mjs +123 -123
  119. package/esm2020/collections/lib/components/collections-viewer/collections-viewer.component.mjs +31 -31
  120. package/esm2020/collections/lib/components/collections.directive.mjs +43 -43
  121. package/esm2020/collections/lib/interfaces/collection.interface.mjs +2 -2
  122. package/esm2020/collections/lib/providers/api-collection.provider.mjs +71 -71
  123. package/esm2020/collections/lib/providers/collection.provider.mjs +13 -13
  124. package/esm2020/collections/lib/providers/local-collection.provider.mjs +16 -16
  125. package/esm2020/collections/public_api.mjs +10 -10
  126. package/esm2020/controls/bravobit-bb-foundation-controls.mjs +4 -4
  127. package/esm2020/controls/lib/checkbox/checkbox/checkbox.component.mjs +153 -153
  128. package/esm2020/controls/lib/checkbox/checkbox-group/checkbox-group.component.mjs +48 -48
  129. package/esm2020/controls/lib/checkbox/checkbox.module.mjs +19 -19
  130. package/esm2020/controls/lib/controls.module.mjs +16 -16
  131. package/esm2020/controls/public_api.mjs +5 -5
  132. package/esm2020/dashboard/bravobit-bb-foundation-dashboard.mjs +4 -4
  133. package/esm2020/dashboard/lib/dashboard/dashboard.component.mjs +56 -56
  134. package/esm2020/dashboard/lib/dashboard-header/dashboard-header.component.mjs +30 -30
  135. package/esm2020/dashboard/lib/dashboard-menu/dashboard-menu.component.mjs +31 -31
  136. package/esm2020/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.mjs +29 -29
  137. package/esm2020/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.mjs +75 -75
  138. package/esm2020/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.mjs +99 -99
  139. package/esm2020/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.mjs +62 -62
  140. package/esm2020/dashboard/lib/dashboard.module.mjs +47 -47
  141. package/esm2020/dashboard/public_api.mjs +9 -9
  142. package/esm2020/dialog/bravobit-bb-foundation-dialog.mjs +4 -4
  143. package/esm2020/dialog/lib/dialog-actions/dialog-actions.component.mjs +12 -12
  144. package/esm2020/dialog/lib/dialog-confirm/dialog-confirm.component.mjs +37 -37
  145. package/esm2020/dialog/lib/dialog-container/dialog-container.component.mjs +153 -153
  146. package/esm2020/dialog/lib/dialog-header/dialog-header.component.mjs +25 -25
  147. package/esm2020/dialog/lib/dialog-link/dialog-link.component.mjs +11 -11
  148. package/esm2020/dialog/lib/dialog-modal/dialog-modal.component.mjs +46 -46
  149. package/esm2020/dialog/lib/dialog-overlay/dialog-overlay.component.mjs +134 -134
  150. package/esm2020/dialog/lib/dialog.injector.mjs +18 -18
  151. package/esm2020/dialog/lib/dialog.insertion.mjs +16 -16
  152. package/esm2020/dialog/lib/dialog.interfaces.mjs +3 -3
  153. package/esm2020/dialog/lib/dialog.module.mjs +70 -70
  154. package/esm2020/dialog/lib/dialog.ref.mjs +22 -22
  155. package/esm2020/dialog/lib/dialog.service.mjs +77 -77
  156. package/esm2020/dialog/public_api.mjs +10 -10
  157. package/esm2020/elements/bravobit-bb-foundation-elements.mjs +4 -4
  158. package/esm2020/elements/lib/avatar/avatar.component.mjs +145 -142
  159. package/esm2020/elements/lib/button/button.component.mjs +61 -61
  160. package/esm2020/elements/lib/checkbox/checkbox.component.mjs +73 -73
  161. package/esm2020/elements/lib/date-picker/date-picker.component.mjs +304 -304
  162. package/esm2020/elements/lib/directives/addon.directive.mjs +29 -29
  163. package/esm2020/elements/lib/directives/autosize.directive.mjs +72 -72
  164. package/esm2020/elements/lib/directives/focus-trap.directive.mjs +77 -77
  165. package/esm2020/elements/lib/directives/focus.directive.mjs +39 -39
  166. package/esm2020/elements/lib/directives/form-submit.directive.mjs +50 -50
  167. package/esm2020/elements/lib/directives/input.directive.mjs +136 -136
  168. package/esm2020/elements/lib/directives/template.directive.mjs +28 -28
  169. package/esm2020/elements/lib/dropdown/dropdown.component.mjs +100 -100
  170. package/esm2020/elements/lib/elements.interfaces.mjs +4 -4
  171. package/esm2020/elements/lib/elements.module.mjs +177 -177
  172. package/esm2020/elements/lib/file-picker/file-picker.component.mjs +236 -236
  173. package/esm2020/elements/lib/form-control/form-control.component.mjs +49 -49
  174. package/esm2020/elements/lib/form-error/form-error.component.mjs +108 -108
  175. package/esm2020/elements/lib/form-group/form-group.component.mjs +18 -18
  176. package/esm2020/elements/lib/icon/icon.component.mjs +102 -102
  177. package/esm2020/elements/lib/image-picker/image-picker.component.mjs +106 -106
  178. package/esm2020/elements/lib/pipes/file-image.pipe.mjs +42 -42
  179. package/esm2020/elements/lib/pipes/file-size.pipe.mjs +28 -28
  180. package/esm2020/elements/lib/pipes/relative-time.pipe.mjs +94 -94
  181. package/esm2020/elements/lib/spinner/spinner.component.mjs +25 -25
  182. package/esm2020/elements/lib/tag/tag.component.mjs +18 -18
  183. package/esm2020/elements/public_api.mjs +26 -26
  184. package/esm2020/http/bravobit-bb-foundation-http.mjs +4 -4
  185. package/esm2020/http/lib/classes/http.config.mjs +29 -29
  186. package/esm2020/http/lib/classes/http.error.mjs +20 -20
  187. package/esm2020/http/lib/http.interfaces.mjs +2 -2
  188. package/esm2020/http/lib/http.module.mjs +43 -43
  189. package/esm2020/http/lib/interceptors/base-url.interceptor.mjs +50 -50
  190. package/esm2020/http/lib/interceptors/error.interceptor.mjs +32 -32
  191. package/esm2020/http/public_api.mjs +7 -7
  192. package/esm2020/lib/core/miscellaneous/regex.mjs +5 -5
  193. package/esm2020/lib/core/miscellaneous/validator.mjs +85 -85
  194. package/esm2020/lib/core/mixins/can-disable.mjs +16 -16
  195. package/esm2020/lib/core/mixins/can-hide-errors.mjs +16 -16
  196. package/esm2020/lib/core/mixins/can-load.mjs +16 -16
  197. package/esm2020/lib/core/mixins/constructor.mjs +2 -2
  198. package/esm2020/lib/core/mixins/has-error.mjs +16 -16
  199. package/esm2020/lib/core/mixins/is-focused.mjs +16 -16
  200. package/esm2020/lib/core/mixins/is-grouped.mjs +16 -16
  201. package/esm2020/lib/core/mixins/is-readonly.mjs +16 -16
  202. package/esm2020/lib/core/mixins/is-required.mjs +16 -16
  203. package/esm2020/lib/core/services/clipboard.service.mjs +70 -70
  204. package/esm2020/lib/core/services/exif.service.mjs +163 -163
  205. package/esm2020/lib/core/services/file-loader.service.mjs +87 -87
  206. package/esm2020/lib/core/services/image-converter.service.mjs +123 -123
  207. package/esm2020/lib/core/services/languages.service.mjs +74 -74
  208. package/esm2020/lib/core/services/network.service.mjs +55 -55
  209. package/esm2020/lib/core/services/patch.service.mjs +63 -63
  210. package/esm2020/lib/core/services/platform.service.mjs +42 -42
  211. package/esm2020/lib/core/tokens/accept-language.token.mjs +3 -3
  212. package/esm2020/lib/core/tokens/base-url.token.mjs +3 -3
  213. package/esm2020/lib/core/tokens/cookie.token.mjs +3 -3
  214. package/esm2020/lib/core/tokens/location.token.mjs +6 -6
  215. package/esm2020/lib/core/tokens/navigator.token.mjs +6 -6
  216. package/esm2020/lib/core/tokens/window.token.mjs +12 -12
  217. package/esm2020/localize/bravobit-bb-foundation-localize.mjs +4 -4
  218. package/esm2020/localize/lib/functions/date.function.mjs +18 -18
  219. package/esm2020/localize/lib/functions/lowercase.function.mjs +13 -13
  220. package/esm2020/localize/lib/functions/uppercase.function.mjs +13 -13
  221. package/esm2020/localize/lib/handlers/missing.handler.mjs +15 -17
  222. package/esm2020/localize/lib/interfaces/config.interfaces.mjs +7 -10
  223. package/esm2020/localize/lib/interfaces/functions.interfaces.mjs +8 -8
  224. package/esm2020/localize/lib/interfaces/handlers.interfaces.mjs +2 -2
  225. package/esm2020/localize/lib/interfaces/options.interfaces.mjs +6 -6
  226. package/esm2020/localize/lib/localizations/dutch.localization.mjs +45 -53
  227. package/esm2020/localize/lib/localizations/english.localization.mjs +45 -53
  228. package/esm2020/localize/lib/localize.dictionary.mjs +26 -135
  229. package/esm2020/localize/lib/localize.module.mjs +71 -72
  230. package/esm2020/localize/lib/localize.pipe.mjs +49 -49
  231. package/esm2020/localize/lib/localize.service.mjs +205 -280
  232. package/esm2020/localize/lib/views/localize-string/localize-string.component.mjs +88 -88
  233. package/esm2020/localize/lib/views/localize-template-or-string.directive.mjs +28 -28
  234. package/esm2020/localize/lib/views/localize-template.directive.mjs +21 -21
  235. package/esm2020/localize/public_api.mjs +17 -18
  236. package/esm2020/notifications/bravobit-bb-foundation-notifications.mjs +4 -4
  237. package/esm2020/notifications/lib/notifications-item/notifications-item.component.mjs +100 -100
  238. package/esm2020/notifications/lib/notifications-list/notifications-list.component.mjs +47 -47
  239. package/esm2020/notifications/lib/notifications.animations.mjs +28 -28
  240. package/esm2020/notifications/lib/notifications.injector.mjs +18 -18
  241. package/esm2020/notifications/lib/notifications.interfaces.mjs +20 -20
  242. package/esm2020/notifications/lib/notifications.module.mjs +30 -30
  243. package/esm2020/notifications/lib/notifications.service.mjs +145 -145
  244. package/esm2020/notifications/public_api.mjs +4 -4
  245. package/esm2020/public_api.mjs +29 -29
  246. package/esm2020/recaptcha/bravobit-bb-foundation-recaptcha.mjs +4 -4
  247. package/esm2020/recaptcha/lib/recaptcha/recaptcha.component.mjs +185 -185
  248. package/esm2020/recaptcha/lib/recaptcha-loader.service.mjs +90 -90
  249. package/esm2020/recaptcha/lib/recaptcha.interface.mjs +3 -3
  250. package/esm2020/recaptcha/lib/recaptcha.module.mjs +27 -27
  251. package/esm2020/recaptcha/public_api.mjs +5 -5
  252. package/esm2020/rxjs/bravobit-bb-foundation-rxjs.mjs +4 -4
  253. package/esm2020/rxjs/lib/operators/combine-latest-map.operator.mjs +10 -10
  254. package/esm2020/rxjs/lib/operators/filter-nil.operator.mjs +5 -5
  255. package/esm2020/rxjs/public_api.mjs +3 -3
  256. package/esm2020/storage/bravobit-bb-foundation-storage.mjs +4 -4
  257. package/esm2020/storage/lib/interfaces/attributes.interface.mjs +2 -2
  258. package/esm2020/storage/lib/interfaces/memory.interface.mjs +2 -2
  259. package/esm2020/storage/lib/interfaces/strategy.interface.mjs +2 -2
  260. package/esm2020/storage/lib/storage.service.mjs +109 -109
  261. package/esm2020/storage/lib/strategies/cookie-storage.strategy.mjs +142 -142
  262. package/esm2020/storage/lib/strategies/memory-storage.strategy.mjs +56 -56
  263. package/esm2020/storage/lib/strategies/polyfill-storage.strategy.mjs +102 -102
  264. package/esm2020/storage/public_api.mjs +8 -8
  265. package/esm2020/table/bravobit-bb-foundation-table.mjs +4 -4
  266. package/esm2020/table/lib/components/table/table.component.mjs +191 -191
  267. package/esm2020/table/lib/components/table-cell/table-cell.component.mjs +11 -11
  268. package/esm2020/table/lib/components/table-header-cell/table-header-cell.component.mjs +131 -131
  269. package/esm2020/table/lib/components/table-pager/table-pager.component.mjs +136 -136
  270. package/esm2020/table/lib/data/datasource.data.mjs +32 -32
  271. package/esm2020/table/lib/data/generic.data.mjs +72 -72
  272. package/esm2020/table/lib/interfaces/datasource.interface.mjs +2 -2
  273. package/esm2020/table/lib/interfaces/table.interfaces.mjs +2 -2
  274. package/esm2020/table/lib/table.module.mjs +42 -42
  275. package/esm2020/table/public_api.mjs +10 -10
  276. package/fesm2015/bravobit-bb-foundation-auth.mjs +930 -926
  277. package/fesm2015/bravobit-bb-foundation-auth.mjs.map +1 -1
  278. package/fesm2015/bravobit-bb-foundation-collections.mjs +423 -423
  279. package/fesm2015/bravobit-bb-foundation-collections.mjs.map +1 -1
  280. package/fesm2015/bravobit-bb-foundation-controls.mjs +216 -216
  281. package/fesm2015/bravobit-bb-foundation-controls.mjs.map +1 -1
  282. package/fesm2015/bravobit-bb-foundation-dashboard.mjs +382 -382
  283. package/fesm2015/bravobit-bb-foundation-dashboard.mjs.map +1 -1
  284. package/fesm2015/bravobit-bb-foundation-dialog.mjs +542 -542
  285. package/fesm2015/bravobit-bb-foundation-dialog.mjs.map +1 -1
  286. package/fesm2015/bravobit-bb-foundation-elements.mjs +1971 -1968
  287. package/fesm2015/bravobit-bb-foundation-elements.mjs.map +1 -1
  288. package/fesm2015/bravobit-bb-foundation-http.mjs +156 -156
  289. package/fesm2015/bravobit-bb-foundation-http.mjs.map +1 -1
  290. package/fesm2015/bravobit-bb-foundation-localize.mjs +611 -812
  291. package/fesm2015/bravobit-bb-foundation-localize.mjs.map +1 -1
  292. package/fesm2015/bravobit-bb-foundation-notifications.mjs +348 -348
  293. package/fesm2015/bravobit-bb-foundation-notifications.mjs.map +1 -1
  294. package/fesm2015/bravobit-bb-foundation-recaptcha.mjs +290 -290
  295. package/fesm2015/bravobit-bb-foundation-recaptcha.mjs.map +1 -1
  296. package/fesm2015/bravobit-bb-foundation-rxjs.mjs +7 -7
  297. package/fesm2015/bravobit-bb-foundation-rxjs.mjs.map +1 -1
  298. package/fesm2015/bravobit-bb-foundation-storage.mjs +401 -401
  299. package/fesm2015/bravobit-bb-foundation-storage.mjs.map +1 -1
  300. package/fesm2015/bravobit-bb-foundation-table.mjs +571 -571
  301. package/fesm2015/bravobit-bb-foundation-table.mjs.map +1 -1
  302. package/fesm2015/bravobit-bb-foundation.mjs +860 -860
  303. package/fesm2015/bravobit-bb-foundation.mjs.map +1 -1
  304. package/fesm2020/bravobit-bb-foundation-auth.mjs +882 -878
  305. package/fesm2020/bravobit-bb-foundation-auth.mjs.map +1 -1
  306. package/fesm2020/bravobit-bb-foundation-collections.mjs +413 -413
  307. package/fesm2020/bravobit-bb-foundation-collections.mjs.map +1 -1
  308. package/fesm2020/bravobit-bb-foundation-controls.mjs +214 -214
  309. package/fesm2020/bravobit-bb-foundation-controls.mjs.map +1 -1
  310. package/fesm2020/bravobit-bb-foundation-dashboard.mjs +370 -370
  311. package/fesm2020/bravobit-bb-foundation-dashboard.mjs.map +1 -1
  312. package/fesm2020/bravobit-bb-foundation-dialog.mjs +541 -541
  313. package/fesm2020/bravobit-bb-foundation-dialog.mjs.map +1 -1
  314. package/fesm2020/bravobit-bb-foundation-elements.mjs +1928 -1925
  315. package/fesm2020/bravobit-bb-foundation-elements.mjs.map +1 -1
  316. package/fesm2020/bravobit-bb-foundation-http.mjs +148 -148
  317. package/fesm2020/bravobit-bb-foundation-http.mjs.map +1 -1
  318. package/fesm2020/bravobit-bb-foundation-localize.mjs +590 -798
  319. package/fesm2020/bravobit-bb-foundation-localize.mjs.map +1 -1
  320. package/fesm2020/bravobit-bb-foundation-notifications.mjs +346 -346
  321. package/fesm2020/bravobit-bb-foundation-notifications.mjs.map +1 -1
  322. package/fesm2020/bravobit-bb-foundation-recaptcha.mjs +280 -280
  323. package/fesm2020/bravobit-bb-foundation-recaptcha.mjs.map +1 -1
  324. package/fesm2020/bravobit-bb-foundation-rxjs.mjs +10 -10
  325. package/fesm2020/bravobit-bb-foundation-rxjs.mjs.map +1 -1
  326. package/fesm2020/bravobit-bb-foundation-storage.mjs +396 -396
  327. package/fesm2020/bravobit-bb-foundation-storage.mjs.map +1 -1
  328. package/fesm2020/bravobit-bb-foundation-table.mjs +560 -560
  329. package/fesm2020/bravobit-bb-foundation-table.mjs.map +1 -1
  330. package/fesm2020/bravobit-bb-foundation.mjs +832 -832
  331. package/fesm2020/bravobit-bb-foundation.mjs.map +1 -1
  332. package/http/bravobit-bb-foundation-http.d.ts +5 -5
  333. package/http/lib/classes/http.config.d.ts +9 -9
  334. package/http/lib/classes/http.error.d.ts +7 -7
  335. package/http/lib/http.interfaces.d.ts +12 -12
  336. package/http/lib/http.module.d.ts +15 -15
  337. package/http/lib/interceptors/base-url.interceptor.d.ts +15 -15
  338. package/http/lib/interceptors/error.interceptor.d.ts +11 -11
  339. package/http/public_api.d.ts +6 -6
  340. package/lib/core/miscellaneous/regex.d.ts +4 -4
  341. package/lib/core/miscellaneous/validator.d.ts +13 -13
  342. package/lib/core/mixins/can-disable.d.ts +6 -6
  343. package/lib/core/mixins/can-hide-errors.d.ts +6 -6
  344. package/lib/core/mixins/can-load.d.ts +6 -6
  345. package/lib/core/mixins/constructor.d.ts +1 -1
  346. package/lib/core/mixins/has-error.d.ts +6 -6
  347. package/lib/core/mixins/is-focused.d.ts +6 -6
  348. package/lib/core/mixins/is-grouped.d.ts +6 -6
  349. package/lib/core/mixins/is-readonly.d.ts +6 -6
  350. package/lib/core/mixins/is-required.d.ts +6 -6
  351. package/lib/core/services/clipboard.service.d.ts +18 -18
  352. package/lib/core/services/exif.service.d.ts +15 -15
  353. package/lib/core/services/file-loader.service.d.ts +13 -13
  354. package/lib/core/services/image-converter.service.d.ts +21 -21
  355. package/lib/core/services/languages.service.d.ts +16 -16
  356. package/lib/core/services/network.service.d.ts +14 -14
  357. package/lib/core/services/patch.service.d.ts +16 -16
  358. package/lib/core/services/platform.service.d.ts +18 -18
  359. package/lib/core/tokens/accept-language.token.d.ts +2 -2
  360. package/lib/core/tokens/base-url.token.d.ts +2 -2
  361. package/lib/core/tokens/cookie.token.d.ts +2 -2
  362. package/lib/core/tokens/location.token.d.ts +2 -2
  363. package/lib/core/tokens/navigator.token.d.ts +2 -2
  364. package/lib/core/tokens/window.token.d.ts +2 -2
  365. package/localize/bravobit-bb-foundation-localize.d.ts +5 -5
  366. package/localize/lib/functions/date.function.d.ts +5 -5
  367. package/localize/lib/functions/lowercase.function.d.ts +5 -5
  368. package/localize/lib/functions/uppercase.function.d.ts +5 -5
  369. package/localize/lib/handlers/missing.handler.d.ts +6 -6
  370. package/localize/lib/interfaces/config.interfaces.d.ts +18 -9
  371. package/localize/lib/interfaces/functions.interfaces.d.ts +9 -9
  372. package/localize/lib/interfaces/handlers.interfaces.d.ts +6 -6
  373. package/localize/lib/interfaces/options.interfaces.d.ts +10 -10
  374. package/localize/lib/localizations/dutch.localization.d.ts +44 -51
  375. package/localize/lib/localizations/english.localization.d.ts +44 -51
  376. package/localize/lib/localize.dictionary.d.ts +7 -24
  377. package/localize/lib/localize.module.d.ts +17 -18
  378. package/localize/lib/localize.pipe.d.ts +12 -12
  379. package/localize/lib/localize.service.d.ts +40 -52
  380. package/localize/lib/views/localize-string/localize-string.component.d.ts +23 -23
  381. package/localize/lib/views/localize-template-or-string.directive.d.ts +10 -10
  382. package/localize/lib/views/localize-template.directive.d.ts +9 -9
  383. package/localize/public_api.d.ts +16 -17
  384. package/notifications/bravobit-bb-foundation-notifications.d.ts +5 -5
  385. package/notifications/lib/notifications-item/notifications-item.component.d.ts +34 -34
  386. package/notifications/lib/notifications-list/notifications-list.component.d.ts +16 -16
  387. package/notifications/lib/notifications.animations.d.ts +1 -1
  388. package/notifications/lib/notifications.injector.d.ts +8 -8
  389. package/notifications/lib/notifications.interfaces.d.ts +49 -49
  390. package/notifications/lib/notifications.module.d.ts +13 -13
  391. package/notifications/lib/notifications.service.d.ts +34 -34
  392. package/notifications/public_api.d.ts +3 -3
  393. package/package.json +6 -6
  394. package/public_api.d.ts +25 -25
  395. package/recaptcha/bravobit-bb-foundation-recaptcha.d.ts +5 -5
  396. package/recaptcha/lib/recaptcha/recaptcha.component.d.ts +47 -47
  397. package/recaptcha/lib/recaptcha-loader.service.d.ts +22 -22
  398. package/recaptcha/lib/recaptcha.interface.d.ts +14 -14
  399. package/recaptcha/lib/recaptcha.module.d.ts +10 -10
  400. package/recaptcha/public_api.d.ts +4 -4
  401. package/rxjs/bravobit-bb-foundation-rxjs.d.ts +5 -5
  402. package/rxjs/lib/operators/combine-latest-map.operator.d.ts +8 -8
  403. package/rxjs/lib/operators/filter-nil.operator.d.ts +1 -1
  404. package/rxjs/public_api.d.ts +2 -2
  405. package/storage/bravobit-bb-foundation-storage.d.ts +5 -5
  406. package/storage/lib/interfaces/attributes.interface.d.ts +13 -13
  407. package/storage/lib/interfaces/memory.interface.d.ts +7 -7
  408. package/storage/lib/interfaces/strategy.interface.d.ts +17 -17
  409. package/storage/lib/storage.service.d.ts +26 -26
  410. package/storage/lib/strategies/cookie-storage.strategy.d.ts +20 -20
  411. package/storage/lib/strategies/memory-storage.strategy.d.ts +11 -11
  412. package/storage/lib/strategies/polyfill-storage.strategy.d.ts +15 -15
  413. package/storage/public_api.d.ts +7 -7
  414. package/table/bravobit-bb-foundation-table.d.ts +5 -5
  415. package/table/lib/components/table/table.component.d.ts +56 -56
  416. package/table/lib/components/table-cell/table-cell.component.d.ts +5 -5
  417. package/table/lib/components/table-header-cell/table-header-cell.component.d.ts +29 -29
  418. package/table/lib/components/table-pager/table-pager.component.d.ts +41 -41
  419. package/table/lib/data/datasource.data.d.ts +14 -14
  420. package/table/lib/data/generic.data.d.ts +23 -23
  421. package/table/lib/interfaces/datasource.interface.d.ts +17 -17
  422. package/table/lib/interfaces/table.interfaces.d.ts +1 -1
  423. package/table/lib/table.module.d.ts +14 -14
  424. package/table/public_api.d.ts +9 -9
  425. package/esm2020/localize/lib/interfaces/dictionary.interfaces.mjs +0 -8
  426. package/localize/lib/interfaces/dictionary.interfaces.d.ts +0 -12
@@ -13,964 +13,968 @@ import * as i3 from '@bravobit/bb-foundation';
13
13
  import * as i7 from '@bravobit/bb-foundation/http';
14
14
  import { HttpError } from '@bravobit/bb-foundation/http';
15
15
 
16
- class AuthConfig {
16
+ class AuthConfig {
17
17
  }
18
18
 
19
19
  const USE_AUTHORIZATION = new HttpContextToken(() => true);
20
20
 
21
- class JwtHelper {
22
- constructor() {
23
- this.baseDecodeUnicode = (value) => {
24
- return decodeURIComponent(atob(value).replace(/(.)/g, (_, p) => {
25
- let code = p.charCodeAt(0).toString(16).toUpperCase();
26
- if (code.length < 2) {
27
- code = '0' + code;
28
- }
29
- return '%' + code;
30
- }));
31
- };
32
- this.parse = (data) => {
33
- return {
34
- id: data['iss'] || null,
35
- type: data['typ'] || null,
36
- audience: data['aud'] || null,
37
- issuer: data['iss'] || null,
38
- subject: data['sub'] || null,
39
- role: data['role'] || null,
40
- notValidBefore: this.parseDate(data['nbf']),
41
- expiresAt: this.parseDate(data['exp']),
42
- issuedAt: this.parseDate(data['iat'])
43
- };
44
- };
45
- this.parseDate = (epochInSeconds) => {
46
- if (!epochInSeconds || epochInSeconds <= 0) {
47
- return null;
48
- }
49
- return new Date(epochInSeconds * 1000);
50
- };
51
- }
52
- decode(token) {
53
- try {
54
- if (token === null || token === undefined) {
55
- return null;
56
- }
57
- const json = JSON.parse(this.urlDecode(token.split('.')[1]));
58
- return this.parse(json);
59
- }
60
- catch (_a) {
61
- return null;
62
- }
63
- }
64
- urlDecode(token) {
65
- const value = token || '';
66
- let output = value
67
- .replace(/-/g, '+')
68
- .replace(/_/g, '/');
69
- switch (output.length % 4) {
70
- case 0:
71
- break;
72
- case 2:
73
- output += '==';
74
- break;
75
- case 3:
76
- output += '=';
77
- break;
78
- default:
79
- throw 'Illegal base64url string!';
80
- }
81
- try {
82
- return this.baseDecodeUnicode(output);
83
- }
84
- catch (_a) {
85
- return atob(output);
86
- }
87
- }
21
+ class JwtHelper {
22
+ constructor() {
23
+ this.baseDecodeUnicode = (value) => {
24
+ return decodeURIComponent(atob(value).replace(/(.)/g, (_, p) => {
25
+ let code = p.charCodeAt(0).toString(16).toUpperCase();
26
+ if (code.length < 2) {
27
+ code = '0' + code;
28
+ }
29
+ return '%' + code;
30
+ }));
31
+ };
32
+ this.parse = (data) => {
33
+ return {
34
+ id: data['iss'] || null,
35
+ type: data['typ'] || null,
36
+ audience: data['aud'] || null,
37
+ issuer: data['iss'] || null,
38
+ subject: data['sub'] || null,
39
+ role: data['role'] || null,
40
+ notValidBefore: this.parseDate(data['nbf']),
41
+ expiresAt: this.parseDate(data['exp']),
42
+ issuedAt: this.parseDate(data['iat'])
43
+ };
44
+ };
45
+ this.parseDate = (epochInSeconds) => {
46
+ if (!epochInSeconds || epochInSeconds <= 0) {
47
+ return null;
48
+ }
49
+ return new Date(epochInSeconds * 1000);
50
+ };
51
+ }
52
+ decode(token) {
53
+ try {
54
+ if (token === null || token === undefined) {
55
+ return null;
56
+ }
57
+ const json = JSON.parse(this.urlDecode(token.split('.')[1]));
58
+ return this.parse(json);
59
+ }
60
+ catch (_a) {
61
+ return null;
62
+ }
63
+ }
64
+ urlDecode(token) {
65
+ const value = token || '';
66
+ let output = value
67
+ .replace(/-/g, '+')
68
+ .replace(/_/g, '/');
69
+ switch (output.length % 4) {
70
+ case 0:
71
+ break;
72
+ case 2:
73
+ output += '==';
74
+ break;
75
+ case 3:
76
+ output += '=';
77
+ break;
78
+ default:
79
+ throw 'Illegal base64url string!';
80
+ }
81
+ try {
82
+ return this.baseDecodeUnicode(output);
83
+ }
84
+ catch (_a) {
85
+ return atob(output);
86
+ }
87
+ }
88
88
  }
89
89
 
90
- class AuthMapper {
91
- constructor() {
92
- // Routes.
93
- this.me = 'auth/me';
94
- this.register = 'auth/register';
95
- this.resendCode = 'auth/resend';
96
- this.logout = 'auth/logout';
97
- this.refresh = 'auth/refresh';
98
- this.requestPassword = 'auth/reset';
99
- this.resetPassword = 'auth/reset-password';
100
- }
101
- role(data) {
102
- return (data && data.role) || null;
103
- }
104
- toRegister(data) {
105
- // Retrieve the params.
106
- const { token, refresh_token, user } = data;
107
- // Map the data to the correct format.
108
- return { accessToken: token, refreshToken: refresh_token, user: user };
109
- }
110
- toRefresh(data) {
111
- // Retrieve the params.
112
- const { token, refresh_token } = data;
113
- // Map the data to the correct format.
114
- return { accessToken: token, refreshToken: refresh_token };
115
- }
116
- }
117
- AuthMapper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: AuthMapper, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
118
- AuthMapper.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: AuthMapper });
119
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: AuthMapper, decorators: [{
120
- type: Injectable
90
+ class AuthMapper {
91
+ constructor() {
92
+ // Routes.
93
+ this.me = 'auth/me';
94
+ this.register = 'auth/register';
95
+ this.resendCode = 'auth/resend';
96
+ this.logout = 'auth/logout';
97
+ this.refresh = 'auth/refresh';
98
+ this.requestPassword = 'auth/reset';
99
+ this.resetPassword = 'auth/reset-password';
100
+ }
101
+ role(data) {
102
+ return (data && data.role) || null;
103
+ }
104
+ toRegister(data) {
105
+ // Retrieve the params.
106
+ const { token, refresh_token, user } = data;
107
+ // Map the data to the correct format.
108
+ return { accessToken: token, refreshToken: refresh_token, user: user };
109
+ }
110
+ toRefresh(data) {
111
+ // Retrieve the params.
112
+ const { token, refresh_token } = data;
113
+ // Map the data to the correct format.
114
+ return { accessToken: token, refreshToken: refresh_token };
115
+ }
116
+ }
117
+ AuthMapper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: AuthMapper, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
118
+ AuthMapper.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: AuthMapper });
119
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: AuthMapper, decorators: [{
120
+ type: Injectable
121
121
  }] });
122
122
 
123
- class AuthVerifyProvider {
124
- constructor(_code, _verifyToken, _endpoint) {
125
- this._code = _code;
126
- this._verifyToken = _verifyToken;
127
- this._endpoint = _endpoint;
128
- }
129
- authenticate(httpClient) {
130
- return __awaiter(this, void 0, void 0, function* () {
131
- // Execute API call.
132
- const data$ = yield httpClient.post(this._endpoint, {
133
- token: this._code,
134
- verify_token: this._verifyToken
135
- });
136
- const { token, refresh_token, user } = yield firstValueFrom(data$);
137
- // Map the data to the correct format.
138
- return { accessToken: token, refreshToken: refresh_token, user: user };
139
- });
140
- }
123
+ class AuthVerifyProvider {
124
+ constructor(_code, _verifyToken, _endpoint) {
125
+ this._code = _code;
126
+ this._verifyToken = _verifyToken;
127
+ this._endpoint = _endpoint;
128
+ }
129
+ authenticate(httpClient) {
130
+ return __awaiter(this, void 0, void 0, function* () {
131
+ // Execute API call.
132
+ const data$ = yield httpClient.post(this._endpoint, {
133
+ token: this._code,
134
+ verify_token: this._verifyToken
135
+ });
136
+ const { token, refresh_token, user } = yield firstValueFrom(data$);
137
+ // Map the data to the correct format.
138
+ return { accessToken: token, refreshToken: refresh_token, user: user };
139
+ });
140
+ }
141
141
  }
142
142
 
143
- class AuthEmailProvider {
144
- constructor(_email, _password, _endpoint) {
145
- this._email = _email;
146
- this._password = _password;
147
- this._endpoint = _endpoint;
148
- }
149
- authenticate(httpClient) {
150
- return __awaiter(this, void 0, void 0, function* () {
151
- // Execute API call.
152
- const data$ = yield httpClient.post(this._endpoint, {
153
- email: this._email,
154
- password: this._password
155
- });
156
- const { token, refresh_token, user, provider, verify_token } = yield firstValueFrom(data$);
157
- // Map the data to the correct format.
158
- return {
159
- accessToken: token,
160
- refreshToken: refresh_token,
161
- user: user,
162
- provider: provider,
163
- verifyToken: verify_token
164
- };
165
- });
166
- }
143
+ class AuthEmailProvider {
144
+ constructor(_email, _password, _endpoint) {
145
+ this._email = _email;
146
+ this._password = _password;
147
+ this._endpoint = _endpoint;
148
+ }
149
+ authenticate(httpClient) {
150
+ return __awaiter(this, void 0, void 0, function* () {
151
+ // Execute API call.
152
+ const data$ = yield httpClient.post(this._endpoint, {
153
+ email: this._email,
154
+ password: this._password
155
+ });
156
+ const { token, refresh_token, user, provider, verify_token } = yield firstValueFrom(data$);
157
+ // Map the data to the correct format.
158
+ return {
159
+ accessToken: token,
160
+ refreshToken: refresh_token,
161
+ user: user,
162
+ provider: provider,
163
+ verifyToken: verify_token
164
+ };
165
+ });
166
+ }
167
167
  }
168
168
 
169
- class AuthSession {
170
- constructor(options) {
171
- var _a, _b;
172
- // Readonly data.
173
- this._jwt = new JwtHelper();
174
- // Token strings.
175
- this._accessTokenString = null;
176
- this._refreshTokenString = null;
177
- // Token payloads.
178
- this._accessTokenPayload = null;
179
- this._refreshTokenPayload = null;
180
- // Private user data.
181
- this._user$ = new BehaviorSubject(null);
182
- // Public user data.
183
- this.user = this._user$.pipe(shareReplay(1));
184
- this.generateKey = (applicationId, key) => {
185
- return [applicationId, key].join('_');
186
- };
187
- this.isTokenValid = (token) => {
188
- var _a;
189
- if (!token) {
190
- return false;
191
- }
192
- return ((_a = token === null || token === void 0 ? void 0 : token.expiresAt) === null || _a === void 0 ? void 0 : _a.getTime()) > Date.now();
193
- };
194
- const applicationId = (_a = options === null || options === void 0 ? void 0 : options.id) !== null && _a !== void 0 ? _a : 'ng';
195
- // Setting up the readonly storage keys.
196
- this._accessTokenStorageKey = this.generateKey(applicationId, 'au_act');
197
- this._refreshTokenStorageKey = this.generateKey(applicationId, 'au_rft');
198
- this._userStorageKey = this.generateKey(applicationId, 'au_usr');
199
- // Setting up the storage.
200
- this._storage = (_b = options === null || options === void 0 ? void 0 : options.storage) !== null && _b !== void 0 ? _b : null;
201
- // Init methods.
202
- this.restoreFromStorage();
203
- }
204
- get accessToken() {
205
- return this.isTokenValid(this._accessTokenPayload)
206
- ? this._accessTokenString
207
- : null;
208
- }
209
- get refreshToken() {
210
- return this.isTokenValid(this.refreshTokenPayload)
211
- ? this._refreshTokenString
212
- : null;
213
- }
214
- get accessTokenPayload() {
215
- var _a;
216
- return (_a = this._accessTokenPayload) !== null && _a !== void 0 ? _a : null;
217
- }
218
- get refreshTokenPayload() {
219
- var _a;
220
- return (_a = this._refreshTokenPayload) !== null && _a !== void 0 ? _a : null;
221
- }
222
- authenticated() {
223
- return this.isTokenValid(this._accessTokenPayload) || this.isTokenValid(this._refreshTokenPayload);
224
- }
225
- setTokens(accessToken, refreshToken) {
226
- this.setAccessToken(accessToken);
227
- this.setRefreshToken(refreshToken);
228
- this.syncTokensInStorage();
229
- }
230
- setUser(user) {
231
- this._user$.next(user !== null && user !== void 0 ? user : null);
232
- this.syncUserInStorage();
233
- }
234
- clear() {
235
- this.setTokens(null, null);
236
- this.setUser(null);
237
- }
238
- restoreFromStorage() {
239
- if (!this._storage) {
240
- return;
241
- }
242
- // Set the access token.
243
- const accessToken = this._storage.get(this._accessTokenStorageKey);
244
- this.setAccessToken(accessToken);
245
- // Set the refresh token.
246
- const refreshToken = this._storage.get(this._refreshTokenStorageKey);
247
- this.setRefreshToken(refreshToken);
248
- // Set the user if we have any correct token payloads.
249
- if (this._accessTokenPayload || this._refreshTokenPayload) {
250
- const user = this._storage.get(this._userStorageKey);
251
- this._user$.next(user !== null && user !== void 0 ? user : null); // Note: just settings here instead of setUser() because of syncing to the storage.
252
- }
253
- }
254
- syncTokensInStorage() {
255
- var _a, _b;
256
- if (!this._storage) {
257
- return;
258
- }
259
- // Set the access token if completely valid.
260
- if (!!this.accessToken) {
261
- this._storage.set(this._accessTokenStorageKey, this._accessTokenString, {
262
- expires: (_a = this._accessTokenPayload) === null || _a === void 0 ? void 0 : _a.expiresAt
263
- });
264
- }
265
- else {
266
- this._storage.remove(this._accessTokenStorageKey);
267
- }
268
- // Set the refresh token if completely valid.
269
- if (!!this.refreshToken) {
270
- this._storage.set(this._refreshTokenStorageKey, this._refreshTokenString, {
271
- expires: (_b = this._refreshTokenPayload) === null || _b === void 0 ? void 0 : _b.expiresAt
272
- });
273
- }
274
- else {
275
- this._storage.remove(this._refreshTokenStorageKey);
276
- }
277
- }
278
- syncUserInStorage() {
279
- if (!this._storage) {
280
- return;
281
- }
282
- const user = this._user$.getValue();
283
- if (!user) {
284
- return this._storage.remove(this._userStorageKey);
285
- }
286
- const date = new Date();
287
- date.setFullYear(date.getFullYear() + 1);
288
- this._storage.set(this._userStorageKey, user, {
289
- expires: new Date(date.getTime())
290
- });
291
- }
292
- setAccessToken(value) {
293
- this._accessTokenString = value !== null && value !== void 0 ? value : null;
294
- this._accessTokenPayload = this._jwt.decode(this._accessTokenString);
295
- }
296
- setRefreshToken(value) {
297
- this._refreshTokenString = value !== null && value !== void 0 ? value : null;
298
- this._refreshTokenPayload = this._jwt.decode(this._refreshTokenString);
299
- }
169
+ class AuthSession {
170
+ constructor(options) {
171
+ var _a, _b;
172
+ // Readonly data.
173
+ this._jwt = new JwtHelper();
174
+ // Token strings.
175
+ this._accessTokenString = null;
176
+ this._refreshTokenString = null;
177
+ // Token payloads.
178
+ this._accessTokenPayload = null;
179
+ this._refreshTokenPayload = null;
180
+ // Private user data.
181
+ this._user$ = new BehaviorSubject(null);
182
+ // Public user data.
183
+ this.user = this._user$.pipe(shareReplay(1));
184
+ this.generateKey = (applicationId, key) => {
185
+ return [applicationId, key].join('_');
186
+ };
187
+ this.isTokenValid = (token) => {
188
+ var _a;
189
+ if (!token) {
190
+ return false;
191
+ }
192
+ return ((_a = token === null || token === void 0 ? void 0 : token.expiresAt) === null || _a === void 0 ? void 0 : _a.getTime()) > Date.now();
193
+ };
194
+ const applicationId = (_a = options === null || options === void 0 ? void 0 : options.id) !== null && _a !== void 0 ? _a : 'ng';
195
+ // Setting up the readonly storage keys.
196
+ this._accessTokenStorageKey = this.generateKey(applicationId, 'au_act');
197
+ this._refreshTokenStorageKey = this.generateKey(applicationId, 'au_rft');
198
+ this._userStorageKey = this.generateKey(applicationId, 'au_usr');
199
+ // Setting up the storage.
200
+ this._storage = (_b = options === null || options === void 0 ? void 0 : options.storage) !== null && _b !== void 0 ? _b : null;
201
+ // Init methods.
202
+ this.restoreFromStorage();
203
+ }
204
+ get accessToken() {
205
+ return this.isTokenValid(this._accessTokenPayload)
206
+ ? this._accessTokenString
207
+ : null;
208
+ }
209
+ get refreshToken() {
210
+ return this.isTokenValid(this.refreshTokenPayload)
211
+ ? this._refreshTokenString
212
+ : null;
213
+ }
214
+ get accessTokenPayload() {
215
+ var _a;
216
+ return (_a = this._accessTokenPayload) !== null && _a !== void 0 ? _a : null;
217
+ }
218
+ get refreshTokenPayload() {
219
+ var _a;
220
+ return (_a = this._refreshTokenPayload) !== null && _a !== void 0 ? _a : null;
221
+ }
222
+ authenticated() {
223
+ return this.isTokenValid(this._accessTokenPayload) || this.isTokenValid(this._refreshTokenPayload);
224
+ }
225
+ setTokens(accessToken, refreshToken) {
226
+ this.setAccessToken(accessToken);
227
+ this.setRefreshToken(refreshToken);
228
+ this.syncTokensInStorage();
229
+ }
230
+ setUser(user) {
231
+ this._user$.next(user !== null && user !== void 0 ? user : null);
232
+ this.syncUserInStorage();
233
+ }
234
+ clear() {
235
+ this.setTokens(null, null);
236
+ this.setUser(null);
237
+ }
238
+ restoreFromStorage() {
239
+ if (!this._storage) {
240
+ return;
241
+ }
242
+ // Set the access token.
243
+ const accessToken = this._storage.get(this._accessTokenStorageKey);
244
+ this.setAccessToken(accessToken);
245
+ // Set the refresh token.
246
+ const refreshToken = this._storage.get(this._refreshTokenStorageKey);
247
+ this.setRefreshToken(refreshToken);
248
+ // Set the user if we have any correct token payloads.
249
+ if (this._accessTokenPayload || this._refreshTokenPayload) {
250
+ const user = this._storage.get(this._userStorageKey);
251
+ this._user$.next(user !== null && user !== void 0 ? user : null); // Note: just settings here instead of setUser() because of syncing to the storage.
252
+ }
253
+ }
254
+ syncTokensInStorage() {
255
+ var _a, _b;
256
+ if (!this._storage) {
257
+ return;
258
+ }
259
+ // Set the access token if completely valid.
260
+ if (!!this.accessToken) {
261
+ this._storage.set(this._accessTokenStorageKey, this._accessTokenString, {
262
+ expires: (_a = this._accessTokenPayload) === null || _a === void 0 ? void 0 : _a.expiresAt
263
+ });
264
+ }
265
+ else {
266
+ this._storage.remove(this._accessTokenStorageKey);
267
+ }
268
+ // Set the refresh token if completely valid.
269
+ if (!!this.refreshToken) {
270
+ this._storage.set(this._refreshTokenStorageKey, this._refreshTokenString, {
271
+ expires: (_b = this._refreshTokenPayload) === null || _b === void 0 ? void 0 : _b.expiresAt
272
+ });
273
+ }
274
+ else {
275
+ this._storage.remove(this._refreshTokenStorageKey);
276
+ }
277
+ }
278
+ syncUserInStorage() {
279
+ if (!this._storage) {
280
+ return;
281
+ }
282
+ const user = this._user$.getValue();
283
+ if (!user) {
284
+ return this._storage.remove(this._userStorageKey);
285
+ }
286
+ const date = new Date();
287
+ date.setFullYear(date.getFullYear() + 1);
288
+ this._storage.set(this._userStorageKey, user, {
289
+ expires: new Date(date.getTime())
290
+ });
291
+ }
292
+ setAccessToken(value) {
293
+ this._accessTokenString = value !== null && value !== void 0 ? value : null;
294
+ this._accessTokenPayload = this._jwt.decode(this._accessTokenString);
295
+ }
296
+ setRefreshToken(value) {
297
+ this._refreshTokenString = value !== null && value !== void 0 ? value : null;
298
+ this._refreshTokenPayload = this._jwt.decode(this._refreshTokenString);
299
+ }
300
300
  }
301
301
 
302
- class Auth {
303
- constructor(_storage, _mapper, _injector, _platform, _httpClient, _config, _state, _httpConfig) {
304
- var _a, _b, _c;
305
- this._storage = _storage;
306
- this._mapper = _mapper;
307
- this._injector = _injector;
308
- this._platform = _platform;
309
- this._httpClient = _httpClient;
310
- this._config = _config;
311
- this._state = _state;
312
- this._httpConfig = _httpConfig;
313
- // Readonly data.
314
- this._authStateKey = makeStateKey(`bbAuthStateKey`);
315
- this._httpAlias = (_b = (_a = this._httpConfig) === null || _a === void 0 ? void 0 : _a.defaultAlias) !== null && _b !== void 0 ? _b : null;
316
- this._refreshHandler = null;
317
- // Starting the new session.
318
- this.session = new AuthSession({
319
- id: (_c = this._config) === null || _c === void 0 ? void 0 : _c.applicationId,
320
- storage: this._storage.select(["cookie" /* Cookie */, "local" /* Local */])
321
- });
322
- this.user = this.session.user;
323
- }
324
- initialize() {
325
- return () => __awaiter(this, void 0, void 0, function* () {
326
- var _a, _b, _c, _d, _e, _f;
327
- // Check if the app should bootstrap the authentication.
328
- const shouldBootstrap = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.bootstrap) !== null && _b !== void 0 ? _b : true;
329
- if (!shouldBootstrap) {
330
- return this.handleAutoRefreshing();
331
- }
332
- // Only retrieve from the server when we are actually authenticated.
333
- if (!this.session.authenticated()) {
334
- return;
335
- }
336
- // Get the key from the server state.
337
- if (this._state && ((_c = this._state) === null || _c === void 0 ? void 0 : _c.hasKey(this._authStateKey))) {
338
- const user = (_e = (_d = this._state) === null || _d === void 0 ? void 0 : _d.get(this._authStateKey, null)) !== null && _e !== void 0 ? _e : null;
339
- return this.session.setUser(user);
340
- }
341
- // Try to fetch the user from the server.
342
- const user$ = this.me();
343
- const user = yield firstValueFrom(user$, { defaultValue: null });
344
- // Set the state if exists.
345
- if (this._state) {
346
- (_f = this._state) === null || _f === void 0 ? void 0 : _f.set(this._authStateKey, user !== null && user !== void 0 ? user : null);
347
- }
348
- // Save the user in the storage and handle auto refreshing.
349
- this.session.setUser(user);
350
- this.handleAutoRefreshing();
351
- });
352
- }
353
- me() {
354
- const url = this.getUrl('auth/me');
355
- return this._httpClient.get(url);
356
- }
357
- signIn(provider, as) {
358
- var _a, _b;
359
- return __awaiter(this, void 0, void 0, function* () {
360
- const _c = yield provider.authenticate(this._httpClient), { accessToken, refreshToken, user } = _c, result = __rest(_c, ["accessToken", "refreshToken", "user"]);
361
- // Check if the role matches.
362
- if (as && !as.includes(this._mapper.role(user))) {
363
- throw new Error('Invalid role.');
364
- }
365
- // Validate if the provider is one of the available
366
- // providers then return the user object and the provider.
367
- const apiProvider = (_a = result === null || result === void 0 ? void 0 : result.provider) !== null && _a !== void 0 ? _a : null;
368
- const apiVerifyToken = (_b = result === null || result === void 0 ? void 0 : result.verifyToken) !== null && _b !== void 0 ? _b : null;
369
- const availableProviders = ['email', 'sms', 'totp'];
370
- if (availableProviders.includes(apiProvider)) {
371
- return { user, provider: apiProvider, verifyToken: apiVerifyToken };
372
- }
373
- // Set the tokens in storage.
374
- this.setTokens(accessToken, refreshToken);
375
- // Set the user in storage.
376
- this.session.setUser(user);
377
- // Return the user.
378
- return { user };
379
- });
380
- }
381
- signInWithEmail(email, password, as) {
382
- return __awaiter(this, void 0, void 0, function* () {
383
- const url = this.getUrl('auth/login');
384
- return this.signIn(new AuthEmailProvider(email, password, url), as);
385
- });
386
- }
387
- signInWithVerifyCode(code, verifyToken) {
388
- return __awaiter(this, void 0, void 0, function* () {
389
- const url = this.getUrl('auth/verify');
390
- return this.signIn(new AuthVerifyProvider(code, verifyToken, url));
391
- });
392
- }
393
- resendVerifyCode(verifyToken) {
394
- return __awaiter(this, void 0, void 0, function* () {
395
- const url = this.getUrl('auth/resend');
396
- const result$ = this._httpClient.post(url, {
397
- verify_token: verifyToken
398
- });
399
- return firstValueFrom(result$);
400
- });
401
- }
402
- register(data, options) {
403
- return __awaiter(this, void 0, void 0, function* () {
404
- // Execute API call.
405
- const url = this.getUrl('auth/register');
406
- const result$ = this._httpClient.post(url, data, options);
407
- const result = yield firstValueFrom(result$);
408
- // Map to the correct response.
409
- const { accessToken, refreshToken, user } = this._mapper.toRegister(result);
410
- // Set the tokens in storage.
411
- this.setTokens(accessToken, refreshToken);
412
- // Set the user in storage.
413
- this.session.setUser(user);
414
- // Return the user.
415
- return user;
416
- });
417
- }
418
- logout() {
419
- // If we don't have a refresh token just clear the session.
420
- // Note: We do this because else we try to invalidate
421
- // an "undefined" refresh token.
422
- const refreshToken = this.session.refreshToken;
423
- if (!refreshToken) {
424
- return this.session.clear();
425
- }
426
- // We do have a refresh token, so try to
427
- // invalidate it in the backend.
428
- try {
429
- const url = this.getUrl('auth/logout');
430
- const observable$ = this._httpClient.get(url, {
431
- headers: { Authorization: refreshToken }
432
- });
433
- firstValueFrom(observable$).then(_ => _);
434
- }
435
- catch (_a) {
436
- // Do nothing because the tokens will be deleted anyways from the session.
437
- }
438
- // Delete the tokens from the session.
439
- return this.session.clear();
440
- }
441
- refresh() {
442
- var _a, _b;
443
- // If the refresh token does
444
- // not exist just return an observable of null.
445
- const refreshToken = this.session.refreshToken;
446
- if (!refreshToken) {
447
- return of(null);
448
- }
449
- // Perform the refresh call.
450
- const scheme = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.scheme) !== null && _b !== void 0 ? _b : 'Bearer';
451
- const url = this.getUrl('auth/refresh');
452
- const context = new HttpContext()
453
- .set(USE_AUTHORIZATION, false);
454
- return this._httpClient.get(url, {
455
- headers: { Authorization: `${scheme} ${refreshToken}` },
456
- context: context
457
- }).pipe(map(data => this._mapper.toRefresh(data)), tap(({ accessToken, refreshToken }) => this.setTokens(accessToken, refreshToken)), map(({ accessToken }) => accessToken));
458
- }
459
- requestPassword(email, extraParams = {}) {
460
- return __awaiter(this, void 0, void 0, function* () {
461
- const url = this.getUrl('auth/reset');
462
- const observable$ = this._httpClient.post(url, Object.assign(Object.assign({}, extraParams), { email }));
463
- return firstValueFrom(observable$);
464
- });
465
- }
466
- resetPassword(token, newPassword, extraParams = {}) {
467
- return __awaiter(this, void 0, void 0, function* () {
468
- const url = this.getUrl('auth/reset-password');
469
- const observable$ = this._httpClient.post(url, Object.assign(Object.assign({}, extraParams), { token, password: newPassword }));
470
- return firstValueFrom(observable$);
471
- });
472
- }
473
- guard(type, redirectUrl) {
474
- var _a, _b, _c, _d, _e, _f;
475
- let newUrl = null;
476
- // Get the correct new url.
477
- switch (type) {
478
- case 'authenticated':
479
- newUrl = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.loggedInUrl) !== null && _b !== void 0 ? _b : null;
480
- break;
481
- case 'unauthenticated':
482
- newUrl = (_d = (_c = this._config) === null || _c === void 0 ? void 0 : _c.redirectUrl) !== null && _d !== void 0 ? _d : null;
483
- break;
484
- }
485
- // Append a redirect url if the user is deemed
486
- // unauthenticated.
487
- if (type === 'unauthenticated') {
488
- const setRedirectOnFailedAuth = (_f = (_e = this._config) === null || _e === void 0 ? void 0 : _e.setRedirectOnFailedAuth) !== null && _f !== void 0 ? _f : true;
489
- if (setRedirectOnFailedAuth && redirectUrl && newUrl) {
490
- newUrl += `?redirectUrl=${redirectUrl}`;
491
- }
492
- }
493
- // Parse the url if it exists.
494
- if (this.router && newUrl) {
495
- return this.router.parseUrl(newUrl);
496
- }
497
- // Return false if the user is not allowed.
498
- return false;
499
- }
500
- clearAndRedirect() {
501
- var _a, _b;
502
- // 1. Delete the tokens from the session.
503
- this.session.clear();
504
- // 2. Compose the route url.
505
- const redirectUrl = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.redirectUrl) !== null && _b !== void 0 ? _b : null;
506
- // 3. Route back if the user provided a redirect url.
507
- if (this.router && redirectUrl) {
508
- this.router.navigate([redirectUrl]).then(_ => _);
509
- }
510
- }
511
- setTokens(accessToken, refreshToken) {
512
- // Set the tokens in our session.
513
- this.session.setTokens(accessToken, refreshToken);
514
- // We need to update the auto refresh of the refresh token.
515
- this.handleAutoRefreshing();
516
- }
517
- handleAutoRefreshing() {
518
- var _a, _b, _c, _d;
519
- const shouldAutoRefresh = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.autoRefresh) !== null && _b !== void 0 ? _b : false;
520
- if (!shouldAutoRefresh) {
521
- return;
522
- }
523
- const expiresAt = (_d = (_c = this.session.refreshTokenPayload) === null || _c === void 0 ? void 0 : _c.expiresAt) !== null && _d !== void 0 ? _d : null;
524
- if (expiresAt === null || !this._platform.isBrowser) {
525
- return;
526
- }
527
- const differenceInMilliseconds = expiresAt.getTime() - Date.now();
528
- const offsetInMilliseconds = 10000; // 10 seconds.
529
- // We want to start the refresh 10 seconds before it expires.
530
- const actualTiming = differenceInMilliseconds - offsetInMilliseconds;
531
- if (actualTiming <= 0) {
532
- return;
533
- }
534
- // We need to cap the timings because if
535
- // we get large numbers it might cause unwanted results.
536
- const maxTiming = 1000 * 60 * 60 * 24; // 24 hours.
537
- const cappedTiming = Math.max(1, Math.min(actualTiming, maxTiming));
538
- try {
539
- if (this._refreshHandler !== null) {
540
- clearTimeout === null || clearTimeout === void 0 ? void 0 : clearTimeout(this._refreshHandler);
541
- this._refreshHandler = null;
542
- }
543
- this._refreshHandler = setTimeout === null || setTimeout === void 0 ? void 0 : setTimeout(() => this.autoRefresh(), cappedTiming);
544
- }
545
- catch (_e) {
546
- // Just ignore it.
547
- }
548
- }
549
- autoRefresh() {
550
- return __awaiter(this, void 0, void 0, function* () {
551
- try {
552
- // We just need to wait for it to refresh.
553
- const refresh$ = this.refresh();
554
- yield firstValueFrom(refresh$);
555
- }
556
- catch (_a) {
557
- // Something went wrong refreshing, we need to clear.
558
- this.clearAndRedirect();
559
- }
560
- });
561
- }
562
- get router() {
563
- return this._injector.get(Router);
564
- }
565
- getUrl(endpoint) {
566
- return [this._httpAlias, endpoint]
567
- .filter(item => !!item)
568
- .join('/');
569
- }
570
- }
571
- Auth.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: Auth, deps: [{ token: i1.Storage }, { token: AuthMapper }, { token: i0.Injector }, { token: i3.Platform }, { token: i4.HttpClient }, { token: AuthConfig, optional: true }, { token: i6.TransferState, optional: true }, { token: i7.HttpConfig, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
572
- Auth.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: Auth });
573
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: Auth, decorators: [{
574
- type: Injectable
575
- }], ctorParameters: function () {
576
- return [{ type: i1.Storage }, { type: AuthMapper }, { type: i0.Injector }, { type: i3.Platform }, { type: i4.HttpClient }, { type: AuthConfig, decorators: [{
577
- type: Optional
578
- }] }, { type: i6.TransferState, decorators: [{
579
- type: Optional
580
- }] }, { type: i7.HttpConfig, decorators: [{
581
- type: Optional
582
- }] }];
302
+ class Auth {
303
+ constructor(_storage, _mapper, _injector, _platform, _httpClient, _config, _state, _httpConfig) {
304
+ var _a, _b, _c;
305
+ this._storage = _storage;
306
+ this._mapper = _mapper;
307
+ this._injector = _injector;
308
+ this._platform = _platform;
309
+ this._httpClient = _httpClient;
310
+ this._config = _config;
311
+ this._state = _state;
312
+ this._httpConfig = _httpConfig;
313
+ // Readonly data.
314
+ this._authStateKey = makeStateKey(`bbAuthStateKey`);
315
+ this._httpAlias = (_b = (_a = this._httpConfig) === null || _a === void 0 ? void 0 : _a.defaultAlias) !== null && _b !== void 0 ? _b : null;
316
+ this._refreshHandler = null;
317
+ // We select a storage strategy based on the server/browser.
318
+ // Only cookies CAN work on the server.
319
+ const storageStrategy = this._platform.isBrowser
320
+ ? this._storage.select(["cookie" /* Cookie */, "local" /* Local */])
321
+ : this._storage.cookie;
322
+ // Starting the new session.
323
+ this.session = new AuthSession({
324
+ id: (_c = this._config) === null || _c === void 0 ? void 0 : _c.applicationId,
325
+ storage: storageStrategy
326
+ });
327
+ this.user = this.session.user;
328
+ }
329
+ initialize() {
330
+ return () => __awaiter(this, void 0, void 0, function* () {
331
+ var _a, _b, _c, _d, _e, _f;
332
+ // Check if the app should bootstrap the authentication.
333
+ const shouldBootstrap = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.bootstrap) !== null && _b !== void 0 ? _b : true;
334
+ if (!shouldBootstrap) {
335
+ return this.handleAutoRefreshing();
336
+ }
337
+ // Only retrieve from the server when we are actually authenticated.
338
+ if (!this.session.authenticated()) {
339
+ return;
340
+ }
341
+ // Get the key from the server state.
342
+ if (this._state && ((_c = this._state) === null || _c === void 0 ? void 0 : _c.hasKey(this._authStateKey))) {
343
+ const user = (_e = (_d = this._state) === null || _d === void 0 ? void 0 : _d.get(this._authStateKey, null)) !== null && _e !== void 0 ? _e : null;
344
+ return this.session.setUser(user);
345
+ }
346
+ // Try to fetch the user from the server.
347
+ const user$ = this.me();
348
+ const user = yield firstValueFrom(user$, { defaultValue: null });
349
+ // Set the state if exists.
350
+ if (this._state) {
351
+ (_f = this._state) === null || _f === void 0 ? void 0 : _f.set(this._authStateKey, user !== null && user !== void 0 ? user : null);
352
+ }
353
+ // Save the user in the storage and handle auto refreshing.
354
+ this.session.setUser(user);
355
+ this.handleAutoRefreshing();
356
+ });
357
+ }
358
+ me() {
359
+ const url = this.getUrl('auth/me');
360
+ return this._httpClient.get(url);
361
+ }
362
+ signIn(provider, as) {
363
+ var _a, _b;
364
+ return __awaiter(this, void 0, void 0, function* () {
365
+ const _c = yield provider.authenticate(this._httpClient), { accessToken, refreshToken, user } = _c, result = __rest(_c, ["accessToken", "refreshToken", "user"]);
366
+ // Check if the role matches.
367
+ if (as && !as.includes(this._mapper.role(user))) {
368
+ throw new Error('Invalid role.');
369
+ }
370
+ // Validate if the provider is one of the available
371
+ // providers then return the user object and the provider.
372
+ const apiProvider = (_a = result === null || result === void 0 ? void 0 : result.provider) !== null && _a !== void 0 ? _a : null;
373
+ const apiVerifyToken = (_b = result === null || result === void 0 ? void 0 : result.verifyToken) !== null && _b !== void 0 ? _b : null;
374
+ const availableProviders = ['email', 'sms', 'totp'];
375
+ if (availableProviders.includes(apiProvider)) {
376
+ return { user, provider: apiProvider, verifyToken: apiVerifyToken };
377
+ }
378
+ // Set the tokens in storage.
379
+ this.setTokens(accessToken, refreshToken);
380
+ // Set the user in storage.
381
+ this.session.setUser(user);
382
+ // Return the user.
383
+ return { user };
384
+ });
385
+ }
386
+ signInWithEmail(email, password, as) {
387
+ return __awaiter(this, void 0, void 0, function* () {
388
+ const url = this.getUrl('auth/login');
389
+ return this.signIn(new AuthEmailProvider(email, password, url), as);
390
+ });
391
+ }
392
+ signInWithVerifyCode(code, verifyToken) {
393
+ return __awaiter(this, void 0, void 0, function* () {
394
+ const url = this.getUrl('auth/verify');
395
+ return this.signIn(new AuthVerifyProvider(code, verifyToken, url));
396
+ });
397
+ }
398
+ resendVerifyCode(verifyToken) {
399
+ return __awaiter(this, void 0, void 0, function* () {
400
+ const url = this.getUrl('auth/resend');
401
+ const result$ = this._httpClient.post(url, {
402
+ verify_token: verifyToken
403
+ });
404
+ return firstValueFrom(result$);
405
+ });
406
+ }
407
+ register(data, options) {
408
+ return __awaiter(this, void 0, void 0, function* () {
409
+ // Execute API call.
410
+ const url = this.getUrl('auth/register');
411
+ const result$ = this._httpClient.post(url, data, options);
412
+ const result = yield firstValueFrom(result$);
413
+ // Map to the correct response.
414
+ const { accessToken, refreshToken, user } = this._mapper.toRegister(result);
415
+ // Set the tokens in storage.
416
+ this.setTokens(accessToken, refreshToken);
417
+ // Set the user in storage.
418
+ this.session.setUser(user);
419
+ // Return the user.
420
+ return user;
421
+ });
422
+ }
423
+ logout() {
424
+ // If we don't have a refresh token just clear the session.
425
+ // Note: We do this because else we try to invalidate
426
+ // an "undefined" refresh token.
427
+ const refreshToken = this.session.refreshToken;
428
+ if (!refreshToken) {
429
+ return this.session.clear();
430
+ }
431
+ // We do have a refresh token, so try to
432
+ // invalidate it in the backend.
433
+ try {
434
+ const url = this.getUrl('auth/logout');
435
+ const observable$ = this._httpClient.get(url, {
436
+ headers: { Authorization: refreshToken }
437
+ });
438
+ firstValueFrom(observable$).then(_ => _);
439
+ }
440
+ catch (_a) {
441
+ // Do nothing because the tokens will be deleted anyways from the session.
442
+ }
443
+ // Delete the tokens from the session.
444
+ return this.session.clear();
445
+ }
446
+ refresh() {
447
+ var _a, _b;
448
+ // If the refresh token does
449
+ // not exist just return an observable of null.
450
+ const refreshToken = this.session.refreshToken;
451
+ if (!refreshToken) {
452
+ return of(null);
453
+ }
454
+ // Perform the refresh call.
455
+ const scheme = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.scheme) !== null && _b !== void 0 ? _b : 'Bearer';
456
+ const url = this.getUrl('auth/refresh');
457
+ const context = new HttpContext()
458
+ .set(USE_AUTHORIZATION, false);
459
+ return this._httpClient.get(url, {
460
+ headers: { Authorization: `${scheme} ${refreshToken}` },
461
+ context: context
462
+ }).pipe(map(data => this._mapper.toRefresh(data)), tap(({ accessToken, refreshToken }) => this.setTokens(accessToken, refreshToken)), map(({ accessToken }) => accessToken));
463
+ }
464
+ requestPassword(email, extraParams = {}) {
465
+ return __awaiter(this, void 0, void 0, function* () {
466
+ const url = this.getUrl('auth/reset');
467
+ const observable$ = this._httpClient.post(url, Object.assign(Object.assign({}, extraParams), { email }));
468
+ return firstValueFrom(observable$);
469
+ });
470
+ }
471
+ resetPassword(token, newPassword, extraParams = {}) {
472
+ return __awaiter(this, void 0, void 0, function* () {
473
+ const url = this.getUrl('auth/reset-password');
474
+ const observable$ = this._httpClient.post(url, Object.assign(Object.assign({}, extraParams), { token, password: newPassword }));
475
+ return firstValueFrom(observable$);
476
+ });
477
+ }
478
+ guard(type, redirectUrl) {
479
+ var _a, _b, _c, _d, _e, _f;
480
+ let newUrl = null;
481
+ // Get the correct new url.
482
+ switch (type) {
483
+ case 'authenticated':
484
+ newUrl = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.loggedInUrl) !== null && _b !== void 0 ? _b : null;
485
+ break;
486
+ case 'unauthenticated':
487
+ newUrl = (_d = (_c = this._config) === null || _c === void 0 ? void 0 : _c.redirectUrl) !== null && _d !== void 0 ? _d : null;
488
+ break;
489
+ }
490
+ // Append a redirect url if the user is deemed
491
+ // unauthenticated.
492
+ if (type === 'unauthenticated') {
493
+ const setRedirectOnFailedAuth = (_f = (_e = this._config) === null || _e === void 0 ? void 0 : _e.setRedirectOnFailedAuth) !== null && _f !== void 0 ? _f : true;
494
+ if (setRedirectOnFailedAuth && redirectUrl && newUrl) {
495
+ newUrl += `?redirectUrl=${redirectUrl}`;
496
+ }
497
+ }
498
+ // Parse the url if it exists.
499
+ if (this.router && newUrl) {
500
+ return this.router.parseUrl(newUrl);
501
+ }
502
+ // Return false if the user is not allowed.
503
+ return false;
504
+ }
505
+ clearAndRedirect() {
506
+ var _a, _b;
507
+ // 1. Delete the tokens from the session.
508
+ this.session.clear();
509
+ // 2. Compose the route url.
510
+ const redirectUrl = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.redirectUrl) !== null && _b !== void 0 ? _b : null;
511
+ // 3. Route back if the user provided a redirect url.
512
+ if (this.router && redirectUrl) {
513
+ this.router.navigate([redirectUrl]).then(_ => _);
514
+ }
515
+ }
516
+ setTokens(accessToken, refreshToken) {
517
+ // Set the tokens in our session.
518
+ this.session.setTokens(accessToken, refreshToken);
519
+ // We need to update the auto refresh of the refresh token.
520
+ this.handleAutoRefreshing();
521
+ }
522
+ handleAutoRefreshing() {
523
+ var _a, _b, _c, _d;
524
+ const shouldAutoRefresh = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.autoRefresh) !== null && _b !== void 0 ? _b : false;
525
+ if (!shouldAutoRefresh) {
526
+ return;
527
+ }
528
+ const expiresAt = (_d = (_c = this.session.refreshTokenPayload) === null || _c === void 0 ? void 0 : _c.expiresAt) !== null && _d !== void 0 ? _d : null;
529
+ if (expiresAt === null || !this._platform.isBrowser) {
530
+ return;
531
+ }
532
+ const differenceInMilliseconds = expiresAt.getTime() - Date.now();
533
+ const offsetInMilliseconds = 10000; // 10 seconds.
534
+ // We want to start the refresh 10 seconds before it expires.
535
+ const actualTiming = differenceInMilliseconds - offsetInMilliseconds;
536
+ if (actualTiming <= 0) {
537
+ return;
538
+ }
539
+ // We need to cap the timings because if
540
+ // we get large numbers it might cause unwanted results.
541
+ const maxTiming = 1000 * 60 * 60 * 24; // 24 hours.
542
+ const cappedTiming = Math.max(1, Math.min(actualTiming, maxTiming));
543
+ try {
544
+ if (this._refreshHandler !== null) {
545
+ clearTimeout === null || clearTimeout === void 0 ? void 0 : clearTimeout(this._refreshHandler);
546
+ this._refreshHandler = null;
547
+ }
548
+ this._refreshHandler = setTimeout === null || setTimeout === void 0 ? void 0 : setTimeout(() => this.autoRefresh(), cappedTiming);
549
+ }
550
+ catch (_e) {
551
+ // Just ignore it.
552
+ }
553
+ }
554
+ autoRefresh() {
555
+ return __awaiter(this, void 0, void 0, function* () {
556
+ try {
557
+ // We just need to wait for it to refresh.
558
+ const refresh$ = this.refresh();
559
+ yield firstValueFrom(refresh$);
560
+ }
561
+ catch (_a) {
562
+ // Something went wrong refreshing, we need to clear.
563
+ this.clearAndRedirect();
564
+ }
565
+ });
566
+ }
567
+ get router() {
568
+ return this._injector.get(Router);
569
+ }
570
+ getUrl(endpoint) {
571
+ return [this._httpAlias, endpoint]
572
+ .filter(item => !!item)
573
+ .join('/');
574
+ }
575
+ }
576
+ Auth.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: Auth, deps: [{ token: i1.Storage }, { token: AuthMapper }, { token: i0.Injector }, { token: i3.Platform }, { token: i4.HttpClient }, { token: AuthConfig, optional: true }, { token: i6.TransferState, optional: true }, { token: i7.HttpConfig, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
577
+ Auth.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: Auth });
578
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: Auth, decorators: [{
579
+ type: Injectable
580
+ }], ctorParameters: function () {
581
+ return [{ type: i1.Storage }, { type: AuthMapper }, { type: i0.Injector }, { type: i3.Platform }, { type: i4.HttpClient }, { type: AuthConfig, decorators: [{
582
+ type: Optional
583
+ }] }, { type: i6.TransferState, decorators: [{
584
+ type: Optional
585
+ }] }, { type: i7.HttpConfig, decorators: [{
586
+ type: Optional
587
+ }] }];
583
588
  } });
584
589
 
585
- class BbAuthenticated {
586
- constructor(_auth, _template, _viewContainerRef) {
587
- this._auth = _auth;
588
- this._template = _template;
589
- this._viewContainerRef = _viewContainerRef;
590
- }
591
- ngOnInit() {
592
- this._subscription = this._auth.user.pipe(map(user => !!user), distinctUntilChanged()).subscribe(isAuthenticated => {
593
- if (!isAuthenticated) {
594
- return this._viewContainerRef.clear();
595
- }
596
- this._viewContainerRef.createEmbeddedView(this._template);
597
- });
598
- }
599
- ngOnDestroy() {
600
- var _a;
601
- (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
602
- }
603
- }
604
- BbAuthenticated.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: BbAuthenticated, deps: [{ token: Auth }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
605
- BbAuthenticated.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.5", type: BbAuthenticated, selector: "[bbAuthenticated]", ngImport: i0 });
606
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: BbAuthenticated, decorators: [{
607
- type: Directive,
608
- args: [{
609
- selector: '[bbAuthenticated]'
610
- }]
590
+ class BbAuthenticated {
591
+ constructor(_auth, _template, _viewContainerRef) {
592
+ this._auth = _auth;
593
+ this._template = _template;
594
+ this._viewContainerRef = _viewContainerRef;
595
+ }
596
+ ngOnInit() {
597
+ this._subscription = this._auth.user.pipe(map(user => !!user), distinctUntilChanged()).subscribe(isAuthenticated => {
598
+ if (!isAuthenticated) {
599
+ return this._viewContainerRef.clear();
600
+ }
601
+ this._viewContainerRef.createEmbeddedView(this._template);
602
+ });
603
+ }
604
+ ngOnDestroy() {
605
+ var _a;
606
+ (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
607
+ }
608
+ }
609
+ BbAuthenticated.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbAuthenticated, deps: [{ token: Auth }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
610
+ BbAuthenticated.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.6", type: BbAuthenticated, selector: "[bbAuthenticated]", ngImport: i0 });
611
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbAuthenticated, decorators: [{
612
+ type: Directive,
613
+ args: [{
614
+ selector: '[bbAuthenticated]'
615
+ }]
611
616
  }], ctorParameters: function () { return [{ type: Auth }, { type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; } });
612
617
 
613
- class BbRole {
614
- constructor(_auth, _template, _viewContainerRef) {
615
- this._auth = _auth;
616
- this._template = _template;
617
- this._viewContainerRef = _viewContainerRef;
618
- this.getAllowedRoles = (value) => {
619
- return Array.isArray(value) ? value : [value];
620
- };
621
- }
622
- ngOnInit() {
623
- this._subscription = this._auth.user.pipe(map(user => { var _a; return (_a = user === null || user === void 0 ? void 0 : user.role) !== null && _a !== void 0 ? _a : null; }), distinctUntilChanged()).subscribe(role => {
624
- const allowedRoles = this.getAllowedRoles(this.bbRole);
625
- if (!allowedRoles.includes(role)) {
626
- return this._viewContainerRef.clear();
627
- }
628
- this._viewContainerRef.createEmbeddedView(this._template);
629
- });
630
- }
631
- ngOnDestroy() {
632
- var _a;
633
- (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
634
- }
635
- }
636
- BbRole.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: BbRole, deps: [{ token: Auth }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
637
- BbRole.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.5", type: BbRole, selector: "[bbRole]", inputs: { bbRole: "bbRole" }, ngImport: i0 });
638
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: BbRole, decorators: [{
639
- type: Directive,
640
- args: [{
641
- selector: '[bbRole]'
642
- }]
643
- }], ctorParameters: function () { return [{ type: Auth }, { type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { bbRole: [{
644
- type: Input
618
+ class BbRole {
619
+ constructor(_auth, _template, _viewContainerRef) {
620
+ this._auth = _auth;
621
+ this._template = _template;
622
+ this._viewContainerRef = _viewContainerRef;
623
+ this.getAllowedRoles = (value) => {
624
+ return Array.isArray(value) ? value : [value];
625
+ };
626
+ }
627
+ ngOnInit() {
628
+ this._subscription = this._auth.user.pipe(map(user => { var _a; return (_a = user === null || user === void 0 ? void 0 : user.role) !== null && _a !== void 0 ? _a : null; }), distinctUntilChanged()).subscribe(role => {
629
+ const allowedRoles = this.getAllowedRoles(this.bbRole);
630
+ if (!allowedRoles.includes(role)) {
631
+ return this._viewContainerRef.clear();
632
+ }
633
+ this._viewContainerRef.createEmbeddedView(this._template);
634
+ });
635
+ }
636
+ ngOnDestroy() {
637
+ var _a;
638
+ (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
639
+ }
640
+ }
641
+ BbRole.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbRole, deps: [{ token: Auth }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
642
+ BbRole.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.6", type: BbRole, selector: "[bbRole]", inputs: { bbRole: "bbRole" }, ngImport: i0 });
643
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbRole, decorators: [{
644
+ type: Directive,
645
+ args: [{
646
+ selector: '[bbRole]'
647
+ }]
648
+ }], ctorParameters: function () { return [{ type: Auth }, { type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { bbRole: [{
649
+ type: Input
645
650
  }] } });
646
651
 
647
- class Permissions {
648
- constructor(_auth, _config) {
649
- var _a, _b;
650
- this._auth = _auth;
651
- this._config = _config;
652
- // Data.
653
- this._permissions = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.permissions) !== null && _b !== void 0 ? _b : {};
654
- this._role$ = this._auth.user.pipe(map(user => { var _a; return (_a = user === null || user === void 0 ? void 0 : user.role) !== null && _a !== void 0 ? _a : null; }), distinctUntilChanged());
655
- }
656
- has(value) {
657
- const requiredPermissions = Array.isArray(value)
658
- ? value
659
- : [value];
660
- return this._role$.pipe(map(role => {
661
- if (role === null || role === undefined) {
662
- return false;
663
- }
664
- for (const requiredPermission of requiredPermissions) {
665
- const result = this.validatePermission(requiredPermission, role);
666
- if (!result) {
667
- return false;
668
- }
669
- }
670
- return true;
671
- }));
672
- }
673
- validatePermission(type, role) {
674
- var _a, _b, _c, _d, _e;
675
- const permission = (_b = (_a = this._permissions) === null || _a === void 0 ? void 0 : _a[type]) !== null && _b !== void 0 ? _b : null;
676
- if (!permission) {
677
- (_c = console === null || console === void 0 ? void 0 : console.warn) === null || _c === void 0 ? void 0 : _c.call(console, `Permissions: Invalid permission requested "${type}".`);
678
- return false;
679
- }
680
- if ((permission === null || permission === void 0 ? void 0 : permission.length) <= 0) {
681
- (_d = console === null || console === void 0 ? void 0 : console.warn) === null || _d === void 0 ? void 0 : _d.call(console, `Permissions: No roles were set, please add some roles to this permission.`);
682
- return false;
683
- }
684
- // If the permission includes a "*" we allow everyone.
685
- if (permission.includes('*')) {
686
- return true;
687
- }
688
- // Validate the role against the permissions.
689
- return (_e = permission === null || permission === void 0 ? void 0 : permission.includes(role)) !== null && _e !== void 0 ? _e : false;
690
- }
691
- }
692
- Permissions.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: Permissions, deps: [{ token: Auth }, { token: AuthConfig, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
693
- Permissions.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: Permissions });
694
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: Permissions, decorators: [{
695
- type: Injectable
696
- }], ctorParameters: function () {
697
- return [{ type: Auth }, { type: AuthConfig, decorators: [{
698
- type: Optional
699
- }] }];
652
+ class Permissions {
653
+ constructor(_auth, _config) {
654
+ var _a, _b;
655
+ this._auth = _auth;
656
+ this._config = _config;
657
+ // Data.
658
+ this._permissions = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.permissions) !== null && _b !== void 0 ? _b : {};
659
+ this._role$ = this._auth.user.pipe(map(user => { var _a; return (_a = user === null || user === void 0 ? void 0 : user.role) !== null && _a !== void 0 ? _a : null; }), distinctUntilChanged());
660
+ }
661
+ has(value) {
662
+ const requiredPermissions = Array.isArray(value)
663
+ ? value
664
+ : [value];
665
+ return this._role$.pipe(map(role => {
666
+ if (role === null || role === undefined) {
667
+ return false;
668
+ }
669
+ for (const requiredPermission of requiredPermissions) {
670
+ const result = this.validatePermission(requiredPermission, role);
671
+ if (!result) {
672
+ return false;
673
+ }
674
+ }
675
+ return true;
676
+ }));
677
+ }
678
+ validatePermission(type, role) {
679
+ var _a, _b, _c, _d, _e;
680
+ const permission = (_b = (_a = this._permissions) === null || _a === void 0 ? void 0 : _a[type]) !== null && _b !== void 0 ? _b : null;
681
+ if (!permission) {
682
+ (_c = console === null || console === void 0 ? void 0 : console.warn) === null || _c === void 0 ? void 0 : _c.call(console, `Permissions: Invalid permission requested "${type}".`);
683
+ return false;
684
+ }
685
+ if ((permission === null || permission === void 0 ? void 0 : permission.length) <= 0) {
686
+ (_d = console === null || console === void 0 ? void 0 : console.warn) === null || _d === void 0 ? void 0 : _d.call(console, `Permissions: No roles were set, please add some roles to this permission.`);
687
+ return false;
688
+ }
689
+ // If the permission includes a "*" we allow everyone.
690
+ if (permission.includes('*')) {
691
+ return true;
692
+ }
693
+ // Validate the role against the permissions.
694
+ return (_e = permission === null || permission === void 0 ? void 0 : permission.includes(role)) !== null && _e !== void 0 ? _e : false;
695
+ }
696
+ }
697
+ Permissions.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: Permissions, deps: [{ token: Auth }, { token: AuthConfig, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
698
+ Permissions.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: Permissions });
699
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: Permissions, decorators: [{
700
+ type: Injectable
701
+ }], ctorParameters: function () {
702
+ return [{ type: Auth }, { type: AuthConfig, decorators: [{
703
+ type: Optional
704
+ }] }];
700
705
  } });
701
706
 
702
- class BbPermission {
703
- constructor(_permissions, _templateRef, _viewContainerRef) {
704
- this._permissions = _permissions;
705
- this._templateRef = _templateRef;
706
- this._viewContainerRef = _viewContainerRef;
707
- // Data.
708
- this._permission$ = new BehaviorSubject([]);
709
- this._valid = false;
710
- this._elseTemplateRef = null;
711
- this._thenViewRef = null;
712
- this._elseViewRef = null;
713
- this.getAllowedPermissions = (value) => {
714
- return Array.isArray(value) ? value : [value];
715
- };
716
- this.assertTemplate = (property, templateRef) => {
717
- const isTemplateRefOrNull = !!(!templateRef || templateRef.createEmbeddedView);
718
- if (!isTemplateRefOrNull) {
719
- throw new Error(`${property} must be a TemplateRef.`);
720
- }
721
- };
722
- }
723
- set bbPermission(value) {
724
- const permissions = this.getAllowedPermissions(value);
725
- this._permission$.next(permissions);
726
- this.updateView();
727
- }
728
- set bbPermissionElse(templateRef) {
729
- this.assertTemplate('bbPermissionElse', templateRef);
730
- this._elseTemplateRef = templateRef;
731
- this.updateView();
732
- }
733
- ngOnInit() {
734
- const check$ = this._permission$.pipe(switchMap(permissions => this._permissions.has(permissions)));
735
- this._subscription = check$.subscribe(valid => {
736
- this._valid = valid;
737
- this.updateView();
738
- });
739
- }
740
- ngOnDestroy() {
741
- var _a;
742
- (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
743
- }
744
- updateView() {
745
- if (this._valid) {
746
- if (!this._thenViewRef) {
747
- this._viewContainerRef.clear();
748
- this._elseViewRef = null;
749
- if (this._templateRef) {
750
- this._thenViewRef = this._viewContainerRef.createEmbeddedView(this._templateRef);
751
- }
752
- }
753
- }
754
- else {
755
- if (!this._elseViewRef) {
756
- this._viewContainerRef.clear();
757
- this._thenViewRef = null;
758
- if (this._elseTemplateRef) {
759
- this._elseViewRef = this._viewContainerRef.createEmbeddedView(this._elseTemplateRef);
760
- }
761
- }
762
- }
763
- }
764
- }
765
- BbPermission.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: BbPermission, deps: [{ token: Permissions }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
766
- BbPermission.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.5", type: BbPermission, selector: "[bbPermission]", inputs: { bbPermission: "bbPermission", bbPermissionElse: "bbPermissionElse" }, ngImport: i0 });
767
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: BbPermission, decorators: [{
768
- type: Directive,
769
- args: [{
770
- selector: '[bbPermission]'
771
- }]
772
- }], ctorParameters: function () { return [{ type: Permissions }, { type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { bbPermission: [{
773
- type: Input
774
- }], bbPermissionElse: [{
775
- type: Input
707
+ class BbPermission {
708
+ constructor(_permissions, _templateRef, _viewContainerRef) {
709
+ this._permissions = _permissions;
710
+ this._templateRef = _templateRef;
711
+ this._viewContainerRef = _viewContainerRef;
712
+ // Data.
713
+ this._permission$ = new BehaviorSubject([]);
714
+ this._valid = false;
715
+ this._elseTemplateRef = null;
716
+ this._thenViewRef = null;
717
+ this._elseViewRef = null;
718
+ this.getAllowedPermissions = (value) => {
719
+ return Array.isArray(value) ? value : [value];
720
+ };
721
+ this.assertTemplate = (property, templateRef) => {
722
+ const isTemplateRefOrNull = !!(!templateRef || templateRef.createEmbeddedView);
723
+ if (!isTemplateRefOrNull) {
724
+ throw new Error(`${property} must be a TemplateRef.`);
725
+ }
726
+ };
727
+ }
728
+ set bbPermission(value) {
729
+ const permissions = this.getAllowedPermissions(value);
730
+ this._permission$.next(permissions);
731
+ this.updateView();
732
+ }
733
+ set bbPermissionElse(templateRef) {
734
+ this.assertTemplate('bbPermissionElse', templateRef);
735
+ this._elseTemplateRef = templateRef;
736
+ this.updateView();
737
+ }
738
+ ngOnInit() {
739
+ const check$ = this._permission$.pipe(switchMap(permissions => this._permissions.has(permissions)));
740
+ this._subscription = check$.subscribe(valid => {
741
+ this._valid = valid;
742
+ this.updateView();
743
+ });
744
+ }
745
+ ngOnDestroy() {
746
+ var _a;
747
+ (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
748
+ }
749
+ updateView() {
750
+ if (this._valid) {
751
+ if (!this._thenViewRef) {
752
+ this._viewContainerRef.clear();
753
+ this._elseViewRef = null;
754
+ if (this._templateRef) {
755
+ this._thenViewRef = this._viewContainerRef.createEmbeddedView(this._templateRef);
756
+ }
757
+ }
758
+ }
759
+ else {
760
+ if (!this._elseViewRef) {
761
+ this._viewContainerRef.clear();
762
+ this._thenViewRef = null;
763
+ if (this._elseTemplateRef) {
764
+ this._elseViewRef = this._viewContainerRef.createEmbeddedView(this._elseTemplateRef);
765
+ }
766
+ }
767
+ }
768
+ }
769
+ }
770
+ BbPermission.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbPermission, deps: [{ token: Permissions }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
771
+ BbPermission.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.6", type: BbPermission, selector: "[bbPermission]", inputs: { bbPermission: "bbPermission", bbPermissionElse: "bbPermissionElse" }, ngImport: i0 });
772
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbPermission, decorators: [{
773
+ type: Directive,
774
+ args: [{
775
+ selector: '[bbPermission]'
776
+ }]
777
+ }], ctorParameters: function () { return [{ type: Permissions }, { type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { bbPermission: [{
778
+ type: Input
779
+ }], bbPermissionElse: [{
780
+ type: Input
776
781
  }] } });
777
782
 
778
- class BbAnonymousGuard {
779
- constructor(_auth) {
780
- this._auth = _auth;
781
- }
782
- canActivate(_, state) {
783
- return __awaiter(this, void 0, void 0, function* () {
784
- // Check if the user is authenticated.
785
- const isAuthenticated$ = yield this._auth.user.pipe(map(user => !!user));
786
- // If the user is not authenticated it can
787
- // access the anonymous page.
788
- const isAuthenticated = yield firstValueFrom(isAuthenticated$, { defaultValue: null });
789
- if (!isAuthenticated) {
790
- return true;
791
- }
792
- // Return the user back to the authenticated page.
793
- return this._auth.guard('authenticated', state.url);
794
- });
795
- }
796
- canActivateChild(childRoute, state) {
797
- return this.canActivate(childRoute, state);
798
- }
799
- }
800
- BbAnonymousGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: BbAnonymousGuard, deps: [{ token: Auth }], target: i0.ɵɵFactoryTarget.Injectable });
801
- BbAnonymousGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: BbAnonymousGuard, providedIn: 'root' });
802
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: BbAnonymousGuard, decorators: [{
803
- type: Injectable,
804
- args: [{
805
- providedIn: 'root'
806
- }]
783
+ class BbAnonymousGuard {
784
+ constructor(_auth) {
785
+ this._auth = _auth;
786
+ }
787
+ canActivate(_, state) {
788
+ return __awaiter(this, void 0, void 0, function* () {
789
+ // Check if the user is authenticated.
790
+ const isAuthenticated$ = yield this._auth.user.pipe(map(user => !!user));
791
+ // If the user is not authenticated it can
792
+ // access the anonymous page.
793
+ const isAuthenticated = yield firstValueFrom(isAuthenticated$, { defaultValue: null });
794
+ if (!isAuthenticated) {
795
+ return true;
796
+ }
797
+ // Return the user back to the authenticated page.
798
+ return this._auth.guard('authenticated', state.url);
799
+ });
800
+ }
801
+ canActivateChild(childRoute, state) {
802
+ return this.canActivate(childRoute, state);
803
+ }
804
+ }
805
+ BbAnonymousGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbAnonymousGuard, deps: [{ token: Auth }], target: i0.ɵɵFactoryTarget.Injectable });
806
+ BbAnonymousGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbAnonymousGuard, providedIn: 'root' });
807
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbAnonymousGuard, decorators: [{
808
+ type: Injectable,
809
+ args: [{
810
+ providedIn: 'root'
811
+ }]
807
812
  }], ctorParameters: function () { return [{ type: Auth }]; } });
808
813
 
809
- class BbAuthenticatedGuard {
810
- constructor(_auth) {
811
- this._auth = _auth;
812
- }
813
- canActivate(_, state) {
814
- return __awaiter(this, void 0, void 0, function* () {
815
- // Check if the user is authenticated.
816
- const isAuthenticated$ = yield this._auth.user.pipe(map(user => !!user));
817
- // If the user is authenticated it can
818
- // access the authenticated page.
819
- const isAuthenticated = yield firstValueFrom(isAuthenticated$, { defaultValue: null });
820
- if (isAuthenticated) {
821
- return true;
822
- }
823
- // The user is not authorized to see that
824
- // page so un-authorize him.
825
- return this._auth.guard('unauthenticated', state.url);
826
- });
827
- }
828
- canActivateChild(childRoute, state) {
829
- return this.canActivate(childRoute, state);
830
- }
831
- }
832
- BbAuthenticatedGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: BbAuthenticatedGuard, deps: [{ token: Auth }], target: i0.ɵɵFactoryTarget.Injectable });
833
- BbAuthenticatedGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: BbAuthenticatedGuard, providedIn: 'root' });
834
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: BbAuthenticatedGuard, decorators: [{
835
- type: Injectable,
836
- args: [{
837
- providedIn: 'root'
838
- }]
814
+ class BbAuthenticatedGuard {
815
+ constructor(_auth) {
816
+ this._auth = _auth;
817
+ }
818
+ canActivate(_, state) {
819
+ return __awaiter(this, void 0, void 0, function* () {
820
+ // Check if the user is authenticated.
821
+ const isAuthenticated$ = yield this._auth.user.pipe(map(user => !!user));
822
+ // If the user is authenticated it can
823
+ // access the authenticated page.
824
+ const isAuthenticated = yield firstValueFrom(isAuthenticated$, { defaultValue: null });
825
+ if (isAuthenticated) {
826
+ return true;
827
+ }
828
+ // The user is not authorized to see that
829
+ // page so un-authorize him.
830
+ return this._auth.guard('unauthenticated', state.url);
831
+ });
832
+ }
833
+ canActivateChild(childRoute, state) {
834
+ return this.canActivate(childRoute, state);
835
+ }
836
+ }
837
+ BbAuthenticatedGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbAuthenticatedGuard, deps: [{ token: Auth }], target: i0.ɵɵFactoryTarget.Injectable });
838
+ BbAuthenticatedGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbAuthenticatedGuard, providedIn: 'root' });
839
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: BbAuthenticatedGuard, decorators: [{
840
+ type: Injectable,
841
+ args: [{
842
+ providedIn: 'root'
843
+ }]
839
844
  }], ctorParameters: function () { return [{ type: Auth }]; } });
840
845
 
841
- class AuthInterceptor {
842
- constructor(_auth, _config) {
843
- this._auth = _auth;
844
- this._config = _config;
845
- // Readonly data.
846
- this._authHeaderString = 'Authorization';
847
- // Data.
848
- this.isRefreshing = false;
849
- this.refreshingAccessToken$ = new BehaviorSubject(null);
850
- this.getAccessToken = (request) => {
851
- // Get the token based on header.
852
- if (request.headers.has('Authorization')) {
853
- return request.headers.get('Authorization');
854
- }
855
- // Return the default access token.
856
- return this._auth.session.accessToken;
857
- };
858
- this.addAuthorizationHeader = (request, accessToken = null) => {
859
- // Remove auth header when we do not have
860
- // an access token.
861
- if (!accessToken) {
862
- return request.clone({
863
- headers: request.headers.delete(this._authHeaderString)
864
- });
865
- }
866
- // Add the auth header to the request.
867
- return request.clone({
868
- setHeaders: { [this._authHeaderString]: this.getFullAuthorizationHeader(accessToken) }
869
- });
870
- };
871
- this.getFullAuthorizationHeader = (token) => {
872
- var _a, _b;
873
- const authScheme = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.scheme) !== null && _b !== void 0 ? _b : 'Bearer';
874
- return [authScheme, token].join(' ');
875
- };
876
- }
877
- intercept(request, next) {
878
- // 1. Check if the user wants to use the authorization for this request.
879
- if (!request.context.get(USE_AUTHORIZATION)) {
880
- return next.handle(request);
881
- }
882
- // 2. Compose the new request.
883
- const accessToken = this.getAccessToken(request);
884
- const newRequest = this.addAuthorizationHeader(request, accessToken);
885
- // 3. Handle all errors.
886
- return next.handle(newRequest).pipe(catchError(error => {
887
- // Handle the HTTP401 error.
888
- if ((error instanceof HttpErrorResponse || error instanceof HttpError) && (error === null || error === void 0 ? void 0 : error.status) === 401) {
889
- return this.handle401Error(request, next);
890
- }
891
- // Just re-throw the parsed error.
892
- return throwError(error);
893
- }));
894
- }
895
- handle401Error(request, next) {
896
- // If already refreshing wait for the refresh token to complete.
897
- if (this.isRefreshing) {
898
- return this.refreshingAccessToken$.pipe(filter(accessToken => accessToken !== null), take(1), switchMap(accessToken => next.handle(this.addAuthorizationHeader(request, accessToken))));
899
- }
900
- // Set the refreshing to true.
901
- this.isRefreshing = true;
902
- this.refreshingAccessToken$.next(null);
903
- return this._auth.refresh().pipe(switchMap(newAccessToken => {
904
- if (!newAccessToken) {
905
- const error = new Error('No refresh token was available.');
906
- return throwError(error);
907
- }
908
- this.refreshingAccessToken$.next(newAccessToken);
909
- return next.handle(this.addAuthorizationHeader(request, newAccessToken));
910
- }), catchError(() => this.logoutUser()), finalize(() => this.isRefreshing = false));
911
- }
912
- logoutUser() {
913
- // Handle the refresh error.
914
- this._auth.clearAndRedirect();
915
- // Return null as data.
916
- return of(null);
917
- }
918
- }
919
- AuthInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: AuthInterceptor, deps: [{ token: Auth }, { token: AuthConfig, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
920
- AuthInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: AuthInterceptor });
921
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: AuthInterceptor, decorators: [{
922
- type: Injectable
923
- }], ctorParameters: function () {
924
- return [{ type: Auth }, { type: AuthConfig, decorators: [{
925
- type: Optional
926
- }] }];
846
+ class AuthInterceptor {
847
+ constructor(_auth, _config) {
848
+ this._auth = _auth;
849
+ this._config = _config;
850
+ // Readonly data.
851
+ this._authHeaderString = 'Authorization';
852
+ // Data.
853
+ this.isRefreshing = false;
854
+ this.refreshingAccessToken$ = new BehaviorSubject(null);
855
+ this.getAccessToken = (request) => {
856
+ // Get the token based on header.
857
+ if (request.headers.has('Authorization')) {
858
+ return request.headers.get('Authorization');
859
+ }
860
+ // Return the default access token.
861
+ return this._auth.session.accessToken;
862
+ };
863
+ this.addAuthorizationHeader = (request, accessToken = null) => {
864
+ // Remove auth header when we do not have
865
+ // an access token.
866
+ if (!accessToken) {
867
+ return request.clone({
868
+ headers: request.headers.delete(this._authHeaderString)
869
+ });
870
+ }
871
+ // Add the auth header to the request.
872
+ return request.clone({
873
+ setHeaders: { [this._authHeaderString]: this.getFullAuthorizationHeader(accessToken) }
874
+ });
875
+ };
876
+ this.getFullAuthorizationHeader = (token) => {
877
+ var _a, _b;
878
+ const authScheme = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.scheme) !== null && _b !== void 0 ? _b : 'Bearer';
879
+ return [authScheme, token].join(' ');
880
+ };
881
+ }
882
+ intercept(request, next) {
883
+ // 1. Check if the user wants to use the authorization for this request.
884
+ if (!request.context.get(USE_AUTHORIZATION)) {
885
+ return next.handle(request);
886
+ }
887
+ // 2. Compose the new request.
888
+ const accessToken = this.getAccessToken(request);
889
+ const newRequest = this.addAuthorizationHeader(request, accessToken);
890
+ // 3. Handle all errors.
891
+ return next.handle(newRequest).pipe(catchError(error => {
892
+ // Handle the HTTP401 error.
893
+ if ((error instanceof HttpErrorResponse || error instanceof HttpError) && (error === null || error === void 0 ? void 0 : error.status) === 401) {
894
+ return this.handle401Error(request, next);
895
+ }
896
+ // Just re-throw the parsed error.
897
+ return throwError(() => error);
898
+ }));
899
+ }
900
+ handle401Error(request, next) {
901
+ // If already refreshing wait for the refresh token to complete.
902
+ if (this.isRefreshing) {
903
+ return this.refreshingAccessToken$.pipe(filter(accessToken => accessToken !== null), take(1), switchMap(accessToken => next.handle(this.addAuthorizationHeader(request, accessToken))));
904
+ }
905
+ // Set the refreshing to true.
906
+ this.isRefreshing = true;
907
+ this.refreshingAccessToken$.next(null);
908
+ return this._auth.refresh().pipe(switchMap(newAccessToken => {
909
+ if (!newAccessToken) {
910
+ return throwError(() => new Error('No refresh token was available.'));
911
+ }
912
+ this.refreshingAccessToken$.next(newAccessToken);
913
+ return next.handle(this.addAuthorizationHeader(request, newAccessToken));
914
+ }), catchError(() => this.logoutUser()), finalize(() => this.isRefreshing = false));
915
+ }
916
+ logoutUser() {
917
+ // Handle the refresh error.
918
+ this._auth.clearAndRedirect();
919
+ // Return null as data.
920
+ return of(null);
921
+ }
922
+ }
923
+ AuthInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: AuthInterceptor, deps: [{ token: Auth }, { token: AuthConfig, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
924
+ AuthInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: AuthInterceptor });
925
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: AuthInterceptor, decorators: [{
926
+ type: Injectable
927
+ }], ctorParameters: function () {
928
+ return [{ type: Auth }, { type: AuthConfig, decorators: [{
929
+ type: Optional
930
+ }] }];
927
931
  } });
928
932
 
929
- const DECLARATIONS_EXPORTS = [
930
- BbAuthenticated,
931
- BbRole,
932
- BbPermission
933
- ];
934
- class AuthModule {
935
- static forRoot(config) {
936
- return {
937
- ngModule: AuthModule,
938
- providers: [
939
- Auth,
940
- Permissions,
941
- { provide: AuthConfig, useValue: config },
942
- { provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true },
943
- { useFactory: initializeAuth, provide: APP_INITIALIZER, deps: [Auth], multi: true }
944
- ]
945
- };
946
- }
947
- }
948
- AuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: AuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
949
- AuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: AuthModule, declarations: [BbAuthenticated,
950
- BbRole,
951
- BbPermission], imports: [HttpClientModule], exports: [BbAuthenticated,
952
- BbRole,
953
- BbPermission] });
954
- AuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: AuthModule, providers: [
955
- { provide: AuthMapper, useClass: AuthMapper }
956
- ], imports: [[HttpClientModule]] });
957
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: AuthModule, decorators: [{
958
- type: NgModule,
959
- args: [{
960
- imports: [HttpClientModule],
961
- declarations: [...DECLARATIONS_EXPORTS],
962
- exports: [...DECLARATIONS_EXPORTS],
963
- providers: [
964
- { provide: AuthMapper, useClass: AuthMapper }
965
- ]
966
- }]
967
- }] });
968
- function initializeAuth(auth) {
969
- return auth.initialize();
933
+ const DECLARATIONS_EXPORTS = [
934
+ BbAuthenticated,
935
+ BbRole,
936
+ BbPermission
937
+ ];
938
+ class AuthModule {
939
+ static forRoot(config) {
940
+ return {
941
+ ngModule: AuthModule,
942
+ providers: [
943
+ Auth,
944
+ Permissions,
945
+ { provide: AuthConfig, useValue: config },
946
+ { provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true },
947
+ { useFactory: initializeAuth, provide: APP_INITIALIZER, deps: [Auth], multi: true }
948
+ ]
949
+ };
950
+ }
951
+ }
952
+ AuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: AuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
953
+ AuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: AuthModule, declarations: [BbAuthenticated,
954
+ BbRole,
955
+ BbPermission], imports: [HttpClientModule], exports: [BbAuthenticated,
956
+ BbRole,
957
+ BbPermission] });
958
+ AuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: AuthModule, providers: [
959
+ { provide: AuthMapper, useClass: AuthMapper }
960
+ ], imports: [[HttpClientModule]] });
961
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.6", ngImport: i0, type: AuthModule, decorators: [{
962
+ type: NgModule,
963
+ args: [{
964
+ imports: [HttpClientModule],
965
+ declarations: [...DECLARATIONS_EXPORTS],
966
+ exports: [...DECLARATIONS_EXPORTS],
967
+ providers: [
968
+ { provide: AuthMapper, useClass: AuthMapper }
969
+ ]
970
+ }]
971
+ }] });
972
+ function initializeAuth(auth) {
973
+ return auth.initialize();
970
974
  }
971
975
 
972
- /**
973
- * Generated bundle index. Do not edit.
976
+ /**
977
+ * Generated bundle index. Do not edit.
974
978
  */
975
979
 
976
980
  export { Auth, AuthConfig, AuthEmailProvider, AuthMapper, AuthModule, AuthSession, AuthVerifyProvider, BbAnonymousGuard, BbAuthenticated, BbAuthenticatedGuard, BbPermission, BbRole, JwtHelper, Permissions, USE_AUTHORIZATION, initializeAuth };