@gen-epix/ui-client-common 4.5.0 → 4.6.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 (229) hide show
  1. package/README.md +5 -4
  2. package/dist/@types/mui.d.ts +13 -5
  3. package/dist/@types/ui-client-common.d.ts +1 -0
  4. package/dist/_chunks/ApplicationFooter.js +45 -46
  5. package/dist/_chunks/ApplicationFooter.js.map +1 -1
  6. package/dist/_chunks/Breadcrumbs.js +14 -15
  7. package/dist/_chunks/CrudPage.js +301 -302
  8. package/dist/_chunks/CrudPage.js.map +1 -1
  9. package/dist/_chunks/GeoFilter.js +1 -2
  10. package/dist/_chunks/GeoFilter.js.map +1 -1
  11. package/dist/_chunks/Notifications.js +52 -53
  12. package/dist/_chunks/OutageList.js +30 -31
  13. package/dist/_chunks/OutageList.js.map +1 -1
  14. package/dist/_chunks/OutageUtil.js +4 -8
  15. package/dist/_chunks/OutageUtil.js.map +1 -1
  16. package/dist/_chunks/QueryClientProvider.js +1 -2
  17. package/dist/_chunks/QueryClientProvider.js.map +1 -1
  18. package/dist/_chunks/QueryClientService.js +101 -395
  19. package/dist/_chunks/QueryClientService.js.map +1 -1
  20. package/dist/_chunks/Reflect.js +1 -2
  21. package/dist/_chunks/Table.js +523 -522
  22. package/dist/_chunks/Table.js.map +1 -1
  23. package/dist/_chunks/TableUtil.js +10 -20
  24. package/dist/_chunks/TableUtil.js.map +1 -1
  25. package/dist/_chunks/TextFilter.js +18 -20
  26. package/dist/_chunks/TextFilter.js.map +1 -1
  27. package/dist/_chunks/UserInvitationsAdminPage.js +78 -79
  28. package/dist/_chunks/UserInvitationsAdminPage.js.map +1 -1
  29. package/dist/_chunks/UserManagerUtil.js +212 -213
  30. package/dist/_chunks/UserManagerUtil.js.map +1 -1
  31. package/dist/_chunks/_baseAssignValue.js +1 -2
  32. package/dist/_chunks/_baseFlatten.js +9 -10
  33. package/dist/_chunks/_baseFlatten.js.map +1 -1
  34. package/dist/_chunks/_baseGet.js +279 -0
  35. package/dist/_chunks/_baseGet.js.map +1 -0
  36. package/dist/_chunks/_baseIteratee.js +273 -0
  37. package/dist/_chunks/_baseIteratee.js.map +1 -0
  38. package/dist/_chunks/_baseUnset.js +22 -300
  39. package/dist/_chunks/_baseUnset.js.map +1 -1
  40. package/dist/_chunks/_cacheHas.js +1 -2
  41. package/dist/_chunks/_setToString.js +1 -2
  42. package/dist/_chunks/decorate.js +1 -2
  43. package/dist/_chunks/decorateParam.js +1 -2
  44. package/dist/_chunks/format.js +27 -54
  45. package/dist/_chunks/format.js.map +1 -1
  46. package/dist/_chunks/isArrayLike.js +1 -2
  47. package/dist/_chunks/isObject.js +1 -2
  48. package/dist/_chunks/isSymbol.js +1 -2
  49. package/dist/_chunks/last.js +12 -0
  50. package/dist/_chunks/last.js.map +1 -0
  51. package/dist/_chunks/middleware.js +2 -3
  52. package/dist/_chunks/middleware.js.map +1 -1
  53. package/dist/_chunks/omit.js +42 -42
  54. package/dist/_chunks/omit.js.map +1 -1
  55. package/dist/_chunks/query.js +8 -15
  56. package/dist/_chunks/query.js.map +1 -1
  57. package/dist/_chunks/react.js +2 -3
  58. package/dist/_chunks/react.js.map +1 -1
  59. package/dist/_chunks/rolldown-runtime.js +2 -3
  60. package/dist/_chunks/tableStore.js +231 -224
  61. package/dist/_chunks/tableStore.js.map +1 -1
  62. package/dist/_chunks/toDate.js +8 -14
  63. package/dist/_chunks/toDate.js.map +1 -1
  64. package/dist/_chunks/uniq.js +43 -0
  65. package/dist/_chunks/uniq.js.map +1 -0
  66. package/dist/_chunks/useColumnsMenu.js +3 -6
  67. package/dist/_chunks/useColumnsMenu.js.map +1 -1
  68. package/dist/_chunks/useMutation.js +24 -26
  69. package/dist/_chunks/useMutation.js.map +1 -1
  70. package/dist/_chunks/useQueryMemo.js +33 -22
  71. package/dist/_chunks/useQueryMemo.js.map +1 -1
  72. package/dist/_chunks/vanilla.js +1 -2
  73. package/dist/_chunks/vanilla.js.map +1 -1
  74. package/dist/_chunks/yup.js +2 -4
  75. package/dist/_chunks/yup.js.map +1 -1
  76. package/dist/classes/TableEventBus/index.js +1 -2
  77. package/dist/classes/abstracts/FilterAbstract/index.js +4 -3
  78. package/dist/classes/abstracts/FilterAbstract/index.js.map +1 -1
  79. package/dist/classes/filters/MultiSelectFilter.d.ts +1 -1
  80. package/dist/classes/services/AuthenticationService/AuthenticationService.d.ts +1 -1
  81. package/dist/classes/services/AuthenticationService/index.js +15 -16
  82. package/dist/classes/services/AuthenticationService/index.js.map +1 -1
  83. package/dist/classes/services/AuthorizationService/index.js +5 -6
  84. package/dist/classes/services/AuthorizationService/index.js.map +1 -1
  85. package/dist/classes/services/BackendVersionService/index.js +4 -4
  86. package/dist/classes/services/BackendVersionService/index.js.map +1 -1
  87. package/dist/classes/services/BreadcrumbService/index.js +16 -39
  88. package/dist/classes/services/BreadcrumbService/index.js.map +1 -1
  89. package/dist/classes/services/EmotionCacheService/index.js +10 -10
  90. package/dist/classes/services/EmotionCacheService/index.js.map +1 -1
  91. package/dist/classes/services/FeatureFlagsService/index.js +1 -2
  92. package/dist/classes/services/I18nService/index.js +12 -12
  93. package/dist/classes/services/I18nService/index.js.map +1 -1
  94. package/dist/classes/services/InactivityService/index.js +13 -14
  95. package/dist/classes/services/InactivityService/index.js.map +1 -1
  96. package/dist/classes/services/LogService/index.js +40 -35
  97. package/dist/classes/services/LogService/index.js.map +1 -1
  98. package/dist/classes/services/NavigationHistoryService/index.js +1 -2
  99. package/dist/classes/services/NotificationService/index.js +9 -10
  100. package/dist/classes/services/NotificationService/index.js.map +1 -1
  101. package/dist/classes/services/PageEventBusService/index.js +14 -11
  102. package/dist/classes/services/PageEventBusService/index.js.map +1 -1
  103. package/dist/classes/services/RouterService/index.js +4 -8
  104. package/dist/classes/services/RouterService/index.js.map +1 -1
  105. package/dist/classes/services/UserSettingsService/index.js +1 -2
  106. package/dist/components/app/App/App.d.ts +1 -1
  107. package/dist/components/app/App/index.js +35 -40
  108. package/dist/components/app/App/index.js.map +1 -1
  109. package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js +29 -30
  110. package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js.map +1 -1
  111. package/dist/components/app/ApplicationBootstrapWithoutAuthorization/index.js +48 -47
  112. package/dist/components/app/ApplicationBootstrapWithoutAuthorization/index.js.map +1 -1
  113. package/dist/components/app/AuthenticationWrapper/index.js +36 -37
  114. package/dist/components/app/AuthenticationWrapper/index.js.map +1 -1
  115. package/dist/components/app/AuthorizationWrapper/index.js +20 -21
  116. package/dist/components/app/AuthorizationWrapper/index.js.map +1 -1
  117. package/dist/components/app/RouterRoot/index.js +53 -52
  118. package/dist/components/app/RouterRoot/index.js.map +1 -1
  119. package/dist/components/epi/EpiContactDetailsDialog/index.js +22 -23
  120. package/dist/components/filters/BooleanFilterField/index.js +6 -7
  121. package/dist/components/filters/DateFilterField/index.js +4 -5
  122. package/dist/components/filters/GeoFilterField/index.js +5 -6
  123. package/dist/components/filters/MultiSelectFilterField/index.js +5 -6
  124. package/dist/components/filters/NumberRangeFilterField/index.js +4 -5
  125. package/dist/components/filters/TextFilterField/index.js +4 -5
  126. package/dist/components/ui/ApplicationBar/index.js +189 -190
  127. package/dist/components/ui/ApplicationBar/index.js.map +1 -1
  128. package/dist/components/ui/ConsentDialog/index.js +1 -2
  129. package/dist/components/ui/GenericErrorMessage/index.js +30 -31
  130. package/dist/components/ui/LicensesDialog/index.js +39 -40
  131. package/dist/components/ui/LicensesDialog/index.js.map +1 -1
  132. package/dist/components/ui/MyPermissionsDialog/index.js +17 -18
  133. package/dist/components/ui/NavLink/index.js +7 -8
  134. package/dist/components/ui/OrganizationSwitcherDialog/index.js +22 -23
  135. package/dist/components/ui/OrganizationSwitcherDialog/index.js.map +1 -1
  136. package/dist/components/ui/OutagesDialog/index.js +1 -2
  137. package/dist/components/ui/PageContainer/index.js +25 -26
  138. package/dist/components/ui/PageContainer/index.js.map +1 -1
  139. package/dist/components/ui/ResponseHandler/index.js +1 -2
  140. package/dist/components/ui/Sidebar/index.js +31 -32
  141. package/dist/components/ui/UserFeedbackDialog/index.js +13 -14
  142. package/dist/components/ui/UserInactivityConfirmation/index.js +1 -2
  143. package/dist/constants/api.constants.js +1 -2
  144. package/dist/constants/config.constants.d.ts +0 -2
  145. package/dist/constants/config.constants.js +3 -4
  146. package/dist/constants/config.constants.js.map +1 -1
  147. package/dist/constants/query.constants.js +1 -2
  148. package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/index.js +13 -14
  149. package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/index.js.map +1 -1
  150. package/dist/dataHooks/useIdentifierIssuerQuery/index.js +15 -16
  151. package/dist/dataHooks/useIdentifierIssuerQuery/index.js.map +1 -1
  152. package/dist/dataHooks/useInviteUserConstraintsQuery/index.js +13 -14
  153. package/dist/dataHooks/useInviteUserConstraintsQuery/index.js.map +1 -1
  154. package/dist/dataHooks/useOrganizationAdminPoliciesQuery/index.js +14 -15
  155. package/dist/dataHooks/useOrganizationAdminPoliciesQuery/index.js.map +1 -1
  156. package/dist/dataHooks/useOrganizationIdentifierIssuerLinksQuery/index.js +5 -6
  157. package/dist/dataHooks/useOrganizationsQuery/index.js +14 -15
  158. package/dist/dataHooks/useOrganizationsQuery/index.js.map +1 -1
  159. package/dist/dataHooks/useUsersQuery/index.js +11 -12
  160. package/dist/dataHooks/useUsersQuery/index.js.map +1 -1
  161. package/dist/hoc/withPermissions/index.js +1 -2
  162. package/dist/hooks/useConfig/index.js +3 -4
  163. package/dist/hooks/useConfig/index.js.map +1 -1
  164. package/dist/hooks/useCreateMutation/index.js +13 -14
  165. package/dist/hooks/useCreateMutation/index.js.map +1 -1
  166. package/dist/hooks/useDeleteMutation/index.js +17 -11
  167. package/dist/hooks/useDeleteMutation/index.js.map +1 -1
  168. package/dist/hooks/useEditMutation/index.js +49 -35
  169. package/dist/hooks/useEditMutation/index.js.map +1 -1
  170. package/dist/hooks/useInitializeTableStore/index.js +1 -2
  171. package/dist/hooks/useItemQuery/index.js +5 -6
  172. package/dist/hooks/useItemQuery/index.js.map +1 -1
  173. package/dist/hooks/useUpdateBreadcrumb/index.js +1 -2
  174. package/dist/hooks/useUpdateDocumentTitle/index.js +1 -2
  175. package/dist/locale/en.json +1 -0
  176. package/dist/locale/nl.json +1 -0
  177. package/dist/models/admin.models.js +1 -2
  178. package/dist/models/admin.models.js.map +1 -1
  179. package/dist/models/config.models.d.ts +1 -5
  180. package/dist/models/table.models.js +1 -2
  181. package/dist/models/table.models.js.map +1 -1
  182. package/dist/models/theme.models.d.ts +19 -16
  183. package/dist/pages/AcceptInvitationPage/index.js +26 -27
  184. package/dist/pages/AcceptInvitationPage/index.js.map +1 -1
  185. package/dist/pages/AdminPage/index.js +17 -18
  186. package/dist/pages/ChooseIdentityProviderPage/index.js +22 -23
  187. package/dist/pages/ErrorPage/index.js +1 -2
  188. package/dist/pages/IdentifierIssuersAdminPage/index.js +6 -7
  189. package/dist/pages/OrganizationAdminPoliciesAdminPage/index.js +6 -7
  190. package/dist/pages/OrganizationContactsAdminPage/index.js +7 -8
  191. package/dist/pages/OrganizationSitesAdminPage/index.js +10 -11
  192. package/dist/pages/OrganizationsAdminPage/index.js +14 -15
  193. package/dist/pages/OrganizationsAdminPage/index.js.map +1 -1
  194. package/dist/pages/OutagesAdminPage/index.js +21 -22
  195. package/dist/pages/PostLoginPage/index.js +8 -9
  196. package/dist/pages/PostLoginPage/index.js.map +1 -1
  197. package/dist/pages/PostLogoutPage/index.js +9 -10
  198. package/dist/pages/RouterErrorPage/index.js +1 -2
  199. package/dist/pages/UsersAdminPage/index.js +40 -41
  200. package/dist/pages/UsersAdminPage/index.js.map +1 -1
  201. package/dist/routes/index.js +1 -2
  202. package/dist/setup/setup.js +12 -6
  203. package/dist/setup/setup.js.map +1 -1
  204. package/dist/stores/oidcStore/index.js +1 -2
  205. package/dist/stores/outagesStore/index.js +1 -2
  206. package/dist/theme/demoTheme/index.js +18 -17
  207. package/dist/theme/demoTheme/index.js.map +1 -1
  208. package/dist/utils/AxiosUtil/index.js +1 -2
  209. package/dist/utils/DataHookUtil/index.js +2 -3
  210. package/dist/utils/DataHookUtil/index.js.map +1 -1
  211. package/dist/utils/DependencyContainerUtil/DependencyContainerUtil.d.ts +2 -3
  212. package/dist/utils/DependencyContainerUtil/index.js +10 -16
  213. package/dist/utils/DependencyContainerUtil/index.js.map +1 -1
  214. package/dist/utils/LoadableUtil/index.js +1 -2
  215. package/dist/utils/MenuDataUtil/index.js +2 -3
  216. package/dist/utils/MenuDataUtil/index.js.map +1 -1
  217. package/dist/utils/NotificationUtil/index.js +1 -2
  218. package/dist/utils/StandardConfigUtil/index.js +1 -6
  219. package/dist/utils/StandardConfigUtil/index.js.map +1 -1
  220. package/dist/utils/TimeUtil/index.js +2 -3
  221. package/dist/utils/TimeUtil/index.js.map +1 -1
  222. package/dist/utils/UserUtil/index.js +1 -2
  223. package/package.json +26 -29
  224. package/dist/context/ClientCommonConfigContext/ClientCommonConfigContext.d.ts +0 -9
  225. package/dist/context/ClientCommonConfigContext/ClientCommonConfigContextProvider.d.ts +0 -6
  226. package/dist/context/ClientCommonConfigContext/index.d.ts +0 -3
  227. package/dist/context/ClientCommonConfigContext/index.js +0 -34
  228. package/dist/context/ClientCommonConfigContext/index.js.map +0 -1
  229. package/dist/context/ClientCommonConfigContext/useClientCommonConfigContext.d.ts +0 -3
@@ -1,48 +1,25 @@
1
- import { n as e, t } from "../../../_chunks/rolldown-runtime.js";
2
- import { t as n } from "../../../_chunks/isObject.js";
3
- import { a as r, g as i, i as a } from "../../../_chunks/_baseUnset.js";
4
- import { t as o } from "../../../_chunks/decorate.js";
5
- import { n as s, t as c } from "../../../_chunks/omit.js";
6
- import { singleton as l } from "tsyringe";
7
- import { Subject as u } from "@gen-epix/ui-core/classes/Subject";
8
- import { SubscribableAbstract as d } from "@gen-epix/ui-core/classes/abstracts/SubscribableAbstract";
9
- //#region ../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_baseSet.js
10
- var f = /* @__PURE__ */ t(((e, t) => {
11
- var o = s(), c = r(), l = i(), u = n(), d = a();
12
- function f(e, t, n, r) {
13
- if (!u(e)) return e;
14
- t = c(t, e);
15
- for (var i = -1, a = t.length, s = a - 1, f = e; f != null && ++i < a;) {
16
- var p = d(t[i]), m = n;
17
- if (p === "__proto__" || p === "constructor" || p === "prototype") return e;
18
- if (i != s) {
19
- var h = f[p];
20
- m = r ? r(h, p, f) : void 0, m === void 0 && (m = u(h) ? h : l(t[i + 1]) ? [] : {});
21
- }
22
- o(f, p, m), f = f[p];
23
- }
24
- return e;
25
- }
26
- t.exports = f;
27
- })), p = /* @__PURE__ */ t(((e, t) => {
28
- var n = f();
29
- function r(e, t, r) {
30
- return e == null ? e : n(e, t, r);
31
- }
32
- t.exports = r;
33
- })), m = /* @__PURE__ */ e(c(), 1), h = /* @__PURE__ */ e(p(), 1), g = class extends d {
1
+ import { n as e } from "../../../_chunks/rolldown-runtime.js";
2
+ import { t } from "../../../_chunks/decorate.js";
3
+ import { t as n } from "../../../_chunks/omit.js";
4
+ import { singleton as r } from "tsyringe";
5
+ import { Subject as i } from "@gen-epix/ui-core/classes/Subject";
6
+ import { SubscribableAbstract as a } from "@gen-epix/ui-core/classes/abstracts/SubscribableAbstract";
7
+ // src/classes/services/BreadcrumbService/BreadcrumbService.ts
8
+ var o = /* @__PURE__ */ e(n(), 1), s = class extends a {
34
9
  constructor() {
35
- super(new u({}));
10
+ super(new i({}));
36
11
  }
37
12
  remove(e) {
38
- this.subject.next({ ...(0, m.default)(this.subject, e) });
13
+ this.subject.next({ ...(0, o.default)(this.subject.data, e) });
39
14
  }
40
15
  update(e, t) {
41
- this.subject.next({ ...(0, h.default)(this.subject.data, e, t) });
16
+ this.subject.next({
17
+ ...this.subject.data,
18
+ [e]: t
19
+ });
42
20
  }
43
21
  };
44
- g = o([l()], g);
45
- //#endregion
46
- export { g as BreadcrumbService };
22
+ s = t([r()], s);
23
+ export { s as BreadcrumbService };
47
24
 
48
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["omit","set","_decorate","__toESM","require_isObject","require__castPath","require__isIndex","require__toKey","__decorate","require__assignValue","require_omit","require__baseSet","assignValue","castPath","isIndex","isObject","toKey","baseSet","object","path","index","length","lastIndex","nested","key","newValue","value","objValue","customizer","require_set","set","import_omit","import_set","BreadcrumbService","SubscribableAbstract","Subject","position","title","singleton"],"sources":["../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_baseSet.js","../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/set.js","../../../../src/classes/services/BreadcrumbService/BreadcrumbService.ts"],"sourcesContent":["var assignValue = require('./_assignValue'),\n castPath = require('./_castPath'),\n isIndex = require('./_isIndex'),\n isObject = require('./isObject'),\n toKey = require('./_toKey');\n\n/**\n * The base implementation of `_.set`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @param {Function} [customizer] The function to customize path creation.\n * @returns {Object} Returns `object`.\n */\nfunction baseSet(object, path, value, customizer) {\n if (!isObject(object)) {\n return object;\n }\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n lastIndex = length - 1,\n nested = object;\n\n while (nested != null && ++index < length) {\n var key = toKey(path[index]),\n newValue = value;\n\n if (key === '__proto__' || key === 'constructor' || key === 'prototype') {\n return object;\n }\n\n if (index != lastIndex) {\n var objValue = nested[key];\n newValue = customizer ? customizer(objValue, key, nested) : undefined;\n if (newValue === undefined) {\n newValue = isObject(objValue)\n ? objValue\n : (isIndex(path[index + 1]) ? [] : {});\n }\n }\n assignValue(nested, key, newValue);\n nested = nested[key];\n }\n return object;\n}\n\nmodule.exports = baseSet;\n","var baseSet = require('./_baseSet');\n\n/**\n * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,\n * it's created. Arrays are created for missing index properties while objects\n * are created for all other missing properties. Use `_.setWith` to customize\n * `path` creation.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.set(object, 'a[0].b.c', 4);\n * console.log(object.a[0].b.c);\n * // => 4\n *\n * _.set(object, ['x', '0', 'y', 'z'], 5);\n * console.log(object.x[0].y.z);\n * // => 5\n */\nfunction set(object, path, value) {\n return object == null ? object : baseSet(object, path, value);\n}\n\nmodule.exports = set;\n","import omit from 'lodash/omit';\nimport set from 'lodash/set';\nimport { Subject } from '@gen-epix/ui-core/classes/Subject';\nimport { SubscribableAbstract } from '@gen-epix/ui-core/classes/abstracts/SubscribableAbstract';\nimport { singleton } from 'tsyringe';\n\n\ntype SubjectData = Record<string, string>;\n\n@singleton()\nexport class BreadcrumbService extends SubscribableAbstract<SubjectData> {\n\n public constructor() {\n super(new Subject<SubjectData>({}));\n }\n\n public remove(position: string): void {\n this.subject.next({ ...omit(this.subject, position) });\n }\n\n public update(position: string, title: string): void {\n this.subject.next({ ...set(this.subject.data, position, title) });\n }\n}\n"],"ignoreList":[0,1],"mappings":";;;;;;;;;;CAAA,IAAIY,IAAAH,EAAA,GACAI,IAAAR,EAAA,GACAS,IAAAR,EAAA,GACAS,IAAAX,EAAA,GACAY,IAAAT,EAAA;CAYJ,SAASU,EAAQ,GAAQ,GAAM,GAAO,GAAY;EAChD,IAAI,CAACF,EAASG,CAAM,GAClB,OAAOA;EAET,IAAOL,EAASM,GAAMD,CAAM;EAO5B,KALA,IAAIE,IAAQ,IACRC,IAASF,EAAK,QACdG,IAAYD,IAAS,GACrBE,IAASL,GAENK,KAAU,QAAQ,EAAEH,IAAQC,IAAQ;GACzC,IAAIG,IAAMR,EAAMG,EAAKC,EAAM,GACvBK,IAAWC;GAEf,IAAIF,MAAQ,eAAeA,MAAQ,iBAAiBA,MAAQ,aAC1D,OAAON;GAGT,IAAIE,KAASE,GAAW;IACtB,IAAIK,IAAWJ,EAAOC;IAEtB,AADA,IAAWI,IAAaA,EAAWD,GAAUH,GAAKD,CAAM,IAAI,KAAA,GACxDE,MAAa,KAAA,MACf,IAAWV,EAASY,CAAQ,IACxBA,IACCb,EAAQK,EAAKC,IAAQ,EAAE,IAAI,CAAC,IAAI,CAAC;GAE1C;GAEA,AADAR,EAAYW,GAAQC,GAAKC,CAAQ,GACjC,IAASF,EAAOC;EAClB;EACA,OAAON;CACT;CAEA,EAAO,UAAUD;;CClDjB,IAAIA,IAAAN,EAAA;CA8BJ,SAASmB,EAAI,GAAQ,GAAM,GAAO;EAChC,OAAOZ,KAAU,OAAOA,IAASD,EAAQC,GAAQC,GAAMO,CAAK;CAC9D;CAEA,EAAO,UAAUI;mECxBJG,IAAN,cAAgCC,EAAkC;CAEvE,cAAqB;EACnB,MAAM,IAAIC,EAAqB,CAAC,CAAC,CAAC;CACpC;CAEA,OAAc,GAAwB;EACpC,KAAK,QAAQ,KAAK,EAAE,IAAA,GAAGnC,EAAAA,QAAAA,CAAK,KAAK,SAASoC,CAAQ,EAAE,CAAC;CACvD;CAEA,OAAc,GAAkB,GAAqB;EACnD,KAAK,QAAQ,KAAK,EAAE,IAAA,GAAGnC,EAAAA,QAAAA,CAAI,KAAK,QAAQ,MAAMmC,GAAUC,CAAK,EAAE,CAAC;CAClE;AACF;AAdC,IAAAnC,EAAA,CAAAoC,EAAU,CAAA,GAAAL,CAAA"}
1
+ {"version":3,"file":"index.js","names":["omit","_decorate","__toESM","require_omit","import_omit","BreadcrumbService","SubscribableAbstract","Subject","position","title","__decorate","singleton"],"sources":["../../../../src/classes/services/BreadcrumbService/BreadcrumbService.ts"],"sourcesContent":["import omit from 'lodash/omit';\nimport { Subject } from '@gen-epix/ui-core/classes/Subject';\nimport { SubscribableAbstract } from '@gen-epix/ui-core/classes/abstracts/SubscribableAbstract';\nimport { singleton } from 'tsyringe';\n\n\ntype SubjectData = Record<string, string>;\n\n@singleton()\nexport class BreadcrumbService extends SubscribableAbstract<SubjectData> {\n\n public constructor() {\n super(new Subject<SubjectData>({}));\n }\n\n public remove(position: string): void {\n this.subject.next({ ...omit(this.subject.data, position) });\n }\n\n public update(position: string, title: string): void {\n this.subject.next({ ...this.subject.data, [position]: title });\n }\n}\n"],"mappings":";;;;;;;A,mCASaK,IAAN,cAAgCC,EAAkC;CAEvE,cAAqB;EACnB,MAAM,IAAIC,EAAqB,CAAC,CAAC,CAAC;CACpC;CAEA,OAAc,GAAwB;EACpC,KAAK,QAAQ,KAAK,EAAE,IAAA,GAAGP,EAAAA,QAAAA,CAAK,KAAK,QAAQ,MAAMQ,CAAQ,EAAE,CAAC;CAC5D;CAEA,OAAc,GAAkB,GAAqB;EACnD,KAAK,QAAQ,KAAK;GAAE,GAAG,KAAK,QAAQ;IAAOA,IAAWC;EAAM,CAAC;CAC/D;AACF;AAdC,IAAAR,EAAA,CAAAU,EAAU,CAAA,GAAAN,CAAA"}
@@ -1,9 +1,10 @@
1
- import { t as e } from "../../../_chunks/decorate.js";
2
- import { CONFIG_TOKEN as t, WINDOW_SERVICE_TOKEN as n } from "../../../constants/config.constants.js";
3
- import { t as r } from "../../../_chunks/decorateParam.js";
4
- import { inject as i, singleton as a } from "tsyringe";
1
+ import { CONFIG_TOKEN as e } from "../../../constants/config.constants.js";
2
+ import { t } from "../../../_chunks/decorateParam.js";
3
+ import { t as n } from "../../../_chunks/decorate.js";
4
+ import { inject as r, singleton as i } from "tsyringe";
5
+ import { WindowService as a } from "@gen-epix/ui-core/classes/services/WindowService";
5
6
  import o from "@emotion/cache";
6
- //#region src/classes/services/EmotionCacheService/EmotionCacheService.ts
7
+ // src/classes/services/EmotionCacheService/EmotionCacheService.ts
7
8
  var s = class {
8
9
  emotionCache;
9
10
  constructor(e, t) {
@@ -16,12 +17,11 @@ var s = class {
16
17
  });
17
18
  }
18
19
  };
19
- s = e([
20
- a(),
21
- r(0, i(t)),
22
- r(1, i(n))
20
+ s = n([
21
+ i(),
22
+ t(0, r(e)),
23
+ t(1, r(a))
23
24
  ], s);
24
- //#endregion
25
25
  export { s as EmotionCacheService };
26
26
 
27
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_decorate","_decorateParam","__decorate","__decorateParam","createCache","EmotionCacheService","windowService","config","singleton","inject","CONFIG_TOKEN","WINDOW_SERVICE_TOKEN"],"sources":["../../../../src/classes/services/EmotionCacheService/EmotionCacheService.ts"],"sourcesContent":["import type { EmotionCache } from '@emotion/cache';\nimport createCache from '@emotion/cache';\nimport {\n inject,\n singleton,\n} from 'tsyringe';\nimport type { WindowService } from '@gen-epix/ui-core/classes/services/WindowService';\n\nimport {\n CONFIG_TOKEN,\n WINDOW_SERVICE_TOKEN,\n} from '../../../constants/config.constants';\nimport type { ConfigBase } from '../../../models/config.models';\n\n\n@singleton()\nexport class EmotionCacheService {\n public readonly emotionCache: EmotionCache;\n\n public constructor(\n @inject(CONFIG_TOKEN) config: ConfigBase,\n @inject(WINDOW_SERVICE_TOKEN) windowService: WindowService,\n ) {\n this.emotionCache = createCache({\n container: windowService.document.head,\n key: 'genepix',\n nonce: config.nonce,\n prepend: !!config.nonce,\n stylisPlugins: [],\n });\n }\n}\n"],"mappings":";;;;;;AAgBO,IAAMK,IAAN,MAA0B;CAC/B;CAEA,YACE,GACA,GACA;EACA,KAAK,eAAeD,EAAY;GAC9B,WAAWE,EAAc,SAAS;GAClC,KAAK;GACL,OAAOC,EAAO;GACd,SAAS,CAAC,CAACA,EAAO;GAClB,eAAe,CAAC;EAClB,CAAC;CACH;AACF;;CAhBCC,EAAU;CAKNP,EAAA,GAAAQ,EAAOC,CAAY,CAAA;CACnBT,EAAA,GAAAQ,EAAOE,CAAoB,CAAA"}
1
+ {"version":3,"file":"index.js","names":["_decorate","_decorateParam","__decorate","createCache","EmotionCacheService","windowService","config","singleton","__decorateParam","inject","CONFIG_TOKEN","WindowService"],"sources":["../../../../src/classes/services/EmotionCacheService/EmotionCacheService.ts"],"sourcesContent":["import type { EmotionCache } from '@emotion/cache';\nimport createCache from '@emotion/cache';\nimport {\n inject,\n singleton,\n} from 'tsyringe';\nimport { WindowService } from '@gen-epix/ui-core/classes/services/WindowService';\n\nimport { CONFIG_TOKEN } from '../../../constants/config.constants';\nimport type { ConfigBase } from '../../../models/config.models';\n\n\n@singleton()\nexport class EmotionCacheService {\n public readonly emotionCache: EmotionCache;\n\n public constructor(\n @inject(CONFIG_TOKEN) config: ConfigBase,\n @inject(WindowService) windowService: WindowService,\n ) {\n this.emotionCache = createCache({\n container: windowService.document.head,\n key: 'genepix',\n nonce: config.nonce,\n prepend: !!config.nonce,\n stylisPlugins: [],\n });\n }\n}\n"],"mappings":";;;;;;;AAaO,IAAMI,IAAN,MAA0B;CAC/B;CAEA,YACE,GACA,GACA;EACA,KAAK,eAAeD,EAAY;GAC9B,WAAWE,EAAc,SAAS;GAClC,KAAK;GACL,OAAOC,EAAO;GACd,SAAS,CAAC,CAACA,EAAO;GAClB,eAAe,CAAC;EAClB,CAAC;CACH;AACF;;CAhBCC,EAAU;CAKNN,EAAA,GAAAQ,EAAOC,CAAY,CAAA;CACnBT,EAAA,GAAAQ,EAAOE,CAAa,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { t as e } from "../../../_chunks/decorate.js";
2
2
  import { singleton as t } from "tsyringe";
3
- //#region src/classes/services/FeatureFlagsService/FeatureFlagsService.ts
3
+ // src/classes/services/FeatureFlagsService/FeatureFlagsService.ts
4
4
  var n = class {
5
5
  get featureFlags() {
6
6
  if (this.__featureFlags === null) throw Error("Feature flags have not been loaded yet");
@@ -12,7 +12,6 @@ var n = class {
12
12
  __featureFlags = null;
13
13
  };
14
14
  n = e([t()], n);
15
- //#endregion
16
15
  export { n as FeatureFlagsService };
17
16
 
18
17
  //# sourceMappingURL=index.js.map
@@ -1,11 +1,11 @@
1
- import { t as e } from "../../../_chunks/decorate.js";
2
- import { WINDOW_SERVICE_TOKEN as t } from "../../../constants/config.constants.js";
3
- import { t as n } from "../../../_chunks/decorateParam.js";
4
- import r, { changeLanguage as i, use as a } from "i18next";
5
- import { inject as o, singleton as s } from "tsyringe";
1
+ import { t as e } from "../../../_chunks/decorateParam.js";
2
+ import { t } from "../../../_chunks/decorate.js";
3
+ import { inject as n, singleton as r } from "tsyringe";
4
+ import { WindowService as i } from "@gen-epix/ui-core/classes/services/WindowService";
5
+ import a, { changeLanguage as o, use as s } from "i18next";
6
6
  import { EventBusAbstract as c } from "@gen-epix/ui-core/classes/abstracts/EventBusAbstract";
7
7
  import { initReactI18next as l } from "react-i18next";
8
- //#region src/classes/services/I18nService/I18nService.ts
8
+ // src/classes/services/I18nService/I18nService.ts
9
9
  var u = class extends c {
10
10
  getCurrentLanguageCode;
11
11
  isInitialized = !1;
@@ -22,7 +22,8 @@ var u = class extends c {
22
22
  return;
23
23
  }
24
24
  let t = await this.getCurrentLanguageCode(), n = this.languageConfigs.find((e) => e.code === t);
25
- await a(l).init({
25
+ if (!n) throw Error(`No i18n config found for code: ${t}`);
26
+ await s(l).init({
26
27
  fallbackLng: n.code,
27
28
  interpolation: { escapeValue: !1 },
28
29
  lng: n.code,
@@ -35,7 +36,7 @@ var u = class extends c {
35
36
  }), await this.loadResources(n.code), this.updateLangAttribute(n.code), this.isInitialized = !0;
36
37
  }
37
38
  async switchLanguage(e) {
38
- await this.switchLanguageConfig(e), await this.loadResources(e), await i(e);
39
+ await this.loadResources(e), await this.switchLanguageConfig(e), await o(e);
39
40
  }
40
41
  async switchLanguageConfig(e) {
41
42
  await this.setNewLanguageCode(e), this.updateLangAttribute(e);
@@ -47,8 +48,8 @@ var u = class extends c {
47
48
  await Promise.all(t.bundles.map(async (e) => {
48
49
  let n = await fetch(e);
49
50
  if (!n.ok) throw Error(`Failed to load i18n bundle: ${e}`);
50
- let i = await n.json();
51
- r.addResourceBundle(t.code, "translation", i.translation, !0, !1);
51
+ let r = await n.json();
52
+ a.addResourceBundle(t.code, "translation", r.translation, !0, !1);
52
53
  })), this.languageLoaded[e] = !0;
53
54
  }
54
55
  updateLangAttribute(e) {
@@ -56,8 +57,7 @@ var u = class extends c {
56
57
  t ? t.documentElement.setAttribute("lang", e) : console.warn("Document is not available, cannot set lang attribute");
57
58
  }
58
59
  };
59
- u = e([s(), n(0, o(t))], u);
60
- //#endregion
60
+ u = t([r(), e(0, n(i))], u);
61
61
  export { u as I18nService };
62
62
 
63
63
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_decorate","_decorateParam","__decorate","__decorateParam","i18next","I18nService","EventBusAbstract","windowService","kwArgs","currentLanguageCode","defaultLanguageConfig","x","use","initReactI18next","text","value","options","key","lng","ns","code","changeLanguage","config","response","bundleUrl","json","doc","singleton","inject","WINDOW_SERVICE_TOKEN"],"sources":["../../../../src/classes/services/I18nService/I18nService.ts"],"sourcesContent":["import i18next, {\n changeLanguage,\n use,\n} from 'i18next';\nimport { initReactI18next } from 'react-i18next';\nimport { EventBusAbstract } from '@gen-epix/ui-core/classes/abstracts/EventBusAbstract';\nimport type { WindowService } from '@gen-epix/ui-core/classes/services/WindowService';\nimport {\n inject,\n singleton,\n} from 'tsyringe';\n\nimport { WINDOW_SERVICE_TOKEN } from '../../../constants/config.constants';\n\nexport type LanguageConfig = {\n bundles: string[];\n code: string;\n};\n\ntype Bundle = {\n translation: Record<string, string>;\n};\n\ntype I18nEvent = {\n onUserLanguageChange: string;\n};\n\n@singleton()\nexport class I18nService extends EventBusAbstract<I18nEvent> {\n\n private getCurrentLanguageCode: () => Promise<string> | string;\n private isInitialized = false;\n private languageConfigs: LanguageConfig[];\n private languageLoaded: Record<string, boolean> = {};\n private setNewLanguageCode: (code: string) => Promise<void> | void;\n private readonly windowService: WindowService;\n\n public constructor(@inject(WINDOW_SERVICE_TOKEN) windowService: WindowService) {\n super();\n this.windowService = windowService;\n }\n\n\n public async init(kwArgs: {\n getCurrentLanguageCode: () => Promise<string> | string;\n languageConfigs: LanguageConfig[];\n setNewLanguageCode: (code: string) => Promise<void> | void;\n }): Promise<void> {\n this.setNewLanguageCode = kwArgs.setNewLanguageCode;\n this.getCurrentLanguageCode = kwArgs.getCurrentLanguageCode;\n this.languageConfigs = kwArgs.languageConfigs;\n if (this.isInitialized) {\n console.warn('I18nService is already initialized');\n return;\n }\n const currentLanguageCode = await this.getCurrentLanguageCode();\n const defaultLanguageConfig = this.languageConfigs.find(x => x.code === currentLanguageCode);\n\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n await use(initReactI18next)\n .init({\n fallbackLng: defaultLanguageConfig.code,\n interpolation: {\n escapeValue: false, // react already safes from xss => https://www.i18next.com/translation-function/interpolation#unescape\n },\n lng: defaultLanguageConfig.code,\n missingInterpolationHandler: (text, value, options) => {\n console.warn(`Missing interpolation for key: \"${text}\" with value: \"${JSON.stringify(value)}\" and options: \"${JSON.stringify(options)}\"`);\n },\n missingKeyHandler: (lng, ns, key) => {\n console.warn(`Missing translation for key: \"${key}\" in language: \"${lng.join(', ')}\" and namespace: \"${ns}\"`);\n },\n });\n\n await this.loadResources(defaultLanguageConfig.code);\n this.updateLangAttribute(defaultLanguageConfig.code);\n this.isInitialized = true;\n }\n\n public async switchLanguage(code: string): Promise<void> {\n await this.switchLanguageConfig(code);\n\n await this.loadResources(code);\n await changeLanguage(code);\n }\n\n public async switchLanguageConfig(code: string): Promise<void> {\n await this.setNewLanguageCode(code);\n this.updateLangAttribute(code);\n }\n\n private async loadResources(code: string): Promise<void> {\n if (this.languageLoaded[code]) {\n return;\n }\n const config = this.languageConfigs.find(x => x.code === code);\n if (!config) {\n throw new Error(`No i18n config found for code: ${code}`);\n }\n await Promise.all(config.bundles.map(async (bundleUrl) => {\n const response = await fetch(bundleUrl);\n if (!response.ok) {\n throw new Error(`Failed to load i18n bundle: ${bundleUrl}`);\n }\n const json = await response.json() as Bundle;\n i18next.addResourceBundle(\n config.code,\n 'translation',\n json.translation,\n true,\n false,\n );\n }));\n this.languageLoaded[code] = true;\n }\n\n private updateLangAttribute(code: string): void {\n const doc = this.windowService.document;\n if (!doc) {\n console.warn('Document is not available, cannot set lang attribute');\n return;\n }\n doc.documentElement.setAttribute('lang', code);\n }\n}\n"],"mappings":";;;;;;;;AA4BO,IAAMK,IAAN,cAA0BC,EAA4B;CAE3D;CACA,gBAAwB;CACxB;CACA,iBAAkD,CAAC;CACnD;CACA;CAEA,YAAmB,GAA4D;EAE7E,AADA,MAAM,GACN,KAAK,gBAAgBC;CACvB;CAGA,MAAa,KAAK,GAIA;EAIhB,IAHA,KAAK,qBAAqBC,EAAO,oBACjC,KAAK,yBAAyBA,EAAO,wBACrC,KAAK,kBAAkBA,EAAO,iBAC1B,KAAK,eAAe;GACtB,QAAQ,KAAK,oCAAoC;GACjD;EACF;EACA,IAAMC,IAAsB,MAAM,KAAK,uBAAuB,GACxDC,IAAwB,KAAK,gBAAgB,MAAK,MAAKC,EAAE,SAASF,CAAmB;EAqB3F,AAjBA,MAAMG,EAAIC,CAAgB,CAAC,CACxB,KAAK;GACJ,aAAaH,EAAsB;GACnC,eAAe,EACb,aAAa,GACf;GACA,KAAKA,EAAsB;GAC3B,8BAA8B,GAAM,GAAO,MAAY;IACrD,QAAQ,KAAK,mCAAmCI,EAAK,iBAAiB,KAAK,UAAUC,CAAK,EAAE,kBAAkB,KAAK,UAAUC,CAAO,EAAE,EAAE;GAC1I;GACA,oBAAoB,GAAK,GAAI,MAAQ;IACnC,QAAQ,KAAK,iCAAiCC,EAAI,kBAAkBC,EAAI,KAAK,IAAI,EAAE,oBAAoBC,EAAG,EAAE;GAC9G;EACF,CAAC,GAEH,MAAM,KAAK,cAAcT,EAAsB,IAAI,GACnD,KAAK,oBAAoBA,EAAsB,IAAI,GACnD,KAAK,gBAAgB;CACvB;CAEA,MAAa,eAAe,GAA6B;EAIvD,AAHA,MAAM,KAAK,qBAAqBU,CAAI,GAEpC,MAAM,KAAK,cAAcA,CAAI,GAC7B,MAAMC,EAAeD,CAAI;CAC3B;CAEA,MAAa,qBAAqB,GAA6B;EAE7D,AADA,MAAM,KAAK,mBAAmBA,CAAI,GAClC,KAAK,oBAAoBA,CAAI;CAC/B;CAEA,MAAc,cAAc,GAA6B;EACvD,IAAI,KAAK,eAAeA,IACtB;EAEF,IAAME,IAAS,KAAK,gBAAgB,MAAK,MAAKX,EAAE,SAASS,CAAI;EAC7D,IAAI,CAACE,GACH,MAAU,MAAM,kCAAkCF,GAAM;EAgB1D,AAdA,MAAM,QAAQ,IAAIE,EAAO,QAAQ,IAAI,OAAO,MAAc;GACxD,IAAMC,IAAW,MAAM,MAAMC,CAAS;GACtC,IAAI,CAACD,EAAS,IACZ,MAAU,MAAM,+BAA+BC,GAAW;GAE5D,IAAMC,IAAO,MAAMF,EAAS,KAAK;GACjC,EAAQ,kBACND,EAAO,MACP,eACAG,EAAK,aACL,IACA,EACF;EACF,CAAC,CAAC,GACF,KAAK,eAAeL,KAAQ;CAC9B;CAEA,oBAA4B,GAAoB;EAC9C,IAAMM,IAAM,KAAK,cAAc;EAC/B,AAAKA,IAILA,EAAI,gBAAgB,aAAa,QAAQN,CAAI,IAH3C,QAAQ,KAAK,sDAAsD;CAIvE;AACF;AAlGC,IAAApB,EAAA,CAAA2B,EAAU,GAAA1B,EAAA,GAUW2B,EAAOC,CAAoB,CAAA,CAAA,GAAAxB,CAAA"}
1
+ {"version":3,"file":"index.js","names":["_decorate","_decorateParam","__decorateParam","i18next","I18nService","EventBusAbstract","windowService","kwArgs","currentLanguageCode","defaultLanguageConfig","x","use","initReactI18next","text","value","options","key","lng","ns","code","changeLanguage","config","response","bundleUrl","json","doc","__decorate","singleton","inject","WindowService"],"sources":["../../../../src/classes/services/I18nService/I18nService.ts"],"sourcesContent":["import i18next, {\n changeLanguage,\n use,\n} from 'i18next';\nimport { initReactI18next } from 'react-i18next';\nimport { EventBusAbstract } from '@gen-epix/ui-core/classes/abstracts/EventBusAbstract';\nimport { WindowService } from '@gen-epix/ui-core/classes/services/WindowService';\nimport {\n inject,\n singleton,\n} from 'tsyringe';\n\nexport type LanguageConfig = {\n bundles: string[];\n code: string;\n};\n\ntype Bundle = {\n translation: Record<string, string>;\n};\n\ntype I18nEvent = {\n onUserLanguageChange: string;\n};\n\n@singleton()\nexport class I18nService extends EventBusAbstract<I18nEvent> {\n\n private getCurrentLanguageCode: () => Promise<string> | string;\n private isInitialized = false;\n private languageConfigs: LanguageConfig[];\n private languageLoaded: Record<string, boolean> = {};\n private setNewLanguageCode: (code: string) => Promise<void> | void;\n private readonly windowService: WindowService;\n\n public constructor(@inject(WindowService) windowService: WindowService) {\n super();\n this.windowService = windowService;\n }\n\n\n public async init(kwArgs: {\n getCurrentLanguageCode: () => Promise<string> | string;\n languageConfigs: LanguageConfig[];\n setNewLanguageCode: (code: string) => Promise<void> | void;\n }): Promise<void> {\n this.setNewLanguageCode = kwArgs.setNewLanguageCode;\n this.getCurrentLanguageCode = kwArgs.getCurrentLanguageCode;\n this.languageConfigs = kwArgs.languageConfigs;\n if (this.isInitialized) {\n console.warn('I18nService is already initialized');\n return;\n }\n const currentLanguageCode = await this.getCurrentLanguageCode();\n const defaultLanguageConfig = this.languageConfigs.find(x => x.code === currentLanguageCode);\n if (!defaultLanguageConfig) {\n throw new Error(`No i18n config found for code: ${currentLanguageCode}`);\n }\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n await use(initReactI18next)\n .init({\n fallbackLng: defaultLanguageConfig.code,\n interpolation: {\n escapeValue: false, // react already safes from xss => https://www.i18next.com/translation-function/interpolation#unescape\n },\n lng: defaultLanguageConfig.code,\n missingInterpolationHandler: (text, value, options) => {\n console.warn(`Missing interpolation for key: \"${text}\" with value: \"${JSON.stringify(value)}\" and options: \"${JSON.stringify(options)}\"`);\n },\n missingKeyHandler: (lng, ns, key) => {\n console.warn(`Missing translation for key: \"${key}\" in language: \"${lng.join(', ')}\" and namespace: \"${ns}\"`);\n },\n });\n\n await this.loadResources(defaultLanguageConfig.code);\n this.updateLangAttribute(defaultLanguageConfig.code);\n this.isInitialized = true;\n }\n\n public async switchLanguage(code: string): Promise<void> {\n await this.loadResources(code);\n await this.switchLanguageConfig(code);\n await changeLanguage(code);\n }\n\n public async switchLanguageConfig(code: string): Promise<void> {\n await this.setNewLanguageCode(code);\n this.updateLangAttribute(code);\n }\n\n private async loadResources(code: string): Promise<void> {\n if (this.languageLoaded[code]) {\n return;\n }\n const config = this.languageConfigs.find(x => x.code === code);\n if (!config) {\n throw new Error(`No i18n config found for code: ${code}`);\n }\n await Promise.all(config.bundles.map(async (bundleUrl) => {\n const response = await fetch(bundleUrl);\n if (!response.ok) {\n throw new Error(`Failed to load i18n bundle: ${bundleUrl}`);\n }\n const json = await response.json() as Bundle;\n i18next.addResourceBundle(\n config.code,\n 'translation',\n json.translation,\n true,\n false,\n );\n }));\n this.languageLoaded[code] = true;\n }\n\n private updateLangAttribute(code: string): void {\n const doc = this.windowService.document;\n if (!doc) {\n console.warn('Document is not available, cannot set lang attribute');\n return;\n }\n doc.documentElement.setAttribute('lang', code);\n }\n}\n"],"mappings":";;;;;;;;AA0BO,IAAMI,IAAN,cAA0BC,EAA4B;CAE3D;CACA,gBAAwB;CACxB;CACA,iBAAkD,CAAC;CACnD;CACA;CAEA,YAAmB,GAAqD;EAEtE,AADA,MAAM,GACN,KAAK,gBAAgBC;CACvB;CAGA,MAAa,KAAK,GAIA;EAIhB,IAHA,KAAK,qBAAqBC,EAAO,oBACjC,KAAK,yBAAyBA,EAAO,wBACrC,KAAK,kBAAkBA,EAAO,iBAC1B,KAAK,eAAe;GACtB,QAAQ,KAAK,oCAAoC;GACjD;EACF;EACA,IAAMC,IAAsB,MAAM,KAAK,uBAAuB,GACxDC,IAAwB,KAAK,gBAAgB,MAAK,MAAKC,EAAE,SAASF,CAAmB;EAC3F,IAAI,CAACC,GACH,MAAU,MAAM,kCAAkCD,GAAqB;EAqBzE,AAjBA,MAAMG,EAAIC,CAAgB,CAAC,CACxB,KAAK;GACJ,aAAaH,EAAsB;GACnC,eAAe,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a,QAAQN,CAAI,IAH3C,QAAQ,KAAK,sDAAsD;CAIvE;AACF;AAnGC,IAAAnB,EAAA,CAAA2B,EAAU,GAAA1B,EAAA,GAUW2B,EAAOC,CAAa,CAAA,CAAA,GAAAzB,CAAA"}
@@ -2,16 +2,16 @@ import { n as e, t } from "../../../_chunks/rolldown-runtime.js";
2
2
  import { TimeUtil as n } from "../../../utils/TimeUtil/index.js";
3
3
  import { a as r, t as i } from "../../../_chunks/isObject.js";
4
4
  import { t as a } from "../../../_chunks/isSymbol.js";
5
- import { t as o } from "../../../_chunks/decorate.js";
6
- import { CONFIG_TOKEN as s } from "../../../constants/config.constants.js";
7
- import { t as c } from "../../../_chunks/decorateParam.js";
5
+ import { CONFIG_TOKEN as o } from "../../../constants/config.constants.js";
6
+ import { t as s } from "../../../_chunks/decorateParam.js";
7
+ import { t as c } from "../../../_chunks/decorate.js";
8
8
  import { AuthenticationService as l } from "../AuthenticationService/index.js";
9
9
  import { LogService as u } from "../LogService/index.js";
10
- import { CommonDbLogLevel as d } from "@gen-epix/api-commondb";
11
- import { inject as f, singleton as p } from "tsyringe";
10
+ import { inject as d, singleton as f } from "tsyringe";
11
+ import { CommonDbLogLevel as p } from "@gen-epix/api-commondb";
12
12
  import { Subject as m } from "@gen-epix/ui-core/classes/Subject";
13
13
  import { SubscribableAbstract as h } from "@gen-epix/ui-core/classes/abstracts/SubscribableAbstract";
14
- //#region ../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/now.js
14
+ // ../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/now.js
15
15
  var g = /* @__PURE__ */ t(((e, t) => {
16
16
  var n = r();
17
17
  t.exports = function() {
@@ -132,14 +132,14 @@ var g = /* @__PURE__ */ t(((e, t) => {
132
132
  if (this.idleSince > 0 && Date.now() - r > this.idleSince && !this.isPaused) {
133
133
  this.idleDiff = Date.now() - this.idleSince, this.isIdle = !0;
134
134
  let e = this.idleSince + r + i;
135
- this.notificationDiff = e - Date.now(), this.notificationDiff < 0 && this.logout(), this.isIdle && this.doNext();
135
+ this.notificationDiff = e - Date.now(), this.notificationDiff < 0 && this.logout(), this.doNext();
136
136
  }
137
137
  }, 500);
138
138
  }
139
139
  logout() {
140
140
  this.logService.log([{
141
141
  detail: this.authenticationService.authContextProps.user,
142
- level: d.TRACE,
142
+ level: p.TRACE,
143
143
  topic: "USER_LOGOUT_BY_INACTIVITY"
144
144
  }]), this.logService.flushLog(), this.authenticationService.authContextProps.signoutRedirect();
145
145
  }
@@ -165,13 +165,12 @@ var g = /* @__PURE__ */ t(((e, t) => {
165
165
  this.isIdle || (this.idleSince = Date.now());
166
166
  }
167
167
  };
168
- S = o([
169
- p(),
170
- c(0, f(s)),
171
- c(1, f(u)),
172
- c(2, f(l))
168
+ S = c([
169
+ f(),
170
+ s(0, d(o)),
171
+ s(1, d(u)),
172
+ s(2, d(l))
173
173
  ], S);
174
- //#endregion
175
174
  export { S as InactivityService };
176
175
 
177
176
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["throttle","_decorate","_decorateParam","__toESM","require__root","require_isObject","require_isSymbol","__decorate","__decorateParam","require_now","root","require__trimmedEndIndex","reWhitespace","trimmedEndIndex","index","string","require__baseTrim","reTrimStart","baseTrim","require_toNumber","isObject","isSymbol","NAN","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","toNumber","value","other","isBinary","require_debounce","now","FUNC_ERROR_TEXT","nativeMax","nativeMin","debounce","lastArgs","lastThis","maxWait","result","timerId","lastCallTime","lastInvokeTime","leading","maxing","trailing","func","wait","options","invokeFunc","args","thisArg","time","leadingEdge","timerExpired","remainingWait","timeSinceLastCall","timeSinceLastInvoke","timeWaiting","shouldInvoke","trailingEdge","cancel","flush","debounced","isInvoking","import_throttle","__commonJSMin","throttle","\"leading\"","\"maxWait\"","\"trailing\"","InactivityService","SubscribableAbstract","Subject","logService","authenticationService","config","event","ALLOWED_IDLE_TIME_MS","notificationEndTime","NOTIFICATION_TIME_MS","CommonDbLogLevel","TimeUtil","singleton","inject","CONFIG_TOKEN","LogService","AuthenticationService"],"sources":["../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/now.js","../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_trimmedEndIndex.js","../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_baseTrim.js","../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/toNumber.js","../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/debounce.js","../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/throttle.js","../../../../src/classes/services/InactivityService/InactivityService.ts"],"sourcesContent":["var root = require('./_root');\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\nmodule.exports = now;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nmodule.exports = trimmedEndIndex;\n","var trimmedEndIndex = require('./_trimmedEndIndex');\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nmodule.exports = baseTrim;\n","var baseTrim = require('./_baseTrim'),\n isObject = require('./isObject'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = toNumber;\n","var isObject = require('./isObject'),\n now = require('./now'),\n toNumber = require('./toNumber');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\nmodule.exports = debounce;\n","var debounce = require('./debounce'),\n isObject = require('./isObject');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\nmodule.exports = throttle;\n","import throttle from 'lodash/throttle';\nimport { CommonDbLogLevel } from '@gen-epix/api-commondb';\nimport { SubscribableAbstract } from '@gen-epix/ui-core/classes/abstracts/SubscribableAbstract';\nimport { Subject } from '@gen-epix/ui-core/classes/Subject';\nimport {\n inject,\n singleton,\n} from 'tsyringe';\n\nimport { AuthenticationService } from '../AuthenticationService';\nimport { LogService } from '../LogService';\nimport { TimeUtil } from '../../../utils/TimeUtil';\nimport { CONFIG_TOKEN } from '../../../constants/config.constants';\nimport type { ConfigBase } from '../../../models/config.models';\n\nexport type InactivityState = {\n idleDiff: number;\n isIdle: boolean;\n notificationDiff: number;\n readableIdleDiff: string;\n readableNotificationDiff: string;\n};\n\n@singleton()\nexport class InactivityService extends SubscribableAbstract<InactivityState> {\n private readonly authenticationService: AuthenticationService;\n\n private idleDiff: number = 0;\n private idleSince: number = Date.now();\n private isIdle: boolean = false;\n private isPaused: boolean = false;\n private readonly logService: LogService;\n private notificationDiff: number = 0;\n private readonly onActivityDebounced: () => void;\n\n public constructor(\n @inject(CONFIG_TOKEN) config: ConfigBase,\n @inject(LogService) logService: LogService,\n @inject(AuthenticationService) authenticationService: AuthenticationService,\n ) {\n super(new Subject<InactivityState>({\n idleDiff: 0,\n isIdle: false,\n notificationDiff: 0,\n readableIdleDiff: '',\n readableNotificationDiff: '',\n }));\n this.logService = logService;\n this.authenticationService = authenticationService;\n\n this.onActivityDebounced = throttle(this.onActivity.bind(this), 1000, {\n leading: true,\n trailing: true,\n });\n\n const { ALLOWED_IDLE_TIME_MS, NOTIFICATION_TIME_MS } = config.userInactivityConfirmation;\n ['mousemove', 'keydown', 'scroll'].forEach((event) => window.addEventListener(event, this.onActivityDebounced));\n\n setInterval(() => {\n if (this.idleSince > 0 && (Date.now() - ALLOWED_IDLE_TIME_MS) > this.idleSince && !this.isPaused) {\n this.idleDiff = Date.now() - this.idleSince;\n this.isIdle = true;\n\n const notificationEndTime = this.idleSince + ALLOWED_IDLE_TIME_MS + NOTIFICATION_TIME_MS;\n this.notificationDiff = notificationEndTime - Date.now();\n\n if (this.notificationDiff < 0) {\n this.logout();\n }\n\n if (this.isIdle) {\n this.doNext();\n }\n }\n }, 500);\n }\n\n\n public logout(): void {\n this.logService.log([{\n detail: this.authenticationService.authContextProps.user,\n level: CommonDbLogLevel.TRACE,\n topic: 'USER_LOGOUT_BY_INACTIVITY',\n }]);\n this.logService.flushLog();\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.authenticationService.authContextProps.signoutRedirect();\n }\n\n public pause(): void {\n this.isPaused = true;\n this.reset();\n }\n\n public reset(): void {\n this.idleSince = Date.now();\n this.isIdle = false;\n this.idleDiff = 0;\n this.notificationDiff = 0;\n this.doNext();\n }\n\n public resume(): void {\n this.isPaused = false;\n this.reset();\n }\n\n private doNext(): void {\n this.next({\n idleDiff: this.idleDiff,\n isIdle: this.isIdle,\n notificationDiff: this.notificationDiff,\n readableIdleDiff: TimeUtil.getReadableTimeRemaining(this.idleDiff),\n readableNotificationDiff: TimeUtil.getReadableTimeRemaining(this.notificationDiff),\n });\n }\n\n private onActivity(): void {\n if (this.isIdle) {\n return;\n }\n this.idleSince = Date.now();\n }\n\n}\n"],"ignoreList":[0,1,2,3,4,5],"mappings":";;;;;;;;;;;;;;;CAAA,IAAIU,IAAAN,EAAA;CAsBJ,EAAO,UAAU,WAJI;EACnB,OAAOM,EAAK,KAAK,IAAI;CACvB;;CC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B,KAAK,MAAM;CACb;CAEA,SAAuB;EACrB,KAAK,KAAK;GACR,UAAU,KAAK;GACf,QAAQ,KAAK;GACb,kBAAkB,KAAK;GACvB,kBAAkBC,EAAS,yBAAyB,KAAK,QAAQ;GACjE,0BAA0BA,EAAS,yBAAyB,KAAK,gBAAgB;EACnF,CAAC;CACH;CAEA,aAA2B;EACzB,AAAI,KAAK,WAGT,KAAK,YAAY,KAAK,IAAI;CAC5B;AAEF;;CArGCC,EAAU;CAaNlF,EAAA,GAAAmF,EAAOC,CAAY,CAAA;CACnBpF,EAAA,GAAAmF,EAAOE,CAAU,CAAA;CACjBrF,EAAA,GAAAmF,EAAOG,CAAqB,CAAA"}
1
+ {"version":3,"file":"index.js","names":["throttle","_decorate","_decorateParam","__toESM","require__root","require_isObject","require_isSymbol","__decorateParam","__decorate","require_now","root","require__trimmedEndIndex","reWhitespace","trimmedEndIndex","index","string","require__baseTrim","reTrimStart","baseTrim","require_toNumber","isObject","isSymbol","NAN","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","toNumber","value","other","isBinary","require_debounce","now","FUNC_ERROR_TEXT","nativeMax","nativeMin","debounce","lastArgs","lastThis","maxWait","result","timerId","lastCallTime","lastInvokeTime","leading","maxing","trailing","func","wait","options","invokeFunc","args","thisArg","time","leadingEdge","timerExpired","remainingWait","timeSinceLastCall","timeSinceLastInvoke","timeWaiting","shouldInvoke","trailingEdge","cancel","flush","debounced","isInvoking","import_throttle","__commonJSMin","throttle","\"leading\"","\"maxWait\"","\"trailing\"","InactivityService","SubscribableAbstract","Subject","logService","authenticationService","config","event","ALLOWED_IDLE_TIME_MS","notificationEndTime","NOTIFICATION_TIME_MS","CommonDbLogLevel","TimeUtil","singleton","inject","CONFIG_TOKEN","LogService","AuthenticationService"],"sources":["../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/now.js","../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_trimmedEndIndex.js","../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_baseTrim.js","../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/toNumber.js","../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/debounce.js","../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/throttle.js","../../../../src/classes/services/InactivityService/InactivityService.ts"],"sourcesContent":["var root = require('./_root');\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\nmodule.exports = now;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nmodule.exports = trimmedEndIndex;\n","var trimmedEndIndex = require('./_trimmedEndIndex');\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nmodule.exports = baseTrim;\n","var baseTrim = require('./_baseTrim'),\n isObject = require('./isObject'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = toNumber;\n","var isObject = require('./isObject'),\n now = require('./now'),\n toNumber = require('./toNumber');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\nmodule.exports = debounce;\n","var debounce = require('./debounce'),\n isObject = require('./isObject');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\nmodule.exports = throttle;\n","import throttle from 'lodash/throttle';\nimport { CommonDbLogLevel } from '@gen-epix/api-commondb';\nimport { SubscribableAbstract } from '@gen-epix/ui-core/classes/abstracts/SubscribableAbstract';\nimport { Subject } from '@gen-epix/ui-core/classes/Subject';\nimport {\n inject,\n singleton,\n} from 'tsyringe';\n\nimport { AuthenticationService } from '../AuthenticationService';\nimport { LogService } from '../LogService';\nimport { TimeUtil } from '../../../utils/TimeUtil';\nimport { CONFIG_TOKEN } from '../../../constants/config.constants';\nimport type { ConfigBase } from '../../../models/config.models';\n\nexport type InactivityState = {\n idleDiff: number;\n isIdle: boolean;\n notificationDiff: number;\n readableIdleDiff: string;\n readableNotificationDiff: string;\n};\n\n@singleton()\nexport class InactivityService extends SubscribableAbstract<InactivityState> {\n private readonly authenticationService: AuthenticationService;\n\n private idleDiff: number = 0;\n private idleSince: number = Date.now();\n private isIdle: boolean = false;\n private isPaused: boolean = false;\n private readonly logService: LogService;\n private notificationDiff: number = 0;\n private readonly onActivityDebounced: () => void;\n\n public constructor(\n @inject(CONFIG_TOKEN) config: ConfigBase,\n @inject(LogService) logService: LogService,\n @inject(AuthenticationService) authenticationService: AuthenticationService,\n ) {\n super(new Subject<InactivityState>({\n idleDiff: 0,\n isIdle: false,\n notificationDiff: 0,\n readableIdleDiff: '',\n readableNotificationDiff: '',\n }));\n this.logService = logService;\n this.authenticationService = authenticationService;\n\n this.onActivityDebounced = throttle(this.onActivity.bind(this), 1000, {\n leading: true,\n trailing: true,\n });\n\n const { ALLOWED_IDLE_TIME_MS, NOTIFICATION_TIME_MS } = config.userInactivityConfirmation;\n ['mousemove', 'keydown', 'scroll'].forEach((event) => window.addEventListener(event, this.onActivityDebounced));\n\n setInterval(() => {\n if (this.idleSince > 0 && (Date.now() - ALLOWED_IDLE_TIME_MS) > this.idleSince && !this.isPaused) {\n this.idleDiff = Date.now() - this.idleSince;\n this.isIdle = true;\n\n const notificationEndTime = this.idleSince + ALLOWED_IDLE_TIME_MS + NOTIFICATION_TIME_MS;\n this.notificationDiff = notificationEndTime - Date.now();\n\n if (this.notificationDiff < 0) {\n this.logout();\n }\n\n this.doNext();\n }\n }, 500);\n }\n\n\n public logout(): void {\n this.logService.log([{\n detail: this.authenticationService.authContextProps.user,\n level: CommonDbLogLevel.TRACE,\n topic: 'USER_LOGOUT_BY_INACTIVITY',\n }]);\n this.logService.flushLog();\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.authenticationService.authContextProps.signoutRedirect();\n }\n\n public pause(): void {\n this.isPaused = true;\n this.reset();\n }\n\n public reset(): void {\n this.idleSince = Date.now();\n this.isIdle = false;\n this.idleDiff = 0;\n this.notificationDiff = 0;\n this.doNext();\n }\n\n public resume(): void {\n this.isPaused = false;\n this.reset();\n }\n\n private doNext(): void {\n this.next({\n idleDiff: this.idleDiff,\n isIdle: this.isIdle,\n notificationDiff: this.notificationDiff,\n readableIdleDiff: TimeUtil.getReadableTimeRemaining(this.idleDiff),\n readableNotificationDiff: TimeUtil.getReadableTimeRemaining(this.notificationDiff),\n });\n }\n\n private onActivity(): void {\n if (this.isIdle) {\n return;\n }\n this.idleSince = Date.now();\n }\n\n}\n"],"ignoreList":[0,1,2,3,4,5],"mappings":";;;;;;;;;;;;;;;CAAA,IAAIU,IAAAN,EAAA;CAsBJ,EAAO,UAAU,WAJI;EACnB,OAAOM,EAAK,KAAK,IAAI;CACvB;;CCnBA,IAAIE,IAAe;CAUnB,SAASC,EAAgB,GAAQ;EAG/B,KAFA,IAAIC,IAAQC,EAAO,QAEZ,OAAWH,EAAa,KAAKG,EAAO,OAAOD,CAAK,CAAC;EACxD,OAAOA;CACT;CAEA,EAAO,UAAUD;;CClBjB,IAAIA,IAAAF,EAAA,GAGAM,IAAc;CASlB,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AAAI,KAAK,WAGT,KAAK,YAAY,KAAK,IAAI;CAC5B;AAEF;;CAnGCC,EAAU;CAaNlF,EAAA,GAAAmF,EAAOC,CAAY,CAAA;CACnBpF,EAAA,GAAAmF,EAAOE,CAAU,CAAA;CACjBrF,EAAA,GAAAmF,EAAOG,CAAqB,CAAA"}
@@ -1,14 +1,14 @@
1
- import { t as e } from "../../../_chunks/decorate.js";
2
- import { CONFIG_TOKEN as t } from "../../../constants/config.constants.js";
3
- import { AxiosUtil as n } from "../../../utils/AxiosUtil/index.js";
4
- import { API_SYSTEM_TOKEN as r } from "../../../constants/api.constants.js";
5
- import { t as i } from "../../../_chunks/decorateParam.js";
1
+ import { CONFIG_TOKEN as e } from "../../../constants/config.constants.js";
2
+ import { AxiosUtil as t } from "../../../utils/AxiosUtil/index.js";
3
+ import { API_SYSTEM_TOKEN as n } from "../../../constants/api.constants.js";
4
+ import { t as r } from "../../../_chunks/decorateParam.js";
5
+ import { t as i } from "../../../_chunks/decorate.js";
6
6
  import { AuthenticationService as a } from "../AuthenticationService/index.js";
7
- import { StringUtil as o } from "@gen-epix/ui-core/utils/StringUtil";
8
- import { CommonDbLogLevel as s } from "@gen-epix/api-commondb";
9
- import { inject as c, singleton as l } from "tsyringe";
7
+ import { inject as o, singleton as s } from "tsyringe";
8
+ import { StringUtil as c } from "@gen-epix/ui-core/utils/StringUtil";
9
+ import { CommonDbLogLevel as l } from "@gen-epix/api-commondb";
10
10
  import { isAxiosError as u } from "axios";
11
- //#region src/classes/services/LogService/LogService.ts
11
+ // src/classes/services/LogService/LogService.ts
12
12
  var d = class {
13
13
  requestMap;
14
14
  authenticationService;
@@ -26,8 +26,8 @@ var d = class {
26
26
  log(e) {
27
27
  let t = (/* @__PURE__ */ new Date()).toISOString(), n = this.config.getSoftwareVersion();
28
28
  this.logItems.push(...e.map((e) => ({
29
- command_id: o.createUuid(),
30
- detail: e.detail ? JSON.stringify(e.detail) : null,
29
+ command_id: c.createUuid(),
30
+ detail: e.detail === void 0 || e.detail === null ? null : JSON.stringify(e.detail),
31
31
  duration: e.duration ?? null,
32
32
  level: e.level,
33
33
  software_version: n,
@@ -37,63 +37,68 @@ var d = class {
37
37
  }
38
38
  onRequest(e) {
39
39
  if (e.headers.has("X-IGNORE-LOG")) return e;
40
- let t = o.createUuid();
40
+ let t = c.createUuid();
41
41
  return e.headers.set("X-REQUEST-ID", t), this.requestMap.set(t, (/* @__PURE__ */ new Date()).getTime()), this.log([{
42
42
  detail: {
43
43
  requestData: e.data,
44
44
  requestParams: e.params,
45
45
  url: e.url
46
46
  },
47
- level: s.TRACE,
47
+ level: l.TRACE,
48
48
  topic: "REQUEST"
49
49
  }]), e;
50
50
  }
51
51
  onResponseFulfilled(e) {
52
52
  if (e.config.headers.has("X-IGNORE-LOG")) return e;
53
- let t = e?.config?.headers.get("X-REQUEST-ID"), n = (/* @__PURE__ */ new Date()).getTime() - this.requestMap.get(t);
54
- return this.log([{
53
+ let t = e.config.headers.get("X-REQUEST-ID"), n = typeof t == "string" ? this.requestMap.get(t) : void 0, r = n === void 0 ? void 0 : Date.now() - n;
54
+ return typeof t == "string" && this.requestMap.delete(t), this.log([{
55
55
  detail: {
56
56
  requestData: e.config.data,
57
57
  requestParams: e.config.params,
58
58
  url: e.config.url
59
59
  },
60
- duration: n,
61
- level: e.status >= 200 && e.status < 300 ? s.TRACE : s.ERROR,
60
+ duration: r,
61
+ level: e.status >= 200 && e.status < 300 ? l.TRACE : l.ERROR,
62
62
  topic: "RESPONSE"
63
63
  }]), e;
64
64
  }
65
65
  onResponseRejected(e) {
66
66
  if (u(e)) {
67
- if (n.isAxiosCanceledError(e)) return;
68
- let t = e?.config?.headers.get("X-REQUEST-ID"), r = (/* @__PURE__ */ new Date()).getTime() - this.requestMap.get(t);
69
- this.log([{
67
+ let n = e.config?.headers.get("X-REQUEST-ID");
68
+ if (t.isAxiosCanceledError(e)) {
69
+ typeof n == "string" && this.requestMap.delete(n);
70
+ return;
71
+ }
72
+ let r = typeof n == "string" ? this.requestMap.get(n) : void 0, i = r === void 0 ? void 0 : Date.now() - r;
73
+ typeof n == "string" && this.requestMap.delete(n), this.log([{
70
74
  detail: {
71
- requestParams: e.config.params,
72
- responseData: e.response.data,
73
- status: e.response.status,
74
- url: e.config.url
75
+ requestParams: e.config?.params,
76
+ responseData: e.response?.data,
77
+ status: e.response?.status,
78
+ url: e.config?.url
75
79
  },
76
- duration: r,
77
- level: s.ERROR,
80
+ duration: i,
81
+ level: l.ERROR,
78
82
  topic: "RESPONSE_ERROR"
79
83
  }]);
80
84
  } else this.log([{
81
- detail: { error: e },
82
- level: s.ERROR,
85
+ detail: { error: e instanceof Error ? e.message : e },
86
+ level: l.ERROR,
83
87
  topic: "RESPONSE_ERROR"
84
88
  }]);
85
89
  }
86
90
  sendLog() {
87
- this.logItems.length && this.authenticationService?.authContextProps?.isAuthenticated && (document.location.href.includes("accept-invitation") || (this.systemApi.log({ log_items: this.logItems }, { headers: { "X-IGNORE-LOG": "1" } }).catch(() => 0), this.logItems = []));
91
+ this.logItems.length && this.authenticationService?.authContextProps?.isAuthenticated && (document.location.href.includes("accept-invitation") || (this.systemApi.log({ log_items: this.logItems }, { headers: { "X-IGNORE-LOG": "1" } }).catch((e) => {
92
+ console.error("Failed to send logs", e);
93
+ }), this.logItems = []));
88
94
  }
89
95
  };
90
- d = e([
91
- l(),
92
- i(0, c(t)),
93
- i(1, c(a)),
94
- i(2, c(r))
96
+ d = i([
97
+ s(),
98
+ r(0, o(e)),
99
+ r(1, o(a)),
100
+ r(2, o(n))
95
101
  ], d);
96
- //#endregion
97
102
  export { d as LogService };
98
103
 
99
104
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_decorate","_decorateParam","__decorate","__decorateParam","LogService","config","authenticationService","systemApi","timestamp","software_version","items","StringUtil","item","request","requestId","CommonDbLogLevel","response","duration","isAxiosError","error","AxiosUtil","singleton","inject","CONFIG_TOKEN","AuthenticationService","API_SYSTEM_TOKEN"],"sources":["../../../../src/classes/services/LogService/LogService.ts"],"sourcesContent":["import { isAxiosError } from 'axios';\nimport type {\n AxiosResponse,\n InternalAxiosRequestConfig,\n} from 'axios';\nimport type {\n CommonDbExternalLogItem,\n CommonDbSystemApi,\n} from '@gen-epix/api-commondb';\nimport { CommonDbLogLevel } from '@gen-epix/api-commondb';\nimport { StringUtil } from '@gen-epix/ui-core/utils/StringUtil';\nimport {\n inject,\n singleton,\n} from 'tsyringe';\n\nimport { API_SYSTEM_TOKEN } from '../../../constants/api.constants';\nimport { AuthenticationService } from '../AuthenticationService';\nimport { AxiosUtil } from '../../../utils/AxiosUtil';\nimport { CONFIG_TOKEN } from '../../../constants/config.constants';\nimport type { ConfigBase } from '../../../models/config.models';\n\ntype LogServiceItem = {\n detail?: unknown;\n duration?: number;\n level: CommonDbLogLevel;\n topic: string;\n};\n\n@singleton()\nexport class LogService {\n protected readonly requestMap: Map<string, number>;\n\n private readonly authenticationService: AuthenticationService;\n private readonly config: Pick<ConfigBase, 'getSoftwareVersion' | 'log'>;\n private logItems: CommonDbExternalLogItem[] = [];\n private readonly systemApi: CommonDbSystemApi;\n\n public constructor(\n @inject(CONFIG_TOKEN) config: ConfigBase,\n @inject(AuthenticationService) authenticationService: AuthenticationService,\n @inject(API_SYSTEM_TOKEN) systemApi: CommonDbSystemApi,\n ) {\n this.requestMap = new Map<string, number>();\n this.config = config;\n this.authenticationService = authenticationService;\n this.systemApi = systemApi;\n setInterval(() => {\n this.sendLog();\n }, config.log.LOG_INTERVAL_MS);\n }\n\n\n public flushLog(): void {\n this.sendLog();\n }\n\n public log(items: LogServiceItem[]): void {\n const timestamp = new Date().toISOString();\n const software_version = this.config.getSoftwareVersion();\n this.logItems.push(...items.map<CommonDbExternalLogItem>(item => {\n return {\n command_id: StringUtil.createUuid(),\n detail: item.detail ? JSON.stringify(item.detail) : null,\n duration: item.duration ?? null,\n level: item.level,\n software_version,\n timestamp,\n topic: item.topic ?? null,\n };\n }));\n }\n\n public onRequest(request: InternalAxiosRequestConfig): InternalAxiosRequestConfig {\n if (request.headers.has('X-IGNORE-LOG')) {\n return request;\n }\n const requestId = StringUtil.createUuid();\n request.headers.set('X-REQUEST-ID', requestId);\n this.requestMap.set(requestId, new Date().getTime());\n\n this.log([{\n detail: {\n requestData: request.data as unknown,\n requestParams: request.params as unknown,\n url: request.url,\n },\n level: CommonDbLogLevel.TRACE,\n topic: 'REQUEST',\n }]);\n\n return request;\n }\n\n public onResponseFulfilled(response: AxiosResponse): AxiosResponse {\n if (response.config.headers.has('X-IGNORE-LOG')) {\n return response;\n }\n\n const requestId = response?.config?.headers.get('X-REQUEST-ID') as string;\n const duration = new Date().getTime() - this.requestMap.get(requestId);\n\n this.log([{\n detail: {\n requestData: response.config.data as unknown,\n requestParams: response.config.params as unknown,\n url: response.config.url,\n },\n duration,\n level: response.status >= 200 && response.status < 300 ? CommonDbLogLevel.TRACE : CommonDbLogLevel.ERROR,\n topic: 'RESPONSE',\n }]);\n\n return response;\n }\n\n public onResponseRejected(error: unknown): void {\n if (isAxiosError(error)) {\n if (AxiosUtil.isAxiosCanceledError(error)) {\n return;\n }\n const requestId = error?.config?.headers.get('X-REQUEST-ID') as string;\n const duration = new Date().getTime() - this.requestMap.get(requestId);\n this.log([{\n detail: {\n requestParams: error.config.params as unknown,\n responseData: error.response.data as unknown,\n status: error.response.status,\n url: error.config.url,\n },\n duration,\n level: CommonDbLogLevel.ERROR,\n topic: 'RESPONSE_ERROR',\n }]);\n } else {\n this.log([{\n detail: {\n error,\n },\n level: CommonDbLogLevel.ERROR,\n topic: 'RESPONSE_ERROR',\n }]);\n }\n }\n\n private sendLog(): void {\n if (!this.logItems.length || !this.authenticationService?.authContextProps?.isAuthenticated) {\n return;\n }\n if (document.location.href.includes('accept-invitation')) {\n return;\n }\n this.systemApi.log({\n log_items: this.logItems,\n }, {\n headers: {\n 'X-IGNORE-LOG': '1',\n },\n }).catch(() => 0);\n this.logItems = [];\n }\n}\n"],"mappings":";;;;;;;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__decorateParam","__decorate","LogService","config","authenticationService","systemApi","timestamp","software_version","items","StringUtil","item","request","requestId","CommonDbLogLevel","response","requestStartedAt","duration","isAxiosError","error","AxiosUtil","singleton","inject","CONFIG_TOKEN","AuthenticationService","API_SYSTEM_TOKEN"],"sources":["../../../../src/classes/services/LogService/LogService.ts"],"sourcesContent":["import { isAxiosError } from 'axios';\nimport type {\n AxiosResponse,\n InternalAxiosRequestConfig,\n} from 'axios';\nimport type {\n CommonDbExternalLogItem,\n CommonDbSystemApi,\n} from '@gen-epix/api-commondb';\nimport { CommonDbLogLevel } from '@gen-epix/api-commondb';\nimport { StringUtil } from '@gen-epix/ui-core/utils/StringUtil';\nimport {\n inject,\n singleton,\n} from 'tsyringe';\n\nimport { API_SYSTEM_TOKEN } from '../../../constants/api.constants';\nimport { AuthenticationService } from '../AuthenticationService';\nimport { AxiosUtil } from '../../../utils/AxiosUtil';\nimport { CONFIG_TOKEN } from '../../../constants/config.constants';\nimport type { ConfigBase } from '../../../models/config.models';\n\ntype LogServiceItem = {\n detail?: unknown;\n duration?: number;\n level: CommonDbLogLevel;\n topic: string;\n};\n\n@singleton()\nexport class LogService {\n protected readonly requestMap: Map<string, number>;\n\n private readonly authenticationService: AuthenticationService;\n private readonly config: Pick<ConfigBase, 'getSoftwareVersion' | 'log'>;\n private logItems: CommonDbExternalLogItem[] = [];\n private readonly systemApi: CommonDbSystemApi;\n\n public constructor(\n @inject(CONFIG_TOKEN) config: ConfigBase,\n @inject(AuthenticationService) authenticationService: AuthenticationService,\n @inject(API_SYSTEM_TOKEN) systemApi: CommonDbSystemApi,\n ) {\n this.requestMap = new Map<string, number>();\n this.config = config;\n this.authenticationService = authenticationService;\n this.systemApi = systemApi;\n setInterval(() => {\n this.sendLog();\n }, config.log.LOG_INTERVAL_MS);\n }\n\n\n public flushLog(): void {\n this.sendLog();\n }\n\n public log(items: LogServiceItem[]): void {\n const timestamp = new Date().toISOString();\n const software_version = this.config.getSoftwareVersion();\n this.logItems.push(...items.map<CommonDbExternalLogItem>(item => {\n return {\n command_id: StringUtil.createUuid(),\n detail: item.detail === undefined || item.detail === null ? null : JSON.stringify(item.detail),\n duration: item.duration ?? null,\n level: item.level,\n software_version,\n timestamp,\n topic: item.topic ?? null,\n };\n }));\n }\n\n public onRequest(request: InternalAxiosRequestConfig): InternalAxiosRequestConfig {\n if (request.headers.has('X-IGNORE-LOG')) {\n return request;\n }\n const requestId = StringUtil.createUuid();\n request.headers.set('X-REQUEST-ID', requestId);\n this.requestMap.set(requestId, new Date().getTime());\n\n this.log([{\n detail: {\n requestData: request.data as unknown,\n requestParams: request.params as unknown,\n url: request.url,\n },\n level: CommonDbLogLevel.TRACE,\n topic: 'REQUEST',\n }]);\n\n return request;\n }\n\n public onResponseFulfilled(response: AxiosResponse): AxiosResponse {\n if (response.config.headers.has('X-IGNORE-LOG')) {\n return response;\n }\n\n const requestId = response.config.headers.get('X-REQUEST-ID');\n const requestStartedAt = typeof requestId === 'string' ? this.requestMap.get(requestId) : undefined;\n const duration = requestStartedAt === undefined ? undefined : Date.now() - requestStartedAt;\n if (typeof requestId === 'string') {\n this.requestMap.delete(requestId);\n }\n\n this.log([{\n detail: {\n requestData: response.config.data as unknown,\n requestParams: response.config.params as unknown,\n url: response.config.url,\n },\n duration,\n level: response.status >= 200 && response.status < 300 ? CommonDbLogLevel.TRACE : CommonDbLogLevel.ERROR,\n topic: 'RESPONSE',\n }]);\n\n return response;\n }\n\n public onResponseRejected(error: unknown): void {\n if (isAxiosError(error)) {\n const requestId = error.config?.headers.get('X-REQUEST-ID');\n if (AxiosUtil.isAxiosCanceledError(error)) {\n if (typeof requestId === 'string') {\n this.requestMap.delete(requestId);\n }\n return;\n }\n const requestStartedAt = typeof requestId === 'string' ? this.requestMap.get(requestId) : undefined;\n const duration = requestStartedAt === undefined ? undefined : Date.now() - requestStartedAt;\n if (typeof requestId === 'string') {\n this.requestMap.delete(requestId);\n }\n this.log([{\n detail: {\n requestParams: error.config?.params as unknown,\n responseData: error.response?.data as unknown,\n status: error.response?.status,\n url: error.config?.url,\n },\n duration,\n level: CommonDbLogLevel.ERROR,\n topic: 'RESPONSE_ERROR',\n }]);\n } else {\n this.log([{\n detail: {\n error: error instanceof Error ? error.message : error,\n },\n level: CommonDbLogLevel.ERROR,\n topic: 'RESPONSE_ERROR',\n }]);\n }\n }\n\n private sendLog(): void {\n if (!this.logItems.length || !this.authenticationService?.authContextProps?.isAuthenticated) {\n return;\n }\n if (document.location.href.includes('accept-invitation')) {\n return;\n }\n this.systemApi.log({\n log_items: this.logItems,\n }, {\n headers: {\n 'X-IGNORE-LOG': '1',\n },\n }).catch((error: unknown) => {\n console.error('Failed to send logs', error);\n });\n this.logItems = [];\n }\n}\n"],"mappings":";;;;;;;;;;;AA8BO,IAAMI,IAAN,MAAiB;CACtB;CAEA;CACA;CACA,WAA8C,CAAC;CAC/C;CAEA,YACE,GACA,GACA,GACA;EAKA,AAJA,KAAK,6BAAa,IAAI,IAAoB,GAC1C,KAAK,SAASC,GACd,KAAK,wBAAwBC,GAC7B,KAAK,YAAYC,GACjB,kBAAkB;GAChB,KAAK,QAAQ;EACf,GAAGF,EAAO,IAAI,eAAe;CAC/B;CAGA,WAAwB;EACtB,KAAK,QAAQ;CACf;CAEA,IAAW,GAA+B;EACxC,IAAMG,qBAAY,IAAI,KAAK,EAAA,CAAE,YAAY,GACnCC,IAAmB,KAAK,OAAO,mBAAmB;EACxD,KAAK,SAAS,KAAK,GAAGC,EAAM,KAA6B,OAChD;GACL,YAAYC,EAAW,WAAW;GAClC,QAAQC,EAAK,WAAW,KAAA,KAAaA,EAAK,WAAW,OAAO,OAAO,KAAK,UAAUA,EAAK,MAAM;GAC7F,UAAUA,EAAK,YAAY;GAC3B,OAAOA,EAAK;GACZ;GACA;GACA,OAAOA,EAAK,SAAS;EACvB,EACD,CAAC;CACJ;CAEA,UAAiB,GAAiE;EAChF,IAAIC,EAAQ,QAAQ,IAAI,cAAc,GACpC,OAAOA;EAET,IAAMC,IAAYH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,OAAOH,KAAc,YACvB,KAAK,WAAW,OAAOA,CAAS,GAElC,KAAK,IAAI,CAAC;IACR,QAAQ;KACN,eAAeM,EAAM,QAAQ;KAC7B,cAAcA,EAAM,UAAU;KAC9B,QAAQA,EAAM,UAAU;KACxB,KAAKA,EAAM,QAAQ;IACrB;IACA;IACA,OAAOL,EAAiB;IACxB,OAAO;GACT,CAAC,CAAC;EACJ,OACE,KAAK,IAAI,CAAC;GACR,QAAQ,EACN,OAAOK,aAAiB,QAAQA,EAAM,UAAUA,EAClD;GACA,OAAOL,EAAiB;GACxB,OAAO;EACT,CAAC,CAAC;CAEN;CAEA,UAAwB;EACtB,AAAK,KAAK,SAAS,UAAW,KAAK,uBAAuB,kBAAkB,oBAGxE,SAAS,SAAS,KAAK,SAAS,mBAAmB,MAGvD,KAAK,UAAU,IAAI,EACjB,WAAW,KAAK,SAClB,GAAG,EACD,SAAS,EACP,gBAAgB,IAClB,EACF,CAAC,CAAC,CAAC,OAAO,MAAmB;GAC3B,QAAQ,MAAM,uBAAuBK,CAAK;EAC5C,CAAC,GACD,KAAK,WAAW,CAAC;CACnB;AACF;;CAjJCE,EAAU;CAUNrB,EAAA,GAAAsB,EAAOC,CAAY,CAAA;CACnBvB,EAAA,GAAAsB,EAAOE,CAAqB,CAAA;CAC5BxB,EAAA,GAAAsB,EAAOG,CAAgB,CAAA"}
@@ -1,11 +1,10 @@
1
1
  import { t as e } from "../../../_chunks/decorate.js";
2
2
  import { singleton as t } from "tsyringe";
3
- //#region src/classes/services/NavigationHistoryService/NavigationHistoryService.ts
3
+ // src/classes/services/NavigationHistoryService/NavigationHistoryService.ts
4
4
  var n = class {
5
5
  navigationHistory = [];
6
6
  };
7
7
  n = e([t()], n);
8
- //#endregion
9
8
  export { n as NavigationHistoryService };
10
9
 
11
10
  //# sourceMappingURL=index.js.map