@csmart/ngc-smart-core 0.7.94 → 1.13.1

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