@gen-epix/ui-client-common 4.0.0 → 4.0.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.
- package/dist/@types/{ui.d.ts → ui-client-common.d.ts} +1 -1
- package/dist/_chunks/ApplicationFooter.js +1 -1
- package/dist/_chunks/ApplicationFooter.js.map +1 -1
- package/dist/_chunks/Breadcrumbs.js +1 -1
- package/dist/_chunks/Breadcrumbs.js.map +1 -1
- package/dist/_chunks/CrudPage.js +293 -293
- package/dist/_chunks/CrudPage.js.map +1 -1
- package/dist/_chunks/GeoFilter.js +1 -1
- package/dist/_chunks/GeoFilter.js.map +1 -1
- package/dist/_chunks/Notifications.js.map +1 -1
- package/dist/_chunks/OutageList.js.map +1 -1
- package/dist/_chunks/QueryClientProvider.js +1 -1
- package/dist/_chunks/QueryClientProvider.js.map +1 -1
- package/dist/_chunks/QueryClientService.js +79 -66
- package/dist/_chunks/QueryClientService.js.map +1 -1
- package/dist/_chunks/Table.js +953 -945
- package/dist/_chunks/Table.js.map +1 -1
- package/dist/_chunks/TableUtil.js.map +1 -1
- package/dist/_chunks/TextFilter.js +4 -4
- package/dist/_chunks/TextFilter.js.map +1 -1
- package/dist/_chunks/UserInvitationsAdminPage.js +110 -110
- package/dist/_chunks/UserInvitationsAdminPage.js.map +1 -1
- package/dist/_chunks/_baseFlatten.js +1 -1
- package/dist/_chunks/_baseGet.js +26 -26
- package/dist/_chunks/_baseGet.js.map +1 -1
- package/dist/_chunks/_baseIteratee.js +25 -26
- package/dist/_chunks/_baseIteratee.js.map +1 -1
- package/dist/_chunks/_setToString.js.map +1 -1
- package/dist/_chunks/{chunk-KS7C4IRE.js → chunk-BV7QT456.js} +1041 -1128
- package/dist/_chunks/chunk-BV7QT456.js.map +1 -0
- package/dist/_chunks/format.js +199 -198
- package/dist/_chunks/format.js.map +1 -1
- package/dist/_chunks/index.esm.js +797 -692
- package/dist/_chunks/index.esm.js.map +1 -1
- package/dist/_chunks/isArrayLike.js +1 -2
- package/dist/_chunks/isArrayLike.js.map +1 -1
- package/dist/_chunks/isObject.js +38 -2
- package/dist/_chunks/isObject.js.map +1 -1
- package/dist/_chunks/isSymbol.js +2 -2
- package/dist/_chunks/middleware.js +11 -9
- package/dist/_chunks/middleware.js.map +1 -1
- package/dist/_chunks/oidc-client-ts.js +12 -9
- package/dist/_chunks/oidc-client-ts.js.map +1 -1
- package/dist/_chunks/omit.js +38 -39
- package/dist/_chunks/omit.js.map +1 -1
- package/dist/_chunks/query.js +210 -228
- package/dist/_chunks/query.js.map +1 -1
- package/dist/_chunks/react-oidc-context.js +1 -1
- package/dist/_chunks/react-oidc-context.js.map +1 -1
- package/dist/_chunks/react.js +1 -1
- package/dist/_chunks/react.js.map +1 -1
- package/dist/_chunks/rolldown-runtime.js +2 -2
- package/dist/_chunks/tableStore.js +79 -78
- package/dist/_chunks/tableStore.js.map +1 -1
- package/dist/_chunks/toDate.js +1 -1
- package/dist/_chunks/toDate.js.map +1 -1
- package/dist/_chunks/uniq.js +1 -1
- package/dist/_chunks/uniq.js.map +1 -1
- package/dist/_chunks/useColumnsMenu.js +7 -6
- package/dist/_chunks/useColumnsMenu.js.map +1 -1
- package/dist/_chunks/useMutation.js +19 -16
- package/dist/_chunks/useMutation.js.map +1 -1
- package/dist/_chunks/useQueryMemo.js +156 -169
- 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 +5 -5
- package/dist/_chunks/yup.js.map +1 -1
- package/dist/classes/filters/GeoFilter.d.ts +1 -1
- package/dist/classes/filters/MultiSelectFilter.d.ts +1 -1
- package/dist/classes/services/AuthenticationService/index.js +41 -44
- package/dist/classes/services/AuthenticationService/index.js.map +1 -1
- package/dist/classes/services/BreadcrumbService/index.js.map +1 -1
- package/dist/classes/services/InactivityService/index.js +10 -11
- package/dist/classes/services/InactivityService/index.js.map +1 -1
- package/dist/classes/services/RouterService/index.js +1 -1
- package/dist/components/app/App/index.js +48 -38
- package/dist/components/app/App/index.js.map +1 -1
- package/dist/components/app/ApplicationBootstrap/index.js +54 -54
- package/dist/components/app/ApplicationBootstrap/index.js.map +1 -1
- package/dist/components/app/AuthenticationWrapper/index.js +45 -45
- package/dist/components/app/AuthenticationWrapper/index.js.map +1 -1
- package/dist/components/app/AuthorizationWrapper/index.js +7 -7
- package/dist/components/app/AuthorizationWrapper/index.js.map +1 -1
- package/dist/components/app/RouterRoot/index.js +53 -53
- package/dist/components/app/RouterRoot/index.js.map +1 -1
- package/dist/components/epi/EpiContactDetailsDialog/EpiContactDetailsDialog.d.ts +2 -2
- package/dist/components/epi/EpiContactDetailsDialog/index.js +28 -26
- package/dist/components/epi/EpiContactDetailsDialog/index.js.map +1 -1
- package/dist/components/filters/BooleanFilterField/index.js +1 -1
- package/dist/components/filters/BooleanFilterField/index.js.map +1 -1
- package/dist/components/filters/DateFilterField/index.js +1 -1
- package/dist/components/filters/DateFilterField/index.js.map +1 -1
- package/dist/components/filters/GeoFilterField/index.js +2 -2
- package/dist/components/filters/GeoFilterField/index.js.map +1 -1
- package/dist/components/filters/MultiSelectFilterField/index.js +2 -2
- package/dist/components/filters/MultiSelectFilterField/index.js.map +1 -1
- package/dist/components/filters/NumberRangeFilterField/index.js +1 -1
- package/dist/components/filters/NumberRangeFilterField/index.js.map +1 -1
- package/dist/components/filters/TextFilterField/index.js +1 -1
- package/dist/components/filters/TextFilterField/index.js.map +1 -1
- package/dist/components/ui/ApplicationBar/index.js +132 -132
- package/dist/components/ui/ApplicationBar/index.js.map +1 -1
- package/dist/components/ui/ConsentDialog/ConsentDialog.d.ts +2 -2
- package/dist/components/ui/ConsentDialog/index.js +11 -11
- package/dist/components/ui/ConsentDialog/index.js.map +1 -1
- package/dist/components/ui/GenericErrorMessage/index.js +1 -1
- package/dist/components/ui/GenericErrorMessage/index.js.map +1 -1
- package/dist/components/ui/LicensesDialog/LicensesDialog.d.ts +2 -2
- package/dist/components/ui/LicensesDialog/index.js +40 -40
- package/dist/components/ui/LicensesDialog/index.js.map +1 -1
- package/dist/components/ui/MyPermissionsDialog/MyPermissionsDialog.d.ts +2 -2
- package/dist/components/ui/MyPermissionsDialog/index.js +21 -21
- package/dist/components/ui/MyPermissionsDialog/index.js.map +1 -1
- package/dist/components/ui/NavLink/index.js +1 -1
- package/dist/components/ui/NavLink/index.js.map +1 -1
- package/dist/components/ui/OrganizationSwitcherDialog/OrganizationSwitcherDialog.d.ts +2 -2
- package/dist/components/ui/OrganizationSwitcherDialog/index.js +43 -43
- package/dist/components/ui/OrganizationSwitcherDialog/index.js.map +1 -1
- package/dist/components/ui/OutagesDialog/OutagesDialog.d.ts +2 -2
- package/dist/components/ui/OutagesDialog/index.js +14 -14
- package/dist/components/ui/OutagesDialog/index.js.map +1 -1
- package/dist/components/ui/PageContainer/index.js +2 -2
- package/dist/components/ui/PageContainer/index.js.map +1 -1
- package/dist/components/ui/ResponseHandler/index.js +8 -8
- package/dist/components/ui/ResponseHandler/index.js.map +1 -1
- package/dist/components/ui/Sidebar/index.js.map +1 -1
- package/dist/components/ui/Table/TableColumnsEditorDialog.d.ts +2 -2
- package/dist/components/ui/UserFeedbackDialog/UserFeedbackDialog.d.ts +2 -2
- package/dist/components/ui/UserFeedbackDialog/index.js +38 -38
- package/dist/components/ui/UserFeedbackDialog/index.js.map +1 -1
- package/dist/components/ui/UserInactivityConfirmation/index.js +14 -14
- package/dist/components/ui/UserInactivityConfirmation/index.js.map +1 -1
- package/dist/context/uiClientCommonConfigContext/UiClientCommonConfigContext.d.ts +5 -0
- package/dist/context/uiClientCommonConfigContext/UiClientCommonConfigContextProvider.d.ts +6 -0
- package/dist/context/uiClientCommonConfigContext/index.d.ts +3 -0
- package/dist/context/uiClientCommonConfigContext/index.js +18 -0
- package/dist/context/uiClientCommonConfigContext/index.js.map +1 -0
- package/dist/context/uiClientCommonConfigContext/useUiClientCommonConfigContext.d.ts +2 -0
- package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/index.js +4 -4
- package/dist/dataHooks/useIdentifierIssuerQuery/index.js +4 -4
- package/dist/dataHooks/useInviteUserConstraintsQuery/index.js +4 -4
- package/dist/dataHooks/useOrganizationAdminPoliciesQuery/index.js +4 -4
- package/dist/dataHooks/useOrganizationIdentifierIssuerLinksQuery/index.js +4 -4
- package/dist/dataHooks/useOrganizationsQuery/index.js +4 -4
- package/dist/dataHooks/useUsersQuery/index.js +4 -4
- package/dist/hooks/useColumnsMenu/useColumnsMenu.d.ts +1 -1
- package/dist/hooks/useEditMutation/index.js +6 -6
- package/dist/hooks/useEditMutation/index.js.map +1 -1
- package/dist/hooks/useItemQuery/index.js +8 -8
- package/dist/hooks/useItemQuery/index.js.map +1 -1
- package/dist/locale/en.json +0 -10
- package/dist/locale/nl.json +0 -10
- package/dist/models/dataHooks.d.ts +1 -1
- package/dist/models/table.d.ts +1 -1
- package/dist/models/table.js.map +1 -1
- package/dist/pages/AcceptInvitationPage/index.js +5 -5
- package/dist/pages/AcceptInvitationPage/index.js.map +1 -1
- package/dist/pages/AdminPage/index.js +1 -1
- package/dist/pages/AdminPage/index.js.map +1 -1
- package/dist/pages/ChooseIdentityProviderPage/index.js.map +1 -1
- package/dist/pages/CrudPage/CrudPage.d.ts +2 -2
- package/dist/pages/CrudPage/CrudPageDeleteDialog.d.ts +2 -2
- package/dist/pages/CrudPage/CrudPageEditDialog.d.ts +4 -4
- package/dist/pages/ErrorPage/index.js.map +1 -1
- package/dist/pages/IdentifierIssuersAdminPage/index.js +2 -2
- package/dist/pages/IdentifierIssuersAdminPage/index.js.map +1 -1
- package/dist/pages/OrganizationAdminPoliciesAdminPage/index.js +1 -1
- package/dist/pages/OrganizationAdminPoliciesAdminPage/index.js.map +1 -1
- package/dist/pages/OrganizationContactsAdminPage/index.js +3 -3
- package/dist/pages/OrganizationContactsAdminPage/index.js.map +1 -1
- package/dist/pages/OrganizationSitesAdminPage/index.js +3 -3
- package/dist/pages/OrganizationSitesAdminPage/index.js.map +1 -1
- package/dist/pages/OrganizationsAdminPage/index.js +2 -2
- package/dist/pages/OrganizationsAdminPage/index.js.map +1 -1
- package/dist/pages/OutagesAdminPage/index.js +2 -2
- package/dist/pages/OutagesAdminPage/index.js.map +1 -1
- package/dist/pages/PostLoginPage/index.js.map +1 -1
- package/dist/pages/PostLogoutPage/index.js.map +1 -1
- package/dist/pages/RouterErrorPage/index.js +1 -1
- package/dist/pages/RouterErrorPage/index.js.map +1 -1
- package/dist/pages/UserInvitationsAdminPage/UserInvitationConsumeDialog.d.ts +2 -2
- package/dist/pages/UserInvitationsAdminPage/UserInvitationShareDialog.d.ts +2 -2
- package/dist/pages/UsersAdminPage/index.js +47 -47
- package/dist/pages/UsersAdminPage/index.js.map +1 -1
- package/dist/setup/setup.js +1 -1
- package/dist/setup/setup.js.map +1 -1
- package/dist/utils/MenuDataUtil/MenuDataUtil.d.ts +1 -1
- package/dist/utils/MenuDataUtil/index.js.map +1 -1
- package/dist/utils/StandardConfigUtil/index.js +4 -4
- package/dist/utils/StandardConfigUtil/index.js.map +1 -1
- package/dist/utils/TableUtil/TableUtil.d.ts +1 -1
- package/package.json +7 -7
- package/dist/_chunks/chunk-KS7C4IRE.js.map +0 -1
- package/dist/_chunks/isObjectLike.js +0 -43
- package/dist/_chunks/isObjectLike.js.map +0 -1
- package/dist/components/ui/BackdropSpinner/BackdropSpinner.d.ts +0 -5
- package/dist/components/ui/BackdropSpinner/index.d.ts +0 -1
- package/dist/components/ui/BackdropSpinner/index.js +0 -19
- package/dist/components/ui/BackdropSpinner/index.js.map +0 -1
- package/dist/components/ui/Confirmation/Confirmation.d.ts +0 -2
- package/dist/components/ui/Confirmation/ConfirmationRender.d.ts +0 -11
- package/dist/components/ui/Confirmation/index.d.ts +0 -2
- package/dist/components/ui/Confirmation/index.js +0 -58
- package/dist/components/ui/Confirmation/index.js.map +0 -1
- package/dist/components/ui/CopyToClipboardButton/CopyToClipboardButton.d.ts +0 -13
- package/dist/components/ui/CopyToClipboardButton/index.d.ts +0 -1
- package/dist/components/ui/CopyToClipboardButton/index.js +0 -101
- package/dist/components/ui/CopyToClipboardButton/index.js.map +0 -1
- package/dist/components/ui/Dialog/Dialog.d.ts +0 -27
- package/dist/components/ui/Dialog/index.d.ts +0 -1
- package/dist/components/ui/Dialog/index.js +0 -83
- package/dist/components/ui/Dialog/index.js.map +0 -1
- package/dist/components/ui/LinearProgressWithLabel/LinearProgressWithLabel.d.ts +0 -5
- package/dist/components/ui/LinearProgressWithLabel/index.d.ts +0 -1
- package/dist/components/ui/LinearProgressWithLabel/index.js +0 -31
- package/dist/components/ui/LinearProgressWithLabel/index.js.map +0 -1
- package/dist/components/ui/LoadingIndicator/LoadingIndicator.d.ts +0 -2
- package/dist/components/ui/LoadingIndicator/index.d.ts +0 -1
- package/dist/components/ui/LoadingIndicator/index.js +0 -12
- package/dist/components/ui/LoadingIndicator/index.js.map +0 -1
- package/dist/components/ui/NestedMenu/IconMenuItem.d.ts +0 -18
- package/dist/components/ui/NestedMenu/NestedDropdown.d.ts +0 -17
- package/dist/components/ui/NestedMenu/NestedMenuItem.d.ts +0 -22
- package/dist/components/ui/NestedMenu/index.d.ts +0 -4
- package/dist/components/ui/NestedMenu/index.js +0 -240
- package/dist/components/ui/NestedMenu/index.js.map +0 -1
- package/dist/components/ui/NestedMenu/nestedMenuItemsFromObject.d.ts +0 -11
- package/dist/components/ui/Spinner/Spinner.d.ts +0 -11
- package/dist/components/ui/Spinner/index.d.ts +0 -1
- package/dist/components/ui/Spinner/index.js +0 -63
- package/dist/components/ui/Spinner/index.js.map +0 -1
- package/dist/components/ui/Stepper/Stepper.d.ts +0 -17
- package/dist/components/ui/Stepper/index.d.ts +0 -2
- package/dist/components/ui/Stepper/index.js +0 -126
- package/dist/components/ui/Stepper/index.js.map +0 -1
- package/dist/components/ui/Stepper/stepperModel.d.ts +0 -4
- package/dist/hoc/withDialog/index.d.ts +0 -1
- package/dist/hoc/withDialog/index.js +0 -69
- package/dist/hoc/withDialog/index.js.map +0 -1
- package/dist/hoc/withDialog/withDialog.d.ts +0 -33
- package/dist/models/nestedMenu.d.ts +0 -17
- package/dist/models/nestedMenu.js +0 -0
|
@@ -2,61 +2,61 @@ import { ConfigService as e } from "../../../classes/services/ConfigService/inde
|
|
|
2
2
|
import { AuthorizationService as t } from "../../../classes/services/AuthorizationService/index.js";
|
|
3
3
|
import { LogService as n } from "../../../classes/services/LogService/index.js";
|
|
4
4
|
import { a as r } from "../../../_chunks/index.esm.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { GenericForm as S } from "@gen-epix/ui-form/components/helpers/GenericForm";
|
|
5
|
+
import { NotificationService as i } from "../../../classes/services/NotificationService/index.js";
|
|
6
|
+
import { t as a } from "../../../_chunks/yup.js";
|
|
7
|
+
import { NavigationHistoryService as o } from "../../../classes/services/NavigationHistoryService/index.js";
|
|
8
|
+
import { UserSettingsService as s } from "../../../classes/services/UserSettingsService/index.js";
|
|
9
|
+
import { Box as c, Typography as l } from "@mui/material";
|
|
10
|
+
import { useCallback as u, useEffect as d, useMemo as f } from "react";
|
|
11
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
12
|
+
import { useTranslation as h } from "react-i18next";
|
|
13
|
+
import { object as g, string as _ } from "yup";
|
|
14
|
+
import { TestIdUtil as v } from "@gen-epix/ui-core/utils/TestIdUtil";
|
|
15
|
+
import { FORM_FIELD_DEFINITION_TYPE as y } from "@gen-epix/ui-core-form/models/form";
|
|
16
|
+
import { SchemaUtil as b } from "@gen-epix/ui-core-form/utils/SchemaUtil";
|
|
17
|
+
import { withDialog as x } from "@gen-epix/ui-core-components/hoc/withDialog";
|
|
18
|
+
import { GenericForm as S } from "@gen-epix/ui-core-form/components/helpers/GenericForm";
|
|
19
19
|
//#region src/components/ui/UserFeedbackDialog/UserFeedbackDialog.tsx
|
|
20
|
-
var C =
|
|
21
|
-
let { t: T } =
|
|
22
|
-
email:
|
|
23
|
-
message:
|
|
24
|
-
name:
|
|
20
|
+
var C = x(({ onActionsChange: x, onClose: C, onTitleChange: w }) => {
|
|
21
|
+
let { t: T } = h(), E = f(() => g().shape({
|
|
22
|
+
email: _().email().required().max(200),
|
|
23
|
+
message: _().freeFormText().required().max(5e3),
|
|
24
|
+
name: b.name
|
|
25
25
|
}), []), D = r({
|
|
26
|
-
resolver:
|
|
26
|
+
resolver: a(E),
|
|
27
27
|
values: {
|
|
28
28
|
email: t.getInstance().user?.email ?? t.getInstance().user?.key ?? "",
|
|
29
29
|
message: "",
|
|
30
30
|
name: t.getInstance().user?.name ?? ""
|
|
31
31
|
}
|
|
32
32
|
}), { handleSubmit: O } = D;
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
d(() => {
|
|
34
|
+
s.getInstance().showShowUserFeedbackTooltip = !1;
|
|
35
35
|
}, []);
|
|
36
|
-
let k =
|
|
36
|
+
let k = f(() => [
|
|
37
37
|
{
|
|
38
|
-
definition:
|
|
38
|
+
definition: y.TEXTFIELD,
|
|
39
39
|
label: T`Name`,
|
|
40
40
|
name: "name"
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
|
-
definition:
|
|
43
|
+
definition: y.TEXTFIELD,
|
|
44
44
|
label: T`Email`,
|
|
45
45
|
name: "email"
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
|
-
definition:
|
|
48
|
+
definition: y.TEXTFIELD,
|
|
49
49
|
label: T`Your message`,
|
|
50
50
|
multiline: !0,
|
|
51
51
|
name: "message",
|
|
52
52
|
rows: 15
|
|
53
53
|
}
|
|
54
54
|
], [T]);
|
|
55
|
-
|
|
55
|
+
d(() => {
|
|
56
56
|
w(T`Feedback`);
|
|
57
57
|
}, [w, T]);
|
|
58
|
-
let A =
|
|
59
|
-
let t =
|
|
58
|
+
let A = u((e) => {
|
|
59
|
+
let t = o.getInstance().navigationHistory;
|
|
60
60
|
n.getInstance().log([{
|
|
61
61
|
detail: {
|
|
62
62
|
...e,
|
|
@@ -64,21 +64,21 @@ var C = i(({ onActionsChange: i, onClose: C, onTitleChange: w }) => {
|
|
|
64
64
|
},
|
|
65
65
|
level: "INFO",
|
|
66
66
|
topic: "USER_FEEDBACK"
|
|
67
|
-
}]), n.getInstance().flushLog(),
|
|
67
|
+
}]), n.getInstance().flushLog(), i.getInstance().showNotification({
|
|
68
68
|
message: T`Thank you for sharing your feedback with us`,
|
|
69
69
|
severity: "success"
|
|
70
70
|
}), C();
|
|
71
71
|
}, [C, T]);
|
|
72
|
-
return
|
|
73
|
-
|
|
74
|
-
...
|
|
72
|
+
return d(() => {
|
|
73
|
+
x([{
|
|
74
|
+
...v.createAttributes("UserFeedbackDialog-close"),
|
|
75
75
|
autoFocus: !0,
|
|
76
76
|
color: "primary",
|
|
77
77
|
label: T`Cancel`,
|
|
78
78
|
onClick: C,
|
|
79
79
|
variant: "outlined"
|
|
80
80
|
}, {
|
|
81
|
-
...
|
|
81
|
+
...v.createAttributes("UserFeedbackDialog-send"),
|
|
82
82
|
autoFocus: !0,
|
|
83
83
|
color: "secondary",
|
|
84
84
|
label: T`Send`,
|
|
@@ -87,17 +87,17 @@ var C = i(({ onActionsChange: i, onClose: C, onTitleChange: w }) => {
|
|
|
87
87
|
}]);
|
|
88
88
|
}, [
|
|
89
89
|
O,
|
|
90
|
-
|
|
90
|
+
x,
|
|
91
91
|
C,
|
|
92
92
|
A,
|
|
93
93
|
T
|
|
94
|
-
]), /* @__PURE__ */
|
|
94
|
+
]), /* @__PURE__ */ m(c, { children: [/* @__PURE__ */ p(c, {
|
|
95
95
|
sx: { marginBottom: 2 },
|
|
96
|
-
children: /* @__PURE__ */
|
|
96
|
+
children: /* @__PURE__ */ p(l, {
|
|
97
97
|
component: "p",
|
|
98
98
|
children: T("Please help make {{applicationName}} better by sharing your feedback with us. You may use this form as many times as you like.", { applicationName: e.getInstance().config.applicationName })
|
|
99
99
|
})
|
|
100
|
-
}), /* @__PURE__ */
|
|
100
|
+
}), /* @__PURE__ */ p(S, {
|
|
101
101
|
formFieldDefinitions: k,
|
|
102
102
|
formMethods: D,
|
|
103
103
|
onSubmit: O(A),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/ui/UserFeedbackDialog/UserFeedbackDialog.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next';\nimport type { ReactElement } from 'react';\nimport {\n useCallback,\n useEffect,\n useMemo,\n} from 'react';\nimport type { Resolver } from 'react-hook-form';\nimport { useForm } from 'react-hook-form';\nimport { yupResolver } from '@hookform/resolvers/yup';\nimport {\n object,\n string,\n} from 'yup';\nimport {\n Box,\n Typography,\n} from '@mui/material';\nimport { TestIdUtil } from '@gen-epix/ui-core/utils/TestIdUtil';\nimport { SchemaUtil } from '@gen-epix/ui-form/utils/SchemaUtil';\nimport { GenericForm } from '@gen-epix/ui-form/components/helpers/GenericForm';\nimport type { FormFieldDefinition } from '@gen-epix/ui-form/models/form';\nimport { FORM_FIELD_DEFINITION_TYPE } from '@gen-epix/ui-form/models/form';\
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/ui/UserFeedbackDialog/UserFeedbackDialog.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next';\nimport type { ReactElement } from 'react';\nimport {\n useCallback,\n useEffect,\n useMemo,\n} from 'react';\nimport type { Resolver } from 'react-hook-form';\nimport { useForm } from 'react-hook-form';\nimport { yupResolver } from '@hookform/resolvers/yup';\nimport {\n object,\n string,\n} from 'yup';\nimport {\n Box,\n Typography,\n} from '@mui/material';\nimport { TestIdUtil } from '@gen-epix/ui-core/utils/TestIdUtil';\nimport { SchemaUtil } from '@gen-epix/ui-core-form/utils/SchemaUtil';\nimport { GenericForm } from '@gen-epix/ui-core-form/components/helpers/GenericForm';\nimport type { FormFieldDefinition } from '@gen-epix/ui-core-form/models/form';\nimport { FORM_FIELD_DEFINITION_TYPE } from '@gen-epix/ui-core-form/models/form';\nimport type {\n WithDialogRefMethods,\n WithDialogRenderProps,\n} from '@gen-epix/ui-core-components/hoc/withDialog';\nimport { withDialog } from '@gen-epix/ui-core-components/hoc/withDialog';\n\nimport { ConfigService } from '../../../classes/services/ConfigService';\nimport { LogService } from '../../../classes/services/LogService';\nimport { NavigationHistoryService } from '../../../classes/services/NavigationHistoryService';\nimport { NotificationService } from '../../../classes/services/NotificationService';\nimport { UserSettingsService } from '../../../classes/services/UserSettingsService';\nimport { AuthorizationService } from '../../../classes/services/AuthorizationService';\n\nexport interface UserFeedbackDialogOpenProps {\n //\n}\n\nexport interface UserFeedbackDialogProps extends WithDialogRenderProps<UserFeedbackDialogOpenProps> {\n //\n}\n\nexport type UserFeedbackDialogRefMethods = WithDialogRefMethods<UserFeedbackDialogProps, UserFeedbackDialogOpenProps>;\n\ntype FormFields = {\n email: string;\n message: string;\n name: string;\n};\n\nexport const UserFeedbackDialog = withDialog<UserFeedbackDialogProps, UserFeedbackDialogOpenProps>((\n {\n onActionsChange,\n onClose,\n onTitleChange,\n }: UserFeedbackDialogProps,\n): ReactElement => {\n const { t } = useTranslation();\n\n const schema = useMemo(() => object<FormFields>().shape({\n email: string().email().required().max(200),\n message: string().freeFormText().required().max(5000),\n name: SchemaUtil.name,\n }), []);\n\n const formMethods = useForm<FormFields>({\n resolver: yupResolver(schema) as Resolver<FormFields>,\n values: {\n email: AuthorizationService.getInstance().user?.email ?? AuthorizationService.getInstance().user?.key ?? '',\n message: '',\n name: AuthorizationService.getInstance().user?.name ?? '',\n },\n });\n const { handleSubmit } = formMethods;\n\n useEffect(() => {\n UserSettingsService.getInstance().showShowUserFeedbackTooltip = false;\n }, []);\n\n const formFieldDefinitions = useMemo<FormFieldDefinition<FormFields>[]>(() => [\n {\n definition: FORM_FIELD_DEFINITION_TYPE.TEXTFIELD,\n label: t`Name`,\n name: 'name',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.TEXTFIELD,\n label: t`Email`,\n name: 'email',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.TEXTFIELD,\n label: t`Your message`,\n multiline: true,\n name: 'message',\n rows: 15,\n } as const satisfies FormFieldDefinition<FormFields>,\n ] as const, [t]);\n\n useEffect(() => {\n onTitleChange(t`Feedback`);\n }, [onTitleChange, t]);\n\n const onFormSubmit = useCallback((formValues: FormFields): void => {\n const navigationHistory = NavigationHistoryService.getInstance().navigationHistory;\n LogService.getInstance().log([{\n detail: {\n ...formValues,\n navigationHistory: navigationHistory.slice(navigationHistory.length - 50).reverse(),\n },\n level: 'INFO',\n topic: 'USER_FEEDBACK',\n }]);\n LogService.getInstance().flushLog();\n NotificationService.getInstance().showNotification({\n message: t`Thank you for sharing your feedback with us`,\n severity: 'success',\n });\n onClose();\n }, [onClose, t]);\n\n useEffect(() => {\n onActionsChange(\n [\n {\n ...TestIdUtil.createAttributes('UserFeedbackDialog-close'),\n autoFocus: true,\n color: 'primary',\n label: t`Cancel`,\n onClick: onClose,\n variant: 'outlined',\n },\n {\n ...TestIdUtil.createAttributes('UserFeedbackDialog-send'),\n autoFocus: true,\n color: 'secondary',\n label: t`Send`,\n onClick: handleSubmit(onFormSubmit),\n variant: 'contained',\n },\n ],\n );\n }, [handleSubmit, onActionsChange, onClose, onFormSubmit, t]);\n\n return (\n <Box>\n <Box\n sx={{\n marginBottom: 2,\n }}\n >\n <Typography component={'p'}>\n {t('Please help make {{applicationName}} better by sharing your feedback with us. You may use this form as many times as you like.', { applicationName: ConfigService.getInstance().config.applicationName })}\n </Typography>\n </Box>\n <GenericForm<FormFields>\n formFieldDefinitions={formFieldDefinitions}\n formMethods={formMethods}\n onSubmit={handleSubmit(onFormSubmit)}\n schema={schema}\n />\n </Box>\n );\n}, {\n defaultTitle: '',\n disableBackdropClick: false,\n fullWidth: true,\n maxWidth: 'md',\n noCloseButton: false,\n testId: 'UserFeedbackDialog',\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoDA,IAAa,IAAqB,GAChC,EACE,oBACA,YACA,uBAEe;CACjB,IAAM,EAAE,SAAM,EAAe,GAEvB,IAAS,QAAc,EAAmB,CAAC,CAAC,MAAM;EACtD,OAAO,EAAO,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,GAAG;EAC1C,SAAS,EAAO,CAAC,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,GAAI;EACpD,MAAM,EAAW;CACnB,CAAC,GAAG,CAAC,CAAC,GAEA,IAAc,EAAoB;EACtC,UAAU,EAAY,CAAM;EAC5B,QAAQ;GACN,OAAO,EAAqB,YAAY,CAAC,CAAC,MAAM,SAAS,EAAqB,YAAY,CAAC,CAAC,MAAM,OAAO;GACzG,SAAS;GACT,MAAM,EAAqB,YAAY,CAAC,CAAC,MAAM,QAAQ;EACzD;CACF,CAAC,GACK,EAAE,oBAAiB;CAEzB,QAAgB;EACd,EAAoB,YAAY,CAAC,CAAC,8BAA8B;CAClE,GAAG,CAAC,CAAC;CAEL,IAAM,IAAuB,QAAiD;EAC5E;GACE,YAAY,EAA2B;GACvC,OAAO,CAAC;GACR,MAAM;EACR;EACA;GACE,YAAY,EAA2B;GACvC,OAAO,CAAC;GACR,MAAM;EACR;EACA;GACE,YAAY,EAA2B;GACvC,OAAO,CAAC;GACR,WAAW;GACX,MAAM;GACN,MAAM;EACR;CACF,GAAY,CAAC,CAAC,CAAC;CAEf,QAAgB;EACd,EAAc,CAAC,UAAU;CAC3B,GAAG,CAAC,GAAe,CAAC,CAAC;CAErB,IAAM,IAAe,GAAa,MAAiC;EACjE,IAAM,IAAoB,EAAyB,YAAY,CAAC,CAAC;EAcjE,AAbA,EAAW,YAAY,CAAC,CAAC,IAAI,CAAC;GAC5B,QAAQ;IACN,GAAG;IACH,mBAAmB,EAAkB,MAAM,EAAkB,SAAS,EAAE,CAAC,CAAC,QAAQ;GACpF;GACA,OAAO;GACP,OAAO;EACT,CAAC,CAAC,GACF,EAAW,YAAY,CAAC,CAAC,SAAS,GAClC,EAAoB,YAAY,CAAC,CAAC,iBAAiB;GACjD,SAAS,CAAC;GACV,UAAU;EACZ,CAAC,GACD,EAAQ;CACV,GAAG,CAAC,GAAS,CAAC,CAAC;CAyBf,OAvBA,QAAgB;EACd,EACE,CACE;GACE,GAAG,EAAW,iBAAiB,0BAA0B;GACzD,WAAW;GACX,OAAO;GACP,OAAO,CAAC;GACR,SAAS;GACT,SAAS;EACX,GACA;GACE,GAAG,EAAW,iBAAiB,yBAAyB;GACxD,WAAW;GACX,OAAO;GACP,OAAO,CAAC;GACR,SAAS,EAAa,CAAY;GAClC,SAAS;EACX,CACF,CACF;CACF,GAAG;EAAC;EAAc;EAAiB;EAAS;EAAc;CAAC,CAAC,GAG1D,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD;EACE,IAAI,EACF,cAAc,EAChB;EAEA,UAAA,kBAAC,GAAD;GAAY,WAAW;GACpB,UAAA,EAAE,kIAAkI,EAAE,iBAAiB,EAAc,YAAY,CAAC,CAAC,OAAO,gBAAgB,CAAC;EAClM,CAAA;CACT,CAAA,GACL,kBAAC,GAAD;EACwB;EACT;EACb,UAAU,EAAa,CAAY;EAC3B;CACT,CAAA,CACE,EAAA,CAAA;AAET,GAAG;CACD,cAAc;CACd,sBAAsB;CACtB,WAAW;CACX,UAAU;CACV,eAAe;CACf,QAAQ;AACV,CAAC"}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { InactivityService as e } from "../../../classes/services/InactivityService/index.js";
|
|
2
|
+
import { useCallback as t, useEffect as n, useRef as r, useState as i } from "react";
|
|
3
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
4
|
+
import { useTranslation as o } from "react-i18next";
|
|
5
|
+
import { Confirmation as s } from "@gen-epix/ui-core-components/components/Confirmation";
|
|
6
6
|
//#region src/components/ui/UserInactivityConfirmation/UserInactivityConfirmation.tsx
|
|
7
7
|
var c = () => {
|
|
8
|
-
let { t: c } =
|
|
9
|
-
|
|
10
|
-
let
|
|
8
|
+
let { t: c } = o(), l = r(null), [u, d] = i(e.getInstance().data);
|
|
9
|
+
n(() => {
|
|
10
|
+
let t = e.getInstance().subscribe((e) => {
|
|
11
11
|
e.isIdle ? (d(e), l.current?.open()) : l.current?.close();
|
|
12
12
|
});
|
|
13
13
|
return () => {
|
|
14
|
-
|
|
14
|
+
t();
|
|
15
15
|
};
|
|
16
16
|
}, []);
|
|
17
|
-
let f =
|
|
18
|
-
|
|
19
|
-
}, []), p =
|
|
20
|
-
|
|
17
|
+
let f = t(() => {
|
|
18
|
+
e.getInstance().logout();
|
|
19
|
+
}, []), p = t(() => {
|
|
20
|
+
e.getInstance().reset();
|
|
21
21
|
}, []);
|
|
22
|
-
return /* @__PURE__ */
|
|
22
|
+
return /* @__PURE__ */ a(s, {
|
|
23
23
|
body: c("Because you were inactive for the last {{formattedTimeInactive}}, you will be automatically logged out in {{formattedTimeUntilLogout}}.", {
|
|
24
24
|
formattedTimeInactive: u.readableIdleDiff,
|
|
25
25
|
formattedTimeUntilLogout: u.readableNotificationDiff
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/ui/UserInactivityConfirmation/UserInactivityConfirmation.tsx"],"sourcesContent":["import {\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/ui/UserInactivityConfirmation/UserInactivityConfirmation.tsx"],"sourcesContent":["import {\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport type { ConfirmationRefMethods } from '@gen-epix/ui-core-components/components/Confirmation';\nimport { Confirmation } from '@gen-epix/ui-core-components/components/Confirmation';\n\nimport type { InactivityState } from '../../../classes/services/InactivityService';\nimport { InactivityService } from '../../../classes/services/InactivityService';\n\nexport const UserInactivityConfirmation = () => {\n const { t } = useTranslation();\n const confirmationRef = useRef<ConfirmationRefMethods>(null);\n const [idleState, setIdleState] = useState<InactivityState>(InactivityService.getInstance().data);\n\n\n useEffect(() => {\n const unsubscribe = InactivityService.getInstance().subscribe((data) => {\n if (data.isIdle) {\n setIdleState(data);\n confirmationRef.current?.open();\n } else {\n confirmationRef.current?.close();\n }\n });\n return () => {\n unsubscribe();\n };\n }, []);\n\n const onCancel = useCallback(() => {\n InactivityService.getInstance().logout();\n }, []);\n\n const onClose = useCallback(() => {\n InactivityService.getInstance().reset();\n }, []);\n\n\n return (\n <Confirmation\n body={t('Because you were inactive for the last {{formattedTimeInactive}}, you will be automatically logged out in {{formattedTimeUntilLogout}}.', {\n formattedTimeInactive: idleState.readableIdleDiff,\n formattedTimeUntilLogout: idleState.readableNotificationDiff,\n })}\n cancelLabel={'Logout'}\n confirmLabel={t`Stay logged in`}\n maxWidth={'xs'}\n onCancel={onCancel}\n onClose={onClose}\n onConfirm={onClose}\n ref={confirmationRef}\n title={t`Your session is about to expire`}\n />\n );\n};\n"],"mappings":";;;;;;AAaA,IAAa,UAAmC;CAC9C,IAAM,EAAE,SAAM,EAAe,GACvB,IAAkB,EAA+B,IAAI,GACrD,CAAC,GAAW,KAAgB,EAA0B,EAAkB,YAAY,CAAC,CAAC,IAAI;CAGhG,QAAgB;EACd,IAAM,IAAc,EAAkB,YAAY,CAAC,CAAC,WAAW,MAAS;GACtE,AAAI,EAAK,UACP,EAAa,CAAI,GACjB,EAAgB,SAAS,KAAK,KAE9B,EAAgB,SAAS,MAAM;EAEnC,CAAC;EACD,aAAa;GACX,EAAY;EACd;CACF,GAAG,CAAC,CAAC;CAEL,IAAM,IAAW,QAAkB;EACjC,EAAkB,YAAY,CAAC,CAAC,OAAO;CACzC,GAAG,CAAC,CAAC,GAEC,IAAU,QAAkB;EAChC,EAAkB,YAAY,CAAC,CAAC,MAAM;CACxC,GAAG,CAAC,CAAC;CAGL,OACE,kBAAC,GAAD;EACE,MAAM,EAAE,2IAA2I;GACjJ,uBAAuB,EAAU;GACjC,0BAA0B,EAAU;EACtC,CAAC;EACD,aAAa;EACb,cAAc,CAAC;EACf,UAAU;EACA;EACD;EACT,WAAW;EACX,KAAK;EACL,OAAO,CAAC;CACT,CAAA;AAEL"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { UiCoreComponentsConfig } from '@gen-epix/ui-core-components/context/uiCoreComponentsConfigContext';
|
|
2
|
+
export type UiClientCommonConfig = {
|
|
3
|
+
uiCoreComponentsConfig: UiCoreComponentsConfig;
|
|
4
|
+
};
|
|
5
|
+
export declare const UiClientCommonConfigContext: import('react').Context<UiClientCommonConfig>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { UiClientCommonConfig } from './UiClientCommonConfigContext';
|
|
3
|
+
export type UiClientCommonConfigContextProviderProps = PropsWithChildren<{
|
|
4
|
+
readonly config: UiClientCommonConfig;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const UiClientCommonConfigContextProvider: (props: UiClientCommonConfigContextProviderProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createContext as e, use as t } from "react";
|
|
2
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { UiCoreComponentsConfigContext as r } from "@gen-epix/ui-core-components/context/uiCoreComponentsConfigContext";
|
|
4
|
+
//#region src/context/uiClientCommonConfigContext/UiClientCommonConfigContext.tsx
|
|
5
|
+
var i = e(null), a = (e) => {
|
|
6
|
+
let { children: t, config: a } = e;
|
|
7
|
+
return /* @__PURE__ */ n(r, {
|
|
8
|
+
value: a.uiCoreComponentsConfig,
|
|
9
|
+
children: /* @__PURE__ */ n(i, {
|
|
10
|
+
value: a,
|
|
11
|
+
children: t
|
|
12
|
+
})
|
|
13
|
+
});
|
|
14
|
+
}, o = () => t(i);
|
|
15
|
+
//#endregion
|
|
16
|
+
export { i as UiClientCommonConfigContext, a as UiClientCommonConfigContextProvider, o as useUiClientCommonConfigContext };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/context/uiClientCommonConfigContext/UiClientCommonConfigContext.tsx","../../../src/context/uiClientCommonConfigContext/UiClientCommonConfigContextProvider.tsx","../../../src/context/uiClientCommonConfigContext/useUiClientCommonConfigContext.tsx"],"sourcesContent":["import type { UiCoreComponentsConfig } from '@gen-epix/ui-core-components/context/uiCoreComponentsConfigContext';\nimport { createContext } from 'react';\n\n\nexport type UiClientCommonConfig = {\n uiCoreComponentsConfig: UiCoreComponentsConfig;\n};\n\nexport const UiClientCommonConfigContext = createContext<UiClientCommonConfig>(null);\n","import type { PropsWithChildren } from 'react';\nimport { UiCoreComponentsConfigContext } from '@gen-epix/ui-core-components/context/uiCoreComponentsConfigContext';\n\nimport type { UiClientCommonConfig } from './UiClientCommonConfigContext';\nimport { UiClientCommonConfigContext } from './UiClientCommonConfigContext';\n\n\nexport type UiClientCommonConfigContextProviderProps = PropsWithChildren<{\n readonly config: UiClientCommonConfig;\n}>;\n\nexport const UiClientCommonConfigContextProvider = (\n props: UiClientCommonConfigContextProviderProps,\n) => {\n const { children, config } = props;\n return (\n <UiCoreComponentsConfigContext value={config.uiCoreComponentsConfig}>\n <UiClientCommonConfigContext value={config}>\n {children}\n </UiClientCommonConfigContext>\n </UiCoreComponentsConfigContext>\n );\n};\n","import { use } from 'react';\n\nimport type { UiClientCommonConfig } from './UiClientCommonConfigContext';\nimport { UiClientCommonConfigContext } from './UiClientCommonConfigContext';\n\nexport const useUiClientCommonConfigContext = (): UiClientCommonConfig => use(UiClientCommonConfigContext);\n"],"mappings":";;;;AAQA,IAAa,IAA8B,EAAoC,IAAI,GCGtE,KACX,MACG;CACH,IAAM,EAAE,aAAU,cAAW;CAC7B,OACE,kBAAC,GAAD;EAA+B,OAAO,EAAO;EAC3C,UAAA,kBAAC,GAAD;GAA6B,OAAO;GACjC;EAC0B,CAAA;CACA,CAAA;AAEnC,GCjBa,UAA6D,EAAI,CAA2B"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { DataHookUtil as e } from "../../utils/DataHookUtil/index.js";
|
|
2
2
|
import { AuthorizationService as t } from "../../classes/services/AuthorizationService/index.js";
|
|
3
3
|
import { ApiService as n } from "../../classes/services/ApiService/index.js";
|
|
4
|
-
import { t as r } from "../../_chunks/
|
|
5
|
-
import { t as i } from "../../_chunks/
|
|
4
|
+
import { t as r } from "../../_chunks/useQueryMemo.js";
|
|
5
|
+
import { t as i } from "../../_chunks/QueryClientService.js";
|
|
6
6
|
import { COMMON_QUERY_KEY as a } from "../../constants/query.js";
|
|
7
7
|
import { useMemo as o } from "react";
|
|
8
8
|
//#region src/dataHooks/useIdentifierIssuerOwnOrganizationQuery/useIdentifierIssuerOwnOrganizationQuery.ts
|
|
9
|
-
var s = () =>
|
|
9
|
+
var s = () => r({
|
|
10
10
|
queryFn: async ({ signal: e }) => {
|
|
11
11
|
let r = (await n.getInstance().organizationApi.organizationIdentifierIssuerLinksPostQuery({
|
|
12
12
|
key: "organization_id",
|
|
@@ -15,7 +15,7 @@ var s = () => i({
|
|
|
15
15
|
}, null, null, { signal: e })).data;
|
|
16
16
|
return (await n.getInstance().organizationApi.identifierIssuersGetSome(r.map((e) => e.identifier_issuer_id).join(","), { signal: e })).data;
|
|
17
17
|
},
|
|
18
|
-
queryKey:
|
|
18
|
+
queryKey: i.getInstance().getGenericKey(a.IDENTIFIER_ISSUERS_OWN_ORGANIZATION)
|
|
19
19
|
}), c = () => {
|
|
20
20
|
let t = s();
|
|
21
21
|
return o(() => e.createUseOptionsDataHook(t, (e) => e.id, (e) => e.name), [t]);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { DataHookUtil as e } from "../../utils/DataHookUtil/index.js";
|
|
2
2
|
import { ApiService as t } from "../../classes/services/ApiService/index.js";
|
|
3
|
-
import { t as n } from "../../_chunks/
|
|
4
|
-
import { t as r } from "../../_chunks/
|
|
3
|
+
import { t as n } from "../../_chunks/useQueryMemo.js";
|
|
4
|
+
import { t as r } from "../../_chunks/QueryClientService.js";
|
|
5
5
|
import { COMMON_QUERY_KEY as i } from "../../constants/query.js";
|
|
6
6
|
import { useMemo as a } from "react";
|
|
7
7
|
//#region src/dataHooks/useIdentifierIssuerQuery/useIdentifierIssuerQuery.ts
|
|
8
|
-
var o = (e) =>
|
|
8
|
+
var o = (e) => n({
|
|
9
9
|
queryFn: async ({ signal: e }) => (await t.getInstance().organizationApi.identifierIssuersGetAll(null, null, { signal: e })).data,
|
|
10
|
-
queryKey:
|
|
10
|
+
queryKey: r.getInstance().getGenericKey(i.IDENTIFIER_ISSUERS),
|
|
11
11
|
select: e ? (t) => e(t) : void 0
|
|
12
12
|
}), s = (t) => {
|
|
13
13
|
let n = o(t);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AuthorizationService as e } from "../../classes/services/AuthorizationService/index.js";
|
|
2
2
|
import { ApiService as t } from "../../classes/services/ApiService/index.js";
|
|
3
|
-
import { t as n } from "../../_chunks/
|
|
4
|
-
import { t as r } from "../../_chunks/
|
|
3
|
+
import { t as n } from "../../_chunks/useQueryMemo.js";
|
|
4
|
+
import { t as r } from "../../_chunks/QueryClientService.js";
|
|
5
5
|
import { COMMON_QUERY_KEY as i } from "../../constants/query.js";
|
|
6
6
|
import { CommonDbCommandName as a, CommonDbPermissionType as o } from "@gen-epix/api-commondb";
|
|
7
7
|
//#region src/dataHooks/useInviteUserConstraintsQuery/useInviteUserConstraintsQuery.ts
|
|
8
|
-
var s = () =>
|
|
8
|
+
var s = () => n({
|
|
9
9
|
queryFn: async ({ signal: n }) => e.getInstance().doesUserHavePermission([{
|
|
10
10
|
command_name: a.RetrieveInviteUserConstraintsCommand,
|
|
11
11
|
permission_type: o.EXECUTE
|
|
@@ -13,7 +13,7 @@ var s = () => r({
|
|
|
13
13
|
organization_ids: [],
|
|
14
14
|
roles: []
|
|
15
15
|
},
|
|
16
|
-
queryKey:
|
|
16
|
+
queryKey: r.getInstance().getGenericKey(i.INVITE_USER_CONSTRAINTS)
|
|
17
17
|
});
|
|
18
18
|
//#endregion
|
|
19
19
|
export { s as useInviteUserConstraintsQuery };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { UserUtil as e } from "../../utils/UserUtil/index.js";
|
|
2
2
|
import { DataHookUtil as t } from "../../utils/DataHookUtil/index.js";
|
|
3
3
|
import { ApiService as n } from "../../classes/services/ApiService/index.js";
|
|
4
|
-
import { t as r } from "../../_chunks/
|
|
5
|
-
import { t as i } from "../../_chunks/
|
|
4
|
+
import { t as r } from "../../_chunks/useQueryMemo.js";
|
|
5
|
+
import { t as i } from "../../_chunks/QueryClientService.js";
|
|
6
6
|
import { COMMON_QUERY_KEY as a } from "../../constants/query.js";
|
|
7
7
|
import { useOrganizationMapQuery as o } from "../useOrganizationsQuery/index.js";
|
|
8
8
|
import { useUsersMapQuery as s } from "../useUsersQuery/index.js";
|
|
9
9
|
import { useMemo as c } from "react";
|
|
10
10
|
import { useTranslation as l } from "react-i18next";
|
|
11
11
|
//#region src/dataHooks/useOrganizationAdminPoliciesQuery/useOrganizationAdminPoliciesQuery.ts
|
|
12
|
-
var u = () =>
|
|
12
|
+
var u = () => r({
|
|
13
13
|
queryFn: async ({ signal: e }) => (await n.getInstance().abacApi.organizationAdminPoliciesGetAll(null, null, { signal: e })).data,
|
|
14
|
-
queryKey:
|
|
14
|
+
queryKey: i.getInstance().getGenericKey(a.ORGANIZATION_ADMIN_POLICIES)
|
|
15
15
|
}), d = () => {
|
|
16
16
|
let e = u();
|
|
17
17
|
return c(() => t.createUseMapDataHook(e, (e) => e.id), [e]);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ApiService as e } from "../../classes/services/ApiService/index.js";
|
|
2
|
-
import { t } from "../../_chunks/
|
|
3
|
-
import { t as n } from "../../_chunks/
|
|
2
|
+
import { t } from "../../_chunks/useQueryMemo.js";
|
|
3
|
+
import { t as n } from "../../_chunks/QueryClientService.js";
|
|
4
4
|
import { COMMON_QUERY_KEY as r } from "../../constants/query.js";
|
|
5
5
|
//#region src/dataHooks/useOrganizationIdentifierIssuerLinksQuery/useOrganizationIdentifierIssuerLinksQuery.ts
|
|
6
|
-
var i = () =>
|
|
6
|
+
var i = () => t({
|
|
7
7
|
queryFn: async ({ signal: t }) => (await e.getInstance().organizationApi.organizationIdentifierIssuerLinksGetAll(null, null, { signal: t })).data,
|
|
8
|
-
queryKey:
|
|
8
|
+
queryKey: n.getInstance().getGenericKey(r.IDENTIFIER_ISSUER_LINKS)
|
|
9
9
|
});
|
|
10
10
|
//#endregion
|
|
11
11
|
export { i as useOrganizationIdentifierIssuerLinksQuery };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { DataHookUtil as e } from "../../utils/DataHookUtil/index.js";
|
|
2
2
|
import { ApiService as t } from "../../classes/services/ApiService/index.js";
|
|
3
|
-
import { t as n } from "../../_chunks/
|
|
4
|
-
import { t as r } from "../../_chunks/
|
|
3
|
+
import { t as n } from "../../_chunks/useQueryMemo.js";
|
|
4
|
+
import { t as r } from "../../_chunks/QueryClientService.js";
|
|
5
5
|
import { COMMON_QUERY_KEY as i } from "../../constants/query.js";
|
|
6
6
|
import { StringUtil as a } from "@gen-epix/ui-core/utils/StringUtil";
|
|
7
7
|
import { useMemo as o } from "react";
|
|
8
8
|
//#region src/dataHooks/useOrganizationsQuery/useOrganizationsQuery.ts
|
|
9
|
-
var s = () =>
|
|
9
|
+
var s = () => n({
|
|
10
10
|
queryFn: async ({ signal: e }) => (await t.getInstance().organizationApi.organizationsGetAll(null, null, { signal: e })).data,
|
|
11
|
-
queryKey:
|
|
11
|
+
queryKey: r.getInstance().getGenericKey(i.ORGANIZATIONS)
|
|
12
12
|
}), c = () => {
|
|
13
13
|
let t = s();
|
|
14
14
|
return o(() => e.createUseMapDataHook(t, (e) => e.id), [t]);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { UserUtil as e } from "../../utils/UserUtil/index.js";
|
|
2
2
|
import { DataHookUtil as t } from "../../utils/DataHookUtil/index.js";
|
|
3
3
|
import { ApiService as n } from "../../classes/services/ApiService/index.js";
|
|
4
|
-
import { t as r } from "../../_chunks/
|
|
5
|
-
import { t as i } from "../../_chunks/
|
|
4
|
+
import { t as r } from "../../_chunks/useQueryMemo.js";
|
|
5
|
+
import { t as i } from "../../_chunks/QueryClientService.js";
|
|
6
6
|
import { COMMON_QUERY_KEY as a } from "../../constants/query.js";
|
|
7
7
|
import { useMemo as o } from "react";
|
|
8
8
|
import { useTranslation as s } from "react-i18next";
|
|
9
9
|
//#region src/dataHooks/useUsersQuery/useUsersQuery.ts
|
|
10
|
-
var c = () =>
|
|
10
|
+
var c = () => r({
|
|
11
11
|
queryFn: async ({ signal: e }) => (await n.getInstance().organizationApi.usersGetAll(null, null, { signal: e })).data,
|
|
12
|
-
queryKey:
|
|
12
|
+
queryKey: i.getInstance().getGenericKey(a.USERS)
|
|
13
13
|
}), l = () => {
|
|
14
14
|
let e = c();
|
|
15
15
|
return o(() => t.createUseMapDataHook(e, (e) => e.id), [e]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MenuItemData } from '
|
|
1
|
+
import { MenuItemData } from '@gen-epix/ui-core-components/models/nestedMenu';
|
|
2
2
|
import { HasCellDataFn } from '../../models/table';
|
|
3
3
|
export type UseColumnsMenuProps<TRowData, TDataContext = null> = {
|
|
4
4
|
readonly hasCellData?: HasCellDataFn<TRowData, TDataContext>;
|
|
@@ -8,8 +8,8 @@ import { ObjectUtil as s } from "@gen-epix/ui-core/utils/ObjectUtil";
|
|
|
8
8
|
var c = ({ associationQueryKeys: c, getErrorNotificationMessage: l, getIntermediateItem: u, getProgressNotificationMessage: d, getSuccessNotificationMessage: f, onError: p, onSuccess: m, queryFn: h, resourceQueryKey: g }) => {
|
|
9
9
|
let _ = t.getInstance().queryClient, v = o(void 0), y = i((e) => {
|
|
10
10
|
v.current = e;
|
|
11
|
-
}, []), b = n({
|
|
12
|
-
mutationFn:
|
|
11
|
+
}, []), b = i(async (e) => h(s.deepNullifyEmptyStrings(e), v.current), [v, h]), x = n({
|
|
12
|
+
mutationFn: b,
|
|
13
13
|
onError: async (n, i, a) => {
|
|
14
14
|
v.current = void 0, g && Array.isArray(a.previousData) && _.setQueryData(g, (e) => Array.isArray(e) ? [...e.filter((e) => e.id !== a.item.id), a.item] : e), await t.getInstance().invalidateQueryKeys(c), p && await p(n, i, a), r.getInstance().fulfillNotification(a.notificationKey, e.wrapErrorNotificationMessage(l(a.item, i, n), n), "error");
|
|
15
15
|
},
|
|
@@ -40,14 +40,14 @@ var c = ({ associationQueryKeys: c, getErrorNotificationMessage: l, getIntermedi
|
|
|
40
40
|
onSuccess: async (e, n, i) => {
|
|
41
41
|
v.current = void 0, await t.getInstance().invalidateQueryKeys(c), m && await m(e, n, i), r.getInstance().fulfillNotification(i.notificationKey, f(e, i), "success");
|
|
42
42
|
}
|
|
43
|
-
}),
|
|
43
|
+
}), S = a(() => x.mutate, [x.mutate]), C = a(() => x.isPending, [x.isPending]);
|
|
44
44
|
return a(() => ({
|
|
45
|
-
isMutating:
|
|
46
|
-
mutate:
|
|
45
|
+
isMutating: C,
|
|
46
|
+
mutate: S,
|
|
47
47
|
setPreviousItem: y
|
|
48
48
|
}), [
|
|
49
|
+
C,
|
|
49
50
|
S,
|
|
50
|
-
x,
|
|
51
51
|
y
|
|
52
52
|
]);
|
|
53
53
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/hooks/useEditMutation/useEditMutation.ts"],"sourcesContent":["import { useMutation } from '@tanstack/react-query';\nimport type { ReactElement } from 'react';\nimport {\n useCallback,\n useMemo,\n useRef,\n} from 'react';\nimport { ObjectUtil } from '@gen-epix/ui-core/utils/ObjectUtil';\n\nimport { NotificationService } from '../../classes/services/NotificationService';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\nimport type { GenericData } from '../../models/data';\nimport { NotificationUtil } from '../../utils/NotificationUtil';\n\nexport type MutationContextEdit<TData> = { item?: TData; notificationKey?: string; previousData?: TData[] };\n\nexport type UseEditMutationProps<TData, TVariables = TData> = {\n readonly associationQueryKeys?: string[][];\n readonly getErrorNotificationMessage: (data: TData, variables: TVariables, error: unknown) => ReactElement | string;\n // Optional function to get an intermediate item to be set in the query cache before the mutation is completed.\n // This is useful for optimistic updates where you want to show a temporary state before the mutation is confirmed.\n // The function receives the variables and the previous item, and should return the intermediate item.\n // Only needed if the variables are different from the previous item.\n readonly getIntermediateItem?: (variables: TVariables, previousItem: TData) => TData;\n readonly getProgressNotificationMessage: (data: TData, variables: TVariables) => ReactElement | string;\n readonly getSuccessNotificationMessage: (data: TData, context: MutationContextEdit<TData>) => ReactElement | string;\n readonly onError?: (error: unknown, variables: TVariables, context: MutationContextEdit<TData>) => Promise<void> | void;\n readonly onSuccess?: (item: TData, variables: TVariables, context: MutationContextEdit<TData>) => Promise<void> | void;\n readonly queryFn?: (variables: TVariables, previousData: TData) => Promise<TData>;\n readonly resourceQueryKey?: string[];\n};\n\nexport const useEditMutation = <TData extends GenericData | GenericData[], TVariables = TData>({\n associationQueryKeys,\n getErrorNotificationMessage,\n getIntermediateItem,\n getProgressNotificationMessage,\n getSuccessNotificationMessage,\n onError,\n onSuccess,\n queryFn,\n resourceQueryKey,\n}: UseEditMutationProps<TData, TVariables>) => {\n const queryClient = QueryClientService.getInstance().queryClient;\n const previousItemRef = useRef<TData>(undefined);\n\n const setPreviousItem = useCallback((item: TData) => {\n previousItemRef.current = item;\n }, []);\n\n const mutationFn = useCallback(async (variables: TVariables) => {\n return queryFn(ObjectUtil.deepNullifyEmptyStrings(variables), previousItemRef.current);\n }, [previousItemRef, queryFn]);\n\n const editMutation = useMutation<TData, Error, TVariables, MutationContextEdit<TData>>({\n mutationFn,\n onError: async (error, variables, context) => {\n previousItemRef.current = undefined;\n if (resourceQueryKey && Array.isArray(context.previousData)) {\n queryClient.setQueryData(resourceQueryKey, (oldItems: TData[]) => {\n if (!Array.isArray(oldItems)) {\n return oldItems;\n }\n return [...oldItems.filter(x => (x as GenericData).id !== (context.item as GenericData).id), context.item];\n });\n }\n await QueryClientService.getInstance().invalidateQueryKeys(associationQueryKeys);\n if (onError) {\n await onError(error, variables, context);\n }\n NotificationService.getInstance().fulfillNotification(context.notificationKey, NotificationUtil.wrapErrorNotificationMessage(getErrorNotificationMessage(context.item, variables, error), error), 'error');\n },\n onMutate: async (variables) => {\n const notificationKey = NotificationService.getInstance().showNotification({\n isLoading: true,\n message: getProgressNotificationMessage(previousItemRef.current, variables),\n severity: 'info',\n });\n if (resourceQueryKey) {\n if (!previousItemRef.current) {\n throw new Error('previousItem is not set');\n }\n await queryClient.cancelQueries({ queryKey: resourceQueryKey });\n const previousData = queryClient.getQueryData<TData[]>(resourceQueryKey);\n if (Array.isArray(previousData) && !Array.isArray(variables)) {\n const intermediateItem = getIntermediateItem ? getIntermediateItem(variables, previousItemRef.current) : {\n ...variables,\n id: (previousItemRef.current as GenericData).id,\n } as GenericData;\n queryClient.setQueryData<GenericData[]>(resourceQueryKey, (oldItems) => {\n return [...oldItems.filter(x => x.id !== (previousItemRef.current as GenericData).id), intermediateItem] as GenericData[];\n });\n return { item: previousItemRef.current, notificationKey, previousData };\n }\n }\n return { notificationKey };\n },\n onSuccess: async (item, variables, context) => {\n previousItemRef.current = undefined;\n await QueryClientService.getInstance().invalidateQueryKeys(associationQueryKeys);\n if (onSuccess) {\n await onSuccess(item, variables, context);\n }\n NotificationService.getInstance().fulfillNotification(context.notificationKey, getSuccessNotificationMessage(item, context), 'success');\n },\n });\n\n // Note: must be done in useMemo to avoid render loops (useMutation returns a new object every time)\n const mutate = useMemo(() => editMutation.mutate, [editMutation.mutate]);\n const isMutating = useMemo(() => editMutation.isPending, [editMutation.isPending]);\n return useMemo(() => ({ isMutating, mutate, setPreviousItem }), [isMutating, mutate, setPreviousItem]);\n};\n"],"mappings":";;;;;;;AAgCA,IAAa,KAAkF,EAC7F,yBACA,gCACA,wBACA,mCACA,kCACA,YACA,cACA,YACA,0BAC6C;CAC7C,IAAM,IAAc,EAAmB,YAAY,CAAC,CAAC,aAC/C,IAAkB,EAAc,KAAA,CAAS,GAEzC,IAAkB,GAAa,MAAgB;EACnD,EAAgB,UAAU;CAC5B,GAAG,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/hooks/useEditMutation/useEditMutation.ts"],"sourcesContent":["import { useMutation } from '@tanstack/react-query';\nimport type { ReactElement } from 'react';\nimport {\n useCallback,\n useMemo,\n useRef,\n} from 'react';\nimport { ObjectUtil } from '@gen-epix/ui-core/utils/ObjectUtil';\n\nimport { NotificationService } from '../../classes/services/NotificationService';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\nimport type { GenericData } from '../../models/data';\nimport { NotificationUtil } from '../../utils/NotificationUtil';\n\nexport type MutationContextEdit<TData> = { item?: TData; notificationKey?: string; previousData?: TData[] };\n\nexport type UseEditMutationProps<TData, TVariables = TData> = {\n readonly associationQueryKeys?: string[][];\n readonly getErrorNotificationMessage: (data: TData, variables: TVariables, error: unknown) => ReactElement | string;\n // Optional function to get an intermediate item to be set in the query cache before the mutation is completed.\n // This is useful for optimistic updates where you want to show a temporary state before the mutation is confirmed.\n // The function receives the variables and the previous item, and should return the intermediate item.\n // Only needed if the variables are different from the previous item.\n readonly getIntermediateItem?: (variables: TVariables, previousItem: TData) => TData;\n readonly getProgressNotificationMessage: (data: TData, variables: TVariables) => ReactElement | string;\n readonly getSuccessNotificationMessage: (data: TData, context: MutationContextEdit<TData>) => ReactElement | string;\n readonly onError?: (error: unknown, variables: TVariables, context: MutationContextEdit<TData>) => Promise<void> | void;\n readonly onSuccess?: (item: TData, variables: TVariables, context: MutationContextEdit<TData>) => Promise<void> | void;\n readonly queryFn?: (variables: TVariables, previousData: TData) => Promise<TData>;\n readonly resourceQueryKey?: string[];\n};\n\nexport const useEditMutation = <TData extends GenericData | GenericData[], TVariables = TData>({\n associationQueryKeys,\n getErrorNotificationMessage,\n getIntermediateItem,\n getProgressNotificationMessage,\n getSuccessNotificationMessage,\n onError,\n onSuccess,\n queryFn,\n resourceQueryKey,\n}: UseEditMutationProps<TData, TVariables>) => {\n const queryClient = QueryClientService.getInstance().queryClient;\n const previousItemRef = useRef<TData>(undefined);\n\n const setPreviousItem = useCallback((item: TData) => {\n previousItemRef.current = item;\n }, []);\n\n const mutationFn = useCallback(async (variables: TVariables) => {\n return queryFn(ObjectUtil.deepNullifyEmptyStrings(variables), previousItemRef.current);\n }, [previousItemRef, queryFn]);\n\n const editMutation = useMutation<TData, Error, TVariables, MutationContextEdit<TData>>({\n mutationFn,\n onError: async (error, variables, context) => {\n previousItemRef.current = undefined;\n if (resourceQueryKey && Array.isArray(context.previousData)) {\n queryClient.setQueryData(resourceQueryKey, (oldItems: TData[]) => {\n if (!Array.isArray(oldItems)) {\n return oldItems;\n }\n return [...oldItems.filter(x => (x as GenericData).id !== (context.item as GenericData).id), context.item];\n });\n }\n await QueryClientService.getInstance().invalidateQueryKeys(associationQueryKeys);\n if (onError) {\n await onError(error, variables, context);\n }\n NotificationService.getInstance().fulfillNotification(context.notificationKey, NotificationUtil.wrapErrorNotificationMessage(getErrorNotificationMessage(context.item, variables, error), error), 'error');\n },\n onMutate: async (variables) => {\n const notificationKey = NotificationService.getInstance().showNotification({\n isLoading: true,\n message: getProgressNotificationMessage(previousItemRef.current, variables),\n severity: 'info',\n });\n if (resourceQueryKey) {\n if (!previousItemRef.current) {\n throw new Error('previousItem is not set');\n }\n await queryClient.cancelQueries({ queryKey: resourceQueryKey });\n const previousData = queryClient.getQueryData<TData[]>(resourceQueryKey);\n if (Array.isArray(previousData) && !Array.isArray(variables)) {\n const intermediateItem = getIntermediateItem ? getIntermediateItem(variables, previousItemRef.current) : {\n ...variables,\n id: (previousItemRef.current as GenericData).id,\n } as GenericData;\n queryClient.setQueryData<GenericData[]>(resourceQueryKey, (oldItems) => {\n return [...oldItems.filter(x => x.id !== (previousItemRef.current as GenericData).id), intermediateItem] as GenericData[];\n });\n return { item: previousItemRef.current, notificationKey, previousData };\n }\n }\n return { notificationKey };\n },\n onSuccess: async (item, variables, context) => {\n previousItemRef.current = undefined;\n await QueryClientService.getInstance().invalidateQueryKeys(associationQueryKeys);\n if (onSuccess) {\n await onSuccess(item, variables, context);\n }\n NotificationService.getInstance().fulfillNotification(context.notificationKey, getSuccessNotificationMessage(item, context), 'success');\n },\n });\n\n // Note: must be done in useMemo to avoid render loops (useMutation returns a new object every time)\n const mutate = useMemo(() => editMutation.mutate, [editMutation.mutate]);\n const isMutating = useMemo(() => editMutation.isPending, [editMutation.isPending]);\n return useMemo(() => ({ isMutating, mutate, setPreviousItem }), [isMutating, mutate, setPreviousItem]);\n};\n"],"mappings":";;;;;;;AAgCA,IAAa,KAAkF,EAC7F,yBACA,gCACA,wBACA,mCACA,kCACA,YACA,cACA,YACA,0BAC6C;CAC7C,IAAM,IAAc,EAAmB,YAAY,CAAC,CAAC,aAC/C,IAAkB,EAAc,KAAA,CAAS,GAEzC,IAAkB,GAAa,MAAgB;EACnD,EAAgB,UAAU;CAC5B,GAAG,CAAC,CAAC,GAEC,IAAa,EAAY,OAAO,MAC7B,EAAQ,EAAW,wBAAwB,CAAS,GAAG,EAAgB,OAAO,GACpF,CAAC,GAAiB,CAAO,CAAC,GAEvB,IAAe,EAAkE;EACrF;EACA,SAAS,OAAO,GAAO,GAAW,MAAY;GAc5C,AAbA,EAAgB,UAAU,KAAA,GACtB,KAAoB,MAAM,QAAQ,EAAQ,YAAY,KACxD,EAAY,aAAa,IAAmB,MACrC,MAAM,QAAQ,CAAQ,IAGpB,CAAC,GAAG,EAAS,QAAO,MAAM,EAAkB,OAAQ,EAAQ,KAAqB,EAAE,GAAG,EAAQ,IAAI,IAFhG,CAGV,GAEH,MAAM,EAAmB,YAAY,CAAC,CAAC,oBAAoB,CAAoB,GAC3E,KACF,MAAM,EAAQ,GAAO,GAAW,CAAO,GAEzC,EAAoB,YAAY,CAAC,CAAC,oBAAoB,EAAQ,iBAAiB,EAAiB,6BAA6B,EAA4B,EAAQ,MAAM,GAAW,CAAK,GAAG,CAAK,GAAG,OAAO;EAC3M;EACA,UAAU,OAAO,MAAc;GAC7B,IAAM,IAAkB,EAAoB,YAAY,CAAC,CAAC,iBAAiB;IACzE,WAAW;IACX,SAAS,EAA+B,EAAgB,SAAS,CAAS;IAC1E,UAAU;GACZ,CAAC;GACD,IAAI,GAAkB;IACpB,IAAI,CAAC,EAAgB,SACnB,MAAU,MAAM,yBAAyB;IAE3C,MAAM,EAAY,cAAc,EAAE,UAAU,EAAiB,CAAC;IAC9D,IAAM,IAAe,EAAY,aAAsB,CAAgB;IACvE,IAAI,MAAM,QAAQ,CAAY,KAAK,CAAC,MAAM,QAAQ,CAAS,GAAG;KAC5D,IAAM,IAAmB,IAAsB,EAAoB,GAAW,EAAgB,OAAO,IAAI;MACvG,GAAG;MACH,IAAK,EAAgB,QAAwB;KAC/C;KAIA,OAHA,EAAY,aAA4B,IAAmB,MAClD,CAAC,GAAG,EAAS,QAAO,MAAK,EAAE,OAAQ,EAAgB,QAAwB,EAAE,GAAG,CAAgB,CACxG,GACM;MAAE,MAAM,EAAgB;MAAS;MAAiB;KAAa;IACxE;GACF;GACA,OAAO,EAAE,mBAAgB;EAC3B;EACA,WAAW,OAAO,GAAM,GAAW,MAAY;GAM7C,AALA,EAAgB,UAAU,KAAA,GAC1B,MAAM,EAAmB,YAAY,CAAC,CAAC,oBAAoB,CAAoB,GAC3E,KACF,MAAM,EAAU,GAAM,GAAW,CAAO,GAE1C,EAAoB,YAAY,CAAC,CAAC,oBAAoB,EAAQ,iBAAiB,EAA8B,GAAM,CAAO,GAAG,SAAS;EACxI;CACF,CAAC,GAGK,IAAS,QAAc,EAAa,QAAQ,CAAC,EAAa,MAAM,CAAC,GACjE,IAAa,QAAc,EAAa,WAAW,CAAC,EAAa,SAAS,CAAC;CACjF,OAAO,SAAe;EAAE;EAAY;EAAQ;CAAgB,IAAI;EAAC;EAAY;EAAQ;CAAe,CAAC;AACvG"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as e } from "../../_chunks/
|
|
2
|
-
import { t } from "../../_chunks/
|
|
1
|
+
import { t as e } from "../../_chunks/useQueryMemo.js";
|
|
2
|
+
import { t } from "../../_chunks/QueryClientService.js";
|
|
3
3
|
import { useEffect as n, useMemo as r, useState as i } from "react";
|
|
4
4
|
//#region src/hooks/useItemQuery/useItemQuery.ts
|
|
5
5
|
var a = [
|
|
@@ -7,10 +7,10 @@ var a = [
|
|
|
7
7
|
"removed",
|
|
8
8
|
"updated"
|
|
9
9
|
], o = ({ baseQueryKey: o, itemId: s, useQueryOptions: c }) => {
|
|
10
|
-
let { queryCache: l } =
|
|
10
|
+
let { queryCache: l } = t.getInstance(), [u, d] = i(t.getInstance().getItemFromCache(o, s)), f = e({
|
|
11
11
|
...c,
|
|
12
12
|
enabled: !u && c.enabled,
|
|
13
|
-
queryKey:
|
|
13
|
+
queryKey: t.getInstance().getGenericKey(o, s)
|
|
14
14
|
});
|
|
15
15
|
return n(() => {
|
|
16
16
|
let e = l.subscribe((e) => {
|
|
@@ -40,11 +40,11 @@ var a = [
|
|
|
40
40
|
u
|
|
41
41
|
]), r(() => ({
|
|
42
42
|
data: u || f.data,
|
|
43
|
-
error: u
|
|
43
|
+
error: !u && f.error,
|
|
44
44
|
isEnabled: u ? !0 : f.isEnabled,
|
|
45
|
-
isFetching: u
|
|
46
|
-
isLoading: u
|
|
47
|
-
isPending: u
|
|
45
|
+
isFetching: !u && f.isFetching,
|
|
46
|
+
isLoading: !u && f.isLoading,
|
|
47
|
+
isPending: !u && f.isPending
|
|
48
48
|
}), [
|
|
49
49
|
u,
|
|
50
50
|
f.data,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/hooks/useItemQuery/useItemQuery.ts"],"sourcesContent":["import {\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport type {\n QueryCacheNotifyEvent,\n UseQueryOptions,\n} from '@tanstack/react-query';\n\nimport type { GenericData } from '../../models/data';\nimport { useQueryMemo } from '../useQueryMemo';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\n\nexport type UseItemQueryProps<T extends GenericData, TQueryKey extends string = string> = {\n readonly baseQueryKey: TQueryKey;\n readonly itemId: string;\n readonly useQueryOptions: Omit<UseQueryOptions<T>, 'queryKey'>;\n};\n\nconst eventTypes: QueryCacheNotifyEvent['type'][] = ['added', 'removed', 'updated'];\n\nexport const useItemQuery = <T extends GenericData>({\n baseQueryKey,\n itemId,\n useQueryOptions,\n}: UseItemQueryProps<T>) => {\n const { queryCache } = QueryClientService.getInstance();\n const [itemFromCache, setItemFromCache] = useState<T>(QueryClientService.getInstance().getItemFromCache<T>(baseQueryKey, itemId));\n\n const useQueryResult = useQueryMemo({\n ...useQueryOptions,\n enabled: !itemFromCache && useQueryOptions.enabled,\n queryKey: QueryClientService.getInstance().getGenericKey(baseQueryKey, itemId),\n });\n\n useEffect(() => {\n const handleQueryCacheEvent = (event: QueryCacheNotifyEvent) => {\n if (Array.isArray(event.query.queryKey) && event.query.queryKey[0] === baseQueryKey && eventTypes.includes(event.type)) {\n if (event.query.queryKey.length === 1) {\n const list = (event.query.state.data as T[]);\n if (event.type === 'removed') {\n setItemFromCache(undefined);\n return;\n }\n if (!list) {\n return;\n }\n const newValue = list?.find(item => item.id === itemId);\n if (JSON.stringify(itemFromCache) !== JSON.stringify(newValue)) {\n setItemFromCache(newValue);\n }\n } else if (event.query.queryKey.length === 2 && (event.query.state.data as T)?.id === itemId) {\n const newValue = event.query.state.data as T;\n if (JSON.stringify(itemFromCache) !== JSON.stringify(newValue)) {\n setItemFromCache(newValue);\n }\n }\n }\n };\n\n const removeListener = queryCache.subscribe(handleQueryCacheEvent);\n return () => {\n removeListener();\n };\n }, [baseQueryKey, itemId, queryCache, itemFromCache]);\n\n\n const result = useMemo(() => {\n return {\n data: itemFromCache || useQueryResult.data,\n error: itemFromCache ? false : useQueryResult.error,\n isEnabled: itemFromCache ? true : useQueryResult.isEnabled,\n isFetching: itemFromCache ? false : useQueryResult.isFetching,\n isLoading: itemFromCache ? false : useQueryResult.isLoading,\n isPending: itemFromCache ? false : useQueryResult.isPending,\n };\n }, [itemFromCache, useQueryResult.data, useQueryResult.isLoading, useQueryResult.isPending, useQueryResult.isFetching, useQueryResult.isEnabled, useQueryResult.error]);\n\n return result;\n};\n"],"mappings":";;;;AAoBA,IAAM,IAA8C;CAAC;CAAS;CAAW;AAAS,GAErE,KAAuC,EAClD,iBACA,WACA,yBAC0B;CAC1B,IAAM,EAAE,kBAAe,EAAmB,YAAY,GAChD,CAAC,GAAe,KAAoB,EAAY,EAAmB,YAAY,CAAC,CAAC,iBAAoB,GAAc,CAAM,CAAC,GAE1H,IAAiB,EAAa;EAClC,GAAG;EACH,SAAS,CAAC,KAAiB,EAAgB;EAC3C,UAAU,EAAmB,YAAY,CAAC,CAAC,cAAc,GAAc,CAAM;CAC/E,CAAC;CA6CD,OA3CA,QAAgB;EAyBd,IAAM,IAAiB,EAAW,WAxBH,MAAiC;GAC9D,IAAI,MAAM,QAAQ,EAAM,MAAM,QAAQ,KAAK,EAAM,MAAM,SAAS,OAAO,KAAgB,EAAW,SAAS,EAAM,IAAI;
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/hooks/useItemQuery/useItemQuery.ts"],"sourcesContent":["import {\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport type {\n QueryCacheNotifyEvent,\n UseQueryOptions,\n} from '@tanstack/react-query';\n\nimport type { GenericData } from '../../models/data';\nimport { useQueryMemo } from '../useQueryMemo';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\n\nexport type UseItemQueryProps<T extends GenericData, TQueryKey extends string = string> = {\n readonly baseQueryKey: TQueryKey;\n readonly itemId: string;\n readonly useQueryOptions: Omit<UseQueryOptions<T>, 'queryKey'>;\n};\n\nconst eventTypes: QueryCacheNotifyEvent['type'][] = ['added', 'removed', 'updated'];\n\nexport const useItemQuery = <T extends GenericData>({\n baseQueryKey,\n itemId,\n useQueryOptions,\n}: UseItemQueryProps<T>) => {\n const { queryCache } = QueryClientService.getInstance();\n const [itemFromCache, setItemFromCache] = useState<T>(QueryClientService.getInstance().getItemFromCache<T>(baseQueryKey, itemId));\n\n const useQueryResult = useQueryMemo({\n ...useQueryOptions,\n enabled: !itemFromCache && useQueryOptions.enabled,\n queryKey: QueryClientService.getInstance().getGenericKey(baseQueryKey, itemId),\n });\n\n useEffect(() => {\n const handleQueryCacheEvent = (event: QueryCacheNotifyEvent) => {\n if (Array.isArray(event.query.queryKey) && event.query.queryKey[0] === baseQueryKey && eventTypes.includes(event.type)) {\n if (event.query.queryKey.length === 1) {\n const list = (event.query.state.data as T[]);\n if (event.type === 'removed') {\n setItemFromCache(undefined);\n return;\n }\n if (!list) {\n return;\n }\n const newValue = list?.find(item => item.id === itemId);\n if (JSON.stringify(itemFromCache) !== JSON.stringify(newValue)) {\n setItemFromCache(newValue);\n }\n } else if (event.query.queryKey.length === 2 && (event.query.state.data as T)?.id === itemId) {\n const newValue = event.query.state.data as T;\n if (JSON.stringify(itemFromCache) !== JSON.stringify(newValue)) {\n setItemFromCache(newValue);\n }\n }\n }\n };\n\n const removeListener = queryCache.subscribe(handleQueryCacheEvent);\n return () => {\n removeListener();\n };\n }, [baseQueryKey, itemId, queryCache, itemFromCache]);\n\n\n const result = useMemo(() => {\n return {\n data: itemFromCache || useQueryResult.data,\n error: itemFromCache ? false : useQueryResult.error,\n isEnabled: itemFromCache ? true : useQueryResult.isEnabled,\n isFetching: itemFromCache ? false : useQueryResult.isFetching,\n isLoading: itemFromCache ? false : useQueryResult.isLoading,\n isPending: itemFromCache ? false : useQueryResult.isPending,\n };\n }, [itemFromCache, useQueryResult.data, useQueryResult.isLoading, useQueryResult.isPending, useQueryResult.isFetching, useQueryResult.isEnabled, useQueryResult.error]);\n\n return result;\n};\n"],"mappings":";;;;AAoBA,IAAM,IAA8C;CAAC;CAAS;CAAW;AAAS,GAErE,KAAuC,EAClD,iBACA,WACA,yBAC0B;CAC1B,IAAM,EAAE,kBAAe,EAAmB,YAAY,GAChD,CAAC,GAAe,KAAoB,EAAY,EAAmB,YAAY,CAAC,CAAC,iBAAoB,GAAc,CAAM,CAAC,GAE1H,IAAiB,EAAa;EAClC,GAAG;EACH,SAAS,CAAC,KAAiB,EAAgB;EAC3C,UAAU,EAAmB,YAAY,CAAC,CAAC,cAAc,GAAc,CAAM;CAC/E,CAAC;CA6CD,OA3CA,QAAgB;EAyBd,IAAM,IAAiB,EAAW,WAxBH,MAAiC;GAC9D,IAAI,MAAM,QAAQ,EAAM,MAAM,QAAQ,KAAK,EAAM,MAAM,SAAS,OAAO,KAAgB,EAAW,SAAS,EAAM,IAAI,GAAG;IACtH,IAAI,EAAM,MAAM,SAAS,WAAW,GAAG;KACrC,IAAM,IAAQ,EAAM,MAAM,MAAM;KAChC,IAAI,EAAM,SAAS,WAAW;MAC5B,EAAiB,KAAA,CAAS;MAC1B;KACF;KACA,IAAI,CAAC,GACH;KAEF,IAAM,IAAW,GAAM,MAAK,MAAQ,EAAK,OAAO,CAAM;KACtD,AAAI,KAAK,UAAU,CAAa,MAAM,KAAK,UAAU,CAAQ,KAC3D,EAAiB,CAAQ;IAE7B,OAAO,IAAI,EAAM,MAAM,SAAS,WAAW,KAAM,EAAM,MAAM,MAAM,MAAY,OAAO,GAAQ;KAC5F,IAAM,IAAW,EAAM,MAAM,MAAM;KACnC,AAAI,KAAK,UAAU,CAAa,MAAM,KAAK,UAAU,CAAQ,KAC3D,EAAiB,CAAQ;IAE7B;GACF;EACF,CAEiE;EACjE,aAAa;GACX,EAAe;EACjB;CACF,GAAG;EAAC;EAAc;EAAQ;EAAY;CAAa,CAAC,GAGrC,SACN;EACL,MAAM,KAAiB,EAAe;EACtC,OAAO,MAAwB,EAAe;EAC9C,WAAW,IAAgB,KAAO,EAAe;EACjD,YAAY,MAAwB,EAAe;EACnD,WAAW,MAAwB,EAAe;EAClD,WAAW,MAAwB,EAAe;CACpD,IACC;EAAC;EAAe,EAAe;EAAM,EAAe;EAAW,EAAe;EAAW,EAAe;EAAY,EAAe;EAAW,EAAe;CAAK,CAE9J;AACT"}
|