@osovitny/anatoly 2.0.22 → 2.0.25

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 (62) hide show
  1. package/bundles/osovitny-anatoly.umd.js +1077 -347
  2. package/bundles/osovitny-anatoly.umd.js.map +1 -1
  3. package/bundles/osovitny-anatoly.umd.min.js +2 -3
  4. package/bundles/osovitny-anatoly.umd.min.js.map +1 -1
  5. package/esm2015/lib/core/alerts.js +52 -52
  6. package/esm2015/lib/core/consts/index.js +2 -1
  7. package/esm2015/lib/core/consts/urls.js +22 -0
  8. package/esm2015/lib/core/convert.js +31 -0
  9. package/esm2015/lib/core/core.module.js +7 -3
  10. package/esm2015/lib/core/index.js +5 -5
  11. package/esm2015/lib/core/localization/index.js +26 -0
  12. package/esm2015/lib/core/localization/localization.module.js +41 -0
  13. package/esm2015/lib/core/localization/localization.service.js +115 -0
  14. package/esm2015/lib/core/localization/localizationSettings.module.js +70 -0
  15. package/esm2015/lib/core/localization/localize.pipe.js +65 -0
  16. package/esm2015/lib/core/notifications/alerts.js +107 -0
  17. package/esm2015/lib/core/notifications/interfaces/notification.js +19 -0
  18. package/esm2015/lib/core/notifications/services/notification-service.js +230 -0
  19. package/esm2015/lib/core/subs.js +1 -1
  20. package/esm2015/lib/core/utils.js +47 -14
  21. package/esm2015/lib/data/base/base-api.service.js +26 -30
  22. package/esm2015/lib/data/consts.js +24 -0
  23. package/esm2015/lib/data/data.module.js +16 -5
  24. package/esm2015/lib/data/index.js +6 -6
  25. package/esm2015/lib/data/services/billing-api.service.js +4 -5
  26. package/esm2015/lib/ui/index.js +4 -4
  27. package/esm2015/lib/ui/ui.module.js +25 -25
  28. package/esm2015/lib/ui/validation/form-validation-summary.component.js +64 -0
  29. package/esm2015/lib/ui/validation/item-validation-summary.component.js +38 -0
  30. package/esm2015/lib/ui/validation/validation-summary.component.js +117 -0
  31. package/esm2015/public-api.js +6 -1
  32. package/fesm2015/osovitny-anatoly.js +1027 -305
  33. package/fesm2015/osovitny-anatoly.js.map +1 -1
  34. package/lib/core/consts/index.d.ts +1 -0
  35. package/lib/core/consts/urls.d.ts +3 -0
  36. package/lib/core/convert.d.ts +7 -0
  37. package/lib/core/index.d.ts +4 -4
  38. package/lib/core/localization/index.d.ts +4 -0
  39. package/lib/core/localization/localization.module.d.ts +2 -0
  40. package/lib/core/localization/localization.service.d.ts +18 -0
  41. package/lib/core/localization/localizationSettings.module.d.ts +10 -0
  42. package/lib/core/localization/localize.pipe.d.ts +7 -0
  43. package/lib/core/notifications/alerts.d.ts +9 -0
  44. package/lib/core/notifications/interfaces/notification.d.ts +10 -0
  45. package/lib/core/notifications/services/notification-service.d.ts +22 -0
  46. package/lib/core/subs.d.ts +1 -1
  47. package/lib/core/utils.d.ts +4 -0
  48. package/lib/data/base/base-api.service.d.ts +2 -3
  49. package/lib/data/consts.d.ts +4 -0
  50. package/lib/data/data.module.d.ts +1 -0
  51. package/lib/data/index.d.ts +5 -5
  52. package/lib/ui/index.d.ts +3 -3
  53. package/lib/ui/ui.module.d.ts +2 -2
  54. package/lib/ui/{components/validation → validation}/validation-summary.component.d.ts +1 -1
  55. package/osovitny-anatoly.metadata.json +1 -1
  56. package/package.json +1 -1
  57. package/public-api.d.ts +5 -0
  58. package/esm2015/lib/ui/components/validation/form-validation-summary.component.js +0 -64
  59. package/esm2015/lib/ui/components/validation/item-validation-summary.component.js +0 -38
  60. package/esm2015/lib/ui/components/validation/validation-summary.component.js +0 -117
  61. /package/lib/ui/{components/validation → validation}/form-validation-summary.component.d.ts +0 -0
  62. /package/lib/ui/{components/validation → validation}/item-validation-summary.component.d.ts +0 -0
@@ -1,10 +1,11 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('sweetalert2'), require('uuid'), require('@angular/core'), require('@angular/router'), require('@angular/common/http'), require('rxjs/operators'), require('rxjs'), require('@angular/common'), require('@angular/forms'), require('angular-froala-wysiwyg')) :
3
- typeof define === 'function' && define.amd ? define('@osovitny/anatoly', ['exports', 'sweetalert2', 'uuid', '@angular/core', '@angular/router', '@angular/common/http', 'rxjs/operators', 'rxjs', '@angular/common', '@angular/forms', 'angular-froala-wysiwyg'], factory) :
4
- (global = global || self, factory((global.osovitny = global.osovitny || {}, global.osovitny.anatoly = {}), global.Swal, global.uuid, global.ng.core, global.ng.router, global.ng.common.http, global.rxjs.operators, global.rxjs, global.ng.common, global.ng.forms, global.angularFroalaWysiwyg));
5
- }(this, (function (exports, Swal, uuid, i0, router, http, operators, rxjs, common, forms, angularFroalaWysiwyg) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('sweetalert2'), require('@angular/core'), require('@angular/common'), require('@angular/common/http'), require('rxjs/operators'), require('rxjs'), require('ngx-toastr'), require('uuid'), require('@ngx-translate/core'), require('date-fns'), require('date-fns/locale/en-US'), require('@angular/router'), require('@angular/forms'), require('angular-froala-wysiwyg'), require('@ngx-translate/http-loader')) :
3
+ typeof define === 'function' && define.amd ? define('@osovitny/anatoly', ['exports', 'sweetalert2', '@angular/core', '@angular/common', '@angular/common/http', 'rxjs/operators', 'rxjs', 'ngx-toastr', 'uuid', '@ngx-translate/core', 'date-fns', 'date-fns/locale/en-US', '@angular/router', '@angular/forms', 'angular-froala-wysiwyg', '@ngx-translate/http-loader'], factory) :
4
+ (global = global || self, factory((global.osovitny = global.osovitny || {}, global.osovitny.anatoly = {}), global.Swal, global.ng.core, global.ng.common, global.ng.common.http, global.rxjs.operators, global.rxjs, global.i1, global.uuid, global.i1$1, global.dateFns, global.enUS, global.ng.router, global.ng.forms, global.angularFroalaWysiwyg, global.httpLoader));
5
+ }(this, (function (exports, Swal, i0, common, http, operators, rxjs, i1, uuid, i1$1, dateFns, enUS, router, forms, angularFroalaWysiwyg, httpLoader) { 'use strict';
6
6
 
7
7
  Swal = Swal && Object.prototype.hasOwnProperty.call(Swal, 'default') ? Swal['default'] : Swal;
8
+ enUS = enUS && Object.prototype.hasOwnProperty.call(enUS, 'default') ? enUS['default'] : enUS;
8
9
 
9
10
  /*
10
11
  <file>
@@ -27,6 +28,28 @@
27
28
  var ContextInitState = JSON.parse((document.getElementById('contextInitState')).getAttribute('data-contextinitstate'));
28
29
  var AppCoreSettings = JSON.parse((document.getElementById('appCoreSettings')).getAttribute('data-appcoresettings'));
29
30
 
31
+ /*
32
+ <file>
33
+ Project:
34
+ MICE
35
+
36
+ Authors:
37
+ Vadim Osovitny vaosovitny@deloitte.com
38
+
39
+ Created:
40
+ 5 May 2020
41
+
42
+ Version:
43
+ 1.0
44
+
45
+ Copyright (c) 2020 Deloitte Tax. All rights reserved.
46
+ </file>
47
+ */
48
+ var Urls = {
49
+ // SignalR Notifications
50
+ notificationsSocketUrl: '/hubs/notifications'
51
+ };
52
+
30
53
  /*
31
54
  <file>
32
55
  Project:
@@ -93,41 +116,41 @@
93
116
  }
94
117
  Alerts.Info = function (text) {
95
118
  Swal.fire({
96
- title: "Information",
119
+ title: 'Information',
97
120
  text: text,
98
- icon: "info",
99
- confirmButtonText: "OK",
121
+ icon: 'info',
122
+ confirmButtonText: 'OK',
100
123
  });
101
124
  };
102
125
  Alerts.Warning = function (text) {
103
126
  Swal.fire({
104
- title: "Warning",
127
+ title: 'Warning',
105
128
  text: text,
106
- icon: "warning",
107
- confirmButtonText: "OK",
129
+ icon: 'warning',
130
+ confirmButtonText: 'OK',
108
131
  });
109
132
  };
110
133
  Alerts.Error = function (text) {
111
134
  Swal.fire({
112
- title: "Error",
135
+ title: 'Error',
113
136
  text: text,
114
- icon: "error",
115
- confirmButtonText: "OK",
137
+ icon: 'error',
138
+ confirmButtonText: 'OK',
116
139
  });
117
140
  };
118
141
  Alerts.NotImplemented = function () {
119
- this.Warning("Not Implemented Yet");
142
+ this.Warning('Not Implemented Yet');
120
143
  };
121
144
  Alerts.ErrorOccurred = function () {
122
- this.Error("Sorry, an unexpected error occurred");
145
+ this.Error('Sorry, an unexpected error occurred');
123
146
  };
124
147
  Alerts.AreYouSure = function (text, title, confirmButtonText, cancelButtonText, successAction, cancelAction) {
125
- if (typeof title == "undefined" || title == null)
126
- title = "Are you sure?";
148
+ if (typeof title === 'undefined' || title == null)
149
+ title = 'Are you sure?';
127
150
  Swal.fire({
128
151
  title: title,
129
152
  text: text,
130
- icon: "warning",
153
+ icon: 'warning',
131
154
  confirmButtonText: confirmButtonText,
132
155
  cancelButtonText: cancelButtonText,
133
156
  showCancelButton: true,
@@ -138,8 +161,8 @@
138
161
  }
139
162
  }
140
163
  // result.dismiss can be 'cancel', 'overlay', 'close', and 'timer'
141
- else if (result.dismiss == Swal.DismissReason.cancel ||
142
- result.dismiss == Swal.DismissReason.close) {
164
+ else if (result.dismiss === Swal.DismissReason.cancel ||
165
+ result.dismiss === Swal.DismissReason.close) {
143
166
  if (cancelAction) {
144
167
  cancelAction();
145
168
  }
@@ -147,16 +170,16 @@
147
170
  });
148
171
  };
149
172
  Alerts.Success = function (text, title, successAction) {
150
- if (typeof title == "undefined" || title == null)
151
- title = "Success";
173
+ if (typeof title === 'undefined' || title == null)
174
+ title = 'Success';
152
175
  if (!text) {
153
- text = "Operation was successful";
176
+ text = 'Operation was successful';
154
177
  }
155
178
  Swal.fire({
156
179
  title: title,
157
180
  text: text,
158
- icon: "success",
159
- confirmButtonText: "OK",
181
+ icon: 'success',
182
+ confirmButtonText: 'OK',
160
183
  }).then(function () {
161
184
  if (successAction) {
162
185
  successAction();
@@ -165,25 +188,25 @@
165
188
  };
166
189
  Alerts.Cancel = function (text) {
167
190
  if (!text) {
168
- text = "Operation has been cancled";
191
+ text = 'Operation has been cancled';
169
192
  }
170
193
  Swal.fire({
171
- title: "Cancelled",
194
+ title: 'Cancelled',
172
195
  text: text,
173
- icon: "info",
196
+ icon: 'info',
174
197
  });
175
198
  };
176
- //Notifications
199
+ // Notifications
177
200
  Alerts.NotificationCancel = function (text, title) {
178
- if (typeof title == "undefined" || title == null) {
179
- title = "Canceled";
201
+ if (typeof title === 'undefined' || title == null) {
202
+ title = 'Canceled';
180
203
  }
181
204
  if (!text) {
182
- text = "Operation has been canceled";
205
+ text = 'Operation has been canceled';
183
206
  }
184
207
  var toast = Swal.mixin({
185
208
  toast: true,
186
- position: "top-end",
209
+ position: 'top-end',
187
210
  showConfirmButton: false,
188
211
  timer: 3000,
189
212
  timerProgressBar: true,
@@ -191,19 +214,19 @@
191
214
  toast.fire({
192
215
  title: title,
193
216
  text: text,
194
- icon: "info",
217
+ icon: 'info',
195
218
  });
196
219
  };
197
220
  Alerts.NotificationSuccess = function (text, title) {
198
- if (typeof title == "undefined" || title == null) {
199
- title = "Success";
221
+ if (typeof title === 'undefined' || title == null) {
222
+ title = 'Success';
200
223
  }
201
224
  if (!text) {
202
- text = "Operation was successful";
225
+ text = 'Operation was successful';
203
226
  }
204
227
  var toast = Swal.mixin({
205
228
  toast: true,
206
- position: "top-end",
229
+ position: 'top-end',
207
230
  showConfirmButton: false,
208
231
  timer: 3000,
209
232
  timerProgressBar: true,
@@ -211,247 +234,12 @@
211
234
  toast.fire({
212
235
  title: title,
213
236
  text: text,
214
- icon: "success",
237
+ icon: 'success',
215
238
  });
216
239
  };
217
240
  return Alerts;
218
241
  }());
219
242
 
220
- /*
221
- <file>
222
- Project:
223
- @osovitny/anatoly
224
-
225
- Authors:
226
- Vadim Osovitny
227
- Anatoly Osovitny
228
-
229
- Created:
230
- 26 Jun 2020
231
-
232
- Version:
233
- 1.0
234
-
235
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
236
- </file>
237
- */
238
- var Utils = /** @class */ (function () {
239
- function Utils() {
240
- }
241
- Utils.getValueByNameInQS = function (name) {
242
- return Utils.getValueByName(location.search, name);
243
- };
244
- Utils.getValueByName = function (url, name) {
245
- name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
246
- var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(url);
247
- return results === null
248
- ? ""
249
- : decodeURIComponent(results[1].replace(/\+/g, " "));
250
- };
251
- Utils.copyToClipBoard = function (event, val) {
252
- event.preventDefault();
253
- var selBox = document.createElement("textarea");
254
- selBox.style.position = "fixed";
255
- selBox.style.left = "0";
256
- selBox.style.top = "0";
257
- selBox.style.opacity = "0";
258
- selBox.value = val;
259
- document.body.appendChild(selBox);
260
- selBox.focus();
261
- selBox.select();
262
- document.execCommand("copy");
263
- document.body.removeChild(selBox);
264
- };
265
- Utils.downloadFile = function (name, url) {
266
- var link = document.createElement("a");
267
- link.download = name;
268
- link.href = url;
269
- link.click();
270
- };
271
- return Utils;
272
- }());
273
-
274
- /*
275
- <file>
276
- Project:
277
- @osovitny/anatoly
278
-
279
- Authors:
280
- Vadim Osovitny
281
- Anatoly Osovitny
282
-
283
- Created:
284
- 26 Jun 2020
285
-
286
- Version:
287
- 1.0
288
-
289
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
290
- </file>
291
- */
292
- var Subs = /** @class */ (function () {
293
- function Subs() {
294
- this.subs = [];
295
- }
296
- Subs.prototype.add = function () {
297
- var subscriptions = [];
298
- for (var _i = 0; _i < arguments.length; _i++) {
299
- subscriptions[_i] = arguments[_i];
300
- }
301
- this.subs = this.subs.concat(subscriptions);
302
- };
303
- Object.defineProperty(Subs.prototype, "sink", {
304
- set: function (subscription) {
305
- this.subs.push(subscription);
306
- },
307
- enumerable: false,
308
- configurable: true
309
- });
310
- Subs.prototype.unsubscribe = function () {
311
- this.subs.forEach(function (sub) { return sub && sub.unsubscribe(); });
312
- this.subs = [];
313
- };
314
- return Subs;
315
- }());
316
-
317
- /*
318
- <file>
319
- Project:
320
- @osovitny/anatoly
321
-
322
- Authors:
323
- Vadim Osovitny
324
- Anatoly Osovitny
325
-
326
- Created:
327
- 26 Jun 2020
328
-
329
- Version:
330
- 1.0
331
-
332
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
333
- </file>
334
- */
335
- var Guid = /** @class */ (function () {
336
- function Guid() {
337
- }
338
- Guid.newGuid = function () {
339
- return uuid.v4();
340
- };
341
- return Guid;
342
- }());
343
-
344
- /*
345
- <file>
346
- Project:
347
- @osovitny/anatoly
348
-
349
- Authors:
350
- Vadim Osovitny
351
- Anatoly Osovitny
352
-
353
- Created:
354
- 17 Jun 2018
355
-
356
- Version:
357
- 1.0
358
-
359
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
360
- </file>
361
- */
362
- var BaseGoService = /** @class */ (function () {
363
- function BaseGoService(route, router) {
364
- this.route = route;
365
- this.router = router;
366
- }
367
- BaseGoService.prototype.locationReload = function () {
368
- //this.router.navigate([this.route.url]);
369
- window.location.reload();
370
- };
371
- return BaseGoService;
372
- }());
373
- BaseGoService.decorators = [
374
- { type: i0.Injectable }
375
- ];
376
- BaseGoService.ctorParameters = function () { return [
377
- { type: router.ActivatedRoute },
378
- { type: router.Router }
379
- ]; };
380
-
381
- /*
382
- <file>
383
- Project:
384
- @osovitny/anatoly
385
-
386
- Authors:
387
- Vadim Osovitny
388
- Anatoly Osovitny
389
-
390
- Created:
391
- 26 Jun 2020
392
-
393
- Version:
394
- 1.0
395
-
396
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
397
- </file>
398
- */
399
- var LoggingService = /** @class */ (function () {
400
- function LoggingService() {
401
- }
402
- LoggingService.prototype.logError = function (error) {
403
- console.error(error);
404
- };
405
- LoggingService.prototype.logInformation = function (info) {
406
- console.info(info);
407
- };
408
- return LoggingService;
409
- }());
410
- LoggingService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LoggingService_Factory() { return new LoggingService(); }, token: LoggingService, providedIn: "root" });
411
- LoggingService.decorators = [
412
- { type: i0.Injectable, args: [{
413
- providedIn: "root",
414
- },] }
415
- ];
416
- LoggingService.ctorParameters = function () { return []; };
417
-
418
- /*
419
- <file>
420
- Project:
421
- @osovitny/anatoly
422
-
423
- Authors:
424
- Vadim Osovitny
425
- Anatoly Osovitny
426
-
427
- Created:
428
- 26 Jun 2020
429
-
430
- Version:
431
- 1.0
432
-
433
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
434
- </file>
435
- */
436
- var GlobalErrorHandler = /** @class */ (function () {
437
- function GlobalErrorHandler(injector) {
438
- this.injector = injector;
439
- }
440
- GlobalErrorHandler.prototype.handleError = function (error) {
441
- var loggingService = this.injector.get(LoggingService);
442
- loggingService.logError(error);
443
- // IMPORTANT: Rethrow the error otherwise it gets swallowed
444
- throw error;
445
- };
446
- return GlobalErrorHandler;
447
- }());
448
- GlobalErrorHandler.decorators = [
449
- { type: i0.Injectable }
450
- ];
451
- GlobalErrorHandler.ctorParameters = function () { return [
452
- { type: i0.Injector }
453
- ]; };
454
-
455
243
  /*! *****************************************************************************
456
244
  Copyright (c) Microsoft Corporation.
457
245
 
@@ -763,7 +551,7 @@
763
551
  Anatoly Osovitny
764
552
 
765
553
  Created:
766
- 13 Nov 2017
554
+ 26 Jun 2020
767
555
 
768
556
  Version:
769
557
  1.0
@@ -771,66 +559,99 @@
771
559
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
772
560
  </file>
773
561
  */
774
- var BaseApiService = /** @class */ (function () {
775
- function BaseApiService(http) {
776
- this.http = http;
777
- this.baseUrl = "";
562
+ var LoggingService = /** @class */ (function () {
563
+ function LoggingService() {
778
564
  }
779
- BaseApiService.prototype.serializeParams = function (data) {
780
- return data ? "?" + $.param(data) : "";
565
+ LoggingService.prototype.logError = function (error) {
566
+ console.error(error);
781
567
  };
782
- //api
783
- BaseApiService.prototype.get = function (action, data, responseType) {
784
- if (!responseType) {
785
- responseType = "json";
786
- }
787
- var url = this.baseUrl + "/" + action + this.serializeParams(data);
788
- return this.http
789
- .get(url, { responseType: responseType })
790
- .pipe(operators.map(function (res) { return res; }));
568
+ LoggingService.prototype.logInformation = function (info) {
569
+ console.info(info);
570
+ };
571
+ return LoggingService;
572
+ }());
573
+ LoggingService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LoggingService_Factory() { return new LoggingService(); }, token: LoggingService, providedIn: "root" });
574
+ LoggingService.decorators = [
575
+ { type: i0.Injectable, args: [{
576
+ providedIn: "root",
577
+ },] }
578
+ ];
579
+ LoggingService.ctorParameters = function () { return []; };
580
+
581
+ /*
582
+ <file>
583
+ Project:
584
+ @osovitny/anatoly
585
+
586
+ Authors:
587
+ Vadim Osovitny
588
+ Anatoly Osovitny
589
+
590
+ Created:
591
+ 13 Nov 2017
592
+
593
+ Version:
594
+ 1.0
595
+
596
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
597
+ </file>
598
+ */
599
+ var BaseApiService = /** @class */ (function () {
600
+ function BaseApiService(http) {
601
+ this.http = http;
602
+ this.baseUrl = '';
603
+ }
604
+ BaseApiService.prototype.serializeParams = function (data) {
605
+ return data ? '?' + $.param(data) : '';
606
+ };
607
+ // api
608
+ BaseApiService.prototype.get = function (action, data, responseType) {
609
+ if (!responseType) {
610
+ responseType = 'json';
611
+ }
612
+ var url = this.baseUrl + "/" + action + this.serializeParams(data);
613
+ return this.http
614
+ .get(url, { responseType: responseType })
615
+ .pipe(operators.map(function (res) { return res; }));
791
616
  };
792
617
  BaseApiService.prototype.post = function (action, data, responseType) {
793
618
  if (!responseType) {
794
- responseType = "text";
619
+ responseType = 'text';
795
620
  }
796
621
  var url = this.baseUrl + "/" + action;
797
622
  return this.http.post(url, data, { responseType: responseType });
798
623
  };
799
624
  BaseApiService.prototype.postQS = function (action, data, responseType) {
800
625
  if (!responseType) {
801
- responseType = "text";
626
+ responseType = 'text';
802
627
  }
803
628
  var url = this.baseUrl + "/" + action + this.serializeParams(data);
804
629
  return this.http.post(url, null, { responseType: responseType });
805
630
  };
806
631
  BaseApiService.prototype.delete = function (action, data, responseType) {
807
632
  if (!responseType) {
808
- responseType = "text";
633
+ responseType = 'text';
809
634
  }
810
635
  var url = this.baseUrl + "/" + action + this.serializeParams(data);
811
636
  return this.http.delete(url, { responseType: responseType });
812
637
  };
813
- //gets
638
+ // gets
814
639
  BaseApiService.prototype.getById = function (id) {
815
- return this.get("getById", { id: id });
640
+ return this.get('getById', { id: id });
816
641
  };
817
642
  BaseApiService.prototype.getAll = function (data) {
818
- return this.get("getall", data).pipe(operators.map(function (res) { return res; }));
643
+ return this.get('getall', data).pipe(operators.map(function (res) { return res; }));
819
644
  };
820
645
  BaseApiService.prototype.getJsonFile = function (fileName, jsonUrl, jsonVersion) {
821
646
  if (!jsonUrl) {
822
- jsonUrl = "/dist/jsons";
647
+ jsonUrl = '/dist/jsons';
823
648
  }
824
649
  if (!jsonVersion) {
825
- jsonVersion = "1.0";
650
+ jsonVersion = '1.0';
826
651
  }
827
- var url = jsonUrl + "/" + fileName + "?" + jsonVersion;
652
+ var url = jsonUrl + '/' + fileName + '?' + jsonVersion;
828
653
  return this.http.get(url).pipe(operators.map(function (res) { return res; }));
829
654
  };
830
- BaseApiService.prototype.getNewGuid = function () {
831
- var url = this.baseUrl + "/getNewGuid";
832
- return this.http.get(url, { responseType: "text" });
833
- };
834
655
  return BaseApiService;
835
656
  }());
836
657
  BaseApiService.decorators = [
@@ -930,15 +751,623 @@
930
751
  _this.isFreezed = false;
931
752
  }, timeout);
932
753
  };
933
- return LoadingService;
934
- }(rxjs.BehaviorSubject));
935
- LoadingService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LoadingService_Factory() { return new LoadingService(); }, token: LoadingService, providedIn: "root" });
936
- LoadingService.decorators = [
937
- { type: i0.Injectable, args: [{
938
- providedIn: "root",
939
- },] }
754
+ return LoadingService;
755
+ }(rxjs.BehaviorSubject));
756
+ LoadingService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LoadingService_Factory() { return new LoadingService(); }, token: LoadingService, providedIn: "root" });
757
+ LoadingService.decorators = [
758
+ { type: i0.Injectable, args: [{
759
+ providedIn: "root",
760
+ },] }
761
+ ];
762
+ LoadingService.ctorParameters = function () { return []; };
763
+
764
+ /*
765
+ <file>
766
+ Project:
767
+ @osovitny/anatoly
768
+
769
+ Authors:
770
+ Vadim Osovitny
771
+ Anatoly Osovitny
772
+
773
+ Created:
774
+ 26 Jun 2020
775
+
776
+ Version:
777
+ 1.0
778
+
779
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
780
+ </file>
781
+ */
782
+ var Guid = /** @class */ (function () {
783
+ function Guid() {
784
+ }
785
+ Guid.newGuid = function () {
786
+ return uuid.v4();
787
+ };
788
+ return Guid;
789
+ }());
790
+
791
+ // SignalR
792
+ // import * as signalR from '@microsoft/signalr';
793
+ // import { NotificationsApiService } from '../../../data/services/notifications/notifications-api-service';
794
+ var NotificationService = /** @class */ (function () {
795
+ function NotificationService(toastrService) {
796
+ this.toastrService = toastrService;
797
+ // SignalR
798
+ // private hubConnection: signalR.HubConnection;
799
+ // private socketUrl: string;
800
+ // Notifications
801
+ this._sessionNotifications = new rxjs.BehaviorSubject([]);
802
+ this._serverNotifications = new rxjs.BehaviorSubject([]);
803
+ // Public
804
+ this.sessionNotifications$ = this._sessionNotifications.asObservable();
805
+ this.serverNotifications$ = this._serverNotifications.asObservable();
806
+ // this.onInit();
807
+ }
808
+ /*
809
+ onInit() {
810
+ if (AppCoreSettings.AzureAD) {
811
+ this.authService.getAuthToken().subscribe((token: string) => {
812
+ this.startSignalRConnection(token);
813
+ });
814
+
815
+ return;
816
+ }
817
+
818
+ this.startSignalRConnection();
819
+ }
820
+
821
+ ngOnDestroy() {
822
+ this.stopSignalRConnection();
823
+ }
824
+
825
+ // SignalR
826
+ private startSignalRConnection(accessToken?) {
827
+ const cskii = AppCoreSettings.selectedClientID;
828
+ // tslint:disable-next-line:variable-name
829
+ const cskii_upn = AppCoreSettings.CSKII_UPN;
830
+ // tslint:disable-next-line:variable-name
831
+ const cli_sessionguid = AppCoreSettings.CLI_SessionGUID;
832
+
833
+ const url = this.socketUrl + '?cskii=' + cskii + '&cskii_upn=' + cskii_upn + '&cli_sessionguid=' + cli_sessionguid;
834
+
835
+ if (accessToken) {
836
+ this.hubConnection = new signalR.HubConnectionBuilder()
837
+ .withUrl(url, {
838
+ skipNegotiation: false,
839
+ transport: signalR.HttpTransportType.WebSockets,
840
+ accessTokenFactory: () => accessToken
841
+ })
842
+ .withAutomaticReconnect()
843
+ .configureLogging(signalR.LogLevel.Debug)
844
+ .build();
845
+ }
846
+ else {
847
+ this.hubConnection = new signalR.HubConnectionBuilder()
848
+ .withUrl(this.socketUrl, {
849
+ skipNegotiation: true,
850
+ transport: signalR.HttpTransportType.WebSockets
851
+ })
852
+ .withAutomaticReconnect()
853
+ .configureLogging(signalR.LogLevel.Debug)
854
+ .build();
855
+ }
856
+
857
+ this.hubConnection
858
+ .start()
859
+ .then(() => this.signalRConnection_onSuccess())
860
+ .catch(err => {
861
+ console.error('Connection failed to SignalR Notification Hub')
862
+ })
863
+ }
864
+
865
+ private signalRConnection_onSuccess() {
866
+ this.addReceiveMessageDataListener();
867
+
868
+ this.notificationsApiService.retrieveNotifications().subscribe(data => {
869
+ this.serverNotifications = data;
870
+ });
871
+ }
872
+
873
+ stopSignalRConnection() {
874
+ if (this.hubConnection) {
875
+ this.hubConnection.stop();
876
+ this.hubConnection = null;
877
+ }
878
+ }
879
+
880
+ private addReceiveMessageDataListener = () => {
881
+ this.hubConnection.on('ReceiveMessage', (message) => {
882
+ if (message) {
883
+ if (message.type === 'error') {
884
+ this.error(message.text, null, null, false);
885
+ }
886
+ else {
887
+ this.success(message.text, null, null, false);
888
+ }
889
+
890
+ const notification = {
891
+ id: message.id,
892
+ isNew: message.isNew,
893
+ isSession: true,
894
+ text: message.text,
895
+ type: message.type,
896
+ createdDate: message.createdDate
897
+ };
898
+
899
+ this.addSessionNotificationToList(notification);
900
+ }
901
+ });
902
+ }
903
+ */
904
+ NotificationService.prototype.addSessionNotification = function (text, type) {
905
+ var id = Guid.newGuid();
906
+ var notification = { id: id, isNew: true, isSession: true, text: text, type: type, createdDate: new Date(Date.now()).toISOString() };
907
+ this.addSessionNotificationToList(notification);
908
+ };
909
+ NotificationService.prototype.addSessionNotificationToList = function (notification) {
910
+ this.sessionNotifications = __spread([
911
+ notification
912
+ ], this.sessionNotifications);
913
+ };
914
+ // Public API
915
+ NotificationService.prototype.removeNotification = function (id, isSession) {
916
+ if (isSession) {
917
+ this.sessionNotifications = this.sessionNotifications.filter(function (notifications) { return notifications.id !== id; });
918
+ }
919
+ else {
920
+ this.serverNotifications = this.serverNotifications.filter(function (notifications) { return notifications.id !== id; });
921
+ }
922
+ };
923
+ NotificationService.prototype.success = function (text, params, title, createSessionNotification) {
924
+ if (createSessionNotification === void 0) { createSessionNotification = true; }
925
+ text = Utils.getLocalizedValue(text, params, 'OperationSuccessFull');
926
+ title = Utils.getLocalizedValue(title);
927
+ this.toastrService.success(text, title, {
928
+ timeOut: 3000,
929
+ progressBar: true
930
+ });
931
+ if (createSessionNotification) {
932
+ this.addSessionNotification(text, 'success');
933
+ }
934
+ };
935
+ NotificationService.prototype.info = function (text, params, title) {
936
+ text = Utils.getLocalizedValue(text, params);
937
+ title = Utils.getLocalizedValue(title);
938
+ this.toastrService.info(text, title, {
939
+ timeOut: 3000,
940
+ progressBar: true
941
+ });
942
+ };
943
+ NotificationService.prototype.warning = function (text, params, title) {
944
+ text = Utils.getLocalizedValue(text, params);
945
+ title = Utils.getLocalizedValue(title);
946
+ this.toastrService.warning(text, title, {
947
+ timeOut: 3000,
948
+ progressBar: true
949
+ });
950
+ };
951
+ NotificationService.prototype.error = function (text, params, title, createSessionNotification) {
952
+ if (createSessionNotification === void 0) { createSessionNotification = true; }
953
+ text = Utils.getLocalizedValue(text, params, 'ErrorOccured');
954
+ title = Utils.getLocalizedValue(title);
955
+ this.toastrService.error(text, title, {
956
+ timeOut: 3000,
957
+ progressBar: true
958
+ });
959
+ if (createSessionNotification) {
960
+ this.addSessionNotification(text, 'error');
961
+ }
962
+ };
963
+ NotificationService.prototype.cancel = function (text, params, title) {
964
+ text = Utils.getLocalizedValue(text, params, 'OperationCancelled');
965
+ title = Utils.getLocalizedValue(title);
966
+ this.toastrService.info(text, title, {
967
+ timeOut: 3000,
968
+ progressBar: true
969
+ });
970
+ };
971
+ Object.defineProperty(NotificationService.prototype, "sessionNotifications", {
972
+ // SessionNotifications
973
+ get: function () {
974
+ return this._sessionNotifications.getValue();
975
+ },
976
+ set: function (val) {
977
+ this._sessionNotifications.next(val);
978
+ },
979
+ enumerable: false,
980
+ configurable: true
981
+ });
982
+ Object.defineProperty(NotificationService.prototype, "serverNotifications", {
983
+ // ServerNotifications
984
+ get: function () {
985
+ return this._serverNotifications.getValue();
986
+ },
987
+ set: function (val) {
988
+ this._serverNotifications.next(val);
989
+ },
990
+ enumerable: false,
991
+ configurable: true
992
+ });
993
+ return NotificationService;
994
+ }());
995
+ NotificationService.ɵprov = i0.ɵɵdefineInjectable({ factory: function NotificationService_Factory() { return new NotificationService(i0.ɵɵinject(i1.ToastrService)); }, token: NotificationService, providedIn: "root" });
996
+ NotificationService.decorators = [
997
+ { type: i0.Injectable, args: [{ providedIn: 'root' },] }
998
+ ];
999
+ NotificationService.ctorParameters = function () { return [
1000
+ { type: i1.ToastrService }
1001
+ ]; };
1002
+
1003
+ var providers = [
1004
+ LoggingService,
1005
+ NotificationService,
1006
+ AppContextService,
1007
+ LoadingService
1008
+ ];
1009
+ var InjectorInstance;
1010
+ var AnatolyCoreModule = /** @class */ (function () {
1011
+ function AnatolyCoreModule(injector, parentModule) {
1012
+ this.injector = injector;
1013
+ throwIfAlreadyLoaded(parentModule, 'AnatolyCoreModule');
1014
+ InjectorInstance = this.injector;
1015
+ }
1016
+ return AnatolyCoreModule;
1017
+ }());
1018
+ AnatolyCoreModule.decorators = [
1019
+ { type: i0.NgModule, args: [{
1020
+ imports: [common.CommonModule],
1021
+ exports: [],
1022
+ providers: __spread(providers),
1023
+ },] }
1024
+ ];
1025
+ AnatolyCoreModule.ctorParameters = function () { return [
1026
+ { type: i0.Injector },
1027
+ { type: AnatolyCoreModule, decorators: [{ type: i0.Optional }, { type: i0.SkipSelf }] }
1028
+ ]; };
1029
+
1030
+ /*
1031
+ <file>
1032
+ Project:
1033
+ @osovitny/anatoly
1034
+
1035
+ Authors:
1036
+ Vadim Osovitny
1037
+ Anatoly Osovitny
1038
+
1039
+ Created:
1040
+ 29 June 2020
1041
+
1042
+ Version:
1043
+ 1.0
1044
+
1045
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1046
+ </file>
1047
+ */
1048
+ var Convert = /** @class */ (function () {
1049
+ function Convert() {
1050
+ }
1051
+ /**
1052
+ * Convert date time lo local time zone value.
1053
+ * @param value
1054
+ */
1055
+ Convert.toLocalizedDateTime = function (value) {
1056
+ if (value) {
1057
+ return new Date(Date.UTC(value.getFullYear(), value.getMonth(), value.getDate(), value.getHours(), value.getMinutes(), value.getSeconds(), value.getMilliseconds()));
1058
+ }
1059
+ return null;
1060
+ };
1061
+ return Convert;
1062
+ }());
1063
+
1064
+ /*
1065
+ <file>
1066
+ Project:
1067
+ @osovitny/anatoly
1068
+
1069
+ Authors:
1070
+ Vadim Osovitny
1071
+ Anatoly Osovitny
1072
+
1073
+ Created:
1074
+ 05 May 2020
1075
+
1076
+ Version:
1077
+ 1.0
1078
+
1079
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1080
+ </file>
1081
+ */
1082
+ var LocalizationService = /** @class */ (function () {
1083
+ function LocalizationService(translate) {
1084
+ this.translate = translate;
1085
+ this.setSupportedLanguages(['en']);
1086
+ }
1087
+ LocalizationService.prototype.format = function (str, args) {
1088
+ // tslint:disable-next-line:variable-name
1089
+ return str.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] !== 'undefined' ? args[number] : match; });
1090
+ };
1091
+ ;
1092
+ LocalizationService.prototype.configureTranslationSettings = function (translate) {
1093
+ var languageToSet = 'en';
1094
+ translate.setDefaultLang(languageToSet);
1095
+ return languageToSet;
1096
+ };
1097
+ LocalizationService.prototype.getBrowserLanguage = function () {
1098
+ return this.translate.getBrowserLang();
1099
+ };
1100
+ LocalizationService.prototype.getDatefnsLocale = function () {
1101
+ var dfnLocale;
1102
+ switch (this.getBrowserLanguage()) {
1103
+ case 'en':
1104
+ dfnLocale = { locale: enUS };
1105
+ break;
1106
+ default:
1107
+ dfnLocale = { locale: enUS };
1108
+ }
1109
+ return dfnLocale;
1110
+ };
1111
+ LocalizationService.prototype.setDefaultLanguage = function (lang) {
1112
+ this.translate.setDefaultLang(lang);
1113
+ };
1114
+ LocalizationService.prototype.setSupportedLanguages = function (languages) {
1115
+ this.translate.addLangs(languages);
1116
+ };
1117
+ LocalizationService.prototype.updateLanguage = function (language) {
1118
+ this.translate.use(language);
1119
+ };
1120
+ LocalizationService.prototype.getLocalizedValue = function (key, params) {
1121
+ var value = this.translate.instant(key);
1122
+ if (!params || params.length === 0) {
1123
+ return value;
1124
+ }
1125
+ return this.format(value, params);
1126
+ };
1127
+ LocalizationService.prototype.getLocalizedDate = function (key) {
1128
+ if (dateFns.isValid(new Date(key))) {
1129
+ return dateFns.format(new Date(key), AppCoreSettings.DATE_FORMATS.angular, this.dateFnsLocale);
1130
+ }
1131
+ return 'Invalid Date';
1132
+ };
1133
+ LocalizationService.prototype.getLocalizedDateTime = function (key) {
1134
+ // To Do Manoj: Test in IE and make TimeZone specific changes accordingly
1135
+ var dateValue = new Date(key);
1136
+ if (dateFns.isValid(dateValue)) {
1137
+ var localDate = Convert.toLocalizedDateTime(dateValue);
1138
+ return dateFns.format(localDate, AppCoreSettings.DATE_FORMATS.angularWithTime, this.dateFnsLocale);
1139
+ }
1140
+ return 'Invalid Date';
1141
+ };
1142
+ LocalizationService.prototype.getLocalizedDistanceToNowInWords = function (date) {
1143
+ // https://date-fns.org/v1.30.1/docs/distanceInWords
1144
+ if (dateFns.isValid(new Date(date))) {
1145
+ return dateFns.formatDistanceToNow(new Date(date), this.dateFnsLocale);
1146
+ }
1147
+ return 'Invalid Date';
1148
+ };
1149
+ LocalizationService.prototype.getLocalizedDistanceInWords = function (endedDate, startedDate) {
1150
+ if (dateFns.isValid(new Date(endedDate)) && dateFns.isValid(new Date(startedDate))) {
1151
+ return dateFns.formatDistance(new Date(endedDate), new Date(startedDate), this.dateFnsLocale);
1152
+ }
1153
+ return 'Invalid Date';
1154
+ };
1155
+ return LocalizationService;
1156
+ }());
1157
+ LocalizationService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LocalizationService_Factory() { return new LocalizationService(i0.ɵɵinject(i1$1.TranslateService)); }, token: LocalizationService, providedIn: "root" });
1158
+ LocalizationService.decorators = [
1159
+ { type: i0.Injectable, args: [{
1160
+ providedIn: 'root'
1161
+ },] }
1162
+ ];
1163
+ LocalizationService.ctorParameters = function () { return [
1164
+ { type: i1$1.TranslateService }
1165
+ ]; };
1166
+
1167
+ /*
1168
+ <file>
1169
+ Project:
1170
+ @osovitny/anatoly
1171
+
1172
+ Authors:
1173
+ Vadim Osovitny
1174
+ Anatoly Osovitny
1175
+
1176
+ Created:
1177
+ 19 March 2020
1178
+
1179
+ Version:
1180
+ 1.0
1181
+
1182
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1183
+ </file>
1184
+ */
1185
+ var Utils = /** @class */ (function () {
1186
+ function Utils() {
1187
+ }
1188
+ Utils.getValueByNameInQS = function (name) {
1189
+ return Utils.getValueByName(location.search, name);
1190
+ };
1191
+ Utils.getValueByName = function (url, name) {
1192
+ name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
1193
+ // tslint:disable-next-line:one-variable-per-declaration
1194
+ var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'), results = regex.exec(url);
1195
+ return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
1196
+ };
1197
+ Utils.copyToClipBoard = function (event, val) {
1198
+ event.preventDefault();
1199
+ var selBox = document.createElement('textarea');
1200
+ selBox.style.position = 'fixed';
1201
+ selBox.style.left = '0';
1202
+ selBox.style.top = '0';
1203
+ selBox.style.opacity = '0';
1204
+ selBox.value = val;
1205
+ document.body.appendChild(selBox);
1206
+ selBox.focus();
1207
+ selBox.select();
1208
+ document.execCommand('copy');
1209
+ document.body.removeChild(selBox);
1210
+ };
1211
+ Utils.downloadFile = function (name, url) {
1212
+ var link = document.createElement('a');
1213
+ link.download = name;
1214
+ link.href = url;
1215
+ link.click();
1216
+ };
1217
+ Object.defineProperty(Utils, "localizationService", {
1218
+ // Localization
1219
+ // @dynamic
1220
+ get: function () {
1221
+ var ns = InjectorInstance.get(LocalizationService);
1222
+ return ns;
1223
+ },
1224
+ enumerable: false,
1225
+ configurable: true
1226
+ });
1227
+ Utils.getLocalizedValue = function (key, params, defaultKey) {
1228
+ // VadimOS: DON'T CHANGE THIS CODE. NEED TO BE REVIEWED AND APPROVED BY VADIMOS
1229
+ // defaultKey definition:
1230
+ // if key is empty and defaultKey is defined => get localization for defaultKey
1231
+ // Example: cancel()
1232
+ if (!key && defaultKey) {
1233
+ return this.localizationService.getLocalizedValue(defaultKey);
1234
+ }
1235
+ // VadimOS:
1236
+ // if key is not empty value MUST be in localization table, othewise we will return key
1237
+ if (key) {
1238
+ var value = this.localizationService.getLocalizedValue(key, params);
1239
+ return value;
1240
+ }
1241
+ return key;
1242
+ };
1243
+ Utils.downloadBlobFile = function (value, fileName) {
1244
+ if (window.navigator.msSaveOrOpenBlob) {
1245
+ window.navigator.msSaveOrOpenBlob(value, fileName);
1246
+ }
1247
+ else {
1248
+ var downloadURL = window.URL.createObjectURL(value);
1249
+ Utils.downloadFile(fileName, downloadURL);
1250
+ }
1251
+ };
1252
+ return Utils;
1253
+ }());
1254
+
1255
+ /*
1256
+ <file>
1257
+ Project:
1258
+ @osovitny/anatoly
1259
+
1260
+ Authors:
1261
+ Vadim Osovitny
1262
+ Anatoly Osovitny
1263
+
1264
+ Created:
1265
+ 26 Jun 2020
1266
+
1267
+ Version:
1268
+ 1.0
1269
+
1270
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1271
+ </file>
1272
+ */
1273
+ var Subs = /** @class */ (function () {
1274
+ function Subs() {
1275
+ this.subs = [];
1276
+ }
1277
+ Subs.prototype.add = function () {
1278
+ var subscriptions = [];
1279
+ for (var _i = 0; _i < arguments.length; _i++) {
1280
+ subscriptions[_i] = arguments[_i];
1281
+ }
1282
+ this.subs = this.subs.concat(subscriptions);
1283
+ };
1284
+ Object.defineProperty(Subs.prototype, "sink", {
1285
+ set: function (subscription) {
1286
+ this.subs.push(subscription);
1287
+ },
1288
+ enumerable: false,
1289
+ configurable: true
1290
+ });
1291
+ Subs.prototype.unsubscribe = function () {
1292
+ this.subs.forEach(function (sub) { return sub && sub.unsubscribe(); });
1293
+ this.subs = [];
1294
+ };
1295
+ return Subs;
1296
+ }());
1297
+
1298
+ /*
1299
+ <file>
1300
+ Project:
1301
+ @osovitny/anatoly
1302
+
1303
+ Authors:
1304
+ Vadim Osovitny
1305
+ Anatoly Osovitny
1306
+
1307
+ Created:
1308
+ 17 Jun 2018
1309
+
1310
+ Version:
1311
+ 1.0
1312
+
1313
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1314
+ </file>
1315
+ */
1316
+ var BaseGoService = /** @class */ (function () {
1317
+ function BaseGoService(route, router) {
1318
+ this.route = route;
1319
+ this.router = router;
1320
+ }
1321
+ BaseGoService.prototype.locationReload = function () {
1322
+ //this.router.navigate([this.route.url]);
1323
+ window.location.reload();
1324
+ };
1325
+ return BaseGoService;
1326
+ }());
1327
+ BaseGoService.decorators = [
1328
+ { type: i0.Injectable }
1329
+ ];
1330
+ BaseGoService.ctorParameters = function () { return [
1331
+ { type: router.ActivatedRoute },
1332
+ { type: router.Router }
1333
+ ]; };
1334
+
1335
+ /*
1336
+ <file>
1337
+ Project:
1338
+ @osovitny/anatoly
1339
+
1340
+ Authors:
1341
+ Vadim Osovitny
1342
+ Anatoly Osovitny
1343
+
1344
+ Created:
1345
+ 26 Jun 2020
1346
+
1347
+ Version:
1348
+ 1.0
1349
+
1350
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1351
+ </file>
1352
+ */
1353
+ var GlobalErrorHandler = /** @class */ (function () {
1354
+ function GlobalErrorHandler(injector) {
1355
+ this.injector = injector;
1356
+ }
1357
+ GlobalErrorHandler.prototype.handleError = function (error) {
1358
+ var loggingService = this.injector.get(LoggingService);
1359
+ loggingService.logError(error);
1360
+ // IMPORTANT: Rethrow the error otherwise it gets swallowed
1361
+ throw error;
1362
+ };
1363
+ return GlobalErrorHandler;
1364
+ }());
1365
+ GlobalErrorHandler.decorators = [
1366
+ { type: i0.Injectable }
940
1367
  ];
941
- LoadingService.ctorParameters = function () { return []; };
1368
+ GlobalErrorHandler.ctorParameters = function () { return [
1369
+ { type: i0.Injector }
1370
+ ]; };
942
1371
 
943
1372
  var AnatolyHttpInterceptor = /** @class */ (function () {
944
1373
  function AnatolyHttpInterceptor(loadingService, loggingService) {
@@ -1054,31 +1483,6 @@
1054
1483
  { type: LoggingService }
1055
1484
  ]; };
1056
1485
 
1057
- var providers = [
1058
- LoggingService,
1059
- AppContextService,
1060
- LoadingService
1061
- ];
1062
- var InjectorInstance;
1063
- var AnatolyCoreModule = /** @class */ (function () {
1064
- function AnatolyCoreModule(injector, parentModule) {
1065
- this.injector = injector;
1066
- throwIfAlreadyLoaded(parentModule, 'AnatolyCoreModule');
1067
- InjectorInstance = this.injector;
1068
- }
1069
- return AnatolyCoreModule;
1070
- }());
1071
- AnatolyCoreModule.decorators = [
1072
- { type: i0.NgModule, args: [{
1073
- imports: [common.CommonModule],
1074
- providers: __spread(providers),
1075
- },] }
1076
- ];
1077
- AnatolyCoreModule.ctorParameters = function () { return [
1078
- { type: i0.Injector },
1079
- { type: AnatolyCoreModule, decorators: [{ type: i0.Optional }, { type: i0.SkipSelf }] }
1080
- ]; };
1081
-
1082
1486
  /*
1083
1487
  <file>
1084
1488
  Project:
@@ -1201,18 +1605,40 @@
1201
1605
  { type: http.HttpClient }
1202
1606
  ]; };
1203
1607
 
1608
+ /*
1609
+ <file>
1610
+ Project:
1611
+ @osovitny/anatoly
1612
+
1613
+ Authors:
1614
+ Vadim Osovitny
1615
+ Anatoly Osovitny
1616
+
1617
+ Created:
1618
+ 30 April 2020
1619
+
1620
+ Version:
1621
+ 1.0
1622
+
1623
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1624
+ </file>
1625
+ */
1626
+ var consts = {
1627
+ billingApiPath: "api/billing",
1628
+ // Notifications API
1629
+ notificationsApiPath: 'api/notifications',
1630
+ };
1631
+
1204
1632
  var BillingApiService = /** @class */ (function (_super) {
1205
1633
  __extends(BillingApiService, _super);
1206
1634
  function BillingApiService(http) {
1207
1635
  var _this = _super.call(this, http) || this;
1208
1636
  _this.http = http;
1209
- _this.baseUrl += "billing/";
1637
+ _this.baseUrl = consts.billingApiPath;
1210
1638
  return _this;
1211
1639
  }
1212
1640
  BillingApiService.prototype.requestNewSubscription = function (requestedPlan, success, error) {
1213
- this.postQS("requestNewSubscription", {
1214
- requestedPlan: requestedPlan,
1215
- }).subscribe(function (data) { }, function (e) {
1641
+ this.postQS("requestNewSubscription", { requestedPlan: requestedPlan }).subscribe(function (data) { }, function (e) {
1216
1642
  if (error)
1217
1643
  error();
1218
1644
  }, function () {
@@ -1266,16 +1692,24 @@
1266
1692
  </file>
1267
1693
  */
1268
1694
  var AnatolyDataModule = /** @class */ (function () {
1269
- function AnatolyDataModule() {
1695
+ function AnatolyDataModule(parentModule) {
1696
+ throwIfAlreadyLoaded(parentModule, 'AnatolyDataModule');
1270
1697
  }
1271
1698
  return AnatolyDataModule;
1272
1699
  }());
1273
1700
  AnatolyDataModule.decorators = [
1274
1701
  { type: i0.NgModule, args: [{
1275
- imports: [common.CommonModule],
1276
- providers: [BillingApiService],
1702
+ imports: [
1703
+ common.CommonModule
1704
+ ],
1705
+ providers: [
1706
+ BillingApiService
1707
+ ],
1277
1708
  },] }
1278
- ];
1709
+ ];
1710
+ AnatolyDataModule.ctorParameters = function () { return [
1711
+ { type: AnatolyDataModule, decorators: [{ type: i0.Optional }, { type: i0.SkipSelf }] }
1712
+ ]; };
1279
1713
 
1280
1714
  /*
1281
1715
  <file>
@@ -2186,7 +2620,7 @@
2186
2620
  HtmlEditorComponent,
2187
2621
  FormsHtmlEditorComponent,
2188
2622
  ContentHeaderComponent,
2189
- //Directives
2623
+ // Directives
2190
2624
  NativeElementDirective
2191
2625
  ],
2192
2626
  declarations: [
@@ -2201,7 +2635,7 @@
2201
2635
  HtmlEditorComponent,
2202
2636
  FormsHtmlEditorComponent,
2203
2637
  ContentHeaderComponent,
2204
- //Directives
2638
+ // Directives
2205
2639
  NativeElementDirective
2206
2640
  ]
2207
2641
  },] }
@@ -2226,6 +2660,298 @@
2226
2660
  </file>
2227
2661
  */
2228
2662
 
2663
+ /*
2664
+ <file>
2665
+ Project:
2666
+ @osovitny/anatoly
2667
+
2668
+ Authors:
2669
+ Vadim Osovitny
2670
+ Anatoly Osovitny
2671
+
2672
+ Created:
2673
+ 10 May 2020
2674
+
2675
+ Version:
2676
+ 1.0
2677
+
2678
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2679
+ </file>
2680
+ */
2681
+ var LocalizePipe = /** @class */ (function () {
2682
+ function LocalizePipe(localizeService) {
2683
+ this.localizeService = localizeService;
2684
+ }
2685
+ LocalizePipe.prototype.transform = function (inputData, type, param2) {
2686
+ if (!inputData) {
2687
+ return;
2688
+ }
2689
+ if (!type) {
2690
+ type = 't';
2691
+ }
2692
+ // Translate
2693
+ if (type === 't') {
2694
+ return this.localizeService.getLocalizedValue(inputData);
2695
+ }
2696
+ // Date
2697
+ if (type === 'd') {
2698
+ return this.localizeService.getLocalizedDate(inputData);
2699
+ }
2700
+ // DateTime
2701
+ if (type === 'dt') {
2702
+ return this.localizeService.getLocalizedDateTime(inputData);
2703
+ }
2704
+ // DistanceToNowInWords
2705
+ if (type === 'dis2now') {
2706
+ return this.localizeService.getLocalizedDistanceToNowInWords(inputData);
2707
+ }
2708
+ // DistanceInWords
2709
+ if (type === 'dis') {
2710
+ return this.localizeService.getLocalizedDistanceInWords(inputData, param2);
2711
+ }
2712
+ return inputData;
2713
+ };
2714
+ return LocalizePipe;
2715
+ }());
2716
+ LocalizePipe.decorators = [
2717
+ { type: i0.Pipe, args: [{
2718
+ name: 'localize'
2719
+ },] }
2720
+ ];
2721
+ LocalizePipe.ctorParameters = function () { return [
2722
+ { type: LocalizationService }
2723
+ ]; };
2724
+
2725
+ /*
2726
+ <file>
2727
+ Project:
2728
+ @osovitny/anatoly
2729
+
2730
+ Authors:
2731
+ Vadim Osovitny
2732
+ Anatoly Osovitny
2733
+
2734
+ Created:
2735
+ 12 May 2020
2736
+
2737
+ Version:
2738
+ 1.0
2739
+
2740
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2741
+ </file>
2742
+ */
2743
+ var LocalizationModule = /** @class */ (function () {
2744
+ function LocalizationModule() {
2745
+ }
2746
+ return LocalizationModule;
2747
+ }());
2748
+ LocalizationModule.decorators = [
2749
+ { type: i0.NgModule, args: [{
2750
+ imports: [
2751
+ i1$1.TranslateModule
2752
+ ],
2753
+ exports: [
2754
+ i1$1.TranslateModule,
2755
+ LocalizePipe
2756
+ ],
2757
+ declarations: [
2758
+ LocalizePipe
2759
+ ],
2760
+ providers: []
2761
+ },] }
2762
+ ];
2763
+
2764
+ /*
2765
+ <file>
2766
+ Project:
2767
+ @osovitny/anatoly
2768
+
2769
+ Authors:
2770
+ Vadim Osovitny
2771
+ Anatoly Osovitny
2772
+
2773
+ Created:
2774
+ 05 May 2020
2775
+
2776
+ Version:
2777
+ 1.0
2778
+
2779
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2780
+ </file>
2781
+ */
2782
+ function customTranslateLoaderFactory(http) {
2783
+ return new httpLoader.TranslateHttpLoader(http, AppCoreSettings.resourcesUrl + "/", '.json');
2784
+ }
2785
+ function localizationInitializerFactory(translate, localizationService, injector) {
2786
+ return function () { return new Promise(function (resolve) {
2787
+ var locationInitialized = injector.get(common.LOCATION_INITIALIZED, Promise.resolve(null));
2788
+ locationInitialized.then(function () {
2789
+ var languageToSet = localizationService.configureTranslationSettings(translate);
2790
+ translate.use(languageToSet).subscribe(function () {
2791
+ }, function () {
2792
+ resolve(null);
2793
+ }, function () {
2794
+ resolve(null);
2795
+ });
2796
+ });
2797
+ }); };
2798
+ }
2799
+ var TranslateModuleAtRoot = i1$1.TranslateModule.forRoot({
2800
+ loader: {
2801
+ provide: i1$1.TranslateLoader,
2802
+ useFactory: customTranslateLoaderFactory,
2803
+ deps: [http.HttpClient]
2804
+ }
2805
+ });
2806
+ var LocalizationSettingsModule = /** @class */ (function () {
2807
+ function LocalizationSettingsModule() {
2808
+ }
2809
+ return LocalizationSettingsModule;
2810
+ }());
2811
+ LocalizationSettingsModule.decorators = [
2812
+ { type: i0.NgModule, args: [{
2813
+ imports: [
2814
+ TranslateModuleAtRoot
2815
+ ],
2816
+ providers: [
2817
+ {
2818
+ provide: i0.APP_INITIALIZER,
2819
+ useFactory: localizationInitializerFactory,
2820
+ deps: [i1$1.TranslateService, LocalizationService, i0.Injector],
2821
+ multi: true
2822
+ }
2823
+ ],
2824
+ exports: []
2825
+ },] }
2826
+ ];
2827
+
2828
+ /*
2829
+ <file>
2830
+ Project:
2831
+ @osovitny/anatoly
2832
+
2833
+ Authors:
2834
+ Vadim Osovitny
2835
+ Anatoly Osovitny
2836
+
2837
+ Created:
2838
+ 26 Jun 2020
2839
+
2840
+ Version:
2841
+ 1.0
2842
+
2843
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2844
+ </file>
2845
+ */
2846
+
2847
+ /*
2848
+ <file>
2849
+ Project:
2850
+ @osovitny/anatoly
2851
+
2852
+ Authors:
2853
+ Vadim Osovitny
2854
+ Anatoly Osovitny
2855
+
2856
+ Created:
2857
+ 3 March 2020
2858
+
2859
+ Version:
2860
+ 1.0
2861
+
2862
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2863
+ </file>
2864
+ */
2865
+ var Alerts$1 = /** @class */ (function () {
2866
+ function Alerts() {
2867
+ }
2868
+ Alerts.success = function (text, params, title, successAction) {
2869
+ text = Utils.getLocalizedValue(text, params, 'OperationSuccessFull');
2870
+ title = Utils.getLocalizedValue(title, null, 'Success');
2871
+ Swal.fire({
2872
+ text: text,
2873
+ title: title,
2874
+ icon: 'success',
2875
+ confirmButtonText: Utils.getLocalizedValue('Ok')
2876
+ })
2877
+ .then(function () {
2878
+ if (successAction) {
2879
+ successAction();
2880
+ }
2881
+ });
2882
+ };
2883
+ Alerts.info = function (text, params, title) {
2884
+ text = Utils.getLocalizedValue(text, params);
2885
+ title = Utils.getLocalizedValue(title, null, 'Info');
2886
+ Swal.fire({
2887
+ text: text,
2888
+ title: title,
2889
+ icon: 'info',
2890
+ confirmButtonText: Utils.getLocalizedValue('Ok')
2891
+ });
2892
+ };
2893
+ Alerts.warning = function (text, params, title) {
2894
+ text = Utils.getLocalizedValue(text, params);
2895
+ title = Utils.getLocalizedValue(title, null, 'Warning');
2896
+ Swal.fire({
2897
+ text: text,
2898
+ title: title,
2899
+ icon: 'warning',
2900
+ confirmButtonText: Utils.getLocalizedValue('Ok')
2901
+ });
2902
+ };
2903
+ Alerts.error = function (text, params, title) {
2904
+ text = Utils.getLocalizedValue(text, params, 'ErrorOccured');
2905
+ title = Utils.getLocalizedValue(title, null, 'Error');
2906
+ Swal.fire({
2907
+ text: text,
2908
+ title: title,
2909
+ icon: 'error',
2910
+ confirmButtonText: Utils.getLocalizedValue('Ok')
2911
+ });
2912
+ };
2913
+ Alerts.cancel = function (text, params, title) {
2914
+ text = Utils.getLocalizedValue(text, params, 'OperationCancelled');
2915
+ title = Utils.getLocalizedValue(title, null, 'Cancelled');
2916
+ Swal.fire({
2917
+ text: text,
2918
+ title: title,
2919
+ icon: 'info'
2920
+ });
2921
+ };
2922
+ Alerts.notImplemented = function () {
2923
+ this.warning('Not Implemented Yet');
2924
+ };
2925
+ ;
2926
+ Alerts.areYouSure = function (text, title, confirmButtonText, cancelButtonText, successAction, cancelAction) {
2927
+ text = Utils.getLocalizedValue(text);
2928
+ title = Utils.getLocalizedValue(title, null, 'AreYouSure');
2929
+ Swal.fire({
2930
+ text: text,
2931
+ title: title,
2932
+ icon: 'warning',
2933
+ confirmButtonText: Utils.getLocalizedValue(confirmButtonText),
2934
+ cancelButtonText: Utils.getLocalizedValue(cancelButtonText),
2935
+ showCancelButton: true
2936
+ })
2937
+ .then(function (result) {
2938
+ if (result.value) {
2939
+ if (successAction) {
2940
+ successAction();
2941
+ }
2942
+ }
2943
+ // result.dismiss can be 'cancel', 'overlay', 'close', and 'timer'
2944
+ else if (result.dismiss == Swal.DismissReason.cancel || result.dismiss == Swal.DismissReason.close) {
2945
+ if (cancelAction) {
2946
+ cancelAction();
2947
+ }
2948
+ }
2949
+ });
2950
+ };
2951
+ ;
2952
+ return Alerts;
2953
+ }());
2954
+
2229
2955
  /*
2230
2956
  * Public API Surface of anatoly
2231
2957
  */
@@ -2234,7 +2960,7 @@
2234
2960
  * Generated bundle index. Do not edit.
2235
2961
  */
2236
2962
 
2237
- exports.Alerts = Alerts;
2963
+ exports.Alerts = Alerts$1;
2238
2964
  exports.AnatolyCoreModule = AnatolyCoreModule;
2239
2965
  exports.AnatolyDataModule = AnatolyDataModule;
2240
2966
  exports.AnatolyHttpInterceptor = AnatolyHttpInterceptor;
@@ -2258,6 +2984,10 @@
2258
2984
  exports.HtmlEditorComponent = HtmlEditorComponent;
2259
2985
  exports.ItemValidationSummaryComponent = ItemValidationSummaryComponent;
2260
2986
  exports.LoadingService = LoadingService;
2987
+ exports.LocalizationModule = LocalizationModule;
2988
+ exports.LocalizationService = LocalizationService;
2989
+ exports.LocalizationSettingsModule = LocalizationSettingsModule;
2990
+ exports.LocalizePipe = LocalizePipe;
2261
2991
  exports.LoggingService = LoggingService;
2262
2992
  exports.NativeElementDirective = NativeElementDirective;
2263
2993
  exports.SignInButtonComponent = SignInButtonComponent;