@gen-epix/ui-client-common 4.5.0 → 4.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) 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 +44 -44
  5. package/dist/_chunks/ApplicationFooter.js.map +1 -1
  6. package/dist/_chunks/Breadcrumbs.js +13 -13
  7. package/dist/_chunks/CrudPage.js +300 -300
  8. package/dist/_chunks/CrudPage.js.map +1 -1
  9. package/dist/_chunks/Notifications.js +51 -51
  10. package/dist/_chunks/OutageList.js +29 -29
  11. package/dist/_chunks/OutageUtil.js +1 -2
  12. package/dist/_chunks/OutageUtil.js.map +1 -1
  13. package/dist/_chunks/QueryClientService.js +96 -388
  14. package/dist/_chunks/QueryClientService.js.map +1 -1
  15. package/dist/_chunks/Table.js +518 -512
  16. package/dist/_chunks/Table.js.map +1 -1
  17. package/dist/_chunks/TableUtil.js +8 -16
  18. package/dist/_chunks/TableUtil.js.map +1 -1
  19. package/dist/_chunks/TextFilter.js +14 -12
  20. package/dist/_chunks/TextFilter.js.map +1 -1
  21. package/dist/_chunks/UserInvitationsAdminPage.js +77 -77
  22. package/dist/_chunks/UserInvitationsAdminPage.js.map +1 -1
  23. package/dist/_chunks/UserManagerUtil.js +210 -209
  24. package/dist/_chunks/UserManagerUtil.js.map +1 -1
  25. package/dist/_chunks/_baseFlatten.js +8 -8
  26. package/dist/_chunks/_baseFlatten.js.map +1 -1
  27. package/dist/_chunks/_baseGet.js +280 -0
  28. package/dist/_chunks/_baseGet.js.map +1 -0
  29. package/dist/_chunks/_baseIteratee.js +274 -0
  30. package/dist/_chunks/_baseIteratee.js.map +1 -0
  31. package/dist/_chunks/_baseUnset.js +22 -299
  32. package/dist/_chunks/_baseUnset.js.map +1 -1
  33. package/dist/_chunks/last.js +13 -0
  34. package/dist/_chunks/last.js.map +1 -0
  35. package/dist/_chunks/omit.js +41 -40
  36. package/dist/_chunks/omit.js.map +1 -1
  37. package/dist/_chunks/tableStore.js +190 -183
  38. package/dist/_chunks/tableStore.js.map +1 -1
  39. package/dist/_chunks/uniq.js +44 -0
  40. package/dist/_chunks/uniq.js.map +1 -0
  41. package/dist/_chunks/useMutation.js +22 -22
  42. package/dist/_chunks/useMutation.js.map +1 -1
  43. package/dist/_chunks/useQueryMemo.js +25 -8
  44. package/dist/_chunks/useQueryMemo.js.map +1 -1
  45. package/dist/classes/abstracts/FilterAbstract/index.js +3 -1
  46. package/dist/classes/abstracts/FilterAbstract/index.js.map +1 -1
  47. package/dist/classes/filters/MultiSelectFilter.d.ts +1 -1
  48. package/dist/classes/services/AuthenticationService/AuthenticationService.d.ts +1 -1
  49. package/dist/classes/services/AuthenticationService/index.js +15 -15
  50. package/dist/classes/services/AuthenticationService/index.js.map +1 -1
  51. package/dist/classes/services/AuthorizationService/index.js +4 -4
  52. package/dist/classes/services/AuthorizationService/index.js.map +1 -1
  53. package/dist/classes/services/BackendVersionService/index.js +3 -2
  54. package/dist/classes/services/BackendVersionService/index.js.map +1 -1
  55. package/dist/classes/services/BreadcrumbService/index.js +16 -38
  56. package/dist/classes/services/BreadcrumbService/index.js.map +1 -1
  57. package/dist/classes/services/EmotionCacheService/index.js +9 -8
  58. package/dist/classes/services/EmotionCacheService/index.js.map +1 -1
  59. package/dist/classes/services/I18nService/index.js +11 -10
  60. package/dist/classes/services/I18nService/index.js.map +1 -1
  61. package/dist/classes/services/InactivityService/index.js +12 -12
  62. package/dist/classes/services/InactivityService/index.js.map +1 -1
  63. package/dist/classes/services/LogService/index.js +39 -33
  64. package/dist/classes/services/LogService/index.js.map +1 -1
  65. package/dist/classes/services/NotificationService/index.js +8 -8
  66. package/dist/classes/services/NotificationService/index.js.map +1 -1
  67. package/dist/classes/services/PageEventBusService/index.js +13 -9
  68. package/dist/classes/services/PageEventBusService/index.js.map +1 -1
  69. package/dist/classes/services/RouterService/index.js +3 -6
  70. package/dist/classes/services/RouterService/index.js.map +1 -1
  71. package/dist/components/app/App/App.d.ts +1 -1
  72. package/dist/components/app/App/index.js +34 -38
  73. package/dist/components/app/App/index.js.map +1 -1
  74. package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js +28 -28
  75. package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js.map +1 -1
  76. package/dist/components/app/ApplicationBootstrapWithoutAuthorization/index.js +47 -45
  77. package/dist/components/app/ApplicationBootstrapWithoutAuthorization/index.js.map +1 -1
  78. package/dist/components/app/AuthenticationWrapper/index.js +35 -35
  79. package/dist/components/app/AuthenticationWrapper/index.js.map +1 -1
  80. package/dist/components/app/AuthorizationWrapper/index.js +19 -19
  81. package/dist/components/app/AuthorizationWrapper/index.js.map +1 -1
  82. package/dist/components/app/RouterRoot/index.js +52 -50
  83. package/dist/components/app/RouterRoot/index.js.map +1 -1
  84. package/dist/components/epi/EpiContactDetailsDialog/index.js +21 -21
  85. package/dist/components/filters/BooleanFilterField/index.js +5 -5
  86. package/dist/components/filters/DateFilterField/index.js +3 -3
  87. package/dist/components/filters/GeoFilterField/index.js +4 -4
  88. package/dist/components/filters/MultiSelectFilterField/index.js +4 -4
  89. package/dist/components/filters/NumberRangeFilterField/index.js +3 -3
  90. package/dist/components/filters/TextFilterField/index.js +3 -3
  91. package/dist/components/ui/ApplicationBar/index.js +188 -188
  92. package/dist/components/ui/ApplicationBar/index.js.map +1 -1
  93. package/dist/components/ui/GenericErrorMessage/index.js +29 -29
  94. package/dist/components/ui/LicensesDialog/index.js +38 -38
  95. package/dist/components/ui/LicensesDialog/index.js.map +1 -1
  96. package/dist/components/ui/MyPermissionsDialog/index.js +16 -16
  97. package/dist/components/ui/NavLink/index.js +6 -6
  98. package/dist/components/ui/OrganizationSwitcherDialog/index.js +21 -21
  99. package/dist/components/ui/OrganizationSwitcherDialog/index.js.map +1 -1
  100. package/dist/components/ui/PageContainer/index.js +24 -24
  101. package/dist/components/ui/PageContainer/index.js.map +1 -1
  102. package/dist/components/ui/Sidebar/index.js +30 -30
  103. package/dist/components/ui/UserFeedbackDialog/index.js +12 -12
  104. package/dist/constants/config.constants.d.ts +0 -2
  105. package/dist/constants/config.constants.js +2 -2
  106. package/dist/constants/config.constants.js.map +1 -1
  107. package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/index.js +12 -12
  108. package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/index.js.map +1 -1
  109. package/dist/dataHooks/useIdentifierIssuerQuery/index.js +14 -14
  110. package/dist/dataHooks/useIdentifierIssuerQuery/index.js.map +1 -1
  111. package/dist/dataHooks/useInviteUserConstraintsQuery/index.js +12 -12
  112. package/dist/dataHooks/useInviteUserConstraintsQuery/index.js.map +1 -1
  113. package/dist/dataHooks/useOrganizationAdminPoliciesQuery/index.js +13 -13
  114. package/dist/dataHooks/useOrganizationAdminPoliciesQuery/index.js.map +1 -1
  115. package/dist/dataHooks/useOrganizationIdentifierIssuerLinksQuery/index.js +4 -4
  116. package/dist/dataHooks/useOrganizationsQuery/index.js +13 -13
  117. package/dist/dataHooks/useOrganizationsQuery/index.js.map +1 -1
  118. package/dist/dataHooks/useUsersQuery/index.js +10 -10
  119. package/dist/dataHooks/useUsersQuery/index.js.map +1 -1
  120. package/dist/hooks/useConfig/index.js +2 -2
  121. package/dist/hooks/useConfig/index.js.map +1 -1
  122. package/dist/hooks/useCreateMutation/index.js +12 -12
  123. package/dist/hooks/useCreateMutation/index.js.map +1 -1
  124. package/dist/hooks/useDeleteMutation/index.js +16 -9
  125. package/dist/hooks/useDeleteMutation/index.js.map +1 -1
  126. package/dist/hooks/useEditMutation/index.js +48 -33
  127. package/dist/hooks/useEditMutation/index.js.map +1 -1
  128. package/dist/hooks/useItemQuery/index.js +4 -4
  129. package/dist/hooks/useItemQuery/index.js.map +1 -1
  130. package/dist/locale/en.json +1 -0
  131. package/dist/locale/nl.json +1 -0
  132. package/dist/models/config.models.d.ts +1 -5
  133. package/dist/models/theme.models.d.ts +19 -16
  134. package/dist/pages/AcceptInvitationPage/index.js +25 -25
  135. package/dist/pages/AcceptInvitationPage/index.js.map +1 -1
  136. package/dist/pages/AdminPage/index.js +16 -16
  137. package/dist/pages/ChooseIdentityProviderPage/index.js +21 -21
  138. package/dist/pages/IdentifierIssuersAdminPage/index.js +5 -5
  139. package/dist/pages/OrganizationAdminPoliciesAdminPage/index.js +5 -5
  140. package/dist/pages/OrganizationContactsAdminPage/index.js +6 -6
  141. package/dist/pages/OrganizationSitesAdminPage/index.js +9 -9
  142. package/dist/pages/OrganizationsAdminPage/index.js +13 -13
  143. package/dist/pages/OutagesAdminPage/index.js +20 -20
  144. package/dist/pages/PostLoginPage/index.js +6 -6
  145. package/dist/pages/PostLogoutPage/index.js +8 -8
  146. package/dist/pages/UsersAdminPage/index.js +39 -39
  147. package/dist/pages/UsersAdminPage/index.js.map +1 -1
  148. package/dist/setup/setup.js +11 -4
  149. package/dist/setup/setup.js.map +1 -1
  150. package/dist/theme/demoTheme/index.js +17 -15
  151. package/dist/theme/demoTheme/index.js.map +1 -1
  152. package/dist/utils/DataHookUtil/index.js +1 -1
  153. package/dist/utils/DataHookUtil/index.js.map +1 -1
  154. package/dist/utils/DependencyContainerUtil/DependencyContainerUtil.d.ts +2 -3
  155. package/dist/utils/DependencyContainerUtil/index.js +10 -15
  156. package/dist/utils/DependencyContainerUtil/index.js.map +1 -1
  157. package/dist/utils/MenuDataUtil/index.js +1 -1
  158. package/dist/utils/MenuDataUtil/index.js.map +1 -1
  159. package/dist/utils/StandardConfigUtil/index.js +0 -4
  160. package/dist/utils/StandardConfigUtil/index.js.map +1 -1
  161. package/dist/utils/TimeUtil/index.js +1 -1
  162. package/dist/utils/TimeUtil/index.js.map +1 -1
  163. package/package.json +10 -13
  164. package/dist/context/ClientCommonConfigContext/ClientCommonConfigContext.d.ts +0 -9
  165. package/dist/context/ClientCommonConfigContext/ClientCommonConfigContextProvider.d.ts +0 -6
  166. package/dist/context/ClientCommonConfigContext/index.d.ts +0 -3
  167. package/dist/context/ClientCommonConfigContext/index.js +0 -34
  168. package/dist/context/ClientCommonConfigContext/index.js.map +0 -1
  169. package/dist/context/ClientCommonConfigContext/useClientCommonConfigContext.d.ts +0 -3
@@ -1,11 +1,11 @@
1
1
  import { t as e } from "../../../_chunks/Reflect.js";
2
- import { t } from "../../../_chunks/decorate.js";
3
- import { WINDOW_SERVICE_TOKEN as n } from "../../../constants/config.constants.js";
4
- import { AxiosUtil as r } from "../../../utils/AxiosUtil/index.js";
5
- import { oidcStore as i } from "../../../stores/oidcStore/index.js";
6
- import { t as a } from "../../../_chunks/decorateParam.js";
7
- import { AuthorizationService as o } from "../AuthorizationService/index.js";
8
- import { inject as s, singleton as c } from "tsyringe";
2
+ import { AxiosUtil as t } from "../../../utils/AxiosUtil/index.js";
3
+ import { oidcStore as n } from "../../../stores/oidcStore/index.js";
4
+ import { t as r } from "../../../_chunks/decorateParam.js";
5
+ import { t as i } from "../../../_chunks/decorate.js";
6
+ import { AuthorizationService as a } from "../AuthorizationService/index.js";
7
+ import { inject as o, singleton as s } from "tsyringe";
8
+ import { WindowService as c } from "@gen-epix/ui-core/classes/services/WindowService";
9
9
  import { Subject as l } from "@gen-epix/ui-core/classes/Subject";
10
10
  import { SubscribableAbstract as u } from "@gen-epix/ui-core/classes/abstracts/SubscribableAbstract";
11
11
  e();
@@ -19,7 +19,7 @@ var d, f = Symbol("createdAt"), p = class extends u {
19
19
  authorizationService;
20
20
  windowService;
21
21
  constructor(e, t) {
22
- super(new l(i.getState().configuration)), this.authorizationService = e, this.windowService = t;
22
+ super(new l(n.getState().configuration)), this.authorizationService = e, this.windowService = t;
23
23
  }
24
24
  static clearStaleState() {
25
25
  Object.keys(sessionStorage).forEach((e) => {
@@ -27,17 +27,17 @@ var d, f = Symbol("createdAt"), p = class extends u {
27
27
  });
28
28
  }
29
29
  getUserManagerSettingsCreatedAt() {
30
- return Reflect.getMetadata(f, this.data);
30
+ return this.data ? Reflect.getMetadata(f, this.data) : void 0;
31
31
  }
32
32
  next(e) {
33
- e ? (Reflect.defineMetadata(f, (/* @__PURE__ */ new Date()).getTime(), e), i.getState().setConfiguration(e)) : i.getState().setConfiguration(void 0), super.next(e);
33
+ e ? (Reflect.defineMetadata(f, (/* @__PURE__ */ new Date()).getTime(), e), n.getState().setConfiguration(e)) : n.getState().setConfiguration(void 0), super.next(e);
34
34
  }
35
35
  onRequest(e) {
36
36
  let t = this.temporaryToken ?? this.authContextProps?.user?.access_token;
37
37
  return t && e.headers.set("Authorization", `Bearer ${t}`), e;
38
38
  }
39
39
  onResponseRejected(e) {
40
- if (!this.temporaryToken && r.isAxiosUnauthorizedError(e)) {
40
+ if (!this.temporaryToken && t.isAxiosUnauthorizedError(e)) {
41
41
  let t = this.authContextProps?.user?.state?.redirectCounter ?? 0;
42
42
  if (t > 0 || !this.authorizationService.user) throw e;
43
43
  (async () => {
@@ -53,10 +53,10 @@ var d, f = Symbol("createdAt"), p = class extends u {
53
53
  }
54
54
  }
55
55
  };
56
- p = d = t([
57
- c(),
58
- a(0, s(o)),
59
- a(1, s(n))
56
+ p = d = i([
57
+ s(),
58
+ r(0, o(a)),
59
+ r(1, o(c))
60
60
  ], p);
61
61
  //#endregion
62
62
  export { p as AuthenticationService, f as createdAtMetaDataKey };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_decorate","_decorateParam","require_Reflect","__decorateParam","_AuthenticationService","createdAtMetaDataKey","AuthenticationService","SubscribableAbstract","Subject","oidcStore","authorizationService","windowService","key","oidcConfiguration","accessToken","request","AxiosUtil","error","redirectCounter","__decorate","singleton","inject","AuthorizationService","WINDOW_SERVICE_TOKEN"],"sources":["../../../../src/classes/services/AuthenticationService/AuthenticationService.ts"],"sourcesContent":["import 'reflect-metadata';\nimport type { InternalAxiosRequestConfig } from 'axios';\nimport type { AuthContextProps } from 'react-oidc-context';\nimport type { CommonDbIdentityProvider } from '@gen-epix/api-commondb';\nimport type { WindowService } from '@gen-epix/ui-core/classes/services/WindowService';\nimport { Subject } from '@gen-epix/ui-core/classes/Subject';\nimport { SubscribableAbstract } from '@gen-epix/ui-core/classes/abstracts/SubscribableAbstract';\nimport {\n inject,\n singleton,\n} from 'tsyringe';\n\nimport { AuthorizationService } from '../AuthorizationService';\nimport type { AuthState } from '../../../models/auth.models';\nimport { oidcStore } from '../../../stores/oidcStore';\nimport { AxiosUtil } from '../../../utils/AxiosUtil';\nimport { WINDOW_SERVICE_TOKEN } from '../../../constants/config.constants';\n\nexport const createdAtMetaDataKey = Symbol('createdAt');\n\n@singleton()\nexport class AuthenticationService extends SubscribableAbstract<CommonDbIdentityProvider> {\n public static autoLoginSkew = 500;\n\n public authContextProps: AuthContextProps;\n\n public temporaryToken: string;\n private readonly authorizationService: AuthorizationService;\n private readonly windowService: WindowService;\n\n public constructor(\n @inject(AuthorizationService) authorizationService: AuthorizationService,\n @inject(WINDOW_SERVICE_TOKEN) windowService: WindowService,\n ) {\n super(new Subject(oidcStore.getState().configuration));\n this.authorizationService = authorizationService;\n this.windowService = windowService;\n }\n\n public static clearStaleState(): void {\n Object.keys(sessionStorage).forEach((key) => {\n if (key.startsWith('oidc')) {\n sessionStorage.removeItem(key);\n }\n });\n }\n\n\n public getUserManagerSettingsCreatedAt(): number {\n return Reflect.getMetadata(createdAtMetaDataKey, this.data) as number;\n }\n\n public next(oidcConfiguration: CommonDbIdentityProvider) {\n if (oidcConfiguration) {\n Reflect.defineMetadata(createdAtMetaDataKey, new Date().getTime(), oidcConfiguration);\n oidcStore.getState().setConfiguration(oidcConfiguration);\n } else {\n oidcStore.getState().setConfiguration(undefined);\n }\n super.next(oidcConfiguration);\n }\n\n public onRequest(request: InternalAxiosRequestConfig): InternalAxiosRequestConfig {\n const accessToken = this.temporaryToken ?? this.authContextProps?.user?.access_token;\n if (accessToken) {\n request.headers.set('Authorization', `Bearer ${accessToken}`);\n }\n return request;\n }\n\n public onResponseRejected(error: unknown): void {\n if (!this.temporaryToken && AxiosUtil.isAxiosUnauthorizedError(error)) {\n const redirectCounter = (this.authContextProps?.user?.state as AuthState)?.redirectCounter ?? 0;\n\n // If the user is not logged in, or the user is already redirected, throw the error\n\n if (redirectCounter > 0 || !this.authorizationService.user) {\n throw error;\n }\n\n const perform = async () => {\n if (!this.authContextProps) {\n return;\n }\n // Clean the stale state (removes items from the session storage)\n AuthenticationService.clearStaleState();\n // Redirect the user to the IDP sign in page\n await this.authContextProps.signinRedirect({\n state: {\n preLoginLocation: {\n hash: this.windowService.window.location.hash,\n pathname: this.windowService.window.location.pathname,\n search: this.windowService.window.location.search,\n },\n redirectCounter: redirectCounter + 1,\n },\n });\n };\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n perform();\n }\n }\n}\n"],"mappings":";;;;;;;;;;;OAkBaK,IAAuB,OAAO,WAAW,GAGzCC,IAAN,cAAoCC,EAA+C;;;;CACxF,OAAc,gBAAgB;CAE9B;CAEA;CACA;CACA;CAEA,YACE,GACA,GACA;EAGA,AAFA,MAAM,IAAIC,EAAQC,EAAU,SAAS,CAAC,CAAC,aAAa,CAAC,GACrD,KAAK,uBAAuBC,GAC5B,KAAK,gBAAgBC;CACvB;CAEA,OAAc,kBAAwB;EACpC,OAAO,KAAK,cAAc,CAAC,CAAC,SAAS,MAAQ;GAC3C,AAAIC,EAAI,WAAW,MAAM,KACvB,eAAe,WAAWA,CAAG;EAEjC,CAAC;CACH;CAGA,kCAAiD;EAC/C,OAAO,QAAQ,YAAYP,GAAsB,KAAK,IAAI;CAC5D;CAEA,KAAY,GAA6C;EAOvD,AANIQ,KACF,QAAQ,eAAeR,oBAAsB,IAAI,KAAK,EAAA,CAAE,QAAQ,GAAGQ,CAAiB,GACpFJ,EAAU,SAAS,CAAC,CAAC,iBAAiBI,CAAiB,KAEvDJ,EAAU,SAAS,CAAC,CAAC,iBAAiB,KAAA,CAAS,GAEjD,MAAM,KAAKI,CAAiB;CAC9B;CAEA,UAAiB,GAAiE;EAChF,IAAMC,IAAc,KAAK,kBAAkB,KAAK,kBAAkB,MAAM;EAIxE,OAHIA,KACFC,EAAQ,QAAQ,IAAI,iBAAiB,UAAUD,GAAa,GAEvDC;CACT;CAEA,mBAA0B,GAAsB;EAC9C,IAAI,CAAC,KAAK,kBAAkBC,EAAU,yBAAyBC,CAAK,GAAG;GACrE,IAAMC,IAAmB,KAAK,kBAAkB,MAAM,OAAqB,mBAAmB;GAI9F,IAAIA,IAAkB,KAAK,CAAC,KAAK,qBAAqB,MACpD,MAAMD;GAsBR,aAnB4B;IAC1B,AAAK,KAAK,qBAIVb,EAAsB,gBAAgB,GAEtC,MAAM,KAAK,iBAAiB,eAAe,EACzC,OAAO;KACL,kBAAkB;MAChB,MAAM,KAAK,cAAc,OAAO,SAAS;MACzC,UAAU,KAAK,cAAc,OAAO,SAAS;MAC7C,QAAQ,KAAK,cAAc,OAAO,SAAS;KAC7C;KACA,iBAAiBc,IAAkB;IACrC,EACF,CAAC;GACH,EAEA,CAAQ;EACV;CACF;AACF;;CAlFCE,EAAU;CAWNnB,EAAA,GAAAoB,EAAOC,CAAoB,CAAA;CAC3BrB,EAAA,GAAAoB,EAAOE,CAAoB,CAAA"}
1
+ {"version":3,"file":"index.js","names":["_decorate","_decorateParam","require_Reflect","__decorateParam","__decorate","_AuthenticationService","createdAtMetaDataKey","AuthenticationService","SubscribableAbstract","Subject","oidcStore","authorizationService","windowService","key","oidcConfiguration","accessToken","request","AxiosUtil","error","redirectCounter","singleton","inject","AuthorizationService","WindowService"],"sources":["../../../../src/classes/services/AuthenticationService/AuthenticationService.ts"],"sourcesContent":["import 'reflect-metadata';\nimport type { InternalAxiosRequestConfig } from 'axios';\nimport type { AuthContextProps } from 'react-oidc-context';\nimport type { CommonDbIdentityProvider } from '@gen-epix/api-commondb';\nimport { WindowService } from '@gen-epix/ui-core/classes/services/WindowService';\nimport { Subject } from '@gen-epix/ui-core/classes/Subject';\nimport { SubscribableAbstract } from '@gen-epix/ui-core/classes/abstracts/SubscribableAbstract';\nimport {\n inject,\n singleton,\n} from 'tsyringe';\n\nimport { AuthorizationService } from '../AuthorizationService';\nimport type { AuthState } from '../../../models/auth.models';\nimport { oidcStore } from '../../../stores/oidcStore';\nimport { AxiosUtil } from '../../../utils/AxiosUtil';\n\nexport const createdAtMetaDataKey = Symbol('createdAt');\n\n@singleton()\nexport class AuthenticationService extends SubscribableAbstract<CommonDbIdentityProvider> {\n public static autoLoginSkew = 500;\n\n public authContextProps: AuthContextProps;\n\n public temporaryToken: string;\n private readonly authorizationService: AuthorizationService;\n private readonly windowService: WindowService;\n\n public constructor(\n @inject(AuthorizationService) authorizationService: AuthorizationService,\n @inject(WindowService) windowService: WindowService,\n ) {\n super(new Subject(oidcStore.getState().configuration));\n this.authorizationService = authorizationService;\n this.windowService = windowService;\n }\n\n public static clearStaleState(): void {\n Object.keys(sessionStorage).forEach((key) => {\n if (key.startsWith('oidc')) {\n sessionStorage.removeItem(key);\n }\n });\n }\n\n\n public getUserManagerSettingsCreatedAt(): number | undefined {\n return this.data ? Reflect.getMetadata(createdAtMetaDataKey, this.data) as number : undefined;\n }\n\n public next(oidcConfiguration: CommonDbIdentityProvider) {\n if (oidcConfiguration) {\n Reflect.defineMetadata(createdAtMetaDataKey, new Date().getTime(), oidcConfiguration);\n oidcStore.getState().setConfiguration(oidcConfiguration);\n } else {\n oidcStore.getState().setConfiguration(undefined);\n }\n super.next(oidcConfiguration);\n }\n\n public onRequest(request: InternalAxiosRequestConfig): InternalAxiosRequestConfig {\n const accessToken = this.temporaryToken ?? this.authContextProps?.user?.access_token;\n if (accessToken) {\n request.headers.set('Authorization', `Bearer ${accessToken}`);\n }\n return request;\n }\n\n public onResponseRejected(error: unknown): void {\n if (!this.temporaryToken && AxiosUtil.isAxiosUnauthorizedError(error)) {\n const redirectCounter = (this.authContextProps?.user?.state as AuthState)?.redirectCounter ?? 0;\n\n // If the user is not logged in, or the user is already redirected, throw the error\n\n if (redirectCounter > 0 || !this.authorizationService.user) {\n throw error;\n }\n\n const perform = async () => {\n if (!this.authContextProps) {\n return;\n }\n // Clean the stale state (removes items from the session storage)\n AuthenticationService.clearStaleState();\n // Redirect the user to the IDP sign in page\n await this.authContextProps.signinRedirect({\n state: {\n preLoginLocation: {\n hash: this.windowService.window.location.hash,\n pathname: this.windowService.window.location.pathname,\n search: this.windowService.window.location.search,\n },\n redirectCounter: redirectCounter + 1,\n },\n });\n };\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n perform();\n }\n }\n}\n"],"mappings":";;;;;;;;;;;OAiBaM,IAAuB,OAAO,WAAW,GAGzCC,IAAN,cAAoCC,EAA+C;;;;CACxF,OAAc,gBAAgB;CAE9B;CAEA;CACA;CACA;CAEA,YACE,GACA,GACA;EAGA,AAFA,MAAM,IAAIC,EAAQC,EAAU,SAAS,CAAC,CAAC,aAAa,CAAC,GACrD,KAAK,uBAAuBC,GAC5B,KAAK,gBAAgBC;CACvB;CAEA,OAAc,kBAAwB;EACpC,OAAO,KAAK,cAAc,CAAC,CAAC,SAAS,MAAQ;GAC3C,AAAIC,EAAI,WAAW,MAAM,KACvB,eAAe,WAAWA,CAAG;EAEjC,CAAC;CACH;CAGA,kCAA6D;EAC3D,OAAO,KAAK,OAAO,QAAQ,YAAYP,GAAsB,KAAK,IAAI,IAAc,KAAA;CACtF;CAEA,KAAY,GAA6C;EAOvD,AANIQ,KACF,QAAQ,eAAeR,oBAAsB,IAAI,KAAK,EAAA,CAAE,QAAQ,GAAGQ,CAAiB,GACpFJ,EAAU,SAAS,CAAC,CAAC,iBAAiBI,CAAiB,KAEvDJ,EAAU,SAAS,CAAC,CAAC,iBAAiB,KAAA,CAAS,GAEjD,MAAM,KAAKI,CAAiB;CAC9B;CAEA,UAAiB,GAAiE;EAChF,IAAMC,IAAc,KAAK,kBAAkB,KAAK,kBAAkB,MAAM;EAIxE,OAHIA,KACFC,EAAQ,QAAQ,IAAI,iBAAiB,UAAUD,GAAa,GAEvDC;CACT;CAEA,mBAA0B,GAAsB;EAC9C,IAAI,CAAC,KAAK,kBAAkBC,EAAU,yBAAyBC,CAAK,GAAG;GACrE,IAAMC,IAAmB,KAAK,kBAAkB,MAAM,OAAqB,mBAAmB;GAI9F,IAAIA,IAAkB,KAAK,CAAC,KAAK,qBAAqB,MACpD,MAAMD;GAsBR,aAnB4B;IAC1B,AAAK,KAAK,qBAIVb,EAAsB,gBAAgB,GAEtC,MAAM,KAAK,iBAAiB,eAAe,EACzC,OAAO;KACL,kBAAkB;MAChB,MAAM,KAAK,cAAc,OAAO,SAAS;MACzC,UAAU,KAAK,cAAc,OAAO,SAAS;MAC7C,QAAQ,KAAK,cAAc,OAAO,SAAS;KAC7C;KACA,iBAAiBc,IAAkB;IACrC,EACF,CAAC;GACH,EAEA,CAAQ;EACV;CACF;AACF;;CAlFCC,EAAU;CAWNnB,EAAA,GAAAoB,EAAOC,CAAoB,CAAA;CAC3BrB,EAAA,GAAAoB,EAAOE,CAAa,CAAA"}
@@ -1,5 +1,5 @@
1
- import { t as e } from "../../../_chunks/decorate.js";
2
- import { t } from "../../../_chunks/decorateParam.js";
1
+ import { t as e } from "../../../_chunks/decorateParam.js";
2
+ import { t } from "../../../_chunks/decorate.js";
3
3
  import { PageEventBusService as n } from "../PageEventBusService/index.js";
4
4
  import { inject as r, singleton as i } from "tsyringe";
5
5
  //#region src/classes/services/AuthorizationService/AuthorizationService.ts
@@ -26,12 +26,12 @@ var a = class {
26
26
  return e?.length ? this.apiPermissions?.length ? e.every((e) => !!this.apiPermissions.find(({ command_name: t, permission_type: n }) => t === e.command_name && n === e.permission_type)) : !1 : !0;
27
27
  }
28
28
  doesUserHavePermissionForRoute(e) {
29
- if (e.handle.requirePermissionForChildRoute) return e.children?.filter((e) => !e.index)?.some((e) => this.doesUserHavePermissionForRoute(e));
29
+ if (e.handle.requirePermissionForChildRoute) return e.children?.filter((e) => !e.index)?.some((e) => this.doesUserHavePermissionForRoute(e)) ?? !1;
30
30
  let t = e.children?.find((e) => e.index);
31
31
  return !!(!e.handle.requiredPermissions?.length && !t || this.doesUserHavePermission(t ? t.handle.requiredPermissions : e.handle.requiredPermissions));
32
32
  }
33
33
  };
34
- a = e([i(), t(0, r(n))], a);
34
+ a = t([i(), e(0, r(n))], a);
35
35
  //#endregion
36
36
  export { a as AuthorizationService };
37
37
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_decorate","_decorateParam","__decorate","AuthorizationService","permissions","user","pageEventBusService","command_name","permission","permission_type","route","r","childRoute","indexRoute","singleton","__decorateParam","inject","PageEventBusService"],"sources":["../../../../src/classes/services/AuthorizationService/AuthorizationService.ts"],"sourcesContent":["import type {\n CommonDbApiPermission,\n CommonDbUser,\n} from '@gen-epix/api-commondb';\nimport {\n inject,\n singleton,\n} from 'tsyringe';\n\nimport type { MyNonIndexRouteObject } from '../../../models/react-router.models';\nimport { PageEventBusService } from '../PageEventBusService';\n\n@singleton()\nexport class AuthorizationService {\n public set apiPermissions(permissions: CommonDbApiPermission[]) {\n this.__apiPermissions = permissions;\n }\n\n public get apiPermissions(): CommonDbApiPermission[] {\n return this.__apiPermissions;\n }\n\n public set user(user: CommonDbUser) {\n this.pageEventBusService.emit('changeUser', user);\n this.__user = user;\n }\n\n public get user(): CommonDbUser {\n return this.__user;\n }\n\n private __apiPermissions: CommonDbApiPermission[] = [];\n\n private __user: CommonDbUser;\n\n private readonly pageEventBusService: PageEventBusService;\n\n public constructor(@inject(PageEventBusService) pageEventBusService: PageEventBusService) {\n this.pageEventBusService = pageEventBusService;\n }\n\n\n public doesUserHavePermission<TApiPermission = CommonDbApiPermission>(permissions: NoInfer<TApiPermission>[]): boolean {\n if (!permissions?.length) {\n return true;\n }\n if (!this.apiPermissions?.length) {\n return false;\n }\n return permissions.every(permission => {\n return !!(this.apiPermissions).find(({ command_name, permission_type }) => {\n return command_name === (permission as CommonDbApiPermission).command_name && permission_type === (permission as CommonDbApiPermission).permission_type;\n });\n });\n }\n\n public doesUserHavePermissionForRoute(route: MyNonIndexRouteObject): boolean {\n if (route.handle.requirePermissionForChildRoute) {\n return route.children?.filter(r => !r.index)?.some((childRoute) => this.doesUserHavePermissionForRoute(childRoute as MyNonIndexRouteObject));\n }\n const indexRoute = route.children?.find((childRoute) => childRoute.index);\n if (!route.handle.requiredPermissions?.length && !indexRoute) {\n return true;\n }\n const hasPermissionForRoute = this.doesUserHavePermission(indexRoute ? indexRoute.handle.requiredPermissions : route.handle.requiredPermissions);\n if (hasPermissionForRoute) {\n return true;\n }\n return false;\n }\n}\n"],"mappings":";;;;;AAaO,IAAMG,IAAN,MAA2B;CAChC,IAAW,eAAe,GAAsC;EAC9D,KAAK,mBAAmBC;CAC1B;CAEA,IAAW,iBAA0C;EACnD,OAAO,KAAK;CACd;CAEA,IAAW,KAAK,GAAoB;EAElC,AADA,KAAK,oBAAoB,KAAK,cAAcC,CAAI,GAChD,KAAK,SAASA;CAChB;CAEA,IAAW,OAAqB;EAC9B,OAAO,KAAK;CACd;CAEA,mBAAoD,CAAC;CAErD;CAEA;CAEA,YAAmB,GAAuE;EACxF,KAAK,sBAAsBC;CAC7B;CAGA,uBAAsE,GAAiD;EAOrH,OANKF,GAAa,SAGb,KAAK,gBAAgB,SAGnBA,EAAY,OAAM,MAChB,CAAC,CAAE,KAAK,eAAgB,MAAM,EAAE,iBAAc,yBAC5CG,MAAkBC,EAAqC,gBAAgBC,MAAqBD,EAAqC,eACzI,CACF,IANQ,KAHA;CAUX;CAEA,+BAAsC,GAAuC;EAC3E,IAAIE,EAAM,OAAO,gCACf,OAAOA,EAAM,UAAU,QAAO,MAAK,CAACC,EAAE,KAAK,CAAC,EAAE,MAAM,MAAe,KAAK,+BAA+BC,CAAmC,CAAC;EAE7I,IAAMC,IAAaH,EAAM,UAAU,MAAM,MAAeE,EAAW,KAAK;EAQxE,OAHA,GAJI,CAACF,EAAM,OAAO,qBAAqB,UAAU,CAACG,KAGpB,KAAK,uBAAuBA,IAAaA,EAAW,OAAO,sBAAsBH,EAAM,OAAO,mBACxH;CAIN;AACF;AA1DC,IAAAV,EAAA,CAAAc,EAAU,GAAAb,EAAA,GAyBWe,EAAOC,CAAmB,CAAA,CAAA,GAAAd,CAAA"}
1
+ {"version":3,"file":"index.js","names":["_decorate","_decorateParam","__decorateParam","AuthorizationService","permissions","user","pageEventBusService","command_name","permission","permission_type","route","r","childRoute","indexRoute","__decorate","singleton","inject","PageEventBusService"],"sources":["../../../../src/classes/services/AuthorizationService/AuthorizationService.ts"],"sourcesContent":["import type {\n CommonDbApiPermission,\n CommonDbUser,\n} from '@gen-epix/api-commondb';\nimport {\n inject,\n singleton,\n} from 'tsyringe';\n\nimport type { MyNonIndexRouteObject } from '../../../models/react-router.models';\nimport { PageEventBusService } from '../PageEventBusService';\n\n@singleton()\nexport class AuthorizationService {\n public set apiPermissions(permissions: CommonDbApiPermission[]) {\n this.__apiPermissions = permissions;\n }\n\n public get apiPermissions(): CommonDbApiPermission[] {\n return this.__apiPermissions;\n }\n\n public set user(user: CommonDbUser) {\n this.pageEventBusService.emit('changeUser', user);\n this.__user = user;\n }\n\n public get user(): CommonDbUser {\n return this.__user;\n }\n\n private __apiPermissions: CommonDbApiPermission[] = [];\n\n private __user: CommonDbUser;\n\n private readonly pageEventBusService: PageEventBusService;\n\n public constructor(@inject(PageEventBusService) pageEventBusService: PageEventBusService) {\n this.pageEventBusService = pageEventBusService;\n }\n\n\n public doesUserHavePermission<TApiPermission = CommonDbApiPermission>(permissions: NoInfer<TApiPermission>[]): boolean {\n if (!permissions?.length) {\n return true;\n }\n if (!this.apiPermissions?.length) {\n return false;\n }\n return permissions.every(permission => {\n return !!(this.apiPermissions).find(({ command_name, permission_type }) => {\n return command_name === (permission as CommonDbApiPermission).command_name && permission_type === (permission as CommonDbApiPermission).permission_type;\n });\n });\n }\n\n public doesUserHavePermissionForRoute(route: MyNonIndexRouteObject): boolean {\n if (route.handle.requirePermissionForChildRoute) {\n return route.children?.filter(r => !r.index)?.some((childRoute) => this.doesUserHavePermissionForRoute(childRoute as MyNonIndexRouteObject)) ?? false;\n }\n const indexRoute = route.children?.find((childRoute) => childRoute.index);\n if (!route.handle.requiredPermissions?.length && !indexRoute) {\n return true;\n }\n const hasPermissionForRoute = this.doesUserHavePermission(indexRoute ? indexRoute.handle.requiredPermissions : route.handle.requiredPermissions);\n if (hasPermissionForRoute) {\n return true;\n }\n return false;\n }\n}\n"],"mappings":";;;;;AAaO,IAAMG,IAAN,MAA2B;CAChC,IAAW,eAAe,GAAsC;EAC9D,KAAK,mBAAmBC;CAC1B;CAEA,IAAW,iBAA0C;EACnD,OAAO,KAAK;CACd;CAEA,IAAW,KAAK,GAAoB;EAElC,AADA,KAAK,oBAAoB,KAAK,cAAcC,CAAI,GAChD,KAAK,SAASA;CAChB;CAEA,IAAW,OAAqB;EAC9B,OAAO,KAAK;CACd;CAEA,mBAAoD,CAAC;CAErD;CAEA;CAEA,YAAmB,GAAuE;EACxF,KAAK,sBAAsBC;CAC7B;CAGA,uBAAsE,GAAiD;EAOrH,OANKF,GAAa,SAGb,KAAK,gBAAgB,SAGnBA,EAAY,OAAM,MAChB,CAAC,CAAE,KAAK,eAAgB,MAAM,EAAE,iBAAc,yBAC5CG,MAAkBC,EAAqC,gBAAgBC,MAAqBD,EAAqC,eACzI,CACF,IANQ,KAHA;CAUX;CAEA,+BAAsC,GAAuC;EAC3E,IAAIE,EAAM,OAAO,gCACf,OAAOA,EAAM,UAAU,QAAO,MAAK,CAACC,EAAE,KAAK,CAAC,EAAE,MAAM,MAAe,KAAK,+BAA+BC,CAAmC,CAAC,KAAK;EAElJ,IAAMC,IAAaH,EAAM,UAAU,MAAM,MAAeE,EAAW,KAAK;EAQxE,OAHA,GAJI,CAACF,EAAM,OAAO,qBAAqB,UAAU,CAACG,KAGpB,KAAK,uBAAuBA,IAAaA,EAAW,OAAO,sBAAsBH,EAAM,OAAO,mBACxH;CAIN;AACF;AA1DC,IAAAV,EAAA,CAAAe,EAAU,GAAAd,EAAA,GAyBWe,EAAOC,CAAmB,CAAA,CAAA,GAAAd,CAAA"}
@@ -2,9 +2,10 @@ import { t as e } from "../../../_chunks/decorate.js";
2
2
  import { singleton as t } from "tsyringe";
3
3
  //#region src/classes/services/BackendVersionService/BackendVersionService.ts
4
4
  var n = class {
5
- version;
5
+ version = "-";
6
6
  onResponseFulfilled(e) {
7
- return this.version = e.headers["content-type"].split("version=")?.[1] ?? "-", e;
7
+ let t = e.headers["content-type"], n = typeof t == "string" ? t.split("version=")[1] : void 0;
8
+ return this.version = n || "-", e;
8
9
  }
9
10
  };
10
11
  n = e([t()], n);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_decorate","__decorate","BackendVersionService","response","singleton"],"sources":["../../../../src/classes/services/BackendVersionService/BackendVersionService.ts"],"sourcesContent":["import type { AxiosResponse } from 'axios';\nimport { singleton } from 'tsyringe';\n\n@singleton()\nexport class BackendVersionService {\n public version: string;\n\n public onResponseFulfilled(response: AxiosResponse): AxiosResponse {\n this.version = (response.headers['content-type'] as string).split('version=')?.[1] ?? '-';\n return response;\n }\n}\n"],"mappings":";;;AAIO,IAAME,IAAN,MAA4B;CACjC;CAEA,oBAA2B,GAAwC;EAEjE,OADA,KAAK,UAAWC,EAAS,QAAQ,eAAe,CAAY,MAAM,UAAU,CAAC,GAAG,MAAM,KAC/EA;CACT;AACF;AARC,IAAAH,EAAA,CAAAI,EAAU,CAAA,GAAAF,CAAA"}
1
+ {"version":3,"file":"index.js","names":["_decorate","__decorate","BackendVersionService","contentType","response","version","singleton"],"sources":["../../../../src/classes/services/BackendVersionService/BackendVersionService.ts"],"sourcesContent":["import type { AxiosResponse } from 'axios';\nimport { singleton } from 'tsyringe';\n\n@singleton()\nexport class BackendVersionService {\n public version: string = '-';\n\n public onResponseFulfilled(response: AxiosResponse): AxiosResponse {\n const contentType = response.headers['content-type'];\n const version = typeof contentType === 'string' ? contentType.split('version=')[1] : undefined;\n this.version = version || '-';\n return response;\n }\n}\n"],"mappings":";;;AAIO,IAAME,IAAN,MAA4B;CACjC,UAAyB;CAEzB,oBAA2B,GAAwC;EACjE,IAAMC,IAAcC,EAAS,QAAQ,iBAC/BC,IAAU,OAAOF,KAAgB,WAAWA,EAAY,MAAM,UAAU,CAAC,CAAC,KAAK,KAAA;EAErF,OADA,KAAK,UAAUE,KAAW,KACnBD;CACT;AACF;AAVC,IAAAJ,EAAA,CAAAM,EAAU,CAAA,GAAAJ,CAAA"}
@@ -1,48 +1,26 @@
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
+ //#region 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);
22
+ s = t([r()], s);
45
23
  //#endregion
46
- export { g as BreadcrumbService };
24
+ export { s as BreadcrumbService };
47
25
 
48
26
  //# 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":";;;;;;;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,7 +1,8 @@
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
7
  //#region src/classes/services/EmotionCacheService/EmotionCacheService.ts
7
8
  var s = class {
@@ -16,10 +17,10 @@ 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
25
  //#endregion
25
26
  export { s as EmotionCacheService };
@@ -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,8 +1,8 @@
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
8
  //#region src/classes/services/I18nService/I18nService.ts
@@ -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,7 +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
+ u = t([r(), e(0, n(i))], u);
60
61
  //#endregion
61
62
  export { u as I18nService };
62
63
 
@@ -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,EACb,aAAa,G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AI,IAH3C,QAAQ,KAAK,sDAAsD;CAIvE;AACF;AAnGC,IAAAnB,EAAA,CAAA2B,EAAU,GAAA1B,EAAA,GAUW2B,EAAOC,CAAa,CAAA,CAAA,GAAAzB,CAAA"}
@@ -2,13 +2,13 @@ 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
14
  //#region ../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/now.js
@@ -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,11 +165,11 @@ 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
174
  //#endregion
175
175
  export { S as InactivityService };
@@ -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;;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,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AA0BA,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,SAASC,EAAS,GAAQ;EACxB,OAAOH,KACHA,EAAO,MAAM,GAAGF,EAAgBE,CAAM,IAAI,CAAC,CAAC,CAAC,QAAQE,GAAa,EAAE;CAE1E;CAEA,EAAO,UAAUC;;CClBjB,IAAIA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