@krak-stack/auth 0.1.56 → 0.1.58
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/access.d.ts +93 -0
- package/dist/access.js +97 -0
- package/dist/admin/api.group.d.ts +7 -0
- package/dist/admin/api.group.js +1 -1
- package/dist/admin/schema.d.ts +2 -0
- package/dist/admin/schema.js +4 -0
- package/dist/api.d.ts +23 -0
- package/dist/components/api-key-edit-form.d.ts +20 -0
- package/dist/components/api-key-edit-form.js +50 -0
- package/dist/components/api-key-rate-limit.d.ts +18 -0
- package/dist/components/api-key-rate-limit.js +29 -0
- package/dist/components/api-key-referrers.d.ts +8 -0
- package/dist/components/api-key-referrers.js +24 -0
- package/dist/components/api-key.d.ts +1 -0
- package/dist/components/api-key.js +20 -1
- package/dist/components/auth-client-api.d.ts +15 -0
- package/dist/components/auth-provider.d.ts +11 -1
- package/dist/components/auth-provider.js +29 -1
- package/dist/components/index.d.ts +3 -1
- package/dist/components/index.js +2 -1
- package/dist/components/organization-switcher.d.ts +58 -3
- package/dist/components/organization-switcher.js +253 -70
- package/dist/components/user-button.d.ts +41 -3
- package/dist/components/user-button.js +134 -33
- package/dist/extra/api.group.d.ts +112 -103
- package/dist/extra/api.group.js +20 -1
- package/dist/extra/schema.d.ts +7 -0
- package/dist/extra/schema.js +18 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.js +1 -0
- package/dist/service.d.ts +26 -0
- package/package.json +5 -1
|
@@ -5,16 +5,18 @@ import { FormBuilder, FormReact } from "@lucas-barake/effect-form-react";
|
|
|
5
5
|
import {} from "@tanstack/react-table";
|
|
6
6
|
import { Effect, Option, Schema } from "effect";
|
|
7
7
|
import { AsyncResult, Atom } from "effect/unstable/reactivity";
|
|
8
|
-
import { Building2, Check, ChevronsUpDown, Copy, KeyRound, LogOut, Mail, PencilIcon, Plus, Trash2, UserIcon, UserPlus, Users, X, } from "lucide-react";
|
|
8
|
+
import { ArrowLeft, Building2, Check, ChevronsUpDown, Copy, KeyRound, LogOut, Mail, PencilIcon, Plus, Trash2, UserIcon, UserPlus, Users, X, } from "lucide-react";
|
|
9
9
|
import { createContext, useContext, useEffect, useEffectEvent, useRef, useState, } from "react";
|
|
10
10
|
import { DataTable, DataTableRelationshipCell, } from "@/components/ui/data-table";
|
|
11
|
-
import { ErrorMessage, ImageField, SelectField, SubmitButton, SubmitError, TextField, } from "@/components/ui/effect-form";
|
|
11
|
+
import { ErrorMessage, ImageField, SelectField, SubmitButton, SubmitError, TextAreaField, TextField, } from "@/components/ui/effect-form";
|
|
12
12
|
import { EditingLocaleSwitcher } from "@/components/ui/editing-locale-switcher";
|
|
13
13
|
import { AppBrand } from "@/components/ui/app-brand";
|
|
14
14
|
import { Field, FieldLabel, FieldSet } from "@/components/ui/field";
|
|
15
15
|
import { Input } from "@/components/ui/input";
|
|
16
16
|
import { Badge } from "@/components/ui/badge";
|
|
17
17
|
import { Button } from "@/components/ui/button";
|
|
18
|
+
import { Checkbox } from "@/components/ui/checkbox";
|
|
19
|
+
import { CopyButton } from "@/components/ui/copy-button";
|
|
18
20
|
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "@/components/ui/dialog";
|
|
19
21
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu";
|
|
20
22
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select";
|
|
@@ -23,14 +25,17 @@ import { OrganizationEmail, OrganizationAddress, OrganizationMetadata, Organizat
|
|
|
23
25
|
import { isOrganizationRole, normalizeOrganizationRole, normalizeOrganizationRoles, organizationRoles, } from "../roles";
|
|
24
26
|
import { authClientApi } from "./auth-client-api";
|
|
25
27
|
import { useKrakstackAuth } from "./auth-provider";
|
|
26
|
-
import { createApiKey } from "./api-key";
|
|
28
|
+
import { createApiKey, parseApiKeyReferrers } from "./api-key";
|
|
29
|
+
import { ApiKeyEditForm } from "./api-key-edit-form";
|
|
30
|
+
import { ApiKeyRateLimit, apiKeyUsagePercent } from "./api-key-rate-limit";
|
|
31
|
+
import { ApiKeyReferrers } from "./api-key-referrers";
|
|
27
32
|
import { useOpenedOnce } from "./hooks";
|
|
28
33
|
import { invitationDisplayStatus, isInvitationExpired, useInvitationExpirationClock, } from "./invitation-expiration";
|
|
29
34
|
import { ExtraUploadedAsset } from "../extra/schema";
|
|
30
35
|
import { assetPath, assetUrl, cn } from "./utils";
|
|
31
36
|
const messages = {
|
|
32
37
|
en: {
|
|
33
|
-
|
|
38
|
+
organization_back: "Back",
|
|
34
39
|
organization_contact: "Contact methods",
|
|
35
40
|
organization_contact_add_email: "Add email",
|
|
36
41
|
organization_contact_add_phone: "Add phone",
|
|
@@ -102,6 +107,7 @@ const messages = {
|
|
|
102
107
|
organization_member_role_error: "Could not update the member role.",
|
|
103
108
|
organization_member_user: "User",
|
|
104
109
|
organization_members_description: "Review active members, update roles, and remove access when needed.",
|
|
110
|
+
organization_members_dialog_description: "Manage members and invitations for {name}.",
|
|
105
111
|
organization_members_empty: "No members found.",
|
|
106
112
|
organization_members_heading: "Organization members",
|
|
107
113
|
organization_members_load_error: "Could not load organization members.",
|
|
@@ -122,24 +128,50 @@ const messages = {
|
|
|
122
128
|
organization_translation_name: "Name",
|
|
123
129
|
organization_update_error: "Could not update the organization.",
|
|
124
130
|
table_empty: "No results.",
|
|
131
|
+
user_api_key_back: "Back",
|
|
132
|
+
user_api_key_create_description: "Configure a new API key for this organization.",
|
|
125
133
|
user_api_key_create_error: "Could not create the API key.",
|
|
134
|
+
user_api_key_create_title: "Create API key",
|
|
135
|
+
user_api_key_copied: "Copied",
|
|
136
|
+
user_api_key_copy: "Copy",
|
|
126
137
|
user_api_key_created_description: "Copy this key now. You will not be able to see it again.",
|
|
127
138
|
user_api_key_created_title: "API key created",
|
|
128
139
|
user_api_key_delete_error: "Could not delete the API key.",
|
|
129
140
|
user_api_key_disabled: "Disabled",
|
|
141
|
+
user_api_key_edit_description: "Update the key name, status, and allowed referrers.",
|
|
142
|
+
user_api_key_edit_title: "Edit API key",
|
|
130
143
|
user_api_key_enabled: "Enabled",
|
|
131
144
|
user_api_key_hidden: "Secret hidden",
|
|
132
145
|
user_api_key_name: "Key name",
|
|
146
|
+
user_api_key_no_permissions: "No permissions",
|
|
147
|
+
user_api_key_permissions: "Permissions",
|
|
148
|
+
user_api_key_permissions_description: "Choose the project permissions this API key should receive.",
|
|
149
|
+
user_api_key_rate_limit: "Rate limit",
|
|
150
|
+
user_api_key_referrers: "Allowed referrers (optional)",
|
|
151
|
+
user_api_key_referrers_any: "Any referrer",
|
|
152
|
+
user_api_key_referrers_column: "Referrers",
|
|
153
|
+
user_api_key_referrers_description: "Enter any number of URLs, separated by commas or new lines. Leave empty to allow any referrer.",
|
|
154
|
+
user_api_key_referrers_error: "{referrer} is not a valid HTTP(S) URL.",
|
|
155
|
+
user_api_key_referrers_placeholder: "https://app.example.com\nhttps://admin.example.com",
|
|
133
156
|
user_api_key_starts_with: "Starts with {start}",
|
|
134
157
|
user_api_key_status: "Status",
|
|
158
|
+
user_api_key_unlimited: "Unlimited",
|
|
159
|
+
user_api_key_update_error: "Could not update the API key.",
|
|
160
|
+
user_api_key_usage: "API key usage",
|
|
161
|
+
user_api_key_window_days: "{count}d",
|
|
162
|
+
user_api_key_window_hours: "{count}h",
|
|
163
|
+
user_api_key_window_minutes: "{count}m",
|
|
164
|
+
user_api_key_window_none: "None",
|
|
165
|
+
user_api_key_window_seconds: "{count}s",
|
|
135
166
|
user_api_keys_load_error: "Could not load API keys.",
|
|
167
|
+
user_api_keys_organization_description: "Create and manage API keys for {name}.",
|
|
136
168
|
user_api_keys_title: "API keys",
|
|
137
169
|
user_button_api_keys: "API keys",
|
|
138
170
|
user_delete: "Delete",
|
|
139
171
|
user_loading: "Loading...",
|
|
140
172
|
},
|
|
141
173
|
fr: {
|
|
142
|
-
|
|
174
|
+
organization_back: "Retour",
|
|
143
175
|
organization_contact: "Moyens de contact",
|
|
144
176
|
organization_contact_add_email: "Ajouter un courriel",
|
|
145
177
|
organization_contact_add_phone: "Ajouter un téléphone",
|
|
@@ -211,6 +243,7 @@ const messages = {
|
|
|
211
243
|
organization_member_role_error: "Impossible de modifier le rôle du membre.",
|
|
212
244
|
organization_member_user: "Utilisateur",
|
|
213
245
|
organization_members_description: "Consultez les membres actifs, modifiez les rôles et retirez les accès au besoin.",
|
|
246
|
+
organization_members_dialog_description: "Gérez les membres et les invitations de {name}.",
|
|
214
247
|
organization_members_empty: "Aucun membre trouvé.",
|
|
215
248
|
organization_members_heading: "Membres de l'organisation",
|
|
216
249
|
organization_members_load_error: "Impossible de charger les membres de l'organisation.",
|
|
@@ -231,17 +264,43 @@ const messages = {
|
|
|
231
264
|
organization_translation_name: "Nom",
|
|
232
265
|
organization_update_error: "Impossible de mettre à jour l'organisation.",
|
|
233
266
|
table_empty: "Aucun résultat.",
|
|
267
|
+
user_api_key_back: "Retour",
|
|
268
|
+
user_api_key_create_description: "Configurez une nouvelle clé API pour cette organisation.",
|
|
234
269
|
user_api_key_create_error: "Impossible de créer la clé API.",
|
|
270
|
+
user_api_key_create_title: "Créer une clé API",
|
|
271
|
+
user_api_key_copied: "Copié",
|
|
272
|
+
user_api_key_copy: "Copier",
|
|
235
273
|
user_api_key_created_description: "Copiez cette clé maintenant. Vous ne pourrez plus la voir.",
|
|
236
274
|
user_api_key_created_title: "Clé API créée",
|
|
237
275
|
user_api_key_delete_error: "Impossible de supprimer la clé API.",
|
|
238
276
|
user_api_key_disabled: "Désactivée",
|
|
277
|
+
user_api_key_edit_description: "Mettez à jour le nom, le statut et les référents autorisés de la clé.",
|
|
278
|
+
user_api_key_edit_title: "Modifier la clé API",
|
|
239
279
|
user_api_key_enabled: "Activée",
|
|
240
280
|
user_api_key_hidden: "Secret masqué",
|
|
241
281
|
user_api_key_name: "Nom de la clé",
|
|
282
|
+
user_api_key_no_permissions: "Aucune autorisation",
|
|
283
|
+
user_api_key_permissions: "Autorisations",
|
|
284
|
+
user_api_key_permissions_description: "Choisissez les autorisations de projet à attribuer à cette clé API.",
|
|
285
|
+
user_api_key_rate_limit: "Limite de débit",
|
|
286
|
+
user_api_key_referrers: "Référents autorisés (facultatifs)",
|
|
287
|
+
user_api_key_referrers_any: "Tout référent",
|
|
288
|
+
user_api_key_referrers_column: "Référents",
|
|
289
|
+
user_api_key_referrers_description: "Saisissez autant d'URL que nécessaire, séparées par des virgules ou des sauts de ligne. Laissez vide pour autoriser tout référent.",
|
|
290
|
+
user_api_key_referrers_error: "{referrer} n'est pas une URL HTTP(S) valide.",
|
|
291
|
+
user_api_key_referrers_placeholder: "https://app.example.com\nhttps://admin.example.com",
|
|
242
292
|
user_api_key_starts_with: "Commence par {start}",
|
|
243
293
|
user_api_key_status: "Statut",
|
|
294
|
+
user_api_key_unlimited: "Illimitée",
|
|
295
|
+
user_api_key_update_error: "Impossible de mettre à jour la clé API.",
|
|
296
|
+
user_api_key_usage: "Utilisation de la clé API",
|
|
297
|
+
user_api_key_window_days: "{count} j",
|
|
298
|
+
user_api_key_window_hours: "{count} h",
|
|
299
|
+
user_api_key_window_minutes: "{count} min",
|
|
300
|
+
user_api_key_window_none: "Aucune",
|
|
301
|
+
user_api_key_window_seconds: "{count} s",
|
|
244
302
|
user_api_keys_load_error: "Impossible de charger les clés API.",
|
|
303
|
+
user_api_keys_organization_description: "Créez et gérez les clés API de {name}.",
|
|
245
304
|
user_api_keys_title: "Clés API",
|
|
246
305
|
user_button_api_keys: "Clés API",
|
|
247
306
|
user_delete: "Supprimer",
|
|
@@ -479,7 +538,9 @@ const organizationFormFields = {
|
|
|
479
538
|
const inviteMemberFormBuilder = FormBuilder.empty
|
|
480
539
|
.addField("email", Schema.NonEmptyString)
|
|
481
540
|
.addField("role", Schema.String);
|
|
482
|
-
const apiKeyFormBuilder = FormBuilder.empty
|
|
541
|
+
const apiKeyFormBuilder = FormBuilder.empty
|
|
542
|
+
.addField("name", Schema.NonEmptyString)
|
|
543
|
+
.addField("referrers", Schema.String);
|
|
483
544
|
const slugify = (value) => value
|
|
484
545
|
.trim()
|
|
485
546
|
.toLowerCase()
|
|
@@ -755,7 +816,7 @@ const organizationMetadataFromForm = async (value, m, uploadImage, existingMetad
|
|
|
755
816
|
addresses,
|
|
756
817
|
};
|
|
757
818
|
};
|
|
758
|
-
export function OrganizationSwitcher({ authClient: providedAuthClient, baseUrl, side = "bottom", className, defaultDialog = null, features, hideTrigger = false, menuActions, renderUnauthenticated, allowedOrganizationIds, messages, dialog: controlledDialog, onChange, onCreate, onDialogChange, }) {
|
|
819
|
+
export function OrganizationSwitcher({ authClient: providedAuthClient, baseUrl, side = "bottom", className, defaultDialog = null, features, hideTrigger = false, menuActions, renderUnauthenticated, allowedOrganizationIds, messages, dialog: controlledDialog, onChange, onCreate, onDialogChange, apiKeyPermissions, }) {
|
|
759
820
|
const auth = useKrakstackAuth();
|
|
760
821
|
const authClient = providedAuthClient ?? auth?.authClient;
|
|
761
822
|
if (!authClient) {
|
|
@@ -886,14 +947,16 @@ export function OrganizationSwitcher({ authClient: providedAuthClient, baseUrl,
|
|
|
886
947
|
setDialog((current) => open ? "manage" : current === "manage" ? null : current);
|
|
887
948
|
}, children: _jsxs(DialogContent, { className: "max-h-[85vh] overflow-y-auto sm:max-w-2xl", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { className: "text-2xl", children: m.organization_switcher_manage() }), _jsx(DialogDescription, { children: m.organization_edit_description() }), _jsx("div", { className: "pt-2", children: _jsx(EditingLocaleSwitcher, { value: editingOrganizationLocale, onValueChange: setEditingOrganizationLocale }) })] }), _jsx(Separator, {}), activeOrganization.data && canUpdateOrganization ? (_jsx(EditOrganizationSection, { authClient: authClient, baseUrl: baseUrl, editingLocale: editingOrganizationLocale, organization: activeOrganization.data, onUpdated: refresh })) : null] }) }), _jsx(Dialog, { open: dialog === "members", onOpenChange: (open) => {
|
|
888
949
|
setDialog((current) => open ? "members" : current === "members" ? null : current);
|
|
889
|
-
}, children:
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
950
|
+
}, children: _jsx(DialogContent, { className: "max-h-[85vh] overflow-y-auto sm:max-w-4xl", children: activeOrganization.data ? (_jsx(OrganizationMembersManager, { authClient: authClient, baseUrl: baseUrl, canManageMembers: canManageApiKeys, organization: activeOrganization.data, currentUserId: session.data.user.id, active: dialog === "members", onLeft: async () => {
|
|
951
|
+
setDialog(null);
|
|
952
|
+
auth?.refreshAuth();
|
|
953
|
+
await refresh();
|
|
954
|
+
onChange?.(null);
|
|
955
|
+
} })) : null }) }), _jsx(Dialog, { open: dialog === "apiKeys" && canManageApiKeys, onOpenChange: (open) => {
|
|
895
956
|
setDialog((current) => open ? "apiKeys" : current === "apiKeys" ? null : current);
|
|
896
|
-
}, children:
|
|
957
|
+
}, children: _jsx(DialogContent, { className: "max-h-[85vh] min-w-0 overflow-x-hidden overflow-y-auto sm:max-w-3xl", children: activeOrganization.data ? (_jsx(OrganizationApiKeyManager, { authClient: authClient, organization: activeOrganization.data, active: dialog === "apiKeys" && canManageApiKeys, permissions: apiKeyPermissions ??
|
|
958
|
+
auth?.access?.organizationApiKeyPermissions ??
|
|
959
|
+
{} })) : null }) }), _jsx(Dialog, { open: dialog === "invitations" && canViewOrganizationInvitations, onOpenChange: (open) => {
|
|
897
960
|
setDialog((current) => open ? "invitations" : current === "invitations" ? null : current);
|
|
898
961
|
}, children: _jsxs(DialogContent, { className: "max-h-[85vh] overflow-y-auto sm:max-w-4xl", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { className: "text-2xl", children: m.organization_user_invitations_title() }), _jsx(DialogDescription, { children: m.organization_user_invitations_description() })] }), _jsx(Separator, {}), _jsx(UserInvitationsManager, { authClient: authClient, baseUrl: baseUrl, invitations: userInvitations, loading: loadingUserInvitations, error: userInvitationsError, ...(activeOrganization.data
|
|
899
962
|
? { activeOrganizationId: activeOrganization.data.id }
|
|
@@ -1161,6 +1224,7 @@ function OrganizationMembersManager({ authClient, baseUrl, canManageMembers, org
|
|
|
1161
1224
|
: emptyOrganizationMembersAtom;
|
|
1162
1225
|
const membersResult = useAtomValue(membersAtom);
|
|
1163
1226
|
const refreshMembers = useAtomRefresh(membersAtom);
|
|
1227
|
+
const [inviting, setInviting] = useState(false);
|
|
1164
1228
|
const [error, setError] = useState(null);
|
|
1165
1229
|
const [cancellingInvitationId, setCancellingInvitationId] = useState(null);
|
|
1166
1230
|
const [leavingOrganization, setLeavingOrganization] = useState(false);
|
|
@@ -1223,8 +1287,10 @@ function OrganizationMembersManager({ authClient, baseUrl, canManageMembers, org
|
|
|
1223
1287
|
const resetInvitation = useAtomSet(inviteForm.reset);
|
|
1224
1288
|
const inviteResult = useAtomValue(inviteForm.submit);
|
|
1225
1289
|
useEffect(() => {
|
|
1226
|
-
if (AsyncResult.isSuccess(inviteResult))
|
|
1227
|
-
|
|
1290
|
+
if (!AsyncResult.isSuccess(inviteResult))
|
|
1291
|
+
return;
|
|
1292
|
+
resetInvitation();
|
|
1293
|
+
setInviting(false);
|
|
1228
1294
|
}, [inviteResult, resetInvitation]);
|
|
1229
1295
|
const updateRole = async (member, role) => {
|
|
1230
1296
|
setError(null);
|
|
@@ -1286,45 +1352,51 @@ function OrganizationMembersManager({ authClient, baseUrl, canManageMembers, org
|
|
|
1286
1352
|
}
|
|
1287
1353
|
refreshMembers();
|
|
1288
1354
|
};
|
|
1289
|
-
return (_jsxs(
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
gallery: false,
|
|
1304
|
-
rowActions: {
|
|
1305
|
-
items: memberRowActions({
|
|
1355
|
+
return (_jsxs(_Fragment, { children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { className: "text-2xl", children: inviting
|
|
1356
|
+
? m.organization_invite_member_title()
|
|
1357
|
+
: m.organization_members_title() }), _jsx(DialogDescription, { children: inviting
|
|
1358
|
+
? m.organization_invite_member_description()
|
|
1359
|
+
: m.organization_members_dialog_description({
|
|
1360
|
+
name: organization.name,
|
|
1361
|
+
}) }), inviting ? (_jsxs(Button, { className: "mt-2 w-fit", onClick: () => setInviting(false), type: "button", variant: "secondary", children: [_jsx(ArrowLeft, {}), m.organization_back()] })) : canInviteMembers ? (_jsxs(Button, { className: "mt-2 w-fit", onClick: () => setInviting(true), type: "button", children: [_jsx(UserPlus, {}), m.organization_invite_member_title()] })) : null] }), _jsx(Separator, {}), _jsxs("div", { className: "flex min-w-0 flex-col gap-5", children: [inviting ? (_jsx(inviteForm.Initialize, { defaultValues: { email: "", role: "member" }, children: _jsxs("form", { className: "grid gap-4 sm:grid-cols-[minmax(0,1fr)_12rem_auto] sm:items-end", onSubmit: (event) => {
|
|
1362
|
+
event.preventDefault();
|
|
1363
|
+
event.stopPropagation();
|
|
1364
|
+
submitInvitation();
|
|
1365
|
+
}, children: [_jsx(inviteForm.email, { label: m.organization_member_email(), placeholder: "teammate@example.com", type: "email", required: true }), _jsx(inviteForm.role, { label: m.organization_member_role(), options: organizationRoles.map((role) => ({
|
|
1366
|
+
label: organizationRoleLabel(role, m),
|
|
1367
|
+
value: role,
|
|
1368
|
+
})) }), _jsx("div", { className: "self-end", children: _jsx(SubmitButton, { form: inviteForm }) }), _jsx(SubmitError, { result: inviteResult })] }) })) : null, !inviting && membersError ? (_jsx("p", { className: "text-destructive text-sm", children: membersError })) : null, !inviting && error ? (_jsx("p", { className: "text-destructive text-sm", children: error })) : null, !inviting ? (_jsxs("section", { className: "flex min-w-0 flex-col gap-3", children: [_jsxs("div", { children: [_jsx("h3", { className: "font-medium", children: m.organization_members_heading() }), _jsx("p", { className: "text-muted-foreground text-sm", children: m.organization_members_description() })] }), _jsx("div", { className: "-m-1 min-w-0 overflow-x-auto p-1", children: _jsx(DataTable, { columns: memberColumns({
|
|
1306
1369
|
m,
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1370
|
+
baseUrl,
|
|
1371
|
+
canChangeRoles: canManageMembers,
|
|
1372
|
+
onRoleChange: updateRole,
|
|
1373
|
+
}), data: displayedMembers, features: {
|
|
1374
|
+
export: { baseName: `${organization.slug}-members` },
|
|
1375
|
+
gallery: false,
|
|
1376
|
+
rowActions: {
|
|
1377
|
+
items: memberRowActions({
|
|
1378
|
+
m,
|
|
1379
|
+
canRemoveMembers,
|
|
1380
|
+
currentUserId,
|
|
1381
|
+
leavingOrganization,
|
|
1382
|
+
onLeave: leaveOrganization,
|
|
1383
|
+
onRemove: removeMember,
|
|
1384
|
+
}),
|
|
1385
|
+
},
|
|
1386
|
+
}, searchState: "local", state: { empty: m.organization_members_empty(), loading } }) })] })) : null, !inviting ? (_jsxs("section", { className: "flex min-w-0 flex-col gap-3", children: [_jsxs("div", { children: [_jsx("h3", { className: "font-medium", children: m.organization_invitations_heading() }), _jsx("p", { className: "text-muted-foreground text-sm", children: m.organization_invitations_description() })] }), _jsx("div", { className: "-m-1 min-w-0 overflow-x-auto p-1", children: _jsx(DataTable, { columns: invitationColumns({
|
|
1322
1387
|
m,
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1388
|
+
now: invitationNow,
|
|
1389
|
+
}), data: invitations, features: {
|
|
1390
|
+
export: { baseName: `${organization.slug}-invitations` },
|
|
1391
|
+
gallery: false,
|
|
1392
|
+
rowActions: {
|
|
1393
|
+
items: invitationRowActions({
|
|
1394
|
+
m,
|
|
1395
|
+
cancellingInvitationId,
|
|
1396
|
+
onCancel: cancelInvitation,
|
|
1397
|
+
}),
|
|
1398
|
+
},
|
|
1399
|
+
}, searchState: "local", state: { empty: m.organization_invitations_empty(), loading } }) })] })) : null] })] }));
|
|
1328
1400
|
}
|
|
1329
1401
|
const memberColumns = ({ m, baseUrl, canChangeRoles, onRoleChange, }) => [
|
|
1330
1402
|
{
|
|
@@ -1418,7 +1490,7 @@ const invitationRowActions = ({ m, cancellingInvitationId, onCancel, }) => [
|
|
|
1418
1490
|
onClick: onCancel,
|
|
1419
1491
|
},
|
|
1420
1492
|
];
|
|
1421
|
-
function OrganizationApiKeyManager({ authClient, organization, active, }) {
|
|
1493
|
+
function OrganizationApiKeyManager({ authClient, organization, active, permissions, }) {
|
|
1422
1494
|
const m = useOrganizationMessages();
|
|
1423
1495
|
const hasOpened = useOpenedOnce(active);
|
|
1424
1496
|
const keysAtom = hasOpened
|
|
@@ -1427,7 +1499,15 @@ function OrganizationApiKeyManager({ authClient, organization, active, }) {
|
|
|
1427
1499
|
const keysResult = useAtomValue(keysAtom);
|
|
1428
1500
|
const refreshKeys = useAtomRefresh(keysAtom);
|
|
1429
1501
|
const [createdKey, setCreatedKey] = useState(null);
|
|
1502
|
+
const [creating, setCreating] = useState(false);
|
|
1503
|
+
const [editingKey, setEditingKey] = useState(null);
|
|
1430
1504
|
const [error, setError] = useState(null);
|
|
1505
|
+
const permissionOptions = organizationApiKeyPermissionOptions(permissions);
|
|
1506
|
+
const [selectedPermissions, setSelectedPermissions] = useState({});
|
|
1507
|
+
const permissionOptionsRef = useRef(permissionOptions);
|
|
1508
|
+
const selectedPermissionsRef = useRef(selectedPermissions);
|
|
1509
|
+
permissionOptionsRef.current = permissionOptions;
|
|
1510
|
+
selectedPermissionsRef.current = selectedPermissions;
|
|
1431
1511
|
const keys = AsyncResult.match(keysResult, {
|
|
1432
1512
|
onInitial: () => [],
|
|
1433
1513
|
onFailure: () => [],
|
|
@@ -1440,7 +1520,7 @@ function OrganizationApiKeyManager({ authClient, organization, active, }) {
|
|
|
1440
1520
|
});
|
|
1441
1521
|
const loading = keysResult._tag === "Initial";
|
|
1442
1522
|
const [createForm] = useState(() => FormReact.make(apiKeyFormBuilder, {
|
|
1443
|
-
fields: { name: TextField },
|
|
1523
|
+
fields: { name: TextField, referrers: TextAreaField },
|
|
1444
1524
|
onSubmit: (_, { decoded: value }) => Effect.tryPromise({
|
|
1445
1525
|
try: async () => {
|
|
1446
1526
|
setCreatedKey(null);
|
|
@@ -1448,8 +1528,11 @@ function OrganizationApiKeyManager({ authClient, organization, active, }) {
|
|
|
1448
1528
|
configId: "organization",
|
|
1449
1529
|
organizationId: organization.id,
|
|
1450
1530
|
name: value.name.trim(),
|
|
1531
|
+
permissions: organizationApiKeySelectedPermissions(permissionOptionsRef.current, selectedPermissionsRef.current),
|
|
1532
|
+
referrers: parseApiKeyReferrers(value.referrers, m.user_api_key_referrers_error()),
|
|
1451
1533
|
}, m.user_api_key_create_error());
|
|
1452
1534
|
setCreatedKey(created.key);
|
|
1535
|
+
setSelectedPermissions({});
|
|
1453
1536
|
refreshKeys();
|
|
1454
1537
|
return created;
|
|
1455
1538
|
},
|
|
@@ -1461,6 +1544,9 @@ function OrganizationApiKeyManager({ authClient, organization, active, }) {
|
|
|
1461
1544
|
const submitApiKey = useAtomSet(createForm.submit);
|
|
1462
1545
|
const resetApiKey = useAtomSet(createForm.reset);
|
|
1463
1546
|
const createResult = useAtomValue(createForm.submit);
|
|
1547
|
+
const togglePermission = (id, checked) => {
|
|
1548
|
+
setSelectedPermissions((current) => ({ ...current, [id]: checked }));
|
|
1549
|
+
};
|
|
1464
1550
|
useEffect(() => {
|
|
1465
1551
|
if (AsyncResult.isSuccess(createResult))
|
|
1466
1552
|
resetApiKey();
|
|
@@ -1476,20 +1562,59 @@ function OrganizationApiKeyManager({ authClient, organization, active, }) {
|
|
|
1476
1562
|
}
|
|
1477
1563
|
refreshKeys();
|
|
1478
1564
|
};
|
|
1479
|
-
return (_jsxs(
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1565
|
+
return (_jsxs(_Fragment, { children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { className: "text-2xl", children: editingKey
|
|
1566
|
+
? m.user_api_key_edit_title()
|
|
1567
|
+
: createdKey
|
|
1568
|
+
? m.user_api_key_created_title()
|
|
1569
|
+
: creating
|
|
1570
|
+
? m.user_api_key_create_title()
|
|
1571
|
+
: m.user_api_keys_title() }), _jsx(DialogDescription, { children: editingKey
|
|
1572
|
+
? m.user_api_key_edit_description()
|
|
1573
|
+
: createdKey
|
|
1574
|
+
? m.user_api_key_created_description()
|
|
1575
|
+
: creating
|
|
1576
|
+
? m.user_api_key_create_description()
|
|
1577
|
+
: m.user_api_keys_organization_description({
|
|
1578
|
+
name: organization.name,
|
|
1579
|
+
}) }), creating || editingKey ? (_jsxs(Button, { className: "mt-2 w-fit", onClick: () => {
|
|
1580
|
+
setCreating(false);
|
|
1581
|
+
setCreatedKey(null);
|
|
1582
|
+
setEditingKey(null);
|
|
1583
|
+
}, type: "button", variant: "secondary", children: [_jsx(ArrowLeft, {}), m.user_api_key_back()] })) : (_jsxs(Button, { className: "mt-2 w-fit", onClick: () => {
|
|
1584
|
+
setCreatedKey(null);
|
|
1585
|
+
setCreating(true);
|
|
1586
|
+
}, type: "button", children: [_jsx(Plus, {}), m.user_api_key_create_title()] }))] }), _jsx(Separator, {}), _jsxs("div", { className: "flex min-w-0 flex-col gap-5", children: [creating && !createdKey ? (_jsx("section", { className: "w-full", children: _jsx(createForm.Initialize, { defaultValues: { name: "", referrers: "" }, children: _jsxs("form", { className: "flex flex-col gap-4", onSubmit: (event) => {
|
|
1587
|
+
event.preventDefault();
|
|
1588
|
+
event.stopPropagation();
|
|
1589
|
+
submitApiKey();
|
|
1590
|
+
}, children: [_jsx(createForm.name, { label: m.user_api_key_name(), required: true }), _jsx(createForm.referrers, { label: m.user_api_key_referrers(), description: m.user_api_key_referrers_description(), placeholder: m.user_api_key_referrers_placeholder(), rows: 3 }), permissionOptions.length > 0 ? (_jsxs(FieldSet, { children: [_jsx("p", { className: "font-medium", children: m.user_api_key_permissions() }), _jsx("p", { className: "text-muted-foreground text-sm", children: m.user_api_key_permissions_description() }), _jsx("div", { className: "flex flex-col gap-3", children: permissionOptions.map((permission) => (_jsxs(Field, { orientation: "horizontal", children: [_jsx(Checkbox, { id: `organization-${permission.id}`, checked: selectedPermissions[permission.id] ?? false, onCheckedChange: (checked) => togglePermission(permission.id, checked) }), _jsxs(FieldLabel, { htmlFor: `organization-${permission.id}`, children: [permission.resource, ": ", permission.action] })] }, permission.id))) })] })) : null, _jsx(SubmitError, { result: createResult }), _jsx(SubmitButton, { form: createForm })] }) }) })) : null, creating && createdKey ? (_jsx("div", { className: "flex min-w-0 flex-col gap-3", children: _jsxs("div", { className: "bg-muted/50 flex min-w-0 items-center justify-between gap-3 rounded-md border px-3 py-2", children: [_jsx("code", { className: "block min-w-0 flex-1 overflow-x-auto text-sm whitespace-nowrap", children: createdKey }), _jsx(CopyButton, { className: "shrink-0", messages: {
|
|
1591
|
+
copied: m.user_api_key_copied(),
|
|
1592
|
+
copy: m.user_api_key_copy(),
|
|
1593
|
+
}, value: createdKey, variant: "ghost" })] }) })) : null, !creating && !editingKey && keysError ? (_jsx("p", { className: "text-destructive text-sm", children: keysError })) : null, !creating && !editingKey && error ? (_jsx("p", { className: "text-destructive text-sm", children: error })) : null, !creating && !editingKey ? (_jsx("div", { className: "max-w-full min-w-0 overflow-x-hidden", children: _jsx(DataTable, { columns: apiKeyColumns({ m }), data: keys, features: {
|
|
1594
|
+
export: { baseName: `${organization.slug}-api-keys` },
|
|
1595
|
+
gallery: false,
|
|
1596
|
+
rowActions: {
|
|
1597
|
+
items: apiKeyRowActions({
|
|
1598
|
+
m,
|
|
1599
|
+
onDelete: deleteKey,
|
|
1600
|
+
onEdit: (key) => setEditingKey(key),
|
|
1601
|
+
}),
|
|
1602
|
+
},
|
|
1603
|
+
}, searchState: "local", state: {
|
|
1604
|
+
empty: loading ? m.user_loading() : m.table_empty(),
|
|
1605
|
+
loading,
|
|
1606
|
+
} }) })) : null, editingKey ? (_jsx(ApiKeyEditForm, { authClient: authClient, configId: "organization", keyData: editingKey, messages: {
|
|
1607
|
+
enabled: m.user_api_key_enabled(),
|
|
1608
|
+
name: m.user_api_key_name(),
|
|
1609
|
+
referrers: m.user_api_key_referrers(),
|
|
1610
|
+
referrersDescription: m.user_api_key_referrers_description(),
|
|
1611
|
+
referrersError: m.user_api_key_referrers_error(),
|
|
1612
|
+
referrersPlaceholder: m.user_api_key_referrers_placeholder(),
|
|
1613
|
+
updateError: m.user_api_key_update_error(),
|
|
1614
|
+
}, onSaved: () => {
|
|
1615
|
+
refreshKeys();
|
|
1616
|
+
setEditingKey(null);
|
|
1617
|
+
} }, editingKey.id)) : null] })] }));
|
|
1493
1618
|
}
|
|
1494
1619
|
const apiKeyColumns = ({ m, }) => [
|
|
1495
1620
|
{
|
|
@@ -1506,8 +1631,66 @@ const apiKeyColumns = ({ m, }) => [
|
|
|
1506
1631
|
? m.user_api_key_enabled()
|
|
1507
1632
|
: m.user_api_key_disabled() })),
|
|
1508
1633
|
},
|
|
1634
|
+
{
|
|
1635
|
+
id: "permissions",
|
|
1636
|
+
accessorFn: (keyData) => keyData.permissions,
|
|
1637
|
+
header: m.user_api_key_permissions(),
|
|
1638
|
+
cell: ({ row }) => {
|
|
1639
|
+
const values = organizationApiKeyFormattedPermissions(row.original.permissions);
|
|
1640
|
+
return values.length > 0 ? (_jsx("div", { className: "flex flex-wrap gap-1", children: values.map((value) => (_jsx(Badge, { variant: "outline", children: value }, value))) })) : (_jsx("span", { className: "text-muted-foreground text-sm", children: m.user_api_key_no_permissions() }));
|
|
1641
|
+
},
|
|
1642
|
+
},
|
|
1643
|
+
{
|
|
1644
|
+
id: "referrers",
|
|
1645
|
+
accessorFn: (keyData) => keyData.metadata,
|
|
1646
|
+
header: m.user_api_key_referrers_column(),
|
|
1647
|
+
cell: ({ row }) => (_jsx(ApiKeyReferrers, { metadata: row.original.metadata, unrestrictedLabel: m.user_api_key_referrers_any() })),
|
|
1648
|
+
},
|
|
1649
|
+
{
|
|
1650
|
+
id: "rateLimit",
|
|
1651
|
+
accessorFn: apiKeyUsagePercent,
|
|
1652
|
+
header: m.user_api_key_rate_limit(),
|
|
1653
|
+
cell: ({ row }) => (_jsx(ApiKeyRateLimit, { keyData: row.original, messages: {
|
|
1654
|
+
disabled: m.user_api_key_disabled(),
|
|
1655
|
+
none: m.user_api_key_window_none(),
|
|
1656
|
+
unlimited: m.user_api_key_unlimited(),
|
|
1657
|
+
usage: m.user_api_key_usage(),
|
|
1658
|
+
windowDays: (count) => m.user_api_key_window_days({ count }),
|
|
1659
|
+
windowHours: (count) => m.user_api_key_window_hours({ count }),
|
|
1660
|
+
windowMinutes: (count) => m.user_api_key_window_minutes({ count }),
|
|
1661
|
+
windowSeconds: (count) => m.user_api_key_window_seconds({ count }),
|
|
1662
|
+
} })),
|
|
1663
|
+
},
|
|
1509
1664
|
];
|
|
1510
|
-
const
|
|
1665
|
+
const organizationApiKeyPermissionOptions = (permissions) => Object.entries(permissions).flatMap(([resource, actions]) => actions.map((action) => ({
|
|
1666
|
+
id: `${resource}:${action}`,
|
|
1667
|
+
resource,
|
|
1668
|
+
action,
|
|
1669
|
+
})));
|
|
1670
|
+
const organizationApiKeySelectedPermissions = (options, selected) => {
|
|
1671
|
+
const permissions = {};
|
|
1672
|
+
for (const option of options) {
|
|
1673
|
+
if (!selected[option.id])
|
|
1674
|
+
continue;
|
|
1675
|
+
permissions[option.resource] = [
|
|
1676
|
+
...(permissions[option.resource] ?? []),
|
|
1677
|
+
option.action,
|
|
1678
|
+
];
|
|
1679
|
+
}
|
|
1680
|
+
return permissions;
|
|
1681
|
+
};
|
|
1682
|
+
const organizationApiKeyFormattedPermissions = (value) => {
|
|
1683
|
+
const decoded = Schema.decodeUnknownOption(Schema.Record(Schema.String, Schema.Array(Schema.String)))(value);
|
|
1684
|
+
return Option.isSome(decoded)
|
|
1685
|
+
? Object.entries(decoded.value).flatMap(([resource, actions]) => actions.map((action) => `${resource}:${action}`))
|
|
1686
|
+
: [];
|
|
1687
|
+
};
|
|
1688
|
+
const apiKeyRowActions = ({ m, onDelete, onEdit, }) => [
|
|
1689
|
+
{
|
|
1690
|
+
name: m.user_api_key_edit_title(),
|
|
1691
|
+
icon: _jsx(PencilIcon, {}),
|
|
1692
|
+
onClick: onEdit,
|
|
1693
|
+
},
|
|
1511
1694
|
{
|
|
1512
1695
|
name: m.user_delete(),
|
|
1513
1696
|
icon: _jsx(Trash2, {}),
|
|
@@ -3,7 +3,6 @@ import { DropdownMenuContent } from "@/components/ui/dropdown-menu";
|
|
|
3
3
|
import type { AuthUiClient } from "./auth-client";
|
|
4
4
|
declare const messages: {
|
|
5
5
|
readonly en: {
|
|
6
|
-
readonly api_key_rate_limit_notice: "API keys are subject to the same rate limits as your account.";
|
|
7
6
|
readonly table_empty: "No results.";
|
|
8
7
|
readonly user_account_cancel: "Cancel";
|
|
9
8
|
readonly user_account_confirm_revoke: "Revoke account";
|
|
@@ -35,18 +34,38 @@ declare const messages: {
|
|
|
35
34
|
readonly user_accounts_title: "Accounts";
|
|
36
35
|
readonly user_api_key_copied: "Copied";
|
|
37
36
|
readonly user_api_key_copy: "Copy";
|
|
37
|
+
readonly user_api_key_back: "Back";
|
|
38
|
+
readonly user_api_key_create_description: "Configure a new API key for your user account.";
|
|
38
39
|
readonly user_api_key_create_error: "Could not create the API key.";
|
|
40
|
+
readonly user_api_key_create_title: "Create API key";
|
|
39
41
|
readonly user_api_key_created_description: "Copy this key now. You will not be able to see it again.";
|
|
40
42
|
readonly user_api_key_created_title: "API key created";
|
|
41
43
|
readonly user_api_key_delete_error: "Could not delete the API key.";
|
|
42
44
|
readonly user_api_key_disabled: "Disabled";
|
|
45
|
+
readonly user_api_key_edit_description: "Update the key name, status, and allowed referrers.";
|
|
46
|
+
readonly user_api_key_edit_title: "Edit API key";
|
|
43
47
|
readonly user_api_key_enabled: "Enabled";
|
|
44
48
|
readonly user_api_key_hidden: "Secret hidden";
|
|
45
49
|
readonly user_api_key_name: "Key name";
|
|
46
50
|
readonly user_api_key_no_permissions: "No permissions";
|
|
47
51
|
readonly user_api_key_permissions: "Permissions";
|
|
48
52
|
readonly user_api_key_permissions_description: "Choose the permissions this API key should receive.";
|
|
53
|
+
readonly user_api_key_rate_limit: "Rate limit";
|
|
54
|
+
readonly user_api_key_referrers: "Allowed referrers (optional)";
|
|
55
|
+
readonly user_api_key_referrers_any: "Any referrer";
|
|
56
|
+
readonly user_api_key_referrers_column: "Referrers";
|
|
57
|
+
readonly user_api_key_referrers_description: "Enter any number of URLs, separated by commas or new lines. Leave empty to allow any referrer.";
|
|
58
|
+
readonly user_api_key_referrers_error: "{referrer} is not a valid HTTP(S) URL.";
|
|
59
|
+
readonly user_api_key_referrers_placeholder: "https://app.example.com\nhttps://admin.example.com";
|
|
49
60
|
readonly user_api_key_status: "Status";
|
|
61
|
+
readonly user_api_key_unlimited: "Unlimited";
|
|
62
|
+
readonly user_api_key_update_error: "Could not update the API key.";
|
|
63
|
+
readonly user_api_key_usage: "API key usage";
|
|
64
|
+
readonly user_api_key_window_days: "{count}d";
|
|
65
|
+
readonly user_api_key_window_hours: "{count}h";
|
|
66
|
+
readonly user_api_key_window_minutes: "{count}m";
|
|
67
|
+
readonly user_api_key_window_none: "None";
|
|
68
|
+
readonly user_api_key_window_seconds: "{count}s";
|
|
50
69
|
readonly user_api_keys_description: "Create and manage API keys for your user account.";
|
|
51
70
|
readonly user_api_keys_export_file_name: "api-keys.csv";
|
|
52
71
|
readonly user_api_keys_load_error: "Could not load API keys.";
|
|
@@ -91,7 +110,6 @@ declare const messages: {
|
|
|
91
110
|
readonly user_two_factor_verify_error: "Could not verify the code.";
|
|
92
111
|
};
|
|
93
112
|
readonly fr: {
|
|
94
|
-
readonly api_key_rate_limit_notice: "Les clés API sont soumises aux mêmes limites de débit que votre compte.";
|
|
95
113
|
readonly table_empty: "Aucun résultat.";
|
|
96
114
|
readonly user_account_cancel: "Annuler";
|
|
97
115
|
readonly user_account_confirm_revoke: "Révoquer le compte";
|
|
@@ -123,18 +141,38 @@ declare const messages: {
|
|
|
123
141
|
readonly user_accounts_title: "Comptes";
|
|
124
142
|
readonly user_api_key_copied: "Copié";
|
|
125
143
|
readonly user_api_key_copy: "Copier";
|
|
144
|
+
readonly user_api_key_back: "Retour";
|
|
145
|
+
readonly user_api_key_create_description: "Configurez une nouvelle clé API pour votre compte utilisateur.";
|
|
126
146
|
readonly user_api_key_create_error: "Impossible de créer la clé API.";
|
|
147
|
+
readonly user_api_key_create_title: "Créer une clé API";
|
|
127
148
|
readonly user_api_key_created_description: "Copiez cette clé maintenant. Vous ne pourrez plus la voir.";
|
|
128
149
|
readonly user_api_key_created_title: "Clé API créée";
|
|
129
150
|
readonly user_api_key_delete_error: "Impossible de supprimer la clé API.";
|
|
130
151
|
readonly user_api_key_disabled: "Désactivée";
|
|
152
|
+
readonly user_api_key_edit_description: "Mettez à jour le nom, le statut et les référents autorisés de la clé.";
|
|
153
|
+
readonly user_api_key_edit_title: "Modifier la clé API";
|
|
131
154
|
readonly user_api_key_enabled: "Activée";
|
|
132
155
|
readonly user_api_key_hidden: "Secret masqué";
|
|
133
156
|
readonly user_api_key_name: "Nom de la clé";
|
|
134
157
|
readonly user_api_key_no_permissions: "Aucune autorisation";
|
|
135
158
|
readonly user_api_key_permissions: "Autorisations";
|
|
136
159
|
readonly user_api_key_permissions_description: "Choisissez les autorisations que cette clé API doit recevoir.";
|
|
160
|
+
readonly user_api_key_rate_limit: "Limite de débit";
|
|
161
|
+
readonly user_api_key_referrers: "Référents autorisés (facultatifs)";
|
|
162
|
+
readonly user_api_key_referrers_any: "Tout référent";
|
|
163
|
+
readonly user_api_key_referrers_column: "Référents";
|
|
164
|
+
readonly user_api_key_referrers_description: "Saisissez autant d'URL que nécessaire, séparées par des virgules ou des sauts de ligne. Laissez vide pour autoriser tout référent.";
|
|
165
|
+
readonly user_api_key_referrers_error: "{referrer} n'est pas une URL HTTP(S) valide.";
|
|
166
|
+
readonly user_api_key_referrers_placeholder: "https://app.example.com\nhttps://admin.example.com";
|
|
137
167
|
readonly user_api_key_status: "Statut";
|
|
168
|
+
readonly user_api_key_unlimited: "Illimitée";
|
|
169
|
+
readonly user_api_key_update_error: "Impossible de mettre à jour la clé API.";
|
|
170
|
+
readonly user_api_key_usage: "Utilisation de la clé API";
|
|
171
|
+
readonly user_api_key_window_days: "{count} j";
|
|
172
|
+
readonly user_api_key_window_hours: "{count} h";
|
|
173
|
+
readonly user_api_key_window_minutes: "{count} min";
|
|
174
|
+
readonly user_api_key_window_none: "Aucune";
|
|
175
|
+
readonly user_api_key_window_seconds: "{count} s";
|
|
138
176
|
readonly user_api_keys_description: "Créez et gérez des clés API pour votre compte utilisateur.";
|
|
139
177
|
readonly user_api_keys_export_file_name: "cles-api.csv";
|
|
140
178
|
readonly user_api_keys_load_error: "Impossible de charger les clés API.";
|
|
@@ -189,7 +227,7 @@ type UserDropdownProps = {
|
|
|
189
227
|
defaultDialog?: UserButtonDialog | null;
|
|
190
228
|
hideTrigger?: boolean;
|
|
191
229
|
renderUnauthenticated?: () => ReactNode;
|
|
192
|
-
apiKeyPermissions?: Record<string, string
|
|
230
|
+
apiKeyPermissions?: Readonly<Record<string, ReadonlyArray<string>>>;
|
|
193
231
|
messages?: UserButtonMessages;
|
|
194
232
|
dialog?: UserButtonDialog | null;
|
|
195
233
|
onDialogChange?: (dialog: UserButtonDialog | null) => void;
|