@igo2/core 1.15.5 → 1.15.6
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/esm2020/igo2-core.mjs +4 -4
- package/esm2020/lib/activity/activity.interceptor.mjs +29 -29
- package/esm2020/lib/activity/activity.module.mjs +29 -29
- package/esm2020/lib/activity/activity.service.mjs +32 -32
- package/esm2020/lib/activity/index.mjs +2 -2
- package/esm2020/lib/analytics/index.mjs +1 -1
- package/esm2020/lib/analytics/shared/analytics.interface.mjs +1 -1
- package/esm2020/lib/analytics/shared/analytics.service.mjs +80 -80
- package/esm2020/lib/analytics/shared/index.mjs +2 -2
- package/esm2020/lib/compression/compressedData.interface.mjs +1 -1
- package/esm2020/lib/compression/compression.service.mjs +139 -139
- package/esm2020/lib/compression/index.mjs +2 -2
- package/esm2020/lib/config/config.interface.mjs +1 -1
- package/esm2020/lib/config/config.module.mjs +22 -22
- package/esm2020/lib/config/config.provider.mjs +20 -20
- package/esm2020/lib/config/config.service.mjs +51 -51
- package/esm2020/lib/config/index.mjs +3 -3
- package/esm2020/lib/config/version.mjs +5 -5
- package/esm2020/lib/core.module.mjs +91 -91
- package/esm2020/lib/gesture/gesture.module.mjs +29 -29
- package/esm2020/lib/gesture/gesture.provider.mjs +15 -15
- package/esm2020/lib/language/index.mjs +1 -1
- package/esm2020/lib/language/language.module.mjs +38 -38
- package/esm2020/lib/language/shared/index.mjs +4 -4
- package/esm2020/lib/language/shared/language.interface.mjs +1 -1
- package/esm2020/lib/language/shared/language.loader.mjs +25 -25
- package/esm2020/lib/language/shared/language.provider.mjs +21 -21
- package/esm2020/lib/language/shared/language.service.mjs +31 -31
- package/esm2020/lib/language/shared/missing-translation.guard.mjs +14 -14
- package/esm2020/lib/media/index.mjs +2 -2
- package/esm2020/lib/media/media.enum.mjs +11 -11
- package/esm2020/lib/media/media.service.mjs +75 -75
- package/esm2020/lib/message/index.mjs +1 -1
- package/esm2020/lib/message/message.module.mjs +55 -55
- package/esm2020/lib/message/shared/index.mjs +3 -3
- package/esm2020/lib/message/shared/message.enum.mjs +9 -9
- package/esm2020/lib/message/shared/message.interface.mjs +1 -1
- package/esm2020/lib/message/shared/message.service.mjs +200 -200
- package/esm2020/lib/network/index.mjs +2 -2
- package/esm2020/lib/network/network.interfaces.mjs +1 -1
- package/esm2020/lib/network/network.service.mjs +59 -59
- package/esm2020/lib/regex/index.mjs +2 -2
- package/esm2020/lib/regex/regex.interface.mjs +1 -1
- package/esm2020/lib/regex/regex.service.mjs +26 -26
- package/esm2020/lib/request/error.interceptor.mjs +65 -65
- package/esm2020/lib/request/error.module.mjs +38 -38
- package/esm2020/lib/request/index.mjs +2 -2
- package/esm2020/lib/request/logging.interceptor.mjs +27 -27
- package/esm2020/lib/request/logging.module.mjs +29 -29
- package/esm2020/lib/route/route.interface.mjs +1 -1
- package/esm2020/lib/route/route.service.mjs +70 -70
- package/esm2020/lib/storage/index.mjs +2 -2
- package/esm2020/lib/storage/storage.interface.mjs +12 -12
- package/esm2020/lib/storage/storage.service.mjs +78 -78
- package/esm2020/public_api.mjs +27 -27
- package/fesm2015/igo2-core.mjs +1328 -1328
- package/fesm2015/igo2-core.mjs.map +1 -1
- package/fesm2020/igo2-core.mjs +1273 -1273
- package/fesm2020/igo2-core.mjs.map +1 -1
- package/index.d.ts +5 -5
- package/lib/activity/activity.interceptor.d.ts +11 -11
- package/lib/activity/activity.module.d.ts +8 -8
- package/lib/activity/activity.service.d.ts +11 -11
- package/lib/activity/index.d.ts +2 -2
- package/lib/analytics/index.d.ts +1 -1
- package/lib/analytics/shared/analytics.interface.d.ts +6 -6
- package/lib/analytics/shared/analytics.service.d.ts +23 -23
- package/lib/analytics/shared/index.d.ts +2 -2
- package/lib/compression/compressedData.interface.d.ts +5 -5
- package/lib/compression/compression.service.d.ts +15 -15
- package/lib/compression/index.d.ts +2 -2
- package/lib/config/config.interface.d.ts +6 -6
- package/lib/config/config.module.d.ts +8 -8
- package/lib/config/config.provider.d.ts +15 -15
- package/lib/config/config.service.d.ts +18 -18
- package/lib/config/index.d.ts +3 -3
- package/lib/config/version.d.ts +5 -5
- package/lib/core.module.d.ts +19 -19
- package/lib/gesture/gesture.module.d.ts +9 -9
- package/lib/gesture/gesture.provider.d.ts +7 -7
- package/lib/language/index.d.ts +1 -1
- package/lib/language/language.module.d.ts +9 -9
- package/lib/language/shared/index.d.ts +4 -4
- package/lib/language/shared/language.interface.d.ts +3 -3
- package/lib/language/shared/language.loader.d.ts +11 -11
- package/lib/language/shared/language.provider.d.ts +15 -15
- package/lib/language/shared/language.service.d.ts +13 -13
- package/lib/language/shared/missing-translation.guard.d.ts +4 -4
- package/lib/media/index.d.ts +2 -2
- package/lib/media/media.enum.d.ts +9 -9
- package/lib/media/media.service.d.ts +16 -16
- package/lib/message/index.d.ts +1 -1
- package/lib/message/message.module.d.ts +10 -10
- package/lib/message/shared/index.d.ts +4 -4
- package/lib/message/shared/message.enum.d.ts +8 -8
- package/lib/message/shared/message.interface.d.ts +21 -21
- package/lib/message/shared/message.service.d.ts +31 -31
- package/lib/network/index.d.ts +2 -2
- package/lib/network/network.interfaces.d.ts +3 -3
- package/lib/network/network.service.d.ts +21 -21
- package/lib/regex/index.d.ts +2 -2
- package/lib/regex/regex.interface.d.ts +3 -3
- package/lib/regex/regex.service.d.ts +12 -12
- package/lib/request/error.interceptor.d.ts +14 -14
- package/lib/request/error.module.d.ts +9 -9
- package/lib/request/index.d.ts +2 -2
- package/lib/request/logging.interceptor.d.ts +8 -8
- package/lib/request/logging.module.d.ts +8 -8
- package/lib/route/route.interface.d.ts +23 -23
- package/lib/route/route.service.d.ts +19 -19
- package/lib/storage/index.d.ts +2 -2
- package/lib/storage/storage.interface.d.ts +20 -20
- package/lib/storage/storage.service.d.ts +19 -19
- package/package.json +2 -2
- package/public_api.d.ts +24 -24
- package/style/partial/media.scss +80 -80
package/fesm2015/igo2-core.mjs
CHANGED
|
@@ -18,1400 +18,1400 @@ import * as i1$3 from '@angular/router';
|
|
|
18
18
|
import * as i1$4 from '@angular/cdk/layout';
|
|
19
19
|
import { Breakpoints } from '@angular/cdk/layout';
|
|
20
20
|
|
|
21
|
-
class ActivityService {
|
|
22
|
-
constructor() {
|
|
23
|
-
this.counter$ = new BehaviorSubject(0);
|
|
24
|
-
this.ids = [];
|
|
25
|
-
}
|
|
26
|
-
register() {
|
|
27
|
-
const id = uuid();
|
|
28
|
-
this.ids.push(id);
|
|
29
|
-
this.counter$.next(this.ids.length);
|
|
30
|
-
return id;
|
|
31
|
-
}
|
|
32
|
-
unregister(id) {
|
|
33
|
-
const index = this.ids.indexOf(id);
|
|
34
|
-
if (index === -1) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
this.ids.splice(index, 1);
|
|
38
|
-
this.counter$.next(this.ids.length);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
ActivityService.ɵfac = function ActivityService_Factory(t) { return new (t || ActivityService)(); };
|
|
42
|
-
ActivityService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ActivityService, factory: ActivityService.ɵfac, providedIn: 'root' });
|
|
43
|
-
(function () {
|
|
44
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ActivityService, [{
|
|
45
|
-
type: Injectable,
|
|
46
|
-
args: [{
|
|
47
|
-
providedIn: 'root'
|
|
48
|
-
}]
|
|
49
|
-
}], function () { return []; }, null);
|
|
21
|
+
class ActivityService {
|
|
22
|
+
constructor() {
|
|
23
|
+
this.counter$ = new BehaviorSubject(0);
|
|
24
|
+
this.ids = [];
|
|
25
|
+
}
|
|
26
|
+
register() {
|
|
27
|
+
const id = uuid();
|
|
28
|
+
this.ids.push(id);
|
|
29
|
+
this.counter$.next(this.ids.length);
|
|
30
|
+
return id;
|
|
31
|
+
}
|
|
32
|
+
unregister(id) {
|
|
33
|
+
const index = this.ids.indexOf(id);
|
|
34
|
+
if (index === -1) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
this.ids.splice(index, 1);
|
|
38
|
+
this.counter$.next(this.ids.length);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
ActivityService.ɵfac = function ActivityService_Factory(t) { return new (t || ActivityService)(); };
|
|
42
|
+
ActivityService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ActivityService, factory: ActivityService.ɵfac, providedIn: 'root' });
|
|
43
|
+
(function () {
|
|
44
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ActivityService, [{
|
|
45
|
+
type: Injectable,
|
|
46
|
+
args: [{
|
|
47
|
+
providedIn: 'root'
|
|
48
|
+
}]
|
|
49
|
+
}], function () { return []; }, null);
|
|
50
50
|
})();
|
|
51
51
|
|
|
52
|
-
class ActivityInterceptor {
|
|
53
|
-
constructor(activityService) {
|
|
54
|
-
this.activityService = activityService;
|
|
55
|
-
}
|
|
56
|
-
intercept(req, next) {
|
|
57
|
-
const activity = req.headers.get('activityInterceptor');
|
|
58
|
-
if (activity) {
|
|
59
|
-
const actReq = req.clone({
|
|
60
|
-
headers: req.headers.delete('activityInterceptor')
|
|
61
|
-
});
|
|
62
|
-
if (activity === 'false') {
|
|
63
|
-
return next.handle(actReq);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
const id = this.activityService.register();
|
|
67
|
-
return next.handle(req).pipe(finalize(() => {
|
|
68
|
-
this.activityService.unregister(id);
|
|
69
|
-
}));
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
ActivityInterceptor.ɵfac = function ActivityInterceptor_Factory(t) { return new (t || ActivityInterceptor)(i0.ɵɵinject(ActivityService)); };
|
|
73
|
-
ActivityInterceptor.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ActivityInterceptor, factory: ActivityInterceptor.ɵfac });
|
|
74
|
-
(function () {
|
|
75
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ActivityInterceptor, [{
|
|
76
|
-
type: Injectable
|
|
77
|
-
}], function () { return [{ type: ActivityService }]; }, null);
|
|
52
|
+
class ActivityInterceptor {
|
|
53
|
+
constructor(activityService) {
|
|
54
|
+
this.activityService = activityService;
|
|
55
|
+
}
|
|
56
|
+
intercept(req, next) {
|
|
57
|
+
const activity = req.headers.get('activityInterceptor');
|
|
58
|
+
if (activity) {
|
|
59
|
+
const actReq = req.clone({
|
|
60
|
+
headers: req.headers.delete('activityInterceptor')
|
|
61
|
+
});
|
|
62
|
+
if (activity === 'false') {
|
|
63
|
+
return next.handle(actReq);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const id = this.activityService.register();
|
|
67
|
+
return next.handle(req).pipe(finalize(() => {
|
|
68
|
+
this.activityService.unregister(id);
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
ActivityInterceptor.ɵfac = function ActivityInterceptor_Factory(t) { return new (t || ActivityInterceptor)(i0.ɵɵinject(ActivityService)); };
|
|
73
|
+
ActivityInterceptor.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ActivityInterceptor, factory: ActivityInterceptor.ɵfac });
|
|
74
|
+
(function () {
|
|
75
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ActivityInterceptor, [{
|
|
76
|
+
type: Injectable
|
|
77
|
+
}], function () { return [{ type: ActivityService }]; }, null);
|
|
78
78
|
})();
|
|
79
79
|
|
|
80
|
-
class IgoActivityModule {
|
|
81
|
-
static forRoot() {
|
|
82
|
-
return {
|
|
83
|
-
ngModule: IgoActivityModule,
|
|
84
|
-
providers: [
|
|
85
|
-
{
|
|
86
|
-
provide: HTTP_INTERCEPTORS,
|
|
87
|
-
useClass: ActivityInterceptor,
|
|
88
|
-
multi: true
|
|
89
|
-
}
|
|
90
|
-
]
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
IgoActivityModule.ɵfac = function IgoActivityModule_Factory(t) { return new (t || IgoActivityModule)(); };
|
|
95
|
-
IgoActivityModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoActivityModule });
|
|
96
|
-
IgoActivityModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
|
|
97
|
-
(function () {
|
|
98
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoActivityModule, [{
|
|
99
|
-
type: NgModule,
|
|
100
|
-
args: [{
|
|
101
|
-
imports: [],
|
|
102
|
-
declarations: [],
|
|
103
|
-
exports: []
|
|
104
|
-
}]
|
|
105
|
-
}], null, null);
|
|
80
|
+
class IgoActivityModule {
|
|
81
|
+
static forRoot() {
|
|
82
|
+
return {
|
|
83
|
+
ngModule: IgoActivityModule,
|
|
84
|
+
providers: [
|
|
85
|
+
{
|
|
86
|
+
provide: HTTP_INTERCEPTORS,
|
|
87
|
+
useClass: ActivityInterceptor,
|
|
88
|
+
multi: true
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
IgoActivityModule.ɵfac = function IgoActivityModule_Factory(t) { return new (t || IgoActivityModule)(); };
|
|
95
|
+
IgoActivityModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoActivityModule });
|
|
96
|
+
IgoActivityModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
|
|
97
|
+
(function () {
|
|
98
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoActivityModule, [{
|
|
99
|
+
type: NgModule,
|
|
100
|
+
args: [{
|
|
101
|
+
imports: [],
|
|
102
|
+
declarations: [],
|
|
103
|
+
exports: []
|
|
104
|
+
}]
|
|
105
|
+
}], null, null);
|
|
106
106
|
})();
|
|
107
107
|
|
|
108
|
-
const version = {
|
|
109
|
-
lib: '1.15.
|
|
110
|
-
releaseDate:
|
|
108
|
+
const version = {
|
|
109
|
+
lib: '1.15.6',
|
|
110
|
+
releaseDate: 1713187580855
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
-
class ConfigService {
|
|
114
|
-
constructor(injector) {
|
|
115
|
-
this.injector = injector;
|
|
116
|
-
this.config = {};
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Use to get the data found in config file
|
|
120
|
-
*/
|
|
121
|
-
getConfig(key) {
|
|
122
|
-
return ObjectUtils.resolve(this.config, key);
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* This method loads "[path]" to get all config's variables
|
|
126
|
-
*/
|
|
127
|
-
load(options) {
|
|
128
|
-
const baseConfig = options.default || {};
|
|
129
|
-
if (!options.path) {
|
|
130
|
-
this.config = baseConfig;
|
|
131
|
-
return true;
|
|
132
|
-
}
|
|
133
|
-
const http = this.injector.get(HttpClient);
|
|
134
|
-
return new Promise((resolve, _reject) => {
|
|
135
|
-
http
|
|
136
|
-
.get(options.path)
|
|
137
|
-
.pipe(catchError((error) => {
|
|
138
|
-
console.log(`Configuration file ${options.path} could not be read`);
|
|
139
|
-
resolve(true);
|
|
140
|
-
return throwError(error.error || 'Server error');
|
|
141
|
-
}))
|
|
142
|
-
.subscribe((configResponse) => {
|
|
143
|
-
this.config = ObjectUtils.mergeDeep(ObjectUtils.mergeDeep({ version }, baseConfig), configResponse);
|
|
144
|
-
resolve(true);
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
ConfigService.ɵfac = function ConfigService_Factory(t) { return new (t || ConfigService)(i0.ɵɵinject(i0.Injector)); };
|
|
150
|
-
ConfigService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ConfigService, factory: ConfigService.ɵfac, providedIn: 'root' });
|
|
151
|
-
(function () {
|
|
152
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ConfigService, [{
|
|
153
|
-
type: Injectable,
|
|
154
|
-
args: [{
|
|
155
|
-
providedIn: 'root'
|
|
156
|
-
}]
|
|
157
|
-
}], function () { return [{ type: i0.Injector }]; }, null);
|
|
113
|
+
class ConfigService {
|
|
114
|
+
constructor(injector) {
|
|
115
|
+
this.injector = injector;
|
|
116
|
+
this.config = {};
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Use to get the data found in config file
|
|
120
|
+
*/
|
|
121
|
+
getConfig(key) {
|
|
122
|
+
return ObjectUtils.resolve(this.config, key);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* This method loads "[path]" to get all config's variables
|
|
126
|
+
*/
|
|
127
|
+
load(options) {
|
|
128
|
+
const baseConfig = options.default || {};
|
|
129
|
+
if (!options.path) {
|
|
130
|
+
this.config = baseConfig;
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
const http = this.injector.get(HttpClient);
|
|
134
|
+
return new Promise((resolve, _reject) => {
|
|
135
|
+
http
|
|
136
|
+
.get(options.path)
|
|
137
|
+
.pipe(catchError((error) => {
|
|
138
|
+
console.log(`Configuration file ${options.path} could not be read`);
|
|
139
|
+
resolve(true);
|
|
140
|
+
return throwError(error.error || 'Server error');
|
|
141
|
+
}))
|
|
142
|
+
.subscribe((configResponse) => {
|
|
143
|
+
this.config = ObjectUtils.mergeDeep(ObjectUtils.mergeDeep({ version }, baseConfig), configResponse);
|
|
144
|
+
resolve(true);
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
ConfigService.ɵfac = function ConfigService_Factory(t) { return new (t || ConfigService)(i0.ɵɵinject(i0.Injector)); };
|
|
150
|
+
ConfigService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ConfigService, factory: ConfigService.ɵfac, providedIn: 'root' });
|
|
151
|
+
(function () {
|
|
152
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ConfigService, [{
|
|
153
|
+
type: Injectable,
|
|
154
|
+
args: [{
|
|
155
|
+
providedIn: 'root'
|
|
156
|
+
}]
|
|
157
|
+
}], function () { return [{ type: i0.Injector }]; }, null);
|
|
158
158
|
})();
|
|
159
159
|
|
|
160
|
-
let CONFIG_OPTIONS = new InjectionToken('configOptions');
|
|
161
|
-
function provideConfigOptions(options) {
|
|
162
|
-
return {
|
|
163
|
-
provide: CONFIG_OPTIONS,
|
|
164
|
-
useValue: options
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
function configFactory(configService, options) {
|
|
168
|
-
return () => configService.load(options);
|
|
169
|
-
}
|
|
170
|
-
function provideConfigLoader() {
|
|
171
|
-
return {
|
|
172
|
-
provide: APP_INITIALIZER,
|
|
173
|
-
useFactory: configFactory,
|
|
174
|
-
multi: true,
|
|
175
|
-
deps: [ConfigService, CONFIG_OPTIONS]
|
|
176
|
-
};
|
|
160
|
+
let CONFIG_OPTIONS = new InjectionToken('configOptions');
|
|
161
|
+
function provideConfigOptions(options) {
|
|
162
|
+
return {
|
|
163
|
+
provide: CONFIG_OPTIONS,
|
|
164
|
+
useValue: options
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function configFactory(configService, options) {
|
|
168
|
+
return () => configService.load(options);
|
|
169
|
+
}
|
|
170
|
+
function provideConfigLoader() {
|
|
171
|
+
return {
|
|
172
|
+
provide: APP_INITIALIZER,
|
|
173
|
+
useFactory: configFactory,
|
|
174
|
+
multi: true,
|
|
175
|
+
deps: [ConfigService, CONFIG_OPTIONS]
|
|
176
|
+
};
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
class IgoConfigModule {
|
|
180
|
-
static forRoot() {
|
|
181
|
-
return {
|
|
182
|
-
ngModule: IgoConfigModule,
|
|
183
|
-
providers: [provideConfigOptions({}), provideConfigLoader()]
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
IgoConfigModule.ɵfac = function IgoConfigModule_Factory(t) { return new (t || IgoConfigModule)(); };
|
|
188
|
-
IgoConfigModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoConfigModule });
|
|
189
|
-
IgoConfigModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
|
|
190
|
-
(function () {
|
|
191
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoConfigModule, [{
|
|
192
|
-
type: NgModule,
|
|
193
|
-
args: [{
|
|
194
|
-
imports: [],
|
|
195
|
-
declarations: [],
|
|
196
|
-
exports: []
|
|
197
|
-
}]
|
|
198
|
-
}], null, null);
|
|
179
|
+
class IgoConfigModule {
|
|
180
|
+
static forRoot() {
|
|
181
|
+
return {
|
|
182
|
+
ngModule: IgoConfigModule,
|
|
183
|
+
providers: [provideConfigOptions({}), provideConfigLoader()]
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
IgoConfigModule.ɵfac = function IgoConfigModule_Factory(t) { return new (t || IgoConfigModule)(); };
|
|
188
|
+
IgoConfigModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoConfigModule });
|
|
189
|
+
IgoConfigModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
|
|
190
|
+
(function () {
|
|
191
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoConfigModule, [{
|
|
192
|
+
type: NgModule,
|
|
193
|
+
args: [{
|
|
194
|
+
imports: [],
|
|
195
|
+
declarations: [],
|
|
196
|
+
exports: []
|
|
197
|
+
}]
|
|
198
|
+
}], null, null);
|
|
199
199
|
})();
|
|
200
200
|
|
|
201
|
-
class LanguageLoader {
|
|
202
|
-
constructor(http, prefix, suffix = '.json', config) {
|
|
203
|
-
this.http = http;
|
|
204
|
-
this.prefix = prefix;
|
|
205
|
-
this.suffix = suffix;
|
|
206
|
-
this.config = config;
|
|
207
|
-
}
|
|
208
|
-
getTranslation(lang) {
|
|
209
|
-
const igoLocale$ = this.http.get(`locale/libs_locale/${lang}.json`);
|
|
210
|
-
if (this.config && !this.prefix) {
|
|
211
|
-
const prefix = this.config.getConfig('language.prefix');
|
|
212
|
-
this.prefix = !prefix || Array.isArray(prefix) ? prefix : [prefix];
|
|
213
|
-
}
|
|
214
|
-
if (!this.prefix || this.prefix.length === 0) {
|
|
215
|
-
return igoLocale$;
|
|
216
|
-
}
|
|
217
|
-
const appLocale$ = this.prefix.map((prefix) => this.http.get(`${prefix}${lang}${this.suffix}`));
|
|
218
|
-
const locale$ = forkJoin([igoLocale$, ...appLocale$]);
|
|
219
|
-
return locale$.pipe(map((translations) => {
|
|
220
|
-
return translations.reduce((acc, current) => ObjectUtils.mergeDeep(acc, current), {});
|
|
221
|
-
}));
|
|
222
|
-
}
|
|
201
|
+
class LanguageLoader {
|
|
202
|
+
constructor(http, prefix, suffix = '.json', config) {
|
|
203
|
+
this.http = http;
|
|
204
|
+
this.prefix = prefix;
|
|
205
|
+
this.suffix = suffix;
|
|
206
|
+
this.config = config;
|
|
207
|
+
}
|
|
208
|
+
getTranslation(lang) {
|
|
209
|
+
const igoLocale$ = this.http.get(`locale/libs_locale/${lang}.json`);
|
|
210
|
+
if (this.config && !this.prefix) {
|
|
211
|
+
const prefix = this.config.getConfig('language.prefix');
|
|
212
|
+
this.prefix = !prefix || Array.isArray(prefix) ? prefix : [prefix];
|
|
213
|
+
}
|
|
214
|
+
if (!this.prefix || this.prefix.length === 0) {
|
|
215
|
+
return igoLocale$;
|
|
216
|
+
}
|
|
217
|
+
const appLocale$ = this.prefix.map((prefix) => this.http.get(`${prefix}${lang}${this.suffix}`));
|
|
218
|
+
const locale$ = forkJoin([igoLocale$, ...appLocale$]);
|
|
219
|
+
return locale$.pipe(map((translations) => {
|
|
220
|
+
return translations.reduce((acc, current) => ObjectUtils.mergeDeep(acc, current), {});
|
|
221
|
+
}));
|
|
222
|
+
}
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
function defaultLanguageLoader(http, config) {
|
|
226
|
-
return new LanguageLoader(http, undefined, undefined, config);
|
|
227
|
-
}
|
|
228
|
-
function provideLanguageLoader(loader) {
|
|
229
|
-
return {
|
|
230
|
-
provide: TranslateLoader,
|
|
231
|
-
useFactory: loader || defaultLanguageLoader,
|
|
232
|
-
deps: [HttpClient]
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
function provideDefaultLanguageLoader(loader) {
|
|
236
|
-
return {
|
|
237
|
-
provide: TranslateLoader,
|
|
238
|
-
useFactory: loader || defaultLanguageLoader,
|
|
239
|
-
deps: [HttpClient, ConfigService]
|
|
240
|
-
};
|
|
225
|
+
function defaultLanguageLoader(http, config) {
|
|
226
|
+
return new LanguageLoader(http, undefined, undefined, config);
|
|
227
|
+
}
|
|
228
|
+
function provideLanguageLoader(loader) {
|
|
229
|
+
return {
|
|
230
|
+
provide: TranslateLoader,
|
|
231
|
+
useFactory: loader || defaultLanguageLoader,
|
|
232
|
+
deps: [HttpClient]
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
function provideDefaultLanguageLoader(loader) {
|
|
236
|
+
return {
|
|
237
|
+
provide: TranslateLoader,
|
|
238
|
+
useFactory: loader || defaultLanguageLoader,
|
|
239
|
+
deps: [HttpClient, ConfigService]
|
|
240
|
+
};
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
class IgoMissingTranslationHandler {
|
|
244
|
-
handle(params) {
|
|
245
|
-
if (!params.translateService.langs.length) {
|
|
243
|
+
class IgoMissingTranslationHandler {
|
|
244
|
+
handle(params) {
|
|
245
|
+
if (!params.translateService.langs.length) {
|
|
246
246
|
const error = 'Translations are not yet loaded. \
|
|
247
|
-
Check that the LanguageService is injected.';
|
|
248
|
-
throw new Error(error);
|
|
249
|
-
}
|
|
250
|
-
if (params.key.substr(0, 4) === 'igo.') {
|
|
251
|
-
throw new Error(`The Key "${params.key}" is missing in locale file.`);
|
|
252
|
-
}
|
|
253
|
-
else {
|
|
254
|
-
return params.key;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
247
|
+
Check that the LanguageService is injected.';
|
|
248
|
+
throw new Error(error);
|
|
249
|
+
}
|
|
250
|
+
if (params.key.substr(0, 4) === 'igo.') {
|
|
251
|
+
throw new Error(`The Key "${params.key}" is missing in locale file.`);
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
return params.key;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
-
class IgoLanguageModule {
|
|
260
|
-
static forRoot() {
|
|
261
|
-
return {
|
|
262
|
-
ngModule: IgoLanguageModule,
|
|
263
|
-
providers: [provideDefaultLanguageLoader()]
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
IgoLanguageModule.ɵfac = function IgoLanguageModule_Factory(t) { return new (t || IgoLanguageModule)(); };
|
|
268
|
-
IgoLanguageModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoLanguageModule });
|
|
269
|
-
IgoLanguageModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [TranslateModule.forRoot({
|
|
270
|
-
missingTranslationHandler: {
|
|
271
|
-
provide: MissingTranslationHandler,
|
|
272
|
-
useClass: IgoMissingTranslationHandler
|
|
273
|
-
}
|
|
274
|
-
}), TranslateModule] });
|
|
275
|
-
(function () {
|
|
276
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoLanguageModule, [{
|
|
277
|
-
type: NgModule,
|
|
278
|
-
args: [{
|
|
279
|
-
imports: [
|
|
280
|
-
TranslateModule.forRoot({
|
|
281
|
-
missingTranslationHandler: {
|
|
282
|
-
provide: MissingTranslationHandler,
|
|
283
|
-
useClass: IgoMissingTranslationHandler
|
|
284
|
-
}
|
|
285
|
-
})
|
|
286
|
-
],
|
|
287
|
-
declarations: [],
|
|
288
|
-
exports: [TranslateModule]
|
|
289
|
-
}]
|
|
290
|
-
}], null, null);
|
|
291
|
-
})();
|
|
259
|
+
class IgoLanguageModule {
|
|
260
|
+
static forRoot() {
|
|
261
|
+
return {
|
|
262
|
+
ngModule: IgoLanguageModule,
|
|
263
|
+
providers: [provideDefaultLanguageLoader()]
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
IgoLanguageModule.ɵfac = function IgoLanguageModule_Factory(t) { return new (t || IgoLanguageModule)(); };
|
|
268
|
+
IgoLanguageModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoLanguageModule });
|
|
269
|
+
IgoLanguageModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [TranslateModule.forRoot({
|
|
270
|
+
missingTranslationHandler: {
|
|
271
|
+
provide: MissingTranslationHandler,
|
|
272
|
+
useClass: IgoMissingTranslationHandler
|
|
273
|
+
}
|
|
274
|
+
}), TranslateModule] });
|
|
275
|
+
(function () {
|
|
276
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoLanguageModule, [{
|
|
277
|
+
type: NgModule,
|
|
278
|
+
args: [{
|
|
279
|
+
imports: [
|
|
280
|
+
TranslateModule.forRoot({
|
|
281
|
+
missingTranslationHandler: {
|
|
282
|
+
provide: MissingTranslationHandler,
|
|
283
|
+
useClass: IgoMissingTranslationHandler
|
|
284
|
+
}
|
|
285
|
+
})
|
|
286
|
+
],
|
|
287
|
+
declarations: [],
|
|
288
|
+
exports: [TranslateModule]
|
|
289
|
+
}]
|
|
290
|
+
}], null, null);
|
|
291
|
+
})();
|
|
292
292
|
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(IgoLanguageModule, { imports: [i1.TranslateModule], exports: [TranslateModule] }); })();
|
|
293
293
|
|
|
294
|
-
class IgoMessageModule {
|
|
295
|
-
static forRoot() {
|
|
296
|
-
return {
|
|
297
|
-
ngModule: IgoMessageModule,
|
|
298
|
-
providers: []
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
IgoMessageModule.ɵfac = function IgoMessageModule_Factory(t) { return new (t || IgoMessageModule)(); };
|
|
303
|
-
IgoMessageModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoMessageModule });
|
|
304
|
-
IgoMessageModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
|
|
305
|
-
ToastrModule.forRoot({
|
|
306
|
-
positionClass: 'toast-bottom-right',
|
|
307
|
-
timeOut: 10000,
|
|
308
|
-
extendedTimeOut: 10000,
|
|
309
|
-
messageClass: 'toast-message mat-typography',
|
|
310
|
-
closeButton: true,
|
|
311
|
-
progressBar: true,
|
|
312
|
-
enableHtml: true,
|
|
313
|
-
tapToDismiss: true,
|
|
314
|
-
maxOpened: 4,
|
|
315
|
-
preventDuplicates: true,
|
|
316
|
-
resetTimeoutOnDuplicate: true,
|
|
317
|
-
countDuplicates: false,
|
|
318
|
-
includeTitleDuplicates: true
|
|
319
|
-
})] });
|
|
320
|
-
(function () {
|
|
321
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoMessageModule, [{
|
|
322
|
-
type: NgModule,
|
|
323
|
-
args: [{
|
|
324
|
-
imports: [CommonModule,
|
|
325
|
-
ToastrModule.forRoot({
|
|
326
|
-
positionClass: 'toast-bottom-right',
|
|
327
|
-
timeOut: 10000,
|
|
328
|
-
extendedTimeOut: 10000,
|
|
329
|
-
messageClass: 'toast-message mat-typography',
|
|
330
|
-
closeButton: true,
|
|
331
|
-
progressBar: true,
|
|
332
|
-
enableHtml: true,
|
|
333
|
-
tapToDismiss: true,
|
|
334
|
-
maxOpened: 4,
|
|
335
|
-
preventDuplicates: true,
|
|
336
|
-
resetTimeoutOnDuplicate: true,
|
|
337
|
-
countDuplicates: false,
|
|
338
|
-
includeTitleDuplicates: true
|
|
339
|
-
})],
|
|
340
|
-
declarations: [],
|
|
341
|
-
exports: []
|
|
342
|
-
}]
|
|
343
|
-
}], null, null);
|
|
344
|
-
})();
|
|
294
|
+
class IgoMessageModule {
|
|
295
|
+
static forRoot() {
|
|
296
|
+
return {
|
|
297
|
+
ngModule: IgoMessageModule,
|
|
298
|
+
providers: []
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
IgoMessageModule.ɵfac = function IgoMessageModule_Factory(t) { return new (t || IgoMessageModule)(); };
|
|
303
|
+
IgoMessageModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoMessageModule });
|
|
304
|
+
IgoMessageModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
|
|
305
|
+
ToastrModule.forRoot({
|
|
306
|
+
positionClass: 'toast-bottom-right',
|
|
307
|
+
timeOut: 10000,
|
|
308
|
+
extendedTimeOut: 10000,
|
|
309
|
+
messageClass: 'toast-message mat-typography',
|
|
310
|
+
closeButton: true,
|
|
311
|
+
progressBar: true,
|
|
312
|
+
enableHtml: true,
|
|
313
|
+
tapToDismiss: true,
|
|
314
|
+
maxOpened: 4,
|
|
315
|
+
preventDuplicates: true,
|
|
316
|
+
resetTimeoutOnDuplicate: true,
|
|
317
|
+
countDuplicates: false,
|
|
318
|
+
includeTitleDuplicates: true
|
|
319
|
+
})] });
|
|
320
|
+
(function () {
|
|
321
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoMessageModule, [{
|
|
322
|
+
type: NgModule,
|
|
323
|
+
args: [{
|
|
324
|
+
imports: [CommonModule,
|
|
325
|
+
ToastrModule.forRoot({
|
|
326
|
+
positionClass: 'toast-bottom-right',
|
|
327
|
+
timeOut: 10000,
|
|
328
|
+
extendedTimeOut: 10000,
|
|
329
|
+
messageClass: 'toast-message mat-typography',
|
|
330
|
+
closeButton: true,
|
|
331
|
+
progressBar: true,
|
|
332
|
+
enableHtml: true,
|
|
333
|
+
tapToDismiss: true,
|
|
334
|
+
maxOpened: 4,
|
|
335
|
+
preventDuplicates: true,
|
|
336
|
+
resetTimeoutOnDuplicate: true,
|
|
337
|
+
countDuplicates: false,
|
|
338
|
+
includeTitleDuplicates: true
|
|
339
|
+
})],
|
|
340
|
+
declarations: [],
|
|
341
|
+
exports: []
|
|
342
|
+
}]
|
|
343
|
+
}], null, null);
|
|
344
|
+
})();
|
|
345
345
|
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(IgoMessageModule, { imports: [CommonModule, i1$1.ToastrModule] }); })();
|
|
346
346
|
|
|
347
|
-
var MessageType;
|
|
348
|
-
(function (MessageType) {
|
|
349
|
-
MessageType["ERROR"] = "error";
|
|
350
|
-
MessageType["ALERT"] = "warning";
|
|
351
|
-
MessageType["WARNING"] = "warning";
|
|
352
|
-
MessageType["INFO"] = "info";
|
|
353
|
-
MessageType["SUCCESS"] = "success";
|
|
354
|
-
MessageType["SHOW"] = "show";
|
|
347
|
+
var MessageType;
|
|
348
|
+
(function (MessageType) {
|
|
349
|
+
MessageType["ERROR"] = "error";
|
|
350
|
+
MessageType["ALERT"] = "warning";
|
|
351
|
+
MessageType["WARNING"] = "warning";
|
|
352
|
+
MessageType["INFO"] = "info";
|
|
353
|
+
MessageType["SUCCESS"] = "success";
|
|
354
|
+
MessageType["SHOW"] = "show";
|
|
355
355
|
})(MessageType || (MessageType = {}));
|
|
356
356
|
|
|
357
|
-
class LanguageService {
|
|
358
|
-
constructor(translate) {
|
|
359
|
-
this.translate = translate;
|
|
360
|
-
this.language = this.translate.getBrowserLang();
|
|
361
|
-
this.language$ = new BehaviorSubject(undefined);
|
|
362
|
-
const lang = this.getLanguage();
|
|
363
|
-
this.translate.setDefaultLang(lang);
|
|
364
|
-
this.language$.next(lang);
|
|
365
|
-
}
|
|
366
|
-
getLanguage() {
|
|
367
|
-
return this.language.match(/en|fr/) ? this.language : 'en';
|
|
368
|
-
}
|
|
369
|
-
setLanguage(language) {
|
|
370
|
-
this.language = language.match(/en|fr/) ? language : 'en';
|
|
371
|
-
combineLatest([this.translate.use(this.language), this.translate.reloadLang(this.language)]).subscribe(() => {
|
|
372
|
-
this.language$.next(this.language);
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
LanguageService.ɵfac = function LanguageService_Factory(t) { return new (t || LanguageService)(i0.ɵɵinject(i1.TranslateService)); };
|
|
377
|
-
LanguageService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: LanguageService, factory: LanguageService.ɵfac, providedIn: 'root' });
|
|
378
|
-
(function () {
|
|
379
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(LanguageService, [{
|
|
380
|
-
type: Injectable,
|
|
381
|
-
args: [{
|
|
382
|
-
providedIn: 'root'
|
|
383
|
-
}]
|
|
384
|
-
}], function () { return [{ type: i1.TranslateService }]; }, null);
|
|
357
|
+
class LanguageService {
|
|
358
|
+
constructor(translate) {
|
|
359
|
+
this.translate = translate;
|
|
360
|
+
this.language = this.translate.getBrowserLang();
|
|
361
|
+
this.language$ = new BehaviorSubject(undefined);
|
|
362
|
+
const lang = this.getLanguage();
|
|
363
|
+
this.translate.setDefaultLang(lang);
|
|
364
|
+
this.language$.next(lang);
|
|
365
|
+
}
|
|
366
|
+
getLanguage() {
|
|
367
|
+
return this.language.match(/en|fr/) ? this.language : 'en';
|
|
368
|
+
}
|
|
369
|
+
setLanguage(language) {
|
|
370
|
+
this.language = language.match(/en|fr/) ? language : 'en';
|
|
371
|
+
combineLatest([this.translate.use(this.language), this.translate.reloadLang(this.language)]).subscribe(() => {
|
|
372
|
+
this.language$.next(this.language);
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
LanguageService.ɵfac = function LanguageService_Factory(t) { return new (t || LanguageService)(i0.ɵɵinject(i1.TranslateService)); };
|
|
377
|
+
LanguageService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: LanguageService, factory: LanguageService.ɵfac, providedIn: 'root' });
|
|
378
|
+
(function () {
|
|
379
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(LanguageService, [{
|
|
380
|
+
type: Injectable,
|
|
381
|
+
args: [{
|
|
382
|
+
providedIn: 'root'
|
|
383
|
+
}]
|
|
384
|
+
}], function () { return [{ type: i1.TranslateService }]; }, null);
|
|
385
385
|
})();
|
|
386
386
|
|
|
387
|
-
class MessageService {
|
|
388
|
-
constructor(injector, configService, languageService) {
|
|
389
|
-
this.injector = injector;
|
|
390
|
-
this.configService = configService;
|
|
391
|
-
this.languageService = languageService;
|
|
392
|
-
this.messages$ = new BehaviorSubject([]);
|
|
393
|
-
this.activeMessageTranslations = [];
|
|
394
|
-
this.options = this.configService.getConfig('message') || {};
|
|
395
|
-
this.languageService.language$.pipe(debounceTime(500)).subscribe(r => {
|
|
396
|
-
if (this.toastr.toasts.length === 0) {
|
|
397
|
-
this.activeMessageTranslations = [];
|
|
398
|
-
}
|
|
399
|
-
this.toastr.toasts.map(toast => {
|
|
400
|
-
const activeMessageTranslation = this.activeMessageTranslations.find(amt => amt.id === toast.toastId);
|
|
401
|
-
if (activeMessageTranslation) {
|
|
402
|
-
const translatedTextInterpolateParams = Object.assign({}, activeMessageTranslation.textInterpolateParams);
|
|
403
|
-
const translatedTitleInterpolateParams = Object.assign({}, activeMessageTranslation.titleInterpolateParams);
|
|
404
|
-
if (activeMessageTranslation.textInterpolateParams) {
|
|
405
|
-
Object.keys(activeMessageTranslation.textInterpolateParams).map(k => {
|
|
406
|
-
if (k) {
|
|
407
|
-
translatedTextInterpolateParams[k] =
|
|
408
|
-
this.languageService.translate.instant(activeMessageTranslation.textInterpolateParams[k]);
|
|
409
|
-
}
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
if (activeMessageTranslation.titleInterpolateParams) {
|
|
413
|
-
Object.keys(activeMessageTranslation.titleInterpolateParams).map(k => {
|
|
414
|
-
if (k) {
|
|
415
|
-
translatedTitleInterpolateParams[k] =
|
|
416
|
-
this.languageService.translate.instant(activeMessageTranslation.titleInterpolateParams[k]);
|
|
417
|
-
}
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
forkJoin([
|
|
421
|
-
this.languageService.translate.get(activeMessageTranslation.textKey, translatedTextInterpolateParams),
|
|
422
|
-
this.languageService.translate.get(activeMessageTranslation.titleKey, translatedTitleInterpolateParams)
|
|
423
|
-
]).pipe(first()).subscribe((res) => {
|
|
424
|
-
toast.toastRef.componentInstance.message = res[0];
|
|
425
|
-
toast.toastRef.componentInstance.title = res[1];
|
|
426
|
-
});
|
|
427
|
-
}
|
|
428
|
-
});
|
|
429
|
-
});
|
|
430
|
-
}
|
|
431
|
-
get toastr() {
|
|
432
|
-
return this.injector.get(ToastrService);
|
|
433
|
-
}
|
|
434
|
-
showError(httpError) {
|
|
435
|
-
httpError.error.caught = true;
|
|
436
|
-
return this.error(httpError.error.message, httpError.error.title);
|
|
437
|
-
}
|
|
438
|
-
message(message) {
|
|
439
|
-
const messageType = message.type;
|
|
440
|
-
this.toastr.toastrConfig.iconClasses[messageType] = `toast-${messageType}`;
|
|
441
|
-
this.messages$.next(this.messages$.value.concat([message]));
|
|
442
|
-
message.options = message.options || {};
|
|
443
|
-
const currentDate = new Date();
|
|
444
|
-
message.options.from = message.options.from ? message.options.from : new Date('1 jan 1900');
|
|
445
|
-
message.options.to = message.options.to ? message.options.to : new Date('1 jan 3000');
|
|
446
|
-
if (typeof message.options.from === 'string') {
|
|
447
|
-
message.options.from = new Date(Date.parse(message.options.from.replace(/-/g, ' ')));
|
|
448
|
-
}
|
|
449
|
-
if (typeof message.options.to === 'string') {
|
|
450
|
-
message.options.to = new Date(Date.parse(message.options.to.replace(/-/g, ' ')));
|
|
451
|
-
}
|
|
452
|
-
if (currentDate > message.options.from && currentDate < message.options.to) {
|
|
453
|
-
if (message.showIcon === false) {
|
|
454
|
-
this.toastr.toastrConfig.iconClasses[messageType] = `toast-${messageType} toast-no-icon`;
|
|
455
|
-
}
|
|
456
|
-
message = this.handleTemplate(message);
|
|
457
|
-
if (message.text) {
|
|
458
|
-
let messageShown;
|
|
459
|
-
switch (message.type) {
|
|
460
|
-
case MessageType.SUCCESS:
|
|
461
|
-
messageShown = this.success(message.text, message.title, message.options, message.textInterpolateParams, message.titleInterpolateParams);
|
|
462
|
-
break;
|
|
463
|
-
case MessageType.ERROR:
|
|
464
|
-
messageShown = this.error(message.text, message.title, message.options, message.textInterpolateParams, message.titleInterpolateParams);
|
|
465
|
-
break;
|
|
466
|
-
case MessageType.INFO:
|
|
467
|
-
messageShown = this.info(message.text, message.title, message.options, message.textInterpolateParams, message.titleInterpolateParams);
|
|
468
|
-
break;
|
|
469
|
-
case MessageType.SHOW:
|
|
470
|
-
messageShown = this.show(message.text, message.title, message.options, message.textInterpolateParams, message.titleInterpolateParams);
|
|
471
|
-
break;
|
|
472
|
-
case MessageType.ALERT:
|
|
473
|
-
case MessageType.WARNING:
|
|
474
|
-
messageShown = this.alert(message.text, message.title, message.options, message.textInterpolateParams, message.titleInterpolateParams);
|
|
475
|
-
break;
|
|
476
|
-
default:
|
|
477
|
-
messageShown = this.info(message.text, message.title, message.options, message.textInterpolateParams, message.titleInterpolateParams);
|
|
478
|
-
break;
|
|
479
|
-
}
|
|
480
|
-
message.options.id = messageShown.toastId;
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
success(text, title = 'igo.core.message.success', options = {}, textInterpolateParams, titleInterpolateParams) {
|
|
485
|
-
return this.handleNgxToastr('success', text, title, options, textInterpolateParams, titleInterpolateParams);
|
|
486
|
-
}
|
|
487
|
-
error(text, title = 'igo.core.message.error', options = {}, textInterpolateParams, titleInterpolateParams) {
|
|
488
|
-
return this.handleNgxToastr('error', text, title, options, textInterpolateParams, titleInterpolateParams);
|
|
489
|
-
}
|
|
490
|
-
info(text, title = 'igo.core.message.info', options = {}, textInterpolateParams, titleInterpolateParams) {
|
|
491
|
-
return this.handleNgxToastr('info', text, title, options, textInterpolateParams, titleInterpolateParams);
|
|
492
|
-
}
|
|
493
|
-
alert(text, title = 'igo.core.message.alert', options = {}, textInterpolateParams, titleInterpolateParams) {
|
|
494
|
-
return this.handleNgxToastr('alert', text, title, options, textInterpolateParams, titleInterpolateParams);
|
|
495
|
-
}
|
|
496
|
-
show(text, title = 'igo.core.message.info', options = {}, textInterpolateParams, titleInterpolateParams) {
|
|
497
|
-
return this.handleNgxToastr('show', text, title, options, textInterpolateParams, titleInterpolateParams);
|
|
498
|
-
}
|
|
499
|
-
handleNgxToastr(type, text, title, options = {}, textInterpolateParams, titleInterpolateParams) {
|
|
500
|
-
const translatedTextInterpolateParams = Object.assign({}, textInterpolateParams);
|
|
501
|
-
const translatedTitlenterpolateParams = Object.assign({}, titleInterpolateParams);
|
|
502
|
-
if (textInterpolateParams) {
|
|
503
|
-
Object.keys(textInterpolateParams).map(k => {
|
|
504
|
-
if (textInterpolateParams[k]) {
|
|
505
|
-
translatedTextInterpolateParams[k] =
|
|
506
|
-
this.languageService.translate.instant(textInterpolateParams[k]);
|
|
507
|
-
}
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
if (titleInterpolateParams) {
|
|
511
|
-
Object.keys(titleInterpolateParams).map(k => {
|
|
512
|
-
if (k) {
|
|
513
|
-
translatedTitlenterpolateParams[k] =
|
|
514
|
-
this.languageService.translate.instant(titleInterpolateParams[k]);
|
|
515
|
-
}
|
|
516
|
-
});
|
|
517
|
-
}
|
|
518
|
-
const message = this.languageService.translate.instant(text, translatedTextInterpolateParams);
|
|
519
|
-
const translatedTitle = this.languageService.translate.instant(title, translatedTitlenterpolateParams);
|
|
520
|
-
let activeToast;
|
|
521
|
-
switch (type) {
|
|
522
|
-
case 'success':
|
|
523
|
-
activeToast = this.toastr.success(message, translatedTitle, options);
|
|
524
|
-
break;
|
|
525
|
-
case 'error':
|
|
526
|
-
activeToast = this.toastr.error(message, translatedTitle, options);
|
|
527
|
-
break;
|
|
528
|
-
case 'show':
|
|
529
|
-
case 'info':
|
|
530
|
-
activeToast = this.toastr.info(message, translatedTitle, options);
|
|
531
|
-
break;
|
|
532
|
-
case 'alert':
|
|
533
|
-
activeToast = this.toastr.warning(message, translatedTitle, options);
|
|
534
|
-
break;
|
|
535
|
-
}
|
|
536
|
-
this.activeMessageTranslations.push({
|
|
537
|
-
id: activeToast.toastId,
|
|
538
|
-
titleKey: title,
|
|
539
|
-
textKey: text,
|
|
540
|
-
textInterpolateParams,
|
|
541
|
-
titleInterpolateParams
|
|
542
|
-
});
|
|
543
|
-
return activeToast;
|
|
544
|
-
}
|
|
545
|
-
remove(id) {
|
|
546
|
-
this.toastr.remove(id);
|
|
547
|
-
}
|
|
548
|
-
removeAllAreNotError() {
|
|
549
|
-
for (const mess of this.messages$.value) {
|
|
550
|
-
if (mess.type !== MessageType.ERROR) {
|
|
551
|
-
this.remove(mess.options.id);
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
handleTemplate(message) {
|
|
556
|
-
if (!this.options.template || message.html) {
|
|
557
|
-
return message;
|
|
558
|
-
}
|
|
559
|
-
let html = this.options.template;
|
|
560
|
-
html = html.replace('${text}', message.text);
|
|
561
|
-
html = html.replace('${title}', message.title);
|
|
562
|
-
message.html = undefined;
|
|
563
|
-
message.text = html;
|
|
564
|
-
message.title = undefined;
|
|
565
|
-
return message;
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
MessageService.ɵfac = function MessageService_Factory(t) { return new (t || MessageService)(i0.ɵɵinject(Injector), i0.ɵɵinject(ConfigService), i0.ɵɵinject(LanguageService)); };
|
|
569
|
-
MessageService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: MessageService, factory: MessageService.ɵfac, providedIn: 'root' });
|
|
570
|
-
(function () {
|
|
571
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MessageService, [{
|
|
572
|
-
type: Injectable,
|
|
573
|
-
args: [{
|
|
574
|
-
providedIn: 'root'
|
|
575
|
-
}]
|
|
576
|
-
}], function () {
|
|
577
|
-
return [{ type: i0.Injector, decorators: [{
|
|
578
|
-
type: Inject,
|
|
579
|
-
args: [Injector]
|
|
580
|
-
}] }, { type: ConfigService }, { type: LanguageService }];
|
|
581
|
-
}, null);
|
|
387
|
+
class MessageService {
|
|
388
|
+
constructor(injector, configService, languageService) {
|
|
389
|
+
this.injector = injector;
|
|
390
|
+
this.configService = configService;
|
|
391
|
+
this.languageService = languageService;
|
|
392
|
+
this.messages$ = new BehaviorSubject([]);
|
|
393
|
+
this.activeMessageTranslations = [];
|
|
394
|
+
this.options = this.configService.getConfig('message') || {};
|
|
395
|
+
this.languageService.language$.pipe(debounceTime(500)).subscribe(r => {
|
|
396
|
+
if (this.toastr.toasts.length === 0) {
|
|
397
|
+
this.activeMessageTranslations = [];
|
|
398
|
+
}
|
|
399
|
+
this.toastr.toasts.map(toast => {
|
|
400
|
+
const activeMessageTranslation = this.activeMessageTranslations.find(amt => amt.id === toast.toastId);
|
|
401
|
+
if (activeMessageTranslation) {
|
|
402
|
+
const translatedTextInterpolateParams = Object.assign({}, activeMessageTranslation.textInterpolateParams);
|
|
403
|
+
const translatedTitleInterpolateParams = Object.assign({}, activeMessageTranslation.titleInterpolateParams);
|
|
404
|
+
if (activeMessageTranslation.textInterpolateParams) {
|
|
405
|
+
Object.keys(activeMessageTranslation.textInterpolateParams).map(k => {
|
|
406
|
+
if (k) {
|
|
407
|
+
translatedTextInterpolateParams[k] =
|
|
408
|
+
this.languageService.translate.instant(activeMessageTranslation.textInterpolateParams[k]);
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
if (activeMessageTranslation.titleInterpolateParams) {
|
|
413
|
+
Object.keys(activeMessageTranslation.titleInterpolateParams).map(k => {
|
|
414
|
+
if (k) {
|
|
415
|
+
translatedTitleInterpolateParams[k] =
|
|
416
|
+
this.languageService.translate.instant(activeMessageTranslation.titleInterpolateParams[k]);
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
forkJoin([
|
|
421
|
+
this.languageService.translate.get(activeMessageTranslation.textKey, translatedTextInterpolateParams),
|
|
422
|
+
this.languageService.translate.get(activeMessageTranslation.titleKey, translatedTitleInterpolateParams)
|
|
423
|
+
]).pipe(first()).subscribe((res) => {
|
|
424
|
+
toast.toastRef.componentInstance.message = res[0];
|
|
425
|
+
toast.toastRef.componentInstance.title = res[1];
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
get toastr() {
|
|
432
|
+
return this.injector.get(ToastrService);
|
|
433
|
+
}
|
|
434
|
+
showError(httpError) {
|
|
435
|
+
httpError.error.caught = true;
|
|
436
|
+
return this.error(httpError.error.message, httpError.error.title);
|
|
437
|
+
}
|
|
438
|
+
message(message) {
|
|
439
|
+
const messageType = message.type;
|
|
440
|
+
this.toastr.toastrConfig.iconClasses[messageType] = `toast-${messageType}`;
|
|
441
|
+
this.messages$.next(this.messages$.value.concat([message]));
|
|
442
|
+
message.options = message.options || {};
|
|
443
|
+
const currentDate = new Date();
|
|
444
|
+
message.options.from = message.options.from ? message.options.from : new Date('1 jan 1900');
|
|
445
|
+
message.options.to = message.options.to ? message.options.to : new Date('1 jan 3000');
|
|
446
|
+
if (typeof message.options.from === 'string') {
|
|
447
|
+
message.options.from = new Date(Date.parse(message.options.from.replace(/-/g, ' ')));
|
|
448
|
+
}
|
|
449
|
+
if (typeof message.options.to === 'string') {
|
|
450
|
+
message.options.to = new Date(Date.parse(message.options.to.replace(/-/g, ' ')));
|
|
451
|
+
}
|
|
452
|
+
if (currentDate > message.options.from && currentDate < message.options.to) {
|
|
453
|
+
if (message.showIcon === false) {
|
|
454
|
+
this.toastr.toastrConfig.iconClasses[messageType] = `toast-${messageType} toast-no-icon`;
|
|
455
|
+
}
|
|
456
|
+
message = this.handleTemplate(message);
|
|
457
|
+
if (message.text) {
|
|
458
|
+
let messageShown;
|
|
459
|
+
switch (message.type) {
|
|
460
|
+
case MessageType.SUCCESS:
|
|
461
|
+
messageShown = this.success(message.text, message.title, message.options, message.textInterpolateParams, message.titleInterpolateParams);
|
|
462
|
+
break;
|
|
463
|
+
case MessageType.ERROR:
|
|
464
|
+
messageShown = this.error(message.text, message.title, message.options, message.textInterpolateParams, message.titleInterpolateParams);
|
|
465
|
+
break;
|
|
466
|
+
case MessageType.INFO:
|
|
467
|
+
messageShown = this.info(message.text, message.title, message.options, message.textInterpolateParams, message.titleInterpolateParams);
|
|
468
|
+
break;
|
|
469
|
+
case MessageType.SHOW:
|
|
470
|
+
messageShown = this.show(message.text, message.title, message.options, message.textInterpolateParams, message.titleInterpolateParams);
|
|
471
|
+
break;
|
|
472
|
+
case MessageType.ALERT:
|
|
473
|
+
case MessageType.WARNING:
|
|
474
|
+
messageShown = this.alert(message.text, message.title, message.options, message.textInterpolateParams, message.titleInterpolateParams);
|
|
475
|
+
break;
|
|
476
|
+
default:
|
|
477
|
+
messageShown = this.info(message.text, message.title, message.options, message.textInterpolateParams, message.titleInterpolateParams);
|
|
478
|
+
break;
|
|
479
|
+
}
|
|
480
|
+
message.options.id = messageShown.toastId;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
success(text, title = 'igo.core.message.success', options = {}, textInterpolateParams, titleInterpolateParams) {
|
|
485
|
+
return this.handleNgxToastr('success', text, title, options, textInterpolateParams, titleInterpolateParams);
|
|
486
|
+
}
|
|
487
|
+
error(text, title = 'igo.core.message.error', options = {}, textInterpolateParams, titleInterpolateParams) {
|
|
488
|
+
return this.handleNgxToastr('error', text, title, options, textInterpolateParams, titleInterpolateParams);
|
|
489
|
+
}
|
|
490
|
+
info(text, title = 'igo.core.message.info', options = {}, textInterpolateParams, titleInterpolateParams) {
|
|
491
|
+
return this.handleNgxToastr('info', text, title, options, textInterpolateParams, titleInterpolateParams);
|
|
492
|
+
}
|
|
493
|
+
alert(text, title = 'igo.core.message.alert', options = {}, textInterpolateParams, titleInterpolateParams) {
|
|
494
|
+
return this.handleNgxToastr('alert', text, title, options, textInterpolateParams, titleInterpolateParams);
|
|
495
|
+
}
|
|
496
|
+
show(text, title = 'igo.core.message.info', options = {}, textInterpolateParams, titleInterpolateParams) {
|
|
497
|
+
return this.handleNgxToastr('show', text, title, options, textInterpolateParams, titleInterpolateParams);
|
|
498
|
+
}
|
|
499
|
+
handleNgxToastr(type, text, title, options = {}, textInterpolateParams, titleInterpolateParams) {
|
|
500
|
+
const translatedTextInterpolateParams = Object.assign({}, textInterpolateParams);
|
|
501
|
+
const translatedTitlenterpolateParams = Object.assign({}, titleInterpolateParams);
|
|
502
|
+
if (textInterpolateParams) {
|
|
503
|
+
Object.keys(textInterpolateParams).map(k => {
|
|
504
|
+
if (textInterpolateParams[k]) {
|
|
505
|
+
translatedTextInterpolateParams[k] =
|
|
506
|
+
this.languageService.translate.instant(textInterpolateParams[k]);
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
if (titleInterpolateParams) {
|
|
511
|
+
Object.keys(titleInterpolateParams).map(k => {
|
|
512
|
+
if (k) {
|
|
513
|
+
translatedTitlenterpolateParams[k] =
|
|
514
|
+
this.languageService.translate.instant(titleInterpolateParams[k]);
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
const message = this.languageService.translate.instant(text, translatedTextInterpolateParams);
|
|
519
|
+
const translatedTitle = this.languageService.translate.instant(title, translatedTitlenterpolateParams);
|
|
520
|
+
let activeToast;
|
|
521
|
+
switch (type) {
|
|
522
|
+
case 'success':
|
|
523
|
+
activeToast = this.toastr.success(message, translatedTitle, options);
|
|
524
|
+
break;
|
|
525
|
+
case 'error':
|
|
526
|
+
activeToast = this.toastr.error(message, translatedTitle, options);
|
|
527
|
+
break;
|
|
528
|
+
case 'show':
|
|
529
|
+
case 'info':
|
|
530
|
+
activeToast = this.toastr.info(message, translatedTitle, options);
|
|
531
|
+
break;
|
|
532
|
+
case 'alert':
|
|
533
|
+
activeToast = this.toastr.warning(message, translatedTitle, options);
|
|
534
|
+
break;
|
|
535
|
+
}
|
|
536
|
+
this.activeMessageTranslations.push({
|
|
537
|
+
id: activeToast.toastId,
|
|
538
|
+
titleKey: title,
|
|
539
|
+
textKey: text,
|
|
540
|
+
textInterpolateParams,
|
|
541
|
+
titleInterpolateParams
|
|
542
|
+
});
|
|
543
|
+
return activeToast;
|
|
544
|
+
}
|
|
545
|
+
remove(id) {
|
|
546
|
+
this.toastr.remove(id);
|
|
547
|
+
}
|
|
548
|
+
removeAllAreNotError() {
|
|
549
|
+
for (const mess of this.messages$.value) {
|
|
550
|
+
if (mess.type !== MessageType.ERROR) {
|
|
551
|
+
this.remove(mess.options.id);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
handleTemplate(message) {
|
|
556
|
+
if (!this.options.template || message.html) {
|
|
557
|
+
return message;
|
|
558
|
+
}
|
|
559
|
+
let html = this.options.template;
|
|
560
|
+
html = html.replace('${text}', message.text);
|
|
561
|
+
html = html.replace('${title}', message.title);
|
|
562
|
+
message.html = undefined;
|
|
563
|
+
message.text = html;
|
|
564
|
+
message.title = undefined;
|
|
565
|
+
return message;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
MessageService.ɵfac = function MessageService_Factory(t) { return new (t || MessageService)(i0.ɵɵinject(Injector), i0.ɵɵinject(ConfigService), i0.ɵɵinject(LanguageService)); };
|
|
569
|
+
MessageService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: MessageService, factory: MessageService.ɵfac, providedIn: 'root' });
|
|
570
|
+
(function () {
|
|
571
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MessageService, [{
|
|
572
|
+
type: Injectable,
|
|
573
|
+
args: [{
|
|
574
|
+
providedIn: 'root'
|
|
575
|
+
}]
|
|
576
|
+
}], function () {
|
|
577
|
+
return [{ type: i0.Injector, decorators: [{
|
|
578
|
+
type: Inject,
|
|
579
|
+
args: [Injector]
|
|
580
|
+
}] }, { type: ConfigService }, { type: LanguageService }];
|
|
581
|
+
}, null);
|
|
582
582
|
})();
|
|
583
583
|
|
|
584
|
-
class ErrorInterceptor {
|
|
585
|
-
constructor(injector) {
|
|
586
|
-
this.injector = injector;
|
|
587
|
-
}
|
|
588
|
-
intercept(originalReq, next) {
|
|
589
|
-
const interceptError = originalReq.headers.get('interceptError');
|
|
590
|
-
const req = originalReq.clone({
|
|
591
|
-
headers: originalReq.headers.delete('interceptError')
|
|
592
|
-
});
|
|
593
|
-
if (interceptError === 'false') {
|
|
594
|
-
return next.handle(req);
|
|
595
|
-
}
|
|
596
|
-
const errorContainer = { httpError: undefined };
|
|
597
|
-
return next.handle(req).pipe(catchError(error => this.handleError(error, errorContainer)), finalize(() => {
|
|
598
|
-
this.handleCaughtError(errorContainer);
|
|
599
|
-
this.handleUncaughtError(errorContainer);
|
|
600
|
-
}));
|
|
601
|
-
}
|
|
602
|
-
handleError(httpError, errorContainer) {
|
|
603
|
-
var _a;
|
|
604
|
-
if (httpError instanceof HttpErrorResponse) {
|
|
605
|
-
const errorObj = httpError.error === 'object' ? httpError.error : {};
|
|
606
|
-
errorObj.message = ((_a = httpError.error) === null || _a === void 0 ? void 0 : _a.message) || httpError.statusText;
|
|
607
|
-
errorObj.caught = false;
|
|
608
|
-
httpError = new HttpErrorResponse({
|
|
609
|
-
error: errorObj,
|
|
610
|
-
headers: httpError.headers,
|
|
611
|
-
status: httpError.status,
|
|
612
|
-
statusText: httpError.statusText,
|
|
613
|
-
url: httpError.url
|
|
614
|
-
});
|
|
615
|
-
}
|
|
616
|
-
errorContainer.httpError = httpError;
|
|
617
|
-
return throwError(httpError);
|
|
618
|
-
}
|
|
619
|
-
handleCaughtError(errorContainer) {
|
|
620
|
-
const httpError = errorContainer.httpError;
|
|
621
|
-
if (httpError && httpError.error.toDisplay) {
|
|
622
|
-
httpError.error.caught = true;
|
|
623
|
-
const messageService = this.injector.get(MessageService);
|
|
624
|
-
messageService.error(httpError.error.message, httpError.error.title);
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
handleUncaughtError(errorContainer) {
|
|
628
|
-
const httpError = errorContainer.httpError;
|
|
629
|
-
if (httpError && !httpError.error.caught) {
|
|
630
|
-
const messageService = this.injector.get(MessageService);
|
|
631
|
-
httpError.error.caught = true;
|
|
632
|
-
messageService.error('igo.core.errors.uncaught.message', 'igo.core.errors.uncaught.title');
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
ErrorInterceptor.ɵfac = function ErrorInterceptor_Factory(t) { return new (t || ErrorInterceptor)(i0.ɵɵinject(i0.Injector)); };
|
|
637
|
-
ErrorInterceptor.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ErrorInterceptor, factory: ErrorInterceptor.ɵfac, providedIn: 'root' });
|
|
638
|
-
(function () {
|
|
639
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ErrorInterceptor, [{
|
|
640
|
-
type: Injectable,
|
|
641
|
-
args: [{
|
|
642
|
-
providedIn: 'root'
|
|
643
|
-
}]
|
|
644
|
-
}], function () { return [{ type: i0.Injector }]; }, null);
|
|
584
|
+
class ErrorInterceptor {
|
|
585
|
+
constructor(injector) {
|
|
586
|
+
this.injector = injector;
|
|
587
|
+
}
|
|
588
|
+
intercept(originalReq, next) {
|
|
589
|
+
const interceptError = originalReq.headers.get('interceptError');
|
|
590
|
+
const req = originalReq.clone({
|
|
591
|
+
headers: originalReq.headers.delete('interceptError')
|
|
592
|
+
});
|
|
593
|
+
if (interceptError === 'false') {
|
|
594
|
+
return next.handle(req);
|
|
595
|
+
}
|
|
596
|
+
const errorContainer = { httpError: undefined };
|
|
597
|
+
return next.handle(req).pipe(catchError(error => this.handleError(error, errorContainer)), finalize(() => {
|
|
598
|
+
this.handleCaughtError(errorContainer);
|
|
599
|
+
this.handleUncaughtError(errorContainer);
|
|
600
|
+
}));
|
|
601
|
+
}
|
|
602
|
+
handleError(httpError, errorContainer) {
|
|
603
|
+
var _a;
|
|
604
|
+
if (httpError instanceof HttpErrorResponse) {
|
|
605
|
+
const errorObj = httpError.error === 'object' ? httpError.error : {};
|
|
606
|
+
errorObj.message = ((_a = httpError.error) === null || _a === void 0 ? void 0 : _a.message) || httpError.statusText;
|
|
607
|
+
errorObj.caught = false;
|
|
608
|
+
httpError = new HttpErrorResponse({
|
|
609
|
+
error: errorObj,
|
|
610
|
+
headers: httpError.headers,
|
|
611
|
+
status: httpError.status,
|
|
612
|
+
statusText: httpError.statusText,
|
|
613
|
+
url: httpError.url
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
errorContainer.httpError = httpError;
|
|
617
|
+
return throwError(httpError);
|
|
618
|
+
}
|
|
619
|
+
handleCaughtError(errorContainer) {
|
|
620
|
+
const httpError = errorContainer.httpError;
|
|
621
|
+
if (httpError && httpError.error.toDisplay) {
|
|
622
|
+
httpError.error.caught = true;
|
|
623
|
+
const messageService = this.injector.get(MessageService);
|
|
624
|
+
messageService.error(httpError.error.message, httpError.error.title);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
handleUncaughtError(errorContainer) {
|
|
628
|
+
const httpError = errorContainer.httpError;
|
|
629
|
+
if (httpError && !httpError.error.caught) {
|
|
630
|
+
const messageService = this.injector.get(MessageService);
|
|
631
|
+
httpError.error.caught = true;
|
|
632
|
+
messageService.error('igo.core.errors.uncaught.message', 'igo.core.errors.uncaught.title');
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
ErrorInterceptor.ɵfac = function ErrorInterceptor_Factory(t) { return new (t || ErrorInterceptor)(i0.ɵɵinject(i0.Injector)); };
|
|
637
|
+
ErrorInterceptor.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ErrorInterceptor, factory: ErrorInterceptor.ɵfac, providedIn: 'root' });
|
|
638
|
+
(function () {
|
|
639
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ErrorInterceptor, [{
|
|
640
|
+
type: Injectable,
|
|
641
|
+
args: [{
|
|
642
|
+
providedIn: 'root'
|
|
643
|
+
}]
|
|
644
|
+
}], function () { return [{ type: i0.Injector }]; }, null);
|
|
645
645
|
})();
|
|
646
646
|
|
|
647
|
-
class IgoErrorModule {
|
|
648
|
-
constructor(parentModule) {
|
|
649
|
-
if (parentModule) {
|
|
650
|
-
throw new Error('IgoErrorModule is already loaded. Import it in the AppModule only');
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
static forRoot() {
|
|
654
|
-
return {
|
|
655
|
-
ngModule: IgoErrorModule,
|
|
656
|
-
providers: [
|
|
657
|
-
{
|
|
658
|
-
provide: HTTP_INTERCEPTORS,
|
|
659
|
-
useClass: ErrorInterceptor,
|
|
660
|
-
multi: true
|
|
661
|
-
}
|
|
662
|
-
]
|
|
663
|
-
};
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
IgoErrorModule.ɵfac = function IgoErrorModule_Factory(t) { return new (t || IgoErrorModule)(i0.ɵɵinject(IgoErrorModule, 12)); };
|
|
667
|
-
IgoErrorModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoErrorModule });
|
|
668
|
-
IgoErrorModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
|
|
669
|
-
(function () {
|
|
670
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoErrorModule, [{
|
|
671
|
-
type: NgModule,
|
|
672
|
-
args: [{
|
|
673
|
-
imports: [],
|
|
674
|
-
declarations: [],
|
|
675
|
-
exports: []
|
|
676
|
-
}]
|
|
677
|
-
}], function () {
|
|
678
|
-
return [{ type: IgoErrorModule, decorators: [{
|
|
679
|
-
type: Optional
|
|
680
|
-
}, {
|
|
681
|
-
type: SkipSelf
|
|
682
|
-
}] }];
|
|
683
|
-
}, null);
|
|
647
|
+
class IgoErrorModule {
|
|
648
|
+
constructor(parentModule) {
|
|
649
|
+
if (parentModule) {
|
|
650
|
+
throw new Error('IgoErrorModule is already loaded. Import it in the AppModule only');
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
static forRoot() {
|
|
654
|
+
return {
|
|
655
|
+
ngModule: IgoErrorModule,
|
|
656
|
+
providers: [
|
|
657
|
+
{
|
|
658
|
+
provide: HTTP_INTERCEPTORS,
|
|
659
|
+
useClass: ErrorInterceptor,
|
|
660
|
+
multi: true
|
|
661
|
+
}
|
|
662
|
+
]
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
IgoErrorModule.ɵfac = function IgoErrorModule_Factory(t) { return new (t || IgoErrorModule)(i0.ɵɵinject(IgoErrorModule, 12)); };
|
|
667
|
+
IgoErrorModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoErrorModule });
|
|
668
|
+
IgoErrorModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
|
|
669
|
+
(function () {
|
|
670
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoErrorModule, [{
|
|
671
|
+
type: NgModule,
|
|
672
|
+
args: [{
|
|
673
|
+
imports: [],
|
|
674
|
+
declarations: [],
|
|
675
|
+
exports: []
|
|
676
|
+
}]
|
|
677
|
+
}], function () {
|
|
678
|
+
return [{ type: IgoErrorModule, decorators: [{
|
|
679
|
+
type: Optional
|
|
680
|
+
}, {
|
|
681
|
+
type: SkipSelf
|
|
682
|
+
}] }];
|
|
683
|
+
}, null);
|
|
684
684
|
})();
|
|
685
685
|
|
|
686
|
-
const dbConfig = {
|
|
687
|
-
name: 'igo2DB',
|
|
688
|
-
version: 2,
|
|
689
|
-
objectStoresMeta: [{
|
|
690
|
-
store: 'geoData',
|
|
691
|
-
storeConfig: { keyPath: 'url', autoIncrement: false },
|
|
692
|
-
storeSchema: [
|
|
693
|
-
{ name: 'regionID', keypath: 'regionID', options: { unique: false } }
|
|
694
|
-
]
|
|
695
|
-
},
|
|
696
|
-
{
|
|
697
|
-
store: 'layerData',
|
|
698
|
-
storeConfig: { keyPath: 'layerId', autoIncrement: false },
|
|
699
|
-
storeSchema: [
|
|
700
|
-
{ name: 'layerOptions', keypath: 'layerOptions', options: { unique: false } },
|
|
701
|
-
{ name: 'sourceOptions', keypath: 'sourceOptions', options: { unique: false } }
|
|
702
|
-
]
|
|
703
|
-
}]
|
|
704
|
-
};
|
|
705
|
-
class IgoCoreModule {
|
|
706
|
-
constructor(matIconRegistry, domSanitizer) {
|
|
707
|
-
matIconRegistry.addSvgIconSet(domSanitizer.bypassSecurityTrustResourceUrl('./assets/igo2/core/icons/mdi.svg'));
|
|
708
|
-
}
|
|
709
|
-
static forRoot() {
|
|
710
|
-
return {
|
|
711
|
-
ngModule: IgoCoreModule,
|
|
712
|
-
providers: []
|
|
713
|
-
};
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
IgoCoreModule.ɵfac = function IgoCoreModule_Factory(t) { return new (t || IgoCoreModule)(i0.ɵɵinject(i1$2.MatIconRegistry), i0.ɵɵinject(i2.DomSanitizer)); };
|
|
717
|
-
IgoCoreModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoCoreModule });
|
|
718
|
-
IgoCoreModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
|
|
719
|
-
HttpClientModule,
|
|
720
|
-
IgoActivityModule.forRoot(),
|
|
721
|
-
IgoConfigModule.forRoot(),
|
|
722
|
-
IgoErrorModule.forRoot(),
|
|
723
|
-
IgoLanguageModule.forRoot(),
|
|
724
|
-
IgoMessageModule.forRoot(),
|
|
725
|
-
NgxIndexedDBModule.forRoot(dbConfig), IgoActivityModule,
|
|
726
|
-
IgoConfigModule,
|
|
727
|
-
IgoErrorModule,
|
|
728
|
-
IgoLanguageModule,
|
|
729
|
-
IgoMessageModule] });
|
|
730
|
-
(function () {
|
|
731
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoCoreModule, [{
|
|
732
|
-
type: NgModule,
|
|
733
|
-
args: [{
|
|
734
|
-
imports: [
|
|
735
|
-
CommonModule,
|
|
736
|
-
HttpClientModule,
|
|
737
|
-
IgoActivityModule.forRoot(),
|
|
738
|
-
IgoConfigModule.forRoot(),
|
|
739
|
-
IgoErrorModule.forRoot(),
|
|
740
|
-
IgoLanguageModule.forRoot(),
|
|
741
|
-
IgoMessageModule.forRoot(),
|
|
742
|
-
NgxIndexedDBModule.forRoot(dbConfig)
|
|
743
|
-
],
|
|
744
|
-
declarations: [],
|
|
745
|
-
exports: [
|
|
746
|
-
IgoActivityModule,
|
|
747
|
-
IgoConfigModule,
|
|
748
|
-
IgoErrorModule,
|
|
749
|
-
IgoLanguageModule,
|
|
750
|
-
IgoMessageModule
|
|
751
|
-
]
|
|
752
|
-
}]
|
|
753
|
-
}], function () { return [{ type: i1$2.MatIconRegistry }, { type: i2.DomSanitizer }]; }, null);
|
|
754
|
-
})();
|
|
755
|
-
(function () {
|
|
756
|
-
(typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(IgoCoreModule, { imports: [CommonModule,
|
|
757
|
-
HttpClientModule, IgoActivityModule, IgoConfigModule, IgoErrorModule, IgoLanguageModule, IgoMessageModule, i8.NgxIndexedDBModule], exports: [IgoActivityModule,
|
|
758
|
-
IgoConfigModule,
|
|
759
|
-
IgoErrorModule,
|
|
760
|
-
IgoLanguageModule,
|
|
761
|
-
IgoMessageModule] });
|
|
686
|
+
const dbConfig = {
|
|
687
|
+
name: 'igo2DB',
|
|
688
|
+
version: 2,
|
|
689
|
+
objectStoresMeta: [{
|
|
690
|
+
store: 'geoData',
|
|
691
|
+
storeConfig: { keyPath: 'url', autoIncrement: false },
|
|
692
|
+
storeSchema: [
|
|
693
|
+
{ name: 'regionID', keypath: 'regionID', options: { unique: false } }
|
|
694
|
+
]
|
|
695
|
+
},
|
|
696
|
+
{
|
|
697
|
+
store: 'layerData',
|
|
698
|
+
storeConfig: { keyPath: 'layerId', autoIncrement: false },
|
|
699
|
+
storeSchema: [
|
|
700
|
+
{ name: 'layerOptions', keypath: 'layerOptions', options: { unique: false } },
|
|
701
|
+
{ name: 'sourceOptions', keypath: 'sourceOptions', options: { unique: false } }
|
|
702
|
+
]
|
|
703
|
+
}]
|
|
704
|
+
};
|
|
705
|
+
class IgoCoreModule {
|
|
706
|
+
constructor(matIconRegistry, domSanitizer) {
|
|
707
|
+
matIconRegistry.addSvgIconSet(domSanitizer.bypassSecurityTrustResourceUrl('./assets/igo2/core/icons/mdi.svg'));
|
|
708
|
+
}
|
|
709
|
+
static forRoot() {
|
|
710
|
+
return {
|
|
711
|
+
ngModule: IgoCoreModule,
|
|
712
|
+
providers: []
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
IgoCoreModule.ɵfac = function IgoCoreModule_Factory(t) { return new (t || IgoCoreModule)(i0.ɵɵinject(i1$2.MatIconRegistry), i0.ɵɵinject(i2.DomSanitizer)); };
|
|
717
|
+
IgoCoreModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoCoreModule });
|
|
718
|
+
IgoCoreModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
|
|
719
|
+
HttpClientModule,
|
|
720
|
+
IgoActivityModule.forRoot(),
|
|
721
|
+
IgoConfigModule.forRoot(),
|
|
722
|
+
IgoErrorModule.forRoot(),
|
|
723
|
+
IgoLanguageModule.forRoot(),
|
|
724
|
+
IgoMessageModule.forRoot(),
|
|
725
|
+
NgxIndexedDBModule.forRoot(dbConfig), IgoActivityModule,
|
|
726
|
+
IgoConfigModule,
|
|
727
|
+
IgoErrorModule,
|
|
728
|
+
IgoLanguageModule,
|
|
729
|
+
IgoMessageModule] });
|
|
730
|
+
(function () {
|
|
731
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoCoreModule, [{
|
|
732
|
+
type: NgModule,
|
|
733
|
+
args: [{
|
|
734
|
+
imports: [
|
|
735
|
+
CommonModule,
|
|
736
|
+
HttpClientModule,
|
|
737
|
+
IgoActivityModule.forRoot(),
|
|
738
|
+
IgoConfigModule.forRoot(),
|
|
739
|
+
IgoErrorModule.forRoot(),
|
|
740
|
+
IgoLanguageModule.forRoot(),
|
|
741
|
+
IgoMessageModule.forRoot(),
|
|
742
|
+
NgxIndexedDBModule.forRoot(dbConfig)
|
|
743
|
+
],
|
|
744
|
+
declarations: [],
|
|
745
|
+
exports: [
|
|
746
|
+
IgoActivityModule,
|
|
747
|
+
IgoConfigModule,
|
|
748
|
+
IgoErrorModule,
|
|
749
|
+
IgoLanguageModule,
|
|
750
|
+
IgoMessageModule
|
|
751
|
+
]
|
|
752
|
+
}]
|
|
753
|
+
}], function () { return [{ type: i1$2.MatIconRegistry }, { type: i2.DomSanitizer }]; }, null);
|
|
754
|
+
})();
|
|
755
|
+
(function () {
|
|
756
|
+
(typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(IgoCoreModule, { imports: [CommonModule,
|
|
757
|
+
HttpClientModule, IgoActivityModule, IgoConfigModule, IgoErrorModule, IgoLanguageModule, IgoMessageModule, i8.NgxIndexedDBModule], exports: [IgoActivityModule,
|
|
758
|
+
IgoConfigModule,
|
|
759
|
+
IgoErrorModule,
|
|
760
|
+
IgoLanguageModule,
|
|
761
|
+
IgoMessageModule] });
|
|
762
762
|
})();
|
|
763
763
|
|
|
764
|
-
class IgoGestureConfig extends HammerGestureConfig {
|
|
765
|
-
buildHammer(element) {
|
|
766
|
-
const mc = super.buildHammer(element);
|
|
767
|
-
mc.set({ touchAction: 'pan-y' });
|
|
768
|
-
return mc;
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
IgoGestureConfig.ɵfac = /*@__PURE__*/ function () { let ɵIgoGestureConfig_BaseFactory; return function IgoGestureConfig_Factory(t) { return (ɵIgoGestureConfig_BaseFactory || (ɵIgoGestureConfig_BaseFactory = i0.ɵɵgetInheritedFactory(IgoGestureConfig)))(t || IgoGestureConfig); }; }();
|
|
772
|
-
IgoGestureConfig.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: IgoGestureConfig, factory: IgoGestureConfig.ɵfac });
|
|
773
|
-
(function () {
|
|
774
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoGestureConfig, [{
|
|
775
|
-
type: Injectable
|
|
776
|
-
}], null, null);
|
|
764
|
+
class IgoGestureConfig extends HammerGestureConfig {
|
|
765
|
+
buildHammer(element) {
|
|
766
|
+
const mc = super.buildHammer(element);
|
|
767
|
+
mc.set({ touchAction: 'pan-y' });
|
|
768
|
+
return mc;
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
IgoGestureConfig.ɵfac = /*@__PURE__*/ function () { let ɵIgoGestureConfig_BaseFactory; return function IgoGestureConfig_Factory(t) { return (ɵIgoGestureConfig_BaseFactory || (ɵIgoGestureConfig_BaseFactory = i0.ɵɵgetInheritedFactory(IgoGestureConfig)))(t || IgoGestureConfig); }; }();
|
|
772
|
+
IgoGestureConfig.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: IgoGestureConfig, factory: IgoGestureConfig.ɵfac });
|
|
773
|
+
(function () {
|
|
774
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoGestureConfig, [{
|
|
775
|
+
type: Injectable
|
|
776
|
+
}], null, null);
|
|
777
777
|
})();
|
|
778
778
|
|
|
779
|
-
class IgoGestureModule {
|
|
780
|
-
static forRoot() {
|
|
781
|
-
return {
|
|
782
|
-
ngModule: IgoGestureModule,
|
|
783
|
-
providers: [
|
|
784
|
-
{
|
|
785
|
-
provide: HAMMER_GESTURE_CONFIG,
|
|
786
|
-
useClass: IgoGestureConfig
|
|
787
|
-
}
|
|
788
|
-
]
|
|
789
|
-
};
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
IgoGestureModule.ɵfac = function IgoGestureModule_Factory(t) { return new (t || IgoGestureModule)(); };
|
|
793
|
-
IgoGestureModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoGestureModule });
|
|
794
|
-
IgoGestureModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [HammerModule] });
|
|
795
|
-
(function () {
|
|
796
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoGestureModule, [{
|
|
797
|
-
type: NgModule,
|
|
798
|
-
args: [{
|
|
799
|
-
imports: [HammerModule],
|
|
800
|
-
declarations: [],
|
|
801
|
-
exports: []
|
|
802
|
-
}]
|
|
803
|
-
}], null, null);
|
|
804
|
-
})();
|
|
779
|
+
class IgoGestureModule {
|
|
780
|
+
static forRoot() {
|
|
781
|
+
return {
|
|
782
|
+
ngModule: IgoGestureModule,
|
|
783
|
+
providers: [
|
|
784
|
+
{
|
|
785
|
+
provide: HAMMER_GESTURE_CONFIG,
|
|
786
|
+
useClass: IgoGestureConfig
|
|
787
|
+
}
|
|
788
|
+
]
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
IgoGestureModule.ɵfac = function IgoGestureModule_Factory(t) { return new (t || IgoGestureModule)(); };
|
|
793
|
+
IgoGestureModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoGestureModule });
|
|
794
|
+
IgoGestureModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [HammerModule] });
|
|
795
|
+
(function () {
|
|
796
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoGestureModule, [{
|
|
797
|
+
type: NgModule,
|
|
798
|
+
args: [{
|
|
799
|
+
imports: [HammerModule],
|
|
800
|
+
declarations: [],
|
|
801
|
+
exports: []
|
|
802
|
+
}]
|
|
803
|
+
}], null, null);
|
|
804
|
+
})();
|
|
805
805
|
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(IgoGestureModule, { imports: [HammerModule] }); })();
|
|
806
806
|
|
|
807
|
-
class LoggingInterceptor {
|
|
808
|
-
intercept(req, next) {
|
|
809
|
-
const started = Date.now();
|
|
810
|
-
let ok;
|
|
811
|
-
// extend server response observable with logging
|
|
812
|
-
return next.handle(req).pipe(tap(
|
|
813
|
-
// Succeeds when there is a response; ignore other events
|
|
814
|
-
event => (ok = event instanceof HttpResponse ? 'succeeded' : ''),
|
|
815
|
-
// Operation failed; error is an HttpErrorResponse
|
|
816
|
-
error => (ok = 'failed')),
|
|
817
|
-
// Log when response observable either completes or errors
|
|
818
|
-
finalize(() => {
|
|
819
|
-
const elapsed = Date.now() - started;
|
|
807
|
+
class LoggingInterceptor {
|
|
808
|
+
intercept(req, next) {
|
|
809
|
+
const started = Date.now();
|
|
810
|
+
let ok;
|
|
811
|
+
// extend server response observable with logging
|
|
812
|
+
return next.handle(req).pipe(tap(
|
|
813
|
+
// Succeeds when there is a response; ignore other events
|
|
814
|
+
event => (ok = event instanceof HttpResponse ? 'succeeded' : ''),
|
|
815
|
+
// Operation failed; error is an HttpErrorResponse
|
|
816
|
+
error => (ok = 'failed')),
|
|
817
|
+
// Log when response observable either completes or errors
|
|
818
|
+
finalize(() => {
|
|
819
|
+
const elapsed = Date.now() - started;
|
|
820
820
|
const msg = `${req.method} "${req.urlWithParams}"
|
|
821
|
-
${ok} in ${elapsed} ms.`;
|
|
822
|
-
console.log(msg);
|
|
823
|
-
}));
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
LoggingInterceptor.ɵfac = function LoggingInterceptor_Factory(t) { return new (t || LoggingInterceptor)(); };
|
|
827
|
-
LoggingInterceptor.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: LoggingInterceptor, factory: LoggingInterceptor.ɵfac });
|
|
828
|
-
(function () {
|
|
829
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(LoggingInterceptor, [{
|
|
830
|
-
type: Injectable
|
|
831
|
-
}], null, null);
|
|
821
|
+
${ok} in ${elapsed} ms.`;
|
|
822
|
+
console.log(msg);
|
|
823
|
+
}));
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
LoggingInterceptor.ɵfac = function LoggingInterceptor_Factory(t) { return new (t || LoggingInterceptor)(); };
|
|
827
|
+
LoggingInterceptor.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: LoggingInterceptor, factory: LoggingInterceptor.ɵfac });
|
|
828
|
+
(function () {
|
|
829
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(LoggingInterceptor, [{
|
|
830
|
+
type: Injectable
|
|
831
|
+
}], null, null);
|
|
832
832
|
})();
|
|
833
833
|
|
|
834
|
-
class IgoLoggingModule {
|
|
835
|
-
static forRoot() {
|
|
836
|
-
return {
|
|
837
|
-
ngModule: IgoLoggingModule,
|
|
838
|
-
providers: [
|
|
839
|
-
{
|
|
840
|
-
provide: HTTP_INTERCEPTORS,
|
|
841
|
-
useClass: LoggingInterceptor,
|
|
842
|
-
multi: true
|
|
843
|
-
}
|
|
844
|
-
]
|
|
845
|
-
};
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
IgoLoggingModule.ɵfac = function IgoLoggingModule_Factory(t) { return new (t || IgoLoggingModule)(); };
|
|
849
|
-
IgoLoggingModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoLoggingModule });
|
|
850
|
-
IgoLoggingModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
|
|
851
|
-
(function () {
|
|
852
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoLoggingModule, [{
|
|
853
|
-
type: NgModule,
|
|
854
|
-
args: [{
|
|
855
|
-
imports: [],
|
|
856
|
-
declarations: [],
|
|
857
|
-
exports: []
|
|
858
|
-
}]
|
|
859
|
-
}], null, null);
|
|
834
|
+
class IgoLoggingModule {
|
|
835
|
+
static forRoot() {
|
|
836
|
+
return {
|
|
837
|
+
ngModule: IgoLoggingModule,
|
|
838
|
+
providers: [
|
|
839
|
+
{
|
|
840
|
+
provide: HTTP_INTERCEPTORS,
|
|
841
|
+
useClass: LoggingInterceptor,
|
|
842
|
+
multi: true
|
|
843
|
+
}
|
|
844
|
+
]
|
|
845
|
+
};
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
IgoLoggingModule.ɵfac = function IgoLoggingModule_Factory(t) { return new (t || IgoLoggingModule)(); };
|
|
849
|
+
IgoLoggingModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoLoggingModule });
|
|
850
|
+
IgoLoggingModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
|
|
851
|
+
(function () {
|
|
852
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoLoggingModule, [{
|
|
853
|
+
type: NgModule,
|
|
854
|
+
args: [{
|
|
855
|
+
imports: [],
|
|
856
|
+
declarations: [],
|
|
857
|
+
exports: []
|
|
858
|
+
}]
|
|
859
|
+
}], null, null);
|
|
860
860
|
})();
|
|
861
861
|
|
|
862
|
-
let ROUTE_SERVICE_OPTIONS = new InjectionToken('routeServiceOptions');
|
|
863
|
-
function provideRouteServiceOptions(options) {
|
|
864
|
-
return {
|
|
865
|
-
provide: ROUTE_SERVICE_OPTIONS,
|
|
866
|
-
useValue: options
|
|
867
|
-
};
|
|
868
|
-
}
|
|
869
|
-
class RouteService {
|
|
870
|
-
constructor(router, route, options) {
|
|
871
|
-
this.router = router;
|
|
872
|
-
this.route = route;
|
|
873
|
-
const defaultOptions = {
|
|
874
|
-
centerKey: 'center',
|
|
875
|
-
zoomKey: 'zoom',
|
|
876
|
-
projectionKey: 'projection',
|
|
877
|
-
contextKey: 'context',
|
|
878
|
-
searchKey: 'search',
|
|
879
|
-
visibleOnLayersKey: 'visiblelayers',
|
|
880
|
-
visibleOffLayersKey: 'invisiblelayers',
|
|
881
|
-
directionsCoordKey: 'routing',
|
|
882
|
-
directionsOptionsKey: 'routingOptions',
|
|
883
|
-
toolKey: 'tool',
|
|
884
|
-
wmsUrlKey: 'wmsUrl',
|
|
885
|
-
wmsLayersKey: 'wmsLayers',
|
|
886
|
-
wmtsUrlKey: 'wmtsUrl',
|
|
887
|
-
wmtsLayersKey: 'wmtsLayers',
|
|
888
|
-
arcgisUrlKey: 'arcgisUrl',
|
|
889
|
-
arcgisLayersKey: 'arcgisLayers',
|
|
890
|
-
iarcgisUrlKey: 'iarcgisUrl',
|
|
891
|
-
iarcgisLayersKey: 'iarcgisLayers',
|
|
892
|
-
tarcgisUrlKey: 'tarcgisUrl',
|
|
893
|
-
tarcgisLayersKey: 'tarcgisLayers',
|
|
894
|
-
vectorKey: 'vector'
|
|
895
|
-
};
|
|
896
|
-
this.options = Object.assign({}, defaultOptions, options);
|
|
897
|
-
}
|
|
898
|
-
get queryParams() {
|
|
899
|
-
let url = decodeURIComponent(location.search);
|
|
900
|
-
if (url.includes('¢er=')) {
|
|
901
|
-
url = url.replace('¢er', '¢er');
|
|
902
|
-
const queryParams = url
|
|
903
|
-
.slice(1)
|
|
904
|
-
.split('&')
|
|
905
|
-
.map(p => p.split('='))
|
|
906
|
-
.reduce((obj, pair) => {
|
|
907
|
-
const [key, value] = pair.map(decodeURIComponent);
|
|
908
|
-
obj[key] = value;
|
|
909
|
-
return obj;
|
|
910
|
-
}, {});
|
|
911
|
-
this.router.navigate([], { queryParams });
|
|
912
|
-
}
|
|
913
|
-
return this.route.queryParams;
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
RouteService.ɵfac = function RouteService_Factory(t) { return new (t || RouteService)(i0.ɵɵinject(i1$3.Router), i0.ɵɵinject(i1$3.ActivatedRoute), i0.ɵɵinject(ROUTE_SERVICE_OPTIONS, 8)); };
|
|
917
|
-
RouteService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: RouteService, factory: RouteService.ɵfac, providedIn: 'root' });
|
|
918
|
-
(function () {
|
|
919
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RouteService, [{
|
|
920
|
-
type: Injectable,
|
|
921
|
-
args: [{
|
|
922
|
-
providedIn: 'root'
|
|
923
|
-
}]
|
|
924
|
-
}], function () {
|
|
925
|
-
return [{ type: i1$3.Router }, { type: i1$3.ActivatedRoute }, { type: undefined, decorators: [{
|
|
926
|
-
type: Inject,
|
|
927
|
-
args: [ROUTE_SERVICE_OPTIONS]
|
|
928
|
-
}, {
|
|
929
|
-
type: Optional
|
|
930
|
-
}] }];
|
|
931
|
-
}, null);
|
|
862
|
+
let ROUTE_SERVICE_OPTIONS = new InjectionToken('routeServiceOptions');
|
|
863
|
+
function provideRouteServiceOptions(options) {
|
|
864
|
+
return {
|
|
865
|
+
provide: ROUTE_SERVICE_OPTIONS,
|
|
866
|
+
useValue: options
|
|
867
|
+
};
|
|
868
|
+
}
|
|
869
|
+
class RouteService {
|
|
870
|
+
constructor(router, route, options) {
|
|
871
|
+
this.router = router;
|
|
872
|
+
this.route = route;
|
|
873
|
+
const defaultOptions = {
|
|
874
|
+
centerKey: 'center',
|
|
875
|
+
zoomKey: 'zoom',
|
|
876
|
+
projectionKey: 'projection',
|
|
877
|
+
contextKey: 'context',
|
|
878
|
+
searchKey: 'search',
|
|
879
|
+
visibleOnLayersKey: 'visiblelayers',
|
|
880
|
+
visibleOffLayersKey: 'invisiblelayers',
|
|
881
|
+
directionsCoordKey: 'routing',
|
|
882
|
+
directionsOptionsKey: 'routingOptions',
|
|
883
|
+
toolKey: 'tool',
|
|
884
|
+
wmsUrlKey: 'wmsUrl',
|
|
885
|
+
wmsLayersKey: 'wmsLayers',
|
|
886
|
+
wmtsUrlKey: 'wmtsUrl',
|
|
887
|
+
wmtsLayersKey: 'wmtsLayers',
|
|
888
|
+
arcgisUrlKey: 'arcgisUrl',
|
|
889
|
+
arcgisLayersKey: 'arcgisLayers',
|
|
890
|
+
iarcgisUrlKey: 'iarcgisUrl',
|
|
891
|
+
iarcgisLayersKey: 'iarcgisLayers',
|
|
892
|
+
tarcgisUrlKey: 'tarcgisUrl',
|
|
893
|
+
tarcgisLayersKey: 'tarcgisLayers',
|
|
894
|
+
vectorKey: 'vector'
|
|
895
|
+
};
|
|
896
|
+
this.options = Object.assign({}, defaultOptions, options);
|
|
897
|
+
}
|
|
898
|
+
get queryParams() {
|
|
899
|
+
let url = decodeURIComponent(location.search);
|
|
900
|
+
if (url.includes('¢er=')) {
|
|
901
|
+
url = url.replace('¢er', '¢er');
|
|
902
|
+
const queryParams = url
|
|
903
|
+
.slice(1)
|
|
904
|
+
.split('&')
|
|
905
|
+
.map(p => p.split('='))
|
|
906
|
+
.reduce((obj, pair) => {
|
|
907
|
+
const [key, value] = pair.map(decodeURIComponent);
|
|
908
|
+
obj[key] = value;
|
|
909
|
+
return obj;
|
|
910
|
+
}, {});
|
|
911
|
+
this.router.navigate([], { queryParams });
|
|
912
|
+
}
|
|
913
|
+
return this.route.queryParams;
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
RouteService.ɵfac = function RouteService_Factory(t) { return new (t || RouteService)(i0.ɵɵinject(i1$3.Router), i0.ɵɵinject(i1$3.ActivatedRoute), i0.ɵɵinject(ROUTE_SERVICE_OPTIONS, 8)); };
|
|
917
|
+
RouteService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: RouteService, factory: RouteService.ɵfac, providedIn: 'root' });
|
|
918
|
+
(function () {
|
|
919
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RouteService, [{
|
|
920
|
+
type: Injectable,
|
|
921
|
+
args: [{
|
|
922
|
+
providedIn: 'root'
|
|
923
|
+
}]
|
|
924
|
+
}], function () {
|
|
925
|
+
return [{ type: i1$3.Router }, { type: i1$3.ActivatedRoute }, { type: undefined, decorators: [{
|
|
926
|
+
type: Inject,
|
|
927
|
+
args: [ROUTE_SERVICE_OPTIONS]
|
|
928
|
+
}, {
|
|
929
|
+
type: Optional
|
|
930
|
+
}] }];
|
|
931
|
+
}, null);
|
|
932
932
|
})();
|
|
933
933
|
|
|
934
|
-
class AnalyticsService {
|
|
935
|
-
constructor(config) {
|
|
936
|
-
this.config = config;
|
|
937
|
-
this.options = this.config.getConfig('analytics') || {};
|
|
938
|
-
if (this.options.provider === 'matomo') {
|
|
939
|
-
this.initMatomo();
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
get paq() {
|
|
943
|
-
return (window._paq = window._paq || []);
|
|
944
|
-
}
|
|
945
|
-
initMatomo() {
|
|
946
|
-
if (!this.options.url || !this.options.id) {
|
|
947
|
-
return;
|
|
948
|
-
}
|
|
949
|
-
const url = this.options.url.substr(-1) === '/'
|
|
950
|
-
? this.options.url + 'matomo'
|
|
951
|
-
: this.options.url;
|
|
952
|
-
// this.paq.push(['trackPageView']);
|
|
953
|
-
// this.paq.push(['enableLinkTracking']);
|
|
954
|
-
(() => {
|
|
955
|
-
this.paq.push(['setTrackerUrl', url + '.php']);
|
|
956
|
-
this.paq.push(['setSiteId', this.options.id]);
|
|
957
|
-
const g = document.createElement('script');
|
|
958
|
-
const s = document.getElementsByTagName('script')[0];
|
|
959
|
-
g.type = 'text/javascript';
|
|
960
|
-
g.async = true;
|
|
961
|
-
g.defer = true;
|
|
962
|
-
g.src = url + '.js';
|
|
963
|
-
s.parentNode.insertBefore(g, s);
|
|
964
|
-
})();
|
|
965
|
-
}
|
|
966
|
-
setUser(user, profils) {
|
|
967
|
-
if (this.options.provider === 'matomo') {
|
|
968
|
-
if (!user) {
|
|
969
|
-
this.paq.push(['resetUserId']);
|
|
970
|
-
this.paq.push(['deleteCustomVariable', 1, 'user']);
|
|
971
|
-
this.paq.push(['deleteCustomVariable', 2, 'name']);
|
|
972
|
-
this.paq.push(['deleteCustomVariable', 3, 'profils']);
|
|
973
|
-
}
|
|
974
|
-
else {
|
|
975
|
-
this.paq.push(['setUserId', user.id]);
|
|
976
|
-
const name = `${user.firstName} ${user.lastName}`;
|
|
977
|
-
this.paq.push(['setCustomVariable', 1, 'user', user.sourceId, 'visit']);
|
|
978
|
-
this.paq.push(['setCustomVariable', 2, 'name', name, 'visit']);
|
|
979
|
-
this.paq.push(['setCustomVariable', 3, 'profils', profils, 'visit']);
|
|
980
|
-
}
|
|
981
|
-
this.paq.push(['trackPageView']);
|
|
982
|
-
this.paq.push(['enableLinkTracking']);
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
trackSearch(term, nbResults) {
|
|
986
|
-
if (this.options.provider === 'matomo') {
|
|
987
|
-
this.paq.push(['trackSiteSearch', term, false, nbResults]);
|
|
988
|
-
}
|
|
989
|
-
}
|
|
990
|
-
trackEvent(category, action, name) {
|
|
991
|
-
if (this.options.provider === 'matomo') {
|
|
992
|
-
this.paq.push(['trackEvent', category, action, name]);
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
/**
|
|
996
|
-
* Function that tracks layers added to the map
|
|
997
|
-
*/
|
|
998
|
-
trackLayer(category, action, parameters) {
|
|
999
|
-
if (this.options.provider === 'matomo')
|
|
1000
|
-
this.paq.push(['trackEvent', category, action, parameters]);
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
AnalyticsService.ɵfac = function AnalyticsService_Factory(t) { return new (t || AnalyticsService)(i0.ɵɵinject(ConfigService)); };
|
|
1004
|
-
AnalyticsService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AnalyticsService, factory: AnalyticsService.ɵfac, providedIn: 'root' });
|
|
1005
|
-
(function () {
|
|
1006
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AnalyticsService, [{
|
|
1007
|
-
type: Injectable,
|
|
1008
|
-
args: [{
|
|
1009
|
-
providedIn: 'root'
|
|
1010
|
-
}]
|
|
1011
|
-
}], function () { return [{ type: ConfigService }]; }, null);
|
|
934
|
+
class AnalyticsService {
|
|
935
|
+
constructor(config) {
|
|
936
|
+
this.config = config;
|
|
937
|
+
this.options = this.config.getConfig('analytics') || {};
|
|
938
|
+
if (this.options.provider === 'matomo') {
|
|
939
|
+
this.initMatomo();
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
get paq() {
|
|
943
|
+
return (window._paq = window._paq || []);
|
|
944
|
+
}
|
|
945
|
+
initMatomo() {
|
|
946
|
+
if (!this.options.url || !this.options.id) {
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
949
|
+
const url = this.options.url.substr(-1) === '/'
|
|
950
|
+
? this.options.url + 'matomo'
|
|
951
|
+
: this.options.url;
|
|
952
|
+
// this.paq.push(['trackPageView']);
|
|
953
|
+
// this.paq.push(['enableLinkTracking']);
|
|
954
|
+
(() => {
|
|
955
|
+
this.paq.push(['setTrackerUrl', url + '.php']);
|
|
956
|
+
this.paq.push(['setSiteId', this.options.id]);
|
|
957
|
+
const g = document.createElement('script');
|
|
958
|
+
const s = document.getElementsByTagName('script')[0];
|
|
959
|
+
g.type = 'text/javascript';
|
|
960
|
+
g.async = true;
|
|
961
|
+
g.defer = true;
|
|
962
|
+
g.src = url + '.js';
|
|
963
|
+
s.parentNode.insertBefore(g, s);
|
|
964
|
+
})();
|
|
965
|
+
}
|
|
966
|
+
setUser(user, profils) {
|
|
967
|
+
if (this.options.provider === 'matomo') {
|
|
968
|
+
if (!user) {
|
|
969
|
+
this.paq.push(['resetUserId']);
|
|
970
|
+
this.paq.push(['deleteCustomVariable', 1, 'user']);
|
|
971
|
+
this.paq.push(['deleteCustomVariable', 2, 'name']);
|
|
972
|
+
this.paq.push(['deleteCustomVariable', 3, 'profils']);
|
|
973
|
+
}
|
|
974
|
+
else {
|
|
975
|
+
this.paq.push(['setUserId', user.id]);
|
|
976
|
+
const name = `${user.firstName} ${user.lastName}`;
|
|
977
|
+
this.paq.push(['setCustomVariable', 1, 'user', user.sourceId, 'visit']);
|
|
978
|
+
this.paq.push(['setCustomVariable', 2, 'name', name, 'visit']);
|
|
979
|
+
this.paq.push(['setCustomVariable', 3, 'profils', profils, 'visit']);
|
|
980
|
+
}
|
|
981
|
+
this.paq.push(['trackPageView']);
|
|
982
|
+
this.paq.push(['enableLinkTracking']);
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
trackSearch(term, nbResults) {
|
|
986
|
+
if (this.options.provider === 'matomo') {
|
|
987
|
+
this.paq.push(['trackSiteSearch', term, false, nbResults]);
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
trackEvent(category, action, name) {
|
|
991
|
+
if (this.options.provider === 'matomo') {
|
|
992
|
+
this.paq.push(['trackEvent', category, action, name]);
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* Function that tracks layers added to the map
|
|
997
|
+
*/
|
|
998
|
+
trackLayer(category, action, parameters) {
|
|
999
|
+
if (this.options.provider === 'matomo')
|
|
1000
|
+
this.paq.push(['trackEvent', category, action, parameters]);
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
AnalyticsService.ɵfac = function AnalyticsService_Factory(t) { return new (t || AnalyticsService)(i0.ɵɵinject(ConfigService)); };
|
|
1004
|
+
AnalyticsService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AnalyticsService, factory: AnalyticsService.ɵfac, providedIn: 'root' });
|
|
1005
|
+
(function () {
|
|
1006
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AnalyticsService, [{
|
|
1007
|
+
type: Injectable,
|
|
1008
|
+
args: [{
|
|
1009
|
+
providedIn: 'root'
|
|
1010
|
+
}]
|
|
1011
|
+
}], function () { return [{ type: ConfigService }]; }, null);
|
|
1012
1012
|
})();
|
|
1013
1013
|
|
|
1014
|
-
var Media;
|
|
1015
|
-
(function (Media) {
|
|
1016
|
-
Media["Mobile"] = "mobile";
|
|
1017
|
-
Media["Tablet"] = "tablet";
|
|
1018
|
-
Media["Desktop"] = "desktop";
|
|
1019
|
-
})(Media || (Media = {}));
|
|
1020
|
-
var MediaOrientation;
|
|
1021
|
-
(function (MediaOrientation) {
|
|
1022
|
-
MediaOrientation["Portrait"] = "portrait";
|
|
1023
|
-
MediaOrientation["Landscape"] = "landscape";
|
|
1014
|
+
var Media;
|
|
1015
|
+
(function (Media) {
|
|
1016
|
+
Media["Mobile"] = "mobile";
|
|
1017
|
+
Media["Tablet"] = "tablet";
|
|
1018
|
+
Media["Desktop"] = "desktop";
|
|
1019
|
+
})(Media || (Media = {}));
|
|
1020
|
+
var MediaOrientation;
|
|
1021
|
+
(function (MediaOrientation) {
|
|
1022
|
+
MediaOrientation["Portrait"] = "portrait";
|
|
1023
|
+
MediaOrientation["Landscape"] = "landscape";
|
|
1024
1024
|
})(MediaOrientation || (MediaOrientation = {}));
|
|
1025
1025
|
|
|
1026
|
-
class MediaService {
|
|
1027
|
-
constructor(breakpointObserver) {
|
|
1028
|
-
this.media$ = new BehaviorSubject(undefined);
|
|
1029
|
-
this.orientation$ = new BehaviorSubject(undefined);
|
|
1030
|
-
breakpointObserver
|
|
1031
|
-
.observe([Breakpoints.HandsetLandscape])
|
|
1032
|
-
.subscribe(res => {
|
|
1033
|
-
if (res.matches) {
|
|
1034
|
-
this.media$.next(Media.Mobile);
|
|
1035
|
-
this.orientation$.next(MediaOrientation.Landscape);
|
|
1036
|
-
}
|
|
1037
|
-
});
|
|
1038
|
-
breakpointObserver.observe([Breakpoints.HandsetPortrait]).subscribe(res => {
|
|
1039
|
-
if (res.matches) {
|
|
1040
|
-
this.media$.next(Media.Mobile);
|
|
1041
|
-
this.orientation$.next(MediaOrientation.Portrait);
|
|
1042
|
-
}
|
|
1043
|
-
});
|
|
1044
|
-
breakpointObserver.observe([Breakpoints.TabletLandscape]).subscribe(res => {
|
|
1045
|
-
if (res.matches) {
|
|
1046
|
-
this.media$.next(Media.Tablet);
|
|
1047
|
-
this.orientation$.next(MediaOrientation.Landscape);
|
|
1048
|
-
}
|
|
1049
|
-
});
|
|
1050
|
-
breakpointObserver.observe([Breakpoints.TabletPortrait]).subscribe(res => {
|
|
1051
|
-
if (res.matches) {
|
|
1052
|
-
this.media$.next(Media.Tablet);
|
|
1053
|
-
this.orientation$.next(MediaOrientation.Portrait);
|
|
1054
|
-
}
|
|
1055
|
-
});
|
|
1056
|
-
breakpointObserver.observe([Breakpoints.WebLandscape]).subscribe(res => {
|
|
1057
|
-
if (res.matches) {
|
|
1058
|
-
this.media$.next(Media.Desktop);
|
|
1059
|
-
this.orientation$.next(MediaOrientation.Landscape);
|
|
1060
|
-
}
|
|
1061
|
-
});
|
|
1062
|
-
breakpointObserver.observe([Breakpoints.WebPortrait]).subscribe(res => {
|
|
1063
|
-
if (res.matches) {
|
|
1064
|
-
this.media$.next(Media.Desktop);
|
|
1065
|
-
this.orientation$.next(MediaOrientation.Portrait);
|
|
1066
|
-
}
|
|
1067
|
-
});
|
|
1068
|
-
}
|
|
1069
|
-
getMedia() {
|
|
1070
|
-
return this.media$.value;
|
|
1071
|
-
}
|
|
1072
|
-
getOrientation() {
|
|
1073
|
-
return this.orientation$.value;
|
|
1074
|
-
}
|
|
1075
|
-
isTouchScreen() {
|
|
1076
|
-
return 'ontouchstart' in document.documentElement ? true : false;
|
|
1077
|
-
}
|
|
1078
|
-
isMobile() {
|
|
1079
|
-
const media = this.getMedia();
|
|
1080
|
-
return media === 'mobile';
|
|
1081
|
-
}
|
|
1082
|
-
isDesktop() {
|
|
1083
|
-
const media = this.getMedia();
|
|
1084
|
-
return media === 'desktop';
|
|
1085
|
-
}
|
|
1086
|
-
}
|
|
1087
|
-
MediaService.ɵfac = function MediaService_Factory(t) { return new (t || MediaService)(i0.ɵɵinject(i1$4.BreakpointObserver)); };
|
|
1088
|
-
MediaService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: MediaService, factory: MediaService.ɵfac, providedIn: 'root' });
|
|
1089
|
-
(function () {
|
|
1090
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MediaService, [{
|
|
1091
|
-
type: Injectable,
|
|
1092
|
-
args: [{
|
|
1093
|
-
providedIn: 'root'
|
|
1094
|
-
}]
|
|
1095
|
-
}], function () { return [{ type: i1$4.BreakpointObserver }]; }, null);
|
|
1026
|
+
class MediaService {
|
|
1027
|
+
constructor(breakpointObserver) {
|
|
1028
|
+
this.media$ = new BehaviorSubject(undefined);
|
|
1029
|
+
this.orientation$ = new BehaviorSubject(undefined);
|
|
1030
|
+
breakpointObserver
|
|
1031
|
+
.observe([Breakpoints.HandsetLandscape])
|
|
1032
|
+
.subscribe(res => {
|
|
1033
|
+
if (res.matches) {
|
|
1034
|
+
this.media$.next(Media.Mobile);
|
|
1035
|
+
this.orientation$.next(MediaOrientation.Landscape);
|
|
1036
|
+
}
|
|
1037
|
+
});
|
|
1038
|
+
breakpointObserver.observe([Breakpoints.HandsetPortrait]).subscribe(res => {
|
|
1039
|
+
if (res.matches) {
|
|
1040
|
+
this.media$.next(Media.Mobile);
|
|
1041
|
+
this.orientation$.next(MediaOrientation.Portrait);
|
|
1042
|
+
}
|
|
1043
|
+
});
|
|
1044
|
+
breakpointObserver.observe([Breakpoints.TabletLandscape]).subscribe(res => {
|
|
1045
|
+
if (res.matches) {
|
|
1046
|
+
this.media$.next(Media.Tablet);
|
|
1047
|
+
this.orientation$.next(MediaOrientation.Landscape);
|
|
1048
|
+
}
|
|
1049
|
+
});
|
|
1050
|
+
breakpointObserver.observe([Breakpoints.TabletPortrait]).subscribe(res => {
|
|
1051
|
+
if (res.matches) {
|
|
1052
|
+
this.media$.next(Media.Tablet);
|
|
1053
|
+
this.orientation$.next(MediaOrientation.Portrait);
|
|
1054
|
+
}
|
|
1055
|
+
});
|
|
1056
|
+
breakpointObserver.observe([Breakpoints.WebLandscape]).subscribe(res => {
|
|
1057
|
+
if (res.matches) {
|
|
1058
|
+
this.media$.next(Media.Desktop);
|
|
1059
|
+
this.orientation$.next(MediaOrientation.Landscape);
|
|
1060
|
+
}
|
|
1061
|
+
});
|
|
1062
|
+
breakpointObserver.observe([Breakpoints.WebPortrait]).subscribe(res => {
|
|
1063
|
+
if (res.matches) {
|
|
1064
|
+
this.media$.next(Media.Desktop);
|
|
1065
|
+
this.orientation$.next(MediaOrientation.Portrait);
|
|
1066
|
+
}
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
getMedia() {
|
|
1070
|
+
return this.media$.value;
|
|
1071
|
+
}
|
|
1072
|
+
getOrientation() {
|
|
1073
|
+
return this.orientation$.value;
|
|
1074
|
+
}
|
|
1075
|
+
isTouchScreen() {
|
|
1076
|
+
return 'ontouchstart' in document.documentElement ? true : false;
|
|
1077
|
+
}
|
|
1078
|
+
isMobile() {
|
|
1079
|
+
const media = this.getMedia();
|
|
1080
|
+
return media === 'mobile';
|
|
1081
|
+
}
|
|
1082
|
+
isDesktop() {
|
|
1083
|
+
const media = this.getMedia();
|
|
1084
|
+
return media === 'desktop';
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
MediaService.ɵfac = function MediaService_Factory(t) { return new (t || MediaService)(i0.ɵɵinject(i1$4.BreakpointObserver)); };
|
|
1088
|
+
MediaService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: MediaService, factory: MediaService.ɵfac, providedIn: 'root' });
|
|
1089
|
+
(function () {
|
|
1090
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MediaService, [{
|
|
1091
|
+
type: Injectable,
|
|
1092
|
+
args: [{
|
|
1093
|
+
providedIn: 'root'
|
|
1094
|
+
}]
|
|
1095
|
+
}], function () { return [{ type: i1$4.BreakpointObserver }]; }, null);
|
|
1096
1096
|
})();
|
|
1097
1097
|
|
|
1098
|
-
var StorageScope;
|
|
1099
|
-
(function (StorageScope) {
|
|
1100
|
-
StorageScope["SESSION"] = "Session";
|
|
1101
|
-
StorageScope["LOCAL"] = "Local";
|
|
1102
|
-
})(StorageScope || (StorageScope = {}));
|
|
1103
|
-
var StorageServiceEventEnum;
|
|
1104
|
-
(function (StorageServiceEventEnum) {
|
|
1105
|
-
StorageServiceEventEnum["ADDED"] = "Added";
|
|
1106
|
-
StorageServiceEventEnum["MODIFIED"] = "Modified";
|
|
1107
|
-
StorageServiceEventEnum["REMOVED"] = "Removed";
|
|
1108
|
-
StorageServiceEventEnum["CLEARED"] = "Cleared";
|
|
1098
|
+
var StorageScope;
|
|
1099
|
+
(function (StorageScope) {
|
|
1100
|
+
StorageScope["SESSION"] = "Session";
|
|
1101
|
+
StorageScope["LOCAL"] = "Local";
|
|
1102
|
+
})(StorageScope || (StorageScope = {}));
|
|
1103
|
+
var StorageServiceEventEnum;
|
|
1104
|
+
(function (StorageServiceEventEnum) {
|
|
1105
|
+
StorageServiceEventEnum["ADDED"] = "Added";
|
|
1106
|
+
StorageServiceEventEnum["MODIFIED"] = "Modified";
|
|
1107
|
+
StorageServiceEventEnum["REMOVED"] = "Removed";
|
|
1108
|
+
StorageServiceEventEnum["CLEARED"] = "Cleared";
|
|
1109
1109
|
})(StorageServiceEventEnum || (StorageServiceEventEnum = {}));
|
|
1110
1110
|
|
|
1111
|
-
class StorageService {
|
|
1112
|
-
constructor(config) {
|
|
1113
|
-
this.config = config;
|
|
1114
|
-
this.storageChange$ = new BehaviorSubject(undefined);
|
|
1115
|
-
this.options = this.config.getConfig('storage') || { key: 'igo' };
|
|
1116
|
-
}
|
|
1117
|
-
/**
|
|
1118
|
-
* Use to get the data found in storage file
|
|
1119
|
-
*/
|
|
1120
|
-
get(key, scope) {
|
|
1121
|
-
let value;
|
|
1122
|
-
if (!scope || scope === StorageScope.SESSION) {
|
|
1123
|
-
value = sessionStorage.getItem(`${this.options.key}.${key}`);
|
|
1124
|
-
}
|
|
1125
|
-
if (scope === StorageScope.LOCAL || (!value && !scope)) {
|
|
1126
|
-
value = localStorage.getItem(`${this.options.key}.${key}`);
|
|
1127
|
-
}
|
|
1128
|
-
if (value) {
|
|
1129
|
-
try {
|
|
1130
|
-
value = JSON.parse(value);
|
|
1131
|
-
}
|
|
1132
|
-
catch (_a) {
|
|
1133
|
-
value = value;
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
return value;
|
|
1137
|
-
}
|
|
1138
|
-
set(key, value, scope = StorageScope.LOCAL) {
|
|
1139
|
-
const previousValue = this.get(key, scope);
|
|
1140
|
-
if (scope === StorageScope.SESSION) {
|
|
1141
|
-
sessionStorage.setItem(`${this.options.key}.${key}`, JSON.stringify(value));
|
|
1142
|
-
}
|
|
1143
|
-
else {
|
|
1144
|
-
localStorage.setItem(`${this.options.key}.${key}`, JSON.stringify(value));
|
|
1145
|
-
}
|
|
1146
|
-
const currentValue = this.get(key, scope);
|
|
1147
|
-
if (currentValue !== previousValue) {
|
|
1148
|
-
this.storageChange$.next({
|
|
1149
|
-
key, scope,
|
|
1150
|
-
event: previousValue !== undefined ? StorageServiceEventEnum.MODIFIED : StorageServiceEventEnum.ADDED,
|
|
1151
|
-
previousValue,
|
|
1152
|
-
currentValue
|
|
1153
|
-
});
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
remove(key, scope = StorageScope.LOCAL) {
|
|
1157
|
-
const previousValue = this.get(key, scope);
|
|
1158
|
-
if (scope === StorageScope.SESSION) {
|
|
1159
|
-
sessionStorage.removeItem(`${this.options.key}.${key}`);
|
|
1160
|
-
}
|
|
1161
|
-
else {
|
|
1162
|
-
localStorage.removeItem(`${this.options.key}.${key}`);
|
|
1163
|
-
}
|
|
1164
|
-
this.storageChange$.next({ key, scope, event: StorageServiceEventEnum.REMOVED, previousValue });
|
|
1165
|
-
}
|
|
1166
|
-
clear(scope = StorageScope.LOCAL) {
|
|
1167
|
-
if (scope === StorageScope.SESSION) {
|
|
1168
|
-
sessionStorage.clear();
|
|
1169
|
-
}
|
|
1170
|
-
else {
|
|
1171
|
-
localStorage.clear();
|
|
1172
|
-
}
|
|
1173
|
-
this.storageChange$.next({ scope, event: StorageServiceEventEnum.CLEARED });
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
StorageService.ɵfac = function StorageService_Factory(t) { return new (t || StorageService)(i0.ɵɵinject(ConfigService)); };
|
|
1177
|
-
StorageService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: StorageService, factory: StorageService.ɵfac, providedIn: 'root' });
|
|
1178
|
-
(function () {
|
|
1179
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(StorageService, [{
|
|
1180
|
-
type: Injectable,
|
|
1181
|
-
args: [{
|
|
1182
|
-
providedIn: 'root'
|
|
1183
|
-
}]
|
|
1184
|
-
}], function () { return [{ type: ConfigService }]; }, null);
|
|
1111
|
+
class StorageService {
|
|
1112
|
+
constructor(config) {
|
|
1113
|
+
this.config = config;
|
|
1114
|
+
this.storageChange$ = new BehaviorSubject(undefined);
|
|
1115
|
+
this.options = this.config.getConfig('storage') || { key: 'igo' };
|
|
1116
|
+
}
|
|
1117
|
+
/**
|
|
1118
|
+
* Use to get the data found in storage file
|
|
1119
|
+
*/
|
|
1120
|
+
get(key, scope) {
|
|
1121
|
+
let value;
|
|
1122
|
+
if (!scope || scope === StorageScope.SESSION) {
|
|
1123
|
+
value = sessionStorage.getItem(`${this.options.key}.${key}`);
|
|
1124
|
+
}
|
|
1125
|
+
if (scope === StorageScope.LOCAL || (!value && !scope)) {
|
|
1126
|
+
value = localStorage.getItem(`${this.options.key}.${key}`);
|
|
1127
|
+
}
|
|
1128
|
+
if (value) {
|
|
1129
|
+
try {
|
|
1130
|
+
value = JSON.parse(value);
|
|
1131
|
+
}
|
|
1132
|
+
catch (_a) {
|
|
1133
|
+
value = value;
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
return value;
|
|
1137
|
+
}
|
|
1138
|
+
set(key, value, scope = StorageScope.LOCAL) {
|
|
1139
|
+
const previousValue = this.get(key, scope);
|
|
1140
|
+
if (scope === StorageScope.SESSION) {
|
|
1141
|
+
sessionStorage.setItem(`${this.options.key}.${key}`, JSON.stringify(value));
|
|
1142
|
+
}
|
|
1143
|
+
else {
|
|
1144
|
+
localStorage.setItem(`${this.options.key}.${key}`, JSON.stringify(value));
|
|
1145
|
+
}
|
|
1146
|
+
const currentValue = this.get(key, scope);
|
|
1147
|
+
if (currentValue !== previousValue) {
|
|
1148
|
+
this.storageChange$.next({
|
|
1149
|
+
key, scope,
|
|
1150
|
+
event: previousValue !== undefined ? StorageServiceEventEnum.MODIFIED : StorageServiceEventEnum.ADDED,
|
|
1151
|
+
previousValue,
|
|
1152
|
+
currentValue
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
remove(key, scope = StorageScope.LOCAL) {
|
|
1157
|
+
const previousValue = this.get(key, scope);
|
|
1158
|
+
if (scope === StorageScope.SESSION) {
|
|
1159
|
+
sessionStorage.removeItem(`${this.options.key}.${key}`);
|
|
1160
|
+
}
|
|
1161
|
+
else {
|
|
1162
|
+
localStorage.removeItem(`${this.options.key}.${key}`);
|
|
1163
|
+
}
|
|
1164
|
+
this.storageChange$.next({ key, scope, event: StorageServiceEventEnum.REMOVED, previousValue });
|
|
1165
|
+
}
|
|
1166
|
+
clear(scope = StorageScope.LOCAL) {
|
|
1167
|
+
if (scope === StorageScope.SESSION) {
|
|
1168
|
+
sessionStorage.clear();
|
|
1169
|
+
}
|
|
1170
|
+
else {
|
|
1171
|
+
localStorage.clear();
|
|
1172
|
+
}
|
|
1173
|
+
this.storageChange$.next({ scope, event: StorageServiceEventEnum.CLEARED });
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
StorageService.ɵfac = function StorageService_Factory(t) { return new (t || StorageService)(i0.ɵɵinject(ConfigService)); };
|
|
1177
|
+
StorageService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: StorageService, factory: StorageService.ɵfac, providedIn: 'root' });
|
|
1178
|
+
(function () {
|
|
1179
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(StorageService, [{
|
|
1180
|
+
type: Injectable,
|
|
1181
|
+
args: [{
|
|
1182
|
+
providedIn: 'root'
|
|
1183
|
+
}]
|
|
1184
|
+
}], function () { return [{ type: ConfigService }]; }, null);
|
|
1185
1185
|
})();
|
|
1186
1186
|
|
|
1187
|
-
function getNumber(v, endposition, length) {
|
|
1188
|
-
/* tslint:disable:no-bitwise*/
|
|
1189
|
-
const mask = ((1 << length) - 1);
|
|
1190
|
-
return (v >> endposition) & mask;
|
|
1191
|
-
/* tslint:enable:no-bitwise*/
|
|
1192
|
-
}
|
|
1193
|
-
class CompressionService {
|
|
1194
|
-
constructor() {
|
|
1195
|
-
this.base64Index = new Map();
|
|
1196
|
-
this.indexBase64 = new Map();
|
|
1197
|
-
this.generateBase64Index();
|
|
1198
|
-
}
|
|
1199
|
-
generateBase64Index() {
|
|
1200
|
-
// https://fr.wikipedia.org/wiki/Base64
|
|
1201
|
-
// A-Z => [0, 25]
|
|
1202
|
-
for (let i = 0; i < 26; i++) {
|
|
1203
|
-
this.base64Index.set(String.fromCharCode('A'.charCodeAt(0) + i), i);
|
|
1204
|
-
this.indexBase64.set(i, String.fromCharCode('A'.charCodeAt(0) + i));
|
|
1205
|
-
}
|
|
1206
|
-
// a-z => [26, 51]
|
|
1207
|
-
for (let i = 0; i < 26; i++) {
|
|
1208
|
-
this.base64Index.set(String.fromCharCode('a'.charCodeAt(0) + i), i + 26);
|
|
1209
|
-
this.indexBase64.set(i + 26, String.fromCharCode('a'.charCodeAt(0) + i));
|
|
1210
|
-
}
|
|
1211
|
-
// 0-9 => [52, 61]
|
|
1212
|
-
for (let i = 0; i < 10; i++) {
|
|
1213
|
-
this.base64Index.set(String.fromCharCode('0'.charCodeAt(0) + i), i + 52);
|
|
1214
|
-
this.indexBase64.set(i + 52, String.fromCharCode('0'.charCodeAt(0) + i));
|
|
1215
|
-
}
|
|
1216
|
-
// + / => [62, 63]
|
|
1217
|
-
this.base64Index.set('+', 62);
|
|
1218
|
-
this.base64Index.set('/', 63);
|
|
1219
|
-
this.indexBase64.set(62, '+');
|
|
1220
|
-
this.indexBase64.set(63, '/');
|
|
1221
|
-
}
|
|
1222
|
-
compressBlob(blob) {
|
|
1223
|
-
if (!blob) {
|
|
1224
|
-
return;
|
|
1225
|
-
}
|
|
1226
|
-
const observable = new Observable((observer) => {
|
|
1227
|
-
const reader = new FileReader();
|
|
1228
|
-
reader.readAsDataURL(blob);
|
|
1229
|
-
reader.onload = () => {
|
|
1230
|
-
const base64 = reader.result.valueOf();
|
|
1231
|
-
const text64 = base64.substr(base64.indexOf(',') + 1);
|
|
1232
|
-
const compressed = this.compressStringBase64(text64);
|
|
1233
|
-
const compressedData = { length: text64.length,
|
|
1234
|
-
type: blob.type,
|
|
1235
|
-
object: compressed };
|
|
1236
|
-
observer.next(compressedData);
|
|
1237
|
-
};
|
|
1238
|
-
});
|
|
1239
|
-
return observable;
|
|
1240
|
-
}
|
|
1241
|
-
decompressBlob(compressedData) {
|
|
1242
|
-
/* tslint:disable:no-bitwise*/
|
|
1243
|
-
const object = compressedData.object;
|
|
1244
|
-
const length = compressedData.length;
|
|
1245
|
-
const decompressed = this.decompressStringBase64(object, length);
|
|
1246
|
-
const byteCharacters = atob(decompressed);
|
|
1247
|
-
const byteNumbers = new Array(byteCharacters.length);
|
|
1248
|
-
for (let i = 0; i < byteCharacters.length; i++) {
|
|
1249
|
-
byteNumbers[i] = byteCharacters.charCodeAt(i);
|
|
1250
|
-
}
|
|
1251
|
-
const byteArray = new Uint8Array(byteNumbers);
|
|
1252
|
-
const blob = new Blob([byteArray], { type: compressedData.type });
|
|
1253
|
-
/* tslint:enable:no-bitwise*/
|
|
1254
|
-
return blob;
|
|
1255
|
-
}
|
|
1256
|
-
compressStringBase64(s) {
|
|
1257
|
-
/* tslint:disable:no-bitwise*/
|
|
1258
|
-
let out = '';
|
|
1259
|
-
let bits = 16;
|
|
1260
|
-
let chr = 0;
|
|
1261
|
-
let rem = 0;
|
|
1262
|
-
for (const c of s) {
|
|
1263
|
-
const value = this.base64Index.get(c);
|
|
1264
|
-
if (bits > 6) {
|
|
1265
|
-
bits -= 6;
|
|
1266
|
-
chr += value << bits;
|
|
1267
|
-
}
|
|
1268
|
-
else {
|
|
1269
|
-
rem = 6 - bits;
|
|
1270
|
-
chr += value >> rem;
|
|
1271
|
-
out += String.fromCharCode(chr);
|
|
1272
|
-
chr = (value) << (16 - rem);
|
|
1273
|
-
bits = 16 - rem;
|
|
1274
|
-
}
|
|
1275
|
-
}
|
|
1276
|
-
if (s.length % 8 !== 0) {
|
|
1277
|
-
out += String.fromCharCode(chr);
|
|
1278
|
-
}
|
|
1279
|
-
/* tslint:enable:no-bitwise*/
|
|
1280
|
-
return String.fromCharCode(9731) + out;
|
|
1281
|
-
}
|
|
1282
|
-
decompressStringBase64(c, length) {
|
|
1283
|
-
/* tslint:disable:no-bitwise*/
|
|
1284
|
-
if (!c) {
|
|
1285
|
-
return;
|
|
1286
|
-
}
|
|
1287
|
-
if (c.charCodeAt(0) !== 9731) {
|
|
1288
|
-
return c;
|
|
1289
|
-
}
|
|
1290
|
-
let chr = 0;
|
|
1291
|
-
let rem = 0;
|
|
1292
|
-
let bits = 16;
|
|
1293
|
-
let out = '';
|
|
1294
|
-
let j = 1;
|
|
1295
|
-
let value = c.charCodeAt(j);
|
|
1296
|
-
for (let i = 0; i < length; i++) {
|
|
1297
|
-
if (bits > 6) {
|
|
1298
|
-
bits -= 6;
|
|
1299
|
-
chr = getNumber(value, bits, 6);
|
|
1300
|
-
out += this.indexBase64.get(chr);
|
|
1301
|
-
}
|
|
1302
|
-
else {
|
|
1303
|
-
rem = 6 - bits;
|
|
1304
|
-
chr = getNumber(value, 0, bits) << rem;
|
|
1305
|
-
value = c.charCodeAt(++j);
|
|
1306
|
-
chr += getNumber(value, 16 - rem, rem);
|
|
1307
|
-
out += this.indexBase64.get(chr);
|
|
1308
|
-
bits = 16 - rem;
|
|
1309
|
-
}
|
|
1310
|
-
}
|
|
1311
|
-
return out;
|
|
1312
|
-
/* tslint:enable:no-bitwise*/
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
CompressionService.ɵfac = function CompressionService_Factory(t) { return new (t || CompressionService)(); };
|
|
1316
|
-
CompressionService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: CompressionService, factory: CompressionService.ɵfac, providedIn: 'root' });
|
|
1317
|
-
(function () {
|
|
1318
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CompressionService, [{
|
|
1319
|
-
type: Injectable,
|
|
1320
|
-
args: [{
|
|
1321
|
-
providedIn: 'root'
|
|
1322
|
-
}]
|
|
1323
|
-
}], function () { return []; }, null);
|
|
1187
|
+
function getNumber(v, endposition, length) {
|
|
1188
|
+
/* tslint:disable:no-bitwise*/
|
|
1189
|
+
const mask = ((1 << length) - 1);
|
|
1190
|
+
return (v >> endposition) & mask;
|
|
1191
|
+
/* tslint:enable:no-bitwise*/
|
|
1192
|
+
}
|
|
1193
|
+
class CompressionService {
|
|
1194
|
+
constructor() {
|
|
1195
|
+
this.base64Index = new Map();
|
|
1196
|
+
this.indexBase64 = new Map();
|
|
1197
|
+
this.generateBase64Index();
|
|
1198
|
+
}
|
|
1199
|
+
generateBase64Index() {
|
|
1200
|
+
// https://fr.wikipedia.org/wiki/Base64
|
|
1201
|
+
// A-Z => [0, 25]
|
|
1202
|
+
for (let i = 0; i < 26; i++) {
|
|
1203
|
+
this.base64Index.set(String.fromCharCode('A'.charCodeAt(0) + i), i);
|
|
1204
|
+
this.indexBase64.set(i, String.fromCharCode('A'.charCodeAt(0) + i));
|
|
1205
|
+
}
|
|
1206
|
+
// a-z => [26, 51]
|
|
1207
|
+
for (let i = 0; i < 26; i++) {
|
|
1208
|
+
this.base64Index.set(String.fromCharCode('a'.charCodeAt(0) + i), i + 26);
|
|
1209
|
+
this.indexBase64.set(i + 26, String.fromCharCode('a'.charCodeAt(0) + i));
|
|
1210
|
+
}
|
|
1211
|
+
// 0-9 => [52, 61]
|
|
1212
|
+
for (let i = 0; i < 10; i++) {
|
|
1213
|
+
this.base64Index.set(String.fromCharCode('0'.charCodeAt(0) + i), i + 52);
|
|
1214
|
+
this.indexBase64.set(i + 52, String.fromCharCode('0'.charCodeAt(0) + i));
|
|
1215
|
+
}
|
|
1216
|
+
// + / => [62, 63]
|
|
1217
|
+
this.base64Index.set('+', 62);
|
|
1218
|
+
this.base64Index.set('/', 63);
|
|
1219
|
+
this.indexBase64.set(62, '+');
|
|
1220
|
+
this.indexBase64.set(63, '/');
|
|
1221
|
+
}
|
|
1222
|
+
compressBlob(blob) {
|
|
1223
|
+
if (!blob) {
|
|
1224
|
+
return;
|
|
1225
|
+
}
|
|
1226
|
+
const observable = new Observable((observer) => {
|
|
1227
|
+
const reader = new FileReader();
|
|
1228
|
+
reader.readAsDataURL(blob);
|
|
1229
|
+
reader.onload = () => {
|
|
1230
|
+
const base64 = reader.result.valueOf();
|
|
1231
|
+
const text64 = base64.substr(base64.indexOf(',') + 1);
|
|
1232
|
+
const compressed = this.compressStringBase64(text64);
|
|
1233
|
+
const compressedData = { length: text64.length,
|
|
1234
|
+
type: blob.type,
|
|
1235
|
+
object: compressed };
|
|
1236
|
+
observer.next(compressedData);
|
|
1237
|
+
};
|
|
1238
|
+
});
|
|
1239
|
+
return observable;
|
|
1240
|
+
}
|
|
1241
|
+
decompressBlob(compressedData) {
|
|
1242
|
+
/* tslint:disable:no-bitwise*/
|
|
1243
|
+
const object = compressedData.object;
|
|
1244
|
+
const length = compressedData.length;
|
|
1245
|
+
const decompressed = this.decompressStringBase64(object, length);
|
|
1246
|
+
const byteCharacters = atob(decompressed);
|
|
1247
|
+
const byteNumbers = new Array(byteCharacters.length);
|
|
1248
|
+
for (let i = 0; i < byteCharacters.length; i++) {
|
|
1249
|
+
byteNumbers[i] = byteCharacters.charCodeAt(i);
|
|
1250
|
+
}
|
|
1251
|
+
const byteArray = new Uint8Array(byteNumbers);
|
|
1252
|
+
const blob = new Blob([byteArray], { type: compressedData.type });
|
|
1253
|
+
/* tslint:enable:no-bitwise*/
|
|
1254
|
+
return blob;
|
|
1255
|
+
}
|
|
1256
|
+
compressStringBase64(s) {
|
|
1257
|
+
/* tslint:disable:no-bitwise*/
|
|
1258
|
+
let out = '';
|
|
1259
|
+
let bits = 16;
|
|
1260
|
+
let chr = 0;
|
|
1261
|
+
let rem = 0;
|
|
1262
|
+
for (const c of s) {
|
|
1263
|
+
const value = this.base64Index.get(c);
|
|
1264
|
+
if (bits > 6) {
|
|
1265
|
+
bits -= 6;
|
|
1266
|
+
chr += value << bits;
|
|
1267
|
+
}
|
|
1268
|
+
else {
|
|
1269
|
+
rem = 6 - bits;
|
|
1270
|
+
chr += value >> rem;
|
|
1271
|
+
out += String.fromCharCode(chr);
|
|
1272
|
+
chr = (value) << (16 - rem);
|
|
1273
|
+
bits = 16 - rem;
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
if (s.length % 8 !== 0) {
|
|
1277
|
+
out += String.fromCharCode(chr);
|
|
1278
|
+
}
|
|
1279
|
+
/* tslint:enable:no-bitwise*/
|
|
1280
|
+
return String.fromCharCode(9731) + out;
|
|
1281
|
+
}
|
|
1282
|
+
decompressStringBase64(c, length) {
|
|
1283
|
+
/* tslint:disable:no-bitwise*/
|
|
1284
|
+
if (!c) {
|
|
1285
|
+
return;
|
|
1286
|
+
}
|
|
1287
|
+
if (c.charCodeAt(0) !== 9731) {
|
|
1288
|
+
return c;
|
|
1289
|
+
}
|
|
1290
|
+
let chr = 0;
|
|
1291
|
+
let rem = 0;
|
|
1292
|
+
let bits = 16;
|
|
1293
|
+
let out = '';
|
|
1294
|
+
let j = 1;
|
|
1295
|
+
let value = c.charCodeAt(j);
|
|
1296
|
+
for (let i = 0; i < length; i++) {
|
|
1297
|
+
if (bits > 6) {
|
|
1298
|
+
bits -= 6;
|
|
1299
|
+
chr = getNumber(value, bits, 6);
|
|
1300
|
+
out += this.indexBase64.get(chr);
|
|
1301
|
+
}
|
|
1302
|
+
else {
|
|
1303
|
+
rem = 6 - bits;
|
|
1304
|
+
chr = getNumber(value, 0, bits) << rem;
|
|
1305
|
+
value = c.charCodeAt(++j);
|
|
1306
|
+
chr += getNumber(value, 16 - rem, rem);
|
|
1307
|
+
out += this.indexBase64.get(chr);
|
|
1308
|
+
bits = 16 - rem;
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
return out;
|
|
1312
|
+
/* tslint:enable:no-bitwise*/
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
CompressionService.ɵfac = function CompressionService_Factory(t) { return new (t || CompressionService)(); };
|
|
1316
|
+
CompressionService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: CompressionService, factory: CompressionService.ɵfac, providedIn: 'root' });
|
|
1317
|
+
(function () {
|
|
1318
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CompressionService, [{
|
|
1319
|
+
type: Injectable,
|
|
1320
|
+
args: [{
|
|
1321
|
+
providedIn: 'root'
|
|
1322
|
+
}]
|
|
1323
|
+
}], function () { return []; }, null);
|
|
1324
1324
|
})();
|
|
1325
1325
|
|
|
1326
|
-
class NetworkService {
|
|
1327
|
-
constructor(messageService, injector) {
|
|
1328
|
-
this.messageService = messageService;
|
|
1329
|
-
this.injector = injector;
|
|
1330
|
-
this.stateChangeEventEmitter = new EventEmitter();
|
|
1331
|
-
this.state = {
|
|
1332
|
-
connection: window.navigator.onLine
|
|
1333
|
-
};
|
|
1334
|
-
this.checkNetworkState();
|
|
1335
|
-
}
|
|
1336
|
-
checkNetworkState() {
|
|
1337
|
-
this.onlineSubscription = fromEvent(window, 'online').subscribe(() => {
|
|
1338
|
-
if (this.previousMessageId) {
|
|
1339
|
-
this.messageService.remove(this.previousMessageId);
|
|
1340
|
-
}
|
|
1341
|
-
const messageObj = this.messageService.info('igo.core.network.online.message', 'igo.core.network.online.title');
|
|
1342
|
-
this.previousMessageId = messageObj.toastId;
|
|
1343
|
-
this.state.connection = true;
|
|
1344
|
-
this.emitEvent();
|
|
1345
|
-
});
|
|
1346
|
-
this.offlineSubscription = fromEvent(window, 'offline').subscribe(() => {
|
|
1347
|
-
if (this.previousMessageId) {
|
|
1348
|
-
this.messageService.remove(this.previousMessageId);
|
|
1349
|
-
}
|
|
1350
|
-
const messageObj = this.messageService.info('igo.core.network.offline.message', 'igo.core.network.offline.title');
|
|
1351
|
-
this.previousMessageId = messageObj.toastId;
|
|
1352
|
-
this.state.connection = false;
|
|
1353
|
-
this.emitEvent();
|
|
1354
|
-
});
|
|
1355
|
-
}
|
|
1356
|
-
emitEvent() {
|
|
1357
|
-
this.stateChangeEventEmitter.emit(this.state);
|
|
1358
|
-
}
|
|
1359
|
-
ngOnDestroy() {
|
|
1360
|
-
try {
|
|
1361
|
-
this.offlineSubscription.unsubscribe();
|
|
1362
|
-
this.onlineSubscription.unsubscribe();
|
|
1363
|
-
}
|
|
1364
|
-
catch (e) { }
|
|
1365
|
-
}
|
|
1366
|
-
currentState(reportState = true) {
|
|
1367
|
-
return reportState
|
|
1368
|
-
? this.stateChangeEventEmitter.pipe(debounceTime(300), startWith(this.state))
|
|
1369
|
-
: this.stateChangeEventEmitter.pipe(debounceTime(300));
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
NetworkService.ɵfac = function NetworkService_Factory(t) { return new (t || NetworkService)(i0.ɵɵinject(MessageService), i0.ɵɵinject(i0.Injector)); };
|
|
1373
|
-
NetworkService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: NetworkService, factory: NetworkService.ɵfac, providedIn: 'root' });
|
|
1374
|
-
(function () {
|
|
1375
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NetworkService, [{
|
|
1376
|
-
type: Injectable,
|
|
1377
|
-
args: [{
|
|
1378
|
-
providedIn: 'root'
|
|
1379
|
-
}]
|
|
1380
|
-
}], function () { return [{ type: MessageService }, { type: i0.Injector }]; }, null);
|
|
1326
|
+
class NetworkService {
|
|
1327
|
+
constructor(messageService, injector) {
|
|
1328
|
+
this.messageService = messageService;
|
|
1329
|
+
this.injector = injector;
|
|
1330
|
+
this.stateChangeEventEmitter = new EventEmitter();
|
|
1331
|
+
this.state = {
|
|
1332
|
+
connection: window.navigator.onLine
|
|
1333
|
+
};
|
|
1334
|
+
this.checkNetworkState();
|
|
1335
|
+
}
|
|
1336
|
+
checkNetworkState() {
|
|
1337
|
+
this.onlineSubscription = fromEvent(window, 'online').subscribe(() => {
|
|
1338
|
+
if (this.previousMessageId) {
|
|
1339
|
+
this.messageService.remove(this.previousMessageId);
|
|
1340
|
+
}
|
|
1341
|
+
const messageObj = this.messageService.info('igo.core.network.online.message', 'igo.core.network.online.title');
|
|
1342
|
+
this.previousMessageId = messageObj.toastId;
|
|
1343
|
+
this.state.connection = true;
|
|
1344
|
+
this.emitEvent();
|
|
1345
|
+
});
|
|
1346
|
+
this.offlineSubscription = fromEvent(window, 'offline').subscribe(() => {
|
|
1347
|
+
if (this.previousMessageId) {
|
|
1348
|
+
this.messageService.remove(this.previousMessageId);
|
|
1349
|
+
}
|
|
1350
|
+
const messageObj = this.messageService.info('igo.core.network.offline.message', 'igo.core.network.offline.title');
|
|
1351
|
+
this.previousMessageId = messageObj.toastId;
|
|
1352
|
+
this.state.connection = false;
|
|
1353
|
+
this.emitEvent();
|
|
1354
|
+
});
|
|
1355
|
+
}
|
|
1356
|
+
emitEvent() {
|
|
1357
|
+
this.stateChangeEventEmitter.emit(this.state);
|
|
1358
|
+
}
|
|
1359
|
+
ngOnDestroy() {
|
|
1360
|
+
try {
|
|
1361
|
+
this.offlineSubscription.unsubscribe();
|
|
1362
|
+
this.onlineSubscription.unsubscribe();
|
|
1363
|
+
}
|
|
1364
|
+
catch (e) { }
|
|
1365
|
+
}
|
|
1366
|
+
currentState(reportState = true) {
|
|
1367
|
+
return reportState
|
|
1368
|
+
? this.stateChangeEventEmitter.pipe(debounceTime(300), startWith(this.state))
|
|
1369
|
+
: this.stateChangeEventEmitter.pipe(debounceTime(300));
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
NetworkService.ɵfac = function NetworkService_Factory(t) { return new (t || NetworkService)(i0.ɵɵinject(MessageService), i0.ɵɵinject(i0.Injector)); };
|
|
1373
|
+
NetworkService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: NetworkService, factory: NetworkService.ɵfac, providedIn: 'root' });
|
|
1374
|
+
(function () {
|
|
1375
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NetworkService, [{
|
|
1376
|
+
type: Injectable,
|
|
1377
|
+
args: [{
|
|
1378
|
+
providedIn: 'root'
|
|
1379
|
+
}]
|
|
1380
|
+
}], function () { return [{ type: MessageService }, { type: i0.Injector }]; }, null);
|
|
1381
1381
|
})();
|
|
1382
1382
|
|
|
1383
|
-
class RegexService {
|
|
1384
|
-
constructor(config) {
|
|
1385
|
-
this.config = config;
|
|
1386
|
-
this.options = this.config.getConfig('regex');
|
|
1387
|
-
}
|
|
1388
|
-
getAll() {
|
|
1389
|
-
return this.options;
|
|
1390
|
-
}
|
|
1391
|
-
get(key) {
|
|
1392
|
-
if (this.options) {
|
|
1393
|
-
return this.options[key];
|
|
1394
|
-
}
|
|
1395
|
-
return;
|
|
1396
|
-
}
|
|
1397
|
-
}
|
|
1398
|
-
RegexService.ɵfac = function RegexService_Factory(t) { return new (t || RegexService)(i0.ɵɵinject(ConfigService)); };
|
|
1399
|
-
RegexService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: RegexService, factory: RegexService.ɵfac, providedIn: 'root' });
|
|
1400
|
-
(function () {
|
|
1401
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RegexService, [{
|
|
1402
|
-
type: Injectable,
|
|
1403
|
-
args: [{
|
|
1404
|
-
providedIn: 'root'
|
|
1405
|
-
}]
|
|
1406
|
-
}], function () { return [{ type: ConfigService }]; }, null);
|
|
1383
|
+
class RegexService {
|
|
1384
|
+
constructor(config) {
|
|
1385
|
+
this.config = config;
|
|
1386
|
+
this.options = this.config.getConfig('regex');
|
|
1387
|
+
}
|
|
1388
|
+
getAll() {
|
|
1389
|
+
return this.options;
|
|
1390
|
+
}
|
|
1391
|
+
get(key) {
|
|
1392
|
+
if (this.options) {
|
|
1393
|
+
return this.options[key];
|
|
1394
|
+
}
|
|
1395
|
+
return;
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
RegexService.ɵfac = function RegexService_Factory(t) { return new (t || RegexService)(i0.ɵɵinject(ConfigService)); };
|
|
1399
|
+
RegexService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: RegexService, factory: RegexService.ɵfac, providedIn: 'root' });
|
|
1400
|
+
(function () {
|
|
1401
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RegexService, [{
|
|
1402
|
+
type: Injectable,
|
|
1403
|
+
args: [{
|
|
1404
|
+
providedIn: 'root'
|
|
1405
|
+
}]
|
|
1406
|
+
}], function () { return [{ type: ConfigService }]; }, null);
|
|
1407
1407
|
})();
|
|
1408
1408
|
|
|
1409
|
-
/*
|
|
1410
|
-
* Public API Surface of core
|
|
1409
|
+
/*
|
|
1410
|
+
* Public API Surface of core
|
|
1411
1411
|
*/
|
|
1412
1412
|
|
|
1413
|
-
/**
|
|
1414
|
-
* Generated bundle index. Do not edit.
|
|
1413
|
+
/**
|
|
1414
|
+
* Generated bundle index. Do not edit.
|
|
1415
1415
|
*/
|
|
1416
1416
|
|
|
1417
1417
|
export { ActivityInterceptor, ActivityService, AnalyticsService, CONFIG_OPTIONS, CompressionService, ConfigService, ErrorInterceptor, IgoActivityModule, IgoConfigModule, IgoCoreModule, IgoErrorModule, IgoGestureConfig, IgoGestureModule, IgoLanguageModule, IgoLoggingModule, IgoMessageModule, IgoMissingTranslationHandler, LanguageLoader, LanguageService, LoggingInterceptor, Media, MediaOrientation, MediaService, MessageService, MessageType, NetworkService, ROUTE_SERVICE_OPTIONS, RegexService, RouteService, StorageScope, StorageService, StorageServiceEventEnum, configFactory, defaultLanguageLoader, provideConfigLoader, provideConfigOptions, provideDefaultLanguageLoader, provideLanguageLoader, provideRouteServiceOptions, version };
|