@osovitny/anatoly 2.0.25 → 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 (59) hide show
  1. package/bundles/osovitny-anatoly.umd.js +1803 -1638
  2. package/bundles/osovitny-anatoly.umd.js.map +1 -1
  3. package/bundles/osovitny-anatoly.umd.min.js +2 -2
  4. package/bundles/osovitny-anatoly.umd.min.js.map +1 -1
  5. package/esm2015/lib/core/convert.js +1 -5
  6. package/esm2015/lib/core/core.module.js +7 -8
  7. package/esm2015/lib/core/go/base-go.service.js +4 -4
  8. package/esm2015/lib/core/interceptors/httpInterceptor.js +2 -2
  9. package/esm2015/lib/core/localization/localization.service.js +3 -3
  10. package/esm2015/lib/core/localization/localizationSettings.module.js +3 -3
  11. package/esm2015/lib/core/notifications/services/notification-service.js +1 -1
  12. package/esm2015/lib/core/services/appcontext.service.js +12 -12
  13. package/esm2015/lib/core/services/idle.service.js +65 -0
  14. package/esm2015/lib/core/services/web-storage.service.js +65 -0
  15. package/esm2015/lib/data/consts.js +2 -2
  16. package/esm2015/lib/data/data.module.js +6 -6
  17. package/esm2015/lib/data/services/notifications/notifications-api-service.js +45 -0
  18. package/esm2015/lib/ui/components/billing/buyaccess-button.component.js +9 -9
  19. package/esm2015/lib/ui/components/billing/upgrade-plan-button.component.js +7 -7
  20. package/esm2015/lib/ui/components/html-editor/base-html-editor.component.js +19 -19
  21. package/esm2015/lib/ui/components/loading/loading.component.js +49 -0
  22. package/esm2015/lib/ui/components/spinner/spinner.component.js +73 -0
  23. package/esm2015/lib/ui/pipes/filesize.pipe.js +41 -0
  24. package/esm2015/lib/ui/pipes/replace-text.pipe.js +36 -0
  25. package/esm2015/lib/ui/pipes/safeHtml.pipe.js +36 -0
  26. package/esm2015/lib/ui/ui.module.js +19 -13
  27. package/esm2015/public-api.js +57 -9
  28. package/fesm2015/osovitny-anatoly.js +1450 -1287
  29. package/fesm2015/osovitny-anatoly.js.map +1 -1
  30. package/lib/core/convert.d.ts +0 -4
  31. package/lib/core/go/base-go.service.d.ts +1 -1
  32. package/lib/core/services/appcontext.service.d.ts +2 -2
  33. package/lib/core/services/idle.service.d.ts +13 -0
  34. package/lib/core/services/web-storage.service.d.ts +17 -0
  35. package/lib/data/services/notifications/notifications-api-service.d.ts +9 -0
  36. package/lib/ui/components/billing/buyaccess-button.component.d.ts +3 -3
  37. package/lib/ui/components/billing/upgrade-plan-button.component.d.ts +1 -1
  38. package/lib/ui/components/html-editor/base-html-editor.component.d.ts +2 -2
  39. package/lib/ui/components/loading/loading.component.d.ts +10 -0
  40. package/lib/ui/components/spinner/spinner.component.d.ts +22 -0
  41. package/lib/ui/pipes/filesize.pipe.d.ts +5 -0
  42. package/lib/ui/pipes/replace-text.pipe.d.ts +4 -0
  43. package/lib/ui/pipes/safeHtml.pipe.d.ts +7 -0
  44. package/lib/ui/ui.module.d.ts +2 -3
  45. package/osovitny-anatoly.metadata.json +1 -1
  46. package/package.json +1 -1
  47. package/public-api.d.ts +53 -8
  48. package/esm2015/lib/core/alerts.js +0 -145
  49. package/esm2015/lib/core/consts/index.js +0 -21
  50. package/esm2015/lib/core/index.js +0 -37
  51. package/esm2015/lib/core/localization/index.js +0 -26
  52. package/esm2015/lib/data/index.js +0 -26
  53. package/esm2015/lib/ui/index.js +0 -43
  54. package/lib/core/alerts.d.ts +0 -12
  55. package/lib/core/consts/index.d.ts +0 -2
  56. package/lib/core/index.d.ts +0 -13
  57. package/lib/core/localization/index.d.ts +0 -4
  58. package/lib/data/index.d.ts +0 -5
  59. package/lib/ui/index.d.ts +0 -16
@@ -1,18 +1,19 @@
1
- import Swal from 'sweetalert2';
2
- import { ɵɵdefineInjectable, Injectable, ɵɵinject, NgModule, Injector, Optional, SkipSelf, Component, Input, Directive, ElementRef, Pipe, APP_INITIALIZER } from '@angular/core';
3
- import { CommonModule, LOCATION_INITIALIZED } from '@angular/common';
4
- import { HttpClient, HttpResponse } from '@angular/common/http';
5
- import { map, tap } from 'rxjs/operators';
6
- import { BehaviorSubject } from 'rxjs';
7
- import { ToastrService } from 'ngx-toastr';
8
- import { v4 } from 'uuid';
1
+ import { Injectable, ɵɵdefineInjectable, ɵɵinject, Pipe, NgModule, APP_INITIALIZER, Injector, Optional, SkipSelf, Component, Input, ViewEncapsulation, Inject, Directive, ElementRef } from '@angular/core';
2
+ import { ActivatedRoute, Router, NavigationStart, NavigationEnd, NavigationCancel, NavigationError } from '@angular/router';
3
+ import { HttpResponse, HttpClient } from '@angular/common/http';
4
+ import { tap, map } from 'rxjs/operators';
5
+ import { BehaviorSubject, Subject, merge, fromEvent, timer } from 'rxjs';
9
6
  import { TranslateService, TranslateModule, TranslateLoader } from '@ngx-translate/core';
10
7
  import { isValid, format, formatDistanceToNow, formatDistance } from 'date-fns';
11
8
  import enUS from 'date-fns/locale/en-US';
12
- import { ActivatedRoute, Router } from '@angular/router';
9
+ import { LOCATION_INITIALIZED, CommonModule, DOCUMENT } from '@angular/common';
10
+ import { TranslateHttpLoader } from '@ngx-translate/http-loader';
11
+ import Swal from 'sweetalert2';
12
+ import { ToastrService } from 'ngx-toastr';
13
+ import { v4 } from 'uuid';
13
14
  import { NgControl, ReactiveFormsModule, FormsModule } from '@angular/forms';
15
+ import { DomSanitizer } from '@angular/platform-browser';
14
16
  import { FroalaEditorModule, FroalaViewModule } from 'angular-froala-wysiwyg';
15
- import { TranslateHttpLoader } from '@ngx-translate/http-loader';
16
17
 
17
18
  /*
18
19
  <file>
@@ -67,14 +68,31 @@ const Urls = {
67
68
  Anatoly Osovitny
68
69
 
69
70
  Created:
70
- 26 Jun 2020
71
+ 17 Jun 2018
71
72
 
72
73
  Version:
73
74
  1.0
74
75
 
75
76
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
76
77
  </file>
77
- */
78
+ */
79
+ class BaseGoService {
80
+ constructor(route, router) {
81
+ this.route = route;
82
+ this.router = router;
83
+ }
84
+ locationReload() {
85
+ // this.router.navigate([this.route.url]);
86
+ window.location.reload();
87
+ }
88
+ }
89
+ BaseGoService.decorators = [
90
+ { type: Injectable }
91
+ ];
92
+ BaseGoService.ctorParameters = () => [
93
+ { type: ActivatedRoute },
94
+ { type: Router }
95
+ ];
78
96
 
79
97
  /*
80
98
  <file>
@@ -110,7 +128,7 @@ function throwIfAlreadyLoaded(parentModule, moduleName) {
110
128
  Anatoly Osovitny
111
129
 
112
130
  Created:
113
- 4 Mar 2020
131
+ 26 Jun 2020
114
132
 
115
133
  Version:
116
134
  1.0
@@ -118,131 +136,46 @@ function throwIfAlreadyLoaded(parentModule, moduleName) {
118
136
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
119
137
  </file>
120
138
  */
121
- class Alerts {
122
- static Info(text) {
123
- Swal.fire({
124
- title: 'Information',
125
- text,
126
- icon: 'info',
127
- confirmButtonText: 'OK',
128
- });
129
- }
130
- static Warning(text) {
131
- Swal.fire({
132
- title: 'Warning',
133
- text,
134
- icon: 'warning',
135
- confirmButtonText: 'OK',
136
- });
137
- }
138
- static Error(text) {
139
- Swal.fire({
140
- title: 'Error',
141
- text,
142
- icon: 'error',
143
- confirmButtonText: 'OK',
144
- });
145
- }
146
- static NotImplemented() {
147
- this.Warning('Not Implemented Yet');
148
- }
149
- static ErrorOccurred() {
150
- this.Error('Sorry, an unexpected error occurred');
151
- }
152
- static AreYouSure(text, title, confirmButtonText, cancelButtonText, successAction, cancelAction) {
153
- if (typeof title === 'undefined' || title == null)
154
- title = 'Are you sure?';
155
- Swal.fire({
156
- title,
157
- text,
158
- icon: 'warning',
159
- confirmButtonText,
160
- cancelButtonText,
161
- showCancelButton: true,
162
- }).then((result) => {
163
- if (result.value) {
164
- if (successAction) {
165
- successAction();
166
- }
167
- }
168
- // result.dismiss can be 'cancel', 'overlay', 'close', and 'timer'
169
- else if (result.dismiss === Swal.DismissReason.cancel ||
170
- result.dismiss === Swal.DismissReason.close) {
171
- if (cancelAction) {
172
- cancelAction();
173
- }
174
- }
175
- });
139
+ class LoadingService extends BehaviorSubject {
140
+ constructor() {
141
+ super(false);
142
+ this.counter = 0;
143
+ //Public
144
+ this.isFreezed = false;
176
145
  }
177
- static Success(text, title, successAction) {
178
- if (typeof title === 'undefined' || title == null)
179
- title = 'Success';
180
- if (!text) {
181
- text = 'Operation was successful';
182
- }
183
- Swal.fire({
184
- title,
185
- text,
186
- icon: 'success',
187
- confirmButtonText: 'OK',
188
- }).then(() => {
189
- if (successAction) {
190
- successAction();
146
+ show() {
147
+ this.counter++;
148
+ let that = this;
149
+ setTimeout(() => {
150
+ if (that.counter > 0) {
151
+ that.next(true);
191
152
  }
192
- });
193
- }
194
- static Cancel(text) {
195
- if (!text) {
196
- text = 'Operation has been cancled';
197
- }
198
- Swal.fire({
199
- title: 'Cancelled',
200
- text,
201
- icon: 'info',
202
- });
153
+ }, 1000);
203
154
  }
204
- // Notifications
205
- static NotificationCancel(text, title) {
206
- if (typeof title === 'undefined' || title == null) {
207
- title = 'Canceled';
155
+ hide() {
156
+ if (this.counter <= 0) {
157
+ return;
208
158
  }
209
- if (!text) {
210
- text = 'Operation has been canceled';
159
+ this.counter--;
160
+ if (this.counter == 0) {
161
+ this.next(false);
211
162
  }
212
- const toast = Swal.mixin({
213
- toast: true,
214
- position: 'top-end',
215
- showConfirmButton: false,
216
- timer: 3000,
217
- timerProgressBar: true,
218
- });
219
- toast.fire({
220
- title,
221
- text,
222
- icon: 'info',
223
- });
224
163
  }
225
- static NotificationSuccess(text, title) {
226
- if (typeof title === 'undefined' || title == null) {
227
- title = 'Success';
228
- }
229
- if (!text) {
230
- text = 'Operation was successful';
231
- }
232
- const toast = Swal.mixin({
233
- toast: true,
234
- position: 'top-end',
235
- showConfirmButton: false,
236
- timer: 3000,
237
- timerProgressBar: true,
238
- });
239
- toast.fire({
240
- title,
241
- text,
242
- icon: 'success',
243
- });
164
+ freeze(timeout = 1000) {
165
+ this.isFreezed = true;
166
+ let that = this;
167
+ setTimeout(() => {
168
+ this.isFreezed = false;
169
+ }, timeout);
244
170
  }
245
- }
171
+ }
172
+ LoadingService.ɵprov = ɵɵdefineInjectable({ factory: function LoadingService_Factory() { return new LoadingService(); }, token: LoadingService, providedIn: "root" });
173
+ LoadingService.decorators = [
174
+ { type: Injectable, args: [{
175
+ providedIn: "root",
176
+ },] }
177
+ ];
178
+ LoadingService.ctorParameters = () => [];
246
179
 
247
180
  /*
248
181
  <file>
@@ -289,7 +222,7 @@ LoggingService.ctorParameters = () => [];
289
222
  Anatoly Osovitny
290
223
 
291
224
  Created:
292
- 13 Nov 2017
225
+ 25 March 2020
293
226
 
294
227
  Version:
295
228
  1.0
@@ -297,68 +230,85 @@ LoggingService.ctorParameters = () => [];
297
230
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
298
231
  </file>
299
232
  */
300
- class BaseApiService {
301
- constructor(http) {
302
- this.http = http;
303
- this.baseUrl = '';
304
- }
305
- serializeParams(data) {
306
- return data ? '?' + $.param(data) : '';
233
+ class AnatolyHttpInterceptor {
234
+ constructor(loadingService, loggingService) {
235
+ this.loadingService = loadingService;
236
+ this.loggingService = loggingService;
237
+ this.longRunningExceptionsList = [];
238
+ this.autoCDNSASTokenUrls = ['chunks', 'resources'];
239
+ this.externalSiteUrls = ['azurewebsites.net'];
307
240
  }
308
- // api
309
- get(action, data, responseType) {
310
- if (!responseType) {
311
- responseType = 'json';
241
+ intercept(req, next) {
242
+ const isCDNEnabled = AppCoreSettings.IsCDNEnabled;
243
+ const cdnSasToken = AppCoreSettings.CDNSASToken;
244
+ const isLoadingFreezed = this.loadingService.isFreezed;
245
+ let loadingRequired = !isLoadingFreezed;
246
+ const authorizationTokenRequired = true;
247
+ const url = req.url.toLowerCase();
248
+ const originalUrl = req.url;
249
+ let isExternalSite = false;
250
+ if (!isLoadingFreezed) {
251
+ for (const i of this.longRunningExceptionsList) {
252
+ if (url.indexOf(this.longRunningExceptionsList[i]) >= 0) {
253
+ loadingRequired = false;
254
+ break;
255
+ }
256
+ }
312
257
  }
313
- const url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
314
- return this.http
315
- .get(url, { responseType })
316
- .pipe(map((res) => res));
317
- }
318
- post(action, data, responseType) {
319
- if (!responseType) {
320
- responseType = 'text';
258
+ if (isCDNEnabled) {
259
+ for (const i of this.autoCDNSASTokenUrls) {
260
+ if (url.indexOf(this.autoCDNSASTokenUrls[i]) >= 0) {
261
+ req = req.clone({ url: originalUrl + cdnSasToken });
262
+ break;
263
+ }
264
+ }
321
265
  }
322
- const url = `${this.baseUrl}/${action}`;
323
- return this.http.post(url, data, { responseType });
324
- }
325
- postQS(action, data, responseType) {
326
- if (!responseType) {
327
- responseType = 'text';
266
+ for (const i of this.externalSiteUrls) {
267
+ if (url.indexOf(this.externalSiteUrls[i]) >= 0) {
268
+ isExternalSite = true;
269
+ break;
270
+ }
328
271
  }
329
- const url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
330
- return this.http.post(url, null, { responseType });
331
- }
332
- delete(action, data, responseType) {
333
- if (!responseType) {
334
- responseType = 'text';
272
+ // VadimOS: IE11-fix
273
+ if (url.indexOf('/api/') > -1) {
274
+ let newUrl = '';
275
+ const t = new Date().getTime().toString();
276
+ if (url.indexOf('?') > -1) {
277
+ newUrl = originalUrl + '&t=' + t;
278
+ }
279
+ else {
280
+ newUrl = originalUrl + '?t=' + t;
281
+ }
282
+ req = req.clone({ url: newUrl });
335
283
  }
336
- const url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
337
- return this.http.delete(url, { responseType });
338
- }
339
- // gets
340
- getById(id) {
341
- return this.get('getById', { id });
342
- }
343
- getAll(data) {
344
- return this.get('getall', data).pipe(map((res) => res));
284
+ req = req.clone({ headers: req.headers.set('Accept', 'application/json') });
285
+ this.onRequestStart(loadingRequired);
286
+ return next.handle(req).pipe(tap((event) => {
287
+ if (event instanceof HttpResponse) {
288
+ this.onRequestEnd(loadingRequired);
289
+ }
290
+ }, (err) => {
291
+ this.onRequestEnd(loadingRequired);
292
+ this.loggingService.logError(err);
293
+ }));
345
294
  }
346
- getJsonFile(fileName, jsonUrl, jsonVersion) {
347
- if (!jsonUrl) {
348
- jsonUrl = '/dist/jsons';
295
+ onRequestStart(loadingRequired) {
296
+ if (loadingRequired) {
297
+ this.loadingService.show();
349
298
  }
350
- if (!jsonVersion) {
351
- jsonVersion = '1.0';
299
+ }
300
+ onRequestEnd(loadingRequired) {
301
+ if (loadingRequired) {
302
+ this.loadingService.hide();
352
303
  }
353
- const url = jsonUrl + '/' + fileName + '?' + jsonVersion;
354
- return this.http.get(url).pipe(map((res) => res));
355
304
  }
356
305
  }
357
- BaseApiService.decorators = [
306
+ AnatolyHttpInterceptor.decorators = [
358
307
  { type: Injectable }
359
308
  ];
360
- BaseApiService.ctorParameters = () => [
361
- { type: HttpClient }
309
+ AnatolyHttpInterceptor.ctorParameters = () => [
310
+ { type: LoadingService },
311
+ { type: LoggingService }
362
312
  ];
363
313
 
364
314
  /*
@@ -371,7 +321,7 @@ BaseApiService.ctorParameters = () => [
371
321
  Anatoly Osovitny
372
322
 
373
323
  Created:
374
- 13 Nov 2017
324
+ 29 June 2020
375
325
 
376
326
  Version:
377
327
  1.0
@@ -379,54 +329,115 @@ BaseApiService.ctorParameters = () => [
379
329
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
380
330
  </file>
381
331
  */
382
- class AppContextService extends BaseApiService {
383
- constructor(http) {
384
- super(http);
385
- this.http = http;
386
- this.current = null;
387
- this.successes = [];
388
- this.subscription = null;
389
- this.baseUrl = "/api/appContext";
390
- }
391
- getCurrent(success) {
392
- if (typeof success == "undefined") {
393
- return;
394
- }
395
- if (this.current != null) {
396
- success(this.current);
397
- return;
332
+ class Convert {
333
+ static toLocalizedDateTime(value) {
334
+ if (value) {
335
+ return new Date(Date.UTC(value.getFullYear(), value.getMonth(), value.getDate(), value.getHours(), value.getMinutes(), value.getSeconds(), value.getMilliseconds()));
398
336
  }
399
- this.successes.push(success);
400
- if (this.subscription != null) {
401
- return;
337
+ return null;
338
+ }
339
+ }
340
+
341
+ /*
342
+ <file>
343
+ Project:
344
+ @osovitny/anatoly
345
+
346
+ Authors:
347
+ Vadim Osovitny
348
+ Anatoly Osovitny
349
+
350
+ Created:
351
+ 05 May 2020
352
+
353
+ Version:
354
+ 1.0
355
+
356
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
357
+ </file>
358
+ */
359
+ class LocalizationService {
360
+ constructor(translate) {
361
+ this.translate = translate;
362
+ this.setSupportedLanguages(['en']);
363
+ }
364
+ format(str, args) {
365
+ // tslint:disable-next-line:variable-name
366
+ return str.replace(/{(\d+)}/g, (match, number) => typeof args[number] !== 'undefined' ? args[number] : match);
367
+ }
368
+ ;
369
+ configureTranslationSettings(translate) {
370
+ const languageToSet = 'en';
371
+ translate.setDefaultLang(languageToSet);
372
+ return languageToSet;
373
+ }
374
+ getBrowserLanguage() {
375
+ return this.translate.getBrowserLang();
376
+ }
377
+ getDatefnsLocale() {
378
+ let dfnLocale;
379
+ switch (this.getBrowserLanguage()) {
380
+ case 'en':
381
+ dfnLocale = { locale: enUS };
382
+ break;
383
+ default:
384
+ dfnLocale = { locale: enUS };
402
385
  }
403
- this.subscription = this.get("GetCurrentContext", null).subscribe((data) => {
404
- this.dataReceived(data);
405
- }, (e) => { });
386
+ return dfnLocale;
406
387
  }
407
- dataReceived(data) {
408
- this.current = data;
409
- for (var i = 0; i < this.successes.length; i++) {
410
- var success = this.successes[i];
411
- success(data);
388
+ setDefaultLanguage(lang) {
389
+ this.translate.setDefaultLang(lang);
390
+ }
391
+ setSupportedLanguages(languages) {
392
+ this.translate.addLangs(languages);
393
+ }
394
+ updateLanguage(language) {
395
+ this.translate.use(language);
396
+ }
397
+ getLocalizedValue(key, params) {
398
+ const value = this.translate.instant(key);
399
+ if (!params || params.length === 0) {
400
+ return value;
412
401
  }
413
- this.successes = [];
414
- this.subscription.unsubscribe();
415
- this.subscription = null;
416
- this.current = null;
402
+ return this.format(value, params);
417
403
  }
418
- isUserSignedIn() {
419
- return ContextInitState.isUserSignedIn;
404
+ getLocalizedDate(key) {
405
+ if (isValid(new Date(key))) {
406
+ return format(new Date(key), AppCoreSettings.DATE_FORMATS.angular, this.dateFnsLocale);
407
+ }
408
+ return 'Invalid Date';
420
409
  }
421
- isUserAdmin() {
422
- return ContextInitState.isUserAdmin;
410
+ getLocalizedDateTime(key) {
411
+ // To Do Manoj: Test in IE and make TimeZone specific changes accordingly
412
+ const dateValue = new Date(key);
413
+ if (isValid(dateValue)) {
414
+ const localDate = Convert.toLocalizedDateTime(dateValue);
415
+ return format(localDate, AppCoreSettings.DATE_FORMATS.angularWithTime, this.dateFnsLocale);
416
+ }
417
+ return 'Invalid Date';
418
+ }
419
+ getLocalizedDistanceToNowInWords(date) {
420
+ // https://date-fns.org/v1.30.1/docs/distanceInWords
421
+ if (isValid(new Date(date))) {
422
+ return formatDistanceToNow(new Date(date), this.dateFnsLocale);
423
+ }
424
+ return 'Invalid Date';
425
+ }
426
+ getLocalizedDistanceInWords(endedDate, startedDate) {
427
+ if (isValid(new Date(endedDate)) && isValid(new Date(startedDate))) {
428
+ return formatDistance(new Date(endedDate), new Date(startedDate), this.dateFnsLocale);
429
+ }
430
+ return 'Invalid Date';
423
431
  }
424
432
  }
425
- AppContextService.decorators = [
426
- { type: Injectable }
433
+ LocalizationService.ɵprov = ɵɵdefineInjectable({ factory: function LocalizationService_Factory() { return new LocalizationService(ɵɵinject(TranslateService)); }, token: LocalizationService, providedIn: "root" });
434
+ LocalizationService.decorators = [
435
+ { type: Injectable, args: [{
436
+ providedIn: 'root'
437
+ },] }
427
438
  ];
428
- AppContextService.ctorParameters = () => [
429
- { type: HttpClient }
439
+ LocalizationService.ctorParameters = () => [
440
+ { type: TranslateService }
430
441
  ];
431
442
 
432
443
  /*
@@ -439,7 +450,7 @@ AppContextService.ctorParameters = () => [
439
450
  Anatoly Osovitny
440
451
 
441
452
  Created:
442
- 26 Jun 2020
453
+ 10 May 2020
443
454
 
444
455
  Version:
445
456
  1.0
@@ -447,46 +458,48 @@ AppContextService.ctorParameters = () => [
447
458
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
448
459
  </file>
449
460
  */
450
- class LoadingService extends BehaviorSubject {
451
- constructor() {
452
- super(false);
453
- this.counter = 0;
454
- //Public
455
- this.isFreezed = false;
456
- }
457
- show() {
458
- this.counter++;
459
- let that = this;
460
- setTimeout(() => {
461
- if (that.counter > 0) {
462
- that.next(true);
463
- }
464
- }, 1000);
461
+ class LocalizePipe {
462
+ constructor(localizeService) {
463
+ this.localizeService = localizeService;
465
464
  }
466
- hide() {
467
- if (this.counter <= 0) {
465
+ transform(inputData, type, param2) {
466
+ if (!inputData) {
468
467
  return;
469
468
  }
470
- this.counter--;
471
- if (this.counter == 0) {
472
- this.next(false);
469
+ if (!type) {
470
+ type = 't';
473
471
  }
474
- }
475
- freeze(timeout = 1000) {
476
- this.isFreezed = true;
477
- let that = this;
478
- setTimeout(() => {
479
- this.isFreezed = false;
480
- }, timeout);
472
+ // Translate
473
+ if (type === 't') {
474
+ return this.localizeService.getLocalizedValue(inputData);
475
+ }
476
+ // Date
477
+ if (type === 'd') {
478
+ return this.localizeService.getLocalizedDate(inputData);
479
+ }
480
+ // DateTime
481
+ if (type === 'dt') {
482
+ return this.localizeService.getLocalizedDateTime(inputData);
483
+ }
484
+ // DistanceToNowInWords
485
+ if (type === 'dis2now') {
486
+ return this.localizeService.getLocalizedDistanceToNowInWords(inputData);
487
+ }
488
+ // DistanceInWords
489
+ if (type === 'dis') {
490
+ return this.localizeService.getLocalizedDistanceInWords(inputData, param2);
491
+ }
492
+ return inputData;
481
493
  }
482
494
  }
483
- LoadingService.ɵprov = ɵɵdefineInjectable({ factory: function LoadingService_Factory() { return new LoadingService(); }, token: LoadingService, providedIn: "root" });
484
- LoadingService.decorators = [
485
- { type: Injectable, args: [{
486
- providedIn: "root",
495
+ LocalizePipe.decorators = [
496
+ { type: Pipe, args: [{
497
+ name: 'localize'
487
498
  },] }
488
499
  ];
489
- LoadingService.ctorParameters = () => [];
500
+ LocalizePipe.ctorParameters = () => [
501
+ { type: LocalizationService }
502
+ ];
490
503
 
491
504
  /*
492
505
  <file>
@@ -498,7 +511,7 @@ LoadingService.ctorParameters = () => [];
498
511
  Anatoly Osovitny
499
512
 
500
513
  Created:
501
- 26 Jun 2020
514
+ 05 May 2020
502
515
 
503
516
  Version:
504
517
  1.0
@@ -506,11 +519,48 @@ LoadingService.ctorParameters = () => [];
506
519
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
507
520
  </file>
508
521
  */
509
- class Guid {
510
- static newGuid() {
511
- return v4();
522
+ function customTranslateLoaderFactory(http) {
523
+ return new TranslateHttpLoader(http, AppCoreSettings.resourcesUrl + "/", '.json');
524
+ }
525
+ function localizationInitializerFactory(translate, localizationService, injector) {
526
+ return () => new Promise((resolve) => {
527
+ let locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
528
+ locationInitialized.then(() => {
529
+ let languageToSet = localizationService.configureTranslationSettings(translate);
530
+ translate.use(languageToSet).subscribe(() => {
531
+ }, () => {
532
+ resolve(null);
533
+ }, () => {
534
+ resolve(null);
535
+ });
536
+ });
537
+ });
538
+ }
539
+ const TranslateModuleAtRoot = TranslateModule.forRoot({
540
+ loader: {
541
+ provide: TranslateLoader,
542
+ useFactory: customTranslateLoaderFactory,
543
+ deps: [HttpClient]
512
544
  }
513
- }
545
+ });
546
+ class LocalizationSettingsModule {
547
+ }
548
+ LocalizationSettingsModule.decorators = [
549
+ { type: NgModule, args: [{
550
+ imports: [
551
+ TranslateModuleAtRoot
552
+ ],
553
+ providers: [
554
+ {
555
+ provide: APP_INITIALIZER,
556
+ useFactory: localizationInitializerFactory,
557
+ deps: [TranslateService, LocalizationService, Injector],
558
+ multi: true
559
+ }
560
+ ],
561
+ exports: []
562
+ },] }
563
+ ];
514
564
 
515
565
  /*
516
566
  <file>
@@ -522,7 +572,7 @@ class Guid {
522
572
  Anatoly Osovitny
523
573
 
524
574
  Created:
525
- 2 Jun 2020
575
+ 12 May 2020
526
576
 
527
577
  Version:
528
578
  1.0
@@ -530,23 +580,269 @@ class Guid {
530
580
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
531
581
  </file>
532
582
  */
533
- // SignalR
534
- // import * as signalR from '@microsoft/signalr';
535
- // import { NotificationsApiService } from '../../../data/services/notifications/notifications-api-service';
536
- class NotificationService {
537
- constructor(toastrService) {
538
- this.toastrService = toastrService;
539
- // SignalR
540
- // private hubConnection: signalR.HubConnection;
541
- // private socketUrl: string;
542
- // Notifications
543
- this._sessionNotifications = new BehaviorSubject([]);
544
- this._serverNotifications = new BehaviorSubject([]);
545
- // Public
546
- this.sessionNotifications$ = this._sessionNotifications.asObservable();
547
- this.serverNotifications$ = this._serverNotifications.asObservable();
548
- // this.onInit();
549
- }
583
+ class LocalizationModule {
584
+ }
585
+ LocalizationModule.decorators = [
586
+ { type: NgModule, args: [{
587
+ imports: [
588
+ TranslateModule
589
+ ],
590
+ exports: [
591
+ TranslateModule,
592
+ LocalizePipe
593
+ ],
594
+ declarations: [
595
+ LocalizePipe
596
+ ],
597
+ providers: []
598
+ },] }
599
+ ];
600
+
601
+ /*
602
+ <file>
603
+ Project:
604
+ @osovitny/anatoly
605
+
606
+ Authors:
607
+ Vadim Osovitny
608
+ Anatoly Osovitny
609
+
610
+ Created:
611
+ 26 Jun 2020
612
+
613
+ Version:
614
+ 1.0
615
+
616
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
617
+ </file>
618
+ */
619
+ class GlobalErrorHandler {
620
+ constructor(injector) {
621
+ this.injector = injector;
622
+ }
623
+ handleError(error) {
624
+ const loggingService = this.injector.get(LoggingService);
625
+ loggingService.logError(error);
626
+ // IMPORTANT: Rethrow the error otherwise it gets swallowed
627
+ throw error;
628
+ }
629
+ }
630
+ GlobalErrorHandler.decorators = [
631
+ { type: Injectable }
632
+ ];
633
+ GlobalErrorHandler.ctorParameters = () => [
634
+ { type: Injector }
635
+ ];
636
+
637
+ /*
638
+ <file>
639
+ Project:
640
+ @osovitny/anatoly
641
+
642
+ Authors:
643
+ Vadim Osovitny
644
+ Anatoly Osovitny
645
+
646
+ Created:
647
+ 13 Nov 2017
648
+
649
+ Version:
650
+ 1.0
651
+
652
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
653
+ </file>
654
+ */
655
+ class BaseApiService {
656
+ constructor(http) {
657
+ this.http = http;
658
+ this.baseUrl = '';
659
+ }
660
+ serializeParams(data) {
661
+ return data ? '?' + $.param(data) : '';
662
+ }
663
+ // api
664
+ get(action, data, responseType) {
665
+ if (!responseType) {
666
+ responseType = 'json';
667
+ }
668
+ const url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
669
+ return this.http
670
+ .get(url, { responseType })
671
+ .pipe(map((res) => res));
672
+ }
673
+ post(action, data, responseType) {
674
+ if (!responseType) {
675
+ responseType = 'text';
676
+ }
677
+ const url = `${this.baseUrl}/${action}`;
678
+ return this.http.post(url, data, { responseType });
679
+ }
680
+ postQS(action, data, responseType) {
681
+ if (!responseType) {
682
+ responseType = 'text';
683
+ }
684
+ const url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
685
+ return this.http.post(url, null, { responseType });
686
+ }
687
+ delete(action, data, responseType) {
688
+ if (!responseType) {
689
+ responseType = 'text';
690
+ }
691
+ const url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
692
+ return this.http.delete(url, { responseType });
693
+ }
694
+ // gets
695
+ getById(id) {
696
+ return this.get('getById', { id });
697
+ }
698
+ getAll(data) {
699
+ return this.get('getall', data).pipe(map((res) => res));
700
+ }
701
+ getJsonFile(fileName, jsonUrl, jsonVersion) {
702
+ if (!jsonUrl) {
703
+ jsonUrl = '/dist/jsons';
704
+ }
705
+ if (!jsonVersion) {
706
+ jsonVersion = '1.0';
707
+ }
708
+ const url = jsonUrl + '/' + fileName + '?' + jsonVersion;
709
+ return this.http.get(url).pipe(map((res) => res));
710
+ }
711
+ }
712
+ BaseApiService.decorators = [
713
+ { type: Injectable }
714
+ ];
715
+ BaseApiService.ctorParameters = () => [
716
+ { type: HttpClient }
717
+ ];
718
+
719
+ /*
720
+ <file>
721
+ Project:
722
+ @osovitny/anatoly
723
+
724
+ Authors:
725
+ Vadim Osovitny
726
+ Anatoly Osovitny
727
+
728
+ Created:
729
+ 13 Nov 2017
730
+
731
+ Version:
732
+ 1.0
733
+
734
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
735
+ </file>
736
+ */
737
+ class AppContextService extends BaseApiService {
738
+ constructor(http) {
739
+ super(http);
740
+ this.http = http;
741
+ this.current = null;
742
+ this.successes = [];
743
+ this.subscription = null;
744
+ this.baseUrl = '/api/appContext';
745
+ }
746
+ getCurrent(success) {
747
+ if (typeof success == 'undefined') {
748
+ return;
749
+ }
750
+ if (this.current != null) {
751
+ success(this.current);
752
+ return;
753
+ }
754
+ this.successes.push(success);
755
+ if (this.subscription != null) {
756
+ return;
757
+ }
758
+ this.subscription = this.get('GetCurrentContext', null).subscribe((data) => {
759
+ this.dataReceived(data);
760
+ }, (e) => { });
761
+ }
762
+ dataReceived(data) {
763
+ this.current = data;
764
+ for (let i = 0; i < this.successes.length; i++) {
765
+ let success = this.successes[i];
766
+ success(data);
767
+ }
768
+ this.successes = [];
769
+ this.subscription.unsubscribe();
770
+ this.subscription = null;
771
+ this.current = null;
772
+ }
773
+ isUserSignedIn() {
774
+ return ContextInitState.isUserSignedIn;
775
+ }
776
+ isUserAdmin() {
777
+ return ContextInitState.isUserAdmin;
778
+ }
779
+ }
780
+ AppContextService.decorators = [
781
+ { type: Injectable }
782
+ ];
783
+ AppContextService.ctorParameters = () => [
784
+ { type: HttpClient }
785
+ ];
786
+
787
+ /*
788
+ <file>
789
+ Project:
790
+ @osovitny/anatoly
791
+
792
+ Authors:
793
+ Vadim Osovitny
794
+ Anatoly Osovitny
795
+
796
+ Created:
797
+ 26 Jun 2020
798
+
799
+ Version:
800
+ 1.0
801
+
802
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
803
+ </file>
804
+ */
805
+ class Guid {
806
+ static newGuid() {
807
+ return v4();
808
+ }
809
+ }
810
+
811
+ /*
812
+ <file>
813
+ Project:
814
+ @osovitny/anatoly
815
+
816
+ Authors:
817
+ Vadim Osovitny
818
+ Anatoly Osovitny
819
+
820
+ Created:
821
+ 2 Jun 2020
822
+
823
+ Version:
824
+ 1.0
825
+
826
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
827
+ </file>
828
+ */
829
+ // SignalR
830
+ // import * as signalR from '@microsoft/signalr';
831
+ // import { NotificationsApiService } from '../../../data/services/notifications/notifications-api-service';
832
+ class NotificationService {
833
+ constructor(toastrService) {
834
+ this.toastrService = toastrService;
835
+ // SignalR
836
+ // private hubConnection: signalR.HubConnection;
837
+ // private socketUrl: string;
838
+ // Notifications
839
+ this._sessionNotifications = new BehaviorSubject([]);
840
+ this._serverNotifications = new BehaviorSubject([]);
841
+ // Public
842
+ this.sessionNotifications$ = this._sessionNotifications.asObservable();
843
+ this.serverNotifications$ = this._serverNotifications.asObservable();
844
+ // this.onInit();
845
+ }
550
846
  /*
551
847
  onInit() {
552
848
  if (AppCoreSettings.AzureAD) {
@@ -720,175 +1016,41 @@ class NotificationService {
720
1016
  get serverNotifications() {
721
1017
  return this._serverNotifications.getValue();
722
1018
  }
723
- set serverNotifications(val) {
724
- this._serverNotifications.next(val);
725
- }
726
- }
727
- NotificationService.ɵprov = ɵɵdefineInjectable({ factory: function NotificationService_Factory() { return new NotificationService(ɵɵinject(ToastrService)); }, token: NotificationService, providedIn: "root" });
728
- NotificationService.decorators = [
729
- { type: Injectable, args: [{ providedIn: 'root' },] }
730
- ];
731
- NotificationService.ctorParameters = () => [
732
- { type: ToastrService }
733
- ];
734
-
735
- const providers = [
736
- LoggingService,
737
- NotificationService,
738
- AppContextService,
739
- LoadingService
740
- ];
741
- let InjectorInstance;
742
- class AnatolyCoreModule {
743
- constructor(injector, parentModule) {
744
- this.injector = injector;
745
- throwIfAlreadyLoaded(parentModule, 'AnatolyCoreModule');
746
- InjectorInstance = this.injector;
747
- }
748
- }
749
- AnatolyCoreModule.decorators = [
750
- { type: NgModule, args: [{
751
- imports: [CommonModule],
752
- exports: [],
753
- providers: [...providers],
754
- },] }
755
- ];
756
- AnatolyCoreModule.ctorParameters = () => [
757
- { type: Injector },
758
- { type: AnatolyCoreModule, decorators: [{ type: Optional }, { type: SkipSelf }] }
759
- ];
760
-
761
- /*
762
- <file>
763
- Project:
764
- @osovitny/anatoly
765
-
766
- Authors:
767
- Vadim Osovitny
768
- Anatoly Osovitny
769
-
770
- Created:
771
- 29 June 2020
772
-
773
- Version:
774
- 1.0
775
-
776
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
777
- </file>
778
- */
779
- class Convert {
780
- /**
781
- * Convert date time lo local time zone value.
782
- * @param value
783
- */
784
- static toLocalizedDateTime(value) {
785
- if (value) {
786
- return new Date(Date.UTC(value.getFullYear(), value.getMonth(), value.getDate(), value.getHours(), value.getMinutes(), value.getSeconds(), value.getMilliseconds()));
787
- }
788
- return null;
789
- }
790
- }
791
-
792
- /*
793
- <file>
794
- Project:
795
- @osovitny/anatoly
796
-
797
- Authors:
798
- Vadim Osovitny
799
- Anatoly Osovitny
800
-
801
- Created:
802
- 05 May 2020
803
-
804
- Version:
805
- 1.0
806
-
807
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
808
- </file>
809
- */
810
- class LocalizationService {
811
- constructor(translate) {
812
- this.translate = translate;
813
- this.setSupportedLanguages(['en']);
814
- }
815
- format(str, args) {
816
- // tslint:disable-next-line:variable-name
817
- return str.replace(/{(\d+)}/g, (match, number) => typeof args[number] !== 'undefined' ? args[number] : match);
818
- }
819
- ;
820
- configureTranslationSettings(translate) {
821
- const languageToSet = 'en';
822
- translate.setDefaultLang(languageToSet);
823
- return languageToSet;
824
- }
825
- getBrowserLanguage() {
826
- return this.translate.getBrowserLang();
827
- }
828
- getDatefnsLocale() {
829
- let dfnLocale;
830
- switch (this.getBrowserLanguage()) {
831
- case 'en':
832
- dfnLocale = { locale: enUS };
833
- break;
834
- default:
835
- dfnLocale = { locale: enUS };
836
- }
837
- return dfnLocale;
838
- }
839
- setDefaultLanguage(lang) {
840
- this.translate.setDefaultLang(lang);
841
- }
842
- setSupportedLanguages(languages) {
843
- this.translate.addLangs(languages);
844
- }
845
- updateLanguage(language) {
846
- this.translate.use(language);
847
- }
848
- getLocalizedValue(key, params) {
849
- const value = this.translate.instant(key);
850
- if (!params || params.length === 0) {
851
- return value;
852
- }
853
- return this.format(value, params);
854
- }
855
- getLocalizedDate(key) {
856
- if (isValid(new Date(key))) {
857
- return format(new Date(key), AppCoreSettings.DATE_FORMATS.angular, this.dateFnsLocale);
858
- }
859
- return 'Invalid Date';
860
- }
861
- getLocalizedDateTime(key) {
862
- // To Do Manoj: Test in IE and make TimeZone specific changes accordingly
863
- const dateValue = new Date(key);
864
- if (isValid(dateValue)) {
865
- const localDate = Convert.toLocalizedDateTime(dateValue);
866
- return format(localDate, AppCoreSettings.DATE_FORMATS.angularWithTime, this.dateFnsLocale);
867
- }
868
- return 'Invalid Date';
869
- }
870
- getLocalizedDistanceToNowInWords(date) {
871
- // https://date-fns.org/v1.30.1/docs/distanceInWords
872
- if (isValid(new Date(date))) {
873
- return formatDistanceToNow(new Date(date), this.dateFnsLocale);
874
- }
875
- return 'Invalid Date';
876
- }
877
- getLocalizedDistanceInWords(endedDate, startedDate) {
878
- if (isValid(new Date(endedDate)) && isValid(new Date(startedDate))) {
879
- return formatDistance(new Date(endedDate), new Date(startedDate), this.dateFnsLocale);
880
- }
881
- return 'Invalid Date';
1019
+ set serverNotifications(val) {
1020
+ this._serverNotifications.next(val);
882
1021
  }
883
1022
  }
884
- LocalizationService.ɵprov = ɵɵdefineInjectable({ factory: function LocalizationService_Factory() { return new LocalizationService(ɵɵinject(TranslateService)); }, token: LocalizationService, providedIn: "root" });
885
- LocalizationService.decorators = [
886
- { type: Injectable, args: [{
887
- providedIn: 'root'
1023
+ NotificationService.ɵprov = ɵɵdefineInjectable({ factory: function NotificationService_Factory() { return new NotificationService(ɵɵinject(ToastrService)); }, token: NotificationService, providedIn: "root" });
1024
+ NotificationService.decorators = [
1025
+ { type: Injectable, args: [{ providedIn: 'root' },] }
1026
+ ];
1027
+ NotificationService.ctorParameters = () => [
1028
+ { type: ToastrService }
1029
+ ];
1030
+
1031
+ let InjectorInstance;
1032
+ class AnatolyCoreModule {
1033
+ constructor(injector, parentModule) {
1034
+ this.injector = injector;
1035
+ throwIfAlreadyLoaded(parentModule, 'AnatolyCoreModule');
1036
+ InjectorInstance = this.injector;
1037
+ }
1038
+ }
1039
+ AnatolyCoreModule.decorators = [
1040
+ { type: NgModule, args: [{
1041
+ imports: [CommonModule],
1042
+ exports: [],
1043
+ providers: [
1044
+ LoggingService,
1045
+ NotificationService,
1046
+ AppContextService,
1047
+ LoadingService
1048
+ ],
888
1049
  },] }
889
1050
  ];
890
- LocalizationService.ctorParameters = () => [
891
- { type: TranslateService }
1051
+ AnatolyCoreModule.ctorParameters = () => [
1052
+ { type: Injector },
1053
+ { type: AnatolyCoreModule, decorators: [{ type: Optional }, { type: SkipSelf }] }
892
1054
  ];
893
1055
 
894
1056
  /*
@@ -982,7 +1144,7 @@ class Utils {
982
1144
  Anatoly Osovitny
983
1145
 
984
1146
  Created:
985
- 26 Jun 2020
1147
+ 3 March 2020
986
1148
 
987
1149
  Version:
988
1150
  1.0
@@ -990,20 +1152,91 @@ class Utils {
990
1152
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
991
1153
  </file>
992
1154
  */
993
- class Subs {
994
- constructor() {
995
- this.subs = [];
1155
+ class Alerts {
1156
+ static success(text, params, title, successAction) {
1157
+ text = Utils.getLocalizedValue(text, params, 'OperationSuccessFull');
1158
+ title = Utils.getLocalizedValue(title, null, 'Success');
1159
+ Swal.fire({
1160
+ text,
1161
+ title,
1162
+ icon: 'success',
1163
+ confirmButtonText: Utils.getLocalizedValue('Ok')
1164
+ })
1165
+ .then(() => {
1166
+ if (successAction) {
1167
+ successAction();
1168
+ }
1169
+ });
996
1170
  }
997
- add(...subscriptions) {
998
- this.subs = this.subs.concat(subscriptions);
1171
+ static info(text, params, title) {
1172
+ text = Utils.getLocalizedValue(text, params);
1173
+ title = Utils.getLocalizedValue(title, null, 'Info');
1174
+ Swal.fire({
1175
+ text,
1176
+ title,
1177
+ icon: 'info',
1178
+ confirmButtonText: Utils.getLocalizedValue('Ok')
1179
+ });
999
1180
  }
1000
- set sink(subscription) {
1001
- this.subs.push(subscription);
1181
+ static warning(text, params, title) {
1182
+ text = Utils.getLocalizedValue(text, params);
1183
+ title = Utils.getLocalizedValue(title, null, 'Warning');
1184
+ Swal.fire({
1185
+ text,
1186
+ title,
1187
+ icon: 'warning',
1188
+ confirmButtonText: Utils.getLocalizedValue('Ok')
1189
+ });
1002
1190
  }
1003
- unsubscribe() {
1004
- this.subs.forEach((sub) => sub && sub.unsubscribe());
1005
- this.subs = [];
1191
+ static error(text, params, title) {
1192
+ text = Utils.getLocalizedValue(text, params, 'ErrorOccured');
1193
+ title = Utils.getLocalizedValue(title, null, 'Error');
1194
+ Swal.fire({
1195
+ text,
1196
+ title,
1197
+ icon: 'error',
1198
+ confirmButtonText: Utils.getLocalizedValue('Ok')
1199
+ });
1200
+ }
1201
+ static cancel(text, params, title) {
1202
+ text = Utils.getLocalizedValue(text, params, 'OperationCancelled');
1203
+ title = Utils.getLocalizedValue(title, null, 'Cancelled');
1204
+ Swal.fire({
1205
+ text,
1206
+ title,
1207
+ icon: 'info'
1208
+ });
1209
+ }
1210
+ static notImplemented() {
1211
+ this.warning('Not Implemented Yet');
1212
+ }
1213
+ ;
1214
+ static areYouSure(text, title, confirmButtonText, cancelButtonText, successAction, cancelAction) {
1215
+ text = Utils.getLocalizedValue(text);
1216
+ title = Utils.getLocalizedValue(title, null, 'AreYouSure');
1217
+ Swal.fire({
1218
+ text,
1219
+ title,
1220
+ icon: 'warning',
1221
+ confirmButtonText: Utils.getLocalizedValue(confirmButtonText),
1222
+ cancelButtonText: Utils.getLocalizedValue(cancelButtonText),
1223
+ showCancelButton: true
1224
+ })
1225
+ .then((result) => {
1226
+ if (result.value) {
1227
+ if (successAction) {
1228
+ successAction();
1229
+ }
1230
+ }
1231
+ // result.dismiss can be 'cancel', 'overlay', 'close', and 'timer'
1232
+ else if (result.dismiss == Swal.DismissReason.cancel || result.dismiss == Swal.DismissReason.close) {
1233
+ if (cancelAction) {
1234
+ cancelAction();
1235
+ }
1236
+ }
1237
+ });
1006
1238
  }
1239
+ ;
1007
1240
  }
1008
1241
 
1009
1242
  /*
@@ -1016,31 +1249,14 @@ class Subs {
1016
1249
  Anatoly Osovitny
1017
1250
 
1018
1251
  Created:
1019
- 17 Jun 2018
1252
+ 2 Jun 2020
1020
1253
 
1021
1254
  Version:
1022
1255
  1.0
1023
1256
 
1024
1257
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1025
1258
  </file>
1026
- */
1027
- class BaseGoService {
1028
- constructor(route, router) {
1029
- this.route = route;
1030
- this.router = router;
1031
- }
1032
- locationReload() {
1033
- //this.router.navigate([this.route.url]);
1034
- window.location.reload();
1035
- }
1036
- }
1037
- BaseGoService.decorators = [
1038
- { type: Injectable }
1039
- ];
1040
- BaseGoService.ctorParameters = () => [
1041
- { type: ActivatedRoute },
1042
- { type: Router }
1043
- ];
1259
+ */
1044
1260
 
1045
1261
  /*
1046
1262
  <file>
@@ -1060,122 +1276,108 @@ BaseGoService.ctorParameters = () => [
1060
1276
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1061
1277
  </file>
1062
1278
  */
1063
- class GlobalErrorHandler {
1064
- constructor(injector) {
1065
- this.injector = injector;
1279
+ class IdleService {
1280
+ constructor() {
1281
+ this.expired$ = new Subject();
1066
1282
  }
1067
- handleError(error) {
1068
- const loggingService = this.injector.get(LoggingService);
1069
- loggingService.logError(error);
1070
- // IMPORTANT: Rethrow the error otherwise it gets swallowed
1071
- throw error;
1283
+ startWatching(timeOutSeconds) {
1284
+ this.idle$ = merge(fromEvent(document, "mousemove"), fromEvent(document, "click"), fromEvent(document, "mousedown"), fromEvent(document, "keypress"), fromEvent(document, "DOMMouseScroll"), fromEvent(document, "mousewheel"), fromEvent(document, "touchmove"), fromEvent(document, "MSPointerMove"), fromEvent(window, "mousemove"), fromEvent(window, "resize"));
1285
+ this.timeOutMilliSeconds = timeOutSeconds * 1000;
1286
+ this.idleSubscription = this.idle$.subscribe((res) => {
1287
+ this.resetTimer();
1288
+ });
1289
+ this.startTimer();
1290
+ return this.expired$;
1072
1291
  }
1073
- }
1074
- GlobalErrorHandler.decorators = [
1075
- { type: Injectable }
1076
- ];
1077
- GlobalErrorHandler.ctorParameters = () => [
1078
- { type: Injector }
1079
- ];
1080
-
1081
- /*
1082
- <file>
1083
- Project:
1084
- @osovitny/anatoly
1085
-
1086
- Authors:
1087
- Vadim Osovitny
1088
- Anatoly Osovitny
1089
-
1090
- Created:
1091
- 25 March 2020
1092
-
1093
- Version:
1094
- 1.0
1095
-
1096
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1097
- </file>
1098
- */
1099
- class AnatolyHttpInterceptor {
1100
- constructor(loadingService, loggingService) {
1101
- this.loadingService = loadingService;
1102
- this.loggingService = loggingService;
1103
- this.longRunningExceptionsList = [];
1104
- this.autoCDNSASTokenUrls = ['chunks', 'resources'];
1105
- this.externalSiteUrls = ['azurewebsites.net'];
1292
+ startTimer() {
1293
+ this.timer$ = timer(this.timeOutMilliSeconds, this.timeOutMilliSeconds).subscribe((res) => {
1294
+ this.expired$.next(true);
1295
+ });
1106
1296
  }
1107
- intercept(req, next) {
1108
- const isCDNEnabled = AppCoreSettings.IsCDNEnabled;
1109
- const cdnSasToken = AppCoreSettings.CDNSASToken;
1110
- const isLoadingFreezed = this.loadingService.isFreezed;
1111
- let loadingRequired = !isLoadingFreezed;
1112
- const authorizationTokenRequired = true;
1113
- const url = req.url.toLowerCase();
1114
- const originalUrl = req.url;
1115
- let isExternalSite = false;
1116
- if (!isLoadingFreezed) {
1117
- for (const i of this.longRunningExceptionsList) {
1118
- if (url.indexOf(this.longRunningExceptionsList[i]) >= 0) {
1119
- loadingRequired = false;
1120
- break;
1121
- }
1122
- }
1123
- }
1124
- if (isCDNEnabled) {
1125
- for (const i of this.autoCDNSASTokenUrls) {
1126
- if (url.indexOf(this.autoCDNSASTokenUrls[i]) >= 0) {
1127
- req = req.clone({ url: originalUrl + cdnSasToken });
1128
- break;
1129
- }
1130
- }
1131
- }
1132
- for (const i of this.externalSiteUrls) {
1133
- if (url.indexOf(this.externalSiteUrls[i]) >= 0) {
1134
- isExternalSite = true;
1135
- break;
1136
- }
1137
- }
1138
- // VadimOS: IE11-fix
1139
- if (url.indexOf('/api/') > -1) {
1140
- let newUrl = '';
1141
- const t = new Date().getTime().toString();
1142
- if (url.indexOf('?') > -1) {
1143
- newUrl = originalUrl + '&t=' + t;
1144
- }
1145
- else {
1146
- newUrl = originalUrl + '?t=' + t;
1147
- }
1148
- req = req.clone({ url: newUrl });
1149
- }
1150
- req = req.clone({ headers: req.headers.set('Accept', 'application/json') });
1151
- this.onRequestStart(loadingRequired);
1152
- return next.handle(req).pipe(tap((event) => {
1153
- if (event instanceof HttpResponse) {
1154
- this.onRequestEnd(loadingRequired);
1155
- }
1156
- }, (err) => {
1157
- this.onRequestEnd(loadingRequired);
1158
- this.loggingService.logError(err);
1159
- }));
1297
+ resetTimer() {
1298
+ this.timer$.unsubscribe();
1299
+ this.startTimer();
1300
+ }
1301
+ stopTimer() {
1302
+ this.timer$.unsubscribe();
1303
+ this.idleSubscription.unsubscribe();
1304
+ }
1305
+ restartIdleTimer() {
1306
+ this.timer$.unsubscribe();
1307
+ this.idleSubscription.unsubscribe();
1308
+ this.idleSubscription = this.idle$.subscribe((res) => {
1309
+ this.resetTimer();
1310
+ });
1311
+ this.startTimer();
1312
+ }
1313
+ }
1314
+ IdleService.ɵprov = ɵɵdefineInjectable({ factory: function IdleService_Factory() { return new IdleService(); }, token: IdleService, providedIn: "root" });
1315
+ IdleService.decorators = [
1316
+ { type: Injectable, args: [{
1317
+ providedIn: "root",
1318
+ },] }
1319
+ ];
1320
+
1321
+ /*
1322
+ <file>
1323
+ Project:
1324
+ @osovitny/anatoly
1325
+
1326
+ Authors:
1327
+ Vadim Osovitny
1328
+ Anatoly Osovitny
1329
+
1330
+ Created:
1331
+ 26 Jun 2020
1332
+
1333
+ Version:
1334
+ 1.0
1335
+
1336
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1337
+ </file>
1338
+ */
1339
+ class WebStorageService {
1340
+ constructor(storage) {
1341
+ this.currentClientKey = AppCoreSettings.SERVICES_CONF.selectedClientID;
1342
+ this.storage =
1343
+ storage === 'local' || storage === 'localStorage'
1344
+ ? localStorage
1345
+ : sessionStorage;
1160
1346
  }
1161
- onRequestStart(loadingRequired) {
1162
- if (loadingRequired) {
1163
- this.loadingService.show();
1164
- }
1347
+ setItem(key, value) {
1348
+ this.storage.setItem(this.currentClientKey + key, value);
1165
1349
  }
1166
- onRequestEnd(loadingRequired) {
1167
- if (loadingRequired) {
1168
- this.loadingService.hide();
1169
- }
1350
+ setObject(key, value) {
1351
+ this.storage.setItem(this.currentClientKey + key, JSON.stringify(value));
1352
+ }
1353
+ getItem(key) {
1354
+ return this.storage.getItem(this.currentClientKey + key);
1355
+ }
1356
+ getObject(key) {
1357
+ return JSON.parse(this.storage.getItem(this.currentClientKey + key) || '{}');
1358
+ }
1359
+ remove(key) {
1360
+ this.storage.removeItem(this.currentClientKey + key);
1170
1361
  }
1171
1362
  }
1172
- AnatolyHttpInterceptor.decorators = [
1363
+ class LocalStorageService extends WebStorageService {
1364
+ constructor() {
1365
+ super('localStorage');
1366
+ }
1367
+ }
1368
+ LocalStorageService.decorators = [
1173
1369
  { type: Injectable }
1174
1370
  ];
1175
- AnatolyHttpInterceptor.ctorParameters = () => [
1176
- { type: LoadingService },
1177
- { type: LoggingService }
1178
- ];
1371
+ LocalStorageService.ctorParameters = () => [];
1372
+ class SessionStorageService extends WebStorageService {
1373
+ constructor() {
1374
+ super('sessionStorage');
1375
+ }
1376
+ }
1377
+ SessionStorageService.decorators = [
1378
+ { type: Injectable }
1379
+ ];
1380
+ SessionStorageService.ctorParameters = () => [];
1179
1381
 
1180
1382
  /*
1181
1383
  <file>
@@ -1194,7 +1396,22 @@ AnatolyHttpInterceptor.ctorParameters = () => [
1194
1396
 
1195
1397
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1196
1398
  </file>
1197
- */
1399
+ */
1400
+ class Subs {
1401
+ constructor() {
1402
+ this.subs = [];
1403
+ }
1404
+ add(...subscriptions) {
1405
+ this.subs = this.subs.concat(subscriptions);
1406
+ }
1407
+ set sink(subscription) {
1408
+ this.subs.push(subscription);
1409
+ }
1410
+ unsubscribe() {
1411
+ this.subs.forEach((sub) => sub && sub.unsubscribe());
1412
+ this.subs = [];
1413
+ }
1414
+ }
1198
1415
 
1199
1416
  /*
1200
1417
  <file>
@@ -1345,11 +1562,49 @@ BaseGridEditService.ctorParameters = () => [
1345
1562
  </file>
1346
1563
  */
1347
1564
  const consts = {
1348
- billingApiPath: "api/billing",
1565
+ billingApiPath: 'api/billing',
1349
1566
  // Notifications API
1350
1567
  notificationsApiPath: 'api/notifications',
1351
1568
  };
1352
1569
 
1570
+ /*
1571
+ <file>
1572
+ Project:
1573
+ @osovitny/anatoly
1574
+
1575
+ Authors:
1576
+ Vadim Osovitny
1577
+ Anatoly Osovitny
1578
+
1579
+ Created:
1580
+ 30 April 2020
1581
+
1582
+ Version:
1583
+ 1.0
1584
+
1585
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1586
+ </file>
1587
+ */
1588
+ class NotificationsApiService extends BaseApiService {
1589
+ constructor(http) {
1590
+ super(http);
1591
+ this.http = http;
1592
+ this.baseUrl = consts.notificationsApiPath;
1593
+ }
1594
+ retrieveNotifications() {
1595
+ return this.get('retrieveNotifications');
1596
+ }
1597
+ }
1598
+ NotificationsApiService.ɵprov = ɵɵdefineInjectable({ factory: function NotificationsApiService_Factory() { return new NotificationsApiService(ɵɵinject(HttpClient)); }, token: NotificationsApiService, providedIn: "root" });
1599
+ NotificationsApiService.decorators = [
1600
+ { type: Injectable, args: [{
1601
+ providedIn: 'root'
1602
+ },] }
1603
+ ];
1604
+ NotificationsApiService.ctorParameters = () => [
1605
+ { type: HttpClient }
1606
+ ];
1607
+
1353
1608
  /*
1354
1609
  <file>
1355
1610
  Project:
@@ -1446,25 +1701,6 @@ AnatolyDataModule.ctorParameters = () => [
1446
1701
  { type: AnatolyDataModule, decorators: [{ type: Optional }, { type: SkipSelf }] }
1447
1702
  ];
1448
1703
 
1449
- /*
1450
- <file>
1451
- Project:
1452
- @osovitny/anatoly
1453
-
1454
- Authors:
1455
- Vadim Osovitny
1456
- Anatoly Osovitny
1457
-
1458
- Created:
1459
- 4 Mar 2020
1460
-
1461
- Version:
1462
- 1.0
1463
-
1464
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1465
- </file>
1466
- */
1467
-
1468
1704
  /*
1469
1705
  <file>
1470
1706
  Project:
@@ -1490,7 +1726,7 @@ class BuyAccessButtonComponent {
1490
1726
  this.contextUpdated = false;
1491
1727
  this.isUserSignedIn = false;
1492
1728
  this.currentPlan = 0;
1493
- this.currentPlanTitle = "";
1729
+ this.currentPlanTitle = '';
1494
1730
  }
1495
1731
  ngOnInit() {
1496
1732
  if (!this.appcontext.isUserSignedIn()) {
@@ -1509,9 +1745,9 @@ class BuyAccessButtonComponent {
1509
1745
  onBuyPlan() {
1510
1746
  const text = `Requested plan: ${this.plantitle} `;
1511
1747
  const that = this;
1512
- Alerts.AreYouSure(text, "Buying access", "Confirm change", "Cancel", () => {
1748
+ Alerts.areYouSure(text, 'Buying access', 'Confirm change', 'Cancel', () => {
1513
1749
  that.api.buyAccess(that.plan, () => {
1514
- Alerts.Success("Access Granted", null, () => {
1750
+ Alerts.success('Access Granted', null, null, () => {
1515
1751
  window.location.reload();
1516
1752
  });
1517
1753
  });
@@ -1519,159 +1755,18 @@ class BuyAccessButtonComponent {
1519
1755
  }
1520
1756
  }
1521
1757
  BuyAccessButtonComponent.decorators = [
1522
- { type: Component, args: [{
1523
- selector: "anatoly-buyaccess-button",
1524
- 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"
1525
- },] }
1526
- ];
1527
- BuyAccessButtonComponent.ctorParameters = () => [
1528
- { type: AppContextService },
1529
- { type: BillingApiService }
1530
- ];
1531
- BuyAccessButtonComponent.propDecorators = {
1532
- plan: [{ type: Input }],
1533
- plantitle: [{ type: Input }]
1534
- };
1535
-
1536
- /*
1537
- <file>
1538
- Project:
1539
- @osovitny/anatoly
1540
-
1541
- Authors:
1542
- Vadim Osovitny
1543
- Anatoly Osovitny
1544
-
1545
- Created:
1546
- 1 Jun 2018
1547
-
1548
- Version:
1549
- 1.0
1550
-
1551
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1552
- </file>
1553
- */
1554
- class SubscribePlanButtonComponent {
1555
- constructor(appcontext) {
1556
- this.appcontext = appcontext;
1557
- this.contextUpdated = false;
1558
- this.isUserSignedIn = false;
1559
- this.currentPlan = 0;
1560
- this.currentPlanTitle = "";
1561
- this.requestedPlan = 0;
1562
- this.requestedPlanTitle = "";
1563
- }
1564
- ngOnInit() {
1565
- if (!this.appcontext.isUserSignedIn()) {
1566
- this.contextUpdated = true;
1567
- return;
1568
- }
1569
- this.appcontext.getCurrent((current) => {
1570
- this.isUserSignedIn = current.isUserSignedIn;
1571
- if (this.isUserSignedIn) {
1572
- this.currentPlan = current.account.billingPlan;
1573
- this.currentPlanTitle = current.account.billingPlanAsString;
1574
- this.requestedPlan = current.account.requestedBillingPlan;
1575
- this.requestedPlanTitle = current.account.requestedBillingPlanAsString;
1576
- }
1577
- this.contextUpdated = true;
1578
- });
1579
- }
1580
- }
1581
- SubscribePlanButtonComponent.decorators = [
1582
- { type: Component, args: [{
1583
- selector: "anatoly-subscribe-plan-button",
1584
- 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"
1585
- },] }
1586
- ];
1587
- SubscribePlanButtonComponent.ctorParameters = () => [
1588
- { type: AppContextService }
1589
- ];
1590
- SubscribePlanButtonComponent.propDecorators = {
1591
- plan: [{ type: Input }],
1592
- plantitle: [{ type: Input }]
1593
- };
1594
-
1595
- /*
1596
- <file>
1597
- Project:
1598
- @osovitny/anatoly
1599
-
1600
- Authors:
1601
- Vadim Osovitny
1602
- Anatoly Osovitny
1603
-
1604
- Created:
1605
- 12 Nov 2017
1606
-
1607
- Version:
1608
- 1.0
1609
-
1610
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1611
- </file>
1612
- */
1613
- // Services
1614
- class UpgradePlanButtonComponent {
1615
- constructor(api) {
1616
- this.api = api;
1617
- }
1618
- onUpgradePlan() {
1619
- const text = `Current plan: ${this.currentplantitle} New plan: ${this.requestedplantitle}`;
1620
- const that = this;
1621
- Alerts.AreYouSure(text, "Change billing plan", "Confirm change", "Cancel", () => {
1622
- that.api.requestNewSubscription(that.requestedplan, () => {
1623
- Alerts.Success("Your request for changing plan has been sent.", null, () => {
1624
- window.location.reload();
1625
- });
1626
- });
1627
- });
1628
- }
1629
- }
1630
- UpgradePlanButtonComponent.decorators = [
1631
- { type: Component, args: [{
1632
- selector: "anatoly-upgrade-plan-button",
1633
- template: "<button class=\"btn btn-block btn-primary\" (click)=\"onUpgradePlan()\">\r\n Upgrade\r\n</button>\r\n"
1634
- },] }
1635
- ];
1636
- UpgradePlanButtonComponent.ctorParameters = () => [
1637
- { type: BillingApiService }
1638
- ];
1639
- UpgradePlanButtonComponent.propDecorators = {
1640
- currentplantitle: [{ type: Input }],
1641
- requestedplan: [{ type: Input }],
1642
- requestedplantitle: [{ type: Input }]
1643
- };
1644
-
1645
- /*
1646
- <file>
1647
- Project:
1648
- @osovitny/anatoly
1649
-
1650
- Authors:
1651
- Vadim Osovitny
1652
- Anatoly Osovitny
1653
-
1654
- Created:
1655
- 4 Jul 2018
1656
-
1657
- Version:
1658
- 1.0
1659
-
1660
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1661
- </file>
1662
- */
1663
- class SignInButtonComponent {
1664
- constructor() { }
1665
- }
1666
- SignInButtonComponent.decorators = [
1667
- { type: Component, args: [{
1668
- selector: "anatoly-signin-button",
1669
- template: "<a href=\"identity/signIn\" class=\"{{classbtn}}\">Sign In</a>\r\n"
1758
+ { type: Component, args: [{
1759
+ selector: 'anatoly-buyaccess-button',
1760
+ 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"
1670
1761
  },] }
1671
1762
  ];
1672
- SignInButtonComponent.ctorParameters = () => [];
1673
- SignInButtonComponent.propDecorators = {
1674
- classbtn: [{ type: Input }]
1763
+ BuyAccessButtonComponent.ctorParameters = () => [
1764
+ { type: AppContextService },
1765
+ { type: BillingApiService }
1766
+ ];
1767
+ BuyAccessButtonComponent.propDecorators = {
1768
+ plan: [{ type: Input }],
1769
+ plantitle: [{ type: Input }]
1675
1770
  };
1676
1771
 
1677
1772
  /*
@@ -1684,7 +1779,7 @@ SignInButtonComponent.propDecorators = {
1684
1779
  Anatoly Osovitny
1685
1780
 
1686
1781
  Created:
1687
- 4 Jul 2018
1782
+ 1 Jun 2018
1688
1783
 
1689
1784
  Version:
1690
1785
  1.0
@@ -1692,18 +1787,45 @@ SignInButtonComponent.propDecorators = {
1692
1787
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1693
1788
  </file>
1694
1789
  */
1695
- class SignOutButtonComponent {
1696
- constructor() { }
1790
+ class SubscribePlanButtonComponent {
1791
+ constructor(appcontext) {
1792
+ this.appcontext = appcontext;
1793
+ this.contextUpdated = false;
1794
+ this.isUserSignedIn = false;
1795
+ this.currentPlan = 0;
1796
+ this.currentPlanTitle = "";
1797
+ this.requestedPlan = 0;
1798
+ this.requestedPlanTitle = "";
1799
+ }
1800
+ ngOnInit() {
1801
+ if (!this.appcontext.isUserSignedIn()) {
1802
+ this.contextUpdated = true;
1803
+ return;
1804
+ }
1805
+ this.appcontext.getCurrent((current) => {
1806
+ this.isUserSignedIn = current.isUserSignedIn;
1807
+ if (this.isUserSignedIn) {
1808
+ this.currentPlan = current.account.billingPlan;
1809
+ this.currentPlanTitle = current.account.billingPlanAsString;
1810
+ this.requestedPlan = current.account.requestedBillingPlan;
1811
+ this.requestedPlanTitle = current.account.requestedBillingPlanAsString;
1812
+ }
1813
+ this.contextUpdated = true;
1814
+ });
1815
+ }
1697
1816
  }
1698
- SignOutButtonComponent.decorators = [
1817
+ SubscribePlanButtonComponent.decorators = [
1699
1818
  { type: Component, args: [{
1700
- selector: "anatoly-signout-button",
1701
- template: "<a href=\"identity/signOut\" class=\"{{classbtn}}\">Sign Out</a>\r\n"
1819
+ selector: "anatoly-subscribe-plan-button",
1820
+ 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"
1702
1821
  },] }
1703
1822
  ];
1704
- SignOutButtonComponent.ctorParameters = () => [];
1705
- SignOutButtonComponent.propDecorators = {
1706
- classbtn: [{ type: Input }]
1823
+ SubscribePlanButtonComponent.ctorParameters = () => [
1824
+ { type: AppContextService }
1825
+ ];
1826
+ SubscribePlanButtonComponent.propDecorators = {
1827
+ plan: [{ type: Input }],
1828
+ plantitle: [{ type: Input }]
1707
1829
  };
1708
1830
 
1709
1831
  /*
@@ -1716,7 +1838,7 @@ SignOutButtonComponent.propDecorators = {
1716
1838
  Anatoly Osovitny
1717
1839
 
1718
1840
  Created:
1719
- 4 Jul 2018
1841
+ 12 Nov 2017
1720
1842
 
1721
1843
  Version:
1722
1844
  1.0
@@ -1724,16 +1846,36 @@ SignOutButtonComponent.propDecorators = {
1724
1846
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1725
1847
  </file>
1726
1848
  */
1727
- class SignUpButtonComponent {
1849
+ // Services
1850
+ class UpgradePlanButtonComponent {
1851
+ constructor(api) {
1852
+ this.api = api;
1853
+ }
1854
+ onUpgradePlan() {
1855
+ const text = `Current plan: ${this.currentplantitle} New plan: ${this.requestedplantitle}`;
1856
+ const that = this;
1857
+ Alerts.areYouSure(text, 'Change billing plan', 'Confirm change', 'Cancel', () => {
1858
+ that.api.requestNewSubscription(that.requestedplan, () => {
1859
+ Alerts.success('Your request for changing plan has been sent.', null, null, () => {
1860
+ window.location.reload();
1861
+ });
1862
+ });
1863
+ });
1864
+ }
1728
1865
  }
1729
- SignUpButtonComponent.decorators = [
1866
+ UpgradePlanButtonComponent.decorators = [
1730
1867
  { type: Component, args: [{
1731
- selector: "anatoly-signup-button",
1732
- template: "<a href=\"identity/signup\" class=\"{{classbtn}}\">Sign Up</a>\r\n"
1868
+ selector: 'anatoly-upgrade-plan-button',
1869
+ template: "<button class=\"btn btn-block btn-primary\" (click)=\"onUpgradePlan()\">\r\n Upgrade\r\n</button>\r\n"
1733
1870
  },] }
1734
1871
  ];
1735
- SignUpButtonComponent.propDecorators = {
1736
- classbtn: [{ type: Input }]
1872
+ UpgradePlanButtonComponent.ctorParameters = () => [
1873
+ { type: BillingApiService }
1874
+ ];
1875
+ UpgradePlanButtonComponent.propDecorators = {
1876
+ currentplantitle: [{ type: Input }],
1877
+ requestedplan: [{ type: Input }],
1878
+ requestedplantitle: [{ type: Input }]
1737
1879
  };
1738
1880
 
1739
1881
  /*
@@ -1771,105 +1913,6 @@ ContentHeaderComponent.propDecorators = {
1771
1913
  title: [{ type: Input }]
1772
1914
  };
1773
1915
 
1774
- /*
1775
- <file>
1776
- Project:
1777
- @osovitny/anatoly
1778
-
1779
- Authors:
1780
- Vadim Osovitny
1781
- Anatoly Osovitny
1782
-
1783
- Created:
1784
- 28 Aug 2018
1785
-
1786
- Version:
1787
- 1.0
1788
-
1789
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1790
- </file>
1791
- */
1792
- class BaseComponent {
1793
- getQSId() {
1794
- var id = Utils.getValueByNameInQS("id");
1795
- if (typeof id === 'undefined' || id == '')
1796
- return null;
1797
- return id;
1798
- }
1799
- }
1800
-
1801
- /*
1802
- <file>
1803
- Project:
1804
- @osovitny/anatoly
1805
-
1806
- Authors:
1807
- Vadim Osovitny
1808
- Anatoly Osovitny
1809
-
1810
- Created:
1811
- 20 Nov 2017
1812
-
1813
- Version:
1814
- 1.0
1815
-
1816
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1817
- </file>
1818
- */
1819
- class BaseEditComponent extends BaseComponent {
1820
- constructor() {
1821
- super();
1822
- this.formSubmitted = false;
1823
- }
1824
- isActionAdding() {
1825
- var id = Utils.getValueByNameInQS("id");
1826
- if (typeof id === 'undefined' || id == '')
1827
- return true;
1828
- return false;
1829
- }
1830
- getEntityId() {
1831
- return this.getQSId();
1832
- }
1833
- isControlValid(name, formGroup = null) {
1834
- return !this.isControlInvalid(name, formGroup);
1835
- }
1836
- isControlInvalid(name, formGroup = null) {
1837
- if (typeof name === 'undefined' || name == '') {
1838
- return false;
1839
- }
1840
- let fg = (formGroup) ? formGroup : this.formGroup;
1841
- if (!fg) {
1842
- return false;
1843
- }
1844
- if (fg.get(name)) {
1845
- return (this.formSubmitted && fg.get(name).invalid) ||
1846
- (fg.get(name).touched && fg.get(name).invalid);
1847
- }
1848
- return false;
1849
- }
1850
- //FormGroup functions
1851
- getFormValue(name, formGroup = null) {
1852
- let fg = (formGroup) ? formGroup : this.formGroup;
1853
- return fg.controls[name].value;
1854
- }
1855
- setFormValue(name, value, formGroup = null) {
1856
- let fg = (formGroup) ? formGroup : this.formGroup;
1857
- fg.controls[name].setValue(value);
1858
- }
1859
- getFormGroupValue(groupName, name, formGroup = null) {
1860
- let fg = (formGroup) ? formGroup : this.formGroup;
1861
- return fg.controls[groupName].get(name).value;
1862
- }
1863
- setFormGroupValue(groupName, name, value, formGroup = null) {
1864
- let fg = (formGroup) ? formGroup : this.formGroup;
1865
- fg.controls[groupName].get(name).setValue(value);
1866
- }
1867
- }
1868
- BaseEditComponent.propDecorators = {
1869
- formGroup: [{ type: Input }],
1870
- formSubmitted: [{ type: Input }]
1871
- };
1872
-
1873
1916
  /*
1874
1917
  <file>
1875
1918
  Project:
@@ -1959,6 +2002,105 @@ const DefaultEditorOptions = {
1959
2002
  imageUploadParams: { uploadType: "", uploadParentId: "" },
1960
2003
  };
1961
2004
 
2005
+ /*
2006
+ <file>
2007
+ Project:
2008
+ @osovitny/anatoly
2009
+
2010
+ Authors:
2011
+ Vadim Osovitny
2012
+ Anatoly Osovitny
2013
+
2014
+ Created:
2015
+ 28 Aug 2018
2016
+
2017
+ Version:
2018
+ 1.0
2019
+
2020
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2021
+ </file>
2022
+ */
2023
+ class BaseComponent {
2024
+ getQSId() {
2025
+ var id = Utils.getValueByNameInQS("id");
2026
+ if (typeof id === 'undefined' || id == '')
2027
+ return null;
2028
+ return id;
2029
+ }
2030
+ }
2031
+
2032
+ /*
2033
+ <file>
2034
+ Project:
2035
+ @osovitny/anatoly
2036
+
2037
+ Authors:
2038
+ Vadim Osovitny
2039
+ Anatoly Osovitny
2040
+
2041
+ Created:
2042
+ 20 Nov 2017
2043
+
2044
+ Version:
2045
+ 1.0
2046
+
2047
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2048
+ </file>
2049
+ */
2050
+ class BaseEditComponent extends BaseComponent {
2051
+ constructor() {
2052
+ super();
2053
+ this.formSubmitted = false;
2054
+ }
2055
+ isActionAdding() {
2056
+ var id = Utils.getValueByNameInQS("id");
2057
+ if (typeof id === 'undefined' || id == '')
2058
+ return true;
2059
+ return false;
2060
+ }
2061
+ getEntityId() {
2062
+ return this.getQSId();
2063
+ }
2064
+ isControlValid(name, formGroup = null) {
2065
+ return !this.isControlInvalid(name, formGroup);
2066
+ }
2067
+ isControlInvalid(name, formGroup = null) {
2068
+ if (typeof name === 'undefined' || name == '') {
2069
+ return false;
2070
+ }
2071
+ let fg = (formGroup) ? formGroup : this.formGroup;
2072
+ if (!fg) {
2073
+ return false;
2074
+ }
2075
+ if (fg.get(name)) {
2076
+ return (this.formSubmitted && fg.get(name).invalid) ||
2077
+ (fg.get(name).touched && fg.get(name).invalid);
2078
+ }
2079
+ return false;
2080
+ }
2081
+ //FormGroup functions
2082
+ getFormValue(name, formGroup = null) {
2083
+ let fg = (formGroup) ? formGroup : this.formGroup;
2084
+ return fg.controls[name].value;
2085
+ }
2086
+ setFormValue(name, value, formGroup = null) {
2087
+ let fg = (formGroup) ? formGroup : this.formGroup;
2088
+ fg.controls[name].setValue(value);
2089
+ }
2090
+ getFormGroupValue(groupName, name, formGroup = null) {
2091
+ let fg = (formGroup) ? formGroup : this.formGroup;
2092
+ return fg.controls[groupName].get(name).value;
2093
+ }
2094
+ setFormGroupValue(groupName, name, value, formGroup = null) {
2095
+ let fg = (formGroup) ? formGroup : this.formGroup;
2096
+ fg.controls[groupName].get(name).setValue(value);
2097
+ }
2098
+ }
2099
+ BaseEditComponent.propDecorators = {
2100
+ formGroup: [{ type: Input }],
2101
+ formSubmitted: [{ type: Input }]
2102
+ };
2103
+
1962
2104
  /*
1963
2105
  <file>
1964
2106
  Project:
@@ -1982,17 +2124,17 @@ class BaseHtmlEditorComponent extends BaseEditComponent {
1982
2124
  super();
1983
2125
  this.froalaEditorInitialized = false;
1984
2126
  this.afterInitializedActions = [];
1985
- //Inputs
1986
- this.editorLabelText = "Html";
2127
+ // Inputs
2128
+ this.editorLabelText = 'Html';
1987
2129
  this.editorOptions = {};
1988
2130
  }
1989
2131
  ngOnInit() {
1990
2132
  let opt = this.editorOptions;
1991
- if (typeof this.editorOptions == "string") {
2133
+ if (typeof this.editorOptions == 'string') {
1992
2134
  opt = JSON.parse(this.editorOptions);
1993
2135
  }
1994
2136
  let newOptions = $.extend({}, DefaultEditorOptions, opt);
1995
- let key = AppCoreSettings.froalaEditorKey;
2137
+ const key = AppCoreSettings.froalaEditorKey;
1996
2138
  if (key) {
1997
2139
  newOptions = $.extend({}, newOptions, JSON.parse('{ "key": "' + key + '" }'));
1998
2140
  }
@@ -2002,18 +2144,18 @@ class BaseHtmlEditorComponent extends BaseEditComponent {
2002
2144
  this.options = newOptions;
2003
2145
  }
2004
2146
  ngAfterViewInit() {
2005
- let that = this;
2147
+ const that = this;
2006
2148
  setTimeout(function () {
2007
2149
  that.froalaEditorInitialized = true;
2008
2150
  that.onInitialized();
2009
2151
  }, 300);
2010
2152
  }
2011
2153
  onInitialized() {
2012
- let actions = this.afterInitializedActions;
2013
- //Clear actions
2154
+ const actions = this.afterInitializedActions;
2155
+ // Clear actions
2014
2156
  this.afterInitializedActions = [];
2015
2157
  if (actions) {
2016
- for (var i = 0; i < actions.length; i++) {
2158
+ for (let i = 0; i < actions.length; i++) {
2017
2159
  actions[i]();
2018
2160
  }
2019
2161
  }
@@ -2023,9 +2165,9 @@ class BaseHtmlEditorComponent extends BaseEditComponent {
2023
2165
  return this.froalaEditor.getEditor();
2024
2166
  return null;
2025
2167
  }
2026
- //Public Funcs
2168
+ // Public Funcs
2027
2169
  doAfterInitialized(action) {
2028
- let that = this;
2170
+ const that = this;
2029
2171
  if (!this.froalaEditorInitialized) {
2030
2172
  this.afterInitializedActions.push(() => {
2031
2173
  action(that);
@@ -2041,8 +2183,8 @@ class BaseHtmlEditorComponent extends BaseEditComponent {
2041
2183
  }
2042
2184
  setUploadParams(uploadType, uploadParentId) {
2043
2185
  this.doAfterInitialized(function (that) {
2044
- var editor = that.getEditor();
2045
- if (typeof editor == "undefined" || editor == null) {
2186
+ const editor = that.getEditor();
2187
+ if (typeof editor == 'undefined' || editor == null) {
2046
2188
  return;
2047
2189
  }
2048
2190
  editor.opts.imageUploadParams.uploadType = uploadType;
@@ -2055,6 +2197,46 @@ BaseHtmlEditorComponent.propDecorators = {
2055
2197
  editorOptions: [{ type: Input }]
2056
2198
  };
2057
2199
 
2200
+ /*
2201
+ <file>
2202
+ Project:
2203
+ @osovitny/anatoly
2204
+
2205
+ Authors:
2206
+ Vadim Osovitny
2207
+ Anatoly Osovitny
2208
+
2209
+ Created:
2210
+ 12 Dec 2017
2211
+
2212
+ Version:
2213
+ 1.0
2214
+
2215
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2216
+ </file>
2217
+ */
2218
+ class FormsHtmlEditorComponent extends BaseHtmlEditorComponent {
2219
+ constructor() {
2220
+ super();
2221
+ this.editorFormKey = "html";
2222
+ }
2223
+ setFormValueAfterInitialized(name, value) {
2224
+ this.doAfterInitialized(function (that) {
2225
+ that.setFormValue(name, value);
2226
+ });
2227
+ }
2228
+ }
2229
+ FormsHtmlEditorComponent.decorators = [
2230
+ { type: Component, args: [{
2231
+ selector: "anatoly-forms-html-editor",
2232
+ 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"
2233
+ },] }
2234
+ ];
2235
+ FormsHtmlEditorComponent.ctorParameters = () => [];
2236
+ FormsHtmlEditorComponent.propDecorators = {
2237
+ editorFormKey: [{ type: Input }]
2238
+ };
2239
+
2058
2240
  /*
2059
2241
  <file>
2060
2242
  Project:
@@ -2112,7 +2294,7 @@ HtmlEditorComponent.ctorParameters = () => [];
2112
2294
  Anatoly Osovitny
2113
2295
 
2114
2296
  Created:
2115
- 12 Dec 2017
2297
+ 4 Jul 2018
2116
2298
 
2117
2299
  Version:
2118
2300
  1.0
@@ -2120,26 +2302,18 @@ HtmlEditorComponent.ctorParameters = () => [];
2120
2302
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2121
2303
  </file>
2122
2304
  */
2123
- class FormsHtmlEditorComponent extends BaseHtmlEditorComponent {
2124
- constructor() {
2125
- super();
2126
- this.editorFormKey = "html";
2127
- }
2128
- setFormValueAfterInitialized(name, value) {
2129
- this.doAfterInitialized(function (that) {
2130
- that.setFormValue(name, value);
2131
- });
2132
- }
2305
+ class SignInButtonComponent {
2306
+ constructor() { }
2133
2307
  }
2134
- FormsHtmlEditorComponent.decorators = [
2308
+ SignInButtonComponent.decorators = [
2135
2309
  { type: Component, args: [{
2136
- selector: "anatoly-forms-html-editor",
2137
- 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"
2310
+ selector: "anatoly-signin-button",
2311
+ template: "<a href=\"identity/signIn\" class=\"{{classbtn}}\">Sign In</a>\r\n"
2138
2312
  },] }
2139
2313
  ];
2140
- FormsHtmlEditorComponent.ctorParameters = () => [];
2141
- FormsHtmlEditorComponent.propDecorators = {
2142
- editorFormKey: [{ type: Input }]
2314
+ SignInButtonComponent.ctorParameters = () => [];
2315
+ SignInButtonComponent.propDecorators = {
2316
+ classbtn: [{ type: Input }]
2143
2317
  };
2144
2318
 
2145
2319
  /*
@@ -2152,7 +2326,7 @@ FormsHtmlEditorComponent.propDecorators = {
2152
2326
  Anatoly Osovitny
2153
2327
 
2154
2328
  Created:
2155
- 8 Dec 2017
2329
+ 4 Jul 2018
2156
2330
 
2157
2331
  Version:
2158
2332
  1.0
@@ -2160,102 +2334,19 @@ FormsHtmlEditorComponent.propDecorators = {
2160
2334
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2161
2335
  </file>
2162
2336
  */
2163
- class ValidationSummaryComponent extends BaseEditComponent {
2164
- constructor() {
2165
- super();
2166
- }
2167
- getFormValidationMessages() {
2168
- let messages = [];
2169
- Object.keys(this.formGroup.controls).forEach(k => {
2170
- var control = this.formGroup.controls[k];
2171
- if (control.controls != null) {
2172
- Object.keys(control.controls).forEach(k => {
2173
- var child = control.controls[k];
2174
- this.getValidationMessages(child, this.getControlName(child, k)).forEach(m => messages.push(m));
2175
- });
2176
- }
2177
- else {
2178
- this.getValidationMessages(control, this.getControlName(control, k)).forEach(m => messages.push(m));
2179
- }
2180
- });
2181
- return messages;
2182
- }
2183
- getValidationMessages(state, thingName) {
2184
- let thing = state.path || thingName;
2185
- let messages = [];
2186
- if (state.errors) {
2187
- for (let errorName in state.errors) {
2188
- if (state.errors.hasOwnProperty(errorName)) {
2189
- switch (errorName) {
2190
- case 'required':
2191
- messages.push(`${thing} is required`);
2192
- break;
2193
- case 'minlength':
2194
- messages.push(`${thing} must be at least ${state.errors["minlength"].requiredLength} characters`);
2195
- break;
2196
- case 'pattern':
2197
- messages.push(`${thing} contains illegal characters`);
2198
- break;
2199
- case 'format':
2200
- messages.push(`${thing} format mismatch`);
2201
- break;
2202
- case 'maxlength':
2203
- messages.push(`${thing} must have maximum ${state.errors["maxlength"].requiredLength} characters`);
2204
- break;
2205
- case 'specialcharacters':
2206
- messages.push(`${thing} contains special characters`);
2207
- break;
2208
- }
2209
- }
2210
- }
2211
- }
2212
- return messages;
2213
- }
2214
- /**
2215
- * Get Control Name
2216
- * @param control
2217
- * @param thingName
2218
- */
2219
- getControlName(control, thingName) {
2220
- let value = this.getControlTitle(control);
2221
- return value ? value : thingName;
2222
- }
2223
- /**
2224
- * Retrieve tilte of control
2225
- * @param control
2226
- */
2227
- getControlTitle(control) {
2228
- if (control === null || control === void 0 ? void 0 : control.nativeElement) {
2229
- let controlTitle = this.getTitleAttribute(control.nativeElement);
2230
- if (controlTitle) {
2231
- return controlTitle;
2232
- }
2233
- }
2234
- return undefined;
2235
- }
2236
- /**
2237
- * Return title attribute of form control
2238
- */
2239
- getTitleAttribute(nativeElement) {
2240
- var _a, _b, _c, _d, _e, _f;
2241
- let title;
2242
- switch (nativeElement.tagName) {
2243
- // For Kendo time and date picker element title is assigned to the 4th child control.
2244
- case "KENDO-TIMEPICKER":
2245
- case "KENDO-DATEPICKER":
2246
- title = (_d = (_c = (_b = (_a = nativeElement.children[0]) === null || _a === void 0 ? void 0 : _a.children[0]) === null || _b === void 0 ? void 0 : _b.children[0]) === null || _c === void 0 ? void 0 : _c.children[0]) === null || _d === void 0 ? void 0 : _d.getAttribute('title');
2247
- break;
2248
- // For Kendo numaric element title is assigned to the 2nd child control.
2249
- case "KENDO-NUMERICTEXTBOX":
2250
- title = (_f = (_e = nativeElement.children[0]) === null || _e === void 0 ? void 0 : _e.children[0]) === null || _f === void 0 ? void 0 : _f.getAttribute('title');
2251
- break;
2252
- default:
2253
- title = nativeElement.getAttribute('title');
2254
- break;
2255
- }
2256
- return title;
2257
- }
2258
- }
2337
+ class SignOutButtonComponent {
2338
+ constructor() { }
2339
+ }
2340
+ SignOutButtonComponent.decorators = [
2341
+ { type: Component, args: [{
2342
+ selector: "anatoly-signout-button",
2343
+ template: "<a href=\"identity/signOut\" class=\"{{classbtn}}\">Sign Out</a>\r\n"
2344
+ },] }
2345
+ ];
2346
+ SignOutButtonComponent.ctorParameters = () => [];
2347
+ SignOutButtonComponent.propDecorators = {
2348
+ classbtn: [{ type: Input }]
2349
+ };
2259
2350
 
2260
2351
  /*
2261
2352
  <file>
@@ -2267,7 +2358,7 @@ class ValidationSummaryComponent extends BaseEditComponent {
2267
2358
  Anatoly Osovitny
2268
2359
 
2269
2360
  Created:
2270
- 7 Dec 2017
2361
+ 4 Jul 2018
2271
2362
 
2272
2363
  Version:
2273
2364
  1.0
@@ -2275,48 +2366,62 @@ class ValidationSummaryComponent extends BaseEditComponent {
2275
2366
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2276
2367
  </file>
2277
2368
  */
2278
- class FormValidationSummaryComponent extends ValidationSummaryComponent {
2279
- constructor() {
2280
- super();
2281
- this.visible = false;
2282
- this.customerrors = [];
2283
- /*
2284
- 0 - only FormValidation messages
2285
- 1 - only Custom messages
2286
- 2 - all
2287
- */
2288
- this.viewtype = 0;
2369
+ class SignUpButtonComponent {
2370
+ }
2371
+ SignUpButtonComponent.decorators = [
2372
+ { type: Component, args: [{
2373
+ selector: "anatoly-signup-button",
2374
+ template: "<a href=\"identity/signup\" class=\"{{classbtn}}\">Sign Up</a>\r\n"
2375
+ },] }
2376
+ ];
2377
+ SignUpButtonComponent.propDecorators = {
2378
+ classbtn: [{ type: Input }]
2379
+ };
2380
+
2381
+ /*
2382
+ <file>
2383
+ Project:
2384
+ @osovitny/anatoly
2385
+
2386
+ Authors:
2387
+ Vadim Osovitny
2388
+ Anatoly Osovitny
2389
+
2390
+ Created:
2391
+ 9 May 2020
2392
+
2393
+ Version:
2394
+ 1.0
2395
+
2396
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2397
+ </file>
2398
+ */
2399
+ class LoadingComponent {
2400
+ constructor(loadingService) {
2401
+ this.loadingService = loadingService;
2402
+ // Private
2403
+ this.subs = new Subs();
2404
+ // Public
2405
+ this.show = false;
2289
2406
  }
2290
- getErrors() {
2291
- if (this.viewtype == 1) {
2292
- return this.customerrors;
2293
- }
2294
- let formValidationMessages = this.getFormValidationMessages();
2295
- if (this.viewtype == 0) {
2296
- return formValidationMessages;
2297
- }
2298
- var messages = [];
2299
- if (formValidationMessages.length > 0) {
2300
- messages.push(...formValidationMessages);
2301
- }
2302
- if (this.customerrors.length > 0) {
2303
- messages.push(...this.customerrors);
2304
- }
2305
- return messages;
2407
+ ngOnInit() {
2408
+ this.subs.sink = this.loadingService.subscribe((state) => {
2409
+ this.show = state;
2410
+ });
2411
+ }
2412
+ ngOnDestroy() {
2413
+ this.subs.unsubscribe();
2306
2414
  }
2307
2415
  }
2308
- FormValidationSummaryComponent.decorators = [
2416
+ LoadingComponent.decorators = [
2309
2417
  { type: Component, args: [{
2310
- selector: "anatoly-form-validation-summary",
2311
- template: "<div class=\"callout callout-danger\" *ngIf=\"visible\">\r\n <h6 class=\"box-title\">There are problems with the form</h6>\r\n <ul>\r\n <li *ngFor=\"let error of getErrors()\"><span>{{error}}</span></li>\r\n </ul>\r\n</div>\r\n\r\n"
2418
+ selector: 'anatoly-loading',
2419
+ template: "<div *ngIf=\"show\">\r\n <span id=\"pnlLoading\" class=\"k-icon k-i-loading\"></span>\r\n</div>\r\n"
2312
2420
  },] }
2313
2421
  ];
2314
- FormValidationSummaryComponent.ctorParameters = () => [];
2315
- FormValidationSummaryComponent.propDecorators = {
2316
- visible: [{ type: Input }],
2317
- customerrors: [{ type: Input }],
2318
- viewtype: [{ type: Input }]
2319
- };
2422
+ LoadingComponent.ctorParameters = () => [
2423
+ { type: LoadingService }
2424
+ ];
2320
2425
 
2321
2426
  /*
2322
2427
  <file>
@@ -2328,7 +2433,7 @@ FormValidationSummaryComponent.propDecorators = {
2328
2433
  Anatoly Osovitny
2329
2434
 
2330
2435
  Created:
2331
- 6 Dec 2017
2436
+ 16 May 2020
2332
2437
 
2333
2438
  Version:
2334
2439
  1.0
@@ -2336,21 +2441,55 @@ FormValidationSummaryComponent.propDecorators = {
2336
2441
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2337
2442
  </file>
2338
2443
  */
2339
- class ItemValidationSummaryComponent extends ValidationSummaryComponent {
2340
- constructor() {
2341
- super();
2444
+ const SpinnerSpinKit = {
2445
+ spinnerLine: 'spinner-line-material',
2446
+ // ToDo
2447
+ ChasingDots: 'spinner-chasing-dots',
2448
+ CubeGrid: 'spinner-cube-grid',
2449
+ DoubleBounce: 'spinner-double-bounce',
2450
+ RotatingPlane: 'spinner-rotationg-plane',
2451
+ SpinnerPulse: 'spinner-spinner-pulse',
2452
+ ThreeBounce: 'spinner-three-bounce',
2453
+ WanderingCubes: 'spinner-wandering-cubes',
2454
+ Wave: 'spinner-wave'
2455
+ };
2456
+ class SpinnerComponent {
2457
+ constructor(router, document) {
2458
+ this.router = router;
2459
+ this.document = document;
2460
+ this.isSpinnerVisible = true;
2461
+ this.spinnerSpinKit = SpinnerSpinKit;
2462
+ this.backgroundColor = '#007CB0';
2463
+ this.spinner = SpinnerSpinKit.spinnerLine;
2464
+ this.router.events.subscribe(event => {
2465
+ if (event instanceof NavigationStart) {
2466
+ this.isSpinnerVisible = true;
2467
+ }
2468
+ else if (event instanceof NavigationEnd || event instanceof NavigationCancel || event instanceof NavigationError) {
2469
+ this.isSpinnerVisible = false;
2470
+ }
2471
+ }, () => {
2472
+ this.isSpinnerVisible = false;
2473
+ });
2474
+ }
2475
+ ngOnDestroy() {
2476
+ this.isSpinnerVisible = false;
2342
2477
  }
2343
2478
  }
2344
- ItemValidationSummaryComponent.decorators = [
2479
+ SpinnerComponent.decorators = [
2345
2480
  { type: Component, args: [{
2346
- selector: "anatoly-item-validation-summary",
2347
- template: "<ul class=\"list-unstyled\" *ngIf=\"isControlInvalid(controlName)\">\r\n <li *ngFor=\"let error of getValidationMessages(formGroup.get(controlName), controlTitle)\">\r\n <span class=\"help-block\">{{ error }}</span>\r\n </li>\r\n</ul>\r\n\r\n"
2481
+ selector: 'spinner',
2482
+ 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",
2483
+ encapsulation: ViewEncapsulation.None
2348
2484
  },] }
2349
2485
  ];
2350
- ItemValidationSummaryComponent.ctorParameters = () => [];
2351
- ItemValidationSummaryComponent.propDecorators = {
2352
- controlName: [{ type: Input }],
2353
- controlTitle: [{ type: Input }]
2486
+ SpinnerComponent.ctorParameters = () => [
2487
+ { type: Router },
2488
+ { type: Document, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
2489
+ ];
2490
+ SpinnerComponent.propDecorators = {
2491
+ backgroundColor: [{ type: Input }],
2492
+ spinner: [{ type: Input }]
2354
2493
  };
2355
2494
 
2356
2495
  /*
@@ -2409,49 +2548,19 @@ NativeElementDirective.ctorParameters = () => [
2409
2548
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2410
2549
  </file>
2411
2550
  */
2412
- const FroalaEditorModuleWithProviders = FroalaEditorModule.forRoot();
2413
- const FroalaViewModuleWithProviders = FroalaViewModule.forRoot();
2414
- class AnatolyUIModule {
2551
+ class ReplaceTextPipe {
2552
+ transform(inputData, search, replacement) {
2553
+ if (inputData) {
2554
+ return inputData.replace(new RegExp(search, "g"), replacement);
2555
+ }
2556
+ else {
2557
+ return inputData;
2558
+ }
2559
+ }
2415
2560
  }
2416
- AnatolyUIModule.decorators = [
2417
- { type: NgModule, args: [{
2418
- imports: [
2419
- CommonModule,
2420
- ReactiveFormsModule,
2421
- FormsModule,
2422
- FroalaEditorModuleWithProviders,
2423
- FroalaViewModuleWithProviders,
2424
- ],
2425
- exports: [
2426
- SubscribePlanButtonComponent,
2427
- UpgradePlanButtonComponent,
2428
- BuyAccessButtonComponent,
2429
- SignInButtonComponent,
2430
- SignUpButtonComponent,
2431
- SignOutButtonComponent,
2432
- FormValidationSummaryComponent,
2433
- ItemValidationSummaryComponent,
2434
- HtmlEditorComponent,
2435
- FormsHtmlEditorComponent,
2436
- ContentHeaderComponent,
2437
- // Directives
2438
- NativeElementDirective
2439
- ],
2440
- declarations: [
2441
- SubscribePlanButtonComponent,
2442
- UpgradePlanButtonComponent,
2443
- BuyAccessButtonComponent,
2444
- SignInButtonComponent,
2445
- SignUpButtonComponent,
2446
- SignOutButtonComponent,
2447
- FormValidationSummaryComponent,
2448
- ItemValidationSummaryComponent,
2449
- HtmlEditorComponent,
2450
- FormsHtmlEditorComponent,
2451
- ContentHeaderComponent,
2452
- // Directives
2453
- NativeElementDirective
2454
- ]
2561
+ ReplaceTextPipe.decorators = [
2562
+ { type: Pipe, args: [{
2563
+ name: "replaceText",
2455
2564
  },] }
2456
2565
  ];
2457
2566
 
@@ -2472,7 +2581,27 @@ AnatolyUIModule.decorators = [
2472
2581
 
2473
2582
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2474
2583
  </file>
2475
- */
2584
+ */
2585
+ class FileSizePipe {
2586
+ constructor() {
2587
+ this.units = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB'];
2588
+ }
2589
+ transform(bytes = 0, precision = 0) {
2590
+ if (isNaN(parseFloat(String(bytes))) || !isFinite(bytes))
2591
+ return '';
2592
+ let unit = 0;
2593
+ while (bytes >= 1024) {
2594
+ bytes /= 1024;
2595
+ unit++;
2596
+ }
2597
+ return bytes.toFixed(+precision) + ' ' + this.units[unit];
2598
+ }
2599
+ }
2600
+ FileSizePipe.decorators = [
2601
+ { type: Pipe, args: [{
2602
+ name: 'filesize',
2603
+ },] }
2604
+ ];
2476
2605
 
2477
2606
  /*
2478
2607
  <file>
@@ -2484,7 +2613,7 @@ AnatolyUIModule.decorators = [
2484
2613
  Anatoly Osovitny
2485
2614
 
2486
2615
  Created:
2487
- 10 May 2020
2616
+ 27 Oct 2019
2488
2617
 
2489
2618
  Version:
2490
2619
  1.0
@@ -2492,47 +2621,19 @@ AnatolyUIModule.decorators = [
2492
2621
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2493
2622
  </file>
2494
2623
  */
2495
- class LocalizePipe {
2496
- constructor(localizeService) {
2497
- this.localizeService = localizeService;
2624
+ class SafeHtmlPipe {
2625
+ constructor(sanitized) {
2626
+ this.sanitized = sanitized;
2498
2627
  }
2499
- transform(inputData, type, param2) {
2500
- if (!inputData) {
2501
- return;
2502
- }
2503
- if (!type) {
2504
- type = 't';
2505
- }
2506
- // Translate
2507
- if (type === 't') {
2508
- return this.localizeService.getLocalizedValue(inputData);
2509
- }
2510
- // Date
2511
- if (type === 'd') {
2512
- return this.localizeService.getLocalizedDate(inputData);
2513
- }
2514
- // DateTime
2515
- if (type === 'dt') {
2516
- return this.localizeService.getLocalizedDateTime(inputData);
2517
- }
2518
- // DistanceToNowInWords
2519
- if (type === 'dis2now') {
2520
- return this.localizeService.getLocalizedDistanceToNowInWords(inputData);
2521
- }
2522
- // DistanceInWords
2523
- if (type === 'dis') {
2524
- return this.localizeService.getLocalizedDistanceInWords(inputData, param2);
2525
- }
2526
- return inputData;
2628
+ transform(value) {
2629
+ return this.sanitized.bypassSecurityTrustHtml(value);
2527
2630
  }
2528
2631
  }
2529
- LocalizePipe.decorators = [
2530
- { type: Pipe, args: [{
2531
- name: 'localize'
2532
- },] }
2632
+ SafeHtmlPipe.decorators = [
2633
+ { type: Pipe, args: [{ name: 'safeHtml' },] }
2533
2634
  ];
2534
- LocalizePipe.ctorParameters = () => [
2535
- { type: LocalizationService }
2635
+ SafeHtmlPipe.ctorParameters = () => [
2636
+ { type: DomSanitizer }
2536
2637
  ];
2537
2638
 
2538
2639
  /*
@@ -2545,7 +2646,122 @@ LocalizePipe.ctorParameters = () => [
2545
2646
  Anatoly Osovitny
2546
2647
 
2547
2648
  Created:
2548
- 12 May 2020
2649
+ 8 Dec 2017
2650
+
2651
+ Version:
2652
+ 1.0
2653
+
2654
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2655
+ </file>
2656
+ */
2657
+ class ValidationSummaryComponent extends BaseEditComponent {
2658
+ constructor() {
2659
+ super();
2660
+ }
2661
+ getFormValidationMessages() {
2662
+ let messages = [];
2663
+ Object.keys(this.formGroup.controls).forEach(k => {
2664
+ var control = this.formGroup.controls[k];
2665
+ if (control.controls != null) {
2666
+ Object.keys(control.controls).forEach(k => {
2667
+ var child = control.controls[k];
2668
+ this.getValidationMessages(child, this.getControlName(child, k)).forEach(m => messages.push(m));
2669
+ });
2670
+ }
2671
+ else {
2672
+ this.getValidationMessages(control, this.getControlName(control, k)).forEach(m => messages.push(m));
2673
+ }
2674
+ });
2675
+ return messages;
2676
+ }
2677
+ getValidationMessages(state, thingName) {
2678
+ let thing = state.path || thingName;
2679
+ let messages = [];
2680
+ if (state.errors) {
2681
+ for (let errorName in state.errors) {
2682
+ if (state.errors.hasOwnProperty(errorName)) {
2683
+ switch (errorName) {
2684
+ case 'required':
2685
+ messages.push(`${thing} is required`);
2686
+ break;
2687
+ case 'minlength':
2688
+ messages.push(`${thing} must be at least ${state.errors["minlength"].requiredLength} characters`);
2689
+ break;
2690
+ case 'pattern':
2691
+ messages.push(`${thing} contains illegal characters`);
2692
+ break;
2693
+ case 'format':
2694
+ messages.push(`${thing} format mismatch`);
2695
+ break;
2696
+ case 'maxlength':
2697
+ messages.push(`${thing} must have maximum ${state.errors["maxlength"].requiredLength} characters`);
2698
+ break;
2699
+ case 'specialcharacters':
2700
+ messages.push(`${thing} contains special characters`);
2701
+ break;
2702
+ }
2703
+ }
2704
+ }
2705
+ }
2706
+ return messages;
2707
+ }
2708
+ /**
2709
+ * Get Control Name
2710
+ * @param control
2711
+ * @param thingName
2712
+ */
2713
+ getControlName(control, thingName) {
2714
+ let value = this.getControlTitle(control);
2715
+ return value ? value : thingName;
2716
+ }
2717
+ /**
2718
+ * Retrieve tilte of control
2719
+ * @param control
2720
+ */
2721
+ getControlTitle(control) {
2722
+ if (control === null || control === void 0 ? void 0 : control.nativeElement) {
2723
+ let controlTitle = this.getTitleAttribute(control.nativeElement);
2724
+ if (controlTitle) {
2725
+ return controlTitle;
2726
+ }
2727
+ }
2728
+ return undefined;
2729
+ }
2730
+ /**
2731
+ * Return title attribute of form control
2732
+ */
2733
+ getTitleAttribute(nativeElement) {
2734
+ var _a, _b, _c, _d, _e, _f;
2735
+ let title;
2736
+ switch (nativeElement.tagName) {
2737
+ // For Kendo time and date picker element title is assigned to the 4th child control.
2738
+ case "KENDO-TIMEPICKER":
2739
+ case "KENDO-DATEPICKER":
2740
+ title = (_d = (_c = (_b = (_a = nativeElement.children[0]) === null || _a === void 0 ? void 0 : _a.children[0]) === null || _b === void 0 ? void 0 : _b.children[0]) === null || _c === void 0 ? void 0 : _c.children[0]) === null || _d === void 0 ? void 0 : _d.getAttribute('title');
2741
+ break;
2742
+ // For Kendo numaric element title is assigned to the 2nd child control.
2743
+ case "KENDO-NUMERICTEXTBOX":
2744
+ title = (_f = (_e = nativeElement.children[0]) === null || _e === void 0 ? void 0 : _e.children[0]) === null || _f === void 0 ? void 0 : _f.getAttribute('title');
2745
+ break;
2746
+ default:
2747
+ title = nativeElement.getAttribute('title');
2748
+ break;
2749
+ }
2750
+ return title;
2751
+ }
2752
+ }
2753
+
2754
+ /*
2755
+ <file>
2756
+ Project:
2757
+ @osovitny/anatoly
2758
+
2759
+ Authors:
2760
+ Vadim Osovitny
2761
+ Anatoly Osovitny
2762
+
2763
+ Created:
2764
+ 7 Dec 2017
2549
2765
 
2550
2766
  Version:
2551
2767
  1.0
@@ -2553,23 +2769,48 @@ LocalizePipe.ctorParameters = () => [
2553
2769
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2554
2770
  </file>
2555
2771
  */
2556
- class LocalizationModule {
2772
+ class FormValidationSummaryComponent extends ValidationSummaryComponent {
2773
+ constructor() {
2774
+ super();
2775
+ this.visible = false;
2776
+ this.customerrors = [];
2777
+ /*
2778
+ 0 - only FormValidation messages
2779
+ 1 - only Custom messages
2780
+ 2 - all
2781
+ */
2782
+ this.viewtype = 0;
2783
+ }
2784
+ getErrors() {
2785
+ if (this.viewtype == 1) {
2786
+ return this.customerrors;
2787
+ }
2788
+ let formValidationMessages = this.getFormValidationMessages();
2789
+ if (this.viewtype == 0) {
2790
+ return formValidationMessages;
2791
+ }
2792
+ var messages = [];
2793
+ if (formValidationMessages.length > 0) {
2794
+ messages.push(...formValidationMessages);
2795
+ }
2796
+ if (this.customerrors.length > 0) {
2797
+ messages.push(...this.customerrors);
2798
+ }
2799
+ return messages;
2800
+ }
2557
2801
  }
2558
- LocalizationModule.decorators = [
2559
- { type: NgModule, args: [{
2560
- imports: [
2561
- TranslateModule
2562
- ],
2563
- exports: [
2564
- TranslateModule,
2565
- LocalizePipe
2566
- ],
2567
- declarations: [
2568
- LocalizePipe
2569
- ],
2570
- providers: []
2802
+ FormValidationSummaryComponent.decorators = [
2803
+ { type: Component, args: [{
2804
+ selector: "anatoly-form-validation-summary",
2805
+ template: "<div class=\"callout callout-danger\" *ngIf=\"visible\">\r\n <h6 class=\"box-title\">There are problems with the form</h6>\r\n <ul>\r\n <li *ngFor=\"let error of getErrors()\"><span>{{error}}</span></li>\r\n </ul>\r\n</div>\r\n\r\n"
2571
2806
  },] }
2572
- ];
2807
+ ];
2808
+ FormValidationSummaryComponent.ctorParameters = () => [];
2809
+ FormValidationSummaryComponent.propDecorators = {
2810
+ visible: [{ type: Input }],
2811
+ customerrors: [{ type: Input }],
2812
+ viewtype: [{ type: Input }]
2813
+ };
2573
2814
 
2574
2815
  /*
2575
2816
  <file>
@@ -2581,7 +2822,7 @@ LocalizationModule.decorators = [
2581
2822
  Anatoly Osovitny
2582
2823
 
2583
2824
  Created:
2584
- 05 May 2020
2825
+ 6 Dec 2017
2585
2826
 
2586
2827
  Version:
2587
2828
  1.0
@@ -2589,48 +2830,22 @@ LocalizationModule.decorators = [
2589
2830
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2590
2831
  </file>
2591
2832
  */
2592
- function customTranslateLoaderFactory(http) {
2593
- return new TranslateHttpLoader(http, AppCoreSettings.resourcesUrl + "/", '.json');
2594
- }
2595
- function localizationInitializerFactory(translate, localizationService, injector) {
2596
- return () => new Promise((resolve) => {
2597
- let locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
2598
- locationInitialized.then(() => {
2599
- let languageToSet = localizationService.configureTranslationSettings(translate);
2600
- translate.use(languageToSet).subscribe(() => {
2601
- }, () => {
2602
- resolve(null);
2603
- }, () => {
2604
- resolve(null);
2605
- });
2606
- });
2607
- });
2608
- }
2609
- const TranslateModuleAtRoot = TranslateModule.forRoot({
2610
- loader: {
2611
- provide: TranslateLoader,
2612
- useFactory: customTranslateLoaderFactory,
2613
- deps: [HttpClient]
2833
+ class ItemValidationSummaryComponent extends ValidationSummaryComponent {
2834
+ constructor() {
2835
+ super();
2614
2836
  }
2615
- });
2616
- class LocalizationSettingsModule {
2617
2837
  }
2618
- LocalizationSettingsModule.decorators = [
2619
- { type: NgModule, args: [{
2620
- imports: [
2621
- TranslateModuleAtRoot
2622
- ],
2623
- providers: [
2624
- {
2625
- provide: APP_INITIALIZER,
2626
- useFactory: localizationInitializerFactory,
2627
- deps: [TranslateService, LocalizationService, Injector],
2628
- multi: true
2629
- }
2630
- ],
2631
- exports: []
2838
+ ItemValidationSummaryComponent.decorators = [
2839
+ { type: Component, args: [{
2840
+ selector: "anatoly-item-validation-summary",
2841
+ template: "<ul class=\"list-unstyled\" *ngIf=\"isControlInvalid(controlName)\">\r\n <li *ngFor=\"let error of getValidationMessages(formGroup.get(controlName), controlTitle)\">\r\n <span class=\"help-block\">{{ error }}</span>\r\n </li>\r\n</ul>\r\n\r\n"
2632
2842
  },] }
2633
- ];
2843
+ ];
2844
+ ItemValidationSummaryComponent.ctorParameters = () => [];
2845
+ ItemValidationSummaryComponent.propDecorators = {
2846
+ controlName: [{ type: Input }],
2847
+ controlTitle: [{ type: Input }]
2848
+ };
2634
2849
 
2635
2850
  /*
2636
2851
  <file>
@@ -2649,112 +2864,60 @@ LocalizationSettingsModule.decorators = [
2649
2864
 
2650
2865
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2651
2866
  </file>
2652
- */
2653
-
2654
- /*
2655
- <file>
2656
- Project:
2657
- @osovitny/anatoly
2658
-
2659
- Authors:
2660
- Vadim Osovitny
2661
- Anatoly Osovitny
2662
-
2663
- Created:
2664
- 3 March 2020
2665
-
2666
- Version:
2667
- 1.0
2668
-
2669
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
2670
- </file>
2671
2867
  */
2672
- class Alerts$1 {
2673
- static success(text, params, title, successAction) {
2674
- text = Utils.getLocalizedValue(text, params, 'OperationSuccessFull');
2675
- title = Utils.getLocalizedValue(title, null, 'Success');
2676
- Swal.fire({
2677
- text,
2678
- title,
2679
- icon: 'success',
2680
- confirmButtonText: Utils.getLocalizedValue('Ok')
2681
- })
2682
- .then(() => {
2683
- if (successAction) {
2684
- successAction();
2685
- }
2686
- });
2687
- }
2688
- static info(text, params, title) {
2689
- text = Utils.getLocalizedValue(text, params);
2690
- title = Utils.getLocalizedValue(title, null, 'Info');
2691
- Swal.fire({
2692
- text,
2693
- title,
2694
- icon: 'info',
2695
- confirmButtonText: Utils.getLocalizedValue('Ok')
2696
- });
2697
- }
2698
- static warning(text, params, title) {
2699
- text = Utils.getLocalizedValue(text, params);
2700
- title = Utils.getLocalizedValue(title, null, 'Warning');
2701
- Swal.fire({
2702
- text,
2703
- title,
2704
- icon: 'warning',
2705
- confirmButtonText: Utils.getLocalizedValue('Ok')
2706
- });
2707
- }
2708
- static error(text, params, title) {
2709
- text = Utils.getLocalizedValue(text, params, 'ErrorOccured');
2710
- title = Utils.getLocalizedValue(title, null, 'Error');
2711
- Swal.fire({
2712
- text,
2713
- title,
2714
- icon: 'error',
2715
- confirmButtonText: Utils.getLocalizedValue('Ok')
2716
- });
2717
- }
2718
- static cancel(text, params, title) {
2719
- text = Utils.getLocalizedValue(text, params, 'OperationCancelled');
2720
- title = Utils.getLocalizedValue(title, null, 'Cancelled');
2721
- Swal.fire({
2722
- text,
2723
- title,
2724
- icon: 'info'
2725
- });
2726
- }
2727
- static notImplemented() {
2728
- this.warning('Not Implemented Yet');
2729
- }
2730
- ;
2731
- static areYouSure(text, title, confirmButtonText, cancelButtonText, successAction, cancelAction) {
2732
- text = Utils.getLocalizedValue(text);
2733
- title = Utils.getLocalizedValue(title, null, 'AreYouSure');
2734
- Swal.fire({
2735
- text,
2736
- title,
2737
- icon: 'warning',
2738
- confirmButtonText: Utils.getLocalizedValue(confirmButtonText),
2739
- cancelButtonText: Utils.getLocalizedValue(cancelButtonText),
2740
- showCancelButton: true
2741
- })
2742
- .then((result) => {
2743
- if (result.value) {
2744
- if (successAction) {
2745
- successAction();
2746
- }
2747
- }
2748
- // result.dismiss can be 'cancel', 'overlay', 'close', and 'timer'
2749
- else if (result.dismiss == Swal.DismissReason.cancel || result.dismiss == Swal.DismissReason.close) {
2750
- if (cancelAction) {
2751
- cancelAction();
2752
- }
2753
- }
2754
- });
2755
- }
2756
- ;
2757
- }
2868
+ const FroalaEditorModuleWithProviders = FroalaEditorModule.forRoot();
2869
+ const FroalaViewModuleWithProviders = FroalaViewModule.forRoot();
2870
+ class AnatolyUIModule {
2871
+ }
2872
+ AnatolyUIModule.decorators = [
2873
+ { type: NgModule, args: [{
2874
+ imports: [
2875
+ CommonModule,
2876
+ ReactiveFormsModule,
2877
+ FormsModule,
2878
+ FroalaEditorModuleWithProviders,
2879
+ FroalaViewModuleWithProviders,
2880
+ ],
2881
+ exports: [
2882
+ SubscribePlanButtonComponent,
2883
+ UpgradePlanButtonComponent,
2884
+ BuyAccessButtonComponent,
2885
+ SignInButtonComponent,
2886
+ SignUpButtonComponent,
2887
+ SignOutButtonComponent,
2888
+ FormValidationSummaryComponent,
2889
+ ItemValidationSummaryComponent,
2890
+ HtmlEditorComponent,
2891
+ FormsHtmlEditorComponent,
2892
+ ContentHeaderComponent,
2893
+ SpinnerComponent,
2894
+ LoadingComponent,
2895
+ NativeElementDirective,
2896
+ SafeHtmlPipe,
2897
+ ReplaceTextPipe,
2898
+ FileSizePipe
2899
+ ],
2900
+ declarations: [
2901
+ SubscribePlanButtonComponent,
2902
+ UpgradePlanButtonComponent,
2903
+ BuyAccessButtonComponent,
2904
+ SignInButtonComponent,
2905
+ SignUpButtonComponent,
2906
+ SignOutButtonComponent,
2907
+ FormValidationSummaryComponent,
2908
+ ItemValidationSummaryComponent,
2909
+ HtmlEditorComponent,
2910
+ FormsHtmlEditorComponent,
2911
+ ContentHeaderComponent,
2912
+ SpinnerComponent,
2913
+ LoadingComponent,
2914
+ NativeElementDirective,
2915
+ SafeHtmlPipe,
2916
+ ReplaceTextPipe,
2917
+ FileSizePipe
2918
+ ]
2919
+ },] }
2920
+ ];
2758
2921
 
2759
2922
  /*
2760
2923
  * Public API Surface of anatoly
@@ -2764,5 +2927,5 @@ class Alerts$1 {
2764
2927
  * Generated bundle index. Do not edit.
2765
2928
  */
2766
2929
 
2767
- export { Alerts$1 as Alerts, AnatolyCoreModule, AnatolyDataModule, AnatolyHttpInterceptor, AnatolyUIModule, AppContextService, AppCoreSettings, BaseApiService, BaseComponent, BaseEditComponent, BaseGoService, BaseGridEditService, BaseGridReadService, BillingApiService, BuyAccessButtonComponent, ContentHeaderComponent, ContextInitState, FormValidationSummaryComponent, FormsHtmlEditorComponent, GlobalErrorHandler, Guid, HtmlEditorComponent, ItemValidationSummaryComponent, LoadingService, LocalizationModule, LocalizationService, LocalizationSettingsModule, LocalizePipe, LoggingService, NativeElementDirective, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, Subs, SubscribePlanButtonComponent, UpgradePlanButtonComponent, Utils, ValidationSummaryComponent, throwIfAlreadyLoaded };
2930
+ export { Alerts, AnatolyCoreModule, AnatolyDataModule, AnatolyHttpInterceptor, AnatolyUIModule, AppContextService, AppCoreSettings, BaseApiService, BaseComponent, BaseEditComponent, BaseGoService, BaseGridEditService, BaseGridReadService, BaseHtmlEditorComponent, BillingApiService, BuyAccessButtonComponent, ContentHeaderComponent, ContextInitState, Convert, DefaultEditorOptions, FileSizePipe, FormValidationSummaryComponent, FormsHtmlEditorComponent, FroalaEditorModuleWithProviders, FroalaViewModuleWithProviders, GlobalErrorHandler, Guid, HtmlEditorComponent, IdleService, InjectorInstance, ItemValidationSummaryComponent, LoadingComponent, LoadingService, LocalStorageService, LocalizationModule, LocalizationService, LocalizationSettingsModule, LocalizePipe, LoggingService, NativeElementDirective, NotificationService, NotificationsApiService, ReplaceTextPipe, SafeHtmlPipe, SessionStorageService, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, SpinnerComponent, Subs, SubscribePlanButtonComponent, TranslateModuleAtRoot, UpgradePlanButtonComponent, Urls, Utils, ValidationSummaryComponent, consts, customTranslateLoaderFactory, localizationInitializerFactory, throwIfAlreadyLoaded };
2768
2931
  //# sourceMappingURL=osovitny-anatoly.js.map