@bravobit/bb-foundation 0.26.2 → 0.27.0

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