@gen-epix/ui-client-common 4.1.0 → 4.2.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/dist/_chunks/CrudPage.js +183 -183
- package/dist/_chunks/CrudPage.js.map +1 -1
- package/dist/_chunks/QueryClientProvider.js +1 -1
- package/dist/_chunks/QueryClientProvider.js.map +1 -1
- package/dist/_chunks/Table.js +622 -603
- package/dist/_chunks/Table.js.map +1 -1
- package/dist/_chunks/UserInvitationsAdminPage.js +97 -97
- package/dist/_chunks/chunk-BV7QT456.js +1 -1
- package/dist/_chunks/chunk-BV7QT456.js.map +1 -1
- package/dist/_chunks/middleware.js +1 -1
- package/dist/_chunks/middleware.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/useColumnsMenu.js +2 -2
- package/dist/_chunks/useColumnsMenu.js.map +1 -1
- package/dist/_chunks/useMutation.js +1 -1
- package/dist/_chunks/useMutation.js.map +1 -1
- package/dist/_chunks/useQueryMemo.js +4 -4
- 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 +23 -23
- package/dist/_chunks/yup.js.map +1 -1
- package/dist/components/app/App/index.js +2 -2
- package/dist/components/app/App/index.js.map +1 -1
- package/dist/components/ui/OrganizationSwitcherDialog/index.js +31 -31
- package/dist/components/ui/UserFeedbackDialog/index.js +35 -35
- package/package.json +66 -65
- package/dist/_chunks/index.esm.js +0 -1284
- package/dist/_chunks/index.esm.js.map +0 -1
|
@@ -4,27 +4,27 @@ import { ConfigService as n } from "../classes/services/ConfigService/index.js";
|
|
|
4
4
|
import { AuthenticationService as r } from "../classes/services/AuthenticationService/index.js";
|
|
5
5
|
import { ApiService as i } from "../classes/services/ApiService/index.js";
|
|
6
6
|
import { ResponseHandler as a } from "../components/ui/ResponseHandler/index.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { t as l } from "./
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
7
|
+
import { t as o } from "./QueryClientService.js";
|
|
8
|
+
import { NotificationService as s } from "../classes/services/NotificationService/index.js";
|
|
9
|
+
import { t as c } from "./yup.js";
|
|
10
|
+
import { t as l } from "./CrudPage.js";
|
|
11
|
+
import { COMMON_QUERY_KEY as u } from "../constants/query.js";
|
|
12
|
+
import { useOrganizationOptionsQuery as d } from "../dataHooks/useOrganizationsQuery/index.js";
|
|
13
|
+
import { useUserOptionsQuery as f } from "../dataHooks/useUsersQuery/index.js";
|
|
14
|
+
import { useOrganizationAdminPolicyMapQuery as p } from "../dataHooks/useOrganizationAdminPoliciesQuery/index.js";
|
|
15
|
+
import { useInviteUserConstraintsQuery as m } from "../dataHooks/useInviteUserConstraintsQuery/index.js";
|
|
16
|
+
import { WindowService as h } from "@gen-epix/ui-core/classes/services/WindowService";
|
|
17
|
+
import { DATE_FORMAT as g } from "@gen-epix/ui-core/constants/date";
|
|
18
|
+
import { CommonDbCommandName as _ } from "@gen-epix/api-commondb";
|
|
19
|
+
import { Box as v, ListItemIcon as y, ListItemText as b, MenuItem as x, Typography as S } from "@mui/material";
|
|
20
|
+
import { useCallback as C, useEffect as w, useId as T, useMemo as E, useRef as D, useState as O } from "react";
|
|
21
|
+
import { Fragment as k, jsx as A, jsxs as j } from "react/jsx-runtime";
|
|
22
|
+
import { useTranslation as M } from "react-i18next";
|
|
23
|
+
import { array as N, object as P, string as F } from "yup";
|
|
24
|
+
import { TestIdUtil as I } from "@gen-epix/ui-core/utils/TestIdUtil";
|
|
25
|
+
import { FORM_FIELD_DEFINITION_TYPE as L } from "@gen-epix/ui-core-form/models/form";
|
|
26
|
+
import { SchemaUtil as R } from "@gen-epix/ui-core-form/utils/SchemaUtil";
|
|
27
|
+
import { useForm as z } from "react-hook-form";
|
|
28
28
|
import { withDialog as B } from "@gen-epix/ui-core-components/hoc/withDialog";
|
|
29
29
|
import { GenericForm as V } from "@gen-epix/ui-core-form/components/helpers/GenericForm";
|
|
30
30
|
import { useArray as H } from "@gen-epix/ui-core/hooks/useArray";
|
|
@@ -34,18 +34,18 @@ import G from "@mui/icons-material/Email";
|
|
|
34
34
|
import { CopyToClipboardButton as K } from "@gen-epix/ui-core-components/components/CopyToClipboardButton";
|
|
35
35
|
//#region src/pages/UserInvitationsAdminPage/UserInvitationShareDialog.tsx
|
|
36
36
|
var q = B(({ onActionsChange: t, onTitleChange: r, openProps: i }) => {
|
|
37
|
-
let { t: a } =
|
|
38
|
-
|
|
37
|
+
let { t: a } = M();
|
|
38
|
+
w(() => {
|
|
39
39
|
r(a("Invitation details for {{email}}", { email: i.item.key }));
|
|
40
40
|
}, [
|
|
41
41
|
r,
|
|
42
42
|
i.item.key,
|
|
43
43
|
a
|
|
44
44
|
]);
|
|
45
|
-
let o =
|
|
46
|
-
let e = new URL(
|
|
45
|
+
let o = E(() => e(i.item.expires_at, g.DATE), [i.item.expires_at]), s = E(() => {
|
|
46
|
+
let e = new URL(h.getInstance().window.location.href);
|
|
47
47
|
return e.search = "", e.hash = "", e.pathname = `/accept-invitation/${i.item.token}`, e.toString();
|
|
48
|
-
}, [i.item.token]), c =
|
|
48
|
+
}, [i.item.token]), c = E(() => `mailto:?subject=${a("Invitation to join {{applicationName}}", { applicationName: n.getInstance().config.applicationName })}&body=${a("Use the following link to accept the invitation: {{invitationLink}}. This link will expire: {{expiryDate}}.", {
|
|
49
49
|
expiryDate: o,
|
|
50
50
|
invitationLink: s
|
|
51
51
|
})}&to=${i.item.key}`, [
|
|
@@ -54,15 +54,15 @@ var q = B(({ onActionsChange: t, onTitleChange: r, openProps: i }) => {
|
|
|
54
54
|
i.item.key,
|
|
55
55
|
a
|
|
56
56
|
]);
|
|
57
|
-
return
|
|
57
|
+
return w(() => {
|
|
58
58
|
t([{
|
|
59
|
-
...
|
|
59
|
+
...I.createAttributes("UserInvitationShareDialog-agree"),
|
|
60
60
|
color: "primary",
|
|
61
61
|
href: c,
|
|
62
62
|
label: a("Email invitation link"),
|
|
63
|
-
startIcon: /* @__PURE__ */
|
|
63
|
+
startIcon: /* @__PURE__ */ A(G, {}),
|
|
64
64
|
variant: "contained"
|
|
65
|
-
}, /* @__PURE__ */
|
|
65
|
+
}, /* @__PURE__ */ A(K, {
|
|
66
66
|
buttonText: a("Copy invitation link to clipboard"),
|
|
67
67
|
clipboardValue: s
|
|
68
68
|
}, "copyToClipboard")]);
|
|
@@ -71,10 +71,10 @@ var q = B(({ onActionsChange: t, onTitleChange: r, openProps: i }) => {
|
|
|
71
71
|
c,
|
|
72
72
|
a,
|
|
73
73
|
s
|
|
74
|
-
]), /* @__PURE__ */
|
|
74
|
+
]), /* @__PURE__ */ j(v, { children: [/* @__PURE__ */ A(v, { children: /* @__PURE__ */ A(S, { children: a("The invitation for {{email}} will expire on {{expiryDate}}.", {
|
|
75
75
|
email: i.item.key,
|
|
76
76
|
expiryDate: o
|
|
77
|
-
}) }) }), /* @__PURE__ */
|
|
77
|
+
}) }) }), /* @__PURE__ */ A(v, {
|
|
78
78
|
sx: { marginY: 1 },
|
|
79
79
|
children: a("Invitation link: {{invitationLink}}", {
|
|
80
80
|
email: i.item.key,
|
|
@@ -86,64 +86,64 @@ var q = B(({ onActionsChange: t, onTitleChange: r, openProps: i }) => {
|
|
|
86
86
|
fullWidth: !0,
|
|
87
87
|
maxWidth: "md",
|
|
88
88
|
testId: "UserInvitationShareDialog"
|
|
89
|
-
}), J = B(({ onActionsChange: e, onClose: t, onTitleChange: n, openProps:
|
|
90
|
-
let { t:
|
|
91
|
-
definition:
|
|
92
|
-
label:
|
|
89
|
+
}), J = B(({ onActionsChange: e, onClose: t, onTitleChange: n, openProps: l }) => {
|
|
90
|
+
let { t: d } = M(), f = T(), [p, m] = O(null), h = E(() => P().shape({ bearerToken: F().required() }), []), g = E(() => [{
|
|
91
|
+
definition: L.TEXTFIELD,
|
|
92
|
+
label: d`Bearer Token`,
|
|
93
93
|
multiline: !0,
|
|
94
94
|
name: "bearerToken",
|
|
95
95
|
rows: 10
|
|
96
|
-
}], [
|
|
97
|
-
resolver:
|
|
96
|
+
}], [d]), _ = z({
|
|
97
|
+
resolver: c(h, void 0, { raw: !0 }),
|
|
98
98
|
values: { bearerToken: "" }
|
|
99
|
-
}), { handleSubmit:
|
|
99
|
+
}), { handleSubmit: y } = _, b = C(async (e) => {
|
|
100
100
|
try {
|
|
101
|
-
r.getInstance().temporaryToken = e.bearerToken, await i.getInstance().organizationApi.userRegistrationsPostOne(
|
|
102
|
-
message:
|
|
101
|
+
r.getInstance().temporaryToken = e.bearerToken, await i.getInstance().organizationApi.userRegistrationsPostOne(l.item.token), s.getInstance().showNotification({
|
|
102
|
+
message: d`Invitation has been consumed by bearer token`,
|
|
103
103
|
severity: "success"
|
|
104
104
|
}), t();
|
|
105
105
|
} catch (e) {
|
|
106
|
-
|
|
106
|
+
m(e);
|
|
107
107
|
} finally {
|
|
108
108
|
delete r.getInstance().temporaryToken;
|
|
109
|
-
let e =
|
|
110
|
-
await
|
|
109
|
+
let e = o.getInstance().getQueryKeyDependencies([u.USER_INVITATIONS], !0);
|
|
110
|
+
await o.getInstance().invalidateQueryKeys(e);
|
|
111
111
|
}
|
|
112
112
|
}, [
|
|
113
113
|
t,
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
l.item.token,
|
|
115
|
+
d
|
|
116
116
|
]);
|
|
117
|
-
return
|
|
118
|
-
n(
|
|
117
|
+
return w(() => {
|
|
118
|
+
n(d`Consume invitation with bearer token`);
|
|
119
119
|
}, [
|
|
120
120
|
n,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
]),
|
|
121
|
+
l.item.key,
|
|
122
|
+
d
|
|
123
|
+
]), w(() => {
|
|
124
124
|
e([{
|
|
125
|
-
...
|
|
125
|
+
...I.createAttributes("UserInvitationConsumeDialog-agree"),
|
|
126
126
|
color: "primary",
|
|
127
|
-
disabled: !!
|
|
128
|
-
form:
|
|
129
|
-
label:
|
|
127
|
+
disabled: !!p,
|
|
128
|
+
form: f,
|
|
129
|
+
label: d("Submit"),
|
|
130
130
|
type: "submit",
|
|
131
131
|
variant: "contained"
|
|
132
132
|
}]);
|
|
133
133
|
}, [
|
|
134
134
|
e,
|
|
135
|
+
d,
|
|
135
136
|
f,
|
|
136
|
-
p
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
error: m,
|
|
137
|
+
p
|
|
138
|
+
]), /* @__PURE__ */ A(v, { children: /* @__PURE__ */ A(a, {
|
|
139
|
+
error: p,
|
|
140
140
|
shouldHideActionButtons: !0,
|
|
141
|
-
children: /* @__PURE__ */
|
|
142
|
-
formFieldDefinitions:
|
|
143
|
-
formId:
|
|
144
|
-
formMethods:
|
|
145
|
-
onSubmit: b
|
|
146
|
-
schema:
|
|
141
|
+
children: /* @__PURE__ */ A(V, {
|
|
142
|
+
formFieldDefinitions: g,
|
|
143
|
+
formId: f,
|
|
144
|
+
formMethods: _,
|
|
145
|
+
onSubmit: y(b),
|
|
146
|
+
schema: h
|
|
147
147
|
})
|
|
148
148
|
}) });
|
|
149
149
|
}, {
|
|
@@ -152,45 +152,45 @@ var q = B(({ onActionsChange: t, onTitleChange: r, openProps: i }) => {
|
|
|
152
152
|
maxWidth: "md",
|
|
153
153
|
testId: "UserInvitationConsumeDialog"
|
|
154
154
|
}), Y = () => {
|
|
155
|
-
let { t: e } =
|
|
155
|
+
let { t: e } = M(), n = d(), r = m(), a = f(), o = p(), s = E(() => !n?.options?.length || !r?.data ? [] : n.options.filter((e) => r.data.organization_ids.includes(e.value)), [n.options, r.data]), c = E(() => r?.data ? r.data.roles.map((e) => ({
|
|
156
156
|
label: e,
|
|
157
157
|
value: e
|
|
158
|
-
})) : [], [r.data]),
|
|
158
|
+
})) : [], [r.data]), h = H([
|
|
159
159
|
r,
|
|
160
160
|
n,
|
|
161
161
|
a,
|
|
162
162
|
o
|
|
163
|
-
]), g =
|
|
164
|
-
description:
|
|
165
|
-
key:
|
|
166
|
-
organization_id:
|
|
167
|
-
roles:
|
|
168
|
-
}), []), B =
|
|
163
|
+
]), g = D(null), v = D(null), S = C(async (e) => (await i.getInstance().organizationApi.userInvitationsGetAll(null, null, { signal: e }))?.data, []), w = C(async (e) => await i.getInstance().organizationApi.userInvitationsDeleteOne(e.id), []), T = C(async (e) => (await i.getInstance().organizationApi.inviteUser({ ...e })).data, []), O = C((e) => e.key, []), z = E(() => P().shape({
|
|
164
|
+
description: R.description,
|
|
165
|
+
key: F().max(100).transform((e) => e === "" ? void 0 : e),
|
|
166
|
+
organization_id: F().uuid4().required().max(100),
|
|
167
|
+
roles: N().min(1).required()
|
|
168
|
+
}), []), B = C((e) => {
|
|
169
169
|
g.current.open({ item: e });
|
|
170
|
-
}, []), V =
|
|
170
|
+
}, []), V = C((e) => {
|
|
171
171
|
g.current.open({ item: e.row });
|
|
172
|
-
}, []), G =
|
|
172
|
+
}, []), G = E(() => {
|
|
173
173
|
let t = [];
|
|
174
174
|
return t.push({
|
|
175
|
-
definition:
|
|
175
|
+
definition: L.TEXTFIELD,
|
|
176
176
|
infoMessage: e`If known, fill in the user's key. This is typically the user's email address, but can be any string depending on the Identity Provider. Filling in a key makes the invitation more secure. If left empty, the invitation can be consumed by anyone with the invite link.`,
|
|
177
177
|
label: e`Key`,
|
|
178
178
|
name: "key"
|
|
179
179
|
}, {
|
|
180
|
-
definition:
|
|
180
|
+
definition: L.AUTOCOMPLETE,
|
|
181
181
|
label: e`Organization`,
|
|
182
182
|
loading: n.isLoading,
|
|
183
183
|
name: "organization_id",
|
|
184
184
|
options: s
|
|
185
185
|
}, {
|
|
186
|
-
definition:
|
|
186
|
+
definition: L.AUTOCOMPLETE,
|
|
187
187
|
label: e`Roles`,
|
|
188
188
|
loading: r.isLoading,
|
|
189
189
|
multiple: !0,
|
|
190
190
|
name: "roles",
|
|
191
191
|
options: c
|
|
192
192
|
}, {
|
|
193
|
-
definition:
|
|
193
|
+
definition: L.TEXTFIELD,
|
|
194
194
|
label: e`Description`,
|
|
195
195
|
name: "description"
|
|
196
196
|
}), t;
|
|
@@ -200,13 +200,13 @@ var q = B(({ onActionsChange: t, onTitleChange: r, openProps: i }) => {
|
|
|
200
200
|
n.isLoading,
|
|
201
201
|
c,
|
|
202
202
|
r.isLoading
|
|
203
|
-
]), K =
|
|
203
|
+
]), K = C((t) => [/* @__PURE__ */ j(x, {
|
|
204
204
|
onClick: () => g.current.open({ item: t.row }),
|
|
205
|
-
children: [/* @__PURE__ */
|
|
206
|
-
}, "custom-action-1"), /* @__PURE__ */
|
|
207
|
-
onClick: () =>
|
|
208
|
-
children: [/* @__PURE__ */
|
|
209
|
-
}, "custom-action-2")], [e]), Y =
|
|
205
|
+
children: [/* @__PURE__ */ A(y, { children: /* @__PURE__ */ A(U, { fontSize: "small" }) }), /* @__PURE__ */ A(b, { children: e`Send invitation` })]
|
|
206
|
+
}, "custom-action-1"), /* @__PURE__ */ j(x, {
|
|
207
|
+
onClick: () => v.current.open({ item: t.row }),
|
|
208
|
+
children: [/* @__PURE__ */ A(y, { children: /* @__PURE__ */ A(W, { fontSize: "small" }) }), /* @__PURE__ */ A(b, { children: e`Consume invitation (advanced)` })]
|
|
209
|
+
}, "custom-action-2")], [e]), Y = E(() => [
|
|
210
210
|
t.createTextColumn({
|
|
211
211
|
id: "key",
|
|
212
212
|
name: e`Key`
|
|
@@ -240,31 +240,31 @@ var q = B(({ onActionsChange: t, onTitleChange: r, openProps: i }) => {
|
|
|
240
240
|
a.options,
|
|
241
241
|
c
|
|
242
242
|
]);
|
|
243
|
-
return /* @__PURE__ */
|
|
244
|
-
/* @__PURE__ */
|
|
243
|
+
return /* @__PURE__ */ j(k, { children: [
|
|
244
|
+
/* @__PURE__ */ A(l, {
|
|
245
245
|
createItemButtonText: e`Invite user`,
|
|
246
246
|
createItemDialogTitle: e`Create new user invitation`,
|
|
247
247
|
createOne: T,
|
|
248
|
-
crudCommandType:
|
|
248
|
+
crudCommandType: _.UserInvitationCrudCommand,
|
|
249
249
|
customOnRowClick: V,
|
|
250
250
|
defaultSortByField: "key",
|
|
251
251
|
defaultSortDirection: "asc",
|
|
252
|
-
deleteOne:
|
|
252
|
+
deleteOne: w,
|
|
253
253
|
extraActionsFactory: K,
|
|
254
|
-
fetchAll:
|
|
254
|
+
fetchAll: S,
|
|
255
255
|
formFieldDefinitions: G,
|
|
256
|
-
getName:
|
|
256
|
+
getName: O,
|
|
257
257
|
itemName: e`User invitation`,
|
|
258
|
-
loadables:
|
|
258
|
+
loadables: h,
|
|
259
259
|
onCreateSuccess: B,
|
|
260
|
-
resourceQueryKeyBase:
|
|
261
|
-
schema:
|
|
260
|
+
resourceQueryKeyBase: u.USER_INVITATIONS,
|
|
261
|
+
schema: z,
|
|
262
262
|
tableColumns: Y,
|
|
263
|
-
testIdAttributes:
|
|
263
|
+
testIdAttributes: I.createAttributes("UserInvitationsAdminPage"),
|
|
264
264
|
title: e`User invitations`
|
|
265
265
|
}),
|
|
266
|
-
/* @__PURE__ */
|
|
267
|
-
/* @__PURE__ */
|
|
266
|
+
/* @__PURE__ */ A(q, { ref: g }),
|
|
267
|
+
/* @__PURE__ */ A(J, { ref: v })
|
|
268
268
|
] });
|
|
269
269
|
};
|
|
270
270
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as e from "react";
|
|
2
|
-
//#region ../../node_modules/.pnpm/react-router@7.18.3_react-dom@19.
|
|
2
|
+
//#region ../../node_modules/.pnpm/react-router@7.18.3_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/react-router/dist/development/chunk-BV7QT456.mjs
|
|
3
3
|
var t = (e) => {
|
|
4
4
|
throw TypeError(e);
|
|
5
5
|
}, n = (e, n, r) => n.has(e) || t("Cannot " + r), r = (e, t, r) => (n(e, t, "read from private field"), r ? r.call(e) : t.get(e)), i = (e, n, r) => n.has(e) ? t("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(e) : n.set(e, r), a = (e, t, r, i) => (n(e, t, "write to private field"), i ? i.call(e, r) : t.set(e, r), r), o = /^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i, s = /^[\\/]{2}/;
|