@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,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('sweetalert2'), require('@angular/core'), require('@
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@osovitny/anatoly', ['exports', 'sweetalert2', '@angular/core', '@
|
|
4
|
-
(global = global || self, factory((global.osovitny = global.osovitny || {}, global.osovitny.anatoly = {}), global.Swal, global.ng.core, global.
|
|
5
|
-
}(this, (function (exports, Swal, i0,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('sweetalert2'), require('@angular/core'), require('@angular/common'), require('@angular/common/http'), require('rxjs/operators'), require('rxjs'), require('ngx-toastr'), require('uuid'), require('@ngx-translate/core'), require('date-fns'), require('date-fns/locale/en-US'), require('@angular/router'), require('@angular/forms'), require('angular-froala-wysiwyg'), require('@ngx-translate/http-loader')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@osovitny/anatoly', ['exports', 'sweetalert2', '@angular/core', '@angular/common', '@angular/common/http', 'rxjs/operators', 'rxjs', 'ngx-toastr', 'uuid', '@ngx-translate/core', 'date-fns', 'date-fns/locale/en-US', '@angular/router', '@angular/forms', 'angular-froala-wysiwyg', '@ngx-translate/http-loader'], factory) :
|
|
4
|
+
(global = global || self, factory((global.osovitny = global.osovitny || {}, global.osovitny.anatoly = {}), global.Swal, global.ng.core, global.ng.common, global.ng.common.http, global.rxjs.operators, global.rxjs, global.i1, global.uuid, global.i1$1, global.dateFns, global.enUS, global.ng.router, global.ng.forms, global.angularFroalaWysiwyg, global.httpLoader));
|
|
5
|
+
}(this, (function (exports, Swal, i0, common, http, operators, rxjs, i1, uuid, i1$1, dateFns, enUS, router, forms, angularFroalaWysiwyg, httpLoader) { 'use strict';
|
|
6
6
|
|
|
7
7
|
Swal = Swal && Object.prototype.hasOwnProperty.call(Swal, 'default') ? Swal['default'] : Swal;
|
|
8
8
|
enUS = enUS && Object.prototype.hasOwnProperty.call(enUS, 'default') ? enUS['default'] : enUS;
|
|
@@ -28,6 +28,28 @@
|
|
|
28
28
|
var ContextInitState = JSON.parse((document.getElementById('contextInitState')).getAttribute('data-contextinitstate'));
|
|
29
29
|
var AppCoreSettings = JSON.parse((document.getElementById('appCoreSettings')).getAttribute('data-appcoresettings'));
|
|
30
30
|
|
|
31
|
+
/*
|
|
32
|
+
<file>
|
|
33
|
+
Project:
|
|
34
|
+
MICE
|
|
35
|
+
|
|
36
|
+
Authors:
|
|
37
|
+
Vadim Osovitny vaosovitny@deloitte.com
|
|
38
|
+
|
|
39
|
+
Created:
|
|
40
|
+
5 May 2020
|
|
41
|
+
|
|
42
|
+
Version:
|
|
43
|
+
1.0
|
|
44
|
+
|
|
45
|
+
Copyright (c) 2020 Deloitte Tax. All rights reserved.
|
|
46
|
+
</file>
|
|
47
|
+
*/
|
|
48
|
+
var Urls = {
|
|
49
|
+
// SignalR Notifications
|
|
50
|
+
notificationsSocketUrl: '/hubs/notifications'
|
|
51
|
+
};
|
|
52
|
+
|
|
31
53
|
/*
|
|
32
54
|
<file>
|
|
33
55
|
Project:
|
|
@@ -94,41 +116,41 @@
|
|
|
94
116
|
}
|
|
95
117
|
Alerts.Info = function (text) {
|
|
96
118
|
Swal.fire({
|
|
97
|
-
title:
|
|
119
|
+
title: 'Information',
|
|
98
120
|
text: text,
|
|
99
|
-
icon:
|
|
100
|
-
confirmButtonText:
|
|
121
|
+
icon: 'info',
|
|
122
|
+
confirmButtonText: 'OK',
|
|
101
123
|
});
|
|
102
124
|
};
|
|
103
125
|
Alerts.Warning = function (text) {
|
|
104
126
|
Swal.fire({
|
|
105
|
-
title:
|
|
127
|
+
title: 'Warning',
|
|
106
128
|
text: text,
|
|
107
|
-
icon:
|
|
108
|
-
confirmButtonText:
|
|
129
|
+
icon: 'warning',
|
|
130
|
+
confirmButtonText: 'OK',
|
|
109
131
|
});
|
|
110
132
|
};
|
|
111
133
|
Alerts.Error = function (text) {
|
|
112
134
|
Swal.fire({
|
|
113
|
-
title:
|
|
135
|
+
title: 'Error',
|
|
114
136
|
text: text,
|
|
115
|
-
icon:
|
|
116
|
-
confirmButtonText:
|
|
137
|
+
icon: 'error',
|
|
138
|
+
confirmButtonText: 'OK',
|
|
117
139
|
});
|
|
118
140
|
};
|
|
119
141
|
Alerts.NotImplemented = function () {
|
|
120
|
-
this.Warning(
|
|
142
|
+
this.Warning('Not Implemented Yet');
|
|
121
143
|
};
|
|
122
144
|
Alerts.ErrorOccurred = function () {
|
|
123
|
-
this.Error(
|
|
145
|
+
this.Error('Sorry, an unexpected error occurred');
|
|
124
146
|
};
|
|
125
147
|
Alerts.AreYouSure = function (text, title, confirmButtonText, cancelButtonText, successAction, cancelAction) {
|
|
126
|
-
if (typeof title
|
|
127
|
-
title =
|
|
148
|
+
if (typeof title === 'undefined' || title == null)
|
|
149
|
+
title = 'Are you sure?';
|
|
128
150
|
Swal.fire({
|
|
129
151
|
title: title,
|
|
130
152
|
text: text,
|
|
131
|
-
icon:
|
|
153
|
+
icon: 'warning',
|
|
132
154
|
confirmButtonText: confirmButtonText,
|
|
133
155
|
cancelButtonText: cancelButtonText,
|
|
134
156
|
showCancelButton: true,
|
|
@@ -139,8 +161,8 @@
|
|
|
139
161
|
}
|
|
140
162
|
}
|
|
141
163
|
// result.dismiss can be 'cancel', 'overlay', 'close', and 'timer'
|
|
142
|
-
else if (result.dismiss
|
|
143
|
-
result.dismiss
|
|
164
|
+
else if (result.dismiss === Swal.DismissReason.cancel ||
|
|
165
|
+
result.dismiss === Swal.DismissReason.close) {
|
|
144
166
|
if (cancelAction) {
|
|
145
167
|
cancelAction();
|
|
146
168
|
}
|
|
@@ -148,16 +170,16 @@
|
|
|
148
170
|
});
|
|
149
171
|
};
|
|
150
172
|
Alerts.Success = function (text, title, successAction) {
|
|
151
|
-
if (typeof title
|
|
152
|
-
title =
|
|
173
|
+
if (typeof title === 'undefined' || title == null)
|
|
174
|
+
title = 'Success';
|
|
153
175
|
if (!text) {
|
|
154
|
-
text =
|
|
176
|
+
text = 'Operation was successful';
|
|
155
177
|
}
|
|
156
178
|
Swal.fire({
|
|
157
179
|
title: title,
|
|
158
180
|
text: text,
|
|
159
|
-
icon:
|
|
160
|
-
confirmButtonText:
|
|
181
|
+
icon: 'success',
|
|
182
|
+
confirmButtonText: 'OK',
|
|
161
183
|
}).then(function () {
|
|
162
184
|
if (successAction) {
|
|
163
185
|
successAction();
|
|
@@ -166,25 +188,25 @@
|
|
|
166
188
|
};
|
|
167
189
|
Alerts.Cancel = function (text) {
|
|
168
190
|
if (!text) {
|
|
169
|
-
text =
|
|
191
|
+
text = 'Operation has been cancled';
|
|
170
192
|
}
|
|
171
193
|
Swal.fire({
|
|
172
|
-
title:
|
|
194
|
+
title: 'Cancelled',
|
|
173
195
|
text: text,
|
|
174
|
-
icon:
|
|
196
|
+
icon: 'info',
|
|
175
197
|
});
|
|
176
198
|
};
|
|
177
|
-
//Notifications
|
|
199
|
+
// Notifications
|
|
178
200
|
Alerts.NotificationCancel = function (text, title) {
|
|
179
|
-
if (typeof title
|
|
180
|
-
title =
|
|
201
|
+
if (typeof title === 'undefined' || title == null) {
|
|
202
|
+
title = 'Canceled';
|
|
181
203
|
}
|
|
182
204
|
if (!text) {
|
|
183
|
-
text =
|
|
205
|
+
text = 'Operation has been canceled';
|
|
184
206
|
}
|
|
185
207
|
var toast = Swal.mixin({
|
|
186
208
|
toast: true,
|
|
187
|
-
position:
|
|
209
|
+
position: 'top-end',
|
|
188
210
|
showConfirmButton: false,
|
|
189
211
|
timer: 3000,
|
|
190
212
|
timerProgressBar: true,
|
|
@@ -192,19 +214,19 @@
|
|
|
192
214
|
toast.fire({
|
|
193
215
|
title: title,
|
|
194
216
|
text: text,
|
|
195
|
-
icon:
|
|
217
|
+
icon: 'info',
|
|
196
218
|
});
|
|
197
219
|
};
|
|
198
220
|
Alerts.NotificationSuccess = function (text, title) {
|
|
199
|
-
if (typeof title
|
|
200
|
-
title =
|
|
221
|
+
if (typeof title === 'undefined' || title == null) {
|
|
222
|
+
title = 'Success';
|
|
201
223
|
}
|
|
202
224
|
if (!text) {
|
|
203
|
-
text =
|
|
225
|
+
text = 'Operation was successful';
|
|
204
226
|
}
|
|
205
227
|
var toast = Swal.mixin({
|
|
206
228
|
toast: true,
|
|
207
|
-
position:
|
|
229
|
+
position: 'top-end',
|
|
208
230
|
showConfirmButton: false,
|
|
209
231
|
timer: 3000,
|
|
210
232
|
timerProgressBar: true,
|
|
@@ -212,115 +234,12 @@
|
|
|
212
234
|
toast.fire({
|
|
213
235
|
title: title,
|
|
214
236
|
text: text,
|
|
215
|
-
icon:
|
|
237
|
+
icon: 'success',
|
|
216
238
|
});
|
|
217
239
|
};
|
|
218
240
|
return Alerts;
|
|
219
241
|
}());
|
|
220
242
|
|
|
221
|
-
/*
|
|
222
|
-
<file>
|
|
223
|
-
Project:
|
|
224
|
-
@osovitny/anatoly
|
|
225
|
-
|
|
226
|
-
Authors:
|
|
227
|
-
Vadim Osovitny
|
|
228
|
-
Anatoly Osovitny
|
|
229
|
-
|
|
230
|
-
Created:
|
|
231
|
-
05 May 2020
|
|
232
|
-
|
|
233
|
-
Version:
|
|
234
|
-
1.0
|
|
235
|
-
|
|
236
|
-
Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
|
|
237
|
-
</file>
|
|
238
|
-
*/
|
|
239
|
-
var LocalizationService = /** @class */ (function () {
|
|
240
|
-
function LocalizationService(translate) {
|
|
241
|
-
this.translate = translate;
|
|
242
|
-
this.setSupportedLanguages(['en']);
|
|
243
|
-
}
|
|
244
|
-
LocalizationService.prototype.format = function (str, args) {
|
|
245
|
-
// tslint:disable-next-line:variable-name
|
|
246
|
-
return str.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] !== 'undefined' ? args[number] : match; });
|
|
247
|
-
};
|
|
248
|
-
;
|
|
249
|
-
LocalizationService.prototype.configureTranslationSettings = function (translate) {
|
|
250
|
-
var languageToSet = 'en';
|
|
251
|
-
translate.setDefaultLang(languageToSet);
|
|
252
|
-
return languageToSet;
|
|
253
|
-
};
|
|
254
|
-
LocalizationService.prototype.getBrowserLanguage = function () {
|
|
255
|
-
return this.translate.getBrowserLang();
|
|
256
|
-
};
|
|
257
|
-
LocalizationService.prototype.getDatefnsLocale = function () {
|
|
258
|
-
var dfnLocale;
|
|
259
|
-
switch (this.getBrowserLanguage()) {
|
|
260
|
-
case 'en':
|
|
261
|
-
dfnLocale = { locale: enUS };
|
|
262
|
-
break;
|
|
263
|
-
default:
|
|
264
|
-
dfnLocale = { locale: enUS };
|
|
265
|
-
}
|
|
266
|
-
return dfnLocale;
|
|
267
|
-
};
|
|
268
|
-
LocalizationService.prototype.setDefaultLanguage = function (lang) {
|
|
269
|
-
this.translate.setDefaultLang(lang);
|
|
270
|
-
};
|
|
271
|
-
LocalizationService.prototype.setSupportedLanguages = function (languages) {
|
|
272
|
-
this.translate.addLangs(languages);
|
|
273
|
-
};
|
|
274
|
-
LocalizationService.prototype.updateLanguage = function (language) {
|
|
275
|
-
this.translate.use(language);
|
|
276
|
-
};
|
|
277
|
-
LocalizationService.prototype.getLocalizedValue = function (key, params) {
|
|
278
|
-
var value = this.translate.instant(key);
|
|
279
|
-
if (!params || params.length === 0) {
|
|
280
|
-
return value;
|
|
281
|
-
}
|
|
282
|
-
return this.format(value, params);
|
|
283
|
-
};
|
|
284
|
-
LocalizationService.prototype.getLocalizedDate = function (key) {
|
|
285
|
-
if (dateFns.isValid(new Date(key))) {
|
|
286
|
-
return dateFns.format(new Date(key), AppCoreSettings.DATE_FORMATS.angular, this.dateFnsLocale);
|
|
287
|
-
}
|
|
288
|
-
return 'Invalid Date';
|
|
289
|
-
};
|
|
290
|
-
LocalizationService.prototype.getLocalizedDateTime = function (key) {
|
|
291
|
-
// To Do Manoj: Test in IE and make TimeZone specific changes accordingly
|
|
292
|
-
var dateValue = new Date(key);
|
|
293
|
-
if (dateFns.isValid(dateValue)) {
|
|
294
|
-
var localDate = Utils.convertToLocalizedDateTime(dateValue);
|
|
295
|
-
return dateFns.format(localDate, AppCoreSettings.DATE_FORMATS.angularWithTime, this.dateFnsLocale);
|
|
296
|
-
}
|
|
297
|
-
return 'Invalid Date';
|
|
298
|
-
};
|
|
299
|
-
LocalizationService.prototype.getLocalizedDistanceToNowInWords = function (date) {
|
|
300
|
-
// https://date-fns.org/v1.30.1/docs/distanceInWords
|
|
301
|
-
if (dateFns.isValid(new Date(date))) {
|
|
302
|
-
return dateFns.formatDistanceToNow(new Date(date), this.dateFnsLocale);
|
|
303
|
-
}
|
|
304
|
-
return 'Invalid Date';
|
|
305
|
-
};
|
|
306
|
-
LocalizationService.prototype.getLocalizedDistanceInWords = function (endedDate, startedDate) {
|
|
307
|
-
if (dateFns.isValid(new Date(endedDate)) && dateFns.isValid(new Date(startedDate))) {
|
|
308
|
-
return dateFns.formatDistance(new Date(endedDate), new Date(startedDate), this.dateFnsLocale);
|
|
309
|
-
}
|
|
310
|
-
return 'Invalid Date';
|
|
311
|
-
};
|
|
312
|
-
return LocalizationService;
|
|
313
|
-
}());
|
|
314
|
-
LocalizationService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LocalizationService_Factory() { return new LocalizationService(i0.ɵɵinject(i1.TranslateService)); }, token: LocalizationService, providedIn: "root" });
|
|
315
|
-
LocalizationService.decorators = [
|
|
316
|
-
{ type: i0.Injectable, args: [{
|
|
317
|
-
providedIn: 'root'
|
|
318
|
-
},] }
|
|
319
|
-
];
|
|
320
|
-
LocalizationService.ctorParameters = function () { return [
|
|
321
|
-
{ type: i1.TranslateService }
|
|
322
|
-
]; };
|
|
323
|
-
|
|
324
243
|
/*! *****************************************************************************
|
|
325
244
|
Copyright (c) Microsoft Corporation.
|
|
326
245
|
|
|
@@ -680,15 +599,15 @@
|
|
|
680
599
|
var BaseApiService = /** @class */ (function () {
|
|
681
600
|
function BaseApiService(http) {
|
|
682
601
|
this.http = http;
|
|
683
|
-
this.baseUrl =
|
|
602
|
+
this.baseUrl = '';
|
|
684
603
|
}
|
|
685
604
|
BaseApiService.prototype.serializeParams = function (data) {
|
|
686
|
-
return data ?
|
|
605
|
+
return data ? '?' + $.param(data) : '';
|
|
687
606
|
};
|
|
688
|
-
//api
|
|
607
|
+
// api
|
|
689
608
|
BaseApiService.prototype.get = function (action, data, responseType) {
|
|
690
609
|
if (!responseType) {
|
|
691
|
-
responseType =
|
|
610
|
+
responseType = 'json';
|
|
692
611
|
}
|
|
693
612
|
var url = this.baseUrl + "/" + action + this.serializeParams(data);
|
|
694
613
|
return this.http
|
|
@@ -697,46 +616,42 @@
|
|
|
697
616
|
};
|
|
698
617
|
BaseApiService.prototype.post = function (action, data, responseType) {
|
|
699
618
|
if (!responseType) {
|
|
700
|
-
responseType =
|
|
619
|
+
responseType = 'text';
|
|
701
620
|
}
|
|
702
621
|
var url = this.baseUrl + "/" + action;
|
|
703
622
|
return this.http.post(url, data, { responseType: responseType });
|
|
704
623
|
};
|
|
705
624
|
BaseApiService.prototype.postQS = function (action, data, responseType) {
|
|
706
625
|
if (!responseType) {
|
|
707
|
-
responseType =
|
|
626
|
+
responseType = 'text';
|
|
708
627
|
}
|
|
709
628
|
var url = this.baseUrl + "/" + action + this.serializeParams(data);
|
|
710
629
|
return this.http.post(url, null, { responseType: responseType });
|
|
711
630
|
};
|
|
712
631
|
BaseApiService.prototype.delete = function (action, data, responseType) {
|
|
713
632
|
if (!responseType) {
|
|
714
|
-
responseType =
|
|
633
|
+
responseType = 'text';
|
|
715
634
|
}
|
|
716
635
|
var url = this.baseUrl + "/" + action + this.serializeParams(data);
|
|
717
636
|
return this.http.delete(url, { responseType: responseType });
|
|
718
637
|
};
|
|
719
|
-
//gets
|
|
638
|
+
// gets
|
|
720
639
|
BaseApiService.prototype.getById = function (id) {
|
|
721
|
-
return this.get(
|
|
640
|
+
return this.get('getById', { id: id });
|
|
722
641
|
};
|
|
723
642
|
BaseApiService.prototype.getAll = function (data) {
|
|
724
|
-
return this.get(
|
|
643
|
+
return this.get('getall', data).pipe(operators.map(function (res) { return res; }));
|
|
725
644
|
};
|
|
726
645
|
BaseApiService.prototype.getJsonFile = function (fileName, jsonUrl, jsonVersion) {
|
|
727
646
|
if (!jsonUrl) {
|
|
728
|
-
jsonUrl =
|
|
647
|
+
jsonUrl = '/dist/jsons';
|
|
729
648
|
}
|
|
730
649
|
if (!jsonVersion) {
|
|
731
|
-
jsonVersion =
|
|
650
|
+
jsonVersion = '1.0';
|
|
732
651
|
}
|
|
733
|
-
var url = jsonUrl +
|
|
652
|
+
var url = jsonUrl + '/' + fileName + '?' + jsonVersion;
|
|
734
653
|
return this.http.get(url).pipe(operators.map(function (res) { return res; }));
|
|
735
654
|
};
|
|
736
|
-
BaseApiService.prototype.getNewGuid = function () {
|
|
737
|
-
var url = this.baseUrl + "/getNewGuid";
|
|
738
|
-
return this.http.get(url, { responseType: "text" });
|
|
739
|
-
};
|
|
740
655
|
return BaseApiService;
|
|
741
656
|
}());
|
|
742
657
|
BaseApiService.decorators = [
|
|
@@ -846,8 +761,248 @@
|
|
|
846
761
|
];
|
|
847
762
|
LoadingService.ctorParameters = function () { return []; };
|
|
848
763
|
|
|
764
|
+
/*
|
|
765
|
+
<file>
|
|
766
|
+
Project:
|
|
767
|
+
@osovitny/anatoly
|
|
768
|
+
|
|
769
|
+
Authors:
|
|
770
|
+
Vadim Osovitny
|
|
771
|
+
Anatoly Osovitny
|
|
772
|
+
|
|
773
|
+
Created:
|
|
774
|
+
26 Jun 2020
|
|
775
|
+
|
|
776
|
+
Version:
|
|
777
|
+
1.0
|
|
778
|
+
|
|
779
|
+
Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
|
|
780
|
+
</file>
|
|
781
|
+
*/
|
|
782
|
+
var Guid = /** @class */ (function () {
|
|
783
|
+
function Guid() {
|
|
784
|
+
}
|
|
785
|
+
Guid.newGuid = function () {
|
|
786
|
+
return uuid.v4();
|
|
787
|
+
};
|
|
788
|
+
return Guid;
|
|
789
|
+
}());
|
|
790
|
+
|
|
791
|
+
// SignalR
|
|
792
|
+
// import * as signalR from '@microsoft/signalr';
|
|
793
|
+
// import { NotificationsApiService } from '../../../data/services/notifications/notifications-api-service';
|
|
794
|
+
var NotificationService = /** @class */ (function () {
|
|
795
|
+
function NotificationService(toastrService) {
|
|
796
|
+
this.toastrService = toastrService;
|
|
797
|
+
// SignalR
|
|
798
|
+
// private hubConnection: signalR.HubConnection;
|
|
799
|
+
// private socketUrl: string;
|
|
800
|
+
// Notifications
|
|
801
|
+
this._sessionNotifications = new rxjs.BehaviorSubject([]);
|
|
802
|
+
this._serverNotifications = new rxjs.BehaviorSubject([]);
|
|
803
|
+
// Public
|
|
804
|
+
this.sessionNotifications$ = this._sessionNotifications.asObservable();
|
|
805
|
+
this.serverNotifications$ = this._serverNotifications.asObservable();
|
|
806
|
+
// this.onInit();
|
|
807
|
+
}
|
|
808
|
+
/*
|
|
809
|
+
onInit() {
|
|
810
|
+
if (AppCoreSettings.AzureAD) {
|
|
811
|
+
this.authService.getAuthToken().subscribe((token: string) => {
|
|
812
|
+
this.startSignalRConnection(token);
|
|
813
|
+
});
|
|
814
|
+
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
this.startSignalRConnection();
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
ngOnDestroy() {
|
|
822
|
+
this.stopSignalRConnection();
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
// SignalR
|
|
826
|
+
private startSignalRConnection(accessToken?) {
|
|
827
|
+
const cskii = AppCoreSettings.selectedClientID;
|
|
828
|
+
// tslint:disable-next-line:variable-name
|
|
829
|
+
const cskii_upn = AppCoreSettings.CSKII_UPN;
|
|
830
|
+
// tslint:disable-next-line:variable-name
|
|
831
|
+
const cli_sessionguid = AppCoreSettings.CLI_SessionGUID;
|
|
832
|
+
|
|
833
|
+
const url = this.socketUrl + '?cskii=' + cskii + '&cskii_upn=' + cskii_upn + '&cli_sessionguid=' + cli_sessionguid;
|
|
834
|
+
|
|
835
|
+
if (accessToken) {
|
|
836
|
+
this.hubConnection = new signalR.HubConnectionBuilder()
|
|
837
|
+
.withUrl(url, {
|
|
838
|
+
skipNegotiation: false,
|
|
839
|
+
transport: signalR.HttpTransportType.WebSockets,
|
|
840
|
+
accessTokenFactory: () => accessToken
|
|
841
|
+
})
|
|
842
|
+
.withAutomaticReconnect()
|
|
843
|
+
.configureLogging(signalR.LogLevel.Debug)
|
|
844
|
+
.build();
|
|
845
|
+
}
|
|
846
|
+
else {
|
|
847
|
+
this.hubConnection = new signalR.HubConnectionBuilder()
|
|
848
|
+
.withUrl(this.socketUrl, {
|
|
849
|
+
skipNegotiation: true,
|
|
850
|
+
transport: signalR.HttpTransportType.WebSockets
|
|
851
|
+
})
|
|
852
|
+
.withAutomaticReconnect()
|
|
853
|
+
.configureLogging(signalR.LogLevel.Debug)
|
|
854
|
+
.build();
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
this.hubConnection
|
|
858
|
+
.start()
|
|
859
|
+
.then(() => this.signalRConnection_onSuccess())
|
|
860
|
+
.catch(err => {
|
|
861
|
+
console.error('Connection failed to SignalR Notification Hub')
|
|
862
|
+
})
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
private signalRConnection_onSuccess() {
|
|
866
|
+
this.addReceiveMessageDataListener();
|
|
867
|
+
|
|
868
|
+
this.notificationsApiService.retrieveNotifications().subscribe(data => {
|
|
869
|
+
this.serverNotifications = data;
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
stopSignalRConnection() {
|
|
874
|
+
if (this.hubConnection) {
|
|
875
|
+
this.hubConnection.stop();
|
|
876
|
+
this.hubConnection = null;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
private addReceiveMessageDataListener = () => {
|
|
881
|
+
this.hubConnection.on('ReceiveMessage', (message) => {
|
|
882
|
+
if (message) {
|
|
883
|
+
if (message.type === 'error') {
|
|
884
|
+
this.error(message.text, null, null, false);
|
|
885
|
+
}
|
|
886
|
+
else {
|
|
887
|
+
this.success(message.text, null, null, false);
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
const notification = {
|
|
891
|
+
id: message.id,
|
|
892
|
+
isNew: message.isNew,
|
|
893
|
+
isSession: true,
|
|
894
|
+
text: message.text,
|
|
895
|
+
type: message.type,
|
|
896
|
+
createdDate: message.createdDate
|
|
897
|
+
};
|
|
898
|
+
|
|
899
|
+
this.addSessionNotificationToList(notification);
|
|
900
|
+
}
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
*/
|
|
904
|
+
NotificationService.prototype.addSessionNotification = function (text, type) {
|
|
905
|
+
var id = Guid.newGuid();
|
|
906
|
+
var notification = { id: id, isNew: true, isSession: true, text: text, type: type, createdDate: new Date(Date.now()).toISOString() };
|
|
907
|
+
this.addSessionNotificationToList(notification);
|
|
908
|
+
};
|
|
909
|
+
NotificationService.prototype.addSessionNotificationToList = function (notification) {
|
|
910
|
+
this.sessionNotifications = __spread([
|
|
911
|
+
notification
|
|
912
|
+
], this.sessionNotifications);
|
|
913
|
+
};
|
|
914
|
+
// Public API
|
|
915
|
+
NotificationService.prototype.removeNotification = function (id, isSession) {
|
|
916
|
+
if (isSession) {
|
|
917
|
+
this.sessionNotifications = this.sessionNotifications.filter(function (notifications) { return notifications.id !== id; });
|
|
918
|
+
}
|
|
919
|
+
else {
|
|
920
|
+
this.serverNotifications = this.serverNotifications.filter(function (notifications) { return notifications.id !== id; });
|
|
921
|
+
}
|
|
922
|
+
};
|
|
923
|
+
NotificationService.prototype.success = function (text, params, title, createSessionNotification) {
|
|
924
|
+
if (createSessionNotification === void 0) { createSessionNotification = true; }
|
|
925
|
+
text = Utils.getLocalizedValue(text, params, 'OperationSuccessFull');
|
|
926
|
+
title = Utils.getLocalizedValue(title);
|
|
927
|
+
this.toastrService.success(text, title, {
|
|
928
|
+
timeOut: 3000,
|
|
929
|
+
progressBar: true
|
|
930
|
+
});
|
|
931
|
+
if (createSessionNotification) {
|
|
932
|
+
this.addSessionNotification(text, 'success');
|
|
933
|
+
}
|
|
934
|
+
};
|
|
935
|
+
NotificationService.prototype.info = function (text, params, title) {
|
|
936
|
+
text = Utils.getLocalizedValue(text, params);
|
|
937
|
+
title = Utils.getLocalizedValue(title);
|
|
938
|
+
this.toastrService.info(text, title, {
|
|
939
|
+
timeOut: 3000,
|
|
940
|
+
progressBar: true
|
|
941
|
+
});
|
|
942
|
+
};
|
|
943
|
+
NotificationService.prototype.warning = function (text, params, title) {
|
|
944
|
+
text = Utils.getLocalizedValue(text, params);
|
|
945
|
+
title = Utils.getLocalizedValue(title);
|
|
946
|
+
this.toastrService.warning(text, title, {
|
|
947
|
+
timeOut: 3000,
|
|
948
|
+
progressBar: true
|
|
949
|
+
});
|
|
950
|
+
};
|
|
951
|
+
NotificationService.prototype.error = function (text, params, title, createSessionNotification) {
|
|
952
|
+
if (createSessionNotification === void 0) { createSessionNotification = true; }
|
|
953
|
+
text = Utils.getLocalizedValue(text, params, 'ErrorOccured');
|
|
954
|
+
title = Utils.getLocalizedValue(title);
|
|
955
|
+
this.toastrService.error(text, title, {
|
|
956
|
+
timeOut: 3000,
|
|
957
|
+
progressBar: true
|
|
958
|
+
});
|
|
959
|
+
if (createSessionNotification) {
|
|
960
|
+
this.addSessionNotification(text, 'error');
|
|
961
|
+
}
|
|
962
|
+
};
|
|
963
|
+
NotificationService.prototype.cancel = function (text, params, title) {
|
|
964
|
+
text = Utils.getLocalizedValue(text, params, 'OperationCancelled');
|
|
965
|
+
title = Utils.getLocalizedValue(title);
|
|
966
|
+
this.toastrService.info(text, title, {
|
|
967
|
+
timeOut: 3000,
|
|
968
|
+
progressBar: true
|
|
969
|
+
});
|
|
970
|
+
};
|
|
971
|
+
Object.defineProperty(NotificationService.prototype, "sessionNotifications", {
|
|
972
|
+
// SessionNotifications
|
|
973
|
+
get: function () {
|
|
974
|
+
return this._sessionNotifications.getValue();
|
|
975
|
+
},
|
|
976
|
+
set: function (val) {
|
|
977
|
+
this._sessionNotifications.next(val);
|
|
978
|
+
},
|
|
979
|
+
enumerable: false,
|
|
980
|
+
configurable: true
|
|
981
|
+
});
|
|
982
|
+
Object.defineProperty(NotificationService.prototype, "serverNotifications", {
|
|
983
|
+
// ServerNotifications
|
|
984
|
+
get: function () {
|
|
985
|
+
return this._serverNotifications.getValue();
|
|
986
|
+
},
|
|
987
|
+
set: function (val) {
|
|
988
|
+
this._serverNotifications.next(val);
|
|
989
|
+
},
|
|
990
|
+
enumerable: false,
|
|
991
|
+
configurable: true
|
|
992
|
+
});
|
|
993
|
+
return NotificationService;
|
|
994
|
+
}());
|
|
995
|
+
NotificationService.ɵprov = i0.ɵɵdefineInjectable({ factory: function NotificationService_Factory() { return new NotificationService(i0.ɵɵinject(i1.ToastrService)); }, token: NotificationService, providedIn: "root" });
|
|
996
|
+
NotificationService.decorators = [
|
|
997
|
+
{ type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
|
998
|
+
];
|
|
999
|
+
NotificationService.ctorParameters = function () { return [
|
|
1000
|
+
{ type: i1.ToastrService }
|
|
1001
|
+
]; };
|
|
1002
|
+
|
|
849
1003
|
var providers = [
|
|
850
1004
|
LoggingService,
|
|
1005
|
+
NotificationService,
|
|
851
1006
|
AppContextService,
|
|
852
1007
|
LoadingService
|
|
853
1008
|
];
|
|
@@ -860,15 +1015,153 @@
|
|
|
860
1015
|
}
|
|
861
1016
|
return AnatolyCoreModule;
|
|
862
1017
|
}());
|
|
863
|
-
AnatolyCoreModule.decorators = [
|
|
864
|
-
{ type: i0.NgModule, args: [{
|
|
865
|
-
imports: [common.CommonModule],
|
|
866
|
-
|
|
1018
|
+
AnatolyCoreModule.decorators = [
|
|
1019
|
+
{ type: i0.NgModule, args: [{
|
|
1020
|
+
imports: [common.CommonModule],
|
|
1021
|
+
exports: [],
|
|
1022
|
+
providers: __spread(providers),
|
|
1023
|
+
},] }
|
|
1024
|
+
];
|
|
1025
|
+
AnatolyCoreModule.ctorParameters = function () { return [
|
|
1026
|
+
{ type: i0.Injector },
|
|
1027
|
+
{ type: AnatolyCoreModule, decorators: [{ type: i0.Optional }, { type: i0.SkipSelf }] }
|
|
1028
|
+
]; };
|
|
1029
|
+
|
|
1030
|
+
/*
|
|
1031
|
+
<file>
|
|
1032
|
+
Project:
|
|
1033
|
+
@osovitny/anatoly
|
|
1034
|
+
|
|
1035
|
+
Authors:
|
|
1036
|
+
Vadim Osovitny
|
|
1037
|
+
Anatoly Osovitny
|
|
1038
|
+
|
|
1039
|
+
Created:
|
|
1040
|
+
29 June 2020
|
|
1041
|
+
|
|
1042
|
+
Version:
|
|
1043
|
+
1.0
|
|
1044
|
+
|
|
1045
|
+
Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
|
|
1046
|
+
</file>
|
|
1047
|
+
*/
|
|
1048
|
+
var Convert = /** @class */ (function () {
|
|
1049
|
+
function Convert() {
|
|
1050
|
+
}
|
|
1051
|
+
/**
|
|
1052
|
+
* Convert date time lo local time zone value.
|
|
1053
|
+
* @param value
|
|
1054
|
+
*/
|
|
1055
|
+
Convert.toLocalizedDateTime = function (value) {
|
|
1056
|
+
if (value) {
|
|
1057
|
+
return new Date(Date.UTC(value.getFullYear(), value.getMonth(), value.getDate(), value.getHours(), value.getMinutes(), value.getSeconds(), value.getMilliseconds()));
|
|
1058
|
+
}
|
|
1059
|
+
return null;
|
|
1060
|
+
};
|
|
1061
|
+
return Convert;
|
|
1062
|
+
}());
|
|
1063
|
+
|
|
1064
|
+
/*
|
|
1065
|
+
<file>
|
|
1066
|
+
Project:
|
|
1067
|
+
@osovitny/anatoly
|
|
1068
|
+
|
|
1069
|
+
Authors:
|
|
1070
|
+
Vadim Osovitny
|
|
1071
|
+
Anatoly Osovitny
|
|
1072
|
+
|
|
1073
|
+
Created:
|
|
1074
|
+
05 May 2020
|
|
1075
|
+
|
|
1076
|
+
Version:
|
|
1077
|
+
1.0
|
|
1078
|
+
|
|
1079
|
+
Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
|
|
1080
|
+
</file>
|
|
1081
|
+
*/
|
|
1082
|
+
var LocalizationService = /** @class */ (function () {
|
|
1083
|
+
function LocalizationService(translate) {
|
|
1084
|
+
this.translate = translate;
|
|
1085
|
+
this.setSupportedLanguages(['en']);
|
|
1086
|
+
}
|
|
1087
|
+
LocalizationService.prototype.format = function (str, args) {
|
|
1088
|
+
// tslint:disable-next-line:variable-name
|
|
1089
|
+
return str.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] !== 'undefined' ? args[number] : match; });
|
|
1090
|
+
};
|
|
1091
|
+
;
|
|
1092
|
+
LocalizationService.prototype.configureTranslationSettings = function (translate) {
|
|
1093
|
+
var languageToSet = 'en';
|
|
1094
|
+
translate.setDefaultLang(languageToSet);
|
|
1095
|
+
return languageToSet;
|
|
1096
|
+
};
|
|
1097
|
+
LocalizationService.prototype.getBrowserLanguage = function () {
|
|
1098
|
+
return this.translate.getBrowserLang();
|
|
1099
|
+
};
|
|
1100
|
+
LocalizationService.prototype.getDatefnsLocale = function () {
|
|
1101
|
+
var dfnLocale;
|
|
1102
|
+
switch (this.getBrowserLanguage()) {
|
|
1103
|
+
case 'en':
|
|
1104
|
+
dfnLocale = { locale: enUS };
|
|
1105
|
+
break;
|
|
1106
|
+
default:
|
|
1107
|
+
dfnLocale = { locale: enUS };
|
|
1108
|
+
}
|
|
1109
|
+
return dfnLocale;
|
|
1110
|
+
};
|
|
1111
|
+
LocalizationService.prototype.setDefaultLanguage = function (lang) {
|
|
1112
|
+
this.translate.setDefaultLang(lang);
|
|
1113
|
+
};
|
|
1114
|
+
LocalizationService.prototype.setSupportedLanguages = function (languages) {
|
|
1115
|
+
this.translate.addLangs(languages);
|
|
1116
|
+
};
|
|
1117
|
+
LocalizationService.prototype.updateLanguage = function (language) {
|
|
1118
|
+
this.translate.use(language);
|
|
1119
|
+
};
|
|
1120
|
+
LocalizationService.prototype.getLocalizedValue = function (key, params) {
|
|
1121
|
+
var value = this.translate.instant(key);
|
|
1122
|
+
if (!params || params.length === 0) {
|
|
1123
|
+
return value;
|
|
1124
|
+
}
|
|
1125
|
+
return this.format(value, params);
|
|
1126
|
+
};
|
|
1127
|
+
LocalizationService.prototype.getLocalizedDate = function (key) {
|
|
1128
|
+
if (dateFns.isValid(new Date(key))) {
|
|
1129
|
+
return dateFns.format(new Date(key), AppCoreSettings.DATE_FORMATS.angular, this.dateFnsLocale);
|
|
1130
|
+
}
|
|
1131
|
+
return 'Invalid Date';
|
|
1132
|
+
};
|
|
1133
|
+
LocalizationService.prototype.getLocalizedDateTime = function (key) {
|
|
1134
|
+
// To Do Manoj: Test in IE and make TimeZone specific changes accordingly
|
|
1135
|
+
var dateValue = new Date(key);
|
|
1136
|
+
if (dateFns.isValid(dateValue)) {
|
|
1137
|
+
var localDate = Convert.toLocalizedDateTime(dateValue);
|
|
1138
|
+
return dateFns.format(localDate, AppCoreSettings.DATE_FORMATS.angularWithTime, this.dateFnsLocale);
|
|
1139
|
+
}
|
|
1140
|
+
return 'Invalid Date';
|
|
1141
|
+
};
|
|
1142
|
+
LocalizationService.prototype.getLocalizedDistanceToNowInWords = function (date) {
|
|
1143
|
+
// https://date-fns.org/v1.30.1/docs/distanceInWords
|
|
1144
|
+
if (dateFns.isValid(new Date(date))) {
|
|
1145
|
+
return dateFns.formatDistanceToNow(new Date(date), this.dateFnsLocale);
|
|
1146
|
+
}
|
|
1147
|
+
return 'Invalid Date';
|
|
1148
|
+
};
|
|
1149
|
+
LocalizationService.prototype.getLocalizedDistanceInWords = function (endedDate, startedDate) {
|
|
1150
|
+
if (dateFns.isValid(new Date(endedDate)) && dateFns.isValid(new Date(startedDate))) {
|
|
1151
|
+
return dateFns.formatDistance(new Date(endedDate), new Date(startedDate), this.dateFnsLocale);
|
|
1152
|
+
}
|
|
1153
|
+
return 'Invalid Date';
|
|
1154
|
+
};
|
|
1155
|
+
return LocalizationService;
|
|
1156
|
+
}());
|
|
1157
|
+
LocalizationService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LocalizationService_Factory() { return new LocalizationService(i0.ɵɵinject(i1$1.TranslateService)); }, token: LocalizationService, providedIn: "root" });
|
|
1158
|
+
LocalizationService.decorators = [
|
|
1159
|
+
{ type: i0.Injectable, args: [{
|
|
1160
|
+
providedIn: 'root'
|
|
867
1161
|
},] }
|
|
868
1162
|
];
|
|
869
|
-
|
|
870
|
-
{ type:
|
|
871
|
-
{ type: AnatolyCoreModule, decorators: [{ type: i0.Optional }, { type: i0.SkipSelf }] }
|
|
1163
|
+
LocalizationService.ctorParameters = function () { return [
|
|
1164
|
+
{ type: i1$1.TranslateService }
|
|
872
1165
|
]; };
|
|
873
1166
|
|
|
874
1167
|
/*
|
|
@@ -889,7 +1182,6 @@
|
|
|
889
1182
|
Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
|
|
890
1183
|
</file>
|
|
891
1184
|
*/
|
|
892
|
-
// @dynamic
|
|
893
1185
|
var Utils = /** @class */ (function () {
|
|
894
1186
|
function Utils() {
|
|
895
1187
|
}
|
|
@@ -898,6 +1190,7 @@
|
|
|
898
1190
|
};
|
|
899
1191
|
Utils.getValueByName = function (url, name) {
|
|
900
1192
|
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
|
|
1193
|
+
// tslint:disable-next-line:one-variable-per-declaration
|
|
901
1194
|
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'), results = regex.exec(url);
|
|
902
1195
|
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
|
|
903
1196
|
};
|
|
@@ -947,16 +1240,6 @@
|
|
|
947
1240
|
}
|
|
948
1241
|
return key;
|
|
949
1242
|
};
|
|
950
|
-
/**
|
|
951
|
-
* Convert date time lo local time zone value.
|
|
952
|
-
* @param value
|
|
953
|
-
*/
|
|
954
|
-
Utils.convertToLocalizedDateTime = function (value) {
|
|
955
|
-
if (value) {
|
|
956
|
-
return new Date(Date.UTC(value.getFullYear(), value.getMonth(), value.getDate(), value.getHours(), value.getMinutes(), value.getSeconds(), value.getMilliseconds()));
|
|
957
|
-
}
|
|
958
|
-
return null;
|
|
959
|
-
};
|
|
960
1243
|
Utils.downloadBlobFile = function (value, fileName) {
|
|
961
1244
|
if (window.navigator.msSaveOrOpenBlob) {
|
|
962
1245
|
window.navigator.msSaveOrOpenBlob(value, fileName);
|
|
@@ -1012,33 +1295,6 @@
|
|
|
1012
1295
|
return Subs;
|
|
1013
1296
|
}());
|
|
1014
1297
|
|
|
1015
|
-
/*
|
|
1016
|
-
<file>
|
|
1017
|
-
Project:
|
|
1018
|
-
@osovitny/anatoly
|
|
1019
|
-
|
|
1020
|
-
Authors:
|
|
1021
|
-
Vadim Osovitny
|
|
1022
|
-
Anatoly Osovitny
|
|
1023
|
-
|
|
1024
|
-
Created:
|
|
1025
|
-
26 Jun 2020
|
|
1026
|
-
|
|
1027
|
-
Version:
|
|
1028
|
-
1.0
|
|
1029
|
-
|
|
1030
|
-
Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
|
|
1031
|
-
</file>
|
|
1032
|
-
*/
|
|
1033
|
-
var Guid = /** @class */ (function () {
|
|
1034
|
-
function Guid() {
|
|
1035
|
-
}
|
|
1036
|
-
Guid.newGuid = function () {
|
|
1037
|
-
return uuid.v4();
|
|
1038
|
-
};
|
|
1039
|
-
return Guid;
|
|
1040
|
-
}());
|
|
1041
|
-
|
|
1042
1298
|
/*
|
|
1043
1299
|
<file>
|
|
1044
1300
|
Project:
|
|
@@ -1349,18 +1605,40 @@
|
|
|
1349
1605
|
{ type: http.HttpClient }
|
|
1350
1606
|
]; };
|
|
1351
1607
|
|
|
1608
|
+
/*
|
|
1609
|
+
<file>
|
|
1610
|
+
Project:
|
|
1611
|
+
@osovitny/anatoly
|
|
1612
|
+
|
|
1613
|
+
Authors:
|
|
1614
|
+
Vadim Osovitny
|
|
1615
|
+
Anatoly Osovitny
|
|
1616
|
+
|
|
1617
|
+
Created:
|
|
1618
|
+
30 April 2020
|
|
1619
|
+
|
|
1620
|
+
Version:
|
|
1621
|
+
1.0
|
|
1622
|
+
|
|
1623
|
+
Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
|
|
1624
|
+
</file>
|
|
1625
|
+
*/
|
|
1626
|
+
var consts = {
|
|
1627
|
+
billingApiPath: "api/billing",
|
|
1628
|
+
// Notifications API
|
|
1629
|
+
notificationsApiPath: 'api/notifications',
|
|
1630
|
+
};
|
|
1631
|
+
|
|
1352
1632
|
var BillingApiService = /** @class */ (function (_super) {
|
|
1353
1633
|
__extends(BillingApiService, _super);
|
|
1354
1634
|
function BillingApiService(http) {
|
|
1355
1635
|
var _this = _super.call(this, http) || this;
|
|
1356
1636
|
_this.http = http;
|
|
1357
|
-
_this.baseUrl
|
|
1637
|
+
_this.baseUrl = consts.billingApiPath;
|
|
1358
1638
|
return _this;
|
|
1359
1639
|
}
|
|
1360
1640
|
BillingApiService.prototype.requestNewSubscription = function (requestedPlan, success, error) {
|
|
1361
|
-
this.postQS("requestNewSubscription", {
|
|
1362
|
-
requestedPlan: requestedPlan,
|
|
1363
|
-
}).subscribe(function (data) { }, function (e) {
|
|
1641
|
+
this.postQS("requestNewSubscription", { requestedPlan: requestedPlan }).subscribe(function (data) { }, function (e) {
|
|
1364
1642
|
if (error)
|
|
1365
1643
|
error();
|
|
1366
1644
|
}, function () {
|
|
@@ -1414,16 +1692,24 @@
|
|
|
1414
1692
|
</file>
|
|
1415
1693
|
*/
|
|
1416
1694
|
var AnatolyDataModule = /** @class */ (function () {
|
|
1417
|
-
function AnatolyDataModule() {
|
|
1695
|
+
function AnatolyDataModule(parentModule) {
|
|
1696
|
+
throwIfAlreadyLoaded(parentModule, 'AnatolyDataModule');
|
|
1418
1697
|
}
|
|
1419
1698
|
return AnatolyDataModule;
|
|
1420
1699
|
}());
|
|
1421
1700
|
AnatolyDataModule.decorators = [
|
|
1422
1701
|
{ type: i0.NgModule, args: [{
|
|
1423
|
-
imports: [
|
|
1424
|
-
|
|
1702
|
+
imports: [
|
|
1703
|
+
common.CommonModule
|
|
1704
|
+
],
|
|
1705
|
+
providers: [
|
|
1706
|
+
BillingApiService
|
|
1707
|
+
],
|
|
1425
1708
|
},] }
|
|
1426
|
-
];
|
|
1709
|
+
];
|
|
1710
|
+
AnatolyDataModule.ctorParameters = function () { return [
|
|
1711
|
+
{ type: AnatolyDataModule, decorators: [{ type: i0.Optional }, { type: i0.SkipSelf }] }
|
|
1712
|
+
]; };
|
|
1427
1713
|
|
|
1428
1714
|
/*
|
|
1429
1715
|
<file>
|
|
@@ -2374,6 +2660,298 @@
|
|
|
2374
2660
|
</file>
|
|
2375
2661
|
*/
|
|
2376
2662
|
|
|
2663
|
+
/*
|
|
2664
|
+
<file>
|
|
2665
|
+
Project:
|
|
2666
|
+
@osovitny/anatoly
|
|
2667
|
+
|
|
2668
|
+
Authors:
|
|
2669
|
+
Vadim Osovitny
|
|
2670
|
+
Anatoly Osovitny
|
|
2671
|
+
|
|
2672
|
+
Created:
|
|
2673
|
+
10 May 2020
|
|
2674
|
+
|
|
2675
|
+
Version:
|
|
2676
|
+
1.0
|
|
2677
|
+
|
|
2678
|
+
Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
|
|
2679
|
+
</file>
|
|
2680
|
+
*/
|
|
2681
|
+
var LocalizePipe = /** @class */ (function () {
|
|
2682
|
+
function LocalizePipe(localizeService) {
|
|
2683
|
+
this.localizeService = localizeService;
|
|
2684
|
+
}
|
|
2685
|
+
LocalizePipe.prototype.transform = function (inputData, type, param2) {
|
|
2686
|
+
if (!inputData) {
|
|
2687
|
+
return;
|
|
2688
|
+
}
|
|
2689
|
+
if (!type) {
|
|
2690
|
+
type = 't';
|
|
2691
|
+
}
|
|
2692
|
+
// Translate
|
|
2693
|
+
if (type === 't') {
|
|
2694
|
+
return this.localizeService.getLocalizedValue(inputData);
|
|
2695
|
+
}
|
|
2696
|
+
// Date
|
|
2697
|
+
if (type === 'd') {
|
|
2698
|
+
return this.localizeService.getLocalizedDate(inputData);
|
|
2699
|
+
}
|
|
2700
|
+
// DateTime
|
|
2701
|
+
if (type === 'dt') {
|
|
2702
|
+
return this.localizeService.getLocalizedDateTime(inputData);
|
|
2703
|
+
}
|
|
2704
|
+
// DistanceToNowInWords
|
|
2705
|
+
if (type === 'dis2now') {
|
|
2706
|
+
return this.localizeService.getLocalizedDistanceToNowInWords(inputData);
|
|
2707
|
+
}
|
|
2708
|
+
// DistanceInWords
|
|
2709
|
+
if (type === 'dis') {
|
|
2710
|
+
return this.localizeService.getLocalizedDistanceInWords(inputData, param2);
|
|
2711
|
+
}
|
|
2712
|
+
return inputData;
|
|
2713
|
+
};
|
|
2714
|
+
return LocalizePipe;
|
|
2715
|
+
}());
|
|
2716
|
+
LocalizePipe.decorators = [
|
|
2717
|
+
{ type: i0.Pipe, args: [{
|
|
2718
|
+
name: 'localize'
|
|
2719
|
+
},] }
|
|
2720
|
+
];
|
|
2721
|
+
LocalizePipe.ctorParameters = function () { return [
|
|
2722
|
+
{ type: LocalizationService }
|
|
2723
|
+
]; };
|
|
2724
|
+
|
|
2725
|
+
/*
|
|
2726
|
+
<file>
|
|
2727
|
+
Project:
|
|
2728
|
+
@osovitny/anatoly
|
|
2729
|
+
|
|
2730
|
+
Authors:
|
|
2731
|
+
Vadim Osovitny
|
|
2732
|
+
Anatoly Osovitny
|
|
2733
|
+
|
|
2734
|
+
Created:
|
|
2735
|
+
12 May 2020
|
|
2736
|
+
|
|
2737
|
+
Version:
|
|
2738
|
+
1.0
|
|
2739
|
+
|
|
2740
|
+
Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
|
|
2741
|
+
</file>
|
|
2742
|
+
*/
|
|
2743
|
+
var LocalizationModule = /** @class */ (function () {
|
|
2744
|
+
function LocalizationModule() {
|
|
2745
|
+
}
|
|
2746
|
+
return LocalizationModule;
|
|
2747
|
+
}());
|
|
2748
|
+
LocalizationModule.decorators = [
|
|
2749
|
+
{ type: i0.NgModule, args: [{
|
|
2750
|
+
imports: [
|
|
2751
|
+
i1$1.TranslateModule
|
|
2752
|
+
],
|
|
2753
|
+
exports: [
|
|
2754
|
+
i1$1.TranslateModule,
|
|
2755
|
+
LocalizePipe
|
|
2756
|
+
],
|
|
2757
|
+
declarations: [
|
|
2758
|
+
LocalizePipe
|
|
2759
|
+
],
|
|
2760
|
+
providers: []
|
|
2761
|
+
},] }
|
|
2762
|
+
];
|
|
2763
|
+
|
|
2764
|
+
/*
|
|
2765
|
+
<file>
|
|
2766
|
+
Project:
|
|
2767
|
+
@osovitny/anatoly
|
|
2768
|
+
|
|
2769
|
+
Authors:
|
|
2770
|
+
Vadim Osovitny
|
|
2771
|
+
Anatoly Osovitny
|
|
2772
|
+
|
|
2773
|
+
Created:
|
|
2774
|
+
05 May 2020
|
|
2775
|
+
|
|
2776
|
+
Version:
|
|
2777
|
+
1.0
|
|
2778
|
+
|
|
2779
|
+
Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
|
|
2780
|
+
</file>
|
|
2781
|
+
*/
|
|
2782
|
+
function customTranslateLoaderFactory(http) {
|
|
2783
|
+
return new httpLoader.TranslateHttpLoader(http, AppCoreSettings.resourcesUrl + "/", '.json');
|
|
2784
|
+
}
|
|
2785
|
+
function localizationInitializerFactory(translate, localizationService, injector) {
|
|
2786
|
+
return function () { return new Promise(function (resolve) {
|
|
2787
|
+
var locationInitialized = injector.get(common.LOCATION_INITIALIZED, Promise.resolve(null));
|
|
2788
|
+
locationInitialized.then(function () {
|
|
2789
|
+
var languageToSet = localizationService.configureTranslationSettings(translate);
|
|
2790
|
+
translate.use(languageToSet).subscribe(function () {
|
|
2791
|
+
}, function () {
|
|
2792
|
+
resolve(null);
|
|
2793
|
+
}, function () {
|
|
2794
|
+
resolve(null);
|
|
2795
|
+
});
|
|
2796
|
+
});
|
|
2797
|
+
}); };
|
|
2798
|
+
}
|
|
2799
|
+
var TranslateModuleAtRoot = i1$1.TranslateModule.forRoot({
|
|
2800
|
+
loader: {
|
|
2801
|
+
provide: i1$1.TranslateLoader,
|
|
2802
|
+
useFactory: customTranslateLoaderFactory,
|
|
2803
|
+
deps: [http.HttpClient]
|
|
2804
|
+
}
|
|
2805
|
+
});
|
|
2806
|
+
var LocalizationSettingsModule = /** @class */ (function () {
|
|
2807
|
+
function LocalizationSettingsModule() {
|
|
2808
|
+
}
|
|
2809
|
+
return LocalizationSettingsModule;
|
|
2810
|
+
}());
|
|
2811
|
+
LocalizationSettingsModule.decorators = [
|
|
2812
|
+
{ type: i0.NgModule, args: [{
|
|
2813
|
+
imports: [
|
|
2814
|
+
TranslateModuleAtRoot
|
|
2815
|
+
],
|
|
2816
|
+
providers: [
|
|
2817
|
+
{
|
|
2818
|
+
provide: i0.APP_INITIALIZER,
|
|
2819
|
+
useFactory: localizationInitializerFactory,
|
|
2820
|
+
deps: [i1$1.TranslateService, LocalizationService, i0.Injector],
|
|
2821
|
+
multi: true
|
|
2822
|
+
}
|
|
2823
|
+
],
|
|
2824
|
+
exports: []
|
|
2825
|
+
},] }
|
|
2826
|
+
];
|
|
2827
|
+
|
|
2828
|
+
/*
|
|
2829
|
+
<file>
|
|
2830
|
+
Project:
|
|
2831
|
+
@osovitny/anatoly
|
|
2832
|
+
|
|
2833
|
+
Authors:
|
|
2834
|
+
Vadim Osovitny
|
|
2835
|
+
Anatoly Osovitny
|
|
2836
|
+
|
|
2837
|
+
Created:
|
|
2838
|
+
26 Jun 2020
|
|
2839
|
+
|
|
2840
|
+
Version:
|
|
2841
|
+
1.0
|
|
2842
|
+
|
|
2843
|
+
Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
|
|
2844
|
+
</file>
|
|
2845
|
+
*/
|
|
2846
|
+
|
|
2847
|
+
/*
|
|
2848
|
+
<file>
|
|
2849
|
+
Project:
|
|
2850
|
+
@osovitny/anatoly
|
|
2851
|
+
|
|
2852
|
+
Authors:
|
|
2853
|
+
Vadim Osovitny
|
|
2854
|
+
Anatoly Osovitny
|
|
2855
|
+
|
|
2856
|
+
Created:
|
|
2857
|
+
3 March 2020
|
|
2858
|
+
|
|
2859
|
+
Version:
|
|
2860
|
+
1.0
|
|
2861
|
+
|
|
2862
|
+
Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
|
|
2863
|
+
</file>
|
|
2864
|
+
*/
|
|
2865
|
+
var Alerts$1 = /** @class */ (function () {
|
|
2866
|
+
function Alerts() {
|
|
2867
|
+
}
|
|
2868
|
+
Alerts.success = function (text, params, title, successAction) {
|
|
2869
|
+
text = Utils.getLocalizedValue(text, params, 'OperationSuccessFull');
|
|
2870
|
+
title = Utils.getLocalizedValue(title, null, 'Success');
|
|
2871
|
+
Swal.fire({
|
|
2872
|
+
text: text,
|
|
2873
|
+
title: title,
|
|
2874
|
+
icon: 'success',
|
|
2875
|
+
confirmButtonText: Utils.getLocalizedValue('Ok')
|
|
2876
|
+
})
|
|
2877
|
+
.then(function () {
|
|
2878
|
+
if (successAction) {
|
|
2879
|
+
successAction();
|
|
2880
|
+
}
|
|
2881
|
+
});
|
|
2882
|
+
};
|
|
2883
|
+
Alerts.info = function (text, params, title) {
|
|
2884
|
+
text = Utils.getLocalizedValue(text, params);
|
|
2885
|
+
title = Utils.getLocalizedValue(title, null, 'Info');
|
|
2886
|
+
Swal.fire({
|
|
2887
|
+
text: text,
|
|
2888
|
+
title: title,
|
|
2889
|
+
icon: 'info',
|
|
2890
|
+
confirmButtonText: Utils.getLocalizedValue('Ok')
|
|
2891
|
+
});
|
|
2892
|
+
};
|
|
2893
|
+
Alerts.warning = function (text, params, title) {
|
|
2894
|
+
text = Utils.getLocalizedValue(text, params);
|
|
2895
|
+
title = Utils.getLocalizedValue(title, null, 'Warning');
|
|
2896
|
+
Swal.fire({
|
|
2897
|
+
text: text,
|
|
2898
|
+
title: title,
|
|
2899
|
+
icon: 'warning',
|
|
2900
|
+
confirmButtonText: Utils.getLocalizedValue('Ok')
|
|
2901
|
+
});
|
|
2902
|
+
};
|
|
2903
|
+
Alerts.error = function (text, params, title) {
|
|
2904
|
+
text = Utils.getLocalizedValue(text, params, 'ErrorOccured');
|
|
2905
|
+
title = Utils.getLocalizedValue(title, null, 'Error');
|
|
2906
|
+
Swal.fire({
|
|
2907
|
+
text: text,
|
|
2908
|
+
title: title,
|
|
2909
|
+
icon: 'error',
|
|
2910
|
+
confirmButtonText: Utils.getLocalizedValue('Ok')
|
|
2911
|
+
});
|
|
2912
|
+
};
|
|
2913
|
+
Alerts.cancel = function (text, params, title) {
|
|
2914
|
+
text = Utils.getLocalizedValue(text, params, 'OperationCancelled');
|
|
2915
|
+
title = Utils.getLocalizedValue(title, null, 'Cancelled');
|
|
2916
|
+
Swal.fire({
|
|
2917
|
+
text: text,
|
|
2918
|
+
title: title,
|
|
2919
|
+
icon: 'info'
|
|
2920
|
+
});
|
|
2921
|
+
};
|
|
2922
|
+
Alerts.notImplemented = function () {
|
|
2923
|
+
this.warning('Not Implemented Yet');
|
|
2924
|
+
};
|
|
2925
|
+
;
|
|
2926
|
+
Alerts.areYouSure = function (text, title, confirmButtonText, cancelButtonText, successAction, cancelAction) {
|
|
2927
|
+
text = Utils.getLocalizedValue(text);
|
|
2928
|
+
title = Utils.getLocalizedValue(title, null, 'AreYouSure');
|
|
2929
|
+
Swal.fire({
|
|
2930
|
+
text: text,
|
|
2931
|
+
title: title,
|
|
2932
|
+
icon: 'warning',
|
|
2933
|
+
confirmButtonText: Utils.getLocalizedValue(confirmButtonText),
|
|
2934
|
+
cancelButtonText: Utils.getLocalizedValue(cancelButtonText),
|
|
2935
|
+
showCancelButton: true
|
|
2936
|
+
})
|
|
2937
|
+
.then(function (result) {
|
|
2938
|
+
if (result.value) {
|
|
2939
|
+
if (successAction) {
|
|
2940
|
+
successAction();
|
|
2941
|
+
}
|
|
2942
|
+
}
|
|
2943
|
+
// result.dismiss can be 'cancel', 'overlay', 'close', and 'timer'
|
|
2944
|
+
else if (result.dismiss == Swal.DismissReason.cancel || result.dismiss == Swal.DismissReason.close) {
|
|
2945
|
+
if (cancelAction) {
|
|
2946
|
+
cancelAction();
|
|
2947
|
+
}
|
|
2948
|
+
}
|
|
2949
|
+
});
|
|
2950
|
+
};
|
|
2951
|
+
;
|
|
2952
|
+
return Alerts;
|
|
2953
|
+
}());
|
|
2954
|
+
|
|
2377
2955
|
/*
|
|
2378
2956
|
* Public API Surface of anatoly
|
|
2379
2957
|
*/
|
|
@@ -2382,7 +2960,7 @@
|
|
|
2382
2960
|
* Generated bundle index. Do not edit.
|
|
2383
2961
|
*/
|
|
2384
2962
|
|
|
2385
|
-
exports.Alerts = Alerts;
|
|
2963
|
+
exports.Alerts = Alerts$1;
|
|
2386
2964
|
exports.AnatolyCoreModule = AnatolyCoreModule;
|
|
2387
2965
|
exports.AnatolyDataModule = AnatolyDataModule;
|
|
2388
2966
|
exports.AnatolyHttpInterceptor = AnatolyHttpInterceptor;
|
|
@@ -2406,6 +2984,10 @@
|
|
|
2406
2984
|
exports.HtmlEditorComponent = HtmlEditorComponent;
|
|
2407
2985
|
exports.ItemValidationSummaryComponent = ItemValidationSummaryComponent;
|
|
2408
2986
|
exports.LoadingService = LoadingService;
|
|
2987
|
+
exports.LocalizationModule = LocalizationModule;
|
|
2988
|
+
exports.LocalizationService = LocalizationService;
|
|
2989
|
+
exports.LocalizationSettingsModule = LocalizationSettingsModule;
|
|
2990
|
+
exports.LocalizePipe = LocalizePipe;
|
|
2409
2991
|
exports.LoggingService = LoggingService;
|
|
2410
2992
|
exports.NativeElementDirective = NativeElementDirective;
|
|
2411
2993
|
exports.SignInButtonComponent = SignInButtonComponent;
|