@delmaredigital/payload-better-auth 0.3.7 → 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/README.md +12 -1
  2. package/dist/adapter/collections.d.ts.map +1 -1
  3. package/dist/adapter/collections.js +126 -88
  4. package/dist/adapter/collections.js.map +1 -1
  5. package/dist/adapter/index.js +197 -150
  6. package/dist/adapter/index.js.map +1 -1
  7. package/dist/components/BeforeLogin.d.ts +1 -1
  8. package/dist/components/BeforeLogin.d.ts.map +1 -1
  9. package/dist/components/BeforeLogin.js +15 -7
  10. package/dist/components/BeforeLogin.js.map +1 -1
  11. package/dist/components/LoginView.d.ts +2 -2
  12. package/dist/components/LoginView.d.ts.map +1 -1
  13. package/dist/components/LoginView.js +660 -218
  14. package/dist/components/LoginView.js.map +1 -1
  15. package/dist/components/LoginViewWrapper.d.ts +1 -1
  16. package/dist/components/LoginViewWrapper.d.ts.map +1 -1
  17. package/dist/components/LoginViewWrapper.js +14 -4
  18. package/dist/components/LoginViewWrapper.js.map +1 -1
  19. package/dist/components/LogoutButton.d.ts +1 -1
  20. package/dist/components/LogoutButton.d.ts.map +1 -1
  21. package/dist/components/LogoutButton.js +19 -11
  22. package/dist/components/LogoutButton.js.map +1 -1
  23. package/dist/components/PasskeyRegisterButton.d.ts +2 -2
  24. package/dist/components/PasskeyRegisterButton.d.ts.map +1 -1
  25. package/dist/components/PasskeyRegisterButton.js +20 -16
  26. package/dist/components/PasskeyRegisterButton.js.map +1 -1
  27. package/dist/components/PasskeySignInButton.d.ts +2 -2
  28. package/dist/components/PasskeySignInButton.d.ts.map +1 -1
  29. package/dist/components/PasskeySignInButton.js +14 -12
  30. package/dist/components/PasskeySignInButton.js.map +1 -1
  31. package/dist/components/auth/ForgotPasswordView.d.ts +1 -1
  32. package/dist/components/auth/ForgotPasswordView.d.ts.map +1 -1
  33. package/dist/components/auth/ForgotPasswordView.js +133 -43
  34. package/dist/components/auth/ForgotPasswordView.js.map +1 -1
  35. package/dist/components/auth/ResetPasswordView.d.ts +1 -1
  36. package/dist/components/auth/ResetPasswordView.d.ts.map +1 -1
  37. package/dist/components/auth/ResetPasswordView.js +154 -50
  38. package/dist/components/auth/ResetPasswordView.js.map +1 -1
  39. package/dist/components/auth/index.js +2 -2
  40. package/dist/components/auth/index.js.map +1 -1
  41. package/dist/components/management/ApiKeysManagementClient.d.ts +2 -2
  42. package/dist/components/management/ApiKeysManagementClient.d.ts.map +1 -1
  43. package/dist/components/management/ApiKeysManagementClient.js +539 -222
  44. package/dist/components/management/ApiKeysManagementClient.js.map +1 -1
  45. package/dist/components/management/PasskeysManagementClient.d.ts +2 -2
  46. package/dist/components/management/PasskeysManagementClient.d.ts.map +1 -1
  47. package/dist/components/management/PasskeysManagementClient.js +215 -92
  48. package/dist/components/management/PasskeysManagementClient.js.map +1 -1
  49. package/dist/components/management/SecurityNavLinks.d.ts +1 -1
  50. package/dist/components/management/SecurityNavLinks.d.ts.map +1 -1
  51. package/dist/components/management/SecurityNavLinks.js +51 -24
  52. package/dist/components/management/SecurityNavLinks.js.map +1 -1
  53. package/dist/components/management/TwoFactorManagementClient.d.ts +2 -2
  54. package/dist/components/management/TwoFactorManagementClient.d.ts.map +1 -1
  55. package/dist/components/management/TwoFactorManagementClient.js +270 -111
  56. package/dist/components/management/TwoFactorManagementClient.js.map +1 -1
  57. package/dist/components/management/index.js +2 -2
  58. package/dist/components/management/index.js.map +1 -1
  59. package/dist/components/management/views/ApiKeysView.d.ts +1 -1
  60. package/dist/components/management/views/ApiKeysView.d.ts.map +1 -1
  61. package/dist/components/management/views/ApiKeysView.js +19 -4
  62. package/dist/components/management/views/ApiKeysView.js.map +1 -1
  63. package/dist/components/management/views/PasskeysView.d.ts +1 -1
  64. package/dist/components/management/views/PasskeysView.d.ts.map +1 -1
  65. package/dist/components/management/views/PasskeysView.js +16 -4
  66. package/dist/components/management/views/PasskeysView.js.map +1 -1
  67. package/dist/components/management/views/TwoFactorView.d.ts +1 -1
  68. package/dist/components/management/views/TwoFactorView.d.ts.map +1 -1
  69. package/dist/components/management/views/TwoFactorView.js +16 -4
  70. package/dist/components/management/views/TwoFactorView.js.map +1 -1
  71. package/dist/components/management/views/index.js +2 -2
  72. package/dist/components/management/views/index.js.map +1 -1
  73. package/dist/components/twoFactor/TwoFactorSetupView.d.ts +1 -1
  74. package/dist/components/twoFactor/TwoFactorSetupView.d.ts.map +1 -1
  75. package/dist/components/twoFactor/TwoFactorSetupView.js +240 -87
  76. package/dist/components/twoFactor/TwoFactorSetupView.js.map +1 -1
  77. package/dist/components/twoFactor/TwoFactorVerifyView.d.ts +1 -1
  78. package/dist/components/twoFactor/TwoFactorVerifyView.d.ts.map +1 -1
  79. package/dist/components/twoFactor/TwoFactorVerifyView.js +108 -45
  80. package/dist/components/twoFactor/TwoFactorVerifyView.js.map +1 -1
  81. package/dist/components/twoFactor/index.js +2 -2
  82. package/dist/components/twoFactor/index.js.map +1 -1
  83. package/dist/exports/client.js +9 -10
  84. package/dist/exports/client.js.map +1 -1
  85. package/dist/exports/components.js +2 -2
  86. package/dist/exports/components.js.map +1 -1
  87. package/dist/exports/management.js +3 -3
  88. package/dist/exports/management.js.map +1 -1
  89. package/dist/exports/rsc.js +2 -2
  90. package/dist/exports/rsc.js.map +1 -1
  91. package/dist/generated-types.js +4 -2
  92. package/dist/generated-types.js.map +1 -1
  93. package/dist/index.js +6 -6
  94. package/dist/index.js.map +1 -1
  95. package/dist/plugin/index.js +198 -162
  96. package/dist/plugin/index.js.map +1 -1
  97. package/dist/scripts/generate-types.js +66 -50
  98. package/dist/scripts/generate-types.js.map +1 -1
  99. package/dist/types/apiKey.js +7 -2
  100. package/dist/types/apiKey.js.map +1 -1
  101. package/dist/types/betterAuth.js +23 -2
  102. package/dist/types/betterAuth.js.map +1 -1
  103. package/dist/utils/access.js +78 -81
  104. package/dist/utils/access.js.map +1 -1
  105. package/dist/utils/apiKeyAccess.js +65 -72
  106. package/dist/utils/apiKeyAccess.js.map +1 -1
  107. package/dist/utils/betterAuthDefaults.js +8 -8
  108. package/dist/utils/betterAuthDefaults.js.map +1 -1
  109. package/dist/utils/detectAuthConfig.js +8 -11
  110. package/dist/utils/detectAuthConfig.js.map +1 -1
  111. package/dist/utils/detectEnabledPlugins.js +6 -7
  112. package/dist/utils/detectEnabledPlugins.js.map +1 -1
  113. package/dist/utils/firstUserAdmin.js +18 -20
  114. package/dist/utils/firstUserAdmin.js.map +1 -1
  115. package/dist/utils/generateScopes.js +40 -41
  116. package/dist/utils/generateScopes.js.map +1 -1
  117. package/dist/utils/session.js +8 -9
  118. package/dist/utils/session.js.map +1 -1
  119. package/package.json +27 -13
@@ -1,14 +1,13 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState, useEffect, useMemo, useRef } from 'react';
4
- import { createPayloadAuthClient, } from '../../exports/client';
4
+ import { createPayloadAuthClient } from '../../exports/client.js';
5
5
  /**
6
6
  * Group scopes by collection for the UI.
7
7
  * Scopes like "posts:read", "posts:write" get grouped under "Posts"
8
- */
9
- function groupScopesByCollection(scopes) {
8
+ */ function groupScopesByCollection(scopes) {
10
9
  const groups = new Map();
11
- for (const scope of scopes) {
10
+ for (const scope of scopes){
12
11
  // Parse scope ID like "posts:read" -> collection="posts", type="read"
13
12
  const colonIndex = scope.id.indexOf(':');
14
13
  let collection;
@@ -16,11 +15,12 @@ function groupScopesByCollection(scopes) {
16
15
  if (colonIndex > 0) {
17
16
  collection = scope.id.substring(0, colonIndex);
18
17
  const typeStr = scope.id.substring(colonIndex + 1);
19
- type = ['read', 'write', 'delete'].includes(typeStr)
20
- ? typeStr
21
- : 'other';
22
- }
23
- else {
18
+ type = [
19
+ 'read',
20
+ 'write',
21
+ 'delete'
22
+ ].includes(typeStr) ? typeStr : 'other';
23
+ } else {
24
24
  // No colon - treat as standalone scope
25
25
  collection = scope.id;
26
26
  type = 'other';
@@ -31,25 +31,30 @@ function groupScopesByCollection(scopes) {
31
31
  groups.set(collection, {
32
32
  collection,
33
33
  label,
34
- scopes: [],
34
+ scopes: []
35
35
  });
36
36
  }
37
- groups.get(collection).scopes.push({ type, scope });
37
+ groups.get(collection).scopes.push({
38
+ type,
39
+ scope
40
+ });
38
41
  }
39
42
  // Sort groups alphabetically, sort scopes within group by type order
40
- const typeOrder = { read: 0, write: 1, delete: 2, other: 3 };
41
- return Array.from(groups.values())
42
- .sort((a, b) => a.label.localeCompare(b.label))
43
- .map((group) => ({
44
- ...group,
45
- scopes: group.scopes.sort((a, b) => typeOrder[a.type] - typeOrder[b.type]),
46
- }));
43
+ const typeOrder = {
44
+ read: 0,
45
+ write: 1,
46
+ delete: 2,
47
+ other: 3
48
+ };
49
+ return Array.from(groups.values()).sort((a, b)=>a.label.localeCompare(b.label)).map((group)=>({
50
+ ...group,
51
+ scopes: group.scopes.sort((a, b)=>typeOrder[a.type] - typeOrder[b.type])
52
+ }));
47
53
  }
48
54
  /**
49
55
  * Client component for API keys management.
50
56
  * Lists, creates, and deletes API keys with scope selection.
51
- */
52
- export function ApiKeysManagementClient({ authClient: providedClient, title = 'API Keys', availableScopes = [], defaultScopes = [], } = {}) {
57
+ */ export function ApiKeysManagementClient({ authClient: providedClient, title = 'API Keys', availableScopes = [], defaultScopes = [] } = {}) {
53
58
  const [apiKeys, setApiKeys] = useState([]);
54
59
  const [loading, setLoading] = useState(true);
55
60
  const [error, setError] = useState(null);
@@ -63,47 +68,59 @@ export function ApiKeysManagementClient({ authClient: providedClient, title = 'A
63
68
  const [expandedGroups, setExpandedGroups] = useState(new Set());
64
69
  const hasScopes = availableScopes.length > 0;
65
70
  // Group scopes by collection
66
- const scopeGroups = useMemo(() => groupScopesByCollection(availableScopes), [availableScopes]);
71
+ const scopeGroups = useMemo(()=>groupScopesByCollection(availableScopes), [
72
+ availableScopes
73
+ ]);
67
74
  // Get all scope IDs by type for bulk actions
68
- const scopesByType = useMemo(() => {
69
- const result = { read: [], write: [], delete: [] };
70
- for (const group of scopeGroups) {
71
- for (const { type, scope } of group.scopes) {
75
+ const scopesByType = useMemo(()=>{
76
+ const result = {
77
+ read: [],
78
+ write: [],
79
+ delete: []
80
+ };
81
+ for (const group of scopeGroups){
82
+ for (const { type, scope } of group.scopes){
72
83
  if (type === 'read' || type === 'write' || type === 'delete') {
73
84
  result[type].push(scope.id);
74
85
  }
75
86
  }
76
87
  }
77
88
  return result;
78
- }, [scopeGroups]);
79
- const getClient = () => providedClient ?? createPayloadAuthClient();
89
+ }, [
90
+ scopeGroups
91
+ ]);
92
+ const getClient = ()=>providedClient ?? createPayloadAuthClient();
80
93
  // Toggle a scope selection
81
94
  function toggleScope(scopeId) {
82
- setSelectedScopes((prev) => prev.includes(scopeId)
83
- ? prev.filter((s) => s !== scopeId)
84
- : [...prev, scopeId]);
95
+ setSelectedScopes((prev)=>prev.includes(scopeId) ? prev.filter((s)=>s !== scopeId) : [
96
+ ...prev,
97
+ scopeId
98
+ ]);
85
99
  }
86
100
  // Toggle all scopes in a group
87
101
  function toggleGroup(group) {
88
- const groupScopeIds = group.scopes.map((s) => s.scope.id);
89
- const allSelected = groupScopeIds.every((id) => selectedScopes.includes(id));
102
+ const groupScopeIds = group.scopes.map((s)=>s.scope.id);
103
+ const allSelected = groupScopeIds.every((id)=>selectedScopes.includes(id));
90
104
  if (allSelected) {
91
105
  // Deselect all in group
92
- setSelectedScopes((prev) => prev.filter((id) => !groupScopeIds.includes(id)));
93
- }
94
- else {
106
+ setSelectedScopes((prev)=>prev.filter((id)=>!groupScopeIds.includes(id)));
107
+ } else {
95
108
  // Select all in group
96
- setSelectedScopes((prev) => [...new Set([...prev, ...groupScopeIds])]);
109
+ setSelectedScopes((prev)=>[
110
+ ...new Set([
111
+ ...prev,
112
+ ...groupScopeIds
113
+ ])
114
+ ]);
97
115
  }
98
116
  }
99
117
  // Toggle expand/collapse for a group
100
118
  function toggleExpanded(collection) {
101
- setExpandedGroups((prev) => {
119
+ setExpandedGroups((prev)=>{
102
120
  const next = new Set(prev);
103
121
  if (next.has(collection)) {
104
122
  next.delete(collection);
105
- }
106
- else {
123
+ } else {
107
124
  next.add(collection);
108
125
  }
109
126
  return next;
@@ -112,22 +129,26 @@ export function ApiKeysManagementClient({ authClient: providedClient, title = 'A
112
129
  // Bulk toggle all scopes of a type
113
130
  function toggleAllOfType(type) {
114
131
  const typeScopes = scopesByType[type];
115
- const allSelected = typeScopes.every((id) => selectedScopes.includes(id));
132
+ const allSelected = typeScopes.every((id)=>selectedScopes.includes(id));
116
133
  if (allSelected) {
117
- setSelectedScopes((prev) => prev.filter((id) => !typeScopes.includes(id)));
118
- }
119
- else {
120
- setSelectedScopes((prev) => [...new Set([...prev, ...typeScopes])]);
134
+ setSelectedScopes((prev)=>prev.filter((id)=>!typeScopes.includes(id)));
135
+ } else {
136
+ setSelectedScopes((prev)=>[
137
+ ...new Set([
138
+ ...prev,
139
+ ...typeScopes
140
+ ])
141
+ ]);
121
142
  }
122
143
  }
123
144
  // Check if all scopes of a type are selected
124
145
  function isAllOfTypeSelected(type) {
125
- return scopesByType[type].length > 0 && scopesByType[type].every((id) => selectedScopes.includes(id));
146
+ return scopesByType[type].length > 0 && scopesByType[type].every((id)=>selectedScopes.includes(id));
126
147
  }
127
148
  // Check if some (but not all) scopes of a type are selected
128
149
  function isSomeOfTypeSelected(type) {
129
150
  const typeScopes = scopesByType[type];
130
- const selectedCount = typeScopes.filter((id) => selectedScopes.includes(id)).length;
151
+ const selectedCount = typeScopes.filter((id)=>selectedScopes.includes(id)).length;
131
152
  return selectedCount > 0 && selectedCount < typeScopes.length;
132
153
  }
133
154
  // Clear all selections
@@ -136,35 +157,37 @@ export function ApiKeysManagementClient({ authClient: providedClient, title = 'A
136
157
  }
137
158
  // Select all scopes
138
159
  function selectAll() {
139
- setSelectedScopes(availableScopes.map((s) => s.id));
160
+ setSelectedScopes(availableScopes.map((s)=>s.id));
140
161
  }
141
162
  // Get group selection state
142
163
  function getGroupState(group) {
143
- const groupScopeIds = group.scopes.map((s) => s.scope.id);
144
- const selectedCount = groupScopeIds.filter((id) => selectedScopes.includes(id)).length;
145
- if (selectedCount === 0)
146
- return 'none';
147
- if (selectedCount === groupScopeIds.length)
148
- return 'all';
164
+ const groupScopeIds = group.scopes.map((s)=>s.scope.id);
165
+ const selectedCount = groupScopeIds.filter((id)=>selectedScopes.includes(id)).length;
166
+ if (selectedCount === 0) return 'none';
167
+ if (selectedCount === groupScopeIds.length) return 'all';
149
168
  return 'some';
150
169
  }
151
170
  // Get scope label by ID
152
171
  function getScopeLabel(scopeId) {
153
- const scope = availableScopes.find((s) => s.id === scopeId);
172
+ const scope = availableScopes.find((s)=>s.id === scopeId);
154
173
  return scope?.label ?? scopeId;
155
174
  }
156
175
  // Get short label for scope type
157
176
  function getTypeLabel(type) {
158
- switch (type) {
159
- case 'read': return 'Read';
160
- case 'write': return 'Write';
161
- case 'delete': return 'Delete';
162
- default: return 'Access';
177
+ switch(type){
178
+ case 'read':
179
+ return 'Read';
180
+ case 'write':
181
+ return 'Write';
182
+ case 'delete':
183
+ return 'Delete';
184
+ default:
185
+ return 'Access';
163
186
  }
164
187
  }
165
- useEffect(() => {
188
+ useEffect(()=>{
166
189
  fetchApiKeys();
167
- // eslint-disable-next-line react-hooks/exhaustive-deps
190
+ // eslint-disable-next-line react-hooks/exhaustive-deps
168
191
  }, []);
169
192
  async function fetchApiKeys() {
170
193
  setLoading(true);
@@ -174,15 +197,12 @@ export function ApiKeysManagementClient({ authClient: providedClient, title = 'A
174
197
  const result = await client.apiKey.list();
175
198
  if (result.error) {
176
199
  setError(result.error.message ?? 'Failed to load API keys');
177
- }
178
- else {
200
+ } else {
179
201
  setApiKeys(result.data ?? []);
180
202
  }
181
- }
182
- catch {
203
+ } catch {
183
204
  setError('Failed to load API keys');
184
- }
185
- finally {
205
+ } finally{
186
206
  setLoading(false);
187
207
  }
188
208
  }
@@ -194,7 +214,9 @@ export function ApiKeysManagementClient({ authClient: providedClient, title = 'A
194
214
  try {
195
215
  const client = getClient();
196
216
  // Send scopes to server - server will convert to permissions
197
- const createOptions = { name: newKeyName };
217
+ const createOptions = {
218
+ name: newKeyName
219
+ };
198
220
  if (newKeyExpiry) {
199
221
  createOptions.expiresIn = parseInt(newKeyExpiry) * 24 * 60 * 60; // Convert days to seconds
200
222
  }
@@ -205,8 +227,7 @@ export function ApiKeysManagementClient({ authClient: providedClient, title = 'A
205
227
  const result = await client.apiKey.create(createOptions);
206
228
  if (result.error) {
207
229
  setError(result.error.message ?? 'Failed to create API key');
208
- }
209
- else if (result.data) {
230
+ } else if (result.data) {
210
231
  setNewlyCreatedKey(result.data.key);
211
232
  setShowCreateForm(false);
212
233
  setNewKeyName('');
@@ -214,11 +235,9 @@ export function ApiKeysManagementClient({ authClient: providedClient, title = 'A
214
235
  setSelectedScopes(defaultScopes); // Reset to defaults
215
236
  fetchApiKeys();
216
237
  }
217
- }
218
- catch {
238
+ } catch {
219
239
  setError('Failed to create API key');
220
- }
221
- finally {
240
+ } finally{
222
241
  setCreating(false);
223
242
  }
224
243
  }
@@ -230,77 +249,111 @@ export function ApiKeysManagementClient({ authClient: providedClient, title = 'A
230
249
  setError(null);
231
250
  try {
232
251
  const client = getClient();
233
- const result = await client.apiKey.delete({ keyId });
252
+ const result = await client.apiKey.delete({
253
+ keyId
254
+ });
234
255
  if (result.error) {
235
256
  setError(result.error.message ?? 'Failed to delete API key');
257
+ } else {
258
+ setApiKeys((prev)=>prev.filter((k)=>k.id !== keyId));
236
259
  }
237
- else {
238
- setApiKeys((prev) => prev.filter((k) => k.id !== keyId));
239
- }
240
- }
241
- catch {
260
+ } catch {
242
261
  setError('Failed to delete API key');
243
- }
244
- finally {
262
+ } finally{
245
263
  setDeleting(null);
246
264
  }
247
265
  }
248
266
  function formatDate(date) {
249
- if (!date)
250
- return 'Never';
267
+ if (!date) return 'Never';
251
268
  const d = date instanceof Date ? date : new Date(date);
252
269
  return d.toLocaleString();
253
270
  }
254
- return (_jsxs("div", { style: {
271
+ return /*#__PURE__*/ _jsxs("div", {
272
+ style: {
255
273
  maxWidth: '900px',
256
274
  margin: '0 auto',
257
- padding: 'calc(var(--base) * 2)',
258
- }, children: [_jsxs("div", { style: {
275
+ padding: 'calc(var(--base) * 2)'
276
+ },
277
+ children: [
278
+ /*#__PURE__*/ _jsxs("div", {
279
+ style: {
259
280
  display: 'flex',
260
281
  justifyContent: 'space-between',
261
282
  alignItems: 'center',
262
- marginBottom: 'calc(var(--base) * 2)',
263
- }, children: [_jsx("h1", { style: {
283
+ marginBottom: 'calc(var(--base) * 2)'
284
+ },
285
+ children: [
286
+ /*#__PURE__*/ _jsx("h1", {
287
+ style: {
264
288
  color: 'var(--theme-text)',
265
289
  fontSize: 'var(--font-size-h2)',
266
290
  fontWeight: 600,
267
- margin: 0,
268
- }, children: title }), _jsx("button", { onClick: () => setShowCreateForm(true), style: {
291
+ margin: 0
292
+ },
293
+ children: title
294
+ }),
295
+ /*#__PURE__*/ _jsx("button", {
296
+ onClick: ()=>setShowCreateForm(true),
297
+ style: {
269
298
  padding: 'calc(var(--base) * 0.5) calc(var(--base) * 1)',
270
299
  background: 'var(--theme-elevation-800)',
271
300
  border: 'none',
272
301
  borderRadius: 'var(--style-radius-s)',
273
302
  color: 'var(--theme-elevation-50)',
274
303
  fontSize: 'var(--font-size-small)',
275
- cursor: 'pointer',
276
- }, children: "Create API Key" })] }), error && (_jsx("div", { style: {
304
+ cursor: 'pointer'
305
+ },
306
+ children: "Create API Key"
307
+ })
308
+ ]
309
+ }),
310
+ error && /*#__PURE__*/ _jsx("div", {
311
+ style: {
277
312
  color: 'var(--theme-error-500)',
278
313
  marginBottom: 'var(--base)',
279
314
  fontSize: 'var(--font-size-small)',
280
315
  padding: 'calc(var(--base) * 0.75)',
281
316
  background: 'var(--theme-error-50)',
282
317
  borderRadius: 'var(--style-radius-s)',
283
- border: '1px solid var(--theme-error-200)',
284
- }, children: error })), newlyCreatedKey && (_jsxs("div", { style: {
318
+ border: '1px solid var(--theme-error-200)'
319
+ },
320
+ children: error
321
+ }),
322
+ newlyCreatedKey && /*#__PURE__*/ _jsxs("div", {
323
+ style: {
285
324
  marginBottom: 'calc(var(--base) * 1.5)',
286
325
  padding: 'calc(var(--base) * 1)',
287
326
  background: 'var(--theme-success-50)',
288
327
  borderRadius: 'var(--style-radius-m)',
289
- border: '1px solid var(--theme-success-200)',
290
- }, children: [_jsx("div", { style: {
328
+ border: '1px solid var(--theme-success-200)'
329
+ },
330
+ children: [
331
+ /*#__PURE__*/ _jsx("div", {
332
+ style: {
291
333
  color: 'var(--theme-success-700)',
292
334
  fontWeight: 500,
293
- marginBottom: 'calc(var(--base) * 0.5)',
294
- }, children: "API Key Created" }), _jsx("p", { style: {
335
+ marginBottom: 'calc(var(--base) * 0.5)'
336
+ },
337
+ children: "API Key Created"
338
+ }),
339
+ /*#__PURE__*/ _jsx("p", {
340
+ style: {
295
341
  color: 'var(--theme-text)',
296
342
  opacity: 0.8,
297
343
  fontSize: 'var(--font-size-small)',
298
- marginBottom: 'calc(var(--base) * 0.5)',
299
- }, children: "Copy this key now - you won't be able to see it again:" }), _jsxs("div", { style: {
344
+ marginBottom: 'calc(var(--base) * 0.5)'
345
+ },
346
+ children: "Copy this key now - you won't be able to see it again:"
347
+ }),
348
+ /*#__PURE__*/ _jsxs("div", {
349
+ style: {
300
350
  display: 'flex',
301
351
  gap: 'calc(var(--base) * 0.5)',
302
- alignItems: 'center',
303
- }, children: [_jsx("code", { style: {
352
+ alignItems: 'center'
353
+ },
354
+ children: [
355
+ /*#__PURE__*/ _jsx("code", {
356
+ style: {
304
357
  flex: 1,
305
358
  padding: 'calc(var(--base) * 0.5)',
306
359
  background: 'var(--theme-elevation-100)',
@@ -308,63 +361,161 @@ export function ApiKeysManagementClient({ authClient: providedClient, title = 'A
308
361
  fontFamily: 'monospace',
309
362
  fontSize: 'var(--font-size-small)',
310
363
  color: 'var(--theme-text)',
311
- wordBreak: 'break-all',
312
- }, children: newlyCreatedKey }), _jsx("button", { onClick: () => {
364
+ wordBreak: 'break-all'
365
+ },
366
+ children: newlyCreatedKey
367
+ }),
368
+ /*#__PURE__*/ _jsx("button", {
369
+ onClick: ()=>{
313
370
  navigator.clipboard.writeText(newlyCreatedKey);
314
- }, style: {
371
+ },
372
+ style: {
315
373
  padding: 'calc(var(--base) * 0.5)',
316
374
  background: 'var(--theme-elevation-200)',
317
375
  border: 'none',
318
376
  borderRadius: 'var(--style-radius-s)',
319
- cursor: 'pointer',
320
- }, children: "Copy" })] })] })), showCreateForm && (_jsxs("div", { style: {
377
+ cursor: 'pointer'
378
+ },
379
+ children: "Copy"
380
+ })
381
+ ]
382
+ })
383
+ ]
384
+ }),
385
+ showCreateForm && /*#__PURE__*/ _jsxs("div", {
386
+ style: {
321
387
  marginBottom: 'calc(var(--base) * 1.5)',
322
388
  padding: 'calc(var(--base) * 1.5)',
323
389
  background: 'var(--theme-elevation-50)',
324
390
  borderRadius: 'var(--style-radius-m)',
325
- border: '1px solid var(--theme-elevation-100)',
326
- }, children: [_jsx("h2", { style: {
391
+ border: '1px solid var(--theme-elevation-100)'
392
+ },
393
+ children: [
394
+ /*#__PURE__*/ _jsx("h2", {
395
+ style: {
327
396
  color: 'var(--theme-text)',
328
397
  fontSize: 'var(--font-size-h4)',
329
398
  fontWeight: 500,
330
- margin: '0 0 var(--base) 0',
331
- }, children: "Create New API Key" }), _jsxs("form", { onSubmit: handleCreate, children: [_jsxs("div", { style: { marginBottom: 'var(--base)' }, children: [_jsx("label", { style: {
399
+ margin: '0 0 var(--base) 0'
400
+ },
401
+ children: "Create New API Key"
402
+ }),
403
+ /*#__PURE__*/ _jsxs("form", {
404
+ onSubmit: handleCreate,
405
+ children: [
406
+ /*#__PURE__*/ _jsxs("div", {
407
+ style: {
408
+ marginBottom: 'var(--base)'
409
+ },
410
+ children: [
411
+ /*#__PURE__*/ _jsx("label", {
412
+ style: {
332
413
  display: 'block',
333
414
  color: 'var(--theme-text)',
334
415
  fontSize: 'var(--font-size-small)',
335
- marginBottom: 'calc(var(--base) * 0.25)',
336
- }, children: "Name" }), _jsx("input", { type: "text", value: newKeyName, onChange: (e) => setNewKeyName(e.target.value), required: true, placeholder: "My API Key", style: {
416
+ marginBottom: 'calc(var(--base) * 0.25)'
417
+ },
418
+ children: "Name"
419
+ }),
420
+ /*#__PURE__*/ _jsx("input", {
421
+ type: "text",
422
+ value: newKeyName,
423
+ onChange: (e)=>setNewKeyName(e.target.value),
424
+ required: true,
425
+ placeholder: "My API Key",
426
+ style: {
337
427
  width: '100%',
338
428
  padding: 'calc(var(--base) * 0.5)',
339
429
  background: 'var(--theme-input-bg)',
340
430
  border: '1px solid var(--theme-elevation-150)',
341
431
  borderRadius: 'var(--style-radius-s)',
342
432
  color: 'var(--theme-text)',
343
- boxSizing: 'border-box',
344
- } })] }), _jsxs("div", { style: { marginBottom: 'var(--base)' }, children: [_jsx("label", { style: {
433
+ boxSizing: 'border-box'
434
+ }
435
+ })
436
+ ]
437
+ }),
438
+ /*#__PURE__*/ _jsxs("div", {
439
+ style: {
440
+ marginBottom: 'var(--base)'
441
+ },
442
+ children: [
443
+ /*#__PURE__*/ _jsx("label", {
444
+ style: {
345
445
  display: 'block',
346
446
  color: 'var(--theme-text)',
347
447
  fontSize: 'var(--font-size-small)',
348
- marginBottom: 'calc(var(--base) * 0.25)',
349
- }, children: "Expires in (days, optional)" }), _jsx("input", { type: "number", value: newKeyExpiry, onChange: (e) => setNewKeyExpiry(e.target.value), placeholder: "30", min: "1", style: {
448
+ marginBottom: 'calc(var(--base) * 0.25)'
449
+ },
450
+ children: "Expires in (days, optional)"
451
+ }),
452
+ /*#__PURE__*/ _jsx("input", {
453
+ type: "number",
454
+ value: newKeyExpiry,
455
+ onChange: (e)=>setNewKeyExpiry(e.target.value),
456
+ placeholder: "30",
457
+ min: "1",
458
+ style: {
350
459
  width: '100%',
351
460
  padding: 'calc(var(--base) * 0.5)',
352
461
  background: 'var(--theme-input-bg)',
353
462
  border: '1px solid var(--theme-elevation-150)',
354
463
  borderRadius: 'var(--style-radius-s)',
355
464
  color: 'var(--theme-text)',
356
- boxSizing: 'border-box',
357
- } })] }), hasScopes && (_jsxs("div", { style: { marginBottom: 'var(--base)' }, children: [_jsx("label", { style: {
465
+ boxSizing: 'border-box'
466
+ }
467
+ })
468
+ ]
469
+ }),
470
+ hasScopes && /*#__PURE__*/ _jsxs("div", {
471
+ style: {
472
+ marginBottom: 'var(--base)'
473
+ },
474
+ children: [
475
+ /*#__PURE__*/ _jsx("label", {
476
+ style: {
358
477
  display: 'block',
359
478
  color: 'var(--theme-text)',
360
479
  fontSize: 'var(--font-size-small)',
361
- marginBottom: 'calc(var(--base) * 0.5)',
362
- }, children: "Permissions" }), _jsxs("div", { style: {
480
+ marginBottom: 'calc(var(--base) * 0.5)'
481
+ },
482
+ children: "Permissions"
483
+ }),
484
+ /*#__PURE__*/ _jsxs("div", {
485
+ style: {
363
486
  display: 'flex',
364
487
  flexWrap: 'wrap',
365
488
  gap: 'calc(var(--base) * 0.5)',
366
- marginBottom: 'calc(var(--base) * 0.75)',
367
- }, children: [_jsx(BulkButton, { label: "All Read", active: isAllOfTypeSelected('read'), indeterminate: isSomeOfTypeSelected('read'), onClick: () => toggleAllOfType('read') }), _jsx(BulkButton, { label: "All Write", active: isAllOfTypeSelected('write'), indeterminate: isSomeOfTypeSelected('write'), onClick: () => toggleAllOfType('write') }), _jsx(BulkButton, { label: "All Delete", active: isAllOfTypeSelected('delete'), indeterminate: isSomeOfTypeSelected('delete'), onClick: () => toggleAllOfType('delete') }), _jsx("div", { style: { flex: 1 } }), _jsx("button", { type: "button", onClick: selectAll, style: {
489
+ marginBottom: 'calc(var(--base) * 0.75)'
490
+ },
491
+ children: [
492
+ /*#__PURE__*/ _jsx(BulkButton, {
493
+ label: "All Read",
494
+ active: isAllOfTypeSelected('read'),
495
+ indeterminate: isSomeOfTypeSelected('read'),
496
+ onClick: ()=>toggleAllOfType('read')
497
+ }),
498
+ /*#__PURE__*/ _jsx(BulkButton, {
499
+ label: "All Write",
500
+ active: isAllOfTypeSelected('write'),
501
+ indeterminate: isSomeOfTypeSelected('write'),
502
+ onClick: ()=>toggleAllOfType('write')
503
+ }),
504
+ /*#__PURE__*/ _jsx(BulkButton, {
505
+ label: "All Delete",
506
+ active: isAllOfTypeSelected('delete'),
507
+ indeterminate: isSomeOfTypeSelected('delete'),
508
+ onClick: ()=>toggleAllOfType('delete')
509
+ }),
510
+ /*#__PURE__*/ _jsx("div", {
511
+ style: {
512
+ flex: 1
513
+ }
514
+ }),
515
+ /*#__PURE__*/ _jsx("button", {
516
+ type: "button",
517
+ onClick: selectAll,
518
+ style: {
368
519
  padding: '4px 8px',
369
520
  background: 'transparent',
370
521
  border: '1px solid var(--theme-elevation-200)',
@@ -372,8 +523,14 @@ export function ApiKeysManagementClient({ authClient: providedClient, title = 'A
372
523
  color: 'var(--theme-text)',
373
524
  fontSize: '11px',
374
525
  cursor: 'pointer',
375
- opacity: 0.8,
376
- }, children: "Select All" }), _jsx("button", { type: "button", onClick: clearAll, style: {
526
+ opacity: 0.8
527
+ },
528
+ children: "Select All"
529
+ }),
530
+ /*#__PURE__*/ _jsx("button", {
531
+ type: "button",
532
+ onClick: clearAll,
533
+ style: {
377
534
  padding: '4px 8px',
378
535
  background: 'transparent',
379
536
  border: '1px solid var(--theme-elevation-200)',
@@ -381,72 +538,140 @@ export function ApiKeysManagementClient({ authClient: providedClient, title = 'A
381
538
  color: 'var(--theme-text)',
382
539
  fontSize: '11px',
383
540
  cursor: 'pointer',
384
- opacity: 0.8,
385
- }, children: "Clear" })] }), _jsx("div", { style: {
541
+ opacity: 0.8
542
+ },
543
+ children: "Clear"
544
+ })
545
+ ]
546
+ }),
547
+ /*#__PURE__*/ _jsx("div", {
548
+ style: {
386
549
  background: 'var(--theme-input-bg)',
387
550
  border: '1px solid var(--theme-elevation-150)',
388
551
  borderRadius: 'var(--style-radius-s)',
389
552
  maxHeight: '400px',
390
- overflowY: 'auto',
391
- }, children: scopeGroups.map((group) => {
553
+ overflowY: 'auto'
554
+ },
555
+ children: scopeGroups.map((group)=>{
392
556
  const groupState = getGroupState(group);
393
557
  const isExpanded = expandedGroups.has(group.collection);
394
- return (_jsxs("div", { style: {
395
- borderBottom: '1px solid var(--theme-elevation-100)',
396
- }, children: [_jsxs("div", { style: {
558
+ return /*#__PURE__*/ _jsxs("div", {
559
+ style: {
560
+ borderBottom: '1px solid var(--theme-elevation-100)'
561
+ },
562
+ children: [
563
+ /*#__PURE__*/ _jsxs("div", {
564
+ style: {
397
565
  display: 'flex',
398
566
  alignItems: 'center',
399
567
  gap: 'calc(var(--base) * 0.5)',
400
568
  padding: 'calc(var(--base) * 0.5) calc(var(--base) * 0.75)',
401
569
  cursor: 'pointer',
402
- background: groupState !== 'none' ? 'var(--theme-elevation-50)' : 'transparent',
403
- }, onClick: () => toggleExpanded(group.collection), children: [_jsx("span", { style: {
570
+ background: groupState !== 'none' ? 'var(--theme-elevation-50)' : 'transparent'
571
+ },
572
+ onClick: ()=>toggleExpanded(group.collection),
573
+ children: [
574
+ /*#__PURE__*/ _jsx("span", {
575
+ style: {
404
576
  color: 'var(--theme-elevation-500)',
405
577
  fontSize: '10px',
406
578
  width: '12px',
407
579
  transition: 'transform 0.15s',
408
- transform: isExpanded ? 'rotate(90deg)' : 'rotate(0deg)',
409
- }, children: "\u25B6" }), _jsx(IndeterminateCheckbox, { checked: groupState === 'all', indeterminate: groupState === 'some', onChange: (e) => {
580
+ transform: isExpanded ? 'rotate(90deg)' : 'rotate(0deg)'
581
+ },
582
+ children: "▶"
583
+ }),
584
+ /*#__PURE__*/ _jsx(IndeterminateCheckbox, {
585
+ checked: groupState === 'all',
586
+ indeterminate: groupState === 'some',
587
+ onChange: (e)=>{
410
588
  e.stopPropagation();
411
589
  toggleGroup(group);
412
- } }), _jsx("span", { style: {
590
+ }
591
+ }),
592
+ /*#__PURE__*/ _jsx("span", {
593
+ style: {
413
594
  color: 'var(--theme-text)',
414
595
  fontSize: 'var(--font-size-small)',
415
596
  fontWeight: 500,
416
- flex: 1,
417
- }, children: group.label }), groupState !== 'none' && (_jsxs("span", { style: {
597
+ flex: 1
598
+ },
599
+ children: group.label
600
+ }),
601
+ groupState !== 'none' && /*#__PURE__*/ _jsxs("span", {
602
+ style: {
418
603
  padding: '2px 6px',
419
604
  background: 'var(--theme-elevation-200)',
420
605
  borderRadius: '10px',
421
606
  fontSize: '10px',
422
- color: 'var(--theme-elevation-700)',
423
- }, children: [group.scopes.filter((s) => selectedScopes.includes(s.scope.id)).length, "/", group.scopes.length] }))] }), isExpanded && (_jsx("div", { style: {
607
+ color: 'var(--theme-elevation-700)'
608
+ },
609
+ children: [
610
+ group.scopes.filter((s)=>selectedScopes.includes(s.scope.id)).length,
611
+ "/",
612
+ group.scopes.length
613
+ ]
614
+ })
615
+ ]
616
+ }),
617
+ isExpanded && /*#__PURE__*/ _jsx("div", {
618
+ style: {
424
619
  padding: '0 calc(var(--base) * 0.75) calc(var(--base) * 0.5)',
425
620
  paddingLeft: 'calc(var(--base) * 2.5)',
426
621
  display: 'flex',
427
622
  flexDirection: 'column',
428
- gap: 'calc(var(--base) * 0.25)',
429
- }, children: group.scopes.map(({ type, scope }) => (_jsxs("label", { style: {
430
- display: 'flex',
431
- alignItems: 'center',
432
- gap: 'calc(var(--base) * 0.5)',
433
- cursor: 'pointer',
434
- padding: 'calc(var(--base) * 0.25)',
435
- borderRadius: 'var(--style-radius-s)',
436
- background: selectedScopes.includes(scope.id)
437
- ? 'var(--theme-elevation-100)'
438
- : 'transparent',
439
- }, children: [_jsx("input", { type: "checkbox", checked: selectedScopes.includes(scope.id), onChange: () => toggleScope(scope.id) }), _jsx("span", { style: {
440
- color: 'var(--theme-text)',
441
- fontSize: 'var(--font-size-small)',
442
- }, children: getTypeLabel(type) })] }, scope.id))) }))] }, group.collection));
443
- }) }), _jsx("div", { style: {
623
+ gap: 'calc(var(--base) * 0.25)'
624
+ },
625
+ children: group.scopes.map(({ type, scope })=>/*#__PURE__*/ _jsxs("label", {
626
+ style: {
627
+ display: 'flex',
628
+ alignItems: 'center',
629
+ gap: 'calc(var(--base) * 0.5)',
630
+ cursor: 'pointer',
631
+ padding: 'calc(var(--base) * 0.25)',
632
+ borderRadius: 'var(--style-radius-s)',
633
+ background: selectedScopes.includes(scope.id) ? 'var(--theme-elevation-100)' : 'transparent'
634
+ },
635
+ children: [
636
+ /*#__PURE__*/ _jsx("input", {
637
+ type: "checkbox",
638
+ checked: selectedScopes.includes(scope.id),
639
+ onChange: ()=>toggleScope(scope.id)
640
+ }),
641
+ /*#__PURE__*/ _jsx("span", {
642
+ style: {
643
+ color: 'var(--theme-text)',
644
+ fontSize: 'var(--font-size-small)'
645
+ },
646
+ children: getTypeLabel(type)
647
+ })
648
+ ]
649
+ }, scope.id))
650
+ })
651
+ ]
652
+ }, group.collection);
653
+ })
654
+ }),
655
+ /*#__PURE__*/ _jsx("div", {
656
+ style: {
444
657
  marginTop: 'calc(var(--base) * 0.5)',
445
658
  fontSize: '11px',
446
- color: selectedScopes.length === 0 ? 'var(--theme-warning-500)' : 'var(--theme-elevation-600)',
447
- }, children: selectedScopes.length === 0
448
- ? 'No permissions selected. Key will have no access.'
449
- : `${selectedScopes.length} permission${selectedScopes.length === 1 ? '' : 's'} selected` })] })), _jsxs("div", { style: { display: 'flex', gap: 'calc(var(--base) * 0.5)' }, children: [_jsx("button", { type: "submit", disabled: creating, style: {
659
+ color: selectedScopes.length === 0 ? 'var(--theme-warning-500)' : 'var(--theme-elevation-600)'
660
+ },
661
+ children: selectedScopes.length === 0 ? 'No permissions selected. Key will have no access.' : `${selectedScopes.length} permission${selectedScopes.length === 1 ? '' : 's'} selected`
662
+ })
663
+ ]
664
+ }),
665
+ /*#__PURE__*/ _jsxs("div", {
666
+ style: {
667
+ display: 'flex',
668
+ gap: 'calc(var(--base) * 0.5)'
669
+ },
670
+ children: [
671
+ /*#__PURE__*/ _jsx("button", {
672
+ type: "submit",
673
+ disabled: creating,
674
+ style: {
450
675
  padding: 'calc(var(--base) * 0.5) calc(var(--base) * 1)',
451
676
  background: 'var(--theme-elevation-800)',
452
677
  border: 'none',
@@ -454,98 +679,190 @@ export function ApiKeysManagementClient({ authClient: providedClient, title = 'A
454
679
  color: 'var(--theme-elevation-50)',
455
680
  fontSize: 'var(--font-size-small)',
456
681
  cursor: creating ? 'not-allowed' : 'pointer',
457
- opacity: creating ? 0.7 : 1,
458
- }, children: creating ? 'Creating...' : 'Create' }), _jsx("button", { type: "button", onClick: () => setShowCreateForm(false), style: {
682
+ opacity: creating ? 0.7 : 1
683
+ },
684
+ children: creating ? 'Creating...' : 'Create'
685
+ }),
686
+ /*#__PURE__*/ _jsx("button", {
687
+ type: "button",
688
+ onClick: ()=>setShowCreateForm(false),
689
+ style: {
459
690
  padding: 'calc(var(--base) * 0.5) calc(var(--base) * 1)',
460
691
  background: 'transparent',
461
692
  border: '1px solid var(--theme-elevation-200)',
462
693
  borderRadius: 'var(--style-radius-s)',
463
694
  color: 'var(--theme-text)',
464
695
  fontSize: 'var(--font-size-small)',
465
- cursor: 'pointer',
466
- }, children: "Cancel" })] })] })] })), loading ? (_jsx("div", { style: {
696
+ cursor: 'pointer'
697
+ },
698
+ children: "Cancel"
699
+ })
700
+ ]
701
+ })
702
+ ]
703
+ })
704
+ ]
705
+ }),
706
+ loading ? /*#__PURE__*/ _jsx("div", {
707
+ style: {
467
708
  color: 'var(--theme-text)',
468
709
  opacity: 0.7,
469
710
  textAlign: 'center',
470
- padding: 'calc(var(--base) * 3)',
471
- }, children: "Loading API keys..." })) : apiKeys.length === 0 ? (_jsx("div", { style: {
711
+ padding: 'calc(var(--base) * 3)'
712
+ },
713
+ children: "Loading API keys..."
714
+ }) : apiKeys.length === 0 ? /*#__PURE__*/ _jsx("div", {
715
+ style: {
472
716
  color: 'var(--theme-text)',
473
717
  opacity: 0.7,
474
718
  textAlign: 'center',
475
- padding: 'calc(var(--base) * 3)',
476
- }, children: "No API keys found. Create one to get started." })) : (_jsx("div", { style: {
719
+ padding: 'calc(var(--base) * 3)'
720
+ },
721
+ children: "No API keys found. Create one to get started."
722
+ }) : /*#__PURE__*/ _jsx("div", {
723
+ style: {
477
724
  background: 'var(--theme-elevation-50)',
478
725
  borderRadius: 'var(--style-radius-m)',
479
726
  overflow: 'hidden',
480
- border: '1px solid var(--theme-elevation-100)',
481
- }, children: apiKeys.map((key, index) => (_jsxs("div", { style: {
482
- display: 'flex',
483
- justifyContent: 'space-between',
484
- alignItems: 'center',
485
- padding: 'calc(var(--base) * 1)',
486
- borderBottom: index < apiKeys.length - 1
487
- ? '1px solid var(--theme-elevation-100)'
488
- : 'none',
489
- }, children: [_jsxs("div", { style: { flex: 1 }, children: [_jsx("div", { style: {
490
- color: 'var(--theme-text)',
491
- fontWeight: 500,
492
- marginBottom: 'calc(var(--base) * 0.25)',
493
- }, children: key.name }), _jsxs("div", { style: {
494
- color: 'var(--theme-elevation-600)',
495
- fontSize: 'var(--font-size-small)',
496
- }, children: [(key.start || key.startsWith) && _jsxs("code", { children: [key.start || key.startsWith, "..."] }), _jsxs("span", { children: [" \u2022 Created: ", formatDate(key.createdAt)] }), key.expiresAt && (_jsxs("span", { children: [" \u2022 Expires: ", formatDate(key.expiresAt)] })), key.lastUsedAt && (_jsxs("span", { children: [" \u2022 Last used: ", formatDate(key.lastUsedAt)] }))] }), key.metadata?.scopes && key.metadata.scopes.length > 0 && (_jsx("div", { style: {
497
- display: 'flex',
498
- flexWrap: 'wrap',
499
- gap: 'calc(var(--base) * 0.25)',
500
- marginTop: 'calc(var(--base) * 0.5)',
501
- }, children: key.metadata.scopes.map((scopeId) => (_jsx("span", { style: {
502
- padding: '2px 6px',
503
- background: 'var(--theme-elevation-100)',
504
- borderRadius: 'var(--style-radius-s)',
505
- fontSize: '11px',
506
- color: 'var(--theme-elevation-700)',
507
- }, children: getScopeLabel(scopeId) }, scopeId))) }))] }), _jsx("button", { onClick: () => handleDelete(key.id), disabled: deleting === key.id, style: {
508
- padding: 'calc(var(--base) * 0.5) calc(var(--base) * 0.75)',
509
- background: 'transparent',
510
- border: '1px solid var(--theme-error-300)',
511
- borderRadius: 'var(--style-radius-s)',
512
- color: 'var(--theme-error-500)',
513
- fontSize: 'var(--font-size-small)',
514
- cursor: deleting === key.id ? 'not-allowed' : 'pointer',
515
- opacity: deleting === key.id ? 0.7 : 1,
516
- }, children: deleting === key.id ? 'Deleting...' : 'Delete' })] }, key.id))) }))] }));
727
+ border: '1px solid var(--theme-elevation-100)'
728
+ },
729
+ children: apiKeys.map((key, index)=>/*#__PURE__*/ _jsxs("div", {
730
+ style: {
731
+ display: 'flex',
732
+ justifyContent: 'space-between',
733
+ alignItems: 'center',
734
+ padding: 'calc(var(--base) * 1)',
735
+ borderBottom: index < apiKeys.length - 1 ? '1px solid var(--theme-elevation-100)' : 'none'
736
+ },
737
+ children: [
738
+ /*#__PURE__*/ _jsxs("div", {
739
+ style: {
740
+ flex: 1
741
+ },
742
+ children: [
743
+ /*#__PURE__*/ _jsx("div", {
744
+ style: {
745
+ color: 'var(--theme-text)',
746
+ fontWeight: 500,
747
+ marginBottom: 'calc(var(--base) * 0.25)'
748
+ },
749
+ children: key.name
750
+ }),
751
+ /*#__PURE__*/ _jsxs("div", {
752
+ style: {
753
+ color: 'var(--theme-elevation-600)',
754
+ fontSize: 'var(--font-size-small)'
755
+ },
756
+ children: [
757
+ (key.start || key.startsWith) && /*#__PURE__*/ _jsxs("code", {
758
+ children: [
759
+ key.start || key.startsWith,
760
+ "..."
761
+ ]
762
+ }),
763
+ /*#__PURE__*/ _jsxs("span", {
764
+ children: [
765
+ " • Created: ",
766
+ formatDate(key.createdAt)
767
+ ]
768
+ }),
769
+ key.expiresAt && /*#__PURE__*/ _jsxs("span", {
770
+ children: [
771
+ " • Expires: ",
772
+ formatDate(key.expiresAt)
773
+ ]
774
+ }),
775
+ key.lastUsedAt && /*#__PURE__*/ _jsxs("span", {
776
+ children: [
777
+ " • Last used: ",
778
+ formatDate(key.lastUsedAt)
779
+ ]
780
+ })
781
+ ]
782
+ }),
783
+ key.metadata?.scopes && key.metadata.scopes.length > 0 && /*#__PURE__*/ _jsx("div", {
784
+ style: {
785
+ display: 'flex',
786
+ flexWrap: 'wrap',
787
+ gap: 'calc(var(--base) * 0.25)',
788
+ marginTop: 'calc(var(--base) * 0.5)'
789
+ },
790
+ children: key.metadata.scopes.map((scopeId)=>/*#__PURE__*/ _jsx("span", {
791
+ style: {
792
+ padding: '2px 6px',
793
+ background: 'var(--theme-elevation-100)',
794
+ borderRadius: 'var(--style-radius-s)',
795
+ fontSize: '11px',
796
+ color: 'var(--theme-elevation-700)'
797
+ },
798
+ children: getScopeLabel(scopeId)
799
+ }, scopeId))
800
+ })
801
+ ]
802
+ }),
803
+ /*#__PURE__*/ _jsx("button", {
804
+ onClick: ()=>handleDelete(key.id),
805
+ disabled: deleting === key.id,
806
+ style: {
807
+ padding: 'calc(var(--base) * 0.5) calc(var(--base) * 0.75)',
808
+ background: 'transparent',
809
+ border: '1px solid var(--theme-error-300)',
810
+ borderRadius: 'var(--style-radius-s)',
811
+ color: 'var(--theme-error-500)',
812
+ fontSize: 'var(--font-size-small)',
813
+ cursor: deleting === key.id ? 'not-allowed' : 'pointer',
814
+ opacity: deleting === key.id ? 0.7 : 1
815
+ },
816
+ children: deleting === key.id ? 'Deleting...' : 'Delete'
817
+ })
818
+ ]
819
+ }, key.id))
820
+ })
821
+ ]
822
+ });
517
823
  }
518
824
  /**
519
825
  * Bulk action button with active/indeterminate states
520
- */
521
- function BulkButton({ label, active, indeterminate, onClick, }) {
522
- return (_jsx("button", { type: "button", onClick: onClick, style: {
826
+ */ function BulkButton({ label, active, indeterminate, onClick }) {
827
+ return /*#__PURE__*/ _jsx("button", {
828
+ type: "button",
829
+ onClick: onClick,
830
+ style: {
523
831
  padding: '4px 10px',
524
- background: active
525
- ? 'var(--theme-elevation-700)'
526
- : indeterminate
527
- ? 'var(--theme-elevation-300)'
528
- : 'var(--theme-elevation-100)',
832
+ background: active ? 'var(--theme-elevation-700)' : indeterminate ? 'var(--theme-elevation-300)' : 'var(--theme-elevation-100)',
529
833
  border: 'none',
530
834
  borderRadius: 'var(--style-radius-s)',
531
835
  color: active ? 'var(--theme-elevation-50)' : 'var(--theme-text)',
532
836
  fontSize: '11px',
533
837
  fontWeight: 500,
534
838
  cursor: 'pointer',
535
- transition: 'background 0.15s',
536
- }, children: label }));
839
+ transition: 'background 0.15s'
840
+ },
841
+ children: label
842
+ });
537
843
  }
538
844
  /**
539
845
  * Checkbox that supports indeterminate state
540
- */
541
- function IndeterminateCheckbox({ checked, indeterminate, onChange, }) {
846
+ */ function IndeterminateCheckbox({ checked, indeterminate, onChange }) {
542
847
  const ref = useRef(null);
543
- useEffect(() => {
848
+ useEffect(()=>{
544
849
  if (ref.current) {
545
850
  ref.current.indeterminate = indeterminate;
546
851
  }
547
- }, [indeterminate]);
548
- return (_jsx("input", { ref: ref, type: "checkbox", checked: checked, onChange: () => { }, onClick: onChange, style: { cursor: 'pointer' } }));
852
+ }, [
853
+ indeterminate
854
+ ]);
855
+ return /*#__PURE__*/ _jsx("input", {
856
+ ref: ref,
857
+ type: "checkbox",
858
+ checked: checked,
859
+ onChange: ()=>{},
860
+ onClick: onChange,
861
+ style: {
862
+ cursor: 'pointer'
863
+ }
864
+ });
549
865
  }
550
866
  export default ApiKeysManagementClient;
867
+
551
868
  //# sourceMappingURL=ApiKeysManagementClient.js.map