@csmart/ngc-smart-core 0.7.93 → 1.13.0

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