@krak-stack/auth 0.1.48 → 0.1.49

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,5 +1,135 @@
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<"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<"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<{
3
133
  readonly hostname: import("effect/Schema").NonEmptyString;
4
134
  readonly rootHostname: import("effect/Schema").NonEmptyString;
5
135
  readonly projectId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
@@ -315,134 +445,4 @@ export declare const authClientApi: (baseUrl?: string | undefined) => AtomHttpAp
315
445
  readonly metadata: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
316
446
  readonly memberCount: import("effect/Schema").optional<import("effect/Schema").Number>;
317
447
  readonly createdAt: import("effect/Schema").Date;
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>>;
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>>;
@@ -1,7 +1,7 @@
1
1
  export { KrakstackAuthProvider, useAuthClient, useKrakstackAuth, useKrakstackAuthProjectConfig, } from "./auth-provider";
2
2
  export { createAuthUiClient } from "./auth-client";
3
3
  export { OrganizationSwitcher } from "./organization-switcher";
4
- export { AdminRequired } from "./admin-required";
4
+ export { MemberRequired } from "./member-required";
5
5
  export { ResetPassword, Signin, Signup, TwoFactor } from "./auth-forms";
6
6
  export { UserButton } from "./user-button";
7
7
  export { AdminOrganizationsTable } from "./admin-organizations";
@@ -12,4 +12,4 @@ export type { KrakstackAuthContextValue, KrakstackAuthLocale, KrakstackAuthProvi
12
12
  export type { OrganizationSwitcherDialog, OrganizationSwitcherProps, } from "./organization-switcher";
13
13
  export type { UserButtonDialog } from "./user-button";
14
14
  export type { AuthUiClient } from "./auth-client";
15
- export type { AdminRequiredMessages, AdminRequiredProps } from "./admin-required";
15
+ export type { MemberRequiredMessages, MemberRequiredProps } from "./member-required";
@@ -1,7 +1,7 @@
1
1
  export { KrakstackAuthProvider, useAuthClient, useKrakstackAuth, useKrakstackAuthProjectConfig, } from "./auth-provider";
2
2
  export { createAuthUiClient } from "./auth-client";
3
3
  export { OrganizationSwitcher } from "./organization-switcher";
4
- export { AdminRequired } from "./admin-required";
4
+ export { MemberRequired } from "./member-required";
5
5
  export { ResetPassword, Signin, Signup, TwoFactor } from "./auth-forms";
6
6
  export { UserButton } from "./user-button";
7
7
  export { AdminOrganizationsTable } from "./admin-organizations";
@@ -0,0 +1,43 @@
1
+ import { type ReactNode } from "react";
2
+ import type { AuthUiClient } from "./auth-client";
3
+ declare const defaultMessages: {
4
+ readonly en: {
5
+ readonly member_required_title: "Organization access required";
6
+ readonly member_required_description: "You need organization access to continue.";
7
+ readonly member_required_org_description: "You need access to {organization} before opening the admin area.";
8
+ readonly member_required_no_permission: "Your account is signed in, but it does not have access to this organization.";
9
+ readonly member_required_invite_found: "You have a pending invitation to {organization}. Accept it to continue.";
10
+ readonly member_required_accept_invite: "Accept invitation";
11
+ readonly member_required_accepting_invite: "Accepting...";
12
+ readonly member_required_accept_error: "Could not accept the invitation.";
13
+ readonly member_required_contact: "Contact organization";
14
+ readonly member_required_contact_description: "If you expected access, contact the organization administrator.";
15
+ readonly member_required_copy_email: "Copy email";
16
+ readonly member_required_copied_email: "Copied email";
17
+ };
18
+ readonly fr: {
19
+ readonly member_required_title: "Accès à l'organisation requis";
20
+ readonly member_required_description: "Vous devez disposer d'un accès à l'organisation pour continuer.";
21
+ readonly member_required_org_description: "Vous devez avoir accès à {organization} avant d'ouvrir l'administration.";
22
+ readonly member_required_no_permission: "Votre compte est connecté, mais il ne dispose pas d'un accès à cette organisation.";
23
+ readonly member_required_invite_found: "Vous avez une invitation en attente pour {organization}. Acceptez-la pour continuer.";
24
+ readonly member_required_accept_invite: "Accepter l'invitation";
25
+ readonly member_required_accepting_invite: "Acceptation...";
26
+ readonly member_required_accept_error: "Impossible d'accepter l'invitation.";
27
+ readonly member_required_contact: "Contacter l'organisation";
28
+ readonly member_required_contact_description: "Si vous pensiez avoir accès, contactez l'administrateur de l'organisation.";
29
+ readonly member_required_copy_email: "Copier l'e-mail";
30
+ readonly member_required_copied_email: "E-mail copié";
31
+ };
32
+ };
33
+ type MemberRequiredLabels = (typeof defaultMessages)["en"];
34
+ export type MemberRequiredMessages = Partial<MemberRequiredLabels>;
35
+ export type MemberRequiredProps = {
36
+ authClient?: AuthUiClient | undefined;
37
+ organizationId: string;
38
+ contactEmail?: string | undefined;
39
+ children?: ReactNode;
40
+ messages?: MemberRequiredMessages | undefined;
41
+ };
42
+ export declare function MemberRequired({ authClient: providedAuthClient, organizationId, contactEmail, children, messages, }: MemberRequiredProps): import("react").JSX.Element;
43
+ export {};
@@ -10,32 +10,32 @@ import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle,
10
10
  import { useKrakstackAuth } from "./auth-provider";
11
11
  const defaultMessages = {
12
12
  en: {
13
- admin_required_title: "Admin access required",
14
- admin_required_description: "You need administrator access to continue.",
15
- admin_required_org_description: "You need access to {organization} before opening the admin area.",
16
- admin_required_no_permission: "Your account is signed in, but it does not have the required admin access.",
17
- admin_required_invite_found: "You have a pending invitation to {organization}. Accept it to continue.",
18
- admin_required_accept_invite: "Accept invitation",
19
- admin_required_accepting_invite: "Accepting...",
20
- admin_required_accept_error: "Could not accept the invitation.",
21
- admin_required_contact: "Contact organization",
22
- admin_required_contact_description: "If you expected access, contact the organization administrator.",
23
- admin_required_copy_email: "Copy email",
24
- admin_required_copied_email: "Copied email",
13
+ member_required_title: "Organization access required",
14
+ member_required_description: "You need organization access to continue.",
15
+ member_required_org_description: "You need access to {organization} before opening the admin area.",
16
+ member_required_no_permission: "Your account is signed in, but it does not have access to this organization.",
17
+ member_required_invite_found: "You have a pending invitation to {organization}. Accept it to continue.",
18
+ member_required_accept_invite: "Accept invitation",
19
+ member_required_accepting_invite: "Accepting...",
20
+ member_required_accept_error: "Could not accept the invitation.",
21
+ member_required_contact: "Contact organization",
22
+ member_required_contact_description: "If you expected access, contact the organization administrator.",
23
+ member_required_copy_email: "Copy email",
24
+ member_required_copied_email: "Copied email",
25
25
  },
26
26
  fr: {
27
- admin_required_title: "Accès administrateur requis",
28
- admin_required_description: "Vous devez disposer d'un accès administrateur pour continuer.",
29
- admin_required_org_description: "Vous devez avoir accès à {organization} avant d'ouvrir l'administration.",
30
- admin_required_no_permission: "Votre compte est connecté, mais il ne dispose pas de l'accès administrateur requis.",
31
- admin_required_invite_found: "Vous avez une invitation en attente pour {organization}. Acceptez-la pour continuer.",
32
- admin_required_accept_invite: "Accepter l'invitation",
33
- admin_required_accepting_invite: "Acceptation...",
34
- admin_required_accept_error: "Impossible d'accepter l'invitation.",
35
- admin_required_contact: "Contacter l'organisation",
36
- admin_required_contact_description: "Si vous pensiez avoir accès, contactez l'administrateur de l'organisation.",
37
- admin_required_copy_email: "Copier l'e-mail",
38
- admin_required_copied_email: "E-mail copié",
27
+ member_required_title: "Accès à l'organisation requis",
28
+ member_required_description: "Vous devez disposer d'un accès à l'organisation pour continuer.",
29
+ member_required_org_description: "Vous devez avoir accès à {organization} avant d'ouvrir l'administration.",
30
+ member_required_no_permission: "Votre compte est connecté, mais il ne dispose pas d'un accès à cette organisation.",
31
+ member_required_invite_found: "Vous avez une invitation en attente pour {organization}. Acceptez-la pour continuer.",
32
+ member_required_accept_invite: "Accepter l'invitation",
33
+ member_required_accepting_invite: "Acceptation...",
34
+ member_required_accept_error: "Impossible d'accepter l'invitation.",
35
+ member_required_contact: "Contacter l'organisation",
36
+ member_required_contact_description: "Si vous pensiez avoir accès, contactez l'administrateur de l'organisation.",
37
+ member_required_copy_email: "Copier l'e-mail",
38
+ member_required_copied_email: "E-mail copié",
39
39
  },
40
40
  };
41
41
  const isFullOrganization = (value) => {
@@ -81,16 +81,14 @@ const getOrganizationPublicProfile = async (baseUrl, organizationId) => {
81
81
  return isFullOrganization(body) ? body : null;
82
82
  };
83
83
  const accessAtom = Atom.family((authClient) => Atom.family((key) => {
84
- const { baseUrl, isAdmin, organizationId } = JSON.parse(key);
84
+ const { baseUrl, organizationId } = JSON.parse(key);
85
85
  return Atom.keepAlive(Atom.make(Effect.tryPromise({
86
86
  try: async () => {
87
- if (isAdmin) {
88
- const activeResult = await authClient.organization.setActive({
89
- organizationId,
90
- });
91
- if (!activeResult.error)
92
- return { allowed: true };
93
- }
87
+ const activeResult = await authClient.organization.setActive({
88
+ organizationId,
89
+ });
90
+ if (!activeResult.error)
91
+ return { allowed: true };
94
92
  const [organization, invitationsResult] = await Promise.all([
95
93
  getOrganizationPublicProfile(baseUrl, organizationId).catch(() => null),
96
94
  authClient.organization.listUserInvitations({}),
@@ -104,11 +102,12 @@ const accessAtom = Atom.family((authClient) => Atom.family((key) => {
104
102
  catch: (error) => error,
105
103
  })));
106
104
  }));
107
- const accessAtomKey = ({ baseUrl, isAdmin, organizationId, userId, }) => JSON.stringify({ baseUrl, isAdmin, organizationId, userId });
108
- export function AdminRequired({ authClient: providedAuthClient, organizationId, contactEmail, children, messages, }) {
105
+ const accessAtomKey = ({ authRefreshVersion, baseUrl, organizationId, userId, }) => JSON.stringify({ authRefreshVersion, baseUrl, organizationId, userId });
106
+ export function MemberRequired({ authClient: providedAuthClient, organizationId, contactEmail, children, messages, }) {
109
107
  const auth = useKrakstackAuth();
110
108
  const authClient = providedAuthClient ?? auth?.authClient;
111
109
  const baseUrl = auth?.baseUrl;
110
+ const authRefreshVersion = auth?.authRefreshVersion ?? 0;
112
111
  const locale = auth?.locale;
113
112
  const refreshAuth = auth?.refreshAuth;
114
113
  if (!authClient) {
@@ -116,21 +115,18 @@ export function AdminRequired({ authClient: providedAuthClient, organizationId,
116
115
  }
117
116
  const session = authClient.useSession();
118
117
  const userId = session.data?.user.id;
119
- const role = session.data?.user.role;
120
- const isAdmin = typeof role === "string" &&
121
- role.split(",").some((item) => item.trim() === "admin");
122
118
  const currentAccessKey = accessAtomKey({
119
+ authRefreshVersion,
123
120
  baseUrl,
124
- isAdmin,
125
121
  organizationId,
126
122
  userId,
127
123
  });
128
124
  const [allowedAccessKey, setAllowedAccessKey] = useState(null);
129
125
  if (allowedAccessKey === currentAccessKey)
130
126
  return _jsx(_Fragment, { children: children });
131
- return (_jsx(AdminRequiredGate, { accessKey: currentAccessKey, authClient: authClient, contactEmail: contactEmail, isAdmin: isAdmin, locale: locale, messages: messages, onAccessAllowed: () => setAllowedAccessKey(currentAccessKey), organizationId: organizationId, refreshAuth: refreshAuth, children: children }));
127
+ return (_jsx(MemberRequiredGate, { accessKey: currentAccessKey, authClient: authClient, contactEmail: contactEmail, locale: locale, messages: messages, onAccessAllowed: () => setAllowedAccessKey(currentAccessKey), organizationId: organizationId, refreshAuth: refreshAuth, children: children }));
132
128
  }
133
- function AdminRequiredGate({ accessKey, authClient, contactEmail, children, isAdmin, locale, messages, onAccessAllowed, organizationId, refreshAuth, }) {
129
+ function MemberRequiredGate({ accessKey, authClient, contactEmail, children, locale, messages, onAccessAllowed, organizationId, refreshAuth, }) {
134
130
  const m = labels(locale, messages);
135
131
  const accessResult = useAtomSuspense(accessAtom(authClient)(accessKey), {
136
132
  suspendOnWaiting: true,
@@ -158,7 +154,7 @@ function AdminRequiredGate({ accessKey, authClient, contactEmail, children, isAd
158
154
  });
159
155
  if (result.error) {
160
156
  setAccepting(false);
161
- setError(result.error.message ?? m.admin_required_accept_error);
157
+ setError(result.error.message ?? m.member_required_accept_error);
162
158
  return;
163
159
  }
164
160
  await authClient.organization.setActive({
@@ -168,16 +164,14 @@ function AdminRequiredGate({ accessKey, authClient, contactEmail, children, isAd
168
164
  onAccessAllowed();
169
165
  setAccepting(false);
170
166
  };
171
- return (_jsx("main", { className: "relative grid min-h-screen place-items-center px-6 py-10", children: _jsxs(Card, { className: "w-full max-w-md", children: [_jsxs(CardHeader, { children: [_jsx("div", { className: "bg-destructive/10 text-destructive mb-2 flex size-10 items-center justify-center rounded-md", children: _jsx(ShieldAlert, {}) }), _jsx(CardTitle, { children: m.admin_required_title }), _jsx(CardDescription, { children: isAdmin
172
- ? interpolate(m.admin_required_org_description, {
173
- organization: displayName,
174
- })
175
- : m.admin_required_no_permission })] }), _jsxs(CardContent, { className: "space-y-3", children: [invitation ? (_jsx("p", { className: "text-muted-foreground text-sm", children: interpolate(m.admin_required_invite_found, {
167
+ return (_jsx("main", { className: "relative grid min-h-screen place-items-center px-6 py-10", children: _jsxs(Card, { className: "w-full max-w-md", children: [_jsxs(CardHeader, { children: [_jsx("div", { className: "bg-destructive/10 text-destructive mb-2 flex size-10 items-center justify-center rounded-md", children: _jsx(ShieldAlert, {}) }), _jsx(CardTitle, { children: m.member_required_title }), _jsx(CardDescription, { children: interpolate(m.member_required_org_description, {
176
168
  organization: displayName,
177
- }) })) : (_jsx("p", { className: "text-muted-foreground text-sm", children: m.admin_required_contact_description })), resolvedContactEmail ? (_jsxs("div", { className: "bg-muted/50 flex items-center justify-between gap-3 rounded-md border px-3 py-2 text-sm", children: [_jsxs("span", { className: "flex min-w-0 items-center gap-2 font-medium", children: [_jsx(Mail, { className: "text-muted-foreground size-4 shrink-0" }), _jsx("span", { className: "truncate", children: resolvedContactEmail })] }), _jsx(CopyButton, { value: resolvedContactEmail, valueDescription: resolvedContactEmail, variant: "ghost", className: "shrink-0", messages: {
178
- copy: m.admin_required_copy_email,
179
- copied: m.admin_required_copied_email,
169
+ }) })] }), _jsxs(CardContent, { className: "space-y-3", children: [invitation ? (_jsx("p", { className: "text-muted-foreground text-sm", children: interpolate(m.member_required_invite_found, {
170
+ organization: displayName,
171
+ }) })) : (_jsx("p", { className: "text-muted-foreground text-sm", children: m.member_required_contact_description })), resolvedContactEmail ? (_jsxs("div", { className: "bg-muted/50 flex items-center justify-between gap-3 rounded-md border px-3 py-2 text-sm", children: [_jsxs("span", { className: "flex min-w-0 items-center gap-2 font-medium", children: [_jsx(Mail, { className: "text-muted-foreground size-4 shrink-0" }), _jsx("span", { className: "truncate", children: resolvedContactEmail })] }), _jsx(CopyButton, { value: resolvedContactEmail, valueDescription: resolvedContactEmail, variant: "ghost", className: "shrink-0", messages: {
172
+ copy: m.member_required_copy_email,
173
+ copied: m.member_required_copied_email,
180
174
  } })] })) : null, error ? _jsx("p", { className: "text-destructive text-sm", children: error }) : null] }), _jsx(CardFooter, { className: "flex flex-wrap gap-2", children: invitation ? (_jsxs(Button, { onClick: acceptInvitation, disabled: accepting, children: [accepting ? (_jsx(Loader2, { className: "size-4 animate-spin" })) : (_jsx(Check, { className: "size-4" })), accepting
181
- ? m.admin_required_accepting_invite
182
- : m.admin_required_accept_invite] })) : null })] }) }));
175
+ ? m.member_required_accepting_invite
176
+ : m.member_required_accept_invite] })) : null })] }) }));
183
177
  }
@@ -22,6 +22,10 @@ declare const messages: {
22
22
  readonly organization_invitation_reject_error: "Could not decline the invitation.";
23
23
  readonly organization_invitation_rejected: "Invitation declined.";
24
24
  readonly organization_invitation_status: "Status";
25
+ readonly organization_invitation_status_accepted: "Accepted";
26
+ readonly organization_invitation_status_canceled: "Canceled";
27
+ readonly organization_invitation_status_pending: "Pending";
28
+ readonly organization_invitation_status_rejected: "Rejected";
25
29
  readonly organization_invitations_description: "Track invitations that have not been accepted yet.";
26
30
  readonly organization_invitations_empty: "No pending invitations.";
27
31
  readonly organization_invitations_heading: "Pending invitations";
@@ -104,6 +108,10 @@ declare const messages: {
104
108
  readonly organization_invitation_reject_error: "Impossible de refuser l'invitation.";
105
109
  readonly organization_invitation_rejected: "Invitation refusée.";
106
110
  readonly organization_invitation_status: "Statut";
111
+ readonly organization_invitation_status_accepted: "Acceptée";
112
+ readonly organization_invitation_status_canceled: "Annulée";
113
+ readonly organization_invitation_status_pending: "En attente";
114
+ readonly organization_invitation_status_rejected: "Refusée";
107
115
  readonly organization_invitations_description: "Suivez les invitations qui n'ont pas encore été acceptées.";
108
116
  readonly organization_invitations_empty: "Aucune invitation en attente.";
109
117
  readonly organization_invitations_heading: "Invitations en attente";
@@ -16,7 +16,7 @@ import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, }
16
16
  import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu";
17
17
  import { Separator } from "@/components/ui/separator";
18
18
  import { OrganizationMetadata, } from "@krak-stack/auth/schema";
19
- import { hasAnyRole, isOrganizationRole, normalizeOrganizationRole, normalizeOrganizationRoles, organizationRoles, } from "../roles";
19
+ import { isOrganizationRole, normalizeOrganizationRole, normalizeOrganizationRoles, organizationRoles, } from "../roles";
20
20
  import { authClientApi } from "./auth-client-api";
21
21
  import { useKrakstackAuth } from "./auth-provider";
22
22
  import { createApiKey } from "./api-key";
@@ -44,6 +44,10 @@ const messages = {
44
44
  organization_invitation_reject_error: "Could not decline the invitation.",
45
45
  organization_invitation_rejected: "Invitation declined.",
46
46
  organization_invitation_status: "Status",
47
+ organization_invitation_status_accepted: "Accepted",
48
+ organization_invitation_status_canceled: "Canceled",
49
+ organization_invitation_status_pending: "Pending",
50
+ organization_invitation_status_rejected: "Rejected",
47
51
  organization_invitations_description: "Track invitations that have not been accepted yet.",
48
52
  organization_invitations_empty: "No pending invitations.",
49
53
  organization_invitations_heading: "Pending invitations",
@@ -126,6 +130,10 @@ const messages = {
126
130
  organization_invitation_reject_error: "Impossible de refuser l'invitation.",
127
131
  organization_invitation_rejected: "Invitation refusée.",
128
132
  organization_invitation_status: "Statut",
133
+ organization_invitation_status_accepted: "Acceptée",
134
+ organization_invitation_status_canceled: "Annulée",
135
+ organization_invitation_status_pending: "En attente",
136
+ organization_invitation_status_rejected: "Refusée",
129
137
  organization_invitations_description: "Suivez les invitations qui n'ont pas encore été acceptées.",
130
138
  organization_invitations_empty: "Aucune invitation en attente.",
131
139
  organization_invitations_heading: "Invitations en attente",
@@ -361,6 +369,20 @@ const organizationRoleLabel = (role, m) => {
361
369
  return m.organization_role_member();
362
370
  }
363
371
  };
372
+ const invitationStatusLabel = (status, m) => {
373
+ switch (status) {
374
+ case "accepted":
375
+ return m.organization_invitation_status_accepted();
376
+ case "canceled":
377
+ return m.organization_invitation_status_canceled();
378
+ case "pending":
379
+ return m.organization_invitation_status_pending();
380
+ case "rejected":
381
+ return m.organization_invitation_status_rejected();
382
+ default:
383
+ return status;
384
+ }
385
+ };
364
386
  const formatOrganizationDate = (date) => new Intl.DateTimeFormat(getLocale(), { dateStyle: "medium" }).format(new Date(date));
365
387
  const organizationMetadataFromForm = async (value, m, uploadImage) => {
366
388
  const translations = [];
@@ -514,7 +536,7 @@ export function OrganizationSwitcher({ authClient: providedAuthClient, baseUrl,
514
536
  setDialog((current) => open ? "manage" : current === "manage" ? null : current);
515
537
  }, children: _jsxs(DialogContent, { className: "max-h-[85vh] overflow-y-auto sm:max-w-xl", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { className: "text-2xl", children: m.organization_switcher_manage() }), _jsx(DialogDescription, { children: m.organization_edit_description() })] }), _jsx(Separator, {}), activeOrganization.data && canUpdateOrganization ? (_jsx(EditOrganizationSection, { authClient: authClient, baseUrl: baseUrl, organization: activeOrganization.data, onUpdated: refresh })) : null] }) }), _jsx(Dialog, { open: dialog === "members", onOpenChange: (open) => {
516
538
  setDialog((current) => open ? "members" : current === "members" ? null : current);
517
- }, children: _jsxs(DialogContent, { className: "max-h-[85vh] overflow-y-auto sm:max-w-4xl", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { className: "text-2xl", children: m.organization_members_title() }), _jsx(DialogDescription, { children: activeOrganization.data?.name })] }), _jsx(Separator, {}), activeOrganization.data ? (_jsx(OrganizationMembersManager, { authClient: authClient, baseUrl: baseUrl, organization: activeOrganization.data, currentUserId: session.data.user.id, active: dialog === "members", onLeft: async () => {
539
+ }, children: _jsxs(DialogContent, { className: "max-h-[85vh] overflow-y-auto sm:max-w-4xl", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { className: "text-2xl", children: m.organization_members_title() }), _jsx(DialogDescription, { children: activeOrganization.data?.name })] }), _jsx(Separator, {}), activeOrganization.data ? (_jsx(OrganizationMembersManager, { authClient: authClient, baseUrl: baseUrl, canManageMembers: canManageApiKeys, organization: activeOrganization.data, currentUserId: session.data.user.id, active: dialog === "members", onLeft: async () => {
518
540
  setDialog(null);
519
541
  auth?.refreshAuth();
520
542
  await refresh();
@@ -580,7 +602,7 @@ const userInvitationColumns = ({ m, }) => [
580
602
  {
581
603
  accessorKey: "status",
582
604
  header: m.organization_invitation_status(),
583
- cell: ({ row }) => _jsx(Badge, { children: row.original.status }),
605
+ cell: ({ row }) => (_jsx(Badge, { children: invitationStatusLabel(row.original.status, m) })),
584
606
  },
585
607
  {
586
608
  accessorKey: "expiresAt",
@@ -765,7 +787,7 @@ function OrganizationTranslationHeader({ locale, editingLocale, onEditingLocaleC
765
787
  : m.organization_translation_french();
766
788
  return (_jsxs("div", { className: "flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between", children: [_jsxs("div", { children: [_jsx("h3", { className: "font-medium", children: title }), _jsx("p", { className: "text-muted-foreground text-sm", children: m.organization_translation_description() })] }), _jsx(EditingLocaleSwitcher, { value: editingLocale, onValueChange: onEditingLocaleChange })] }));
767
789
  }
768
- function OrganizationMembersManager({ authClient, baseUrl, organization, currentUserId, active, onLeft, }) {
790
+ function OrganizationMembersManager({ authClient, baseUrl, canManageMembers, organization, currentUserId, active, onLeft, }) {
769
791
  const m = useOrganizationMessages();
770
792
  const hasOpened = useOpenedOnce(active);
771
793
  const membersAtom = hasOpened
@@ -776,11 +798,16 @@ function OrganizationMembersManager({ authClient, baseUrl, organization, current
776
798
  const [error, setError] = useState(null);
777
799
  const [cancellingInvitationId, setCancellingInvitationId] = useState(null);
778
800
  const [leavingOrganization, setLeavingOrganization] = useState(false);
779
- const membersData = AsyncResult.match(membersResult, {
780
- onInitial: () => ({ members: [], invitations: [] }),
781
- onFailure: () => ({ members: [], invitations: [] }),
801
+ const [lastMembersData, setLastMembersData] = useState(null);
802
+ const currentMembersData = AsyncResult.match(membersResult, {
803
+ onInitial: () => null,
804
+ onFailure: () => null,
782
805
  onSuccess: ({ value }) => value,
783
806
  });
807
+ const membersData = currentMembersData ?? lastMembersData ?? {
808
+ members: [],
809
+ invitations: [],
810
+ };
784
811
  const members = membersData.members;
785
812
  const invitations = membersData.invitations;
786
813
  const [memberRoleOverrides, setMemberRoleOverrides] = useState({});
@@ -793,14 +820,14 @@ function OrganizationMembersManager({ authClient, baseUrl, organization, current
793
820
  onFailure: () => m.organization_members_load_error(),
794
821
  onSuccess: () => null,
795
822
  });
796
- const loading = membersResult._tag === "Initial";
797
- const currentMemberRole = displayedMembers.find((member) => member.userId === currentUserId)?.role;
798
- const canChangeMemberRoles = hasAnyRole(currentMemberRole, [
799
- "owner",
800
- "admin",
801
- ]);
802
- const canInviteMembers = canChangeMemberRoles;
803
- const canRemoveMembers = canChangeMemberRoles;
823
+ const loading = !lastMembersData && membersResult._tag === "Initial";
824
+ const canInviteMembers = canManageMembers;
825
+ const canRemoveMembers = canManageMembers;
826
+ useEffect(() => {
827
+ if (!currentMembersData)
828
+ return;
829
+ setLastMembersData(currentMembersData);
830
+ }, [currentMembersData]);
804
831
  const inviteForm = useAppForm({
805
832
  defaultValues: { email: "", role: "member" },
806
833
  onSubmit: async ({ value, formApi }) => {
@@ -883,19 +910,19 @@ function OrganizationMembersManager({ authClient, baseUrl, organization, current
883
910
  }
884
911
  refreshMembers();
885
912
  };
886
- return (_jsxs("div", { className: "flex min-w-0 flex-col gap-5", children: [canInviteMembers ? (_jsx(inviteForm.AppForm, { children: _jsxs("form", { className: "grid gap-4 rounded-lg border p-4 sm:grid-cols-[minmax(0,1fr)_12rem_auto] sm:items-end", onSubmit: (event) => {
887
- event.preventDefault();
888
- event.stopPropagation();
889
- inviteForm.handleSubmit();
890
- }, children: [_jsxs("div", { className: "sm:col-span-3", children: [_jsxs("div", { className: "flex items-center gap-2 font-medium", children: [_jsx(UserPlus, { className: "size-4" }), m.organization_invite_member_title()] }), _jsx("p", { className: "text-muted-foreground text-sm", children: m.organization_invite_member_description() })] }), _jsx(inviteForm.AppField, { name: "email", children: (field) => (_jsx(field.TextField, { label: m.organization_member_email(), placeholder: "teammate@example.com", type: "email", required: true })) }), _jsx(inviteForm.AppField, { name: "role", children: (field) => (_jsx(field.SelectField, { label: m.organization_member_role(), options: organizationRoles.map((role) => ({
891
- label: organizationRoleLabel(role, m),
892
- value: role,
893
- })) })) }), _jsx("div", { className: "self-end", children: _jsx(inviteForm.SubmitButton, {}) }), _jsx(inviteForm.FormError, {})] }) })) : null, membersError ? (_jsx("p", { className: "text-destructive text-sm", children: membersError })) : null, error ? _jsx("p", { className: "text-destructive text-sm", children: error }) : null, _jsxs("section", { className: "flex min-w-0 flex-col gap-3", children: [_jsxs("div", { children: [_jsx("h3", { className: "font-medium", children: m.organization_members_heading() }), _jsx("p", { className: "text-muted-foreground text-sm", children: m.organization_members_description() })] }), _jsx("div", { className: "-m-1 min-w-0 overflow-x-auto p-1", children: _jsx(DataTable, { columns: memberColumns({
913
+ return (_jsxs("div", { className: "flex min-w-0 flex-col gap-5", children: [canInviteMembers ? (_jsx("div", { className: "min-h-40 rounded-lg border p-4", children: _jsx(inviteForm.AppForm, { children: _jsxs("form", { className: "grid gap-4 sm:grid-cols-[minmax(0,1fr)_12rem_auto] sm:items-end", onSubmit: (event) => {
914
+ event.preventDefault();
915
+ event.stopPropagation();
916
+ inviteForm.handleSubmit();
917
+ }, children: [_jsxs("div", { className: "sm:col-span-3", children: [_jsxs("div", { className: "flex items-center gap-2 font-medium", children: [_jsx(UserPlus, { className: "size-4" }), m.organization_invite_member_title()] }), _jsx("p", { className: "text-muted-foreground text-sm", children: m.organization_invite_member_description() })] }), _jsx(inviteForm.AppField, { name: "email", children: (field) => (_jsx(field.TextField, { label: m.organization_member_email(), placeholder: "teammate@example.com", type: "email", required: true })) }), _jsx(inviteForm.AppField, { name: "role", children: (field) => (_jsx(field.SelectField, { label: m.organization_member_role(), options: organizationRoles.map((role) => ({
918
+ label: organizationRoleLabel(role, m),
919
+ value: role,
920
+ })) })) }), _jsx("div", { className: "self-end", children: _jsx(inviteForm.SubmitButton, {}) }), _jsx(inviteForm.FormError, {})] }) }) })) : null, membersError ? (_jsx("p", { className: "text-destructive text-sm", children: membersError })) : null, error ? _jsx("p", { className: "text-destructive text-sm", children: error }) : null, _jsxs("section", { className: "flex min-w-0 flex-col gap-3", children: [_jsxs("div", { children: [_jsx("h3", { className: "font-medium", children: m.organization_members_heading() }), _jsx("p", { className: "text-muted-foreground text-sm", children: m.organization_members_description() })] }), _jsx("div", { className: "-m-1 min-w-0 overflow-x-auto p-1", children: _jsx(DataTable, { columns: memberColumns({
894
921
  m,
895
922
  baseUrl,
896
- canChangeRoles: canChangeMemberRoles,
923
+ canChangeRoles: canManageMembers,
897
924
  onRoleChange: updateRole,
898
- }), data: displayedMembers, emptyLabel: loading ? m.user_loading() : m.organization_members_empty(), exportFileName: `${organization.slug}-members.csv`, features: { gallery: false }, searchState: "local", rowActions: memberRowActions({
925
+ }), data: displayedMembers, emptyLabel: m.organization_members_empty(), exportFileName: `${organization.slug}-members.csv`, features: { gallery: false }, isLoading: loading, searchState: "local", rowActions: memberRowActions({
899
926
  m,
900
927
  canRemoveMembers,
901
928
  currentUserId,
@@ -904,7 +931,7 @@ function OrganizationMembersManager({ authClient, baseUrl, organization, current
904
931
  onRemove: removeMember,
905
932
  }) }) })] }), _jsxs("section", { className: "flex min-w-0 flex-col gap-3", children: [_jsxs("div", { children: [_jsx("h3", { className: "font-medium", children: m.organization_invitations_heading() }), _jsx("p", { className: "text-muted-foreground text-sm", children: m.organization_invitations_description() })] }), _jsx("div", { className: "-m-1 min-w-0 overflow-x-auto p-1", children: _jsx(DataTable, { columns: invitationColumns({
906
933
  m,
907
- }), data: invitations, emptyLabel: loading ? m.user_loading() : m.organization_invitations_empty(), exportFileName: `${organization.slug}-invitations.csv`, features: { gallery: false }, searchState: "local", rowActions: invitationRowActions({
934
+ }), data: invitations, emptyLabel: m.organization_invitations_empty(), exportFileName: `${organization.slug}-invitations.csv`, features: { gallery: false }, isLoading: loading, searchState: "local", rowActions: invitationRowActions({
908
935
  m,
909
936
  cancellingInvitationId,
910
937
  onCancel: cancelInvitation,
@@ -985,7 +1012,7 @@ const invitationColumns = ({ m, }) => [
985
1012
  {
986
1013
  accessorKey: "status",
987
1014
  header: m.organization_invitation_status(),
988
- cell: ({ row }) => _jsx(Badge, { children: row.original.status }),
1015
+ cell: ({ row }) => (_jsx(Badge, { children: invitationStatusLabel(row.original.status, m) })),
989
1016
  },
990
1017
  {
991
1018
  accessorKey: "expiresAt",
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, AdminRequired, KrakstackAuthProvider, ResetPassword, Signin, Signup, TwoFactor, AdminOrganizationForm, AdminOrganizationsTable, AdminUsersTable, UserButton, assetUrl, createAuthUiClient, type AuthUiClient, type AdminRequiredMessages, type AdminRequiredProps, 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, 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, AdminRequired, KrakstackAuthProvider, ResetPassword, Signin, Signup, TwoFactor, AdminOrganizationForm, AdminOrganizationsTable, AdminUsersTable, UserButton, assetUrl, createAuthUiClient, useAuthClient, useAdminUsersTotal, } from "./components";
8
+ export { OrganizationSwitcher, MemberRequired, KrakstackAuthProvider, ResetPassword, Signin, Signup, TwoFactor, 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.48",
3
+ "version": "0.1.49",
4
4
  "description": "Effect HttpApi clients and schemas for KrakStack Auth.",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -1,43 +0,0 @@
1
- import { type ReactNode } from "react";
2
- import type { AuthUiClient } from "./auth-client";
3
- declare const defaultMessages: {
4
- readonly en: {
5
- readonly admin_required_title: "Admin access required";
6
- readonly admin_required_description: "You need administrator access to continue.";
7
- readonly admin_required_org_description: "You need access to {organization} before opening the admin area.";
8
- readonly admin_required_no_permission: "Your account is signed in, but it does not have the required admin access.";
9
- readonly admin_required_invite_found: "You have a pending invitation to {organization}. Accept it to continue.";
10
- readonly admin_required_accept_invite: "Accept invitation";
11
- readonly admin_required_accepting_invite: "Accepting...";
12
- readonly admin_required_accept_error: "Could not accept the invitation.";
13
- readonly admin_required_contact: "Contact organization";
14
- readonly admin_required_contact_description: "If you expected access, contact the organization administrator.";
15
- readonly admin_required_copy_email: "Copy email";
16
- readonly admin_required_copied_email: "Copied email";
17
- };
18
- readonly fr: {
19
- readonly admin_required_title: "Accès administrateur requis";
20
- readonly admin_required_description: "Vous devez disposer d'un accès administrateur pour continuer.";
21
- readonly admin_required_org_description: "Vous devez avoir accès à {organization} avant d'ouvrir l'administration.";
22
- readonly admin_required_no_permission: "Votre compte est connecté, mais il ne dispose pas de l'accès administrateur requis.";
23
- readonly admin_required_invite_found: "Vous avez une invitation en attente pour {organization}. Acceptez-la pour continuer.";
24
- readonly admin_required_accept_invite: "Accepter l'invitation";
25
- readonly admin_required_accepting_invite: "Acceptation...";
26
- readonly admin_required_accept_error: "Impossible d'accepter l'invitation.";
27
- readonly admin_required_contact: "Contacter l'organisation";
28
- readonly admin_required_contact_description: "Si vous pensiez avoir accès, contactez l'administrateur de l'organisation.";
29
- readonly admin_required_copy_email: "Copier l'e-mail";
30
- readonly admin_required_copied_email: "E-mail copié";
31
- };
32
- };
33
- type AdminRequiredLabels = (typeof defaultMessages)["en"];
34
- export type AdminRequiredMessages = Partial<AdminRequiredLabels>;
35
- export type AdminRequiredProps = {
36
- authClient?: AuthUiClient | undefined;
37
- organizationId: string;
38
- contactEmail?: string | undefined;
39
- children?: ReactNode;
40
- messages?: AdminRequiredMessages | undefined;
41
- };
42
- export declare function AdminRequired({ authClient: providedAuthClient, organizationId, contactEmail, children, messages, }: AdminRequiredProps): import("react").JSX.Element;
43
- export {};