@igo2/core 1.14.1 → 1.14.3
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/__ivy_ngcc__/locale/en.geo.json +22 -8
- package/__ivy_ngcc__/locale/en.json +22 -8
- package/__ivy_ngcc__/locale/fr.geo.json +17 -3
- package/__ivy_ngcc__/locale/fr.json +17 -3
- 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 +73 -73
- 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 +83 -83
- 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 +26 -26
- package/esm2020/lib/language/shared/language.provider.mjs +21 -21
- package/esm2020/lib/language/shared/language.service.mjs +32 -32
- 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 +192 -192
- package/esm2020/lib/network/index.mjs +2 -2
- package/esm2020/lib/network/network.interfaces.mjs +1 -1
- package/esm2020/lib/network/network.service.mjs +66 -66
- package/esm2020/lib/regex/index.mjs +3 -0
- package/esm2020/lib/regex/regex.interface.mjs +2 -0
- package/esm2020/lib/regex/regex.service.mjs +27 -0
- 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 +28 -27
- package/fesm2015/igo2-core.mjs +1313 -1287
- package/fesm2015/igo2-core.mjs.map +1 -1
- package/fesm2020/igo2-core.mjs +1259 -1235
- 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 +19 -19
- 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 -0
- package/lib/regex/regex.interface.d.ts +3 -0
- package/lib/regex/regex.service.d.ts +12 -0
- 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/locale/en.geo.json +22 -8
- package/locale/en.json +22 -8
- package/locale/fr.geo.json +17 -3
- package/locale/fr.json +17 -3
- package/package.json +2 -2
- package/public_api.d.ts +24 -23
package/fesm2015/igo2-core.mjs
CHANGED
|
@@ -18,1357 +18,1383 @@ 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.14.
|
|
110
|
-
releaseDate:
|
|
108
|
+
const version = {
|
|
109
|
+
lib: '1.14.3',
|
|
110
|
+
releaseDate: 1712763032014
|
|
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$ = combineLatest([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$ = combineLatest([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
|
-
this.language
|
|
372
|
-
|
|
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
|
-
translatedTextInterpolateParams[k] =
|
|
407
|
-
this.languageService.translate.instant(activeMessageTranslation.textInterpolateParams[k]);
|
|
408
|
-
});
|
|
409
|
-
}
|
|
410
|
-
if (activeMessageTranslation.titleInterpolateParams) {
|
|
411
|
-
Object.keys(activeMessageTranslation.titleInterpolateParams).map(k => {
|
|
412
|
-
translatedTitleInterpolateParams[k] =
|
|
413
|
-
this.languageService.translate.instant(activeMessageTranslation.titleInterpolateParams[k]);
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
forkJoin([
|
|
417
|
-
this.languageService.translate.get(activeMessageTranslation.textKey, translatedTextInterpolateParams),
|
|
418
|
-
this.languageService.translate.get(activeMessageTranslation.titleKey, translatedTitleInterpolateParams)
|
|
419
|
-
]).pipe(first()).subscribe((res) => {
|
|
420
|
-
toast.toastRef.componentInstance.message = res[0];
|
|
421
|
-
toast.toastRef.componentInstance.title = res[1];
|
|
422
|
-
});
|
|
423
|
-
}
|
|
424
|
-
});
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
get toastr() {
|
|
428
|
-
return this.injector.get(ToastrService);
|
|
429
|
-
}
|
|
430
|
-
showError(httpError) {
|
|
431
|
-
httpError.error.caught = true;
|
|
432
|
-
return this.error(httpError.error.message, httpError.error.title);
|
|
433
|
-
}
|
|
434
|
-
message(message) {
|
|
435
|
-
const messageType = message.type;
|
|
436
|
-
this.toastr.toastrConfig.iconClasses[messageType] = `toast-${messageType}`;
|
|
437
|
-
this.messages$.next(this.messages$.value.concat([message]));
|
|
438
|
-
message.options = message.options || {};
|
|
439
|
-
const currentDate = new Date();
|
|
440
|
-
message.options.from = message.options.from ? message.options.from : new Date('1 jan 1900');
|
|
441
|
-
message.options.to = message.options.to ? message.options.to : new Date('1 jan 3000');
|
|
442
|
-
if (typeof message.options.from === 'string') {
|
|
443
|
-
message.options.from = new Date(Date.parse(message.options.from.replace(/-/g, ' ')));
|
|
444
|
-
}
|
|
445
|
-
if (typeof message.options.to === 'string') {
|
|
446
|
-
message.options.to = new Date(Date.parse(message.options.to.replace(/-/g, ' ')));
|
|
447
|
-
}
|
|
448
|
-
if (currentDate > message.options.from && currentDate < message.options.to) {
|
|
449
|
-
if (message.showIcon === false) {
|
|
450
|
-
this.toastr.toastrConfig.iconClasses[messageType] = `toast-${messageType} toast-no-icon`;
|
|
451
|
-
}
|
|
452
|
-
message = this.handleTemplate(message);
|
|
453
|
-
if (message.text) {
|
|
454
|
-
let messageShown;
|
|
455
|
-
switch (message.type) {
|
|
456
|
-
case MessageType.SUCCESS:
|
|
457
|
-
messageShown = this.success(message.text, message.title, message.options, message.textInterpolateParams, message.titleInterpolateParams);
|
|
458
|
-
break;
|
|
459
|
-
case MessageType.ERROR:
|
|
460
|
-
messageShown = this.error(message.text, message.title, message.options, message.textInterpolateParams, message.titleInterpolateParams);
|
|
461
|
-
break;
|
|
462
|
-
case MessageType.INFO:
|
|
463
|
-
messageShown = this.info(message.text, message.title, message.options, message.textInterpolateParams, message.titleInterpolateParams);
|
|
464
|
-
break;
|
|
465
|
-
case MessageType.SHOW:
|
|
466
|
-
messageShown = this.show(message.text, message.title, message.options, message.textInterpolateParams, message.titleInterpolateParams);
|
|
467
|
-
break;
|
|
468
|
-
case MessageType.ALERT:
|
|
469
|
-
case MessageType.WARNING:
|
|
470
|
-
messageShown = this.alert(message.text, message.title, message.options, message.textInterpolateParams, message.titleInterpolateParams);
|
|
471
|
-
break;
|
|
472
|
-
default:
|
|
473
|
-
messageShown = this.info(message.text, message.title, message.options, message.textInterpolateParams, message.titleInterpolateParams);
|
|
474
|
-
break;
|
|
475
|
-
}
|
|
476
|
-
message.options.id = messageShown.toastId;
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
success(text, title = 'igo.core.message.success', options = {}, textInterpolateParams, titleInterpolateParams) {
|
|
481
|
-
return this.handleNgxToastr('success', text, title, options, textInterpolateParams, titleInterpolateParams);
|
|
482
|
-
}
|
|
483
|
-
error(text, title = 'igo.core.message.error', options = {}, textInterpolateParams, titleInterpolateParams) {
|
|
484
|
-
return this.handleNgxToastr('error', text, title, options, textInterpolateParams, titleInterpolateParams);
|
|
485
|
-
}
|
|
486
|
-
info(text, title = 'igo.core.message.info', options = {}, textInterpolateParams, titleInterpolateParams) {
|
|
487
|
-
return this.handleNgxToastr('info', text, title, options, textInterpolateParams, titleInterpolateParams);
|
|
488
|
-
}
|
|
489
|
-
alert(text, title = 'igo.core.message.alert', options = {}, textInterpolateParams, titleInterpolateParams) {
|
|
490
|
-
return this.handleNgxToastr('alert', text, title, options, textInterpolateParams, titleInterpolateParams);
|
|
491
|
-
}
|
|
492
|
-
show(text, title = 'igo.core.message.info', options = {}, textInterpolateParams, titleInterpolateParams) {
|
|
493
|
-
return this.handleNgxToastr('show', text, title, options, textInterpolateParams, titleInterpolateParams);
|
|
494
|
-
}
|
|
495
|
-
handleNgxToastr(type, text, title, options = {}, textInterpolateParams, titleInterpolateParams) {
|
|
496
|
-
const translatedTextInterpolateParams = Object.assign({}, textInterpolateParams);
|
|
497
|
-
const translatedTitlenterpolateParams = Object.assign({}, titleInterpolateParams);
|
|
498
|
-
if (textInterpolateParams) {
|
|
499
|
-
Object.keys(textInterpolateParams).map(k => {
|
|
500
|
-
translatedTextInterpolateParams[k] =
|
|
501
|
-
this.languageService.translate.instant(textInterpolateParams[k]);
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
|
-
if (titleInterpolateParams) {
|
|
505
|
-
Object.keys(titleInterpolateParams).map(k => {
|
|
506
|
-
translatedTitlenterpolateParams[k] =
|
|
507
|
-
this.languageService.translate.instant(titleInterpolateParams[k]);
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
const message = this.languageService.translate.instant(text, translatedTextInterpolateParams);
|
|
511
|
-
const translatedTitle = this.languageService.translate.instant(title, translatedTitlenterpolateParams);
|
|
512
|
-
let activeToast;
|
|
513
|
-
switch (type) {
|
|
514
|
-
case 'success':
|
|
515
|
-
activeToast = this.toastr.success(message, translatedTitle, options);
|
|
516
|
-
break;
|
|
517
|
-
case 'error':
|
|
518
|
-
activeToast = this.toastr.error(message, translatedTitle, options);
|
|
519
|
-
break;
|
|
520
|
-
case 'show':
|
|
521
|
-
case 'info':
|
|
522
|
-
activeToast = this.toastr.info(message, translatedTitle, options);
|
|
523
|
-
break;
|
|
524
|
-
case 'alert':
|
|
525
|
-
activeToast = this.toastr.warning(message, translatedTitle, options);
|
|
526
|
-
break;
|
|
527
|
-
}
|
|
528
|
-
this.activeMessageTranslations.push({
|
|
529
|
-
id: activeToast.toastId,
|
|
530
|
-
titleKey: title,
|
|
531
|
-
textKey: text,
|
|
532
|
-
textInterpolateParams,
|
|
533
|
-
titleInterpolateParams
|
|
534
|
-
});
|
|
535
|
-
return activeToast;
|
|
536
|
-
}
|
|
537
|
-
remove(id) {
|
|
538
|
-
this.toastr.remove(id);
|
|
539
|
-
}
|
|
540
|
-
removeAllAreNotError() {
|
|
541
|
-
for (const mess of this.messages$.value) {
|
|
542
|
-
if (mess.type !== MessageType.ERROR) {
|
|
543
|
-
this.remove(mess.options.id);
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
handleTemplate(message) {
|
|
548
|
-
if (!this.options.template || message.html) {
|
|
549
|
-
return message;
|
|
550
|
-
}
|
|
551
|
-
let html = this.options.template;
|
|
552
|
-
html = html.replace('${text}', message.text);
|
|
553
|
-
html = html.replace('${title}', message.title);
|
|
554
|
-
message.html = undefined;
|
|
555
|
-
message.text = html;
|
|
556
|
-
message.title = undefined;
|
|
557
|
-
return message;
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
MessageService.ɵfac = function MessageService_Factory(t) { return new (t || MessageService)(i0.ɵɵinject(Injector), i0.ɵɵinject(ConfigService), i0.ɵɵinject(LanguageService)); };
|
|
561
|
-
MessageService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: MessageService, factory: MessageService.ɵfac, providedIn: 'root' });
|
|
562
|
-
(function () {
|
|
563
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MessageService, [{
|
|
564
|
-
type: Injectable,
|
|
565
|
-
args: [{
|
|
566
|
-
providedIn: 'root'
|
|
567
|
-
}]
|
|
568
|
-
}], function () {
|
|
569
|
-
return [{ type: i0.Injector, decorators: [{
|
|
570
|
-
type: Inject,
|
|
571
|
-
args: [Injector]
|
|
572
|
-
}] }, { type: ConfigService }, { type: LanguageService }];
|
|
573
|
-
}, 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
|
+
translatedTextInterpolateParams[k] =
|
|
407
|
+
this.languageService.translate.instant(activeMessageTranslation.textInterpolateParams[k]);
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
if (activeMessageTranslation.titleInterpolateParams) {
|
|
411
|
+
Object.keys(activeMessageTranslation.titleInterpolateParams).map(k => {
|
|
412
|
+
translatedTitleInterpolateParams[k] =
|
|
413
|
+
this.languageService.translate.instant(activeMessageTranslation.titleInterpolateParams[k]);
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
forkJoin([
|
|
417
|
+
this.languageService.translate.get(activeMessageTranslation.textKey, translatedTextInterpolateParams),
|
|
418
|
+
this.languageService.translate.get(activeMessageTranslation.titleKey, translatedTitleInterpolateParams)
|
|
419
|
+
]).pipe(first()).subscribe((res) => {
|
|
420
|
+
toast.toastRef.componentInstance.message = res[0];
|
|
421
|
+
toast.toastRef.componentInstance.title = res[1];
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
get toastr() {
|
|
428
|
+
return this.injector.get(ToastrService);
|
|
429
|
+
}
|
|
430
|
+
showError(httpError) {
|
|
431
|
+
httpError.error.caught = true;
|
|
432
|
+
return this.error(httpError.error.message, httpError.error.title);
|
|
433
|
+
}
|
|
434
|
+
message(message) {
|
|
435
|
+
const messageType = message.type;
|
|
436
|
+
this.toastr.toastrConfig.iconClasses[messageType] = `toast-${messageType}`;
|
|
437
|
+
this.messages$.next(this.messages$.value.concat([message]));
|
|
438
|
+
message.options = message.options || {};
|
|
439
|
+
const currentDate = new Date();
|
|
440
|
+
message.options.from = message.options.from ? message.options.from : new Date('1 jan 1900');
|
|
441
|
+
message.options.to = message.options.to ? message.options.to : new Date('1 jan 3000');
|
|
442
|
+
if (typeof message.options.from === 'string') {
|
|
443
|
+
message.options.from = new Date(Date.parse(message.options.from.replace(/-/g, ' ')));
|
|
444
|
+
}
|
|
445
|
+
if (typeof message.options.to === 'string') {
|
|
446
|
+
message.options.to = new Date(Date.parse(message.options.to.replace(/-/g, ' ')));
|
|
447
|
+
}
|
|
448
|
+
if (currentDate > message.options.from && currentDate < message.options.to) {
|
|
449
|
+
if (message.showIcon === false) {
|
|
450
|
+
this.toastr.toastrConfig.iconClasses[messageType] = `toast-${messageType} toast-no-icon`;
|
|
451
|
+
}
|
|
452
|
+
message = this.handleTemplate(message);
|
|
453
|
+
if (message.text) {
|
|
454
|
+
let messageShown;
|
|
455
|
+
switch (message.type) {
|
|
456
|
+
case MessageType.SUCCESS:
|
|
457
|
+
messageShown = this.success(message.text, message.title, message.options, message.textInterpolateParams, message.titleInterpolateParams);
|
|
458
|
+
break;
|
|
459
|
+
case MessageType.ERROR:
|
|
460
|
+
messageShown = this.error(message.text, message.title, message.options, message.textInterpolateParams, message.titleInterpolateParams);
|
|
461
|
+
break;
|
|
462
|
+
case MessageType.INFO:
|
|
463
|
+
messageShown = this.info(message.text, message.title, message.options, message.textInterpolateParams, message.titleInterpolateParams);
|
|
464
|
+
break;
|
|
465
|
+
case MessageType.SHOW:
|
|
466
|
+
messageShown = this.show(message.text, message.title, message.options, message.textInterpolateParams, message.titleInterpolateParams);
|
|
467
|
+
break;
|
|
468
|
+
case MessageType.ALERT:
|
|
469
|
+
case MessageType.WARNING:
|
|
470
|
+
messageShown = this.alert(message.text, message.title, message.options, message.textInterpolateParams, message.titleInterpolateParams);
|
|
471
|
+
break;
|
|
472
|
+
default:
|
|
473
|
+
messageShown = this.info(message.text, message.title, message.options, message.textInterpolateParams, message.titleInterpolateParams);
|
|
474
|
+
break;
|
|
475
|
+
}
|
|
476
|
+
message.options.id = messageShown.toastId;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
success(text, title = 'igo.core.message.success', options = {}, textInterpolateParams, titleInterpolateParams) {
|
|
481
|
+
return this.handleNgxToastr('success', text, title, options, textInterpolateParams, titleInterpolateParams);
|
|
482
|
+
}
|
|
483
|
+
error(text, title = 'igo.core.message.error', options = {}, textInterpolateParams, titleInterpolateParams) {
|
|
484
|
+
return this.handleNgxToastr('error', text, title, options, textInterpolateParams, titleInterpolateParams);
|
|
485
|
+
}
|
|
486
|
+
info(text, title = 'igo.core.message.info', options = {}, textInterpolateParams, titleInterpolateParams) {
|
|
487
|
+
return this.handleNgxToastr('info', text, title, options, textInterpolateParams, titleInterpolateParams);
|
|
488
|
+
}
|
|
489
|
+
alert(text, title = 'igo.core.message.alert', options = {}, textInterpolateParams, titleInterpolateParams) {
|
|
490
|
+
return this.handleNgxToastr('alert', text, title, options, textInterpolateParams, titleInterpolateParams);
|
|
491
|
+
}
|
|
492
|
+
show(text, title = 'igo.core.message.info', options = {}, textInterpolateParams, titleInterpolateParams) {
|
|
493
|
+
return this.handleNgxToastr('show', text, title, options, textInterpolateParams, titleInterpolateParams);
|
|
494
|
+
}
|
|
495
|
+
handleNgxToastr(type, text, title, options = {}, textInterpolateParams, titleInterpolateParams) {
|
|
496
|
+
const translatedTextInterpolateParams = Object.assign({}, textInterpolateParams);
|
|
497
|
+
const translatedTitlenterpolateParams = Object.assign({}, titleInterpolateParams);
|
|
498
|
+
if (textInterpolateParams) {
|
|
499
|
+
Object.keys(textInterpolateParams).map(k => {
|
|
500
|
+
translatedTextInterpolateParams[k] =
|
|
501
|
+
this.languageService.translate.instant(textInterpolateParams[k]);
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
if (titleInterpolateParams) {
|
|
505
|
+
Object.keys(titleInterpolateParams).map(k => {
|
|
506
|
+
translatedTitlenterpolateParams[k] =
|
|
507
|
+
this.languageService.translate.instant(titleInterpolateParams[k]);
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
const message = this.languageService.translate.instant(text, translatedTextInterpolateParams);
|
|
511
|
+
const translatedTitle = this.languageService.translate.instant(title, translatedTitlenterpolateParams);
|
|
512
|
+
let activeToast;
|
|
513
|
+
switch (type) {
|
|
514
|
+
case 'success':
|
|
515
|
+
activeToast = this.toastr.success(message, translatedTitle, options);
|
|
516
|
+
break;
|
|
517
|
+
case 'error':
|
|
518
|
+
activeToast = this.toastr.error(message, translatedTitle, options);
|
|
519
|
+
break;
|
|
520
|
+
case 'show':
|
|
521
|
+
case 'info':
|
|
522
|
+
activeToast = this.toastr.info(message, translatedTitle, options);
|
|
523
|
+
break;
|
|
524
|
+
case 'alert':
|
|
525
|
+
activeToast = this.toastr.warning(message, translatedTitle, options);
|
|
526
|
+
break;
|
|
527
|
+
}
|
|
528
|
+
this.activeMessageTranslations.push({
|
|
529
|
+
id: activeToast.toastId,
|
|
530
|
+
titleKey: title,
|
|
531
|
+
textKey: text,
|
|
532
|
+
textInterpolateParams,
|
|
533
|
+
titleInterpolateParams
|
|
534
|
+
});
|
|
535
|
+
return activeToast;
|
|
536
|
+
}
|
|
537
|
+
remove(id) {
|
|
538
|
+
this.toastr.remove(id);
|
|
539
|
+
}
|
|
540
|
+
removeAllAreNotError() {
|
|
541
|
+
for (const mess of this.messages$.value) {
|
|
542
|
+
if (mess.type !== MessageType.ERROR) {
|
|
543
|
+
this.remove(mess.options.id);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
handleTemplate(message) {
|
|
548
|
+
if (!this.options.template || message.html) {
|
|
549
|
+
return message;
|
|
550
|
+
}
|
|
551
|
+
let html = this.options.template;
|
|
552
|
+
html = html.replace('${text}', message.text);
|
|
553
|
+
html = html.replace('${title}', message.title);
|
|
554
|
+
message.html = undefined;
|
|
555
|
+
message.text = html;
|
|
556
|
+
message.title = undefined;
|
|
557
|
+
return message;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
MessageService.ɵfac = function MessageService_Factory(t) { return new (t || MessageService)(i0.ɵɵinject(Injector), i0.ɵɵinject(ConfigService), i0.ɵɵinject(LanguageService)); };
|
|
561
|
+
MessageService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: MessageService, factory: MessageService.ɵfac, providedIn: 'root' });
|
|
562
|
+
(function () {
|
|
563
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MessageService, [{
|
|
564
|
+
type: Injectable,
|
|
565
|
+
args: [{
|
|
566
|
+
providedIn: 'root'
|
|
567
|
+
}]
|
|
568
|
+
}], function () {
|
|
569
|
+
return [{ type: i0.Injector, decorators: [{
|
|
570
|
+
type: Inject,
|
|
571
|
+
args: [Injector]
|
|
572
|
+
}] }, { type: ConfigService }, { type: LanguageService }];
|
|
573
|
+
}, null);
|
|
574
574
|
})();
|
|
575
575
|
|
|
576
|
-
class ErrorInterceptor {
|
|
577
|
-
constructor(injector) {
|
|
578
|
-
this.injector = injector;
|
|
579
|
-
}
|
|
580
|
-
intercept(originalReq, next) {
|
|
581
|
-
const interceptError = originalReq.headers.get('interceptError');
|
|
582
|
-
const req = originalReq.clone({
|
|
583
|
-
headers: originalReq.headers.delete('interceptError')
|
|
584
|
-
});
|
|
585
|
-
if (interceptError === 'false') {
|
|
586
|
-
return next.handle(req);
|
|
587
|
-
}
|
|
588
|
-
const errorContainer = { httpError: undefined };
|
|
589
|
-
return next.handle(req).pipe(catchError(error => this.handleError(error, errorContainer)), finalize(() => {
|
|
590
|
-
this.handleCaughtError(errorContainer);
|
|
591
|
-
this.handleUncaughtError(errorContainer);
|
|
592
|
-
}));
|
|
593
|
-
}
|
|
594
|
-
handleError(httpError, errorContainer) {
|
|
595
|
-
if (httpError instanceof HttpErrorResponse) {
|
|
596
|
-
const errorObj = httpError.error === 'object' ? httpError.error : {};
|
|
597
|
-
errorObj.message = httpError.error.message || httpError.statusText;
|
|
598
|
-
errorObj.caught = false;
|
|
599
|
-
httpError = new HttpErrorResponse({
|
|
600
|
-
error: errorObj,
|
|
601
|
-
headers: httpError.headers,
|
|
602
|
-
status: httpError.status,
|
|
603
|
-
statusText: httpError.statusText,
|
|
604
|
-
url: httpError.url
|
|
605
|
-
});
|
|
606
|
-
}
|
|
607
|
-
errorContainer.httpError = httpError;
|
|
608
|
-
return throwError(httpError);
|
|
609
|
-
}
|
|
610
|
-
handleCaughtError(errorContainer) {
|
|
611
|
-
const httpError = errorContainer.httpError;
|
|
612
|
-
if (httpError && httpError.error.toDisplay) {
|
|
613
|
-
httpError.error.caught = true;
|
|
614
|
-
const messageService = this.injector.get(MessageService);
|
|
615
|
-
messageService.error(httpError.error.message, httpError.error.title);
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
handleUncaughtError(errorContainer) {
|
|
619
|
-
const httpError = errorContainer.httpError;
|
|
620
|
-
if (httpError && !httpError.error.caught) {
|
|
621
|
-
const messageService = this.injector.get(MessageService);
|
|
622
|
-
httpError.error.caught = true;
|
|
623
|
-
messageService.error('igo.core.errors.uncaught.message', 'igo.core.errors.uncaught.title');
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
ErrorInterceptor.ɵfac = function ErrorInterceptor_Factory(t) { return new (t || ErrorInterceptor)(i0.ɵɵinject(i0.Injector)); };
|
|
628
|
-
ErrorInterceptor.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ErrorInterceptor, factory: ErrorInterceptor.ɵfac, providedIn: 'root' });
|
|
629
|
-
(function () {
|
|
630
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ErrorInterceptor, [{
|
|
631
|
-
type: Injectable,
|
|
632
|
-
args: [{
|
|
633
|
-
providedIn: 'root'
|
|
634
|
-
}]
|
|
635
|
-
}], function () { return [{ type: i0.Injector }]; }, null);
|
|
576
|
+
class ErrorInterceptor {
|
|
577
|
+
constructor(injector) {
|
|
578
|
+
this.injector = injector;
|
|
579
|
+
}
|
|
580
|
+
intercept(originalReq, next) {
|
|
581
|
+
const interceptError = originalReq.headers.get('interceptError');
|
|
582
|
+
const req = originalReq.clone({
|
|
583
|
+
headers: originalReq.headers.delete('interceptError')
|
|
584
|
+
});
|
|
585
|
+
if (interceptError === 'false') {
|
|
586
|
+
return next.handle(req);
|
|
587
|
+
}
|
|
588
|
+
const errorContainer = { httpError: undefined };
|
|
589
|
+
return next.handle(req).pipe(catchError(error => this.handleError(error, errorContainer)), finalize(() => {
|
|
590
|
+
this.handleCaughtError(errorContainer);
|
|
591
|
+
this.handleUncaughtError(errorContainer);
|
|
592
|
+
}));
|
|
593
|
+
}
|
|
594
|
+
handleError(httpError, errorContainer) {
|
|
595
|
+
if (httpError instanceof HttpErrorResponse) {
|
|
596
|
+
const errorObj = httpError.error === 'object' ? httpError.error : {};
|
|
597
|
+
errorObj.message = httpError.error.message || httpError.statusText;
|
|
598
|
+
errorObj.caught = false;
|
|
599
|
+
httpError = new HttpErrorResponse({
|
|
600
|
+
error: errorObj,
|
|
601
|
+
headers: httpError.headers,
|
|
602
|
+
status: httpError.status,
|
|
603
|
+
statusText: httpError.statusText,
|
|
604
|
+
url: httpError.url
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
errorContainer.httpError = httpError;
|
|
608
|
+
return throwError(httpError);
|
|
609
|
+
}
|
|
610
|
+
handleCaughtError(errorContainer) {
|
|
611
|
+
const httpError = errorContainer.httpError;
|
|
612
|
+
if (httpError && httpError.error.toDisplay) {
|
|
613
|
+
httpError.error.caught = true;
|
|
614
|
+
const messageService = this.injector.get(MessageService);
|
|
615
|
+
messageService.error(httpError.error.message, httpError.error.title);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
handleUncaughtError(errorContainer) {
|
|
619
|
+
const httpError = errorContainer.httpError;
|
|
620
|
+
if (httpError && !httpError.error.caught) {
|
|
621
|
+
const messageService = this.injector.get(MessageService);
|
|
622
|
+
httpError.error.caught = true;
|
|
623
|
+
messageService.error('igo.core.errors.uncaught.message', 'igo.core.errors.uncaught.title');
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
ErrorInterceptor.ɵfac = function ErrorInterceptor_Factory(t) { return new (t || ErrorInterceptor)(i0.ɵɵinject(i0.Injector)); };
|
|
628
|
+
ErrorInterceptor.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ErrorInterceptor, factory: ErrorInterceptor.ɵfac, providedIn: 'root' });
|
|
629
|
+
(function () {
|
|
630
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ErrorInterceptor, [{
|
|
631
|
+
type: Injectable,
|
|
632
|
+
args: [{
|
|
633
|
+
providedIn: 'root'
|
|
634
|
+
}]
|
|
635
|
+
}], function () { return [{ type: i0.Injector }]; }, null);
|
|
636
636
|
})();
|
|
637
637
|
|
|
638
|
-
class IgoErrorModule {
|
|
639
|
-
constructor(parentModule) {
|
|
640
|
-
if (parentModule) {
|
|
641
|
-
throw new Error('IgoErrorModule is already loaded. Import it in the AppModule only');
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
static forRoot() {
|
|
645
|
-
return {
|
|
646
|
-
ngModule: IgoErrorModule,
|
|
647
|
-
providers: [
|
|
648
|
-
{
|
|
649
|
-
provide: HTTP_INTERCEPTORS,
|
|
650
|
-
useClass: ErrorInterceptor,
|
|
651
|
-
multi: true
|
|
652
|
-
}
|
|
653
|
-
]
|
|
654
|
-
};
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
IgoErrorModule.ɵfac = function IgoErrorModule_Factory(t) { return new (t || IgoErrorModule)(i0.ɵɵinject(IgoErrorModule, 12)); };
|
|
658
|
-
IgoErrorModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoErrorModule });
|
|
659
|
-
IgoErrorModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
|
|
660
|
-
(function () {
|
|
661
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoErrorModule, [{
|
|
662
|
-
type: NgModule,
|
|
663
|
-
args: [{
|
|
664
|
-
imports: [],
|
|
665
|
-
declarations: [],
|
|
666
|
-
exports: []
|
|
667
|
-
}]
|
|
668
|
-
}], function () {
|
|
669
|
-
return [{ type: IgoErrorModule, decorators: [{
|
|
670
|
-
type: Optional
|
|
671
|
-
}, {
|
|
672
|
-
type: SkipSelf
|
|
673
|
-
}] }];
|
|
674
|
-
}, null);
|
|
638
|
+
class IgoErrorModule {
|
|
639
|
+
constructor(parentModule) {
|
|
640
|
+
if (parentModule) {
|
|
641
|
+
throw new Error('IgoErrorModule is already loaded. Import it in the AppModule only');
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
static forRoot() {
|
|
645
|
+
return {
|
|
646
|
+
ngModule: IgoErrorModule,
|
|
647
|
+
providers: [
|
|
648
|
+
{
|
|
649
|
+
provide: HTTP_INTERCEPTORS,
|
|
650
|
+
useClass: ErrorInterceptor,
|
|
651
|
+
multi: true
|
|
652
|
+
}
|
|
653
|
+
]
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
IgoErrorModule.ɵfac = function IgoErrorModule_Factory(t) { return new (t || IgoErrorModule)(i0.ɵɵinject(IgoErrorModule, 12)); };
|
|
658
|
+
IgoErrorModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoErrorModule });
|
|
659
|
+
IgoErrorModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
|
|
660
|
+
(function () {
|
|
661
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoErrorModule, [{
|
|
662
|
+
type: NgModule,
|
|
663
|
+
args: [{
|
|
664
|
+
imports: [],
|
|
665
|
+
declarations: [],
|
|
666
|
+
exports: []
|
|
667
|
+
}]
|
|
668
|
+
}], function () {
|
|
669
|
+
return [{ type: IgoErrorModule, decorators: [{
|
|
670
|
+
type: Optional
|
|
671
|
+
}, {
|
|
672
|
+
type: SkipSelf
|
|
673
|
+
}] }];
|
|
674
|
+
}, null);
|
|
675
675
|
})();
|
|
676
676
|
|
|
677
|
-
const dbConfig = {
|
|
678
|
-
name: 'igo2DB',
|
|
679
|
-
version: 1,
|
|
680
|
-
objectStoresMeta: [{
|
|
681
|
-
store: 'geoData',
|
|
682
|
-
storeConfig: { keyPath: 'url', autoIncrement: false },
|
|
683
|
-
storeSchema: [
|
|
684
|
-
{ name: 'regionID', keypath: 'regionID', options: { unique: false } }
|
|
685
|
-
]
|
|
686
|
-
}]
|
|
687
|
-
};
|
|
688
|
-
class IgoCoreModule {
|
|
689
|
-
constructor(matIconRegistry, domSanitizer) {
|
|
690
|
-
matIconRegistry.addSvgIconSet(domSanitizer.bypassSecurityTrustResourceUrl('./assets/igo2/core/icons/mdi.svg'));
|
|
691
|
-
}
|
|
692
|
-
static forRoot() {
|
|
693
|
-
return {
|
|
694
|
-
ngModule: IgoCoreModule,
|
|
695
|
-
providers: []
|
|
696
|
-
};
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
IgoCoreModule.ɵfac = function IgoCoreModule_Factory(t) { return new (t || IgoCoreModule)(i0.ɵɵinject(i1$2.MatIconRegistry), i0.ɵɵinject(i2.DomSanitizer)); };
|
|
700
|
-
IgoCoreModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoCoreModule });
|
|
701
|
-
IgoCoreModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
|
|
702
|
-
HttpClientModule,
|
|
703
|
-
IgoActivityModule.forRoot(),
|
|
704
|
-
IgoConfigModule.forRoot(),
|
|
705
|
-
IgoErrorModule.forRoot(),
|
|
706
|
-
IgoLanguageModule.forRoot(),
|
|
707
|
-
IgoMessageModule.forRoot(),
|
|
708
|
-
NgxIndexedDBModule.forRoot(dbConfig), IgoActivityModule,
|
|
709
|
-
IgoConfigModule,
|
|
710
|
-
IgoErrorModule,
|
|
711
|
-
IgoLanguageModule,
|
|
712
|
-
IgoMessageModule] });
|
|
713
|
-
(function () {
|
|
714
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoCoreModule, [{
|
|
715
|
-
type: NgModule,
|
|
716
|
-
args: [{
|
|
717
|
-
imports: [
|
|
718
|
-
CommonModule,
|
|
719
|
-
HttpClientModule,
|
|
720
|
-
IgoActivityModule.forRoot(),
|
|
721
|
-
IgoConfigModule.forRoot(),
|
|
722
|
-
IgoErrorModule.forRoot(),
|
|
723
|
-
IgoLanguageModule.forRoot(),
|
|
724
|
-
IgoMessageModule.forRoot(),
|
|
725
|
-
NgxIndexedDBModule.forRoot(dbConfig)
|
|
726
|
-
],
|
|
727
|
-
declarations: [],
|
|
728
|
-
exports: [
|
|
729
|
-
IgoActivityModule,
|
|
730
|
-
IgoConfigModule,
|
|
731
|
-
IgoErrorModule,
|
|
732
|
-
IgoLanguageModule,
|
|
733
|
-
IgoMessageModule
|
|
734
|
-
]
|
|
735
|
-
}]
|
|
736
|
-
}], function () { return [{ type: i1$2.MatIconRegistry }, { type: i2.DomSanitizer }]; }, null);
|
|
737
|
-
})();
|
|
738
|
-
(function () {
|
|
739
|
-
(typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(IgoCoreModule, { imports: [CommonModule,
|
|
740
|
-
HttpClientModule, IgoActivityModule, IgoConfigModule, IgoErrorModule, IgoLanguageModule, IgoMessageModule, i8.NgxIndexedDBModule], exports: [IgoActivityModule,
|
|
741
|
-
IgoConfigModule,
|
|
742
|
-
IgoErrorModule,
|
|
743
|
-
IgoLanguageModule,
|
|
744
|
-
IgoMessageModule] });
|
|
677
|
+
const dbConfig = {
|
|
678
|
+
name: 'igo2DB',
|
|
679
|
+
version: 1,
|
|
680
|
+
objectStoresMeta: [{
|
|
681
|
+
store: 'geoData',
|
|
682
|
+
storeConfig: { keyPath: 'url', autoIncrement: false },
|
|
683
|
+
storeSchema: [
|
|
684
|
+
{ name: 'regionID', keypath: 'regionID', options: { unique: false } }
|
|
685
|
+
]
|
|
686
|
+
}]
|
|
687
|
+
};
|
|
688
|
+
class IgoCoreModule {
|
|
689
|
+
constructor(matIconRegistry, domSanitizer) {
|
|
690
|
+
matIconRegistry.addSvgIconSet(domSanitizer.bypassSecurityTrustResourceUrl('./assets/igo2/core/icons/mdi.svg'));
|
|
691
|
+
}
|
|
692
|
+
static forRoot() {
|
|
693
|
+
return {
|
|
694
|
+
ngModule: IgoCoreModule,
|
|
695
|
+
providers: []
|
|
696
|
+
};
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
IgoCoreModule.ɵfac = function IgoCoreModule_Factory(t) { return new (t || IgoCoreModule)(i0.ɵɵinject(i1$2.MatIconRegistry), i0.ɵɵinject(i2.DomSanitizer)); };
|
|
700
|
+
IgoCoreModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoCoreModule });
|
|
701
|
+
IgoCoreModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
|
|
702
|
+
HttpClientModule,
|
|
703
|
+
IgoActivityModule.forRoot(),
|
|
704
|
+
IgoConfigModule.forRoot(),
|
|
705
|
+
IgoErrorModule.forRoot(),
|
|
706
|
+
IgoLanguageModule.forRoot(),
|
|
707
|
+
IgoMessageModule.forRoot(),
|
|
708
|
+
NgxIndexedDBModule.forRoot(dbConfig), IgoActivityModule,
|
|
709
|
+
IgoConfigModule,
|
|
710
|
+
IgoErrorModule,
|
|
711
|
+
IgoLanguageModule,
|
|
712
|
+
IgoMessageModule] });
|
|
713
|
+
(function () {
|
|
714
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoCoreModule, [{
|
|
715
|
+
type: NgModule,
|
|
716
|
+
args: [{
|
|
717
|
+
imports: [
|
|
718
|
+
CommonModule,
|
|
719
|
+
HttpClientModule,
|
|
720
|
+
IgoActivityModule.forRoot(),
|
|
721
|
+
IgoConfigModule.forRoot(),
|
|
722
|
+
IgoErrorModule.forRoot(),
|
|
723
|
+
IgoLanguageModule.forRoot(),
|
|
724
|
+
IgoMessageModule.forRoot(),
|
|
725
|
+
NgxIndexedDBModule.forRoot(dbConfig)
|
|
726
|
+
],
|
|
727
|
+
declarations: [],
|
|
728
|
+
exports: [
|
|
729
|
+
IgoActivityModule,
|
|
730
|
+
IgoConfigModule,
|
|
731
|
+
IgoErrorModule,
|
|
732
|
+
IgoLanguageModule,
|
|
733
|
+
IgoMessageModule
|
|
734
|
+
]
|
|
735
|
+
}]
|
|
736
|
+
}], function () { return [{ type: i1$2.MatIconRegistry }, { type: i2.DomSanitizer }]; }, null);
|
|
737
|
+
})();
|
|
738
|
+
(function () {
|
|
739
|
+
(typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(IgoCoreModule, { imports: [CommonModule,
|
|
740
|
+
HttpClientModule, IgoActivityModule, IgoConfigModule, IgoErrorModule, IgoLanguageModule, IgoMessageModule, i8.NgxIndexedDBModule], exports: [IgoActivityModule,
|
|
741
|
+
IgoConfigModule,
|
|
742
|
+
IgoErrorModule,
|
|
743
|
+
IgoLanguageModule,
|
|
744
|
+
IgoMessageModule] });
|
|
745
745
|
})();
|
|
746
746
|
|
|
747
|
-
class IgoGestureConfig extends HammerGestureConfig {
|
|
748
|
-
buildHammer(element) {
|
|
749
|
-
const mc = super.buildHammer(element);
|
|
750
|
-
mc.set({ touchAction: 'pan-y' });
|
|
751
|
-
return mc;
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
IgoGestureConfig.ɵfac = /*@__PURE__*/ function () { let ɵIgoGestureConfig_BaseFactory; return function IgoGestureConfig_Factory(t) { return (ɵIgoGestureConfig_BaseFactory || (ɵIgoGestureConfig_BaseFactory = i0.ɵɵgetInheritedFactory(IgoGestureConfig)))(t || IgoGestureConfig); }; }();
|
|
755
|
-
IgoGestureConfig.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: IgoGestureConfig, factory: IgoGestureConfig.ɵfac });
|
|
756
|
-
(function () {
|
|
757
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoGestureConfig, [{
|
|
758
|
-
type: Injectable
|
|
759
|
-
}], null, null);
|
|
747
|
+
class IgoGestureConfig extends HammerGestureConfig {
|
|
748
|
+
buildHammer(element) {
|
|
749
|
+
const mc = super.buildHammer(element);
|
|
750
|
+
mc.set({ touchAction: 'pan-y' });
|
|
751
|
+
return mc;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
IgoGestureConfig.ɵfac = /*@__PURE__*/ function () { let ɵIgoGestureConfig_BaseFactory; return function IgoGestureConfig_Factory(t) { return (ɵIgoGestureConfig_BaseFactory || (ɵIgoGestureConfig_BaseFactory = i0.ɵɵgetInheritedFactory(IgoGestureConfig)))(t || IgoGestureConfig); }; }();
|
|
755
|
+
IgoGestureConfig.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: IgoGestureConfig, factory: IgoGestureConfig.ɵfac });
|
|
756
|
+
(function () {
|
|
757
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoGestureConfig, [{
|
|
758
|
+
type: Injectable
|
|
759
|
+
}], null, null);
|
|
760
760
|
})();
|
|
761
761
|
|
|
762
|
-
class IgoGestureModule {
|
|
763
|
-
static forRoot() {
|
|
764
|
-
return {
|
|
765
|
-
ngModule: IgoGestureModule,
|
|
766
|
-
providers: [
|
|
767
|
-
{
|
|
768
|
-
provide: HAMMER_GESTURE_CONFIG,
|
|
769
|
-
useClass: IgoGestureConfig
|
|
770
|
-
}
|
|
771
|
-
]
|
|
772
|
-
};
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
IgoGestureModule.ɵfac = function IgoGestureModule_Factory(t) { return new (t || IgoGestureModule)(); };
|
|
776
|
-
IgoGestureModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoGestureModule });
|
|
777
|
-
IgoGestureModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [HammerModule] });
|
|
778
|
-
(function () {
|
|
779
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoGestureModule, [{
|
|
780
|
-
type: NgModule,
|
|
781
|
-
args: [{
|
|
782
|
-
imports: [HammerModule],
|
|
783
|
-
declarations: [],
|
|
784
|
-
exports: []
|
|
785
|
-
}]
|
|
786
|
-
}], null, null);
|
|
787
|
-
})();
|
|
762
|
+
class IgoGestureModule {
|
|
763
|
+
static forRoot() {
|
|
764
|
+
return {
|
|
765
|
+
ngModule: IgoGestureModule,
|
|
766
|
+
providers: [
|
|
767
|
+
{
|
|
768
|
+
provide: HAMMER_GESTURE_CONFIG,
|
|
769
|
+
useClass: IgoGestureConfig
|
|
770
|
+
}
|
|
771
|
+
]
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
IgoGestureModule.ɵfac = function IgoGestureModule_Factory(t) { return new (t || IgoGestureModule)(); };
|
|
776
|
+
IgoGestureModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoGestureModule });
|
|
777
|
+
IgoGestureModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [HammerModule] });
|
|
778
|
+
(function () {
|
|
779
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoGestureModule, [{
|
|
780
|
+
type: NgModule,
|
|
781
|
+
args: [{
|
|
782
|
+
imports: [HammerModule],
|
|
783
|
+
declarations: [],
|
|
784
|
+
exports: []
|
|
785
|
+
}]
|
|
786
|
+
}], null, null);
|
|
787
|
+
})();
|
|
788
788
|
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(IgoGestureModule, { imports: [HammerModule] }); })();
|
|
789
789
|
|
|
790
|
-
class LoggingInterceptor {
|
|
791
|
-
intercept(req, next) {
|
|
792
|
-
const started = Date.now();
|
|
793
|
-
let ok;
|
|
794
|
-
// extend server response observable with logging
|
|
795
|
-
return next.handle(req).pipe(tap(
|
|
796
|
-
// Succeeds when there is a response; ignore other events
|
|
797
|
-
event => (ok = event instanceof HttpResponse ? 'succeeded' : ''),
|
|
798
|
-
// Operation failed; error is an HttpErrorResponse
|
|
799
|
-
error => (ok = 'failed')),
|
|
800
|
-
// Log when response observable either completes or errors
|
|
801
|
-
finalize(() => {
|
|
802
|
-
const elapsed = Date.now() - started;
|
|
790
|
+
class LoggingInterceptor {
|
|
791
|
+
intercept(req, next) {
|
|
792
|
+
const started = Date.now();
|
|
793
|
+
let ok;
|
|
794
|
+
// extend server response observable with logging
|
|
795
|
+
return next.handle(req).pipe(tap(
|
|
796
|
+
// Succeeds when there is a response; ignore other events
|
|
797
|
+
event => (ok = event instanceof HttpResponse ? 'succeeded' : ''),
|
|
798
|
+
// Operation failed; error is an HttpErrorResponse
|
|
799
|
+
error => (ok = 'failed')),
|
|
800
|
+
// Log when response observable either completes or errors
|
|
801
|
+
finalize(() => {
|
|
802
|
+
const elapsed = Date.now() - started;
|
|
803
803
|
const msg = `${req.method} "${req.urlWithParams}"
|
|
804
|
-
${ok} in ${elapsed} ms.`;
|
|
805
|
-
console.log(msg);
|
|
806
|
-
}));
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
LoggingInterceptor.ɵfac = function LoggingInterceptor_Factory(t) { return new (t || LoggingInterceptor)(); };
|
|
810
|
-
LoggingInterceptor.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: LoggingInterceptor, factory: LoggingInterceptor.ɵfac });
|
|
811
|
-
(function () {
|
|
812
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(LoggingInterceptor, [{
|
|
813
|
-
type: Injectable
|
|
814
|
-
}], null, null);
|
|
804
|
+
${ok} in ${elapsed} ms.`;
|
|
805
|
+
console.log(msg);
|
|
806
|
+
}));
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
LoggingInterceptor.ɵfac = function LoggingInterceptor_Factory(t) { return new (t || LoggingInterceptor)(); };
|
|
810
|
+
LoggingInterceptor.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: LoggingInterceptor, factory: LoggingInterceptor.ɵfac });
|
|
811
|
+
(function () {
|
|
812
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(LoggingInterceptor, [{
|
|
813
|
+
type: Injectable
|
|
814
|
+
}], null, null);
|
|
815
815
|
})();
|
|
816
816
|
|
|
817
|
-
class IgoLoggingModule {
|
|
818
|
-
static forRoot() {
|
|
819
|
-
return {
|
|
820
|
-
ngModule: IgoLoggingModule,
|
|
821
|
-
providers: [
|
|
822
|
-
{
|
|
823
|
-
provide: HTTP_INTERCEPTORS,
|
|
824
|
-
useClass: LoggingInterceptor,
|
|
825
|
-
multi: true
|
|
826
|
-
}
|
|
827
|
-
]
|
|
828
|
-
};
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
IgoLoggingModule.ɵfac = function IgoLoggingModule_Factory(t) { return new (t || IgoLoggingModule)(); };
|
|
832
|
-
IgoLoggingModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoLoggingModule });
|
|
833
|
-
IgoLoggingModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
|
|
834
|
-
(function () {
|
|
835
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoLoggingModule, [{
|
|
836
|
-
type: NgModule,
|
|
837
|
-
args: [{
|
|
838
|
-
imports: [],
|
|
839
|
-
declarations: [],
|
|
840
|
-
exports: []
|
|
841
|
-
}]
|
|
842
|
-
}], null, null);
|
|
817
|
+
class IgoLoggingModule {
|
|
818
|
+
static forRoot() {
|
|
819
|
+
return {
|
|
820
|
+
ngModule: IgoLoggingModule,
|
|
821
|
+
providers: [
|
|
822
|
+
{
|
|
823
|
+
provide: HTTP_INTERCEPTORS,
|
|
824
|
+
useClass: LoggingInterceptor,
|
|
825
|
+
multi: true
|
|
826
|
+
}
|
|
827
|
+
]
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
IgoLoggingModule.ɵfac = function IgoLoggingModule_Factory(t) { return new (t || IgoLoggingModule)(); };
|
|
832
|
+
IgoLoggingModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoLoggingModule });
|
|
833
|
+
IgoLoggingModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
|
|
834
|
+
(function () {
|
|
835
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoLoggingModule, [{
|
|
836
|
+
type: NgModule,
|
|
837
|
+
args: [{
|
|
838
|
+
imports: [],
|
|
839
|
+
declarations: [],
|
|
840
|
+
exports: []
|
|
841
|
+
}]
|
|
842
|
+
}], null, null);
|
|
843
843
|
})();
|
|
844
844
|
|
|
845
|
-
let ROUTE_SERVICE_OPTIONS = new InjectionToken('routeServiceOptions');
|
|
846
|
-
function provideRouteServiceOptions(options) {
|
|
847
|
-
return {
|
|
848
|
-
provide: ROUTE_SERVICE_OPTIONS,
|
|
849
|
-
useValue: options
|
|
850
|
-
};
|
|
851
|
-
}
|
|
852
|
-
class RouteService {
|
|
853
|
-
constructor(router, route, options) {
|
|
854
|
-
this.router = router;
|
|
855
|
-
this.route = route;
|
|
856
|
-
const defaultOptions = {
|
|
857
|
-
centerKey: 'center',
|
|
858
|
-
zoomKey: 'zoom',
|
|
859
|
-
projectionKey: 'projection',
|
|
860
|
-
contextKey: 'context',
|
|
861
|
-
searchKey: 'search',
|
|
862
|
-
visibleOnLayersKey: 'visiblelayers',
|
|
863
|
-
visibleOffLayersKey: 'invisiblelayers',
|
|
864
|
-
directionsCoordKey: 'routing',
|
|
865
|
-
directionsOptionsKey: 'routingOptions',
|
|
866
|
-
toolKey: 'tool',
|
|
867
|
-
wmsUrlKey: 'wmsUrl',
|
|
868
|
-
wmsLayersKey: 'wmsLayers',
|
|
869
|
-
wmtsUrlKey: 'wmtsUrl',
|
|
870
|
-
wmtsLayersKey: 'wmtsLayers',
|
|
871
|
-
arcgisUrlKey: 'arcgisUrl',
|
|
872
|
-
arcgisLayersKey: 'arcgisLayers',
|
|
873
|
-
iarcgisUrlKey: 'iarcgisUrl',
|
|
874
|
-
iarcgisLayersKey: 'iarcgisLayers',
|
|
875
|
-
tarcgisUrlKey: 'tarcgisUrl',
|
|
876
|
-
tarcgisLayersKey: 'tarcgisLayers',
|
|
877
|
-
vectorKey: 'vector'
|
|
878
|
-
};
|
|
879
|
-
this.options = Object.assign({}, defaultOptions, options);
|
|
880
|
-
}
|
|
881
|
-
get queryParams() {
|
|
882
|
-
let url = decodeURIComponent(location.search);
|
|
883
|
-
if (url.includes('¢er=')) {
|
|
884
|
-
url = url.replace('¢er', '¢er');
|
|
885
|
-
const queryParams = url
|
|
886
|
-
.slice(1)
|
|
887
|
-
.split('&')
|
|
888
|
-
.map(p => p.split('='))
|
|
889
|
-
.reduce((obj, pair) => {
|
|
890
|
-
const [key, value] = pair.map(decodeURIComponent);
|
|
891
|
-
obj[key] = value;
|
|
892
|
-
return obj;
|
|
893
|
-
}, {});
|
|
894
|
-
this.router.navigate([], { queryParams });
|
|
895
|
-
}
|
|
896
|
-
return this.route.queryParams;
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
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)); };
|
|
900
|
-
RouteService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: RouteService, factory: RouteService.ɵfac, providedIn: 'root' });
|
|
901
|
-
(function () {
|
|
902
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RouteService, [{
|
|
903
|
-
type: Injectable,
|
|
904
|
-
args: [{
|
|
905
|
-
providedIn: 'root'
|
|
906
|
-
}]
|
|
907
|
-
}], function () {
|
|
908
|
-
return [{ type: i1$3.Router }, { type: i1$3.ActivatedRoute }, { type: undefined, decorators: [{
|
|
909
|
-
type: Inject,
|
|
910
|
-
args: [ROUTE_SERVICE_OPTIONS]
|
|
911
|
-
}, {
|
|
912
|
-
type: Optional
|
|
913
|
-
}] }];
|
|
914
|
-
}, null);
|
|
845
|
+
let ROUTE_SERVICE_OPTIONS = new InjectionToken('routeServiceOptions');
|
|
846
|
+
function provideRouteServiceOptions(options) {
|
|
847
|
+
return {
|
|
848
|
+
provide: ROUTE_SERVICE_OPTIONS,
|
|
849
|
+
useValue: options
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
class RouteService {
|
|
853
|
+
constructor(router, route, options) {
|
|
854
|
+
this.router = router;
|
|
855
|
+
this.route = route;
|
|
856
|
+
const defaultOptions = {
|
|
857
|
+
centerKey: 'center',
|
|
858
|
+
zoomKey: 'zoom',
|
|
859
|
+
projectionKey: 'projection',
|
|
860
|
+
contextKey: 'context',
|
|
861
|
+
searchKey: 'search',
|
|
862
|
+
visibleOnLayersKey: 'visiblelayers',
|
|
863
|
+
visibleOffLayersKey: 'invisiblelayers',
|
|
864
|
+
directionsCoordKey: 'routing',
|
|
865
|
+
directionsOptionsKey: 'routingOptions',
|
|
866
|
+
toolKey: 'tool',
|
|
867
|
+
wmsUrlKey: 'wmsUrl',
|
|
868
|
+
wmsLayersKey: 'wmsLayers',
|
|
869
|
+
wmtsUrlKey: 'wmtsUrl',
|
|
870
|
+
wmtsLayersKey: 'wmtsLayers',
|
|
871
|
+
arcgisUrlKey: 'arcgisUrl',
|
|
872
|
+
arcgisLayersKey: 'arcgisLayers',
|
|
873
|
+
iarcgisUrlKey: 'iarcgisUrl',
|
|
874
|
+
iarcgisLayersKey: 'iarcgisLayers',
|
|
875
|
+
tarcgisUrlKey: 'tarcgisUrl',
|
|
876
|
+
tarcgisLayersKey: 'tarcgisLayers',
|
|
877
|
+
vectorKey: 'vector'
|
|
878
|
+
};
|
|
879
|
+
this.options = Object.assign({}, defaultOptions, options);
|
|
880
|
+
}
|
|
881
|
+
get queryParams() {
|
|
882
|
+
let url = decodeURIComponent(location.search);
|
|
883
|
+
if (url.includes('¢er=')) {
|
|
884
|
+
url = url.replace('¢er', '¢er');
|
|
885
|
+
const queryParams = url
|
|
886
|
+
.slice(1)
|
|
887
|
+
.split('&')
|
|
888
|
+
.map(p => p.split('='))
|
|
889
|
+
.reduce((obj, pair) => {
|
|
890
|
+
const [key, value] = pair.map(decodeURIComponent);
|
|
891
|
+
obj[key] = value;
|
|
892
|
+
return obj;
|
|
893
|
+
}, {});
|
|
894
|
+
this.router.navigate([], { queryParams });
|
|
895
|
+
}
|
|
896
|
+
return this.route.queryParams;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
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)); };
|
|
900
|
+
RouteService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: RouteService, factory: RouteService.ɵfac, providedIn: 'root' });
|
|
901
|
+
(function () {
|
|
902
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RouteService, [{
|
|
903
|
+
type: Injectable,
|
|
904
|
+
args: [{
|
|
905
|
+
providedIn: 'root'
|
|
906
|
+
}]
|
|
907
|
+
}], function () {
|
|
908
|
+
return [{ type: i1$3.Router }, { type: i1$3.ActivatedRoute }, { type: undefined, decorators: [{
|
|
909
|
+
type: Inject,
|
|
910
|
+
args: [ROUTE_SERVICE_OPTIONS]
|
|
911
|
+
}, {
|
|
912
|
+
type: Optional
|
|
913
|
+
}] }];
|
|
914
|
+
}, null);
|
|
915
915
|
})();
|
|
916
916
|
|
|
917
|
-
class AnalyticsService {
|
|
918
|
-
constructor(config) {
|
|
919
|
-
this.config = config;
|
|
920
|
-
this.options = this.config.getConfig('analytics') || {};
|
|
921
|
-
if (this.options.provider === 'matomo') {
|
|
922
|
-
this.initMatomo();
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
get paq() {
|
|
926
|
-
return (window._paq = window._paq || []);
|
|
927
|
-
}
|
|
928
|
-
initMatomo() {
|
|
929
|
-
if (!this.options.url || !this.options.id) {
|
|
930
|
-
return;
|
|
931
|
-
}
|
|
932
|
-
const url = this.options.url.substr(-1) === '/'
|
|
933
|
-
? this.options.url + 'matomo'
|
|
934
|
-
: this.options.url;
|
|
935
|
-
// this.paq.push(['trackPageView']);
|
|
936
|
-
// this.paq.push(['enableLinkTracking']);
|
|
937
|
-
(() => {
|
|
938
|
-
this.paq.push(['setTrackerUrl', url + '.php']);
|
|
939
|
-
this.paq.push(['setSiteId', this.options.id]);
|
|
940
|
-
const g = document.createElement('script');
|
|
941
|
-
const s = document.getElementsByTagName('script')[0];
|
|
942
|
-
g.type = 'text/javascript';
|
|
943
|
-
g.async = true;
|
|
944
|
-
g.defer = true;
|
|
945
|
-
g.src = url + '.js';
|
|
946
|
-
s.parentNode.insertBefore(g, s);
|
|
947
|
-
})();
|
|
948
|
-
}
|
|
949
|
-
setUser(user, profils) {
|
|
950
|
-
if (this.options.provider === 'matomo') {
|
|
951
|
-
if (!user) {
|
|
952
|
-
this.paq.push(['resetUserId']);
|
|
953
|
-
this.paq.push(['deleteCustomVariable', 1, 'user']);
|
|
954
|
-
this.paq.push(['deleteCustomVariable', 2, 'name']);
|
|
955
|
-
this.paq.push(['deleteCustomVariable', 3, 'profils']);
|
|
956
|
-
}
|
|
957
|
-
else {
|
|
958
|
-
this.paq.push(['setUserId', user.id]);
|
|
959
|
-
const name = `${user.firstName} ${user.lastName}`;
|
|
960
|
-
this.paq.push(['setCustomVariable', 1, 'user', user.sourceId, 'visit']);
|
|
961
|
-
this.paq.push(['setCustomVariable', 2, 'name', name, 'visit']);
|
|
962
|
-
this.paq.push(['setCustomVariable', 3, 'profils', profils, 'visit']);
|
|
963
|
-
}
|
|
964
|
-
this.paq.push(['trackPageView']);
|
|
965
|
-
this.paq.push(['enableLinkTracking']);
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
trackSearch(term, nbResults) {
|
|
969
|
-
if (this.options.provider === 'matomo') {
|
|
970
|
-
this.paq.push(['trackSiteSearch', term, false, nbResults]);
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
trackEvent(category, action, name) {
|
|
974
|
-
if (this.options.provider === 'matomo') {
|
|
975
|
-
this.paq.push(['trackEvent', category, action, name]);
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
AnalyticsService.ɵfac = function AnalyticsService_Factory(t) { return new (t || AnalyticsService)(i0.ɵɵinject(ConfigService)); };
|
|
980
|
-
AnalyticsService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AnalyticsService, factory: AnalyticsService.ɵfac, providedIn: 'root' });
|
|
981
|
-
(function () {
|
|
982
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AnalyticsService, [{
|
|
983
|
-
type: Injectable,
|
|
984
|
-
args: [{
|
|
985
|
-
providedIn: 'root'
|
|
986
|
-
}]
|
|
987
|
-
}], function () { return [{ type: ConfigService }]; }, null);
|
|
917
|
+
class AnalyticsService {
|
|
918
|
+
constructor(config) {
|
|
919
|
+
this.config = config;
|
|
920
|
+
this.options = this.config.getConfig('analytics') || {};
|
|
921
|
+
if (this.options.provider === 'matomo') {
|
|
922
|
+
this.initMatomo();
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
get paq() {
|
|
926
|
+
return (window._paq = window._paq || []);
|
|
927
|
+
}
|
|
928
|
+
initMatomo() {
|
|
929
|
+
if (!this.options.url || !this.options.id) {
|
|
930
|
+
return;
|
|
931
|
+
}
|
|
932
|
+
const url = this.options.url.substr(-1) === '/'
|
|
933
|
+
? this.options.url + 'matomo'
|
|
934
|
+
: this.options.url;
|
|
935
|
+
// this.paq.push(['trackPageView']);
|
|
936
|
+
// this.paq.push(['enableLinkTracking']);
|
|
937
|
+
(() => {
|
|
938
|
+
this.paq.push(['setTrackerUrl', url + '.php']);
|
|
939
|
+
this.paq.push(['setSiteId', this.options.id]);
|
|
940
|
+
const g = document.createElement('script');
|
|
941
|
+
const s = document.getElementsByTagName('script')[0];
|
|
942
|
+
g.type = 'text/javascript';
|
|
943
|
+
g.async = true;
|
|
944
|
+
g.defer = true;
|
|
945
|
+
g.src = url + '.js';
|
|
946
|
+
s.parentNode.insertBefore(g, s);
|
|
947
|
+
})();
|
|
948
|
+
}
|
|
949
|
+
setUser(user, profils) {
|
|
950
|
+
if (this.options.provider === 'matomo') {
|
|
951
|
+
if (!user) {
|
|
952
|
+
this.paq.push(['resetUserId']);
|
|
953
|
+
this.paq.push(['deleteCustomVariable', 1, 'user']);
|
|
954
|
+
this.paq.push(['deleteCustomVariable', 2, 'name']);
|
|
955
|
+
this.paq.push(['deleteCustomVariable', 3, 'profils']);
|
|
956
|
+
}
|
|
957
|
+
else {
|
|
958
|
+
this.paq.push(['setUserId', user.id]);
|
|
959
|
+
const name = `${user.firstName} ${user.lastName}`;
|
|
960
|
+
this.paq.push(['setCustomVariable', 1, 'user', user.sourceId, 'visit']);
|
|
961
|
+
this.paq.push(['setCustomVariable', 2, 'name', name, 'visit']);
|
|
962
|
+
this.paq.push(['setCustomVariable', 3, 'profils', profils, 'visit']);
|
|
963
|
+
}
|
|
964
|
+
this.paq.push(['trackPageView']);
|
|
965
|
+
this.paq.push(['enableLinkTracking']);
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
trackSearch(term, nbResults) {
|
|
969
|
+
if (this.options.provider === 'matomo') {
|
|
970
|
+
this.paq.push(['trackSiteSearch', term, false, nbResults]);
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
trackEvent(category, action, name) {
|
|
974
|
+
if (this.options.provider === 'matomo') {
|
|
975
|
+
this.paq.push(['trackEvent', category, action, name]);
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
AnalyticsService.ɵfac = function AnalyticsService_Factory(t) { return new (t || AnalyticsService)(i0.ɵɵinject(ConfigService)); };
|
|
980
|
+
AnalyticsService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AnalyticsService, factory: AnalyticsService.ɵfac, providedIn: 'root' });
|
|
981
|
+
(function () {
|
|
982
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AnalyticsService, [{
|
|
983
|
+
type: Injectable,
|
|
984
|
+
args: [{
|
|
985
|
+
providedIn: 'root'
|
|
986
|
+
}]
|
|
987
|
+
}], function () { return [{ type: ConfigService }]; }, null);
|
|
988
988
|
})();
|
|
989
989
|
|
|
990
|
-
var Media;
|
|
991
|
-
(function (Media) {
|
|
992
|
-
Media["Mobile"] = "mobile";
|
|
993
|
-
Media["Tablet"] = "tablet";
|
|
994
|
-
Media["Desktop"] = "desktop";
|
|
995
|
-
})(Media || (Media = {}));
|
|
996
|
-
var MediaOrientation;
|
|
997
|
-
(function (MediaOrientation) {
|
|
998
|
-
MediaOrientation["Portrait"] = "portrait";
|
|
999
|
-
MediaOrientation["Landscape"] = "landscape";
|
|
990
|
+
var Media;
|
|
991
|
+
(function (Media) {
|
|
992
|
+
Media["Mobile"] = "mobile";
|
|
993
|
+
Media["Tablet"] = "tablet";
|
|
994
|
+
Media["Desktop"] = "desktop";
|
|
995
|
+
})(Media || (Media = {}));
|
|
996
|
+
var MediaOrientation;
|
|
997
|
+
(function (MediaOrientation) {
|
|
998
|
+
MediaOrientation["Portrait"] = "portrait";
|
|
999
|
+
MediaOrientation["Landscape"] = "landscape";
|
|
1000
1000
|
})(MediaOrientation || (MediaOrientation = {}));
|
|
1001
1001
|
|
|
1002
|
-
class MediaService {
|
|
1003
|
-
constructor(breakpointObserver) {
|
|
1004
|
-
this.media$ = new BehaviorSubject(undefined);
|
|
1005
|
-
this.orientation$ = new BehaviorSubject(undefined);
|
|
1006
|
-
breakpointObserver
|
|
1007
|
-
.observe([Breakpoints.HandsetLandscape])
|
|
1008
|
-
.subscribe(res => {
|
|
1009
|
-
if (res.matches) {
|
|
1010
|
-
this.media$.next(Media.Mobile);
|
|
1011
|
-
this.orientation$.next(MediaOrientation.Landscape);
|
|
1012
|
-
}
|
|
1013
|
-
});
|
|
1014
|
-
breakpointObserver.observe([Breakpoints.HandsetPortrait]).subscribe(res => {
|
|
1015
|
-
if (res.matches) {
|
|
1016
|
-
this.media$.next(Media.Mobile);
|
|
1017
|
-
this.orientation$.next(MediaOrientation.Portrait);
|
|
1018
|
-
}
|
|
1019
|
-
});
|
|
1020
|
-
breakpointObserver.observe([Breakpoints.TabletLandscape]).subscribe(res => {
|
|
1021
|
-
if (res.matches) {
|
|
1022
|
-
this.media$.next(Media.Tablet);
|
|
1023
|
-
this.orientation$.next(MediaOrientation.Landscape);
|
|
1024
|
-
}
|
|
1025
|
-
});
|
|
1026
|
-
breakpointObserver.observe([Breakpoints.TabletPortrait]).subscribe(res => {
|
|
1027
|
-
if (res.matches) {
|
|
1028
|
-
this.media$.next(Media.Tablet);
|
|
1029
|
-
this.orientation$.next(MediaOrientation.Portrait);
|
|
1030
|
-
}
|
|
1031
|
-
});
|
|
1032
|
-
breakpointObserver.observe([Breakpoints.WebLandscape]).subscribe(res => {
|
|
1033
|
-
if (res.matches) {
|
|
1034
|
-
this.media$.next(Media.Desktop);
|
|
1035
|
-
this.orientation$.next(MediaOrientation.Landscape);
|
|
1036
|
-
}
|
|
1037
|
-
});
|
|
1038
|
-
breakpointObserver.observe([Breakpoints.WebPortrait]).subscribe(res => {
|
|
1039
|
-
if (res.matches) {
|
|
1040
|
-
this.media$.next(Media.Desktop);
|
|
1041
|
-
this.orientation$.next(MediaOrientation.Portrait);
|
|
1042
|
-
}
|
|
1043
|
-
});
|
|
1044
|
-
}
|
|
1045
|
-
getMedia() {
|
|
1046
|
-
return this.media$.value;
|
|
1047
|
-
}
|
|
1048
|
-
getOrientation() {
|
|
1049
|
-
return this.orientation$.value;
|
|
1050
|
-
}
|
|
1051
|
-
isTouchScreen() {
|
|
1052
|
-
return 'ontouchstart' in document.documentElement ? true : false;
|
|
1053
|
-
}
|
|
1054
|
-
isMobile() {
|
|
1055
|
-
const media = this.getMedia();
|
|
1056
|
-
return media === 'mobile';
|
|
1057
|
-
}
|
|
1058
|
-
isDesktop() {
|
|
1059
|
-
const media = this.getMedia();
|
|
1060
|
-
return media === 'desktop';
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
MediaService.ɵfac = function MediaService_Factory(t) { return new (t || MediaService)(i0.ɵɵinject(i1$4.BreakpointObserver)); };
|
|
1064
|
-
MediaService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: MediaService, factory: MediaService.ɵfac, providedIn: 'root' });
|
|
1065
|
-
(function () {
|
|
1066
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MediaService, [{
|
|
1067
|
-
type: Injectable,
|
|
1068
|
-
args: [{
|
|
1069
|
-
providedIn: 'root'
|
|
1070
|
-
}]
|
|
1071
|
-
}], function () { return [{ type: i1$4.BreakpointObserver }]; }, null);
|
|
1002
|
+
class MediaService {
|
|
1003
|
+
constructor(breakpointObserver) {
|
|
1004
|
+
this.media$ = new BehaviorSubject(undefined);
|
|
1005
|
+
this.orientation$ = new BehaviorSubject(undefined);
|
|
1006
|
+
breakpointObserver
|
|
1007
|
+
.observe([Breakpoints.HandsetLandscape])
|
|
1008
|
+
.subscribe(res => {
|
|
1009
|
+
if (res.matches) {
|
|
1010
|
+
this.media$.next(Media.Mobile);
|
|
1011
|
+
this.orientation$.next(MediaOrientation.Landscape);
|
|
1012
|
+
}
|
|
1013
|
+
});
|
|
1014
|
+
breakpointObserver.observe([Breakpoints.HandsetPortrait]).subscribe(res => {
|
|
1015
|
+
if (res.matches) {
|
|
1016
|
+
this.media$.next(Media.Mobile);
|
|
1017
|
+
this.orientation$.next(MediaOrientation.Portrait);
|
|
1018
|
+
}
|
|
1019
|
+
});
|
|
1020
|
+
breakpointObserver.observe([Breakpoints.TabletLandscape]).subscribe(res => {
|
|
1021
|
+
if (res.matches) {
|
|
1022
|
+
this.media$.next(Media.Tablet);
|
|
1023
|
+
this.orientation$.next(MediaOrientation.Landscape);
|
|
1024
|
+
}
|
|
1025
|
+
});
|
|
1026
|
+
breakpointObserver.observe([Breakpoints.TabletPortrait]).subscribe(res => {
|
|
1027
|
+
if (res.matches) {
|
|
1028
|
+
this.media$.next(Media.Tablet);
|
|
1029
|
+
this.orientation$.next(MediaOrientation.Portrait);
|
|
1030
|
+
}
|
|
1031
|
+
});
|
|
1032
|
+
breakpointObserver.observe([Breakpoints.WebLandscape]).subscribe(res => {
|
|
1033
|
+
if (res.matches) {
|
|
1034
|
+
this.media$.next(Media.Desktop);
|
|
1035
|
+
this.orientation$.next(MediaOrientation.Landscape);
|
|
1036
|
+
}
|
|
1037
|
+
});
|
|
1038
|
+
breakpointObserver.observe([Breakpoints.WebPortrait]).subscribe(res => {
|
|
1039
|
+
if (res.matches) {
|
|
1040
|
+
this.media$.next(Media.Desktop);
|
|
1041
|
+
this.orientation$.next(MediaOrientation.Portrait);
|
|
1042
|
+
}
|
|
1043
|
+
});
|
|
1044
|
+
}
|
|
1045
|
+
getMedia() {
|
|
1046
|
+
return this.media$.value;
|
|
1047
|
+
}
|
|
1048
|
+
getOrientation() {
|
|
1049
|
+
return this.orientation$.value;
|
|
1050
|
+
}
|
|
1051
|
+
isTouchScreen() {
|
|
1052
|
+
return 'ontouchstart' in document.documentElement ? true : false;
|
|
1053
|
+
}
|
|
1054
|
+
isMobile() {
|
|
1055
|
+
const media = this.getMedia();
|
|
1056
|
+
return media === 'mobile';
|
|
1057
|
+
}
|
|
1058
|
+
isDesktop() {
|
|
1059
|
+
const media = this.getMedia();
|
|
1060
|
+
return media === 'desktop';
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
MediaService.ɵfac = function MediaService_Factory(t) { return new (t || MediaService)(i0.ɵɵinject(i1$4.BreakpointObserver)); };
|
|
1064
|
+
MediaService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: MediaService, factory: MediaService.ɵfac, providedIn: 'root' });
|
|
1065
|
+
(function () {
|
|
1066
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MediaService, [{
|
|
1067
|
+
type: Injectable,
|
|
1068
|
+
args: [{
|
|
1069
|
+
providedIn: 'root'
|
|
1070
|
+
}]
|
|
1071
|
+
}], function () { return [{ type: i1$4.BreakpointObserver }]; }, null);
|
|
1072
1072
|
})();
|
|
1073
1073
|
|
|
1074
|
-
var StorageScope;
|
|
1075
|
-
(function (StorageScope) {
|
|
1076
|
-
StorageScope["SESSION"] = "Session";
|
|
1077
|
-
StorageScope["LOCAL"] = "Local";
|
|
1078
|
-
})(StorageScope || (StorageScope = {}));
|
|
1079
|
-
var StorageServiceEventEnum;
|
|
1080
|
-
(function (StorageServiceEventEnum) {
|
|
1081
|
-
StorageServiceEventEnum["ADDED"] = "Added";
|
|
1082
|
-
StorageServiceEventEnum["MODIFIED"] = "Modified";
|
|
1083
|
-
StorageServiceEventEnum["REMOVED"] = "Removed";
|
|
1084
|
-
StorageServiceEventEnum["CLEARED"] = "Cleared";
|
|
1074
|
+
var StorageScope;
|
|
1075
|
+
(function (StorageScope) {
|
|
1076
|
+
StorageScope["SESSION"] = "Session";
|
|
1077
|
+
StorageScope["LOCAL"] = "Local";
|
|
1078
|
+
})(StorageScope || (StorageScope = {}));
|
|
1079
|
+
var StorageServiceEventEnum;
|
|
1080
|
+
(function (StorageServiceEventEnum) {
|
|
1081
|
+
StorageServiceEventEnum["ADDED"] = "Added";
|
|
1082
|
+
StorageServiceEventEnum["MODIFIED"] = "Modified";
|
|
1083
|
+
StorageServiceEventEnum["REMOVED"] = "Removed";
|
|
1084
|
+
StorageServiceEventEnum["CLEARED"] = "Cleared";
|
|
1085
1085
|
})(StorageServiceEventEnum || (StorageServiceEventEnum = {}));
|
|
1086
1086
|
|
|
1087
|
-
class StorageService {
|
|
1088
|
-
constructor(config) {
|
|
1089
|
-
this.config = config;
|
|
1090
|
-
this.storageChange$ = new BehaviorSubject(undefined);
|
|
1091
|
-
this.options = this.config.getConfig('storage') || { key: 'igo' };
|
|
1092
|
-
}
|
|
1093
|
-
/**
|
|
1094
|
-
* Use to get the data found in storage file
|
|
1095
|
-
*/
|
|
1096
|
-
get(key, scope) {
|
|
1097
|
-
let value;
|
|
1098
|
-
if (!scope || scope === StorageScope.SESSION) {
|
|
1099
|
-
value = sessionStorage.getItem(`${this.options.key}.${key}`);
|
|
1100
|
-
}
|
|
1101
|
-
if (scope === StorageScope.LOCAL || (!value && !scope)) {
|
|
1102
|
-
value = localStorage.getItem(`${this.options.key}.${key}`);
|
|
1103
|
-
}
|
|
1104
|
-
if (value) {
|
|
1105
|
-
try {
|
|
1106
|
-
value = JSON.parse(value);
|
|
1107
|
-
}
|
|
1108
|
-
catch (_a) {
|
|
1109
|
-
value = value;
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
|
-
return value;
|
|
1113
|
-
}
|
|
1114
|
-
set(key, value, scope = StorageScope.LOCAL) {
|
|
1115
|
-
const previousValue = this.get(key, scope);
|
|
1116
|
-
if (scope === StorageScope.SESSION) {
|
|
1117
|
-
sessionStorage.setItem(`${this.options.key}.${key}`, JSON.stringify(value));
|
|
1118
|
-
}
|
|
1119
|
-
else {
|
|
1120
|
-
localStorage.setItem(`${this.options.key}.${key}`, JSON.stringify(value));
|
|
1121
|
-
}
|
|
1122
|
-
const currentValue = this.get(key, scope);
|
|
1123
|
-
if (currentValue !== previousValue) {
|
|
1124
|
-
this.storageChange$.next({
|
|
1125
|
-
key, scope,
|
|
1126
|
-
event: previousValue !== undefined ? StorageServiceEventEnum.MODIFIED : StorageServiceEventEnum.ADDED,
|
|
1127
|
-
previousValue,
|
|
1128
|
-
currentValue
|
|
1129
|
-
});
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
remove(key, scope = StorageScope.LOCAL) {
|
|
1133
|
-
const previousValue = this.get(key, scope);
|
|
1134
|
-
if (scope === StorageScope.SESSION) {
|
|
1135
|
-
sessionStorage.removeItem(`${this.options.key}.${key}`);
|
|
1136
|
-
}
|
|
1137
|
-
else {
|
|
1138
|
-
localStorage.removeItem(`${this.options.key}.${key}`);
|
|
1139
|
-
}
|
|
1140
|
-
this.storageChange$.next({ key, scope, event: StorageServiceEventEnum.REMOVED, previousValue });
|
|
1141
|
-
}
|
|
1142
|
-
clear(scope = StorageScope.LOCAL) {
|
|
1143
|
-
if (scope === StorageScope.SESSION) {
|
|
1144
|
-
sessionStorage.clear();
|
|
1145
|
-
}
|
|
1146
|
-
else {
|
|
1147
|
-
localStorage.clear();
|
|
1148
|
-
}
|
|
1149
|
-
this.storageChange$.next({ scope, event: StorageServiceEventEnum.CLEARED });
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
StorageService.ɵfac = function StorageService_Factory(t) { return new (t || StorageService)(i0.ɵɵinject(ConfigService)); };
|
|
1153
|
-
StorageService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: StorageService, factory: StorageService.ɵfac, providedIn: 'root' });
|
|
1154
|
-
(function () {
|
|
1155
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(StorageService, [{
|
|
1156
|
-
type: Injectable,
|
|
1157
|
-
args: [{
|
|
1158
|
-
providedIn: 'root'
|
|
1159
|
-
}]
|
|
1160
|
-
}], function () { return [{ type: ConfigService }]; }, null);
|
|
1087
|
+
class StorageService {
|
|
1088
|
+
constructor(config) {
|
|
1089
|
+
this.config = config;
|
|
1090
|
+
this.storageChange$ = new BehaviorSubject(undefined);
|
|
1091
|
+
this.options = this.config.getConfig('storage') || { key: 'igo' };
|
|
1092
|
+
}
|
|
1093
|
+
/**
|
|
1094
|
+
* Use to get the data found in storage file
|
|
1095
|
+
*/
|
|
1096
|
+
get(key, scope) {
|
|
1097
|
+
let value;
|
|
1098
|
+
if (!scope || scope === StorageScope.SESSION) {
|
|
1099
|
+
value = sessionStorage.getItem(`${this.options.key}.${key}`);
|
|
1100
|
+
}
|
|
1101
|
+
if (scope === StorageScope.LOCAL || (!value && !scope)) {
|
|
1102
|
+
value = localStorage.getItem(`${this.options.key}.${key}`);
|
|
1103
|
+
}
|
|
1104
|
+
if (value) {
|
|
1105
|
+
try {
|
|
1106
|
+
value = JSON.parse(value);
|
|
1107
|
+
}
|
|
1108
|
+
catch (_a) {
|
|
1109
|
+
value = value;
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
return value;
|
|
1113
|
+
}
|
|
1114
|
+
set(key, value, scope = StorageScope.LOCAL) {
|
|
1115
|
+
const previousValue = this.get(key, scope);
|
|
1116
|
+
if (scope === StorageScope.SESSION) {
|
|
1117
|
+
sessionStorage.setItem(`${this.options.key}.${key}`, JSON.stringify(value));
|
|
1118
|
+
}
|
|
1119
|
+
else {
|
|
1120
|
+
localStorage.setItem(`${this.options.key}.${key}`, JSON.stringify(value));
|
|
1121
|
+
}
|
|
1122
|
+
const currentValue = this.get(key, scope);
|
|
1123
|
+
if (currentValue !== previousValue) {
|
|
1124
|
+
this.storageChange$.next({
|
|
1125
|
+
key, scope,
|
|
1126
|
+
event: previousValue !== undefined ? StorageServiceEventEnum.MODIFIED : StorageServiceEventEnum.ADDED,
|
|
1127
|
+
previousValue,
|
|
1128
|
+
currentValue
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
remove(key, scope = StorageScope.LOCAL) {
|
|
1133
|
+
const previousValue = this.get(key, scope);
|
|
1134
|
+
if (scope === StorageScope.SESSION) {
|
|
1135
|
+
sessionStorage.removeItem(`${this.options.key}.${key}`);
|
|
1136
|
+
}
|
|
1137
|
+
else {
|
|
1138
|
+
localStorage.removeItem(`${this.options.key}.${key}`);
|
|
1139
|
+
}
|
|
1140
|
+
this.storageChange$.next({ key, scope, event: StorageServiceEventEnum.REMOVED, previousValue });
|
|
1141
|
+
}
|
|
1142
|
+
clear(scope = StorageScope.LOCAL) {
|
|
1143
|
+
if (scope === StorageScope.SESSION) {
|
|
1144
|
+
sessionStorage.clear();
|
|
1145
|
+
}
|
|
1146
|
+
else {
|
|
1147
|
+
localStorage.clear();
|
|
1148
|
+
}
|
|
1149
|
+
this.storageChange$.next({ scope, event: StorageServiceEventEnum.CLEARED });
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
StorageService.ɵfac = function StorageService_Factory(t) { return new (t || StorageService)(i0.ɵɵinject(ConfigService)); };
|
|
1153
|
+
StorageService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: StorageService, factory: StorageService.ɵfac, providedIn: 'root' });
|
|
1154
|
+
(function () {
|
|
1155
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(StorageService, [{
|
|
1156
|
+
type: Injectable,
|
|
1157
|
+
args: [{
|
|
1158
|
+
providedIn: 'root'
|
|
1159
|
+
}]
|
|
1160
|
+
}], function () { return [{ type: ConfigService }]; }, null);
|
|
1161
1161
|
})();
|
|
1162
1162
|
|
|
1163
|
-
function getNumber(v, endposition, length) {
|
|
1164
|
-
/* tslint:disable:no-bitwise*/
|
|
1165
|
-
const mask = ((1 << length) - 1);
|
|
1166
|
-
return (v >> endposition) & mask;
|
|
1167
|
-
/* tslint:enable:no-bitwise*/
|
|
1168
|
-
}
|
|
1169
|
-
class CompressionService {
|
|
1170
|
-
constructor() {
|
|
1171
|
-
this.base64Index = new Map();
|
|
1172
|
-
this.indexBase64 = new Map();
|
|
1173
|
-
this.generateBase64Index();
|
|
1174
|
-
}
|
|
1175
|
-
generateBase64Index() {
|
|
1176
|
-
// https://fr.wikipedia.org/wiki/Base64
|
|
1177
|
-
// A-Z => [0, 25]
|
|
1178
|
-
for (let i = 0; i < 26; i++) {
|
|
1179
|
-
this.base64Index.set(String.fromCharCode('A'.charCodeAt(0) + i), i);
|
|
1180
|
-
this.indexBase64.set(i, String.fromCharCode('A'.charCodeAt(0) + i));
|
|
1181
|
-
}
|
|
1182
|
-
// a-z => [26, 51]
|
|
1183
|
-
for (let i = 0; i < 26; i++) {
|
|
1184
|
-
this.base64Index.set(String.fromCharCode('a'.charCodeAt(0) + i), i + 26);
|
|
1185
|
-
this.indexBase64.set(i + 26, String.fromCharCode('a'.charCodeAt(0) + i));
|
|
1186
|
-
}
|
|
1187
|
-
// 0-9 => [52, 61]
|
|
1188
|
-
for (let i = 0; i < 10; i++) {
|
|
1189
|
-
this.base64Index.set(String.fromCharCode('0'.charCodeAt(0) + i), i + 52);
|
|
1190
|
-
this.indexBase64.set(i + 52, String.fromCharCode('0'.charCodeAt(0) + i));
|
|
1191
|
-
}
|
|
1192
|
-
// + / => [62, 63]
|
|
1193
|
-
this.base64Index.set('+', 62);
|
|
1194
|
-
this.base64Index.set('/', 63);
|
|
1195
|
-
this.indexBase64.set(62, '+');
|
|
1196
|
-
this.indexBase64.set(63, '/');
|
|
1197
|
-
}
|
|
1198
|
-
compressBlob(blob) {
|
|
1199
|
-
if (!blob) {
|
|
1200
|
-
return;
|
|
1201
|
-
}
|
|
1202
|
-
const observable = new Observable((observer) => {
|
|
1203
|
-
const reader = new FileReader();
|
|
1204
|
-
reader.readAsDataURL(blob);
|
|
1205
|
-
reader.onload = () => {
|
|
1206
|
-
const base64 = reader.result.valueOf();
|
|
1207
|
-
const text64 = base64.substr(base64.indexOf(',') + 1);
|
|
1208
|
-
const compressed = this.compressStringBase64(text64);
|
|
1209
|
-
const compressedData = { length: text64.length,
|
|
1210
|
-
type: blob.type,
|
|
1211
|
-
object: compressed };
|
|
1212
|
-
observer.next(compressedData);
|
|
1213
|
-
};
|
|
1214
|
-
});
|
|
1215
|
-
return observable;
|
|
1216
|
-
}
|
|
1217
|
-
decompressBlob(compressedData) {
|
|
1218
|
-
/* tslint:disable:no-bitwise*/
|
|
1219
|
-
const object = compressedData.object;
|
|
1220
|
-
const length = compressedData.length;
|
|
1221
|
-
const decompressed = this.decompressStringBase64(object, length);
|
|
1222
|
-
const byteCharacters = atob(decompressed);
|
|
1223
|
-
const byteNumbers = new Array(byteCharacters.length);
|
|
1224
|
-
for (let i = 0; i < byteCharacters.length; i++) {
|
|
1225
|
-
byteNumbers[i] = byteCharacters.charCodeAt(i);
|
|
1226
|
-
}
|
|
1227
|
-
const byteArray = new Uint8Array(byteNumbers);
|
|
1228
|
-
const blob = new Blob([byteArray], { type: compressedData.type });
|
|
1229
|
-
/* tslint:enable:no-bitwise*/
|
|
1230
|
-
return blob;
|
|
1231
|
-
}
|
|
1232
|
-
compressStringBase64(s) {
|
|
1233
|
-
/* tslint:disable:no-bitwise*/
|
|
1234
|
-
let out = '';
|
|
1235
|
-
let bits = 16;
|
|
1236
|
-
let chr = 0;
|
|
1237
|
-
let rem = 0;
|
|
1238
|
-
for (const c of s) {
|
|
1239
|
-
const value = this.base64Index.get(c);
|
|
1240
|
-
if (bits > 6) {
|
|
1241
|
-
bits -= 6;
|
|
1242
|
-
chr += value << bits;
|
|
1243
|
-
}
|
|
1244
|
-
else {
|
|
1245
|
-
rem = 6 - bits;
|
|
1246
|
-
chr += value >> rem;
|
|
1247
|
-
out += String.fromCharCode(chr);
|
|
1248
|
-
chr = (value) << (16 - rem);
|
|
1249
|
-
bits = 16 - rem;
|
|
1250
|
-
}
|
|
1251
|
-
}
|
|
1252
|
-
if (s.length % 8 !== 0) {
|
|
1253
|
-
out += String.fromCharCode(chr);
|
|
1254
|
-
}
|
|
1255
|
-
/* tslint:enable:no-bitwise*/
|
|
1256
|
-
return String.fromCharCode(9731) + out;
|
|
1257
|
-
}
|
|
1258
|
-
decompressStringBase64(c, length) {
|
|
1259
|
-
/* tslint:disable:no-bitwise*/
|
|
1260
|
-
if (!c) {
|
|
1261
|
-
return;
|
|
1262
|
-
}
|
|
1263
|
-
if (c.charCodeAt(0) !== 9731) {
|
|
1264
|
-
return c;
|
|
1265
|
-
}
|
|
1266
|
-
let chr = 0;
|
|
1267
|
-
let rem = 0;
|
|
1268
|
-
let bits = 16;
|
|
1269
|
-
let out = '';
|
|
1270
|
-
let j = 1;
|
|
1271
|
-
let value = c.charCodeAt(j);
|
|
1272
|
-
for (let i = 0; i < length; i++) {
|
|
1273
|
-
if (bits > 6) {
|
|
1274
|
-
bits -= 6;
|
|
1275
|
-
chr = getNumber(value, bits, 6);
|
|
1276
|
-
out += this.indexBase64.get(chr);
|
|
1277
|
-
}
|
|
1278
|
-
else {
|
|
1279
|
-
rem = 6 - bits;
|
|
1280
|
-
chr = getNumber(value, 0, bits) << rem;
|
|
1281
|
-
value = c.charCodeAt(++j);
|
|
1282
|
-
chr += getNumber(value, 16 - rem, rem);
|
|
1283
|
-
out += this.indexBase64.get(chr);
|
|
1284
|
-
bits = 16 - rem;
|
|
1285
|
-
}
|
|
1286
|
-
}
|
|
1287
|
-
return out;
|
|
1288
|
-
/* tslint:enable:no-bitwise*/
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
CompressionService.ɵfac = function CompressionService_Factory(t) { return new (t || CompressionService)(); };
|
|
1292
|
-
CompressionService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: CompressionService, factory: CompressionService.ɵfac, providedIn: 'root' });
|
|
1293
|
-
(function () {
|
|
1294
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CompressionService, [{
|
|
1295
|
-
type: Injectable,
|
|
1296
|
-
args: [{
|
|
1297
|
-
providedIn: 'root'
|
|
1298
|
-
}]
|
|
1299
|
-
}], function () { return []; }, null);
|
|
1163
|
+
function getNumber(v, endposition, length) {
|
|
1164
|
+
/* tslint:disable:no-bitwise*/
|
|
1165
|
+
const mask = ((1 << length) - 1);
|
|
1166
|
+
return (v >> endposition) & mask;
|
|
1167
|
+
/* tslint:enable:no-bitwise*/
|
|
1168
|
+
}
|
|
1169
|
+
class CompressionService {
|
|
1170
|
+
constructor() {
|
|
1171
|
+
this.base64Index = new Map();
|
|
1172
|
+
this.indexBase64 = new Map();
|
|
1173
|
+
this.generateBase64Index();
|
|
1174
|
+
}
|
|
1175
|
+
generateBase64Index() {
|
|
1176
|
+
// https://fr.wikipedia.org/wiki/Base64
|
|
1177
|
+
// A-Z => [0, 25]
|
|
1178
|
+
for (let i = 0; i < 26; i++) {
|
|
1179
|
+
this.base64Index.set(String.fromCharCode('A'.charCodeAt(0) + i), i);
|
|
1180
|
+
this.indexBase64.set(i, String.fromCharCode('A'.charCodeAt(0) + i));
|
|
1181
|
+
}
|
|
1182
|
+
// a-z => [26, 51]
|
|
1183
|
+
for (let i = 0; i < 26; i++) {
|
|
1184
|
+
this.base64Index.set(String.fromCharCode('a'.charCodeAt(0) + i), i + 26);
|
|
1185
|
+
this.indexBase64.set(i + 26, String.fromCharCode('a'.charCodeAt(0) + i));
|
|
1186
|
+
}
|
|
1187
|
+
// 0-9 => [52, 61]
|
|
1188
|
+
for (let i = 0; i < 10; i++) {
|
|
1189
|
+
this.base64Index.set(String.fromCharCode('0'.charCodeAt(0) + i), i + 52);
|
|
1190
|
+
this.indexBase64.set(i + 52, String.fromCharCode('0'.charCodeAt(0) + i));
|
|
1191
|
+
}
|
|
1192
|
+
// + / => [62, 63]
|
|
1193
|
+
this.base64Index.set('+', 62);
|
|
1194
|
+
this.base64Index.set('/', 63);
|
|
1195
|
+
this.indexBase64.set(62, '+');
|
|
1196
|
+
this.indexBase64.set(63, '/');
|
|
1197
|
+
}
|
|
1198
|
+
compressBlob(blob) {
|
|
1199
|
+
if (!blob) {
|
|
1200
|
+
return;
|
|
1201
|
+
}
|
|
1202
|
+
const observable = new Observable((observer) => {
|
|
1203
|
+
const reader = new FileReader();
|
|
1204
|
+
reader.readAsDataURL(blob);
|
|
1205
|
+
reader.onload = () => {
|
|
1206
|
+
const base64 = reader.result.valueOf();
|
|
1207
|
+
const text64 = base64.substr(base64.indexOf(',') + 1);
|
|
1208
|
+
const compressed = this.compressStringBase64(text64);
|
|
1209
|
+
const compressedData = { length: text64.length,
|
|
1210
|
+
type: blob.type,
|
|
1211
|
+
object: compressed };
|
|
1212
|
+
observer.next(compressedData);
|
|
1213
|
+
};
|
|
1214
|
+
});
|
|
1215
|
+
return observable;
|
|
1216
|
+
}
|
|
1217
|
+
decompressBlob(compressedData) {
|
|
1218
|
+
/* tslint:disable:no-bitwise*/
|
|
1219
|
+
const object = compressedData.object;
|
|
1220
|
+
const length = compressedData.length;
|
|
1221
|
+
const decompressed = this.decompressStringBase64(object, length);
|
|
1222
|
+
const byteCharacters = atob(decompressed);
|
|
1223
|
+
const byteNumbers = new Array(byteCharacters.length);
|
|
1224
|
+
for (let i = 0; i < byteCharacters.length; i++) {
|
|
1225
|
+
byteNumbers[i] = byteCharacters.charCodeAt(i);
|
|
1226
|
+
}
|
|
1227
|
+
const byteArray = new Uint8Array(byteNumbers);
|
|
1228
|
+
const blob = new Blob([byteArray], { type: compressedData.type });
|
|
1229
|
+
/* tslint:enable:no-bitwise*/
|
|
1230
|
+
return blob;
|
|
1231
|
+
}
|
|
1232
|
+
compressStringBase64(s) {
|
|
1233
|
+
/* tslint:disable:no-bitwise*/
|
|
1234
|
+
let out = '';
|
|
1235
|
+
let bits = 16;
|
|
1236
|
+
let chr = 0;
|
|
1237
|
+
let rem = 0;
|
|
1238
|
+
for (const c of s) {
|
|
1239
|
+
const value = this.base64Index.get(c);
|
|
1240
|
+
if (bits > 6) {
|
|
1241
|
+
bits -= 6;
|
|
1242
|
+
chr += value << bits;
|
|
1243
|
+
}
|
|
1244
|
+
else {
|
|
1245
|
+
rem = 6 - bits;
|
|
1246
|
+
chr += value >> rem;
|
|
1247
|
+
out += String.fromCharCode(chr);
|
|
1248
|
+
chr = (value) << (16 - rem);
|
|
1249
|
+
bits = 16 - rem;
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
if (s.length % 8 !== 0) {
|
|
1253
|
+
out += String.fromCharCode(chr);
|
|
1254
|
+
}
|
|
1255
|
+
/* tslint:enable:no-bitwise*/
|
|
1256
|
+
return String.fromCharCode(9731) + out;
|
|
1257
|
+
}
|
|
1258
|
+
decompressStringBase64(c, length) {
|
|
1259
|
+
/* tslint:disable:no-bitwise*/
|
|
1260
|
+
if (!c) {
|
|
1261
|
+
return;
|
|
1262
|
+
}
|
|
1263
|
+
if (c.charCodeAt(0) !== 9731) {
|
|
1264
|
+
return c;
|
|
1265
|
+
}
|
|
1266
|
+
let chr = 0;
|
|
1267
|
+
let rem = 0;
|
|
1268
|
+
let bits = 16;
|
|
1269
|
+
let out = '';
|
|
1270
|
+
let j = 1;
|
|
1271
|
+
let value = c.charCodeAt(j);
|
|
1272
|
+
for (let i = 0; i < length; i++) {
|
|
1273
|
+
if (bits > 6) {
|
|
1274
|
+
bits -= 6;
|
|
1275
|
+
chr = getNumber(value, bits, 6);
|
|
1276
|
+
out += this.indexBase64.get(chr);
|
|
1277
|
+
}
|
|
1278
|
+
else {
|
|
1279
|
+
rem = 6 - bits;
|
|
1280
|
+
chr = getNumber(value, 0, bits) << rem;
|
|
1281
|
+
value = c.charCodeAt(++j);
|
|
1282
|
+
chr += getNumber(value, 16 - rem, rem);
|
|
1283
|
+
out += this.indexBase64.get(chr);
|
|
1284
|
+
bits = 16 - rem;
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
return out;
|
|
1288
|
+
/* tslint:enable:no-bitwise*/
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
CompressionService.ɵfac = function CompressionService_Factory(t) { return new (t || CompressionService)(); };
|
|
1292
|
+
CompressionService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: CompressionService, factory: CompressionService.ɵfac, providedIn: 'root' });
|
|
1293
|
+
(function () {
|
|
1294
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CompressionService, [{
|
|
1295
|
+
type: Injectable,
|
|
1296
|
+
args: [{
|
|
1297
|
+
providedIn: 'root'
|
|
1298
|
+
}]
|
|
1299
|
+
}], function () { return []; }, null);
|
|
1300
1300
|
})();
|
|
1301
1301
|
|
|
1302
|
-
class NetworkService {
|
|
1303
|
-
constructor(messageService, injector) {
|
|
1304
|
-
this.messageService = messageService;
|
|
1305
|
-
this.injector = injector;
|
|
1306
|
-
this.stateChangeEventEmitter = new EventEmitter();
|
|
1307
|
-
this.state = {
|
|
1308
|
-
connection: window.navigator.onLine
|
|
1309
|
-
};
|
|
1310
|
-
this.checkNetworkState();
|
|
1311
|
-
}
|
|
1312
|
-
checkNetworkState() {
|
|
1313
|
-
this.onlineSubscription = fromEvent(window, 'online').subscribe(() => {
|
|
1314
|
-
if (this.previousMessageId) {
|
|
1315
|
-
this.messageService.remove(this.previousMessageId);
|
|
1316
|
-
}
|
|
1317
|
-
const translate = this.injector.get(LanguageService).translate;
|
|
1318
|
-
const message = translate.instant('igo.core.network.online.message');
|
|
1319
|
-
const title = translate.instant('igo.core.network.online.title');
|
|
1320
|
-
const messageObj = this.messageService.info(message, title);
|
|
1321
|
-
this.previousMessageId = messageObj.toastId;
|
|
1322
|
-
this.state.connection = true;
|
|
1323
|
-
this.emitEvent();
|
|
1324
|
-
});
|
|
1325
|
-
this.offlineSubscription = fromEvent(window, 'offline').subscribe(() => {
|
|
1326
|
-
if (this.previousMessageId) {
|
|
1327
|
-
this.messageService.remove(this.previousMessageId);
|
|
1328
|
-
}
|
|
1329
|
-
const translate = this.injector.get(LanguageService).translate;
|
|
1330
|
-
const message = translate.instant('igo.core.network.offline.message');
|
|
1331
|
-
const title = translate.instant('igo.core.network.offline.title');
|
|
1332
|
-
const messageObj = this.messageService.info(message, title);
|
|
1333
|
-
this.previousMessageId = messageObj.toastId;
|
|
1334
|
-
this.state.connection = false;
|
|
1335
|
-
this.emitEvent();
|
|
1336
|
-
});
|
|
1337
|
-
}
|
|
1338
|
-
emitEvent() {
|
|
1339
|
-
this.stateChangeEventEmitter.emit(this.state);
|
|
1340
|
-
}
|
|
1341
|
-
ngOnDestroy() {
|
|
1342
|
-
try {
|
|
1343
|
-
this.offlineSubscription.unsubscribe();
|
|
1344
|
-
this.onlineSubscription.unsubscribe();
|
|
1345
|
-
}
|
|
1346
|
-
catch (e) { }
|
|
1347
|
-
}
|
|
1348
|
-
currentState(reportState = true) {
|
|
1349
|
-
return reportState
|
|
1350
|
-
? this.stateChangeEventEmitter.pipe(debounceTime(300), startWith(this.state))
|
|
1351
|
-
: this.stateChangeEventEmitter.pipe(debounceTime(300));
|
|
1352
|
-
}
|
|
1353
|
-
}
|
|
1354
|
-
NetworkService.ɵfac = function NetworkService_Factory(t) { return new (t || NetworkService)(i0.ɵɵinject(MessageService), i0.ɵɵinject(i0.Injector)); };
|
|
1355
|
-
NetworkService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: NetworkService, factory: NetworkService.ɵfac, providedIn: 'root' });
|
|
1356
|
-
(function () {
|
|
1357
|
-
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NetworkService, [{
|
|
1358
|
-
type: Injectable,
|
|
1359
|
-
args: [{
|
|
1360
|
-
providedIn: 'root'
|
|
1361
|
-
}]
|
|
1362
|
-
}], function () { return [{ type: MessageService }, { type: i0.Injector }]; }, null);
|
|
1302
|
+
class NetworkService {
|
|
1303
|
+
constructor(messageService, injector) {
|
|
1304
|
+
this.messageService = messageService;
|
|
1305
|
+
this.injector = injector;
|
|
1306
|
+
this.stateChangeEventEmitter = new EventEmitter();
|
|
1307
|
+
this.state = {
|
|
1308
|
+
connection: window.navigator.onLine
|
|
1309
|
+
};
|
|
1310
|
+
this.checkNetworkState();
|
|
1311
|
+
}
|
|
1312
|
+
checkNetworkState() {
|
|
1313
|
+
this.onlineSubscription = fromEvent(window, 'online').subscribe(() => {
|
|
1314
|
+
if (this.previousMessageId) {
|
|
1315
|
+
this.messageService.remove(this.previousMessageId);
|
|
1316
|
+
}
|
|
1317
|
+
const translate = this.injector.get(LanguageService).translate;
|
|
1318
|
+
const message = translate.instant('igo.core.network.online.message');
|
|
1319
|
+
const title = translate.instant('igo.core.network.online.title');
|
|
1320
|
+
const messageObj = this.messageService.info(message, title);
|
|
1321
|
+
this.previousMessageId = messageObj.toastId;
|
|
1322
|
+
this.state.connection = true;
|
|
1323
|
+
this.emitEvent();
|
|
1324
|
+
});
|
|
1325
|
+
this.offlineSubscription = fromEvent(window, 'offline').subscribe(() => {
|
|
1326
|
+
if (this.previousMessageId) {
|
|
1327
|
+
this.messageService.remove(this.previousMessageId);
|
|
1328
|
+
}
|
|
1329
|
+
const translate = this.injector.get(LanguageService).translate;
|
|
1330
|
+
const message = translate.instant('igo.core.network.offline.message');
|
|
1331
|
+
const title = translate.instant('igo.core.network.offline.title');
|
|
1332
|
+
const messageObj = this.messageService.info(message, title);
|
|
1333
|
+
this.previousMessageId = messageObj.toastId;
|
|
1334
|
+
this.state.connection = false;
|
|
1335
|
+
this.emitEvent();
|
|
1336
|
+
});
|
|
1337
|
+
}
|
|
1338
|
+
emitEvent() {
|
|
1339
|
+
this.stateChangeEventEmitter.emit(this.state);
|
|
1340
|
+
}
|
|
1341
|
+
ngOnDestroy() {
|
|
1342
|
+
try {
|
|
1343
|
+
this.offlineSubscription.unsubscribe();
|
|
1344
|
+
this.onlineSubscription.unsubscribe();
|
|
1345
|
+
}
|
|
1346
|
+
catch (e) { }
|
|
1347
|
+
}
|
|
1348
|
+
currentState(reportState = true) {
|
|
1349
|
+
return reportState
|
|
1350
|
+
? this.stateChangeEventEmitter.pipe(debounceTime(300), startWith(this.state))
|
|
1351
|
+
: this.stateChangeEventEmitter.pipe(debounceTime(300));
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
NetworkService.ɵfac = function NetworkService_Factory(t) { return new (t || NetworkService)(i0.ɵɵinject(MessageService), i0.ɵɵinject(i0.Injector)); };
|
|
1355
|
+
NetworkService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: NetworkService, factory: NetworkService.ɵfac, providedIn: 'root' });
|
|
1356
|
+
(function () {
|
|
1357
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NetworkService, [{
|
|
1358
|
+
type: Injectable,
|
|
1359
|
+
args: [{
|
|
1360
|
+
providedIn: 'root'
|
|
1361
|
+
}]
|
|
1362
|
+
}], function () { return [{ type: MessageService }, { type: i0.Injector }]; }, null);
|
|
1363
|
+
})();
|
|
1364
|
+
|
|
1365
|
+
class RegexService {
|
|
1366
|
+
constructor(config) {
|
|
1367
|
+
this.config = config;
|
|
1368
|
+
this.options = this.config.getConfig('regex');
|
|
1369
|
+
}
|
|
1370
|
+
getAll() {
|
|
1371
|
+
return this.options;
|
|
1372
|
+
}
|
|
1373
|
+
get(key) {
|
|
1374
|
+
if (this.options) {
|
|
1375
|
+
return this.options[key];
|
|
1376
|
+
}
|
|
1377
|
+
return;
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
RegexService.ɵfac = function RegexService_Factory(t) { return new (t || RegexService)(i0.ɵɵinject(ConfigService)); };
|
|
1381
|
+
RegexService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: RegexService, factory: RegexService.ɵfac, providedIn: 'root' });
|
|
1382
|
+
(function () {
|
|
1383
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RegexService, [{
|
|
1384
|
+
type: Injectable,
|
|
1385
|
+
args: [{
|
|
1386
|
+
providedIn: 'root'
|
|
1387
|
+
}]
|
|
1388
|
+
}], function () { return [{ type: ConfigService }]; }, null);
|
|
1363
1389
|
})();
|
|
1364
1390
|
|
|
1365
|
-
/*
|
|
1366
|
-
* Public API Surface of core
|
|
1391
|
+
/*
|
|
1392
|
+
* Public API Surface of core
|
|
1367
1393
|
*/
|
|
1368
1394
|
|
|
1369
|
-
/**
|
|
1370
|
-
* Generated bundle index. Do not edit.
|
|
1395
|
+
/**
|
|
1396
|
+
* Generated bundle index. Do not edit.
|
|
1371
1397
|
*/
|
|
1372
1398
|
|
|
1373
|
-
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, RouteService, StorageScope, StorageService, StorageServiceEventEnum, configFactory, defaultLanguageLoader, provideConfigLoader, provideConfigOptions, provideDefaultLanguageLoader, provideLanguageLoader, provideRouteServiceOptions, version };
|
|
1399
|
+
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 };
|
|
1374
1400
|
//# sourceMappingURL=igo2-core.mjs.map
|