@cleavelandprice/ngx-lib 2.2.2 → 2.3.8

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 (272) hide show
  1. package/README.md +6 -616
  2. package/active-directory/active-directory.module.d.ts +11 -0
  3. package/active-directory/index.d.ts +5 -0
  4. package/active-directory/model/ad-object.d.ts +13 -0
  5. package/active-directory/model/cache-object.d.ts +4 -0
  6. package/active-directory/model/caching-config.d.ts +4 -0
  7. package/active-directory/model/default-caching-config.d.ts +2 -0
  8. package/active-directory/model/default-config.d.ts +2 -0
  9. package/active-directory/model/default-logging-config.d.ts +2 -0
  10. package/active-directory/model/logging-config.d.ts +6 -0
  11. package/active-directory/model/service-config.d.ts +7 -0
  12. package/active-directory/model/user-or-group.d.ts +7 -0
  13. package/active-directory/model/user.d.ts +23 -0
  14. package/active-directory/public_api.d.ts +8 -0
  15. package/active-directory/services/active-directory.service.d.ts +18 -0
  16. package/authentication/authentication.module.d.ts +20 -0
  17. package/authentication/components/login/login.component.d.ts +13 -0
  18. package/authentication/components/login-form/login-form.component.d.ts +23 -0
  19. package/authentication/index.d.ts +5 -0
  20. package/authentication/model/authenticated-user.d.ts +9 -0
  21. package/authentication/model/authentication-request.d.ts +6 -0
  22. package/{src/authentication → authentication}/model/authentication-token.d.ts +0 -0
  23. package/authentication/model/default-config.d.ts +2 -0
  24. package/authentication/model/login-form-data.d.ts +3 -0
  25. package/authentication/model/service-config.d.ts +3 -0
  26. package/authentication/public_api.d.ts +9 -0
  27. package/authentication/services/authentication.service.d.ts +25 -0
  28. package/dialog/components/base/base.component.d.ts +20 -0
  29. package/dialog/components/confirmation/confirmation.component.d.ts +12 -0
  30. package/dialog/components/input/input.component.d.ts +12 -0
  31. package/dialog/components/message/message.component.d.ts +12 -0
  32. package/dialog/dialog.module.d.ts +17 -0
  33. package/dialog/index.d.ts +5 -0
  34. package/{src/dialog/model/confirmation-dialog-mode.enum.d.ts → dialog/model/confirmation-dialog-mode.d.ts} +0 -0
  35. package/dialog/model/dialog-base-data.d.ts +10 -0
  36. package/dialog/model/dialog-type.d.ts +5 -0
  37. package/dialog/public_api.d.ts +8 -0
  38. package/esm2020/active-directory/active-directory.module.mjs +38 -0
  39. package/esm2020/active-directory/cleavelandprice-ngx-lib-active-directory.mjs +5 -0
  40. package/esm2020/active-directory/model/ad-object.mjs +2 -0
  41. package/esm2020/active-directory/model/cache-object.mjs +3 -0
  42. package/esm2020/active-directory/model/caching-config.mjs +2 -0
  43. package/esm2020/active-directory/model/default-caching-config.mjs +5 -0
  44. package/esm2020/active-directory/model/default-config.mjs +8 -0
  45. package/esm2020/active-directory/model/default-logging-config.mjs +7 -0
  46. package/esm2020/active-directory/model/logging-config.mjs +2 -0
  47. package/esm2020/active-directory/model/service-config.mjs +3 -0
  48. package/esm2020/active-directory/model/user-or-group.mjs +2 -0
  49. package/esm2020/active-directory/model/user.mjs +2 -0
  50. package/esm2020/active-directory/public_api.mjs +9 -0
  51. package/esm2020/active-directory/services/active-directory.service.mjs +89 -0
  52. package/esm2020/authentication/authentication.module.mjs +77 -0
  53. package/esm2020/authentication/cleavelandprice-ngx-lib-authentication.mjs +5 -0
  54. package/esm2020/authentication/components/login/login.component.mjs +39 -0
  55. package/esm2020/authentication/components/login-form/login-form.component.mjs +60 -0
  56. package/esm2020/authentication/model/authenticated-user.mjs +2 -0
  57. package/esm2020/authentication/model/authentication-request.mjs +2 -0
  58. package/esm2020/authentication/model/authentication-token.mjs +2 -0
  59. package/esm2020/authentication/model/default-config.mjs +4 -0
  60. package/esm2020/authentication/model/login-form-data.mjs +2 -0
  61. package/esm2020/authentication/model/service-config.mjs +3 -0
  62. package/esm2020/authentication/public_api.mjs +11 -0
  63. package/esm2020/authentication/services/authentication.service.mjs +120 -0
  64. package/esm2020/cleavelandprice-ngx-lib.mjs +1 -1
  65. package/esm2020/dialog/cleavelandprice-ngx-lib-dialog.mjs +5 -0
  66. package/esm2020/dialog/components/base/base.component.mjs +84 -0
  67. package/esm2020/dialog/components/confirmation/confirmation.component.mjs +23 -0
  68. package/esm2020/dialog/components/input/input.component.mjs +23 -0
  69. package/esm2020/dialog/components/message/message.component.mjs +23 -0
  70. package/esm2020/dialog/dialog.module.mjs +63 -0
  71. package/esm2020/dialog/model/confirmation-dialog-mode.mjs +8 -0
  72. package/esm2020/dialog/model/dialog-base-data.mjs +2 -0
  73. package/esm2020/dialog/model/dialog-type.mjs +7 -0
  74. package/esm2020/dialog/public_api.mjs +9 -0
  75. package/esm2020/lib/ngx-lib.module.mjs +16 -0
  76. package/esm2020/public_api.mjs +5 -8
  77. package/esm2020/sharepoint/cleavelandprice-ngx-lib-sharepoint.mjs +5 -0
  78. package/esm2020/sharepoint/model/base-item.mjs +2 -0
  79. package/esm2020/sharepoint/model/base-request-credential.mjs +2 -0
  80. package/esm2020/sharepoint/model/base-request.mjs +2 -0
  81. package/esm2020/sharepoint/model/cache-object.mjs +3 -0
  82. package/esm2020/sharepoint/model/caching-config.mjs +2 -0
  83. package/esm2020/sharepoint/model/default-config.mjs +25 -0
  84. package/esm2020/sharepoint/model/file-request.mjs +2 -0
  85. package/esm2020/sharepoint/model/folder-request.mjs +2 -0
  86. package/esm2020/sharepoint/model/list-item.mjs +2 -0
  87. package/esm2020/sharepoint/model/list-items-request.mjs +2 -0
  88. package/esm2020/sharepoint/model/logging-config.mjs +2 -0
  89. package/esm2020/sharepoint/model/photo-item.mjs +2 -0
  90. package/esm2020/sharepoint/model/service-config.mjs +3 -0
  91. package/esm2020/sharepoint/model/uri-request.mjs +2 -0
  92. package/esm2020/sharepoint/model/user-request.mjs +2 -0
  93. package/esm2020/sharepoint/model/user.mjs +2 -0
  94. package/esm2020/sharepoint/public_api.mjs +18 -0
  95. package/esm2020/sharepoint/services/sharepoint.service.mjs +152 -0
  96. package/esm2020/sharepoint/sharepoint.module.mjs +38 -0
  97. package/esm2020/upload/cleavelandprice-ngx-lib-upload.mjs +5 -0
  98. package/esm2020/upload/components/upload/upload.component.mjs +33 -0
  99. package/esm2020/upload/components/upload-dialog/upload-dialog.component.mjs +92 -0
  100. package/esm2020/upload/model/database-file-info.mjs +2 -0
  101. package/esm2020/upload/model/file-upload-request.mjs +2 -0
  102. package/esm2020/upload/model/filesystem-file-info.mjs +2 -0
  103. package/esm2020/upload/model/service-config.mjs +3 -0
  104. package/esm2020/upload/public_api.mjs +9 -0
  105. package/esm2020/upload/services/upload.service.mjs +93 -0
  106. package/esm2020/upload/upload.module.mjs +61 -0
  107. package/esm2020/url-utilities/cleavelandprice-ngx-lib-url-utilities.mjs +5 -0
  108. package/esm2020/url-utilities/pipes/safe-resource-url.pipe.mjs +20 -0
  109. package/esm2020/url-utilities/pipes/safe-url.pipe.mjs +20 -0
  110. package/esm2020/url-utilities/pipes/uri-scheme.pipe.mjs +105 -0
  111. package/esm2020/url-utilities/public_api.mjs +5 -0
  112. package/esm2020/url-utilities/url-utilities.module.mjs +34 -0
  113. package/fesm2015/cleavelandprice-ngx-lib-active-directory.mjs +156 -0
  114. package/fesm2015/cleavelandprice-ngx-lib-active-directory.mjs.map +1 -0
  115. package/fesm2015/cleavelandprice-ngx-lib-authentication.mjs +299 -0
  116. package/fesm2015/cleavelandprice-ngx-lib-authentication.mjs.map +1 -0
  117. package/fesm2015/cleavelandprice-ngx-lib-dialog.mjs +218 -0
  118. package/fesm2015/cleavelandprice-ngx-lib-dialog.mjs.map +1 -0
  119. package/fesm2015/cleavelandprice-ngx-lib-sharepoint.mjs +233 -0
  120. package/fesm2015/cleavelandprice-ngx-lib-sharepoint.mjs.map +1 -0
  121. package/fesm2015/cleavelandprice-ngx-lib-upload.mjs +280 -0
  122. package/fesm2015/cleavelandprice-ngx-lib-upload.mjs.map +1 -0
  123. package/fesm2015/cleavelandprice-ngx-lib-url-utilities.mjs +176 -0
  124. package/fesm2015/cleavelandprice-ngx-lib-url-utilities.mjs.map +1 -0
  125. package/fesm2015/cleavelandprice-ngx-lib.mjs +11 -1398
  126. package/fesm2015/cleavelandprice-ngx-lib.mjs.map +1 -1
  127. package/fesm2020/cleavelandprice-ngx-lib-active-directory.mjs +147 -0
  128. package/fesm2020/cleavelandprice-ngx-lib-active-directory.mjs.map +1 -0
  129. package/fesm2020/cleavelandprice-ngx-lib-authentication.mjs +290 -0
  130. package/fesm2020/cleavelandprice-ngx-lib-authentication.mjs.map +1 -0
  131. package/fesm2020/cleavelandprice-ngx-lib-dialog.mjs +212 -0
  132. package/fesm2020/cleavelandprice-ngx-lib-dialog.mjs.map +1 -0
  133. package/fesm2020/cleavelandprice-ngx-lib-sharepoint.mjs +219 -0
  134. package/fesm2020/cleavelandprice-ngx-lib-sharepoint.mjs.map +1 -0
  135. package/fesm2020/cleavelandprice-ngx-lib-upload.mjs +273 -0
  136. package/fesm2020/cleavelandprice-ngx-lib-upload.mjs.map +1 -0
  137. package/fesm2020/cleavelandprice-ngx-lib-url-utilities.mjs +176 -0
  138. package/fesm2020/cleavelandprice-ngx-lib-url-utilities.mjs.map +1 -0
  139. package/fesm2020/cleavelandprice-ngx-lib.mjs +11 -1370
  140. package/fesm2020/cleavelandprice-ngx-lib.mjs.map +1 -1
  141. package/lib/ngx-lib.module.d.ts +6 -0
  142. package/package.json +57 -12
  143. package/public_api.d.ts +1 -7
  144. package/sharepoint/index.d.ts +5 -0
  145. package/sharepoint/model/base-item.d.ts +4 -0
  146. package/sharepoint/model/base-request-credential.d.ts +4 -0
  147. package/sharepoint/model/base-request.d.ts +8 -0
  148. package/sharepoint/model/cache-object.d.ts +4 -0
  149. package/sharepoint/model/caching-config.d.ts +4 -0
  150. package/sharepoint/model/default-config.d.ts +2 -0
  151. package/sharepoint/model/file-request.d.ts +4 -0
  152. package/sharepoint/model/folder-request.d.ts +4 -0
  153. package/sharepoint/model/list-item.d.ts +10 -0
  154. package/sharepoint/model/list-items-request.d.ts +5 -0
  155. package/sharepoint/model/logging-config.d.ts +6 -0
  156. package/sharepoint/model/photo-item.d.ts +11 -0
  157. package/sharepoint/model/service-config.d.ts +16 -0
  158. package/sharepoint/model/uri-request.d.ts +4 -0
  159. package/sharepoint/model/user-request.d.ts +4 -0
  160. package/sharepoint/model/user.d.ts +12 -0
  161. package/sharepoint/public_api.d.ts +16 -0
  162. package/sharepoint/services/sharepoint.service.d.ts +25 -0
  163. package/sharepoint/sharepoint.module.d.ts +11 -0
  164. package/{src/file-upload → upload}/components/upload/upload.component.d.ts +0 -0
  165. package/{src/file-upload → upload}/components/upload-dialog/upload-dialog.component.d.ts +3 -3
  166. package/upload/index.d.ts +5 -0
  167. package/{src/file-upload → upload}/model/database-file-info.d.ts +0 -0
  168. package/{src/file-upload → upload}/model/file-upload-request.d.ts +0 -0
  169. package/{src/file-upload → upload}/model/filesystem-file-info.d.ts +0 -0
  170. package/{src/file-upload/model/upload.service.config.d.ts → upload/model/service-config.d.ts} +1 -1
  171. package/upload/public_api.d.ts +8 -0
  172. package/{src/file-upload → upload}/services/upload.service.d.ts +6 -8
  173. package/upload/upload.module.d.ts +16 -0
  174. package/url-utilities/index.d.ts +5 -0
  175. package/url-utilities/pipes/safe-resource-url.pipe.d.ts +10 -0
  176. package/{src/url → url-utilities}/pipes/safe-url.pipe.d.ts +0 -0
  177. package/{src/url → url-utilities}/pipes/uri-scheme.pipe.d.ts +1 -1
  178. package/url-utilities/public_api.d.ts +4 -0
  179. package/url-utilities/url-utilities.module.d.ts +10 -0
  180. package/esm2020/src/authentication/authentication.module.mjs +0 -112
  181. package/esm2020/src/authentication/components/login/login.component.mjs +0 -40
  182. package/esm2020/src/authentication/components/login-form/login-form.component.mjs +0 -45
  183. package/esm2020/src/authentication/model/authentication-token.mjs +0 -2
  184. package/esm2020/src/authentication/model/authentication.service.config.mjs +0 -3
  185. package/esm2020/src/authentication/services/authentication.service.mjs +0 -138
  186. package/esm2020/src/dialog/components/_dialog/dialog.component.mjs +0 -83
  187. package/esm2020/src/dialog/components/confirmation-dialog/confirmation-dialog.component.mjs +0 -21
  188. package/esm2020/src/dialog/components/input-dialog/input-dialog.component.mjs +0 -21
  189. package/esm2020/src/dialog/components/message-dialog/message-dialog.component.mjs +0 -21
  190. package/esm2020/src/dialog/dialog.module.mjs +0 -74
  191. package/esm2020/src/dialog/model/confirmation-dialog-mode.enum.mjs +0 -8
  192. package/esm2020/src/email/email.module.mjs +0 -47
  193. package/esm2020/src/email/model/email-dto.mjs +0 -2
  194. package/esm2020/src/email/model/email-sender.mjs +0 -2
  195. package/esm2020/src/email/model/email.mjs +0 -2
  196. package/esm2020/src/email/model/email.service.config.mjs +0 -3
  197. package/esm2020/src/email/services/email.service.mjs +0 -31
  198. package/esm2020/src/employee/employee.module.mjs +0 -91
  199. package/esm2020/src/employee/model/employee.mjs +0 -2
  200. package/esm2020/src/employee/model/employee.service.config.mjs +0 -3
  201. package/esm2020/src/employee/pipes/departments.pipe.mjs +0 -24
  202. package/esm2020/src/employee/pipes/employee-by-dn.pipe.mjs +0 -17
  203. package/esm2020/src/employee/pipes/employee-photo-url.pipe.mjs +0 -27
  204. package/esm2020/src/employee/pipes/employees-with-property-value.pipe.mjs +0 -17
  205. package/esm2020/src/employee/pipes/filter-employees.pipe.mjs +0 -22
  206. package/esm2020/src/employee/pipes/is-member-of.pipe.mjs +0 -17
  207. package/esm2020/src/employee/pipes/sort-employees.pipe.mjs +0 -44
  208. package/esm2020/src/employee/services/employee.service.mjs +0 -41
  209. package/esm2020/src/file-upload/components/upload/upload.component.mjs +0 -34
  210. package/esm2020/src/file-upload/components/upload-dialog/upload-dialog.component.mjs +0 -102
  211. package/esm2020/src/file-upload/model/database-file-info.mjs +0 -2
  212. package/esm2020/src/file-upload/model/file-upload-request.mjs +0 -2
  213. package/esm2020/src/file-upload/model/filesystem-file-info.mjs +0 -2
  214. package/esm2020/src/file-upload/model/upload.service.config.mjs +0 -3
  215. package/esm2020/src/file-upload/services/upload.service.mjs +0 -93
  216. package/esm2020/src/file-upload/upload.module.mjs +0 -93
  217. package/esm2020/src/sharepoint/model/sharepoint-calendar-event.mjs +0 -2
  218. package/esm2020/src/sharepoint/model/sharepoint-customer-visit.mjs +0 -2
  219. package/esm2020/src/sharepoint/model/sharepoint-employee-picture.mjs +0 -2
  220. package/esm2020/src/sharepoint/model/sharepoint-list-item.mjs +0 -2
  221. package/esm2020/src/sharepoint/model/sharepoint-list.mjs +0 -2
  222. package/esm2020/src/sharepoint/model/sharepoint-person.mjs +0 -2
  223. package/esm2020/src/sharepoint/model/sharepoint-picture.mjs +0 -2
  224. package/esm2020/src/sharepoint/model/sharepoint.service.config.mjs +0 -3
  225. package/esm2020/src/sharepoint/pipes/sharepoint-photo-url.pipe.mjs +0 -16
  226. package/esm2020/src/sharepoint/pipes/sharepoint-url.pipe.mjs +0 -16
  227. package/esm2020/src/sharepoint/services/sharepoint.service.mjs +0 -77
  228. package/esm2020/src/sharepoint/sharepoint.module.mjs +0 -69
  229. package/esm2020/src/url/pipes/safe-url.pipe.mjs +0 -21
  230. package/esm2020/src/url/pipes/uri-scheme.pipe.mjs +0 -103
  231. package/esm2020/src/url/url.module.mjs +0 -38
  232. package/src/authentication/authentication.module.d.ts +0 -31
  233. package/src/authentication/components/login/login.component.d.ts +0 -15
  234. package/src/authentication/components/login-form/login-form.component.d.ts +0 -20
  235. package/src/authentication/model/authentication.service.config.d.ts +0 -3
  236. package/src/authentication/services/authentication.service.d.ts +0 -68
  237. package/src/dialog/components/_dialog/dialog.component.d.ts +0 -22
  238. package/src/dialog/components/confirmation-dialog/confirmation-dialog.component.d.ts +0 -9
  239. package/src/dialog/components/input-dialog/input-dialog.component.d.ts +0 -9
  240. package/src/dialog/components/message-dialog/message-dialog.component.d.ts +0 -9
  241. package/src/dialog/dialog.module.d.ts +0 -20
  242. package/src/email/email.module.d.ts +0 -14
  243. package/src/email/model/email-dto.d.ts +0 -13
  244. package/src/email/model/email-sender.d.ts +0 -6
  245. package/src/email/model/email.d.ts +0 -9
  246. package/src/email/model/email.service.config.d.ts +0 -7
  247. package/src/email/services/email.service.d.ts +0 -13
  248. package/src/employee/employee.module.d.ts +0 -28
  249. package/src/employee/model/employee.d.ts +0 -35
  250. package/src/employee/model/employee.service.config.d.ts +0 -3
  251. package/src/employee/pipes/departments.pipe.d.ts +0 -8
  252. package/src/employee/pipes/employee-by-dn.pipe.d.ts +0 -8
  253. package/src/employee/pipes/employee-photo-url.pipe.d.ts +0 -9
  254. package/src/employee/pipes/employees-with-property-value.pipe.d.ts +0 -8
  255. package/src/employee/pipes/filter-employees.pipe.d.ts +0 -8
  256. package/src/employee/pipes/is-member-of.pipe.d.ts +0 -8
  257. package/src/employee/pipes/sort-employees.pipe.d.ts +0 -9
  258. package/src/employee/services/employee.service.d.ts +0 -15
  259. package/src/file-upload/upload.module.d.ts +0 -26
  260. package/src/sharepoint/model/sharepoint-calendar-event.d.ts +0 -6
  261. package/src/sharepoint/model/sharepoint-customer-visit.d.ts +0 -8
  262. package/src/sharepoint/model/sharepoint-employee-picture.d.ts +0 -5
  263. package/src/sharepoint/model/sharepoint-list-item.d.ts +0 -11
  264. package/src/sharepoint/model/sharepoint-list.d.ts +0 -8
  265. package/src/sharepoint/model/sharepoint-person.d.ts +0 -9
  266. package/src/sharepoint/model/sharepoint-picture.d.ts +0 -14
  267. package/src/sharepoint/model/sharepoint.service.config.d.ts +0 -5
  268. package/src/sharepoint/pipes/sharepoint-photo-url.pipe.d.ts +0 -8
  269. package/src/sharepoint/pipes/sharepoint-url.pipe.d.ts +0 -7
  270. package/src/sharepoint/services/sharepoint.service.d.ts +0 -23
  271. package/src/sharepoint/sharepoint.module.d.ts +0 -24
  272. package/src/url/url.module.d.ts +0 -11
@@ -0,0 +1,156 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, Optional, NgModule, SkipSelf } from '@angular/core';
3
+ import { of } from 'rxjs';
4
+ import moment from 'moment';
5
+ import * as i2 from '@angular/common/http';
6
+ import { CommonModule } from '@angular/common';
7
+
8
+ class ServiceConfig {
9
+ }
10
+
11
+ const defaultCachingConfig = {
12
+ enabled: false,
13
+ lifeMinutes: 720
14
+ };
15
+
16
+ const defaultLoggingConfig = {
17
+ dataCached: false,
18
+ cachedDataReturned: false,
19
+ freshDataReturned: false,
20
+ cacheCleared: false
21
+ };
22
+
23
+ const defaultConfig = {
24
+ apiUrl: 'http://utilityapi/users',
25
+ caching: defaultCachingConfig,
26
+ logging: defaultLoggingConfig
27
+ };
28
+
29
+ //#region Imports
30
+ //#endregion
31
+ class ActiveDirectoryService {
32
+ //#endregion
33
+ //#region Initialization
34
+ // If a ServiceConfig object is not provided when the module is imported, then default values are pulled in from default-config.ts.
35
+ constructor(config, http) {
36
+ var _a, _b, _c;
37
+ this.config = config;
38
+ this.http = http;
39
+ this.cache = null;
40
+ this.defaultCacheLifeMinutes = 720;
41
+ this.config = (_a = this.config) !== null && _a !== void 0 ? _a : defaultConfig;
42
+ this.config.caching = (_b = this.config.caching) !== null && _b !== void 0 ? _b : defaultCachingConfig;
43
+ this.config.logging = (_c = this.config.logging) !== null && _c !== void 0 ? _c : defaultLoggingConfig;
44
+ }
45
+ //#region Properties
46
+ get cacheExpired() {
47
+ var _a, _b;
48
+ if (!this.cache) {
49
+ return true;
50
+ }
51
+ const lifeMinutes = (_b = (_a = this.config.caching) === null || _a === void 0 ? void 0 : _a.lifeMinutes) !== null && _b !== void 0 ? _b : this.defaultCacheLifeMinutes;
52
+ const expiration = moment(this.cache.lastUpdate)
53
+ .add(lifeMinutes, 'minutes');
54
+ return moment().isAfter(expiration);
55
+ }
56
+ //#endregion
57
+ getUsers(includePhoto = false, includeDisabled = false, parentOU) {
58
+ var _a, _b, _c;
59
+ // If caching is enabled, there will be two calls to the API if the cache is null/expired
60
+ // One call is to update the cache and the other is to return the data that the user requested
61
+ // Subsequent calls will bypass the API and returned cached data until it expires
62
+ const observable$ = this.http.get(`${this.config.apiUrl}/${includePhoto}/${includeDisabled}/${parentOU !== null && parentOU !== void 0 ? parentOU : ''}`);
63
+ if ((_a = this.config.caching) === null || _a === void 0 ? void 0 : _a.enabled) {
64
+ if (this.cacheExpired) {
65
+ // Get the data and cache it
66
+ observable$.subscribe(data => {
67
+ var _a, _b, _c;
68
+ this.cache = {
69
+ data,
70
+ lastUpdate: moment()
71
+ };
72
+ if ((_a = this.config.logging) === null || _a === void 0 ? void 0 : _a.dataCached) {
73
+ const lifeMinutes = (_c = (_b = this.config.caching) === null || _b === void 0 ? void 0 : _b.lifeMinutes) !== null && _c !== void 0 ? _c : this.defaultCacheLifeMinutes;
74
+ console.log(`Data cached for ${lifeMinutes} minutes`);
75
+ }
76
+ });
77
+ }
78
+ else {
79
+ // Cache exists and hasn't expired yet
80
+ if ((_b = this.config.logging) === null || _b === void 0 ? void 0 : _b.cachedDataReturned) {
81
+ console.log('Returning cached users');
82
+ }
83
+ return of(this.cache.data);
84
+ }
85
+ }
86
+ // Cache is either disabled or expired, return data from API
87
+ if ((_c = this.config.logging) === null || _c === void 0 ? void 0 : _c.freshDataReturned) {
88
+ console.log('Returning fresh users');
89
+ }
90
+ return observable$;
91
+ }
92
+ getUser(accountName, includePhoto = false) {
93
+ return this.http.get(`${this.config.apiUrl}/name/${accountName}/${includePhoto}`);
94
+ }
95
+ clearCache() {
96
+ var _a;
97
+ this.cache = null;
98
+ if ((_a = this.config.logging) === null || _a === void 0 ? void 0 : _a.cacheCleared) {
99
+ console.log('Cache cleared');
100
+ }
101
+ }
102
+ }
103
+ ActiveDirectoryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ActiveDirectoryService, deps: [{ token: ServiceConfig, optional: true }, { token: i2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
104
+ ActiveDirectoryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ActiveDirectoryService, providedIn: 'root' });
105
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ActiveDirectoryService, decorators: [{
106
+ type: Injectable,
107
+ args: [{
108
+ providedIn: 'root'
109
+ }]
110
+ }], ctorParameters: function () {
111
+ return [{ type: ServiceConfig, decorators: [{
112
+ type: Optional
113
+ }] }, { type: i2.HttpClient }];
114
+ } });
115
+
116
+ class ActiveDirectoryModule {
117
+ constructor(parentModule) {
118
+ if (parentModule) {
119
+ throw new Error('ActiveDirectoryModule is already loaded. Import it in the AppModule only');
120
+ }
121
+ }
122
+ static forRoot(config) {
123
+ return {
124
+ ngModule: ActiveDirectoryModule,
125
+ providers: [
126
+ ActiveDirectoryService,
127
+ { provide: ServiceConfig, useValue: config }
128
+ ]
129
+ };
130
+ }
131
+ }
132
+ ActiveDirectoryModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ActiveDirectoryModule, deps: [{ token: ActiveDirectoryModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule });
133
+ ActiveDirectoryModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0", ngImport: i0, type: ActiveDirectoryModule, imports: [CommonModule] });
134
+ ActiveDirectoryModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ActiveDirectoryModule, imports: [CommonModule] });
135
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ActiveDirectoryModule, decorators: [{
136
+ type: NgModule,
137
+ args: [{
138
+ declarations: [],
139
+ imports: [
140
+ CommonModule
141
+ ]
142
+ }]
143
+ }], ctorParameters: function () {
144
+ return [{ type: ActiveDirectoryModule, decorators: [{
145
+ type: Optional
146
+ }, {
147
+ type: SkipSelf
148
+ }] }];
149
+ } });
150
+
151
+ /**
152
+ * Generated bundle index. Do not edit.
153
+ */
154
+
155
+ export { ActiveDirectoryModule, ActiveDirectoryService, ServiceConfig };
156
+ //# sourceMappingURL=cleavelandprice-ngx-lib-active-directory.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cleavelandprice-ngx-lib-active-directory.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/active-directory/src/model/service-config.ts","../../../../projects/cleavelandprice/ngx-lib/active-directory/src/model/default-caching-config.ts","../../../../projects/cleavelandprice/ngx-lib/active-directory/src/model/default-logging-config.ts","../../../../projects/cleavelandprice/ngx-lib/active-directory/src/model/default-config.ts","../../../../projects/cleavelandprice/ngx-lib/active-directory/src/services/active-directory.service.ts","../../../../projects/cleavelandprice/ngx-lib/active-directory/src/active-directory.module.ts","../../../../projects/cleavelandprice/ngx-lib/active-directory/src/cleavelandprice-ngx-lib-active-directory.ts"],"sourcesContent":["import { CachingConfig } from \"./caching-config\";\r\nimport { LoggingConfig } from './logging-config';\r\n\r\nexport class ServiceConfig {\r\n apiUrl!: string;\r\n caching?: CachingConfig;\r\n logging?: LoggingConfig;\r\n}\r\n","import { CachingConfig } from \"./caching-config\";\r\n\r\nexport const defaultCachingConfig: CachingConfig = {\r\n enabled: false,\r\n lifeMinutes: 720\r\n}","import { LoggingConfig } from \"./logging-config\";\r\n\r\nexport const defaultLoggingConfig: LoggingConfig = {\r\n dataCached: false,\r\n cachedDataReturned: false,\r\n freshDataReturned: false,\r\n cacheCleared: false\r\n}","import { ServiceConfig } from \"./service-config\";\r\nimport { defaultCachingConfig } from './default-caching-config';\r\nimport { defaultLoggingConfig } from \"./default-logging-config\";\r\n\r\nexport const defaultConfig: ServiceConfig = {\r\n apiUrl: 'http://utilityapi/users',\r\n caching: defaultCachingConfig,\r\n logging: defaultLoggingConfig\r\n}","//#region Imports\nimport { Injectable, Optional } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { Observable, of } from 'rxjs';\n\nimport { defaultConfig } from '../model/default-config';\nimport { defaultCachingConfig } from '../model/default-caching-config';\nimport { defaultLoggingConfig } from '../model/default-logging-config';\n\nimport { CacheObject } from '../model/cache-object';\nimport { ServiceConfig } from '../model/service-config';\nimport { User } from '../model/user';\n\nimport moment from 'moment';\n//#endregion\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ActiveDirectoryService {\n private cache: CacheObject<User> | null = null;\n private defaultCacheLifeMinutes = 720;\n\n //#region Properties\n private get cacheExpired(): boolean {\n if (!this.cache) {\n return true;\n }\n\n const lifeMinutes = this.config.caching?.lifeMinutes ?? this.defaultCacheLifeMinutes;\n const expiration = moment(this.cache.lastUpdate)\n .add(lifeMinutes, 'minutes');\n\n return moment().isAfter(expiration);\n }\n //#endregion\n\n //#region Initialization\n // If a ServiceConfig object is not provided when the module is imported, then default values are pulled in from default-config.ts.\n constructor(@Optional() private config: ServiceConfig,\n private http: HttpClient) {\n\n this.config = this.config ?? defaultConfig;\n this.config.caching = this.config.caching ?? defaultCachingConfig;\n this.config.logging = this.config.logging ?? defaultLoggingConfig;\n }\n //#endregion\n\n getUsers(includePhoto = false, includeDisabled = false, parentOU?: string): Observable<User[]> {\n // If caching is enabled, there will be two calls to the API if the cache is null/expired\n // One call is to update the cache and the other is to return the data that the user requested\n // Subsequent calls will bypass the API and returned cached data until it expires\n\n const observable$ = this.http.get<User[]>(`${this.config.apiUrl}/${includePhoto}/${includeDisabled}/${parentOU ?? ''}`);\n\n if (this.config.caching?.enabled) {\n if (this.cacheExpired) {\n // Get the data and cache it\n observable$.subscribe(data => {\n this.cache = {\n data,\n lastUpdate: moment()\n };\n\n if (this.config.logging?.dataCached) {\n const lifeMinutes = this.config.caching?.lifeMinutes ?? this.defaultCacheLifeMinutes;\n console.log(`Data cached for ${lifeMinutes} minutes`);\n }\n });\n } else {\n // Cache exists and hasn't expired yet\n if (this.config.logging?.cachedDataReturned) {\n console.log('Returning cached users');\n }\n\n return of(this.cache!.data);\n }\n }\n\n // Cache is either disabled or expired, return data from API\n if (this.config.logging?.freshDataReturned) {\n console.log('Returning fresh users');\n }\n\n return observable$;\n }\n\n getUser(accountName: string, includePhoto = false): Observable<User> {\n return this.http.get<User>(`${this.config.apiUrl}/name/${accountName}/${includePhoto}`);\n }\n\n clearCache(): void {\n this.cache = null;\n\n if (this.config.logging?.cacheCleared) {\n console.log('Cache cleared');\n }\n }\n}\n","import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ServiceConfig } from './model/service-config';\nimport { ActiveDirectoryService } from './services/active-directory.service';\n\n@NgModule({\n declarations: [],\n imports: [\n CommonModule\n ]\n})\nexport class ActiveDirectoryModule {\n static forRoot(config: ServiceConfig): ModuleWithProviders<ActiveDirectoryModule> {\n return {\n ngModule: ActiveDirectoryModule,\n providers: [\n ActiveDirectoryService,\n { provide: ServiceConfig, useValue: config }\n ]\n };\n }\n\n constructor( @Optional() @SkipSelf() parentModule: ActiveDirectoryModule) {\n if (parentModule) {\n throw new Error(\n 'ActiveDirectoryModule is already loaded. Import it in the AppModule only');\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1.ServiceConfig"],"mappings":";;;;;;;MAGa,aAAa,CAAA;AAIzB;;ACLM,MAAM,oBAAoB,GAAkB;AAC/C,IAAA,OAAO,EAAE,KAAK;AACd,IAAA,WAAW,EAAE,GAAG;CACnB;;ACHM,MAAM,oBAAoB,GAAkB;AAC/C,IAAA,UAAU,EAAE,KAAK;AACjB,IAAA,kBAAkB,EAAE,KAAK;AACzB,IAAA,iBAAiB,EAAE,KAAK;AACxB,IAAA,YAAY,EAAE,KAAK;CACtB;;ACHM,MAAM,aAAa,GAAkB;AACxC,IAAA,MAAM,EAAE,yBAAyB;AACjC,IAAA,OAAO,EAAE,oBAAoB;AAC7B,IAAA,OAAO,EAAE,oBAAoB;CAChC;;ACRD;AAcA;MAKa,sBAAsB,CAAA;;;;IAoBjC,WAAgC,CAAA,MAAqB,EACjC,IAAgB,EAAA;;AADJ,QAAA,IAAM,CAAA,MAAA,GAAN,MAAM,CAAe;AACjC,QAAA,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAY;AApB5B,QAAA,IAAK,CAAA,KAAA,GAA6B,IAAI,CAAC;AACvC,QAAA,IAAuB,CAAA,uBA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qB,EAAA,UAAA,EAAA,CAAA;kBANjC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;iBACF,CAAA;;wBAYoD,qBAAqB,EAAA,UAAA,EAAA,CAAA;8BAA1D,QAAQ;;8BAAI,QAAQ;;;;ACtBpC;;AAEG;;;;"}
@@ -0,0 +1,299 @@
1
+ import * as i0 from '@angular/core';
2
+ import { EventEmitter, Injectable, Optional, Output, Component, Inject, Input, NgModule, SkipSelf } from '@angular/core';
3
+ import { ConfirmationComponent } from '@cleavelandprice/ngx-lib/dialog';
4
+ import * as i4 from '@angular/forms';
5
+ import { UntypedFormGroup, UntypedFormControl, Validators, ReactiveFormsModule } from '@angular/forms';
6
+ import * as i1 from '@angular/material/dialog';
7
+ import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
8
+ import { JwtHelperService } from '@auth0/angular-jwt';
9
+ import * as i2 from '@angular/common/http';
10
+ import * as i3 from '@cleavelandprice/ngx-lib/sharepoint';
11
+ import * as i3$1 from '@angular/common';
12
+ import { CommonModule } from '@angular/common';
13
+ import * as i5 from '@angular/material/button';
14
+ import { MatButtonModule } from '@angular/material/button';
15
+ import * as i6 from '@angular/material/form-field';
16
+ import { MatFormFieldModule } from '@angular/material/form-field';
17
+ import * as i7 from '@angular/material/icon';
18
+ import { MatIconModule } from '@angular/material/icon';
19
+ import * as i8 from '@angular/material/input';
20
+ import { MatInputModule } from '@angular/material/input';
21
+ import * as i9 from '@angular/material/progress-spinner';
22
+ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
23
+
24
+ class ServiceConfig {
25
+ }
26
+
27
+ const defaultConfig = {
28
+ apiUrl: 'http://utilityapi/authenticate/token'
29
+ };
30
+
31
+ //#region Imports
32
+ //#endregion
33
+ class AuthenticationService {
34
+ //#endregion
35
+ //#region Lifecycle
36
+ // If a ServiceConfig object is not provided when the module is imported, then default values are pulled in from default-config.ts.
37
+ constructor(config, http, sharePointService) {
38
+ var _a;
39
+ this.config = config;
40
+ this.http = http;
41
+ this.sharePointService = sharePointService;
42
+ //#region Fields
43
+ this.authenticatedChanged = new EventEmitter();
44
+ this.authenticatingChanged = new EventEmitter();
45
+ this.authenticationError = new EventEmitter();
46
+ // Flag set to true while the service is attempting to authenticate the user
47
+ this.authenticating = false;
48
+ //Flag set to true when the user is successfully authenticated
49
+ this.authenticated = false;
50
+ this.config = (_a = this.config) !== null && _a !== void 0 ? _a : defaultConfig;
51
+ this.checkForExistingToken();
52
+ }
53
+ //#endregion
54
+ //#region Utilities
55
+ //Authenticate the user and store the token in Local Storage
56
+ login(username, password, adminGroup) {
57
+ const today = new Date();
58
+ //const expiration = new Date().setFullYear(today.getFullYear() + 10);
59
+ const request = {
60
+ username: username,
61
+ password: password,
62
+ adminGroup: adminGroup
63
+ //expirationDate: expiration // moment().add(10, 'years').toDate()
64
+ };
65
+ this.authenticating = true;
66
+ this.authenticatingChanged.emit(this.authenticating);
67
+ // Sending a 'raw' POST request so that we can tell HttpClient that we are expecting text instead of Json
68
+ // Otherwise, it would throw an error trying to decode Json from the response
69
+ this.http.request('POST', this.config.apiUrl, { body: request, responseType: 'text' })
70
+ .subscribe(token => this.validateUser(token), err => {
71
+ //console.log('Authentication error', err);
72
+ this.authenticating = false;
73
+ this.authenticatingChanged.emit(this.authenticating);
74
+ this.authenticationError.emit(err);
75
+ });
76
+ }
77
+ //Logout the user and delete the token from Local Storage
78
+ logout() {
79
+ if (localStorage.getItem('token')) {
80
+ localStorage.removeItem('token');
81
+ }
82
+ this.authenticatedUser = null;
83
+ this.authenticated = false;
84
+ this.authenticatedChanged.emit(false);
85
+ }
86
+ validateUser(token) {
87
+ if (!token) {
88
+ return;
89
+ }
90
+ const jwtHelper = new JwtHelperService();
91
+ const decoded = jwtHelper.decodeToken(token);
92
+ if (jwtHelper.isTokenExpired(token)) {
93
+ this.logout();
94
+ return;
95
+ }
96
+ this.authenticatedUser = {
97
+ admin: decoded.role === 'Admin',
98
+ displayName: decoded.displayName,
99
+ accountName: decoded.winaccountname,
100
+ distinguishedName: decoded.distinguishedName,
101
+ employeeNumber: decoded.employeeNumber,
102
+ memberOf: decoded.memberOf
103
+ };
104
+ localStorage.setItem('token', token);
105
+ this.getPhoto();
106
+ this.authenticated = true;
107
+ this.authenticatedChanged.emit(this.authenticated);
108
+ this.authenticating = false;
109
+ this.authenticatingChanged.emit(this.authenticating);
110
+ }
111
+ getPhoto() {
112
+ this.sharePointService.getPhotos()
113
+ .subscribe(photos => {
114
+ var _a;
115
+ // The user may have been logged out by the time the photos came back
116
+ if (!((_a = this.authenticatedUser) === null || _a === void 0 ? void 0 : _a.employeeNumber)) {
117
+ return;
118
+ }
119
+ const photo = photos.find(pic => pic.employeeNumber === +this.authenticatedUser.employeeNumber);
120
+ if (photo) {
121
+ this.authenticatedUser.photoUrl = photo.encodedAbsUrl;
122
+ }
123
+ });
124
+ }
125
+ checkForExistingToken() {
126
+ this.validateUser(localStorage.getItem('token'));
127
+ }
128
+ }
129
+ AuthenticationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: AuthenticationService, deps: [{ token: ServiceConfig, optional: true }, { token: i2.HttpClient }, { token: i3.SharepointService }], target: i0.ɵɵFactoryTarget.Injectable });
130
+ AuthenticationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: AuthenticationService, providedIn: 'root' });
131
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: AuthenticationService, decorators: [{
132
+ type: Injectable,
133
+ args: [{
134
+ providedIn: 'root'
135
+ }]
136
+ }], ctorParameters: function () {
137
+ return [{ type: ServiceConfig, decorators: [{
138
+ type: Optional
139
+ }] }, { type: i2.HttpClient }, { type: i3.SharepointService }];
140
+ }, propDecorators: { authenticatedChanged: [{
141
+ type: Output
142
+ }], authenticatingChanged: [{
143
+ type: Output
144
+ }], authenticationError: [{
145
+ type: Output
146
+ }] } });
147
+
148
+ class LoginFormComponent {
149
+ constructor(data, dialogRef, authenticationService) {
150
+ var _a;
151
+ this.dialogRef = dialogRef;
152
+ this.authenticationService = authenticationService;
153
+ this.errorMessage = null;
154
+ this.form = new UntypedFormGroup({
155
+ username: new UntypedFormControl(null, [Validators.required]),
156
+ password: new UntypedFormControl(null, [Validators.required]),
157
+ adminGroup: new UntypedFormControl()
158
+ });
159
+ (_a = this.form.get('adminGroup')) === null || _a === void 0 ? void 0 : _a.setValue(data.adminGroup);
160
+ }
161
+ ngOnInit() {
162
+ this.authenticatedChangedSubscription = this.authenticationService.authenticatedChanged
163
+ .subscribe(this.authChangedHandler.bind(this));
164
+ this.authenticationErrorSubscription = this.authenticationService.authenticationError
165
+ .subscribe(this.errorHandler.bind(this));
166
+ }
167
+ ngOnDestroy() {
168
+ this.authenticationErrorSubscription.unsubscribe();
169
+ this.authenticatedChangedSubscription.unsubscribe();
170
+ }
171
+ authenticate() {
172
+ this.errorMessage = null;
173
+ const { username, password, adminGroup } = this.form.value;
174
+ this.authenticationService.login(username, password, adminGroup);
175
+ }
176
+ authChangedHandler(authenticated) {
177
+ if (authenticated) {
178
+ this.dialogRef.close();
179
+ }
180
+ }
181
+ errorHandler(err) {
182
+ console.log('Authentication error', err);
183
+ this.errorMessage = `${err.name}: ${err.statusText}`;
184
+ }
185
+ }
186
+ LoginFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: LoginFormComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }, { token: AuthenticationService }], target: i0.ɵɵFactoryTarget.Component });
187
+ LoginFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: LoginFormComponent, selector: "authentication-login-form", ngImport: i0, template: "<h2 mat-dialog-title>\n <span *ngIf=\"!authenticationService.authenticating\">Login</span>\n <span *ngIf=\"authenticationService.authenticating\">Authenticating...</span>\n</h2>\n\n<mat-dialog-content>\n <div id=\"spinner\" *ngIf=\"authenticationService.authenticating\">\n <mat-progress-spinner color=\"primary\" mode=\"indeterminate\"></mat-progress-spinner>\n </div>\n\n <form *ngIf=\"!authenticationService.authenticating\" [formGroup]=\"form\">\n <mat-form-field>\n <input matInput formControlName=\"username\" placeholder=\"Username\" (keyup.enter)=\"authenticate()\">\n </mat-form-field>\n\n <mat-form-field>\n <input matInput formControlName=\"password\" type=\"password\" placeholder=\"Password\" (keyup.enter)=\"authenticate()\">\n </mat-form-field>\n </form>\n\n <div *ngIf=\"!authenticationService.authenticating && errorMessage\" id=\"error\">\n {{ errorMessage }}\n </div>\n</mat-dialog-content>\n\n<mat-dialog-actions *ngIf=\"!authenticationService.authenticating\">\n <button mat-raised-button color=\"primary\" (click)=\"authenticate()\"\n [disabled]=\"form.invalid\">\n <mat-icon fontIcon=\"done\"></mat-icon>\n <span>OK</span>\n </button>\n\n <button mat-raised-button (click)=\"dialogRef.close()\">\n <mat-icon fontIcon=\"close\"></mat-icon>\n <span>Cancel</span>\n </button>\n</mat-dialog-actions>", styles: ["#spinner{width:100%;height:100%;display:flex;justify-content:center;align-items:center}form{display:grid;gap:1rem}mat-dialog-actions{display:grid;justify-content:center;grid-template-columns:auto auto;gap:1rem}#error{color:red}\n", ".material-icons{font-family:Material Icons;font-weight:400;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:\"liga\"}\n"], dependencies: [{ kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i5.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i8.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i9.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "diameter", "strokeWidth", "mode", "value"], exportAs: ["matProgressSpinner"] }] });
188
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: LoginFormComponent, decorators: [{
189
+ type: Component,
190
+ args: [{ selector: 'authentication-login-form', template: "<h2 mat-dialog-title>\n <span *ngIf=\"!authenticationService.authenticating\">Login</span>\n <span *ngIf=\"authenticationService.authenticating\">Authenticating...</span>\n</h2>\n\n<mat-dialog-content>\n <div id=\"spinner\" *ngIf=\"authenticationService.authenticating\">\n <mat-progress-spinner color=\"primary\" mode=\"indeterminate\"></mat-progress-spinner>\n </div>\n\n <form *ngIf=\"!authenticationService.authenticating\" [formGroup]=\"form\">\n <mat-form-field>\n <input matInput formControlName=\"username\" placeholder=\"Username\" (keyup.enter)=\"authenticate()\">\n </mat-form-field>\n\n <mat-form-field>\n <input matInput formControlName=\"password\" type=\"password\" placeholder=\"Password\" (keyup.enter)=\"authenticate()\">\n </mat-form-field>\n </form>\n\n <div *ngIf=\"!authenticationService.authenticating && errorMessage\" id=\"error\">\n {{ errorMessage }}\n </div>\n</mat-dialog-content>\n\n<mat-dialog-actions *ngIf=\"!authenticationService.authenticating\">\n <button mat-raised-button color=\"primary\" (click)=\"authenticate()\"\n [disabled]=\"form.invalid\">\n <mat-icon fontIcon=\"done\"></mat-icon>\n <span>OK</span>\n </button>\n\n <button mat-raised-button (click)=\"dialogRef.close()\">\n <mat-icon fontIcon=\"close\"></mat-icon>\n <span>Cancel</span>\n </button>\n</mat-dialog-actions>", styles: ["#spinner{width:100%;height:100%;display:flex;justify-content:center;align-items:center}form{display:grid;gap:1rem}mat-dialog-actions{display:grid;justify-content:center;grid-template-columns:auto auto;gap:1rem}#error{color:red}\n", ".material-icons{font-family:Material Icons;font-weight:400;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:\"liga\"}\n"] }]
191
+ }], ctorParameters: function () {
192
+ return [{ type: undefined, decorators: [{
193
+ type: Inject,
194
+ args: [MAT_DIALOG_DATA]
195
+ }] }, { type: i1.MatDialogRef }, { type: AuthenticationService }];
196
+ } });
197
+
198
+ class LoginComponent {
199
+ constructor(dialog, authenticationService) {
200
+ this.dialog = dialog;
201
+ this.authenticationService = authenticationService;
202
+ }
203
+ login() {
204
+ this.dialog.open(LoginFormComponent, {
205
+ data: { adminGroup: this.adminGroup }
206
+ });
207
+ }
208
+ confirmLogout() {
209
+ this.dialog.open(ConfirmationComponent, {
210
+ data: { message: `Are you sure you want to logout?` }
211
+ })
212
+ .afterClosed()
213
+ .subscribe(result => {
214
+ if (result) {
215
+ this.authenticationService.logout();
216
+ }
217
+ });
218
+ }
219
+ }
220
+ LoginComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: LoginComponent, deps: [{ token: i1.MatDialog }, { token: AuthenticationService }], target: i0.ɵɵFactoryTarget.Component });
221
+ LoginComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: LoginComponent, selector: "authentication-login", inputs: { adminGroup: "adminGroup" }, ngImport: i0, template: "<div id=\"user-id\">\n <!-- Logged out -->\n <mat-icon *ngIf=\"!authenticationService.authenticated\"\n fontIcon=\"account_circle\"\n matTooltip=\"Login\"\n (click)=\"login()\">\n </mat-icon>\n\n <!-- Logged in -->\n <ng-container *ngIf=\"authenticationService.authenticated\">\n <!-- With photo -->\n <img *ngIf=\"authenticationService.authenticatedUser?.photoUrl\"\n id=\"authenticated-user-image\"\n [src]=\"authenticationService.authenticatedUser?.photoUrl\"\n matTooltip=\"Logout\"\n (click)=\"confirmLogout()\" />\n \n <!-- Without photo -->\n <mat-icon *ngIf=\"!authenticationService.authenticatedUser?.photoUrl\"\n fontIcon=\"account_circle\"\n matTooltip=\"Logout\"\n (click)=\"confirmLogout()\">\n </mat-icon>\n \n <!-- Name -->\n <div id=\"user-name\">\n {{ authenticationService.authenticatedUser?.displayName }}\n </div>\n </ng-container>\n</div>", styles: ["#user-id{display:flex;height:2em;padding:.3em;font-family:Verdana,Geneva,Tahoma,sans-serif}mat-icon{font-size:2em!important;height:2em!important;width:2em!important}img{border-radius:100%;width:2em;height:2em}#user-id>div{display:flex;align-items:center;height:100%;margin-left:.75em;font-size:1.15em}\n", ".material-icons{font-family:Material Icons;font-weight:400;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:\"liga\"}\n"], dependencies: [{ kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
222
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: LoginComponent, decorators: [{
223
+ type: Component,
224
+ args: [{ selector: 'authentication-login', template: "<div id=\"user-id\">\n <!-- Logged out -->\n <mat-icon *ngIf=\"!authenticationService.authenticated\"\n fontIcon=\"account_circle\"\n matTooltip=\"Login\"\n (click)=\"login()\">\n </mat-icon>\n\n <!-- Logged in -->\n <ng-container *ngIf=\"authenticationService.authenticated\">\n <!-- With photo -->\n <img *ngIf=\"authenticationService.authenticatedUser?.photoUrl\"\n id=\"authenticated-user-image\"\n [src]=\"authenticationService.authenticatedUser?.photoUrl\"\n matTooltip=\"Logout\"\n (click)=\"confirmLogout()\" />\n \n <!-- Without photo -->\n <mat-icon *ngIf=\"!authenticationService.authenticatedUser?.photoUrl\"\n fontIcon=\"account_circle\"\n matTooltip=\"Logout\"\n (click)=\"confirmLogout()\">\n </mat-icon>\n \n <!-- Name -->\n <div id=\"user-name\">\n {{ authenticationService.authenticatedUser?.displayName }}\n </div>\n </ng-container>\n</div>", styles: ["#user-id{display:flex;height:2em;padding:.3em;font-family:Verdana,Geneva,Tahoma,sans-serif}mat-icon{font-size:2em!important;height:2em!important;width:2em!important}img{border-radius:100%;width:2em;height:2em}#user-id>div{display:flex;align-items:center;height:100%;margin-left:.75em;font-size:1.15em}\n", ".material-icons{font-family:Material Icons;font-weight:400;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:\"liga\"}\n"] }]
225
+ }], ctorParameters: function () { return [{ type: i1.MatDialog }, { type: AuthenticationService }]; }, propDecorators: { adminGroup: [{
226
+ type: Input
227
+ }] } });
228
+
229
+ class AuthenticationModule {
230
+ constructor(parentModule) {
231
+ if (parentModule) {
232
+ throw new Error('AuthenticationModule is already loaded. Import it in the AppModule only');
233
+ }
234
+ }
235
+ static forRoot(config) {
236
+ return {
237
+ ngModule: AuthenticationModule,
238
+ providers: [
239
+ AuthenticationService,
240
+ { provide: ServiceConfig, useValue: config }
241
+ ]
242
+ };
243
+ }
244
+ }
245
+ AuthenticationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: AuthenticationModule, deps: [{ token: AuthenticationModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule });
246
+ AuthenticationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0", ngImport: i0, type: AuthenticationModule, declarations: [LoginComponent,
247
+ LoginFormComponent], imports: [CommonModule,
248
+ ReactiveFormsModule,
249
+ MatButtonModule,
250
+ MatDialogModule,
251
+ MatFormFieldModule,
252
+ MatIconModule,
253
+ MatInputModule,
254
+ MatProgressSpinnerModule], exports: [LoginComponent,
255
+ LoginFormComponent] });
256
+ AuthenticationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: AuthenticationModule, imports: [CommonModule,
257
+ ReactiveFormsModule,
258
+ MatButtonModule,
259
+ MatDialogModule,
260
+ MatFormFieldModule,
261
+ MatIconModule,
262
+ MatInputModule,
263
+ MatProgressSpinnerModule] });
264
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: AuthenticationModule, decorators: [{
265
+ type: NgModule,
266
+ args: [{
267
+ declarations: [
268
+ LoginComponent,
269
+ LoginFormComponent
270
+ ],
271
+ imports: [
272
+ CommonModule,
273
+ ReactiveFormsModule,
274
+ MatButtonModule,
275
+ MatDialogModule,
276
+ MatFormFieldModule,
277
+ MatIconModule,
278
+ MatInputModule,
279
+ MatProgressSpinnerModule
280
+ ],
281
+ exports: [
282
+ LoginComponent,
283
+ LoginFormComponent
284
+ ]
285
+ }]
286
+ }], ctorParameters: function () {
287
+ return [{ type: AuthenticationModule, decorators: [{
288
+ type: Optional
289
+ }, {
290
+ type: SkipSelf
291
+ }] }];
292
+ } });
293
+
294
+ /**
295
+ * Generated bundle index. Do not edit.
296
+ */
297
+
298
+ export { AuthenticationModule, AuthenticationService, LoginComponent, LoginFormComponent, ServiceConfig };
299
+ //# sourceMappingURL=cleavelandprice-ngx-lib-authentication.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cleavelandprice-ngx-lib-authentication.mjs","sources":["../../../../projects/cleavelandprice/ngx-lib/authentication/src/model/service-config.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/model/default-config.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/services/authentication.service.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/components/login-form/login-form.component.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/components/login-form/login-form.component.html","../../../../projects/cleavelandprice/ngx-lib/authentication/src/components/login/login.component.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/components/login/login.component.html","../../../../projects/cleavelandprice/ngx-lib/authentication/src/authentication.module.ts","../../../../projects/cleavelandprice/ngx-lib/authentication/src/cleavelandprice-ngx-lib-authentication.ts"],"sourcesContent":["export class ServiceConfig {\r\n apiUrl!: string;\r\n}\r\n","import { ServiceConfig } from \"./service-config\";\r\n\r\nexport const defaultConfig: ServiceConfig = {\r\n apiUrl: 'http://utilityapi/authenticate/token'\r\n}","//#region Imports\nimport { Injectable, Output, EventEmitter, Optional } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { JwtHelperService } from '@auth0/angular-jwt';\n\nimport { defaultConfig } from '../model/default-config';\n\nimport { AuthenticationToken } from '../model/authentication-token';\nimport { ServiceConfig } from '../model/service-config';\nimport { SharepointService } from '@cleavelandprice/ngx-lib/sharepoint';\nimport { AuthenticatedUser } from '../model/authenticated-user';\nimport { AuthenticationRequest } from '../model/authentication-request';\n//#endregion\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AuthenticationService {\n //#region Fields\n @Output() authenticatedChanged = new EventEmitter<boolean>();\n @Output() authenticatingChanged = new EventEmitter<boolean>();\n @Output() authenticationError = new EventEmitter();\n \n // Flag set to true while the service is attempting to authenticate the user\n authenticating = false;\n \n //Flag set to true when the user is successfully authenticated\n authenticated = false;\n \n // Object representing the authenticated user\n authenticatedUser!: AuthenticatedUser | null;\n //#endregion\n \n //#region Lifecycle\n // If a ServiceConfig object is not provided when the module is imported, then default values are pulled in from default-config.ts.\n constructor(@Optional() private config: ServiceConfig,\n private http: HttpClient,\n private sharePointService: SharepointService) {\n\n this.config = this.config ?? defaultConfig;\n \n this.checkForExistingToken();\n }\n //#endregion\n\n //#region Utilities\n //Authenticate the user and store the token in Local Storage\n login(username: string, password: string, adminGroup?: string): void {\n const today = new Date();\n //const expiration = new Date().setFullYear(today.getFullYear() + 10);\n\n const request: AuthenticationRequest = {\n username: username,\n password: password,\n adminGroup: adminGroup\n //expirationDate: expiration // moment().add(10, 'years').toDate()\n };\n\n this.authenticating = true;\n this.authenticatingChanged.emit(this.authenticating);\n\n // Sending a 'raw' POST request so that we can tell HttpClient that we are expecting text instead of Json\n // Otherwise, it would throw an error trying to decode Json from the response\n this.http.request('POST', this.config.apiUrl, { body: request, responseType: 'text' })\n .subscribe(token => this.validateUser(token),\n err => {\n //console.log('Authentication error', err);\n this.authenticating = false;\n this.authenticatingChanged.emit(this.authenticating);\n this.authenticationError.emit(err);\n });\n }\n \n //Logout the user and delete the token from Local Storage\n logout(): void {\n if (localStorage.getItem('token')) {\n localStorage.removeItem('token');\n }\n\n this.authenticatedUser = null;\n this.authenticated = false;\n this.authenticatedChanged.emit(false);\n }\n \n private validateUser(token: string | null): void {\n if (!token) { return; }\n\n const jwtHelper = new JwtHelperService();\n const decoded = jwtHelper.decodeToken(token) as AuthenticationToken;\n\n if (jwtHelper.isTokenExpired(token)) {\n this.logout();\n return;\n }\n\n this.authenticatedUser = {\n admin: decoded.role === 'Admin',\n displayName: decoded.displayName,\n accountName: decoded.winaccountname,\n distinguishedName: decoded.distinguishedName,\n employeeNumber: decoded.employeeNumber,\n memberOf: decoded.memberOf\n };\n\n localStorage.setItem('token', token);\n\n this.getPhoto();\n \n this.authenticated = true;\n this.authenticatedChanged.emit(this.authenticated);\n\n this.authenticating = false;\n this.authenticatingChanged.emit(this.authenticating);\n }\n\n private getPhoto(): void {\n this.sharePointService.getPhotos()\n .subscribe(photos => {\n // The user may have been logged out by the time the photos came back\n if (!this.authenticatedUser?.employeeNumber) {\n return;\n }\n\n const photo = photos.find(pic => pic.employeeNumber === +this.authenticatedUser!.employeeNumber);\n\n if (photo) {\n this.authenticatedUser.photoUrl = photo.encodedAbsUrl;\n }\n });\n }\n\n private checkForExistingToken(): void {\n this.validateUser(localStorage.getItem('token'));\n }\n //#endregion\n}\n ","import { Component, Inject, OnInit, OnDestroy } from '@angular/core';\nimport { UntypedFormGroup, UntypedFormControl, Validators } from '@angular/forms';\nimport { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';\nimport { Subscription } from 'rxjs';\n\nimport { AuthenticationService } from '../../services/authentication.service';\nimport { LoginFormData } from '../../model/login-form-data';\n\n@Component({\n selector: 'authentication-login-form',\n templateUrl: './login-form.component.html',\n styleUrls: [\n './login-form.component.css',\n '../../../../styles/mat-icon.css'\n ]\n})\nexport class LoginFormComponent implements OnInit, OnDestroy {\n errorMessage: string | null = null;\n authenticatedChangedSubscription!: Subscription;\n authenticationErrorSubscription!: Subscription;\n\n form = new UntypedFormGroup({\n username: new UntypedFormControl(null, [ Validators.required ]),\n password: new UntypedFormControl(null, [ Validators.required ]),\n adminGroup: new UntypedFormControl()\n });\n\n constructor(@Inject(MAT_DIALOG_DATA) data: LoginFormData,\n public dialogRef: MatDialogRef<LoginFormComponent>,\n public authenticationService: AuthenticationService) {\n\n this.form.get('adminGroup')?.setValue(data.adminGroup);\n }\n\n ngOnInit(): void {\n this.authenticatedChangedSubscription = this.authenticationService.authenticatedChanged\n .subscribe(this.authChangedHandler.bind(this));\n\n this.authenticationErrorSubscription = this.authenticationService.authenticationError\n .subscribe(this.errorHandler.bind(this));\n }\n\n ngOnDestroy(): void {\n this.authenticationErrorSubscription.unsubscribe();\n this.authenticatedChangedSubscription.unsubscribe();\n }\n\n authenticate() {\n this.errorMessage = null;\n const { username, password, adminGroup } = this.form.value;\n this.authenticationService.login(username, password, adminGroup);\n }\n\n private authChangedHandler(authenticated: boolean): void {\n if (authenticated) {\n this.dialogRef.close();\n }\n }\n\n private errorHandler(err: any): void {\n console.log('Authentication error', err);\n this.errorMessage = `${err.name}: ${err.statusText}`;\n }\n}\n","<h2 mat-dialog-title>\n <span *ngIf=\"!authenticationService.authenticating\">Login</span>\n <span *ngIf=\"authenticationService.authenticating\">Authenticating...</span>\n</h2>\n\n<mat-dialog-content>\n <div id=\"spinner\" *ngIf=\"authenticationService.authenticating\">\n <mat-progress-spinner color=\"primary\" mode=\"indeterminate\"></mat-progress-spinner>\n </div>\n\n <form *ngIf=\"!authenticationService.authenticating\" [formGroup]=\"form\">\n <mat-form-field>\n <input matInput formControlName=\"username\" placeholder=\"Username\" (keyup.enter)=\"authenticate()\">\n </mat-form-field>\n\n <mat-form-field>\n <input matInput formControlName=\"password\" type=\"password\" placeholder=\"Password\" (keyup.enter)=\"authenticate()\">\n </mat-form-field>\n </form>\n\n <div *ngIf=\"!authenticationService.authenticating && errorMessage\" id=\"error\">\n {{ errorMessage }}\n </div>\n</mat-dialog-content>\n\n<mat-dialog-actions *ngIf=\"!authenticationService.authenticating\">\n <button mat-raised-button color=\"primary\" (click)=\"authenticate()\"\n [disabled]=\"form.invalid\">\n <mat-icon fontIcon=\"done\"></mat-icon>\n <span>OK</span>\n </button>\n\n <button mat-raised-button (click)=\"dialogRef.close()\">\n <mat-icon fontIcon=\"close\"></mat-icon>\n <span>Cancel</span>\n </button>\n</mat-dialog-actions>","import { Component, Input } from '@angular/core';\nimport { MatDialog } from '@angular/material/dialog';\nimport { ConfirmationComponent } from '@cleavelandprice/ngx-lib/dialog';\nimport { LoginFormComponent } from '../login-form/login-form.component';\nimport { AuthenticationService } from '../../services/authentication.service';\n\n@Component({\n selector: 'authentication-login',\n templateUrl: './login.component.html',\n styleUrls: [\n './login.component.css',\n '../../../../styles/mat-icon.css'\n ]\n})\nexport class LoginComponent {\n @Input() adminGroup!: string;\n\n constructor(private dialog: MatDialog,\n public authenticationService: AuthenticationService) {\n }\n\n login(): void {\n this.dialog.open(LoginFormComponent, {\n data: { adminGroup: this.adminGroup }\n });\n }\n\n confirmLogout(): void {\n this.dialog.open(ConfirmationComponent, {\n data: { message: `Are you sure you want to logout?` }\n })\n .afterClosed()\n .subscribe(result => {\n if (result) {\n this.authenticationService.logout();\n }\n });\n }\n}\n","<div id=\"user-id\">\n <!-- Logged out -->\n <mat-icon *ngIf=\"!authenticationService.authenticated\"\n fontIcon=\"account_circle\"\n matTooltip=\"Login\"\n (click)=\"login()\">\n </mat-icon>\n\n <!-- Logged in -->\n <ng-container *ngIf=\"authenticationService.authenticated\">\n <!-- With photo -->\n <img *ngIf=\"authenticationService.authenticatedUser?.photoUrl\"\n id=\"authenticated-user-image\"\n [src]=\"authenticationService.authenticatedUser?.photoUrl\"\n matTooltip=\"Logout\"\n (click)=\"confirmLogout()\" />\n \n <!-- Without photo -->\n <mat-icon *ngIf=\"!authenticationService.authenticatedUser?.photoUrl\"\n fontIcon=\"account_circle\"\n matTooltip=\"Logout\"\n (click)=\"confirmLogout()\">\n </mat-icon>\n \n <!-- Name -->\n <div id=\"user-name\">\n {{ authenticationService.authenticatedUser?.displayName }}\n </div>\n </ng-container>\n</div>","import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ReactiveFormsModule } from '@angular/forms';\n\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatDialogModule } from '@angular/material/dialog';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\n\nimport { LoginComponent } from './components/login/login.component';\nimport { LoginFormComponent } from './components/login-form/login-form.component';\nimport { ServiceConfig } from './model/service-config';\nimport { AuthenticationService } from './services/authentication.service';\n\n@NgModule({\n declarations: [\n LoginComponent,\n LoginFormComponent\n ],\n imports: [\n CommonModule,\n ReactiveFormsModule,\n \n MatButtonModule,\n MatDialogModule,\n MatFormFieldModule,\n MatIconModule,\n MatInputModule,\n MatProgressSpinnerModule\n ],\n exports: [\n LoginComponent,\n LoginFormComponent\n ]\n})\nexport class AuthenticationModule {\n static forRoot(config: ServiceConfig): ModuleWithProviders<AuthenticationModule> {\n return {\n ngModule: AuthenticationModule,\n providers: [\n AuthenticationService,\n { provide: ServiceConfig, useValue: config }\n ]\n };\n }\n\n constructor( @Optional() @SkipSelf() parentModule: AuthenticationModule) {\n if (parentModule) {\n throw new Error(\n 'AuthenticationModule is already loaded. Import it in the AppModule only');\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1.ServiceConfig","i2.AuthenticationService","i3","i4"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;MAAa,aAAa,CAAA;AAEzB;;ACAM,MAAM,aAAa,GAAkB;AACxC,IAAA,MAAM,EAAE,sCAAsC;CACjD;;ACJD;AAYA;MAKa,qBAAqB,CAAA;;;;AAkBhC,IAAA,WAAA,CAAgC,MAAqB,EACjC,IAAgB,EAChB,iBAAoC,EAAA;;AAFxB,QAAA,IAAM,CAAA,MAAA,GAAN,MAAM,CAAe;AACjC,QAAA,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAY;AAChB,QAAA,IAAiB,CAAA,iBAAA,GAAjB,iBAAiB,CAAmB;;AAlB9C,QAAA,IAAA,CAAA,oBAAoB,GAAG,IAAI,YAAY,EAAW,CAAC;AACnD,QAAA,IAAA,CAAA,qBAAqB,GAAG,IAAI,YAAY,EAAW,CAAC;AACpD,QAAA,IAAA,CAAA,mBAAmB,GAAG,IAAI,YAAY,EAAE,CAAC;;AAGlD,QAAA,IAAc,CAAA,cAAA,GAAG,KAAK,CAAC;;AAGxB,QAAA,IAAa,CAAA,aAAA,GAAG,KAAK,CAAC;QAYR,IAAI,CAAC,MAAM,GAAG,CAAA,EAAA,GAAA,IAAI,CAAC,MAAM,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,aAAa,CAAC;QAE3C,IAAI,CAAC,qBAAqB,EAAE,CAAC;KAC1C;;;;AAKD,IAAA,KAAK,CAAC,QAAgB,EAAE,QAAgB,EAAE,UAAmB,EAAA;AAC3D,QAAA,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;;AAGzB,QAAA,MAAM,OAAO,GAA0B;AACrC,YAAA,QAAQ,EAAE,QAAQ;AAClB,YAAA,QAAQ,EAAE,QAAQ;AAClB,YAAA,UAAU,EAAE,UAAU;;SAEvB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