@gen-epix/ui-client-common 4.6.1 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/_chunks/Breadcrumbs.js +4 -4
- package/dist/_chunks/CrudPage.js +233 -232
- package/dist/_chunks/CrudPage.js.map +1 -1
- package/dist/_chunks/GeoFilter.js +1 -0
- package/dist/_chunks/GeoFilter.js.map +1 -1
- package/dist/_chunks/Notifications.js +16 -16
- package/dist/_chunks/QueryClientProvider.js +1 -1
- package/dist/_chunks/QueryClientProvider.js.map +1 -1
- package/dist/_chunks/QueryClientService.js +73 -72
- package/dist/_chunks/QueryClientService.js.map +1 -1
- package/dist/_chunks/Table.js +1314 -887
- package/dist/_chunks/Table.js.map +1 -1
- package/dist/_chunks/TableUtil.js +5126 -178
- package/dist/_chunks/TableUtil.js.map +1 -1
- package/dist/_chunks/TextFilter.js +10 -6
- package/dist/_chunks/TextFilter.js.map +1 -1
- package/dist/_chunks/UserInvitationsAdminPage.js +131 -131
- package/dist/_chunks/UserInvitationsAdminPage.js.map +1 -1
- package/dist/_chunks/_baseFlatten.js +12 -12
- package/dist/_chunks/_baseFlatten.js.map +1 -1
- package/dist/_chunks/_baseIteratee.js +78 -78
- package/dist/_chunks/_baseIteratee.js.map +1 -1
- package/dist/_chunks/decorate.js +1 -1
- package/dist/_chunks/decorateParam.js +1 -1
- package/dist/_chunks/middleware.js +66 -70
- package/dist/_chunks/middleware.js.map +1 -1
- package/dist/_chunks/omit.js +98 -98
- package/dist/_chunks/omit.js.map +1 -1
- package/dist/_chunks/query.js +123 -107
- package/dist/_chunks/query.js.map +1 -1
- package/dist/_chunks/react.js +1 -1
- package/dist/_chunks/react.js.map +1 -1
- package/dist/_chunks/tableStore.js +298 -275
- package/dist/_chunks/tableStore.js.map +1 -1
- package/dist/_chunks/useMutation.js +2 -2
- package/dist/_chunks/useMutation.js.map +1 -1
- package/dist/_chunks/useQueryMemo.js +15 -16
- package/dist/_chunks/useQueryMemo.js.map +1 -1
- package/dist/_chunks/vanilla.js +1 -1
- package/dist/_chunks/vanilla.js.map +1 -1
- package/dist/_chunks/yup.js +2 -2
- package/dist/_chunks/yup.js.map +1 -1
- package/dist/classes/abstracts/FilterAbstract/FilterAbstract.d.ts +11 -0
- package/dist/classes/abstracts/FilterAbstract/index.js +48 -3
- package/dist/classes/abstracts/FilterAbstract/index.js.map +1 -1
- package/dist/classes/filters/BooleanFilter.d.ts +1 -0
- package/dist/classes/filters/DateFilter.d.ts +1 -1
- package/dist/classes/filters/GeoFilter.d.ts +1 -0
- package/dist/classes/filters/MultiSelectFilter.d.ts +1 -0
- package/dist/classes/filters/NumberRangeFilter.d.ts +1 -0
- package/dist/classes/filters/TextFilter.d.ts +1 -0
- package/dist/classes/services/AuthenticationService/index.js +8 -8
- package/dist/classes/services/AuthenticationService/index.js.map +1 -1
- package/dist/classes/services/AuthorizationService/index.js +4 -4
- package/dist/classes/services/AuthorizationService/index.js.map +1 -1
- package/dist/classes/services/BreadcrumbService/index.js +4 -4
- package/dist/classes/services/BreadcrumbService/index.js.map +1 -1
- package/dist/classes/services/EmotionCacheService/index.js.map +1 -1
- package/dist/classes/services/InactivityService/index.js +30 -30
- package/dist/classes/services/InactivityService/index.js.map +1 -1
- package/dist/classes/services/LogService/index.js +15 -15
- package/dist/classes/services/LogService/index.js.map +1 -1
- package/dist/classes/services/PageEventBusService/index.js.map +1 -1
- package/dist/components/app/App/index.js +27 -24
- package/dist/components/app/App/index.js.map +1 -1
- package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js +18 -18
- package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js.map +1 -1
- package/dist/components/app/ApplicationBootstrapWithoutAuthorization/index.js +18 -18
- package/dist/components/app/ApplicationBootstrapWithoutAuthorization/index.js.map +1 -1
- package/dist/components/app/AuthenticationWrapper/index.js +15 -15
- package/dist/components/app/AuthorizationWrapper/index.js +16 -16
- package/dist/components/app/AuthorizationWrapper/index.js.map +1 -1
- package/dist/components/app/RouterRoot/index.js +33 -33
- package/dist/components/app/RouterRoot/index.js.map +1 -1
- package/dist/components/epi/EpiContactDetailsDialog/index.js +4 -4
- package/dist/components/epi/EpiContactDetailsDialog/index.js.map +1 -1
- package/dist/components/ui/ApplicationBar/index.js +234 -234
- package/dist/components/ui/ApplicationBar/index.js.map +1 -1
- package/dist/components/ui/GenericErrorMessage/index.js +13 -13
- package/dist/components/ui/LicensesDialog/index.js +6 -6
- package/dist/components/ui/OrganizationSwitcherDialog/index.js +11 -11
- package/dist/components/ui/OutagesDialog/index.js +4 -4
- package/dist/components/ui/OutagesDialog/index.js.map +1 -1
- package/dist/components/ui/PageContainer/index.js +5 -5
- package/dist/components/ui/PageContainer/index.js.map +1 -1
- package/dist/components/ui/ResponseHandler/index.js +4 -4
- package/dist/components/ui/SortableList/SortableList.d.ts +5 -3
- package/dist/components/ui/Table/Table.d.ts +5 -2
- package/dist/components/ui/Table/TableColumnsEditorDialog.d.ts +13 -2
- package/dist/components/ui/Table/TableDownloadSidebarItem.d.ts +10 -0
- package/dist/components/ui/Table/TableSidebarMenu.d.ts +2 -1
- package/dist/components/ui/Table/index.d.ts +2 -0
- package/dist/components/ui/Table/index.js +1 -1
- package/dist/components/ui/Table/useTableColumnsMenu.d.ts +6 -0
- package/dist/components/ui/UserFeedbackDialog/index.js +15 -15
- package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/index.js +12 -12
- package/dist/dataHooks/useIdentifierIssuerQuery/index.js +11 -11
- package/dist/dataHooks/useInviteUserConstraintsQuery/index.js +5 -5
- package/dist/dataHooks/useInviteUserConstraintsQuery/index.js.map +1 -1
- package/dist/dataHooks/useOrganizationAdminPoliciesQuery/index.js +15 -15
- package/dist/dataHooks/useOrganizationsQuery/index.js +7 -7
- package/dist/dataHooks/useUsersQuery/index.js +10 -10
- package/dist/hooks/useCreateMutation/index.js +14 -14
- package/dist/hooks/useCreateMutation/index.js.map +1 -1
- package/dist/hooks/useDeleteMutation/index.js +17 -17
- package/dist/hooks/useDeleteMutation/index.js.map +1 -1
- package/dist/hooks/useEditMutation/index.js +22 -22
- package/dist/hooks/useEditMutation/index.js.map +1 -1
- package/dist/hooks/useInitializeTableStore/index.js +6 -6
- package/dist/hooks/useInitializeTableStore/index.js.map +1 -1
- package/dist/locale/en.json +27 -5
- package/dist/locale/nl.json +27 -5
- package/dist/models/table.models.d.ts +1 -0
- package/dist/models/table.models.js.map +1 -1
- package/dist/pages/AcceptInvitationPage/index.js +10 -10
- package/dist/pages/AdminPage/index.js +19 -19
- package/dist/pages/ChooseIdentityProviderPage/index.js +5 -5
- package/dist/pages/ErrorPage/index.js +4 -4
- package/dist/pages/IdentifierIssuersAdminPage/index.js +7 -7
- package/dist/pages/IdentifierIssuersAdminPage/index.js.map +1 -1
- package/dist/pages/OrganizationAdminPoliciesAdminPage/index.js +16 -16
- package/dist/pages/OrganizationContactsAdminPage/index.js +10 -10
- package/dist/pages/OrganizationContactsAdminPage/index.js.map +1 -1
- package/dist/pages/OrganizationSitesAdminPage/index.js +12 -12
- package/dist/pages/OrganizationSitesAdminPage/index.js.map +1 -1
- package/dist/pages/OrganizationsAdminPage/index.js +20 -20
- package/dist/pages/OrganizationsAdminPage/index.js.map +1 -1
- package/dist/pages/OutagesAdminPage/index.js +11 -11
- package/dist/pages/OutagesAdminPage/index.js.map +1 -1
- package/dist/pages/RouterErrorPage/index.js +4 -4
- package/dist/pages/UsersAdminPage/index.js +34 -34
- package/dist/pages/UsersAdminPage/index.js.map +1 -1
- package/dist/setup/setup.js +4 -4
- package/dist/setup/setup.js.map +1 -1
- package/dist/stores/oidcStore/oidcStore.d.ts +1 -1
- package/dist/stores/tableStore/tableStore.d.ts +3 -1
- package/dist/utils/StandardConfigUtil/index.js +2 -2
- package/dist/utils/StandardConfigUtil/index.js.map +1 -1
- package/dist/utils/TableUtil/TableUtil.d.ts +5 -0
- package/package.json +35 -37
- package/dist/_chunks/useColumnsMenu.js +0 -157
- package/dist/_chunks/useColumnsMenu.js.map +0 -1
- package/dist/hooks/useColumnsMenu/index.d.ts +0 -1
- package/dist/hooks/useColumnsMenu/index.js +0 -1
- package/dist/hooks/useColumnsMenu/useColumnsMenu.d.ts +0 -6
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as i } from "../../../_chunks/
|
|
6
|
-
import {
|
|
1
|
+
import { API_SYSTEM_TOKEN as e } from "../../../constants/api.constants.js";
|
|
2
|
+
import { AuthenticationService as t } from "../AuthenticationService/index.js";
|
|
3
|
+
import { AxiosUtil as n } from "../../../utils/AxiosUtil/index.js";
|
|
4
|
+
import { CONFIG_TOKEN as r } from "../../../constants/config.constants.js";
|
|
5
|
+
import { t as i } from "../../../_chunks/decorateParam.js";
|
|
6
|
+
import { t as a } from "../../../_chunks/decorate.js";
|
|
7
7
|
import { inject as o, singleton as s } from "tsyringe";
|
|
8
8
|
import { StringUtil as c } from "@gen-epix/ui-core/utils/StringUtil";
|
|
9
9
|
import { CommonDbLogLevel as l } from "@gen-epix/api-commondb";
|
|
@@ -64,13 +64,13 @@ var d = class {
|
|
|
64
64
|
}
|
|
65
65
|
onResponseRejected(e) {
|
|
66
66
|
if (u(e)) {
|
|
67
|
-
let
|
|
68
|
-
if (
|
|
69
|
-
typeof
|
|
67
|
+
let t = e.config?.headers.get("X-REQUEST-ID");
|
|
68
|
+
if (n.isAxiosCanceledError(e)) {
|
|
69
|
+
typeof t == "string" && this.requestMap.delete(t);
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
|
-
let r = typeof
|
|
73
|
-
typeof
|
|
72
|
+
let r = typeof t == "string" ? this.requestMap.get(t) : void 0, i = r === void 0 ? void 0 : Date.now() - r;
|
|
73
|
+
typeof t == "string" && this.requestMap.delete(t), this.log([{
|
|
74
74
|
detail: {
|
|
75
75
|
requestParams: e.config?.params,
|
|
76
76
|
responseData: e.response?.data,
|
|
@@ -93,11 +93,11 @@ var d = class {
|
|
|
93
93
|
}), this.logItems = []));
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
|
-
d =
|
|
96
|
+
d = a([
|
|
97
97
|
s(),
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
i(0, o(r)),
|
|
99
|
+
i(1, o(t)),
|
|
100
|
+
i(2, o(e))
|
|
101
101
|
], d);
|
|
102
102
|
export { d as LogService };
|
|
103
103
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["_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":";;;;;;;;;;;AA8BO,IAAMG,IAAN,MAAiB;CACtB;CAEA;CACA;CACA,WAA8C,CAAC;CAC/C;CAEA,YACE,GACA,GACA,GACA;EAKA,AAJA,KAAK,6BAAa,IAAI,IAAoB,GAC1C,KAAK,SAASC,GACd,KAAK,wBAAwBC,GAC7B,KAAK,YAAYC,GACjB,kBAAkB;GAChB,KAAK,QAAQ;EACf,GAAGF,EAAO,IAAI,eAAe;CAC/B;CAGA,WAAwB;EACtB,KAAK,QAAQ;CACf;CAEA,IAAW,GAA+B;EACxC,IAAMG,qBAAY,IAAI,KAAK,EAAA,CAAE,YAAY,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AAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["_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,IAAME,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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,IAAIG,GACF,OAAOA;EAEX;EACA,OAAO;CACT;AACF;;CA5FCC,EAAU;CAMNtB,EAAA,GAAAwB,EAAOC,CAAY,CAAA;CACnBzB,EAAA,GAAAwB,EAAOE,CAAa,CAAA"}
|
|
@@ -1,41 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
1
|
+
import { t as e } from "../../../_chunks/QueryClientProvider.js";
|
|
2
|
+
import { API_BASE_TOKEN as t } from "../../../constants/api.constants.js";
|
|
3
|
+
import { BackendVersionService as n } from "../../../classes/services/BackendVersionService/index.js";
|
|
4
|
+
import { t as r } from "../../../_chunks/QueryClientService.js";
|
|
5
|
+
import { ErrorPage as i } from "../../../pages/ErrorPage/index.js";
|
|
6
|
+
import { EmotionCacheService as a } from "../../../classes/services/EmotionCacheService/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 { ApplicationBootstrapWithoutAuthorization as c } from "../ApplicationBootstrapWithoutAuthorization/index.js";
|
|
10
|
+
import { RouterService as l } from "../../../classes/services/RouterService/index.js";
|
|
11
|
+
import { useConfig as u } from "../../../hooks/useConfig/index.js";
|
|
12
12
|
import { container as d } from "tsyringe";
|
|
13
13
|
import { CssBaseline as f, ThemeProvider as p } from "@mui/material";
|
|
14
14
|
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
15
15
|
import { RouterProvider as g } from "react-router-dom";
|
|
16
16
|
import { CacheProvider as _ } from "@emotion/react";
|
|
17
17
|
import { ErrorBoundary as v } from "react-error-boundary";
|
|
18
|
+
import { useOsxScrollbarAlwaysVisible as y } from "@gen-epix/ui-core/hooks/useOsxScrollbarAlwaysVisible";
|
|
18
19
|
// src/components/app/AppRouterProvider/AppRouterProvider.tsx
|
|
19
|
-
var
|
|
20
|
-
let
|
|
21
|
-
|
|
22
|
-
let
|
|
23
|
-
S
|
|
24
|
-
let C = d.resolve(
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
var b = () => /* @__PURE__ */ m(g, { router: d.resolve(l).router }), x = () => {
|
|
21
|
+
let l = u();
|
|
22
|
+
y(l.nonce);
|
|
23
|
+
let g = d.resolve(o), x = d.resolve(s), S = l.getTouchIconUrl();
|
|
24
|
+
S && document.querySelector("link[rel=\"icon\"]")?.setAttribute("href", S);
|
|
25
|
+
let C = d.resolve(t);
|
|
26
|
+
C.baseUrl = l.getAPIBaseUrl(), C.defaultRequestTimeout = l.defaultRequestTimeout, C.onRequest = [g.onRequest.bind(g), x.onRequest.bind(x)], C.onResponseFulfilled = [x.onResponseFulfilled.bind(x), d.resolve(n).onResponseFulfilled.bind(d.resolve(n))], C.onResponseRejected = [x.onResponseRejected.bind(x), g.onResponseRejected.bind(g)];
|
|
27
|
+
let w = d.resolve(r), T = d.resolve(a).emotionCache;
|
|
28
|
+
return /* @__PURE__ */ m(e, {
|
|
29
|
+
client: w.queryClient,
|
|
27
30
|
children: /* @__PURE__ */ m(_, {
|
|
28
|
-
value:
|
|
31
|
+
value: T,
|
|
29
32
|
children: /* @__PURE__ */ h(p, {
|
|
30
|
-
theme:
|
|
33
|
+
theme: l.theme,
|
|
31
34
|
children: [/* @__PURE__ */ m(f, {}), /* @__PURE__ */ m(v, {
|
|
32
|
-
FallbackComponent:
|
|
33
|
-
children: /* @__PURE__ */ m(
|
|
35
|
+
FallbackComponent: i,
|
|
36
|
+
children: /* @__PURE__ */ m(c, { children: /* @__PURE__ */ m(b, {}) })
|
|
34
37
|
})]
|
|
35
38
|
})
|
|
36
39
|
})
|
|
37
40
|
});
|
|
38
41
|
};
|
|
39
|
-
export {
|
|
42
|
+
export { x as App };
|
|
40
43
|
|
|
41
44
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
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":"
|
|
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';\nimport { useOsxScrollbarAlwaysVisible } from '@gen-epix/ui-core/hooks/useOsxScrollbarAlwaysVisible';\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 useOsxScrollbarAlwaysVisible(config.nonce);\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,GCqB5FC,UAAY;CACvB,IAAMC,IAASC,EAAU;CACzB,EAA6BD,EAAO,KAAK;CAEzC,IAAME,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,14 +1,14 @@
|
|
|
1
|
-
import { t as e } from "../../../_chunks/
|
|
2
|
-
import { t } from "../../../
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { t as o } from "../../../_chunks/useQueryMemo.js";
|
|
8
|
-
import { t as s } from "../../../_chunks/QueryClientService.js";
|
|
9
|
-
import { COMMON_QUERY_KEY as c } from "../../../constants/query.constants.js";
|
|
10
|
-
import { t as l } from "../../../_chunks/OutageList.js";
|
|
1
|
+
import { t as e } from "../../../_chunks/react.js";
|
|
2
|
+
import { API_SYSTEM_TOKEN as t } from "../../../constants/api.constants.js";
|
|
3
|
+
import { t as n } from "../../../_chunks/useQueryMemo.js";
|
|
4
|
+
import { outagesStore as r } from "../../../stores/outagesStore/index.js";
|
|
5
|
+
import { t as i } from "../../../_chunks/OutageUtil.js";
|
|
6
|
+
import { t as a } from "../../../_chunks/QueryClientService.js";
|
|
11
7
|
import "../../ui/OutageList/index.js";
|
|
8
|
+
import { PageContainer as o } from "../../ui/PageContainer/index.js";
|
|
9
|
+
import { ResponseHandler as s } from "../../ui/ResponseHandler/index.js";
|
|
10
|
+
import { t as c } from "../../../_chunks/OutageList.js";
|
|
11
|
+
import { COMMON_QUERY_KEY as l } from "../../../constants/query.constants.js";
|
|
12
12
|
import { container as u } from "tsyringe";
|
|
13
13
|
import { WindowService as d } from "@gen-epix/ui-core/classes/services/WindowService";
|
|
14
14
|
import { Box as f, Button as p } from "@mui/material";
|
|
@@ -19,13 +19,13 @@ 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
|
// src/components/app/ApplicationBootstrapWithAuthentication/ApplicationBootstrapWithAuthentication.tsx
|
|
21
21
|
var C = ({ children: C }) => {
|
|
22
|
-
let { t: w } = b(), T =
|
|
22
|
+
let { t: w } = b(), T = e(r, (e) => e.setCategorizedOutages), [E, D] = _(!1), [O, k] = _(!1), A = n({
|
|
23
23
|
gcTime: Infinity,
|
|
24
|
-
queryFn: async ({ signal: e }) => (await u.resolve(
|
|
25
|
-
queryKey: u.resolve(
|
|
24
|
+
queryFn: async ({ signal: e }) => (await u.resolve(t).retrieveOutages({ signal: e })).data,
|
|
25
|
+
queryKey: u.resolve(a).getGenericKey(l.OUTAGES),
|
|
26
26
|
refetchInterval: 3e5,
|
|
27
27
|
staleTime: Infinity
|
|
28
|
-
}), j = S([A]), M = g(() =>
|
|
28
|
+
}), j = S([A]), M = g(() => i.getCategorizedOutages(A.data ?? []), [A.data]), N = m(() => {
|
|
29
29
|
u.resolve(d).window.location.reload();
|
|
30
30
|
}, []), P = m(() => {
|
|
31
31
|
D(!0);
|
|
@@ -38,11 +38,11 @@ var C = ({ children: C }) => {
|
|
|
38
38
|
return () => {
|
|
39
39
|
e.window.clearTimeout(t);
|
|
40
40
|
};
|
|
41
|
-
}, [M, T]), !E && !A.isLoading && !A.error && M.activeOutages?.length > 0 ? /* @__PURE__ */ y(
|
|
41
|
+
}, [M, T]), !E && !A.isLoading && !A.error && M.activeOutages?.length > 0 ? /* @__PURE__ */ y(o, {
|
|
42
42
|
singleAction: !0,
|
|
43
43
|
testIdAttributes: x.createAttributes("OutagePage"),
|
|
44
44
|
title: w`Outages`,
|
|
45
|
-
children: [/* @__PURE__ */ v(
|
|
45
|
+
children: [/* @__PURE__ */ v(c, {
|
|
46
46
|
activeOutages: M.activeOutages,
|
|
47
47
|
soonActiveOutages: M.soonActiveOutages,
|
|
48
48
|
visibleOutages: M.visibleOutages
|
|
@@ -64,12 +64,12 @@ var C = ({ children: C }) => {
|
|
|
64
64
|
children: w`Retry`
|
|
65
65
|
})]
|
|
66
66
|
})]
|
|
67
|
-
}) : A.error || A.isLoading ? /* @__PURE__ */ v(
|
|
67
|
+
}) : A.error || A.isLoading ? /* @__PURE__ */ v(o, {
|
|
68
68
|
ignorePageEvent: !0,
|
|
69
69
|
singleAction: !0,
|
|
70
70
|
testIdAttributes: x.createAttributes("OutagesLoadingPage"),
|
|
71
71
|
title: w`Outages`,
|
|
72
|
-
children: /* @__PURE__ */ v(
|
|
72
|
+
children: /* @__PURE__ */ v(s, {
|
|
73
73
|
loadables: j,
|
|
74
74
|
loadingMessage: w`Loading`,
|
|
75
75
|
children: C
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["useStore","useQueryMemo","OutageUtil","QueryClientService","OutageList","ApplicationBootstrapWithAuthentication","useTranslation","setCategorizedOutages","outagesStore","state","shouldContinue","setShouldContinue","useState","buttonsEnabled","setButtonsEnabled","outagesQuery","container","API_SYSTEM_TOKEN","COMMON_QUERY_KEY","outagesLoadables","useArray","categorizedOutages","useMemo","onRetryButtonClick","useCallback","WindowService","onContinuButtonClick","useEffect","windowService","timeout","PageContainer","TestIdUtil","Box","Button","ResponseHandler","children"],"sources":["../../../../src/components/app/ApplicationBootstrapWithAuthentication/ApplicationBootstrapWithAuthentication.tsx"],"sourcesContent":["import { container } from 'tsyringe';\nimport {\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport type {\n PropsWithChildren,\n ReactNode,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useStore } from 'zustand';\nimport {\n Box,\n Button,\n} from '@mui/material';\nimport { TestIdUtil } from '@gen-epix/ui-core/utils/TestIdUtil';\nimport { useArray } from '@gen-epix/ui-core/hooks/useArray';\nimport { WindowService } from '@gen-epix/ui-core/classes/services/WindowService';\n\nimport { API_SYSTEM_TOKEN } from '../../../constants/api.constants';\nimport { useQueryMemo } from '../../../hooks/useQueryMemo';\nimport { outagesStore } from '../../../stores/outagesStore';\nimport { OutageUtil } from '../../../utils/OutageUtil';\nimport { QueryClientService } from '../../../classes/services/QueryClientService';\nimport { OutageList } from '../../ui/OutageList';\nimport { PageContainer } from '../../ui/PageContainer';\nimport { ResponseHandler } from '../../ui/ResponseHandler';\nimport { COMMON_QUERY_KEY } from '../../../constants/query.constants';\n\n\nexport const ApplicationBootstrapWithAuthentication = ({ children }: PropsWithChildren): ReactNode => {\n const { t } = useTranslation();\n\n const setCategorizedOutages = useStore(outagesStore, (state) => state.setCategorizedOutages);\n const [shouldContinue, setShouldContinue] = useState(false);\n const [buttonsEnabled, setButtonsEnabled] = useState(false);\n\n const outagesQuery = useQueryMemo({\n gcTime: Infinity,\n queryFn: async ({ signal }) => (await container.resolve(API_SYSTEM_TOKEN).retrieveOutages({ signal })).data,\n queryKey: container.resolve(QueryClientService).getGenericKey(COMMON_QUERY_KEY.OUTAGES),\n refetchInterval: 5 * 60 * 1000,\n staleTime: Infinity,\n });\n\n const outagesLoadables = useArray([outagesQuery]);\n\n const categorizedOutages = useMemo(() => {\n return OutageUtil.getCategorizedOutages(outagesQuery.data ?? []);\n }, [outagesQuery.data]);\n\n const onRetryButtonClick = useCallback(() => {\n container.resolve(WindowService).window.location.reload();\n }, []);\n\n const onContinuButtonClick = useCallback(() => {\n setShouldContinue(true);\n }, []);\n\n useEffect(() => {\n if (categorizedOutages) {\n setCategorizedOutages(categorizedOutages);\n }\n\n const windowService = container.resolve(WindowService);\n const timeout = windowService.window.setTimeout(() => {\n setButtonsEnabled(true);\n }, 5000);\n\n return () => {\n windowService.window.clearTimeout(timeout);\n };\n }, [categorizedOutages, setCategorizedOutages]);\n\n const shouldShowOutagePage = !shouldContinue && !outagesQuery.isLoading && !outagesQuery.error && categorizedOutages.activeOutages?.length > 0;\n\n if (shouldShowOutagePage) {\n return (\n <PageContainer\n singleAction\n testIdAttributes={TestIdUtil.createAttributes('OutagePage')}\n title={t`Outages`}\n >\n <OutageList\n activeOutages={categorizedOutages.activeOutages}\n soonActiveOutages={categorizedOutages.soonActiveOutages}\n visibleOutages={categorizedOutages.visibleOutages}\n />\n <Box\n sx={{\n display: 'flex',\n gap: 1,\n justifyContent: 'flex-end',\n }}\n >\n <Button\n disabled={!buttonsEnabled}\n onClick={onContinuButtonClick}\n variant={'outlined'}\n >\n {t`Continue anyway`}\n </Button>\n <Button\n disabled={!buttonsEnabled}\n onClick={onRetryButtonClick}\n variant={'contained'}\n >\n {t`Retry`}\n </Button>\n </Box>\n </PageContainer>\n );\n }\n if (outagesQuery.error || outagesQuery.isLoading) {\n return (\n <PageContainer\n ignorePageEvent\n singleAction\n testIdAttributes={TestIdUtil.createAttributes('OutagesLoadingPage')}\n title={t`Outages`}\n >\n <ResponseHandler\n loadables={outagesLoadables}\n loadingMessage={t`Loading`}\n >\n {children}\n </ResponseHandler>\n </PageContainer>\n );\n\n }\n\n return children;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgCA,IAAaK,KAA0C,EAAE,kBAA6C;CACpG,IAAM,EAAE,SAAMC,EAAe,GAEvBC,IAAwBP,EAASQ,IAAe,MAAUC,EAAM,qBAAqB,GACrF,CAACC,GAAgBC,KAAqBC,EAAS,EAAK,GACpD,CAACC,GAAgBC,KAAqBF,EAAS,EAAK,GAEpDG,IAAed,EAAa;EAChC,QAAQ;EACR,SAAS,OAAO,EAAE,iBAAc,MAAMe,EAAU,QAAQC,CAAgB,CAAC,CAAC,gBAAgB,EAAE,UAAO,CAAC,EAAA,CAAG;EACvG,UAAUD,EAAU,QAAQb,CAAkB,CAAC,CAAC,cAAce,EAAiB,OAAO;EACtF,iBAAiB;EACjB,WAAW;CACb,CAAC,GAEKC,IAAmBC,EAAS,CAACL,CAAY,CAAC,GAE1CM,IAAqBC,QAClBpB,EAAW,sBAAsBa,EAAa,QAAQ,CAAC,CAAC,GAC9D,CAACA,EAAa,IAAI,CAAC,GAEhBQ,IAAqBC,QAAkB;EAC3C,EAAU,QAAQC,CAAa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
|
|
4
|
-
import {
|
|
5
|
-
import { t as i } from "../../../_chunks/
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
1
|
+
import { API_SYSTEM_TOKEN as e } from "../../../constants/api.constants.js";
|
|
2
|
+
import { t } from "../../../_chunks/useQueryMemo.js";
|
|
3
|
+
import { FeatureFlagsService as n } from "../../../classes/services/FeatureFlagsService/index.js";
|
|
4
|
+
import { I18nService as r } from "../../../classes/services/I18nService/index.js";
|
|
5
|
+
import { t as i } from "../../../_chunks/QueryClientService.js";
|
|
6
|
+
import { PageContainer as a } from "../../ui/PageContainer/index.js";
|
|
7
|
+
import { ResponseHandler as o } from "../../ui/ResponseHandler/index.js";
|
|
8
|
+
import { COMMON_QUERY_KEY as s } from "../../../constants/query.constants.js";
|
|
9
|
+
import { LoadableUtil as c } from "../../../utils/LoadableUtil/index.js";
|
|
10
|
+
import { ErrorPage as l } from "../../../pages/ErrorPage/index.js";
|
|
11
11
|
import { container as u } from "tsyringe";
|
|
12
12
|
import { WindowService as d } from "@gen-epix/ui-core/classes/services/WindowService";
|
|
13
13
|
import { useCallback as f, useEffect as p, useRef as m, useState as h } from "react";
|
|
@@ -21,7 +21,7 @@ import { Confirmation as S } from "@gen-epix/ui-core-components/components/Confi
|
|
|
21
21
|
var C = ({ children: C }) => {
|
|
22
22
|
let { t: w } = v(), T = m(null), E = m(null), [D, O] = h(!1);
|
|
23
23
|
p(() => {
|
|
24
|
-
let e = u.resolve(
|
|
24
|
+
let e = u.resolve(r), t = (e) => {
|
|
25
25
|
E.current = e, T.current?.open();
|
|
26
26
|
};
|
|
27
27
|
return e.addEventListener("onUserLanguageChange", t), () => {
|
|
@@ -29,16 +29,16 @@ var C = ({ children: C }) => {
|
|
|
29
29
|
};
|
|
30
30
|
}, []);
|
|
31
31
|
let k = f(async () => {
|
|
32
|
-
E.current && (O(!0), await u.resolve(
|
|
33
|
-
}, []), A =
|
|
32
|
+
E.current && (O(!0), await u.resolve(r).switchLanguageConfig(E.current), u.resolve(d).window.location.reload());
|
|
33
|
+
}, []), A = t({
|
|
34
34
|
gcTime: Infinity,
|
|
35
|
-
queryFn: async ({ signal:
|
|
36
|
-
queryKey: u.resolve(
|
|
35
|
+
queryFn: async ({ signal: t }) => (await u.resolve(e).retrieveFeatureFlags({ signal: t })).data,
|
|
36
|
+
queryKey: u.resolve(i).getGenericKey(s.FEATURE_FLAGS),
|
|
37
37
|
staleTime: Infinity
|
|
38
38
|
});
|
|
39
|
-
A.data && (u.resolve(
|
|
39
|
+
A.data && (u.resolve(n).featureFlags = A.data.feature_flags);
|
|
40
40
|
let j = x([A]);
|
|
41
|
-
return
|
|
41
|
+
return c.hasSomeError(j) ? /* @__PURE__ */ g(l, { error: A.error }) : D ? /* @__PURE__ */ g(a, {
|
|
42
42
|
singleAction: !0,
|
|
43
43
|
testIdAttributes: y.createAttributes("LanguageChangingPage"),
|
|
44
44
|
title: w`Changing language`,
|
|
@@ -46,7 +46,7 @@ var C = ({ children: C }) => {
|
|
|
46
46
|
inline: !0,
|
|
47
47
|
label: w`Changing language...`
|
|
48
48
|
})
|
|
49
|
-
}) : /* @__PURE__ */ _(
|
|
49
|
+
}) : /* @__PURE__ */ _(o, {
|
|
50
50
|
loadables: j,
|
|
51
51
|
loadingMessage: w`Loading`,
|
|
52
52
|
children: [C, /* @__PURE__ */ g(S, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["QueryClientService","ApplicationBootstrapWithoutAuthorization","useTranslation","confirmationRef","useRef","newLanguageCodeRef","isLanguageChanging","setIsLanguageChanging","useState","i18nService","container","I18nService","callback","code","onLanguageChangeConfirm","useCallback","WindowService","featureFlagsQuery","useQueryMemo","API_SYSTEM_TOKEN","COMMON_QUERY_KEY","FeatureFlagsService","loadables","useArray","LoadableUtil","ErrorPage","PageContainer","TestIdUtil","Spinner","ResponseHandler","children","Confirmation"],"sources":["../../../../src/components/app/ApplicationBootstrapWithoutAuthorization/ApplicationBootstrapWithoutAuthorization.tsx"],"sourcesContent":["import { container } from 'tsyringe';\nimport {\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport type {\n PropsWithChildren,\n ReactNode,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { TestIdUtil } from '@gen-epix/ui-core/utils/TestIdUtil';\nimport { useArray } from '@gen-epix/ui-core/hooks/useArray';\nimport type { ConfirmationRefMethods } from '@gen-epix/ui-core-components/components/Confirmation';\nimport { Confirmation } from '@gen-epix/ui-core-components/components/Confirmation';\nimport { Spinner } from '@gen-epix/ui-core-components/components/Spinner';\nimport { WindowService } from '@gen-epix/ui-core/classes/services/WindowService';\n\nimport { API_SYSTEM_TOKEN } from '../../../constants/api.constants';\nimport { useQueryMemo } from '../../../hooks/useQueryMemo';\nimport { FeatureFlagsService } from '../../../classes/services/FeatureFlagsService';\nimport { I18nService } from '../../../classes/services/I18nService';\nimport { QueryClientService } from '../../../classes/services/QueryClientService';\nimport { PageContainer } from '../../ui/PageContainer';\nimport { ResponseHandler } from '../../ui/ResponseHandler';\nimport { COMMON_QUERY_KEY } from '../../../constants/query.constants';\nimport { LoadableUtil } from '../../../utils/LoadableUtil';\nimport { ErrorPage } from '../../../pages/ErrorPage';\n\n\nexport const ApplicationBootstrapWithoutAuthorization = ({ children }: PropsWithChildren): ReactNode => {\n const { t } = useTranslation();\n\n const confirmationRef = useRef<ConfirmationRefMethods>(null);\n const newLanguageCodeRef = useRef<string>(null);\n const [isLanguageChanging, setIsLanguageChanging] = useState(false);\n\n useEffect(() => {\n const i18nService = container.resolve(I18nService);\n const callback = (code: string) => {\n newLanguageCodeRef.current = code;\n confirmationRef.current?.open();\n };\n i18nService.addEventListener('onUserLanguageChange', callback);\n return () => {\n i18nService.removeEventListener('onUserLanguageChange', callback);\n };\n }, []);\n\n const onLanguageChangeConfirm = useCallback(async () => {\n if (newLanguageCodeRef.current) {\n setIsLanguageChanging(true);\n await container.resolve(I18nService).switchLanguageConfig(newLanguageCodeRef.current);\n container.resolve(WindowService).window.location.reload();\n }\n }, []);\n\n const featureFlagsQuery = useQueryMemo({\n gcTime: Infinity,\n queryFn: async ({ signal }) => (await container.resolve(API_SYSTEM_TOKEN).retrieveFeatureFlags({ signal })).data,\n queryKey: container.resolve(QueryClientService).getGenericKey(COMMON_QUERY_KEY.FEATURE_FLAGS),\n staleTime: Infinity,\n });\n\n if (featureFlagsQuery.data) {\n container.resolve(FeatureFlagsService).featureFlags = featureFlagsQuery.data.feature_flags;\n }\n\n const loadables = useArray([featureFlagsQuery]);\n\n if (LoadableUtil.hasSomeError(loadables)) {\n return (\n <ErrorPage error={featureFlagsQuery.error} />\n );\n }\n\n if (isLanguageChanging) {\n return (\n <PageContainer\n singleAction\n testIdAttributes={TestIdUtil.createAttributes('LanguageChangingPage')}\n title={t`Changing language`}\n >\n <Spinner\n inline\n label={t`Changing language...`}\n />\n </PageContainer>\n );\n }\n\n return (\n <ResponseHandler\n loadables={loadables}\n loadingMessage={t`Loading`}\n >\n {children}\n <Confirmation\n body={t`Changing language will reload the application. Do you want to continue?`}\n cancelLabel={t`Cancel`}\n confirmLabel={t`Change language`}\n maxWidth={'xs'}\n onConfirm={onLanguageChangeConfirm}\n ref={confirmationRef}\n title={t`Are you sure?`}\n />\n </ResponseHandler>\n );\n\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA+BA,IAAaC,KAA4C,EAAE,kBAA6C;CACtG,IAAM,EAAE,SAAMC,EAAe,GAEvBC,IAAkBC,EAA+B,IAAI,GACrDC,IAAqBD,EAAe,IAAI,GACxC,CAACE,GAAoBC,KAAyBC,EAAS,EAAK;CAElE,QAAgB;EACd,IAAMC,IAAcC,EAAU,QAAQC,CAAW,GAC3CC,KAAY,MAAiB;GAEjC,AADA,EAAmB,UAAUC,GAC7BV,EAAgB,SAAS,KAAK;EAChC;EAEA,OADAM,EAAY,iBAAiB,wBAA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5
|
-
import {
|
|
1
|
+
import { AuthenticationService as e } from "../../../classes/services/AuthenticationService/index.js";
|
|
2
|
+
import { LogService as t } from "../../../classes/services/LogService/index.js";
|
|
3
|
+
import { useConfig as n } from "../../../hooks/useConfig/index.js";
|
|
4
|
+
import { ConsentDialog as r } from "../../ui/ConsentDialog/index.js";
|
|
5
|
+
import { PageContainer as i } from "../../ui/PageContainer/index.js";
|
|
6
6
|
import { container as a } from "tsyringe";
|
|
7
7
|
import { WindowService as o } from "@gen-epix/ui-core/classes/services/WindowService";
|
|
8
8
|
import { CommonDbLogLevel as s } from "@gen-epix/api-commondb";
|
|
@@ -16,14 +16,14 @@ import { Spinner as S } from "@gen-epix/ui-core-components/components/Spinner";
|
|
|
16
16
|
import { useAuth as C } from "react-oidc-context";
|
|
17
17
|
// src/components/app/AuthenticationWrapper/AuthenticationWrapper.tsx
|
|
18
18
|
var w = ({ children: w }) => {
|
|
19
|
-
let { t: T } = y(), E = C(), D =
|
|
19
|
+
let { t: T } = y(), E = C(), D = n(), O = m(null), [k, A] = h(!D.consentDialog?.getShouldShow()), j = x(a.resolve(e)), M = D.login?.AfterLoginElement;
|
|
20
20
|
f(() => {
|
|
21
|
-
a.resolve(
|
|
21
|
+
a.resolve(e).authContextProps = E;
|
|
22
22
|
}, [E]), f(() => {
|
|
23
23
|
E.isAuthenticated && !k && O.current.open();
|
|
24
24
|
}, [E.isAuthenticated, k]);
|
|
25
25
|
let N = d(() => {
|
|
26
|
-
a.resolve(
|
|
26
|
+
a.resolve(t).log([{
|
|
27
27
|
level: s.INFO,
|
|
28
28
|
topic: "CONSENT"
|
|
29
29
|
}]), A(!0), O.current.close();
|
|
@@ -39,7 +39,7 @@ var w = ({ children: w }) => {
|
|
|
39
39
|
}, [E]), F = d(() => {
|
|
40
40
|
P();
|
|
41
41
|
}, [P]), I = d(() => {
|
|
42
|
-
|
|
42
|
+
e.clearStaleState(), a.resolve(e).next(void 0);
|
|
43
43
|
}, []), L = p(() => (/* @__PURE__ */ new Date()).getTime(), []), R = p(() => /* @__PURE__ */ v(g, { children: [
|
|
44
44
|
/* @__PURE__ */ _(c, {
|
|
45
45
|
sx: {
|
|
@@ -74,18 +74,18 @@ var w = ({ children: w }) => {
|
|
|
74
74
|
T,
|
|
75
75
|
M
|
|
76
76
|
]);
|
|
77
|
-
if (E.activeNavigator || E.isLoading) return /* @__PURE__ */ _(
|
|
77
|
+
if (E.activeNavigator || E.isLoading) return /* @__PURE__ */ _(i, {
|
|
78
78
|
ignorePageEvent: !0,
|
|
79
79
|
singleAction: !0,
|
|
80
80
|
testIdAttributes: b.createAttributes("RedirectingPage"),
|
|
81
81
|
title: T`Redirecting`,
|
|
82
82
|
children: /* @__PURE__ */ _(S, { label: T`Redirecting` })
|
|
83
83
|
});
|
|
84
|
-
if (E.error) return
|
|
84
|
+
if (E.error) return e.clearStaleState(), a.resolve(t).log([{
|
|
85
85
|
detail: { error: E.error },
|
|
86
86
|
level: s.ERROR,
|
|
87
87
|
topic: "Authentication Error"
|
|
88
|
-
}]), /* @__PURE__ */ v(
|
|
88
|
+
}]), /* @__PURE__ */ v(i, {
|
|
89
89
|
singleAction: !0,
|
|
90
90
|
testIdAttributes: b.createAttributes("LoginPageSessionExpired"),
|
|
91
91
|
title: T`Login`,
|
|
@@ -96,11 +96,11 @@ var w = ({ children: w }) => {
|
|
|
96
96
|
}), R]
|
|
97
97
|
});
|
|
98
98
|
if (!E.isAuthenticated) {
|
|
99
|
-
if (a.resolve(
|
|
99
|
+
if (a.resolve(e).getUserManagerSettingsCreatedAt() && L - a.resolve(e).getUserManagerSettingsCreatedAt() < e.autoLoginSkew) {
|
|
100
100
|
P();
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
|
-
return /* @__PURE__ */ v(
|
|
103
|
+
return /* @__PURE__ */ v(i, {
|
|
104
104
|
singleAction: !0,
|
|
105
105
|
testIdAttributes: b.createAttributes("LoginPage"),
|
|
106
106
|
title: T`Login`,
|
|
@@ -116,7 +116,7 @@ var w = ({ children: w }) => {
|
|
|
116
116
|
}), R]
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
|
-
return /* @__PURE__ */ v(g, { children: [w, D.consentDialog?.getShouldShow() && /* @__PURE__ */ _(
|
|
119
|
+
return /* @__PURE__ */ v(g, { children: [w, D.consentDialog?.getShouldShow() && /* @__PURE__ */ _(r, {
|
|
120
120
|
onConsent: N,
|
|
121
121
|
ref: O
|
|
122
122
|
})] });
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { n as e } from "../../../_chunks/rolldown-runtime.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
2
|
+
import { t } from "../../../_chunks/last.js";
|
|
3
|
+
import { API_ORGANIZATION_TOKEN as n } from "../../../constants/api.constants.js";
|
|
4
|
+
import { AuthorizationService as r } from "../../../classes/services/AuthorizationService/index.js";
|
|
5
|
+
import { t as i } from "../../../_chunks/useQueryMemo.js";
|
|
6
|
+
import { LoadableUtil as a } from "../../../utils/LoadableUtil/index.js";
|
|
7
|
+
import { PageContainer as o } from "../../ui/PageContainer/index.js";
|
|
8
|
+
import { ResponseHandler as s } from "../../ui/ResponseHandler/index.js";
|
|
9
9
|
import { t as c } from "../../../_chunks/QueryClientService.js";
|
|
10
10
|
import { COMMON_QUERY_KEY as l } from "../../../constants/query.constants.js";
|
|
11
11
|
import { container as u } from "tsyringe";
|
|
@@ -16,28 +16,28 @@ import { TestIdUtil as m } from "@gen-epix/ui-core/utils/TestIdUtil";
|
|
|
16
16
|
import { useMatches as h } from "react-router-dom";
|
|
17
17
|
import { useArray as g } from "@gen-epix/ui-core/hooks/useArray";
|
|
18
18
|
// src/components/app/AuthorizationWrapper/AuthorizationWrapper.tsx
|
|
19
|
-
var _ = /* @__PURE__ */ e(
|
|
20
|
-
let { t
|
|
19
|
+
var _ = /* @__PURE__ */ e(t(), 1), v = ({ children: e }) => {
|
|
20
|
+
let { t } = p(), v = h(), y = d(() => (0, _.default)(v).handle.requiresUserProfile, [v]), b = i({
|
|
21
21
|
enabled: y,
|
|
22
22
|
gcTime: Infinity,
|
|
23
|
-
queryFn: async ({ signal: e }) => (await u.resolve(
|
|
23
|
+
queryFn: async ({ signal: e }) => (await u.resolve(n).userMeGetOne({ signal: e })).data,
|
|
24
24
|
queryKey: u.resolve(c).getGenericKey(l.USER_ME),
|
|
25
25
|
staleTime: Infinity
|
|
26
|
-
}), x =
|
|
26
|
+
}), x = i({
|
|
27
27
|
enabled: y,
|
|
28
28
|
gcTime: Infinity,
|
|
29
|
-
queryFn: async ({ signal: e }) => (await u.resolve(
|
|
29
|
+
queryFn: async ({ signal: e }) => (await u.resolve(n).userMeRetrievePermissions({ signal: e })).data,
|
|
30
30
|
queryKey: u.resolve(c).getGenericKey(l.USER_PERMISSIONS),
|
|
31
31
|
staleTime: Infinity
|
|
32
32
|
}), S = g([b, x]);
|
|
33
|
-
return b.data && (u.resolve(
|
|
33
|
+
return b.data && (u.resolve(r).user = b.data), x.data && (u.resolve(r).apiPermissions = x.data), y && (a.isSomeLoading(S) || a.hasSomeError(S)) ? /* @__PURE__ */ f(o, {
|
|
34
34
|
ignorePageEvent: !0,
|
|
35
35
|
singleAction: !0,
|
|
36
36
|
testIdAttributes: m.createAttributes("LoadingUserDataPage"),
|
|
37
|
-
title:
|
|
38
|
-
children: /* @__PURE__ */ f(
|
|
37
|
+
title: t`Loading user data`,
|
|
38
|
+
children: /* @__PURE__ */ f(s, {
|
|
39
39
|
loadables: S,
|
|
40
|
-
loadingMessage:
|
|
40
|
+
loadingMessage: t`Loading user data`
|
|
41
41
|
})
|
|
42
42
|
}) : e;
|
|
43
43
|
};
|