@csmart/ngc-smart-core 0.7.95 → 1.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/csmart-ngc-smart-core.d.ts +1 -5
  2. package/esm2020/csmart-ngc-smart-core.mjs +5 -0
  3. package/esm2020/lib/ngc-smart-core.module.mjs +97 -0
  4. package/esm2020/lib/smart-auth/smart-access-control-config.mjs +12 -0
  5. package/esm2020/lib/smart-auth/smart-access-control.directive.mjs +40 -0
  6. package/esm2020/lib/smart-auth/smart-auth.service.mjs +479 -0
  7. package/esm2020/lib/smart-auth/smart-authorization-guard.service.mjs +35 -0
  8. package/esm2020/lib/smart-auth/smart-error.component.mjs +37 -0
  9. package/esm2020/lib/smart-auth/smart-login-staff-resolver.service.mjs +59 -0
  10. package/esm2020/lib/smart-auth/smart-selected-offender-resolver.service.mjs +49 -0
  11. package/esm2020/lib/smart-navbar/smart-navbar-config.mjs +2 -0
  12. package/esm2020/lib/smart-navbar/smart-navbar.component.mjs +132 -0
  13. package/esm2020/lib/smart-navbar/smart-navbar.service.mjs +63 -0
  14. package/esm2020/lib/smart-offender-header/smart-offender-header.component.mjs +151 -0
  15. package/esm2020/lib/smart-offender-header/smart-offender-header.service.mjs +41 -0
  16. package/esm2020/lib/smart-staff-offender-options/smart-staff-offender-options-resolver.service.mjs +25 -0
  17. package/esm2020/lib/smart-staff-offender-options/smart-staff-offender-options.component.mjs +78 -0
  18. package/esm2020/lib/smart-staff-offender-options/smart-staff-offender-options.service.mjs +134 -0
  19. package/esm2020/lib/smart-storage/smart-storage-model.mjs +30 -0
  20. package/esm2020/lib/smart-storage/xdm.service.mjs +158 -0
  21. package/esm2020/public-api.mjs +20 -0
  22. package/fesm2015/csmart-ngc-smart-core.mjs +1529 -0
  23. package/fesm2015/csmart-ngc-smart-core.mjs.map +1 -0
  24. package/fesm2020/csmart-ngc-smart-core.mjs +1514 -0
  25. package/fesm2020/csmart-ngc-smart-core.mjs.map +1 -0
  26. package/lib/ngc-smart-core.module.d.ts +18 -0
  27. package/lib/smart-auth/smart-access-control.directive.d.ts +3 -0
  28. package/lib/smart-auth/smart-auth.service.d.ts +4 -0
  29. package/lib/smart-auth/smart-authorization-guard.service.d.ts +3 -0
  30. package/lib/smart-auth/smart-error.component.d.ts +3 -0
  31. package/lib/smart-auth/smart-login-staff-resolver.service.d.ts +3 -0
  32. package/lib/smart-auth/smart-selected-offender-resolver.service.d.ts +3 -0
  33. package/lib/smart-navbar/smart-navbar.component.d.ts +6 -3
  34. package/lib/smart-navbar/smart-navbar.service.d.ts +3 -0
  35. package/lib/smart-offender-header/smart-offender-header.component.d.ts +4 -1
  36. package/lib/smart-offender-header/smart-offender-header.service.d.ts +3 -0
  37. package/lib/smart-staff-offender-options/smart-staff-offender-options-resolver.service.d.ts +3 -0
  38. package/lib/smart-staff-offender-options/smart-staff-offender-options.component.d.ts +3 -0
  39. package/lib/smart-staff-offender-options/smart-staff-offender-options.service.d.ts +6 -3
  40. package/lib/smart-storage/xdm.service.d.ts +3 -0
  41. package/package.json +25 -14
  42. package/public-api.d.ts +3 -0
  43. package/bundles/csmart-ngc-smart-core.umd.js +0 -2620
  44. package/bundles/csmart-ngc-smart-core.umd.js.map +0 -1
  45. package/bundles/csmart-ngc-smart-core.umd.min.js +0 -2
  46. package/bundles/csmart-ngc-smart-core.umd.min.js.map +0 -1
  47. package/csmart-ngc-smart-core.metadata.json +0 -1
  48. package/esm2015/csmart-ngc-smart-core.js +0 -15
  49. package/esm2015/lib/ngc-smart-core.module.js +0 -59
  50. package/esm2015/lib/smart-auth/smart-access-control-config.js +0 -32
  51. package/esm2015/lib/smart-auth/smart-access-control.directive.js +0 -70
  52. package/esm2015/lib/smart-auth/smart-auth.service.js +0 -693
  53. package/esm2015/lib/smart-auth/smart-authorization-guard.service.js +0 -63
  54. package/esm2015/lib/smart-auth/smart-error.component.js +0 -77
  55. package/esm2015/lib/smart-auth/smart-login-staff-resolver.service.js +0 -94
  56. package/esm2015/lib/smart-auth/smart-selected-offender-resolver.service.js +0 -101
  57. package/esm2015/lib/smart-navbar/smart-navbar-config.js +0 -22
  58. package/esm2015/lib/smart-navbar/smart-navbar.component.js +0 -224
  59. package/esm2015/lib/smart-navbar/smart-navbar.service.js +0 -89
  60. package/esm2015/lib/smart-offender-header/smart-offender-header.component.js +0 -253
  61. package/esm2015/lib/smart-offender-header/smart-offender-header.service.js +0 -85
  62. package/esm2015/lib/smart-staff-offender-options/smart-staff-offender-options-resolver.service.js +0 -49
  63. package/esm2015/lib/smart-staff-offender-options/smart-staff-offender-options.component.js +0 -151
  64. package/esm2015/lib/smart-staff-offender-options/smart-staff-offender-options.service.js +0 -222
  65. package/esm2015/lib/smart-storage/smart-storage-model.js +0 -131
  66. package/esm2015/lib/smart-storage/xdm.service.js +0 -317
  67. package/esm2015/public-api.js +0 -22
  68. package/esm5/csmart-ngc-smart-core.js +0 -15
  69. package/esm5/lib/ngc-smart-core.module.js +0 -63
  70. package/esm5/lib/smart-auth/smart-access-control-config.js +0 -32
  71. package/esm5/lib/smart-auth/smart-access-control.directive.js +0 -74
  72. package/esm5/lib/smart-auth/smart-auth.service.js +0 -762
  73. package/esm5/lib/smart-auth/smart-authorization-guard.service.js +0 -67
  74. package/esm5/lib/smart-auth/smart-error.component.js +0 -83
  75. package/esm5/lib/smart-auth/smart-login-staff-resolver.service.js +0 -98
  76. package/esm5/lib/smart-auth/smart-selected-offender-resolver.service.js +0 -108
  77. package/esm5/lib/smart-navbar/smart-navbar-config.js +0 -22
  78. package/esm5/lib/smart-navbar/smart-navbar.component.js +0 -251
  79. package/esm5/lib/smart-navbar/smart-navbar.service.js +0 -114
  80. package/esm5/lib/smart-offender-header/smart-offender-header.component.js +0 -283
  81. package/esm5/lib/smart-offender-header/smart-offender-header.service.js +0 -76
  82. package/esm5/lib/smart-staff-offender-options/smart-staff-offender-options-resolver.service.js +0 -52
  83. package/esm5/lib/smart-staff-offender-options/smart-staff-offender-options.component.js +0 -165
  84. package/esm5/lib/smart-staff-offender-options/smart-staff-offender-options.service.js +0 -232
  85. package/esm5/lib/smart-storage/smart-storage-model.js +0 -155
  86. package/esm5/lib/smart-storage/xdm.service.js +0 -389
  87. package/esm5/public-api.js +0 -22
  88. package/fesm2015/csmart-ngc-smart-core.js +0 -2231
  89. package/fesm2015/csmart-ngc-smart-core.js.map +0 -1
  90. package/fesm5/csmart-ngc-smart-core.js +0 -2502
  91. package/fesm5/csmart-ngc-smart-core.js.map +0 -1
@@ -1,2620 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('penpal'), require('@angular/material'), require('@angular/forms'), require('@angular/common/http'), require('@azure/msal-angular'), require('@angular/router'), require('rxjs'), require('@angular/core'), require('rxjs/operators')) :
3
- typeof define === 'function' && define.amd ? define('@csmart/ngc-smart-core', ['exports', '@angular/common', 'penpal', '@angular/material', '@angular/forms', '@angular/common/http', '@azure/msal-angular', '@angular/router', 'rxjs', '@angular/core', 'rxjs/operators'], factory) :
4
- (factory((global.csmart = global.csmart || {}, global.csmart['ngc-smart-core'] = {}),global.ng.common,global.penpal,global.ng.material,global.ng.forms,global.ng.common.http,global.msalAngular,global.ng.router,global.rxjs,global.ng.core,global.rxjs.operators));
5
- }(this, (function (exports,i1,penpal,material,forms,i1$1,i2,i2$1,rxjs,i0,operators) { 'use strict';
6
-
7
- /*! *****************************************************************************
8
- Copyright (c) Microsoft Corporation.
9
-
10
- Permission to use, copy, modify, and/or distribute this software for any
11
- purpose with or without fee is hereby granted.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
- PERFORMANCE OF THIS SOFTWARE.
20
- ***************************************************************************** */
21
- function __awaiter(thisArg, _arguments, P, generator) {
22
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
- return new (P || (P = Promise))(function (resolve, reject) {
24
- function fulfilled(value) { try {
25
- step(generator.next(value));
26
- }
27
- catch (e) {
28
- reject(e);
29
- } }
30
- function rejected(value) { try {
31
- step(generator["throw"](value));
32
- }
33
- catch (e) {
34
- reject(e);
35
- } }
36
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
37
- step((generator = generator.apply(thisArg, _arguments || [])).next());
38
- });
39
- }
40
- function __generator(thisArg, body) {
41
- var _ = { label: 0, sent: function () { if (t[0] & 1)
42
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
43
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
44
- function verb(n) { return function (v) { return step([n, v]); }; }
45
- function step(op) {
46
- if (f)
47
- throw new TypeError("Generator is already executing.");
48
- while (_)
49
- try {
50
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
51
- return t;
52
- if (y = 0, t)
53
- op = [op[0] & 2, t.value];
54
- switch (op[0]) {
55
- case 0:
56
- case 1:
57
- t = op;
58
- break;
59
- case 4:
60
- _.label++;
61
- return { value: op[1], done: false };
62
- case 5:
63
- _.label++;
64
- y = op[1];
65
- op = [0];
66
- continue;
67
- case 7:
68
- op = _.ops.pop();
69
- _.trys.pop();
70
- continue;
71
- default:
72
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
73
- _ = 0;
74
- continue;
75
- }
76
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
77
- _.label = op[1];
78
- break;
79
- }
80
- if (op[0] === 6 && _.label < t[1]) {
81
- _.label = t[1];
82
- t = op;
83
- break;
84
- }
85
- if (t && _.label < t[2]) {
86
- _.label = t[2];
87
- _.ops.push(op);
88
- break;
89
- }
90
- if (t[2])
91
- _.ops.pop();
92
- _.trys.pop();
93
- continue;
94
- }
95
- op = body.call(thisArg, _);
96
- }
97
- catch (e) {
98
- op = [6, e];
99
- y = 0;
100
- }
101
- finally {
102
- f = t = 0;
103
- }
104
- if (op[0] & 5)
105
- throw op[1];
106
- return { value: op[0] ? op[1] : void 0, done: true };
107
- }
108
- }
109
- function __read(o, n) {
110
- var m = typeof Symbol === "function" && o[Symbol.iterator];
111
- if (!m)
112
- return o;
113
- var i = m.call(o), r, ar = [], e;
114
- try {
115
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
116
- ar.push(r.value);
117
- }
118
- catch (error) {
119
- e = { error: error };
120
- }
121
- finally {
122
- try {
123
- if (r && !r.done && (m = i["return"]))
124
- m.call(i);
125
- }
126
- finally {
127
- if (e)
128
- throw e.error;
129
- }
130
- }
131
- return ar;
132
- }
133
- function __spread() {
134
- for (var ar = [], i = 0; i < arguments.length; i++)
135
- ar = ar.concat(__read(arguments[i]));
136
- return ar;
137
- }
138
-
139
- /**
140
- * @fileoverview added by tsickle
141
- * Generated from: lib/smart-storage/smart-storage-model.ts
142
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
143
- */
144
- var Permission = /** @class */ (function () {
145
- function Permission() {
146
- }
147
- return Permission;
148
- }());
149
- var Role = /** @class */ (function () {
150
- function Role() {
151
- }
152
- return Role;
153
- }());
154
- var Option = /** @class */ (function () {
155
- function Option() {
156
- }
157
- return Option;
158
- }());
159
- var LoginStaff = /** @class */ (function () {
160
- function LoginStaff() {
161
- this.selectedRole = '*';
162
- }
163
- return LoginStaff;
164
- }());
165
- var SelectedOffender = /** @class */ (function () {
166
- function SelectedOffender() {
167
- this.intakeFlag = false;
168
- }
169
- return SelectedOffender;
170
- }());
171
- var OffenderQuery = /** @class */ (function () {
172
- function OffenderQuery() {
173
- }
174
- return OffenderQuery;
175
- }());
176
- var StorageKey = /** @class */ (function () {
177
- function StorageKey() {
178
- }
179
- StorageKey.selectedOffender = 'smart-selected-offender';
180
- StorageKey.loginStaff = 'smart-login-staff';
181
- StorageKey.offenderQuery = 'smart-offender-query';
182
- return StorageKey;
183
- }());
184
- /** @type {?} */
185
- var SMART_WEB_STORAGE_LISTENER_URL = new i0.InjectionToken('SMART Web Storage Listener URL');
186
- /** @type {?} */
187
- var SMART_WEB_PORTAL_URL = new i0.InjectionToken('SMART Web Portal URL');
188
- /** @type {?} */
189
- var SMART_DATA_SERVICE_URL = new i0.InjectionToken('SMART Data Service URL');
190
- //exception for redirection
191
- /** @type {?} */
192
- var SMART_DOMAIN_FORMAT = new i0.InjectionToken('SMART Domain Format URL');
193
-
194
- /**
195
- * @fileoverview added by tsickle
196
- * Generated from: lib/smart-storage/xdm.service.ts
197
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
198
- */
199
- var XdmService = /** @class */ (function () {
200
- function XdmService(document, smartStorageListenerUrl, httpClient, smartDataServiceUrl) {
201
- this.document = document;
202
- this.smartStorageListenerUrl = smartStorageListenerUrl;
203
- this.httpClient = httpClient;
204
- this.smartDataServiceUrl = smartDataServiceUrl;
205
- this.offenderSubject = new rxjs.Subject();
206
- this.staffSubject = new rxjs.Subject();
207
- this.offenderQuerySubject = new rxjs.Subject();
208
- if (i0.isDevMode) {
209
- console.log('SmartStorage XdmService (Client) - constructor()');
210
- }
211
- this.init();
212
- }
213
- /**
214
- * @private
215
- * @return {?}
216
- */
217
- XdmService.prototype.init = /**
218
- * @private
219
- * @return {?}
220
- */
221
- function () {
222
- /** @type {?} */
223
- var frame = this.document.createElement('iframe');
224
- frame.src = this.smartStorageListenerUrl;
225
- frame.id = 'childframe';
226
- frame.name = Math.random().toString();
227
- frame.onload = null;
228
- frame.style.visibility = 'hidden';
229
- this.document.body.appendChild(frame);
230
- this.connection = penpal.connectToChild({
231
- iframe: frame,
232
- debug: false,
233
- });
234
- };
235
- /**
236
- * @private
237
- * @param {?} staffId
238
- * @return {?}
239
- */
240
- XdmService.prototype.getStaffOffenderListOptions = /**
241
- * @private
242
- * @param {?} staffId
243
- * @return {?}
244
- */
245
- function (staffId) {
246
- /** @type {?} */
247
- var queryString = "{findvStaffOffenderListOptions(input:{\n where:{\n staffId: " + staffId + "\n }\n }){\n data{\n offenderListOptionId\n name\n serviceApiFieldName\n selectedFlag\n }\n } }";
248
- return this.httpClient
249
- .post(this.smartDataServiceUrl, { query: queryString })
250
- .pipe(operators.map(( /**
251
- * @param {?} __0
252
- * @return {?}
253
- */function (_a) {
254
- var data = _a.data;
255
- data.findvStaffOffenderListOptions.data['offenderOptionListId'] =
256
- data.findvStaffOffenderListOptions.data['offenderListOptionId'];
257
- return data.findvStaffOffenderListOptions.data;
258
- })));
259
- /*return of([
260
- { offenderListOptionId: 'genderCode', name: '', selectedFlag: true }]);*/
261
- };
262
- /**
263
- * @return {?}
264
- */
265
- XdmService.prototype.clearAll = /**
266
- * @return {?}
267
- */
268
- function () {
269
- var _this = this;
270
- this.connection.promise.then(( /**
271
- * @param {?} child
272
- * @return {?}
273
- */function (child) {
274
- child.clearAll();
275
- _this.offenderSubject.next();
276
- _this.staffSubject.next();
277
- }));
278
- };
279
- /*************************************
280
- * Offender
281
- **************************************/
282
- /**
283
- * **********************************
284
- * Offender
285
- * ************************************
286
- * @param {?} selectedOffender
287
- * @return {?}
288
- */
289
- XdmService.prototype.setSelectedOffender = /**
290
- * **********************************
291
- * Offender
292
- * ************************************
293
- * @param {?} selectedOffender
294
- * @return {?}
295
- */
296
- function (selectedOffender) {
297
- var _this = this;
298
- this.connection.promise.then(( /**
299
- * @param {?} child
300
- * @return {?}
301
- */function (child) {
302
- child.setSelectedOffender(selectedOffender);
303
- _this.offenderSubject.next(selectedOffender);
304
- }));
305
- };
306
- /**
307
- * @return {?}
308
- */
309
- XdmService.prototype.getSelectedOffender = /**
310
- * @return {?}
311
- */
312
- function () {
313
- return this.connection.promise.then(( /**
314
- * @param {?} child
315
- * @return {?}
316
- */function (child) {
317
- return child.getSelectedOffender(StorageKey.selectedOffender);
318
- }));
319
- };
320
- /**
321
- * @return {?}
322
- */
323
- XdmService.prototype.clearSelectedOffender = /**
324
- * @return {?}
325
- */
326
- function () {
327
- var _this = this;
328
- this.connection.promise.then(( /**
329
- * @param {?} child
330
- * @return {?}
331
- */function (child) {
332
- child.clearSelectedOffender();
333
- _this.offenderSubject.next();
334
- }));
335
- };
336
- /**
337
- * @return {?}
338
- */
339
- XdmService.prototype.getOffenderUpdate = /**
340
- * @return {?}
341
- */
342
- function () {
343
- return this.offenderSubject.asObservable();
344
- };
345
- /************************************************************************
346
- * Staff
347
- ************************************************************************/
348
- /**
349
- * *********************************************************************
350
- * Staff
351
- * **********************************************************************
352
- * @param {?} loginStaff
353
- * @return {?}
354
- */
355
- XdmService.prototype.setLoginStaff = /**
356
- * *********************************************************************
357
- * Staff
358
- * **********************************************************************
359
- * @param {?} loginStaff
360
- * @return {?}
361
- */
362
- function (loginStaff) {
363
- var _this = this;
364
- this.connection.promise.then(( /**
365
- * @param {?} child
366
- * @return {?}
367
- */function (child) {
368
- child.setLoginStaff(loginStaff);
369
- _this.staffSubject.next(loginStaff);
370
- }));
371
- };
372
- /**
373
- * @return {?}
374
- */
375
- XdmService.prototype.getLoginStaff = /**
376
- * @return {?}
377
- */
378
- function () {
379
- return this.connection.promise.then(( /**
380
- * @param {?} child
381
- * @return {?}
382
- */function (child) {
383
- return child.getLoginStaff(StorageKey.loginStaff);
384
- }));
385
- };
386
- /**
387
- * @return {?}
388
- */
389
- XdmService.prototype.clearLoginStaff = /**
390
- * @return {?}
391
- */
392
- function () {
393
- var _this = this;
394
- this.connection.promise.then(( /**
395
- * @param {?} child
396
- * @return {?}
397
- */function (child) {
398
- child.clearLoginStaff();
399
- _this.staffSubject.next();
400
- }));
401
- };
402
- /**
403
- * @return {?}
404
- */
405
- XdmService.prototype.getStaffUpdate = /**
406
- * @return {?}
407
- */
408
- function () {
409
- return this.staffSubject.asObservable();
410
- };
411
- /**
412
- * @return {?}
413
- */
414
- XdmService.prototype.refreshLoginStaffOptions = /**
415
- * @return {?}
416
- */
417
- function () {
418
- var _this = this;
419
- this.getLoginStaff().then(( /**
420
- * @param {?} oldLoginStaff
421
- * @return {?}
422
- */function (oldLoginStaff) {
423
- _this.getStaffOffenderListOptions(oldLoginStaff.staffId).subscribe(( /**
424
- * @param {?} optionData
425
- * @return {?}
426
- */function (optionData) {
427
- console.log(optionData);
428
- oldLoginStaff.options = optionData;
429
- _this.setLoginStaff(oldLoginStaff);
430
- }));
431
- }));
432
- };
433
- /************************************************************************
434
- * Offender Query
435
- ************************************************************************/
436
- /**
437
- * *********************************************************************
438
- * Offender Query
439
- * **********************************************************************
440
- * @param {?} offenderQuery
441
- * @return {?}
442
- */
443
- XdmService.prototype.setOffenderQuery = /**
444
- * *********************************************************************
445
- * Offender Query
446
- * **********************************************************************
447
- * @param {?} offenderQuery
448
- * @return {?}
449
- */
450
- function (offenderQuery) {
451
- var _this = this;
452
- this.connection.promise.then(( /**
453
- * @param {?} child
454
- * @return {?}
455
- */function (child) {
456
- child.setOffenderQuery(offenderQuery);
457
- _this.offenderQuerySubject.next(offenderQuery);
458
- }));
459
- };
460
- /**
461
- * @return {?}
462
- */
463
- XdmService.prototype.getOffenderQuery = /**
464
- * @return {?}
465
- */
466
- function () {
467
- return this.connection.promise.then(( /**
468
- * @param {?} child
469
- * @return {?}
470
- */function (child) {
471
- return child.getOffenderQuery(StorageKey.offenderQuery);
472
- }));
473
- };
474
- /**
475
- * @return {?}
476
- */
477
- XdmService.prototype.clearOffenderQuery = /**
478
- * @return {?}
479
- */
480
- function () {
481
- var _this = this;
482
- this.connection.promise.then(( /**
483
- * @param {?} child
484
- * @return {?}
485
- */function (child) {
486
- child.clearOffenderQuery();
487
- _this.offenderQuerySubject.next();
488
- }));
489
- };
490
- /**
491
- * @return {?}
492
- */
493
- XdmService.prototype.getOffenderQueryUpdate = /**
494
- * @return {?}
495
- */
496
- function () {
497
- return this.offenderQuerySubject.asObservable();
498
- };
499
- XdmService.decorators = [
500
- { type: i0.Injectable, args: [{
501
- providedIn: 'root',
502
- },] }
503
- ];
504
- /** @nocollapse */
505
- XdmService.ctorParameters = function () {
506
- return [
507
- { type: undefined, decorators: [{ type: i0.Inject, args: [i1.DOCUMENT,] }] },
508
- { type: String, decorators: [{ type: i0.Inject, args: [SMART_WEB_STORAGE_LISTENER_URL,] }] },
509
- { type: i1$1.HttpClient },
510
- { type: undefined, decorators: [{ type: i0.Inject, args: [SMART_DATA_SERVICE_URL,] }] }
511
- ];
512
- };
513
- /** @nocollapse */ XdmService.ngInjectableDef = i0.defineInjectable({ factory: function XdmService_Factory() { return new XdmService(i0.inject(i1.DOCUMENT), i0.inject(SMART_WEB_STORAGE_LISTENER_URL), i0.inject(i1$1.HttpClient), i0.inject(SMART_DATA_SERVICE_URL)); }, token: XdmService, providedIn: "root" });
514
- return XdmService;
515
- }());
516
-
517
- /**
518
- * @fileoverview added by tsickle
519
- * Generated from: lib/smart-offender-header/smart-offender-header.service.ts
520
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
521
- */
522
- var SmartOffenderHeaderService = /** @class */ (function () {
523
- function SmartOffenderHeaderService(smartDataServiceUrl, http) {
524
- this.smartDataServiceUrl = smartDataServiceUrl;
525
- this.http = http;
526
- }
527
- /**
528
- * @param {?} staffId
529
- * @return {?}
530
- */
531
- SmartOffenderHeaderService.prototype.getStaffOffenders = /**
532
- * @param {?} staffId
533
- * @return {?}
534
- */
535
- function (staffId) {
536
- /** @type {?} */
537
- var queryString = "\n query getStaffOffenderList{\n filterOffenderList(input: {staffId: " + staffId + "}) {\n data {\n offenderId\n offenderName\n pdId\n birthDate\n gender\n }\n }\n }\n ";
538
- return this.http
539
- .post(this.smartDataServiceUrl, { query: queryString })
540
- .pipe(operators.map(( /**
541
- * @param {?} __0
542
- * @return {?}
543
- */function (_a) {
544
- var data = _a.data;
545
- return data.filterOffenderList.data;
546
- })));
547
- };
548
- SmartOffenderHeaderService.decorators = [
549
- { type: i0.Injectable }
550
- ];
551
- /** @nocollapse */
552
- SmartOffenderHeaderService.ctorParameters = function () {
553
- return [
554
- { type: undefined, decorators: [{ type: i0.Inject, args: [SMART_DATA_SERVICE_URL,] }] },
555
- { type: i1$1.HttpClient }
556
- ];
557
- };
558
- return SmartOffenderHeaderService;
559
- }());
560
-
561
- /**
562
- * @fileoverview added by tsickle
563
- * Generated from: lib/smart-offender-header/smart-offender-header.component.ts
564
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
565
- */
566
- var SmartOffenderHeaderComponent = /** @class */ (function () {
567
- function SmartOffenderHeaderComponent(xdmService, authnService, smartOffenderHeaderService, router) {
568
- this.xdmService = xdmService;
569
- this.authnService = authnService;
570
- this.smartOffenderHeaderService = smartOffenderHeaderService;
571
- this.router = router;
572
- this.selectedOffenderControl$ = new forms.FormControl();
573
- }
574
- /**
575
- * @return {?}
576
- */
577
- SmartOffenderHeaderComponent.prototype.ngOnInit = /**
578
- * @return {?}
579
- */
580
- function () {
581
- var _this = this;
582
- this.isAuthenticated = this.authnService.getAccount() ? true : false;
583
- this.xdmService.getLoginStaff().then(( /**
584
- * @param {?} loginStaff
585
- * @return {?}
586
- */function (loginStaff) {
587
- _this.loginStaff = loginStaff ? loginStaff : null;
588
- }));
589
- this.xdmService.getSelectedOffender().then(( /**
590
- * @param {?} selectedOffender
591
- * @return {?}
592
- */function (selectedOffender) {
593
- _this.selectedOffender =
594
- selectedOffender && selectedOffender.offenderId
595
- ? selectedOffender
596
- : null;
597
- }));
598
- this.subscription = this.xdmService
599
- .getOffenderUpdate()
600
- .subscribe(( /**
601
- * @param {?} selectedOffender
602
- * @return {?}
603
- */function (selectedOffender) {
604
- _this.selectedOffender = selectedOffender;
605
- _this.setSelectedOffenderControl();
606
- }));
607
- this.xdmService.getOffenderQuery().then(( /**
608
- * @param {?} offenderQuery
609
- * @return {?}
610
- */function (offenderQuery) {
611
- if (offenderQuery) {
612
- _this.offenderQueryList = offenderQuery.offenders;
613
- _this.setSelectedOffenderControl();
614
- }
615
- }));
616
- this.offenderQuerySubscription = this.xdmService.getOffenderQueryUpdate()
617
- .subscribe(( /**
618
- * @param {?} offenderList
619
- * @return {?}
620
- */function (offenderList) {
621
- if (offenderList && offenderList.offenders) {
622
- _this.offenderQueryList = __spread(offenderList.offenders);
623
- }
624
- }));
625
- this.selectedOffenderControl$.valueChanges.subscribe(( /**
626
- * @param {?} o
627
- * @return {?}
628
- */function (o) {
629
- return _this.onOffenderSelected(o);
630
- }));
631
- this.router.routeReuseStrategy.shouldReuseRoute = ( /**
632
- * @return {?}
633
- */function () {
634
- return false;
635
- });
636
- };
637
- /**
638
- * @return {?}
639
- */
640
- SmartOffenderHeaderComponent.prototype.ngOnDestroy = /**
641
- * @return {?}
642
- */
643
- function () {
644
- this.subscription.unsubscribe();
645
- };
646
- /**
647
- * @private
648
- * @param {?} offender
649
- * @return {?}
650
- */
651
- SmartOffenderHeaderComponent.prototype.onOffenderSelected = /**
652
- * @private
653
- * @param {?} offender
654
- * @return {?}
655
- */
656
- function (offender) {
657
- if (offender) {
658
- // const o = offender.offenderName.split(',');
659
- // if (o.length === 2) {
660
- // const offenderName = `${o[1]} ${o[0]}`;
661
- // this.selectedOffender = {
662
- // offenderId: offender.offenderId,
663
- // name: offenderName,
664
- // pdId: offender.pdId,
665
- // birthDate: offender.birthDate,
666
- // gender: offender.genderCode,
667
- // assignmentStaffRelationId: '',
668
- // intakeFlag: this.loginStaff
669
- // ? this.hasIntakeRole(this.loginStaff.roles)
670
- // : false,
671
- // } as SelectedOffender;
672
- this.selectedOffender = offender;
673
- this.xdmService.setSelectedOffender(this.selectedOffender);
674
- this.reloadCurrentRoute();
675
- }
676
- };
677
- /**
678
- * @private
679
- * @return {?}
680
- */
681
- SmartOffenderHeaderComponent.prototype.setSelectedOffenderControl = /**
682
- * @private
683
- * @return {?}
684
- */
685
- function () {
686
- var _this = this;
687
- if (this.selectedOffender &&
688
- this.offenderQueryList &&
689
- this.offenderQueryList.length > 0) {
690
- /** @type {?} */
691
- var o = this.offenderQueryList.find(( /**
692
- * @param {?} x
693
- * @return {?}
694
- */function (x) { return x.offenderId === _this.selectedOffender.offenderId; }));
695
- if (o) {
696
- this.selectedOffenderControl$.setValue(o, { emitEvent: false });
697
- }
698
- if (!o && this.offenderQueryList.length > 0) {
699
- this.selectedOffenderControl$.setValue(this.offenderQueryList[0], {
700
- emitEvent: false,
701
- });
702
- }
703
- }
704
- };
705
- /**
706
- * @private
707
- * @return {?}
708
- */
709
- SmartOffenderHeaderComponent.prototype.reloadCurrentRoute = /**
710
- * @private
711
- * @return {?}
712
- */
713
- function () {
714
- try {
715
- /** @type {?} */
716
- var urlTree = this.router.parseUrl(this.router.url);
717
- if (urlTree
718
- && urlTree.root
719
- && urlTree.root.segments
720
- && urlTree.root.segments.length > 1) {
721
- this.router.navigate([urlTree.root.segments[0].path]);
722
- }
723
- else if (urlTree
724
- && urlTree.root
725
- && urlTree.root.children
726
- && urlTree.root.children.primary
727
- && urlTree.root.children.primary.segments
728
- && urlTree.root.children.primary.segments.length > 1) {
729
- this.router.navigate([urlTree.root.children.primary.segments[0].path]);
730
- }
731
- else {
732
- this.router.navigate([this.router.url]);
733
- }
734
- }
735
- catch (_a) {
736
- this.router.navigateByUrl('/');
737
- }
738
- };
739
- /**
740
- * @private
741
- * @param {?} roles
742
- * @return {?}
743
- */
744
- SmartOffenderHeaderComponent.prototype.hasIntakeRole = /**
745
- * @private
746
- * @param {?} roles
747
- * @return {?}
748
- */
749
- function (roles) {
750
- if (roles && roles.length > 0) {
751
- return roles.findIndex(this.isIntakeRole) > -1;
752
- }
753
- return false;
754
- };
755
- /**
756
- * @private
757
- * @param {?} role
758
- * @return {?}
759
- */
760
- SmartOffenderHeaderComponent.prototype.isIntakeRole = /**
761
- * @private
762
- * @param {?} role
763
- * @return {?}
764
- */
765
- function (role) {
766
- switch (role.roleId) {
767
- case 'OPA':
768
- case 'OPS':
769
- case 'SOPS':
770
- return true;
771
- default:
772
- return false;
773
- }
774
- };
775
- SmartOffenderHeaderComponent.decorators = [
776
- { type: i0.Component, args: [{
777
- selector: 'app-smart-offender-header',
778
- template: "<div\r\n class=\"offender-header-container\"\r\n *ngIf=\"selectedOffender && isAuthenticated\">\r\n <div class=\"offender-header-name-item\">\r\n <mat-form-field appearance=\"standard\" class=\"switch-offender\">\r\n <mat-label>Switch Offender</mat-label>\r\n <mat-select [formControl]=\"selectedOffenderControl$\">\r\n <mat-option\r\n *ngFor=\"let offender of offenderQueryList\"\r\n [value]=\"offender\">\r\n {{ offender?.name}} ({{offender?.offenderId}})\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n <div>\r\n <div class=\"offender-header-id-item\">\r\n <span class=\"item-label\">PDID:</span> {{ selectedOffender.pdId }}\r\n </div>\r\n <div class=\"offender-header-id-item\">\r\n <span class=\"item-label\">CSOSA ID:</span>\r\n {{ selectedOffender.offenderId }}\r\n </div>\r\n </div>\r\n</div>\r\n",
779
- styles: [".offender-header-container{display:-ms-grid;display:grid;-ms-grid-columns:2fr 1fr;grid-template-columns:2fr 1fr;grid-column-gap:20px;width:100%;margin:4px;background-color:#eae9e9;font-family:Roboto,'Helvetica Neue',sans-serif;font-size:14px;font-weight:500;padding-top:8px;justify-items:end}.offender-header-name-item{width:50%}.offender-header-id-item{text-align:left;display:-ms-grid;display:grid;-ms-grid-columns:80px 80px;grid-template-columns:80px 80px;margin-top:8px}.switch-offender{width:100%!important}@media only screen and (max-width:740px){.offender-header-container{display:-ms-grid;display:grid;-ms-grid-rows:1fr 1fr;grid-template-rows:1fr 1fr;-ms-grid-columns:1fr;grid-template-columns:1fr;align-items:center;background-color:#eae9e9;font-family:Roboto,'Helvetica Neue',sans-serif;font-size:14px;font-weight:500;height:100%;margin:4px;padding-left:16px;justify-items:start}.offender-header-name-item{text-align:left}}"]
780
- }] }
781
- ];
782
- /** @nocollapse */
783
- SmartOffenderHeaderComponent.ctorParameters = function () {
784
- return [
785
- { type: XdmService },
786
- { type: i2.MsalService },
787
- { type: SmartOffenderHeaderService },
788
- { type: i2$1.Router }
789
- ];
790
- };
791
- return SmartOffenderHeaderComponent;
792
- }());
793
-
794
- /**
795
- * @fileoverview added by tsickle
796
- * Generated from: lib/smart-navbar/smart-navbar.service.ts
797
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
798
- */
799
- var SmartNavbarService = /** @class */ (function () {
800
- function SmartNavbarService(http) {
801
- this.http = http;
802
- }
803
- /*
804
- public getNavbarConfigs(): SmartNavbarConfig[] {
805
- this.configs = [
806
- {appModuleId: 'SMART', name: 'SMART', url: 'http://localhost:4200', offenderSpecific: false, displayOrder: 1 },
807
- {appModuleId: 'OFFENDER', name: 'Offender', url: 'http://localhost:4200', offenderSpecific: true, displayOrder: 2 },
808
- {appModuleId: 'SPRVSN', name: 'Supervision', url: 'http://localhost:4200', offenderSpecific: true, displayOrder: 3 },
809
- ];
810
-
811
- return this.configs;
812
- }
813
- */
814
- /*
815
- public getNavbarConfigs(serviceApiUrl: string): Observable<SmartNavbarConfig[]> {
816
- return this.http.get<SmartNavbarConfig[]>(serviceApiUrl + '/AppModules');
817
- }
818
- */
819
- /*
820
- public getNavbarConfigs(): SmartNavbarConfig[] {
821
- this.configs = [
822
- {appModuleId: 'SMART', name: 'SMART', url: 'http://localhost:4200', offenderSpecific: false, displayOrder: 1 },
823
- {appModuleId: 'OFFENDER', name: 'Offender', url: 'http://localhost:4200', offenderSpecific: true, displayOrder: 2 },
824
- {appModuleId: 'SPRVSN', name: 'Supervision', url: 'http://localhost:4200', offenderSpecific: true, displayOrder: 3 },
825
- ];
826
-
827
- return this.configs;
828
- }
829
- */
830
- /*
831
- public getNavbarConfigs(serviceApiUrl: string): Observable<SmartNavbarConfig[]> {
832
- return this.http.get<SmartNavbarConfig[]>(serviceApiUrl + '/AppModules');
833
- }
834
- */
835
- /**
836
- * @param {?} serviceApiUrl
837
- * @return {?}
838
- */
839
- SmartNavbarService.prototype.getNavbarConfigs = /*
840
- public getNavbarConfigs(): SmartNavbarConfig[] {
841
- this.configs = [
842
- {appModuleId: 'SMART', name: 'SMART', url: 'http://localhost:4200', offenderSpecific: false, displayOrder: 1 },
843
- {appModuleId: 'OFFENDER', name: 'Offender', url: 'http://localhost:4200', offenderSpecific: true, displayOrder: 2 },
844
- {appModuleId: 'SPRVSN', name: 'Supervision', url: 'http://localhost:4200', offenderSpecific: true, displayOrder: 3 },
845
- ];
846
-
847
- return this.configs;
848
- }
849
- */
850
- /*
851
- public getNavbarConfigs(serviceApiUrl: string): Observable<SmartNavbarConfig[]> {
852
- return this.http.get<SmartNavbarConfig[]>(serviceApiUrl + '/AppModules');
853
- }
854
- */
855
- /**
856
- * @param {?} serviceApiUrl
857
- * @return {?}
858
- */
859
- function (serviceApiUrl) {
860
- /** @type {?} */
861
- var queryString = "\n {\n findAppModules {\n data {\n appModuleId\n name\n url\n offenderSpecificFlag\n displayOrder\n }\n }\n }";
862
- /*
863
- const httpHeaders = new HttpHeaders({
864
- 'Content-Type': 'application/json',
865
- 'Cache-Control': 'no-cache'
866
- });
867
- const options = {
868
- headers: httpHeaders
869
- };
870
- */
871
- return this.http
872
- .post(serviceApiUrl, { query: queryString })
873
- .pipe(operators.map(( /**
874
- * @param {?} __0
875
- * @return {?}
876
- */function (_a) {
877
- var data = _a.data;
878
- if (i0.isDevMode()) {
879
- console.log(data);
880
- }
881
- return data.findAppModules.data;
882
- })));
883
- };
884
- SmartNavbarService.decorators = [
885
- { type: i0.Injectable }
886
- ];
887
- /** @nocollapse */
888
- SmartNavbarService.ctorParameters = function () {
889
- return [
890
- { type: i1$1.HttpClient }
891
- ];
892
- };
893
- return SmartNavbarService;
894
- }());
895
-
896
- /**
897
- * @fileoverview added by tsickle
898
- * Generated from: lib/smart-navbar/smart-navbar.component.ts
899
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
900
- */
901
- var SmartNavbarComponent = /** @class */ (function () {
902
- function SmartNavbarComponent(navbarConfigService, xdmService, authnService) {
903
- this.navbarConfigService = navbarConfigService;
904
- this.xdmService = xdmService;
905
- this.authnService = authnService;
906
- this.appModuleId = 'SMART';
907
- this.isAuthenticated = false;
908
- }
909
- /**
910
- * @return {?}
911
- */
912
- SmartNavbarComponent.prototype.ngOnChanges = /**
913
- * @return {?}
914
- */
915
- function () {
916
- /*
917
- console.log(this.selectedTab);
918
- setTimeout(() => {
919
- this.tabGroup.selectedIndex = this.selectedTab;
920
- }, 1000);
921
- */
922
- };
923
- /**
924
- * @return {?}
925
- */
926
- SmartNavbarComponent.prototype.ngOnInit = /**
927
- * @return {?}
928
- */
929
- function () {
930
- var _this = this;
931
- this.xdmService.getSelectedOffender().then(( /**
932
- * @param {?} selectedOffender
933
- * @return {?}
934
- */function (selectedOffender) {
935
- _this.selectedOffender =
936
- selectedOffender && selectedOffender.offenderId
937
- ? selectedOffender
938
- : null;
939
- }));
940
- this.xdmService.getLoginStaff().then(( /**
941
- * @param {?} loginStaff
942
- * @return {?}
943
- */function (loginStaff) {
944
- // this.zone.run(() => {
945
- _this.loginStaff = loginStaff ? loginStaff : null;
946
- // });
947
- }));
948
- this.offenderSubscription = this.xdmService
949
- .getOffenderUpdate()
950
- .subscribe(( /**
951
- * @param {?} selectedOffender
952
- * @return {?}
953
- */function (selectedOffender) {
954
- // this.zone.run(() => {
955
- _this.selectedOffender = selectedOffender;
956
- // });
957
- }));
958
- this.staffSubscription = this.xdmService
959
- .getStaffUpdate()
960
- .subscribe(( /**
961
- * @param {?} loginStaff
962
- * @return {?}
963
- */function (loginStaff) {
964
- // this.zone.run(() => {
965
- _this.loginStaff = loginStaff;
966
- // });
967
- }));
968
- this.navbarConfigService
969
- .getNavbarConfigs(this.serviceApiUrl)
970
- .subscribe(( /**
971
- * @param {?} configs
972
- * @return {?}
973
- */function (configs) {
974
- _this.navbarConfigs = configs.sort(( /**
975
- * @param {?} a
976
- * @param {?} b
977
- * @return {?}
978
- */function (a, b) {
979
- if (a.displayOrder < b.displayOrder) {
980
- return -1;
981
- }
982
- else if (a.displayOrder > b.displayOrder) {
983
- return 1;
984
- }
985
- return 0;
986
- }));
987
- }));
988
- this.isAuthenticated = this.authnService.getAccount() ? true : false;
989
- };
990
- /**
991
- * @return {?}
992
- */
993
- SmartNavbarComponent.prototype.ngOnDestroy = /**
994
- * @return {?}
995
- */
996
- function () {
997
- this.offenderSubscription.unsubscribe();
998
- this.staffSubscription.unsubscribe();
999
- };
1000
- /**
1001
- * @return {?}
1002
- */
1003
- SmartNavbarComponent.prototype.logout = /**
1004
- * @return {?}
1005
- */
1006
- function () {
1007
- this.xdmService.clearAll();
1008
- this.authnService.logout();
1009
- };
1010
- /**
1011
- * @param {?} config
1012
- * @return {?}
1013
- */
1014
- SmartNavbarComponent.prototype.getAppModuleUrl = /**
1015
- * @param {?} config
1016
- * @return {?}
1017
- */
1018
- function (config) {
1019
- return (config && this.selectedOffender && config.appModuleId === 'PPMAS') ?
1020
- config.url + "?skipAppMetadata=true&OffenderId=" + this.selectedOffender.offenderId : config.url;
1021
- };
1022
- /**
1023
- * @param {?} appModuleId
1024
- * @return {?}
1025
- */
1026
- SmartNavbarComponent.prototype.hasAppModulePermission = /**
1027
- * @param {?} appModuleId
1028
- * @return {?}
1029
- */
1030
- function (appModuleId) {
1031
- if (this.loginStaff && this.loginStaff.permissions && this.loginStaff.permissions.length > 0) {
1032
- return this.loginStaff.permissions.findIndex(( /**
1033
- * @param {?} p
1034
- * @return {?}
1035
- */function (p) { return p.appModuleId === appModuleId; })) > -1;
1036
- }
1037
- return false;
1038
- };
1039
- Object.defineProperty(SmartNavbarComponent.prototype, "hasExternalUserRole", {
1040
- get: /**
1041
- * @return {?}
1042
- */ function () {
1043
- if (this.loginStaff && this.loginStaff.roles && this.loginStaff.roles.length > 0) {
1044
- return this.loginStaff.roles.findIndex(this.isExternalRole) > -1;
1045
- }
1046
- return false;
1047
- },
1048
- enumerable: true,
1049
- configurable: true
1050
- });
1051
- /**
1052
- * @private
1053
- * @param {?} role
1054
- * @return {?}
1055
- */
1056
- SmartNavbarComponent.prototype.isExternalRole = /**
1057
- * @private
1058
- * @param {?} role
1059
- * @return {?}
1060
- */
1061
- function (role) {
1062
- switch (role.roleId) {
1063
- case 'EUDTL':
1064
- case 'EUDUSM':
1065
- case 'EUJDG':
1066
- case 'EUMPD':
1067
- case 'EUSOTV':
1068
- case 'EUUSA2':
1069
- case 'EUUSAO':
1070
- case 'EUUSPC':
1071
- return true;
1072
- default:
1073
- return false;
1074
- }
1075
- };
1076
- SmartNavbarComponent.decorators = [
1077
- { type: i0.Component, args: [{
1078
- selector: 'app-smart-navbar',
1079
- template: "<!--\r\n<a class=\"smart-navbar-toggle open\" href=\"#nav\">\r\n <i class=\"material-icons\">menu</i>\r\n</a>\r\n\r\n<nav id=\"nav\" role=\"navigation\" class=\"smart-navbar-container\">\r\n <a class=\"smart-navbar-toggle close\" href=\"#\">\r\n <i class=\"material-icons\">close</i>\r\n </a>\r\n\r\n <span *ngFor=\"let config of navbarConfigs\">\r\n <a mat-button class=\"smart-navbar-item\" \r\n *ngIf=\"(config.offenderSpecificFlag === false || selectedOffender) && isAuthenticated && loginStaff\" href=\"{{config.url}}\">{{config.name}}</a>\r\n </span>\r\n\r\n <button mat-button class=\"smart-navbar-item\" [matMenuTriggerFor]=\"menuTheme\">Set Theme</button>\r\n <mat-menu #menuTheme=\"matMenu\">\r\n <button mat-menu-item (click)=\"onSetTheme('blue-theme')\">Blue</button>\r\n <button mat-menu-item (click)=\"onSetTheme('red-theme')\">Red</button>\r\n <button mat-menu-item (click)=\"onSetTheme('green-theme')\">Green</button>\r\n </mat-menu>\r\n <button mat-button class=\"smart-navbar-item smart-navbar-last-item\" [matMenuTriggerFor]=\"menu\"\r\n *ngIf=\"isAuthenticated && loginStaff\">{{loginStaff.firstName + ' ' + loginStaff.lastName}}</button>\r\n <mat-menu #menu=\"matMenu\">\r\n <button mat-menu-item>Profile</button>\r\n <button mat-menu-item (click)=\"logout()\">Sign Out</button>\r\n </mat-menu>\r\n</nav>\r\n-->\r\n\r\n<!-- <nav mat-tab-nav-bar>\r\n <a mat-tab-link mat-flat-button *ngFor=\"let config of navbarConfigs\" [active]=\"appModuleId == config.appModuleId\" href=\"{{config.url}}\">{{config.name}}</a>\r\n</nav> -->\r\n\r\n<mat-tab-group class=\"nav-tab-group\" [selectedIndex]=\"null\">\r\n <ng-container *ngFor=\"let config of navbarConfigs\">\r\n <mat-tab\r\n *ngIf=\"\r\n ((hasExternalUserRole && hasAppModulePermission(config.appModuleId)) ||\r\n (!hasExternalUserRole && (config.offenderSpecificFlag === false || selectedOffender))) &&\r\n isAuthenticated &&\r\n loginStaff \r\n \"\r\n label=\"config.name\"\r\n >\r\n <ng-template mat-tab-label>\r\n <a\r\n mat-flat-button\r\n [ngClass]=\"{ 'main-menu-active': appModuleId == config.appModuleId }\"\r\n [href]=\"getAppModuleUrl(config)\"\r\n >{{ config.name }}</a\r\n >\r\n </ng-template>\r\n </mat-tab>\r\n </ng-container>\r\n</mat-tab-group>\r\n",
1080
- encapsulation: i0.ViewEncapsulation.None,
1081
- styles: [".smart-navbar-container{display:flex;flex-wrap:wrap;flex-direction:column}.smart-navbar-item{font-size:1.2rem;line-height:1.2rem;padding:.5rem;background-color:var(--primary-color,#9fa8da);-webkit-text-decoration-line:none;text-decoration-line:none;display:block;text-align:left;border-radius:.3rem;margin:.1rem}.smart-navbar-last-item{margin-left:auto}.main-menu-active{border-bottom:3px solid #00008b!important;border-radius:0!important}.nav-tab-group.mat-primary .mat-ink-bar{background-color:inherit!important}.mat-tab-links{flex-direction:row;margin:4px;flex-wrap:wrap;font-family:Roboto,arial,sans-serif;font-size:13px}.mat-tab-link{min-width:16px!important}@media only screen and (min-width:768px){.smart-navbar-container{flex-direction:row}.smart-navbar-item{text-align:center}.smart-navbar-toggle{display:none}}@media only screen and (max-width:767px){#nav{position:fixed;top:0;bottom:0;width:300px;left:-340px;transition:transform .3s ease-in-out}#nav:target{transform:translateX(340px)}}.mat-tab-labels{display:flex!important;justify-content:flex-start!important}.mat-tab-label,.mat-tab-label.mat-tab-label-active{min-width:25px!important;padding:0 5px!important;justify-content:flex-start!important;font-weight:700}"]
1082
- }] }
1083
- ];
1084
- /** @nocollapse */
1085
- SmartNavbarComponent.ctorParameters = function () {
1086
- return [
1087
- { type: SmartNavbarService },
1088
- { type: XdmService },
1089
- { type: i2.MsalService }
1090
- ];
1091
- };
1092
- SmartNavbarComponent.propDecorators = {
1093
- serviceApiUrl: [{ type: i0.Input }],
1094
- appModuleId: [{ type: i0.Input }],
1095
- tabGroup: [{ type: i0.ViewChild, args: ['tabs',] }]
1096
- };
1097
- return SmartNavbarComponent;
1098
- }());
1099
-
1100
- /**
1101
- * @fileoverview added by tsickle
1102
- * Generated from: lib/smart-auth/smart-error.component.ts
1103
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1104
- */
1105
- var SmartErrorComponent = /** @class */ (function () {
1106
- function SmartErrorComponent(authnService, route, smartWebPortalUrl) {
1107
- this.authnService = authnService;
1108
- this.route = route;
1109
- this.smartWebPortalUrl = smartWebPortalUrl;
1110
- }
1111
- /**
1112
- * @return {?}
1113
- */
1114
- SmartErrorComponent.prototype.ngOnInit = /**
1115
- * @return {?}
1116
- */
1117
- function () {
1118
- this.type = this.route.snapshot.queryParamMap.get('type') || 'staff';
1119
- this.message =
1120
- this.route.snapshot.queryParamMap.get('message') || 'Error occured.';
1121
- };
1122
- /**
1123
- * @return {?}
1124
- */
1125
- SmartErrorComponent.prototype.logout = /**
1126
- * @return {?}
1127
- */
1128
- function () {
1129
- this.authnService.logout();
1130
- };
1131
- /**
1132
- * @return {?}
1133
- */
1134
- SmartErrorComponent.prototype.portal = /**
1135
- * @return {?}
1136
- */
1137
- function () {
1138
- window.location.href = this.smartWebPortalUrl;
1139
- };
1140
- SmartErrorComponent.decorators = [
1141
- { type: i0.Component, args: [{
1142
- selector: 'app-smart-error',
1143
- template: "<div>\r\n <h2>\r\n {{ message }}\r\n </h2>\r\n <p>\r\n Please contact help desk if needed.\r\n </p>\r\n <div>\r\n <button (click)=\"logout()\" *ngIf=\"type === 'staff'\">OK</button>\r\n <button (click)=\"portal()\" *ngIf=\"type === 'offender'\">OK</button>\r\n </div>\r\n</div>\r\n",
1144
- styles: ["div{text-align:center}"]
1145
- }] }
1146
- ];
1147
- /** @nocollapse */
1148
- SmartErrorComponent.ctorParameters = function () {
1149
- return [
1150
- { type: i2.MsalService },
1151
- { type: i2$1.ActivatedRoute },
1152
- { type: String, decorators: [{ type: i0.Inject, args: [SMART_WEB_PORTAL_URL,] }] }
1153
- ];
1154
- };
1155
- return SmartErrorComponent;
1156
- }());
1157
-
1158
- /**
1159
- * @fileoverview added by tsickle
1160
- * Generated from: lib/smart-staff-offender-options/smart-staff-offender-options.service.ts
1161
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1162
- */
1163
- var SmartStaffOffenderOptionsService = /** @class */ (function () {
1164
- function SmartStaffOffenderOptionsService(serviceApiUrl, http, matSnackBar) {
1165
- this.serviceApiUrl = serviceApiUrl;
1166
- this.http = http;
1167
- this.matSnackBar = matSnackBar;
1168
- }
1169
- /**
1170
- * @param {?} message
1171
- * @return {?}
1172
- */
1173
- SmartStaffOffenderOptionsService.prototype.showMessage = /**
1174
- * @param {?} message
1175
- * @return {?}
1176
- */
1177
- function (message) {
1178
- this.matSnackBar.open(message, null, {
1179
- duration: 2000,
1180
- });
1181
- };
1182
- /**
1183
- * @private
1184
- * @param {?} jsonObject
1185
- * @return {?}
1186
- */
1187
- SmartStaffOffenderOptionsService.prototype.convertEmptyToNull = /**
1188
- * @private
1189
- * @param {?} jsonObject
1190
- * @return {?}
1191
- */
1192
- function (jsonObject) {
1193
- var _this = this;
1194
- if (!jsonObject) {
1195
- return;
1196
- }
1197
- if (jsonObject instanceof Array) {
1198
- jsonObject.forEach(( /**
1199
- * @param {?} obj
1200
- * @return {?}
1201
- */function (obj) {
1202
- _this.convertEmptyToNull(obj);
1203
- }));
1204
- }
1205
- /** @type {?} */
1206
- var keys = Object.keys(jsonObject);
1207
- keys.forEach(( /**
1208
- * @param {?} key
1209
- * @return {?}
1210
- */function (key) {
1211
- if (typeof jsonObject[key] === 'object') {
1212
- _this.convertEmptyToNull(jsonObject[key]);
1213
- }
1214
- else if (typeof jsonObject[key] === 'string' && jsonObject[key].trim() === '') {
1215
- jsonObject[key] = null;
1216
- }
1217
- }));
1218
- };
1219
- /**
1220
- * @private
1221
- * @param {?} queryName
1222
- * @param {?} queryString
1223
- * @return {?}
1224
- */
1225
- SmartStaffOffenderOptionsService.prototype.getGraphQueryData = /**
1226
- * @private
1227
- * @param {?} queryName
1228
- * @param {?} queryString
1229
- * @return {?}
1230
- */
1231
- function (queryName, queryString) {
1232
- return this.http
1233
- .post(this.serviceApiUrl, { query: queryString })
1234
- .pipe(operators.map(( /**
1235
- * @param {?} __0
1236
- * @return {?}
1237
- */function (_a) {
1238
- var data = _a.data;
1239
- return data[queryName];
1240
- })));
1241
- };
1242
- /**
1243
- * @return {?}
1244
- */
1245
- SmartStaffOffenderOptionsService.prototype.getOffenderListOptions = /**
1246
- * @return {?}
1247
- */
1248
- function () {
1249
- /** @type {?} */
1250
- var queryName = 'findOffenderListOptions';
1251
- /** @type {?} */
1252
- var queryString = "{\n " + queryName + " {\n data {\n offenderListOptionId\n name\n serviceApiFieldName\n }\n message\n }\n }";
1253
- return this.getGraphQueryData(queryName, queryString);
1254
- };
1255
- /**
1256
- * @param {?} staffId
1257
- * @return {?}
1258
- */
1259
- SmartStaffOffenderOptionsService.prototype.getStaffOffenderListOptions = /**
1260
- * @param {?} staffId
1261
- * @return {?}
1262
- */
1263
- function (staffId) {
1264
- /** @type {?} */
1265
- var queryString = "{findStaffOffenderListOptions(input:{\n where:{\n staffId: " + staffId + "\n }\n }){\n data{\n offenderListOptionId\n }\n } }";
1266
- return this.http
1267
- .post(this.serviceApiUrl, { query: queryString })
1268
- .pipe(operators.map(( /**
1269
- * @param {?} __0
1270
- * @return {?}
1271
- */function (_a) {
1272
- var data = _a.data;
1273
- return data.findStaffOffenderListOptions.data;
1274
- })));
1275
- };
1276
- /**
1277
- * @param {?} dataToSave
1278
- * @return {?}
1279
- */
1280
- SmartStaffOffenderOptionsService.prototype.saveStaffOffenderListOptionsData = /**
1281
- * @param {?} dataToSave
1282
- * @return {?}
1283
- */
1284
- function (dataToSave) {
1285
- /** @type {?} */
1286
- var query = "mutation {\n upsertStaffOffenderListOption(input: " + this.convertToString(dataToSave) + ") {\n message\n }\n }";
1287
- return this.http
1288
- .post(this.serviceApiUrl, { query: query });
1289
- /*.pipe(
1290
- map(({ data }) => {
1291
- return data[queryName];
1292
- }));*/
1293
- };
1294
- /**
1295
- * @param {?} obj
1296
- * @return {?}
1297
- */
1298
- SmartStaffOffenderOptionsService.prototype.convertToString = /**
1299
- * @param {?} obj
1300
- * @return {?}
1301
- */
1302
- function (obj) {
1303
- var _this = this;
1304
- /** @type {?} */
1305
- var result = '';
1306
- if (!obj) {
1307
- return result;
1308
- }
1309
- if (obj instanceof Array) {
1310
- result += ' [';
1311
- obj.forEach(( /**
1312
- * @param {?} eObj
1313
- * @return {?}
1314
- */function (eObj) {
1315
- result += _this.convertToString(eObj);
1316
- }));
1317
- result += '],';
1318
- }
1319
- else {
1320
- result += '{';
1321
- /** @type {?} */
1322
- var keys = Object.keys(obj);
1323
- keys.forEach(( /**
1324
- * @param {?} key
1325
- * @return {?}
1326
- */function (key) {
1327
- if (typeof obj[key] === 'object') {
1328
- result += key + ':' + _this.convertToString(obj[key]);
1329
- }
1330
- else {
1331
- if (isNaN(obj[key])) {
1332
- result += key + ':"' + obj[key] + '",';
1333
- }
1334
- else {
1335
- result += key + ':' + obj[key] + ',';
1336
- }
1337
- }
1338
- }));
1339
- result = result.substring(0, result.length - 1);
1340
- result += '},';
1341
- }
1342
- return result;
1343
- };
1344
- SmartStaffOffenderOptionsService.decorators = [
1345
- { type: i0.Injectable }
1346
- ];
1347
- /** @nocollapse */
1348
- SmartStaffOffenderOptionsService.ctorParameters = function () {
1349
- return [
1350
- { type: undefined, decorators: [{ type: i0.Inject, args: [SMART_DATA_SERVICE_URL,] }] },
1351
- { type: i1$1.HttpClient },
1352
- { type: material.MatSnackBar }
1353
- ];
1354
- };
1355
- return SmartStaffOffenderOptionsService;
1356
- }());
1357
-
1358
- /**
1359
- * @fileoverview added by tsickle
1360
- * Generated from: lib/smart-staff-offender-options/smart-staff-offender-options.component.ts
1361
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1362
- */
1363
- var SmartStaffOffenderOptionsComponent = /** @class */ (function () {
1364
- function SmartStaffOffenderOptionsComponent(route, offenderService, xdmService) {
1365
- this.route = route;
1366
- this.offenderService = offenderService;
1367
- this.xdmService = xdmService;
1368
- this.offenderListOptions = [];
1369
- }
1370
- /**
1371
- * @return {?}
1372
- */
1373
- SmartStaffOffenderOptionsComponent.prototype.ngOnInit = /**
1374
- * @return {?}
1375
- */
1376
- function () {
1377
- var _this = this;
1378
- /** @type {?} */
1379
- var routData = this.route.snapshot.data;
1380
- this.loginStaff = routData.loginStaff;
1381
- this.offenderListOptions = routData.selectedOffenderResolverService;
1382
- this.frmGroup = this.createForm();
1383
- this.offenderService.getStaffOffenderListOptions(this.loginStaff.staffId).subscribe(( /**
1384
- * @param {?} data
1385
- * @return {?}
1386
- */function (data) {
1387
- _this.fillForm(data);
1388
- }));
1389
- };
1390
- /**
1391
- * @private
1392
- * @param {?} data
1393
- * @return {?}
1394
- */
1395
- SmartStaffOffenderOptionsComponent.prototype.fillForm = /**
1396
- * @private
1397
- * @param {?} data
1398
- * @return {?}
1399
- */
1400
- function (data) {
1401
- if (data) {
1402
- /** @type {?} */
1403
- var offenderListOptionsFg_1 = this.frmGroup.get('offenderListOptions');
1404
- data.forEach(( /**
1405
- * @param {?} element
1406
- * @return {?}
1407
- */function (element) {
1408
- offenderListOptionsFg_1.get(element.offenderListOptionId).setValue(true);
1409
- }));
1410
- }
1411
- };
1412
- /**
1413
- * @private
1414
- * @return {?}
1415
- */
1416
- SmartStaffOffenderOptionsComponent.prototype.createForm = /**
1417
- * @private
1418
- * @return {?}
1419
- */
1420
- function () {
1421
- /** @type {?} */
1422
- var offenderListOptionsFg = new forms.FormGroup({});
1423
- this.offenderListOptions.forEach(( /**
1424
- * @param {?} dt
1425
- * @param {?} i
1426
- * @return {?}
1427
- */function (dt, i) {
1428
- offenderListOptionsFg.addControl(dt.offenderListOptionId, new forms.FormControl(false));
1429
- }));
1430
- return new forms.FormGroup({
1431
- offenderListOptions: offenderListOptionsFg,
1432
- });
1433
- };
1434
- /**
1435
- * @return {?}
1436
- */
1437
- SmartStaffOffenderOptionsComponent.prototype.onSave = /**
1438
- * @return {?}
1439
- */
1440
- function () {
1441
- var _this = this;
1442
- /** @type {?} */
1443
- var data = {
1444
- options: [],
1445
- staffId: this.loginStaff.staffId,
1446
- modifiedBy: this.loginStaff.staffId
1447
- };
1448
- /** @type {?} */
1449
- var offenderListOptionsVal = this.frmGroup.get('offenderListOptions').value;
1450
- /** @type {?} */
1451
- var keys = Object.keys(offenderListOptionsVal);
1452
- keys.forEach(( /**
1453
- * @param {?} key
1454
- * @return {?}
1455
- */function (key) {
1456
- if (offenderListOptionsVal[key]) {
1457
- data.options.push({ 'offenderListOptionId': key });
1458
- }
1459
- }));
1460
- this.offenderService.saveStaffOffenderListOptionsData(data).subscribe(( /**
1461
- * @param {?} rtrDatea
1462
- * @return {?}
1463
- */function (rtrDatea) {
1464
- if (rtrDatea.message) {
1465
- _this.offenderService.showMessage(rtrDatea.message);
1466
- }
1467
- else {
1468
- _this.offenderService.showMessage('Saved successfully');
1469
- _this.xdmService.refreshLoginStaffOptions();
1470
- }
1471
- }));
1472
- };
1473
- SmartStaffOffenderOptionsComponent.decorators = [
1474
- { type: i0.Component, args: [{
1475
- selector: 'lib-smart-staff-offender-options',
1476
- template: "<form class=\"main-form\" [formGroup]=\"frmGroup\">\r\n <mat-card role=\"group\">\r\n <mat-card-content>\r\n <div formGroupName=\"offenderListOptions\">\r\n <div style=\"float:left;\">\r\n <div *ngFor=\"let offenderListOption of offenderListOptions; let i = index\">\r\n <mat-checkbox *ngIf=\"i%2!=0\" color=\"primary\" formControlName=\"{{offenderListOption.offenderListOptionId}}\">\r\n {{offenderListOption.name}}\r\n </mat-checkbox>\r\n </div>\r\n </div>\r\n <div>\r\n <div *ngFor=\"let offenderListOption of offenderListOptions; let i = index\" >\r\n <mat-checkbox *ngIf=\"i%2==0\" color=\"primary\" formControlName=\"{{offenderListOption.offenderListOptionId}}\">\r\n {{offenderListOption.name}}\r\n </mat-checkbox> \r\n </div>\r\n </div>\r\n </div>\r\n </mat-card-content>\r\n <div align=\"center\">\r\n <button mat-raised-button color=\"accent\" (click)=\"onSave()\">Save</button>\r\n </div>\r\n </mat-card>\r\n </form>\r\n ",
1477
- styles: [""]
1478
- }] }
1479
- ];
1480
- /** @nocollapse */
1481
- SmartStaffOffenderOptionsComponent.ctorParameters = function () {
1482
- return [
1483
- { type: i2$1.ActivatedRoute },
1484
- { type: SmartStaffOffenderOptionsService },
1485
- { type: XdmService }
1486
- ];
1487
- };
1488
- return SmartStaffOffenderOptionsComponent;
1489
- }());
1490
-
1491
- /**
1492
- * @fileoverview added by tsickle
1493
- * Generated from: lib/smart-auth/smart-auth.service.ts
1494
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1495
- */
1496
- // import { stringify } from 'querystring';
1497
- var SmartAuthService = /** @class */ (function () {
1498
- function SmartAuthService(http, authnService, xdmService, smartDataServiceUrl, smartDomainFormatUrl) {
1499
- this.http = http;
1500
- this.authnService = authnService;
1501
- this.xdmService = xdmService;
1502
- this.smartDataServiceUrl = smartDataServiceUrl;
1503
- this.smartDomainFormatUrl = smartDomainFormatUrl;
1504
- }
1505
- /**
1506
- * @return {?}
1507
- */
1508
- SmartAuthService.prototype.getLoginStaff = /**
1509
- * @return {?}
1510
- */
1511
- function () {
1512
- var _this = this;
1513
- if (i0.isDevMode) {
1514
- console.log('SmartAuthService - getLoginStaff()');
1515
- }
1516
- if (!i0.isDevMode && this.loginStaff) {
1517
- if (this.loginStaff.staffId) {
1518
- if (i0.isDevMode) {
1519
- console.log('##### getLoginStaff(): get internal instance in service', this.loginStaff);
1520
- }
1521
- return rxjs.of(this.loginStaff);
1522
- }
1523
- else if (this.loginStaff.userName) {
1524
- if (i0.isDevMode) {
1525
- console.log('##### getLoginStaff(): get using preset user name', this.loginStaff);
1526
- }
1527
- return this.getStaff(this.loginStaff.userName);
1528
- }
1529
- }
1530
- return rxjs.from(this.xdmService.getLoginStaff()).pipe(operators.switchMap(( /**
1531
- * @param {?} storedResult
1532
- * @return {?}
1533
- */function (storedResult) {
1534
- if (storedResult && storedResult.staffId) {
1535
- if (i0.isDevMode) {
1536
- console.log('##### getLoginStaff(): get from session.', storedResult);
1537
- }
1538
- _this.loginStaff = storedResult;
1539
- return rxjs.of(storedResult);
1540
- }
1541
- else if (storedResult && storedResult.userName) {
1542
- if (i0.isDevMode) {
1543
- console.log('##### getLoginStaff(): get using preset user name', _this.loginStaff);
1544
- }
1545
- return _this.getStaff(storedResult.userName);
1546
- }
1547
- else {
1548
- /** @type {?} */
1549
- var userName = _this.authnService.getAccount().userName;
1550
- /** @type {?} */
1551
- var staffName = userName.substring(0, userName.indexOf('@'));
1552
- if (i0.isDevMode) {
1553
- console.log('##### loginLoginStaff(): get using login staff name ', staffName);
1554
- }
1555
- return _this.getStaff(staffName);
1556
- }
1557
- })));
1558
- };
1559
- /**
1560
- * @private
1561
- * @param {?} app
1562
- * @param {?} afterHash
1563
- * @return {?}
1564
- */
1565
- SmartAuthService.prototype.getTeamUrl = /**
1566
- * @private
1567
- * @param {?} app
1568
- * @param {?} afterHash
1569
- * @return {?}
1570
- */
1571
- function (app, afterHash) {
1572
- return this.smartDomainFormatUrl.replace('${APP}', app) + afterHash;
1573
- };
1574
- /**
1575
- * @private
1576
- * @param {?} url
1577
- * @param {?} app
1578
- * @return {?}
1579
- */
1580
- SmartAuthService.prototype.isSameHost = /**
1581
- * @private
1582
- * @param {?} url
1583
- * @param {?} app
1584
- * @return {?}
1585
- */
1586
- function (url, app) {
1587
- return this.smartDomainFormatUrl.replace('${APP}', app) === url;
1588
- };
1589
- /**
1590
- * @param {?} loginStaff
1591
- * @return {?}
1592
- */
1593
- SmartAuthService.prototype.redirectToTeam = /**
1594
- * @param {?} loginStaff
1595
- * @return {?}
1596
- */
1597
- function (loginStaff) {
1598
- if (loginStaff.roles.findIndex(( /**
1599
- * @param {?} role
1600
- * @return {?}
1601
- */function (role) { return role.roleId === 'EUUSPC'; })) > -1) {
1602
- if (!this.isSameHost(window.location.origin, 'investigation')) {
1603
- window.location.href = this.getTeamUrl('investigation', '/assignment');
1604
- }
1605
- }
1606
- else if (loginStaff.roles.findIndex(( /**
1607
- * @param {?} role
1608
- * @return {?}
1609
- */function (role) { return role.roleId.substring(0, 3) === 'RSC'; })) > -1) {
1610
- if (!this.isSameHost(window.location.origin, 'rsc')) {
1611
- window.location.href = this.getTeamUrl('rsc', '/offender-list');
1612
- }
1613
- }
1614
- };
1615
- /**
1616
- * @param {?} selectedOffender
1617
- * @return {?}
1618
- */
1619
- SmartAuthService.prototype.setSelectedOffender = /**
1620
- * @param {?} selectedOffender
1621
- * @return {?}
1622
- */
1623
- function (selectedOffender) {
1624
- return __awaiter(this, void 0, void 0, function () {
1625
- var relation;
1626
- return __generator(this, function (_a) {
1627
- switch (_a.label) {
1628
- case 0:
1629
- if (!selectedOffender)
1630
- return [3 /*break*/, 2];
1631
- // if (!selectedOffender.assignmentStaffRelationId) {
1632
- return [4 /*yield*/, this.getStaffOffenderRelation(this.loginStaff.staffId, selectedOffender.offenderId).toPromise()];
1633
- case 1:
1634
- relation = _a.sent();
1635
- if (relation) {
1636
- selectedOffender.assignmentStaffRelationId = relation;
1637
- }
1638
- else {
1639
- selectedOffender.assignmentStaffRelationId = 'NOASSIGN';
1640
- }
1641
- _a.label = 2;
1642
- case 2:
1643
- this.xdmService.setSelectedOffender(selectedOffender);
1644
- this.selectedOffender = selectedOffender;
1645
- return [2 /*return*/];
1646
- }
1647
- });
1648
- });
1649
- };
1650
- /**
1651
- * @return {?}
1652
- */
1653
- SmartAuthService.prototype.logout = /**
1654
- * @return {?}
1655
- */
1656
- function () {
1657
- this.xdmService.clearAll();
1658
- this.authnService.logout();
1659
- };
1660
- /**
1661
- * @param {?} appModuleId
1662
- * @param {?} route
1663
- * @return {?}
1664
- */
1665
- SmartAuthService.prototype.setPermission = /**
1666
- * @param {?} appModuleId
1667
- * @param {?} route
1668
- * @return {?}
1669
- */
1670
- function (appModuleId, route) {
1671
- return __awaiter(this, void 0, void 0, function () {
1672
- var _a, permissions, resource, _b, relation, assignmentStaffRelationId, elements, pattern;
1673
- var _this = this;
1674
- return __generator(this, function (_c) {
1675
- switch (_c.label) {
1676
- case 0:
1677
- if (!!this.loginStaff)
1678
- return [3 /*break*/, 2];
1679
- _a = this;
1680
- return [4 /*yield*/, this.xdmService.getLoginStaff()];
1681
- case 1:
1682
- _a.loginStaff = _c.sent();
1683
- _c.label = 2;
1684
- case 2:
1685
- permissions = this.loginStaff.permissions;
1686
- resource = route.url[0].path;
1687
- if (!!this.selectedOffender)
1688
- return [3 /*break*/, 4];
1689
- _b = this;
1690
- return [4 /*yield*/, this.xdmService.getSelectedOffender()];
1691
- case 3:
1692
- _b.selectedOffender = _c.sent();
1693
- _c.label = 4;
1694
- case 4:
1695
- if (!this.selectedOffender)
1696
- return [3 /*break*/, 6];
1697
- // if (!this.selectedOffender.assignmentStaffRelationId) {
1698
- return [4 /*yield*/, this.getStaffOffenderRelation(this.loginStaff.staffId, this.selectedOffender.offenderId).toPromise()];
1699
- case 5:
1700
- relation = _c.sent();
1701
- if (relation) {
1702
- this.selectedOffender.assignmentStaffRelationId = relation;
1703
- }
1704
- else {
1705
- this.selectedOffender.assignmentStaffRelationId = 'NOASSIGN';
1706
- }
1707
- this.xdmService.setSelectedOffender(this.selectedOffender);
1708
- _c.label = 6;
1709
- case 6:
1710
- assignmentStaffRelationId = this.selectedOffender
1711
- .assignmentStaffRelationId;
1712
- elements = document.querySelectorAll('[class^="sac-"]');
1713
- pattern = /^sac-(\S+)-(\S+)$/i;
1714
- Array.from(elements).forEach(( /**
1715
- * @param {?} element
1716
- * @return {?}
1717
- */function (element) {
1718
- /** @type {?} */
1719
- var hide;
1720
- /** @type {?} */
1721
- var disable;
1722
- element.classList.forEach(( /**
1723
- * @param {?} c
1724
- * @return {?}
1725
- */function (c) {
1726
- /** @type {?} */
1727
- var results = c.match(pattern);
1728
- // console.log(results);
1729
- if (results && results.length > 2) {
1730
- /** @type {?} */
1731
- var roleId_1 = results[1] ? results[1].toUpperCase() : null;
1732
- /** @type {?} */
1733
- var right = results[2];
1734
- // console.log(results[0]);
1735
- // console.log(results[1]);
1736
- // console.log(results[2]);
1737
- /** @type {?} */
1738
- var permission = permissions.find(( /**
1739
- * @param {?} p
1740
- * @return {?}
1741
- */function (p) {
1742
- return (p.appModuleId === appModuleId &&
1743
- p.resource === resource &&
1744
- p.roleId === roleId_1 &&
1745
- p.assignmentStaffRelationId === assignmentStaffRelationId);
1746
- }));
1747
- /*
1748
- console.log('##### setPermission() resource: ', resource);
1749
- console.log('##### setPermission() appModuleId: ', appModuleId);
1750
- console.log('##### setPermission() roleId: ', roleId);
1751
- console.log(
1752
- '##### setPermission() assignment relation: ',
1753
- assignmentStaffRelationId,
1754
- );
1755
- */
1756
- console.log('##### Matched permission: ', permission);
1757
- if (permission) {
1758
- if (right === 'read') {
1759
- if (!permission.readFlag) {
1760
- if (hide !== false) {
1761
- hide = true;
1762
- }
1763
- }
1764
- else {
1765
- hide = false;
1766
- }
1767
- }
1768
- else if ((right === 'create' && !permission.createFlag) ||
1769
- (right === 'update' && !permission.updateFlag) ||
1770
- (right === 'delete' && !permission.deleteFlag) ||
1771
- (right === 'assign' && !permission.assignFlag) ||
1772
- (right === 'close' && !permission.closeFlag) ||
1773
- (right === 'expunge' && !permission.expungeFlag) ||
1774
- (right === 'reopen' && !permission.reopenFlag)) {
1775
- if (element.nodeName === 'BUTTON') {
1776
- if (hide !== false) {
1777
- hide = true;
1778
- }
1779
- }
1780
- else {
1781
- if (disable !== false) {
1782
- disable = true;
1783
- }
1784
- }
1785
- }
1786
- else {
1787
- if (element.nodeName === 'BUTTON') {
1788
- hide = false;
1789
- }
1790
- else {
1791
- disable = false;
1792
- }
1793
- }
1794
- }
1795
- else {
1796
- if (right === 'read') {
1797
- if (hide !== false) {
1798
- hide = true;
1799
- }
1800
- }
1801
- else if (element.nodeName === 'BUTTON') {
1802
- if (hide !== false) {
1803
- hide = true;
1804
- }
1805
- }
1806
- else if (disable !== false) {
1807
- disable = true;
1808
- }
1809
- }
1810
- }
1811
- }));
1812
- console.log('hide: ', hide);
1813
- console.log('disable: ', disable);
1814
- if (hide === true) {
1815
- _this.hideHtmlElement(element);
1816
- }
1817
- else if (disable === true) {
1818
- _this.disableHtmlElement(element);
1819
- }
1820
- }));
1821
- return [2 /*return*/];
1822
- }
1823
- });
1824
- });
1825
- };
1826
- /**
1827
- * @param {?} accessControlConfig
1828
- * @return {?}
1829
- */
1830
- SmartAuthService.prototype.checkPermission = /**
1831
- * @param {?} accessControlConfig
1832
- * @return {?}
1833
- */
1834
- function (accessControlConfig) {
1835
- /** @type {?} */
1836
- var selData = accessControlConfig.route.data;
1837
- this.loginStaff = selData.loginStaff;
1838
- this.selectedOffender = selData.selectedOffender;
1839
- /** @type {?} */
1840
- var permissions = this.loginStaff.permissions;
1841
- /** @type {?} */
1842
- var resource = accessControlConfig.route.url[0].path;
1843
- /** @type {?} */
1844
- var roleId = accessControlConfig.roleId
1845
- ? accessControlConfig.roleId.toUpperCase()
1846
- : null;
1847
- /** @type {?} */
1848
- var accessType = accessControlConfig.accessType;
1849
- /** @type {?} */
1850
- var assignmentStaffRelationId = !this.selectedOffender
1851
- .assignmentStaffRelationId
1852
- ? 'N/A'
1853
- : this.selectedOffender.assignmentStaffRelationId;
1854
- /** @type {?} */
1855
- var permission = permissions.find(( /**
1856
- * @param {?} p
1857
- * @return {?}
1858
- */function (p) {
1859
- return (p.appModuleId === accessControlConfig.appModuleId
1860
- && p.resource === resource
1861
- && (!roleId || p.roleId === roleId)
1862
- && (p.assignmentStaffRelationId === 'N/A' ||
1863
- p.assignmentStaffRelationId === assignmentStaffRelationId));
1864
- }));
1865
- if (permission) {
1866
- if (accessType === 'read') {
1867
- if (!permission.readFlag) {
1868
- return false;
1869
- }
1870
- else {
1871
- return true;
1872
- }
1873
- }
1874
- else if ((accessType === 'create' && !permission.createFlag) ||
1875
- (accessType === 'update' && !permission.updateFlag) ||
1876
- (accessType === 'delete' && !permission.deleteFlag) ||
1877
- (accessType === 'assign' && !permission.assignFlag) ||
1878
- (accessType === 'close' && !permission.closeFlag) ||
1879
- (accessType === 'expunge' && !permission.expungeFlag) ||
1880
- (accessType === 'reopen' && !permission.reopenFlag)) {
1881
- return false;
1882
- }
1883
- else {
1884
- return true;
1885
- }
1886
- }
1887
- else {
1888
- if (accessType === 'read') {
1889
- return false;
1890
- }
1891
- }
1892
- return false;
1893
- };
1894
- /**
1895
- * @param {?} loginStaff
1896
- * @param {?} feature
1897
- * @param {?=} appModuleId
1898
- * @return {?}
1899
- */
1900
- SmartAuthService.prototype.canAppFeatureActivate = /**
1901
- * @param {?} loginStaff
1902
- * @param {?} feature
1903
- * @param {?=} appModuleId
1904
- * @return {?}
1905
- */
1906
- function (loginStaff, feature, appModuleId) {
1907
- if (appModuleId === void 0) {
1908
- appModuleId = null;
1909
- }
1910
- // if (!this.isAuthEnable(loginStaff.roles, appModuleId)) {
1911
- // return true;
1912
- // }
1913
- return this.hasAppFeaturePermission(loginStaff.permissions, feature, appModuleId);
1914
- };
1915
- // public isAuthEnable(roles: Role[], appModuleId: string) {
1916
- // if (roles && roles.length > 0) {
1917
- // return roles.map(r => r.roleId).findIndex(this.isExternalRole) > -1 || appModuleId === 'RR';
1918
- // }
1919
- // return false;
1920
- // }
1921
- // public isAuthEnable(roles: Role[], appModuleId: string) {
1922
- // if (roles && roles.length > 0) {
1923
- // return roles.map(r => r.roleId).findIndex(this.isExternalRole) > -1 || appModuleId === 'RR';
1924
- // }
1925
- // return false;
1926
- // }
1927
- /**
1928
- * @param {?} roles
1929
- * @return {?}
1930
- */
1931
- SmartAuthService.prototype.hasIntakeRole =
1932
- // public isAuthEnable(roles: Role[], appModuleId: string) {
1933
- // if (roles && roles.length > 0) {
1934
- // return roles.map(r => r.roleId).findIndex(this.isExternalRole) > -1 || appModuleId === 'RR';
1935
- // }
1936
- // return false;
1937
- // }
1938
- /**
1939
- * @param {?} roles
1940
- * @return {?}
1941
- */
1942
- function (roles) {
1943
- if (roles && roles.length > 0) {
1944
- return roles.findIndex(this.isIntakeRole) > -1;
1945
- }
1946
- return false;
1947
- };
1948
- /**
1949
- * @private
1950
- * @param {?} permissions
1951
- * @param {?} feature
1952
- * @param {?} appModuleId
1953
- * @return {?}
1954
- */
1955
- SmartAuthService.prototype.hasAppFeaturePermission = /**
1956
- * @private
1957
- * @param {?} permissions
1958
- * @param {?} feature
1959
- * @param {?} appModuleId
1960
- * @return {?}
1961
- */
1962
- function (permissions, feature, appModuleId) {
1963
- if (permissions && permissions.length > 0) {
1964
- if (appModuleId) {
1965
- return (permissions.findIndex(( /**
1966
- * @param {?} p
1967
- * @return {?}
1968
- */function (p) { return p.resource === feature && p.appModuleId === appModuleId; })) > -1);
1969
- }
1970
- else {
1971
- return permissions.findIndex(( /**
1972
- * @param {?} p
1973
- * @return {?}
1974
- */function (p) { return p.resource === feature; })) > -1;
1975
- }
1976
- }
1977
- return false;
1978
- };
1979
- /**
1980
- * @private
1981
- * @param {?} roleId
1982
- * @return {?}
1983
- */
1984
- SmartAuthService.prototype.isExternalRole = /**
1985
- * @private
1986
- * @param {?} roleId
1987
- * @return {?}
1988
- */
1989
- function (roleId) {
1990
- switch (roleId) {
1991
- case 'EUDTL':
1992
- case 'EUDUSM':
1993
- case 'EUJDG':
1994
- case 'EUMPD':
1995
- case 'EUSOTV':
1996
- case 'EUUSA2':
1997
- case 'EUUSAO':
1998
- case 'EUUSPC':
1999
- return true;
2000
- default:
2001
- return false;
2002
- }
2003
- };
2004
- /**
2005
- * @private
2006
- * @param {?} role
2007
- * @return {?}
2008
- */
2009
- SmartAuthService.prototype.isIntakeRole = /**
2010
- * @private
2011
- * @param {?} role
2012
- * @return {?}
2013
- */
2014
- function (role) {
2015
- switch (role.roleId) {
2016
- case 'OPA':
2017
- case 'OPS':
2018
- case 'SOPS':
2019
- return true;
2020
- default:
2021
- return false;
2022
- }
2023
- };
2024
- /**
2025
- * @private
2026
- * @param {?} element
2027
- * @return {?}
2028
- */
2029
- SmartAuthService.prototype.disableHtmlElement = /**
2030
- * @private
2031
- * @param {?} element
2032
- * @return {?}
2033
- */
2034
- function (element) {
2035
- // console.log(element);
2036
- switch (element.nodeName) {
2037
- case 'A':
2038
- element.setAttribute('style', 'pointer-events: none;cursor: not-allowed;');
2039
- element.setAttribute('tabIndex', '-1');
2040
- break;
2041
- default:
2042
- element.setAttribute('disabled', 'disabled');
2043
- break;
2044
- }
2045
- };
2046
- /**
2047
- * @private
2048
- * @param {?} element
2049
- * @return {?}
2050
- */
2051
- SmartAuthService.prototype.hideHtmlElement = /**
2052
- * @private
2053
- * @param {?} element
2054
- * @return {?}
2055
- */
2056
- function (element) {
2057
- // element.setAttribute('hidden', 'hidden');
2058
- element.setAttribute('style', 'display: none;');
2059
- };
2060
- /**
2061
- * @private
2062
- * @param {?} userName
2063
- * @return {?}
2064
- */
2065
- SmartAuthService.prototype.getStaff = /**
2066
- * @private
2067
- * @param {?} userName
2068
- * @return {?}
2069
- */
2070
- function (userName) {
2071
- var _this = this;
2072
- /** @type {?} */
2073
- var queryString = "\n {\n findvStaffs(input: {where: {userName: \"" + userName + "\", activeFlag: true}}) {\n totalCount\n message\n data {\n staffId\n userName\n lastName\n firstName\n phone\n email\n roles {\n roleId\n role\n }\n permissions {\n roleId\n appModuleId\n resource\n assignmentStaffRelationId\n readFlag\n createFlag\n updateFlag\n deleteFlag\n assignFlag\n reopenFlag\n closeFlag\n expungeFlag\n }\n options {\n offenderListOptionId\n name\n serviceApiFieldName\n selectedFlag\n }\n }\n }\n }";
2074
- return this.http
2075
- .post(this.smartDataServiceUrl, { query: queryString })
2076
- .pipe(operators.take(1), operators.map(( /**
2077
- * @param {?} result
2078
- * @return {?}
2079
- */function (result) {
2080
- if (i0.isDevMode) {
2081
- console.log('##### getStaff() from service ', result);
2082
- }
2083
- if (result.data.findvStaffs.data.length > 0) {
2084
- /** @type {?} */
2085
- var data = result.data.findvStaffs.data[0];
2086
- _this.xdmService.setLoginStaff(data);
2087
- _this.loginStaff = data;
2088
- return data;
2089
- }
2090
- else {
2091
- return null;
2092
- // return throwError('No access right.');
2093
- }
2094
- })), operators.catchError(( /**
2095
- * @param {?} error
2096
- * @return {?}
2097
- */function (error) {
2098
- console.log('error ' + error);
2099
- return null;
2100
- })));
2101
- };
2102
- /**
2103
- * @private
2104
- * @param {?} staffId
2105
- * @param {?} offenderId
2106
- * @return {?}
2107
- */
2108
- SmartAuthService.prototype.getStaffOffenderRelation = /**
2109
- * @private
2110
- * @param {?} staffId
2111
- * @param {?} offenderId
2112
- * @return {?}
2113
- */
2114
- function (staffId, offenderId) {
2115
- /** @type {?} */
2116
- var queryString = "\n {\n findvStaffOffenderRelations(input: {where: {staffId: " + staffId + ", offenderId: " + offenderId + "}}) {\n data {\n assignmentStaffRelationId\n }\n }\n }";
2117
- return this.http
2118
- .post(this.smartDataServiceUrl, { query: queryString })
2119
- .pipe(operators.take(1), operators.map(( /**
2120
- * @param {?} result
2121
- * @return {?}
2122
- */function (result) {
2123
- if (i0.isDevMode) {
2124
- console.log('##### getStaffOffenderRelation() from service ', result);
2125
- }
2126
- if (result.data.findvStaffOffenderRelations.data.length > 0) {
2127
- /** @type {?} */
2128
- var data = result.data.findvStaffOffenderRelations.data[0];
2129
- return data.assignmentStaffRelationId;
2130
- }
2131
- else {
2132
- return null;
2133
- // return throwError('No access right.');
2134
- }
2135
- })), operators.catchError(( /**
2136
- * @param {?} error
2137
- * @return {?}
2138
- */function (error) {
2139
- console.log('error ' + error);
2140
- return null;
2141
- })));
2142
- };
2143
- /**
2144
- * @private
2145
- * @param {?} appModuleId
2146
- * @param {?} resource
2147
- * @return {?}
2148
- */
2149
- SmartAuthService.prototype.getRolePermissions = /**
2150
- * @private
2151
- * @param {?} appModuleId
2152
- * @param {?} resource
2153
- * @return {?}
2154
- */
2155
- function (appModuleId, resource) {
2156
- /** @type {?} */
2157
- var queryString = "\n query findvRolePermissionPivots{\n findvRolePermissionPivots(input: {where: {appModuleId: " + appModuleId + ", resource: " + resource + "}}){\n totalCount\n message\n }\n }";
2158
- return this.http
2159
- .post(this.smartDataServiceUrl, { query: queryString })
2160
- .pipe(operators.take(1), operators.map(( /**
2161
- * @param {?} result
2162
- * @return {?}
2163
- */function (result) {
2164
- if (i0.isDevMode) {
2165
- console.log('##### findvRolePermissionPivots() from service ', result);
2166
- }
2167
- if (result.data.findvRolePermissionPivots.totalCount > 0) {
2168
- return true;
2169
- }
2170
- else {
2171
- return false;
2172
- // return throwError('No access right.');
2173
- }
2174
- })), operators.catchError(( /**
2175
- * @param {?} error
2176
- * @return {?}
2177
- */function (error) {
2178
- console.log('error ' + error);
2179
- return rxjs.throwError(error);
2180
- })));
2181
- };
2182
- SmartAuthService.decorators = [
2183
- { type: i0.Injectable, args: [{
2184
- providedIn: 'root',
2185
- },] }
2186
- ];
2187
- /** @nocollapse */
2188
- SmartAuthService.ctorParameters = function () {
2189
- return [
2190
- { type: i1$1.HttpClient },
2191
- { type: i2.MsalService },
2192
- { type: XdmService },
2193
- { type: undefined, decorators: [{ type: i0.Inject, args: [SMART_DATA_SERVICE_URL,] }] },
2194
- { type: String, decorators: [{ type: i0.Inject, args: [SMART_DOMAIN_FORMAT,] }] }
2195
- ];
2196
- };
2197
- /** @nocollapse */ SmartAuthService.ngInjectableDef = i0.defineInjectable({ factory: function SmartAuthService_Factory() { return new SmartAuthService(i0.inject(i1$1.HttpClient), i0.inject(i2.MsalService), i0.inject(XdmService), i0.inject(SMART_DATA_SERVICE_URL), i0.inject(SMART_DOMAIN_FORMAT)); }, token: SmartAuthService, providedIn: "root" });
2198
- return SmartAuthService;
2199
- }());
2200
-
2201
- /**
2202
- * @fileoverview added by tsickle
2203
- * Generated from: lib/smart-auth/smart-access-control.directive.ts
2204
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2205
- */
2206
- var SmartAccessControlDirective = /** @class */ (function () {
2207
- function SmartAccessControlDirective(elementRef, auth) {
2208
- this.elementRef = elementRef;
2209
- this.auth = auth;
2210
- }
2211
- /**
2212
- * @return {?}
2213
- */
2214
- SmartAccessControlDirective.prototype.ngOnInit = /**
2215
- * @return {?}
2216
- */
2217
- function () {
2218
- this.checkAccess();
2219
- };
2220
- /**
2221
- * @return {?}
2222
- */
2223
- SmartAccessControlDirective.prototype.checkAccess = /**
2224
- * @return {?}
2225
- */
2226
- function () {
2227
- if (!this.accessControlConfig ||
2228
- !this.accessControlConfig.route ||
2229
- !this.accessControlConfig.route.data ||
2230
- !this.accessControlConfig.route.data.loginStaff ||
2231
- !this.accessControlConfig.route.data.selectedOffender) {
2232
- return;
2233
- }
2234
- // const loginStaff = this.accessControlConfig.route.data.loginStaff;
2235
- // if (!this.auth.isAuthEnable(loginStaff.roles, this.accessControlConfig.appModuleId)) {
2236
- // return;
2237
- // }
2238
- this.elementRef.nativeElement.style.display = this.auth.checkPermission(this.accessControlConfig)
2239
- ? 'block'
2240
- : 'none';
2241
- };
2242
- SmartAccessControlDirective.decorators = [
2243
- { type: i0.Directive, args: [{
2244
- selector: '[accessControl]',
2245
- },] }
2246
- ];
2247
- /** @nocollapse */
2248
- SmartAccessControlDirective.ctorParameters = function () {
2249
- return [
2250
- { type: i0.ElementRef },
2251
- { type: SmartAuthService }
2252
- ];
2253
- };
2254
- SmartAccessControlDirective.propDecorators = {
2255
- accessControlConfig: [{ type: i0.Input }]
2256
- };
2257
- return SmartAccessControlDirective;
2258
- }());
2259
-
2260
- /**
2261
- * @fileoverview added by tsickle
2262
- * Generated from: lib/smart-auth/smart-authorization-guard.service.ts
2263
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2264
- */
2265
- var SmartAuthorizationGuard = /** @class */ (function () {
2266
- function SmartAuthorizationGuard(authnService) {
2267
- this.authnService = authnService;
2268
- }
2269
- /**
2270
- * @param {?} route
2271
- * @return {?}
2272
- */
2273
- SmartAuthorizationGuard.prototype.canActivate = /**
2274
- * @param {?} route
2275
- * @return {?}
2276
- */
2277
- function (route) {
2278
- var _this = this;
2279
- return this.authnService.getLoginStaff().pipe(operators.take(1), operators.mergeMap(( /**
2280
- * @param {?} loginStaff
2281
- * @return {?}
2282
- */function (loginStaff) {
2283
- if (!loginStaff || !route || !route.routeConfig) {
2284
- return rxjs.of(false);
2285
- }
2286
- // if (!this.authnService.isAuthEnable(loginStaff.roles, null)) {
2287
- // return of(true);
2288
- // }
2289
- /** @type {?} */
2290
- var resource = route.routeConfig.path
2291
- ? route.routeConfig.path.split('/')[0]
2292
- : '';
2293
- /** @type {?} */
2294
- var isFeatureValid = _this.authnService.canAppFeatureActivate(loginStaff, resource);
2295
- return rxjs.of(isFeatureValid);
2296
- })), operators.catchError(( /**
2297
- * @param {?} error
2298
- * @return {?}
2299
- */function (error) {
2300
- return rxjs.of(false);
2301
- })));
2302
- };
2303
- SmartAuthorizationGuard.decorators = [
2304
- { type: i0.Injectable }
2305
- ];
2306
- /** @nocollapse */
2307
- SmartAuthorizationGuard.ctorParameters = function () {
2308
- return [
2309
- { type: SmartAuthService }
2310
- ];
2311
- };
2312
- return SmartAuthorizationGuard;
2313
- }());
2314
-
2315
- /**
2316
- * @fileoverview added by tsickle
2317
- * Generated from: lib/ngc-smart-core.module.ts
2318
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2319
- */
2320
- var NgcSmartCoreModule = /** @class */ (function () {
2321
- function NgcSmartCoreModule() {
2322
- }
2323
- NgcSmartCoreModule.decorators = [
2324
- { type: i0.NgModule, args: [{
2325
- declarations: [
2326
- SmartOffenderHeaderComponent,
2327
- SmartNavbarComponent,
2328
- SmartErrorComponent,
2329
- SmartStaffOffenderOptionsComponent,
2330
- SmartAccessControlDirective,
2331
- ],
2332
- imports: [
2333
- i1.CommonModule,
2334
- i1$1.HttpClientModule,
2335
- material.MatButtonModule,
2336
- material.MatMenuModule,
2337
- material.MatTabsModule,
2338
- material.MatSelectModule,
2339
- material.MatCardModule,
2340
- material.MatCheckboxModule,
2341
- forms.ReactiveFormsModule,
2342
- ],
2343
- exports: [
2344
- SmartOffenderHeaderComponent,
2345
- SmartNavbarComponent,
2346
- SmartErrorComponent,
2347
- SmartStaffOffenderOptionsComponent,
2348
- SmartAccessControlDirective,
2349
- ],
2350
- providers: [
2351
- SmartNavbarService,
2352
- SmartOffenderHeaderService,
2353
- SmartStaffOffenderOptionsService,
2354
- SmartAuthorizationGuard,
2355
- material.MatSnackBar,
2356
- ],
2357
- },] }
2358
- ];
2359
- return NgcSmartCoreModule;
2360
- }());
2361
-
2362
- /**
2363
- * @fileoverview added by tsickle
2364
- * Generated from: lib/smart-auth/smart-login-staff-resolver.service.ts
2365
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2366
- */
2367
- var LoginStaffResolverService = /** @class */ (function () {
2368
- function LoginStaffResolverService(authnService, router) {
2369
- this.authnService = authnService;
2370
- this.router = router;
2371
- }
2372
- /**
2373
- * @param {?} route
2374
- * @param {?} state
2375
- * @return {?}
2376
- */
2377
- LoginStaffResolverService.prototype.resolve = /**
2378
- * @param {?} route
2379
- * @param {?} state
2380
- * @return {?}
2381
- */
2382
- function (route, state) {
2383
- var _this = this;
2384
- return this.authnService.getLoginStaff().pipe(operators.take(1), operators.mergeMap(( /**
2385
- * @param {?} loginStaff
2386
- * @return {?}
2387
- */function (loginStaff) {
2388
- if (i0.isDevMode) {
2389
- console.log('LoginStaffResolverService: ', loginStaff);
2390
- }
2391
- if (loginStaff) {
2392
- return rxjs.of(loginStaff);
2393
- }
2394
- else {
2395
- return rxjs.throwError('Not authorized to access SMART.');
2396
- // return EMPTY;
2397
- /*
2398
- this.zone.run(() => {
2399
- this.router.navigate(['/smart-error'], {
2400
- queryParams: {
2401
- type: 'staff',
2402
- message: 'Not authorized to access SMART.'
2403
- }
2404
- });
2405
- });
2406
- return EMPTY;
2407
- */
2408
- }
2409
- })), operators.catchError(( /**
2410
- * @param {?} error
2411
- * @return {?}
2412
- */function (error) {
2413
- console.log('LoginStaffResolverService: ' + error);
2414
- _this.router.navigate(['/smart-error'], {
2415
- queryParams: {
2416
- type: 'staff',
2417
- message: 'SMART Authentication: ' + error,
2418
- },
2419
- });
2420
- return rxjs.EMPTY;
2421
- })));
2422
- };
2423
- LoginStaffResolverService.decorators = [
2424
- { type: i0.Injectable, args: [{
2425
- providedIn: 'root',
2426
- },] }
2427
- ];
2428
- /** @nocollapse */
2429
- LoginStaffResolverService.ctorParameters = function () {
2430
- return [
2431
- { type: SmartAuthService },
2432
- { type: i2$1.Router }
2433
- ];
2434
- };
2435
- /** @nocollapse */ LoginStaffResolverService.ngInjectableDef = i0.defineInjectable({ factory: function LoginStaffResolverService_Factory() { return new LoginStaffResolverService(i0.inject(SmartAuthService), i0.inject(i2$1.Router)); }, token: LoginStaffResolverService, providedIn: "root" });
2436
- return LoginStaffResolverService;
2437
- }());
2438
-
2439
- /**
2440
- * @fileoverview added by tsickle
2441
- * Generated from: lib/smart-auth/smart-selected-offender-resolver.service.ts
2442
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2443
- */
2444
- var SelectedOffenderResolverService = /** @class */ (function () {
2445
- function SelectedOffenderResolverService(service, zone, router) {
2446
- this.service = service;
2447
- this.zone = zone;
2448
- this.router = router;
2449
- }
2450
- /**
2451
- * @param {?} route
2452
- * @param {?} state
2453
- * @return {?}
2454
- */
2455
- SelectedOffenderResolverService.prototype.resolve = /**
2456
- * @param {?} route
2457
- * @param {?} state
2458
- * @return {?}
2459
- */
2460
- function (route, state) {
2461
- var _this = this;
2462
- return rxjs.from(this.service.getSelectedOffender()).pipe(operators.mergeMap(( /**
2463
- * @param {?} selectedOffender
2464
- * @return {?}
2465
- */function (selectedOffender) {
2466
- if (i0.isDevMode) {
2467
- console.log(selectedOffender);
2468
- }
2469
- if (!selectedOffender) {
2470
- return rxjs.throwError('No offender selected.');
2471
- }
2472
- return rxjs.of(selectedOffender);
2473
- })), operators.retryWhen(( /**
2474
- * @param {?} errors
2475
- * @return {?}
2476
- */function (errors) {
2477
- return errors.pipe(
2478
- // tap(() => console.log('Retry getting selected offender.')),
2479
- operators.delay(1000), operators.take(5), ( /**
2480
- * @param {?} o
2481
- * @return {?}
2482
- */function (o) {
2483
- return rxjs.concat(o, rxjs.throwError('No offender selected (failed after retries).'));
2484
- }));
2485
- })), operators.catchError(( /**
2486
- * @param {?} error
2487
- * @return {?}
2488
- */function (error) {
2489
- /*
2490
- this.zone.run(() => {
2491
- this.router.navigate(['/smart-error'], {
2492
- queryParams: { type: 'offender', message: error }
2493
- });
2494
- });
2495
- */
2496
- _this.router.navigate(['/smart-error'], {
2497
- queryParams: { type: 'offender', message: error },
2498
- });
2499
- return rxjs.EMPTY;
2500
- })));
2501
- };
2502
- SelectedOffenderResolverService.decorators = [
2503
- { type: i0.Injectable, args: [{
2504
- providedIn: 'root',
2505
- },] }
2506
- ];
2507
- /** @nocollapse */
2508
- SelectedOffenderResolverService.ctorParameters = function () {
2509
- return [
2510
- { type: XdmService },
2511
- { type: i0.NgZone },
2512
- { type: i2$1.Router }
2513
- ];
2514
- };
2515
- /** @nocollapse */ SelectedOffenderResolverService.ngInjectableDef = i0.defineInjectable({ factory: function SelectedOffenderResolverService_Factory() { return new SelectedOffenderResolverService(i0.inject(XdmService), i0.inject(i0.NgZone), i0.inject(i2$1.Router)); }, token: SelectedOffenderResolverService, providedIn: "root" });
2516
- return SelectedOffenderResolverService;
2517
- }());
2518
-
2519
- /**
2520
- * @fileoverview added by tsickle
2521
- * Generated from: lib/smart-staff-offender-options/smart-staff-offender-options-resolver.service.ts
2522
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2523
- */
2524
- var SmartStaffOffenderOptionsResolverService = /** @class */ (function () {
2525
- function SmartStaffOffenderOptionsResolverService(offenderService) {
2526
- this.offenderService = offenderService;
2527
- }
2528
- /**
2529
- * @return {?}
2530
- */
2531
- SmartStaffOffenderOptionsResolverService.prototype.resolve = /**
2532
- * @return {?}
2533
- */
2534
- function () {
2535
- return this.offenderService.getOffenderListOptions()
2536
- .pipe(operators.map(( /**
2537
- * @param {?} __0
2538
- * @return {?}
2539
- */function (_a) {
2540
- var data = _a.data;
2541
- return data;
2542
- })));
2543
- };
2544
- SmartStaffOffenderOptionsResolverService.decorators = [
2545
- { type: i0.Injectable, args: [{
2546
- providedIn: 'root',
2547
- },] }
2548
- ];
2549
- /** @nocollapse */
2550
- SmartStaffOffenderOptionsResolverService.ctorParameters = function () {
2551
- return [
2552
- { type: SmartStaffOffenderOptionsService }
2553
- ];
2554
- };
2555
- /** @nocollapse */ SmartStaffOffenderOptionsResolverService.ngInjectableDef = i0.defineInjectable({ factory: function SmartStaffOffenderOptionsResolverService_Factory() { return new SmartStaffOffenderOptionsResolverService(i0.inject(SmartStaffOffenderOptionsService)); }, token: SmartStaffOffenderOptionsResolverService, providedIn: "root" });
2556
- return SmartStaffOffenderOptionsResolverService;
2557
- }());
2558
-
2559
- /**
2560
- * @fileoverview added by tsickle
2561
- * Generated from: lib/smart-auth/smart-access-control-config.ts
2562
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2563
- */
2564
- /** @enum {string} */
2565
- var AccessType = {
2566
- READ: "read",
2567
- CREATE: "create",
2568
- UPDATE: "update",
2569
- DELETE: "delete",
2570
- EXPUNGE: "expunge",
2571
- ASSIGN: "assign",
2572
- REOPEN: "reopen",
2573
- CLOSE: "close",
2574
- };
2575
-
2576
- /**
2577
- * @fileoverview added by tsickle
2578
- * Generated from: public-api.ts
2579
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2580
- */
2581
-
2582
- /**
2583
- * @fileoverview added by tsickle
2584
- * Generated from: csmart-ngc-smart-core.ts
2585
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2586
- */
2587
-
2588
- exports.NgcSmartCoreModule = NgcSmartCoreModule;
2589
- exports.SmartAuthService = SmartAuthService;
2590
- exports.LoginStaffResolverService = LoginStaffResolverService;
2591
- exports.SelectedOffenderResolverService = SelectedOffenderResolverService;
2592
- exports.SmartErrorComponent = SmartErrorComponent;
2593
- exports.SmartNavbarService = SmartNavbarService;
2594
- exports.XdmService = XdmService;
2595
- exports.Permission = Permission;
2596
- exports.Role = Role;
2597
- exports.Option = Option;
2598
- exports.LoginStaff = LoginStaff;
2599
- exports.SelectedOffender = SelectedOffender;
2600
- exports.OffenderQuery = OffenderQuery;
2601
- exports.StorageKey = StorageKey;
2602
- exports.SMART_WEB_STORAGE_LISTENER_URL = SMART_WEB_STORAGE_LISTENER_URL;
2603
- exports.SMART_WEB_PORTAL_URL = SMART_WEB_PORTAL_URL;
2604
- exports.SMART_DATA_SERVICE_URL = SMART_DATA_SERVICE_URL;
2605
- exports.SMART_DOMAIN_FORMAT = SMART_DOMAIN_FORMAT;
2606
- exports.SmartStaffOffenderOptionsComponent = SmartStaffOffenderOptionsComponent;
2607
- exports.SmartStaffOffenderOptionsResolverService = SmartStaffOffenderOptionsResolverService;
2608
- exports.AccessType = AccessType;
2609
- exports.SmartAuthorizationGuard = SmartAuthorizationGuard;
2610
- exports.ɵe = SmartAccessControlDirective;
2611
- exports.ɵc = SmartNavbarComponent;
2612
- exports.ɵa = SmartOffenderHeaderComponent;
2613
- exports.ɵb = SmartOffenderHeaderService;
2614
- exports.ɵd = SmartStaffOffenderOptionsService;
2615
-
2616
- Object.defineProperty(exports, '__esModule', { value: true });
2617
-
2618
- })));
2619
-
2620
- //# sourceMappingURL=csmart-ngc-smart-core.umd.js.map