@bravobit/bb-foundation 0.14.3 → 0.15.2

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 (413) 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/bundles/bravobit-bb-foundation-auth.umd.js +1400 -1402
  25. package/bundles/bravobit-bb-foundation-auth.umd.js.map +1 -1
  26. package/bundles/bravobit-bb-foundation-collections.umd.js +868 -0
  27. package/bundles/bravobit-bb-foundation-collections.umd.js.map +1 -0
  28. package/bundles/bravobit-bb-foundation-dashboard.umd.js +817 -819
  29. package/bundles/bravobit-bb-foundation-dashboard.umd.js.map +1 -1
  30. package/bundles/bravobit-bb-foundation-dialog.umd.js +649 -651
  31. package/bundles/bravobit-bb-foundation-dialog.umd.js.map +1 -1
  32. package/bundles/bravobit-bb-foundation-elements.umd.js +2651 -2653
  33. package/bundles/bravobit-bb-foundation-elements.umd.js.map +1 -1
  34. package/bundles/bravobit-bb-foundation-http.umd.js +488 -490
  35. package/bundles/bravobit-bb-foundation-http.umd.js.map +1 -1
  36. package/bundles/bravobit-bb-foundation-localize.umd.js +1208 -1210
  37. package/bundles/bravobit-bb-foundation-localize.umd.js.map +1 -1
  38. package/bundles/bravobit-bb-foundation-notifications.umd.js +743 -745
  39. package/bundles/bravobit-bb-foundation-notifications.umd.js.map +1 -1
  40. package/bundles/bravobit-bb-foundation-recaptcha.umd.js +640 -642
  41. package/bundles/bravobit-bb-foundation-recaptcha.umd.js.map +1 -1
  42. package/bundles/bravobit-bb-foundation-rxjs.umd.js +13 -13
  43. package/bundles/bravobit-bb-foundation-rxjs.umd.js.map +1 -1
  44. package/bundles/bravobit-bb-foundation-storage.umd.js +756 -758
  45. package/bundles/bravobit-bb-foundation-storage.umd.js.map +1 -1
  46. package/bundles/bravobit-bb-foundation-table.umd.js +993 -995
  47. package/bundles/bravobit-bb-foundation-table.umd.js.map +1 -1
  48. package/bundles/bravobit-bb-foundation.umd.js +1332 -1334
  49. package/bundles/bravobit-bb-foundation.umd.js.map +1 -1
  50. package/collections/bravobit-bb-foundation-collections.d.ts +5 -0
  51. package/collections/lib/collection.d.ts +43 -0
  52. package/collections/lib/collections.module.d.ts +10 -0
  53. package/collections/lib/components/collections-pager/collections-pager.component.d.ts +34 -0
  54. package/collections/lib/components/collections-viewer/collections-viewer.component.d.ts +12 -0
  55. package/collections/lib/components/collections.directive.d.ts +17 -0
  56. package/collections/lib/interfaces/collection.interface.d.ts +26 -0
  57. package/collections/lib/providers/api-collection.provider.d.ts +15 -0
  58. package/collections/lib/providers/collection.provider.d.ts +6 -0
  59. package/collections/lib/providers/local-collection.provider.d.ts +8 -0
  60. package/collections/package.json +10 -0
  61. package/collections/public_api.d.ts +9 -0
  62. package/dashboard/bravobit-bb-foundation-dashboard.d.ts +5 -5
  63. package/dashboard/lib/dashboard/dashboard.component.d.ts +19 -19
  64. package/dashboard/lib/dashboard-header/dashboard-header.component.d.ts +11 -11
  65. package/dashboard/lib/dashboard-menu/dashboard-menu.component.d.ts +9 -9
  66. package/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.d.ts +11 -11
  67. package/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.d.ts +21 -21
  68. package/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.d.ts +27 -27
  69. package/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.d.ts +16 -16
  70. package/dashboard/lib/dashboard.module.d.ts +16 -16
  71. package/dashboard/public_api.d.ts +8 -8
  72. package/dialog/bravobit-bb-foundation-dialog.d.ts +5 -5
  73. package/dialog/lib/dialog-actions/dialog-actions.component.d.ts +5 -5
  74. package/dialog/lib/dialog-confirm/dialog-confirm.component.d.ts +16 -16
  75. package/dialog/lib/dialog-container/dialog-container.component.d.ts +24 -24
  76. package/dialog/lib/dialog-header/dialog-header.component.d.ts +9 -9
  77. package/dialog/lib/dialog-link/dialog-link.component.d.ts +5 -5
  78. package/dialog/lib/dialog-modal/dialog-modal.component.d.ts +12 -12
  79. package/dialog/lib/dialog-overlay/dialog-overlay.component.d.ts +22 -22
  80. package/dialog/lib/dialog.injector.d.ts +8 -8
  81. package/dialog/lib/dialog.insertion.d.ts +8 -8
  82. package/dialog/lib/dialog.interfaces.d.ts +3 -3
  83. package/dialog/lib/dialog.module.d.ts +19 -19
  84. package/dialog/lib/dialog.ref.d.ts +8 -8
  85. package/dialog/lib/dialog.service.d.ts +19 -19
  86. package/dialog/public_api.d.ts +9 -9
  87. package/elements/bravobit-bb-foundation-elements.d.ts +5 -5
  88. package/elements/lib/avatar/avatar.component.d.ts +25 -25
  89. package/elements/lib/button/button.component.d.ts +23 -23
  90. package/elements/lib/checkbox/checkbox.component.d.ts +27 -27
  91. package/elements/lib/date-picker/date-picker.component.d.ts +69 -69
  92. package/elements/lib/directives/addon.directive.d.ts +9 -9
  93. package/elements/lib/directives/autosize.directive.d.ts +18 -18
  94. package/elements/lib/directives/focus-trap.directive.d.ts +17 -17
  95. package/elements/lib/directives/focus.directive.d.ts +14 -14
  96. package/elements/lib/directives/form-submit.directive.d.ts +17 -17
  97. package/elements/lib/directives/input.directive.d.ts +38 -38
  98. package/elements/lib/directives/template.directive.d.ts +10 -10
  99. package/elements/lib/dropdown/dropdown.component.d.ts +21 -21
  100. package/elements/lib/elements.interfaces.d.ts +25 -25
  101. package/elements/lib/elements.module.d.ts +116 -116
  102. package/elements/lib/file-picker/file-picker.component.d.ts +49 -49
  103. package/elements/lib/form-control/form-control.component.d.ts +21 -21
  104. package/elements/lib/form-error/form-error.component.d.ts +29 -29
  105. package/elements/lib/form-group/form-group.component.d.ts +10 -10
  106. package/elements/lib/icon/icon.component.d.ts +22 -22
  107. package/elements/lib/image-picker/image-picker.component.d.ts +38 -38
  108. package/elements/lib/pipes/file-image.pipe.d.ts +13 -13
  109. package/elements/lib/pipes/file-size.pipe.d.ts +8 -8
  110. package/elements/lib/pipes/relative-time.pipe.d.ts +19 -19
  111. package/elements/lib/spinner/spinner.component.d.ts +12 -12
  112. package/elements/lib/tag/tag.component.d.ts +7 -7
  113. package/elements/public_api.d.ts +25 -25
  114. package/esm2015/auth/bravobit-bb-foundation-auth.js +4 -4
  115. package/esm2015/auth/lib/auth.interceptor.js +95 -95
  116. package/esm2015/auth/lib/auth.module.js +54 -54
  117. package/esm2015/auth/lib/auth.service.js +299 -299
  118. package/esm2015/auth/lib/auth.session.js +136 -136
  119. package/esm2015/auth/lib/directives/authenticated.directive.js +32 -32
  120. package/esm2015/auth/lib/directives/permission.directive.js +81 -81
  121. package/esm2015/auth/lib/directives/role.directive.js +38 -38
  122. package/esm2015/auth/lib/guards/anonymous.guard.js +35 -35
  123. package/esm2015/auth/lib/guards/authenticated.guard.js +36 -36
  124. package/esm2015/auth/lib/helpers/jwt.helper.js +69 -69
  125. package/esm2015/auth/lib/helpers/mapper.helper.js +35 -35
  126. package/esm2015/auth/lib/interfaces/config.interface.js +3 -3
  127. package/esm2015/auth/lib/interfaces/mapper.interface.js +2 -2
  128. package/esm2015/auth/lib/interfaces/provider.interface.js +2 -2
  129. package/esm2015/auth/lib/interfaces/token.interface.js +2 -2
  130. package/esm2015/auth/lib/permissions.service.js +58 -58
  131. package/esm2015/auth/lib/providers/email.provider.js +26 -26
  132. package/esm2015/auth/lib/providers/verify.provider.js +20 -20
  133. package/esm2015/auth/lib/tokens/use-authorization.token.js +3 -3
  134. package/esm2015/auth/public_api.js +19 -19
  135. package/esm2015/bravobit-bb-foundation.js +4 -4
  136. package/esm2015/collections/bravobit-bb-foundation-collections.js +5 -0
  137. package/esm2015/collections/lib/collection.js +104 -0
  138. package/esm2015/collections/lib/collections.module.js +54 -0
  139. package/esm2015/collections/lib/components/collections-pager/collections-pager.component.js +136 -0
  140. package/esm2015/collections/lib/components/collections-viewer/collections-viewer.component.js +39 -0
  141. package/esm2015/collections/lib/components/collections.directive.js +43 -0
  142. package/esm2015/collections/lib/interfaces/collection.interface.js +2 -0
  143. package/esm2015/collections/lib/providers/api-collection.provider.js +69 -0
  144. package/esm2015/collections/lib/providers/collection.provider.js +14 -0
  145. package/esm2015/collections/lib/providers/local-collection.provider.js +16 -0
  146. package/esm2015/collections/public_api.js +10 -0
  147. package/esm2015/dashboard/bravobit-bb-foundation-dashboard.js +4 -4
  148. package/esm2015/dashboard/lib/dashboard/dashboard.component.js +64 -64
  149. package/esm2015/dashboard/lib/dashboard-header/dashboard-header.component.js +41 -41
  150. package/esm2015/dashboard/lib/dashboard-menu/dashboard-menu.component.js +39 -39
  151. package/esm2015/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.js +38 -38
  152. package/esm2015/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.js +83 -83
  153. package/esm2015/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.js +110 -110
  154. package/esm2015/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.js +71 -71
  155. package/esm2015/dashboard/lib/dashboard.module.js +47 -47
  156. package/esm2015/dashboard/public_api.js +9 -9
  157. package/esm2015/dialog/bravobit-bb-foundation-dialog.js +4 -4
  158. package/esm2015/dialog/lib/dialog-actions/dialog-actions.component.js +20 -20
  159. package/esm2015/dialog/lib/dialog-confirm/dialog-confirm.component.js +45 -45
  160. package/esm2015/dialog/lib/dialog-container/dialog-container.component.js +162 -162
  161. package/esm2015/dialog/lib/dialog-header/dialog-header.component.js +33 -33
  162. package/esm2015/dialog/lib/dialog-link/dialog-link.component.js +19 -19
  163. package/esm2015/dialog/lib/dialog-modal/dialog-modal.component.js +54 -54
  164. package/esm2015/dialog/lib/dialog-overlay/dialog-overlay.component.js +143 -143
  165. package/esm2015/dialog/lib/dialog.injector.js +18 -18
  166. package/esm2015/dialog/lib/dialog.insertion.js +16 -16
  167. package/esm2015/dialog/lib/dialog.interfaces.js +3 -3
  168. package/esm2015/dialog/lib/dialog.module.js +74 -74
  169. package/esm2015/dialog/lib/dialog.ref.js +22 -22
  170. package/esm2015/dialog/lib/dialog.service.js +77 -77
  171. package/esm2015/dialog/public_api.js +10 -10
  172. package/esm2015/elements/bravobit-bb-foundation-elements.js +4 -4
  173. package/esm2015/elements/lib/avatar/avatar.component.js +151 -151
  174. package/esm2015/elements/lib/button/button.component.js +79 -79
  175. package/esm2015/elements/lib/checkbox/checkbox.component.js +83 -83
  176. package/esm2015/elements/lib/date-picker/date-picker.component.js +322 -322
  177. package/esm2015/elements/lib/directives/addon.directive.js +29 -29
  178. package/esm2015/elements/lib/directives/autosize.directive.js +74 -74
  179. package/esm2015/elements/lib/directives/focus-trap.directive.js +77 -77
  180. package/esm2015/elements/lib/directives/focus.directive.js +39 -39
  181. package/esm2015/elements/lib/directives/form-submit.directive.js +53 -53
  182. package/esm2015/elements/lib/directives/input.directive.js +139 -139
  183. package/esm2015/elements/lib/directives/template.directive.js +28 -28
  184. package/esm2015/elements/lib/dropdown/dropdown.component.js +111 -111
  185. package/esm2015/elements/lib/elements.interfaces.js +4 -4
  186. package/esm2015/elements/lib/elements.module.js +177 -177
  187. package/esm2015/elements/lib/file-picker/file-picker.component.js +247 -247
  188. package/esm2015/elements/lib/form-control/form-control.component.js +58 -58
  189. package/esm2015/elements/lib/form-error/form-error.component.js +116 -116
  190. package/esm2015/elements/lib/form-group/form-group.component.js +27 -27
  191. package/esm2015/elements/lib/icon/icon.component.js +110 -110
  192. package/esm2015/elements/lib/image-picker/image-picker.component.js +119 -119
  193. package/esm2015/elements/lib/pipes/file-image.pipe.js +45 -45
  194. package/esm2015/elements/lib/pipes/file-size.pipe.js +28 -28
  195. package/esm2015/elements/lib/pipes/relative-time.pipe.js +96 -96
  196. package/esm2015/elements/lib/spinner/spinner.component.js +34 -34
  197. package/esm2015/elements/lib/tag/tag.component.js +26 -26
  198. package/esm2015/elements/public_api.js +26 -26
  199. package/esm2015/http/bravobit-bb-foundation-http.js +4 -4
  200. package/esm2015/http/lib/classes/http.config.js +31 -31
  201. package/esm2015/http/lib/classes/http.error.js +21 -21
  202. package/esm2015/http/lib/http.interfaces.js +2 -2
  203. package/esm2015/http/lib/http.module.js +43 -43
  204. package/esm2015/http/lib/interceptors/base-url.interceptor.js +52 -52
  205. package/esm2015/http/lib/interceptors/error.interceptor.js +33 -33
  206. package/esm2015/http/public_api.js +7 -7
  207. package/esm2015/lib/core/coercions/boolean-coercion.js +4 -4
  208. package/esm2015/lib/core/miscellaneous/regex.js +5 -5
  209. package/esm2015/lib/core/miscellaneous/validator.js +86 -86
  210. package/esm2015/lib/core/mixins/can-disable.js +16 -16
  211. package/esm2015/lib/core/mixins/can-hide-errors.js +16 -16
  212. package/esm2015/lib/core/mixins/can-load.js +16 -16
  213. package/esm2015/lib/core/mixins/constructor.js +2 -2
  214. package/esm2015/lib/core/mixins/has-error.js +16 -16
  215. package/esm2015/lib/core/mixins/is-focused.js +16 -16
  216. package/esm2015/lib/core/mixins/is-grouped.js +16 -16
  217. package/esm2015/lib/core/mixins/is-readonly.js +16 -16
  218. package/esm2015/lib/core/mixins/is-required.js +16 -16
  219. package/esm2015/lib/core/services/clipboard.service.js +72 -72
  220. package/esm2015/lib/core/services/exif.service.js +168 -168
  221. package/esm2015/lib/core/services/file-loader.service.js +90 -90
  222. package/esm2015/lib/core/services/image-converter.service.js +130 -130
  223. package/esm2015/lib/core/services/languages.service.js +74 -74
  224. package/esm2015/lib/core/services/network.service.js +56 -56
  225. package/esm2015/lib/core/services/patch.service.js +65 -65
  226. package/esm2015/lib/core/services/platform.service.js +42 -42
  227. package/esm2015/lib/core/tokens/accept-language.token.js +3 -3
  228. package/esm2015/lib/core/tokens/base-url.token.js +3 -3
  229. package/esm2015/lib/core/tokens/cookie.token.js +3 -3
  230. package/esm2015/lib/core/tokens/location.token.js +6 -6
  231. package/esm2015/lib/core/tokens/navigator.token.js +6 -6
  232. package/esm2015/lib/core/tokens/window.token.js +12 -12
  233. package/esm2015/localize/bravobit-bb-foundation-localize.js +4 -4
  234. package/esm2015/localize/lib/functions/date.function.js +18 -18
  235. package/esm2015/localize/lib/functions/lowercase.function.js +13 -13
  236. package/esm2015/localize/lib/functions/uppercase.function.js +13 -13
  237. package/esm2015/localize/lib/handlers/missing.handler.js +17 -17
  238. package/esm2015/localize/lib/interfaces/config.interfaces.js +10 -10
  239. package/esm2015/localize/lib/interfaces/dictionary.interfaces.js +8 -8
  240. package/esm2015/localize/lib/interfaces/functions.interfaces.js +8 -8
  241. package/esm2015/localize/lib/interfaces/handlers.interfaces.js +2 -2
  242. package/esm2015/localize/lib/interfaces/options.interfaces.js +6 -6
  243. package/esm2015/localize/lib/localizations/dutch.localization.js +53 -53
  244. package/esm2015/localize/lib/localizations/english.localization.js +53 -53
  245. package/esm2015/localize/lib/localize.dictionary.js +137 -137
  246. package/esm2015/localize/lib/localize.module.js +69 -69
  247. package/esm2015/localize/lib/localize.pipe.js +49 -49
  248. package/esm2015/localize/lib/localize.service.js +282 -282
  249. package/esm2015/localize/lib/views/localize-string/localize-string.component.js +99 -99
  250. package/esm2015/localize/lib/views/localize-template-or-string.directive.js +28 -28
  251. package/esm2015/localize/lib/views/localize-template.directive.js +21 -21
  252. package/esm2015/localize/public_api.js +18 -18
  253. package/esm2015/notifications/bravobit-bb-foundation-notifications.js +4 -4
  254. package/esm2015/notifications/lib/notifications-item/notifications-item.component.js +108 -108
  255. package/esm2015/notifications/lib/notifications-list/notifications-list.component.js +56 -56
  256. package/esm2015/notifications/lib/notifications.animations.js +28 -28
  257. package/esm2015/notifications/lib/notifications.injector.js +18 -18
  258. package/esm2015/notifications/lib/notifications.interfaces.js +20 -20
  259. package/esm2015/notifications/lib/notifications.module.js +31 -31
  260. package/esm2015/notifications/lib/notifications.service.js +145 -145
  261. package/esm2015/notifications/public_api.js +4 -4
  262. package/esm2015/public_api.js +30 -30
  263. package/esm2015/recaptcha/bravobit-bb-foundation-recaptcha.js +4 -4
  264. package/esm2015/recaptcha/lib/recaptcha/recaptcha.component.js +199 -199
  265. package/esm2015/recaptcha/lib/recaptcha-loader.service.js +93 -93
  266. package/esm2015/recaptcha/lib/recaptcha.interface.js +3 -3
  267. package/esm2015/recaptcha/lib/recaptcha.module.js +27 -27
  268. package/esm2015/recaptcha/public_api.js +5 -5
  269. package/esm2015/rxjs/bravobit-bb-foundation-rxjs.js +4 -4
  270. package/esm2015/rxjs/lib/operators/combine-latest-map.operator.js +7 -7
  271. package/esm2015/rxjs/lib/operators/filter-nil.operator.js +5 -5
  272. package/esm2015/rxjs/public_api.js +3 -3
  273. package/esm2015/storage/bravobit-bb-foundation-storage.js +4 -4
  274. package/esm2015/storage/lib/interfaces/attributes.interface.js +2 -2
  275. package/esm2015/storage/lib/interfaces/memory.interface.js +2 -2
  276. package/esm2015/storage/lib/interfaces/strategy.interface.js +2 -2
  277. package/esm2015/storage/lib/storage.service.js +111 -111
  278. package/esm2015/storage/lib/strategies/cookie-storage.strategy.js +143 -143
  279. package/esm2015/storage/lib/strategies/memory-storage.strategy.js +56 -56
  280. package/esm2015/storage/lib/strategies/polyfill-storage.strategy.js +102 -102
  281. package/esm2015/storage/public_api.js +8 -8
  282. package/esm2015/table/bravobit-bb-foundation-table.js +4 -4
  283. package/esm2015/table/lib/components/table/table.component.js +183 -183
  284. package/esm2015/table/lib/components/table-cell/table-cell.component.js +19 -19
  285. package/esm2015/table/lib/components/table-header-cell/table-header-cell.component.js +141 -141
  286. package/esm2015/table/lib/components/table-pager/table-pager.component.js +146 -146
  287. package/esm2015/table/lib/data/datasource.data.js +32 -32
  288. package/esm2015/table/lib/data/generic.data.js +73 -73
  289. package/esm2015/table/lib/interfaces/datasource.interface.js +2 -2
  290. package/esm2015/table/lib/interfaces/table.interfaces.js +2 -2
  291. package/esm2015/table/lib/table.module.js +39 -39
  292. package/esm2015/table/public_api.js +10 -10
  293. package/fesm2015/bravobit-bb-foundation-auth.js +915 -915
  294. package/fesm2015/bravobit-bb-foundation-auth.js.map +1 -1
  295. package/fesm2015/bravobit-bb-foundation-collections.js +463 -0
  296. package/fesm2015/bravobit-bb-foundation-collections.js.map +1 -0
  297. package/fesm2015/bravobit-bb-foundation-dashboard.js +434 -434
  298. package/fesm2015/bravobit-bb-foundation-dashboard.js.map +1 -1
  299. package/fesm2015/bravobit-bb-foundation-dialog.js +603 -603
  300. package/fesm2015/bravobit-bb-foundation-dialog.js.map +1 -1
  301. package/fesm2015/bravobit-bb-foundation-elements.js +2076 -2076
  302. package/fesm2015/bravobit-bb-foundation-elements.js.map +1 -1
  303. package/fesm2015/bravobit-bb-foundation-http.js +154 -154
  304. package/fesm2015/bravobit-bb-foundation-http.js.map +1 -1
  305. package/fesm2015/bravobit-bb-foundation-localize.js +796 -796
  306. package/fesm2015/bravobit-bb-foundation-localize.js.map +1 -1
  307. package/fesm2015/bravobit-bb-foundation-notifications.js +364 -364
  308. package/fesm2015/bravobit-bb-foundation-notifications.js.map +1 -1
  309. package/fesm2015/bravobit-bb-foundation-recaptcha.js +297 -297
  310. package/fesm2015/bravobit-bb-foundation-recaptcha.js.map +1 -1
  311. package/fesm2015/bravobit-bb-foundation-rxjs.js +7 -7
  312. package/fesm2015/bravobit-bb-foundation-rxjs.js.map +1 -1
  313. package/fesm2015/bravobit-bb-foundation-storage.js +399 -399
  314. package/fesm2015/bravobit-bb-foundation-storage.js.map +1 -1
  315. package/fesm2015/bravobit-bb-foundation-table.js +578 -578
  316. package/fesm2015/bravobit-bb-foundation-table.js.map +1 -1
  317. package/fesm2015/bravobit-bb-foundation.js +851 -851
  318. package/fesm2015/bravobit-bb-foundation.js.map +1 -1
  319. package/http/bravobit-bb-foundation-http.d.ts +5 -5
  320. package/http/lib/classes/http.config.d.ts +9 -9
  321. package/http/lib/classes/http.error.d.ts +7 -7
  322. package/http/lib/http.interfaces.d.ts +12 -12
  323. package/http/lib/http.module.d.ts +15 -15
  324. package/http/lib/interceptors/base-url.interceptor.d.ts +15 -15
  325. package/http/lib/interceptors/error.interceptor.d.ts +11 -11
  326. package/http/public_api.d.ts +6 -6
  327. package/lib/core/coercions/boolean-coercion.d.ts +1 -1
  328. package/lib/core/miscellaneous/regex.d.ts +4 -4
  329. package/lib/core/miscellaneous/validator.d.ts +13 -13
  330. package/lib/core/mixins/can-disable.d.ts +6 -6
  331. package/lib/core/mixins/can-hide-errors.d.ts +6 -6
  332. package/lib/core/mixins/can-load.d.ts +6 -6
  333. package/lib/core/mixins/constructor.d.ts +1 -1
  334. package/lib/core/mixins/has-error.d.ts +6 -6
  335. package/lib/core/mixins/is-focused.d.ts +6 -6
  336. package/lib/core/mixins/is-grouped.d.ts +6 -6
  337. package/lib/core/mixins/is-readonly.d.ts +6 -6
  338. package/lib/core/mixins/is-required.d.ts +6 -6
  339. package/lib/core/services/clipboard.service.d.ts +18 -18
  340. package/lib/core/services/exif.service.d.ts +15 -15
  341. package/lib/core/services/file-loader.service.d.ts +13 -13
  342. package/lib/core/services/image-converter.service.d.ts +21 -21
  343. package/lib/core/services/languages.service.d.ts +16 -16
  344. package/lib/core/services/network.service.d.ts +14 -14
  345. package/lib/core/services/patch.service.d.ts +16 -16
  346. package/lib/core/services/platform.service.d.ts +18 -18
  347. package/lib/core/tokens/accept-language.token.d.ts +2 -2
  348. package/lib/core/tokens/base-url.token.d.ts +2 -2
  349. package/lib/core/tokens/cookie.token.d.ts +2 -2
  350. package/lib/core/tokens/location.token.d.ts +2 -2
  351. package/lib/core/tokens/navigator.token.d.ts +2 -2
  352. package/lib/core/tokens/window.token.d.ts +2 -2
  353. package/localize/bravobit-bb-foundation-localize.d.ts +5 -5
  354. package/localize/lib/functions/date.function.d.ts +5 -5
  355. package/localize/lib/functions/lowercase.function.d.ts +5 -5
  356. package/localize/lib/functions/uppercase.function.d.ts +5 -5
  357. package/localize/lib/handlers/missing.handler.d.ts +6 -6
  358. package/localize/lib/interfaces/config.interfaces.d.ts +8 -8
  359. package/localize/lib/interfaces/dictionary.interfaces.d.ts +12 -12
  360. package/localize/lib/interfaces/functions.interfaces.d.ts +9 -9
  361. package/localize/lib/interfaces/handlers.interfaces.d.ts +6 -6
  362. package/localize/lib/interfaces/options.interfaces.d.ts +10 -10
  363. package/localize/lib/localizations/dutch.localization.d.ts +51 -51
  364. package/localize/lib/localizations/english.localization.d.ts +51 -51
  365. package/localize/lib/localize.dictionary.d.ts +24 -24
  366. package/localize/lib/localize.module.d.ts +18 -18
  367. package/localize/lib/localize.pipe.d.ts +12 -12
  368. package/localize/lib/localize.service.d.ts +51 -51
  369. package/localize/lib/views/localize-string/localize-string.component.d.ts +23 -23
  370. package/localize/lib/views/localize-template-or-string.directive.d.ts +10 -10
  371. package/localize/lib/views/localize-template.directive.d.ts +9 -9
  372. package/localize/public_api.d.ts +17 -17
  373. package/notifications/bravobit-bb-foundation-notifications.d.ts +5 -5
  374. package/notifications/lib/notifications-item/notifications-item.component.d.ts +34 -34
  375. package/notifications/lib/notifications-list/notifications-list.component.d.ts +16 -16
  376. package/notifications/lib/notifications.animations.d.ts +1 -1
  377. package/notifications/lib/notifications.injector.d.ts +8 -8
  378. package/notifications/lib/notifications.interfaces.d.ts +49 -49
  379. package/notifications/lib/notifications.module.d.ts +13 -13
  380. package/notifications/lib/notifications.service.d.ts +34 -34
  381. package/notifications/public_api.d.ts +3 -3
  382. package/package.json +5 -5
  383. package/public_api.d.ts +26 -26
  384. package/recaptcha/bravobit-bb-foundation-recaptcha.d.ts +5 -5
  385. package/recaptcha/lib/recaptcha/recaptcha.component.d.ts +47 -47
  386. package/recaptcha/lib/recaptcha-loader.service.d.ts +22 -22
  387. package/recaptcha/lib/recaptcha.interface.d.ts +14 -14
  388. package/recaptcha/lib/recaptcha.module.d.ts +10 -16
  389. package/recaptcha/public_api.d.ts +4 -4
  390. package/rxjs/bravobit-bb-foundation-rxjs.d.ts +5 -5
  391. package/rxjs/lib/operators/combine-latest-map.operator.d.ts +8 -8
  392. package/rxjs/lib/operators/filter-nil.operator.d.ts +1 -1
  393. package/rxjs/public_api.d.ts +2 -2
  394. package/storage/bravobit-bb-foundation-storage.d.ts +5 -5
  395. package/storage/lib/interfaces/attributes.interface.d.ts +13 -13
  396. package/storage/lib/interfaces/memory.interface.d.ts +7 -7
  397. package/storage/lib/interfaces/strategy.interface.d.ts +17 -17
  398. package/storage/lib/storage.service.d.ts +26 -26
  399. package/storage/lib/strategies/cookie-storage.strategy.d.ts +20 -20
  400. package/storage/lib/strategies/memory-storage.strategy.d.ts +11 -11
  401. package/storage/lib/strategies/polyfill-storage.strategy.d.ts +15 -15
  402. package/storage/public_api.d.ts +7 -7
  403. package/table/bravobit-bb-foundation-table.d.ts +5 -5
  404. package/table/lib/components/table/table.component.d.ts +48 -48
  405. package/table/lib/components/table-cell/table-cell.component.d.ts +5 -5
  406. package/table/lib/components/table-header-cell/table-header-cell.component.d.ts +29 -29
  407. package/table/lib/components/table-pager/table-pager.component.d.ts +41 -41
  408. package/table/lib/data/datasource.data.d.ts +14 -14
  409. package/table/lib/data/generic.data.d.ts +23 -23
  410. package/table/lib/interfaces/datasource.interface.d.ts +17 -17
  411. package/table/lib/interfaces/table.interfaces.d.ts +1 -1
  412. package/table/lib/table.module.d.ts +14 -14
  413. package/table/public_api.d.ts +9 -9
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common/http'), require('@angular/core'), require('rxjs/operators'), require('@angular/platform-browser'), require('rxjs'), require('@angular/router'), require('@bravobit/bb-foundation/storage'), require('@bravobit/bb-foundation'), require('@bravobit/bb-foundation/http')) :
3
3
  typeof define === 'function' && define.amd ? define('@bravobit/bb-foundation/auth', ['exports', '@angular/common/http', '@angular/core', 'rxjs/operators', '@angular/platform-browser', 'rxjs', '@angular/router', '@bravobit/bb-foundation/storage', '@bravobit/bb-foundation', '@bravobit/bb-foundation/http'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.bravobit = global.bravobit || {}, global.bravobit['bb-foundation'] = global.bravobit['bb-foundation'] || {}, global.bravobit['bb-foundation'].auth = {}), global.ng.common.http, global.ng.core, global.rxjs.operators, global.ng.platformBrowser, global.rxjs, global.ng.router, global.bravobit['bb-foundation'].storage, global.bravobit['bb-foundation'], global.bravobit['bb-foundation'].http));
5
- }(this, (function (exports, i4, i0, operators, i6, rxjs, router, i1, i3, i7) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.bravobit = global.bravobit || {}, global.bravobit["bb-foundation"] = global.bravobit["bb-foundation"] || {}, global.bravobit["bb-foundation"].auth = {}), global.ng.common.http, global.ng.core, global.rxjs.operators, global.ng.platformBrowser, global.rxjs, global.ng.router, global.bravobit["bb-foundation"].storage, global.bravobit["bb-foundation"], global.bravobit["bb-foundation"].http));
5
+ })(this, (function (exports, i4, i0, operators, i6, rxjs, router, i1, i3, i7) { 'use strict';
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -13,14 +13,12 @@
13
13
  var d = Object.getOwnPropertyDescriptor(e, k);
14
14
  Object.defineProperty(n, k, d.get ? d : {
15
15
  enumerable: true,
16
- get: function () {
17
- return e[k];
18
- }
16
+ get: function () { return e[k]; }
19
17
  });
20
18
  }
21
19
  });
22
20
  }
23
- n['default'] = e;
21
+ n["default"] = e;
24
22
  return Object.freeze(n);
25
23
  }
26
24
 
@@ -31,1435 +29,1435 @@
31
29
  var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
32
30
  var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
33
31
 
34
- var AuthConfig = /** @class */ (function () {
35
- function AuthConfig() {
36
- }
37
- return AuthConfig;
32
+ var AuthConfig = /** @class */ (function () {
33
+ function AuthConfig() {
34
+ }
35
+ return AuthConfig;
38
36
  }());
39
37
 
40
38
  var USE_AUTHORIZATION = new i4.HttpContextToken(function () { return true; });
41
39
 
42
- var JwtHelper = /** @class */ (function () {
43
- function JwtHelper() {
44
- var _this = this;
45
- this.baseDecodeUnicode = function (value) {
46
- return decodeURIComponent(atob(value).replace(/(.)/g, function (_, p) {
47
- var code = p.charCodeAt(0).toString(16).toUpperCase();
48
- if (code.length < 2) {
49
- code = '0' + code;
50
- }
51
- return '%' + code;
52
- }));
53
- };
54
- this.parse = function (data) {
55
- return {
56
- id: data['iss'] || null,
57
- type: data['typ'] || null,
58
- audience: data['aud'] || null,
59
- issuer: data['iss'] || null,
60
- subject: data['sub'] || null,
61
- role: data['role'] || null,
62
- notValidBefore: _this.parseDate(data['nbf']),
63
- expiresAt: _this.parseDate(data['exp']),
64
- issuedAt: _this.parseDate(data['iat'])
65
- };
66
- };
67
- this.parseDate = function (epochInSeconds) {
68
- if (!epochInSeconds || epochInSeconds <= 0) {
69
- return null;
70
- }
71
- return new Date(epochInSeconds * 1000);
72
- };
73
- }
74
- JwtHelper.prototype.decode = function (token) {
75
- try {
76
- if (token === null || token === undefined) {
77
- return null;
78
- }
79
- var json = JSON.parse(this.urlDecode(token.split('.')[1]));
80
- return this.parse(json);
81
- }
82
- catch (_a) {
83
- return null;
84
- }
85
- };
86
- JwtHelper.prototype.urlDecode = function (token) {
87
- var value = token || '';
88
- var output = value
89
- .replace(/-/g, '+')
90
- .replace(/_/g, '/');
91
- switch (output.length % 4) {
92
- case 0:
93
- break;
94
- case 2:
95
- output += '==';
96
- break;
97
- case 3:
98
- output += '=';
99
- break;
100
- default:
101
- throw 'Illegal base64url string!';
102
- }
103
- try {
104
- return this.baseDecodeUnicode(output);
105
- }
106
- catch (_a) {
107
- return atob(output);
108
- }
109
- };
110
- return JwtHelper;
40
+ var JwtHelper = /** @class */ (function () {
41
+ function JwtHelper() {
42
+ var _this = this;
43
+ this.baseDecodeUnicode = function (value) {
44
+ return decodeURIComponent(atob(value).replace(/(.)/g, function (_, p) {
45
+ var code = p.charCodeAt(0).toString(16).toUpperCase();
46
+ if (code.length < 2) {
47
+ code = '0' + code;
48
+ }
49
+ return '%' + code;
50
+ }));
51
+ };
52
+ this.parse = function (data) {
53
+ return {
54
+ id: data['iss'] || null,
55
+ type: data['typ'] || null,
56
+ audience: data['aud'] || null,
57
+ issuer: data['iss'] || null,
58
+ subject: data['sub'] || null,
59
+ role: data['role'] || null,
60
+ notValidBefore: _this.parseDate(data['nbf']),
61
+ expiresAt: _this.parseDate(data['exp']),
62
+ issuedAt: _this.parseDate(data['iat'])
63
+ };
64
+ };
65
+ this.parseDate = function (epochInSeconds) {
66
+ if (!epochInSeconds || epochInSeconds <= 0) {
67
+ return null;
68
+ }
69
+ return new Date(epochInSeconds * 1000);
70
+ };
71
+ }
72
+ JwtHelper.prototype.decode = function (token) {
73
+ try {
74
+ if (token === null || token === undefined) {
75
+ return null;
76
+ }
77
+ var json = JSON.parse(this.urlDecode(token.split('.')[1]));
78
+ return this.parse(json);
79
+ }
80
+ catch (_a) {
81
+ return null;
82
+ }
83
+ };
84
+ JwtHelper.prototype.urlDecode = function (token) {
85
+ var value = token || '';
86
+ var output = value
87
+ .replace(/-/g, '+')
88
+ .replace(/_/g, '/');
89
+ switch (output.length % 4) {
90
+ case 0:
91
+ break;
92
+ case 2:
93
+ output += '==';
94
+ break;
95
+ case 3:
96
+ output += '=';
97
+ break;
98
+ default:
99
+ throw 'Illegal base64url string!';
100
+ }
101
+ try {
102
+ return this.baseDecodeUnicode(output);
103
+ }
104
+ catch (_a) {
105
+ return atob(output);
106
+ }
107
+ };
108
+ return JwtHelper;
111
109
  }());
112
110
 
113
- var AuthMapper = /** @class */ (function () {
114
- function AuthMapper() {
115
- // Routes.
116
- this.me = 'auth/me';
117
- this.register = 'auth/register';
118
- this.resendCode = 'auth/resend';
119
- this.logout = 'auth/logout';
120
- this.refresh = 'auth/refresh';
121
- this.requestPassword = 'auth/reset';
122
- this.resetPassword = 'auth/reset-password';
123
- }
124
- AuthMapper.prototype.role = function (data) {
125
- return (data && data.role) || null;
126
- };
127
- AuthMapper.prototype.toRegister = function (data) {
128
- // Retrieve the params.
129
- var token = data.token, refresh_token = data.refresh_token, user = data.user;
130
- // Map the data to the correct format.
131
- return { accessToken: token, refreshToken: refresh_token, user: user };
132
- };
133
- AuthMapper.prototype.toRefresh = function (data) {
134
- // Retrieve the params.
135
- var token = data.token, refresh_token = data.refresh_token;
136
- // Map the data to the correct format.
137
- return { accessToken: token, refreshToken: refresh_token };
138
- };
139
- return AuthMapper;
140
- }());
141
- AuthMapper.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: AuthMapper, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
142
- AuthMapper.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: AuthMapper });
143
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: AuthMapper, decorators: [{
144
- type: i0.Injectable
111
+ var AuthMapper = /** @class */ (function () {
112
+ function AuthMapper() {
113
+ // Routes.
114
+ this.me = 'auth/me';
115
+ this.register = 'auth/register';
116
+ this.resendCode = 'auth/resend';
117
+ this.logout = 'auth/logout';
118
+ this.refresh = 'auth/refresh';
119
+ this.requestPassword = 'auth/reset';
120
+ this.resetPassword = 'auth/reset-password';
121
+ }
122
+ AuthMapper.prototype.role = function (data) {
123
+ return (data && data.role) || null;
124
+ };
125
+ AuthMapper.prototype.toRegister = function (data) {
126
+ // Retrieve the params.
127
+ var token = data.token, refresh_token = data.refresh_token, user = data.user;
128
+ // Map the data to the correct format.
129
+ return { accessToken: token, refreshToken: refresh_token, user: user };
130
+ };
131
+ AuthMapper.prototype.toRefresh = function (data) {
132
+ // Retrieve the params.
133
+ var token = data.token, refresh_token = data.refresh_token;
134
+ // Map the data to the correct format.
135
+ return { accessToken: token, refreshToken: refresh_token };
136
+ };
137
+ return AuthMapper;
138
+ }());
139
+ AuthMapper.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: AuthMapper, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
140
+ AuthMapper.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: AuthMapper });
141
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: AuthMapper, decorators: [{
142
+ type: i0.Injectable
145
143
  }] });
146
144
 
147
- /*! *****************************************************************************
148
- Copyright (c) Microsoft Corporation.
149
-
150
- Permission to use, copy, modify, and/or distribute this software for any
151
- purpose with or without fee is hereby granted.
152
-
153
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
154
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
155
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
156
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
157
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
158
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
159
- PERFORMANCE OF THIS SOFTWARE.
160
- ***************************************************************************** */
161
- /* global Reflect, Promise */
162
- var extendStatics = function (d, b) {
163
- extendStatics = Object.setPrototypeOf ||
164
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
165
- function (d, b) { for (var p in b)
166
- if (Object.prototype.hasOwnProperty.call(b, p))
167
- d[p] = b[p]; };
168
- return extendStatics(d, b);
169
- };
170
- function __extends(d, b) {
171
- if (typeof b !== "function" && b !== null)
172
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
173
- extendStatics(d, b);
174
- function __() { this.constructor = d; }
175
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
176
- }
177
- var __assign = function () {
178
- __assign = Object.assign || function __assign(t) {
179
- for (var s, i = 1, n = arguments.length; i < n; i++) {
180
- s = arguments[i];
181
- for (var p in s)
182
- if (Object.prototype.hasOwnProperty.call(s, p))
183
- t[p] = s[p];
184
- }
185
- return t;
186
- };
187
- return __assign.apply(this, arguments);
188
- };
189
- function __rest(s, e) {
190
- var t = {};
191
- for (var p in s)
192
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
193
- t[p] = s[p];
194
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
195
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
196
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
197
- t[p[i]] = s[p[i]];
198
- }
199
- return t;
200
- }
201
- function __decorate(decorators, target, key, desc) {
202
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
203
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
204
- r = Reflect.decorate(decorators, target, key, desc);
205
- else
206
- for (var i = decorators.length - 1; i >= 0; i--)
207
- if (d = decorators[i])
208
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
209
- return c > 3 && r && Object.defineProperty(target, key, r), r;
210
- }
211
- function __param(paramIndex, decorator) {
212
- return function (target, key) { decorator(target, key, paramIndex); };
213
- }
214
- function __metadata(metadataKey, metadataValue) {
215
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
216
- return Reflect.metadata(metadataKey, metadataValue);
217
- }
218
- function __awaiter(thisArg, _arguments, P, generator) {
219
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
220
- return new (P || (P = Promise))(function (resolve, reject) {
221
- function fulfilled(value) { try {
222
- step(generator.next(value));
223
- }
224
- catch (e) {
225
- reject(e);
226
- } }
227
- function rejected(value) { try {
228
- step(generator["throw"](value));
229
- }
230
- catch (e) {
231
- reject(e);
232
- } }
233
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
234
- step((generator = generator.apply(thisArg, _arguments || [])).next());
235
- });
236
- }
237
- function __generator(thisArg, body) {
238
- var _ = { label: 0, sent: function () { if (t[0] & 1)
239
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
240
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
241
- function verb(n) { return function (v) { return step([n, v]); }; }
242
- function step(op) {
243
- if (f)
244
- throw new TypeError("Generator is already executing.");
245
- while (_)
246
- try {
247
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
248
- return t;
249
- if (y = 0, t)
250
- op = [op[0] & 2, t.value];
251
- switch (op[0]) {
252
- case 0:
253
- case 1:
254
- t = op;
255
- break;
256
- case 4:
257
- _.label++;
258
- return { value: op[1], done: false };
259
- case 5:
260
- _.label++;
261
- y = op[1];
262
- op = [0];
263
- continue;
264
- case 7:
265
- op = _.ops.pop();
266
- _.trys.pop();
267
- continue;
268
- default:
269
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
270
- _ = 0;
271
- continue;
272
- }
273
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
274
- _.label = op[1];
275
- break;
276
- }
277
- if (op[0] === 6 && _.label < t[1]) {
278
- _.label = t[1];
279
- t = op;
280
- break;
281
- }
282
- if (t && _.label < t[2]) {
283
- _.label = t[2];
284
- _.ops.push(op);
285
- break;
286
- }
287
- if (t[2])
288
- _.ops.pop();
289
- _.trys.pop();
290
- continue;
291
- }
292
- op = body.call(thisArg, _);
293
- }
294
- catch (e) {
295
- op = [6, e];
296
- y = 0;
297
- }
298
- finally {
299
- f = t = 0;
300
- }
301
- if (op[0] & 5)
302
- throw op[1];
303
- return { value: op[0] ? op[1] : void 0, done: true };
304
- }
305
- }
306
- var __createBinding = Object.create ? (function (o, m, k, k2) {
307
- if (k2 === undefined)
308
- k2 = k;
309
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
310
- }) : (function (o, m, k, k2) {
311
- if (k2 === undefined)
312
- k2 = k;
313
- o[k2] = m[k];
314
- });
315
- function __exportStar(m, o) {
316
- for (var p in m)
317
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
318
- __createBinding(o, m, p);
319
- }
320
- function __values(o) {
321
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
322
- if (m)
323
- return m.call(o);
324
- if (o && typeof o.length === "number")
325
- return {
326
- next: function () {
327
- if (o && i >= o.length)
328
- o = void 0;
329
- return { value: o && o[i++], done: !o };
330
- }
331
- };
332
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
333
- }
334
- function __read(o, n) {
335
- var m = typeof Symbol === "function" && o[Symbol.iterator];
336
- if (!m)
337
- return o;
338
- var i = m.call(o), r, ar = [], e;
339
- try {
340
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
341
- ar.push(r.value);
342
- }
343
- catch (error) {
344
- e = { error: error };
345
- }
346
- finally {
347
- try {
348
- if (r && !r.done && (m = i["return"]))
349
- m.call(i);
350
- }
351
- finally {
352
- if (e)
353
- throw e.error;
354
- }
355
- }
356
- return ar;
357
- }
358
- /** @deprecated */
359
- function __spread() {
360
- for (var ar = [], i = 0; i < arguments.length; i++)
361
- ar = ar.concat(__read(arguments[i]));
362
- return ar;
363
- }
364
- /** @deprecated */
365
- function __spreadArrays() {
366
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
367
- s += arguments[i].length;
368
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
369
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
370
- r[k] = a[j];
371
- return r;
372
- }
373
- function __spreadArray(to, from, pack) {
374
- if (pack || arguments.length === 2)
375
- for (var i = 0, l = from.length, ar; i < l; i++) {
376
- if (ar || !(i in from)) {
377
- if (!ar)
378
- ar = Array.prototype.slice.call(from, 0, i);
379
- ar[i] = from[i];
380
- }
381
- }
382
- return to.concat(ar || from);
383
- }
384
- function __await(v) {
385
- return this instanceof __await ? (this.v = v, this) : new __await(v);
386
- }
387
- function __asyncGenerator(thisArg, _arguments, generator) {
388
- if (!Symbol.asyncIterator)
389
- throw new TypeError("Symbol.asyncIterator is not defined.");
390
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
391
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
392
- function verb(n) { if (g[n])
393
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
394
- function resume(n, v) { try {
395
- step(g[n](v));
396
- }
397
- catch (e) {
398
- settle(q[0][3], e);
399
- } }
400
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
401
- function fulfill(value) { resume("next", value); }
402
- function reject(value) { resume("throw", value); }
403
- function settle(f, v) { if (f(v), q.shift(), q.length)
404
- resume(q[0][0], q[0][1]); }
405
- }
406
- function __asyncDelegator(o) {
407
- var i, p;
408
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
409
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
410
- }
411
- function __asyncValues(o) {
412
- if (!Symbol.asyncIterator)
413
- throw new TypeError("Symbol.asyncIterator is not defined.");
414
- var m = o[Symbol.asyncIterator], i;
415
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
416
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
417
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
418
- }
419
- function __makeTemplateObject(cooked, raw) {
420
- if (Object.defineProperty) {
421
- Object.defineProperty(cooked, "raw", { value: raw });
422
- }
423
- else {
424
- cooked.raw = raw;
425
- }
426
- return cooked;
427
- }
428
- ;
429
- var __setModuleDefault = Object.create ? (function (o, v) {
430
- Object.defineProperty(o, "default", { enumerable: true, value: v });
431
- }) : function (o, v) {
432
- o["default"] = v;
433
- };
434
- function __importStar(mod) {
435
- if (mod && mod.__esModule)
436
- return mod;
437
- var result = {};
438
- if (mod != null)
439
- for (var k in mod)
440
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
441
- __createBinding(result, mod, k);
442
- __setModuleDefault(result, mod);
443
- return result;
444
- }
445
- function __importDefault(mod) {
446
- return (mod && mod.__esModule) ? mod : { default: mod };
447
- }
448
- function __classPrivateFieldGet(receiver, state, kind, f) {
449
- if (kind === "a" && !f)
450
- throw new TypeError("Private accessor was defined without a getter");
451
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
452
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
453
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
454
- }
455
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
456
- if (kind === "m")
457
- throw new TypeError("Private method is not writable");
458
- if (kind === "a" && !f)
459
- throw new TypeError("Private accessor was defined without a setter");
460
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
461
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
462
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
145
+ /*! *****************************************************************************
146
+ Copyright (c) Microsoft Corporation.
147
+
148
+ Permission to use, copy, modify, and/or distribute this software for any
149
+ purpose with or without fee is hereby granted.
150
+
151
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
152
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
153
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
154
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
155
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
156
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
157
+ PERFORMANCE OF THIS SOFTWARE.
158
+ ***************************************************************************** */
159
+ /* global Reflect, Promise */
160
+ var extendStatics = function (d, b) {
161
+ extendStatics = Object.setPrototypeOf ||
162
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
163
+ function (d, b) { for (var p in b)
164
+ if (Object.prototype.hasOwnProperty.call(b, p))
165
+ d[p] = b[p]; };
166
+ return extendStatics(d, b);
167
+ };
168
+ function __extends(d, b) {
169
+ if (typeof b !== "function" && b !== null)
170
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
171
+ extendStatics(d, b);
172
+ function __() { this.constructor = d; }
173
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
174
+ }
175
+ var __assign = function () {
176
+ __assign = Object.assign || function __assign(t) {
177
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
178
+ s = arguments[i];
179
+ for (var p in s)
180
+ if (Object.prototype.hasOwnProperty.call(s, p))
181
+ t[p] = s[p];
182
+ }
183
+ return t;
184
+ };
185
+ return __assign.apply(this, arguments);
186
+ };
187
+ function __rest(s, e) {
188
+ var t = {};
189
+ for (var p in s)
190
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
191
+ t[p] = s[p];
192
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
193
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
194
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
195
+ t[p[i]] = s[p[i]];
196
+ }
197
+ return t;
198
+ }
199
+ function __decorate(decorators, target, key, desc) {
200
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
201
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
202
+ r = Reflect.decorate(decorators, target, key, desc);
203
+ else
204
+ for (var i = decorators.length - 1; i >= 0; i--)
205
+ if (d = decorators[i])
206
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
207
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
208
+ }
209
+ function __param(paramIndex, decorator) {
210
+ return function (target, key) { decorator(target, key, paramIndex); };
211
+ }
212
+ function __metadata(metadataKey, metadataValue) {
213
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
214
+ return Reflect.metadata(metadataKey, metadataValue);
215
+ }
216
+ function __awaiter(thisArg, _arguments, P, generator) {
217
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
218
+ return new (P || (P = Promise))(function (resolve, reject) {
219
+ function fulfilled(value) { try {
220
+ step(generator.next(value));
221
+ }
222
+ catch (e) {
223
+ reject(e);
224
+ } }
225
+ function rejected(value) { try {
226
+ step(generator["throw"](value));
227
+ }
228
+ catch (e) {
229
+ reject(e);
230
+ } }
231
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
232
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
233
+ });
234
+ }
235
+ function __generator(thisArg, body) {
236
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
237
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
238
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
239
+ function verb(n) { return function (v) { return step([n, v]); }; }
240
+ function step(op) {
241
+ if (f)
242
+ throw new TypeError("Generator is already executing.");
243
+ while (_)
244
+ try {
245
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
246
+ return t;
247
+ if (y = 0, t)
248
+ op = [op[0] & 2, t.value];
249
+ switch (op[0]) {
250
+ case 0:
251
+ case 1:
252
+ t = op;
253
+ break;
254
+ case 4:
255
+ _.label++;
256
+ return { value: op[1], done: false };
257
+ case 5:
258
+ _.label++;
259
+ y = op[1];
260
+ op = [0];
261
+ continue;
262
+ case 7:
263
+ op = _.ops.pop();
264
+ _.trys.pop();
265
+ continue;
266
+ default:
267
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
268
+ _ = 0;
269
+ continue;
270
+ }
271
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
272
+ _.label = op[1];
273
+ break;
274
+ }
275
+ if (op[0] === 6 && _.label < t[1]) {
276
+ _.label = t[1];
277
+ t = op;
278
+ break;
279
+ }
280
+ if (t && _.label < t[2]) {
281
+ _.label = t[2];
282
+ _.ops.push(op);
283
+ break;
284
+ }
285
+ if (t[2])
286
+ _.ops.pop();
287
+ _.trys.pop();
288
+ continue;
289
+ }
290
+ op = body.call(thisArg, _);
291
+ }
292
+ catch (e) {
293
+ op = [6, e];
294
+ y = 0;
295
+ }
296
+ finally {
297
+ f = t = 0;
298
+ }
299
+ if (op[0] & 5)
300
+ throw op[1];
301
+ return { value: op[0] ? op[1] : void 0, done: true };
302
+ }
303
+ }
304
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
305
+ if (k2 === undefined)
306
+ k2 = k;
307
+ Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
308
+ }) : (function (o, m, k, k2) {
309
+ if (k2 === undefined)
310
+ k2 = k;
311
+ o[k2] = m[k];
312
+ });
313
+ function __exportStar(m, o) {
314
+ for (var p in m)
315
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
316
+ __createBinding(o, m, p);
317
+ }
318
+ function __values(o) {
319
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
320
+ if (m)
321
+ return m.call(o);
322
+ if (o && typeof o.length === "number")
323
+ return {
324
+ next: function () {
325
+ if (o && i >= o.length)
326
+ o = void 0;
327
+ return { value: o && o[i++], done: !o };
328
+ }
329
+ };
330
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
331
+ }
332
+ function __read(o, n) {
333
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
334
+ if (!m)
335
+ return o;
336
+ var i = m.call(o), r, ar = [], e;
337
+ try {
338
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
339
+ ar.push(r.value);
340
+ }
341
+ catch (error) {
342
+ e = { error: error };
343
+ }
344
+ finally {
345
+ try {
346
+ if (r && !r.done && (m = i["return"]))
347
+ m.call(i);
348
+ }
349
+ finally {
350
+ if (e)
351
+ throw e.error;
352
+ }
353
+ }
354
+ return ar;
355
+ }
356
+ /** @deprecated */
357
+ function __spread() {
358
+ for (var ar = [], i = 0; i < arguments.length; i++)
359
+ ar = ar.concat(__read(arguments[i]));
360
+ return ar;
361
+ }
362
+ /** @deprecated */
363
+ function __spreadArrays() {
364
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
365
+ s += arguments[i].length;
366
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
367
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
368
+ r[k] = a[j];
369
+ return r;
370
+ }
371
+ function __spreadArray(to, from, pack) {
372
+ if (pack || arguments.length === 2)
373
+ for (var i = 0, l = from.length, ar; i < l; i++) {
374
+ if (ar || !(i in from)) {
375
+ if (!ar)
376
+ ar = Array.prototype.slice.call(from, 0, i);
377
+ ar[i] = from[i];
378
+ }
379
+ }
380
+ return to.concat(ar || Array.prototype.slice.call(from));
381
+ }
382
+ function __await(v) {
383
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
384
+ }
385
+ function __asyncGenerator(thisArg, _arguments, generator) {
386
+ if (!Symbol.asyncIterator)
387
+ throw new TypeError("Symbol.asyncIterator is not defined.");
388
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
389
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
390
+ function verb(n) { if (g[n])
391
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
392
+ function resume(n, v) { try {
393
+ step(g[n](v));
394
+ }
395
+ catch (e) {
396
+ settle(q[0][3], e);
397
+ } }
398
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
399
+ function fulfill(value) { resume("next", value); }
400
+ function reject(value) { resume("throw", value); }
401
+ function settle(f, v) { if (f(v), q.shift(), q.length)
402
+ resume(q[0][0], q[0][1]); }
403
+ }
404
+ function __asyncDelegator(o) {
405
+ var i, p;
406
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
407
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
408
+ }
409
+ function __asyncValues(o) {
410
+ if (!Symbol.asyncIterator)
411
+ throw new TypeError("Symbol.asyncIterator is not defined.");
412
+ var m = o[Symbol.asyncIterator], i;
413
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
414
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
415
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
416
+ }
417
+ function __makeTemplateObject(cooked, raw) {
418
+ if (Object.defineProperty) {
419
+ Object.defineProperty(cooked, "raw", { value: raw });
420
+ }
421
+ else {
422
+ cooked.raw = raw;
423
+ }
424
+ return cooked;
425
+ }
426
+ ;
427
+ var __setModuleDefault = Object.create ? (function (o, v) {
428
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
429
+ }) : function (o, v) {
430
+ o["default"] = v;
431
+ };
432
+ function __importStar(mod) {
433
+ if (mod && mod.__esModule)
434
+ return mod;
435
+ var result = {};
436
+ if (mod != null)
437
+ for (var k in mod)
438
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
439
+ __createBinding(result, mod, k);
440
+ __setModuleDefault(result, mod);
441
+ return result;
442
+ }
443
+ function __importDefault(mod) {
444
+ return (mod && mod.__esModule) ? mod : { default: mod };
445
+ }
446
+ function __classPrivateFieldGet(receiver, state, kind, f) {
447
+ if (kind === "a" && !f)
448
+ throw new TypeError("Private accessor was defined without a getter");
449
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
450
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
451
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
452
+ }
453
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
454
+ if (kind === "m")
455
+ throw new TypeError("Private method is not writable");
456
+ if (kind === "a" && !f)
457
+ throw new TypeError("Private accessor was defined without a setter");
458
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
459
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
460
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
463
461
  }
464
462
 
465
- var AuthVerifyProvider = /** @class */ (function () {
466
- function AuthVerifyProvider(_code, _verifyToken, _endpoint) {
467
- this._code = _code;
468
- this._verifyToken = _verifyToken;
469
- this._endpoint = _endpoint;
470
- }
471
- AuthVerifyProvider.prototype.authenticate = function (httpClient) {
472
- return __awaiter(this, void 0, void 0, function () {
473
- var _a, token, refresh_token, user;
474
- return __generator(this, function (_b) {
475
- switch (_b.label) {
476
- case 0: return [4 /*yield*/, httpClient.post(this._endpoint, {
477
- token: this._code,
478
- verify_token: this._verifyToken
479
- }).toPromise()];
480
- case 1:
481
- _a = _b.sent(), token = _a.token, refresh_token = _a.refresh_token, user = _a.user;
482
- // Map the data to the correct format.
483
- return [2 /*return*/, { accessToken: token, refreshToken: refresh_token, user: user }];
484
- }
485
- });
486
- });
487
- };
488
- return AuthVerifyProvider;
463
+ var AuthVerifyProvider = /** @class */ (function () {
464
+ function AuthVerifyProvider(_code, _verifyToken, _endpoint) {
465
+ this._code = _code;
466
+ this._verifyToken = _verifyToken;
467
+ this._endpoint = _endpoint;
468
+ }
469
+ AuthVerifyProvider.prototype.authenticate = function (httpClient) {
470
+ return __awaiter(this, void 0, void 0, function () {
471
+ var _a, token, refresh_token, user;
472
+ return __generator(this, function (_b) {
473
+ switch (_b.label) {
474
+ case 0: return [4 /*yield*/, httpClient.post(this._endpoint, {
475
+ token: this._code,
476
+ verify_token: this._verifyToken
477
+ }).toPromise()];
478
+ case 1:
479
+ _a = _b.sent(), token = _a.token, refresh_token = _a.refresh_token, user = _a.user;
480
+ // Map the data to the correct format.
481
+ return [2 /*return*/, { accessToken: token, refreshToken: refresh_token, user: user }];
482
+ }
483
+ });
484
+ });
485
+ };
486
+ return AuthVerifyProvider;
489
487
  }());
490
488
 
491
- var AuthEmailProvider = /** @class */ (function () {
492
- function AuthEmailProvider(_email, _password, _endpoint) {
493
- this._email = _email;
494
- this._password = _password;
495
- this._endpoint = _endpoint;
496
- }
497
- AuthEmailProvider.prototype.authenticate = function (httpClient) {
498
- return __awaiter(this, void 0, void 0, function () {
499
- var _a, token, refresh_token, user, provider, verify_token;
500
- return __generator(this, function (_b) {
501
- switch (_b.label) {
502
- case 0: return [4 /*yield*/, httpClient.post(this._endpoint, {
503
- email: this._email,
504
- password: this._password
505
- }).toPromise()];
506
- case 1:
507
- _a = _b.sent(), token = _a.token, refresh_token = _a.refresh_token, user = _a.user, provider = _a.provider, verify_token = _a.verify_token;
508
- // Map the data to the correct format.
509
- return [2 /*return*/, {
510
- accessToken: token,
511
- refreshToken: refresh_token,
512
- user: user,
513
- provider: provider,
514
- verifyToken: verify_token
515
- }];
516
- }
517
- });
518
- });
519
- };
520
- return AuthEmailProvider;
489
+ var AuthEmailProvider = /** @class */ (function () {
490
+ function AuthEmailProvider(_email, _password, _endpoint) {
491
+ this._email = _email;
492
+ this._password = _password;
493
+ this._endpoint = _endpoint;
494
+ }
495
+ AuthEmailProvider.prototype.authenticate = function (httpClient) {
496
+ return __awaiter(this, void 0, void 0, function () {
497
+ var _a, token, refresh_token, user, provider, verify_token;
498
+ return __generator(this, function (_b) {
499
+ switch (_b.label) {
500
+ case 0: return [4 /*yield*/, httpClient.post(this._endpoint, {
501
+ email: this._email,
502
+ password: this._password
503
+ }).toPromise()];
504
+ case 1:
505
+ _a = _b.sent(), token = _a.token, refresh_token = _a.refresh_token, user = _a.user, provider = _a.provider, verify_token = _a.verify_token;
506
+ // Map the data to the correct format.
507
+ return [2 /*return*/, {
508
+ accessToken: token,
509
+ refreshToken: refresh_token,
510
+ user: user,
511
+ provider: provider,
512
+ verifyToken: verify_token
513
+ }];
514
+ }
515
+ });
516
+ });
517
+ };
518
+ return AuthEmailProvider;
521
519
  }());
522
520
 
523
- var AuthSession = /** @class */ (function () {
524
- function AuthSession(options) {
525
- var _a, _b;
526
- // Readonly data.
527
- this._jwt = new JwtHelper();
528
- // Token strings.
529
- this._accessTokenString = null;
530
- this._refreshTokenString = null;
531
- // Token payloads.
532
- this._accessTokenPayload = null;
533
- this._refreshTokenPayload = null;
534
- // Private user data.
535
- this._user$ = new rxjs.BehaviorSubject(null);
536
- // Public user data.
537
- this.user = this._user$.pipe(operators.shareReplay(1));
538
- this.generateKey = function (applicationId, key) {
539
- return [applicationId, key].join('_');
540
- };
541
- this.isTokenValid = function (token) {
542
- var _a;
543
- if (!token) {
544
- return false;
545
- }
546
- return ((_a = token === null || token === void 0 ? void 0 : token.expiresAt) === null || _a === void 0 ? void 0 : _a.getTime()) > Date.now();
547
- };
548
- var applicationId = (_a = options === null || options === void 0 ? void 0 : options.id) !== null && _a !== void 0 ? _a : 'ng';
549
- // Setting up the readonly storage keys.
550
- this._accessTokenStorageKey = this.generateKey(applicationId, 'au_act');
551
- this._refreshTokenStorageKey = this.generateKey(applicationId, 'au_rft');
552
- this._userStorageKey = this.generateKey(applicationId, 'au_usr');
553
- // Setting up the storage.
554
- this._storage = (_b = options === null || options === void 0 ? void 0 : options.storage) !== null && _b !== void 0 ? _b : null;
555
- // Init methods.
556
- this.restoreFromStorage();
557
- }
558
- Object.defineProperty(AuthSession.prototype, "accessToken", {
559
- get: function () {
560
- return this.isTokenValid(this._accessTokenPayload)
561
- ? this._accessTokenString
562
- : null;
563
- },
564
- enumerable: false,
565
- configurable: true
566
- });
567
- Object.defineProperty(AuthSession.prototype, "refreshToken", {
568
- get: function () {
569
- return this.isTokenValid(this.refreshTokenPayload)
570
- ? this._refreshTokenString
571
- : null;
572
- },
573
- enumerable: false,
574
- configurable: true
575
- });
576
- Object.defineProperty(AuthSession.prototype, "accessTokenPayload", {
577
- get: function () {
578
- var _a;
579
- return (_a = this._accessTokenPayload) !== null && _a !== void 0 ? _a : null;
580
- },
581
- enumerable: false,
582
- configurable: true
583
- });
584
- Object.defineProperty(AuthSession.prototype, "refreshTokenPayload", {
585
- get: function () {
586
- var _a;
587
- return (_a = this._refreshTokenPayload) !== null && _a !== void 0 ? _a : null;
588
- },
589
- enumerable: false,
590
- configurable: true
591
- });
592
- AuthSession.prototype.authenticated = function () {
593
- return this.isTokenValid(this._accessTokenPayload) || this.isTokenValid(this._refreshTokenPayload);
594
- };
595
- AuthSession.prototype.setTokens = function (accessToken, refreshToken) {
596
- this.setAccessToken(accessToken);
597
- this.setRefreshToken(refreshToken);
598
- this.syncTokensInStorage();
599
- };
600
- AuthSession.prototype.setUser = function (user) {
601
- this._user$.next(user !== null && user !== void 0 ? user : null);
602
- this.syncUserInStorage();
603
- };
604
- AuthSession.prototype.clear = function () {
605
- this.setTokens(null, null);
606
- this.setUser(null);
607
- };
608
- AuthSession.prototype.restoreFromStorage = function () {
609
- if (!this._storage) {
610
- return;
611
- }
612
- // Set the access token.
613
- var accessToken = this._storage.get(this._accessTokenStorageKey);
614
- this.setAccessToken(accessToken);
615
- // Set the refresh token.
616
- var refreshToken = this._storage.get(this._refreshTokenStorageKey);
617
- this.setRefreshToken(refreshToken);
618
- // Set the user if we have any correct token payloads.
619
- if (this._accessTokenPayload || this._refreshTokenPayload) {
620
- var user = this._storage.get(this._userStorageKey);
621
- this._user$.next(user !== null && user !== void 0 ? user : null); // Note: just settings here instead of setUser() because of syncing to the storage.
622
- }
623
- };
624
- AuthSession.prototype.syncTokensInStorage = function () {
625
- var _a, _b;
626
- if (!this._storage) {
627
- return;
628
- }
629
- // Set the access token if completely valid.
630
- if (!!this.accessToken) {
631
- this._storage.set(this._accessTokenStorageKey, this._accessTokenString, {
632
- expires: (_a = this._accessTokenPayload) === null || _a === void 0 ? void 0 : _a.expiresAt
633
- });
634
- }
635
- else {
636
- this._storage.remove(this._accessTokenStorageKey);
637
- }
638
- // Set the refresh token if completely valid.
639
- if (!!this.refreshToken) {
640
- this._storage.set(this._refreshTokenStorageKey, this._refreshTokenString, {
641
- expires: (_b = this._refreshTokenPayload) === null || _b === void 0 ? void 0 : _b.expiresAt
642
- });
643
- }
644
- else {
645
- this._storage.remove(this._refreshTokenStorageKey);
646
- }
647
- };
648
- AuthSession.prototype.syncUserInStorage = function () {
649
- if (!this._storage) {
650
- return;
651
- }
652
- var user = this._user$.getValue();
653
- if (!user) {
654
- return this._storage.remove(this._userStorageKey);
655
- }
656
- var date = new Date();
657
- date.setFullYear(date.getFullYear() + 1);
658
- this._storage.set(this._userStorageKey, user, {
659
- expires: new Date(date.getTime())
660
- });
661
- };
662
- AuthSession.prototype.setAccessToken = function (value) {
663
- this._accessTokenString = value !== null && value !== void 0 ? value : null;
664
- this._accessTokenPayload = this._jwt.decode(this._accessTokenString);
665
- };
666
- AuthSession.prototype.setRefreshToken = function (value) {
667
- this._refreshTokenString = value !== null && value !== void 0 ? value : null;
668
- this._refreshTokenPayload = this._jwt.decode(this._refreshTokenString);
669
- };
670
- return AuthSession;
521
+ var AuthSession = /** @class */ (function () {
522
+ function AuthSession(options) {
523
+ var _a, _b;
524
+ // Readonly data.
525
+ this._jwt = new JwtHelper();
526
+ // Token strings.
527
+ this._accessTokenString = null;
528
+ this._refreshTokenString = null;
529
+ // Token payloads.
530
+ this._accessTokenPayload = null;
531
+ this._refreshTokenPayload = null;
532
+ // Private user data.
533
+ this._user$ = new rxjs.BehaviorSubject(null);
534
+ // Public user data.
535
+ this.user = this._user$.pipe(operators.shareReplay(1));
536
+ this.generateKey = function (applicationId, key) {
537
+ return [applicationId, key].join('_');
538
+ };
539
+ this.isTokenValid = function (token) {
540
+ var _a;
541
+ if (!token) {
542
+ return false;
543
+ }
544
+ return ((_a = token === null || token === void 0 ? void 0 : token.expiresAt) === null || _a === void 0 ? void 0 : _a.getTime()) > Date.now();
545
+ };
546
+ var applicationId = (_a = options === null || options === void 0 ? void 0 : options.id) !== null && _a !== void 0 ? _a : 'ng';
547
+ // Setting up the readonly storage keys.
548
+ this._accessTokenStorageKey = this.generateKey(applicationId, 'au_act');
549
+ this._refreshTokenStorageKey = this.generateKey(applicationId, 'au_rft');
550
+ this._userStorageKey = this.generateKey(applicationId, 'au_usr');
551
+ // Setting up the storage.
552
+ this._storage = (_b = options === null || options === void 0 ? void 0 : options.storage) !== null && _b !== void 0 ? _b : null;
553
+ // Init methods.
554
+ this.restoreFromStorage();
555
+ }
556
+ Object.defineProperty(AuthSession.prototype, "accessToken", {
557
+ get: function () {
558
+ return this.isTokenValid(this._accessTokenPayload)
559
+ ? this._accessTokenString
560
+ : null;
561
+ },
562
+ enumerable: false,
563
+ configurable: true
564
+ });
565
+ Object.defineProperty(AuthSession.prototype, "refreshToken", {
566
+ get: function () {
567
+ return this.isTokenValid(this.refreshTokenPayload)
568
+ ? this._refreshTokenString
569
+ : null;
570
+ },
571
+ enumerable: false,
572
+ configurable: true
573
+ });
574
+ Object.defineProperty(AuthSession.prototype, "accessTokenPayload", {
575
+ get: function () {
576
+ var _a;
577
+ return (_a = this._accessTokenPayload) !== null && _a !== void 0 ? _a : null;
578
+ },
579
+ enumerable: false,
580
+ configurable: true
581
+ });
582
+ Object.defineProperty(AuthSession.prototype, "refreshTokenPayload", {
583
+ get: function () {
584
+ var _a;
585
+ return (_a = this._refreshTokenPayload) !== null && _a !== void 0 ? _a : null;
586
+ },
587
+ enumerable: false,
588
+ configurable: true
589
+ });
590
+ AuthSession.prototype.authenticated = function () {
591
+ return this.isTokenValid(this._accessTokenPayload) || this.isTokenValid(this._refreshTokenPayload);
592
+ };
593
+ AuthSession.prototype.setTokens = function (accessToken, refreshToken) {
594
+ this.setAccessToken(accessToken);
595
+ this.setRefreshToken(refreshToken);
596
+ this.syncTokensInStorage();
597
+ };
598
+ AuthSession.prototype.setUser = function (user) {
599
+ this._user$.next(user !== null && user !== void 0 ? user : null);
600
+ this.syncUserInStorage();
601
+ };
602
+ AuthSession.prototype.clear = function () {
603
+ this.setTokens(null, null);
604
+ this.setUser(null);
605
+ };
606
+ AuthSession.prototype.restoreFromStorage = function () {
607
+ if (!this._storage) {
608
+ return;
609
+ }
610
+ // Set the access token.
611
+ var accessToken = this._storage.get(this._accessTokenStorageKey);
612
+ this.setAccessToken(accessToken);
613
+ // Set the refresh token.
614
+ var refreshToken = this._storage.get(this._refreshTokenStorageKey);
615
+ this.setRefreshToken(refreshToken);
616
+ // Set the user if we have any correct token payloads.
617
+ if (this._accessTokenPayload || this._refreshTokenPayload) {
618
+ var user = this._storage.get(this._userStorageKey);
619
+ this._user$.next(user !== null && user !== void 0 ? user : null); // Note: just settings here instead of setUser() because of syncing to the storage.
620
+ }
621
+ };
622
+ AuthSession.prototype.syncTokensInStorage = function () {
623
+ var _a, _b;
624
+ if (!this._storage) {
625
+ return;
626
+ }
627
+ // Set the access token if completely valid.
628
+ if (!!this.accessToken) {
629
+ this._storage.set(this._accessTokenStorageKey, this._accessTokenString, {
630
+ expires: (_a = this._accessTokenPayload) === null || _a === void 0 ? void 0 : _a.expiresAt
631
+ });
632
+ }
633
+ else {
634
+ this._storage.remove(this._accessTokenStorageKey);
635
+ }
636
+ // Set the refresh token if completely valid.
637
+ if (!!this.refreshToken) {
638
+ this._storage.set(this._refreshTokenStorageKey, this._refreshTokenString, {
639
+ expires: (_b = this._refreshTokenPayload) === null || _b === void 0 ? void 0 : _b.expiresAt
640
+ });
641
+ }
642
+ else {
643
+ this._storage.remove(this._refreshTokenStorageKey);
644
+ }
645
+ };
646
+ AuthSession.prototype.syncUserInStorage = function () {
647
+ if (!this._storage) {
648
+ return;
649
+ }
650
+ var user = this._user$.getValue();
651
+ if (!user) {
652
+ return this._storage.remove(this._userStorageKey);
653
+ }
654
+ var date = new Date();
655
+ date.setFullYear(date.getFullYear() + 1);
656
+ this._storage.set(this._userStorageKey, user, {
657
+ expires: new Date(date.getTime())
658
+ });
659
+ };
660
+ AuthSession.prototype.setAccessToken = function (value) {
661
+ this._accessTokenString = value !== null && value !== void 0 ? value : null;
662
+ this._accessTokenPayload = this._jwt.decode(this._accessTokenString);
663
+ };
664
+ AuthSession.prototype.setRefreshToken = function (value) {
665
+ this._refreshTokenString = value !== null && value !== void 0 ? value : null;
666
+ this._refreshTokenPayload = this._jwt.decode(this._refreshTokenString);
667
+ };
668
+ return AuthSession;
671
669
  }());
672
670
 
673
- var Auth = /** @class */ (function () {
674
- function Auth(_storage, _mapper, _injector, _platform, _httpClient, _config, _state, _httpConfig) {
675
- var _a, _b, _c;
676
- this._storage = _storage;
677
- this._mapper = _mapper;
678
- this._injector = _injector;
679
- this._platform = _platform;
680
- this._httpClient = _httpClient;
681
- this._config = _config;
682
- this._state = _state;
683
- this._httpConfig = _httpConfig;
684
- // Readonly data.
685
- this._authStateKey = i6.makeStateKey("bbAuthStateKey");
686
- this._httpAlias = (_b = (_a = this._httpConfig) === null || _a === void 0 ? void 0 : _a.defaultAlias) !== null && _b !== void 0 ? _b : null;
687
- this._refreshHandler = null;
688
- // Starting the new session.
689
- this.session = new AuthSession({
690
- id: (_c = this._config) === null || _c === void 0 ? void 0 : _c.applicationId,
691
- storage: this._storage.select(["cookie" /* Cookie */, "local" /* Local */])
692
- });
693
- this.user = this.session.user;
694
- }
695
- Auth.prototype.initialize = function () {
696
- var _this = this;
697
- return function () { return __awaiter(_this, void 0, void 0, function () {
698
- var _a, _b, _c, _d, _e, _f, shouldBootstrap, user_1, user;
699
- return __generator(this, function (_g) {
700
- switch (_g.label) {
701
- case 0:
702
- shouldBootstrap = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.bootstrap) !== null && _b !== void 0 ? _b : true;
703
- if (!shouldBootstrap) {
704
- return [2 /*return*/, this.handleAutoRefreshing()];
705
- }
706
- // Only retrieve from the server when we are actually authenticated.
707
- if (!this.session.authenticated()) {
708
- return [2 /*return*/];
709
- }
710
- // Get the key from the server state.
711
- if (this._state && ((_c = this._state) === null || _c === void 0 ? void 0 : _c.hasKey(this._authStateKey))) {
712
- user_1 = (_e = (_d = this._state) === null || _d === void 0 ? void 0 : _d.get(this._authStateKey, null)) !== null && _e !== void 0 ? _e : null;
713
- return [2 /*return*/, this.session.setUser(user_1)];
714
- }
715
- return [4 /*yield*/, this.me().pipe(operators.take(1)).toPromise()];
716
- case 1:
717
- user = _g.sent();
718
- // Set the state if exists.
719
- if (this._state) {
720
- (_f = this._state) === null || _f === void 0 ? void 0 : _f.set(this._authStateKey, user !== null && user !== void 0 ? user : null);
721
- }
722
- // Save the user in the storage and handle auto refreshing.
723
- this.session.setUser(user);
724
- this.handleAutoRefreshing();
725
- return [2 /*return*/];
726
- }
727
- });
728
- }); };
729
- };
730
- Auth.prototype.me = function () {
731
- var url = this.getUrl('auth/me');
732
- return this._httpClient.get(url);
733
- };
734
- Auth.prototype.signIn = function (provider, as) {
735
- var _a, _b;
736
- return __awaiter(this, void 0, void 0, function () {
737
- var _c, accessToken, refreshToken, user, result, apiProvider, apiVerifyToken, availableProviders;
738
- return __generator(this, function (_g) {
739
- switch (_g.label) {
740
- case 0: return [4 /*yield*/, provider.authenticate(this._httpClient)];
741
- case 1:
742
- _c = _g.sent(), accessToken = _c.accessToken, refreshToken = _c.refreshToken, user = _c.user, result = __rest(_c, ["accessToken", "refreshToken", "user"]);
743
- // Check if the role matches.
744
- if (as && !as.includes(this._mapper.role(user))) {
745
- throw new Error('Invalid role.');
746
- }
747
- apiProvider = (_a = result === null || result === void 0 ? void 0 : result.provider) !== null && _a !== void 0 ? _a : null;
748
- apiVerifyToken = (_b = result === null || result === void 0 ? void 0 : result.verifyToken) !== null && _b !== void 0 ? _b : null;
749
- availableProviders = ['email', 'sms', 'totp'];
750
- if (availableProviders.includes(apiProvider)) {
751
- return [2 /*return*/, { user: user, provider: apiProvider, verifyToken: apiVerifyToken }];
752
- }
753
- // Set the tokens in storage.
754
- this.setTokens(accessToken, refreshToken);
755
- // Set the user in storage.
756
- this.session.setUser(user);
757
- // Return the user.
758
- return [2 /*return*/, { user: user }];
759
- }
760
- });
761
- });
762
- };
763
- Auth.prototype.signInWithEmail = function (email, password, as) {
764
- return __awaiter(this, void 0, void 0, function () {
765
- var url;
766
- return __generator(this, function (_g) {
767
- url = this.getUrl('auth/login');
768
- return [2 /*return*/, this.signIn(new AuthEmailProvider(email, password, url), as)];
769
- });
770
- });
771
- };
772
- Auth.prototype.signInWithVerifyCode = function (code, verifyToken) {
773
- return __awaiter(this, void 0, void 0, function () {
774
- var url;
775
- return __generator(this, function (_g) {
776
- url = this.getUrl('auth/verify');
777
- return [2 /*return*/, this.signIn(new AuthVerifyProvider(code, verifyToken, url))];
778
- });
779
- });
780
- };
781
- Auth.prototype.resendVerifyCode = function (verifyToken) {
782
- return __awaiter(this, void 0, void 0, function () {
783
- var url;
784
- return __generator(this, function (_g) {
785
- switch (_g.label) {
786
- case 0:
787
- url = this.getUrl('auth/resend');
788
- return [4 /*yield*/, this._httpClient.post(url, {
789
- verify_token: verifyToken
790
- }).toPromise()];
791
- case 1: return [2 /*return*/, _g.sent()];
792
- }
793
- });
794
- });
795
- };
796
- Auth.prototype.register = function (data, options) {
797
- return __awaiter(this, void 0, void 0, function () {
798
- var url, result, _g, accessToken, refreshToken, user;
799
- return __generator(this, function (_h) {
800
- switch (_h.label) {
801
- case 0:
802
- url = this.getUrl('auth/register');
803
- return [4 /*yield*/, this._httpClient
804
- .post(url, data, options)
805
- .toPromise()];
806
- case 1:
807
- result = _h.sent();
808
- _g = this._mapper.toRegister(result), accessToken = _g.accessToken, refreshToken = _g.refreshToken, user = _g.user;
809
- // Set the tokens in storage.
810
- this.setTokens(accessToken, refreshToken);
811
- // Set the user in storage.
812
- this.session.setUser(user);
813
- // Return the user.
814
- return [2 /*return*/, user];
815
- }
816
- });
817
- });
818
- };
819
- Auth.prototype.logout = function () {
820
- // If we don't have a refresh token just clear the session.
821
- // Note: We do this because else we try to invalidate
822
- // an "undefined" refresh token.
823
- var refreshToken = this.session.refreshToken;
824
- if (!refreshToken) {
825
- return this.session.clear();
826
- }
827
- // We do have a refresh token, so try to
828
- // invalidate it in the backend.
829
- try {
830
- var url = this.getUrl('auth/logout');
831
- this._httpClient.get(url, {
832
- headers: { Authorization: refreshToken }
833
- }).toPromise().then(function (_) { return _; });
834
- }
835
- catch (_a) {
836
- // Do nothing because the tokens will be deleted anyways from the session.
837
- }
838
- // Delete the tokens from the session.
839
- return this.session.clear();
840
- };
841
- Auth.prototype.refresh = function () {
842
- var _this = this;
843
- var _a, _b;
844
- // If the refresh token does
845
- // not exist just return an observable of null.
846
- var refreshToken = this.session.refreshToken;
847
- if (!refreshToken) {
848
- return rxjs.of(null);
849
- }
850
- // Perform the refresh call.
851
- var scheme = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.scheme) !== null && _b !== void 0 ? _b : 'Bearer';
852
- var url = this.getUrl('auth/refresh');
853
- var context = new i4.HttpContext()
854
- .set(USE_AUTHORIZATION, false);
855
- return this._httpClient.get(url, {
856
- headers: { Authorization: scheme + " " + refreshToken },
857
- context: context
858
- }).pipe(operators.map(function (data) { return _this._mapper.toRefresh(data); }), operators.tap(function (_g) {
859
- var accessToken = _g.accessToken, refreshToken = _g.refreshToken;
860
- return _this.setTokens(accessToken, refreshToken);
861
- }), operators.map(function (_g) {
862
- var accessToken = _g.accessToken;
863
- return accessToken;
864
- }));
865
- };
866
- Auth.prototype.requestPassword = function (email, extraParams) {
867
- if (extraParams === void 0) { extraParams = {}; }
868
- return __awaiter(this, void 0, void 0, function () {
869
- var url;
870
- return __generator(this, function (_g) {
871
- switch (_g.label) {
872
- case 0:
873
- url = this.getUrl('auth/reset');
874
- return [4 /*yield*/, this._httpClient
875
- .post(url, Object.assign(Object.assign({}, extraParams), { email: email }))
876
- .toPromise()];
877
- case 1: return [2 /*return*/, _g.sent()];
878
- }
879
- });
880
- });
881
- };
882
- Auth.prototype.resetPassword = function (token, newPassword, extraParams) {
883
- if (extraParams === void 0) { extraParams = {}; }
884
- return __awaiter(this, void 0, void 0, function () {
885
- var url;
886
- return __generator(this, function (_g) {
887
- switch (_g.label) {
888
- case 0:
889
- url = this.getUrl('auth/reset-password');
890
- return [4 /*yield*/, this._httpClient
891
- .post(url, Object.assign(Object.assign({}, extraParams), { token: token, password: newPassword }))
892
- .toPromise()];
893
- case 1: return [2 /*return*/, _g.sent()];
894
- }
895
- });
896
- });
897
- };
898
- Auth.prototype.guard = function (type, redirectUrl) {
899
- var _a, _b, _c, _d, _e, _f;
900
- var newUrl = null;
901
- // Get the correct new url.
902
- switch (type) {
903
- case 'authenticated':
904
- newUrl = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.loggedInUrl) !== null && _b !== void 0 ? _b : null;
905
- break;
906
- case 'unauthenticated':
907
- newUrl = (_d = (_c = this._config) === null || _c === void 0 ? void 0 : _c.redirectUrl) !== null && _d !== void 0 ? _d : null;
908
- break;
909
- }
910
- // Append a redirect url if the user is deemed
911
- // unauthenticated.
912
- if (type === 'unauthenticated') {
913
- var setRedirectOnFailedAuth = (_f = (_e = this._config) === null || _e === void 0 ? void 0 : _e.setRedirectOnFailedAuth) !== null && _f !== void 0 ? _f : true;
914
- if (setRedirectOnFailedAuth && redirectUrl && newUrl) {
915
- newUrl += "?redirectUrl=" + redirectUrl;
916
- }
917
- }
918
- // Parse the url if it exists.
919
- if (this.router && newUrl) {
920
- return this.router.parseUrl(newUrl);
921
- }
922
- // Return false if the user is not allowed.
923
- return false;
924
- };
925
- Auth.prototype.clearAndRedirect = function () {
926
- var _a, _b;
927
- // 1. Delete the tokens from the session.
928
- this.session.clear();
929
- // 2. Compose the route url.
930
- var redirectUrl = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.redirectUrl) !== null && _b !== void 0 ? _b : null;
931
- // 3. Route back if the user provided a redirect url.
932
- if (this.router && redirectUrl) {
933
- this.router.navigate([redirectUrl]).then(function (_) { return _; });
934
- }
935
- };
936
- Auth.prototype.setTokens = function (accessToken, refreshToken) {
937
- // Set the tokens in our session.
938
- this.session.setTokens(accessToken, refreshToken);
939
- // We need to update the auto refresh of the refresh token.
940
- this.handleAutoRefreshing();
941
- };
942
- Auth.prototype.handleAutoRefreshing = function () {
943
- var _this = this;
944
- var _a, _b, _c, _d;
945
- var shouldAutoRefresh = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.autoRefresh) !== null && _b !== void 0 ? _b : false;
946
- if (!shouldAutoRefresh) {
947
- return;
948
- }
949
- var expiresAt = (_d = (_c = this.session.refreshTokenPayload) === null || _c === void 0 ? void 0 : _c.expiresAt) !== null && _d !== void 0 ? _d : null;
950
- if (expiresAt === null || !this._platform.isBrowser) {
951
- return;
952
- }
953
- var differenceInMilliseconds = expiresAt.getTime() - Date.now();
954
- var offsetInMilliseconds = 10000; // 10 seconds.
955
- // We want to start the refresh 10 seconds before it expires.
956
- var actualTiming = differenceInMilliseconds - offsetInMilliseconds;
957
- if (actualTiming <= 0) {
958
- return;
959
- }
960
- // We need to cap the timings because if
961
- // we get large numbers it might cause unwanted results.
962
- var maxTiming = 1000 * 60 * 60 * 24; // 24 hours.
963
- var cappedTiming = Math.max(1, Math.min(actualTiming, maxTiming));
964
- try {
965
- if (this._refreshHandler !== null) {
966
- clearTimeout === null || clearTimeout === void 0 ? void 0 : clearTimeout(this._refreshHandler);
967
- this._refreshHandler = null;
968
- }
969
- this._refreshHandler = setTimeout === null || setTimeout === void 0 ? void 0 : setTimeout(function () { return _this.autoRefresh(); }, cappedTiming);
970
- }
971
- catch (_e) {
972
- // Just ignore it.
973
- }
974
- };
975
- Auth.prototype.autoRefresh = function () {
976
- return __awaiter(this, void 0, void 0, function () {
977
- var _a_1;
978
- return __generator(this, function (_g) {
979
- switch (_g.label) {
980
- case 0:
981
- _g.trys.push([0, 2, , 3]);
982
- // We just need to wait for it to refresh.
983
- return [4 /*yield*/, this.refresh().toPromise()];
984
- case 1:
985
- // We just need to wait for it to refresh.
986
- _g.sent();
987
- return [3 /*break*/, 3];
988
- case 2:
989
- _a_1 = _g.sent();
990
- // Something went wrong refreshing, we need to clear.
991
- this.clearAndRedirect();
992
- return [3 /*break*/, 3];
993
- case 3: return [2 /*return*/];
994
- }
995
- });
996
- });
997
- };
998
- Object.defineProperty(Auth.prototype, "router", {
999
- get: function () {
1000
- return this._injector.get(router.Router);
1001
- },
1002
- enumerable: false,
1003
- configurable: true
1004
- });
1005
- Auth.prototype.getUrl = function (endpoint) {
1006
- return [this._httpAlias, endpoint]
1007
- .filter(function (item) { return !!item; })
1008
- .join('/');
1009
- };
1010
- return Auth;
1011
- }());
1012
- Auth.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: Auth, deps: [{ token: i1__namespace.Storage }, { token: AuthMapper }, { token: i0__namespace.Injector }, { token: i3__namespace.Platform }, { token: i4__namespace.HttpClient }, { token: AuthConfig, optional: true }, { token: i6__namespace.TransferState, optional: true }, { token: i7__namespace.HttpConfig, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1013
- Auth.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: Auth });
1014
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: Auth, decorators: [{
1015
- type: i0.Injectable
1016
- }], ctorParameters: function () {
1017
- return [{ type: i1__namespace.Storage }, { type: AuthMapper }, { type: i0__namespace.Injector }, { type: i3__namespace.Platform }, { type: i4__namespace.HttpClient }, { type: AuthConfig, decorators: [{
1018
- type: i0.Optional
1019
- }] }, { type: i6__namespace.TransferState, decorators: [{
1020
- type: i0.Optional
1021
- }] }, { type: i7__namespace.HttpConfig, decorators: [{
1022
- type: i0.Optional
1023
- }] }];
671
+ var Auth = /** @class */ (function () {
672
+ function Auth(_storage, _mapper, _injector, _platform, _httpClient, _config, _state, _httpConfig) {
673
+ var _a, _b, _c;
674
+ this._storage = _storage;
675
+ this._mapper = _mapper;
676
+ this._injector = _injector;
677
+ this._platform = _platform;
678
+ this._httpClient = _httpClient;
679
+ this._config = _config;
680
+ this._state = _state;
681
+ this._httpConfig = _httpConfig;
682
+ // Readonly data.
683
+ this._authStateKey = i6.makeStateKey("bbAuthStateKey");
684
+ this._httpAlias = (_b = (_a = this._httpConfig) === null || _a === void 0 ? void 0 : _a.defaultAlias) !== null && _b !== void 0 ? _b : null;
685
+ this._refreshHandler = null;
686
+ // Starting the new session.
687
+ this.session = new AuthSession({
688
+ id: (_c = this._config) === null || _c === void 0 ? void 0 : _c.applicationId,
689
+ storage: this._storage.select(["cookie" /* Cookie */, "local" /* Local */])
690
+ });
691
+ this.user = this.session.user;
692
+ }
693
+ Auth.prototype.initialize = function () {
694
+ var _this = this;
695
+ return function () { return __awaiter(_this, void 0, void 0, function () {
696
+ var _a, _b, _c, _d, _e, _f, shouldBootstrap, user_1, user;
697
+ return __generator(this, function (_g) {
698
+ switch (_g.label) {
699
+ case 0:
700
+ shouldBootstrap = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.bootstrap) !== null && _b !== void 0 ? _b : true;
701
+ if (!shouldBootstrap) {
702
+ return [2 /*return*/, this.handleAutoRefreshing()];
703
+ }
704
+ // Only retrieve from the server when we are actually authenticated.
705
+ if (!this.session.authenticated()) {
706
+ return [2 /*return*/];
707
+ }
708
+ // Get the key from the server state.
709
+ if (this._state && ((_c = this._state) === null || _c === void 0 ? void 0 : _c.hasKey(this._authStateKey))) {
710
+ user_1 = (_e = (_d = this._state) === null || _d === void 0 ? void 0 : _d.get(this._authStateKey, null)) !== null && _e !== void 0 ? _e : null;
711
+ return [2 /*return*/, this.session.setUser(user_1)];
712
+ }
713
+ return [4 /*yield*/, this.me().pipe(operators.take(1)).toPromise()];
714
+ case 1:
715
+ user = _g.sent();
716
+ // Set the state if exists.
717
+ if (this._state) {
718
+ (_f = this._state) === null || _f === void 0 ? void 0 : _f.set(this._authStateKey, user !== null && user !== void 0 ? user : null);
719
+ }
720
+ // Save the user in the storage and handle auto refreshing.
721
+ this.session.setUser(user);
722
+ this.handleAutoRefreshing();
723
+ return [2 /*return*/];
724
+ }
725
+ });
726
+ }); };
727
+ };
728
+ Auth.prototype.me = function () {
729
+ var url = this.getUrl('auth/me');
730
+ return this._httpClient.get(url);
731
+ };
732
+ Auth.prototype.signIn = function (provider, as) {
733
+ var _a, _b;
734
+ return __awaiter(this, void 0, void 0, function () {
735
+ var _c, accessToken, refreshToken, user, result, apiProvider, apiVerifyToken, availableProviders;
736
+ return __generator(this, function (_g) {
737
+ switch (_g.label) {
738
+ case 0: return [4 /*yield*/, provider.authenticate(this._httpClient)];
739
+ case 1:
740
+ _c = _g.sent(), accessToken = _c.accessToken, refreshToken = _c.refreshToken, user = _c.user, result = __rest(_c, ["accessToken", "refreshToken", "user"]);
741
+ // Check if the role matches.
742
+ if (as && !as.includes(this._mapper.role(user))) {
743
+ throw new Error('Invalid role.');
744
+ }
745
+ apiProvider = (_a = result === null || result === void 0 ? void 0 : result.provider) !== null && _a !== void 0 ? _a : null;
746
+ apiVerifyToken = (_b = result === null || result === void 0 ? void 0 : result.verifyToken) !== null && _b !== void 0 ? _b : null;
747
+ availableProviders = ['email', 'sms', 'totp'];
748
+ if (availableProviders.includes(apiProvider)) {
749
+ return [2 /*return*/, { user: user, provider: apiProvider, verifyToken: apiVerifyToken }];
750
+ }
751
+ // Set the tokens in storage.
752
+ this.setTokens(accessToken, refreshToken);
753
+ // Set the user in storage.
754
+ this.session.setUser(user);
755
+ // Return the user.
756
+ return [2 /*return*/, { user: user }];
757
+ }
758
+ });
759
+ });
760
+ };
761
+ Auth.prototype.signInWithEmail = function (email, password, as) {
762
+ return __awaiter(this, void 0, void 0, function () {
763
+ var url;
764
+ return __generator(this, function (_g) {
765
+ url = this.getUrl('auth/login');
766
+ return [2 /*return*/, this.signIn(new AuthEmailProvider(email, password, url), as)];
767
+ });
768
+ });
769
+ };
770
+ Auth.prototype.signInWithVerifyCode = function (code, verifyToken) {
771
+ return __awaiter(this, void 0, void 0, function () {
772
+ var url;
773
+ return __generator(this, function (_g) {
774
+ url = this.getUrl('auth/verify');
775
+ return [2 /*return*/, this.signIn(new AuthVerifyProvider(code, verifyToken, url))];
776
+ });
777
+ });
778
+ };
779
+ Auth.prototype.resendVerifyCode = function (verifyToken) {
780
+ return __awaiter(this, void 0, void 0, function () {
781
+ var url;
782
+ return __generator(this, function (_g) {
783
+ switch (_g.label) {
784
+ case 0:
785
+ url = this.getUrl('auth/resend');
786
+ return [4 /*yield*/, this._httpClient.post(url, {
787
+ verify_token: verifyToken
788
+ }).toPromise()];
789
+ case 1: return [2 /*return*/, _g.sent()];
790
+ }
791
+ });
792
+ });
793
+ };
794
+ Auth.prototype.register = function (data, options) {
795
+ return __awaiter(this, void 0, void 0, function () {
796
+ var url, result, _g, accessToken, refreshToken, user;
797
+ return __generator(this, function (_h) {
798
+ switch (_h.label) {
799
+ case 0:
800
+ url = this.getUrl('auth/register');
801
+ return [4 /*yield*/, this._httpClient
802
+ .post(url, data, options)
803
+ .toPromise()];
804
+ case 1:
805
+ result = _h.sent();
806
+ _g = this._mapper.toRegister(result), accessToken = _g.accessToken, refreshToken = _g.refreshToken, user = _g.user;
807
+ // Set the tokens in storage.
808
+ this.setTokens(accessToken, refreshToken);
809
+ // Set the user in storage.
810
+ this.session.setUser(user);
811
+ // Return the user.
812
+ return [2 /*return*/, user];
813
+ }
814
+ });
815
+ });
816
+ };
817
+ Auth.prototype.logout = function () {
818
+ // If we don't have a refresh token just clear the session.
819
+ // Note: We do this because else we try to invalidate
820
+ // an "undefined" refresh token.
821
+ var refreshToken = this.session.refreshToken;
822
+ if (!refreshToken) {
823
+ return this.session.clear();
824
+ }
825
+ // We do have a refresh token, so try to
826
+ // invalidate it in the backend.
827
+ try {
828
+ var url = this.getUrl('auth/logout');
829
+ this._httpClient.get(url, {
830
+ headers: { Authorization: refreshToken }
831
+ }).toPromise().then(function (_) { return _; });
832
+ }
833
+ catch (_a) {
834
+ // Do nothing because the tokens will be deleted anyways from the session.
835
+ }
836
+ // Delete the tokens from the session.
837
+ return this.session.clear();
838
+ };
839
+ Auth.prototype.refresh = function () {
840
+ var _this = this;
841
+ var _a, _b;
842
+ // If the refresh token does
843
+ // not exist just return an observable of null.
844
+ var refreshToken = this.session.refreshToken;
845
+ if (!refreshToken) {
846
+ return rxjs.of(null);
847
+ }
848
+ // Perform the refresh call.
849
+ var scheme = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.scheme) !== null && _b !== void 0 ? _b : 'Bearer';
850
+ var url = this.getUrl('auth/refresh');
851
+ var context = new i4.HttpContext()
852
+ .set(USE_AUTHORIZATION, false);
853
+ return this._httpClient.get(url, {
854
+ headers: { Authorization: scheme + " " + refreshToken },
855
+ context: context
856
+ }).pipe(operators.map(function (data) { return _this._mapper.toRefresh(data); }), operators.tap(function (_g) {
857
+ var accessToken = _g.accessToken, refreshToken = _g.refreshToken;
858
+ return _this.setTokens(accessToken, refreshToken);
859
+ }), operators.map(function (_g) {
860
+ var accessToken = _g.accessToken;
861
+ return accessToken;
862
+ }));
863
+ };
864
+ Auth.prototype.requestPassword = function (email, extraParams) {
865
+ if (extraParams === void 0) { extraParams = {}; }
866
+ return __awaiter(this, void 0, void 0, function () {
867
+ var url;
868
+ return __generator(this, function (_g) {
869
+ switch (_g.label) {
870
+ case 0:
871
+ url = this.getUrl('auth/reset');
872
+ return [4 /*yield*/, this._httpClient
873
+ .post(url, Object.assign(Object.assign({}, extraParams), { email: email }))
874
+ .toPromise()];
875
+ case 1: return [2 /*return*/, _g.sent()];
876
+ }
877
+ });
878
+ });
879
+ };
880
+ Auth.prototype.resetPassword = function (token, newPassword, extraParams) {
881
+ if (extraParams === void 0) { extraParams = {}; }
882
+ return __awaiter(this, void 0, void 0, function () {
883
+ var url;
884
+ return __generator(this, function (_g) {
885
+ switch (_g.label) {
886
+ case 0:
887
+ url = this.getUrl('auth/reset-password');
888
+ return [4 /*yield*/, this._httpClient
889
+ .post(url, Object.assign(Object.assign({}, extraParams), { token: token, password: newPassword }))
890
+ .toPromise()];
891
+ case 1: return [2 /*return*/, _g.sent()];
892
+ }
893
+ });
894
+ });
895
+ };
896
+ Auth.prototype.guard = function (type, redirectUrl) {
897
+ var _a, _b, _c, _d, _e, _f;
898
+ var newUrl = null;
899
+ // Get the correct new url.
900
+ switch (type) {
901
+ case 'authenticated':
902
+ newUrl = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.loggedInUrl) !== null && _b !== void 0 ? _b : null;
903
+ break;
904
+ case 'unauthenticated':
905
+ newUrl = (_d = (_c = this._config) === null || _c === void 0 ? void 0 : _c.redirectUrl) !== null && _d !== void 0 ? _d : null;
906
+ break;
907
+ }
908
+ // Append a redirect url if the user is deemed
909
+ // unauthenticated.
910
+ if (type === 'unauthenticated') {
911
+ var setRedirectOnFailedAuth = (_f = (_e = this._config) === null || _e === void 0 ? void 0 : _e.setRedirectOnFailedAuth) !== null && _f !== void 0 ? _f : true;
912
+ if (setRedirectOnFailedAuth && redirectUrl && newUrl) {
913
+ newUrl += "?redirectUrl=" + redirectUrl;
914
+ }
915
+ }
916
+ // Parse the url if it exists.
917
+ if (this.router && newUrl) {
918
+ return this.router.parseUrl(newUrl);
919
+ }
920
+ // Return false if the user is not allowed.
921
+ return false;
922
+ };
923
+ Auth.prototype.clearAndRedirect = function () {
924
+ var _a, _b;
925
+ // 1. Delete the tokens from the session.
926
+ this.session.clear();
927
+ // 2. Compose the route url.
928
+ var redirectUrl = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.redirectUrl) !== null && _b !== void 0 ? _b : null;
929
+ // 3. Route back if the user provided a redirect url.
930
+ if (this.router && redirectUrl) {
931
+ this.router.navigate([redirectUrl]).then(function (_) { return _; });
932
+ }
933
+ };
934
+ Auth.prototype.setTokens = function (accessToken, refreshToken) {
935
+ // Set the tokens in our session.
936
+ this.session.setTokens(accessToken, refreshToken);
937
+ // We need to update the auto refresh of the refresh token.
938
+ this.handleAutoRefreshing();
939
+ };
940
+ Auth.prototype.handleAutoRefreshing = function () {
941
+ var _this = this;
942
+ var _a, _b, _c, _d;
943
+ var shouldAutoRefresh = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.autoRefresh) !== null && _b !== void 0 ? _b : false;
944
+ if (!shouldAutoRefresh) {
945
+ return;
946
+ }
947
+ var expiresAt = (_d = (_c = this.session.refreshTokenPayload) === null || _c === void 0 ? void 0 : _c.expiresAt) !== null && _d !== void 0 ? _d : null;
948
+ if (expiresAt === null || !this._platform.isBrowser) {
949
+ return;
950
+ }
951
+ var differenceInMilliseconds = expiresAt.getTime() - Date.now();
952
+ var offsetInMilliseconds = 10000; // 10 seconds.
953
+ // We want to start the refresh 10 seconds before it expires.
954
+ var actualTiming = differenceInMilliseconds - offsetInMilliseconds;
955
+ if (actualTiming <= 0) {
956
+ return;
957
+ }
958
+ // We need to cap the timings because if
959
+ // we get large numbers it might cause unwanted results.
960
+ var maxTiming = 1000 * 60 * 60 * 24; // 24 hours.
961
+ var cappedTiming = Math.max(1, Math.min(actualTiming, maxTiming));
962
+ try {
963
+ if (this._refreshHandler !== null) {
964
+ clearTimeout === null || clearTimeout === void 0 ? void 0 : clearTimeout(this._refreshHandler);
965
+ this._refreshHandler = null;
966
+ }
967
+ this._refreshHandler = setTimeout === null || setTimeout === void 0 ? void 0 : setTimeout(function () { return _this.autoRefresh(); }, cappedTiming);
968
+ }
969
+ catch (_e) {
970
+ // Just ignore it.
971
+ }
972
+ };
973
+ Auth.prototype.autoRefresh = function () {
974
+ return __awaiter(this, void 0, void 0, function () {
975
+ var _a_1;
976
+ return __generator(this, function (_g) {
977
+ switch (_g.label) {
978
+ case 0:
979
+ _g.trys.push([0, 2, , 3]);
980
+ // We just need to wait for it to refresh.
981
+ return [4 /*yield*/, this.refresh().toPromise()];
982
+ case 1:
983
+ // We just need to wait for it to refresh.
984
+ _g.sent();
985
+ return [3 /*break*/, 3];
986
+ case 2:
987
+ _a_1 = _g.sent();
988
+ // Something went wrong refreshing, we need to clear.
989
+ this.clearAndRedirect();
990
+ return [3 /*break*/, 3];
991
+ case 3: return [2 /*return*/];
992
+ }
993
+ });
994
+ });
995
+ };
996
+ Object.defineProperty(Auth.prototype, "router", {
997
+ get: function () {
998
+ return this._injector.get(router.Router);
999
+ },
1000
+ enumerable: false,
1001
+ configurable: true
1002
+ });
1003
+ Auth.prototype.getUrl = function (endpoint) {
1004
+ return [this._httpAlias, endpoint]
1005
+ .filter(function (item) { return !!item; })
1006
+ .join('/');
1007
+ };
1008
+ return Auth;
1009
+ }());
1010
+ Auth.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: Auth, deps: [{ token: i1__namespace.Storage }, { token: AuthMapper }, { token: i0__namespace.Injector }, { token: i3__namespace.Platform }, { token: i4__namespace.HttpClient }, { token: AuthConfig, optional: true }, { token: i6__namespace.TransferState, optional: true }, { token: i7__namespace.HttpConfig, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1011
+ Auth.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: Auth });
1012
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: Auth, decorators: [{
1013
+ type: i0.Injectable
1014
+ }], ctorParameters: function () {
1015
+ return [{ type: i1__namespace.Storage }, { type: AuthMapper }, { type: i0__namespace.Injector }, { type: i3__namespace.Platform }, { type: i4__namespace.HttpClient }, { type: AuthConfig, decorators: [{
1016
+ type: i0.Optional
1017
+ }] }, { type: i6__namespace.TransferState, decorators: [{
1018
+ type: i0.Optional
1019
+ }] }, { type: i7__namespace.HttpConfig, decorators: [{
1020
+ type: i0.Optional
1021
+ }] }];
1024
1022
  } });
1025
1023
 
1026
- var BbAuthenticated = /** @class */ (function () {
1027
- function BbAuthenticated(_auth, _template, _viewContainerRef) {
1028
- this._auth = _auth;
1029
- this._template = _template;
1030
- this._viewContainerRef = _viewContainerRef;
1031
- }
1032
- BbAuthenticated.prototype.ngOnInit = function () {
1033
- var _this = this;
1034
- this._subscription = this._auth.user.pipe(operators.map(function (user) { return !!user; }), operators.distinctUntilChanged()).subscribe(function (isAuthenticated) {
1035
- if (!isAuthenticated) {
1036
- return _this._viewContainerRef.clear();
1037
- }
1038
- _this._viewContainerRef.createEmbeddedView(_this._template);
1039
- });
1040
- };
1041
- BbAuthenticated.prototype.ngOnDestroy = function () {
1042
- var _a;
1043
- (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
1044
- };
1045
- return BbAuthenticated;
1046
- }());
1047
- BbAuthenticated.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: BbAuthenticated, deps: [{ token: Auth }, { token: i0__namespace.TemplateRef }, { token: i0__namespace.ViewContainerRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1048
- BbAuthenticated.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.1", type: BbAuthenticated, selector: "[bbAuthenticated]", ngImport: i0__namespace });
1049
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: BbAuthenticated, decorators: [{
1050
- type: i0.Directive,
1051
- args: [{
1052
- selector: '[bbAuthenticated]'
1053
- }]
1024
+ var BbAuthenticated = /** @class */ (function () {
1025
+ function BbAuthenticated(_auth, _template, _viewContainerRef) {
1026
+ this._auth = _auth;
1027
+ this._template = _template;
1028
+ this._viewContainerRef = _viewContainerRef;
1029
+ }
1030
+ BbAuthenticated.prototype.ngOnInit = function () {
1031
+ var _this = this;
1032
+ this._subscription = this._auth.user.pipe(operators.map(function (user) { return !!user; }), operators.distinctUntilChanged()).subscribe(function (isAuthenticated) {
1033
+ if (!isAuthenticated) {
1034
+ return _this._viewContainerRef.clear();
1035
+ }
1036
+ _this._viewContainerRef.createEmbeddedView(_this._template);
1037
+ });
1038
+ };
1039
+ BbAuthenticated.prototype.ngOnDestroy = function () {
1040
+ var _a;
1041
+ (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
1042
+ };
1043
+ return BbAuthenticated;
1044
+ }());
1045
+ BbAuthenticated.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: BbAuthenticated, deps: [{ token: Auth }, { token: i0__namespace.TemplateRef }, { token: i0__namespace.ViewContainerRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1046
+ BbAuthenticated.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.10", type: BbAuthenticated, selector: "[bbAuthenticated]", ngImport: i0__namespace });
1047
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: BbAuthenticated, decorators: [{
1048
+ type: i0.Directive,
1049
+ args: [{
1050
+ selector: '[bbAuthenticated]'
1051
+ }]
1054
1052
  }], ctorParameters: function () { return [{ type: Auth }, { type: i0__namespace.TemplateRef }, { type: i0__namespace.ViewContainerRef }]; } });
1055
1053
 
1056
- var BbRole = /** @class */ (function () {
1057
- function BbRole(_auth, _template, _viewContainerRef) {
1058
- this._auth = _auth;
1059
- this._template = _template;
1060
- this._viewContainerRef = _viewContainerRef;
1061
- this.getAllowedRoles = function (value) {
1062
- return Array.isArray(value) ? value : [value];
1063
- };
1064
- }
1065
- BbRole.prototype.ngOnInit = function () {
1066
- var _this = this;
1067
- this._subscription = this._auth.user.pipe(operators.map(function (user) { var _a; return (_a = user === null || user === void 0 ? void 0 : user.role) !== null && _a !== void 0 ? _a : null; }), operators.distinctUntilChanged()).subscribe(function (role) {
1068
- var allowedRoles = _this.getAllowedRoles(_this.bbRole);
1069
- if (!allowedRoles.includes(role)) {
1070
- return _this._viewContainerRef.clear();
1071
- }
1072
- _this._viewContainerRef.createEmbeddedView(_this._template);
1073
- });
1074
- };
1075
- BbRole.prototype.ngOnDestroy = function () {
1076
- var _a;
1077
- (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
1078
- };
1079
- return BbRole;
1080
- }());
1081
- BbRole.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: BbRole, deps: [{ token: Auth }, { token: i0__namespace.TemplateRef }, { token: i0__namespace.ViewContainerRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1082
- BbRole.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.1", type: BbRole, selector: "[bbRole]", inputs: { bbRole: "bbRole" }, ngImport: i0__namespace });
1083
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: BbRole, decorators: [{
1084
- type: i0.Directive,
1085
- args: [{
1086
- selector: '[bbRole]'
1087
- }]
1088
- }], ctorParameters: function () { return [{ type: Auth }, { type: i0__namespace.TemplateRef }, { type: i0__namespace.ViewContainerRef }]; }, propDecorators: { bbRole: [{
1089
- type: i0.Input
1054
+ var BbRole = /** @class */ (function () {
1055
+ function BbRole(_auth, _template, _viewContainerRef) {
1056
+ this._auth = _auth;
1057
+ this._template = _template;
1058
+ this._viewContainerRef = _viewContainerRef;
1059
+ this.getAllowedRoles = function (value) {
1060
+ return Array.isArray(value) ? value : [value];
1061
+ };
1062
+ }
1063
+ BbRole.prototype.ngOnInit = function () {
1064
+ var _this = this;
1065
+ this._subscription = this._auth.user.pipe(operators.map(function (user) { var _a; return (_a = user === null || user === void 0 ? void 0 : user.role) !== null && _a !== void 0 ? _a : null; }), operators.distinctUntilChanged()).subscribe(function (role) {
1066
+ var allowedRoles = _this.getAllowedRoles(_this.bbRole);
1067
+ if (!allowedRoles.includes(role)) {
1068
+ return _this._viewContainerRef.clear();
1069
+ }
1070
+ _this._viewContainerRef.createEmbeddedView(_this._template);
1071
+ });
1072
+ };
1073
+ BbRole.prototype.ngOnDestroy = function () {
1074
+ var _a;
1075
+ (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
1076
+ };
1077
+ return BbRole;
1078
+ }());
1079
+ BbRole.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: BbRole, deps: [{ token: Auth }, { token: i0__namespace.TemplateRef }, { token: i0__namespace.ViewContainerRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1080
+ BbRole.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.10", type: BbRole, selector: "[bbRole]", inputs: { bbRole: "bbRole" }, ngImport: i0__namespace });
1081
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: BbRole, decorators: [{
1082
+ type: i0.Directive,
1083
+ args: [{
1084
+ selector: '[bbRole]'
1085
+ }]
1086
+ }], ctorParameters: function () { return [{ type: Auth }, { type: i0__namespace.TemplateRef }, { type: i0__namespace.ViewContainerRef }]; }, propDecorators: { bbRole: [{
1087
+ type: i0.Input
1090
1088
  }] } });
1091
1089
 
1092
- var Permissions = /** @class */ (function () {
1093
- function Permissions(_auth, _config) {
1094
- var _a, _b;
1095
- this._auth = _auth;
1096
- this._config = _config;
1097
- // Data.
1098
- this._permissions = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.permissions) !== null && _b !== void 0 ? _b : {};
1099
- this._role$ = this._auth.user.pipe(operators.map(function (user) { var _a; return (_a = user === null || user === void 0 ? void 0 : user.role) !== null && _a !== void 0 ? _a : null; }), operators.distinctUntilChanged());
1100
- }
1101
- Permissions.prototype.has = function (value) {
1102
- var _this = this;
1103
- var requiredPermissions = Array.isArray(value)
1104
- ? value
1105
- : [value];
1106
- return this._role$.pipe(operators.map(function (role) {
1107
- var e_1, _f;
1108
- if (role === null || role === undefined) {
1109
- return false;
1110
- }
1111
- try {
1112
- for (var requiredPermissions_1 = __values(requiredPermissions), requiredPermissions_1_1 = requiredPermissions_1.next(); !requiredPermissions_1_1.done; requiredPermissions_1_1 = requiredPermissions_1.next()) {
1113
- var requiredPermission = requiredPermissions_1_1.value;
1114
- var result = _this.validatePermission(requiredPermission, role);
1115
- if (!result) {
1116
- return false;
1117
- }
1118
- }
1119
- }
1120
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1121
- finally {
1122
- try {
1123
- if (requiredPermissions_1_1 && !requiredPermissions_1_1.done && (_f = requiredPermissions_1.return)) _f.call(requiredPermissions_1);
1124
- }
1125
- finally { if (e_1) throw e_1.error; }
1126
- }
1127
- return true;
1128
- }));
1129
- };
1130
- Permissions.prototype.validatePermission = function (type, role) {
1131
- var _a, _b, _c, _d, _e;
1132
- var permission = (_b = (_a = this._permissions) === null || _a === void 0 ? void 0 : _a[type]) !== null && _b !== void 0 ? _b : null;
1133
- if (!permission) {
1134
- (_c = console === null || console === void 0 ? void 0 : console.warn) === null || _c === void 0 ? void 0 : _c.call(console, "Permissions: Invalid permission requested \"" + type + "\".");
1135
- return false;
1136
- }
1137
- if ((permission === null || permission === void 0 ? void 0 : permission.length) <= 0) {
1138
- (_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.");
1139
- return false;
1140
- }
1141
- // If the permission includes a "*" we allow everyone.
1142
- if (permission.includes('*')) {
1143
- return true;
1144
- }
1145
- // Validate the role against the permissions.
1146
- return (_e = permission === null || permission === void 0 ? void 0 : permission.includes(role)) !== null && _e !== void 0 ? _e : false;
1147
- };
1148
- return Permissions;
1149
- }());
1150
- Permissions.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: Permissions, deps: [{ token: Auth }, { token: AuthConfig, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1151
- Permissions.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: Permissions });
1152
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: Permissions, decorators: [{
1153
- type: i0.Injectable
1154
- }], ctorParameters: function () {
1155
- return [{ type: Auth }, { type: AuthConfig, decorators: [{
1156
- type: i0.Optional
1157
- }] }];
1090
+ var Permissions = /** @class */ (function () {
1091
+ function Permissions(_auth, _config) {
1092
+ var _a, _b;
1093
+ this._auth = _auth;
1094
+ this._config = _config;
1095
+ // Data.
1096
+ this._permissions = (_b = (_a = this._config) === null || _a === void 0 ? void 0 : _a.permissions) !== null && _b !== void 0 ? _b : {};
1097
+ this._role$ = this._auth.user.pipe(operators.map(function (user) { var _a; return (_a = user === null || user === void 0 ? void 0 : user.role) !== null && _a !== void 0 ? _a : null; }), operators.distinctUntilChanged());
1098
+ }
1099
+ Permissions.prototype.has = function (value) {
1100
+ var _this = this;
1101
+ var requiredPermissions = Array.isArray(value)
1102
+ ? value
1103
+ : [value];
1104
+ return this._role$.pipe(operators.map(function (role) {
1105
+ var e_1, _f;
1106
+ if (role === null || role === undefined) {
1107
+ return false;
1108
+ }
1109
+ try {
1110
+ for (var requiredPermissions_1 = __values(requiredPermissions), requiredPermissions_1_1 = requiredPermissions_1.next(); !requiredPermissions_1_1.done; requiredPermissions_1_1 = requiredPermissions_1.next()) {
1111
+ var requiredPermission = requiredPermissions_1_1.value;
1112
+ var result = _this.validatePermission(requiredPermission, role);
1113
+ if (!result) {
1114
+ return false;
1115
+ }
1116
+ }
1117
+ }
1118
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1119
+ finally {
1120
+ try {
1121
+ if (requiredPermissions_1_1 && !requiredPermissions_1_1.done && (_f = requiredPermissions_1.return)) _f.call(requiredPermissions_1);
1122
+ }
1123
+ finally { if (e_1) throw e_1.error; }
1124
+ }
1125
+ return true;
1126
+ }));
1127
+ };
1128
+ Permissions.prototype.validatePermission = function (type, role) {
1129
+ var _a, _b, _c, _d, _e;
1130
+ var permission = (_b = (_a = this._permissions) === null || _a === void 0 ? void 0 : _a[type]) !== null && _b !== void 0 ? _b : null;
1131
+ if (!permission) {
1132
+ (_c = console === null || console === void 0 ? void 0 : console.warn) === null || _c === void 0 ? void 0 : _c.call(console, "Permissions: Invalid permission requested \"" + type + "\".");
1133
+ return false;
1134
+ }
1135
+ if ((permission === null || permission === void 0 ? void 0 : permission.length) <= 0) {
1136
+ (_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.");
1137
+ return false;
1138
+ }
1139
+ // If the permission includes a "*" we allow everyone.
1140
+ if (permission.includes('*')) {
1141
+ return true;
1142
+ }
1143
+ // Validate the role against the permissions.
1144
+ return (_e = permission === null || permission === void 0 ? void 0 : permission.includes(role)) !== null && _e !== void 0 ? _e : false;
1145
+ };
1146
+ return Permissions;
1147
+ }());
1148
+ Permissions.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: Permissions, deps: [{ token: Auth }, { token: AuthConfig, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1149
+ Permissions.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: Permissions });
1150
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: Permissions, decorators: [{
1151
+ type: i0.Injectable
1152
+ }], ctorParameters: function () {
1153
+ return [{ type: Auth }, { type: AuthConfig, decorators: [{
1154
+ type: i0.Optional
1155
+ }] }];
1158
1156
  } });
1159
1157
 
1160
- var BbPermission = /** @class */ (function () {
1161
- function BbPermission(_permissions, _templateRef, _viewContainerRef) {
1162
- this._permissions = _permissions;
1163
- this._templateRef = _templateRef;
1164
- this._viewContainerRef = _viewContainerRef;
1165
- // Data.
1166
- this._permission$ = new rxjs.BehaviorSubject([]);
1167
- this._valid = false;
1168
- this._elseTemplateRef = null;
1169
- this._thenViewRef = null;
1170
- this._elseViewRef = null;
1171
- this.getAllowedPermissions = function (value) {
1172
- return Array.isArray(value) ? value : [value];
1173
- };
1174
- this.assertTemplate = function (property, templateRef) {
1175
- var isTemplateRefOrNull = !!(!templateRef || templateRef.createEmbeddedView);
1176
- if (!isTemplateRefOrNull) {
1177
- throw new Error(property + " must be a TemplateRef.");
1178
- }
1179
- };
1180
- }
1181
- Object.defineProperty(BbPermission.prototype, "bbPermission", {
1182
- set: function (value) {
1183
- var permissions = this.getAllowedPermissions(value);
1184
- this._permission$.next(permissions);
1185
- this.updateView();
1186
- },
1187
- enumerable: false,
1188
- configurable: true
1189
- });
1190
- Object.defineProperty(BbPermission.prototype, "bbPermissionElse", {
1191
- set: function (templateRef) {
1192
- this.assertTemplate('bbPermissionElse', templateRef);
1193
- this._elseTemplateRef = templateRef;
1194
- this.updateView();
1195
- },
1196
- enumerable: false,
1197
- configurable: true
1198
- });
1199
- BbPermission.prototype.ngOnInit = function () {
1200
- var _this = this;
1201
- var check$ = this._permission$.pipe(operators.switchMap(function (permissions) { return _this._permissions.has(permissions); }));
1202
- this._subscription = check$.subscribe(function (valid) {
1203
- _this._valid = valid;
1204
- _this.updateView();
1205
- });
1206
- };
1207
- BbPermission.prototype.ngOnDestroy = function () {
1208
- var _a;
1209
- (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
1210
- };
1211
- BbPermission.prototype.updateView = function () {
1212
- if (this._valid) {
1213
- if (!this._thenViewRef) {
1214
- this._viewContainerRef.clear();
1215
- this._elseViewRef = null;
1216
- if (this._templateRef) {
1217
- this._thenViewRef = this._viewContainerRef.createEmbeddedView(this._templateRef);
1218
- }
1219
- }
1220
- }
1221
- else {
1222
- if (!this._elseViewRef) {
1223
- this._viewContainerRef.clear();
1224
- this._thenViewRef = null;
1225
- if (this._elseTemplateRef) {
1226
- this._elseViewRef = this._viewContainerRef.createEmbeddedView(this._elseTemplateRef);
1227
- }
1228
- }
1229
- }
1230
- };
1231
- return BbPermission;
1232
- }());
1233
- BbPermission.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: BbPermission, deps: [{ token: Permissions }, { token: i0__namespace.TemplateRef }, { token: i0__namespace.ViewContainerRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1234
- BbPermission.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.1", type: BbPermission, selector: "[bbPermission]", inputs: { bbPermission: "bbPermission", bbPermissionElse: "bbPermissionElse" }, ngImport: i0__namespace });
1235
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: BbPermission, decorators: [{
1236
- type: i0.Directive,
1237
- args: [{
1238
- selector: '[bbPermission]'
1239
- }]
1240
- }], ctorParameters: function () { return [{ type: Permissions }, { type: i0__namespace.TemplateRef }, { type: i0__namespace.ViewContainerRef }]; }, propDecorators: { bbPermission: [{
1241
- type: i0.Input
1242
- }], bbPermissionElse: [{
1243
- type: i0.Input
1158
+ var BbPermission = /** @class */ (function () {
1159
+ function BbPermission(_permissions, _templateRef, _viewContainerRef) {
1160
+ this._permissions = _permissions;
1161
+ this._templateRef = _templateRef;
1162
+ this._viewContainerRef = _viewContainerRef;
1163
+ // Data.
1164
+ this._permission$ = new rxjs.BehaviorSubject([]);
1165
+ this._valid = false;
1166
+ this._elseTemplateRef = null;
1167
+ this._thenViewRef = null;
1168
+ this._elseViewRef = null;
1169
+ this.getAllowedPermissions = function (value) {
1170
+ return Array.isArray(value) ? value : [value];
1171
+ };
1172
+ this.assertTemplate = function (property, templateRef) {
1173
+ var isTemplateRefOrNull = !!(!templateRef || templateRef.createEmbeddedView);
1174
+ if (!isTemplateRefOrNull) {
1175
+ throw new Error(property + " must be a TemplateRef.");
1176
+ }
1177
+ };
1178
+ }
1179
+ Object.defineProperty(BbPermission.prototype, "bbPermission", {
1180
+ set: function (value) {
1181
+ var permissions = this.getAllowedPermissions(value);
1182
+ this._permission$.next(permissions);
1183
+ this.updateView();
1184
+ },
1185
+ enumerable: false,
1186
+ configurable: true
1187
+ });
1188
+ Object.defineProperty(BbPermission.prototype, "bbPermissionElse", {
1189
+ set: function (templateRef) {
1190
+ this.assertTemplate('bbPermissionElse', templateRef);
1191
+ this._elseTemplateRef = templateRef;
1192
+ this.updateView();
1193
+ },
1194
+ enumerable: false,
1195
+ configurable: true
1196
+ });
1197
+ BbPermission.prototype.ngOnInit = function () {
1198
+ var _this = this;
1199
+ var check$ = this._permission$.pipe(operators.switchMap(function (permissions) { return _this._permissions.has(permissions); }));
1200
+ this._subscription = check$.subscribe(function (valid) {
1201
+ _this._valid = valid;
1202
+ _this.updateView();
1203
+ });
1204
+ };
1205
+ BbPermission.prototype.ngOnDestroy = function () {
1206
+ var _a;
1207
+ (_a = this._subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
1208
+ };
1209
+ BbPermission.prototype.updateView = function () {
1210
+ if (this._valid) {
1211
+ if (!this._thenViewRef) {
1212
+ this._viewContainerRef.clear();
1213
+ this._elseViewRef = null;
1214
+ if (this._templateRef) {
1215
+ this._thenViewRef = this._viewContainerRef.createEmbeddedView(this._templateRef);
1216
+ }
1217
+ }
1218
+ }
1219
+ else {
1220
+ if (!this._elseViewRef) {
1221
+ this._viewContainerRef.clear();
1222
+ this._thenViewRef = null;
1223
+ if (this._elseTemplateRef) {
1224
+ this._elseViewRef = this._viewContainerRef.createEmbeddedView(this._elseTemplateRef);
1225
+ }
1226
+ }
1227
+ }
1228
+ };
1229
+ return BbPermission;
1230
+ }());
1231
+ BbPermission.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: BbPermission, deps: [{ token: Permissions }, { token: i0__namespace.TemplateRef }, { token: i0__namespace.ViewContainerRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1232
+ BbPermission.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.10", type: BbPermission, selector: "[bbPermission]", inputs: { bbPermission: "bbPermission", bbPermissionElse: "bbPermissionElse" }, ngImport: i0__namespace });
1233
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: BbPermission, decorators: [{
1234
+ type: i0.Directive,
1235
+ args: [{
1236
+ selector: '[bbPermission]'
1237
+ }]
1238
+ }], ctorParameters: function () { return [{ type: Permissions }, { type: i0__namespace.TemplateRef }, { type: i0__namespace.ViewContainerRef }]; }, propDecorators: { bbPermission: [{
1239
+ type: i0.Input
1240
+ }], bbPermissionElse: [{
1241
+ type: i0.Input
1244
1242
  }] } });
1245
1243
 
1246
- var BbAnonymousGuard = /** @class */ (function () {
1247
- function BbAnonymousGuard(_auth) {
1248
- this._auth = _auth;
1249
- }
1250
- BbAnonymousGuard.prototype.canActivate = function (_, state) {
1251
- return __awaiter(this, void 0, void 0, function () {
1252
- var isAuthenticated;
1253
- return __generator(this, function (_a) {
1254
- switch (_a.label) {
1255
- case 0: return [4 /*yield*/, this._auth.user.pipe(operators.map(function (user) { return !!user; }), operators.first()).toPromise()];
1256
- case 1:
1257
- isAuthenticated = _a.sent();
1258
- // If the user is not authenticated it can
1259
- // access the anonymous page.
1260
- if (!isAuthenticated) {
1261
- return [2 /*return*/, true];
1262
- }
1263
- // Return the user back to the authenticated page.
1264
- return [2 /*return*/, this._auth.guard('authenticated', state.url)];
1265
- }
1266
- });
1267
- });
1268
- };
1269
- BbAnonymousGuard.prototype.canActivateChild = function (childRoute, state) {
1270
- return this.canActivate(childRoute, state);
1271
- };
1272
- return BbAnonymousGuard;
1273
- }());
1274
- BbAnonymousGuard.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: BbAnonymousGuard, deps: [{ token: Auth }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1275
- BbAnonymousGuard.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: BbAnonymousGuard, providedIn: 'root' });
1276
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: BbAnonymousGuard, decorators: [{
1277
- type: i0.Injectable,
1278
- args: [{
1279
- providedIn: 'root'
1280
- }]
1244
+ var BbAnonymousGuard = /** @class */ (function () {
1245
+ function BbAnonymousGuard(_auth) {
1246
+ this._auth = _auth;
1247
+ }
1248
+ BbAnonymousGuard.prototype.canActivate = function (_, state) {
1249
+ return __awaiter(this, void 0, void 0, function () {
1250
+ var isAuthenticated;
1251
+ return __generator(this, function (_a) {
1252
+ switch (_a.label) {
1253
+ case 0: return [4 /*yield*/, this._auth.user.pipe(operators.map(function (user) { return !!user; }), operators.first()).toPromise()];
1254
+ case 1:
1255
+ isAuthenticated = _a.sent();
1256
+ // If the user is not authenticated it can
1257
+ // access the anonymous page.
1258
+ if (!isAuthenticated) {
1259
+ return [2 /*return*/, true];
1260
+ }
1261
+ // Return the user back to the authenticated page.
1262
+ return [2 /*return*/, this._auth.guard('authenticated', state.url)];
1263
+ }
1264
+ });
1265
+ });
1266
+ };
1267
+ BbAnonymousGuard.prototype.canActivateChild = function (childRoute, state) {
1268
+ return this.canActivate(childRoute, state);
1269
+ };
1270
+ return BbAnonymousGuard;
1271
+ }());
1272
+ BbAnonymousGuard.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: BbAnonymousGuard, deps: [{ token: Auth }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1273
+ BbAnonymousGuard.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: BbAnonymousGuard, providedIn: 'root' });
1274
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: BbAnonymousGuard, decorators: [{
1275
+ type: i0.Injectable,
1276
+ args: [{
1277
+ providedIn: 'root'
1278
+ }]
1281
1279
  }], ctorParameters: function () { return [{ type: Auth }]; } });
1282
1280
 
1283
- var BbAuthenticatedGuard = /** @class */ (function () {
1284
- function BbAuthenticatedGuard(_auth) {
1285
- this._auth = _auth;
1286
- }
1287
- BbAuthenticatedGuard.prototype.canActivate = function (_, state) {
1288
- return __awaiter(this, void 0, void 0, function () {
1289
- var isAuthenticated;
1290
- return __generator(this, function (_a) {
1291
- switch (_a.label) {
1292
- case 0: return [4 /*yield*/, this._auth.user.pipe(operators.map(function (user) { return !!user; }), operators.first()).toPromise()];
1293
- case 1:
1294
- isAuthenticated = _a.sent();
1295
- // If the user is authenticated it can
1296
- // access the authenticated page.
1297
- if (isAuthenticated) {
1298
- return [2 /*return*/, true];
1299
- }
1300
- // The user is not authorized to see that
1301
- // page so un-authorize him.
1302
- return [2 /*return*/, this._auth.guard('unauthenticated', state.url)];
1303
- }
1304
- });
1305
- });
1306
- };
1307
- BbAuthenticatedGuard.prototype.canActivateChild = function (childRoute, state) {
1308
- return this.canActivate(childRoute, state);
1309
- };
1310
- return BbAuthenticatedGuard;
1311
- }());
1312
- BbAuthenticatedGuard.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: BbAuthenticatedGuard, deps: [{ token: Auth }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1313
- BbAuthenticatedGuard.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: BbAuthenticatedGuard, providedIn: 'root' });
1314
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: BbAuthenticatedGuard, decorators: [{
1315
- type: i0.Injectable,
1316
- args: [{
1317
- providedIn: 'root'
1318
- }]
1281
+ var BbAuthenticatedGuard = /** @class */ (function () {
1282
+ function BbAuthenticatedGuard(_auth) {
1283
+ this._auth = _auth;
1284
+ }
1285
+ BbAuthenticatedGuard.prototype.canActivate = function (_, state) {
1286
+ return __awaiter(this, void 0, void 0, function () {
1287
+ var isAuthenticated;
1288
+ return __generator(this, function (_a) {
1289
+ switch (_a.label) {
1290
+ case 0: return [4 /*yield*/, this._auth.user.pipe(operators.map(function (user) { return !!user; }), operators.first()).toPromise()];
1291
+ case 1:
1292
+ isAuthenticated = _a.sent();
1293
+ // If the user is authenticated it can
1294
+ // access the authenticated page.
1295
+ if (isAuthenticated) {
1296
+ return [2 /*return*/, true];
1297
+ }
1298
+ // The user is not authorized to see that
1299
+ // page so un-authorize him.
1300
+ return [2 /*return*/, this._auth.guard('unauthenticated', state.url)];
1301
+ }
1302
+ });
1303
+ });
1304
+ };
1305
+ BbAuthenticatedGuard.prototype.canActivateChild = function (childRoute, state) {
1306
+ return this.canActivate(childRoute, state);
1307
+ };
1308
+ return BbAuthenticatedGuard;
1309
+ }());
1310
+ BbAuthenticatedGuard.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: BbAuthenticatedGuard, deps: [{ token: Auth }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1311
+ BbAuthenticatedGuard.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: BbAuthenticatedGuard, providedIn: 'root' });
1312
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: BbAuthenticatedGuard, decorators: [{
1313
+ type: i0.Injectable,
1314
+ args: [{
1315
+ providedIn: 'root'
1316
+ }]
1319
1317
  }], ctorParameters: function () { return [{ type: Auth }]; } });
1320
1318
 
1321
- var AuthInterceptor = /** @class */ (function () {
1322
- function AuthInterceptor(_auth, _config) {
1323
- var _this = this;
1324
- this._auth = _auth;
1325
- this._config = _config;
1326
- // Readonly data.
1327
- this._authHeaderString = 'Authorization';
1328
- // Data.
1329
- this.isRefreshing = false;
1330
- this.refreshingAccessToken$ = new rxjs.BehaviorSubject(null);
1331
- this.getAccessToken = function (request) {
1332
- // Get the token based on header.
1333
- if (request.headers.has('Authorization')) {
1334
- return request.headers.get('Authorization');
1335
- }
1336
- // Return the default access token.
1337
- return _this._auth.session.accessToken;
1338
- };
1339
- this.addAuthorizationHeader = function (request, accessToken) {
1340
- var _c;
1341
- if (accessToken === void 0) { accessToken = null; }
1342
- // Remove auth header when we do not have
1343
- // an access token.
1344
- if (!accessToken) {
1345
- return request.clone({
1346
- headers: request.headers.delete(_this._authHeaderString)
1347
- });
1348
- }
1349
- // Add the auth header to the request.
1350
- return request.clone({
1351
- setHeaders: (_c = {}, _c[_this._authHeaderString] = _this.getFullAuthorizationHeader(accessToken), _c)
1352
- });
1353
- };
1354
- this.getFullAuthorizationHeader = function (token) {
1355
- var _a, _b;
1356
- var authScheme = (_b = (_a = _this._config) === null || _a === void 0 ? void 0 : _a.scheme) !== null && _b !== void 0 ? _b : 'Bearer';
1357
- return [authScheme, token].join(' ');
1358
- };
1359
- }
1360
- AuthInterceptor.prototype.intercept = function (request, next) {
1361
- var _this = this;
1362
- // 1. Check if the user wants to use the authorization for this request.
1363
- if (!request.context.get(USE_AUTHORIZATION)) {
1364
- return next.handle(request);
1365
- }
1366
- // 2. Compose the new request.
1367
- var accessToken = this.getAccessToken(request);
1368
- var newRequest = this.addAuthorizationHeader(request, accessToken);
1369
- // 3. Handle all errors.
1370
- return next.handle(newRequest).pipe(operators.catchError(function (error) {
1371
- // Handle the HTTP401 error.
1372
- if ((error instanceof i4.HttpErrorResponse || error instanceof i7.HttpError) && (error === null || error === void 0 ? void 0 : error.status) === 401) {
1373
- return _this.handle401Error(request, next);
1374
- }
1375
- // Just re-throw the parsed error.
1376
- return rxjs.throwError(error);
1377
- }));
1378
- };
1379
- AuthInterceptor.prototype.handle401Error = function (request, next) {
1380
- var _this = this;
1381
- // If already refreshing wait for the refresh token to complete.
1382
- if (this.isRefreshing) {
1383
- return this.refreshingAccessToken$.pipe(operators.filter(function (accessToken) { return accessToken !== null; }), operators.take(1), operators.switchMap(function (accessToken) { return next.handle(_this.addAuthorizationHeader(request, accessToken)); }));
1384
- }
1385
- // Set the refreshing to true.
1386
- this.isRefreshing = true;
1387
- this.refreshingAccessToken$.next(null);
1388
- return this._auth.refresh().pipe(operators.switchMap(function (newAccessToken) {
1389
- if (!newAccessToken) {
1390
- var error = new Error('No refresh token was available.');
1391
- return rxjs.throwError(error);
1392
- }
1393
- _this.refreshingAccessToken$.next(newAccessToken);
1394
- return next.handle(_this.addAuthorizationHeader(request, newAccessToken));
1395
- }), operators.catchError(function () { return _this.logoutUser(); }), operators.finalize(function () { return _this.isRefreshing = false; }));
1396
- };
1397
- AuthInterceptor.prototype.logoutUser = function () {
1398
- // Handle the refresh error.
1399
- this._auth.clearAndRedirect();
1400
- // Return null as data.
1401
- return rxjs.of(null);
1402
- };
1403
- return AuthInterceptor;
1404
- }());
1405
- AuthInterceptor.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: AuthInterceptor, deps: [{ token: Auth }, { token: AuthConfig, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1406
- AuthInterceptor.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: AuthInterceptor });
1407
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: AuthInterceptor, decorators: [{
1408
- type: i0.Injectable
1409
- }], ctorParameters: function () {
1410
- return [{ type: Auth }, { type: AuthConfig, decorators: [{
1411
- type: i0.Optional
1412
- }] }];
1319
+ var AuthInterceptor = /** @class */ (function () {
1320
+ function AuthInterceptor(_auth, _config) {
1321
+ var _this = this;
1322
+ this._auth = _auth;
1323
+ this._config = _config;
1324
+ // Readonly data.
1325
+ this._authHeaderString = 'Authorization';
1326
+ // Data.
1327
+ this.isRefreshing = false;
1328
+ this.refreshingAccessToken$ = new rxjs.BehaviorSubject(null);
1329
+ this.getAccessToken = function (request) {
1330
+ // Get the token based on header.
1331
+ if (request.headers.has('Authorization')) {
1332
+ return request.headers.get('Authorization');
1333
+ }
1334
+ // Return the default access token.
1335
+ return _this._auth.session.accessToken;
1336
+ };
1337
+ this.addAuthorizationHeader = function (request, accessToken) {
1338
+ var _c;
1339
+ if (accessToken === void 0) { accessToken = null; }
1340
+ // Remove auth header when we do not have
1341
+ // an access token.
1342
+ if (!accessToken) {
1343
+ return request.clone({
1344
+ headers: request.headers.delete(_this._authHeaderString)
1345
+ });
1346
+ }
1347
+ // Add the auth header to the request.
1348
+ return request.clone({
1349
+ setHeaders: (_c = {}, _c[_this._authHeaderString] = _this.getFullAuthorizationHeader(accessToken), _c)
1350
+ });
1351
+ };
1352
+ this.getFullAuthorizationHeader = function (token) {
1353
+ var _a, _b;
1354
+ var authScheme = (_b = (_a = _this._config) === null || _a === void 0 ? void 0 : _a.scheme) !== null && _b !== void 0 ? _b : 'Bearer';
1355
+ return [authScheme, token].join(' ');
1356
+ };
1357
+ }
1358
+ AuthInterceptor.prototype.intercept = function (request, next) {
1359
+ var _this = this;
1360
+ // 1. Check if the user wants to use the authorization for this request.
1361
+ if (!request.context.get(USE_AUTHORIZATION)) {
1362
+ return next.handle(request);
1363
+ }
1364
+ // 2. Compose the new request.
1365
+ var accessToken = this.getAccessToken(request);
1366
+ var newRequest = this.addAuthorizationHeader(request, accessToken);
1367
+ // 3. Handle all errors.
1368
+ return next.handle(newRequest).pipe(operators.catchError(function (error) {
1369
+ // Handle the HTTP401 error.
1370
+ if ((error instanceof i4.HttpErrorResponse || error instanceof i7.HttpError) && (error === null || error === void 0 ? void 0 : error.status) === 401) {
1371
+ return _this.handle401Error(request, next);
1372
+ }
1373
+ // Just re-throw the parsed error.
1374
+ return rxjs.throwError(error);
1375
+ }));
1376
+ };
1377
+ AuthInterceptor.prototype.handle401Error = function (request, next) {
1378
+ var _this = this;
1379
+ // If already refreshing wait for the refresh token to complete.
1380
+ if (this.isRefreshing) {
1381
+ return this.refreshingAccessToken$.pipe(operators.filter(function (accessToken) { return accessToken !== null; }), operators.take(1), operators.switchMap(function (accessToken) { return next.handle(_this.addAuthorizationHeader(request, accessToken)); }));
1382
+ }
1383
+ // Set the refreshing to true.
1384
+ this.isRefreshing = true;
1385
+ this.refreshingAccessToken$.next(null);
1386
+ return this._auth.refresh().pipe(operators.switchMap(function (newAccessToken) {
1387
+ if (!newAccessToken) {
1388
+ var error = new Error('No refresh token was available.');
1389
+ return rxjs.throwError(error);
1390
+ }
1391
+ _this.refreshingAccessToken$.next(newAccessToken);
1392
+ return next.handle(_this.addAuthorizationHeader(request, newAccessToken));
1393
+ }), operators.catchError(function () { return _this.logoutUser(); }), operators.finalize(function () { return _this.isRefreshing = false; }));
1394
+ };
1395
+ AuthInterceptor.prototype.logoutUser = function () {
1396
+ // Handle the refresh error.
1397
+ this._auth.clearAndRedirect();
1398
+ // Return null as data.
1399
+ return rxjs.of(null);
1400
+ };
1401
+ return AuthInterceptor;
1402
+ }());
1403
+ AuthInterceptor.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: AuthInterceptor, deps: [{ token: Auth }, { token: AuthConfig, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1404
+ AuthInterceptor.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: AuthInterceptor });
1405
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: AuthInterceptor, decorators: [{
1406
+ type: i0.Injectable
1407
+ }], ctorParameters: function () {
1408
+ return [{ type: Auth }, { type: AuthConfig, decorators: [{
1409
+ type: i0.Optional
1410
+ }] }];
1413
1411
  } });
1414
1412
 
1415
- var DECLARATIONS_EXPORTS = [
1416
- BbAuthenticated,
1417
- BbRole,
1418
- BbPermission
1419
- ];
1420
- var AuthModule = /** @class */ (function () {
1421
- function AuthModule() {
1422
- }
1423
- AuthModule.forRoot = function (config) {
1424
- return {
1425
- ngModule: AuthModule,
1426
- providers: [
1427
- Auth,
1428
- Permissions,
1429
- { provide: AuthConfig, useValue: config },
1430
- { provide: i4.HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true },
1431
- { useFactory: initializeAuth, provide: i0.APP_INITIALIZER, deps: [Auth], multi: true }
1432
- ]
1433
- };
1434
- };
1435
- return AuthModule;
1436
- }());
1437
- AuthModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: AuthModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1438
- AuthModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: AuthModule, declarations: [BbAuthenticated,
1439
- BbRole,
1440
- BbPermission], imports: [i4.HttpClientModule], exports: [BbAuthenticated,
1441
- BbRole,
1442
- BbPermission] });
1443
- AuthModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: AuthModule, providers: [
1444
- { provide: AuthMapper, useClass: AuthMapper }
1445
- ], imports: [[i4.HttpClientModule]] });
1446
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.1", ngImport: i0__namespace, type: AuthModule, decorators: [{
1447
- type: i0.NgModule,
1448
- args: [{
1449
- imports: [i4.HttpClientModule],
1450
- declarations: __spreadArray([], __read(DECLARATIONS_EXPORTS)),
1451
- exports: __spreadArray([], __read(DECLARATIONS_EXPORTS)),
1452
- providers: [
1453
- { provide: AuthMapper, useClass: AuthMapper }
1454
- ]
1455
- }]
1456
- }] });
1457
- function initializeAuth(auth) {
1458
- return auth.initialize();
1413
+ var DECLARATIONS_EXPORTS = [
1414
+ BbAuthenticated,
1415
+ BbRole,
1416
+ BbPermission
1417
+ ];
1418
+ var AuthModule = /** @class */ (function () {
1419
+ function AuthModule() {
1420
+ }
1421
+ AuthModule.forRoot = function (config) {
1422
+ return {
1423
+ ngModule: AuthModule,
1424
+ providers: [
1425
+ Auth,
1426
+ Permissions,
1427
+ { provide: AuthConfig, useValue: config },
1428
+ { provide: i4.HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true },
1429
+ { useFactory: initializeAuth, provide: i0.APP_INITIALIZER, deps: [Auth], multi: true }
1430
+ ]
1431
+ };
1432
+ };
1433
+ return AuthModule;
1434
+ }());
1435
+ AuthModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: AuthModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1436
+ AuthModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: AuthModule, declarations: [BbAuthenticated,
1437
+ BbRole,
1438
+ BbPermission], imports: [i4.HttpClientModule], exports: [BbAuthenticated,
1439
+ BbRole,
1440
+ BbPermission] });
1441
+ AuthModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: AuthModule, providers: [
1442
+ { provide: AuthMapper, useClass: AuthMapper }
1443
+ ], imports: [[i4.HttpClientModule]] });
1444
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: AuthModule, decorators: [{
1445
+ type: i0.NgModule,
1446
+ args: [{
1447
+ imports: [i4.HttpClientModule],
1448
+ declarations: __spreadArray([], __read(DECLARATIONS_EXPORTS)),
1449
+ exports: __spreadArray([], __read(DECLARATIONS_EXPORTS)),
1450
+ providers: [
1451
+ { provide: AuthMapper, useClass: AuthMapper }
1452
+ ]
1453
+ }]
1454
+ }] });
1455
+ function initializeAuth(auth) {
1456
+ return auth.initialize();
1459
1457
  }
1460
1458
 
1461
- /**
1462
- * Generated bundle index. Do not edit.
1459
+ /**
1460
+ * Generated bundle index. Do not edit.
1463
1461
  */
1464
1462
 
1465
1463
  exports.Auth = Auth;
@@ -1481,5 +1479,5 @@
1481
1479
 
1482
1480
  Object.defineProperty(exports, '__esModule', { value: true });
1483
1481
 
1484
- })));
1482
+ }));
1485
1483
  //# sourceMappingURL=bravobit-bb-foundation-auth.umd.js.map