@gen-epix/ui-client-common 4.4.2 → 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 (190) hide show
  1. package/README.md +7 -6
  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/Breadcrumbs.js.map +1 -1
  8. package/dist/_chunks/CrudPage.js +300 -300
  9. package/dist/_chunks/CrudPage.js.map +1 -1
  10. package/dist/_chunks/Notifications.js +51 -51
  11. package/dist/_chunks/Notifications.js.map +1 -1
  12. package/dist/_chunks/OutageList.js +29 -29
  13. package/dist/_chunks/OutageUtil.js +1 -2
  14. package/dist/_chunks/OutageUtil.js.map +1 -1
  15. package/dist/_chunks/QueryClientService.js +96 -388
  16. package/dist/_chunks/QueryClientService.js.map +1 -1
  17. package/dist/_chunks/Table.js +518 -512
  18. package/dist/_chunks/Table.js.map +1 -1
  19. package/dist/_chunks/TableUtil.js +8 -16
  20. package/dist/_chunks/TableUtil.js.map +1 -1
  21. package/dist/_chunks/TextFilter.js +14 -12
  22. package/dist/_chunks/TextFilter.js.map +1 -1
  23. package/dist/_chunks/UserInvitationsAdminPage.js +77 -77
  24. package/dist/_chunks/UserInvitationsAdminPage.js.map +1 -1
  25. package/dist/_chunks/UserManagerUtil.js +210 -209
  26. package/dist/_chunks/UserManagerUtil.js.map +1 -1
  27. package/dist/_chunks/_baseFlatten.js +8 -8
  28. package/dist/_chunks/_baseFlatten.js.map +1 -1
  29. package/dist/_chunks/_baseGet.js +280 -0
  30. package/dist/_chunks/_baseGet.js.map +1 -0
  31. package/dist/_chunks/_baseIteratee.js +274 -0
  32. package/dist/_chunks/_baseIteratee.js.map +1 -0
  33. package/dist/_chunks/_baseUnset.js +22 -299
  34. package/dist/_chunks/_baseUnset.js.map +1 -1
  35. package/dist/_chunks/last.js +13 -0
  36. package/dist/_chunks/last.js.map +1 -0
  37. package/dist/_chunks/omit.js +41 -40
  38. package/dist/_chunks/omit.js.map +1 -1
  39. package/dist/_chunks/tableStore.js +190 -183
  40. package/dist/_chunks/tableStore.js.map +1 -1
  41. package/dist/_chunks/uniq.js +44 -0
  42. package/dist/_chunks/uniq.js.map +1 -0
  43. package/dist/_chunks/useMutation.js +22 -22
  44. package/dist/_chunks/useMutation.js.map +1 -1
  45. package/dist/_chunks/useQueryMemo.js +25 -8
  46. package/dist/_chunks/useQueryMemo.js.map +1 -1
  47. package/dist/classes/abstracts/FilterAbstract/index.js +3 -1
  48. package/dist/classes/abstracts/FilterAbstract/index.js.map +1 -1
  49. package/dist/classes/filters/MultiSelectFilter.d.ts +1 -1
  50. package/dist/classes/services/AuthenticationService/AuthenticationService.d.ts +1 -1
  51. package/dist/classes/services/AuthenticationService/index.js +15 -15
  52. package/dist/classes/services/AuthenticationService/index.js.map +1 -1
  53. package/dist/classes/services/AuthorizationService/index.js +4 -4
  54. package/dist/classes/services/AuthorizationService/index.js.map +1 -1
  55. package/dist/classes/services/BackendVersionService/index.js +3 -2
  56. package/dist/classes/services/BackendVersionService/index.js.map +1 -1
  57. package/dist/classes/services/BreadcrumbService/index.js +16 -38
  58. package/dist/classes/services/BreadcrumbService/index.js.map +1 -1
  59. package/dist/classes/services/EmotionCacheService/index.js +9 -8
  60. package/dist/classes/services/EmotionCacheService/index.js.map +1 -1
  61. package/dist/classes/services/I18nService/index.js +11 -10
  62. package/dist/classes/services/I18nService/index.js.map +1 -1
  63. package/dist/classes/services/InactivityService/index.js +12 -12
  64. package/dist/classes/services/InactivityService/index.js.map +1 -1
  65. package/dist/classes/services/LogService/index.js +39 -33
  66. package/dist/classes/services/LogService/index.js.map +1 -1
  67. package/dist/classes/services/NotificationService/index.js +8 -8
  68. package/dist/classes/services/NotificationService/index.js.map +1 -1
  69. package/dist/classes/services/PageEventBusService/index.js +13 -9
  70. package/dist/classes/services/PageEventBusService/index.js.map +1 -1
  71. package/dist/classes/services/RouterService/index.js +3 -6
  72. package/dist/classes/services/RouterService/index.js.map +1 -1
  73. package/dist/components/app/App/App.d.ts +1 -1
  74. package/dist/components/app/App/index.js +34 -38
  75. package/dist/components/app/App/index.js.map +1 -1
  76. package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js +28 -28
  77. package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js.map +1 -1
  78. package/dist/components/app/ApplicationBootstrapWithoutAuthorization/index.js +47 -45
  79. package/dist/components/app/ApplicationBootstrapWithoutAuthorization/index.js.map +1 -1
  80. package/dist/components/app/AuthenticationWrapper/index.js +35 -35
  81. package/dist/components/app/AuthenticationWrapper/index.js.map +1 -1
  82. package/dist/components/app/AuthorizationWrapper/index.js +19 -19
  83. package/dist/components/app/AuthorizationWrapper/index.js.map +1 -1
  84. package/dist/components/app/RouterRoot/index.js +52 -50
  85. package/dist/components/app/RouterRoot/index.js.map +1 -1
  86. package/dist/components/epi/EpiContactDetailsDialog/index.js +21 -21
  87. package/dist/components/epi/EpiContactDetailsDialog/index.js.map +1 -1
  88. package/dist/components/filters/BooleanFilterField/index.js +5 -5
  89. package/dist/components/filters/DateFilterField/index.js +3 -3
  90. package/dist/components/filters/GeoFilterField/index.js +4 -4
  91. package/dist/components/filters/MultiSelectFilterField/index.js +4 -4
  92. package/dist/components/filters/NumberRangeFilterField/index.js +3 -3
  93. package/dist/components/filters/TextFilterField/index.js +3 -3
  94. package/dist/components/ui/ApplicationBar/index.js +188 -188
  95. package/dist/components/ui/ApplicationBar/index.js.map +1 -1
  96. package/dist/components/ui/GenericErrorMessage/index.js +29 -29
  97. package/dist/components/ui/GenericErrorMessage/index.js.map +1 -1
  98. package/dist/components/ui/LicensesDialog/index.js +38 -38
  99. package/dist/components/ui/LicensesDialog/index.js.map +1 -1
  100. package/dist/components/ui/MyPermissionsDialog/index.js +16 -16
  101. package/dist/components/ui/MyPermissionsDialog/index.js.map +1 -1
  102. package/dist/components/ui/NavLink/index.js +6 -6
  103. package/dist/components/ui/OrganizationSwitcherDialog/index.js +21 -21
  104. package/dist/components/ui/OrganizationSwitcherDialog/index.js.map +1 -1
  105. package/dist/components/ui/PageContainer/index.js +24 -24
  106. package/dist/components/ui/PageContainer/index.js.map +1 -1
  107. package/dist/components/ui/Sidebar/index.js +30 -30
  108. package/dist/components/ui/UserFeedbackDialog/index.js +12 -12
  109. package/dist/components/ui/UserFeedbackDialog/index.js.map +1 -1
  110. package/dist/components/ui/UserInactivityConfirmation/index.js.map +1 -1
  111. package/dist/constants/config.constants.d.ts +0 -2
  112. package/dist/constants/config.constants.js +2 -2
  113. package/dist/constants/config.constants.js.map +1 -1
  114. package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/index.js +12 -12
  115. package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/index.js.map +1 -1
  116. package/dist/dataHooks/useIdentifierIssuerQuery/index.js +14 -14
  117. package/dist/dataHooks/useIdentifierIssuerQuery/index.js.map +1 -1
  118. package/dist/dataHooks/useInviteUserConstraintsQuery/index.js +12 -12
  119. package/dist/dataHooks/useInviteUserConstraintsQuery/index.js.map +1 -1
  120. package/dist/dataHooks/useOrganizationAdminPoliciesQuery/index.js +13 -13
  121. package/dist/dataHooks/useOrganizationAdminPoliciesQuery/index.js.map +1 -1
  122. package/dist/dataHooks/useOrganizationIdentifierIssuerLinksQuery/index.js +4 -4
  123. package/dist/dataHooks/useOrganizationIdentifierIssuerLinksQuery/index.js.map +1 -1
  124. package/dist/dataHooks/useOrganizationsQuery/index.js +13 -13
  125. package/dist/dataHooks/useOrganizationsQuery/index.js.map +1 -1
  126. package/dist/dataHooks/useUsersQuery/index.js +10 -10
  127. package/dist/dataHooks/useUsersQuery/index.js.map +1 -1
  128. package/dist/hoc/withPermissions/index.js.map +1 -1
  129. package/dist/hooks/useConfig/index.js +2 -2
  130. package/dist/hooks/useConfig/index.js.map +1 -1
  131. package/dist/hooks/useCreateMutation/index.js +12 -12
  132. package/dist/hooks/useCreateMutation/index.js.map +1 -1
  133. package/dist/hooks/useDeleteMutation/index.js +16 -9
  134. package/dist/hooks/useDeleteMutation/index.js.map +1 -1
  135. package/dist/hooks/useEditMutation/index.js +48 -33
  136. package/dist/hooks/useEditMutation/index.js.map +1 -1
  137. package/dist/hooks/useItemQuery/index.js +4 -4
  138. package/dist/hooks/useItemQuery/index.js.map +1 -1
  139. package/dist/hooks/useUpdateBreadcrumb/index.js.map +1 -1
  140. package/dist/locale/en.json +1 -0
  141. package/dist/locale/nl.json +1 -0
  142. package/dist/models/config.models.d.ts +1 -5
  143. package/dist/models/theme.models.d.ts +19 -16
  144. package/dist/pages/AcceptInvitationPage/index.js +25 -25
  145. package/dist/pages/AcceptInvitationPage/index.js.map +1 -1
  146. package/dist/pages/AdminPage/index.js +16 -16
  147. package/dist/pages/AdminPage/index.js.map +1 -1
  148. package/dist/pages/ChooseIdentityProviderPage/index.js +21 -21
  149. package/dist/pages/ChooseIdentityProviderPage/index.js.map +1 -1
  150. package/dist/pages/IdentifierIssuersAdminPage/index.js +5 -5
  151. package/dist/pages/IdentifierIssuersAdminPage/index.js.map +1 -1
  152. package/dist/pages/OrganizationAdminPoliciesAdminPage/index.js +5 -5
  153. package/dist/pages/OrganizationAdminPoliciesAdminPage/index.js.map +1 -1
  154. package/dist/pages/OrganizationContactsAdminPage/index.js +6 -6
  155. package/dist/pages/OrganizationContactsAdminPage/index.js.map +1 -1
  156. package/dist/pages/OrganizationSitesAdminPage/index.js +9 -9
  157. package/dist/pages/OrganizationSitesAdminPage/index.js.map +1 -1
  158. package/dist/pages/OrganizationsAdminPage/index.js +13 -13
  159. package/dist/pages/OrganizationsAdminPage/index.js.map +1 -1
  160. package/dist/pages/OutagesAdminPage/index.js +20 -20
  161. package/dist/pages/OutagesAdminPage/index.js.map +1 -1
  162. package/dist/pages/PostLoginPage/index.js +6 -6
  163. package/dist/pages/PostLoginPage/index.js.map +1 -1
  164. package/dist/pages/PostLogoutPage/index.js +8 -8
  165. package/dist/pages/PostLogoutPage/index.js.map +1 -1
  166. package/dist/pages/UsersAdminPage/index.js +39 -39
  167. package/dist/pages/UsersAdminPage/index.js.map +1 -1
  168. package/dist/setup/setup.d.ts +1 -1
  169. package/dist/setup/setup.js +11 -4
  170. package/dist/setup/setup.js.map +1 -1
  171. package/dist/theme/demoTheme/index.js +17 -15
  172. package/dist/theme/demoTheme/index.js.map +1 -1
  173. package/dist/utils/DataHookUtil/index.js +1 -1
  174. package/dist/utils/DataHookUtil/index.js.map +1 -1
  175. package/dist/utils/DependencyContainerUtil/DependencyContainerUtil.d.ts +2 -3
  176. package/dist/utils/DependencyContainerUtil/index.js +10 -16
  177. package/dist/utils/DependencyContainerUtil/index.js.map +1 -1
  178. package/dist/utils/MenuDataUtil/index.js +1 -1
  179. package/dist/utils/MenuDataUtil/index.js.map +1 -1
  180. package/dist/utils/StandardConfigUtil/index.js +0 -4
  181. package/dist/utils/StandardConfigUtil/index.js.map +1 -1
  182. package/dist/utils/TimeUtil/index.js +1 -1
  183. package/dist/utils/TimeUtil/index.js.map +1 -1
  184. package/package.json +11 -14
  185. package/dist/context/uiClientCommonConfigContext/UiClientCommonConfigContext.d.ts +0 -9
  186. package/dist/context/uiClientCommonConfigContext/UiClientCommonConfigContextProvider.d.ts +0 -6
  187. package/dist/context/uiClientCommonConfigContext/index.d.ts +0 -3
  188. package/dist/context/uiClientCommonConfigContext/index.js +0 -34
  189. package/dist/context/uiClientCommonConfigContext/index.js.map +0 -1
  190. package/dist/context/uiClientCommonConfigContext/useUiClientCommonConfigContext.d.ts +0 -3
@@ -1,12 +1,12 @@
1
- import { t as e } from "../../../_chunks/decorate.js";
2
- import { CONFIG_TOKEN as t } from "../../../constants/config.constants.js";
3
- import { AxiosUtil as n } from "../../../utils/AxiosUtil/index.js";
4
- import { API_SYSTEM_TOKEN as r } from "../../../constants/api.constants.js";
5
- import { t as i } from "../../../_chunks/decorateParam.js";
1
+ import { CONFIG_TOKEN as e } from "../../../constants/config.constants.js";
2
+ import { AxiosUtil as t } from "../../../utils/AxiosUtil/index.js";
3
+ import { API_SYSTEM_TOKEN as n } from "../../../constants/api.constants.js";
4
+ import { t as r } from "../../../_chunks/decorateParam.js";
5
+ import { t as i } from "../../../_chunks/decorate.js";
6
6
  import { AuthenticationService as a } from "../AuthenticationService/index.js";
7
- import { StringUtil as o } from "@gen-epix/ui-core/utils/StringUtil";
8
- import { CommonDbLogLevel as s } from "@gen-epix/api-commondb";
9
- import { inject as c, singleton as l } from "tsyringe";
7
+ import { inject as o, singleton as s } from "tsyringe";
8
+ import { StringUtil as c } from "@gen-epix/ui-core/utils/StringUtil";
9
+ import { CommonDbLogLevel as l } from "@gen-epix/api-commondb";
10
10
  import { isAxiosError as u } from "axios";
11
11
  //#region src/classes/services/LogService/LogService.ts
12
12
  var d = class {
@@ -26,8 +26,8 @@ var d = class {
26
26
  log(e) {
27
27
  let t = (/* @__PURE__ */ new Date()).toISOString(), n = this.config.getSoftwareVersion();
28
28
  this.logItems.push(...e.map((e) => ({
29
- command_id: o.createUuid(),
30
- detail: e.detail ? JSON.stringify(e.detail) : null,
29
+ command_id: c.createUuid(),
30
+ detail: e.detail === void 0 || e.detail === null ? null : JSON.stringify(e.detail),
31
31
  duration: e.duration ?? null,
32
32
  level: e.level,
33
33
  software_version: n,
@@ -37,61 +37,67 @@ var d = class {
37
37
  }
38
38
  onRequest(e) {
39
39
  if (e.headers.has("X-IGNORE-LOG")) return e;
40
- let t = o.createUuid();
40
+ let t = c.createUuid();
41
41
  return e.headers.set("X-REQUEST-ID", t), this.requestMap.set(t, (/* @__PURE__ */ new Date()).getTime()), this.log([{
42
42
  detail: {
43
43
  requestData: e.data,
44
44
  requestParams: e.params,
45
45
  url: e.url
46
46
  },
47
- level: s.TRACE,
47
+ level: l.TRACE,
48
48
  topic: "REQUEST"
49
49
  }]), e;
50
50
  }
51
51
  onResponseFulfilled(e) {
52
52
  if (e.config.headers.has("X-IGNORE-LOG")) return e;
53
- let t = e?.config?.headers.get("X-REQUEST-ID"), n = (/* @__PURE__ */ new Date()).getTime() - this.requestMap.get(t);
54
- return this.log([{
53
+ let t = e.config.headers.get("X-REQUEST-ID"), n = typeof t == "string" ? this.requestMap.get(t) : void 0, r = n === void 0 ? void 0 : Date.now() - n;
54
+ return typeof t == "string" && this.requestMap.delete(t), this.log([{
55
55
  detail: {
56
56
  requestData: e.config.data,
57
57
  requestParams: e.config.params,
58
58
  url: e.config.url
59
59
  },
60
- duration: n,
61
- level: e.status >= 200 && e.status < 300 ? s.TRACE : s.ERROR,
60
+ duration: r,
61
+ level: e.status >= 200 && e.status < 300 ? l.TRACE : l.ERROR,
62
62
  topic: "RESPONSE"
63
63
  }]), e;
64
64
  }
65
65
  onResponseRejected(e) {
66
66
  if (u(e)) {
67
- if (n.isAxiosCanceledError(e)) return;
68
- let t = e?.config?.headers.get("X-REQUEST-ID"), r = (/* @__PURE__ */ new Date()).getTime() - this.requestMap.get(t);
69
- this.log([{
67
+ let n = e.config?.headers.get("X-REQUEST-ID");
68
+ if (t.isAxiosCanceledError(e)) {
69
+ typeof n == "string" && this.requestMap.delete(n);
70
+ return;
71
+ }
72
+ let r = typeof n == "string" ? this.requestMap.get(n) : void 0, i = r === void 0 ? void 0 : Date.now() - r;
73
+ typeof n == "string" && this.requestMap.delete(n), this.log([{
70
74
  detail: {
71
- requestParams: e.config.params,
72
- responseData: e.response.data,
73
- status: e.response.status,
74
- url: e.config.url
75
+ requestParams: e.config?.params,
76
+ responseData: e.response?.data,
77
+ status: e.response?.status,
78
+ url: e.config?.url
75
79
  },
76
- duration: r,
77
- level: s.ERROR,
80
+ duration: i,
81
+ level: l.ERROR,
78
82
  topic: "RESPONSE_ERROR"
79
83
  }]);
80
84
  } else this.log([{
81
- detail: { error: e },
82
- level: s.ERROR,
85
+ detail: { error: e instanceof Error ? e.message : e },
86
+ level: l.ERROR,
83
87
  topic: "RESPONSE_ERROR"
84
88
  }]);
85
89
  }
86
90
  sendLog() {
87
- this.logItems.length && this.authenticationService?.authContextProps?.isAuthenticated && (document.location.href.includes("accept-invitation") || (this.systemApi.log({ log_items: this.logItems }, { headers: { "X-IGNORE-LOG": "1" } }).catch(() => 0), this.logItems = []));
91
+ this.logItems.length && this.authenticationService?.authContextProps?.isAuthenticated && (document.location.href.includes("accept-invitation") || (this.systemApi.log({ log_items: this.logItems }, { headers: { "X-IGNORE-LOG": "1" } }).catch((e) => {
92
+ console.error("Failed to send logs", e);
93
+ }), this.logItems = []));
88
94
  }
89
95
  };
90
- d = e([
91
- l(),
92
- i(0, c(t)),
93
- i(1, c(a)),
94
- i(2, c(r))
96
+ d = i([
97
+ s(),
98
+ r(0, o(e)),
99
+ r(1, o(a)),
100
+ r(2, o(n))
95
101
  ], d);
96
102
  //#endregion
97
103
  export { d as LogService };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_decorate","_decorateParam","__decorate","__decorateParam","LogService","config","authenticationService","systemApi","timestamp","software_version","items","StringUtil","item","request","requestId","CommonDbLogLevel","response","duration","isAxiosError","error","AxiosUtil","singleton","inject","CONFIG_TOKEN","AuthenticationService","API_SYSTEM_TOKEN"],"sources":["../../../../src/classes/services/LogService/LogService.ts"],"sourcesContent":["import { isAxiosError } from 'axios';\nimport type {\n AxiosResponse,\n InternalAxiosRequestConfig,\n} from 'axios';\nimport type {\n CommonDbExternalLogItem,\n CommonDbSystemApi,\n} from '@gen-epix/api-commondb';\nimport { CommonDbLogLevel } from '@gen-epix/api-commondb';\nimport { StringUtil } from '@gen-epix/ui-core/utils/StringUtil';\nimport {\n inject,\n singleton,\n} from 'tsyringe';\n\nimport { API_SYSTEM_TOKEN } from '../../../constants/api.constants';\nimport { AuthenticationService } from '../AuthenticationService';\nimport { AxiosUtil } from '../../../utils/AxiosUtil';\nimport { CONFIG_TOKEN } from '../../../constants/config.constants';\nimport type { ConfigBase } from '../../../models/config.models';\n\ntype LogServiceItem = {\n detail?: unknown;\n duration?: number;\n level: CommonDbLogLevel;\n topic: string;\n};\n\n@singleton()\nexport class LogService {\n protected readonly requestMap: Map<string, number>;\n\n private readonly authenticationService: AuthenticationService;\n private readonly config: Pick<ConfigBase, 'getSoftwareVersion' | 'log'>;\n private logItems: CommonDbExternalLogItem[] = [];\n private readonly systemApi: CommonDbSystemApi;\n\n public constructor(\n @inject(CONFIG_TOKEN) config: ConfigBase,\n @inject(AuthenticationService) authenticationService: AuthenticationService,\n @inject(API_SYSTEM_TOKEN) systemApi: CommonDbSystemApi,\n ) {\n this.requestMap = new Map<string, number>();\n this.config = config;\n this.authenticationService = authenticationService;\n this.systemApi = systemApi;\n setInterval(() => {\n this.sendLog();\n }, config.log.LOG_INTERVAL_MS);\n }\n\n\n public flushLog(): void {\n this.sendLog();\n }\n\n public log(items: LogServiceItem[]): void {\n const timestamp = new Date().toISOString();\n const software_version = this.config.getSoftwareVersion();\n this.logItems.push(...items.map<CommonDbExternalLogItem>(item => {\n return {\n command_id: StringUtil.createUuid(),\n detail: item.detail ? JSON.stringify(item.detail) : null,\n duration: item.duration ?? null,\n level: item.level,\n software_version,\n timestamp,\n topic: item.topic ?? null,\n };\n }));\n }\n\n public onRequest(request: InternalAxiosRequestConfig): InternalAxiosRequestConfig {\n if (request.headers.has('X-IGNORE-LOG')) {\n return request;\n }\n const requestId = StringUtil.createUuid();\n request.headers.set('X-REQUEST-ID', requestId);\n this.requestMap.set(requestId, new Date().getTime());\n\n this.log([{\n detail: {\n requestData: request.data as unknown,\n requestParams: request.params as unknown,\n url: request.url,\n },\n level: CommonDbLogLevel.TRACE,\n topic: 'REQUEST',\n }]);\n\n return request;\n }\n\n public onResponseFulfilled(response: AxiosResponse): AxiosResponse {\n if (response.config.headers.has('X-IGNORE-LOG')) {\n return response;\n }\n\n const requestId = response?.config?.headers.get('X-REQUEST-ID') as string;\n const duration = new Date().getTime() - this.requestMap.get(requestId);\n\n this.log([{\n detail: {\n requestData: response.config.data as unknown,\n requestParams: response.config.params as unknown,\n url: response.config.url,\n },\n duration,\n level: response.status >= 200 && response.status < 300 ? CommonDbLogLevel.TRACE : CommonDbLogLevel.ERROR,\n topic: 'RESPONSE',\n }]);\n\n return response;\n }\n\n public onResponseRejected(error: unknown): void {\n if (isAxiosError(error)) {\n if (AxiosUtil.isAxiosCanceledError(error)) {\n return;\n }\n const requestId = error?.config?.headers.get('X-REQUEST-ID') as string;\n const duration = new Date().getTime() - this.requestMap.get(requestId);\n this.log([{\n detail: {\n requestParams: error.config.params as unknown,\n responseData: error.response.data as unknown,\n status: error.response.status,\n url: error.config.url,\n },\n duration,\n level: CommonDbLogLevel.ERROR,\n topic: 'RESPONSE_ERROR',\n }]);\n } else {\n this.log([{\n detail: {\n error,\n },\n level: CommonDbLogLevel.ERROR,\n topic: 'RESPONSE_ERROR',\n }]);\n }\n }\n\n private sendLog(): void {\n if (!this.logItems.length || !this.authenticationService?.authContextProps?.isAuthenticated) {\n return;\n }\n if (document.location.href.includes('accept-invitation')) {\n return;\n }\n this.systemApi.log({\n log_items: this.logItems,\n }, {\n headers: {\n 'X-IGNORE-LOG': '1',\n },\n }).catch(() => 0);\n this.logItems = [];\n }\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"index.js","names":["_decorate","_decorateParam","__decorateParam","__decorate","LogService","config","authenticationService","systemApi","timestamp","software_version","items","StringUtil","item","request","requestId","CommonDbLogLevel","response","requestStartedAt","duration","isAxiosError","error","AxiosUtil","singleton","inject","CONFIG_TOKEN","AuthenticationService","API_SYSTEM_TOKEN"],"sources":["../../../../src/classes/services/LogService/LogService.ts"],"sourcesContent":["import { isAxiosError } from 'axios';\nimport type {\n AxiosResponse,\n InternalAxiosRequestConfig,\n} from 'axios';\nimport type {\n CommonDbExternalLogItem,\n CommonDbSystemApi,\n} from '@gen-epix/api-commondb';\nimport { CommonDbLogLevel } from '@gen-epix/api-commondb';\nimport { StringUtil } from '@gen-epix/ui-core/utils/StringUtil';\nimport {\n inject,\n singleton,\n} from 'tsyringe';\n\nimport { API_SYSTEM_TOKEN } from '../../../constants/api.constants';\nimport { AuthenticationService } from '../AuthenticationService';\nimport { AxiosUtil } from '../../../utils/AxiosUtil';\nimport { CONFIG_TOKEN } from '../../../constants/config.constants';\nimport type { ConfigBase } from '../../../models/config.models';\n\ntype LogServiceItem = {\n detail?: unknown;\n duration?: number;\n level: CommonDbLogLevel;\n topic: string;\n};\n\n@singleton()\nexport class LogService {\n protected readonly requestMap: Map<string, number>;\n\n private readonly authenticationService: AuthenticationService;\n private readonly config: Pick<ConfigBase, 'getSoftwareVersion' | 'log'>;\n private logItems: CommonDbExternalLogItem[] = [];\n private readonly systemApi: CommonDbSystemApi;\n\n public constructor(\n @inject(CONFIG_TOKEN) config: ConfigBase,\n @inject(AuthenticationService) authenticationService: AuthenticationService,\n @inject(API_SYSTEM_TOKEN) systemApi: CommonDbSystemApi,\n ) {\n this.requestMap = new Map<string, number>();\n this.config = config;\n this.authenticationService = authenticationService;\n this.systemApi = systemApi;\n setInterval(() => {\n this.sendLog();\n }, config.log.LOG_INTERVAL_MS);\n }\n\n\n public flushLog(): void {\n this.sendLog();\n }\n\n public log(items: LogServiceItem[]): void {\n const timestamp = new Date().toISOString();\n const software_version = this.config.getSoftwareVersion();\n this.logItems.push(...items.map<CommonDbExternalLogItem>(item => {\n return {\n command_id: StringUtil.createUuid(),\n detail: item.detail === undefined || item.detail === null ? null : JSON.stringify(item.detail),\n duration: item.duration ?? null,\n level: item.level,\n software_version,\n timestamp,\n topic: item.topic ?? null,\n };\n }));\n }\n\n public onRequest(request: InternalAxiosRequestConfig): InternalAxiosRequestConfig {\n if (request.headers.has('X-IGNORE-LOG')) {\n return request;\n }\n const requestId = StringUtil.createUuid();\n request.headers.set('X-REQUEST-ID', requestId);\n this.requestMap.set(requestId, new Date().getTime());\n\n this.log([{\n detail: {\n requestData: request.data as unknown,\n requestParams: request.params as unknown,\n url: request.url,\n },\n level: CommonDbLogLevel.TRACE,\n topic: 'REQUEST',\n }]);\n\n return request;\n }\n\n public onResponseFulfilled(response: AxiosResponse): AxiosResponse {\n if (response.config.headers.has('X-IGNORE-LOG')) {\n return response;\n }\n\n const requestId = response.config.headers.get('X-REQUEST-ID');\n const requestStartedAt = typeof requestId === 'string' ? this.requestMap.get(requestId) : undefined;\n const duration = requestStartedAt === undefined ? undefined : Date.now() - requestStartedAt;\n if (typeof requestId === 'string') {\n this.requestMap.delete(requestId);\n }\n\n this.log([{\n detail: {\n requestData: response.config.data as unknown,\n requestParams: response.config.params as unknown,\n url: response.config.url,\n },\n duration,\n level: response.status >= 200 && response.status < 300 ? CommonDbLogLevel.TRACE : CommonDbLogLevel.ERROR,\n topic: 'RESPONSE',\n }]);\n\n return response;\n }\n\n public onResponseRejected(error: unknown): void {\n if (isAxiosError(error)) {\n const requestId = error.config?.headers.get('X-REQUEST-ID');\n if (AxiosUtil.isAxiosCanceledError(error)) {\n if (typeof requestId === 'string') {\n this.requestMap.delete(requestId);\n }\n return;\n }\n const requestStartedAt = typeof requestId === 'string' ? this.requestMap.get(requestId) : undefined;\n const duration = requestStartedAt === undefined ? undefined : Date.now() - requestStartedAt;\n if (typeof requestId === 'string') {\n this.requestMap.delete(requestId);\n }\n this.log([{\n detail: {\n requestParams: error.config?.params as unknown,\n responseData: error.response?.data as unknown,\n status: error.response?.status,\n url: error.config?.url,\n },\n duration,\n level: CommonDbLogLevel.ERROR,\n topic: 'RESPONSE_ERROR',\n }]);\n } else {\n this.log([{\n detail: {\n error: error instanceof Error ? error.message : error,\n },\n level: CommonDbLogLevel.ERROR,\n topic: 'RESPONSE_ERROR',\n }]);\n }\n }\n\n private sendLog(): void {\n if (!this.logItems.length || !this.authenticationService?.authContextProps?.isAuthenticated) {\n return;\n }\n if (document.location.href.includes('accept-invitation')) {\n return;\n }\n this.systemApi.log({\n log_items: this.logItems,\n }, {\n headers: {\n 'X-IGNORE-LOG': '1',\n },\n }).catch((error: unknown) => {\n console.error('Failed to send logs', error);\n });\n this.logItems = [];\n }\n}\n"],"mappings":"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"}
@@ -1,8 +1,8 @@
1
- import { t as e } from "../../../_chunks/decorate.js";
2
- import { CONFIG_TOKEN as t } from "../../../constants/config.constants.js";
3
- import { t as n } from "../../../_chunks/decorateParam.js";
4
- import { StringUtil as r } from "@gen-epix/ui-core/utils/StringUtil";
5
- 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 { StringUtil as a } from "@gen-epix/ui-core/utils/StringUtil";
6
6
  import { Subject as o } from "@gen-epix/ui-core/classes/Subject";
7
7
  import { SubscribableAbstract as s } from "@gen-epix/ui-core/classes/abstracts/SubscribableAbstract";
8
8
  //#region src/classes/services/NotificationService/NotificationService.ts
@@ -41,7 +41,7 @@ var c = class extends s {
41
41
  } : t)), clearTimeout(this.notificationTimeouts[e]), delete this.notificationTimeouts[e];
42
42
  }
43
43
  showNotification(e) {
44
- let t = r.createUuid(), n = e.autoHideAfterMs ?? this.config.notifications.autoHideAfterMs;
44
+ let t = a.createUuid(), n = e.autoHideAfterMs ?? this.config.notifications.autoHideAfterMs;
45
45
  return this.subject.next([{
46
46
  ...e,
47
47
  autoHideAfterMs: n,
@@ -49,14 +49,14 @@ var c = class extends s {
49
49
  timestamp: (/* @__PURE__ */ new Date()).getTime(),
50
50
  visible: !0
51
51
  }, ...this.subject.data]), isFinite(n) && (this.notificationTimeouts[t] = setTimeout(() => {
52
- this.subject.next(this.subject.data.map((e) => e.key === t ? {
52
+ delete this.notificationTimeouts[t], this.subject.next(this.subject.data.map((e) => e.key === t ? {
53
53
  ...e,
54
54
  visible: !1
55
55
  } : e));
56
56
  }, n)), t;
57
57
  }
58
58
  };
59
- c = e([a(), n(0, i(t))], c);
59
+ c = n([i(), t(0, r(e))], c);
60
60
  //#endregion
61
61
  export { c as NotificationService };
62
62
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_decorate","_decorateParam","__decorate","__decorateParam","NotificationService","SubscribableAbstract","Subject","config","x","key","StringUtil","autoHideAfterMs","notification","singleton","inject","CONFIG_TOKEN"],"sources":["../../../../src/classes/services/NotificationService/NotificationService.ts"],"sourcesContent":["import { StringUtil } from '@gen-epix/ui-core/utils/StringUtil';\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 type { Notification } from '../../../models/notification.models';\nimport { CONFIG_TOKEN } from '../../../constants/config.constants';\nimport type { ConfigBase } from '../../../models/config.models';\n\n@singleton()\nexport class NotificationService extends SubscribableAbstract<Notification[]> {\n private readonly config: Pick<ConfigBase, 'notifications'>;\n private readonly notificationTimeouts: Record<string, ReturnType<typeof setTimeout>>;\n\n public constructor(@inject(CONFIG_TOKEN) config: ConfigBase) {\n super(new Subject<Notification[]>([]));\n this.config = config;\n this.notificationTimeouts = {};\n }\n\n\n public clearNotification(key: string): void {\n this.subject.next(this.subject.data.filter(x => x.key !== key));\n if (this.notificationTimeouts[key]) {\n clearTimeout(this.notificationTimeouts[key]);\n delete this.notificationTimeouts[key];\n }\n }\n\n public clearNotifications(): void {\n this.subject.next([]);\n Object.keys(this.notificationTimeouts).forEach(key => {\n clearTimeout(this.notificationTimeouts[key]);\n delete this.notificationTimeouts[key];\n });\n }\n\n public fulfillNotification(key: string, message: Notification['message'], severity: Notification['severity']): void {\n this.subject.next(this.subject.data.map(x => {\n if (x.key === key) {\n return {\n ...x,\n isLoading: false,\n message,\n severity,\n };\n }\n return x;\n }));\n }\n\n public hideAllNotifications(): void {\n this.subject.next(this.subject.data.map(x => ({\n ...x,\n visible: false,\n })));\n }\n\n public hideNotification(key: string): void {\n this.subject.next(this.subject.data.map(x => {\n if (x.key === key) {\n return {\n ...x,\n visible: false,\n };\n }\n return x;\n }));\n clearTimeout(this.notificationTimeouts[key]);\n delete this.notificationTimeouts[key];\n }\n\n public showNotification(notification: Omit<Notification, 'key' | 'timestamp' | 'visible'>): string {\n const key = StringUtil.createUuid();\n const autoHideAfterMs = notification.autoHideAfterMs ?? this.config.notifications.autoHideAfterMs;\n\n this.subject.next([\n {\n ...notification,\n autoHideAfterMs,\n key,\n timestamp: new Date().getTime(),\n visible: true,\n },\n ...this.subject.data,\n ]);\n\n if (isFinite(autoHideAfterMs)) {\n this.notificationTimeouts[key] = setTimeout(() => {\n this.subject.next(this.subject.data.map(x => {\n if (x.key === key) {\n return {\n ...x,\n visible: false,\n };\n }\n return x;\n }));\n }, autoHideAfterMs);\n }\n return key;\n }\n}\n"],"mappings":";;;;;;;;AAaO,IAAMI,IAAN,cAAkCC,EAAqC;CAC5E;CACA;CAEA,YAAmB,GAA0C;EAG3D,AAFA,MAAM,IAAIC,EAAwB,CAAC,CAAC,CAAC,GACrC,KAAK,SAASC,GACd,KAAK,uBAAuB,CAAC;CAC/B;CAGA,kBAAyB,GAAmB;EAE1C,AADA,KAAK,QAAQ,KAAK,KAAK,QAAQ,KAAK,QAAO,MAAKC,EAAE,QAAQC,CAAG,CAAC,GAC1D,KAAK,qBAAqBA,OAC5B,aAAa,KAAK,qBAAqBA,EAAI,GAC3C,OAAO,KAAK,qBAAqBA;CAErC;CAEA,qBAAkC;EAEhC,AADA,KAAK,QAAQ,KAAK,CAAC,CAAC,GACpB,OAAO,KAAK,KAAK,oBAAoB,CAAC,CAAC,SAAQ,MAAO;GAEpD,AADA,aAAa,KAAK,qBAAqBA,EAAI,GAC3C,OAAO,KAAK,qBAAqBA;EACnC,CAAC;CACH;CAEA,oBAA2B,GAAa,GAAkC,GAA0C;EAClH,KAAK,QAAQ,KAAK,KAAK,QAAQ,KAAK,KAAI,MAClCD,EAAE,QAAQC,IACL;GACL,GAAGD;GACH,WAAW;GACX;GACA;EACF,IAEKA,CACR,CAAC;CACJ;CAEA,uBAAoC;EAClC,KAAK,QAAQ,KAAK,KAAK,QAAQ,KAAK,KAAI,OAAM;GAC5C,GAAGA;GACH,SAAS;EACX,EAAE,CAAC;CACL;CAEA,iBAAwB,GAAmB;EAWzC,AAVA,KAAK,QAAQ,KAAK,KAAK,QAAQ,KAAK,KAAI,MAClCA,EAAE,QAAQC,IACL;GACL,GAAGD;GACH,SAAS;EACX,IAEKA,CACR,CAAC,GACF,aAAa,KAAK,qBAAqBC,EAAI,GAC3C,OAAO,KAAK,qBAAqBA;CACnC;CAEA,iBAAwB,GAA2E;EACjG,IAAMA,IAAMC,EAAW,WAAW,GAC5BC,IAAkBC,EAAa,mBAAmB,KAAK,OAAO,cAAc;EA0BlF,OAxBA,KAAK,QAAQ,KAAK,CAChB;GACE,GAAGA;GACH;GACA;GACA,4BAAW,IAAI,KAAK,EAAA,CAAE,QAAQ;GAC9B,SAAS;EACX,GACA,GAAG,KAAK,QAAQ,IAClB,CAAC,GAEG,SAASD,CAAe,MAC1B,KAAK,qBAAqBF,KAAO,iBAAiB;GAChD,KAAK,QAAQ,KAAK,KAAK,QAAQ,KAAK,KAAI,MAClCD,EAAE,QAAQC,IACL;IACL,GAAGD;IACH,SAAS;GACX,IAEKA,CACR,CAAC;EACJ,GAAGG,CAAe,IAEbF;CACT;AACF;AA7FC,IAAAT,EAAA,CAAAa,EAAU,GAAAZ,EAAA,GAKWa,EAAOC,CAAY,CAAA,CAAA,GAAAX,CAAA"}
1
+ {"version":3,"file":"index.js","names":["_decorate","_decorateParam","__decorate","NotificationService","SubscribableAbstract","Subject","config","x","key","StringUtil","autoHideAfterMs","notification","singleton","__decorateParam","inject","CONFIG_TOKEN"],"sources":["../../../../src/classes/services/NotificationService/NotificationService.ts"],"sourcesContent":["import { StringUtil } from '@gen-epix/ui-core/utils/StringUtil';\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 type { Notification } from '../../../models/notification.models';\nimport { CONFIG_TOKEN } from '../../../constants/config.constants';\nimport type { ConfigBase } from '../../../models/config.models';\n\n@singleton()\nexport class NotificationService extends SubscribableAbstract<Notification[]> {\n private readonly config: Pick<ConfigBase, 'notifications'>;\n private readonly notificationTimeouts: Record<string, ReturnType<typeof setTimeout>>;\n\n public constructor(@inject(CONFIG_TOKEN) config: ConfigBase) {\n super(new Subject<Notification[]>([]));\n this.config = config;\n this.notificationTimeouts = {};\n }\n\n\n public clearNotification(key: string): void {\n this.subject.next(this.subject.data.filter(x => x.key !== key));\n if (this.notificationTimeouts[key]) {\n clearTimeout(this.notificationTimeouts[key]);\n delete this.notificationTimeouts[key];\n }\n }\n\n public clearNotifications(): void {\n this.subject.next([]);\n Object.keys(this.notificationTimeouts).forEach(key => {\n clearTimeout(this.notificationTimeouts[key]);\n delete this.notificationTimeouts[key];\n });\n }\n\n public fulfillNotification(key: string, message: Notification['message'], severity: Notification['severity']): void {\n this.subject.next(this.subject.data.map(x => {\n if (x.key === key) {\n return {\n ...x,\n isLoading: false,\n message,\n severity,\n };\n }\n return x;\n }));\n }\n\n public hideAllNotifications(): void {\n this.subject.next(this.subject.data.map(x => ({\n ...x,\n visible: false,\n })));\n }\n\n public hideNotification(key: string): void {\n this.subject.next(this.subject.data.map(x => {\n if (x.key === key) {\n return {\n ...x,\n visible: false,\n };\n }\n return x;\n }));\n clearTimeout(this.notificationTimeouts[key]);\n delete this.notificationTimeouts[key];\n }\n\n public showNotification(notification: Omit<Notification, 'key' | 'timestamp' | 'visible'>): string {\n const key = StringUtil.createUuid();\n const autoHideAfterMs = notification.autoHideAfterMs ?? this.config.notifications.autoHideAfterMs;\n\n this.subject.next([\n {\n ...notification,\n autoHideAfterMs,\n key,\n timestamp: new Date().getTime(),\n visible: true,\n },\n ...this.subject.data,\n ]);\n\n if (isFinite(autoHideAfterMs)) {\n this.notificationTimeouts[key] = setTimeout(() => {\n delete this.notificationTimeouts[key];\n this.subject.next(this.subject.data.map(x => {\n if (x.key === key) {\n return {\n ...x,\n visible: false,\n };\n }\n return x;\n }));\n }, autoHideAfterMs);\n }\n return key;\n }\n}\n"],"mappings":";;;;;;;;AAaO,IAAMG,IAAN,cAAkCC,EAAqC;CAC5E;CACA;CAEA,YAAmB,GAA0C;EAG3D,AAFA,MAAM,IAAIC,EAAwB,CAAC,CAAC,CAAC,GACrC,KAAK,SAASC,GACd,KAAK,uBAAuB,CAAC;CAC/B;CAGA,kBAAyB,GAAmB;EAE1C,AADA,KAAK,QAAQ,KAAK,KAAK,QAAQ,KAAK,QAAO,MAAKC,EAAE,QAAQC,CAAG,CAAC,GAC1D,KAAK,qBAAqBA,OAC5B,aAAa,KAAK,qBAAqBA,EAAI,GAC3C,OAAO,KAAK,qBAAqBA;CAErC;CAEA,qBAAkC;EAEhC,AADA,KAAK,QAAQ,KAAK,CAAC,CAAC,GACpB,OAAO,KAAK,KAAK,oBAAoB,CAAC,CAAC,SAAQ,MAAO;GAEpD,AADA,aAAa,KAAK,qBAAqBA,EAAI,GAC3C,OAAO,KAAK,qBAAqBA;EACnC,CAAC;CACH;CAEA,oBAA2B,GAAa,GAAkC,GAA0C;EAClH,KAAK,QAAQ,KAAK,KAAK,QAAQ,KAAK,KAAI,MAClCD,EAAE,QAAQC,IACL;GACL,GAAGD;GACH,WAAW;GACX;GACA;EACF,IAEKA,CACR,CAAC;CACJ;CAEA,uBAAoC;EAClC,KAAK,QAAQ,KAAK,KAAK,QAAQ,KAAK,KAAI,OAAM;GAC5C,GAAGA;GACH,SAAS;EACX,EAAE,CAAC;CACL;CAEA,iBAAwB,GAAmB;EAWzC,AAVA,KAAK,QAAQ,KAAK,KAAK,QAAQ,KAAK,KAAI,MAClCA,EAAE,QAAQC,IACL;GACL,GAAGD;GACH,SAAS;EACX,IAEKA,CACR,CAAC,GACF,aAAa,KAAK,qBAAqBC,EAAI,GAC3C,OAAO,KAAK,qBAAqBA;CACnC;CAEA,iBAAwB,GAA2E;EACjG,IAAMA,IAAMC,EAAW,WAAW,GAC5BC,IAAkBC,EAAa,mBAAmB,KAAK,OAAO,cAAc;EA2BlF,OAzBA,KAAK,QAAQ,KAAK,CAChB;GACE,GAAGA;GACH;GACA;GACA,4BAAW,IAAI,KAAK,EAAA,CAAE,QAAQ;GAC9B,SAAS;EACX,GACA,GAAG,KAAK,QAAQ,IAClB,CAAC,GAEG,SAASD,CAAe,MAC1B,KAAK,qBAAqBF,KAAO,iBAAiB;GAEhD,AADA,OAAO,KAAK,qBAAqBA,IACjC,KAAK,QAAQ,KAAK,KAAK,QAAQ,KAAK,KAAI,MAClCD,EAAE,QAAQC,IACL;IACL,GAAGD;IACH,SAAS;GACX,IAEKA,CACR,CAAC;EACJ,GAAGG,CAAe,IAEbF;CACT;AACF;AA9FC,IAAAR,EAAA,CAAAY,EAAU,GAAAX,EAAA,GAKWa,EAAOC,CAAY,CAAA,CAAA,GAAAZ,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 { EventBusAbstract as o } from "@gen-epix/ui-core/classes/abstracts/EventBusAbstract";
6
7
  //#region src/classes/services/PageEventBusService/PageEventBusService.ts
7
8
  var s = class extends o {
@@ -54,14 +55,17 @@ var s = class extends o {
54
55
  }
55
56
  traverseDom(e, t) {
56
57
  if (t(e)) return e;
57
- for (let n of Array.from(e.childNodes)) if (this.traverseDom(n, t)) return n;
58
+ for (let n of Array.from(e.childNodes)) {
59
+ let e = this.traverseDom(n, t);
60
+ if (e) return e;
61
+ }
58
62
  return null;
59
63
  }
60
64
  };
61
- s = e([
62
- a(),
63
- r(0, i(t)),
64
- r(1, i(n))
65
+ s = n([
66
+ i(),
67
+ t(0, r(e)),
68
+ t(1, r(a))
65
69
  ], s);
66
70
  //#endregion
67
71
  export { s as PageEventBusService };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_decorate","_decorateParam","__decorate","__decorateParam","PageEventBusService","EventBusAbstract","windowService","config","eventName","payload","enablePageEvents","closestButton","event","closestLink","closestElement","context","buttonTitle","childTextNode","el","nodeWithText","predicate","element","child","singleton","inject","CONFIG_TOKEN","WINDOW_SERVICE_TOKEN"],"sources":["../../../../src/classes/services/PageEventBusService/PageEventBusService.ts"],"sourcesContent":["import type { CommonDbUser } from '@gen-epix/api-commondb';\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 {\n CONFIG_TOKEN,\n WINDOW_SERVICE_TOKEN,\n} from '../../../constants/config.constants';\nimport type { ConfigBase } from '../../../models/config.models';\n\ntype EpiEvent = {\n changePage: Page;\n changeUser: CommonDbUser;\n click: {\n context?: string;\n label: string;\n page?: Page;\n type: 'button' | 'link' | 'table-row-index' | 'table-row';\n };\n error: Error;\n};\n\ntype Page = {\n location: Location;\n pageName: string;\n};\n\n@singleton()\nexport class PageEventBusService extends EventBusAbstract<EpiEvent> {\n private lastPageEventPayload: string = null;\n private readonly windowService: WindowService;\n\n public constructor(\n @inject(CONFIG_TOKEN) config: ConfigBase,\n @inject(WINDOW_SERVICE_TOKEN) windowService: WindowService,\n ) {\n super();\n this.windowService = windowService;\n this.setupClickEventListener(config.enablePageEvents);\n }\n\n\n public emit<TEventName extends keyof EpiEvent>(eventName: TEventName, payload?: EpiEvent[TEventName]): void {\n if (eventName === 'changePage') {\n if (this.lastPageEventPayload === (payload as EpiEvent['changePage']).pageName) {\n return;\n }\n this.lastPageEventPayload = (payload as EpiEvent['changePage']).pageName;\n }\n\n if (eventName === 'click' && !(payload as EpiEvent['click']).page) {\n (payload as EpiEvent['click']).page = this.getPage();\n }\n\n super.emit(eventName, payload);\n }\n\n public getPage(): Page {\n return {\n location: this.windowService.window.location,\n pageName: document.querySelector('[data-page-container]')?.getAttribute('data-testid'),\n };\n }\n\n private setupClickEventListener(enablePageEvents: boolean): void {\n if (!enablePageEvents) {\n return;\n }\n this.windowService.window.addEventListener('click', (event: Event): void => {\n\n const closestButton = (event.target as HTMLElement).closest('button');\n const closestLink = (event.target as HTMLElement).closest('a');\n const closestElement = closestButton || closestLink;\n\n if (closestElement) {\n const context = closestElement?.closest('[data-testid]')?.getAttribute('data-testid') ?? '';\n\n const buttonTitle = closestElement.getAttribute('aria-label') ?? closestElement.getAttribute('title');\n if (buttonTitle) {\n this.emit('click', {\n context,\n label: buttonTitle,\n type: closestButton ? 'button' : 'link',\n });\n } else {\n const childTextNode = this.traverseDom(closestElement, (el) => el.nodeType === Node.TEXT_NODE);\n if (childTextNode?.nodeValue) {\n this.emit('click', {\n context,\n label: childTextNode?.nodeValue,\n type: closestButton ? 'button' : 'link',\n });\n } else {\n const nodeWithText = this.traverseDom(closestElement, (el) => !!el.innerText);\n if (nodeWithText?.innerText) {\n this.emit('click', {\n context,\n label: nodeWithText?.innerText.split('\\n')[0],\n type: closestButton ? 'button' : 'link',\n });\n }\n }\n }\n }\n });\n }\n\n private traverseDom(element: HTMLElement, predicate: (element: HTMLElement) => boolean): HTMLElement {\n if (predicate(element)) {\n return element;\n }\n for (const child of Array.from(element.childNodes)) {\n const found = this.traverseDom(child as HTMLElement, predicate);\n if (found) {\n return child as HTMLElement;\n }\n }\n return null;\n }\n}\n"],"mappings":";;;;;;AAgCO,IAAMI,IAAN,cAAkCC,EAA2B;CAClE,uBAAuC;CACvC;CAEA,YACE,GACA,GACA;EAGA,AAFA,MAAM,GACN,KAAK,gBAAgBC,GACrB,KAAK,wBAAwBC,EAAO,gBAAgB;CACtD;CAGA,KAA+C,GAAuB,GAAsC;EAC1G,IAAIC,MAAc,cAAc;GAC9B,IAAI,KAAK,yBAA0BC,EAAmC,UACpE;GAEF,KAAK,uBAAwBA,EAAmC;EAClE;EAMA,AAJID,MAAc,WAAW,CAAEC,EAA8B,SAC3D,EAA+B,OAAO,KAAK,QAAQ,IAGrD,MAAM,KAAKD,GAAWC,CAAO;CAC/B;CAEA,UAAuB;EACrB,OAAO;GACL,UAAU,KAAK,cAAc,OAAO;GACpC,UAAU,SAAS,cAAc,uBAAuB,CAAC,EAAE,aAAa,aAAa;EACvF;CACF;CAEA,wBAAgC,GAAiC;EAC/D,AAAKC,KAGL,KAAK,cAAc,OAAO,iBAAiB,UAAU,MAAuB;GAE1E,IAAMC,IAAiBC,EAAM,OAAuB,QAAQ,QAAQ,GAC9DC,IAAeD,EAAM,OAAuB,QAAQ,GAAG,GACvDE,IAAiBH,KAAiBE;GAExC,IAAIC,GAAgB;IAClB,IAAMC,IAAUD,GAAgB,QAAQ,eAAe,CAAC,EAAE,aAAa,aAAa,KAAK,IAEnFE,IAAcF,EAAe,aAAa,YAAY,KAAKA,EAAe,aAAa,OAAO;IACpG,IAAIE,GACF,KAAK,KAAK,SAAS;KACjB;KACA,OAAOA;KACP,MAAML,IAAgB,WAAW;IACnC,CAAC;SACI;KACL,IAAMM,IAAgB,KAAK,YAAYH,IAAiB,MAAOI,EAAG,aAAa,KAAK,SAAS;KAC7F,IAAID,GAAe,WACjB,KAAK,KAAK,SAAS;MACjB;MACA,OAAOA,GAAe;MACtB,MAAMN,IAAgB,WAAW;KACnC,CAAC;UACI;MACL,IAAMQ,IAAe,KAAK,YAAYL,IAAiB,MAAO,CAAC,CAACI,EAAG,SAAS;MAC5E,AAAIC,GAAc,aAChB,KAAK,KAAK,SAAS;OACjB;OACA,OAAOA,GAAc,UAAU,MAAM,IAAI,CAAC,CAAC;OAC3C,MAAMR,IAAgB,WAAW;MACnC,CAAC;KAEL;IACF;GACF;EACF,CAAC;CACH;CAEA,YAAoB,GAAsB,GAA2D;EACnG,IAAIS,EAAUC,CAAO,GACnB,OAAOA;EAET,KAAK,IAAMC,KAAS,MAAM,KAAKD,EAAQ,UAAU,GAE/C,IADc,KAAK,YAAYC,GAAsBF,CACjD,GACF,OAAOE;EAGX,OAAO;CACT;AACF;;CA5FCC,EAAU;CAMNtB,EAAA,GAAAuB,EAAOC,CAAY,CAAA;CACnBxB,EAAA,GAAAuB,EAAOE,CAAoB,CAAA"}
1
+ {"version":3,"file":"index.js","names":["_decorate","_decorateParam","__decorate","PageEventBusService","EventBusAbstract","windowService","config","eventName","payload","enablePageEvents","closestButton","event","closestLink","closestElement","context","buttonTitle","childTextNode","el","nodeWithText","predicate","element","child","found","singleton","__decorateParam","inject","CONFIG_TOKEN","WindowService"],"sources":["../../../../src/classes/services/PageEventBusService/PageEventBusService.ts"],"sourcesContent":["import type { CommonDbUser } from '@gen-epix/api-commondb';\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\nimport { CONFIG_TOKEN } from '../../../constants/config.constants';\nimport type { ConfigBase } from '../../../models/config.models';\n\ntype EpiEvent = {\n changePage: Page;\n changeUser: CommonDbUser;\n click: {\n context?: string;\n label: string;\n page?: Page;\n type: 'button' | 'link' | 'table-row-index' | 'table-row';\n };\n error: Error;\n};\n\ntype Page = {\n location: Location;\n pageName: string;\n};\n\n@singleton()\nexport class PageEventBusService extends EventBusAbstract<EpiEvent> {\n private lastPageEventPayload: string = null;\n private readonly windowService: WindowService;\n\n public constructor(\n @inject(CONFIG_TOKEN) config: ConfigBase,\n @inject(WindowService) windowService: WindowService,\n ) {\n super();\n this.windowService = windowService;\n this.setupClickEventListener(config.enablePageEvents);\n }\n\n\n public emit<TEventName extends keyof EpiEvent>(eventName: TEventName, payload?: EpiEvent[TEventName]): void {\n if (eventName === 'changePage') {\n if (this.lastPageEventPayload === (payload as EpiEvent['changePage']).pageName) {\n return;\n }\n this.lastPageEventPayload = (payload as EpiEvent['changePage']).pageName;\n }\n\n if (eventName === 'click' && !(payload as EpiEvent['click']).page) {\n (payload as EpiEvent['click']).page = this.getPage();\n }\n\n super.emit(eventName, payload);\n }\n\n public getPage(): Page {\n return {\n location: this.windowService.window.location,\n pageName: document.querySelector('[data-page-container]')?.getAttribute('data-testid'),\n };\n }\n\n private setupClickEventListener(enablePageEvents: boolean): void {\n if (!enablePageEvents) {\n return;\n }\n this.windowService.window.addEventListener('click', (event: Event): void => {\n\n const closestButton = (event.target as HTMLElement).closest('button');\n const closestLink = (event.target as HTMLElement).closest('a');\n const closestElement = closestButton || closestLink;\n\n if (closestElement) {\n const context = closestElement?.closest('[data-testid]')?.getAttribute('data-testid') ?? '';\n\n const buttonTitle = closestElement.getAttribute('aria-label') ?? closestElement.getAttribute('title');\n if (buttonTitle) {\n this.emit('click', {\n context,\n label: buttonTitle,\n type: closestButton ? 'button' : 'link',\n });\n } else {\n const childTextNode = this.traverseDom(closestElement, (el) => el.nodeType === Node.TEXT_NODE);\n if (childTextNode?.nodeValue) {\n this.emit('click', {\n context,\n label: childTextNode?.nodeValue,\n type: closestButton ? 'button' : 'link',\n });\n } else {\n const nodeWithText = this.traverseDom(closestElement, (el) => !!el.innerText);\n if (nodeWithText?.innerText) {\n this.emit('click', {\n context,\n label: nodeWithText?.innerText.split('\\n')[0],\n type: closestButton ? 'button' : 'link',\n });\n }\n }\n }\n }\n });\n }\n\n private traverseDom(element: HTMLElement, predicate: (element: HTMLElement) => boolean): HTMLElement {\n if (predicate(element)) {\n return element;\n }\n for (const child of Array.from(element.childNodes)) {\n const found = this.traverseDom(child as HTMLElement, predicate);\n if (found) {\n return found;\n }\n }\n return null;\n }\n}\n"],"mappings":";;;;;;;AA6BO,IAAMG,IAAN,cAAkCC,EAA2B;CAClE,uBAAuC;CACvC;CAEA,YACE,GACA,GACA;EAGA,AAFA,MAAM,GACN,KAAK,gBAAgBC,GACrB,KAAK,wBAAwBC,EAAO,gBAAgB;CACtD;CAGA,KAA+C,GAAuB,GAAsC;EAC1G,IAAIC,MAAc,cAAc;GAC9B,IAAI,KAAK,yBAA0BC,EAAmC,UACpE;GAEF,KAAK,uBAAwBA,EAAmC;EAClE;EAMA,AAJID,MAAc,WAAW,CAAEC,EAA8B,SAC3D,EAA+B,OAAO,KAAK,QAAQ,IAGrD,MAAM,KAAKD,GAAWC,CAAO;CAC/B;CAEA,UAAuB;EACrB,OAAO;GACL,UAAU,KAAK,cAAc,OAAO;GACpC,UAAU,SAAS,cAAc,uBAAuB,CAAC,EAAE,aAAa,aAAa;EACvF;CACF;CAEA,wBAAgC,GAAiC;EAC/D,AAAKC,KAGL,KAAK,cAAc,OAAO,iBAAiB,UAAU,MAAuB;GAE1E,IAAMC,IAAiBC,EAAM,OAAuB,QAAQ,QAAQ,GAC9DC,IAAeD,EAAM,OAAuB,QAAQ,GAAG,GACvDE,IAAiBH,KAAiBE;GAExC,IAAIC,GAAgB;IAClB,IAAMC,IAAUD,GAAgB,QAAQ,eAAe,CAAC,EAAE,aAAa,aAAa,KAAK,IAEnFE,IAAcF,EAAe,aAAa,YAAY,KAAKA,EAAe,aAAa,OAAO;IACpG,IAAIE,GACF,KAAK,KAAK,SAAS;KACjB;KACA,OAAOA;KACP,MAAML,IAAgB,WAAW;IACnC,CAAC;SACI;KACL,IAAMM,IAAgB,KAAK,YAAYH,IAAiB,MAAOI,EAAG,aAAa,KAAK,SAAS;KAC7F,IAAID,GAAe,WACjB,KAAK,KAAK,SAAS;MACjB;MACA,OAAOA,GAAe;MACtB,MAAMN,IAAgB,WAAW;KACnC,CAAC;UACI;MACL,IAAMQ,IAAe,KAAK,YAAYL,IAAiB,MAAO,CAAC,CAACI,EAAG,SAAS;MAC5E,AAAIC,GAAc,aAChB,KAAK,KAAK,SAAS;OACjB;OACA,OAAOA,GAAc,UAAU,MAAM,IAAI,CAAC,CAAC;OAC3C,MAAMR,IAAgB,WAAW;MACnC,CAAC;KAEL;IACF;GACF;EACF,CAAC;CACH;CAEA,YAAoB,GAAsB,GAA2D;EACnG,IAAIS,EAAUC,CAAO,GACnB,OAAOA;EAET,KAAK,IAAMC,KAAS,MAAM,KAAKD,EAAQ,UAAU,GAAG;GAClD,IAAME,IAAQ,KAAK,YAAYD,GAAsBF,CAAS;GAC9D,IAAIG,GACF,OAAOA;EAEX;EACA,OAAO;CACT;AACF;;CA5FCC,EAAU;CAMNtB,EAAA,GAAAwB,EAAOC,CAAY,CAAA;CACnBzB,EAAA,GAAAwB,EAAOE,CAAa,CAAA"}
@@ -4,26 +4,23 @@ import { createBrowserRouter as n } from "react-router-dom";
4
4
  //#region src/classes/services/RouterService/RouterService.ts
5
5
  var r = class {
6
6
  get adminRoutes() {
7
- if (!this.__adminRoutesFactory) throw Error("RouterService not initialized");
8
7
  return this.__adminRoutes ??= this.__adminRoutesFactory(), this.__adminRoutes;
9
8
  }
10
9
  get homePageComponent() {
11
- if (!this.__homePageComponent) throw Error("RouterService not initialized");
12
10
  return this.__homePageComponent;
13
11
  }
14
12
  get router() {
15
13
  return this.__router ||= n(this.routes), this.__router;
16
14
  }
17
15
  get routes() {
18
- if (!this.__routesFactory) throw Error("RouterService not initialized");
19
16
  return this.__routes ??= this.__routesFactory(), this.__routes;
20
17
  }
21
18
  __adminRoutes = null;
22
- __adminRoutesFactory = null;
23
- __homePageComponent = null;
19
+ __adminRoutesFactory;
20
+ __homePageComponent;
24
21
  __router = null;
25
22
  __routes = null;
26
- __routesFactory = null;
23
+ __routesFactory;
27
24
  constructor(e) {
28
25
  this.__homePageComponent = e.homePageComponent, this.__adminRoutesFactory = this.createRoutesFactory(e.adminRoutes), this.__routesFactory = this.createRoutesFactory(e.routes);
29
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_decorate","__decorate","RouterService","createBrowserRouter","kwArgs","routes","singleton"],"sources":["../../../../src/classes/services/RouterService/RouterService.ts"],"sourcesContent":["import type { ReactElement } from 'react';\nimport { createBrowserRouter } from 'react-router-dom';\nimport { singleton } from 'tsyringe';\n\nimport type { MyNonIndexRouteObject } from '../../../models/react-router.models';\n\ntype HomePage = () => ReactElement;\ntype RoutesFactory = () => MyNonIndexRouteObject[];\ntype RoutesInput = MyNonIndexRouteObject[] | RoutesFactory;\n\n@singleton()\nexport class RouterService {\n public get adminRoutes(): MyNonIndexRouteObject[] {\n if (!this.__adminRoutesFactory) {\n throw new Error('RouterService not initialized');\n }\n this.__adminRoutes ??= this.__adminRoutesFactory();\n return this.__adminRoutes;\n }\n public get homePageComponent(): HomePage {\n if (!this.__homePageComponent) {\n throw new Error('RouterService not initialized');\n }\n return this.__homePageComponent;\n }\n public get router(): ReturnType<typeof createBrowserRouter> {\n if (!this.__router) {\n this.__router = createBrowserRouter(this.routes);\n }\n return this.__router;\n }\n public get routes(): MyNonIndexRouteObject[] {\n if (!this.__routesFactory) {\n throw new Error('RouterService not initialized');\n }\n this.__routes ??= this.__routesFactory();\n return this.__routes;\n }\n private __adminRoutes: MyNonIndexRouteObject[] | null = null;\n private readonly __adminRoutesFactory: null | RoutesFactory = null;\n\n private readonly __homePageComponent: HomePage | null = null;\n\n private __router: null | ReturnType<typeof createBrowserRouter> = null;\n\n private __routes: MyNonIndexRouteObject[] | null = null;\n\n private readonly __routesFactory: null | RoutesFactory = null;\n\n public constructor(kwArgs: {\n adminRoutes: RoutesInput;\n homePageComponent: HomePage;\n routes: RoutesInput;\n }) {\n this.__homePageComponent = kwArgs.homePageComponent;\n this.__adminRoutesFactory = this.createRoutesFactory(kwArgs.adminRoutes);\n this.__routesFactory = this.createRoutesFactory(kwArgs.routes);\n }\n\n\n private createRoutesFactory(routes: RoutesInput): RoutesFactory {\n if (typeof routes === 'function') {\n return routes;\n }\n return () => routes;\n }\n}\n"],"mappings":";;;;AAWO,IAAME,IAAN,MAAoB;CACzB,IAAW,cAAuC;EAChD,IAAI,CAAC,KAAK,sBACR,MAAU,MAAM,+BAA+B;EAGjD,OADA,KAAK,kBAAkB,KAAK,qBAAqB,GAC1C,KAAK;CACd;CACA,IAAW,oBAA8B;EACvC,IAAI,CAAC,KAAK,qBACR,MAAU,MAAM,+BAA+B;EAEjD,OAAO,KAAK;CACd;CACA,IAAW,SAAiD;EAI1D,OAHA,AACE,KAAK,aAAWC,EAAoB,KAAK,MAAM,GAE1C,KAAK;CACd;CACA,IAAW,SAAkC;EAC3C,IAAI,CAAC,KAAK,iBACR,MAAU,MAAM,+BAA+B;EAGjD,OADA,KAAK,aAAa,KAAK,gBAAgB,GAChC,KAAK;CACd;CACA,gBAAwD;CACxD,uBAA8D;CAE9D,sBAAwD;CAExD,WAAkE;CAElE,WAAmD;CAEnD,kBAAyD;CAEzD,YAAmB,GAIhB;EAGD,AAFA,KAAK,sBAAsBC,EAAO,mBAClC,KAAK,uBAAuB,KAAK,oBAAoBA,EAAO,WAAW,GACvE,KAAK,kBAAkB,KAAK,oBAAoBA,EAAO,MAAM;CAC/D;CAGA,oBAA4B,GAAoC;EAI9D,OAHI,OAAOC,KAAW,aACbA,UAEIA;CACf;AACF;AAxDC,IAAAL,EAAA,CAAAM,EAAU,CAAA,GAAAJ,CAAA"}
1
+ {"version":3,"file":"index.js","names":["_decorate","__decorate","RouterService","createBrowserRouter","kwArgs","routes","singleton"],"sources":["../../../../src/classes/services/RouterService/RouterService.ts"],"sourcesContent":["import type { ReactElement } from 'react';\nimport { createBrowserRouter } from 'react-router-dom';\nimport { singleton } from 'tsyringe';\n\nimport type { MyNonIndexRouteObject } from '../../../models/react-router.models';\n\ntype HomePage = () => ReactElement;\ntype RoutesFactory = () => MyNonIndexRouteObject[];\ntype RoutesInput = MyNonIndexRouteObject[] | RoutesFactory;\n\n@singleton()\nexport class RouterService {\n public get adminRoutes(): MyNonIndexRouteObject[] {\n this.__adminRoutes ??= this.__adminRoutesFactory();\n return this.__adminRoutes;\n }\n public get homePageComponent(): HomePage {\n return this.__homePageComponent;\n }\n public get router(): ReturnType<typeof createBrowserRouter> {\n if (!this.__router) {\n this.__router = createBrowserRouter(this.routes);\n }\n return this.__router;\n }\n public get routes(): MyNonIndexRouteObject[] {\n this.__routes ??= this.__routesFactory();\n return this.__routes;\n }\n private __adminRoutes: MyNonIndexRouteObject[] | null = null;\n private readonly __adminRoutesFactory: RoutesFactory;\n\n private readonly __homePageComponent: HomePage;\n\n private __router: null | ReturnType<typeof createBrowserRouter> = null;\n\n private __routes: MyNonIndexRouteObject[] | null = null;\n\n private readonly __routesFactory: RoutesFactory;\n\n public constructor(kwArgs: {\n adminRoutes: RoutesInput;\n homePageComponent: HomePage;\n routes: RoutesInput;\n }) {\n this.__homePageComponent = kwArgs.homePageComponent;\n this.__adminRoutesFactory = this.createRoutesFactory(kwArgs.adminRoutes);\n this.__routesFactory = this.createRoutesFactory(kwArgs.routes);\n }\n\n\n private createRoutesFactory(routes: RoutesInput): RoutesFactory {\n if (typeof routes === 'function') {\n return routes;\n }\n return () => routes;\n }\n}\n"],"mappings":";;;;AAWO,IAAME,IAAN,MAAoB;CACzB,IAAW,cAAuC;EAEhD,OADA,KAAK,kBAAkB,KAAK,qBAAqB,GAC1C,KAAK;CACd;CACA,IAAW,oBAA8B;EACvC,OAAO,KAAK;CACd;CACA,IAAW,SAAiD;EAI1D,OAHA,AACE,KAAK,aAAWC,EAAoB,KAAK,MAAM,GAE1C,KAAK;CACd;CACA,IAAW,SAAkC;EAE3C,OADA,KAAK,aAAa,KAAK,gBAAgB,GAChC,KAAK;CACd;CACA,gBAAwD;CACxD;CAEA;CAEA,WAAkE;CAElE,WAAmD;CAEnD;CAEA,YAAmB,GAIhB;EAGD,AAFA,KAAK,sBAAsBC,EAAO,mBAClC,KAAK,uBAAuB,KAAK,oBAAoBA,EAAO,WAAW,GACvE,KAAK,kBAAkB,KAAK,oBAAoBA,EAAO,MAAM;CAC/D;CAGA,oBAA4B,GAAoC;EAI9D,OAHI,OAAOC,KAAW,aACbA,UAEIA;CACf;AACF;AA/CC,IAAAL,EAAA,CAAAM,EAAU,CAAA,GAAAJ,CAAA"}
@@ -2,4 +2,4 @@ import { DependencyContainer } from 'tsyringe';
2
2
  export type AppProps = {
3
3
  readonly container: DependencyContainer;
4
4
  };
5
- export declare const App: ({ container }: AppProps) => import('react').JSX.Element;
5
+ export declare const App: () => import('react').JSX.Element;
@@ -1,46 +1,42 @@
1
- import { t as e } from "../../../_chunks/QueryClientService.js";
2
- import { t } from "../../../_chunks/QueryClientProvider.js";
3
- import { DependencyContainerUtil as n } from "../../../utils/DependencyContainerUtil/index.js";
4
- import { API_BASE_TOKEN as r } from "../../../constants/api.constants.js";
5
- import { RouterService as i } from "../../../classes/services/RouterService/index.js";
6
- import { UiClientCommonConfigContextProvider as a } from "../../../context/uiClientCommonConfigContext/index.js";
7
- import { AuthenticationService as o } from "../../../classes/services/AuthenticationService/index.js";
8
- import { LogService as s } from "../../../classes/services/LogService/index.js";
9
- import { ErrorPage as c } from "../../../pages/ErrorPage/index.js";
10
- import { BackendVersionService as l } from "../../../classes/services/BackendVersionService/index.js";
11
- import { ApplicationBootstrapWithoutAuthorization as u } from "../ApplicationBootstrapWithoutAuthorization/index.js";
12
- import { EmotionCacheService as d } from "../../../classes/services/EmotionCacheService/index.js";
13
- import { container as f } from "tsyringe";
14
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
15
- import { CssBaseline as h, ThemeProvider as g } from "@mui/material";
16
- import { RouterProvider as _ } from "react-router-dom";
17
- import { CacheProvider as v } from "@emotion/react";
18
- import { ErrorBoundary as y } from "react-error-boundary";
1
+ import { API_BASE_TOKEN as e } from "../../../constants/api.constants.js";
2
+ import { RouterService as t } from "../../../classes/services/RouterService/index.js";
3
+ import { useConfig as n } from "../../../hooks/useConfig/index.js";
4
+ import { AuthenticationService as r } from "../../../classes/services/AuthenticationService/index.js";
5
+ import { LogService as i } from "../../../classes/services/LogService/index.js";
6
+ import { t as a } from "../../../_chunks/QueryClientProvider.js";
7
+ import { t as o } from "../../../_chunks/QueryClientService.js";
8
+ import { ErrorPage as s } from "../../../pages/ErrorPage/index.js";
9
+ import { BackendVersionService as c } from "../../../classes/services/BackendVersionService/index.js";
10
+ import { ApplicationBootstrapWithoutAuthorization as l } from "../ApplicationBootstrapWithoutAuthorization/index.js";
11
+ import { EmotionCacheService as u } from "../../../classes/services/EmotionCacheService/index.js";
12
+ import { container as d } from "tsyringe";
13
+ import { CssBaseline as f, ThemeProvider as p } from "@mui/material";
14
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
15
+ import { RouterProvider as g } from "react-router-dom";
16
+ import { CacheProvider as _ } from "@emotion/react";
17
+ import { ErrorBoundary as v } from "react-error-boundary";
19
18
  //#region src/components/app/AppRouterProvider/AppRouterProvider.tsx
20
- var b = () => /* @__PURE__ */ p(_, { router: f.resolve(i).router }), x = ({ container: i }) => {
21
- let _ = n.resolveConfig(i), x = f.resolve(o), S = f.resolve(s), C = _.getTouchIconUrl();
22
- C && document.querySelector("link[rel=\"icon\"]")?.setAttribute("href", C);
23
- let w = f.resolve(r);
24
- w.baseUrl = _.getAPIBaseUrl(), w.defaultRequestTimeout = _.defaultRequestTimeout, w.onRequest = [x.onRequest.bind(x), S.onRequest.bind(S)], w.onResponseFulfilled = [S.onResponseFulfilled.bind(S), f.resolve(l).onResponseFulfilled.bind(f.resolve(l))], w.onResponseRejected = [S.onResponseRejected.bind(S), x.onResponseRejected.bind(x)];
25
- let T = i.resolve(e), E = i.resolve(d).emotionCache;
26
- return /* @__PURE__ */ p(a, {
27
- container: i,
28
- children: /* @__PURE__ */ p(t, {
29
- client: T.queryClient,
30
- children: /* @__PURE__ */ p(v, {
31
- value: E,
32
- children: /* @__PURE__ */ m(g, {
33
- theme: _.theme,
34
- children: [/* @__PURE__ */ p(h, {}), /* @__PURE__ */ p(y, {
35
- FallbackComponent: c,
36
- children: /* @__PURE__ */ p(u, { children: /* @__PURE__ */ p(b, {}) })
37
- })]
38
- })
19
+ var y = () => /* @__PURE__ */ m(g, { router: d.resolve(t).router }), b = () => {
20
+ let t = n(), g = d.resolve(r), b = d.resolve(i), x = t.getTouchIconUrl();
21
+ x && document.querySelector("link[rel=\"icon\"]")?.setAttribute("href", x);
22
+ let S = d.resolve(e);
23
+ S.baseUrl = t.getAPIBaseUrl(), S.defaultRequestTimeout = t.defaultRequestTimeout, S.onRequest = [g.onRequest.bind(g), b.onRequest.bind(b)], S.onResponseFulfilled = [b.onResponseFulfilled.bind(b), d.resolve(c).onResponseFulfilled.bind(d.resolve(c))], S.onResponseRejected = [b.onResponseRejected.bind(b), g.onResponseRejected.bind(g)];
24
+ let C = d.resolve(o), w = d.resolve(u).emotionCache;
25
+ return /* @__PURE__ */ m(a, {
26
+ client: C.queryClient,
27
+ children: /* @__PURE__ */ m(_, {
28
+ value: w,
29
+ children: /* @__PURE__ */ h(p, {
30
+ theme: t.theme,
31
+ children: [/* @__PURE__ */ m(f, {}), /* @__PURE__ */ m(v, {
32
+ FallbackComponent: s,
33
+ children: /* @__PURE__ */ m(l, { children: /* @__PURE__ */ m(y, {}) })
34
+ })]
39
35
  })
40
36
  })
41
37
  });
42
38
  };
43
39
  //#endregion
44
- export { x as App };
40
+ export { b as App };
45
41
 
46
42
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["rootContainer","container","rootContainer","QueryClientService","AppRouterProvider","RouterProvider","container","RouterService","App","container$1","config","DependencyContainerUtil","authenticationService","AuthenticationService","logService","LogService","touchIconUrl","api","API_BASE_TOKEN","BackendVersionService","queryClientService","emotionCache","EmotionCacheService","UiClientCommonConfigContextProvider","QueryClientProvider","CacheProvider","ThemeProvider","CssBaseline","ErrorBoundary","ErrorPage","ApplicationBootstrapWithoutAuthorization"],"sources":["../../../../src/components/app/AppRouterProvider/AppRouterProvider.tsx","../../../../src/components/app/App/App.tsx"],"sourcesContent":["import { container as rootContainer } from 'tsyringe';\nimport { RouterProvider } from 'react-router-dom';\n\nimport { RouterService } from '../../../classes/services/RouterService';\n\nexport const AppRouterProvider = () => <RouterProvider router={rootContainer.resolve(RouterService).router} />;\n","import type { DependencyContainer } from 'tsyringe';\nimport { container as rootContainer } from 'tsyringe';\nimport { CacheProvider } from '@emotion/react';\nimport {\n CssBaseline,\n ThemeProvider,\n} from '@mui/material';\nimport { QueryClientProvider } from '@tanstack/react-query';\nimport { ErrorBoundary } from 'react-error-boundary';\n\nimport { API_BASE_TOKEN } from '../../../constants/api.constants';\nimport { BackendVersionService } from '../../../classes/services/BackendVersionService';\nimport { QueryClientService } from '../../../classes/services/QueryClientService';\nimport { ErrorPage } from '../../../pages/ErrorPage';\nimport { EmotionCacheService } from '../../../classes/services/EmotionCacheService';\nimport { AuthenticationService } from '../../../classes/services/AuthenticationService';\nimport { LogService } from '../../../classes/services/LogService';\nimport { ApplicationBootstrapWithoutAuthorization } from '../ApplicationBootstrapWithoutAuthorization';\nimport { AppRouterProvider } from '../AppRouterProvider/AppRouterProvider';\nimport { UiClientCommonConfigContextProvider } from '../../../context/uiClientCommonConfigContext';\nimport type { ConfigBase } from '../../../models/config.models';\nimport { DependencyContainerUtil } from '../../../utils/DependencyContainerUtil';\n\nexport type AppProps = {\n readonly container: DependencyContainer;\n};\n\nexport const App = ({ container }: AppProps) => {\n const config = DependencyContainerUtil.resolveConfig<ConfigBase>(container);\n\n const authenticationService = rootContainer.resolve(AuthenticationService);\n const logService = rootContainer.resolve(LogService);\n const touchIconUrl = config.getTouchIconUrl();\n if (touchIconUrl) {\n document.querySelector('link[rel=\"icon\"]')?.setAttribute('href', touchIconUrl);\n }\n const api = rootContainer.resolve(API_BASE_TOKEN);\n api.baseUrl = config.getAPIBaseUrl();\n api.defaultRequestTimeout = config.defaultRequestTimeout;\n api.onRequest = [\n authenticationService.onRequest.bind(authenticationService),\n logService.onRequest.bind(logService),\n ];\n api.onResponseFulfilled = [\n logService.onResponseFulfilled.bind(logService),\n rootContainer.resolve(BackendVersionService).onResponseFulfilled.bind(rootContainer.resolve(BackendVersionService)),\n ];\n api.onResponseRejected = [\n logService.onResponseRejected.bind(logService),\n authenticationService.onResponseRejected.bind(authenticationService),\n ];\n\n const queryClientService = container.resolve(QueryClientService);\n const emotionCache = container.resolve(EmotionCacheService).emotionCache;\n\n return (\n <UiClientCommonConfigContextProvider container={container}>\n <QueryClientProvider client={queryClientService.queryClient}>\n <CacheProvider value={emotionCache}>\n <ThemeProvider theme={config.theme}>\n <CssBaseline />\n <ErrorBoundary FallbackComponent={ErrorPage}>\n <ApplicationBootstrapWithoutAuthorization>\n <AppRouterProvider />\n </ApplicationBootstrapWithoutAuthorization>\n </ErrorBoundary>\n </ThemeProvider>\n </CacheProvider>\n </QueryClientProvider>\n </UiClientCommonConfigContextProvider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAKA,IAAaI,UAA0B,kBAACC,GAAD,EAAgB,QAAQL,EAAc,QAAQO,CAAa,CAAC,CAAC,OAAS,CAAA,GCsBhGC,KAAO,EAAE,WAAAC,QAA0B;CAC9C,IAAMC,IAASC,EAAwB,cAA0BV,CAAS,GAEpEW,IAAwBV,EAAc,QAAQW,CAAqB,GACnEC,IAAaZ,EAAc,QAAQa,CAAU,GAC7CC,IAAeN,EAAO,gBAAgB;CAC5C,AAAIM,KACF,SAAS,cAAc,oBAAkB,CAAC,EAAE,aAAa,QAAQA,CAAY;CAE/E,IAAMC,IAAMf,EAAc,QAAQgB,CAAc;CAWhD,AAVA,EAAI,UAAUR,EAAO,cAAc,GACnC,EAAI,wBAAwBA,EAAO,uBACnC,EAAI,YAAY,CACdE,EAAsB,UAAU,KAAKA,CAAqB,GAC1DE,EAAW,UAAU,KAAKA,CAAU,CACtC,GACA,EAAI,sBAAsB,CACxBA,EAAW,oBAAoB,KAAKA,CAAU,GAC9CZ,EAAc,QAAQiB,CAAqB,CAAC,CAAC,oBAAoB,KAAKjB,EAAc,QAAQiB,CAAqB,CAAC,CACpH,GACA,EAAI,qBAAqB,CACvBL,EAAW,mBAAmB,KAAKA,CAAU,GAC7CF,EAAsB,mBAAmB,KAAKA,CAAqB,CACrE;CAEA,IAAMQ,IAAqBnB,EAAU,QAAQE,CAAkB,GACzDkB,IAAepB,EAAU,QAAQqB,CAAmB,CAAC,CAAC;CAE5D,OACE,kBAACC,GAAD;EAAgD,WAAAd;EAC9C,UAAA,kBAACe,GAAD;GAAqB,QAAQJ,EAAmB;GAC9C,UAAA,kBAACK,GAAD;IAAe,OAAOJ;IACpB,UAAA,kBAACK,GAAD;KAAe,OAAOhB,EAAO;KAA7B,UAAA,CACE,kBAACiB,GAAD,CAAc,CAAA,GACd,kBAACC,GAAD;MAAe,mBAAmBC;MAChC,UAAA,kBAACC,GAAD,EAAA,UACE,kBAAC1B,GAAD,CAAoB,CAAA,EACoB,CAAA;KAC7B,CAAA,CACF;;GACF,CAAA;EACI,CAAA;CACc,CAAA;AAEzC"}
1
+ {"version":3,"file":"index.js","names":["QueryClientProvider","QueryClientService","AppRouterProvider","RouterProvider","container","RouterService","App","config","useConfig","authenticationService","AuthenticationService","logService","LogService","touchIconUrl","api","API_BASE_TOKEN","BackendVersionService","queryClientService","emotionCache","EmotionCacheService","CacheProvider","ThemeProvider","CssBaseline","ErrorBoundary","ErrorPage","ApplicationBootstrapWithoutAuthorization"],"sources":["../../../../src/components/app/AppRouterProvider/AppRouterProvider.tsx","../../../../src/components/app/App/App.tsx"],"sourcesContent":["import { container } from 'tsyringe';\nimport { RouterProvider } from 'react-router-dom';\n\nimport { RouterService } from '../../../classes/services/RouterService';\n\nexport const AppRouterProvider = () => <RouterProvider router={container.resolve(RouterService).router} />;\n","import { container } from 'tsyringe';\nimport type { DependencyContainer } from 'tsyringe';\nimport { CacheProvider } from '@emotion/react';\nimport {\n CssBaseline,\n ThemeProvider,\n} from '@mui/material';\nimport { QueryClientProvider } from '@tanstack/react-query';\nimport { ErrorBoundary } from 'react-error-boundary';\n\nimport { API_BASE_TOKEN } from '../../../constants/api.constants';\nimport { BackendVersionService } from '../../../classes/services/BackendVersionService';\nimport { QueryClientService } from '../../../classes/services/QueryClientService';\nimport { ErrorPage } from '../../../pages/ErrorPage';\nimport { EmotionCacheService } from '../../../classes/services/EmotionCacheService';\nimport { AuthenticationService } from '../../../classes/services/AuthenticationService';\nimport { LogService } from '../../../classes/services/LogService';\nimport { ApplicationBootstrapWithoutAuthorization } from '../ApplicationBootstrapWithoutAuthorization';\nimport { AppRouterProvider } from '../AppRouterProvider/AppRouterProvider';\nimport { useConfig } from '../../../hooks/useConfig';\n\nexport type AppProps = {\n readonly container: DependencyContainer;\n};\n\nexport const App = () => {\n const config = useConfig();\n\n const authenticationService = container.resolve(AuthenticationService);\n const logService = container.resolve(LogService);\n const touchIconUrl = config.getTouchIconUrl();\n if (touchIconUrl) {\n document.querySelector('link[rel=\"icon\"]')?.setAttribute('href', touchIconUrl);\n }\n const api = container.resolve(API_BASE_TOKEN);\n api.baseUrl = config.getAPIBaseUrl();\n api.defaultRequestTimeout = config.defaultRequestTimeout;\n api.onRequest = [\n authenticationService.onRequest.bind(authenticationService),\n logService.onRequest.bind(logService),\n ];\n api.onResponseFulfilled = [\n logService.onResponseFulfilled.bind(logService),\n container.resolve(BackendVersionService).onResponseFulfilled.bind(container.resolve(BackendVersionService)),\n ];\n api.onResponseRejected = [\n logService.onResponseRejected.bind(logService),\n authenticationService.onResponseRejected.bind(authenticationService),\n ];\n\n const queryClientService = container.resolve(QueryClientService);\n const emotionCache = container.resolve(EmotionCacheService).emotionCache;\n\n return (\n <QueryClientProvider client={queryClientService.queryClient}>\n <CacheProvider value={emotionCache}>\n <ThemeProvider theme={config.theme}>\n <CssBaseline />\n <ErrorBoundary FallbackComponent={ErrorPage}>\n <ApplicationBootstrapWithoutAuthorization>\n <AppRouterProvider />\n </ApplicationBootstrapWithoutAuthorization>\n </ErrorBoundary>\n </ThemeProvider>\n </CacheProvider>\n </QueryClientProvider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAKA,IAAaE,UAA0B,kBAACC,GAAD,EAAgB,QAAQC,EAAU,QAAQC,CAAa,CAAC,CAAC,OAAS,CAAA,GCoB5FC,UAAY;CACvB,IAAMC,IAASC,EAAU,GAEnBC,IAAwBL,EAAU,QAAQM,CAAqB,GAC/DC,IAAaP,EAAU,QAAQQ,CAAU,GACzCC,IAAeN,EAAO,gBAAgB;CAC5C,AAAIM,KACF,SAAS,cAAc,oBAAkB,CAAC,EAAE,aAAa,QAAQA,CAAY;CAE/E,IAAMC,IAAMV,EAAU,QAAQW,CAAc;CAW5C,AAVA,EAAI,UAAUR,EAAO,cAAc,GACnC,EAAI,wBAAwBA,EAAO,uBACnC,EAAI,YAAY,CACdE,EAAsB,UAAU,KAAKA,CAAqB,GAC1DE,EAAW,UAAU,KAAKA,CAAU,CACtC,GACA,EAAI,sBAAsB,CACxBA,EAAW,oBAAoB,KAAKA,CAAU,GAC9CP,EAAU,QAAQY,CAAqB,CAAC,CAAC,oBAAoB,KAAKZ,EAAU,QAAQY,CAAqB,CAAC,CAC5G,GACA,EAAI,qBAAqB,CACvBL,EAAW,mBAAmB,KAAKA,CAAU,GAC7CF,EAAsB,mBAAmB,KAAKA,CAAqB,CACrE;CAEA,IAAMQ,IAAqBb,EAAU,QAAQH,CAAkB,GACzDiB,IAAed,EAAU,QAAQe,CAAmB,CAAC,CAAC;CAE5D,OACE,kBAACnB,GAAD;EAAqB,QAAQiB,EAAmB;EAC9C,UAAA,kBAACG,GAAD;GAAe,OAAOF;GACpB,UAAA,kBAACG,GAAD;IAAe,OAAOd,EAAO;IAA7B,UAAA,CACE,kBAACe,GAAD,CAAc,CAAA,GACd,kBAACC,GAAD;KAAe,mBAAmBC;KAChC,UAAA,kBAACC,GAAD,EAAA,UACE,kBAACvB,GAAD,CAAoB,CAAA,EACoB,CAAA;IAC7B,CAAA,CACF;;EACF,CAAA;CACI,CAAA;AAEzB"}
@@ -1,75 +1,75 @@
1
1
  import { t as e } from "../../../_chunks/OutageUtil.js";
2
- import { t } from "../../../_chunks/QueryClientService.js";
3
- import { t as n } from "../../../_chunks/useQueryMemo.js";
4
- import { t as r } from "../../../_chunks/react.js";
5
- import { outagesStore as i } from "../../../stores/outagesStore/index.js";
6
- import { API_SYSTEM_TOKEN as a } from "../../../constants/api.constants.js";
7
- import { PageContainer as o } from "../../ui/PageContainer/index.js";
8
- import { ResponseHandler as s } from "../../ui/ResponseHandler/index.js";
2
+ import { t } from "../../../_chunks/react.js";
3
+ import { outagesStore as n } from "../../../stores/outagesStore/index.js";
4
+ import { API_SYSTEM_TOKEN as r } from "../../../constants/api.constants.js";
5
+ import { PageContainer as i } from "../../ui/PageContainer/index.js";
6
+ import { ResponseHandler as a } from "../../ui/ResponseHandler/index.js";
7
+ import { t as o } from "../../../_chunks/useQueryMemo.js";
8
+ import { t as s } from "../../../_chunks/QueryClientService.js";
9
9
  import { COMMON_QUERY_KEY as c } from "../../../constants/query.constants.js";
10
10
  import { t as l } from "../../../_chunks/OutageList.js";
11
11
  import "../../ui/OutageList/index.js";
12
- import { WindowService as u } from "@gen-epix/ui-core/classes/services/WindowService";
13
- import { container as d } from "tsyringe";
14
- import { useCallback as f, useEffect as p, useMemo as m, useState as h } from "react";
15
- import { jsx as g, jsxs as _ } from "react/jsx-runtime";
16
- import { Box as v, Button as y } from "@mui/material";
12
+ import { container as u } from "tsyringe";
13
+ import { WindowService as d } from "@gen-epix/ui-core/classes/services/WindowService";
14
+ import { Box as f, Button as p } from "@mui/material";
15
+ import { useCallback as m, useEffect as h, useMemo as g, useState as _ } from "react";
16
+ import { jsx as v, jsxs as y } from "react/jsx-runtime";
17
17
  import { useTranslation as b } from "react-i18next";
18
18
  import { TestIdUtil as x } from "@gen-epix/ui-core/utils/TestIdUtil";
19
19
  import { useArray as S } from "@gen-epix/ui-core/hooks/useArray";
20
20
  //#region src/components/app/ApplicationBootstrapWithAuthentication/ApplicationBootstrapWithAuthentication.tsx
21
21
  var C = ({ children: C }) => {
22
- let { t: w } = b(), T = r(i, (e) => e.setCategorizedOutages), [E, D] = h(!1), [O, k] = h(!1), A = n({
22
+ let { t: w } = b(), T = t(n, (e) => e.setCategorizedOutages), [E, D] = _(!1), [O, k] = _(!1), A = o({
23
23
  gcTime: Infinity,
24
- queryFn: async ({ signal: e }) => (await d.resolve(a).retrieveOutages({ signal: e })).data,
25
- queryKey: d.resolve(t).getGenericKey(c.OUTAGES),
24
+ queryFn: async ({ signal: e }) => (await u.resolve(r).retrieveOutages({ signal: e })).data,
25
+ queryKey: u.resolve(s).getGenericKey(c.OUTAGES),
26
26
  refetchInterval: 3e5,
27
27
  staleTime: Infinity
28
- }), j = S([A]), M = m(() => e.getCategorizedOutages(A.data ?? []), [A.data]), N = f(() => {
29
- u.getInstance().window.location.reload();
30
- }, []), P = f(() => {
28
+ }), j = S([A]), M = g(() => e.getCategorizedOutages(A.data ?? []), [A.data]), N = m(() => {
29
+ u.resolve(d).window.location.reload();
30
+ }, []), P = m(() => {
31
31
  D(!0);
32
32
  }, []);
33
- return p(() => {
33
+ return h(() => {
34
34
  M && T(M);
35
- let e = u.getInstance().window.setTimeout(() => {
35
+ let e = u.resolve(d), t = e.window.setTimeout(() => {
36
36
  k(!0);
37
37
  }, 5e3);
38
38
  return () => {
39
- u.getInstance().window.clearTimeout(e);
39
+ e.window.clearTimeout(t);
40
40
  };
41
- }, [M, T]), !E && !A.isLoading && !A.error && M.activeOutages?.length > 0 ? /* @__PURE__ */ _(o, {
41
+ }, [M, T]), !E && !A.isLoading && !A.error && M.activeOutages?.length > 0 ? /* @__PURE__ */ y(i, {
42
42
  singleAction: !0,
43
43
  testIdAttributes: x.createAttributes("OutagePage"),
44
44
  title: w`Outages`,
45
- children: [/* @__PURE__ */ g(l, {
45
+ children: [/* @__PURE__ */ v(l, {
46
46
  activeOutages: M.activeOutages,
47
47
  soonActiveOutages: M.soonActiveOutages,
48
48
  visibleOutages: M.visibleOutages
49
- }), /* @__PURE__ */ _(v, {
49
+ }), /* @__PURE__ */ y(f, {
50
50
  sx: {
51
51
  display: "flex",
52
52
  gap: 1,
53
53
  justifyContent: "flex-end"
54
54
  },
55
- children: [/* @__PURE__ */ g(y, {
55
+ children: [/* @__PURE__ */ v(p, {
56
56
  disabled: !O,
57
57
  onClick: P,
58
58
  variant: "outlined",
59
59
  children: w`Continue anyway`
60
- }), /* @__PURE__ */ g(y, {
60
+ }), /* @__PURE__ */ v(p, {
61
61
  disabled: !O,
62
62
  onClick: N,
63
63
  variant: "contained",
64
64
  children: w`Retry`
65
65
  })]
66
66
  })]
67
- }) : A.error || A.isLoading ? /* @__PURE__ */ g(o, {
67
+ }) : A.error || A.isLoading ? /* @__PURE__ */ v(i, {
68
68
  ignorePageEvent: !0,
69
69
  singleAction: !0,
70
70
  testIdAttributes: x.createAttributes("OutagesLoadingPage"),
71
71
  title: w`Outages`,
72
- children: /* @__PURE__ */ g(s, {
72
+ children: /* @__PURE__ */ v(a, {
73
73
  loadables: j,
74
74
  loadingMessage: w`Loading`,
75
75
  children: C