@osovitny/anatoly 2.0.23 → 2.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/osovitny-anatoly.umd.js +795 -213
- package/bundles/osovitny-anatoly.umd.js.map +1 -1
- package/bundles/osovitny-anatoly.umd.min.js +2 -3
- package/bundles/osovitny-anatoly.umd.min.js.map +1 -1
- package/esm2015/lib/core/alerts.js +52 -52
- package/esm2015/lib/core/consts/index.js +2 -1
- package/esm2015/lib/core/consts/urls.js +22 -0
- package/esm2015/lib/core/convert.js +31 -0
- package/esm2015/lib/core/core.module.js +7 -3
- package/esm2015/lib/core/index.js +5 -5
- package/esm2015/lib/core/localization/index.js +26 -0
- package/esm2015/lib/core/localization/localization.module.js +41 -0
- package/esm2015/lib/core/localization/localization.service.js +3 -3
- package/esm2015/lib/core/localization/localizationSettings.module.js +70 -0
- package/esm2015/lib/core/localization/localize.pipe.js +65 -0
- package/esm2015/lib/core/notifications/alerts.js +107 -0
- package/esm2015/lib/core/notifications/interfaces/notification.js +19 -0
- package/esm2015/lib/core/notifications/services/notification-service.js +230 -0
- package/esm2015/lib/core/subs.js +1 -1
- package/esm2015/lib/core/utils.js +3 -14
- package/esm2015/lib/data/base/base-api.service.js +26 -30
- package/esm2015/lib/data/consts.js +24 -0
- package/esm2015/lib/data/data.module.js +16 -5
- package/esm2015/lib/data/index.js +6 -6
- package/esm2015/lib/data/services/billing-api.service.js +4 -5
- package/esm2015/lib/ui/ui.module.js +1 -1
- package/esm2015/public-api.js +6 -1
- package/fesm2015/osovitny-anatoly.js +828 -251
- package/fesm2015/osovitny-anatoly.js.map +1 -1
- package/lib/core/consts/index.d.ts +1 -0
- package/lib/core/consts/urls.d.ts +3 -0
- package/lib/core/convert.d.ts +7 -0
- package/lib/core/index.d.ts +4 -4
- package/lib/core/localization/index.d.ts +4 -0
- package/lib/core/localization/localization.module.d.ts +2 -0
- package/lib/core/localization/localizationSettings.module.d.ts +10 -0
- package/lib/core/localization/localize.pipe.d.ts +7 -0
- package/lib/core/notifications/alerts.d.ts +9 -0
- package/lib/core/notifications/interfaces/notification.d.ts +10 -0
- package/lib/core/notifications/services/notification-service.d.ts +22 -0
- package/lib/core/subs.d.ts +1 -1
- package/lib/core/utils.d.ts +0 -5
- package/lib/data/base/base-api.service.d.ts +2 -3
- package/lib/data/consts.d.ts +4 -0
- package/lib/data/data.module.d.ts +1 -0
- package/lib/data/index.d.ts +5 -5
- package/osovitny-anatoly.metadata.json +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +5 -0
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import Swal from 'sweetalert2';
|
|
2
|
-
import { ɵɵdefineInjectable,
|
|
3
|
-
import {
|
|
4
|
-
import { isValid, format, formatDistanceToNow, formatDistance } from 'date-fns';
|
|
5
|
-
import enUS from 'date-fns/locale/en-US';
|
|
6
|
-
import { CommonModule } from '@angular/common';
|
|
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';
|
|
7
4
|
import { HttpClient, HttpResponse } from '@angular/common/http';
|
|
8
5
|
import { map, tap } from 'rxjs/operators';
|
|
9
6
|
import { BehaviorSubject } from 'rxjs';
|
|
7
|
+
import { ToastrService } from 'ngx-toastr';
|
|
10
8
|
import { v4 } from 'uuid';
|
|
9
|
+
import { TranslateService, TranslateModule, TranslateLoader } from '@ngx-translate/core';
|
|
10
|
+
import { isValid, format, formatDistanceToNow, formatDistance } from 'date-fns';
|
|
11
|
+
import enUS from 'date-fns/locale/en-US';
|
|
11
12
|
import { ActivatedRoute, Router } from '@angular/router';
|
|
12
13
|
import { NgControl, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
13
14
|
import { FroalaEditorModule, FroalaViewModule } from 'angular-froala-wysiwyg';
|
|
15
|
+
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
|
14
16
|
|
|
15
17
|
/*
|
|
16
18
|
<file>
|
|
@@ -33,6 +35,28 @@ import { FroalaEditorModule, FroalaViewModule } from 'angular-froala-wysiwyg';
|
|
|
33
35
|
const ContextInitState = JSON.parse((document.getElementById('contextInitState')).getAttribute('data-contextinitstate'));
|
|
34
36
|
const AppCoreSettings = JSON.parse((document.getElementById('appCoreSettings')).getAttribute('data-appcoresettings'));
|
|
35
37
|
|
|
38
|
+
/*
|
|
39
|
+
<file>
|
|
40
|
+
Project:
|
|
41
|
+
MICE
|
|
42
|
+
|
|
43
|
+
Authors:
|
|
44
|
+
Vadim Osovitny vaosovitny@deloitte.com
|
|
45
|
+
|
|
46
|
+
Created:
|
|
47
|
+
5 May 2020
|
|
48
|
+
|
|
49
|
+
Version:
|
|
50
|
+
1.0
|
|
51
|
+
|
|
52
|
+
Copyright (c) 2020 Deloitte Tax. All rights reserved.
|
|
53
|
+
</file>
|
|
54
|
+
*/
|
|
55
|
+
const Urls = {
|
|
56
|
+
// SignalR Notifications
|
|
57
|
+
notificationsSocketUrl: '/hubs/notifications'
|
|
58
|
+
};
|
|
59
|
+
|
|
36
60
|
/*
|
|
37
61
|
<file>
|
|
38
62
|
Project:
|
|
@@ -97,43 +121,43 @@ function throwIfAlreadyLoaded(parentModule, moduleName) {
|
|
|
97
121
|
class Alerts {
|
|
98
122
|
static Info(text) {
|
|
99
123
|
Swal.fire({
|
|
100
|
-
title:
|
|
101
|
-
text
|
|
102
|
-
icon:
|
|
103
|
-
confirmButtonText:
|
|
124
|
+
title: 'Information',
|
|
125
|
+
text,
|
|
126
|
+
icon: 'info',
|
|
127
|
+
confirmButtonText: 'OK',
|
|
104
128
|
});
|
|
105
129
|
}
|
|
106
130
|
static Warning(text) {
|
|
107
131
|
Swal.fire({
|
|
108
|
-
title:
|
|
109
|
-
text
|
|
110
|
-
icon:
|
|
111
|
-
confirmButtonText:
|
|
132
|
+
title: 'Warning',
|
|
133
|
+
text,
|
|
134
|
+
icon: 'warning',
|
|
135
|
+
confirmButtonText: 'OK',
|
|
112
136
|
});
|
|
113
137
|
}
|
|
114
138
|
static Error(text) {
|
|
115
139
|
Swal.fire({
|
|
116
|
-
title:
|
|
117
|
-
text
|
|
118
|
-
icon:
|
|
119
|
-
confirmButtonText:
|
|
140
|
+
title: 'Error',
|
|
141
|
+
text,
|
|
142
|
+
icon: 'error',
|
|
143
|
+
confirmButtonText: 'OK',
|
|
120
144
|
});
|
|
121
145
|
}
|
|
122
146
|
static NotImplemented() {
|
|
123
|
-
this.Warning(
|
|
147
|
+
this.Warning('Not Implemented Yet');
|
|
124
148
|
}
|
|
125
149
|
static ErrorOccurred() {
|
|
126
|
-
this.Error(
|
|
150
|
+
this.Error('Sorry, an unexpected error occurred');
|
|
127
151
|
}
|
|
128
152
|
static AreYouSure(text, title, confirmButtonText, cancelButtonText, successAction, cancelAction) {
|
|
129
|
-
if (typeof title
|
|
130
|
-
title =
|
|
153
|
+
if (typeof title === 'undefined' || title == null)
|
|
154
|
+
title = 'Are you sure?';
|
|
131
155
|
Swal.fire({
|
|
132
|
-
title
|
|
133
|
-
text
|
|
134
|
-
icon:
|
|
135
|
-
confirmButtonText
|
|
136
|
-
cancelButtonText
|
|
156
|
+
title,
|
|
157
|
+
text,
|
|
158
|
+
icon: 'warning',
|
|
159
|
+
confirmButtonText,
|
|
160
|
+
cancelButtonText,
|
|
137
161
|
showCancelButton: true,
|
|
138
162
|
}).then((result) => {
|
|
139
163
|
if (result.value) {
|
|
@@ -142,8 +166,8 @@ class Alerts {
|
|
|
142
166
|
}
|
|
143
167
|
}
|
|
144
168
|
// result.dismiss can be 'cancel', 'overlay', 'close', and 'timer'
|
|
145
|
-
else if (result.dismiss
|
|
146
|
-
result.dismiss
|
|
169
|
+
else if (result.dismiss === Swal.DismissReason.cancel ||
|
|
170
|
+
result.dismiss === Swal.DismissReason.close) {
|
|
147
171
|
if (cancelAction) {
|
|
148
172
|
cancelAction();
|
|
149
173
|
}
|
|
@@ -151,17 +175,17 @@ class Alerts {
|
|
|
151
175
|
});
|
|
152
176
|
}
|
|
153
177
|
static Success(text, title, successAction) {
|
|
154
|
-
if (typeof title
|
|
155
|
-
title =
|
|
178
|
+
if (typeof title === 'undefined' || title == null)
|
|
179
|
+
title = 'Success';
|
|
156
180
|
if (!text) {
|
|
157
|
-
text =
|
|
181
|
+
text = 'Operation was successful';
|
|
158
182
|
}
|
|
159
183
|
Swal.fire({
|
|
160
|
-
title
|
|
161
|
-
text
|
|
162
|
-
icon:
|
|
163
|
-
confirmButtonText:
|
|
164
|
-
}).then(
|
|
184
|
+
title,
|
|
185
|
+
text,
|
|
186
|
+
icon: 'success',
|
|
187
|
+
confirmButtonText: 'OK',
|
|
188
|
+
}).then(() => {
|
|
165
189
|
if (successAction) {
|
|
166
190
|
successAction();
|
|
167
191
|
}
|
|
@@ -169,159 +193,57 @@ class Alerts {
|
|
|
169
193
|
}
|
|
170
194
|
static Cancel(text) {
|
|
171
195
|
if (!text) {
|
|
172
|
-
text =
|
|
196
|
+
text = 'Operation has been cancled';
|
|
173
197
|
}
|
|
174
198
|
Swal.fire({
|
|
175
|
-
title:
|
|
176
|
-
text
|
|
177
|
-
icon:
|
|
199
|
+
title: 'Cancelled',
|
|
200
|
+
text,
|
|
201
|
+
icon: 'info',
|
|
178
202
|
});
|
|
179
203
|
}
|
|
180
|
-
//Notifications
|
|
204
|
+
// Notifications
|
|
181
205
|
static NotificationCancel(text, title) {
|
|
182
|
-
if (typeof title
|
|
183
|
-
title =
|
|
206
|
+
if (typeof title === 'undefined' || title == null) {
|
|
207
|
+
title = 'Canceled';
|
|
184
208
|
}
|
|
185
209
|
if (!text) {
|
|
186
|
-
text =
|
|
210
|
+
text = 'Operation has been canceled';
|
|
187
211
|
}
|
|
188
212
|
const toast = Swal.mixin({
|
|
189
213
|
toast: true,
|
|
190
|
-
position:
|
|
214
|
+
position: 'top-end',
|
|
191
215
|
showConfirmButton: false,
|
|
192
216
|
timer: 3000,
|
|
193
217
|
timerProgressBar: true,
|
|
194
218
|
});
|
|
195
219
|
toast.fire({
|
|
196
|
-
title
|
|
197
|
-
text
|
|
198
|
-
icon:
|
|
220
|
+
title,
|
|
221
|
+
text,
|
|
222
|
+
icon: 'info',
|
|
199
223
|
});
|
|
200
224
|
}
|
|
201
225
|
static NotificationSuccess(text, title) {
|
|
202
|
-
if (typeof title
|
|
203
|
-
title =
|
|
226
|
+
if (typeof title === 'undefined' || title == null) {
|
|
227
|
+
title = 'Success';
|
|
204
228
|
}
|
|
205
229
|
if (!text) {
|
|
206
|
-
text =
|
|
230
|
+
text = 'Operation was successful';
|
|
207
231
|
}
|
|
208
232
|
const toast = Swal.mixin({
|
|
209
233
|
toast: true,
|
|
210
|
-
position:
|
|
234
|
+
position: 'top-end',
|
|
211
235
|
showConfirmButton: false,
|
|
212
236
|
timer: 3000,
|
|
213
237
|
timerProgressBar: true,
|
|
214
238
|
});
|
|
215
239
|
toast.fire({
|
|
216
|
-
title
|
|
217
|
-
text
|
|
218
|
-
icon:
|
|
240
|
+
title,
|
|
241
|
+
text,
|
|
242
|
+
icon: 'success',
|
|
219
243
|
});
|
|
220
244
|
}
|
|
221
245
|
}
|
|
222
246
|
|
|
223
|
-
/*
|
|
224
|
-
<file>
|
|
225
|
-
Project:
|
|
226
|
-
@osovitny/anatoly
|
|
227
|
-
|
|
228
|
-
Authors:
|
|
229
|
-
Vadim Osovitny
|
|
230
|
-
Anatoly Osovitny
|
|
231
|
-
|
|
232
|
-
Created:
|
|
233
|
-
05 May 2020
|
|
234
|
-
|
|
235
|
-
Version:
|
|
236
|
-
1.0
|
|
237
|
-
|
|
238
|
-
Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
|
|
239
|
-
</file>
|
|
240
|
-
*/
|
|
241
|
-
class LocalizationService {
|
|
242
|
-
constructor(translate) {
|
|
243
|
-
this.translate = translate;
|
|
244
|
-
this.setSupportedLanguages(['en']);
|
|
245
|
-
}
|
|
246
|
-
format(str, args) {
|
|
247
|
-
// tslint:disable-next-line:variable-name
|
|
248
|
-
return str.replace(/{(\d+)}/g, (match, number) => typeof args[number] !== 'undefined' ? args[number] : match);
|
|
249
|
-
}
|
|
250
|
-
;
|
|
251
|
-
configureTranslationSettings(translate) {
|
|
252
|
-
const languageToSet = 'en';
|
|
253
|
-
translate.setDefaultLang(languageToSet);
|
|
254
|
-
return languageToSet;
|
|
255
|
-
}
|
|
256
|
-
getBrowserLanguage() {
|
|
257
|
-
return this.translate.getBrowserLang();
|
|
258
|
-
}
|
|
259
|
-
getDatefnsLocale() {
|
|
260
|
-
let dfnLocale;
|
|
261
|
-
switch (this.getBrowserLanguage()) {
|
|
262
|
-
case 'en':
|
|
263
|
-
dfnLocale = { locale: enUS };
|
|
264
|
-
break;
|
|
265
|
-
default:
|
|
266
|
-
dfnLocale = { locale: enUS };
|
|
267
|
-
}
|
|
268
|
-
return dfnLocale;
|
|
269
|
-
}
|
|
270
|
-
setDefaultLanguage(lang) {
|
|
271
|
-
this.translate.setDefaultLang(lang);
|
|
272
|
-
}
|
|
273
|
-
setSupportedLanguages(languages) {
|
|
274
|
-
this.translate.addLangs(languages);
|
|
275
|
-
}
|
|
276
|
-
updateLanguage(language) {
|
|
277
|
-
this.translate.use(language);
|
|
278
|
-
}
|
|
279
|
-
getLocalizedValue(key, params) {
|
|
280
|
-
const value = this.translate.instant(key);
|
|
281
|
-
if (!params || params.length === 0) {
|
|
282
|
-
return value;
|
|
283
|
-
}
|
|
284
|
-
return this.format(value, params);
|
|
285
|
-
}
|
|
286
|
-
getLocalizedDate(key) {
|
|
287
|
-
if (isValid(new Date(key))) {
|
|
288
|
-
return format(new Date(key), AppCoreSettings.DATE_FORMATS.angular, this.dateFnsLocale);
|
|
289
|
-
}
|
|
290
|
-
return 'Invalid Date';
|
|
291
|
-
}
|
|
292
|
-
getLocalizedDateTime(key) {
|
|
293
|
-
// To Do Manoj: Test in IE and make TimeZone specific changes accordingly
|
|
294
|
-
const dateValue = new Date(key);
|
|
295
|
-
if (isValid(dateValue)) {
|
|
296
|
-
const localDate = Utils.convertToLocalizedDateTime(dateValue);
|
|
297
|
-
return format(localDate, AppCoreSettings.DATE_FORMATS.angularWithTime, this.dateFnsLocale);
|
|
298
|
-
}
|
|
299
|
-
return 'Invalid Date';
|
|
300
|
-
}
|
|
301
|
-
getLocalizedDistanceToNowInWords(date) {
|
|
302
|
-
// https://date-fns.org/v1.30.1/docs/distanceInWords
|
|
303
|
-
if (isValid(new Date(date))) {
|
|
304
|
-
return formatDistanceToNow(new Date(date), this.dateFnsLocale);
|
|
305
|
-
}
|
|
306
|
-
return 'Invalid Date';
|
|
307
|
-
}
|
|
308
|
-
getLocalizedDistanceInWords(endedDate, startedDate) {
|
|
309
|
-
if (isValid(new Date(endedDate)) && isValid(new Date(startedDate))) {
|
|
310
|
-
return formatDistance(new Date(endedDate), new Date(startedDate), this.dateFnsLocale);
|
|
311
|
-
}
|
|
312
|
-
return 'Invalid Date';
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
LocalizationService.ɵprov = ɵɵdefineInjectable({ factory: function LocalizationService_Factory() { return new LocalizationService(ɵɵinject(TranslateService)); }, token: LocalizationService, providedIn: "root" });
|
|
316
|
-
LocalizationService.decorators = [
|
|
317
|
-
{ type: Injectable, args: [{
|
|
318
|
-
providedIn: 'root'
|
|
319
|
-
},] }
|
|
320
|
-
];
|
|
321
|
-
LocalizationService.ctorParameters = () => [
|
|
322
|
-
{ type: TranslateService }
|
|
323
|
-
];
|
|
324
|
-
|
|
325
247
|
/*
|
|
326
248
|
<file>
|
|
327
249
|
Project:
|
|
@@ -378,63 +300,59 @@ LoggingService.ctorParameters = () => [];
|
|
|
378
300
|
class BaseApiService {
|
|
379
301
|
constructor(http) {
|
|
380
302
|
this.http = http;
|
|
381
|
-
this.baseUrl =
|
|
303
|
+
this.baseUrl = '';
|
|
382
304
|
}
|
|
383
305
|
serializeParams(data) {
|
|
384
|
-
return data ?
|
|
306
|
+
return data ? '?' + $.param(data) : '';
|
|
385
307
|
}
|
|
386
|
-
//api
|
|
308
|
+
// api
|
|
387
309
|
get(action, data, responseType) {
|
|
388
310
|
if (!responseType) {
|
|
389
|
-
responseType =
|
|
311
|
+
responseType = 'json';
|
|
390
312
|
}
|
|
391
|
-
|
|
313
|
+
const url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
|
|
392
314
|
return this.http
|
|
393
|
-
.get(url, { responseType
|
|
315
|
+
.get(url, { responseType })
|
|
394
316
|
.pipe(map((res) => res));
|
|
395
317
|
}
|
|
396
318
|
post(action, data, responseType) {
|
|
397
319
|
if (!responseType) {
|
|
398
|
-
responseType =
|
|
320
|
+
responseType = 'text';
|
|
399
321
|
}
|
|
400
|
-
|
|
401
|
-
return this.http.post(url, data, { responseType
|
|
322
|
+
const url = `${this.baseUrl}/${action}`;
|
|
323
|
+
return this.http.post(url, data, { responseType });
|
|
402
324
|
}
|
|
403
325
|
postQS(action, data, responseType) {
|
|
404
326
|
if (!responseType) {
|
|
405
|
-
responseType =
|
|
327
|
+
responseType = 'text';
|
|
406
328
|
}
|
|
407
|
-
|
|
408
|
-
return this.http.post(url, null, { responseType
|
|
329
|
+
const url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
|
|
330
|
+
return this.http.post(url, null, { responseType });
|
|
409
331
|
}
|
|
410
332
|
delete(action, data, responseType) {
|
|
411
333
|
if (!responseType) {
|
|
412
|
-
responseType =
|
|
334
|
+
responseType = 'text';
|
|
413
335
|
}
|
|
414
|
-
|
|
415
|
-
return this.http.delete(url, { responseType
|
|
336
|
+
const url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
|
|
337
|
+
return this.http.delete(url, { responseType });
|
|
416
338
|
}
|
|
417
|
-
//gets
|
|
339
|
+
// gets
|
|
418
340
|
getById(id) {
|
|
419
|
-
return this.get(
|
|
341
|
+
return this.get('getById', { id });
|
|
420
342
|
}
|
|
421
343
|
getAll(data) {
|
|
422
|
-
return this.get(
|
|
344
|
+
return this.get('getall', data).pipe(map((res) => res));
|
|
423
345
|
}
|
|
424
346
|
getJsonFile(fileName, jsonUrl, jsonVersion) {
|
|
425
347
|
if (!jsonUrl) {
|
|
426
|
-
jsonUrl =
|
|
348
|
+
jsonUrl = '/dist/jsons';
|
|
427
349
|
}
|
|
428
350
|
if (!jsonVersion) {
|
|
429
|
-
jsonVersion =
|
|
351
|
+
jsonVersion = '1.0';
|
|
430
352
|
}
|
|
431
|
-
|
|
353
|
+
const url = jsonUrl + '/' + fileName + '?' + jsonVersion;
|
|
432
354
|
return this.http.get(url).pipe(map((res) => res));
|
|
433
355
|
}
|
|
434
|
-
getNewGuid() {
|
|
435
|
-
var url = `${this.baseUrl}/getNewGuid`;
|
|
436
|
-
return this.http.get(url, { responseType: "text" });
|
|
437
|
-
}
|
|
438
356
|
}
|
|
439
357
|
BaseApiService.decorators = [
|
|
440
358
|
{ type: Injectable }
|
|
@@ -562,36 +480,415 @@ class LoadingService extends BehaviorSubject {
|
|
|
562
480
|
}, timeout);
|
|
563
481
|
}
|
|
564
482
|
}
|
|
565
|
-
LoadingService.ɵprov = ɵɵdefineInjectable({ factory: function LoadingService_Factory() { return new LoadingService(); }, token: LoadingService, providedIn: "root" });
|
|
566
|
-
LoadingService.decorators = [
|
|
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",
|
|
487
|
+
},] }
|
|
488
|
+
];
|
|
489
|
+
LoadingService.ctorParameters = () => [];
|
|
490
|
+
|
|
491
|
+
/*
|
|
492
|
+
<file>
|
|
493
|
+
Project:
|
|
494
|
+
@osovitny/anatoly
|
|
495
|
+
|
|
496
|
+
Authors:
|
|
497
|
+
Vadim Osovitny
|
|
498
|
+
Anatoly Osovitny
|
|
499
|
+
|
|
500
|
+
Created:
|
|
501
|
+
26 Jun 2020
|
|
502
|
+
|
|
503
|
+
Version:
|
|
504
|
+
1.0
|
|
505
|
+
|
|
506
|
+
Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
|
|
507
|
+
</file>
|
|
508
|
+
*/
|
|
509
|
+
class Guid {
|
|
510
|
+
static newGuid() {
|
|
511
|
+
return v4();
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/*
|
|
516
|
+
<file>
|
|
517
|
+
Project:
|
|
518
|
+
@osovitny/anatoly
|
|
519
|
+
|
|
520
|
+
Authors:
|
|
521
|
+
Vadim Osovitny
|
|
522
|
+
Anatoly Osovitny
|
|
523
|
+
|
|
524
|
+
Created:
|
|
525
|
+
2 Jun 2020
|
|
526
|
+
|
|
527
|
+
Version:
|
|
528
|
+
1.0
|
|
529
|
+
|
|
530
|
+
Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
|
|
531
|
+
</file>
|
|
532
|
+
*/
|
|
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
|
+
}
|
|
550
|
+
/*
|
|
551
|
+
onInit() {
|
|
552
|
+
if (AppCoreSettings.AzureAD) {
|
|
553
|
+
this.authService.getAuthToken().subscribe((token: string) => {
|
|
554
|
+
this.startSignalRConnection(token);
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
this.startSignalRConnection();
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
ngOnDestroy() {
|
|
564
|
+
this.stopSignalRConnection();
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
// SignalR
|
|
568
|
+
private startSignalRConnection(accessToken?) {
|
|
569
|
+
const cskii = AppCoreSettings.selectedClientID;
|
|
570
|
+
// tslint:disable-next-line:variable-name
|
|
571
|
+
const cskii_upn = AppCoreSettings.CSKII_UPN;
|
|
572
|
+
// tslint:disable-next-line:variable-name
|
|
573
|
+
const cli_sessionguid = AppCoreSettings.CLI_SessionGUID;
|
|
574
|
+
|
|
575
|
+
const url = this.socketUrl + '?cskii=' + cskii + '&cskii_upn=' + cskii_upn + '&cli_sessionguid=' + cli_sessionguid;
|
|
576
|
+
|
|
577
|
+
if (accessToken) {
|
|
578
|
+
this.hubConnection = new signalR.HubConnectionBuilder()
|
|
579
|
+
.withUrl(url, {
|
|
580
|
+
skipNegotiation: false,
|
|
581
|
+
transport: signalR.HttpTransportType.WebSockets,
|
|
582
|
+
accessTokenFactory: () => accessToken
|
|
583
|
+
})
|
|
584
|
+
.withAutomaticReconnect()
|
|
585
|
+
.configureLogging(signalR.LogLevel.Debug)
|
|
586
|
+
.build();
|
|
587
|
+
}
|
|
588
|
+
else {
|
|
589
|
+
this.hubConnection = new signalR.HubConnectionBuilder()
|
|
590
|
+
.withUrl(this.socketUrl, {
|
|
591
|
+
skipNegotiation: true,
|
|
592
|
+
transport: signalR.HttpTransportType.WebSockets
|
|
593
|
+
})
|
|
594
|
+
.withAutomaticReconnect()
|
|
595
|
+
.configureLogging(signalR.LogLevel.Debug)
|
|
596
|
+
.build();
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
this.hubConnection
|
|
600
|
+
.start()
|
|
601
|
+
.then(() => this.signalRConnection_onSuccess())
|
|
602
|
+
.catch(err => {
|
|
603
|
+
console.error('Connection failed to SignalR Notification Hub')
|
|
604
|
+
})
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
private signalRConnection_onSuccess() {
|
|
608
|
+
this.addReceiveMessageDataListener();
|
|
609
|
+
|
|
610
|
+
this.notificationsApiService.retrieveNotifications().subscribe(data => {
|
|
611
|
+
this.serverNotifications = data;
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
stopSignalRConnection() {
|
|
616
|
+
if (this.hubConnection) {
|
|
617
|
+
this.hubConnection.stop();
|
|
618
|
+
this.hubConnection = null;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
private addReceiveMessageDataListener = () => {
|
|
623
|
+
this.hubConnection.on('ReceiveMessage', (message) => {
|
|
624
|
+
if (message) {
|
|
625
|
+
if (message.type === 'error') {
|
|
626
|
+
this.error(message.text, null, null, false);
|
|
627
|
+
}
|
|
628
|
+
else {
|
|
629
|
+
this.success(message.text, null, null, false);
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
const notification = {
|
|
633
|
+
id: message.id,
|
|
634
|
+
isNew: message.isNew,
|
|
635
|
+
isSession: true,
|
|
636
|
+
text: message.text,
|
|
637
|
+
type: message.type,
|
|
638
|
+
createdDate: message.createdDate
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
this.addSessionNotificationToList(notification);
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
*/
|
|
646
|
+
addSessionNotification(text, type) {
|
|
647
|
+
const id = Guid.newGuid();
|
|
648
|
+
const notification = { id, isNew: true, isSession: true, text, type, createdDate: new Date(Date.now()).toISOString() };
|
|
649
|
+
this.addSessionNotificationToList(notification);
|
|
650
|
+
}
|
|
651
|
+
addSessionNotificationToList(notification) {
|
|
652
|
+
this.sessionNotifications = [
|
|
653
|
+
notification,
|
|
654
|
+
...this.sessionNotifications,
|
|
655
|
+
];
|
|
656
|
+
}
|
|
657
|
+
// Public API
|
|
658
|
+
removeNotification(id, isSession) {
|
|
659
|
+
if (isSession) {
|
|
660
|
+
this.sessionNotifications = this.sessionNotifications.filter(notifications => notifications.id !== id);
|
|
661
|
+
}
|
|
662
|
+
else {
|
|
663
|
+
this.serverNotifications = this.serverNotifications.filter(notifications => notifications.id !== id);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
success(text, params, title, createSessionNotification = true) {
|
|
667
|
+
text = Utils.getLocalizedValue(text, params, 'OperationSuccessFull');
|
|
668
|
+
title = Utils.getLocalizedValue(title);
|
|
669
|
+
this.toastrService.success(text, title, {
|
|
670
|
+
timeOut: 3000,
|
|
671
|
+
progressBar: true
|
|
672
|
+
});
|
|
673
|
+
if (createSessionNotification) {
|
|
674
|
+
this.addSessionNotification(text, 'success');
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
info(text, params, title) {
|
|
678
|
+
text = Utils.getLocalizedValue(text, params);
|
|
679
|
+
title = Utils.getLocalizedValue(title);
|
|
680
|
+
this.toastrService.info(text, title, {
|
|
681
|
+
timeOut: 3000,
|
|
682
|
+
progressBar: true
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
warning(text, params, title) {
|
|
686
|
+
text = Utils.getLocalizedValue(text, params);
|
|
687
|
+
title = Utils.getLocalizedValue(title);
|
|
688
|
+
this.toastrService.warning(text, title, {
|
|
689
|
+
timeOut: 3000,
|
|
690
|
+
progressBar: true
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
error(text, params, title, createSessionNotification = true) {
|
|
694
|
+
text = Utils.getLocalizedValue(text, params, 'ErrorOccured');
|
|
695
|
+
title = Utils.getLocalizedValue(title);
|
|
696
|
+
this.toastrService.error(text, title, {
|
|
697
|
+
timeOut: 3000,
|
|
698
|
+
progressBar: true
|
|
699
|
+
});
|
|
700
|
+
if (createSessionNotification) {
|
|
701
|
+
this.addSessionNotification(text, 'error');
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
cancel(text, params, title) {
|
|
705
|
+
text = Utils.getLocalizedValue(text, params, 'OperationCancelled');
|
|
706
|
+
title = Utils.getLocalizedValue(title);
|
|
707
|
+
this.toastrService.info(text, title, {
|
|
708
|
+
timeOut: 3000,
|
|
709
|
+
progressBar: true
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
// SessionNotifications
|
|
713
|
+
get sessionNotifications() {
|
|
714
|
+
return this._sessionNotifications.getValue();
|
|
715
|
+
}
|
|
716
|
+
set sessionNotifications(val) {
|
|
717
|
+
this._sessionNotifications.next(val);
|
|
718
|
+
}
|
|
719
|
+
// ServerNotifications
|
|
720
|
+
get serverNotifications() {
|
|
721
|
+
return this._serverNotifications.getValue();
|
|
722
|
+
}
|
|
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';
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
LocalizationService.ɵprov = ɵɵdefineInjectable({ factory: function LocalizationService_Factory() { return new LocalizationService(ɵɵinject(TranslateService)); }, token: LocalizationService, providedIn: "root" });
|
|
885
|
+
LocalizationService.decorators = [
|
|
567
886
|
{ type: Injectable, args: [{
|
|
568
|
-
providedIn:
|
|
569
|
-
},] }
|
|
570
|
-
];
|
|
571
|
-
LoadingService.ctorParameters = () => [];
|
|
572
|
-
|
|
573
|
-
const providers = [
|
|
574
|
-
LoggingService,
|
|
575
|
-
AppContextService,
|
|
576
|
-
LoadingService
|
|
577
|
-
];
|
|
578
|
-
let InjectorInstance;
|
|
579
|
-
class AnatolyCoreModule {
|
|
580
|
-
constructor(injector, parentModule) {
|
|
581
|
-
this.injector = injector;
|
|
582
|
-
throwIfAlreadyLoaded(parentModule, 'AnatolyCoreModule');
|
|
583
|
-
InjectorInstance = this.injector;
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
AnatolyCoreModule.decorators = [
|
|
587
|
-
{ type: NgModule, args: [{
|
|
588
|
-
imports: [CommonModule],
|
|
589
|
-
providers: [...providers],
|
|
887
|
+
providedIn: 'root'
|
|
590
888
|
},] }
|
|
591
889
|
];
|
|
592
|
-
|
|
593
|
-
{ type:
|
|
594
|
-
{ type: AnatolyCoreModule, decorators: [{ type: Optional }, { type: SkipSelf }] }
|
|
890
|
+
LocalizationService.ctorParameters = () => [
|
|
891
|
+
{ type: TranslateService }
|
|
595
892
|
];
|
|
596
893
|
|
|
597
894
|
/*
|
|
@@ -612,13 +909,13 @@ AnatolyCoreModule.ctorParameters = () => [
|
|
|
612
909
|
Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
|
|
613
910
|
</file>
|
|
614
911
|
*/
|
|
615
|
-
// @dynamic
|
|
616
912
|
class Utils {
|
|
617
913
|
static getValueByNameInQS(name) {
|
|
618
914
|
return Utils.getValueByName(location.search, name);
|
|
619
915
|
}
|
|
620
916
|
static getValueByName(url, name) {
|
|
621
917
|
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
|
|
918
|
+
// tslint:disable-next-line:one-variable-per-declaration
|
|
622
919
|
const regex = new RegExp('[\\?&]' + name + '=([^&#]*)'), results = regex.exec(url);
|
|
623
920
|
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
|
|
624
921
|
}
|
|
@@ -664,16 +961,6 @@ class Utils {
|
|
|
664
961
|
}
|
|
665
962
|
return key;
|
|
666
963
|
}
|
|
667
|
-
/**
|
|
668
|
-
* Convert date time lo local time zone value.
|
|
669
|
-
* @param value
|
|
670
|
-
*/
|
|
671
|
-
static convertToLocalizedDateTime(value) {
|
|
672
|
-
if (value) {
|
|
673
|
-
return new Date(Date.UTC(value.getFullYear(), value.getMonth(), value.getDate(), value.getHours(), value.getMinutes(), value.getSeconds(), value.getMilliseconds()));
|
|
674
|
-
}
|
|
675
|
-
return null;
|
|
676
|
-
}
|
|
677
964
|
static downloadBlobFile(value, fileName) {
|
|
678
965
|
if (window.navigator.msSaveOrOpenBlob) {
|
|
679
966
|
window.navigator.msSaveOrOpenBlob(value, fileName);
|
|
@@ -719,30 +1006,6 @@ class Subs {
|
|
|
719
1006
|
}
|
|
720
1007
|
}
|
|
721
1008
|
|
|
722
|
-
/*
|
|
723
|
-
<file>
|
|
724
|
-
Project:
|
|
725
|
-
@osovitny/anatoly
|
|
726
|
-
|
|
727
|
-
Authors:
|
|
728
|
-
Vadim Osovitny
|
|
729
|
-
Anatoly Osovitny
|
|
730
|
-
|
|
731
|
-
Created:
|
|
732
|
-
26 Jun 2020
|
|
733
|
-
|
|
734
|
-
Version:
|
|
735
|
-
1.0
|
|
736
|
-
|
|
737
|
-
Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
|
|
738
|
-
</file>
|
|
739
|
-
*/
|
|
740
|
-
class Guid {
|
|
741
|
-
static newGuid() {
|
|
742
|
-
return v4();
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
|
|
746
1009
|
/*
|
|
747
1010
|
<file>
|
|
748
1011
|
Project:
|
|
@@ -1063,6 +1326,30 @@ BaseGridEditService.ctorParameters = () => [
|
|
|
1063
1326
|
{ type: HttpClient }
|
|
1064
1327
|
];
|
|
1065
1328
|
|
|
1329
|
+
/*
|
|
1330
|
+
<file>
|
|
1331
|
+
Project:
|
|
1332
|
+
@osovitny/anatoly
|
|
1333
|
+
|
|
1334
|
+
Authors:
|
|
1335
|
+
Vadim Osovitny
|
|
1336
|
+
Anatoly Osovitny
|
|
1337
|
+
|
|
1338
|
+
Created:
|
|
1339
|
+
30 April 2020
|
|
1340
|
+
|
|
1341
|
+
Version:
|
|
1342
|
+
1.0
|
|
1343
|
+
|
|
1344
|
+
Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
|
|
1345
|
+
</file>
|
|
1346
|
+
*/
|
|
1347
|
+
const consts = {
|
|
1348
|
+
billingApiPath: "api/billing",
|
|
1349
|
+
// Notifications API
|
|
1350
|
+
notificationsApiPath: 'api/notifications',
|
|
1351
|
+
};
|
|
1352
|
+
|
|
1066
1353
|
/*
|
|
1067
1354
|
<file>
|
|
1068
1355
|
Project:
|
|
@@ -1085,12 +1372,10 @@ class BillingApiService extends BaseApiService {
|
|
|
1085
1372
|
constructor(http) {
|
|
1086
1373
|
super(http);
|
|
1087
1374
|
this.http = http;
|
|
1088
|
-
this.baseUrl
|
|
1375
|
+
this.baseUrl = consts.billingApiPath;
|
|
1089
1376
|
}
|
|
1090
1377
|
requestNewSubscription(requestedPlan, success, error) {
|
|
1091
|
-
this.postQS("requestNewSubscription", {
|
|
1092
|
-
requestedPlan: requestedPlan,
|
|
1093
|
-
}).subscribe((data) => { }, (e) => {
|
|
1378
|
+
this.postQS("requestNewSubscription", { requestedPlan: requestedPlan }).subscribe((data) => { }, (e) => {
|
|
1094
1379
|
if (error)
|
|
1095
1380
|
error();
|
|
1096
1381
|
}, () => {
|
|
@@ -1143,12 +1428,22 @@ BillingApiService.ctorParameters = () => [
|
|
|
1143
1428
|
</file>
|
|
1144
1429
|
*/
|
|
1145
1430
|
class AnatolyDataModule {
|
|
1431
|
+
constructor(parentModule) {
|
|
1432
|
+
throwIfAlreadyLoaded(parentModule, 'AnatolyDataModule');
|
|
1433
|
+
}
|
|
1146
1434
|
}
|
|
1147
1435
|
AnatolyDataModule.decorators = [
|
|
1148
1436
|
{ type: NgModule, args: [{
|
|
1149
|
-
imports: [
|
|
1150
|
-
|
|
1437
|
+
imports: [
|
|
1438
|
+
CommonModule
|
|
1439
|
+
],
|
|
1440
|
+
providers: [
|
|
1441
|
+
BillingApiService
|
|
1442
|
+
],
|
|
1151
1443
|
},] }
|
|
1444
|
+
];
|
|
1445
|
+
AnatolyDataModule.ctorParameters = () => [
|
|
1446
|
+
{ type: AnatolyDataModule, decorators: [{ type: Optional }, { type: SkipSelf }] }
|
|
1152
1447
|
];
|
|
1153
1448
|
|
|
1154
1449
|
/*
|
|
@@ -2179,6 +2474,288 @@ AnatolyUIModule.decorators = [
|
|
|
2179
2474
|
</file>
|
|
2180
2475
|
*/
|
|
2181
2476
|
|
|
2477
|
+
/*
|
|
2478
|
+
<file>
|
|
2479
|
+
Project:
|
|
2480
|
+
@osovitny/anatoly
|
|
2481
|
+
|
|
2482
|
+
Authors:
|
|
2483
|
+
Vadim Osovitny
|
|
2484
|
+
Anatoly Osovitny
|
|
2485
|
+
|
|
2486
|
+
Created:
|
|
2487
|
+
10 May 2020
|
|
2488
|
+
|
|
2489
|
+
Version:
|
|
2490
|
+
1.0
|
|
2491
|
+
|
|
2492
|
+
Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
|
|
2493
|
+
</file>
|
|
2494
|
+
*/
|
|
2495
|
+
class LocalizePipe {
|
|
2496
|
+
constructor(localizeService) {
|
|
2497
|
+
this.localizeService = localizeService;
|
|
2498
|
+
}
|
|
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;
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2529
|
+
LocalizePipe.decorators = [
|
|
2530
|
+
{ type: Pipe, args: [{
|
|
2531
|
+
name: 'localize'
|
|
2532
|
+
},] }
|
|
2533
|
+
];
|
|
2534
|
+
LocalizePipe.ctorParameters = () => [
|
|
2535
|
+
{ type: LocalizationService }
|
|
2536
|
+
];
|
|
2537
|
+
|
|
2538
|
+
/*
|
|
2539
|
+
<file>
|
|
2540
|
+
Project:
|
|
2541
|
+
@osovitny/anatoly
|
|
2542
|
+
|
|
2543
|
+
Authors:
|
|
2544
|
+
Vadim Osovitny
|
|
2545
|
+
Anatoly Osovitny
|
|
2546
|
+
|
|
2547
|
+
Created:
|
|
2548
|
+
12 May 2020
|
|
2549
|
+
|
|
2550
|
+
Version:
|
|
2551
|
+
1.0
|
|
2552
|
+
|
|
2553
|
+
Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
|
|
2554
|
+
</file>
|
|
2555
|
+
*/
|
|
2556
|
+
class LocalizationModule {
|
|
2557
|
+
}
|
|
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: []
|
|
2571
|
+
},] }
|
|
2572
|
+
];
|
|
2573
|
+
|
|
2574
|
+
/*
|
|
2575
|
+
<file>
|
|
2576
|
+
Project:
|
|
2577
|
+
@osovitny/anatoly
|
|
2578
|
+
|
|
2579
|
+
Authors:
|
|
2580
|
+
Vadim Osovitny
|
|
2581
|
+
Anatoly Osovitny
|
|
2582
|
+
|
|
2583
|
+
Created:
|
|
2584
|
+
05 May 2020
|
|
2585
|
+
|
|
2586
|
+
Version:
|
|
2587
|
+
1.0
|
|
2588
|
+
|
|
2589
|
+
Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
|
|
2590
|
+
</file>
|
|
2591
|
+
*/
|
|
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]
|
|
2614
|
+
}
|
|
2615
|
+
});
|
|
2616
|
+
class LocalizationSettingsModule {
|
|
2617
|
+
}
|
|
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: []
|
|
2632
|
+
},] }
|
|
2633
|
+
];
|
|
2634
|
+
|
|
2635
|
+
/*
|
|
2636
|
+
<file>
|
|
2637
|
+
Project:
|
|
2638
|
+
@osovitny/anatoly
|
|
2639
|
+
|
|
2640
|
+
Authors:
|
|
2641
|
+
Vadim Osovitny
|
|
2642
|
+
Anatoly Osovitny
|
|
2643
|
+
|
|
2644
|
+
Created:
|
|
2645
|
+
26 Jun 2020
|
|
2646
|
+
|
|
2647
|
+
Version:
|
|
2648
|
+
1.0
|
|
2649
|
+
|
|
2650
|
+
Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
|
|
2651
|
+
</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
|
+
*/
|
|
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
|
+
}
|
|
2758
|
+
|
|
2182
2759
|
/*
|
|
2183
2760
|
* Public API Surface of anatoly
|
|
2184
2761
|
*/
|
|
@@ -2187,5 +2764,5 @@ AnatolyUIModule.decorators = [
|
|
|
2187
2764
|
* Generated bundle index. Do not edit.
|
|
2188
2765
|
*/
|
|
2189
2766
|
|
|
2190
|
-
export { Alerts, AnatolyCoreModule, AnatolyDataModule, AnatolyHttpInterceptor, AnatolyUIModule, AppContextService, AppCoreSettings, BaseApiService, BaseComponent, BaseEditComponent, BaseGoService, BaseGridEditService, BaseGridReadService, BillingApiService, BuyAccessButtonComponent, ContentHeaderComponent, ContextInitState, FormValidationSummaryComponent, FormsHtmlEditorComponent, GlobalErrorHandler, Guid, HtmlEditorComponent, ItemValidationSummaryComponent, LoadingService, LoggingService, NativeElementDirective, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, Subs, SubscribePlanButtonComponent, UpgradePlanButtonComponent, Utils, ValidationSummaryComponent, throwIfAlreadyLoaded };
|
|
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 };
|
|
2191
2768
|
//# sourceMappingURL=osovitny-anatoly.js.map
|