@osovitny/anatoly 2.0.23 → 2.0.26

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 (78) hide show
  1. package/bundles/osovitny-anatoly.umd.js +2039 -1292
  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/consts/urls.js +22 -0
  6. package/esm2015/lib/core/convert.js +27 -0
  7. package/esm2015/lib/core/core.module.js +12 -9
  8. package/esm2015/lib/core/go/base-go.service.js +4 -4
  9. package/esm2015/lib/core/interceptors/httpInterceptor.js +2 -2
  10. package/esm2015/lib/core/localization/localization.module.js +41 -0
  11. package/esm2015/lib/core/localization/localization.service.js +5 -5
  12. package/esm2015/lib/core/localization/localizationSettings.module.js +70 -0
  13. package/esm2015/lib/core/localization/localize.pipe.js +65 -0
  14. package/esm2015/lib/core/notifications/alerts.js +107 -0
  15. package/esm2015/lib/core/notifications/interfaces/notification.js +19 -0
  16. package/esm2015/lib/core/notifications/services/notification-service.js +230 -0
  17. package/esm2015/lib/core/services/appcontext.service.js +12 -12
  18. package/esm2015/lib/core/services/idle.service.js +65 -0
  19. package/esm2015/lib/core/services/web-storage.service.js +65 -0
  20. package/esm2015/lib/core/subs.js +1 -1
  21. package/esm2015/lib/core/utils.js +3 -14
  22. package/esm2015/lib/data/base/base-api.service.js +26 -30
  23. package/esm2015/lib/data/consts.js +24 -0
  24. package/esm2015/lib/data/data.module.js +19 -8
  25. package/esm2015/lib/data/services/billing-api.service.js +4 -5
  26. package/esm2015/lib/data/services/notifications/notifications-api-service.js +45 -0
  27. package/esm2015/lib/ui/components/billing/buyaccess-button.component.js +9 -9
  28. package/esm2015/lib/ui/components/billing/upgrade-plan-button.component.js +7 -7
  29. package/esm2015/lib/ui/components/html-editor/base-html-editor.component.js +19 -19
  30. package/esm2015/lib/ui/components/loading/loading.component.js +49 -0
  31. package/esm2015/lib/ui/components/spinner/spinner.component.js +73 -0
  32. package/esm2015/lib/ui/pipes/filesize.pipe.js +41 -0
  33. package/esm2015/lib/ui/pipes/replace-text.pipe.js +36 -0
  34. package/esm2015/lib/ui/pipes/safeHtml.pipe.js +36 -0
  35. package/esm2015/lib/ui/ui.module.js +19 -13
  36. package/esm2015/public-api.js +57 -4
  37. package/fesm2015/osovitny-anatoly.js +1449 -709
  38. package/fesm2015/osovitny-anatoly.js.map +1 -1
  39. package/lib/core/consts/urls.d.ts +3 -0
  40. package/lib/core/convert.d.ts +3 -0
  41. package/lib/core/go/base-go.service.d.ts +1 -1
  42. package/lib/core/localization/localization.module.d.ts +2 -0
  43. package/lib/core/localization/localizationSettings.module.d.ts +10 -0
  44. package/lib/core/localization/localize.pipe.d.ts +7 -0
  45. package/lib/core/notifications/alerts.d.ts +9 -0
  46. package/lib/core/notifications/interfaces/notification.d.ts +10 -0
  47. package/lib/core/notifications/services/notification-service.d.ts +22 -0
  48. package/lib/core/services/appcontext.service.d.ts +2 -2
  49. package/lib/core/services/idle.service.d.ts +13 -0
  50. package/lib/core/services/web-storage.service.d.ts +17 -0
  51. package/lib/core/subs.d.ts +1 -1
  52. package/lib/core/utils.d.ts +0 -5
  53. package/lib/data/base/base-api.service.d.ts +2 -3
  54. package/lib/data/consts.d.ts +4 -0
  55. package/lib/data/data.module.d.ts +1 -0
  56. package/lib/data/services/notifications/notifications-api-service.d.ts +9 -0
  57. package/lib/ui/components/billing/buyaccess-button.component.d.ts +3 -3
  58. package/lib/ui/components/billing/upgrade-plan-button.component.d.ts +1 -1
  59. package/lib/ui/components/html-editor/base-html-editor.component.d.ts +2 -2
  60. package/lib/ui/components/loading/loading.component.d.ts +10 -0
  61. package/lib/ui/components/spinner/spinner.component.d.ts +22 -0
  62. package/lib/ui/pipes/filesize.pipe.d.ts +5 -0
  63. package/lib/ui/pipes/replace-text.pipe.d.ts +4 -0
  64. package/lib/ui/pipes/safeHtml.pipe.d.ts +7 -0
  65. package/lib/ui/ui.module.d.ts +2 -3
  66. package/osovitny-anatoly.metadata.json +1 -1
  67. package/package.json +1 -1
  68. package/public-api.d.ts +53 -3
  69. package/esm2015/lib/core/alerts.js +0 -145
  70. package/esm2015/lib/core/consts/index.js +0 -20
  71. package/esm2015/lib/core/index.js +0 -37
  72. package/esm2015/lib/data/index.js +0 -26
  73. package/esm2015/lib/ui/index.js +0 -43
  74. package/lib/core/alerts.d.ts +0 -12
  75. package/lib/core/consts/index.d.ts +0 -1
  76. package/lib/core/index.d.ts +0 -13
  77. package/lib/data/index.d.ts +0 -5
  78. package/lib/ui/index.d.ts +0 -16
@@ -1,11 +1,11 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('sweetalert2'), require('@angular/core'), require('@ngx-translate/core'), require('date-fns'), require('date-fns/locale/en-US'), require('@angular/common'), require('@angular/common/http'), require('rxjs/operators'), require('rxjs'), require('uuid'), require('@angular/router'), require('@angular/forms'), require('angular-froala-wysiwyg')) :
3
- typeof define === 'function' && define.amd ? define('@osovitny/anatoly', ['exports', 'sweetalert2', '@angular/core', '@ngx-translate/core', 'date-fns', 'date-fns/locale/en-US', '@angular/common', '@angular/common/http', 'rxjs/operators', 'rxjs', 'uuid', '@angular/router', '@angular/forms', 'angular-froala-wysiwyg'], factory) :
4
- (global = global || self, factory((global.osovitny = global.osovitny || {}, global.osovitny.anatoly = {}), global.Swal, global.ng.core, global.i1, global.dateFns, global.enUS, global.ng.common, global.ng.common.http, global.rxjs.operators, global.rxjs, global.uuid, global.ng.router, global.ng.forms, global.angularFroalaWysiwyg));
5
- }(this, (function (exports, Swal, i0, i1, dateFns, enUS, common, http, operators, rxjs, uuid, router, forms, angularFroalaWysiwyg) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/router'), require('@angular/common/http'), require('rxjs/operators'), require('rxjs'), require('@ngx-translate/core'), require('date-fns'), require('date-fns/locale/en-US'), require('@angular/common'), require('@ngx-translate/http-loader'), require('sweetalert2'), require('ngx-toastr'), require('uuid'), require('@angular/forms'), require('@angular/platform-browser'), require('angular-froala-wysiwyg')) :
3
+ typeof define === 'function' && define.amd ? define('@osovitny/anatoly', ['exports', '@angular/core', '@angular/router', '@angular/common/http', 'rxjs/operators', 'rxjs', '@ngx-translate/core', 'date-fns', 'date-fns/locale/en-US', '@angular/common', '@ngx-translate/http-loader', 'sweetalert2', 'ngx-toastr', 'uuid', '@angular/forms', '@angular/platform-browser', 'angular-froala-wysiwyg'], factory) :
4
+ (global = global || self, factory((global.osovitny = global.osovitny || {}, global.osovitny.anatoly = {}), global.ng.core, global.ng.router, global.ng.common.http, global.rxjs.operators, global.rxjs, global.i1$1, global.dateFns, global.enUS, global.ng.common, global.httpLoader, global.Swal, global.i1$2, global.uuid, global.ng.forms, global.ng.platformBrowser, global.angularFroalaWysiwyg));
5
+ }(this, (function (exports, i0, router, i1, operators, rxjs, i1$1, dateFns, enUS, common, httpLoader, Swal, i1$2, uuid, forms, platformBrowser, angularFroalaWysiwyg) { 'use strict';
6
6
 
7
- Swal = Swal && Object.prototype.hasOwnProperty.call(Swal, 'default') ? Swal['default'] : Swal;
8
7
  enUS = enUS && Object.prototype.hasOwnProperty.call(enUS, 'default') ? enUS['default'] : enUS;
8
+ Swal = Swal && Object.prototype.hasOwnProperty.call(Swal, 'default') ? Swal['default'] : Swal;
9
9
 
10
10
  /*
11
11
  <file>
@@ -31,45 +31,24 @@
31
31
  /*
32
32
  <file>
33
33
  Project:
34
- @osovitny/anatoly
35
-
36
- Authors:
37
- Vadim Osovitny
38
- Anatoly Osovitny
39
-
40
- Created:
41
- 26 Jun 2020
42
-
43
- Version:
44
- 1.0
45
-
46
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
47
- </file>
48
- */
49
-
50
- /*
51
- <file>
52
- Project:
53
- @osovitny/anatoly
34
+ MICE
54
35
 
55
36
  Authors:
56
- Vadim Osovitny
57
- Anatoly Osovitny
37
+ Vadim Osovitny vaosovitny@deloitte.com
58
38
 
59
39
  Created:
60
- 26 Jun 2020
40
+ 5 May 2020
61
41
 
62
42
  Version:
63
43
  1.0
64
44
 
65
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
45
+ Copyright (c) 2020 Deloitte Tax. All rights reserved.
66
46
  </file>
67
47
  */
68
- function throwIfAlreadyLoaded(parentModule, moduleName) {
69
- if (parentModule) {
70
- throw new Error(moduleName + " has already been loaded. Import " + moduleName + " modules in the AppModule only.");
71
- }
72
- }
48
+ var Urls = {
49
+ // SignalR Notifications
50
+ notificationsSocketUrl: '/hubs/notifications'
51
+ };
73
52
 
74
53
  /*
75
54
  <file>
@@ -81,7 +60,7 @@
81
60
  Anatoly Osovitny
82
61
 
83
62
  Created:
84
- 4 Mar 2020
63
+ 17 Jun 2018
85
64
 
86
65
  Version:
87
66
  1.0
@@ -89,134 +68,24 @@
89
68
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
90
69
  </file>
91
70
  */
92
- var Alerts = /** @class */ (function () {
93
- function Alerts() {
71
+ var BaseGoService = /** @class */ (function () {
72
+ function BaseGoService(route, router) {
73
+ this.route = route;
74
+ this.router = router;
94
75
  }
95
- Alerts.Info = function (text) {
96
- Swal.fire({
97
- title: "Information",
98
- text: text,
99
- icon: "info",
100
- confirmButtonText: "OK",
101
- });
102
- };
103
- Alerts.Warning = function (text) {
104
- Swal.fire({
105
- title: "Warning",
106
- text: text,
107
- icon: "warning",
108
- confirmButtonText: "OK",
109
- });
110
- };
111
- Alerts.Error = function (text) {
112
- Swal.fire({
113
- title: "Error",
114
- text: text,
115
- icon: "error",
116
- confirmButtonText: "OK",
117
- });
118
- };
119
- Alerts.NotImplemented = function () {
120
- this.Warning("Not Implemented Yet");
121
- };
122
- Alerts.ErrorOccurred = function () {
123
- this.Error("Sorry, an unexpected error occurred");
124
- };
125
- Alerts.AreYouSure = function (text, title, confirmButtonText, cancelButtonText, successAction, cancelAction) {
126
- if (typeof title == "undefined" || title == null)
127
- title = "Are you sure?";
128
- Swal.fire({
129
- title: title,
130
- text: text,
131
- icon: "warning",
132
- confirmButtonText: confirmButtonText,
133
- cancelButtonText: cancelButtonText,
134
- showCancelButton: true,
135
- }).then(function (result) {
136
- if (result.value) {
137
- if (successAction) {
138
- successAction();
139
- }
140
- }
141
- // result.dismiss can be 'cancel', 'overlay', 'close', and 'timer'
142
- else if (result.dismiss == Swal.DismissReason.cancel ||
143
- result.dismiss == Swal.DismissReason.close) {
144
- if (cancelAction) {
145
- cancelAction();
146
- }
147
- }
148
- });
149
- };
150
- Alerts.Success = function (text, title, successAction) {
151
- if (typeof title == "undefined" || title == null)
152
- title = "Success";
153
- if (!text) {
154
- text = "Operation was successful";
155
- }
156
- Swal.fire({
157
- title: title,
158
- text: text,
159
- icon: "success",
160
- confirmButtonText: "OK",
161
- }).then(function () {
162
- if (successAction) {
163
- successAction();
164
- }
165
- });
166
- };
167
- Alerts.Cancel = function (text) {
168
- if (!text) {
169
- text = "Operation has been cancled";
170
- }
171
- Swal.fire({
172
- title: "Cancelled",
173
- text: text,
174
- icon: "info",
175
- });
176
- };
177
- //Notifications
178
- Alerts.NotificationCancel = function (text, title) {
179
- if (typeof title == "undefined" || title == null) {
180
- title = "Canceled";
181
- }
182
- if (!text) {
183
- text = "Operation has been canceled";
184
- }
185
- var toast = Swal.mixin({
186
- toast: true,
187
- position: "top-end",
188
- showConfirmButton: false,
189
- timer: 3000,
190
- timerProgressBar: true,
191
- });
192
- toast.fire({
193
- title: title,
194
- text: text,
195
- icon: "info",
196
- });
197
- };
198
- Alerts.NotificationSuccess = function (text, title) {
199
- if (typeof title == "undefined" || title == null) {
200
- title = "Success";
201
- }
202
- if (!text) {
203
- text = "Operation was successful";
204
- }
205
- var toast = Swal.mixin({
206
- toast: true,
207
- position: "top-end",
208
- showConfirmButton: false,
209
- timer: 3000,
210
- timerProgressBar: true,
211
- });
212
- toast.fire({
213
- title: title,
214
- text: text,
215
- icon: "success",
216
- });
76
+ BaseGoService.prototype.locationReload = function () {
77
+ // this.router.navigate([this.route.url]);
78
+ window.location.reload();
217
79
  };
218
- return Alerts;
219
- }());
80
+ return BaseGoService;
81
+ }());
82
+ BaseGoService.decorators = [
83
+ { type: i0.Injectable }
84
+ ];
85
+ BaseGoService.ctorParameters = function () { return [
86
+ { type: router.ActivatedRoute },
87
+ { type: router.Router }
88
+ ]; };
220
89
 
221
90
  /*
222
91
  <file>
@@ -228,7 +97,7 @@
228
97
  Anatoly Osovitny
229
98
 
230
99
  Created:
231
- 05 May 2020
100
+ 26 Jun 2020
232
101
 
233
102
  Version:
234
103
  1.0
@@ -236,90 +105,11 @@
236
105
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
237
106
  </file>
238
107
  */
239
- var LocalizationService = /** @class */ (function () {
240
- function LocalizationService(translate) {
241
- this.translate = translate;
242
- this.setSupportedLanguages(['en']);
108
+ function throwIfAlreadyLoaded(parentModule, moduleName) {
109
+ if (parentModule) {
110
+ throw new Error(moduleName + " has already been loaded. Import " + moduleName + " modules in the AppModule only.");
243
111
  }
244
- LocalizationService.prototype.format = function (str, args) {
245
- // tslint:disable-next-line:variable-name
246
- return str.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] !== 'undefined' ? args[number] : match; });
247
- };
248
- ;
249
- LocalizationService.prototype.configureTranslationSettings = function (translate) {
250
- var languageToSet = 'en';
251
- translate.setDefaultLang(languageToSet);
252
- return languageToSet;
253
- };
254
- LocalizationService.prototype.getBrowserLanguage = function () {
255
- return this.translate.getBrowserLang();
256
- };
257
- LocalizationService.prototype.getDatefnsLocale = function () {
258
- var dfnLocale;
259
- switch (this.getBrowserLanguage()) {
260
- case 'en':
261
- dfnLocale = { locale: enUS };
262
- break;
263
- default:
264
- dfnLocale = { locale: enUS };
265
- }
266
- return dfnLocale;
267
- };
268
- LocalizationService.prototype.setDefaultLanguage = function (lang) {
269
- this.translate.setDefaultLang(lang);
270
- };
271
- LocalizationService.prototype.setSupportedLanguages = function (languages) {
272
- this.translate.addLangs(languages);
273
- };
274
- LocalizationService.prototype.updateLanguage = function (language) {
275
- this.translate.use(language);
276
- };
277
- LocalizationService.prototype.getLocalizedValue = function (key, params) {
278
- var value = this.translate.instant(key);
279
- if (!params || params.length === 0) {
280
- return value;
281
- }
282
- return this.format(value, params);
283
- };
284
- LocalizationService.prototype.getLocalizedDate = function (key) {
285
- if (dateFns.isValid(new Date(key))) {
286
- return dateFns.format(new Date(key), AppCoreSettings.DATE_FORMATS.angular, this.dateFnsLocale);
287
- }
288
- return 'Invalid Date';
289
- };
290
- LocalizationService.prototype.getLocalizedDateTime = function (key) {
291
- // To Do Manoj: Test in IE and make TimeZone specific changes accordingly
292
- var dateValue = new Date(key);
293
- if (dateFns.isValid(dateValue)) {
294
- var localDate = Utils.convertToLocalizedDateTime(dateValue);
295
- return dateFns.format(localDate, AppCoreSettings.DATE_FORMATS.angularWithTime, this.dateFnsLocale);
296
- }
297
- return 'Invalid Date';
298
- };
299
- LocalizationService.prototype.getLocalizedDistanceToNowInWords = function (date) {
300
- // https://date-fns.org/v1.30.1/docs/distanceInWords
301
- if (dateFns.isValid(new Date(date))) {
302
- return dateFns.formatDistanceToNow(new Date(date), this.dateFnsLocale);
303
- }
304
- return 'Invalid Date';
305
- };
306
- LocalizationService.prototype.getLocalizedDistanceInWords = function (endedDate, startedDate) {
307
- if (dateFns.isValid(new Date(endedDate)) && dateFns.isValid(new Date(startedDate))) {
308
- return dateFns.formatDistance(new Date(endedDate), new Date(startedDate), this.dateFnsLocale);
309
- }
310
- return 'Invalid Date';
311
- };
312
- return LocalizationService;
313
- }());
314
- LocalizationService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LocalizationService_Factory() { return new LocalizationService(i0.ɵɵinject(i1.TranslateService)); }, token: LocalizationService, providedIn: "root" });
315
- LocalizationService.decorators = [
316
- { type: i0.Injectable, args: [{
317
- providedIn: 'root'
318
- },] }
319
- ];
320
- LocalizationService.ctorParameters = function () { return [
321
- { type: i1.TranslateService }
322
- ]; };
112
+ }
323
113
 
324
114
  /*! *****************************************************************************
325
115
  Copyright (c) Microsoft Corporation.
@@ -622,6 +412,52 @@
622
412
  return value;
623
413
  }
624
414
 
415
+ var LoadingService = /** @class */ (function (_super) {
416
+ __extends(LoadingService, _super);
417
+ function LoadingService() {
418
+ var _this = _super.call(this, false) || this;
419
+ _this.counter = 0;
420
+ //Public
421
+ _this.isFreezed = false;
422
+ return _this;
423
+ }
424
+ LoadingService.prototype.show = function () {
425
+ this.counter++;
426
+ var that = this;
427
+ setTimeout(function () {
428
+ if (that.counter > 0) {
429
+ that.next(true);
430
+ }
431
+ }, 1000);
432
+ };
433
+ LoadingService.prototype.hide = function () {
434
+ if (this.counter <= 0) {
435
+ return;
436
+ }
437
+ this.counter--;
438
+ if (this.counter == 0) {
439
+ this.next(false);
440
+ }
441
+ };
442
+ LoadingService.prototype.freeze = function (timeout) {
443
+ var _this = this;
444
+ if (timeout === void 0) { timeout = 1000; }
445
+ this.isFreezed = true;
446
+ var that = this;
447
+ setTimeout(function () {
448
+ _this.isFreezed = false;
449
+ }, timeout);
450
+ };
451
+ return LoadingService;
452
+ }(rxjs.BehaviorSubject));
453
+ LoadingService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LoadingService_Factory() { return new LoadingService(); }, token: LoadingService, providedIn: "root" });
454
+ LoadingService.decorators = [
455
+ { type: i0.Injectable, args: [{
456
+ providedIn: "root",
457
+ },] }
458
+ ];
459
+ LoadingService.ctorParameters = function () { return []; };
460
+
625
461
  /*
626
462
  <file>
627
463
  Project:
@@ -659,216 +495,118 @@
659
495
  ];
660
496
  LoggingService.ctorParameters = function () { return []; };
661
497
 
662
- /*
663
- <file>
664
- Project:
665
- @osovitny/anatoly
666
-
667
- Authors:
668
- Vadim Osovitny
669
- Anatoly Osovitny
670
-
671
- Created:
672
- 13 Nov 2017
673
-
674
- Version:
675
- 1.0
676
-
677
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
678
- </file>
679
- */
680
- var BaseApiService = /** @class */ (function () {
681
- function BaseApiService(http) {
682
- this.http = http;
683
- this.baseUrl = "";
684
- }
685
- BaseApiService.prototype.serializeParams = function (data) {
686
- return data ? "?" + $.param(data) : "";
687
- };
688
- //api
689
- BaseApiService.prototype.get = function (action, data, responseType) {
690
- if (!responseType) {
691
- responseType = "json";
692
- }
693
- var url = this.baseUrl + "/" + action + this.serializeParams(data);
694
- return this.http
695
- .get(url, { responseType: responseType })
696
- .pipe(operators.map(function (res) { return res; }));
697
- };
698
- BaseApiService.prototype.post = function (action, data, responseType) {
699
- if (!responseType) {
700
- responseType = "text";
701
- }
702
- var url = this.baseUrl + "/" + action;
703
- return this.http.post(url, data, { responseType: responseType });
704
- };
705
- BaseApiService.prototype.postQS = function (action, data, responseType) {
706
- if (!responseType) {
707
- responseType = "text";
708
- }
709
- var url = this.baseUrl + "/" + action + this.serializeParams(data);
710
- return this.http.post(url, null, { responseType: responseType });
711
- };
712
- BaseApiService.prototype.delete = function (action, data, responseType) {
713
- if (!responseType) {
714
- responseType = "text";
715
- }
716
- var url = this.baseUrl + "/" + action + this.serializeParams(data);
717
- return this.http.delete(url, { responseType: responseType });
718
- };
719
- //gets
720
- BaseApiService.prototype.getById = function (id) {
721
- return this.get("getById", { id: id });
722
- };
723
- BaseApiService.prototype.getAll = function (data) {
724
- return this.get("getall", data).pipe(operators.map(function (res) { return res; }));
725
- };
726
- BaseApiService.prototype.getJsonFile = function (fileName, jsonUrl, jsonVersion) {
727
- if (!jsonUrl) {
728
- jsonUrl = "/dist/jsons";
729
- }
730
- if (!jsonVersion) {
731
- jsonVersion = "1.0";
732
- }
733
- var url = jsonUrl + "/" + fileName + "?" + jsonVersion;
734
- return this.http.get(url).pipe(operators.map(function (res) { return res; }));
735
- };
736
- BaseApiService.prototype.getNewGuid = function () {
737
- var url = this.baseUrl + "/getNewGuid";
738
- return this.http.get(url, { responseType: "text" });
739
- };
740
- return BaseApiService;
741
- }());
742
- BaseApiService.decorators = [
743
- { type: i0.Injectable }
744
- ];
745
- BaseApiService.ctorParameters = function () { return [
746
- { type: http.HttpClient }
747
- ]; };
748
-
749
- var AppContextService = /** @class */ (function (_super) {
750
- __extends(AppContextService, _super);
751
- function AppContextService(http) {
752
- var _this = _super.call(this, http) || this;
753
- _this.http = http;
754
- _this.current = null;
755
- _this.successes = [];
756
- _this.subscription = null;
757
- _this.baseUrl = "/api/appContext";
758
- return _this;
498
+ var AnatolyHttpInterceptor = /** @class */ (function () {
499
+ function AnatolyHttpInterceptor(loadingService, loggingService) {
500
+ this.loadingService = loadingService;
501
+ this.loggingService = loggingService;
502
+ this.longRunningExceptionsList = [];
503
+ this.autoCDNSASTokenUrls = ['chunks', 'resources'];
504
+ this.externalSiteUrls = ['azurewebsites.net'];
759
505
  }
760
- AppContextService.prototype.getCurrent = function (success) {
506
+ AnatolyHttpInterceptor.prototype.intercept = function (req, next) {
507
+ var e_1, _a, e_2, _b, e_3, _c;
761
508
  var _this = this;
762
- if (typeof success == "undefined") {
763
- return;
509
+ var isCDNEnabled = AppCoreSettings.IsCDNEnabled;
510
+ var cdnSasToken = AppCoreSettings.CDNSASToken;
511
+ var isLoadingFreezed = this.loadingService.isFreezed;
512
+ var loadingRequired = !isLoadingFreezed;
513
+ var authorizationTokenRequired = true;
514
+ var url = req.url.toLowerCase();
515
+ var originalUrl = req.url;
516
+ var isExternalSite = false;
517
+ if (!isLoadingFreezed) {
518
+ try {
519
+ for (var _d = __values(this.longRunningExceptionsList), _e = _d.next(); !_e.done; _e = _d.next()) {
520
+ var i = _e.value;
521
+ if (url.indexOf(this.longRunningExceptionsList[i]) >= 0) {
522
+ loadingRequired = false;
523
+ break;
524
+ }
525
+ }
526
+ }
527
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
528
+ finally {
529
+ try {
530
+ if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
531
+ }
532
+ finally { if (e_1) throw e_1.error; }
533
+ }
764
534
  }
765
- if (this.current != null) {
766
- success(this.current);
767
- return;
535
+ if (isCDNEnabled) {
536
+ try {
537
+ for (var _f = __values(this.autoCDNSASTokenUrls), _g = _f.next(); !_g.done; _g = _f.next()) {
538
+ var i = _g.value;
539
+ if (url.indexOf(this.autoCDNSASTokenUrls[i]) >= 0) {
540
+ req = req.clone({ url: originalUrl + cdnSasToken });
541
+ break;
542
+ }
543
+ }
544
+ }
545
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
546
+ finally {
547
+ try {
548
+ if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
549
+ }
550
+ finally { if (e_2) throw e_2.error; }
551
+ }
768
552
  }
769
- this.successes.push(success);
770
- if (this.subscription != null) {
771
- return;
553
+ try {
554
+ for (var _h = __values(this.externalSiteUrls), _j = _h.next(); !_j.done; _j = _h.next()) {
555
+ var i = _j.value;
556
+ if (url.indexOf(this.externalSiteUrls[i]) >= 0) {
557
+ isExternalSite = true;
558
+ break;
559
+ }
560
+ }
772
561
  }
773
- this.subscription = this.get("GetCurrentContext", null).subscribe(function (data) {
774
- _this.dataReceived(data);
775
- }, function (e) { });
776
- };
777
- AppContextService.prototype.dataReceived = function (data) {
778
- this.current = data;
779
- for (var i = 0; i < this.successes.length; i++) {
780
- var success = this.successes[i];
781
- success(data);
562
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
563
+ finally {
564
+ try {
565
+ if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
566
+ }
567
+ finally { if (e_3) throw e_3.error; }
782
568
  }
783
- this.successes = [];
784
- this.subscription.unsubscribe();
785
- this.subscription = null;
786
- this.current = null;
787
- };
788
- AppContextService.prototype.isUserSignedIn = function () {
789
- return ContextInitState.isUserSignedIn;
790
- };
791
- AppContextService.prototype.isUserAdmin = function () {
792
- return ContextInitState.isUserAdmin;
793
- };
794
- return AppContextService;
795
- }(BaseApiService));
796
- AppContextService.decorators = [
797
- { type: i0.Injectable }
798
- ];
799
- AppContextService.ctorParameters = function () { return [
800
- { type: http.HttpClient }
801
- ]; };
802
-
803
- var LoadingService = /** @class */ (function (_super) {
804
- __extends(LoadingService, _super);
805
- function LoadingService() {
806
- var _this = _super.call(this, false) || this;
807
- _this.counter = 0;
808
- //Public
809
- _this.isFreezed = false;
810
- return _this;
811
- }
812
- LoadingService.prototype.show = function () {
813
- this.counter++;
814
- var that = this;
815
- setTimeout(function () {
816
- if (that.counter > 0) {
817
- that.next(true);
569
+ // VadimOS: IE11-fix
570
+ if (url.indexOf('/api/') > -1) {
571
+ var newUrl = '';
572
+ var t = new Date().getTime().toString();
573
+ if (url.indexOf('?') > -1) {
574
+ newUrl = originalUrl + '&t=' + t;
818
575
  }
819
- }, 1000);
820
- };
821
- LoadingService.prototype.hide = function () {
822
- if (this.counter <= 0) {
823
- return;
576
+ else {
577
+ newUrl = originalUrl + '?t=' + t;
578
+ }
579
+ req = req.clone({ url: newUrl });
824
580
  }
825
- this.counter--;
826
- if (this.counter == 0) {
827
- this.next(false);
581
+ req = req.clone({ headers: req.headers.set('Accept', 'application/json') });
582
+ this.onRequestStart(loadingRequired);
583
+ return next.handle(req).pipe(operators.tap(function (event) {
584
+ if (event instanceof i1.HttpResponse) {
585
+ _this.onRequestEnd(loadingRequired);
586
+ }
587
+ }, function (err) {
588
+ _this.onRequestEnd(loadingRequired);
589
+ _this.loggingService.logError(err);
590
+ }));
591
+ };
592
+ AnatolyHttpInterceptor.prototype.onRequestStart = function (loadingRequired) {
593
+ if (loadingRequired) {
594
+ this.loadingService.show();
828
595
  }
829
596
  };
830
- LoadingService.prototype.freeze = function (timeout) {
831
- var _this = this;
832
- if (timeout === void 0) { timeout = 1000; }
833
- this.isFreezed = true;
834
- var that = this;
835
- setTimeout(function () {
836
- _this.isFreezed = false;
837
- }, timeout);
597
+ AnatolyHttpInterceptor.prototype.onRequestEnd = function (loadingRequired) {
598
+ if (loadingRequired) {
599
+ this.loadingService.hide();
600
+ }
838
601
  };
839
- return LoadingService;
840
- }(rxjs.BehaviorSubject));
841
- LoadingService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LoadingService_Factory() { return new LoadingService(); }, token: LoadingService, providedIn: "root" });
842
- LoadingService.decorators = [
843
- { type: i0.Injectable, args: [{
844
- providedIn: "root",
845
- },] }
846
- ];
847
- LoadingService.ctorParameters = function () { return []; };
848
-
849
- var providers = [
850
- LoggingService,
851
- AppContextService,
852
- LoadingService
853
- ];
854
- var InjectorInstance;
855
- var AnatolyCoreModule = /** @class */ (function () {
856
- function AnatolyCoreModule(injector, parentModule) {
857
- this.injector = injector;
858
- throwIfAlreadyLoaded(parentModule, 'AnatolyCoreModule');
859
- InjectorInstance = this.injector;
860
- }
861
- return AnatolyCoreModule;
602
+ return AnatolyHttpInterceptor;
862
603
  }());
863
- AnatolyCoreModule.decorators = [
864
- { type: i0.NgModule, args: [{
865
- imports: [common.CommonModule],
866
- providers: __spread(providers),
867
- },] }
604
+ AnatolyHttpInterceptor.decorators = [
605
+ { type: i0.Injectable }
868
606
  ];
869
- AnatolyCoreModule.ctorParameters = function () { return [
870
- { type: i0.Injector },
871
- { type: AnatolyCoreModule, decorators: [{ type: i0.Optional }, { type: i0.SkipSelf }] }
607
+ AnatolyHttpInterceptor.ctorParameters = function () { return [
608
+ { type: LoadingService },
609
+ { type: LoggingService }
872
610
  ]; };
873
611
 
874
612
  /*
@@ -881,7 +619,7 @@
881
619
  Anatoly Osovitny
882
620
 
883
621
  Created:
884
- 19 March 2020
622
+ 29 June 2020
885
623
 
886
624
  Version:
887
625
  1.0
@@ -889,85 +627,120 @@
889
627
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
890
628
  </file>
891
629
  */
892
- // @dynamic
893
- var Utils = /** @class */ (function () {
894
- function Utils() {
630
+ var Convert = /** @class */ (function () {
631
+ function Convert() {
895
632
  }
896
- Utils.getValueByNameInQS = function (name) {
897
- return Utils.getValueByName(location.search, name);
633
+ Convert.toLocalizedDateTime = function (value) {
634
+ if (value) {
635
+ return new Date(Date.UTC(value.getFullYear(), value.getMonth(), value.getDate(), value.getHours(), value.getMinutes(), value.getSeconds(), value.getMilliseconds()));
636
+ }
637
+ return null;
898
638
  };
899
- Utils.getValueByName = function (url, name) {
900
- name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
901
- var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'), results = regex.exec(url);
902
- return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
639
+ return Convert;
640
+ }());
641
+
642
+ /*
643
+ <file>
644
+ Project:
645
+ @osovitny/anatoly
646
+
647
+ Authors:
648
+ Vadim Osovitny
649
+ Anatoly Osovitny
650
+
651
+ Created:
652
+ 05 May 2020
653
+
654
+ Version:
655
+ 1.0
656
+
657
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
658
+ </file>
659
+ */
660
+ var LocalizationService = /** @class */ (function () {
661
+ function LocalizationService(translate) {
662
+ this.translate = translate;
663
+ this.setSupportedLanguages(['en']);
664
+ }
665
+ LocalizationService.prototype.format = function (str, args) {
666
+ // tslint:disable-next-line:variable-name
667
+ return str.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] !== 'undefined' ? args[number] : match; });
903
668
  };
904
- Utils.copyToClipBoard = function (event, val) {
905
- event.preventDefault();
906
- var selBox = document.createElement('textarea');
907
- selBox.style.position = 'fixed';
908
- selBox.style.left = '0';
909
- selBox.style.top = '0';
910
- selBox.style.opacity = '0';
911
- selBox.value = val;
912
- document.body.appendChild(selBox);
913
- selBox.focus();
914
- selBox.select();
915
- document.execCommand('copy');
916
- document.body.removeChild(selBox);
669
+ ;
670
+ LocalizationService.prototype.configureTranslationSettings = function (translate) {
671
+ var languageToSet = 'en';
672
+ translate.setDefaultLang(languageToSet);
673
+ return languageToSet;
917
674
  };
918
- Utils.downloadFile = function (name, url) {
919
- var link = document.createElement('a');
920
- link.download = name;
921
- link.href = url;
922
- link.click();
675
+ LocalizationService.prototype.getBrowserLanguage = function () {
676
+ return this.translate.getBrowserLang();
923
677
  };
924
- Object.defineProperty(Utils, "localizationService", {
925
- // Localization
926
- // @dynamic
927
- get: function () {
928
- var ns = InjectorInstance.get(LocalizationService);
929
- return ns;
930
- },
931
- enumerable: false,
932
- configurable: true
933
- });
934
- Utils.getLocalizedValue = function (key, params, defaultKey) {
935
- // VadimOS: DON'T CHANGE THIS CODE. NEED TO BE REVIEWED AND APPROVED BY VADIMOS
936
- // defaultKey definition:
937
- // if key is empty and defaultKey is defined => get localization for defaultKey
938
- // Example: cancel()
939
- if (!key && defaultKey) {
940
- return this.localizationService.getLocalizedValue(defaultKey);
678
+ LocalizationService.prototype.getDatefnsLocale = function () {
679
+ var dfnLocale;
680
+ switch (this.getBrowserLanguage()) {
681
+ case 'en':
682
+ dfnLocale = { locale: enUS };
683
+ break;
684
+ default:
685
+ dfnLocale = { locale: enUS };
941
686
  }
942
- // VadimOS:
943
- // if key is not empty value MUST be in localization table, othewise we will return key
944
- if (key) {
945
- var value = this.localizationService.getLocalizedValue(key, params);
687
+ return dfnLocale;
688
+ };
689
+ LocalizationService.prototype.setDefaultLanguage = function (lang) {
690
+ this.translate.setDefaultLang(lang);
691
+ };
692
+ LocalizationService.prototype.setSupportedLanguages = function (languages) {
693
+ this.translate.addLangs(languages);
694
+ };
695
+ LocalizationService.prototype.updateLanguage = function (language) {
696
+ this.translate.use(language);
697
+ };
698
+ LocalizationService.prototype.getLocalizedValue = function (key, params) {
699
+ var value = this.translate.instant(key);
700
+ if (!params || params.length === 0) {
946
701
  return value;
947
702
  }
948
- return key;
703
+ return this.format(value, params);
949
704
  };
950
- /**
951
- * Convert date time lo local time zone value.
952
- * @param value
953
- */
954
- Utils.convertToLocalizedDateTime = function (value) {
955
- if (value) {
956
- return new Date(Date.UTC(value.getFullYear(), value.getMonth(), value.getDate(), value.getHours(), value.getMinutes(), value.getSeconds(), value.getMilliseconds()));
705
+ LocalizationService.prototype.getLocalizedDate = function (key) {
706
+ if (dateFns.isValid(new Date(key))) {
707
+ return dateFns.format(new Date(key), AppCoreSettings.DATE_FORMATS.angular, this.dateFnsLocale);
957
708
  }
958
- return null;
709
+ return 'Invalid Date';
959
710
  };
960
- Utils.downloadBlobFile = function (value, fileName) {
961
- if (window.navigator.msSaveOrOpenBlob) {
962
- window.navigator.msSaveOrOpenBlob(value, fileName);
711
+ LocalizationService.prototype.getLocalizedDateTime = function (key) {
712
+ // To Do Manoj: Test in IE and make TimeZone specific changes accordingly
713
+ var dateValue = new Date(key);
714
+ if (dateFns.isValid(dateValue)) {
715
+ var localDate = Convert.toLocalizedDateTime(dateValue);
716
+ return dateFns.format(localDate, AppCoreSettings.DATE_FORMATS.angularWithTime, this.dateFnsLocale);
963
717
  }
964
- else {
965
- var downloadURL = window.URL.createObjectURL(value);
966
- Utils.downloadFile(fileName, downloadURL);
718
+ return 'Invalid Date';
719
+ };
720
+ LocalizationService.prototype.getLocalizedDistanceToNowInWords = function (date) {
721
+ // https://date-fns.org/v1.30.1/docs/distanceInWords
722
+ if (dateFns.isValid(new Date(date))) {
723
+ return dateFns.formatDistanceToNow(new Date(date), this.dateFnsLocale);
967
724
  }
725
+ return 'Invalid Date';
968
726
  };
969
- return Utils;
970
- }());
727
+ LocalizationService.prototype.getLocalizedDistanceInWords = function (endedDate, startedDate) {
728
+ if (dateFns.isValid(new Date(endedDate)) && dateFns.isValid(new Date(startedDate))) {
729
+ return dateFns.formatDistance(new Date(endedDate), new Date(startedDate), this.dateFnsLocale);
730
+ }
731
+ return 'Invalid Date';
732
+ };
733
+ return LocalizationService;
734
+ }());
735
+ LocalizationService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LocalizationService_Factory() { return new LocalizationService(i0.ɵɵinject(i1$1.TranslateService)); }, token: LocalizationService, providedIn: "root" });
736
+ LocalizationService.decorators = [
737
+ { type: i0.Injectable, args: [{
738
+ providedIn: 'root'
739
+ },] }
740
+ ];
741
+ LocalizationService.ctorParameters = function () { return [
742
+ { type: i1$1.TranslateService }
743
+ ]; };
971
744
 
972
745
  /*
973
746
  <file>
@@ -979,7 +752,7 @@
979
752
  Anatoly Osovitny
980
753
 
981
754
  Created:
982
- 26 Jun 2020
755
+ 10 May 2020
983
756
 
984
757
  Version:
985
758
  1.0
@@ -987,30 +760,49 @@
987
760
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
988
761
  </file>
989
762
  */
990
- var Subs = /** @class */ (function () {
991
- function Subs() {
992
- this.subs = [];
763
+ var LocalizePipe = /** @class */ (function () {
764
+ function LocalizePipe(localizeService) {
765
+ this.localizeService = localizeService;
993
766
  }
994
- Subs.prototype.add = function () {
995
- var subscriptions = [];
996
- for (var _i = 0; _i < arguments.length; _i++) {
997
- subscriptions[_i] = arguments[_i];
767
+ LocalizePipe.prototype.transform = function (inputData, type, param2) {
768
+ if (!inputData) {
769
+ return;
998
770
  }
999
- this.subs = this.subs.concat(subscriptions);
1000
- };
1001
- Object.defineProperty(Subs.prototype, "sink", {
1002
- set: function (subscription) {
1003
- this.subs.push(subscription);
1004
- },
1005
- enumerable: false,
1006
- configurable: true
1007
- });
1008
- Subs.prototype.unsubscribe = function () {
1009
- this.subs.forEach(function (sub) { return sub && sub.unsubscribe(); });
1010
- this.subs = [];
771
+ if (!type) {
772
+ type = 't';
773
+ }
774
+ // Translate
775
+ if (type === 't') {
776
+ return this.localizeService.getLocalizedValue(inputData);
777
+ }
778
+ // Date
779
+ if (type === 'd') {
780
+ return this.localizeService.getLocalizedDate(inputData);
781
+ }
782
+ // DateTime
783
+ if (type === 'dt') {
784
+ return this.localizeService.getLocalizedDateTime(inputData);
785
+ }
786
+ // DistanceToNowInWords
787
+ if (type === 'dis2now') {
788
+ return this.localizeService.getLocalizedDistanceToNowInWords(inputData);
789
+ }
790
+ // DistanceInWords
791
+ if (type === 'dis') {
792
+ return this.localizeService.getLocalizedDistanceInWords(inputData, param2);
793
+ }
794
+ return inputData;
1011
795
  };
1012
- return Subs;
1013
- }());
796
+ return LocalizePipe;
797
+ }());
798
+ LocalizePipe.decorators = [
799
+ { type: i0.Pipe, args: [{
800
+ name: 'localize'
801
+ },] }
802
+ ];
803
+ LocalizePipe.ctorParameters = function () { return [
804
+ { type: LocalizationService }
805
+ ]; };
1014
806
 
1015
807
  /*
1016
808
  <file>
@@ -1022,7 +814,7 @@
1022
814
  Anatoly Osovitny
1023
815
 
1024
816
  Created:
1025
- 26 Jun 2020
817
+ 05 May 2020
1026
818
 
1027
819
  Version:
1028
820
  1.0
@@ -1030,14 +822,51 @@
1030
822
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1031
823
  </file>
1032
824
  */
1033
- var Guid = /** @class */ (function () {
1034
- function Guid() {
825
+ function customTranslateLoaderFactory(http) {
826
+ return new httpLoader.TranslateHttpLoader(http, AppCoreSettings.resourcesUrl + "/", '.json');
827
+ }
828
+ function localizationInitializerFactory(translate, localizationService, injector) {
829
+ return function () { return new Promise(function (resolve) {
830
+ var locationInitialized = injector.get(common.LOCATION_INITIALIZED, Promise.resolve(null));
831
+ locationInitialized.then(function () {
832
+ var languageToSet = localizationService.configureTranslationSettings(translate);
833
+ translate.use(languageToSet).subscribe(function () {
834
+ }, function () {
835
+ resolve(null);
836
+ }, function () {
837
+ resolve(null);
838
+ });
839
+ });
840
+ }); };
841
+ }
842
+ var TranslateModuleAtRoot = i1$1.TranslateModule.forRoot({
843
+ loader: {
844
+ provide: i1$1.TranslateLoader,
845
+ useFactory: customTranslateLoaderFactory,
846
+ deps: [i1.HttpClient]
1035
847
  }
1036
- Guid.newGuid = function () {
1037
- return uuid.v4();
1038
- };
1039
- return Guid;
1040
- }());
848
+ });
849
+ var LocalizationSettingsModule = /** @class */ (function () {
850
+ function LocalizationSettingsModule() {
851
+ }
852
+ return LocalizationSettingsModule;
853
+ }());
854
+ LocalizationSettingsModule.decorators = [
855
+ { type: i0.NgModule, args: [{
856
+ imports: [
857
+ TranslateModuleAtRoot
858
+ ],
859
+ providers: [
860
+ {
861
+ provide: i0.APP_INITIALIZER,
862
+ useFactory: localizationInitializerFactory,
863
+ deps: [i1$1.TranslateService, LocalizationService, i0.Injector],
864
+ multi: true
865
+ }
866
+ ],
867
+ exports: []
868
+ },] }
869
+ ];
1041
870
 
1042
871
  /*
1043
872
  <file>
@@ -1049,7 +878,7 @@
1049
878
  Anatoly Osovitny
1050
879
 
1051
880
  Created:
1052
- 17 Jun 2018
881
+ 12 May 2020
1053
882
 
1054
883
  Version:
1055
884
  1.0
@@ -1057,24 +886,26 @@
1057
886
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1058
887
  </file>
1059
888
  */
1060
- var BaseGoService = /** @class */ (function () {
1061
- function BaseGoService(route, router) {
1062
- this.route = route;
1063
- this.router = router;
889
+ var LocalizationModule = /** @class */ (function () {
890
+ function LocalizationModule() {
1064
891
  }
1065
- BaseGoService.prototype.locationReload = function () {
1066
- //this.router.navigate([this.route.url]);
1067
- window.location.reload();
1068
- };
1069
- return BaseGoService;
892
+ return LocalizationModule;
1070
893
  }());
1071
- BaseGoService.decorators = [
1072
- { type: i0.Injectable }
1073
- ];
1074
- BaseGoService.ctorParameters = function () { return [
1075
- { type: router.ActivatedRoute },
1076
- { type: router.Router }
1077
- ]; };
894
+ LocalizationModule.decorators = [
895
+ { type: i0.NgModule, args: [{
896
+ imports: [
897
+ i1$1.TranslateModule
898
+ ],
899
+ exports: [
900
+ i1$1.TranslateModule,
901
+ LocalizePipe
902
+ ],
903
+ declarations: [
904
+ LocalizePipe
905
+ ],
906
+ providers: []
907
+ },] }
908
+ ];
1078
909
 
1079
910
  /*
1080
911
  <file>
@@ -1113,118 +944,141 @@
1113
944
  { type: i0.Injector }
1114
945
  ]; };
1115
946
 
1116
- var AnatolyHttpInterceptor = /** @class */ (function () {
1117
- function AnatolyHttpInterceptor(loadingService, loggingService) {
1118
- this.loadingService = loadingService;
1119
- this.loggingService = loggingService;
1120
- this.longRunningExceptionsList = [];
1121
- this.autoCDNSASTokenUrls = ['chunks', 'resources'];
1122
- this.externalSiteUrls = ['azurewebsites.net'];
1123
- }
1124
- AnatolyHttpInterceptor.prototype.intercept = function (req, next) {
1125
- var e_1, _a, e_2, _b, e_3, _c;
1126
- var _this = this;
1127
- var isCDNEnabled = AppCoreSettings.IsCDNEnabled;
1128
- var cdnSasToken = AppCoreSettings.CDNSASToken;
1129
- var isLoadingFreezed = this.loadingService.isFreezed;
1130
- var loadingRequired = !isLoadingFreezed;
1131
- var authorizationTokenRequired = true;
1132
- var url = req.url.toLowerCase();
1133
- var originalUrl = req.url;
1134
- var isExternalSite = false;
1135
- if (!isLoadingFreezed) {
1136
- try {
1137
- for (var _d = __values(this.longRunningExceptionsList), _e = _d.next(); !_e.done; _e = _d.next()) {
1138
- var i = _e.value;
1139
- if (url.indexOf(this.longRunningExceptionsList[i]) >= 0) {
1140
- loadingRequired = false;
1141
- break;
1142
- }
1143
- }
1144
- }
1145
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1146
- finally {
1147
- try {
1148
- if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
1149
- }
1150
- finally { if (e_1) throw e_1.error; }
1151
- }
947
+ /*
948
+ <file>
949
+ Project:
950
+ @osovitny/anatoly
951
+
952
+ Authors:
953
+ Vadim Osovitny
954
+ Anatoly Osovitny
955
+
956
+ Created:
957
+ 13 Nov 2017
958
+
959
+ Version:
960
+ 1.0
961
+
962
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
963
+ </file>
964
+ */
965
+ var BaseApiService = /** @class */ (function () {
966
+ function BaseApiService(http) {
967
+ this.http = http;
968
+ this.baseUrl = '';
969
+ }
970
+ BaseApiService.prototype.serializeParams = function (data) {
971
+ return data ? '?' + $.param(data) : '';
972
+ };
973
+ // api
974
+ BaseApiService.prototype.get = function (action, data, responseType) {
975
+ if (!responseType) {
976
+ responseType = 'json';
1152
977
  }
1153
- if (isCDNEnabled) {
1154
- try {
1155
- for (var _f = __values(this.autoCDNSASTokenUrls), _g = _f.next(); !_g.done; _g = _f.next()) {
1156
- var i = _g.value;
1157
- if (url.indexOf(this.autoCDNSASTokenUrls[i]) >= 0) {
1158
- req = req.clone({ url: originalUrl + cdnSasToken });
1159
- break;
1160
- }
1161
- }
1162
- }
1163
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
1164
- finally {
1165
- try {
1166
- if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
1167
- }
1168
- finally { if (e_2) throw e_2.error; }
1169
- }
978
+ var url = this.baseUrl + "/" + action + this.serializeParams(data);
979
+ return this.http
980
+ .get(url, { responseType: responseType })
981
+ .pipe(operators.map(function (res) { return res; }));
982
+ };
983
+ BaseApiService.prototype.post = function (action, data, responseType) {
984
+ if (!responseType) {
985
+ responseType = 'text';
1170
986
  }
1171
- try {
1172
- for (var _h = __values(this.externalSiteUrls), _j = _h.next(); !_j.done; _j = _h.next()) {
1173
- var i = _j.value;
1174
- if (url.indexOf(this.externalSiteUrls[i]) >= 0) {
1175
- isExternalSite = true;
1176
- break;
1177
- }
1178
- }
987
+ var url = this.baseUrl + "/" + action;
988
+ return this.http.post(url, data, { responseType: responseType });
989
+ };
990
+ BaseApiService.prototype.postQS = function (action, data, responseType) {
991
+ if (!responseType) {
992
+ responseType = 'text';
1179
993
  }
1180
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
1181
- finally {
1182
- try {
1183
- if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
1184
- }
1185
- finally { if (e_3) throw e_3.error; }
994
+ var url = this.baseUrl + "/" + action + this.serializeParams(data);
995
+ return this.http.post(url, null, { responseType: responseType });
996
+ };
997
+ BaseApiService.prototype.delete = function (action, data, responseType) {
998
+ if (!responseType) {
999
+ responseType = 'text';
1186
1000
  }
1187
- // VadimOS: IE11-fix
1188
- if (url.indexOf('/api/') > -1) {
1189
- var newUrl = '';
1190
- var t = new Date().getTime().toString();
1191
- if (url.indexOf('?') > -1) {
1192
- newUrl = originalUrl + '&t=' + t;
1193
- }
1194
- else {
1195
- newUrl = originalUrl + '?t=' + t;
1196
- }
1197
- req = req.clone({ url: newUrl });
1001
+ var url = this.baseUrl + "/" + action + this.serializeParams(data);
1002
+ return this.http.delete(url, { responseType: responseType });
1003
+ };
1004
+ // gets
1005
+ BaseApiService.prototype.getById = function (id) {
1006
+ return this.get('getById', { id: id });
1007
+ };
1008
+ BaseApiService.prototype.getAll = function (data) {
1009
+ return this.get('getall', data).pipe(operators.map(function (res) { return res; }));
1010
+ };
1011
+ BaseApiService.prototype.getJsonFile = function (fileName, jsonUrl, jsonVersion) {
1012
+ if (!jsonUrl) {
1013
+ jsonUrl = '/dist/jsons';
1198
1014
  }
1199
- req = req.clone({ headers: req.headers.set('Accept', 'application/json') });
1200
- this.onRequestStart(loadingRequired);
1201
- return next.handle(req).pipe(operators.tap(function (event) {
1202
- if (event instanceof http.HttpResponse) {
1203
- _this.onRequestEnd(loadingRequired);
1204
- }
1205
- }, function (err) {
1206
- _this.onRequestEnd(loadingRequired);
1207
- _this.loggingService.logError(err);
1208
- }));
1015
+ if (!jsonVersion) {
1016
+ jsonVersion = '1.0';
1017
+ }
1018
+ var url = jsonUrl + '/' + fileName + '?' + jsonVersion;
1019
+ return this.http.get(url).pipe(operators.map(function (res) { return res; }));
1209
1020
  };
1210
- AnatolyHttpInterceptor.prototype.onRequestStart = function (loadingRequired) {
1211
- if (loadingRequired) {
1212
- this.loadingService.show();
1021
+ return BaseApiService;
1022
+ }());
1023
+ BaseApiService.decorators = [
1024
+ { type: i0.Injectable }
1025
+ ];
1026
+ BaseApiService.ctorParameters = function () { return [
1027
+ { type: i1.HttpClient }
1028
+ ]; };
1029
+
1030
+ var AppContextService = /** @class */ (function (_super) {
1031
+ __extends(AppContextService, _super);
1032
+ function AppContextService(http) {
1033
+ var _this = _super.call(this, http) || this;
1034
+ _this.http = http;
1035
+ _this.current = null;
1036
+ _this.successes = [];
1037
+ _this.subscription = null;
1038
+ _this.baseUrl = '/api/appContext';
1039
+ return _this;
1040
+ }
1041
+ AppContextService.prototype.getCurrent = function (success) {
1042
+ var _this = this;
1043
+ if (typeof success == 'undefined') {
1044
+ return;
1045
+ }
1046
+ if (this.current != null) {
1047
+ success(this.current);
1048
+ return;
1049
+ }
1050
+ this.successes.push(success);
1051
+ if (this.subscription != null) {
1052
+ return;
1213
1053
  }
1054
+ this.subscription = this.get('GetCurrentContext', null).subscribe(function (data) {
1055
+ _this.dataReceived(data);
1056
+ }, function (e) { });
1214
1057
  };
1215
- AnatolyHttpInterceptor.prototype.onRequestEnd = function (loadingRequired) {
1216
- if (loadingRequired) {
1217
- this.loadingService.hide();
1058
+ AppContextService.prototype.dataReceived = function (data) {
1059
+ this.current = data;
1060
+ for (var i = 0; i < this.successes.length; i++) {
1061
+ var success = this.successes[i];
1062
+ success(data);
1218
1063
  }
1064
+ this.successes = [];
1065
+ this.subscription.unsubscribe();
1066
+ this.subscription = null;
1067
+ this.current = null;
1219
1068
  };
1220
- return AnatolyHttpInterceptor;
1221
- }());
1222
- AnatolyHttpInterceptor.decorators = [
1069
+ AppContextService.prototype.isUserSignedIn = function () {
1070
+ return ContextInitState.isUserSignedIn;
1071
+ };
1072
+ AppContextService.prototype.isUserAdmin = function () {
1073
+ return ContextInitState.isUserAdmin;
1074
+ };
1075
+ return AppContextService;
1076
+ }(BaseApiService));
1077
+ AppContextService.decorators = [
1223
1078
  { type: i0.Injectable }
1224
1079
  ];
1225
- AnatolyHttpInterceptor.ctorParameters = function () { return [
1226
- { type: LoadingService },
1227
- { type: LoggingService }
1080
+ AppContextService.ctorParameters = function () { return [
1081
+ { type: i1.HttpClient }
1228
1082
  ]; };
1229
1083
 
1230
1084
  /*
@@ -1244,156 +1098,340 @@
1244
1098
 
1245
1099
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1246
1100
  </file>
1247
- */
1101
+ */
1102
+ var Guid = /** @class */ (function () {
1103
+ function Guid() {
1104
+ }
1105
+ Guid.newGuid = function () {
1106
+ return uuid.v4();
1107
+ };
1108
+ return Guid;
1109
+ }());
1248
1110
 
1249
- var BaseGridReadService = /** @class */ (function (_super) {
1250
- __extends(BaseGridReadService, _super);
1251
- function BaseGridReadService(http) {
1252
- var _this = _super.call(this, []) || this;
1253
- _this.http = http;
1254
- _this.baseReadUrl = "";
1255
- _this.data = [];
1256
- return _this;
1111
+ // SignalR
1112
+ // import * as signalR from '@microsoft/signalr';
1113
+ // import { NotificationsApiService } from '../../../data/services/notifications/notifications-api-service';
1114
+ var NotificationService = /** @class */ (function () {
1115
+ function NotificationService(toastrService) {
1116
+ this.toastrService = toastrService;
1117
+ // SignalR
1118
+ // private hubConnection: signalR.HubConnection;
1119
+ // private socketUrl: string;
1120
+ // Notifications
1121
+ this._sessionNotifications = new rxjs.BehaviorSubject([]);
1122
+ this._serverNotifications = new rxjs.BehaviorSubject([]);
1123
+ // Public
1124
+ this.sessionNotifications$ = this._sessionNotifications.asObservable();
1125
+ this.serverNotifications$ = this._serverNotifications.asObservable();
1126
+ // this.onInit();
1257
1127
  }
1258
- BaseGridReadService.prototype.serializeParams = function (data) {
1259
- return data ? "?" + $.param(data) : "";
1128
+ /*
1129
+ onInit() {
1130
+ if (AppCoreSettings.AzureAD) {
1131
+ this.authService.getAuthToken().subscribe((token: string) => {
1132
+ this.startSignalRConnection(token);
1133
+ });
1134
+
1135
+ return;
1136
+ }
1137
+
1138
+ this.startSignalRConnection();
1139
+ }
1140
+
1141
+ ngOnDestroy() {
1142
+ this.stopSignalRConnection();
1143
+ }
1144
+
1145
+ // SignalR
1146
+ private startSignalRConnection(accessToken?) {
1147
+ const cskii = AppCoreSettings.selectedClientID;
1148
+ // tslint:disable-next-line:variable-name
1149
+ const cskii_upn = AppCoreSettings.CSKII_UPN;
1150
+ // tslint:disable-next-line:variable-name
1151
+ const cli_sessionguid = AppCoreSettings.CLI_SessionGUID;
1152
+
1153
+ const url = this.socketUrl + '?cskii=' + cskii + '&cskii_upn=' + cskii_upn + '&cli_sessionguid=' + cli_sessionguid;
1154
+
1155
+ if (accessToken) {
1156
+ this.hubConnection = new signalR.HubConnectionBuilder()
1157
+ .withUrl(url, {
1158
+ skipNegotiation: false,
1159
+ transport: signalR.HttpTransportType.WebSockets,
1160
+ accessTokenFactory: () => accessToken
1161
+ })
1162
+ .withAutomaticReconnect()
1163
+ .configureLogging(signalR.LogLevel.Debug)
1164
+ .build();
1165
+ }
1166
+ else {
1167
+ this.hubConnection = new signalR.HubConnectionBuilder()
1168
+ .withUrl(this.socketUrl, {
1169
+ skipNegotiation: true,
1170
+ transport: signalR.HttpTransportType.WebSockets
1171
+ })
1172
+ .withAutomaticReconnect()
1173
+ .configureLogging(signalR.LogLevel.Debug)
1174
+ .build();
1175
+ }
1176
+
1177
+ this.hubConnection
1178
+ .start()
1179
+ .then(() => this.signalRConnection_onSuccess())
1180
+ .catch(err => {
1181
+ console.error('Connection failed to SignalR Notification Hub')
1182
+ })
1183
+ }
1184
+
1185
+ private signalRConnection_onSuccess() {
1186
+ this.addReceiveMessageDataListener();
1187
+
1188
+ this.notificationsApiService.retrieveNotifications().subscribe(data => {
1189
+ this.serverNotifications = data;
1190
+ });
1191
+ }
1192
+
1193
+ stopSignalRConnection() {
1194
+ if (this.hubConnection) {
1195
+ this.hubConnection.stop();
1196
+ this.hubConnection = null;
1197
+ }
1198
+ }
1199
+
1200
+ private addReceiveMessageDataListener = () => {
1201
+ this.hubConnection.on('ReceiveMessage', (message) => {
1202
+ if (message) {
1203
+ if (message.type === 'error') {
1204
+ this.error(message.text, null, null, false);
1205
+ }
1206
+ else {
1207
+ this.success(message.text, null, null, false);
1208
+ }
1209
+
1210
+ const notification = {
1211
+ id: message.id,
1212
+ isNew: message.isNew,
1213
+ isSession: true,
1214
+ text: message.text,
1215
+ type: message.type,
1216
+ createdDate: message.createdDate
1217
+ };
1218
+
1219
+ this.addSessionNotificationToList(notification);
1220
+ }
1221
+ });
1222
+ }
1223
+ */
1224
+ NotificationService.prototype.addSessionNotification = function (text, type) {
1225
+ var id = Guid.newGuid();
1226
+ var notification = { id: id, isNew: true, isSession: true, text: text, type: type, createdDate: new Date(Date.now()).toISOString() };
1227
+ this.addSessionNotificationToList(notification);
1260
1228
  };
1261
- BaseGridReadService.prototype.read = function (params, success, error) {
1262
- var _this = this;
1263
- if (this.data.length) {
1264
- return _super.prototype.next.call(this, this.data);
1229
+ NotificationService.prototype.addSessionNotificationToList = function (notification) {
1230
+ this.sessionNotifications = __spread([
1231
+ notification
1232
+ ], this.sessionNotifications);
1233
+ };
1234
+ // Public API
1235
+ NotificationService.prototype.removeNotification = function (id, isSession) {
1236
+ if (isSession) {
1237
+ this.sessionNotifications = this.sessionNotifications.filter(function (notifications) { return notifications.id !== id; });
1265
1238
  }
1266
- var url = this.baseReadUrl;
1267
- if (typeof params === "undefined") {
1268
- params = this.savedReadParams;
1239
+ else {
1240
+ this.serverNotifications = this.serverNotifications.filter(function (notifications) { return notifications.id !== id; });
1269
1241
  }
1270
- if (params) {
1271
- url = this.baseReadUrl + ("" + this.serializeParams(params));
1272
- this.savedReadParams = params;
1242
+ };
1243
+ NotificationService.prototype.success = function (text, params, title, createSessionNotification) {
1244
+ if (createSessionNotification === void 0) { createSessionNotification = true; }
1245
+ text = Utils.getLocalizedValue(text, params, 'OperationSuccessFull');
1246
+ title = Utils.getLocalizedValue(title);
1247
+ this.toastrService.success(text, title, {
1248
+ timeOut: 3000,
1249
+ progressBar: true
1250
+ });
1251
+ if (createSessionNotification) {
1252
+ this.addSessionNotification(text, 'success');
1273
1253
  }
1274
- this.http
1275
- .get(url)
1276
- .pipe(operators.map(function (res) { return res; }))
1277
- .subscribe(function (data) {
1278
- _super.prototype.next.call(_this, data);
1279
- if (success)
1280
- success();
1281
- }, function (e) {
1282
- if (error)
1283
- error(e);
1254
+ };
1255
+ NotificationService.prototype.info = function (text, params, title) {
1256
+ text = Utils.getLocalizedValue(text, params);
1257
+ title = Utils.getLocalizedValue(title);
1258
+ this.toastrService.info(text, title, {
1259
+ timeOut: 3000,
1260
+ progressBar: true
1284
1261
  });
1285
1262
  };
1286
- return BaseGridReadService;
1287
- }(rxjs.BehaviorSubject));
1288
- BaseGridReadService.decorators = [
1289
- { type: i0.Injectable }
1290
- ];
1291
- BaseGridReadService.ctorParameters = function () { return [
1292
- { type: http.HttpClient }
1293
- ]; };
1294
-
1295
- var BaseGridEditService = /** @class */ (function (_super) {
1296
- __extends(BaseGridEditService, _super);
1297
- function BaseGridEditService(http) {
1298
- var _this = _super.call(this, http) || this;
1299
- _this.http = http;
1300
- _this.baseUrl = "";
1301
- return _this;
1302
- }
1303
- BaseGridEditService.prototype.reset = function () {
1304
- this.data = [];
1263
+ NotificationService.prototype.warning = function (text, params, title) {
1264
+ text = Utils.getLocalizedValue(text, params);
1265
+ title = Utils.getLocalizedValue(title);
1266
+ this.toastrService.warning(text, title, {
1267
+ timeOut: 3000,
1268
+ progressBar: true
1269
+ });
1305
1270
  };
1306
- BaseGridEditService.prototype.resetItem = function (dataItem) {
1307
- if (!dataItem) {
1308
- return;
1271
+ NotificationService.prototype.error = function (text, params, title, createSessionNotification) {
1272
+ if (createSessionNotification === void 0) { createSessionNotification = true; }
1273
+ text = Utils.getLocalizedValue(text, params, 'ErrorOccured');
1274
+ title = Utils.getLocalizedValue(title);
1275
+ this.toastrService.error(text, title, {
1276
+ timeOut: 3000,
1277
+ progressBar: true
1278
+ });
1279
+ if (createSessionNotification) {
1280
+ this.addSessionNotification(text, 'error');
1309
1281
  }
1310
- //find orignal data item
1311
- var originalDataItem = this.data.find(function (item) { return item.Id === dataItem.Id; });
1312
- //revert changes
1313
- Object.assign(originalDataItem, dataItem);
1314
- _super.prototype.next.call(this, this.data);
1315
- };
1316
- BaseGridEditService.prototype.save = function (data, isNew, sucess) {
1317
- var _this = this;
1318
- var action = isNew ? "add" : "update";
1319
- this.reset();
1320
- this.post(action, data).subscribe(function () { }, function () {
1321
- _this.read();
1322
- }, function () {
1323
- _this.read();
1324
- if (sucess)
1325
- sucess();
1326
- });
1327
1282
  };
1328
- BaseGridEditService.prototype.remove = function (data, sucess) {
1329
- var _this = this;
1330
- this.reset();
1331
- this.post("remove", data).subscribe(function () { }, function () {
1332
- _this.read();
1333
- }, function () {
1334
- _this.read();
1335
- if (sucess)
1336
- sucess();
1283
+ NotificationService.prototype.cancel = function (text, params, title) {
1284
+ text = Utils.getLocalizedValue(text, params, 'OperationCancelled');
1285
+ title = Utils.getLocalizedValue(title);
1286
+ this.toastrService.info(text, title, {
1287
+ timeOut: 3000,
1288
+ progressBar: true
1337
1289
  });
1338
1290
  };
1339
- BaseGridEditService.prototype.post = function (action, data) {
1340
- var url = this.baseUrl + ("" + action + this.serializeParams(data));
1341
- return this.http.post(url, data).pipe(operators.map(function (res) { return res; }));
1342
- };
1343
- return BaseGridEditService;
1344
- }(BaseGridReadService));
1345
- BaseGridEditService.decorators = [
1346
- { type: i0.Injectable }
1291
+ Object.defineProperty(NotificationService.prototype, "sessionNotifications", {
1292
+ // SessionNotifications
1293
+ get: function () {
1294
+ return this._sessionNotifications.getValue();
1295
+ },
1296
+ set: function (val) {
1297
+ this._sessionNotifications.next(val);
1298
+ },
1299
+ enumerable: false,
1300
+ configurable: true
1301
+ });
1302
+ Object.defineProperty(NotificationService.prototype, "serverNotifications", {
1303
+ // ServerNotifications
1304
+ get: function () {
1305
+ return this._serverNotifications.getValue();
1306
+ },
1307
+ set: function (val) {
1308
+ this._serverNotifications.next(val);
1309
+ },
1310
+ enumerable: false,
1311
+ configurable: true
1312
+ });
1313
+ return NotificationService;
1314
+ }());
1315
+ NotificationService.ɵprov = i0.ɵɵdefineInjectable({ factory: function NotificationService_Factory() { return new NotificationService(i0.ɵɵinject(i1$2.ToastrService)); }, token: NotificationService, providedIn: "root" });
1316
+ NotificationService.decorators = [
1317
+ { type: i0.Injectable, args: [{ providedIn: 'root' },] }
1347
1318
  ];
1348
- BaseGridEditService.ctorParameters = function () { return [
1349
- { type: http.HttpClient }
1319
+ NotificationService.ctorParameters = function () { return [
1320
+ { type: i1$2.ToastrService }
1350
1321
  ]; };
1351
1322
 
1352
- var BillingApiService = /** @class */ (function (_super) {
1353
- __extends(BillingApiService, _super);
1354
- function BillingApiService(http) {
1355
- var _this = _super.call(this, http) || this;
1356
- _this.http = http;
1357
- _this.baseUrl += "billing/";
1358
- return _this;
1323
+ var AnatolyCoreModule = /** @class */ (function () {
1324
+ function AnatolyCoreModule(injector, parentModule) {
1325
+ this.injector = injector;
1326
+ throwIfAlreadyLoaded(parentModule, 'AnatolyCoreModule');
1327
+ exports.InjectorInstance = this.injector;
1359
1328
  }
1360
- BillingApiService.prototype.requestNewSubscription = function (requestedPlan, success, error) {
1361
- this.postQS("requestNewSubscription", {
1362
- requestedPlan: requestedPlan,
1363
- }).subscribe(function (data) { }, function (e) {
1364
- if (error)
1365
- error();
1366
- }, function () {
1367
- if (success)
1368
- success();
1369
- });
1329
+ return AnatolyCoreModule;
1330
+ }());
1331
+ AnatolyCoreModule.decorators = [
1332
+ { type: i0.NgModule, args: [{
1333
+ imports: [common.CommonModule],
1334
+ exports: [],
1335
+ providers: [
1336
+ LoggingService,
1337
+ NotificationService,
1338
+ AppContextService,
1339
+ LoadingService
1340
+ ],
1341
+ },] }
1342
+ ];
1343
+ AnatolyCoreModule.ctorParameters = function () { return [
1344
+ { type: i0.Injector },
1345
+ { type: AnatolyCoreModule, decorators: [{ type: i0.Optional }, { type: i0.SkipSelf }] }
1346
+ ]; };
1347
+
1348
+ /*
1349
+ <file>
1350
+ Project:
1351
+ @osovitny/anatoly
1352
+
1353
+ Authors:
1354
+ Vadim Osovitny
1355
+ Anatoly Osovitny
1356
+
1357
+ Created:
1358
+ 19 March 2020
1359
+
1360
+ Version:
1361
+ 1.0
1362
+
1363
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1364
+ </file>
1365
+ */
1366
+ var Utils = /** @class */ (function () {
1367
+ function Utils() {
1368
+ }
1369
+ Utils.getValueByNameInQS = function (name) {
1370
+ return Utils.getValueByName(location.search, name);
1370
1371
  };
1371
- BillingApiService.prototype.cancelRequestedSubscription = function (success, error) {
1372
- this.postQS("cancelRequestedSubscription", null).subscribe(function (data) { }, function (e) {
1373
- if (error)
1374
- error();
1375
- }, function () {
1376
- if (success)
1377
- success();
1378
- });
1372
+ Utils.getValueByName = function (url, name) {
1373
+ name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
1374
+ // tslint:disable-next-line:one-variable-per-declaration
1375
+ var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'), results = regex.exec(url);
1376
+ return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
1379
1377
  };
1380
- BillingApiService.prototype.buyAccess = function (requestedPlan, success, error) {
1381
- this.postQS("buyAccess", { requestedPlan: requestedPlan }).subscribe(function (data) { }, function (e) {
1382
- if (error)
1383
- error();
1384
- }, function () {
1385
- if (success)
1386
- success();
1387
- });
1378
+ Utils.copyToClipBoard = function (event, val) {
1379
+ event.preventDefault();
1380
+ var selBox = document.createElement('textarea');
1381
+ selBox.style.position = 'fixed';
1382
+ selBox.style.left = '0';
1383
+ selBox.style.top = '0';
1384
+ selBox.style.opacity = '0';
1385
+ selBox.value = val;
1386
+ document.body.appendChild(selBox);
1387
+ selBox.focus();
1388
+ selBox.select();
1389
+ document.execCommand('copy');
1390
+ document.body.removeChild(selBox);
1388
1391
  };
1389
- return BillingApiService;
1390
- }(BaseApiService));
1391
- BillingApiService.decorators = [
1392
- { type: i0.Injectable }
1393
- ];
1394
- BillingApiService.ctorParameters = function () { return [
1395
- { type: http.HttpClient }
1396
- ]; };
1392
+ Utils.downloadFile = function (name, url) {
1393
+ var link = document.createElement('a');
1394
+ link.download = name;
1395
+ link.href = url;
1396
+ link.click();
1397
+ };
1398
+ Object.defineProperty(Utils, "localizationService", {
1399
+ // Localization
1400
+ // @dynamic
1401
+ get: function () {
1402
+ var ns = exports.InjectorInstance.get(LocalizationService);
1403
+ return ns;
1404
+ },
1405
+ enumerable: false,
1406
+ configurable: true
1407
+ });
1408
+ Utils.getLocalizedValue = function (key, params, defaultKey) {
1409
+ // VadimOS: DON'T CHANGE THIS CODE. NEED TO BE REVIEWED AND APPROVED BY VADIMOS
1410
+ // defaultKey definition:
1411
+ // if key is empty and defaultKey is defined => get localization for defaultKey
1412
+ // Example: cancel()
1413
+ if (!key && defaultKey) {
1414
+ return this.localizationService.getLocalizedValue(defaultKey);
1415
+ }
1416
+ // VadimOS:
1417
+ // if key is not empty value MUST be in localization table, othewise we will return key
1418
+ if (key) {
1419
+ var value = this.localizationService.getLocalizedValue(key, params);
1420
+ return value;
1421
+ }
1422
+ return key;
1423
+ };
1424
+ Utils.downloadBlobFile = function (value, fileName) {
1425
+ if (window.navigator.msSaveOrOpenBlob) {
1426
+ window.navigator.msSaveOrOpenBlob(value, fileName);
1427
+ }
1428
+ else {
1429
+ var downloadURL = window.URL.createObjectURL(value);
1430
+ Utils.downloadFile(fileName, downloadURL);
1431
+ }
1432
+ };
1433
+ return Utils;
1434
+ }());
1397
1435
 
1398
1436
  /*
1399
1437
  <file>
@@ -1405,7 +1443,7 @@
1405
1443
  Anatoly Osovitny
1406
1444
 
1407
1445
  Created:
1408
- 4 Mar 2020
1446
+ 3 March 2020
1409
1447
 
1410
1448
  Version:
1411
1449
  1.0
@@ -1413,17 +1451,95 @@
1413
1451
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1414
1452
  </file>
1415
1453
  */
1416
- var AnatolyDataModule = /** @class */ (function () {
1417
- function AnatolyDataModule() {
1454
+ var Alerts = /** @class */ (function () {
1455
+ function Alerts() {
1418
1456
  }
1419
- return AnatolyDataModule;
1420
- }());
1421
- AnatolyDataModule.decorators = [
1422
- { type: i0.NgModule, args: [{
1423
- imports: [common.CommonModule],
1424
- providers: [BillingApiService],
1425
- },] }
1426
- ];
1457
+ Alerts.success = function (text, params, title, successAction) {
1458
+ text = Utils.getLocalizedValue(text, params, 'OperationSuccessFull');
1459
+ title = Utils.getLocalizedValue(title, null, 'Success');
1460
+ Swal.fire({
1461
+ text: text,
1462
+ title: title,
1463
+ icon: 'success',
1464
+ confirmButtonText: Utils.getLocalizedValue('Ok')
1465
+ })
1466
+ .then(function () {
1467
+ if (successAction) {
1468
+ successAction();
1469
+ }
1470
+ });
1471
+ };
1472
+ Alerts.info = function (text, params, title) {
1473
+ text = Utils.getLocalizedValue(text, params);
1474
+ title = Utils.getLocalizedValue(title, null, 'Info');
1475
+ Swal.fire({
1476
+ text: text,
1477
+ title: title,
1478
+ icon: 'info',
1479
+ confirmButtonText: Utils.getLocalizedValue('Ok')
1480
+ });
1481
+ };
1482
+ Alerts.warning = function (text, params, title) {
1483
+ text = Utils.getLocalizedValue(text, params);
1484
+ title = Utils.getLocalizedValue(title, null, 'Warning');
1485
+ Swal.fire({
1486
+ text: text,
1487
+ title: title,
1488
+ icon: 'warning',
1489
+ confirmButtonText: Utils.getLocalizedValue('Ok')
1490
+ });
1491
+ };
1492
+ Alerts.error = function (text, params, title) {
1493
+ text = Utils.getLocalizedValue(text, params, 'ErrorOccured');
1494
+ title = Utils.getLocalizedValue(title, null, 'Error');
1495
+ Swal.fire({
1496
+ text: text,
1497
+ title: title,
1498
+ icon: 'error',
1499
+ confirmButtonText: Utils.getLocalizedValue('Ok')
1500
+ });
1501
+ };
1502
+ Alerts.cancel = function (text, params, title) {
1503
+ text = Utils.getLocalizedValue(text, params, 'OperationCancelled');
1504
+ title = Utils.getLocalizedValue(title, null, 'Cancelled');
1505
+ Swal.fire({
1506
+ text: text,
1507
+ title: title,
1508
+ icon: 'info'
1509
+ });
1510
+ };
1511
+ Alerts.notImplemented = function () {
1512
+ this.warning('Not Implemented Yet');
1513
+ };
1514
+ ;
1515
+ Alerts.areYouSure = function (text, title, confirmButtonText, cancelButtonText, successAction, cancelAction) {
1516
+ text = Utils.getLocalizedValue(text);
1517
+ title = Utils.getLocalizedValue(title, null, 'AreYouSure');
1518
+ Swal.fire({
1519
+ text: text,
1520
+ title: title,
1521
+ icon: 'warning',
1522
+ confirmButtonText: Utils.getLocalizedValue(confirmButtonText),
1523
+ cancelButtonText: Utils.getLocalizedValue(cancelButtonText),
1524
+ showCancelButton: true
1525
+ })
1526
+ .then(function (result) {
1527
+ if (result.value) {
1528
+ if (successAction) {
1529
+ successAction();
1530
+ }
1531
+ }
1532
+ // result.dismiss can be 'cancel', 'overlay', 'close', and 'timer'
1533
+ else if (result.dismiss == Swal.DismissReason.cancel || result.dismiss == Swal.DismissReason.close) {
1534
+ if (cancelAction) {
1535
+ cancelAction();
1536
+ }
1537
+ }
1538
+ });
1539
+ };
1540
+ ;
1541
+ return Alerts;
1542
+ }());
1427
1543
 
1428
1544
  /*
1429
1545
  <file>
@@ -1435,7 +1551,7 @@
1435
1551
  Anatoly Osovitny
1436
1552
 
1437
1553
  Created:
1438
- 4 Mar 2020
1554
+ 2 Jun 2020
1439
1555
 
1440
1556
  Version:
1441
1557
  1.0
@@ -1454,7 +1570,7 @@
1454
1570
  Anatoly Osovitny
1455
1571
 
1456
1572
  Created:
1457
- 14 Aug 2018
1573
+ 26 Jun 2020
1458
1574
 
1459
1575
  Version:
1460
1576
  1.0
@@ -1462,57 +1578,99 @@
1462
1578
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1463
1579
  </file>
1464
1580
  */
1465
- var BuyAccessButtonComponent = /** @class */ (function () {
1466
- function BuyAccessButtonComponent(appcontext, api) {
1467
- this.appcontext = appcontext;
1468
- this.api = api;
1469
- this.contextUpdated = false;
1470
- this.isUserSignedIn = false;
1471
- this.currentPlan = 0;
1472
- this.currentPlanTitle = "";
1581
+ var IdleService = /** @class */ (function () {
1582
+ function IdleService() {
1583
+ this.expired$ = new rxjs.Subject();
1473
1584
  }
1474
- BuyAccessButtonComponent.prototype.ngOnInit = function () {
1585
+ IdleService.prototype.startWatching = function (timeOutSeconds) {
1475
1586
  var _this = this;
1476
- if (!this.appcontext.isUserSignedIn()) {
1477
- this.contextUpdated = true;
1478
- return;
1479
- }
1480
- this.appcontext.getCurrent(function (current) {
1481
- _this.isUserSignedIn = current.isUserSignedIn;
1482
- if (_this.isUserSignedIn) {
1483
- _this.currentPlan = current.account.billingPlan;
1484
- _this.currentPlanTitle = current.account.billingPlanAsString;
1485
- }
1486
- _this.contextUpdated = true;
1587
+ this.idle$ = rxjs.merge(rxjs.fromEvent(document, "mousemove"), rxjs.fromEvent(document, "click"), rxjs.fromEvent(document, "mousedown"), rxjs.fromEvent(document, "keypress"), rxjs.fromEvent(document, "DOMMouseScroll"), rxjs.fromEvent(document, "mousewheel"), rxjs.fromEvent(document, "touchmove"), rxjs.fromEvent(document, "MSPointerMove"), rxjs.fromEvent(window, "mousemove"), rxjs.fromEvent(window, "resize"));
1588
+ this.timeOutMilliSeconds = timeOutSeconds * 1000;
1589
+ this.idleSubscription = this.idle$.subscribe(function (res) {
1590
+ _this.resetTimer();
1487
1591
  });
1592
+ this.startTimer();
1593
+ return this.expired$;
1488
1594
  };
1489
- BuyAccessButtonComponent.prototype.onBuyPlan = function () {
1490
- var text = "Requested plan: " + this.plantitle + " ";
1491
- var that = this;
1492
- Alerts.AreYouSure(text, "Buying access", "Confirm change", "Cancel", function () {
1493
- that.api.buyAccess(that.plan, function () {
1494
- Alerts.Success("Access Granted", null, function () {
1495
- window.location.reload();
1496
- });
1497
- });
1595
+ IdleService.prototype.startTimer = function () {
1596
+ var _this = this;
1597
+ this.timer$ = rxjs.timer(this.timeOutMilliSeconds, this.timeOutMilliSeconds).subscribe(function (res) {
1598
+ _this.expired$.next(true);
1498
1599
  });
1499
1600
  };
1500
- return BuyAccessButtonComponent;
1601
+ IdleService.prototype.resetTimer = function () {
1602
+ this.timer$.unsubscribe();
1603
+ this.startTimer();
1604
+ };
1605
+ IdleService.prototype.stopTimer = function () {
1606
+ this.timer$.unsubscribe();
1607
+ this.idleSubscription.unsubscribe();
1608
+ };
1609
+ IdleService.prototype.restartIdleTimer = function () {
1610
+ var _this = this;
1611
+ this.timer$.unsubscribe();
1612
+ this.idleSubscription.unsubscribe();
1613
+ this.idleSubscription = this.idle$.subscribe(function (res) {
1614
+ _this.resetTimer();
1615
+ });
1616
+ this.startTimer();
1617
+ };
1618
+ return IdleService;
1501
1619
  }());
1502
- BuyAccessButtonComponent.decorators = [
1503
- { type: i0.Component, args: [{
1504
- selector: "anatoly-buyaccess-button",
1505
- template: "<div *ngIf=\"contextUpdated\">\r\n <div *ngIf=\"!isUserSignedIn\">\r\n <anatoly-signup-button classbtn=\"btn btn-block btn-primary\"></anatoly-signup-button>\r\n </div>\r\n\r\n <div *ngIf=\"isUserSignedIn\">\r\n <button class=\"btn btn-block btn-success selectPlan\" *ngIf=\"plan == currentPlan\">\r\n Your Plan\r\n </button>\r\n\r\n <button class=\"btn btn-block btn-warning selectPlan\" *ngIf=\"plan != currentPlan && currentPlan == 1\" (click)=\"onBuyPlan()\">\r\n Buy Now\r\n </button>\r\n </div>\r\n</div>\r\n"
1620
+ IdleService.ɵprov = i0.ɵɵdefineInjectable({ factory: function IdleService_Factory() { return new IdleService(); }, token: IdleService, providedIn: "root" });
1621
+ IdleService.decorators = [
1622
+ { type: i0.Injectable, args: [{
1623
+ providedIn: "root",
1506
1624
  },] }
1625
+ ];
1626
+
1627
+ var WebStorageService = /** @class */ (function () {
1628
+ function WebStorageService(storage) {
1629
+ this.currentClientKey = AppCoreSettings.SERVICES_CONF.selectedClientID;
1630
+ this.storage =
1631
+ storage === 'local' || storage === 'localStorage'
1632
+ ? localStorage
1633
+ : sessionStorage;
1634
+ }
1635
+ WebStorageService.prototype.setItem = function (key, value) {
1636
+ this.storage.setItem(this.currentClientKey + key, value);
1637
+ };
1638
+ WebStorageService.prototype.setObject = function (key, value) {
1639
+ this.storage.setItem(this.currentClientKey + key, JSON.stringify(value));
1640
+ };
1641
+ WebStorageService.prototype.getItem = function (key) {
1642
+ return this.storage.getItem(this.currentClientKey + key);
1643
+ };
1644
+ WebStorageService.prototype.getObject = function (key) {
1645
+ return JSON.parse(this.storage.getItem(this.currentClientKey + key) || '{}');
1646
+ };
1647
+ WebStorageService.prototype.remove = function (key) {
1648
+ this.storage.removeItem(this.currentClientKey + key);
1649
+ };
1650
+ return WebStorageService;
1651
+ }());
1652
+ var LocalStorageService = /** @class */ (function (_super) {
1653
+ __extends(LocalStorageService, _super);
1654
+ function LocalStorageService() {
1655
+ return _super.call(this, 'localStorage') || this;
1656
+ }
1657
+ return LocalStorageService;
1658
+ }(WebStorageService));
1659
+ LocalStorageService.decorators = [
1660
+ { type: i0.Injectable }
1507
1661
  ];
1508
- BuyAccessButtonComponent.ctorParameters = function () { return [
1509
- { type: AppContextService },
1510
- { type: BillingApiService }
1511
- ]; };
1512
- BuyAccessButtonComponent.propDecorators = {
1513
- plan: [{ type: i0.Input }],
1514
- plantitle: [{ type: i0.Input }]
1515
- };
1662
+ LocalStorageService.ctorParameters = function () { return []; };
1663
+ var SessionStorageService = /** @class */ (function (_super) {
1664
+ __extends(SessionStorageService, _super);
1665
+ function SessionStorageService() {
1666
+ return _super.call(this, 'sessionStorage') || this;
1667
+ }
1668
+ return SessionStorageService;
1669
+ }(WebStorageService));
1670
+ SessionStorageService.decorators = [
1671
+ { type: i0.Injectable }
1672
+ ];
1673
+ SessionStorageService.ctorParameters = function () { return []; };
1516
1674
 
1517
1675
  /*
1518
1676
  <file>
@@ -1524,7 +1682,7 @@
1524
1682
  Anatoly Osovitny
1525
1683
 
1526
1684
  Created:
1527
- 1 Jun 2018
1685
+ 26 Jun 2020
1528
1686
 
1529
1687
  Version:
1530
1688
  1.0
@@ -1532,99 +1690,133 @@
1532
1690
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1533
1691
  </file>
1534
1692
  */
1535
- var SubscribePlanButtonComponent = /** @class */ (function () {
1536
- function SubscribePlanButtonComponent(appcontext) {
1537
- this.appcontext = appcontext;
1538
- this.contextUpdated = false;
1539
- this.isUserSignedIn = false;
1540
- this.currentPlan = 0;
1541
- this.currentPlanTitle = "";
1542
- this.requestedPlan = 0;
1543
- this.requestedPlanTitle = "";
1693
+ var Subs = /** @class */ (function () {
1694
+ function Subs() {
1695
+ this.subs = [];
1544
1696
  }
1545
- SubscribePlanButtonComponent.prototype.ngOnInit = function () {
1697
+ Subs.prototype.add = function () {
1698
+ var subscriptions = [];
1699
+ for (var _i = 0; _i < arguments.length; _i++) {
1700
+ subscriptions[_i] = arguments[_i];
1701
+ }
1702
+ this.subs = this.subs.concat(subscriptions);
1703
+ };
1704
+ Object.defineProperty(Subs.prototype, "sink", {
1705
+ set: function (subscription) {
1706
+ this.subs.push(subscription);
1707
+ },
1708
+ enumerable: false,
1709
+ configurable: true
1710
+ });
1711
+ Subs.prototype.unsubscribe = function () {
1712
+ this.subs.forEach(function (sub) { return sub && sub.unsubscribe(); });
1713
+ this.subs = [];
1714
+ };
1715
+ return Subs;
1716
+ }());
1717
+
1718
+ var BaseGridReadService = /** @class */ (function (_super) {
1719
+ __extends(BaseGridReadService, _super);
1720
+ function BaseGridReadService(http) {
1721
+ var _this = _super.call(this, []) || this;
1722
+ _this.http = http;
1723
+ _this.baseReadUrl = "";
1724
+ _this.data = [];
1725
+ return _this;
1726
+ }
1727
+ BaseGridReadService.prototype.serializeParams = function (data) {
1728
+ return data ? "?" + $.param(data) : "";
1729
+ };
1730
+ BaseGridReadService.prototype.read = function (params, success, error) {
1546
1731
  var _this = this;
1547
- if (!this.appcontext.isUserSignedIn()) {
1548
- this.contextUpdated = true;
1549
- return;
1732
+ if (this.data.length) {
1733
+ return _super.prototype.next.call(this, this.data);
1550
1734
  }
1551
- this.appcontext.getCurrent(function (current) {
1552
- _this.isUserSignedIn = current.isUserSignedIn;
1553
- if (_this.isUserSignedIn) {
1554
- _this.currentPlan = current.account.billingPlan;
1555
- _this.currentPlanTitle = current.account.billingPlanAsString;
1556
- _this.requestedPlan = current.account.requestedBillingPlan;
1557
- _this.requestedPlanTitle = current.account.requestedBillingPlanAsString;
1558
- }
1559
- _this.contextUpdated = true;
1735
+ var url = this.baseReadUrl;
1736
+ if (typeof params === "undefined") {
1737
+ params = this.savedReadParams;
1738
+ }
1739
+ if (params) {
1740
+ url = this.baseReadUrl + ("" + this.serializeParams(params));
1741
+ this.savedReadParams = params;
1742
+ }
1743
+ this.http
1744
+ .get(url)
1745
+ .pipe(operators.map(function (res) { return res; }))
1746
+ .subscribe(function (data) {
1747
+ _super.prototype.next.call(_this, data);
1748
+ if (success)
1749
+ success();
1750
+ }, function (e) {
1751
+ if (error)
1752
+ error(e);
1560
1753
  });
1561
1754
  };
1562
- return SubscribePlanButtonComponent;
1563
- }());
1564
- SubscribePlanButtonComponent.decorators = [
1565
- { type: i0.Component, args: [{
1566
- selector: "anatoly-subscribe-plan-button",
1567
- template: "<div *ngIf=\"contextUpdated\">\r\n <div *ngIf=\"!isUserSignedIn\">\r\n <anatoly-signup-button classbtn=\"btn btn-block btn-primary\"></anatoly-signup-button>\r\n </div>\r\n\r\n <div *ngIf=\"isUserSignedIn\">\r\n <button class=\"btn btn-block btn-success selectPlan\" *ngIf=\"plan == currentPlan\">\r\n Your Plan\r\n </button>\r\n\r\n <button class=\"btn btn-block btn-warning selectPlan\" *ngIf=\"requestedPlan != null && requestedPlan != 0 && plan == requestedPlan\">\r\n Requested\r\n </button>\r\n\r\n <anatoly-upgrade-plan-button *ngIf=\"plan != currentPlan && plan != requestedPlan\"\r\n [currentplantitle]=\"currentPlanTitle\"\r\n [requestedplan]=plan\r\n [requestedplantitle]=\"plantitle\">\r\n </anatoly-upgrade-plan-button>\r\n </div>\r\n</div>\r\n"
1568
- },] }
1755
+ return BaseGridReadService;
1756
+ }(rxjs.BehaviorSubject));
1757
+ BaseGridReadService.decorators = [
1758
+ { type: i0.Injectable }
1569
1759
  ];
1570
- SubscribePlanButtonComponent.ctorParameters = function () { return [
1571
- { type: AppContextService }
1572
- ]; };
1573
- SubscribePlanButtonComponent.propDecorators = {
1574
- plan: [{ type: i0.Input }],
1575
- plantitle: [{ type: i0.Input }]
1576
- };
1760
+ BaseGridReadService.ctorParameters = function () { return [
1761
+ { type: i1.HttpClient }
1762
+ ]; };
1577
1763
 
1578
- /*
1579
- <file>
1580
- Project:
1581
- @osovitny/anatoly
1582
-
1583
- Authors:
1584
- Vadim Osovitny
1585
- Anatoly Osovitny
1586
-
1587
- Created:
1588
- 12 Nov 2017
1589
-
1590
- Version:
1591
- 1.0
1592
-
1593
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1594
- </file>
1595
- */
1596
- // Services
1597
- var UpgradePlanButtonComponent = /** @class */ (function () {
1598
- function UpgradePlanButtonComponent(api) {
1599
- this.api = api;
1764
+ var BaseGridEditService = /** @class */ (function (_super) {
1765
+ __extends(BaseGridEditService, _super);
1766
+ function BaseGridEditService(http) {
1767
+ var _this = _super.call(this, http) || this;
1768
+ _this.http = http;
1769
+ _this.baseUrl = "";
1770
+ return _this;
1600
1771
  }
1601
- UpgradePlanButtonComponent.prototype.onUpgradePlan = function () {
1602
- var text = "Current plan: " + this.currentplantitle + " New plan: " + this.requestedplantitle;
1603
- var that = this;
1604
- Alerts.AreYouSure(text, "Change billing plan", "Confirm change", "Cancel", function () {
1605
- that.api.requestNewSubscription(that.requestedplan, function () {
1606
- Alerts.Success("Your request for changing plan has been sent.", null, function () {
1607
- window.location.reload();
1608
- });
1609
- });
1772
+ BaseGridEditService.prototype.reset = function () {
1773
+ this.data = [];
1774
+ };
1775
+ BaseGridEditService.prototype.resetItem = function (dataItem) {
1776
+ if (!dataItem) {
1777
+ return;
1778
+ }
1779
+ //find orignal data item
1780
+ var originalDataItem = this.data.find(function (item) { return item.Id === dataItem.Id; });
1781
+ //revert changes
1782
+ Object.assign(originalDataItem, dataItem);
1783
+ _super.prototype.next.call(this, this.data);
1784
+ };
1785
+ BaseGridEditService.prototype.save = function (data, isNew, sucess) {
1786
+ var _this = this;
1787
+ var action = isNew ? "add" : "update";
1788
+ this.reset();
1789
+ this.post(action, data).subscribe(function () { }, function () {
1790
+ _this.read();
1791
+ }, function () {
1792
+ _this.read();
1793
+ if (sucess)
1794
+ sucess();
1610
1795
  });
1611
1796
  };
1612
- return UpgradePlanButtonComponent;
1613
- }());
1614
- UpgradePlanButtonComponent.decorators = [
1615
- { type: i0.Component, args: [{
1616
- selector: "anatoly-upgrade-plan-button",
1617
- template: "<button class=\"btn btn-block btn-primary\" (click)=\"onUpgradePlan()\">\r\n Upgrade\r\n</button>\r\n"
1618
- },] }
1797
+ BaseGridEditService.prototype.remove = function (data, sucess) {
1798
+ var _this = this;
1799
+ this.reset();
1800
+ this.post("remove", data).subscribe(function () { }, function () {
1801
+ _this.read();
1802
+ }, function () {
1803
+ _this.read();
1804
+ if (sucess)
1805
+ sucess();
1806
+ });
1807
+ };
1808
+ BaseGridEditService.prototype.post = function (action, data) {
1809
+ var url = this.baseUrl + ("" + action + this.serializeParams(data));
1810
+ return this.http.post(url, data).pipe(operators.map(function (res) { return res; }));
1811
+ };
1812
+ return BaseGridEditService;
1813
+ }(BaseGridReadService));
1814
+ BaseGridEditService.decorators = [
1815
+ { type: i0.Injectable }
1619
1816
  ];
1620
- UpgradePlanButtonComponent.ctorParameters = function () { return [
1621
- { type: BillingApiService }
1622
- ]; };
1623
- UpgradePlanButtonComponent.propDecorators = {
1624
- currentplantitle: [{ type: i0.Input }],
1625
- requestedplan: [{ type: i0.Input }],
1626
- requestedplantitle: [{ type: i0.Input }]
1627
- };
1817
+ BaseGridEditService.ctorParameters = function () { return [
1818
+ { type: i1.HttpClient }
1819
+ ]; };
1628
1820
 
1629
1821
  /*
1630
1822
  <file>
@@ -1636,7 +1828,7 @@
1636
1828
  Anatoly Osovitny
1637
1829
 
1638
1830
  Created:
1639
- 4 Jul 2018
1831
+ 30 April 2020
1640
1832
 
1641
1833
  Version:
1642
1834
  1.0
@@ -1644,20 +1836,185 @@
1644
1836
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1645
1837
  </file>
1646
1838
  */
1647
- var SignInButtonComponent = /** @class */ (function () {
1648
- function SignInButtonComponent() {
1839
+ var consts = {
1840
+ billingApiPath: 'api/billing',
1841
+ // Notifications API
1842
+ notificationsApiPath: 'api/notifications',
1843
+ };
1844
+
1845
+ var NotificationsApiService = /** @class */ (function (_super) {
1846
+ __extends(NotificationsApiService, _super);
1847
+ function NotificationsApiService(http) {
1848
+ var _this = _super.call(this, http) || this;
1849
+ _this.http = http;
1850
+ _this.baseUrl = consts.notificationsApiPath;
1851
+ return _this;
1649
1852
  }
1650
- return SignInButtonComponent;
1651
- }());
1652
- SignInButtonComponent.decorators = [
1853
+ NotificationsApiService.prototype.retrieveNotifications = function () {
1854
+ return this.get('retrieveNotifications');
1855
+ };
1856
+ return NotificationsApiService;
1857
+ }(BaseApiService));
1858
+ NotificationsApiService.ɵprov = i0.ɵɵdefineInjectable({ factory: function NotificationsApiService_Factory() { return new NotificationsApiService(i0.ɵɵinject(i1.HttpClient)); }, token: NotificationsApiService, providedIn: "root" });
1859
+ NotificationsApiService.decorators = [
1860
+ { type: i0.Injectable, args: [{
1861
+ providedIn: 'root'
1862
+ },] }
1863
+ ];
1864
+ NotificationsApiService.ctorParameters = function () { return [
1865
+ { type: i1.HttpClient }
1866
+ ]; };
1867
+
1868
+ var BillingApiService = /** @class */ (function (_super) {
1869
+ __extends(BillingApiService, _super);
1870
+ function BillingApiService(http) {
1871
+ var _this = _super.call(this, http) || this;
1872
+ _this.http = http;
1873
+ _this.baseUrl = consts.billingApiPath;
1874
+ return _this;
1875
+ }
1876
+ BillingApiService.prototype.requestNewSubscription = function (requestedPlan, success, error) {
1877
+ this.postQS("requestNewSubscription", { requestedPlan: requestedPlan }).subscribe(function (data) { }, function (e) {
1878
+ if (error)
1879
+ error();
1880
+ }, function () {
1881
+ if (success)
1882
+ success();
1883
+ });
1884
+ };
1885
+ BillingApiService.prototype.cancelRequestedSubscription = function (success, error) {
1886
+ this.postQS("cancelRequestedSubscription", null).subscribe(function (data) { }, function (e) {
1887
+ if (error)
1888
+ error();
1889
+ }, function () {
1890
+ if (success)
1891
+ success();
1892
+ });
1893
+ };
1894
+ BillingApiService.prototype.buyAccess = function (requestedPlan, success, error) {
1895
+ this.postQS("buyAccess", { requestedPlan: requestedPlan }).subscribe(function (data) { }, function (e) {
1896
+ if (error)
1897
+ error();
1898
+ }, function () {
1899
+ if (success)
1900
+ success();
1901
+ });
1902
+ };
1903
+ return BillingApiService;
1904
+ }(BaseApiService));
1905
+ BillingApiService.decorators = [
1906
+ { type: i0.Injectable }
1907
+ ];
1908
+ BillingApiService.ctorParameters = function () { return [
1909
+ { type: i1.HttpClient }
1910
+ ]; };
1911
+
1912
+ /*
1913
+ <file>
1914
+ Project:
1915
+ @osovitny/anatoly
1916
+
1917
+ Authors:
1918
+ Vadim Osovitny
1919
+ Anatoly Osovitny
1920
+
1921
+ Created:
1922
+ 4 Mar 2020
1923
+
1924
+ Version:
1925
+ 1.0
1926
+
1927
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1928
+ </file>
1929
+ */
1930
+ var AnatolyDataModule = /** @class */ (function () {
1931
+ function AnatolyDataModule(parentModule) {
1932
+ throwIfAlreadyLoaded(parentModule, 'AnatolyDataModule');
1933
+ }
1934
+ return AnatolyDataModule;
1935
+ }());
1936
+ AnatolyDataModule.decorators = [
1937
+ { type: i0.NgModule, args: [{
1938
+ imports: [
1939
+ common.CommonModule
1940
+ ],
1941
+ providers: [
1942
+ BillingApiService
1943
+ ],
1944
+ },] }
1945
+ ];
1946
+ AnatolyDataModule.ctorParameters = function () { return [
1947
+ { type: AnatolyDataModule, decorators: [{ type: i0.Optional }, { type: i0.SkipSelf }] }
1948
+ ]; };
1949
+
1950
+ /*
1951
+ <file>
1952
+ Project:
1953
+ @osovitny/anatoly
1954
+
1955
+ Authors:
1956
+ Vadim Osovitny
1957
+ Anatoly Osovitny
1958
+
1959
+ Created:
1960
+ 14 Aug 2018
1961
+
1962
+ Version:
1963
+ 1.0
1964
+
1965
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1966
+ </file>
1967
+ */
1968
+ var BuyAccessButtonComponent = /** @class */ (function () {
1969
+ function BuyAccessButtonComponent(appcontext, api) {
1970
+ this.appcontext = appcontext;
1971
+ this.api = api;
1972
+ this.contextUpdated = false;
1973
+ this.isUserSignedIn = false;
1974
+ this.currentPlan = 0;
1975
+ this.currentPlanTitle = '';
1976
+ }
1977
+ BuyAccessButtonComponent.prototype.ngOnInit = function () {
1978
+ var _this = this;
1979
+ if (!this.appcontext.isUserSignedIn()) {
1980
+ this.contextUpdated = true;
1981
+ return;
1982
+ }
1983
+ this.appcontext.getCurrent(function (current) {
1984
+ _this.isUserSignedIn = current.isUserSignedIn;
1985
+ if (_this.isUserSignedIn) {
1986
+ _this.currentPlan = current.account.billingPlan;
1987
+ _this.currentPlanTitle = current.account.billingPlanAsString;
1988
+ }
1989
+ _this.contextUpdated = true;
1990
+ });
1991
+ };
1992
+ BuyAccessButtonComponent.prototype.onBuyPlan = function () {
1993
+ var text = "Requested plan: " + this.plantitle + " ";
1994
+ var that = this;
1995
+ Alerts.areYouSure(text, 'Buying access', 'Confirm change', 'Cancel', function () {
1996
+ that.api.buyAccess(that.plan, function () {
1997
+ Alerts.success('Access Granted', null, null, function () {
1998
+ window.location.reload();
1999
+ });
2000
+ });
2001
+ });
2002
+ };
2003
+ return BuyAccessButtonComponent;
2004
+ }());
2005
+ BuyAccessButtonComponent.decorators = [
1653
2006
  { type: i0.Component, args: [{
1654
- selector: "anatoly-signin-button",
1655
- template: "<a href=\"identity/signIn\" class=\"{{classbtn}}\">Sign In</a>\r\n"
2007
+ selector: 'anatoly-buyaccess-button',
2008
+ template: "<div *ngIf=\"contextUpdated\">\r\n <div *ngIf=\"!isUserSignedIn\">\r\n <anatoly-signup-button classbtn=\"btn btn-block btn-primary\"></anatoly-signup-button>\r\n </div>\r\n\r\n <div *ngIf=\"isUserSignedIn\">\r\n <button class=\"btn btn-block btn-success selectPlan\" *ngIf=\"plan == currentPlan\">\r\n Your Plan\r\n </button>\r\n\r\n <button class=\"btn btn-block btn-warning selectPlan\" *ngIf=\"plan != currentPlan && currentPlan == 1\" (click)=\"onBuyPlan()\">\r\n Buy Now\r\n </button>\r\n </div>\r\n</div>\r\n"
1656
2009
  },] }
1657
2010
  ];
1658
- SignInButtonComponent.ctorParameters = function () { return []; };
1659
- SignInButtonComponent.propDecorators = {
1660
- classbtn: [{ type: i0.Input }]
2011
+ BuyAccessButtonComponent.ctorParameters = function () { return [
2012
+ { type: AppContextService },
2013
+ { type: BillingApiService }
2014
+ ]; };
2015
+ BuyAccessButtonComponent.propDecorators = {
2016
+ plan: [{ type: i0.Input }],
2017
+ plantitle: [{ type: i0.Input }]
1661
2018
  };
1662
2019
 
1663
2020
  /*
@@ -1670,7 +2027,7 @@
1670
2027
  Anatoly Osovitny
1671
2028
 
1672
2029
  Created:
1673
- 4 Jul 2018
2030
+ 1 Jun 2018
1674
2031
 
1675
2032
  Version:
1676
2033
  1.0
@@ -1678,21 +2035,456 @@
1678
2035
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1679
2036
  </file>
1680
2037
  */
1681
- var SignOutButtonComponent = /** @class */ (function () {
1682
- function SignOutButtonComponent() {
2038
+ var SubscribePlanButtonComponent = /** @class */ (function () {
2039
+ function SubscribePlanButtonComponent(appcontext) {
2040
+ this.appcontext = appcontext;
2041
+ this.contextUpdated = false;
2042
+ this.isUserSignedIn = false;
2043
+ this.currentPlan = 0;
2044
+ this.currentPlanTitle = "";
2045
+ this.requestedPlan = 0;
2046
+ this.requestedPlanTitle = "";
1683
2047
  }
1684
- return SignOutButtonComponent;
2048
+ SubscribePlanButtonComponent.prototype.ngOnInit = function () {
2049
+ var _this = this;
2050
+ if (!this.appcontext.isUserSignedIn()) {
2051
+ this.contextUpdated = true;
2052
+ return;
2053
+ }
2054
+ this.appcontext.getCurrent(function (current) {
2055
+ _this.isUserSignedIn = current.isUserSignedIn;
2056
+ if (_this.isUserSignedIn) {
2057
+ _this.currentPlan = current.account.billingPlan;
2058
+ _this.currentPlanTitle = current.account.billingPlanAsString;
2059
+ _this.requestedPlan = current.account.requestedBillingPlan;
2060
+ _this.requestedPlanTitle = current.account.requestedBillingPlanAsString;
2061
+ }
2062
+ _this.contextUpdated = true;
2063
+ });
2064
+ };
2065
+ return SubscribePlanButtonComponent;
1685
2066
  }());
1686
- SignOutButtonComponent.decorators = [
2067
+ SubscribePlanButtonComponent.decorators = [
1687
2068
  { type: i0.Component, args: [{
1688
- selector: "anatoly-signout-button",
1689
- template: "<a href=\"identity/signOut\" class=\"{{classbtn}}\">Sign Out</a>\r\n"
2069
+ selector: "anatoly-subscribe-plan-button",
2070
+ template: "<div *ngIf=\"contextUpdated\">\r\n <div *ngIf=\"!isUserSignedIn\">\r\n <anatoly-signup-button classbtn=\"btn btn-block btn-primary\"></anatoly-signup-button>\r\n </div>\r\n\r\n <div *ngIf=\"isUserSignedIn\">\r\n <button class=\"btn btn-block btn-success selectPlan\" *ngIf=\"plan == currentPlan\">\r\n Your Plan\r\n </button>\r\n\r\n <button class=\"btn btn-block btn-warning selectPlan\" *ngIf=\"requestedPlan != null && requestedPlan != 0 && plan == requestedPlan\">\r\n Requested\r\n </button>\r\n\r\n <anatoly-upgrade-plan-button *ngIf=\"plan != currentPlan && plan != requestedPlan\"\r\n [currentplantitle]=\"currentPlanTitle\"\r\n [requestedplan]=plan\r\n [requestedplantitle]=\"plantitle\">\r\n </anatoly-upgrade-plan-button>\r\n </div>\r\n</div>\r\n"
2071
+ },] }
2072
+ ];
2073
+ SubscribePlanButtonComponent.ctorParameters = function () { return [
2074
+ { type: AppContextService }
2075
+ ]; };
2076
+ SubscribePlanButtonComponent.propDecorators = {
2077
+ plan: [{ type: i0.Input }],
2078
+ plantitle: [{ type: i0.Input }]
2079
+ };
2080
+
2081
+ /*
2082
+ <file>
2083
+ Project:
2084
+ @osovitny/anatoly
2085
+
2086
+ Authors:
2087
+ Vadim Osovitny
2088
+ Anatoly Osovitny
2089
+
2090
+ Created:
2091
+ 12 Nov 2017
2092
+
2093
+ Version:
2094
+ 1.0
2095
+
2096
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2097
+ </file>
2098
+ */
2099
+ // Services
2100
+ var UpgradePlanButtonComponent = /** @class */ (function () {
2101
+ function UpgradePlanButtonComponent(api) {
2102
+ this.api = api;
2103
+ }
2104
+ UpgradePlanButtonComponent.prototype.onUpgradePlan = function () {
2105
+ var text = "Current plan: " + this.currentplantitle + " New plan: " + this.requestedplantitle;
2106
+ var that = this;
2107
+ Alerts.areYouSure(text, 'Change billing plan', 'Confirm change', 'Cancel', function () {
2108
+ that.api.requestNewSubscription(that.requestedplan, function () {
2109
+ Alerts.success('Your request for changing plan has been sent.', null, null, function () {
2110
+ window.location.reload();
2111
+ });
2112
+ });
2113
+ });
2114
+ };
2115
+ return UpgradePlanButtonComponent;
2116
+ }());
2117
+ UpgradePlanButtonComponent.decorators = [
2118
+ { type: i0.Component, args: [{
2119
+ selector: 'anatoly-upgrade-plan-button',
2120
+ template: "<button class=\"btn btn-block btn-primary\" (click)=\"onUpgradePlan()\">\r\n Upgrade\r\n</button>\r\n"
2121
+ },] }
2122
+ ];
2123
+ UpgradePlanButtonComponent.ctorParameters = function () { return [
2124
+ { type: BillingApiService }
2125
+ ]; };
2126
+ UpgradePlanButtonComponent.propDecorators = {
2127
+ currentplantitle: [{ type: i0.Input }],
2128
+ requestedplan: [{ type: i0.Input }],
2129
+ requestedplantitle: [{ type: i0.Input }]
2130
+ };
2131
+
2132
+ /*
2133
+ <file>
2134
+ Project:
2135
+ @osovitny/anatoly
2136
+
2137
+ Authors:
2138
+ Vadim Osovitny
2139
+ Anatoly Osovitny
2140
+
2141
+ Created:
2142
+ 23 Apr 2018
2143
+
2144
+ Version:
2145
+ 1.0
2146
+
2147
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2148
+ </file>
2149
+ */
2150
+ var ContentHeaderComponent = /** @class */ (function () {
2151
+ function ContentHeaderComponent() {
2152
+ }
2153
+ ContentHeaderComponent.prototype.ngOnInit = function () {
2154
+ if (this.title == null) {
2155
+ this.title = "";
2156
+ }
2157
+ };
2158
+ return ContentHeaderComponent;
2159
+ }());
2160
+ ContentHeaderComponent.decorators = [
2161
+ { type: i0.Component, args: [{
2162
+ selector: "anatoly-content-header",
2163
+ template: "<h2 class=\"page-header\">\r\n {{title}}\r\n <!--<small>Optional {{title}}</small>-->\r\n</h2>\r\n"
2164
+ },] }
2165
+ ];
2166
+ ContentHeaderComponent.propDecorators = {
2167
+ title: [{ type: i0.Input }]
2168
+ };
2169
+
2170
+ /*
2171
+ <file>
2172
+ Project:
2173
+ @osovitny/anatoly
2174
+
2175
+ Authors:
2176
+ Vadim Osovitny
2177
+ Anatoly Osovitny
2178
+
2179
+ Created:
2180
+ 12 Dec 2017
2181
+
2182
+ Version:
2183
+ 1.0
2184
+
2185
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2186
+ </file>
2187
+ */
2188
+ var DefaultEditorOptions = {
2189
+ placeholderText: "Edit Your Content Here",
2190
+ charCounterCount: true,
2191
+ heightMin: 100,
2192
+ toolbarInline: false,
2193
+ toolbarButtons: {
2194
+ moreText: {
2195
+ buttons: [
2196
+ "bold",
2197
+ "italic",
2198
+ "underline",
2199
+ "strikeThrough",
2200
+ "subscript",
2201
+ "superscript",
2202
+ "fontFamily",
2203
+ "fontSize",
2204
+ "textColor",
2205
+ "backgroundColor",
2206
+ "inlineClass",
2207
+ "inlineStyle",
2208
+ ],
2209
+ },
2210
+ moreParagraph: {
2211
+ buttons: [
2212
+ "alignLeft",
2213
+ "alignCenter",
2214
+ "formatOLSimple",
2215
+ "alignRight",
2216
+ "alignJustify",
2217
+ "formatOL",
2218
+ "formatUL",
2219
+ "paragraphFormat",
2220
+ "paragraphStyle",
2221
+ "lineHeight",
2222
+ "outdent",
2223
+ "indent",
2224
+ "quote",
2225
+ ],
2226
+ },
2227
+ moreRich: {
2228
+ buttons: [
2229
+ "insertLink",
2230
+ "insertImage",
2231
+ "insertTable",
2232
+ "emoticons",
2233
+ "fontAwesome",
2234
+ "specialCharacters",
2235
+ "embedly",
2236
+ ],
2237
+ },
2238
+ moreMisc: {
2239
+ buttons: [
2240
+ "selectAll",
2241
+ "clearFormatting",
2242
+ "html",
2243
+ "undo",
2244
+ "redo",
2245
+ "fullscreen",
2246
+ ],
2247
+ align: "right",
2248
+ },
2249
+ },
2250
+ /*
2251
+ Upload:
2252
+ https://www.froala.com/wysiwyg-editor/docs/concepts/image/upload
2253
+ */
2254
+ imageUploadURL: "/api/HtmlEditor/UploadImage",
2255
+ imageAllowedTypes: ["jpeg", "jpg", "png"],
2256
+ imageUploadParams: { uploadType: "", uploadParentId: "" },
2257
+ };
2258
+
2259
+ /*
2260
+ <file>
2261
+ Project:
2262
+ @osovitny/anatoly
2263
+
2264
+ Authors:
2265
+ Vadim Osovitny
2266
+ Anatoly Osovitny
2267
+
2268
+ Created:
2269
+ 28 Aug 2018
2270
+
2271
+ Version:
2272
+ 1.0
2273
+
2274
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2275
+ </file>
2276
+ */
2277
+ var BaseComponent = /** @class */ (function () {
2278
+ function BaseComponent() {
2279
+ }
2280
+ BaseComponent.prototype.getQSId = function () {
2281
+ var id = Utils.getValueByNameInQS("id");
2282
+ if (typeof id === 'undefined' || id == '')
2283
+ return null;
2284
+ return id;
2285
+ };
2286
+ return BaseComponent;
2287
+ }());
2288
+
2289
+ var BaseEditComponent = /** @class */ (function (_super) {
2290
+ __extends(BaseEditComponent, _super);
2291
+ function BaseEditComponent() {
2292
+ var _this = _super.call(this) || this;
2293
+ _this.formSubmitted = false;
2294
+ return _this;
2295
+ }
2296
+ BaseEditComponent.prototype.isActionAdding = function () {
2297
+ var id = Utils.getValueByNameInQS("id");
2298
+ if (typeof id === 'undefined' || id == '')
2299
+ return true;
2300
+ return false;
2301
+ };
2302
+ BaseEditComponent.prototype.getEntityId = function () {
2303
+ return this.getQSId();
2304
+ };
2305
+ BaseEditComponent.prototype.isControlValid = function (name, formGroup) {
2306
+ if (formGroup === void 0) { formGroup = null; }
2307
+ return !this.isControlInvalid(name, formGroup);
2308
+ };
2309
+ BaseEditComponent.prototype.isControlInvalid = function (name, formGroup) {
2310
+ if (formGroup === void 0) { formGroup = null; }
2311
+ if (typeof name === 'undefined' || name == '') {
2312
+ return false;
2313
+ }
2314
+ var fg = (formGroup) ? formGroup : this.formGroup;
2315
+ if (!fg) {
2316
+ return false;
2317
+ }
2318
+ if (fg.get(name)) {
2319
+ return (this.formSubmitted && fg.get(name).invalid) ||
2320
+ (fg.get(name).touched && fg.get(name).invalid);
2321
+ }
2322
+ return false;
2323
+ };
2324
+ //FormGroup functions
2325
+ BaseEditComponent.prototype.getFormValue = function (name, formGroup) {
2326
+ if (formGroup === void 0) { formGroup = null; }
2327
+ var fg = (formGroup) ? formGroup : this.formGroup;
2328
+ return fg.controls[name].value;
2329
+ };
2330
+ BaseEditComponent.prototype.setFormValue = function (name, value, formGroup) {
2331
+ if (formGroup === void 0) { formGroup = null; }
2332
+ var fg = (formGroup) ? formGroup : this.formGroup;
2333
+ fg.controls[name].setValue(value);
2334
+ };
2335
+ BaseEditComponent.prototype.getFormGroupValue = function (groupName, name, formGroup) {
2336
+ if (formGroup === void 0) { formGroup = null; }
2337
+ var fg = (formGroup) ? formGroup : this.formGroup;
2338
+ return fg.controls[groupName].get(name).value;
2339
+ };
2340
+ BaseEditComponent.prototype.setFormGroupValue = function (groupName, name, value, formGroup) {
2341
+ if (formGroup === void 0) { formGroup = null; }
2342
+ var fg = (formGroup) ? formGroup : this.formGroup;
2343
+ fg.controls[groupName].get(name).setValue(value);
2344
+ };
2345
+ return BaseEditComponent;
2346
+ }(BaseComponent));
2347
+ BaseEditComponent.propDecorators = {
2348
+ formGroup: [{ type: i0.Input }],
2349
+ formSubmitted: [{ type: i0.Input }]
2350
+ };
2351
+
2352
+ var BaseHtmlEditorComponent = /** @class */ (function (_super) {
2353
+ __extends(BaseHtmlEditorComponent, _super);
2354
+ function BaseHtmlEditorComponent() {
2355
+ var _this = _super.call(this) || this;
2356
+ _this.froalaEditorInitialized = false;
2357
+ _this.afterInitializedActions = [];
2358
+ // Inputs
2359
+ _this.editorLabelText = 'Html';
2360
+ _this.editorOptions = {};
2361
+ return _this;
2362
+ }
2363
+ BaseHtmlEditorComponent.prototype.ngOnInit = function () {
2364
+ var opt = this.editorOptions;
2365
+ if (typeof this.editorOptions == 'string') {
2366
+ opt = JSON.parse(this.editorOptions);
2367
+ }
2368
+ var newOptions = $.extend({}, DefaultEditorOptions, opt);
2369
+ var key = AppCoreSettings.froalaEditorKey;
2370
+ if (key) {
2371
+ newOptions = $.extend({}, newOptions, JSON.parse('{ "key": "' + key + '" }'));
2372
+ }
2373
+ if (newOptions.events && newOptions.events.initialized) {
2374
+ newOptions.events.initialized.overridden = false;
2375
+ }
2376
+ this.options = newOptions;
2377
+ };
2378
+ BaseHtmlEditorComponent.prototype.ngAfterViewInit = function () {
2379
+ var that = this;
2380
+ setTimeout(function () {
2381
+ that.froalaEditorInitialized = true;
2382
+ that.onInitialized();
2383
+ }, 300);
2384
+ };
2385
+ BaseHtmlEditorComponent.prototype.onInitialized = function () {
2386
+ var actions = this.afterInitializedActions;
2387
+ // Clear actions
2388
+ this.afterInitializedActions = [];
2389
+ if (actions) {
2390
+ for (var i = 0; i < actions.length; i++) {
2391
+ actions[i]();
2392
+ }
2393
+ }
2394
+ };
2395
+ BaseHtmlEditorComponent.prototype.getEditor = function () {
2396
+ if (this.froalaEditor)
2397
+ return this.froalaEditor.getEditor();
2398
+ return null;
2399
+ };
2400
+ // Public Funcs
2401
+ BaseHtmlEditorComponent.prototype.doAfterInitialized = function (action) {
2402
+ var that = this;
2403
+ if (!this.froalaEditorInitialized) {
2404
+ this.afterInitializedActions.push(function () {
2405
+ action(that);
2406
+ });
2407
+ }
2408
+ else {
2409
+ action(that);
2410
+ }
2411
+ };
2412
+ BaseHtmlEditorComponent.prototype.initializeControl = function (control) {
2413
+ this.froalaEditor = control;
2414
+ this.froalaEditor.initialize();
2415
+ };
2416
+ BaseHtmlEditorComponent.prototype.setUploadParams = function (uploadType, uploadParentId) {
2417
+ this.doAfterInitialized(function (that) {
2418
+ var editor = that.getEditor();
2419
+ if (typeof editor == 'undefined' || editor == null) {
2420
+ return;
2421
+ }
2422
+ editor.opts.imageUploadParams.uploadType = uploadType;
2423
+ editor.opts.imageUploadParams.uploadParentId = uploadParentId;
2424
+ });
2425
+ };
2426
+ return BaseHtmlEditorComponent;
2427
+ }(BaseEditComponent));
2428
+ BaseHtmlEditorComponent.propDecorators = {
2429
+ editorLabelText: [{ type: i0.Input }],
2430
+ editorOptions: [{ type: i0.Input }]
2431
+ };
2432
+
2433
+ var FormsHtmlEditorComponent = /** @class */ (function (_super) {
2434
+ __extends(FormsHtmlEditorComponent, _super);
2435
+ function FormsHtmlEditorComponent() {
2436
+ var _this = _super.call(this) || this;
2437
+ _this.editorFormKey = "html";
2438
+ return _this;
2439
+ }
2440
+ FormsHtmlEditorComponent.prototype.setFormValueAfterInitialized = function (name, value) {
2441
+ this.doAfterInitialized(function (that) {
2442
+ that.setFormValue(name, value);
2443
+ });
2444
+ };
2445
+ return FormsHtmlEditorComponent;
2446
+ }(BaseHtmlEditorComponent));
2447
+ FormsHtmlEditorComponent.decorators = [
2448
+ { type: i0.Component, args: [{
2449
+ selector: "anatoly-forms-html-editor",
2450
+ template: "<div [formGroup]=\"formGroup\">\r\n <div class=\"form-group\" [ngClass]=\"{'has-error': isControlInvalid(editorFormKey) }\">\r\n <label class=\"control-label\">{{ editorLabelText }}</label>\r\n <textarea [formControlName]=\"editorFormKey\"\r\n [froalaEditor]=\"options\" (froalaInit)=\"initializeControl($event)\">\r\n </textarea>\r\n <anatoly-item-validation-summary [formGroup]=\"formGroup\"\r\n [formSubmitted]=\"formSubmitted\"\r\n [controlName]=\"editorFormKey\"\r\n [controlTitle]=\"editorLabelText\">\r\n </anatoly-item-validation-summary>\r\n </div>\r\n</div>\r\n"
2451
+ },] }
2452
+ ];
2453
+ FormsHtmlEditorComponent.ctorParameters = function () { return []; };
2454
+ FormsHtmlEditorComponent.propDecorators = {
2455
+ editorFormKey: [{ type: i0.Input }]
2456
+ };
2457
+
2458
+ var HtmlEditorComponent = /** @class */ (function (_super) {
2459
+ __extends(HtmlEditorComponent, _super);
2460
+ function HtmlEditorComponent() {
2461
+ return _super.call(this) || this;
2462
+ }
2463
+ HtmlEditorComponent.prototype.setHtml = function (content) {
2464
+ this.doAfterInitialized(function (that) {
2465
+ var editor = that.getEditor();
2466
+ if (typeof editor == "undefined" || editor == null) {
2467
+ return;
2468
+ }
2469
+ editor.html.set(content);
2470
+ });
2471
+ };
2472
+ HtmlEditorComponent.prototype.getHtml = function () {
2473
+ var editor = this.getEditor();
2474
+ if (typeof editor == "undefined" || editor == null) {
2475
+ return;
2476
+ }
2477
+ return editor.html.get(false);
2478
+ };
2479
+ return HtmlEditorComponent;
2480
+ }(BaseHtmlEditorComponent));
2481
+ HtmlEditorComponent.decorators = [
2482
+ { type: i0.Component, args: [{
2483
+ selector: "anatoly-html-editor",
2484
+ template: "<div>\r\n <label>{{ editorLabelText }}</label>\r\n <textarea [froalaEditor]=\"options\" (froalaInit)=\"initializeControl($event)\">\r\n </textarea>\r\n</div>"
1690
2485
  },] }
1691
2486
  ];
1692
- SignOutButtonComponent.ctorParameters = function () { return []; };
1693
- SignOutButtonComponent.propDecorators = {
1694
- classbtn: [{ type: i0.Input }]
1695
- };
2487
+ HtmlEditorComponent.ctorParameters = function () { return []; };
1696
2488
 
1697
2489
  /*
1698
2490
  <file>
@@ -1712,18 +2504,19 @@
1712
2504
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1713
2505
  </file>
1714
2506
  */
1715
- var SignUpButtonComponent = /** @class */ (function () {
1716
- function SignUpButtonComponent() {
2507
+ var SignInButtonComponent = /** @class */ (function () {
2508
+ function SignInButtonComponent() {
1717
2509
  }
1718
- return SignUpButtonComponent;
2510
+ return SignInButtonComponent;
1719
2511
  }());
1720
- SignUpButtonComponent.decorators = [
2512
+ SignInButtonComponent.decorators = [
1721
2513
  { type: i0.Component, args: [{
1722
- selector: "anatoly-signup-button",
1723
- template: "<a href=\"identity/signup\" class=\"{{classbtn}}\">Sign Up</a>\r\n"
2514
+ selector: "anatoly-signin-button",
2515
+ template: "<a href=\"identity/signIn\" class=\"{{classbtn}}\">Sign In</a>\r\n"
1724
2516
  },] }
1725
2517
  ];
1726
- SignUpButtonComponent.propDecorators = {
2518
+ SignInButtonComponent.ctorParameters = function () { return []; };
2519
+ SignInButtonComponent.propDecorators = {
1727
2520
  classbtn: [{ type: i0.Input }]
1728
2521
  };
1729
2522
 
@@ -1737,7 +2530,7 @@
1737
2530
  Anatoly Osovitny
1738
2531
 
1739
2532
  Created:
1740
- 23 Apr 2018
2533
+ 4 Jul 2018
1741
2534
 
1742
2535
  Version:
1743
2536
  1.0
@@ -1745,24 +2538,20 @@
1745
2538
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1746
2539
  </file>
1747
2540
  */
1748
- var ContentHeaderComponent = /** @class */ (function () {
1749
- function ContentHeaderComponent() {
2541
+ var SignOutButtonComponent = /** @class */ (function () {
2542
+ function SignOutButtonComponent() {
1750
2543
  }
1751
- ContentHeaderComponent.prototype.ngOnInit = function () {
1752
- if (this.title == null) {
1753
- this.title = "";
1754
- }
1755
- };
1756
- return ContentHeaderComponent;
2544
+ return SignOutButtonComponent;
1757
2545
  }());
1758
- ContentHeaderComponent.decorators = [
2546
+ SignOutButtonComponent.decorators = [
1759
2547
  { type: i0.Component, args: [{
1760
- selector: "anatoly-content-header",
1761
- template: "<h2 class=\"page-header\">\r\n {{title}}\r\n <!--<small>Optional {{title}}</small>-->\r\n</h2>\r\n"
2548
+ selector: "anatoly-signout-button",
2549
+ template: "<a href=\"identity/signOut\" class=\"{{classbtn}}\">Sign Out</a>\r\n"
1762
2550
  },] }
1763
2551
  ];
1764
- ContentHeaderComponent.propDecorators = {
1765
- title: [{ type: i0.Input }]
2552
+ SignOutButtonComponent.ctorParameters = function () { return []; };
2553
+ SignOutButtonComponent.propDecorators = {
2554
+ classbtn: [{ type: i0.Input }]
1766
2555
  };
1767
2556
 
1768
2557
  /*
@@ -1775,7 +2564,7 @@
1775
2564
  Anatoly Osovitny
1776
2565
 
1777
2566
  Created:
1778
- 28 Aug 2018
2567
+ 4 Jul 2018
1779
2568
 
1780
2569
  Version:
1781
2570
  1.0
@@ -1783,79 +2572,19 @@
1783
2572
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1784
2573
  </file>
1785
2574
  */
1786
- var BaseComponent = /** @class */ (function () {
1787
- function BaseComponent() {
1788
- }
1789
- BaseComponent.prototype.getQSId = function () {
1790
- var id = Utils.getValueByNameInQS("id");
1791
- if (typeof id === 'undefined' || id == '')
1792
- return null;
1793
- return id;
1794
- };
1795
- return BaseComponent;
1796
- }());
1797
-
1798
- var BaseEditComponent = /** @class */ (function (_super) {
1799
- __extends(BaseEditComponent, _super);
1800
- function BaseEditComponent() {
1801
- var _this = _super.call(this) || this;
1802
- _this.formSubmitted = false;
1803
- return _this;
2575
+ var SignUpButtonComponent = /** @class */ (function () {
2576
+ function SignUpButtonComponent() {
1804
2577
  }
1805
- BaseEditComponent.prototype.isActionAdding = function () {
1806
- var id = Utils.getValueByNameInQS("id");
1807
- if (typeof id === 'undefined' || id == '')
1808
- return true;
1809
- return false;
1810
- };
1811
- BaseEditComponent.prototype.getEntityId = function () {
1812
- return this.getQSId();
1813
- };
1814
- BaseEditComponent.prototype.isControlValid = function (name, formGroup) {
1815
- if (formGroup === void 0) { formGroup = null; }
1816
- return !this.isControlInvalid(name, formGroup);
1817
- };
1818
- BaseEditComponent.prototype.isControlInvalid = function (name, formGroup) {
1819
- if (formGroup === void 0) { formGroup = null; }
1820
- if (typeof name === 'undefined' || name == '') {
1821
- return false;
1822
- }
1823
- var fg = (formGroup) ? formGroup : this.formGroup;
1824
- if (!fg) {
1825
- return false;
1826
- }
1827
- if (fg.get(name)) {
1828
- return (this.formSubmitted && fg.get(name).invalid) ||
1829
- (fg.get(name).touched && fg.get(name).invalid);
1830
- }
1831
- return false;
1832
- };
1833
- //FormGroup functions
1834
- BaseEditComponent.prototype.getFormValue = function (name, formGroup) {
1835
- if (formGroup === void 0) { formGroup = null; }
1836
- var fg = (formGroup) ? formGroup : this.formGroup;
1837
- return fg.controls[name].value;
1838
- };
1839
- BaseEditComponent.prototype.setFormValue = function (name, value, formGroup) {
1840
- if (formGroup === void 0) { formGroup = null; }
1841
- var fg = (formGroup) ? formGroup : this.formGroup;
1842
- fg.controls[name].setValue(value);
1843
- };
1844
- BaseEditComponent.prototype.getFormGroupValue = function (groupName, name, formGroup) {
1845
- if (formGroup === void 0) { formGroup = null; }
1846
- var fg = (formGroup) ? formGroup : this.formGroup;
1847
- return fg.controls[groupName].get(name).value;
1848
- };
1849
- BaseEditComponent.prototype.setFormGroupValue = function (groupName, name, value, formGroup) {
1850
- if (formGroup === void 0) { formGroup = null; }
1851
- var fg = (formGroup) ? formGroup : this.formGroup;
1852
- fg.controls[groupName].get(name).setValue(value);
1853
- };
1854
- return BaseEditComponent;
1855
- }(BaseComponent));
1856
- BaseEditComponent.propDecorators = {
1857
- formGroup: [{ type: i0.Input }],
1858
- formSubmitted: [{ type: i0.Input }]
2578
+ return SignUpButtonComponent;
2579
+ }());
2580
+ SignUpButtonComponent.decorators = [
2581
+ { type: i0.Component, args: [{
2582
+ selector: "anatoly-signup-button",
2583
+ template: "<a href=\"identity/signup\" class=\"{{classbtn}}\">Sign Up</a>\r\n"
2584
+ },] }
2585
+ ];
2586
+ SignUpButtonComponent.propDecorators = {
2587
+ classbtn: [{ type: i0.Input }]
1859
2588
  };
1860
2589
 
1861
2590
  /*
@@ -1868,7 +2597,7 @@
1868
2597
  Anatoly Osovitny
1869
2598
 
1870
2599
  Created:
1871
- 12 Dec 2017
2600
+ 9 May 2020
1872
2601
 
1873
2602
  Version:
1874
2603
  1.0
@@ -1876,213 +2605,257 @@
1876
2605
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1877
2606
  </file>
1878
2607
  */
1879
- var DefaultEditorOptions = {
1880
- placeholderText: "Edit Your Content Here",
1881
- charCounterCount: true,
1882
- heightMin: 100,
1883
- toolbarInline: false,
1884
- toolbarButtons: {
1885
- moreText: {
1886
- buttons: [
1887
- "bold",
1888
- "italic",
1889
- "underline",
1890
- "strikeThrough",
1891
- "subscript",
1892
- "superscript",
1893
- "fontFamily",
1894
- "fontSize",
1895
- "textColor",
1896
- "backgroundColor",
1897
- "inlineClass",
1898
- "inlineStyle",
1899
- ],
1900
- },
1901
- moreParagraph: {
1902
- buttons: [
1903
- "alignLeft",
1904
- "alignCenter",
1905
- "formatOLSimple",
1906
- "alignRight",
1907
- "alignJustify",
1908
- "formatOL",
1909
- "formatUL",
1910
- "paragraphFormat",
1911
- "paragraphStyle",
1912
- "lineHeight",
1913
- "outdent",
1914
- "indent",
1915
- "quote",
1916
- ],
1917
- },
1918
- moreRich: {
1919
- buttons: [
1920
- "insertLink",
1921
- "insertImage",
1922
- "insertTable",
1923
- "emoticons",
1924
- "fontAwesome",
1925
- "specialCharacters",
1926
- "embedly",
1927
- ],
1928
- },
1929
- moreMisc: {
1930
- buttons: [
1931
- "selectAll",
1932
- "clearFormatting",
1933
- "html",
1934
- "undo",
1935
- "redo",
1936
- "fullscreen",
1937
- ],
1938
- align: "right",
1939
- },
1940
- },
1941
- /*
1942
- Upload:
1943
- https://www.froala.com/wysiwyg-editor/docs/concepts/image/upload
1944
- */
1945
- imageUploadURL: "/api/HtmlEditor/UploadImage",
1946
- imageAllowedTypes: ["jpeg", "jpg", "png"],
1947
- imageUploadParams: { uploadType: "", uploadParentId: "" },
1948
- };
1949
-
1950
- var BaseHtmlEditorComponent = /** @class */ (function (_super) {
1951
- __extends(BaseHtmlEditorComponent, _super);
1952
- function BaseHtmlEditorComponent() {
1953
- var _this = _super.call(this) || this;
1954
- _this.froalaEditorInitialized = false;
1955
- _this.afterInitializedActions = [];
1956
- //Inputs
1957
- _this.editorLabelText = "Html";
1958
- _this.editorOptions = {};
1959
- return _this;
2608
+ var LoadingComponent = /** @class */ (function () {
2609
+ function LoadingComponent(loadingService) {
2610
+ this.loadingService = loadingService;
2611
+ // Private
2612
+ this.subs = new Subs();
2613
+ // Public
2614
+ this.show = false;
1960
2615
  }
1961
- BaseHtmlEditorComponent.prototype.ngOnInit = function () {
1962
- var opt = this.editorOptions;
1963
- if (typeof this.editorOptions == "string") {
1964
- opt = JSON.parse(this.editorOptions);
1965
- }
1966
- var newOptions = $.extend({}, DefaultEditorOptions, opt);
1967
- var key = AppCoreSettings.froalaEditorKey;
1968
- if (key) {
1969
- newOptions = $.extend({}, newOptions, JSON.parse('{ "key": "' + key + '" }'));
1970
- }
1971
- if (newOptions.events && newOptions.events.initialized) {
1972
- newOptions.events.initialized.overridden = false;
1973
- }
1974
- this.options = newOptions;
1975
- };
1976
- BaseHtmlEditorComponent.prototype.ngAfterViewInit = function () {
1977
- var that = this;
1978
- setTimeout(function () {
1979
- that.froalaEditorInitialized = true;
1980
- that.onInitialized();
1981
- }, 300);
1982
- };
1983
- BaseHtmlEditorComponent.prototype.onInitialized = function () {
1984
- var actions = this.afterInitializedActions;
1985
- //Clear actions
1986
- this.afterInitializedActions = [];
1987
- if (actions) {
1988
- for (var i = 0; i < actions.length; i++) {
1989
- actions[i]();
1990
- }
1991
- }
1992
- };
1993
- BaseHtmlEditorComponent.prototype.getEditor = function () {
1994
- if (this.froalaEditor)
1995
- return this.froalaEditor.getEditor();
1996
- return null;
1997
- };
1998
- //Public Funcs
1999
- BaseHtmlEditorComponent.prototype.doAfterInitialized = function (action) {
2000
- var that = this;
2001
- if (!this.froalaEditorInitialized) {
2002
- this.afterInitializedActions.push(function () {
2003
- action(that);
2004
- });
2005
- }
2006
- else {
2007
- action(that);
2008
- }
2616
+ LoadingComponent.prototype.ngOnInit = function () {
2617
+ var _this = this;
2618
+ this.subs.sink = this.loadingService.subscribe(function (state) {
2619
+ _this.show = state;
2620
+ });
2009
2621
  };
2010
- BaseHtmlEditorComponent.prototype.initializeControl = function (control) {
2011
- this.froalaEditor = control;
2012
- this.froalaEditor.initialize();
2622
+ LoadingComponent.prototype.ngOnDestroy = function () {
2623
+ this.subs.unsubscribe();
2013
2624
  };
2014
- BaseHtmlEditorComponent.prototype.setUploadParams = function (uploadType, uploadParentId) {
2015
- this.doAfterInitialized(function (that) {
2016
- var editor = that.getEditor();
2017
- if (typeof editor == "undefined" || editor == null) {
2018
- return;
2625
+ return LoadingComponent;
2626
+ }());
2627
+ LoadingComponent.decorators = [
2628
+ { type: i0.Component, args: [{
2629
+ selector: 'anatoly-loading',
2630
+ template: "<div *ngIf=\"show\">\r\n <span id=\"pnlLoading\" class=\"k-icon k-i-loading\"></span>\r\n</div>\r\n"
2631
+ },] }
2632
+ ];
2633
+ LoadingComponent.ctorParameters = function () { return [
2634
+ { type: LoadingService }
2635
+ ]; };
2636
+
2637
+ /*
2638
+ <file>
2639
+ Project:
2640
+ @osovitny/anatoly
2641
+
2642
+ Authors:
2643
+ Vadim Osovitny
2644
+ Anatoly Osovitny
2645
+
2646
+ Created:
2647
+ 16 May 2020
2648
+
2649
+ Version:
2650
+ 1.0
2651
+
2652
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2653
+ </file>
2654
+ */
2655
+ var SpinnerSpinKit = {
2656
+ spinnerLine: 'spinner-line-material',
2657
+ // ToDo
2658
+ ChasingDots: 'spinner-chasing-dots',
2659
+ CubeGrid: 'spinner-cube-grid',
2660
+ DoubleBounce: 'spinner-double-bounce',
2661
+ RotatingPlane: 'spinner-rotationg-plane',
2662
+ SpinnerPulse: 'spinner-spinner-pulse',
2663
+ ThreeBounce: 'spinner-three-bounce',
2664
+ WanderingCubes: 'spinner-wandering-cubes',
2665
+ Wave: 'spinner-wave'
2666
+ };
2667
+ var SpinnerComponent = /** @class */ (function () {
2668
+ function SpinnerComponent(router$1, document) {
2669
+ var _this = this;
2670
+ this.router = router$1;
2671
+ this.document = document;
2672
+ this.isSpinnerVisible = true;
2673
+ this.spinnerSpinKit = SpinnerSpinKit;
2674
+ this.backgroundColor = '#007CB0';
2675
+ this.spinner = SpinnerSpinKit.spinnerLine;
2676
+ this.router.events.subscribe(function (event) {
2677
+ if (event instanceof router.NavigationStart) {
2678
+ _this.isSpinnerVisible = true;
2019
2679
  }
2020
- editor.opts.imageUploadParams.uploadType = uploadType;
2021
- editor.opts.imageUploadParams.uploadParentId = uploadParentId;
2680
+ else if (event instanceof router.NavigationEnd || event instanceof router.NavigationCancel || event instanceof router.NavigationError) {
2681
+ _this.isSpinnerVisible = false;
2682
+ }
2683
+ }, function () {
2684
+ _this.isSpinnerVisible = false;
2022
2685
  });
2686
+ }
2687
+ SpinnerComponent.prototype.ngOnDestroy = function () {
2688
+ this.isSpinnerVisible = false;
2023
2689
  };
2024
- return BaseHtmlEditorComponent;
2025
- }(BaseEditComponent));
2026
- BaseHtmlEditorComponent.propDecorators = {
2027
- editorLabelText: [{ type: i0.Input }],
2028
- editorOptions: [{ type: i0.Input }]
2690
+ return SpinnerComponent;
2691
+ }());
2692
+ SpinnerComponent.decorators = [
2693
+ { type: i0.Component, args: [{
2694
+ selector: 'spinner',
2695
+ template: "<div id=\"spinner-loader\" *ngIf=\"isSpinnerVisible\">\r\n <div class=\"loader-bg\">\r\n <div class=\"spinner-line-material\" [class.colored]=\"!backgroundColor\" *ngIf=\"spinner === spinnerSpinKit.spinnerLine\">\r\n <div class=\"spinner-child spinner-bounce1\" [style.background-color]='backgroundColor'></div>\r\n </div>\r\n </div>\r\n</div>\r\n",
2696
+ encapsulation: i0.ViewEncapsulation.None
2697
+ },] }
2698
+ ];
2699
+ SpinnerComponent.ctorParameters = function () { return [
2700
+ { type: router.Router },
2701
+ { type: Document, decorators: [{ type: i0.Inject, args: [common.DOCUMENT,] }] }
2702
+ ]; };
2703
+ SpinnerComponent.propDecorators = {
2704
+ backgroundColor: [{ type: i0.Input }],
2705
+ spinner: [{ type: i0.Input }]
2029
2706
  };
2030
2707
 
2031
- var HtmlEditorComponent = /** @class */ (function (_super) {
2032
- __extends(HtmlEditorComponent, _super);
2033
- function HtmlEditorComponent() {
2034
- return _super.call(this) || this;
2708
+ /*
2709
+ <file>
2710
+ Project:
2711
+ @osovitny/anatoly
2712
+
2713
+ Authors:
2714
+ Vadim Osovitny
2715
+ Anatoly Osovitny
2716
+
2717
+ Created:
2718
+ 28 Jun 2020
2719
+
2720
+ Version:
2721
+ 1.0
2722
+
2723
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2724
+ </file>
2725
+ */
2726
+ var NativeElementDirective = /** @class */ (function () {
2727
+ function NativeElementDirective(el, control) {
2728
+ this.el = el;
2729
+ this.control = control;
2035
2730
  }
2036
- HtmlEditorComponent.prototype.setHtml = function (content) {
2037
- this.doAfterInitialized(function (that) {
2038
- var editor = that.getEditor();
2039
- if (typeof editor == "undefined" || editor == null) {
2040
- return;
2041
- }
2042
- editor.html.set(content);
2043
- });
2044
- };
2045
- HtmlEditorComponent.prototype.getHtml = function () {
2046
- var editor = this.getEditor();
2047
- if (typeof editor == "undefined" || editor == null) {
2048
- return;
2049
- }
2050
- return editor.html.get(false);
2731
+ NativeElementDirective.prototype.ngOnInit = function () {
2732
+ // sets the localization key to the control
2733
+ this.control.control.nativeElement = this.el.nativeElement;
2051
2734
  };
2052
- return HtmlEditorComponent;
2053
- }(BaseHtmlEditorComponent));
2054
- HtmlEditorComponent.decorators = [
2055
- { type: i0.Component, args: [{
2056
- selector: "anatoly-html-editor",
2057
- template: "<div>\r\n <label>{{ editorLabelText }}</label>\r\n <textarea [froalaEditor]=\"options\" (froalaInit)=\"initializeControl($event)\">\r\n </textarea>\r\n</div>"
2735
+ return NativeElementDirective;
2736
+ }());
2737
+ NativeElementDirective.decorators = [
2738
+ { type: i0.Directive, args: [{
2739
+ selector: '[formControl], [formControlName]'
2058
2740
  },] }
2059
2741
  ];
2060
- HtmlEditorComponent.ctorParameters = function () { return []; };
2742
+ NativeElementDirective.ctorParameters = function () { return [
2743
+ { type: i0.ElementRef },
2744
+ { type: forms.NgControl }
2745
+ ]; };
2061
2746
 
2062
- var FormsHtmlEditorComponent = /** @class */ (function (_super) {
2063
- __extends(FormsHtmlEditorComponent, _super);
2064
- function FormsHtmlEditorComponent() {
2065
- var _this = _super.call(this) || this;
2066
- _this.editorFormKey = "html";
2067
- return _this;
2747
+ /*
2748
+ <file>
2749
+ Project:
2750
+ @osovitny/anatoly
2751
+
2752
+ Authors:
2753
+ Vadim Osovitny
2754
+ Anatoly Osovitny
2755
+
2756
+ Created:
2757
+ 26 Jun 2020
2758
+
2759
+ Version:
2760
+ 1.0
2761
+
2762
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2763
+ </file>
2764
+ */
2765
+ var ReplaceTextPipe = /** @class */ (function () {
2766
+ function ReplaceTextPipe() {
2068
2767
  }
2069
- FormsHtmlEditorComponent.prototype.setFormValueAfterInitialized = function (name, value) {
2070
- this.doAfterInitialized(function (that) {
2071
- that.setFormValue(name, value);
2072
- });
2768
+ ReplaceTextPipe.prototype.transform = function (inputData, search, replacement) {
2769
+ if (inputData) {
2770
+ return inputData.replace(new RegExp(search, "g"), replacement);
2771
+ }
2772
+ else {
2773
+ return inputData;
2774
+ }
2073
2775
  };
2074
- return FormsHtmlEditorComponent;
2075
- }(BaseHtmlEditorComponent));
2076
- FormsHtmlEditorComponent.decorators = [
2077
- { type: i0.Component, args: [{
2078
- selector: "anatoly-forms-html-editor",
2079
- template: "<div [formGroup]=\"formGroup\">\r\n <div class=\"form-group\" [ngClass]=\"{'has-error': isControlInvalid(editorFormKey) }\">\r\n <label class=\"control-label\">{{ editorLabelText }}</label>\r\n <textarea [formControlName]=\"editorFormKey\"\r\n [froalaEditor]=\"options\" (froalaInit)=\"initializeControl($event)\">\r\n </textarea>\r\n <anatoly-item-validation-summary [formGroup]=\"formGroup\"\r\n [formSubmitted]=\"formSubmitted\"\r\n [controlName]=\"editorFormKey\"\r\n [controlTitle]=\"editorLabelText\">\r\n </anatoly-item-validation-summary>\r\n </div>\r\n</div>\r\n"
2776
+ return ReplaceTextPipe;
2777
+ }());
2778
+ ReplaceTextPipe.decorators = [
2779
+ { type: i0.Pipe, args: [{
2780
+ name: "replaceText",
2781
+ },] }
2782
+ ];
2783
+
2784
+ /*
2785
+ <file>
2786
+ Project:
2787
+ @osovitny/anatoly
2788
+
2789
+ Authors:
2790
+ Vadim Osovitny
2791
+ Anatoly Osovitny
2792
+
2793
+ Created:
2794
+ 26 Jun 2020
2795
+
2796
+ Version:
2797
+ 1.0
2798
+
2799
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2800
+ </file>
2801
+ */
2802
+ var FileSizePipe = /** @class */ (function () {
2803
+ function FileSizePipe() {
2804
+ this.units = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB'];
2805
+ }
2806
+ FileSizePipe.prototype.transform = function (bytes, precision) {
2807
+ if (bytes === void 0) { bytes = 0; }
2808
+ if (precision === void 0) { precision = 0; }
2809
+ if (isNaN(parseFloat(String(bytes))) || !isFinite(bytes))
2810
+ return '';
2811
+ var unit = 0;
2812
+ while (bytes >= 1024) {
2813
+ bytes /= 1024;
2814
+ unit++;
2815
+ }
2816
+ return bytes.toFixed(+precision) + ' ' + this.units[unit];
2817
+ };
2818
+ return FileSizePipe;
2819
+ }());
2820
+ FileSizePipe.decorators = [
2821
+ { type: i0.Pipe, args: [{
2822
+ name: 'filesize',
2080
2823
  },] }
2824
+ ];
2825
+
2826
+ /*
2827
+ <file>
2828
+ Project:
2829
+ @osovitny/anatoly
2830
+
2831
+ Authors:
2832
+ Vadim Osovitny
2833
+ Anatoly Osovitny
2834
+
2835
+ Created:
2836
+ 27 Oct 2019
2837
+
2838
+ Version:
2839
+ 1.0
2840
+
2841
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2842
+ </file>
2843
+ */
2844
+ var SafeHtmlPipe = /** @class */ (function () {
2845
+ function SafeHtmlPipe(sanitized) {
2846
+ this.sanitized = sanitized;
2847
+ }
2848
+ SafeHtmlPipe.prototype.transform = function (value) {
2849
+ return this.sanitized.bypassSecurityTrustHtml(value);
2850
+ };
2851
+ return SafeHtmlPipe;
2852
+ }());
2853
+ SafeHtmlPipe.decorators = [
2854
+ { type: i0.Pipe, args: [{ name: 'safeHtml' },] }
2081
2855
  ];
2082
- FormsHtmlEditorComponent.ctorParameters = function () { return []; };
2083
- FormsHtmlEditorComponent.propDecorators = {
2084
- editorFormKey: [{ type: i0.Input }]
2085
- };
2856
+ SafeHtmlPipe.ctorParameters = function () { return [
2857
+ { type: platformBrowser.DomSanitizer }
2858
+ ]; };
2086
2859
 
2087
2860
  var ValidationSummaryComponent = /** @class */ (function (_super) {
2088
2861
  __extends(ValidationSummaryComponent, _super);
@@ -2249,45 +3022,6 @@
2249
3022
  controlTitle: [{ type: i0.Input }]
2250
3023
  };
2251
3024
 
2252
- /*
2253
- <file>
2254
- Project:
2255
- @osovitny/anatoly
2256
-
2257
- Authors:
2258
- Vadim Osovitny
2259
- Anatoly Osovitny
2260
-
2261
- Created:
2262
- 28 Jun 2020
2263
-
2264
- Version:
2265
- 1.0
2266
-
2267
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2268
- </file>
2269
- */
2270
- var NativeElementDirective = /** @class */ (function () {
2271
- function NativeElementDirective(el, control) {
2272
- this.el = el;
2273
- this.control = control;
2274
- }
2275
- NativeElementDirective.prototype.ngOnInit = function () {
2276
- // sets the localization key to the control
2277
- this.control.control.nativeElement = this.el.nativeElement;
2278
- };
2279
- return NativeElementDirective;
2280
- }());
2281
- NativeElementDirective.decorators = [
2282
- { type: i0.Directive, args: [{
2283
- selector: '[formControl], [formControlName]'
2284
- },] }
2285
- ];
2286
- NativeElementDirective.ctorParameters = function () { return [
2287
- { type: i0.ElementRef },
2288
- { type: forms.NgControl }
2289
- ]; };
2290
-
2291
3025
  /*
2292
3026
  <file>
2293
3027
  Project:
@@ -2334,8 +3068,12 @@
2334
3068
  HtmlEditorComponent,
2335
3069
  FormsHtmlEditorComponent,
2336
3070
  ContentHeaderComponent,
2337
- // Directives
2338
- NativeElementDirective
3071
+ SpinnerComponent,
3072
+ LoadingComponent,
3073
+ NativeElementDirective,
3074
+ SafeHtmlPipe,
3075
+ ReplaceTextPipe,
3076
+ FileSizePipe
2339
3077
  ],
2340
3078
  declarations: [
2341
3079
  SubscribePlanButtonComponent,
@@ -2349,31 +3087,16 @@
2349
3087
  HtmlEditorComponent,
2350
3088
  FormsHtmlEditorComponent,
2351
3089
  ContentHeaderComponent,
2352
- // Directives
2353
- NativeElementDirective
3090
+ SpinnerComponent,
3091
+ LoadingComponent,
3092
+ NativeElementDirective,
3093
+ SafeHtmlPipe,
3094
+ ReplaceTextPipe,
3095
+ FileSizePipe
2354
3096
  ]
2355
3097
  },] }
2356
3098
  ];
2357
3099
 
2358
- /*
2359
- <file>
2360
- Project:
2361
- @osovitny/anatoly
2362
-
2363
- Authors:
2364
- Vadim Osovitny
2365
- Anatoly Osovitny
2366
-
2367
- Created:
2368
- 26 Jun 2020
2369
-
2370
- Version:
2371
- 1.0
2372
-
2373
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2374
- </file>
2375
- */
2376
-
2377
3100
  /*
2378
3101
  * Public API Surface of anatoly
2379
3102
  */
@@ -2395,27 +3118,51 @@
2395
3118
  exports.BaseGoService = BaseGoService;
2396
3119
  exports.BaseGridEditService = BaseGridEditService;
2397
3120
  exports.BaseGridReadService = BaseGridReadService;
3121
+ exports.BaseHtmlEditorComponent = BaseHtmlEditorComponent;
2398
3122
  exports.BillingApiService = BillingApiService;
2399
3123
  exports.BuyAccessButtonComponent = BuyAccessButtonComponent;
2400
3124
  exports.ContentHeaderComponent = ContentHeaderComponent;
2401
3125
  exports.ContextInitState = ContextInitState;
3126
+ exports.Convert = Convert;
3127
+ exports.DefaultEditorOptions = DefaultEditorOptions;
3128
+ exports.FileSizePipe = FileSizePipe;
2402
3129
  exports.FormValidationSummaryComponent = FormValidationSummaryComponent;
2403
3130
  exports.FormsHtmlEditorComponent = FormsHtmlEditorComponent;
3131
+ exports.FroalaEditorModuleWithProviders = FroalaEditorModuleWithProviders;
3132
+ exports.FroalaViewModuleWithProviders = FroalaViewModuleWithProviders;
2404
3133
  exports.GlobalErrorHandler = GlobalErrorHandler;
2405
3134
  exports.Guid = Guid;
2406
3135
  exports.HtmlEditorComponent = HtmlEditorComponent;
3136
+ exports.IdleService = IdleService;
2407
3137
  exports.ItemValidationSummaryComponent = ItemValidationSummaryComponent;
3138
+ exports.LoadingComponent = LoadingComponent;
2408
3139
  exports.LoadingService = LoadingService;
3140
+ exports.LocalStorageService = LocalStorageService;
3141
+ exports.LocalizationModule = LocalizationModule;
3142
+ exports.LocalizationService = LocalizationService;
3143
+ exports.LocalizationSettingsModule = LocalizationSettingsModule;
3144
+ exports.LocalizePipe = LocalizePipe;
2409
3145
  exports.LoggingService = LoggingService;
2410
3146
  exports.NativeElementDirective = NativeElementDirective;
3147
+ exports.NotificationService = NotificationService;
3148
+ exports.NotificationsApiService = NotificationsApiService;
3149
+ exports.ReplaceTextPipe = ReplaceTextPipe;
3150
+ exports.SafeHtmlPipe = SafeHtmlPipe;
3151
+ exports.SessionStorageService = SessionStorageService;
2411
3152
  exports.SignInButtonComponent = SignInButtonComponent;
2412
3153
  exports.SignOutButtonComponent = SignOutButtonComponent;
2413
3154
  exports.SignUpButtonComponent = SignUpButtonComponent;
3155
+ exports.SpinnerComponent = SpinnerComponent;
2414
3156
  exports.Subs = Subs;
2415
3157
  exports.SubscribePlanButtonComponent = SubscribePlanButtonComponent;
3158
+ exports.TranslateModuleAtRoot = TranslateModuleAtRoot;
2416
3159
  exports.UpgradePlanButtonComponent = UpgradePlanButtonComponent;
3160
+ exports.Urls = Urls;
2417
3161
  exports.Utils = Utils;
2418
3162
  exports.ValidationSummaryComponent = ValidationSummaryComponent;
3163
+ exports.consts = consts;
3164
+ exports.customTranslateLoaderFactory = customTranslateLoaderFactory;
3165
+ exports.localizationInitializerFactory = localizationInitializerFactory;
2419
3166
  exports.throwIfAlreadyLoaded = throwIfAlreadyLoaded;
2420
3167
 
2421
3168
  Object.defineProperty(exports, '__esModule', { value: true });