@igo2/core 1.15.3 → 16.0.0-rc.0

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