@kaloma-ai/framework-web 0.0.0-stage → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +677 -0
- package/dist/index.js +3315 -0
- package/dist/theme.css +167 -0
- package/package.json +53 -3
- package/README.md +0 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,677 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode, ButtonHTMLAttributes, InputHTMLAttributes, SelectHTMLAttributes, TextareaHTMLAttributes, HTMLAttributes } from 'react';
|
|
3
|
+
import { LucideIcon } from 'lucide-react';
|
|
4
|
+
import * as better_auth_client from 'better-auth/client';
|
|
5
|
+
import * as better_auth_react from 'better-auth/react';
|
|
6
|
+
import * as better_auth from 'better-auth';
|
|
7
|
+
import * as better_auth_plugins from 'better-auth/plugins';
|
|
8
|
+
|
|
9
|
+
interface NavItem {
|
|
10
|
+
to: string;
|
|
11
|
+
label: string;
|
|
12
|
+
/** An icon from lucide-react, shown next to the label. */
|
|
13
|
+
icon?: LucideIcon;
|
|
14
|
+
/** Only shown to users who hold this permission (the backend still enforces it). */
|
|
15
|
+
permission?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Common page layout: a sidebar with the logo and the app's navigation, one Administration entry for users who
|
|
19
|
+
* may open administration pages, and an account menu (theme, sign out). Inside the administration pages the
|
|
20
|
+
* sidebar shows the administration menu instead, with a link back to the app. On small screens the sidebar
|
|
21
|
+
* becomes a drawer.
|
|
22
|
+
*/
|
|
23
|
+
declare function AppShell({ nav, children }: {
|
|
24
|
+
nav?: NavItem[];
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
}): react.JSX.Element;
|
|
27
|
+
/** Shown for unknown addresses inside the shell. */
|
|
28
|
+
declare function NotFoundPage(): react.JSX.Element;
|
|
29
|
+
|
|
30
|
+
/** The brand as served by GET /api/brand: brand/brand.json gives the first values, the Settings page can change them. */
|
|
31
|
+
interface Brand {
|
|
32
|
+
appName: string;
|
|
33
|
+
logoUrl: string | null;
|
|
34
|
+
fontFamily: string | null;
|
|
35
|
+
fontUrl: string | null;
|
|
36
|
+
colors: {
|
|
37
|
+
primary?: string;
|
|
38
|
+
primaryContrast?: string;
|
|
39
|
+
secondary?: string;
|
|
40
|
+
primaryDark?: string;
|
|
41
|
+
primaryDarkContrast?: string;
|
|
42
|
+
secondaryDark?: string;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
declare const useBrand: () => Brand;
|
|
46
|
+
/** Replaces the live brand (name, logo, colors) without a page reload, e.g. after saving on the Settings page. */
|
|
47
|
+
declare const useSetBrand: () => (brand: Brand) => void;
|
|
48
|
+
/** CSS that overrides the theme.css variables with the brand's values, for light and dark mode. */
|
|
49
|
+
declare function brandCss({ colors, fontFamily, fontUrl }: Brand): string;
|
|
50
|
+
/** Loads the brand profile, themes the whole app with it, and makes it available through `useBrand`. */
|
|
51
|
+
declare function BrandProvider({ children }: {
|
|
52
|
+
children: ReactNode;
|
|
53
|
+
}): react.JSX.Element | null;
|
|
54
|
+
|
|
55
|
+
/** Light, dark, or follow the device. The choice is remembered in the browser. */
|
|
56
|
+
declare function ThemeToggle(): react.JSX.Element;
|
|
57
|
+
|
|
58
|
+
/** Browser-side auth client. Talks to /api/auth on the same origin. */
|
|
59
|
+
declare const authClient: better_auth_react.ReactAuthClient<{
|
|
60
|
+
basePath: string;
|
|
61
|
+
plugins: {
|
|
62
|
+
id: "organization";
|
|
63
|
+
version: string;
|
|
64
|
+
$InferServerPlugin: better_auth_plugins.OrganizationPlugin<{
|
|
65
|
+
ac: better_auth_plugins.AccessControl<{
|
|
66
|
+
readonly organization: readonly ["update", "delete"];
|
|
67
|
+
readonly member: readonly ["create", "update", "delete"];
|
|
68
|
+
readonly invitation: readonly ["create", "cancel"];
|
|
69
|
+
readonly team: readonly ["create", "update", "delete"];
|
|
70
|
+
readonly ac: readonly ["create", "read", "update", "delete"];
|
|
71
|
+
}>;
|
|
72
|
+
roles: {
|
|
73
|
+
admin: better_auth_plugins.Role;
|
|
74
|
+
member: better_auth_plugins.Role;
|
|
75
|
+
owner: better_auth_plugins.Role;
|
|
76
|
+
};
|
|
77
|
+
teams: {
|
|
78
|
+
enabled: false;
|
|
79
|
+
};
|
|
80
|
+
schema: {
|
|
81
|
+
organization?: {
|
|
82
|
+
additionalFields?: {
|
|
83
|
+
[key: string]: better_auth.DBFieldAttribute;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
member?: {
|
|
87
|
+
additionalFields?: {
|
|
88
|
+
[key: string]: better_auth.DBFieldAttribute;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
invitation?: {
|
|
92
|
+
additionalFields?: {
|
|
93
|
+
[key: string]: better_auth.DBFieldAttribute;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
team?: {
|
|
97
|
+
additionalFields?: {
|
|
98
|
+
[key: string]: better_auth.DBFieldAttribute;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
organizationRole?: {
|
|
102
|
+
additionalFields?: {
|
|
103
|
+
[key: string]: better_auth.DBFieldAttribute;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
} | undefined;
|
|
107
|
+
dynamicAccessControl: {
|
|
108
|
+
enabled: false;
|
|
109
|
+
};
|
|
110
|
+
}>;
|
|
111
|
+
getActions: ($fetch: better_auth_react.BetterFetch, _$store: better_auth.ClientStore, co: better_auth.BetterAuthClientOptions | undefined) => {
|
|
112
|
+
$Infer: {
|
|
113
|
+
ActiveOrganization: {
|
|
114
|
+
members: {
|
|
115
|
+
id: string;
|
|
116
|
+
organizationId: string;
|
|
117
|
+
role: "member" | "admin" | "owner";
|
|
118
|
+
createdAt: Date;
|
|
119
|
+
userId: string;
|
|
120
|
+
user: {
|
|
121
|
+
id: string;
|
|
122
|
+
email: string;
|
|
123
|
+
name: string;
|
|
124
|
+
image?: string | undefined;
|
|
125
|
+
};
|
|
126
|
+
}[];
|
|
127
|
+
invitations: {
|
|
128
|
+
id: string;
|
|
129
|
+
organizationId: string;
|
|
130
|
+
email: string;
|
|
131
|
+
role: "member" | "admin" | "owner";
|
|
132
|
+
status: better_auth_plugins.InvitationStatus;
|
|
133
|
+
inviterId: string;
|
|
134
|
+
expiresAt: Date;
|
|
135
|
+
createdAt: Date;
|
|
136
|
+
}[];
|
|
137
|
+
} & {
|
|
138
|
+
id: string;
|
|
139
|
+
name: string;
|
|
140
|
+
slug: string;
|
|
141
|
+
createdAt: Date;
|
|
142
|
+
logo?: string | null | undefined | undefined;
|
|
143
|
+
metadata?: any;
|
|
144
|
+
};
|
|
145
|
+
Organization: {
|
|
146
|
+
id: string;
|
|
147
|
+
name: string;
|
|
148
|
+
slug: string;
|
|
149
|
+
createdAt: Date;
|
|
150
|
+
logo?: string | null | undefined;
|
|
151
|
+
metadata?: any;
|
|
152
|
+
};
|
|
153
|
+
Invitation: {
|
|
154
|
+
id: string;
|
|
155
|
+
organizationId: string;
|
|
156
|
+
email: string;
|
|
157
|
+
role: "member" | "admin" | "owner";
|
|
158
|
+
status: better_auth_plugins.InvitationStatus;
|
|
159
|
+
inviterId: string;
|
|
160
|
+
expiresAt: Date;
|
|
161
|
+
createdAt: Date;
|
|
162
|
+
};
|
|
163
|
+
Member: {
|
|
164
|
+
id: string;
|
|
165
|
+
organizationId: string;
|
|
166
|
+
role: "member" | "admin" | "owner";
|
|
167
|
+
createdAt: Date;
|
|
168
|
+
userId: string;
|
|
169
|
+
user: {
|
|
170
|
+
id: string;
|
|
171
|
+
email: string;
|
|
172
|
+
name: string;
|
|
173
|
+
image?: string | undefined;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
Team: {
|
|
177
|
+
id: string;
|
|
178
|
+
name: string;
|
|
179
|
+
organizationId: string;
|
|
180
|
+
createdAt: Date;
|
|
181
|
+
updatedAt?: Date | undefined;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
organization: {
|
|
185
|
+
checkRolePermission: <R extends "member" | "admin" | "owner">(data: {
|
|
186
|
+
permissions: {
|
|
187
|
+
readonly organization?: ("update" | "delete")[] | undefined;
|
|
188
|
+
readonly member?: ("create" | "update" | "delete")[] | undefined;
|
|
189
|
+
readonly invitation?: ("create" | "cancel")[] | undefined;
|
|
190
|
+
readonly team?: ("create" | "update" | "delete")[] | undefined;
|
|
191
|
+
readonly ac?: ("create" | "update" | "delete" | "read")[] | undefined;
|
|
192
|
+
};
|
|
193
|
+
} & {
|
|
194
|
+
role: R;
|
|
195
|
+
}) => boolean;
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
getAtoms: ($fetch: better_auth_react.BetterFetch) => {
|
|
199
|
+
$listOrg: better_auth_react.PreinitializedWritableAtom<boolean> & object;
|
|
200
|
+
$activeOrgSignal: better_auth_react.PreinitializedWritableAtom<boolean> & object;
|
|
201
|
+
$activeMemberSignal: better_auth_react.PreinitializedWritableAtom<boolean> & object;
|
|
202
|
+
$activeMemberRoleSignal: better_auth_react.PreinitializedWritableAtom<boolean> & object;
|
|
203
|
+
activeOrganization: better_auth_client.AuthQueryAtom<better_auth.Prettify<{
|
|
204
|
+
id: string;
|
|
205
|
+
name: string;
|
|
206
|
+
slug: string;
|
|
207
|
+
createdAt: Date;
|
|
208
|
+
logo?: string | null | undefined | undefined;
|
|
209
|
+
metadata?: any;
|
|
210
|
+
} & {
|
|
211
|
+
members: {
|
|
212
|
+
id: string;
|
|
213
|
+
organizationId: string;
|
|
214
|
+
role: "member" | "admin" | "owner";
|
|
215
|
+
createdAt: Date;
|
|
216
|
+
userId: string;
|
|
217
|
+
user: {
|
|
218
|
+
id: string;
|
|
219
|
+
email: string;
|
|
220
|
+
name: string;
|
|
221
|
+
image?: string | undefined;
|
|
222
|
+
};
|
|
223
|
+
}[];
|
|
224
|
+
invitations: {
|
|
225
|
+
id: string;
|
|
226
|
+
organizationId: string;
|
|
227
|
+
email: string;
|
|
228
|
+
role: "member" | "admin" | "owner";
|
|
229
|
+
status: better_auth_plugins.InvitationStatus;
|
|
230
|
+
inviterId: string;
|
|
231
|
+
expiresAt: Date;
|
|
232
|
+
createdAt: Date;
|
|
233
|
+
}[];
|
|
234
|
+
}>>;
|
|
235
|
+
listOrganizations: better_auth_client.AuthQueryAtom<{
|
|
236
|
+
id: string;
|
|
237
|
+
name: string;
|
|
238
|
+
slug: string;
|
|
239
|
+
createdAt: Date;
|
|
240
|
+
logo?: string | null | undefined | undefined;
|
|
241
|
+
metadata?: any;
|
|
242
|
+
}[]>;
|
|
243
|
+
activeMember: better_auth_client.AuthQueryAtom<{
|
|
244
|
+
id: string;
|
|
245
|
+
organizationId: string;
|
|
246
|
+
userId: string;
|
|
247
|
+
role: string;
|
|
248
|
+
createdAt: Date;
|
|
249
|
+
}>;
|
|
250
|
+
activeMemberRole: better_auth_client.AuthQueryAtom<{
|
|
251
|
+
role: string;
|
|
252
|
+
}>;
|
|
253
|
+
};
|
|
254
|
+
pathMethods: {
|
|
255
|
+
"/organization/get-full-organization": "GET";
|
|
256
|
+
"/organization/list-user-teams": "GET";
|
|
257
|
+
};
|
|
258
|
+
atomListeners: ({
|
|
259
|
+
matcher(path: string): path is "/organization/create" | "/organization/update" | "/organization/delete";
|
|
260
|
+
signal: "$listOrg";
|
|
261
|
+
} | {
|
|
262
|
+
matcher(path: string): boolean;
|
|
263
|
+
signal: "$activeOrgSignal";
|
|
264
|
+
} | {
|
|
265
|
+
matcher(path: string): boolean;
|
|
266
|
+
signal: "$sessionSignal";
|
|
267
|
+
} | {
|
|
268
|
+
matcher(path: string): boolean;
|
|
269
|
+
signal: "$activeMemberSignal";
|
|
270
|
+
} | {
|
|
271
|
+
matcher(path: string): boolean;
|
|
272
|
+
signal: "$activeMemberRoleSignal";
|
|
273
|
+
})[];
|
|
274
|
+
$ERROR_CODES: {
|
|
275
|
+
YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION">;
|
|
276
|
+
YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS: better_auth.RawError<"YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS">;
|
|
277
|
+
ORGANIZATION_ALREADY_EXISTS: better_auth.RawError<"ORGANIZATION_ALREADY_EXISTS">;
|
|
278
|
+
ORGANIZATION_SLUG_ALREADY_TAKEN: better_auth.RawError<"ORGANIZATION_SLUG_ALREADY_TAKEN">;
|
|
279
|
+
ORGANIZATION_NOT_FOUND: better_auth.RawError<"ORGANIZATION_NOT_FOUND">;
|
|
280
|
+
USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION: better_auth.RawError<"USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION">;
|
|
281
|
+
YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION">;
|
|
282
|
+
YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_ORGANIZATION: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_ORGANIZATION">;
|
|
283
|
+
NO_ACTIVE_ORGANIZATION: better_auth.RawError<"NO_ACTIVE_ORGANIZATION">;
|
|
284
|
+
USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION: better_auth.RawError<"USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION">;
|
|
285
|
+
MEMBER_NOT_FOUND: better_auth.RawError<"MEMBER_NOT_FOUND">;
|
|
286
|
+
ROLE_NOT_FOUND: better_auth.RawError<"ROLE_NOT_FOUND">;
|
|
287
|
+
YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM">;
|
|
288
|
+
TEAM_ALREADY_EXISTS: better_auth.RawError<"TEAM_ALREADY_EXISTS">;
|
|
289
|
+
TEAM_NOT_FOUND: better_auth.RawError<"TEAM_NOT_FOUND">;
|
|
290
|
+
YOU_CANNOT_LEAVE_THE_ORGANIZATION_AS_THE_ONLY_OWNER: better_auth.RawError<"YOU_CANNOT_LEAVE_THE_ORGANIZATION_AS_THE_ONLY_OWNER">;
|
|
291
|
+
YOU_CANNOT_LEAVE_THE_ORGANIZATION_WITHOUT_AN_OWNER: better_auth.RawError<"YOU_CANNOT_LEAVE_THE_ORGANIZATION_WITHOUT_AN_OWNER">;
|
|
292
|
+
YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_MEMBER: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_MEMBER">;
|
|
293
|
+
YOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION">;
|
|
294
|
+
USER_IS_ALREADY_INVITED_TO_THIS_ORGANIZATION: better_auth.RawError<"USER_IS_ALREADY_INVITED_TO_THIS_ORGANIZATION">;
|
|
295
|
+
INVITATION_NOT_FOUND: better_auth.RawError<"INVITATION_NOT_FOUND">;
|
|
296
|
+
YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION: better_auth.RawError<"YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION">;
|
|
297
|
+
EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION: better_auth.RawError<"EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION">;
|
|
298
|
+
EMAIL_VERIFICATION_REQUIRED_FOR_INVITATION: better_auth.RawError<"EMAIL_VERIFICATION_REQUIRED_FOR_INVITATION">;
|
|
299
|
+
YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION">;
|
|
300
|
+
INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION: better_auth.RawError<"INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION">;
|
|
301
|
+
YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE">;
|
|
302
|
+
FAILED_TO_RETRIEVE_INVITATION: better_auth.RawError<"FAILED_TO_RETRIEVE_INVITATION">;
|
|
303
|
+
YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_TEAMS: better_auth.RawError<"YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_TEAMS">;
|
|
304
|
+
UNABLE_TO_REMOVE_LAST_TEAM: better_auth.RawError<"UNABLE_TO_REMOVE_LAST_TEAM">;
|
|
305
|
+
YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_MEMBER: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_MEMBER">;
|
|
306
|
+
ORGANIZATION_MEMBERSHIP_LIMIT_REACHED: better_auth.RawError<"ORGANIZATION_MEMBERSHIP_LIMIT_REACHED">;
|
|
307
|
+
YOU_ARE_NOT_ALLOWED_TO_CREATE_TEAMS_IN_THIS_ORGANIZATION: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_TEAMS_IN_THIS_ORGANIZATION">;
|
|
308
|
+
YOU_ARE_NOT_ALLOWED_TO_DELETE_TEAMS_IN_THIS_ORGANIZATION: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_TEAMS_IN_THIS_ORGANIZATION">;
|
|
309
|
+
YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_TEAM: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_TEAM">;
|
|
310
|
+
YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_TEAM: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_TEAM">;
|
|
311
|
+
INVITATION_LIMIT_REACHED: better_auth.RawError<"INVITATION_LIMIT_REACHED">;
|
|
312
|
+
TEAM_MEMBER_LIMIT_REACHED: better_auth.RawError<"TEAM_MEMBER_LIMIT_REACHED">;
|
|
313
|
+
USER_IS_NOT_A_MEMBER_OF_THE_TEAM: better_auth.RawError<"USER_IS_NOT_A_MEMBER_OF_THE_TEAM">;
|
|
314
|
+
YOU_CAN_NOT_ACCESS_THE_MEMBERS_OF_THIS_TEAM: better_auth.RawError<"YOU_CAN_NOT_ACCESS_THE_MEMBERS_OF_THIS_TEAM">;
|
|
315
|
+
YOU_DO_NOT_HAVE_AN_ACTIVE_TEAM: better_auth.RawError<"YOU_DO_NOT_HAVE_AN_ACTIVE_TEAM">;
|
|
316
|
+
YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM_MEMBER: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM_MEMBER">;
|
|
317
|
+
YOU_ARE_NOT_ALLOWED_TO_REMOVE_A_TEAM_MEMBER: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_REMOVE_A_TEAM_MEMBER">;
|
|
318
|
+
YOU_ARE_NOT_ALLOWED_TO_ACCESS_THIS_ORGANIZATION: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_ACCESS_THIS_ORGANIZATION">;
|
|
319
|
+
YOU_ARE_NOT_A_MEMBER_OF_THIS_ORGANIZATION: better_auth.RawError<"YOU_ARE_NOT_A_MEMBER_OF_THIS_ORGANIZATION">;
|
|
320
|
+
MISSING_AC_INSTANCE: better_auth.RawError<"MISSING_AC_INSTANCE">;
|
|
321
|
+
YOU_MUST_BE_IN_AN_ORGANIZATION_TO_CREATE_A_ROLE: better_auth.RawError<"YOU_MUST_BE_IN_AN_ORGANIZATION_TO_CREATE_A_ROLE">;
|
|
322
|
+
YOU_ARE_NOT_ALLOWED_TO_CREATE_A_ROLE: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_A_ROLE">;
|
|
323
|
+
YOU_ARE_NOT_ALLOWED_TO_UPDATE_A_ROLE: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_A_ROLE">;
|
|
324
|
+
YOU_ARE_NOT_ALLOWED_TO_DELETE_A_ROLE: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_A_ROLE">;
|
|
325
|
+
YOU_ARE_NOT_ALLOWED_TO_READ_A_ROLE: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_READ_A_ROLE">;
|
|
326
|
+
YOU_ARE_NOT_ALLOWED_TO_LIST_A_ROLE: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_A_ROLE">;
|
|
327
|
+
YOU_ARE_NOT_ALLOWED_TO_GET_A_ROLE: better_auth.RawError<"YOU_ARE_NOT_ALLOWED_TO_GET_A_ROLE">;
|
|
328
|
+
TOO_MANY_ROLES: better_auth.RawError<"TOO_MANY_ROLES">;
|
|
329
|
+
INVALID_RESOURCE: better_auth.RawError<"INVALID_RESOURCE">;
|
|
330
|
+
ROLE_NAME_IS_ALREADY_TAKEN: better_auth.RawError<"ROLE_NAME_IS_ALREADY_TAKEN">;
|
|
331
|
+
CANNOT_DELETE_A_PRE_DEFINED_ROLE: better_auth.RawError<"CANNOT_DELETE_A_PRE_DEFINED_ROLE">;
|
|
332
|
+
ROLE_IS_ASSIGNED_TO_MEMBERS: better_auth.RawError<"ROLE_IS_ASSIGNED_TO_MEMBERS">;
|
|
333
|
+
INVALID_TEAM_ID: better_auth.RawError<"INVALID_TEAM_ID">;
|
|
334
|
+
};
|
|
335
|
+
}[];
|
|
336
|
+
}>;
|
|
337
|
+
declare const useSession: () => {
|
|
338
|
+
data: {
|
|
339
|
+
user: better_auth.StripEmptyObjects<{
|
|
340
|
+
id: string;
|
|
341
|
+
createdAt: Date;
|
|
342
|
+
updatedAt: Date;
|
|
343
|
+
email: string;
|
|
344
|
+
emailVerified: boolean;
|
|
345
|
+
name: string;
|
|
346
|
+
image?: string | null | undefined;
|
|
347
|
+
}>;
|
|
348
|
+
session: better_auth.StripEmptyObjects<{
|
|
349
|
+
id: string;
|
|
350
|
+
createdAt: Date;
|
|
351
|
+
updatedAt: Date;
|
|
352
|
+
userId: string;
|
|
353
|
+
expiresAt: Date;
|
|
354
|
+
token: string;
|
|
355
|
+
ipAddress?: string | null | undefined;
|
|
356
|
+
userAgent?: string | null | undefined;
|
|
357
|
+
} & {} & {
|
|
358
|
+
activeOrganizationId?: string | null | undefined;
|
|
359
|
+
}>;
|
|
360
|
+
} | null;
|
|
361
|
+
isPending: boolean;
|
|
362
|
+
isRefetching: boolean;
|
|
363
|
+
error: better_auth_react.BetterFetchError | null;
|
|
364
|
+
refetch: (queryParams?: {
|
|
365
|
+
query?: better_auth.SessionQueryParams;
|
|
366
|
+
} | undefined) => Promise<void>;
|
|
367
|
+
};
|
|
368
|
+
type Me = {
|
|
369
|
+
user: {
|
|
370
|
+
id: string;
|
|
371
|
+
email: string;
|
|
372
|
+
name: string;
|
|
373
|
+
};
|
|
374
|
+
roles: string[];
|
|
375
|
+
permissions: string[];
|
|
376
|
+
accessExpiresAt: string | null;
|
|
377
|
+
};
|
|
378
|
+
/** Whether the signed-in user holds a permission. Only hides UI: the backend enforces it. */
|
|
379
|
+
declare function can(me: Me | null, permission: string): boolean;
|
|
380
|
+
|
|
381
|
+
declare function LoginPage(): react.JSX.Element;
|
|
382
|
+
declare function SignupPage(): react.JSX.Element;
|
|
383
|
+
declare function ForgotPasswordPage(): react.JSX.Element;
|
|
384
|
+
declare function ResetPasswordPage(): react.JSX.Element;
|
|
385
|
+
declare function AcceptInvitationPage(): react.JSX.Element;
|
|
386
|
+
/** Wrap pages that need a signed-in user. Redirects to /login and back. */
|
|
387
|
+
declare function RequireAuth({ children }: {
|
|
388
|
+
children: React.ReactNode;
|
|
389
|
+
}): react.JSX.Element;
|
|
390
|
+
/** Loads /api/me (user and role). */
|
|
391
|
+
declare function useMe(): Me | null;
|
|
392
|
+
|
|
393
|
+
/** Calls the API with the session cookie; throws an Error with the server's message on failure. */
|
|
394
|
+
declare function api<T = unknown>(path: string, init?: {
|
|
395
|
+
method?: string;
|
|
396
|
+
body?: unknown;
|
|
397
|
+
}): Promise<T>;
|
|
398
|
+
/** Sends a multipart form (file uploads) with the session cookie; throws an Error with the server's message on failure. */
|
|
399
|
+
declare function apiForm<T = unknown>(path: string, form: FormData, method?: string): Promise<T>;
|
|
400
|
+
|
|
401
|
+
declare function UsersPage(): react.JSX.Element;
|
|
402
|
+
|
|
403
|
+
declare function GroupsPage(): react.JSX.Element;
|
|
404
|
+
|
|
405
|
+
declare function RolesPage(): react.JSX.Element;
|
|
406
|
+
|
|
407
|
+
declare function ApiKeysPage(): react.JSX.Element;
|
|
408
|
+
|
|
409
|
+
declare function AuditPage(): react.JSX.Element;
|
|
410
|
+
|
|
411
|
+
declare function StatusPage(): react.JSX.Element;
|
|
412
|
+
|
|
413
|
+
/** The framework's Settings page: name, logo, brand colors and every parameter the app declares. */
|
|
414
|
+
declare function SettingsPage(): react.JSX.Element;
|
|
415
|
+
|
|
416
|
+
/** The framework's Connections page: storages, AI models and email, set up by an Admin and used by name from app code. */
|
|
417
|
+
declare function ConnectionsPage(): react.JSX.Element;
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* The settings every signed-in user may read (the ones the app marked `expose`), e.g. a default for a form.
|
|
421
|
+
* `null` while loading. Admins change them on the Settings page.
|
|
422
|
+
*/
|
|
423
|
+
declare function useSettingValues(): Record<string, unknown> | null;
|
|
424
|
+
|
|
425
|
+
/** Joins class names, skipping empty values. */
|
|
426
|
+
declare function cn(...parts: (string | false | null | undefined)[]): string;
|
|
427
|
+
|
|
428
|
+
/** "YYYY-MM-DD" as a local calendar date (no time zone surprises). */
|
|
429
|
+
declare function parseDate(value: string): Date;
|
|
430
|
+
declare function toDateString(date: Date): string;
|
|
431
|
+
declare const todayString: () => string;
|
|
432
|
+
declare function addDays(date: string, days: number): string;
|
|
433
|
+
/** "20 Nov 2026" */
|
|
434
|
+
declare function formatDate(value: string | Date | null | undefined): string;
|
|
435
|
+
/** "Fri, 20 Nov 2026" */
|
|
436
|
+
declare function formatDateLong(value: string): string;
|
|
437
|
+
/** "20 Nov 2026, 14:05" */
|
|
438
|
+
declare function formatDateTime(value: string | Date | null | undefined): string;
|
|
439
|
+
/** Whole days from today to a "YYYY-MM-DD" date (negative when it has passed). */
|
|
440
|
+
declare function daysUntil(value: string): number;
|
|
441
|
+
/** "Due today", "Due in 5 days", "Overdue by 2 days". */
|
|
442
|
+
declare function dueText(value: string): string;
|
|
443
|
+
/** "5 minutes ago", "yesterday", or the date for anything older than a week. */
|
|
444
|
+
declare function timeAgo(value: string | Date | null | undefined): string;
|
|
445
|
+
declare function formatBytes(bytes: number): string;
|
|
446
|
+
declare function initials(name: string): string;
|
|
447
|
+
|
|
448
|
+
type Variant = "primary" | "secondary" | "ghost" | "danger";
|
|
449
|
+
type Size = "sm" | "md" | "lg";
|
|
450
|
+
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
451
|
+
variant?: Variant;
|
|
452
|
+
size?: Size;
|
|
453
|
+
loading?: boolean;
|
|
454
|
+
icon?: ReactNode;
|
|
455
|
+
/** Stretch to the full width of the container. */
|
|
456
|
+
block?: boolean;
|
|
457
|
+
}
|
|
458
|
+
declare function buttonClass(variant?: Variant, size?: Size, block?: boolean): string;
|
|
459
|
+
declare function Button({ variant, size, loading, icon, block, className, children, disabled, type, ...props }: ButtonProps): react.JSX.Element;
|
|
460
|
+
/** Round icon-only button; `label` is the accessible name and tooltip. */
|
|
461
|
+
declare function IconButton({ label, children, className, type, ...props }: {
|
|
462
|
+
label: string;
|
|
463
|
+
} & ButtonHTMLAttributes<HTMLButtonElement>): react.JSX.Element;
|
|
464
|
+
|
|
465
|
+
/** A label, the control, and an optional hint or error underneath. */
|
|
466
|
+
declare function Field({ label, hint, error, children, className }: {
|
|
467
|
+
label: string;
|
|
468
|
+
hint?: string;
|
|
469
|
+
error?: string | null;
|
|
470
|
+
children: ReactNode;
|
|
471
|
+
className?: string;
|
|
472
|
+
}): react.JSX.Element;
|
|
473
|
+
declare function Input({ className, ...props }: InputHTMLAttributes<HTMLInputElement>): react.JSX.Element;
|
|
474
|
+
declare function Textarea({ className, ...props }: TextareaHTMLAttributes<HTMLTextAreaElement>): react.JSX.Element;
|
|
475
|
+
declare function Select({ className, children, ...props }: SelectHTMLAttributes<HTMLSelectElement>): react.JSX.Element;
|
|
476
|
+
/** A checkbox with a label and optional description, large enough to hit easily. */
|
|
477
|
+
declare function Checkbox({ label, description, className, ...props }: {
|
|
478
|
+
label: ReactNode;
|
|
479
|
+
description?: ReactNode;
|
|
480
|
+
} & Omit<InputHTMLAttributes<HTMLInputElement>, "type">): react.JSX.Element;
|
|
481
|
+
/** A color swatch (opens the browser's color picker) next to a hex field. Empty means "use the default". */
|
|
482
|
+
declare function ColorField({ value, onChange, placeholder, disabled }: {
|
|
483
|
+
value: string | null;
|
|
484
|
+
onChange: (value: string | null) => void;
|
|
485
|
+
placeholder?: string;
|
|
486
|
+
disabled?: boolean;
|
|
487
|
+
}): react.JSX.Element;
|
|
488
|
+
|
|
489
|
+
declare function Card({ className, ...props }: HTMLAttributes<HTMLDivElement>): react.JSX.Element;
|
|
490
|
+
/** Title, description and actions at the top of a page. */
|
|
491
|
+
declare function PageHeader({ title, description, actions, back }: {
|
|
492
|
+
title: ReactNode;
|
|
493
|
+
description?: ReactNode;
|
|
494
|
+
actions?: ReactNode;
|
|
495
|
+
back?: {
|
|
496
|
+
to: string;
|
|
497
|
+
label: string;
|
|
498
|
+
};
|
|
499
|
+
}): react.JSX.Element;
|
|
500
|
+
type Tone = "neutral" | "brand" | "ok" | "warn" | "danger";
|
|
501
|
+
declare function Badge({ tone, dot, className, children }: {
|
|
502
|
+
tone?: Tone;
|
|
503
|
+
dot?: boolean;
|
|
504
|
+
className?: string;
|
|
505
|
+
children: ReactNode;
|
|
506
|
+
}): react.JSX.Element;
|
|
507
|
+
declare function Avatar({ name, size }: {
|
|
508
|
+
name: string;
|
|
509
|
+
size?: "sm" | "md" | "lg";
|
|
510
|
+
}): react.JSX.Element;
|
|
511
|
+
declare const alertStyles: Record<"info" | "success" | "warning" | "error", {
|
|
512
|
+
box: string;
|
|
513
|
+
icon: LucideIcon;
|
|
514
|
+
}>;
|
|
515
|
+
declare function Alert({ kind, title, children, className }: {
|
|
516
|
+
kind?: keyof typeof alertStyles;
|
|
517
|
+
title?: string;
|
|
518
|
+
children?: ReactNode;
|
|
519
|
+
className?: string;
|
|
520
|
+
}): react.JSX.Element;
|
|
521
|
+
declare function EmptyState({ icon: Icon, title, description, action }: {
|
|
522
|
+
icon?: LucideIcon;
|
|
523
|
+
title: string;
|
|
524
|
+
description?: ReactNode;
|
|
525
|
+
action?: ReactNode;
|
|
526
|
+
}): react.JSX.Element;
|
|
527
|
+
declare function Spinner({ label }: {
|
|
528
|
+
label?: string;
|
|
529
|
+
}): react.JSX.Element;
|
|
530
|
+
declare function ProgressBar({ value, max, tone, className }: {
|
|
531
|
+
value: number;
|
|
532
|
+
max: number;
|
|
533
|
+
tone?: "ok" | "brand" | "danger" | "warn";
|
|
534
|
+
className?: string;
|
|
535
|
+
}): react.JSX.Element;
|
|
536
|
+
declare function StatCard({ icon: Icon, label, value, tone, hint, to }: {
|
|
537
|
+
icon: LucideIcon;
|
|
538
|
+
label: string;
|
|
539
|
+
value: ReactNode;
|
|
540
|
+
tone?: Tone;
|
|
541
|
+
hint?: string;
|
|
542
|
+
to?: string;
|
|
543
|
+
}): react.JSX.Element;
|
|
544
|
+
/** Table pieces with consistent spacing; wrap in a Card for the framed look. */
|
|
545
|
+
declare function Table({ className, ...props }: HTMLAttributes<HTMLTableElement>): react.JSX.Element;
|
|
546
|
+
declare const TH: ({ className, ...props }: HTMLAttributes<HTMLTableCellElement>) => react.JSX.Element;
|
|
547
|
+
declare const TD: ({ className, ...props }: HTMLAttributes<HTMLTableCellElement>) => react.JSX.Element;
|
|
548
|
+
declare const TR: ({ className, ...props }: HTMLAttributes<HTMLTableRowElement>) => react.JSX.Element;
|
|
549
|
+
/** Segmented control for switching between a few views or filters. */
|
|
550
|
+
declare function Segmented<T extends string>({ value, onChange, options, label }: {
|
|
551
|
+
value: T;
|
|
552
|
+
onChange: (v: T) => void;
|
|
553
|
+
options: {
|
|
554
|
+
value: T;
|
|
555
|
+
label: string;
|
|
556
|
+
count?: number;
|
|
557
|
+
}[];
|
|
558
|
+
label: string;
|
|
559
|
+
}): react.JSX.Element;
|
|
560
|
+
|
|
561
|
+
/** A centered dialog with a title, scrolling body and a footer for the actions. */
|
|
562
|
+
declare function Dialog({ open, onClose, title, description, children, footer, size, }: {
|
|
563
|
+
open: boolean;
|
|
564
|
+
onClose: () => void;
|
|
565
|
+
title: string;
|
|
566
|
+
description?: string;
|
|
567
|
+
children: ReactNode;
|
|
568
|
+
footer?: ReactNode;
|
|
569
|
+
size?: "sm" | "md" | "lg";
|
|
570
|
+
}): react.JSX.Element;
|
|
571
|
+
interface ConfirmOptions {
|
|
572
|
+
title: string;
|
|
573
|
+
description?: string;
|
|
574
|
+
confirmLabel?: string;
|
|
575
|
+
cancelLabel?: string;
|
|
576
|
+
/** "danger" for destructive actions. */
|
|
577
|
+
tone?: "default" | "danger";
|
|
578
|
+
}
|
|
579
|
+
/** Replaces window.confirm: `if (await confirm({ title: "Delete this role?", tone: "danger" })) ...` */
|
|
580
|
+
declare function useConfirm(): (options: ConfirmOptions) => Promise<boolean>;
|
|
581
|
+
declare function ConfirmProvider({ children }: {
|
|
582
|
+
children: ReactNode;
|
|
583
|
+
}): react.JSX.Element;
|
|
584
|
+
|
|
585
|
+
/** Short confirmations that disappear by themselves: `toast.success("Invitation sent")`. */
|
|
586
|
+
declare function useToast(): {
|
|
587
|
+
success: (message: string) => void;
|
|
588
|
+
error: (message: string) => void;
|
|
589
|
+
};
|
|
590
|
+
declare function ToastProvider({ children }: {
|
|
591
|
+
children: ReactNode;
|
|
592
|
+
}): react.JSX.Element;
|
|
593
|
+
/** Toasts and confirmation dialogs for everything below it. BrandProvider already includes it. */
|
|
594
|
+
declare function UiProvider({ children }: {
|
|
595
|
+
children: ReactNode;
|
|
596
|
+
}): react.JSX.Element;
|
|
597
|
+
|
|
598
|
+
interface DatePreset {
|
|
599
|
+
label: string;
|
|
600
|
+
/** Days from today. */
|
|
601
|
+
days: number;
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* A date field with a calendar popover and quick presets. Values are "YYYY-MM-DD" strings (empty when unset).
|
|
605
|
+
* Dates before `min` cannot be picked.
|
|
606
|
+
*/
|
|
607
|
+
declare function DatePicker({ value, onChange, min, placeholder, presets, label, clearable, invalid, }: {
|
|
608
|
+
value: string;
|
|
609
|
+
onChange: (value: string) => void;
|
|
610
|
+
min?: string;
|
|
611
|
+
placeholder?: string;
|
|
612
|
+
presets?: DatePreset[];
|
|
613
|
+
label: string;
|
|
614
|
+
clearable?: boolean;
|
|
615
|
+
invalid?: boolean;
|
|
616
|
+
}): react.JSX.Element;
|
|
617
|
+
|
|
618
|
+
interface Person {
|
|
619
|
+
id: string;
|
|
620
|
+
name: string;
|
|
621
|
+
email: string;
|
|
622
|
+
}
|
|
623
|
+
/** Search, tick and untick people; shows how many are chosen. */
|
|
624
|
+
declare function PeoplePicker({ people, value, onChange, disabledIds, emptyText, maxHeight, }: {
|
|
625
|
+
people: Person[];
|
|
626
|
+
value: string[];
|
|
627
|
+
onChange: (ids: string[]) => void;
|
|
628
|
+
/** People who cannot be changed (for example those already on the list). */
|
|
629
|
+
disabledIds?: string[];
|
|
630
|
+
emptyText?: string;
|
|
631
|
+
maxHeight?: string;
|
|
632
|
+
}): react.JSX.Element;
|
|
633
|
+
|
|
634
|
+
interface GroupOption {
|
|
635
|
+
id: string;
|
|
636
|
+
name: string;
|
|
637
|
+
/** Shown next to the name when given. */
|
|
638
|
+
memberCount?: number;
|
|
639
|
+
}
|
|
640
|
+
/** Tick groups to assign something to or notify (several can be chosen). */
|
|
641
|
+
declare function GroupPicker({ groups, value, onChange, legend, emptyText, }: {
|
|
642
|
+
groups: GroupOption[];
|
|
643
|
+
value: string[];
|
|
644
|
+
onChange: (ids: string[]) => void;
|
|
645
|
+
legend?: string;
|
|
646
|
+
emptyText?: string;
|
|
647
|
+
}): react.JSX.Element;
|
|
648
|
+
|
|
649
|
+
/** Click or drop a file. Shows the chosen file with its size. */
|
|
650
|
+
declare function FileDrop({ file, onChange, accept, hint, maxBytes, label, existingName, }: {
|
|
651
|
+
file: File | null;
|
|
652
|
+
onChange: (file: File | null) => void;
|
|
653
|
+
accept?: string;
|
|
654
|
+
hint?: string;
|
|
655
|
+
maxBytes?: number;
|
|
656
|
+
label?: string;
|
|
657
|
+
/** Name of the file that is already there (when replacing one). */
|
|
658
|
+
existingName?: string;
|
|
659
|
+
}): react.JSX.Element;
|
|
660
|
+
|
|
661
|
+
/** A small popover menu. `trigger` is the button content; items close the menu when clicked. */
|
|
662
|
+
declare function Menu({ trigger, label, children, align }: {
|
|
663
|
+
trigger: ReactNode;
|
|
664
|
+
label: string;
|
|
665
|
+
children: (close: () => void) => ReactNode;
|
|
666
|
+
align?: "start" | "end";
|
|
667
|
+
}): react.JSX.Element;
|
|
668
|
+
declare function MenuItem({ icon, children, onClick, tone }: {
|
|
669
|
+
icon?: ReactNode;
|
|
670
|
+
children: ReactNode;
|
|
671
|
+
onClick: () => void;
|
|
672
|
+
tone?: "default" | "danger";
|
|
673
|
+
}): react.JSX.Element;
|
|
674
|
+
declare const MenuSeparator: () => react.JSX.Element;
|
|
675
|
+
|
|
676
|
+
export { AcceptInvitationPage, Alert, ApiKeysPage, AppShell, AuditPage, Avatar, Badge, BrandProvider, Button, Card, Checkbox, ColorField, ConfirmProvider, ConnectionsPage, DatePicker, Dialog, EmptyState, Field, FileDrop, ForgotPasswordPage, GroupPicker, GroupsPage, IconButton, Input, LoginPage, Menu, MenuItem, MenuSeparator, NotFoundPage, PageHeader, PeoplePicker, ProgressBar, RequireAuth, ResetPasswordPage, RolesPage, Segmented, Select, SettingsPage, SignupPage, Spinner, StatCard, StatusPage, TD, TH, TR, Table, Textarea, ThemeToggle, ToastProvider, UiProvider, UsersPage, addDays, api, apiForm, authClient, brandCss, buttonClass, can, cn, daysUntil, dueText, formatBytes, formatDate, formatDateLong, formatDateTime, initials, parseDate, timeAgo, toDateString, todayString, useBrand, useConfirm, useMe, useSession, useSetBrand, useSettingValues, useToast };
|
|
677
|
+
export type { Brand, ButtonProps, DatePreset, GroupOption, Me, NavItem, Person, Tone };
|