@krak-stack/auth 0.1.49 → 0.1.51

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.
@@ -96,13 +96,17 @@ export function AdminOrganizationsTable({ from, reloadKey = 0, search, }) {
96
96
  onFailure: () => false,
97
97
  onSuccess: () => false,
98
98
  });
99
- return (_jsxs("div", { className: "flex flex-col gap-4", children: [error ? _jsx(ErrorMessage, { text: error }) : null, _jsx(DataTable, { columns: organizationColumns(m, locale, baseUrl), data: organizations, exportFileName: "organizations.csv", features: { gallery: false }, ...(from ? { from } : {}), ...(!search
99
+ return (_jsxs("div", { className: "flex flex-col gap-4", children: [error ? _jsx(ErrorMessage, { text: error }) : null, _jsx(DataTable, { columns: organizationColumns(m, locale, baseUrl), data: organizations, features: {
100
+ export: { baseName: "organizations" },
101
+ gallery: false,
102
+ pagination: { mode: "server", rowCount: total },
103
+ }, ...(from ? { routeFrom: from } : {}), ...(!search
100
104
  ? {
101
105
  search: tableSearch,
102
106
  onSearchChange: setLocalSearch,
103
107
  searchState: "local",
104
108
  }
105
- : {}), isLoading: isLoading, onRefresh: () => setRefreshKey((current) => current + 1), serverPagination: { rowCount: total } })] }));
109
+ : {}), onRefresh: () => setRefreshKey((current) => current + 1), state: { loading: isLoading } })] }));
106
110
  }
107
111
  const organizationColumns = (m, locale, baseUrl) => [
108
112
  {
@@ -171,84 +171,91 @@ export function AdminUsersTable({ from, reloadKey = 0, search, }) {
171
171
  await navigate({ to: "/" });
172
172
  await router.invalidate();
173
173
  };
174
- return (_jsxs(_Fragment, { children: [error ? _jsx(ErrorMessage, { text: error }) : null, impersonateError ? _jsx(ErrorMessage, { text: impersonateError }) : null, _jsx(DataTable, { columns: userColumns(m), data: users, exportFileName: "users.csv", features: { gallery: false }, ...(from ? { from } : {}), ...(!search
174
+ return (_jsxs(_Fragment, { children: [error ? _jsx(ErrorMessage, { text: error }) : null, impersonateError ? _jsx(ErrorMessage, { text: impersonateError }) : null, _jsx(DataTable, { columns: userColumns(m), data: users, features: {
175
+ export: { baseName: "users" },
176
+ gallery: false,
177
+ pagination: { mode: "server", rowCount: total },
178
+ rowActions: {
179
+ items: [
180
+ {
181
+ name: m.admin_action_impersonate,
182
+ icon: impersonatingUserId ? (_jsx(Loader2, { className: "size-4 animate-spin" })) : (_jsx(UserCog, { className: "size-4" })),
183
+ onClick: async (user) => {
184
+ setImpersonateError("");
185
+ setImpersonatingUserId(user.id);
186
+ try {
187
+ if (!authClient)
188
+ throw new Error(m.admin_error_access_required);
189
+ await impersonateUser(authClient, user.id, m);
190
+ await refreshSessionAndNavigate();
191
+ }
192
+ catch (cause) {
193
+ setImpersonateError(cause instanceof Error
194
+ ? cause.message
195
+ : m.admin_error_impersonate);
196
+ }
197
+ finally {
198
+ setImpersonatingUserId(null);
199
+ }
200
+ },
201
+ visible: (user) => !user.banned,
202
+ },
203
+ {
204
+ name: m.admin_action_impersonate_organization,
205
+ icon: impersonatingUserId ? (_jsx(Loader2, { className: "size-4 animate-spin" })) : (_jsx(Building2, { className: "size-4" })),
206
+ onClick: async (user) => {
207
+ setImpersonateError("");
208
+ setImpersonatingUserId(user.id);
209
+ try {
210
+ if (!session?.user?.id) {
211
+ throw new Error(m.admin_error_access_required);
212
+ }
213
+ const organizationId = activeOrganizationId(session);
214
+ if (!organizationId) {
215
+ throw new Error(m.admin_error_organization_required);
216
+ }
217
+ await impersonateOrganizationUser({
218
+ payload: {
219
+ organizationId,
220
+ actorUserId: session.user.id,
221
+ targetUserId: user.id,
222
+ },
223
+ });
224
+ await refreshSessionAndNavigate();
225
+ }
226
+ catch (cause) {
227
+ setImpersonateError(cause instanceof Error
228
+ ? cause.message
229
+ : m.admin_error_impersonate_organization);
230
+ }
231
+ finally {
232
+ setImpersonatingUserId(null);
233
+ }
234
+ },
235
+ visible: (user) => !user.banned,
236
+ },
237
+ {
238
+ name: m.admin_action_ban,
239
+ icon: _jsx(Ban, { className: "size-4" }),
240
+ variant: "destructive",
241
+ onClick: (user) => setBanningUser(user),
242
+ visible: (user) => !user.banned,
243
+ },
244
+ {
245
+ name: m.admin_action_unban,
246
+ icon: _jsx(ShieldOff, { className: "size-4" }),
247
+ onClick: (user) => setUnbanningUser(user),
248
+ visible: (user) => !!user.banned,
249
+ },
250
+ ],
251
+ },
252
+ }, ...(from ? { routeFrom: from } : {}), ...(!search
175
253
  ? {
176
254
  search: tableSearch,
177
255
  onSearchChange: setLocalSearch,
178
256
  searchState: "local",
179
257
  }
180
- : {}), isLoading: isLoading, onRefresh: () => setRefreshKey((current) => current + 1), serverPagination: { rowCount: total }, rowActions: [
181
- {
182
- name: m.admin_action_impersonate,
183
- icon: impersonatingUserId ? (_jsx(Loader2, { className: "size-4 animate-spin" })) : (_jsx(UserCog, { className: "size-4" })),
184
- onClick: async (user) => {
185
- setImpersonateError("");
186
- setImpersonatingUserId(user.id);
187
- try {
188
- if (!authClient)
189
- throw new Error(m.admin_error_access_required);
190
- await impersonateUser(authClient, user.id, m);
191
- await refreshSessionAndNavigate();
192
- }
193
- catch (cause) {
194
- setImpersonateError(cause instanceof Error
195
- ? cause.message
196
- : m.admin_error_impersonate);
197
- }
198
- finally {
199
- setImpersonatingUserId(null);
200
- }
201
- },
202
- visible: (user) => !user.banned,
203
- },
204
- {
205
- name: m.admin_action_impersonate_organization,
206
- icon: impersonatingUserId ? (_jsx(Loader2, { className: "size-4 animate-spin" })) : (_jsx(Building2, { className: "size-4" })),
207
- onClick: async (user) => {
208
- setImpersonateError("");
209
- setImpersonatingUserId(user.id);
210
- try {
211
- if (!session?.user?.id) {
212
- throw new Error(m.admin_error_access_required);
213
- }
214
- const organizationId = activeOrganizationId(session);
215
- if (!organizationId) {
216
- throw new Error(m.admin_error_organization_required);
217
- }
218
- await impersonateOrganizationUser({
219
- payload: {
220
- organizationId,
221
- actorUserId: session.user.id,
222
- targetUserId: user.id,
223
- },
224
- });
225
- await refreshSessionAndNavigate();
226
- }
227
- catch (cause) {
228
- setImpersonateError(cause instanceof Error
229
- ? cause.message
230
- : m.admin_error_impersonate_organization);
231
- }
232
- finally {
233
- setImpersonatingUserId(null);
234
- }
235
- },
236
- visible: (user) => !user.banned,
237
- },
238
- {
239
- name: m.admin_action_ban,
240
- icon: _jsx(Ban, { className: "size-4" }),
241
- variant: "destructive",
242
- onClick: (user) => setBanningUser(user),
243
- visible: (user) => !user.banned,
244
- },
245
- {
246
- name: m.admin_action_unban,
247
- icon: _jsx(ShieldOff, { className: "size-4" }),
248
- onClick: (user) => setUnbanningUser(user),
249
- visible: (user) => !!user.banned,
250
- },
251
- ] }), banningUser ? (_jsx(BanUserDialog, { labels: m, authClient: authClient, user: banningUser, onBanned: () => setRefreshKey((current) => current + 1), onClose: () => setBanningUser(null) })) : null, unbanningUser ? (_jsx(UnbanUserDialog, { labels: m, authClient: authClient, user: unbanningUser, onUnbanned: () => setRefreshKey((current) => current + 1), onClose: () => setUnbanningUser(null) })) : null] }));
258
+ : {}), onRefresh: () => setRefreshKey((current) => current + 1), state: { loading: isLoading } }), banningUser ? (_jsx(BanUserDialog, { labels: m, authClient: authClient, user: banningUser, onBanned: () => setRefreshKey((current) => current + 1), onClose: () => setBanningUser(null) })) : null, unbanningUser ? (_jsx(UnbanUserDialog, { labels: m, authClient: authClient, user: unbanningUser, onUnbanned: () => setRefreshKey((current) => current + 1), onClose: () => setUnbanningUser(null) })) : null] }));
252
259
  }
253
260
  export function useAdminUsersTotal(search) {
254
261
  const auth = useKrakstackAuth();
@@ -1,135 +1,5 @@
1
1
  import { AtomHttpApi } from "effect/unstable/reactivity";
2
- export declare const authClientApi: (baseUrl?: string | undefined) => AtomHttpApi.AtomHttpApiClient<object, `AuthClientApi:${string}`, import("effect/unstable/httpapi/HttpApiGroup").HttpApiGroup<"auth", import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getSession", "GET", "/api/auth/get-session", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").NullOr<import("effect/Schema").Struct<{
3
- readonly session: import("effect/Schema").Struct<{
4
- readonly id: import("effect/Schema").String;
5
- readonly expiresAt: import("effect/Schema").Date;
6
- readonly token: import("effect/Schema").String;
7
- readonly createdAt: import("effect/Schema").Date;
8
- readonly updatedAt: import("effect/Schema").Date;
9
- readonly ipAddress: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
10
- readonly userAgent: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
11
- readonly userId: import("effect/Schema").String;
12
- readonly impersonatedBy: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
13
- readonly impersonatedByOrganizationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
14
- readonly activeOrganizationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
15
- }>;
16
- readonly user: import("effect/Schema").Struct<{
17
- readonly id: import("effect/Schema").String;
18
- readonly name: import("effect/Schema").String;
19
- readonly email: import("effect/Schema").String;
20
- readonly emailVerified: import("effect/Schema").Boolean;
21
- readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
22
- readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
23
- readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
24
- readonly lastLoginMethod: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
25
- readonly createdAt: import("effect/Schema").Date;
26
- readonly updatedAt: import("effect/Schema").Date;
27
- }>;
28
- }>>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").BadRequest | typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError | typeof import("../better-auth/schema").TooManyRequests>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"organizationImpersonateUser", "POST", "/api/auth/organization/impersonate-user", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
29
- readonly organizationId: import("effect/Schema").NonEmptyString;
30
- readonly actorUserId: import("effect/Schema").NonEmptyString;
31
- readonly targetUserId: import("effect/Schema").NonEmptyString;
32
- readonly expiresInSeconds: import("effect/Schema").optional<import("effect/Schema").Number>;
33
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
34
- readonly session: import("effect/Schema").Struct<{
35
- readonly id: import("effect/Schema").String;
36
- readonly expiresAt: import("effect/Schema").Date;
37
- readonly token: import("effect/Schema").String;
38
- readonly createdAt: import("effect/Schema").Date;
39
- readonly updatedAt: import("effect/Schema").Date;
40
- readonly ipAddress: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
41
- readonly userAgent: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
42
- readonly userId: import("effect/Schema").String;
43
- readonly impersonatedBy: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
44
- readonly impersonatedByOrganizationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
45
- readonly activeOrganizationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
46
- }>;
47
- readonly user: import("effect/Schema").Struct<{
48
- readonly id: import("effect/Schema").String;
49
- readonly name: import("effect/Schema").String;
50
- readonly email: import("effect/Schema").String;
51
- readonly emailVerified: import("effect/Schema").Boolean;
52
- readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
53
- readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
54
- readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
55
- readonly lastLoginMethod: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
56
- readonly createdAt: import("effect/Schema").Date;
57
- readonly updatedAt: import("effect/Schema").Date;
58
- }>;
59
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").BadRequest | typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never>, false> | import("effect/unstable/httpapi/HttpApiGroup").HttpApiGroup<"authExtra", import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"createApiKey", "POST", "/api/auth/create-api-key", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
60
- readonly configId: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"user">, import("effect/Schema").Literal<"organization">, import("effect/Schema").Literal<"service">]>;
61
- readonly name: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
62
- readonly organizationId: import("effect/Schema").optional<import("effect/Schema").String>;
63
- readonly permissions: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
64
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
65
- readonly id: import("effect/Schema").String;
66
- readonly key: import("effect/Schema").String;
67
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError | typeof import("../extra/schema").ExtraBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getOrganizationPublicProfile", "GET", "/api/auth/organization-profile", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
68
- readonly organizationId: import("effect/Schema").String;
69
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
70
- readonly id: import("effect/Schema").String;
71
- readonly name: import("effect/Schema").String;
72
- readonly slug: import("effect/Schema").String;
73
- readonly displayName: import("effect/Schema").String;
74
- readonly contactEmail: import("effect/Schema").NullOr<import("effect/Schema").String>;
75
- readonly logo: import("effect/Schema").NullOr<import("effect/Schema").String>;
76
- readonly icon: import("effect/Schema").NullOr<import("effect/Schema").String>;
77
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getProjectPublicConfig", "GET", "/api/auth/project-config", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
78
- readonly projectId: import("effect/Schema").optional<import("effect/Schema").String>;
79
- readonly clientId: import("effect/Schema").optional<import("effect/Schema").String>;
80
- readonly host: import("effect/Schema").optional<import("effect/Schema").String>;
81
- readonly rootHost: import("effect/Schema").optional<import("effect/Schema").String>;
82
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
83
- readonly projectKey: import("effect/Schema").String;
84
- readonly name: import("effect/Schema").NullOr<import("effect/Schema").String>;
85
- readonly logoUrl: import("effect/Schema").NullOr<import("effect/Schema").String>;
86
- readonly authDomain: import("effect/Schema").NullOr<import("effect/Schema").String>;
87
- readonly rootDomain: import("effect/Schema").NullOr<import("effect/Schema").String>;
88
- readonly themeCss: import("effect/Schema").NullOr<import("effect/Schema").String>;
89
- readonly authOptions: import("effect/Schema").Struct<{
90
- readonly emailPassword: import("effect/Schema").Boolean;
91
- readonly emailOtp: import("effect/Schema").Boolean;
92
- readonly google: import("effect/Schema").Boolean;
93
- readonly signUp: import("effect/Schema").Boolean;
94
- readonly signUpName: import("effect/Schema").Boolean;
95
- }>;
96
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"setPassword", "POST", "/api/auth/set-password", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
97
- readonly newPassword: import("effect/Schema").NonEmptyString;
98
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
99
- readonly ok: import("effect/Schema").Boolean;
100
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError | typeof import("../extra/schema").ExtraBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"uploadUserImage", "POST", "/api/auth/image/upload", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/unstable/httpapi/HttpApiSchema").asMultipartStream<import("effect/Schema").Struct<{
101
- readonly file: import("effect/Schema").decodeTo<import("effect/unstable/http/Multipart").PersistedFileSchema, import("effect/Schema").$Array<import("effect/unstable/http/Multipart").PersistedFileSchema>, never, never>;
102
- }>>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
103
- readonly url: import("effect/Schema").String;
104
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError | typeof import("../extra/schema").ExtraBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"verifyApiKey", "POST", "/api/auth/verify-api-key", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
105
- readonly key: import("effect/Schema").NonEmptyString;
106
- readonly configId: import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"user">, import("effect/Schema").Literal<"organization">, import("effect/Schema").Literal<"service">]>>;
107
- readonly permissions: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
108
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
109
- readonly valid: import("effect/Schema").Boolean;
110
- readonly error: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
111
- readonly message: import("effect/Schema").String;
112
- readonly code: import("effect/Schema").String;
113
- }>>;
114
- readonly key: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
115
- readonly id: import("effect/Schema").String;
116
- readonly configId: import("effect/Schema").String;
117
- readonly name: import("effect/Schema").NullOr<import("effect/Schema").String>;
118
- readonly start: import("effect/Schema").NullOr<import("effect/Schema").String>;
119
- readonly prefix: import("effect/Schema").NullOr<import("effect/Schema").String>;
120
- readonly referenceId: import("effect/Schema").String;
121
- readonly enabled: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
122
- readonly expiresAt: import("effect/Schema").NullOr<import("effect/Schema").Date>;
123
- readonly createdAt: import("effect/Schema").Date;
124
- readonly updatedAt: import("effect/Schema").Date;
125
- readonly permissions: import("effect/Schema").NullOr<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
126
- readonly metadata: import("effect/Schema").NullOr<import("effect/Schema").Unknown>;
127
- }>>;
128
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("../extra/schema").ExtraBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"verifyPassword", "POST", "/api/auth/verify-password", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
129
- readonly password: import("effect/Schema").NonEmptyString;
130
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
131
- readonly ok: import("effect/Schema").Boolean;
132
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError | typeof import("../extra/schema").ExtraBadRequest>, never, never>, false> | import("effect/unstable/httpapi/HttpApiGroup").HttpApiGroup<"admin", import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"createDomain", "POST", "/api/auth/admin/domains", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
2
+ export declare const authClientApi: (baseUrl?: string | undefined) => AtomHttpApi.AtomHttpApiClient<object, `AuthClientApi:${string}`, import("effect/unstable/httpapi/HttpApiGroup").HttpApiGroup<"admin", import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"createDomain", "POST", "/api/auth/admin/domains", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
133
3
  readonly hostname: import("effect/Schema").NonEmptyString;
134
4
  readonly rootHostname: import("effect/Schema").NonEmptyString;
135
5
  readonly projectId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
@@ -445,4 +315,134 @@ export declare const authClientApi: (baseUrl?: string | undefined) => AtomHttpAp
445
315
  readonly metadata: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
446
316
  readonly memberCount: import("effect/Schema").optional<import("effect/Schema").Number>;
447
317
  readonly createdAt: import("effect/Schema").Date;
448
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never>, false>>;
318
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never>, false> | import("effect/unstable/httpapi/HttpApiGroup").HttpApiGroup<"auth", import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getSession", "GET", "/api/auth/get-session", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").NullOr<import("effect/Schema").Struct<{
319
+ readonly session: import("effect/Schema").Struct<{
320
+ readonly id: import("effect/Schema").String;
321
+ readonly expiresAt: import("effect/Schema").Date;
322
+ readonly token: import("effect/Schema").String;
323
+ readonly createdAt: import("effect/Schema").Date;
324
+ readonly updatedAt: import("effect/Schema").Date;
325
+ readonly ipAddress: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
326
+ readonly userAgent: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
327
+ readonly userId: import("effect/Schema").String;
328
+ readonly impersonatedBy: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
329
+ readonly impersonatedByOrganizationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
330
+ readonly activeOrganizationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
331
+ }>;
332
+ readonly user: import("effect/Schema").Struct<{
333
+ readonly id: import("effect/Schema").String;
334
+ readonly name: import("effect/Schema").String;
335
+ readonly email: import("effect/Schema").String;
336
+ readonly emailVerified: import("effect/Schema").Boolean;
337
+ readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
338
+ readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
339
+ readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
340
+ readonly lastLoginMethod: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
341
+ readonly createdAt: import("effect/Schema").Date;
342
+ readonly updatedAt: import("effect/Schema").Date;
343
+ }>;
344
+ }>>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").BadRequest | typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError | typeof import("../better-auth/schema").TooManyRequests>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"organizationImpersonateUser", "POST", "/api/auth/organization/impersonate-user", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
345
+ readonly organizationId: import("effect/Schema").NonEmptyString;
346
+ readonly actorUserId: import("effect/Schema").NonEmptyString;
347
+ readonly targetUserId: import("effect/Schema").NonEmptyString;
348
+ readonly expiresInSeconds: import("effect/Schema").optional<import("effect/Schema").Number>;
349
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
350
+ readonly session: import("effect/Schema").Struct<{
351
+ readonly id: import("effect/Schema").String;
352
+ readonly expiresAt: import("effect/Schema").Date;
353
+ readonly token: import("effect/Schema").String;
354
+ readonly createdAt: import("effect/Schema").Date;
355
+ readonly updatedAt: import("effect/Schema").Date;
356
+ readonly ipAddress: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
357
+ readonly userAgent: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
358
+ readonly userId: import("effect/Schema").String;
359
+ readonly impersonatedBy: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
360
+ readonly impersonatedByOrganizationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
361
+ readonly activeOrganizationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
362
+ }>;
363
+ readonly user: import("effect/Schema").Struct<{
364
+ readonly id: import("effect/Schema").String;
365
+ readonly name: import("effect/Schema").String;
366
+ readonly email: import("effect/Schema").String;
367
+ readonly emailVerified: import("effect/Schema").Boolean;
368
+ readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
369
+ readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
370
+ readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
371
+ readonly lastLoginMethod: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
372
+ readonly createdAt: import("effect/Schema").Date;
373
+ readonly updatedAt: import("effect/Schema").Date;
374
+ }>;
375
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").BadRequest | typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never>, false> | import("effect/unstable/httpapi/HttpApiGroup").HttpApiGroup<"authExtra", import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"createApiKey", "POST", "/api/auth/create-api-key", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
376
+ readonly configId: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"user">, import("effect/Schema").Literal<"organization">, import("effect/Schema").Literal<"service">]>;
377
+ readonly name: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
378
+ readonly organizationId: import("effect/Schema").optional<import("effect/Schema").String>;
379
+ readonly permissions: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
380
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
381
+ readonly id: import("effect/Schema").String;
382
+ readonly key: import("effect/Schema").String;
383
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError | typeof import("../extra/schema").ExtraBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getOrganizationPublicProfile", "GET", "/api/auth/organization-profile", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
384
+ readonly organizationId: import("effect/Schema").String;
385
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
386
+ readonly id: import("effect/Schema").String;
387
+ readonly name: import("effect/Schema").String;
388
+ readonly slug: import("effect/Schema").String;
389
+ readonly displayName: import("effect/Schema").String;
390
+ readonly contactEmail: import("effect/Schema").NullOr<import("effect/Schema").String>;
391
+ readonly logo: import("effect/Schema").NullOr<import("effect/Schema").String>;
392
+ readonly icon: import("effect/Schema").NullOr<import("effect/Schema").String>;
393
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getProjectPublicConfig", "GET", "/api/auth/project-config", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
394
+ readonly projectId: import("effect/Schema").optional<import("effect/Schema").String>;
395
+ readonly clientId: import("effect/Schema").optional<import("effect/Schema").String>;
396
+ readonly host: import("effect/Schema").optional<import("effect/Schema").String>;
397
+ readonly rootHost: import("effect/Schema").optional<import("effect/Schema").String>;
398
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
399
+ readonly projectKey: import("effect/Schema").String;
400
+ readonly name: import("effect/Schema").NullOr<import("effect/Schema").String>;
401
+ readonly logoUrl: import("effect/Schema").NullOr<import("effect/Schema").String>;
402
+ readonly authDomain: import("effect/Schema").NullOr<import("effect/Schema").String>;
403
+ readonly rootDomain: import("effect/Schema").NullOr<import("effect/Schema").String>;
404
+ readonly themeCss: import("effect/Schema").NullOr<import("effect/Schema").String>;
405
+ readonly authOptions: import("effect/Schema").Struct<{
406
+ readonly emailPassword: import("effect/Schema").Boolean;
407
+ readonly emailOtp: import("effect/Schema").Boolean;
408
+ readonly google: import("effect/Schema").Boolean;
409
+ readonly signUp: import("effect/Schema").Boolean;
410
+ readonly signUpName: import("effect/Schema").Boolean;
411
+ }>;
412
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"setPassword", "POST", "/api/auth/set-password", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
413
+ readonly newPassword: import("effect/Schema").NonEmptyString;
414
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
415
+ readonly ok: import("effect/Schema").Boolean;
416
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError | typeof import("../extra/schema").ExtraBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"uploadUserImage", "POST", "/api/auth/image/upload", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/unstable/httpapi/HttpApiSchema").asMultipartStream<import("effect/Schema").Struct<{
417
+ readonly file: import("effect/Schema").decodeTo<import("effect/unstable/http/Multipart").PersistedFileSchema, import("effect/Schema").$Array<import("effect/unstable/http/Multipart").PersistedFileSchema>, never, never>;
418
+ }>>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
419
+ readonly url: import("effect/Schema").String;
420
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError | typeof import("../extra/schema").ExtraBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"verifyApiKey", "POST", "/api/auth/verify-api-key", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
421
+ readonly key: import("effect/Schema").NonEmptyString;
422
+ readonly configId: import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"user">, import("effect/Schema").Literal<"organization">, import("effect/Schema").Literal<"service">]>>;
423
+ readonly permissions: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
424
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
425
+ readonly valid: import("effect/Schema").Boolean;
426
+ readonly error: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
427
+ readonly message: import("effect/Schema").String;
428
+ readonly code: import("effect/Schema").String;
429
+ }>>;
430
+ readonly key: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
431
+ readonly id: import("effect/Schema").String;
432
+ readonly configId: import("effect/Schema").String;
433
+ readonly name: import("effect/Schema").NullOr<import("effect/Schema").String>;
434
+ readonly start: import("effect/Schema").NullOr<import("effect/Schema").String>;
435
+ readonly prefix: import("effect/Schema").NullOr<import("effect/Schema").String>;
436
+ readonly referenceId: import("effect/Schema").String;
437
+ readonly enabled: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
438
+ readonly expiresAt: import("effect/Schema").NullOr<import("effect/Schema").Date>;
439
+ readonly createdAt: import("effect/Schema").Date;
440
+ readonly updatedAt: import("effect/Schema").Date;
441
+ readonly permissions: import("effect/Schema").NullOr<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
442
+ readonly metadata: import("effect/Schema").NullOr<import("effect/Schema").Unknown>;
443
+ }>>;
444
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("../extra/schema").ExtraBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"verifyPassword", "POST", "/api/auth/verify-password", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
445
+ readonly password: import("effect/Schema").NonEmptyString;
446
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
447
+ readonly ok: import("effect/Schema").Boolean;
448
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError | typeof import("../extra/schema").ExtraBadRequest>, never, never>, false>>;
@@ -1,5 +1,5 @@
1
1
  import { apiKeyClient } from "@better-auth/api-key/client";
2
- import { adminClient, emailOTPClient, genericOAuthClient, inferAdditionalFields, lastLoginMethodClient, organizationClient, twoFactorClient } from "better-auth/client/plugins";
2
+ import { adminClient, anonymousClient, emailOTPClient, genericOAuthClient, inferAdditionalFields, lastLoginMethodClient, organizationClient, twoFactorClient } from "better-auth/client/plugins";
3
3
  import { type ReactAuthClient } from "better-auth/react";
4
4
  declare const additionalFields: {
5
5
  readonly session: {
@@ -13,6 +13,7 @@ declare const additionalFields: {
13
13
  type AuthUiClientPlugins = [
14
14
  ReturnType<typeof inferAdditionalFields<never, typeof additionalFields>>,
15
15
  ReturnType<typeof adminClient<{}>>,
16
+ ReturnType<typeof anonymousClient>,
16
17
  ReturnType<typeof emailOTPClient>,
17
18
  ReturnType<typeof lastLoginMethodClient>,
18
19
  ReturnType<typeof organizationClient<{}>>,
@@ -1,5 +1,5 @@
1
1
  import { apiKeyClient } from "@better-auth/api-key/client";
2
- import { adminClient, emailOTPClient, genericOAuthClient, inferAdditionalFields, lastLoginMethodClient, organizationClient, twoFactorClient, } from "better-auth/client/plugins";
2
+ import { adminClient, anonymousClient, emailOTPClient, genericOAuthClient, inferAdditionalFields, lastLoginMethodClient, organizationClient, twoFactorClient, } from "better-auth/client/plugins";
3
3
  import { createAuthClient } from "better-auth/react";
4
4
  const additionalFields = {
5
5
  session: {
@@ -13,6 +13,7 @@ const additionalFields = {
13
13
  const authUiClientPlugins = [
14
14
  inferAdditionalFields(additionalFields),
15
15
  adminClient(),
16
+ anonymousClient(),
16
17
  emailOTPClient(),
17
18
  lastLoginMethodClient({
18
19
  cookieName: "krakstack-auth.last_used_login_method",
@@ -0,0 +1,8 @@
1
+ type ExpiringInvitation = {
2
+ status: string;
3
+ expiresAt: Date | string;
4
+ };
5
+ export declare const isInvitationExpired: (invitation: ExpiringInvitation, now?: number) => boolean;
6
+ export declare const invitationDisplayStatus: (invitation: ExpiringInvitation, now?: number) => string;
7
+ export declare const useInvitationExpirationClock: (invitations: readonly ExpiringInvitation[]) => number;
8
+ export {};
@@ -0,0 +1,24 @@
1
+ import { useEffect, useState } from "react";
2
+ const expirationTime = (invitation) => new Date(invitation.expiresAt).getTime();
3
+ export const isInvitationExpired = (invitation, now = Date.now()) => invitation.status === "pending" && expirationTime(invitation) <= now;
4
+ export const invitationDisplayStatus = (invitation, now = Date.now()) => (isInvitationExpired(invitation, now) ? "expired" : invitation.status);
5
+ export const useInvitationExpirationClock = (invitations) => {
6
+ const [now, setNow] = useState(Date.now);
7
+ const nextExpiration = invitations.reduce((next, invitation) => {
8
+ const expiresAt = expirationTime(invitation);
9
+ if (invitation.status !== "pending" ||
10
+ !Number.isFinite(expiresAt) ||
11
+ expiresAt <= now) {
12
+ return next;
13
+ }
14
+ return next === undefined ? expiresAt : Math.min(next, expiresAt);
15
+ }, undefined);
16
+ useEffect(() => {
17
+ if (nextExpiration === undefined)
18
+ return;
19
+ const delay = Math.min(Math.max(nextExpiration - Date.now() + 1, 0), 2_147_483_647);
20
+ const timeout = globalThis.setTimeout(() => setNow(Date.now()), delay);
21
+ return () => globalThis.clearTimeout(timeout);
22
+ }, [nextExpiration]);
23
+ return now;
24
+ };
@@ -7,6 +7,7 @@ declare const defaultMessages: {
7
7
  readonly member_required_org_description: "You need access to {organization} before opening the admin area.";
8
8
  readonly member_required_no_permission: "Your account is signed in, but it does not have access to this organization.";
9
9
  readonly member_required_invite_found: "You have a pending invitation to {organization}. Accept it to continue.";
10
+ readonly member_required_invite_expired: "Your invitation to {organization} has expired. Contact the organization administrator for a new invitation.";
10
11
  readonly member_required_accept_invite: "Accept invitation";
11
12
  readonly member_required_accepting_invite: "Accepting...";
12
13
  readonly member_required_accept_error: "Could not accept the invitation.";
@@ -21,6 +22,7 @@ declare const defaultMessages: {
21
22
  readonly member_required_org_description: "Vous devez avoir accès à {organization} avant d'ouvrir l'administration.";
22
23
  readonly member_required_no_permission: "Votre compte est connecté, mais il ne dispose pas d'un accès à cette organisation.";
23
24
  readonly member_required_invite_found: "Vous avez une invitation en attente pour {organization}. Acceptez-la pour continuer.";
25
+ readonly member_required_invite_expired: "Votre invitation pour {organization} a expiré. Contactez l'administrateur de l'organisation pour obtenir une nouvelle invitation.";
24
26
  readonly member_required_accept_invite: "Accepter l'invitation";
25
27
  readonly member_required_accepting_invite: "Acceptation...";
26
28
  readonly member_required_accept_error: "Impossible d'accepter l'invitation.";
@@ -8,6 +8,7 @@ import { Button } from "@/components/ui/button";
8
8
  import { CopyButton } from "@/components/ui/copy-button";
9
9
  import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "@/components/ui/card";
10
10
  import { useKrakstackAuth } from "./auth-provider";
11
+ import { isInvitationExpired, useInvitationExpirationClock, } from "./invitation-expiration";
11
12
  const defaultMessages = {
12
13
  en: {
13
14
  member_required_title: "Organization access required",
@@ -15,6 +16,7 @@ const defaultMessages = {
15
16
  member_required_org_description: "You need access to {organization} before opening the admin area.",
16
17
  member_required_no_permission: "Your account is signed in, but it does not have access to this organization.",
17
18
  member_required_invite_found: "You have a pending invitation to {organization}. Accept it to continue.",
19
+ member_required_invite_expired: "Your invitation to {organization} has expired. Contact the organization administrator for a new invitation.",
18
20
  member_required_accept_invite: "Accept invitation",
19
21
  member_required_accepting_invite: "Accepting...",
20
22
  member_required_accept_error: "Could not accept the invitation.",
@@ -29,6 +31,7 @@ const defaultMessages = {
29
31
  member_required_org_description: "Vous devez avoir accès à {organization} avant d'ouvrir l'administration.",
30
32
  member_required_no_permission: "Votre compte est connecté, mais il ne dispose pas d'un accès à cette organisation.",
31
33
  member_required_invite_found: "Vous avez une invitation en attente pour {organization}. Acceptez-la pour continuer.",
34
+ member_required_invite_expired: "Votre invitation pour {organization} a expiré. Contactez l'administrateur de l'organisation pour obtenir une nouvelle invitation.",
32
35
  member_required_accept_invite: "Accepter l'invitation",
33
36
  member_required_accepting_invite: "Acceptation...",
34
37
  member_required_accept_error: "Impossible d'accepter l'invitation.",
@@ -57,7 +60,8 @@ const labels = (locale, overrides) => ({
57
60
  ...(locale === "fr" ? defaultMessages.fr : defaultMessages.en),
58
61
  ...overrides,
59
62
  });
60
- const invitationMatches = (invitation, organizationId) => invitation.status === "pending" && invitation.organizationId === organizationId;
63
+ const invitationMatches = (invitation, organizationId) => invitation.status === "pending" &&
64
+ invitation.organizationId === organizationId;
61
65
  const organizationContactEmail = (organization, fallback) => organization?.contactEmail ?? fallback ?? null;
62
66
  const organizationDisplayName = (invitation, organization, fallback) => organization?.displayName ??
63
67
  organization?.name ??
@@ -134,6 +138,7 @@ function MemberRequiredGate({ accessKey, authClient, contactEmail, children, loc
134
138
  const [accepting, setAccepting] = useState(false);
135
139
  const [error, setError] = useState(null);
136
140
  const access = accessResult.value;
141
+ const invitationNow = useInvitationExpirationClock(access.allowed || !access.invitation ? [] : [access.invitation]);
137
142
  useEffect(() => {
138
143
  if (!access.allowed)
139
144
  return;
@@ -142,10 +147,13 @@ function MemberRequiredGate({ accessKey, authClient, contactEmail, children, loc
142
147
  if (access.allowed)
143
148
  return _jsx(_Fragment, { children: children });
144
149
  const { invitation, organization } = access;
150
+ const invitationExpired = invitation
151
+ ? isInvitationExpired(invitation, invitationNow)
152
+ : false;
145
153
  const displayName = organizationDisplayName(invitation, organization, organizationId);
146
154
  const resolvedContactEmail = organizationContactEmail(organization, contactEmail);
147
155
  const acceptInvitation = async () => {
148
- if (!invitation)
156
+ if (!invitation || isInvitationExpired(invitation))
149
157
  return;
150
158
  setAccepting(true);
151
159
  setError(null);
@@ -166,12 +174,12 @@ function MemberRequiredGate({ accessKey, authClient, contactEmail, children, loc
166
174
  };
167
175
  return (_jsx("main", { className: "relative grid min-h-screen place-items-center px-6 py-10", children: _jsxs(Card, { className: "w-full max-w-md", children: [_jsxs(CardHeader, { children: [_jsx("div", { className: "bg-destructive/10 text-destructive mb-2 flex size-10 items-center justify-center rounded-md", children: _jsx(ShieldAlert, {}) }), _jsx(CardTitle, { children: m.member_required_title }), _jsx(CardDescription, { children: interpolate(m.member_required_org_description, {
168
176
  organization: displayName,
169
- }) })] }), _jsxs(CardContent, { className: "space-y-3", children: [invitation ? (_jsx("p", { className: "text-muted-foreground text-sm", children: interpolate(m.member_required_invite_found, {
170
- organization: displayName,
171
- }) })) : (_jsx("p", { className: "text-muted-foreground text-sm", children: m.member_required_contact_description })), resolvedContactEmail ? (_jsxs("div", { className: "bg-muted/50 flex items-center justify-between gap-3 rounded-md border px-3 py-2 text-sm", children: [_jsxs("span", { className: "flex min-w-0 items-center gap-2 font-medium", children: [_jsx(Mail, { className: "text-muted-foreground size-4 shrink-0" }), _jsx("span", { className: "truncate", children: resolvedContactEmail })] }), _jsx(CopyButton, { value: resolvedContactEmail, valueDescription: resolvedContactEmail, variant: "ghost", className: "shrink-0", messages: {
177
+ }) })] }), _jsxs(CardContent, { className: "space-y-3", children: [invitation ? (_jsx("p", { className: "text-muted-foreground text-sm", children: interpolate(invitationExpired
178
+ ? m.member_required_invite_expired
179
+ : m.member_required_invite_found, { organization: displayName }) })) : (_jsx("p", { className: "text-muted-foreground text-sm", children: m.member_required_contact_description })), resolvedContactEmail ? (_jsxs("div", { className: "bg-muted/50 flex items-center justify-between gap-3 rounded-md border px-3 py-2 text-sm", children: [_jsxs("span", { className: "flex min-w-0 items-center gap-2 font-medium", children: [_jsx(Mail, { className: "text-muted-foreground size-4 shrink-0" }), _jsx("span", { className: "truncate", children: resolvedContactEmail })] }), _jsx(CopyButton, { value: resolvedContactEmail, valueDescription: resolvedContactEmail, variant: "ghost", className: "shrink-0", messages: {
172
180
  copy: m.member_required_copy_email,
173
181
  copied: m.member_required_copied_email,
174
- } })] })) : null, error ? _jsx("p", { className: "text-destructive text-sm", children: error }) : null] }), _jsx(CardFooter, { className: "flex flex-wrap gap-2", children: invitation ? (_jsxs(Button, { onClick: acceptInvitation, disabled: accepting, children: [accepting ? (_jsx(Loader2, { className: "size-4 animate-spin" })) : (_jsx(Check, { className: "size-4" })), accepting
182
+ } })] })) : null, error ? _jsx("p", { className: "text-destructive text-sm", children: error }) : null] }), _jsx(CardFooter, { className: "flex flex-wrap gap-2", children: invitation && !invitationExpired ? (_jsxs(Button, { onClick: acceptInvitation, disabled: accepting, children: [accepting ? (_jsx(Loader2, { className: "size-4 animate-spin" })) : (_jsx(Check, { className: "size-4" })), accepting
175
183
  ? m.member_required_accepting_invite
176
184
  : m.member_required_accept_invite] })) : null })] }) }));
177
185
  }
@@ -24,11 +24,12 @@ declare const messages: {
24
24
  readonly organization_invitation_status: "Status";
25
25
  readonly organization_invitation_status_accepted: "Accepted";
26
26
  readonly organization_invitation_status_canceled: "Canceled";
27
+ readonly organization_invitation_status_expired: "Expired";
27
28
  readonly organization_invitation_status_pending: "Pending";
28
29
  readonly organization_invitation_status_rejected: "Rejected";
29
- readonly organization_invitations_description: "Track invitations that have not been accepted yet.";
30
- readonly organization_invitations_empty: "No pending invitations.";
31
- readonly organization_invitations_heading: "Pending invitations";
30
+ readonly organization_invitations_description: "Track pending and expired invitations.";
31
+ readonly organization_invitations_empty: "No invitations.";
32
+ readonly organization_invitations_heading: "Invitations";
32
33
  readonly organization_invitations_load_error: "Could not load organization invitations.";
33
34
  readonly organization_user_invitations_description: "Review invitations sent to your email address and choose which organizations to join.";
34
35
  readonly organization_user_invitations_empty: "You have no pending invitations.";
@@ -110,11 +111,12 @@ declare const messages: {
110
111
  readonly organization_invitation_status: "Statut";
111
112
  readonly organization_invitation_status_accepted: "Acceptée";
112
113
  readonly organization_invitation_status_canceled: "Annulée";
114
+ readonly organization_invitation_status_expired: "Expirée";
113
115
  readonly organization_invitation_status_pending: "En attente";
114
116
  readonly organization_invitation_status_rejected: "Refusée";
115
- readonly organization_invitations_description: "Suivez les invitations qui n'ont pas encore été acceptées.";
116
- readonly organization_invitations_empty: "Aucune invitation en attente.";
117
- readonly organization_invitations_heading: "Invitations en attente";
117
+ readonly organization_invitations_description: "Suivez les invitations en attente et expirées.";
118
+ readonly organization_invitations_empty: "Aucune invitation.";
119
+ readonly organization_invitations_heading: "Invitations";
118
120
  readonly organization_invitations_load_error: "Impossible de charger les invitations de l'organisation.";
119
121
  readonly organization_user_invitations_description: "Consultez les invitations envoyées à votre adresse courriel et choisissez les organisations à rejoindre.";
120
122
  readonly organization_user_invitations_empty: "Vous n'avez aucune invitation en attente.";
@@ -21,6 +21,7 @@ import { authClientApi } from "./auth-client-api";
21
21
  import { useKrakstackAuth } from "./auth-provider";
22
22
  import { createApiKey } from "./api-key";
23
23
  import { useOpenedOnce } from "./hooks";
24
+ import { invitationDisplayStatus, isInvitationExpired, useInvitationExpirationClock, } from "./invitation-expiration";
24
25
  import { ExtraUploadedAsset } from "../extra/schema";
25
26
  import { assetPath, assetUrl, cn } from "./utils";
26
27
  const messages = {
@@ -46,11 +47,12 @@ const messages = {
46
47
  organization_invitation_status: "Status",
47
48
  organization_invitation_status_accepted: "Accepted",
48
49
  organization_invitation_status_canceled: "Canceled",
50
+ organization_invitation_status_expired: "Expired",
49
51
  organization_invitation_status_pending: "Pending",
50
52
  organization_invitation_status_rejected: "Rejected",
51
- organization_invitations_description: "Track invitations that have not been accepted yet.",
52
- organization_invitations_empty: "No pending invitations.",
53
- organization_invitations_heading: "Pending invitations",
53
+ organization_invitations_description: "Track pending and expired invitations.",
54
+ organization_invitations_empty: "No invitations.",
55
+ organization_invitations_heading: "Invitations",
54
56
  organization_invitations_load_error: "Could not load organization invitations.",
55
57
  organization_user_invitations_description: "Review invitations sent to your email address and choose which organizations to join.",
56
58
  organization_user_invitations_empty: "You have no pending invitations.",
@@ -132,11 +134,12 @@ const messages = {
132
134
  organization_invitation_status: "Statut",
133
135
  organization_invitation_status_accepted: "Acceptée",
134
136
  organization_invitation_status_canceled: "Annulée",
137
+ organization_invitation_status_expired: "Expirée",
135
138
  organization_invitation_status_pending: "En attente",
136
139
  organization_invitation_status_rejected: "Refusée",
137
- organization_invitations_description: "Suivez les invitations qui n'ont pas encore été acceptées.",
138
- organization_invitations_empty: "Aucune invitation en attente.",
139
- organization_invitations_heading: "Invitations en attente",
140
+ organization_invitations_description: "Suivez les invitations en attente et expirées.",
141
+ organization_invitations_empty: "Aucune invitation.",
142
+ organization_invitations_heading: "Invitations",
140
143
  organization_invitations_load_error: "Impossible de charger les invitations de l'organisation.",
141
144
  organization_user_invitations_description: "Consultez les invitations envoyées à votre adresse courriel et choisissez les organisations à rejoindre.",
142
145
  organization_user_invitations_empty: "Vous n'avez aucune invitation en attente.",
@@ -231,6 +234,11 @@ const userInvitationsAtom = Atom.family((authClient) => Atom.keepAlive(Atom.make
231
234
  },
232
235
  catch: (error) => error,
233
236
  }))));
237
+ const invitationOrganizationProfileAtom = Atom.family(({ baseUrl, organizationId, }) => authClientApi(baseUrl).query("authExtra", "getOrganizationPublicProfile", {
238
+ query: { organizationId },
239
+ timeToLive: "5 minutes",
240
+ serializationKey: `invitation-organization:${organizationId}`,
241
+ }));
234
242
  const emptyUserInvitationsAtom = Atom.make(Effect.try({
235
243
  try: () => [],
236
244
  catch: (error) => error,
@@ -375,6 +383,8 @@ const invitationStatusLabel = (status, m) => {
375
383
  return m.organization_invitation_status_accepted();
376
384
  case "canceled":
377
385
  return m.organization_invitation_status_canceled();
386
+ case "expired":
387
+ return m.organization_invitation_status_expired();
378
388
  case "pending":
379
389
  return m.organization_invitation_status_pending();
380
390
  case "rejected":
@@ -545,15 +555,18 @@ export function OrganizationSwitcher({ authClient: providedAuthClient, baseUrl,
545
555
  setDialog((current) => open ? "apiKeys" : current === "apiKeys" ? null : current);
546
556
  }, children: _jsxs(DialogContent, { className: "max-h-[85vh] overflow-y-auto sm:max-w-3xl", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { className: "text-2xl", children: m.user_api_keys_title() }), _jsx(DialogDescription, { children: activeOrganization.data?.name })] }), _jsx(Separator, {}), activeOrganization.data ? (_jsx(OrganizationApiKeyManager, { authClient: authClient, organization: activeOrganization.data, active: dialog === "apiKeys" && canManageApiKeys })) : null] }) }), _jsx(Dialog, { open: dialog === "invitations" && !locked, onOpenChange: (open) => {
547
557
  setDialog((current) => open ? "invitations" : current === "invitations" ? null : current);
548
- }, 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, invitations: userInvitations, loading: loadingUserInvitations, error: userInvitationsError, ...(activeOrganization.data
558
+ }, 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
549
559
  ? { activeOrganizationId: activeOrganization.data.id }
550
560
  : {}), onActionComplete: refreshAfterInvitationAction })] }) })] }));
551
561
  }
552
- function UserInvitationsManager({ authClient, invitations, loading, error, activeOrganizationId, onActionComplete, }) {
562
+ function UserInvitationsManager({ authClient, baseUrl, invitations, loading, error, activeOrganizationId, onActionComplete, }) {
553
563
  const m = useOrganizationMessages();
554
564
  const [actingInvitationId, setActingInvitationId] = useState(null);
555
565
  const [actionError, setActionError] = useState(null);
566
+ const invitationNow = useInvitationExpirationClock(invitations);
556
567
  const acceptInvitation = async (invitation) => {
568
+ if (isInvitationExpired(invitation))
569
+ return;
557
570
  setActingInvitationId(invitation.id);
558
571
  setActionError(null);
559
572
  const result = await authClient.organization.acceptInvitation({
@@ -580,19 +593,33 @@ function UserInvitationsManager({ authClient, invitations, loading, error, activ
580
593
  await onActionComplete(activeOrganizationId);
581
594
  };
582
595
  return (_jsxs("section", { className: "flex flex-col gap-4", children: [error ? _jsx("p", { className: "text-destructive text-sm", children: error }) : null, actionError ? (_jsx("p", { className: "text-destructive text-sm", children: actionError })) : null, _jsx(DataTable, { columns: userInvitationColumns({
596
+ baseUrl,
583
597
  m,
584
- }), data: invitations, emptyLabel: loading ? m.user_loading() : m.organization_user_invitations_empty(), exportFileName: "organization-invitations.csv", features: { gallery: false }, searchState: "local", rowActions: userInvitationRowActions({
585
- m,
586
- actingInvitationId,
587
- onAccept: acceptInvitation,
588
- onReject: rejectInvitation,
589
- }) })] }));
598
+ now: invitationNow,
599
+ }), data: invitations, features: {
600
+ export: { baseName: "organization-invitations" },
601
+ gallery: false,
602
+ rowActions: {
603
+ items: userInvitationRowActions({
604
+ m,
605
+ actingInvitationId,
606
+ now: invitationNow,
607
+ onAccept: acceptInvitation,
608
+ onReject: rejectInvitation,
609
+ }),
610
+ },
611
+ }, searchState: "local", state: {
612
+ empty: loading
613
+ ? m.user_loading()
614
+ : m.organization_user_invitations_empty(),
615
+ loading,
616
+ } })] }));
590
617
  }
591
- const userInvitationColumns = ({ m, }) => [
618
+ const userInvitationColumns = ({ baseUrl, m, now, }) => [
592
619
  {
593
620
  accessorKey: "organizationName",
594
621
  header: m.organization_invitation_organization(),
595
- cell: ({ row }) => (_jsxs("div", { className: "flex min-w-48 flex-col gap-1", children: [_jsx("span", { className: "truncate font-medium", children: row.original.organizationName ?? row.original.organizationId }), _jsx("code", { className: "text-muted-foreground truncate text-xs", children: row.original.organizationId })] })),
622
+ cell: ({ row }) => (_jsx(InvitationOrganizationBrand, { baseUrl: baseUrl, invitation: row.original })),
596
623
  },
597
624
  {
598
625
  accessorKey: "role",
@@ -602,7 +629,7 @@ const userInvitationColumns = ({ m, }) => [
602
629
  {
603
630
  accessorKey: "status",
604
631
  header: m.organization_invitation_status(),
605
- cell: ({ row }) => (_jsx(Badge, { children: invitationStatusLabel(row.original.status, m) })),
632
+ cell: ({ row }) => (_jsx(Badge, { variant: isInvitationExpired(row.original, now) ? "destructive" : "default", children: invitationStatusLabel(invitationDisplayStatus(row.original, now), m) })),
606
633
  },
607
634
  {
608
635
  accessorKey: "expiresAt",
@@ -610,11 +637,27 @@ const userInvitationColumns = ({ m, }) => [
610
637
  cell: ({ row }) => (_jsx("span", { className: "text-muted-foreground text-sm", children: formatOrganizationDate(row.original.expiresAt) })),
611
638
  },
612
639
  ];
613
- const userInvitationRowActions = ({ m, actingInvitationId, onAccept, onReject, }) => [
640
+ function InvitationOrganizationBrand({ baseUrl, invitation, }) {
641
+ const profileResult = useAtomValue(invitationOrganizationProfileAtom({
642
+ baseUrl,
643
+ organizationId: invitation.organizationId,
644
+ }));
645
+ const profile = AsyncResult.match(profileResult, {
646
+ onInitial: () => null,
647
+ onFailure: () => null,
648
+ onSuccess: ({ value }) => value,
649
+ });
650
+ const image = assetUrl(profile?.icon ?? profile?.logo ?? null, baseUrl);
651
+ return (_jsx(AppBrand, { to: null, label: profile?.displayName ??
652
+ invitation.organizationName ??
653
+ invitation.organizationId, subtitle: invitation.organizationId, icon: Building2, className: "min-w-48", ...(image ? { imageSrc: image } : {}) }));
654
+ }
655
+ const userInvitationRowActions = ({ m, actingInvitationId, now, onAccept, onReject, }) => [
614
656
  {
615
657
  name: m.organization_invitation_accept(),
616
658
  icon: _jsx(Check, {}),
617
- visible: (invitation) => actingInvitationId !== invitation.id,
659
+ visible: (invitation) => actingInvitationId !== invitation.id &&
660
+ !isInvitationExpired(invitation, now),
618
661
  onClick: onAccept,
619
662
  },
620
663
  {
@@ -804,12 +847,14 @@ function OrganizationMembersManager({ authClient, baseUrl, canManageMembers, org
804
847
  onFailure: () => null,
805
848
  onSuccess: ({ value }) => value,
806
849
  });
807
- const membersData = currentMembersData ?? lastMembersData ?? {
850
+ const membersData = currentMembersData ??
851
+ lastMembersData ?? {
808
852
  members: [],
809
853
  invitations: [],
810
854
  };
811
855
  const members = membersData.members;
812
856
  const invitations = membersData.invitations;
857
+ const invitationNow = useInvitationExpirationClock(invitations);
813
858
  const [memberRoleOverrides, setMemberRoleOverrides] = useState({});
814
859
  const displayedMembers = members.map((member) => ({
815
860
  ...member,
@@ -922,20 +967,33 @@ function OrganizationMembersManager({ authClient, baseUrl, canManageMembers, org
922
967
  baseUrl,
923
968
  canChangeRoles: canManageMembers,
924
969
  onRoleChange: updateRole,
925
- }), data: displayedMembers, emptyLabel: m.organization_members_empty(), exportFileName: `${organization.slug}-members.csv`, features: { gallery: false }, isLoading: loading, searchState: "local", rowActions: memberRowActions({
926
- m,
927
- canRemoveMembers,
928
- currentUserId,
929
- leavingOrganization,
930
- onLeave: leaveOrganization,
931
- onRemove: removeMember,
932
- }) }) })] }), _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({
933
- m,
934
- }), data: invitations, emptyLabel: m.organization_invitations_empty(), exportFileName: `${organization.slug}-invitations.csv`, features: { gallery: false }, isLoading: loading, searchState: "local", rowActions: invitationRowActions({
970
+ }), data: displayedMembers, features: {
971
+ export: { baseName: `${organization.slug}-members` },
972
+ gallery: false,
973
+ rowActions: {
974
+ items: memberRowActions({
975
+ m,
976
+ canRemoveMembers,
977
+ currentUserId,
978
+ leavingOrganization,
979
+ onLeave: leaveOrganization,
980
+ onRemove: removeMember,
981
+ }),
982
+ },
983
+ }, searchState: "local", state: { empty: m.organization_members_empty(), loading } }) })] }), _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({
935
984
  m,
936
- cancellingInvitationId,
937
- onCancel: cancelInvitation,
938
- }) }) })] })] }));
985
+ now: invitationNow,
986
+ }), data: invitations, features: {
987
+ export: { baseName: `${organization.slug}-invitations` },
988
+ gallery: false,
989
+ rowActions: {
990
+ items: invitationRowActions({
991
+ m,
992
+ cancellingInvitationId,
993
+ onCancel: cancelInvitation,
994
+ }),
995
+ },
996
+ }, searchState: "local", state: { empty: m.organization_invitations_empty(), loading } }) })] })] }));
939
997
  }
940
998
  const memberColumns = ({ m, baseUrl, canChangeRoles, onRoleChange, }) => [
941
999
  {
@@ -962,7 +1020,7 @@ const memberColumns = ({ m, baseUrl, canChangeRoles, onRoleChange, }) => [
962
1020
  return (_jsx(DataTableRelationshipCell, { emptyLabel: m.organization_member_role(), manageLabel: m.organization_member_role(), options: organizationRoles.map((role) => ({
963
1021
  label: organizationRoleLabel(role, m),
964
1022
  value: role,
965
- })), value: roleOptions, from: "/", onAdd: (value) => {
1023
+ })), value: roleOptions, onAdd: (value) => {
966
1024
  if (!isOrganizationRole(value))
967
1025
  return;
968
1026
  onRoleChange(member, Array.from(new Set([...roles, value])));
@@ -998,7 +1056,7 @@ const memberRowActions = ({ m, canRemoveMembers, currentUserId, leavingOrganizat
998
1056
  onClick: onRemove,
999
1057
  },
1000
1058
  ];
1001
- const invitationColumns = ({ m, }) => [
1059
+ const invitationColumns = ({ m, now, }) => [
1002
1060
  {
1003
1061
  accessorKey: "email",
1004
1062
  header: m.organization_member_email(),
@@ -1012,7 +1070,7 @@ const invitationColumns = ({ m, }) => [
1012
1070
  {
1013
1071
  accessorKey: "status",
1014
1072
  header: m.organization_invitation_status(),
1015
- cell: ({ row }) => (_jsx(Badge, { children: invitationStatusLabel(row.original.status, m) })),
1073
+ cell: ({ row }) => (_jsx(Badge, { variant: isInvitationExpired(row.original, now) ? "destructive" : "default", children: invitationStatusLabel(invitationDisplayStatus(row.original, now), m) })),
1016
1074
  },
1017
1075
  {
1018
1076
  accessorKey: "expiresAt",
@@ -1092,7 +1150,16 @@ function OrganizationApiKeyManager({ authClient, organization, active, }) {
1092
1150
  event.preventDefault();
1093
1151
  event.stopPropagation();
1094
1152
  createForm.handleSubmit();
1095
- }, children: [_jsx("p", { className: "text-muted-foreground text-sm", children: m.api_key_rate_limit_notice() }), _jsx(createForm.AppField, { name: "name", children: (field) => (_jsx(field.TextField, { label: m.user_api_key_name(), required: true })) }), _jsx(createForm.FormError, {}), _jsx(createForm.SubmitButton, {})] }) }), createdKey ? (_jsxs("div", { className: "flex flex-col gap-2 rounded-lg border p-4", children: [_jsxs("div", { className: "flex items-center gap-2 font-medium", children: [_jsx(KeyRound, {}), m.user_api_key_created_title()] }), _jsx("p", { className: "text-muted-foreground text-sm", children: m.user_api_key_created_description() }), _jsx("code", { className: "bg-muted overflow-x-auto rounded-md p-3 text-sm", children: createdKey })] })) : null, keysError ? (_jsx("p", { className: "text-destructive text-sm", children: keysError })) : null, error ? _jsx("p", { className: "text-destructive text-sm", children: error }) : null, _jsx(Separator, {}), _jsx(DataTable, { columns: apiKeyColumns({ m }), data: keys, emptyLabel: loading ? m.user_loading() : m.table_empty(), exportFileName: `${organization.slug}-api-keys.csv`, features: { gallery: false }, searchState: "local", rowActions: apiKeyRowActions({ m, onDelete: deleteKey }) })] }));
1153
+ }, children: [_jsx("p", { className: "text-muted-foreground text-sm", children: m.api_key_rate_limit_notice() }), _jsx(createForm.AppField, { name: "name", children: (field) => (_jsx(field.TextField, { label: m.user_api_key_name(), required: true })) }), _jsx(createForm.FormError, {}), _jsx(createForm.SubmitButton, {})] }) }), createdKey ? (_jsxs("div", { className: "flex flex-col gap-2 rounded-lg border p-4", children: [_jsxs("div", { className: "flex items-center gap-2 font-medium", children: [_jsx(KeyRound, {}), m.user_api_key_created_title()] }), _jsx("p", { className: "text-muted-foreground text-sm", children: m.user_api_key_created_description() }), _jsx("code", { className: "bg-muted overflow-x-auto rounded-md p-3 text-sm", children: createdKey })] })) : null, keysError ? (_jsx("p", { className: "text-destructive text-sm", children: keysError })) : null, error ? _jsx("p", { className: "text-destructive text-sm", children: error }) : null, _jsx(Separator, {}), _jsx(DataTable, { columns: apiKeyColumns({ m }), data: keys, features: {
1154
+ export: { baseName: `${organization.slug}-api-keys` },
1155
+ gallery: false,
1156
+ rowActions: {
1157
+ items: apiKeyRowActions({ m, onDelete: deleteKey }),
1158
+ },
1159
+ }, searchState: "local", state: {
1160
+ empty: loading ? m.user_loading() : m.table_empty(),
1161
+ loading,
1162
+ } })] }));
1096
1163
  }
1097
1164
  const apiKeyColumns = ({ m, }) => [
1098
1165
  {
@@ -766,7 +766,16 @@ function ApiKeyManager({ authClient, active, permissions = {}, }) {
766
766
  event.preventDefault();
767
767
  event.stopPropagation();
768
768
  createForm.handleSubmit();
769
- }, children: [_jsx("p", { className: "text-muted-foreground text-sm", children: m.api_key_rate_limit_notice() }), _jsx(createForm.AppField, { name: "name", children: (field) => (_jsx(field.TextField, { label: m.user_api_key_name(), required: true })) }), permissionOptions.length > 0 ? (_jsxs(FieldSet, { children: [_jsx(FieldLegend, { children: m.user_api_key_permissions() }), _jsx(FieldDescription, { children: m.user_api_key_permissions_description() }), _jsx(FieldGroup, { "data-slot": "checkbox-group", className: "gap-3", children: permissionOptions.map((permission) => (_jsxs(Field, { orientation: "horizontal", children: [_jsx(Checkbox, { id: permission.id, checked: selectedPermissions[permission.id] ?? false, onCheckedChange: (checked) => togglePermission(permission.id, checked) }), _jsx(FieldContent, { children: _jsx(FieldLabel, { htmlFor: permission.id, children: permission.id }) })] }, permission.id))) })] })) : null, _jsx(createForm.FormError, {}), _jsx(createForm.SubmitButton, {})] }) }), createdKey ? (_jsxs("div", { className: "flex flex-col gap-2 rounded-lg border p-4", children: [_jsxs("div", { className: "flex items-center gap-2 font-medium", children: [_jsx(KeyRound, {}), m.user_api_key_created_title()] }), _jsx("p", { className: "text-muted-foreground text-sm", children: m.user_api_key_created_description() }), _jsxs("div", { className: "grid min-w-0 gap-2 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center", children: [_jsx("code", { className: "bg-muted block max-w-full overflow-x-auto rounded-md p-3 text-sm whitespace-nowrap", children: createdKey }), _jsxs(Button, { type: "button", variant: "outline", onClick: copyCreatedKey, className: "self-start sm:self-auto", children: [copiedKey ? _jsx(Check, {}) : _jsx(Copy, {}), copiedKey ? m.user_api_key_copied() : m.user_api_key_copy()] })] })] })) : null, keysError ? (_jsx("p", { className: "text-destructive text-sm", children: keysError })) : null, error ? _jsx("p", { className: "text-destructive text-sm", children: error }) : null, _jsx(Separator, {}), _jsx(DataTable, { columns: apiKeyColumns({ m }), data: keys, emptyLabel: loading ? m.user_loading() : m.table_empty(), exportFileName: m.user_api_keys_export_file_name(), features: { gallery: false }, searchState: "local", rowActions: apiKeyRowActions({ m, onDelete: deleteKey }) })] }));
769
+ }, children: [_jsx("p", { className: "text-muted-foreground text-sm", children: m.api_key_rate_limit_notice() }), _jsx(createForm.AppField, { name: "name", children: (field) => (_jsx(field.TextField, { label: m.user_api_key_name(), required: true })) }), permissionOptions.length > 0 ? (_jsxs(FieldSet, { children: [_jsx(FieldLegend, { children: m.user_api_key_permissions() }), _jsx(FieldDescription, { children: m.user_api_key_permissions_description() }), _jsx(FieldGroup, { "data-slot": "checkbox-group", className: "gap-3", children: permissionOptions.map((permission) => (_jsxs(Field, { orientation: "horizontal", children: [_jsx(Checkbox, { id: permission.id, checked: selectedPermissions[permission.id] ?? false, onCheckedChange: (checked) => togglePermission(permission.id, checked) }), _jsx(FieldContent, { children: _jsx(FieldLabel, { htmlFor: permission.id, children: permission.id }) })] }, permission.id))) })] })) : null, _jsx(createForm.FormError, {}), _jsx(createForm.SubmitButton, {})] }) }), createdKey ? (_jsxs("div", { className: "flex flex-col gap-2 rounded-lg border p-4", children: [_jsxs("div", { className: "flex items-center gap-2 font-medium", children: [_jsx(KeyRound, {}), m.user_api_key_created_title()] }), _jsx("p", { className: "text-muted-foreground text-sm", children: m.user_api_key_created_description() }), _jsxs("div", { className: "grid min-w-0 gap-2 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center", children: [_jsx("code", { className: "bg-muted block max-w-full overflow-x-auto rounded-md p-3 text-sm whitespace-nowrap", children: createdKey }), _jsxs(Button, { type: "button", variant: "outline", onClick: copyCreatedKey, className: "self-start sm:self-auto", children: [copiedKey ? _jsx(Check, {}) : _jsx(Copy, {}), copiedKey ? m.user_api_key_copied() : m.user_api_key_copy()] })] })] })) : null, keysError ? (_jsx("p", { className: "text-destructive text-sm", children: keysError })) : null, error ? _jsx("p", { className: "text-destructive text-sm", children: error }) : null, _jsx(Separator, {}), _jsx(DataTable, { columns: apiKeyColumns({ m }), data: keys, features: {
770
+ export: { baseName: m.user_api_keys_export_file_name() },
771
+ gallery: false,
772
+ rowActions: {
773
+ items: apiKeyRowActions({ m, onDelete: deleteKey }),
774
+ },
775
+ }, searchState: "local", state: {
776
+ empty: loading ? m.user_loading() : m.table_empty(),
777
+ loading,
778
+ } })] }));
770
779
  }
771
780
  const apiKeyColumns = ({ m, }) => [
772
781
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krak-stack/auth",
3
- "version": "0.1.49",
3
+ "version": "0.1.51",
4
4
  "description": "Effect HttpApi clients and schemas for KrakStack Auth.",
5
5
  "license": "MIT",
6
6
  "files": [