@krak-stack/auth 0.1.50 → 0.1.52

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.
@@ -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: {
@@ -10,12 +10,25 @@ declare const additionalFields: {
10
10
  };
11
11
  };
12
12
  };
13
+ declare const organizationSchema: {
14
+ readonly organization: {
15
+ readonly additionalFields: {
16
+ readonly userId: {
17
+ readonly type: "string";
18
+ readonly required: false;
19
+ };
20
+ };
21
+ };
22
+ };
13
23
  type AuthUiClientPlugins = [
14
24
  ReturnType<typeof inferAdditionalFields<never, typeof additionalFields>>,
15
25
  ReturnType<typeof adminClient<{}>>,
26
+ ReturnType<typeof anonymousClient>,
16
27
  ReturnType<typeof emailOTPClient>,
17
28
  ReturnType<typeof lastLoginMethodClient>,
18
- ReturnType<typeof organizationClient<{}>>,
29
+ ReturnType<typeof organizationClient<{
30
+ schema: typeof organizationSchema;
31
+ }>>,
19
32
  ReturnType<typeof twoFactorClient>,
20
33
  ReturnType<typeof apiKeyClient>,
21
34
  ReturnType<typeof genericOAuthClient>
@@ -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: {
@@ -10,14 +10,25 @@ const additionalFields = {
10
10
  },
11
11
  },
12
12
  };
13
+ const organizationSchema = {
14
+ organization: {
15
+ additionalFields: {
16
+ userId: {
17
+ type: "string",
18
+ required: false,
19
+ },
20
+ },
21
+ },
22
+ };
13
23
  const authUiClientPlugins = [
14
24
  inferAdditionalFields(additionalFields),
15
25
  adminClient(),
26
+ anonymousClient(),
16
27
  emailOTPClient(),
17
28
  lastLoginMethodClient({
18
29
  cookieName: "krakstack-auth.last_used_login_method",
19
30
  }),
20
- organizationClient(),
31
+ organizationClient({ schema: organizationSchema }),
21
32
  twoFactorClient(),
22
33
  apiKeyClient(),
23
34
  genericOAuthClient(),
@@ -7,6 +7,7 @@ type AuthFormProps = {
7
7
  };
8
8
  export declare function Signin(props: AuthFormProps): import("react").JSX.Element;
9
9
  export declare function Signup(props: AuthFormProps): import("react").JSX.Element;
10
+ export declare function VerifyEmail(props: AuthFormProps): import("react").JSX.Element;
10
11
  export declare function ResetPassword(props: AuthFormProps): import("react").JSX.Element;
11
12
  export declare function TwoFactor(props: AuthFormProps): import("react").JSX.Element;
12
13
  export {};
@@ -67,6 +67,13 @@ const defaultMessages = {
67
67
  two_factor_verify_description: "Enter the code from your authenticator app to continue.",
68
68
  two_factor_verify_email_description: "Enter the verification code sent to your email to continue.",
69
69
  two_factor_verify_error: "Could not verify the code.",
70
+ verify_email_code: "Verification code",
71
+ verify_email_description: "Enter the one-time code sent to your email address.",
72
+ verify_email_error: "Unable to verify email.",
73
+ verify_email_resend: "Resend code",
74
+ verify_email_resend_error: "Unable to send verification code.",
75
+ verify_email_resent: "A new verification code has been sent.",
76
+ verify_email_title: "Verify your email",
70
77
  },
71
78
  fr: {
72
79
  auth_continue_with_google: "Continuer avec Google",
@@ -118,6 +125,13 @@ const defaultMessages = {
118
125
  two_factor_verify_description: "Saisissez le code de votre application d'authentification pour continuer.",
119
126
  two_factor_verify_email_description: "Saisissez le code de vérification envoyé à votre courriel pour continuer.",
120
127
  two_factor_verify_error: "Impossible de vérifier le code.",
128
+ verify_email_code: "Code de vérification",
129
+ verify_email_description: "Saisissez le code à usage unique envoyé à votre adresse courriel.",
130
+ verify_email_error: "Impossible de vérifier le courriel.",
131
+ verify_email_resend: "Renvoyer le code",
132
+ verify_email_resend_error: "Impossible d'envoyer le code de vérification.",
133
+ verify_email_resent: "Un nouveau code de vérification a été envoyé.",
134
+ verify_email_title: "Vérifier votre courriel",
121
135
  },
122
136
  };
123
137
  const labels = (locale) => ({
@@ -366,7 +380,7 @@ export function Signin(props) {
366
380
  ? m.sign_in_continue
367
381
  : selectedAuthMethod === "emailOtp"
368
382
  ? m.sign_in_email_otp_verify
369
- : m.auth_sign_in }) })] }) })) : null, options.google && !emailSubmitted ? (_jsxs("div", { className: "mt-4 flex flex-col gap-3", children: [hasPrimaryAuth ? (_jsx(Divider, { label: m.auth_or_continue_with })) : null, _jsxs(Button, { type: "button", variant: "outline", className: "w-full", onClick: signInWithGoogle, children: [_jsx(GoogleLogo, {}), m.auth_continue_with_google] })] })) : null, !hasPrimaryAuth && !options.google ? (_jsx("p", { className: "text-muted-foreground text-sm", children: m.oauth_client_no_auth_methods })) : null, options.signUp ? (_jsxs("p", { className: "text-muted-foreground mt-6 text-center text-sm", children: [m.sign_in_need_account, " ", _jsx(Link, { className: authLinkClassName, to: "/sign-up", search: searchObject(searchString), children: m.auth_sign_up })] })) : null] })] }));
383
+ : m.auth_sign_in }) })] }) })) : null, options.google && !emailSubmitted ? (_jsxs("div", { className: "mt-4 flex flex-col gap-3", children: [hasPrimaryAuth ? (_jsx(Divider, { label: m.auth_or_continue_with })) : null, _jsxs(Button, { type: "button", variant: "outline", className: "w-full", onClick: signInWithGoogle, children: [_jsx(GoogleLogo, {}), m.auth_continue_with_google] })] })) : null, !hasPrimaryAuth && !options.google ? (_jsx("p", { className: "text-muted-foreground text-sm", children: m.oauth_client_no_auth_methods })) : null, options.signUp ? (_jsx("p", { className: "text-muted-foreground mt-6 text-center text-sm", children: _jsxs(Link, { className: authLinkClassName, to: "/sign-up", search: searchObject(searchString), children: [m.sign_in_need_account, " ", m.auth_sign_up] }) })) : null] })] }));
370
384
  }
371
385
  export function Signup(props) {
372
386
  const { authClient, baseUrl, labels: m, projectConfig: providedProjectConfig, } = useAuthFormOptions(props);
@@ -378,7 +392,10 @@ export function Signup(props) {
378
392
  const redirectTarget = getRedirectTarget(searchString, projectConfig?.authDomain, projectConfig?.rootDomain);
379
393
  const authOptions = projectConfig?.authOptions;
380
394
  const onNavigate = (target) => navigate({ href: target });
381
- const onVerifyEmail = (email) => navigate({ to: "/verify-email", search: { email } });
395
+ const onVerifyEmail = (email) => navigate({
396
+ to: "/verify-email",
397
+ search: { ...searchObject(searchString), email },
398
+ });
382
399
  const options = {
383
400
  google: authOptions?.google ?? true,
384
401
  signUp: authOptions?.signUp ?? true,
@@ -444,13 +461,72 @@ export function Signup(props) {
444
461
  }
445
462
  };
446
463
  if (!options.signUp) {
447
- return (_jsxs(Card, { className: "w-full max-w-md", children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "text-3xl", children: m.sign_up_disabled_title }), _jsx(CardDescription, { children: m.sign_up_disabled_description })] }), _jsx(CardContent, { children: _jsxs("p", { className: "text-muted-foreground text-center text-sm", children: [m.sign_up_have_account, " ", _jsx(Link, { className: authLinkClassName, to: "/sign-in", search: searchObject(searchString), children: m.auth_sign_in })] }) })] }));
464
+ return (_jsxs(Card, { className: "w-full max-w-md", children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "text-3xl", children: m.sign_up_disabled_title }), _jsx(CardDescription, { children: m.sign_up_disabled_description })] }), _jsx(CardContent, { children: _jsx("p", { className: "text-muted-foreground text-center text-sm", children: _jsxs(Link, { className: authLinkClassName, to: "/sign-in", search: searchObject(searchString), children: [m.sign_up_have_account, " ", m.auth_sign_in] }) }) })] }));
448
465
  }
449
466
  return (_jsxs(Card, { className: "w-full max-w-md", children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "text-3xl", children: m.sign_up_title }), _jsx(CardDescription, { children: m.sign_up_description })] }), _jsxs(CardContent, { children: [_jsx(form.AppForm, { children: _jsxs("form", { className: "flex flex-col gap-4", onSubmit: (event) => {
450
467
  event.preventDefault();
451
468
  event.stopPropagation();
452
469
  form.handleSubmit();
453
- }, children: [options.signUpName ? (_jsx(form.AppField, { name: "name", children: (field) => (_jsx(field.TextField, { label: m.field_name, autoComplete: "name", required: true })) })) : null, _jsx(form.AppField, { name: "email", children: (field) => (_jsx(field.TextField, { label: m.field_email, type: "email", autoComplete: "email", required: true })) }), _jsx(form.AppField, { name: "password", children: (field) => (_jsx(field.TextField, { label: m.field_password, type: "password", autoComplete: "new-password", minLength: 8, required: true })) }), _jsx(form.FormError, {}), _jsx(form.SubmitButton, {})] }) }), options.google ? (_jsxs("div", { className: "mt-4 flex flex-col gap-3", children: [_jsx(Divider, { label: m.auth_or_continue_with }), _jsxs(Button, { type: "button", variant: "outline", className: "w-full", onClick: signUpWithGoogle, children: [_jsx(GoogleLogo, {}), m.auth_continue_with_google] })] })) : null, _jsxs("p", { className: "text-muted-foreground mt-6 text-center text-sm", children: [m.sign_up_have_account, " ", _jsx(Link, { className: authLinkClassName, to: "/sign-in", search: searchObject(searchString), children: m.auth_sign_in })] })] })] }));
470
+ }, children: [options.signUpName ? (_jsx(form.AppField, { name: "name", children: (field) => (_jsx(field.TextField, { label: m.field_name, autoComplete: "name", required: true })) })) : null, _jsx(form.AppField, { name: "email", children: (field) => (_jsx(field.TextField, { label: m.field_email, type: "email", autoComplete: "email", required: true })) }), _jsx(form.AppField, { name: "password", children: (field) => (_jsx(field.TextField, { label: m.field_password, type: "password", autoComplete: "new-password", minLength: 8, required: true })) }), _jsx(form.FormError, {}), _jsx(form.SubmitButton, {})] }) }), options.google ? (_jsxs("div", { className: "mt-4 flex flex-col gap-3", children: [_jsx(Divider, { label: m.auth_or_continue_with }), _jsxs(Button, { type: "button", variant: "outline", className: "w-full", onClick: signUpWithGoogle, children: [_jsx(GoogleLogo, {}), m.auth_continue_with_google] })] })) : null, _jsx("p", { className: "text-muted-foreground mt-6 text-center text-sm", children: _jsxs(Link, { className: authLinkClassName, to: "/sign-in", search: searchObject(searchString), children: [m.sign_up_have_account, " ", m.auth_sign_in] }) })] })] }));
471
+ }
472
+ export function VerifyEmail(props) {
473
+ const { authClient, baseUrl, labels: m, projectConfig: providedProjectConfig, } = useAuthFormOptions(props);
474
+ const navigate = useNavigate();
475
+ const searchString = useRouterState({
476
+ select: (state) => state.location.searchStr,
477
+ });
478
+ const projectConfig = useAuthProjectConfig(baseUrl, searchString, providedProjectConfig);
479
+ const redirectTarget = getRedirectTarget(searchString, projectConfig?.authDomain, projectConfig?.rootDomain);
480
+ const onNavigate = (target) => navigateTarget(target, navigate);
481
+ const [resent, setResent] = useState(false);
482
+ const form = useAppForm({
483
+ defaultValues: {
484
+ email: getSearchParam(searchString, "email") ?? "",
485
+ otp: "",
486
+ },
487
+ onSubmit: async ({ value, formApi }) => {
488
+ formApi.setErrorMap({ onSubmit: undefined });
489
+ const result = await authClient.emailOtp.verifyEmail({
490
+ email: value.email.trim(),
491
+ otp: value.otp.trim(),
492
+ });
493
+ if (result.error) {
494
+ formApi.setErrorMap({
495
+ onSubmit: {
496
+ form: result.error.message ?? m.verify_email_error,
497
+ fields: {},
498
+ },
499
+ });
500
+ return;
501
+ }
502
+ onNavigate(redirectTarget);
503
+ },
504
+ });
505
+ const resendCode = async () => {
506
+ form.setErrorMap({ onSubmit: undefined });
507
+ const result = await authClient.emailOtp.sendVerificationOtp({
508
+ email: form.state.values.email.trim(),
509
+ type: "email-verification",
510
+ });
511
+ if (result.error) {
512
+ form.setErrorMap({
513
+ onSubmit: {
514
+ form: result.error.message ?? m.verify_email_resend_error,
515
+ fields: {},
516
+ },
517
+ });
518
+ return;
519
+ }
520
+ setResent(true);
521
+ };
522
+ return (_jsxs(Card, { className: "w-full max-w-md", children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "text-3xl", children: m.verify_email_title }), _jsx(CardDescription, { children: m.verify_email_description })] }), _jsxs(CardContent, { children: [_jsx(form.AppForm, { children: _jsxs("form", { className: "flex flex-col gap-4", onSubmit: (event) => {
523
+ event.preventDefault();
524
+ event.stopPropagation();
525
+ form.handleSubmit();
526
+ }, children: [_jsx(form.AppField, { name: "email", children: (field) => (_jsx(field.TextField, { label: m.field_email, type: "email", autoComplete: "email", required: true })) }), _jsx(form.AppField, { name: "otp", children: (field) => {
527
+ const invalid = !field.state.meta.isValid;
528
+ return (_jsxs(Field, { "data-invalid": invalid, children: [_jsx(FieldLabel, { htmlFor: field.name, children: m.verify_email_code }), _jsxs(InputOTP, { id: field.name, name: field.name, maxLength: 6, value: field.state.value ?? "", onChange: (value) => field.handleChange(value), onBlur: field.handleBlur, autoComplete: "one-time-code", inputMode: "numeric", pattern: REGEXP_ONLY_DIGITS, required: true, children: [_jsxs(InputOTPGroup, { children: [_jsx(InputOTPSlot, { index: 0, "aria-invalid": invalid }), _jsx(InputOTPSlot, { index: 1, "aria-invalid": invalid }), _jsx(InputOTPSlot, { index: 2, "aria-invalid": invalid })] }), _jsx(InputOTPSeparator, {}), _jsxs(InputOTPGroup, { children: [_jsx(InputOTPSlot, { index: 3, "aria-invalid": invalid }), _jsx(InputOTPSlot, { index: 4, "aria-invalid": invalid }), _jsx(InputOTPSlot, { index: 5, "aria-invalid": invalid })] })] }), _jsx(FieldError, { errors: field.getMeta().errors })] }));
529
+ } }), _jsx(form.FormError, {}), resent ? (_jsx("p", { className: "text-muted-foreground text-sm", children: m.verify_email_resent })) : null, _jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [_jsx(form.SubmitButton, {}), _jsx(Button, { type: "button", variant: "ghost", onClick: resendCode, children: m.verify_email_resend })] })] }) }), _jsx("p", { className: "text-muted-foreground mt-6 text-center text-sm", children: _jsx(Link, { className: authLinkClassName, to: "/sign-in", children: m.forgot_password_back_to_sign_in }) })] })] }));
454
530
  }
455
531
  export function ResetPassword(props) {
456
532
  const { authClient, labels: m } = useAuthFormOptions(props);
@@ -662,9 +738,8 @@ const shouldUseDocumentRedirect = (target) => {
662
738
  return true;
663
739
  if (target.startsWith("/"))
664
740
  return false;
665
- if (target.startsWith(window.location.origin)) {
666
- return target.slice(window.location.origin.length).startsWith("/api/");
667
- }
741
+ if (target.startsWith(window.location.origin))
742
+ return true;
668
743
  return target.startsWith("http://") || target.startsWith("https://");
669
744
  };
670
745
  const nameFromEmail = (email) => {
@@ -2,7 +2,7 @@ export { KrakstackAuthProvider, useAuthClient, useKrakstackAuth, useKrakstackAut
2
2
  export { createAuthUiClient } from "./auth-client";
3
3
  export { OrganizationSwitcher } from "./organization-switcher";
4
4
  export { MemberRequired } from "./member-required";
5
- export { ResetPassword, Signin, Signup, TwoFactor } from "./auth-forms";
5
+ export { ResetPassword, Signin, Signup, TwoFactor, VerifyEmail, } from "./auth-forms";
6
6
  export { UserButton } from "./user-button";
7
7
  export { AdminOrganizationsTable } from "./admin-organizations";
8
8
  export { AdminOrganizationForm } from "./admin-organization-form";
@@ -2,7 +2,7 @@ export { KrakstackAuthProvider, useAuthClient, useKrakstackAuth, useKrakstackAut
2
2
  export { createAuthUiClient } from "./auth-client";
3
3
  export { OrganizationSwitcher } from "./organization-switcher";
4
4
  export { MemberRequired } from "./member-required";
5
- export { ResetPassword, Signin, Signup, TwoFactor } from "./auth-forms";
5
+ export { ResetPassword, Signin, Signup, TwoFactor, VerifyEmail, } from "./auth-forms";
6
6
  export { UserButton } from "./user-button";
7
7
  export { AdminOrganizationsTable } from "./admin-organizations";
8
8
  export { AdminOrganizationForm } from "./admin-organization-form";
@@ -10,7 +10,7 @@ declare const messages: {
10
10
  readonly organization_copy_id: "Copy organization ID";
11
11
  readonly organization_create_slug_conflict: "That organization slug is already in use. Choose a different slug.";
12
12
  readonly organization_create_title: "Create organization";
13
- readonly organization_edit_description: "Update the active organization's canonical details and localized profile.";
13
+ readonly organization_edit_description: "Update the active organization's localized profile.";
14
14
  readonly organization_invitation_cancel: "Cancel invitation";
15
15
  readonly organization_invitation_cancel_error: "Could not cancel the invitation.";
16
16
  readonly organization_invitation_accept: "Accept invitation";
@@ -56,7 +56,7 @@ declare const messages: {
56
56
  readonly organization_members_heading: "Organization members";
57
57
  readonly organization_members_load_error: "Could not load organization members.";
58
58
  readonly organization_members_title: "Members";
59
- readonly organization_name: "Organization name";
59
+ readonly organization_name_required: "Enter a name in at least one language.";
60
60
  readonly organization_role_admin: "Admin";
61
61
  readonly organization_role_member: "Member";
62
62
  readonly organization_role_owner: "Owner";
@@ -67,10 +67,11 @@ declare const messages: {
67
67
  readonly organization_switcher_label: "Organization";
68
68
  readonly organization_switcher_manage: "Manage organization";
69
69
  readonly organization_switcher_no_other_organizations: "No other organizations.";
70
+ readonly organization_switcher_personal: "Personal";
70
71
  readonly organization_translation_description: "Localized organization details stored in metadata.";
71
72
  readonly organization_translation_english: "English profile";
72
73
  readonly organization_translation_french: "French profile";
73
- readonly organization_translation_name: "Localized name";
74
+ readonly organization_translation_name: "Name";
74
75
  readonly organization_update_error: "Could not update the organization.";
75
76
  readonly table_empty: "No results.";
76
77
  readonly user_api_key_create_error: "Could not create the API key.";
@@ -97,7 +98,7 @@ declare const messages: {
97
98
  readonly organization_copy_id: "Copier l'ID de l'organisation";
98
99
  readonly organization_create_slug_conflict: "Ce slug d'organisation est déjà utilisé. Choisissez un autre slug.";
99
100
  readonly organization_create_title: "Créer une organisation";
100
- readonly organization_edit_description: "Mettez à jour les détails canoniques et le profil localisé de l'organisation active.";
101
+ readonly organization_edit_description: "Mettez à jour le profil localisé de l'organisation active.";
101
102
  readonly organization_invitation_cancel: "Annuler l'invitation";
102
103
  readonly organization_invitation_cancel_error: "Impossible d'annuler l'invitation.";
103
104
  readonly organization_invitation_accept: "Accepter l'invitation";
@@ -143,7 +144,7 @@ declare const messages: {
143
144
  readonly organization_members_heading: "Membres de l'organisation";
144
145
  readonly organization_members_load_error: "Impossible de charger les membres de l'organisation.";
145
146
  readonly organization_members_title: "Membres";
146
- readonly organization_name: "Nom de l'organisation";
147
+ readonly organization_name_required: "Saisissez un nom dans au moins une langue.";
147
148
  readonly organization_role_admin: "Admin";
148
149
  readonly organization_role_member: "Membre";
149
150
  readonly organization_role_owner: "Propriétaire";
@@ -154,10 +155,11 @@ declare const messages: {
154
155
  readonly organization_switcher_label: "Organisation";
155
156
  readonly organization_switcher_manage: "Gérer l'organisation";
156
157
  readonly organization_switcher_no_other_organizations: "Aucune autre organisation.";
158
+ readonly organization_switcher_personal: "Personnel";
157
159
  readonly organization_translation_description: "Détails localisés de l'organisation stockés dans les métadonnées.";
158
160
  readonly organization_translation_english: "Profil anglais";
159
161
  readonly organization_translation_french: "Profil français";
160
- readonly organization_translation_name: "Nom localisé";
162
+ readonly organization_translation_name: "Nom";
161
163
  readonly organization_update_error: "Impossible de mettre à jour l'organisation.";
162
164
  readonly table_empty: "Aucun résultat.";
163
165
  readonly user_api_key_create_error: "Impossible de créer la clé API.";
@@ -200,6 +202,7 @@ type OrganizationSummary = {
200
202
  name: string;
201
203
  slug: string;
202
204
  metadata?: unknown;
205
+ userId?: string | null;
203
206
  };
204
207
  export type OrganizationSwitcherDialog = "create" | "manage" | "members" | "apiKeys" | "invitations";
205
208
  export declare function OrganizationSwitcher({ authClient: providedAuthClient, baseUrl, side, className, defaultDialog, hideTrigger, menuActions, renderUnauthenticated, locked, messages, dialog: controlledDialog, onChange, onCreate, onDialogChange, }: OrganizationSwitcherProps): import("react").JSX.Element;
@@ -9,6 +9,7 @@ import { createContext, useContext, useEffect, useEffectEvent, useRef, useState,
9
9
  import { DataTable, DataTableRelationshipCell, } from "@/components/ui/data-table";
10
10
  import { EditingLocaleSwitcher } from "@/components/ui/editing-locale-switcher";
11
11
  import { AppBrand } from "@/components/ui/app-brand";
12
+ import { FieldSet } from "@/components/ui/field";
12
13
  import { useAppForm } from "@/components/ui/form";
13
14
  import { Badge } from "@/components/ui/badge";
14
15
  import { Button } from "@/components/ui/button";
@@ -33,7 +34,7 @@ const messages = {
33
34
  organization_copy_id: "Copy organization ID",
34
35
  organization_create_slug_conflict: "That organization slug is already in use. Choose a different slug.",
35
36
  organization_create_title: "Create organization",
36
- organization_edit_description: "Update the active organization's canonical details and localized profile.",
37
+ organization_edit_description: "Update the active organization's localized profile.",
37
38
  organization_invitation_cancel: "Cancel invitation",
38
39
  organization_invitation_cancel_error: "Could not cancel the invitation.",
39
40
  organization_invitation_accept: "Accept invitation",
@@ -79,7 +80,7 @@ const messages = {
79
80
  organization_members_heading: "Organization members",
80
81
  organization_members_load_error: "Could not load organization members.",
81
82
  organization_members_title: "Members",
82
- organization_name: "Organization name",
83
+ organization_name_required: "Enter a name in at least one language.",
83
84
  organization_role_admin: "Admin",
84
85
  organization_role_member: "Member",
85
86
  organization_role_owner: "Owner",
@@ -90,10 +91,11 @@ const messages = {
90
91
  organization_switcher_label: "Organization",
91
92
  organization_switcher_manage: "Manage organization",
92
93
  organization_switcher_no_other_organizations: "No other organizations.",
94
+ organization_switcher_personal: "Personal",
93
95
  organization_translation_description: "Localized organization details stored in metadata.",
94
96
  organization_translation_english: "English profile",
95
97
  organization_translation_french: "French profile",
96
- organization_translation_name: "Localized name",
98
+ organization_translation_name: "Name",
97
99
  organization_update_error: "Could not update the organization.",
98
100
  table_empty: "No results.",
99
101
  user_api_key_create_error: "Could not create the API key.",
@@ -120,7 +122,7 @@ const messages = {
120
122
  organization_copy_id: "Copier l'ID de l'organisation",
121
123
  organization_create_slug_conflict: "Ce slug d'organisation est déjà utilisé. Choisissez un autre slug.",
122
124
  organization_create_title: "Créer une organisation",
123
- organization_edit_description: "Mettez à jour les détails canoniques et le profil localisé de l'organisation active.",
125
+ organization_edit_description: "Mettez à jour le profil localisé de l'organisation active.",
124
126
  organization_invitation_cancel: "Annuler l'invitation",
125
127
  organization_invitation_cancel_error: "Impossible d'annuler l'invitation.",
126
128
  organization_invitation_accept: "Accepter l'invitation",
@@ -166,7 +168,7 @@ const messages = {
166
168
  organization_members_heading: "Membres de l'organisation",
167
169
  organization_members_load_error: "Impossible de charger les membres de l'organisation.",
168
170
  organization_members_title: "Membres",
169
- organization_name: "Nom de l'organisation",
171
+ organization_name_required: "Saisissez un nom dans au moins une langue.",
170
172
  organization_role_admin: "Admin",
171
173
  organization_role_member: "Membre",
172
174
  organization_role_owner: "Propriétaire",
@@ -177,10 +179,11 @@ const messages = {
177
179
  organization_switcher_label: "Organisation",
178
180
  organization_switcher_manage: "Gérer l'organisation",
179
181
  organization_switcher_no_other_organizations: "Aucune autre organisation.",
182
+ organization_switcher_personal: "Personnel",
180
183
  organization_translation_description: "Détails localisés de l'organisation stockés dans les métadonnées.",
181
184
  organization_translation_english: "Profil anglais",
182
185
  organization_translation_french: "Profil français",
183
- organization_translation_name: "Nom localisé",
186
+ organization_translation_name: "Nom",
184
187
  organization_update_error: "Impossible de mettre à jour l'organisation.",
185
188
  table_empty: "Aucun résultat.",
186
189
  user_api_key_create_error: "Impossible de créer la clé API.",
@@ -339,12 +342,14 @@ const organizationDisplay = (organization, m, baseUrl) => {
339
342
  image: assetUrl(translation?.icon || translation?.logo, baseUrl),
340
343
  };
341
344
  };
345
+ const organizationSwitcherSubtitle = (organization, subtitle, m) => organization?.userId
346
+ ? `${m.organization_switcher_personal()} · ${subtitle}`
347
+ : subtitle;
342
348
  const organizationFormDefaults = (organization, baseUrl) => {
343
349
  const translations = parseOrganizationMetadata(organization?.metadata).translations;
344
350
  const en = translations.find((translation) => translation.locale === "en");
345
351
  const fr = translations.find((translation) => translation.locale === "fr");
346
352
  return {
347
- name: organization?.name ?? "",
348
353
  slug: organization?.slug ?? "",
349
354
  enName: en?.name || organization?.name || "",
350
355
  enLogo: assetUrl(en?.logo, baseUrl) || null,
@@ -365,6 +370,11 @@ const organizationLogoFromForm = async (value, m, uploadImage) => {
365
370
  return assetPath(value);
366
371
  return null;
367
372
  };
373
+ const organizationNameFromForm = (value, locale) => {
374
+ const preferredName = locale === "fr" ? value.frName : value.enName;
375
+ const fallbackName = locale === "fr" ? value.enName : value.frName;
376
+ return preferredName.trim() || fallbackName.trim();
377
+ };
368
378
  const organizationRoleLabel = (role, m) => {
369
379
  switch (normalizeOrganizationRole(role)) {
370
380
  case "owner":
@@ -396,7 +406,7 @@ const invitationStatusLabel = (status, m) => {
396
406
  const formatOrganizationDate = (date) => new Intl.DateTimeFormat(getLocale(), { dateStyle: "medium" }).format(new Date(date));
397
407
  const organizationMetadataFromForm = async (value, m, uploadImage) => {
398
408
  const translations = [];
399
- const enName = value.enName.trim() || value.name.trim();
409
+ const enName = value.enName.trim();
400
410
  const frName = value.frName.trim();
401
411
  const enLogo = await organizationLogoFromForm(value.enLogo, m, uploadImage);
402
412
  const enIcon = await organizationLogoFromForm(value.enIcon, m, uploadImage);
@@ -504,11 +514,12 @@ export function OrganizationSwitcher({ authClient: providedAuthClient, baseUrl,
504
514
  }
505
515
  };
506
516
  const activeDisplay = organizationDisplay(active ?? null, m, baseUrl);
517
+ const activeSubtitle = organizationSwitcherSubtitle(active ?? null, activeDisplay.subtitle, m);
507
518
  return (_jsxs(OrganizationMessagesContext.Provider, { value: m, children: [hideTrigger ? null : (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { render: _jsxs(Button, { variant: "ghost", className: cn("h-11 w-full justify-between gap-2 !px-1 !py-0 group-data-[collapsible=icon]:size-8 group-data-[collapsible=icon]:justify-start group-data-[collapsible=icon]:!p-0", className), children: [_jsx(AppBrand, { to: null, label: activeName
508
519
  ? activeDisplay.name
509
- : m.organization_switcher_label(), subtitle: activeDisplay.subtitle, icon: Building2, variant: "sidebar", className: "min-w-0 flex-1 !p-0 text-left group-data-[collapsible=icon]:flex-none group-data-[collapsible=icon]:justify-start", ...(activeDisplay.image
520
+ : m.organization_switcher_label(), subtitle: activeSubtitle, icon: Building2, variant: "sidebar", className: "min-w-0 flex-1 !p-0 text-left group-data-[collapsible=icon]:flex-none group-data-[collapsible=icon]:justify-start", ...(activeDisplay.image
510
521
  ? { imageSrc: activeDisplay.image }
511
- : {}) }), _jsx(ChevronsUpDown, { className: "text-muted-foreground size-4 shrink-0 group-data-[collapsible=icon]:hidden" })] }) }), _jsx(DropdownMenuContent, { className: "min-w-64 rounded-lg", side: side, align: "end", sideOffset: 4, children: _jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { className: "p-0 font-normal", children: _jsx(AppBrand, { to: null, label: activeDisplay.name, subtitle: activeDisplay.subtitle, icon: Building2, variant: "sidebar", className: "px-1 py-1.5 text-left text-sm", ...(activeDisplay.image
522
+ : {}) }), _jsx(ChevronsUpDown, { className: "text-muted-foreground size-4 shrink-0 group-data-[collapsible=icon]:hidden" })] }) }), _jsx(DropdownMenuContent, { className: "min-w-64 rounded-lg", side: side, align: "end", sideOffset: 4, children: _jsxs(DropdownMenuGroup, { children: [_jsx(DropdownMenuLabel, { className: "p-0 font-normal", children: _jsx(AppBrand, { to: null, label: activeDisplay.name, subtitle: activeSubtitle, icon: Building2, variant: "sidebar", className: "px-1 py-1.5 text-left text-sm", ...(activeDisplay.image
512
523
  ? { imageSrc: activeDisplay.image }
513
524
  : {}) }) }), menuActions ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), menuActions] })) : null, hasOrganizationListItems ? _jsx(DropdownMenuSeparator, {}) : null, organizations.isPending ? (_jsx(DropdownMenuItem, { disabled: true, children: m.organization_loading() })) : null, organizations.error ? (_jsx(DropdownMenuItem, { disabled: true, children: organizations.error.message })) : null, !locked && selectableOrganizations.length ? (selectableOrganizations.map((organization) => {
514
525
  const display = organizationDisplay(organization, m, baseUrl);
@@ -520,7 +531,7 @@ export function OrganizationSwitcher({ authClient: providedAuthClient, baseUrl,
520
531
  await refresh();
521
532
  onChange?.(organization);
522
533
  }
523
- }, children: _jsx(AppBrand, { to: null, label: display.name, subtitle: display.subtitle, icon: Building2, className: "w-full text-left [&>div:first-child]:size-7", ...(display.image ? { imageSrc: display.image } : {}) }) }, organization.id));
534
+ }, children: _jsx(AppBrand, { to: null, label: display.name, subtitle: organizationSwitcherSubtitle(organization, display.subtitle, m), icon: Building2, className: "w-full text-left [&>div:first-child]:size-7", ...(display.image ? { imageSrc: display.image } : {}) }) }, organization.id));
524
535
  })) : !locked && !organizations.isPending ? (_jsx(DropdownMenuItem, { disabled: true, children: active
525
536
  ? m.organization_switcher_no_other_organizations()
526
537
  : m.organization_switcher_empty() })) : null, !locked ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { onClick: openCreate, children: [_jsx(Plus, {}), m.organization_create_title()] }), _jsxs(DropdownMenuItem, { onClick: () => {
@@ -671,14 +682,24 @@ const userInvitationRowActions = ({ m, actingInvitationId, now, onAccept, onReje
671
682
  function EditOrganizationSection({ authClient, baseUrl, organization, onUpdated, }) {
672
683
  const m = useOrganizationMessages();
673
684
  const uploadImage = useAtomSet(authClientApi(baseUrl).mutation("authExtra", "uploadUserImage"), { mode: "promise" });
674
- const [editingLocale, setEditingLocale] = useState(currentOrganizationLocale());
685
+ const [defaultLocale] = useState(currentOrganizationLocale);
686
+ const [editingLocale, setEditingLocale] = useState(defaultLocale);
675
687
  const defaultValues = organizationFormDefaults(organization, baseUrl);
676
688
  const form = useAppForm({
677
689
  defaultValues,
678
690
  onSubmit: async ({ value, formApi }) => {
679
691
  formApi.setErrorMap({ onSubmit: undefined });
680
692
  try {
681
- const name = value.name.trim();
693
+ const name = organizationNameFromForm(value, defaultLocale);
694
+ if (!name) {
695
+ formApi.setErrorMap({
696
+ onSubmit: {
697
+ form: m.organization_name_required(),
698
+ fields: {},
699
+ },
700
+ });
701
+ return;
702
+ }
682
703
  const slug = value.slug.trim().toLowerCase();
683
704
  const metadata = await organizationMetadataFromForm(value, m, uploadImage);
684
705
  const result = await authClient.organization.update({
@@ -712,7 +733,7 @@ function EditOrganizationSection({ authClient, baseUrl, organization, onUpdated,
712
733
  event.preventDefault();
713
734
  event.stopPropagation();
714
735
  form.handleSubmit();
715
- }, children: [_jsx(form.AppField, { name: "name", children: (field) => (_jsx(field.TextField, { label: m.organization_name(), required: true })) }), _jsx(form.AppField, { name: "slug", children: (field) => (_jsx(field.TextField, { label: m.organization_slug(), required: true })) }), _jsx(Separator, { className: "my-2" }), editingLocale === "en" ? (_jsxs(_Fragment, { children: [_jsx(OrganizationTranslationHeader, { locale: "en", editingLocale: editingLocale, onEditingLocaleChange: setEditingLocale }), _jsx(form.AppField, { name: "enName", children: (field) => (_jsx(field.TextField, { label: m.organization_translation_name(), required: true })) }), _jsx(form.AppField, { name: "enLogo", children: (field) => (_jsx(field.ImageField, { label: m.organization_logo(), size: {
736
+ }, children: [_jsx(form.AppField, { name: "slug", children: (field) => (_jsx(field.TextField, { label: m.organization_slug(), required: true })) }), _jsx(Separator, { className: "my-2" }), _jsx(OrganizationTranslationHeader, { locale: editingLocale, editingLocale: editingLocale, onEditingLocaleChange: setEditingLocale }), _jsxs(FieldSet, { disabled: editingLocale !== "en", className: editingLocale === "en" ? "contents" : "hidden", children: [_jsx(form.AppField, { name: "enName", children: (field) => (_jsx(field.TextField, { label: m.organization_translation_name() })) }), _jsx(form.AppField, { name: "enLogo", children: (field) => (_jsx(field.ImageField, { label: m.organization_logo(), size: {
716
737
  width: 175,
717
738
  height: 50,
718
739
  suggestedWidth: 350,
@@ -722,7 +743,7 @@ function EditOrganizationSection({ authClient, baseUrl, organization, onUpdated,
722
743
  height: 96,
723
744
  suggestedWidth: 512,
724
745
  suggestedHeight: 512,
725
- } })) }), _jsx(form.AppField, { name: "enContactEmail", children: (field) => (_jsx(field.TextField, { label: m.organization_contact_email(), placeholder: "team@example.com", type: "email" })) }), _jsx(form.AppField, { name: "enLocation", children: (field) => (_jsx(field.TextField, { label: m.organization_location() })) })] })) : (_jsxs(_Fragment, { children: [_jsx(OrganizationTranslationHeader, { locale: "fr", editingLocale: editingLocale, onEditingLocaleChange: setEditingLocale }), _jsx(form.AppField, { name: "frName", children: (field) => (_jsx(field.TextField, { label: m.organization_translation_name() })) }), _jsx(form.AppField, { name: "frLogo", children: (field) => (_jsx(field.ImageField, { label: m.organization_logo(), size: {
746
+ } })) }), _jsx(form.AppField, { name: "enContactEmail", children: (field) => (_jsx(field.TextField, { label: m.organization_contact_email(), placeholder: "team@example.com", type: "email" })) }), _jsx(form.AppField, { name: "enLocation", children: (field) => _jsx(field.TextField, { label: m.organization_location() }) })] }), _jsxs(FieldSet, { disabled: editingLocale !== "fr", className: editingLocale === "fr" ? "contents" : "hidden", children: [_jsx(form.AppField, { name: "frName", children: (field) => (_jsx(field.TextField, { label: m.organization_translation_name() })) }), _jsx(form.AppField, { name: "frLogo", children: (field) => (_jsx(field.ImageField, { label: m.organization_logo(), size: {
726
747
  width: 175,
727
748
  height: 50,
728
749
  suggestedWidth: 350,
@@ -732,23 +753,32 @@ function EditOrganizationSection({ authClient, baseUrl, organization, onUpdated,
732
753
  height: 96,
733
754
  suggestedWidth: 512,
734
755
  suggestedHeight: 512,
735
- } })) }), _jsx(form.AppField, { name: "frContactEmail", children: (field) => (_jsx(field.TextField, { label: m.organization_contact_email(), placeholder: "team@example.com", type: "email" })) }), _jsx(form.AppField, { name: "frLocation", children: (field) => (_jsx(field.TextField, { label: m.organization_location() })) })] })), _jsx(form.FormError, {}), _jsx(form.SubmitButton, {})] }) }) }));
756
+ } })) }), _jsx(form.AppField, { name: "frContactEmail", children: (field) => (_jsx(field.TextField, { label: m.organization_contact_email(), placeholder: "team@example.com", type: "email" })) }), _jsx(form.AppField, { name: "frLocation", children: (field) => _jsx(field.TextField, { label: m.organization_location() }) })] }), _jsx(form.FormError, {}), _jsx(form.SubmitButton, {})] }) }) }));
736
757
  }
737
758
  function CreateOrganizationSection({ authClient, baseUrl, onCreated, }) {
738
759
  const m = useOrganizationMessages();
739
760
  const uploadImage = useAtomSet(authClientApi(baseUrl).mutation("authExtra", "uploadUserImage"), { mode: "promise" });
740
- const [editingLocale, setEditingLocale] = useState(currentOrganizationLocale());
761
+ const [defaultLocale] = useState(currentOrganizationLocale);
762
+ const [editingLocale, setEditingLocale] = useState(defaultLocale);
741
763
  const defaultValues = organizationFormDefaults(undefined, baseUrl);
742
764
  const form = useAppForm({
743
765
  defaultValues,
744
766
  onSubmit: async ({ value, formApi }) => {
745
767
  formApi.setErrorMap({ onSubmit: undefined });
746
768
  try {
747
- const name = value.name.trim();
769
+ const name = organizationNameFromForm(value, defaultLocale);
770
+ if (!name) {
771
+ formApi.setErrorMap({
772
+ onSubmit: {
773
+ form: m.organization_name_required(),
774
+ fields: {},
775
+ },
776
+ });
777
+ return;
778
+ }
748
779
  const slug = (value.slug.trim() || slugify(name)).toLowerCase();
749
780
  const metadata = await organizationMetadataFromForm({
750
781
  ...value,
751
- name,
752
782
  slug,
753
783
  }, m, uploadImage);
754
784
  const result = await authClient.organization.create({
@@ -790,7 +820,7 @@ function CreateOrganizationSection({ authClient, baseUrl, onCreated, }) {
790
820
  }
791
821
  },
792
822
  });
793
- const name = useStore(form.store, (state) => state.values.name);
823
+ const name = useStore(form.store, (state) => organizationNameFromForm(state.values, defaultLocale));
794
824
  const slugIsDirty = useStore(form.store, (state) => state.fieldMeta.slug?.isDirty ?? false);
795
825
  useEffect(() => {
796
826
  if (!slugIsDirty) {
@@ -801,7 +831,7 @@ function CreateOrganizationSection({ authClient, baseUrl, onCreated, }) {
801
831
  event.preventDefault();
802
832
  event.stopPropagation();
803
833
  form.handleSubmit();
804
- }, children: [_jsx(form.AppField, { name: "name", children: (field) => (_jsx(field.TextField, { label: m.organization_name(), required: true })) }), _jsx(form.AppField, { name: "slug", children: (field) => (_jsx(field.TextField, { label: m.organization_slug(), description: m.organization_slug_description() })) }), _jsx(Separator, { className: "my-2" }), editingLocale === "en" ? (_jsxs(_Fragment, { children: [_jsx(OrganizationTranslationHeader, { locale: "en", editingLocale: editingLocale, onEditingLocaleChange: setEditingLocale }), _jsx(form.AppField, { name: "enName", children: (field) => (_jsx(field.TextField, { label: m.organization_translation_name(), required: true })) }), _jsx(form.AppField, { name: "enLogo", children: (field) => (_jsx(field.ImageField, { label: m.organization_logo(), size: {
834
+ }, children: [_jsx(form.AppField, { name: "slug", children: (field) => (_jsx(field.TextField, { label: m.organization_slug(), description: m.organization_slug_description() })) }), _jsx(Separator, { className: "my-2" }), _jsx(OrganizationTranslationHeader, { locale: editingLocale, editingLocale: editingLocale, onEditingLocaleChange: setEditingLocale }), _jsxs(FieldSet, { disabled: editingLocale !== "en", className: editingLocale === "en" ? "contents" : "hidden", children: [_jsx(form.AppField, { name: "enName", children: (field) => (_jsx(field.TextField, { label: m.organization_translation_name() })) }), _jsx(form.AppField, { name: "enLogo", children: (field) => (_jsx(field.ImageField, { label: m.organization_logo(), size: {
805
835
  width: 175,
806
836
  height: 50,
807
837
  suggestedWidth: 350,
@@ -811,7 +841,7 @@ function CreateOrganizationSection({ authClient, baseUrl, onCreated, }) {
811
841
  height: 96,
812
842
  suggestedWidth: 512,
813
843
  suggestedHeight: 512,
814
- } })) }), _jsx(form.AppField, { name: "enContactEmail", children: (field) => (_jsx(field.TextField, { label: m.organization_contact_email(), placeholder: "team@example.com", type: "email" })) }), _jsx(form.AppField, { name: "enLocation", children: (field) => (_jsx(field.TextField, { label: m.organization_location() })) })] })) : (_jsxs(_Fragment, { children: [_jsx(OrganizationTranslationHeader, { locale: "fr", editingLocale: editingLocale, onEditingLocaleChange: setEditingLocale }), _jsx(form.AppField, { name: "frName", children: (field) => (_jsx(field.TextField, { label: m.organization_translation_name() })) }), _jsx(form.AppField, { name: "frLogo", children: (field) => (_jsx(field.ImageField, { label: m.organization_logo(), size: {
844
+ } })) }), _jsx(form.AppField, { name: "enContactEmail", children: (field) => (_jsx(field.TextField, { label: m.organization_contact_email(), placeholder: "team@example.com", type: "email" })) }), _jsx(form.AppField, { name: "enLocation", children: (field) => _jsx(field.TextField, { label: m.organization_location() }) })] }), _jsxs(FieldSet, { disabled: editingLocale !== "fr", className: editingLocale === "fr" ? "contents" : "hidden", children: [_jsx(form.AppField, { name: "frName", children: (field) => (_jsx(field.TextField, { label: m.organization_translation_name() })) }), _jsx(form.AppField, { name: "frLogo", children: (field) => (_jsx(field.ImageField, { label: m.organization_logo(), size: {
815
845
  width: 175,
816
846
  height: 50,
817
847
  suggestedWidth: 350,
@@ -821,7 +851,7 @@ function CreateOrganizationSection({ authClient, baseUrl, onCreated, }) {
821
851
  height: 96,
822
852
  suggestedWidth: 512,
823
853
  suggestedHeight: 512,
824
- } })) }), _jsx(form.AppField, { name: "frContactEmail", children: (field) => (_jsx(field.TextField, { label: m.organization_contact_email(), placeholder: "team@example.com", type: "email" })) }), _jsx(form.AppField, { name: "frLocation", children: (field) => (_jsx(field.TextField, { label: m.organization_location() })) })] })), _jsx(form.FormError, {}), _jsx(form.SubmitButton, {})] }) }) }));
854
+ } })) }), _jsx(form.AppField, { name: "frContactEmail", children: (field) => (_jsx(field.TextField, { label: m.organization_contact_email(), placeholder: "team@example.com", type: "email" })) }), _jsx(form.AppField, { name: "frLocation", children: (field) => _jsx(field.TextField, { label: m.organization_location() }) })] }), _jsx(form.FormError, {}), _jsx(form.SubmitButton, {})] }) }) }));
825
855
  }
826
856
  function OrganizationTranslationHeader({ locale, editingLocale, onEditingLocaleChange, }) {
827
857
  const m = useOrganizationMessages();
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export { AuthClientApi, AuthServiceApi } from "./api";
5
5
  export { AuthService, type AuthServiceLayerOptions } from "./service";
6
6
  export { AuthClientConfig } from "./config";
7
7
  export { proxyAuthRequest } from "./server/proxy";
8
- export { OrganizationSwitcher, MemberRequired, KrakstackAuthProvider, ResetPassword, Signin, Signup, TwoFactor, AdminOrganizationForm, AdminOrganizationsTable, AdminUsersTable, UserButton, assetUrl, createAuthUiClient, type AuthUiClient, type MemberRequiredMessages, type MemberRequiredProps, type KrakstackAuthContextValue, type KrakstackAuthLocale, type KrakstackAuthProviderProps, type OrganizationSwitcherDialog, type OrganizationSwitcherProps, type UserButtonDialog, useAuthClient, useAdminUsersTotal, } from "./components";
8
+ export { OrganizationSwitcher, MemberRequired, KrakstackAuthProvider, ResetPassword, Signin, Signup, TwoFactor, VerifyEmail, AdminOrganizationForm, AdminOrganizationsTable, AdminUsersTable, UserButton, assetUrl, createAuthUiClient, type AuthUiClient, type MemberRequiredMessages, type MemberRequiredProps, type KrakstackAuthContextValue, type KrakstackAuthLocale, type KrakstackAuthProviderProps, type OrganizationSwitcherDialog, type OrganizationSwitcherProps, type UserButtonDialog, useAuthClient, useAdminUsersTotal, } from "./components";
9
9
  export * as BetterAuth from "./better-auth/api.group";
10
10
  export * as Extra from "./extra/api.group";
11
11
  export * as Server from "./server";
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ export { AuthClientApi, AuthServiceApi } from "./api";
5
5
  export { AuthService } from "./service";
6
6
  export { AuthClientConfig } from "./config";
7
7
  export { proxyAuthRequest } from "./server/proxy";
8
- export { OrganizationSwitcher, MemberRequired, KrakstackAuthProvider, ResetPassword, Signin, Signup, TwoFactor, AdminOrganizationForm, AdminOrganizationsTable, AdminUsersTable, UserButton, assetUrl, createAuthUiClient, useAuthClient, useAdminUsersTotal, } from "./components";
8
+ export { OrganizationSwitcher, MemberRequired, KrakstackAuthProvider, ResetPassword, Signin, Signup, TwoFactor, VerifyEmail, AdminOrganizationForm, AdminOrganizationsTable, AdminUsersTable, UserButton, assetUrl, createAuthUiClient, useAuthClient, useAdminUsersTotal, } from "./components";
9
9
  export * as BetterAuth from "./better-auth/api.group";
10
10
  export * as Extra from "./extra/api.group";
11
11
  export * as Server from "./server";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krak-stack/auth",
3
- "version": "0.1.50",
3
+ "version": "0.1.52",
4
4
  "description": "Effect HttpApi clients and schemas for KrakStack Auth.",
5
5
  "license": "MIT",
6
6
  "files": [