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