@krak-stack/auth 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +37 -0
  3. package/dist/admin/api.group.d.ts +4 -4
  4. package/dist/admin/schema.d.ts +6 -6
  5. package/dist/api.d.ts +1577 -1331
  6. package/dist/auth/api.group.d.ts +124 -1
  7. package/dist/auth/api.group.js +36 -1
  8. package/dist/auth/schema.d.ts +38 -0
  9. package/dist/auth/schema.js +38 -0
  10. package/dist/components/account-deletion.js +2 -1
  11. package/dist/components/admin-organization-form.js +3 -2
  12. package/dist/components/admin-organizations.js +3 -3
  13. package/dist/components/admin-users.js +3 -3
  14. package/dist/components/appearance.d.ts +89 -0
  15. package/dist/components/appearance.js +59 -0
  16. package/dist/components/auth-client-api.d.ts +134 -4
  17. package/dist/components/auth-forms.d.ts +5 -1
  18. package/dist/components/auth-forms.js +60 -7
  19. package/dist/components/contact-fields.js +2 -1
  20. package/dist/components/index.d.ts +1 -0
  21. package/dist/components/organization-sso-atom.d.ts +71 -0
  22. package/dist/components/organization-sso-atom.js +40 -0
  23. package/dist/components/organization-sso-messages.d.ts +76 -0
  24. package/dist/components/organization-sso-messages.js +77 -0
  25. package/dist/components/organization-sso-settings.d.ts +6 -0
  26. package/dist/components/organization-sso-settings.js +96 -0
  27. package/dist/components/organization-switcher.d.ts +8 -3
  28. package/dist/components/organization-switcher.js +25 -13
  29. package/dist/components/scrollable-dialog.d.ts +3 -2
  30. package/dist/components/scrollable-dialog.js +11 -4
  31. package/dist/components/user-button.d.ts +8 -2
  32. package/dist/components/user-button.js +8 -7
  33. package/dist/service.d.ts +260 -0
  34. package/package.json +3 -3
@@ -327,6 +327,10 @@ export declare const AuthApiGroup: HttpApiGroup.HttpApiGroup<"auth", HttpApiEndp
327
327
  readonly createdAt: Schema.DateFromString;
328
328
  readonly updatedAt: Schema.DateFromString;
329
329
  }>;
330
+ }>>, Schema.toCodecJson<typeof AuthBadRequest | typeof AuthUnauthorized | typeof AuthForbidden | typeof AuthNotFound | typeof AuthConflict | typeof AuthExpectationFailed | typeof AuthTooManyRequests | typeof AuthInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"deleteOrganizationSso", "POST", "/organization/sso/delete", never, never, Schema.toCodecJson<Schema.Struct<{
331
+ readonly organizationId: Schema.NonEmptyString;
332
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
333
+ readonly success: Schema.Boolean;
330
334
  }>>, Schema.toCodecJson<typeof AuthBadRequest | typeof AuthUnauthorized | typeof AuthForbidden | typeof AuthNotFound | typeof AuthConflict | typeof AuthExpectationFailed | typeof AuthTooManyRequests | typeof AuthInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"deleteUser", "POST", "/delete-user", never, never, Schema.toCodecJson<Schema.Struct<{
331
335
  readonly password: Schema.optional<Schema.String>;
332
336
  readonly token: Schema.optional<Schema.String>;
@@ -334,7 +338,20 @@ export declare const AuthApiGroup: HttpApiGroup.HttpApiGroup<"auth", HttpApiEndp
334
338
  }>>, never, Schema.toCodecJson<Schema.Struct<{
335
339
  readonly success: Schema.Boolean;
336
340
  readonly message: Schema.String;
337
- }>>, Schema.toCodecJson<typeof AuthBadRequest | typeof AuthUnauthorized | typeof AuthForbidden | typeof AuthNotFound | typeof AuthInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getSession", "GET", "/get-session", never, Schema.toCodecStringTree<Schema.Struct<{
341
+ }>>, Schema.toCodecJson<typeof AuthBadRequest | typeof AuthUnauthorized | typeof AuthForbidden | typeof AuthNotFound | typeof AuthInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getOrganizationSso", "GET", "/organization/sso", never, Schema.toCodecStringTree<Schema.Struct<{
342
+ readonly organizationId: Schema.NonEmptyString;
343
+ }>>, never, never, Schema.toCodecJson<Schema.NullOr<Schema.Struct<{
344
+ readonly callbackURL: Schema.optional<Schema.NonEmptyString>;
345
+ readonly organizationId: Schema.NonEmptyString;
346
+ readonly providerId: Schema.NonEmptyString;
347
+ readonly issuer: Schema.NonEmptyString;
348
+ readonly domain: Schema.NonEmptyString;
349
+ readonly clientId: Schema.NonEmptyString;
350
+ readonly enabled: Schema.Boolean;
351
+ readonly domainVerified: Schema.Boolean;
352
+ readonly verificationName: Schema.NonEmptyString;
353
+ readonly verificationToken: Schema.optional<Schema.NonEmptyString>;
354
+ }>>>, Schema.toCodecJson<typeof AuthBadRequest | typeof AuthUnauthorized | typeof AuthForbidden | typeof AuthNotFound | typeof AuthConflict | typeof AuthExpectationFailed | typeof AuthTooManyRequests | typeof AuthInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getSession", "GET", "/get-session", never, Schema.toCodecStringTree<Schema.Struct<{
338
355
  readonly disableCookieCache: Schema.optional<Schema.String>;
339
356
  readonly disableRefresh: Schema.optional<Schema.String>;
340
357
  }>>, never, never, Schema.toCodecJson<Schema.NullOr<Schema.Struct<{
@@ -399,6 +416,11 @@ export declare const AuthApiGroup: HttpApiGroup.HttpApiGroup<"auth", HttpApiEndp
399
416
  readonly createdAt: Schema.DateFromString;
400
417
  readonly updatedAt: Schema.DateFromString;
401
418
  }>;
419
+ }>>>, Schema.toCodecJson<typeof AuthBadRequest | typeof AuthUnauthorized | typeof AuthForbidden | typeof AuthNotFound | typeof AuthConflict | typeof AuthExpectationFailed | typeof AuthTooManyRequests | typeof AuthInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getSsoConfig", "GET", "/sso/config", never, Schema.toCodecStringTree<Schema.Struct<{
420
+ readonly email: Schema.optional<Schema.NonEmptyString>;
421
+ readonly organizationSlug: Schema.optional<Schema.NonEmptyString>;
422
+ }>>, never, never, Schema.toCodecJson<Schema.NullOr<Schema.Struct<{
423
+ readonly providerId: Schema.NonEmptyString;
402
424
  }>>>, Schema.toCodecJson<typeof AuthBadRequest | typeof AuthUnauthorized | typeof AuthForbidden | typeof AuthNotFound | typeof AuthConflict | typeof AuthExpectationFailed | typeof AuthTooManyRequests | typeof AuthInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"linkSocial", "POST", "/link-social", never, never, Schema.toCodecJson<Schema.Struct<{
403
425
  readonly callbackURL: Schema.optional<Schema.String>;
404
426
  readonly provider: Schema.String;
@@ -906,11 +928,42 @@ export declare const AuthApiGroup: HttpApiGroup.HttpApiGroup<"auth", HttpApiEndp
906
928
  readonly token: Schema.optional<Schema.String>;
907
929
  }>>, never, Schema.toCodecJson<Schema.Struct<{
908
930
  readonly status: Schema.Boolean;
931
+ }>>, Schema.toCodecJson<typeof AuthBadRequest | typeof AuthUnauthorized | typeof AuthForbidden | typeof AuthNotFound | typeof AuthConflict | typeof AuthExpectationFailed | typeof AuthTooManyRequests | typeof AuthInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"saveOrganizationSso", "POST", "/organization/sso", never, never, Schema.toCodecJson<Schema.Struct<{
932
+ readonly organizationId: Schema.NonEmptyString;
933
+ readonly issuer: Schema.NonEmptyString;
934
+ readonly domain: Schema.NonEmptyString;
935
+ readonly clientId: Schema.NonEmptyString;
936
+ readonly clientSecret: Schema.optional<Schema.NonEmptyString>;
937
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
938
+ readonly callbackURL: Schema.optional<Schema.NonEmptyString>;
939
+ readonly organizationId: Schema.NonEmptyString;
940
+ readonly providerId: Schema.NonEmptyString;
941
+ readonly issuer: Schema.NonEmptyString;
942
+ readonly domain: Schema.NonEmptyString;
943
+ readonly clientId: Schema.NonEmptyString;
944
+ readonly enabled: Schema.Boolean;
945
+ readonly domainVerified: Schema.Boolean;
946
+ readonly verificationName: Schema.NonEmptyString;
947
+ readonly verificationToken: Schema.optional<Schema.NonEmptyString>;
909
948
  }>>, Schema.toCodecJson<typeof AuthBadRequest | typeof AuthUnauthorized | typeof AuthForbidden | typeof AuthNotFound | typeof AuthConflict | typeof AuthExpectationFailed | typeof AuthTooManyRequests | typeof AuthInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"sendVerificationOtp", "POST", "/email-otp/send-verification-otp", never, never, Schema.toCodecJson<Schema.Struct<{
910
949
  readonly email: Schema.String;
911
950
  readonly type: Schema.Literals<readonly ["sign-in", "email-verification", "forget-password"]>;
912
951
  }>>, never, Schema.toCodecJson<Schema.Struct<{
913
952
  readonly success: Schema.Boolean;
953
+ }>>, Schema.toCodecJson<typeof AuthBadRequest | typeof AuthUnauthorized | typeof AuthForbidden | typeof AuthNotFound | typeof AuthConflict | typeof AuthExpectationFailed | typeof AuthTooManyRequests | typeof AuthInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"setOrganizationSsoEnabled", "POST", "/organization/sso/enabled", never, never, Schema.toCodecJson<Schema.Struct<{
954
+ readonly organizationId: Schema.NonEmptyString;
955
+ readonly enabled: Schema.Boolean;
956
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
957
+ readonly callbackURL: Schema.optional<Schema.NonEmptyString>;
958
+ readonly organizationId: Schema.NonEmptyString;
959
+ readonly providerId: Schema.NonEmptyString;
960
+ readonly issuer: Schema.NonEmptyString;
961
+ readonly domain: Schema.NonEmptyString;
962
+ readonly clientId: Schema.NonEmptyString;
963
+ readonly enabled: Schema.Boolean;
964
+ readonly domainVerified: Schema.Boolean;
965
+ readonly verificationName: Schema.NonEmptyString;
966
+ readonly verificationToken: Schema.optional<Schema.NonEmptyString>;
914
967
  }>>, Schema.toCodecJson<typeof AuthBadRequest | typeof AuthUnauthorized | typeof AuthForbidden | typeof AuthNotFound | typeof AuthConflict | typeof AuthExpectationFailed | typeof AuthTooManyRequests | typeof AuthInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"signInEmail", "POST", "/sign-in/email", never, never, Schema.toCodecJson<Schema.Struct<{
915
968
  readonly email: Schema.String;
916
969
  readonly password: Schema.String;
@@ -1106,6 +1159,63 @@ export declare const AuthApiGroup: HttpApiGroup.HttpApiGroup<"auth", HttpApiEndp
1106
1159
  readonly updatedAt: Schema.DateFromString;
1107
1160
  }>>;
1108
1161
  readonly status: Schema.optional<Schema.Boolean>;
1162
+ }>>, Schema.toCodecJson<typeof AuthBadRequest | typeof AuthUnauthorized | typeof AuthForbidden | typeof AuthNotFound | typeof AuthConflict | typeof AuthExpectationFailed | typeof AuthTooManyRequests | typeof AuthInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"signInSso", "POST", "/sign-in/sso", never, never, Schema.toCodecJson<Schema.Struct<{
1163
+ readonly providerId: Schema.NonEmptyString;
1164
+ readonly callbackURL: Schema.NonEmptyString;
1165
+ readonly errorCallbackURL: Schema.optional<Schema.NonEmptyString>;
1166
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
1167
+ readonly url: Schema.optional<Schema.String>;
1168
+ readonly redirect: Schema.Boolean;
1169
+ readonly token: Schema.optional<Schema.String>;
1170
+ readonly user: Schema.optional<Schema.Struct<{
1171
+ readonly id: Schema.String;
1172
+ readonly name: Schema.String;
1173
+ readonly email: Schema.String;
1174
+ readonly emailVerified: Schema.Boolean;
1175
+ readonly locale: Schema.optional<Schema.Literals<readonly ["en", "fr"]>>;
1176
+ readonly image: Schema.NullOr<Schema.String>;
1177
+ readonly metadata: Schema.optional<Schema.NullOr<Schema.decodeTo<Schema.Struct<{
1178
+ readonly emails: Schema.optional<Schema.$Array<Schema.Struct<{
1179
+ readonly email: Schema.NonEmptyString;
1180
+ readonly translations: Schema.$Array<Schema.Struct<{
1181
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
1182
+ readonly label: Schema.NonEmptyString;
1183
+ }>>;
1184
+ }>>>;
1185
+ readonly phones: Schema.optional<Schema.$Array<Schema.Struct<{
1186
+ readonly number: Schema.NonEmptyString;
1187
+ readonly extension: Schema.optional<Schema.String>;
1188
+ readonly translations: Schema.$Array<Schema.Struct<{
1189
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
1190
+ readonly label: Schema.NonEmptyString;
1191
+ }>>;
1192
+ }>>>;
1193
+ readonly websites: Schema.optional<Schema.$Array<Schema.Struct<{
1194
+ readonly url: Schema.NonEmptyString;
1195
+ readonly translations: Schema.$Array<Schema.Struct<{
1196
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
1197
+ readonly label: Schema.NonEmptyString;
1198
+ }>>;
1199
+ }>>>;
1200
+ readonly socials: Schema.optional<Schema.$Array<Schema.Struct<{
1201
+ readonly platform: Schema.Literals<readonly ["facebook", "github", "instagram", "linkedin", "tiktok", "x", "youtube"]>;
1202
+ readonly url: Schema.NonEmptyString;
1203
+ readonly translations: Schema.$Array<Schema.Struct<{
1204
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
1205
+ readonly label: Schema.NonEmptyString;
1206
+ }>>;
1207
+ }>>>;
1208
+ }>, Schema.Unknown, never, never>>>;
1209
+ readonly role: Schema.NullOr<Schema.String>;
1210
+ readonly banned: Schema.NullOr<Schema.Boolean>;
1211
+ readonly banReason: Schema.optional<Schema.NullOr<Schema.String>>;
1212
+ readonly banExpires: Schema.optional<Schema.NullOr<Schema.DateFromString>>;
1213
+ readonly twoFactorEnabled: Schema.optional<Schema.Boolean>;
1214
+ readonly lastLoginMethod: Schema.optional<Schema.NullOr<Schema.String>>;
1215
+ readonly createdAt: Schema.DateFromString;
1216
+ readonly updatedAt: Schema.DateFromString;
1217
+ }>>;
1218
+ readonly status: Schema.optional<Schema.Boolean>;
1109
1219
  }>>, Schema.toCodecJson<typeof AuthBadRequest | typeof AuthUnauthorized | typeof AuthForbidden | typeof AuthNotFound | typeof AuthConflict | typeof AuthExpectationFailed | typeof AuthTooManyRequests | typeof AuthInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"signOut", "POST", "/sign-out", never, never, Schema.toCodecJson<Schema.Struct<{}>>, never, Schema.toCodecJson<Schema.Struct<{
1110
1220
  readonly success: Schema.Boolean;
1111
1221
  }>>, Schema.toCodecJson<typeof AuthBadRequest | typeof AuthUnauthorized | typeof AuthForbidden | typeof AuthNotFound | typeof AuthConflict | typeof AuthExpectationFailed | typeof AuthTooManyRequests | typeof AuthInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"twoFactorDisable", "POST", "/two-factor/disable", never, never, Schema.toCodecJson<Schema.Struct<{
@@ -1382,4 +1492,17 @@ export declare const AuthApiGroup: HttpApiGroup.HttpApiGroup<"auth", HttpApiEndp
1382
1492
  readonly createdAt: Schema.DateFromString;
1383
1493
  readonly updatedAt: Schema.DateFromString;
1384
1494
  }>;
1495
+ }>>, Schema.toCodecJson<typeof AuthBadRequest | typeof AuthUnauthorized | typeof AuthForbidden | typeof AuthNotFound | typeof AuthConflict | typeof AuthExpectationFailed | typeof AuthTooManyRequests | typeof AuthInternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"verifyOrganizationSso", "POST", "/organization/sso/verify", never, never, Schema.toCodecJson<Schema.Struct<{
1496
+ readonly organizationId: Schema.NonEmptyString;
1497
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
1498
+ readonly callbackURL: Schema.optional<Schema.NonEmptyString>;
1499
+ readonly organizationId: Schema.NonEmptyString;
1500
+ readonly providerId: Schema.NonEmptyString;
1501
+ readonly issuer: Schema.NonEmptyString;
1502
+ readonly domain: Schema.NonEmptyString;
1503
+ readonly clientId: Schema.NonEmptyString;
1504
+ readonly enabled: Schema.Boolean;
1505
+ readonly domainVerified: Schema.Boolean;
1506
+ readonly verificationName: Schema.NonEmptyString;
1507
+ readonly verificationToken: Schema.optional<Schema.NonEmptyString>;
1385
1508
  }>>, Schema.toCodecJson<typeof AuthBadRequest | typeof AuthUnauthorized | typeof AuthForbidden | typeof AuthNotFound | typeof AuthConflict | typeof AuthExpectationFailed | typeof AuthTooManyRequests | typeof AuthInternalServerError>, never, never>, false>;
@@ -1,6 +1,6 @@
1
1
  import { Schema } from "effect";
2
2
  import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api";
3
- import { DeleteUserPayload, DeleteOrganizationPayload, DeleteUserResponse, AdminBanUserPayload, AdminStopImpersonatingPayload, AdminUserIdPayload, AdminUserResponse, AuthBadRequest, AuthConflict, AuthExpectationFailed, AuthForbidden, AuthInternalServerError, AuthInvitation, AuthNotFound, AuthOrganization, AuthSessionResponse, AuthStatusResponse, AuthSuccessResponse, AuthTooManyRequests, AuthUnauthorized, ChangePasswordPayload, ChangePasswordResponse, CreateOrganizationPayload, DeleteApiKeyPayload, FullAuthOrganization, GetFullOrganizationQuery, GetInvitationQuery, GetInvitationResponse, GetSessionQuery, GetSessionResponse, InvitationActionResponse, InvitationIdPayload, InviteMemberPayload, LeaveOrganizationPayload, LinkedAccount, LinkSocialPayload, ListApiKeysQuery, ListApiKeysResponse, MemberResponse, OAuthConsentPayload, OAuthPublicClient, OAuthPublicClientQuery, OAuthRedirectResponse, OrganizationImpersonateUserPayload, OrganizationImpersonateUserResponse, OrganizationInvitationsQuery, OrganizationListMembersQuery, OrganizationListMembersResponse, RemoveMemberPayload, RequestPasswordResetPayload, RequestPasswordResetResponse, ResetPasswordPayload, SendVerificationOtpPayload, SetActiveOrganizationPayload, SignInEmailOtpPayload, SignInEmailPayload, SignInEmailResponse, SignInResponse, SignInSocialPayload, SignOutPayload, SocialRedirectResponse, TwoFactorBackupVerifyPayload, TwoFactorDisablePayload, TwoFactorEnablePayload, TwoFactorEnableResponse, TwoFactorSendPayload, TwoFactorVerifyPayload, UnlinkAccountPayload, UpdateMemberRolePayload, UpdateOrganizationPayload, UpdateUserPayload, UserInvitationsQuery, VerifyEmailOtpPayload, VerifyEmailOtpResponse, } from "./schema.js";
3
+ import { DeleteUserPayload, DeleteOrganizationPayload, DeleteUserResponse, AdminBanUserPayload, AdminStopImpersonatingPayload, AdminUserIdPayload, AdminUserResponse, AuthBadRequest, AuthConflict, AuthExpectationFailed, AuthForbidden, AuthInternalServerError, AuthInvitation, AuthNotFound, AuthOrganization, AuthSessionResponse, AuthStatusResponse, AuthSuccessResponse, AuthTooManyRequests, AuthUnauthorized, ChangePasswordPayload, ChangePasswordResponse, CreateOrganizationPayload, DeleteApiKeyPayload, FullAuthOrganization, GetFullOrganizationQuery, GetInvitationQuery, GetInvitationResponse, GetSessionQuery, GetSessionResponse, InvitationActionResponse, InvitationIdPayload, InviteMemberPayload, LeaveOrganizationPayload, LinkedAccount, LinkSocialPayload, ListApiKeysQuery, ListApiKeysResponse, MemberResponse, OAuthConsentPayload, OAuthPublicClient, OAuthPublicClientQuery, OAuthRedirectResponse, OrganizationImpersonateUserPayload, OrganizationImpersonateUserResponse, OrganizationInvitationsQuery, OrganizationListMembersQuery, OrganizationListMembersResponse, RemoveMemberPayload, RequestPasswordResetPayload, RequestPasswordResetResponse, ResetPasswordPayload, SendVerificationOtpPayload, SetActiveOrganizationPayload, SignInEmailOtpPayload, SignInEmailPayload, SignInEmailResponse, SignInResponse, SignInSocialPayload, SignInSsoPayload, SsoPublicConfig, SsoDiscoveryQuery, OrganizationSsoQuery, OrganizationSsoSettings, OrganizationSsoEnabled, OrganizationSsoConnection, SignOutPayload, SocialRedirectResponse, TwoFactorBackupVerifyPayload, TwoFactorDisablePayload, TwoFactorEnablePayload, TwoFactorEnableResponse, TwoFactorSendPayload, TwoFactorVerifyPayload, UnlinkAccountPayload, UpdateMemberRolePayload, UpdateOrganizationPayload, UpdateUserPayload, UserInvitationsQuery, VerifyEmailOtpPayload, VerifyEmailOtpResponse, } from "./schema.js";
4
4
  export * from "./schema.js";
5
5
  const errors = [
6
6
  AuthBadRequest,
@@ -14,6 +14,41 @@ const errors = [
14
14
  ];
15
15
  const docs = (title, description) => OpenApi.annotations({ title, summary: title, description });
16
16
  export const AuthApiGroup = HttpApiGroup.make("auth")
17
+ .add(HttpApiEndpoint.get("getSsoConfig", "/sso/config", {
18
+ query: SsoDiscoveryQuery.fields,
19
+ success: SsoPublicConfig,
20
+ error: errors,
21
+ }).annotateMerge(docs("Get SSO configuration", "Returns the available organization SSO provider, or null.")))
22
+ .add(HttpApiEndpoint.get("getOrganizationSso", "/organization/sso", {
23
+ query: OrganizationSsoQuery.fields,
24
+ success: Schema.NullOr(OrganizationSsoConnection),
25
+ error: errors,
26
+ }))
27
+ .add(HttpApiEndpoint.post("saveOrganizationSso", "/organization/sso", {
28
+ payload: OrganizationSsoSettings,
29
+ success: OrganizationSsoConnection,
30
+ error: errors,
31
+ }))
32
+ .add(HttpApiEndpoint.post("verifyOrganizationSso", "/organization/sso/verify", {
33
+ payload: OrganizationSsoQuery,
34
+ success: OrganizationSsoConnection,
35
+ error: errors,
36
+ }))
37
+ .add(HttpApiEndpoint.post("setOrganizationSsoEnabled", "/organization/sso/enabled", {
38
+ payload: OrganizationSsoEnabled,
39
+ success: OrganizationSsoConnection,
40
+ error: errors,
41
+ }))
42
+ .add(HttpApiEndpoint.post("deleteOrganizationSso", "/organization/sso/delete", {
43
+ payload: OrganizationSsoQuery,
44
+ success: AuthSuccessResponse,
45
+ error: errors,
46
+ }))
47
+ .add(HttpApiEndpoint.post("signInSso", "/sign-in/sso", {
48
+ payload: SignInSsoPayload,
49
+ success: SocialRedirectResponse,
50
+ error: errors,
51
+ }).annotateMerge(docs("Sign in with SSO", "Starts organization SSO for an existing member.")))
17
52
  .add(HttpApiEndpoint.post("deleteUser", "/delete-user", {
18
53
  payload: DeleteUserPayload,
19
54
  success: DeleteUserResponse,
@@ -204,6 +204,44 @@ export declare const AuthStatusResponse: Schema.Struct<{
204
204
  readonly status: Schema.Boolean;
205
205
  }>;
206
206
  export declare const SignOutPayload: Schema.Struct<{}>;
207
+ export declare const SignInSsoPayload: Schema.Struct<{
208
+ readonly providerId: Schema.NonEmptyString;
209
+ readonly callbackURL: Schema.NonEmptyString;
210
+ readonly errorCallbackURL: Schema.optional<Schema.NonEmptyString>;
211
+ }>;
212
+ export declare const SsoPublicConfig: Schema.NullOr<Schema.Struct<{
213
+ readonly providerId: Schema.NonEmptyString;
214
+ }>>;
215
+ export declare const SsoDiscoveryQuery: Schema.Struct<{
216
+ readonly email: Schema.optional<Schema.NonEmptyString>;
217
+ readonly organizationSlug: Schema.optional<Schema.NonEmptyString>;
218
+ }>;
219
+ export declare const OrganizationSsoQuery: Schema.Struct<{
220
+ readonly organizationId: Schema.NonEmptyString;
221
+ }>;
222
+ export declare const OrganizationSsoSettings: Schema.Struct<{
223
+ readonly organizationId: Schema.NonEmptyString;
224
+ readonly issuer: Schema.NonEmptyString;
225
+ readonly domain: Schema.NonEmptyString;
226
+ readonly clientId: Schema.NonEmptyString;
227
+ readonly clientSecret: Schema.optional<Schema.NonEmptyString>;
228
+ }>;
229
+ export declare const OrganizationSsoEnabled: Schema.Struct<{
230
+ readonly organizationId: Schema.NonEmptyString;
231
+ readonly enabled: Schema.Boolean;
232
+ }>;
233
+ export declare const OrganizationSsoConnection: Schema.Struct<{
234
+ readonly callbackURL: Schema.optional<Schema.NonEmptyString>;
235
+ readonly organizationId: Schema.NonEmptyString;
236
+ readonly providerId: Schema.NonEmptyString;
237
+ readonly issuer: Schema.NonEmptyString;
238
+ readonly domain: Schema.NonEmptyString;
239
+ readonly clientId: Schema.NonEmptyString;
240
+ readonly enabled: Schema.Boolean;
241
+ readonly domainVerified: Schema.Boolean;
242
+ readonly verificationName: Schema.NonEmptyString;
243
+ readonly verificationToken: Schema.optional<Schema.NonEmptyString>;
244
+ }>;
207
245
  export declare const AuthSuccessResponse: Schema.Struct<{
208
246
  readonly success: Schema.Boolean;
209
247
  }>;
@@ -85,6 +85,44 @@ export const AuthStatusResponse = Schema.Struct({
85
85
  export const SignOutPayload = Schema.Struct({}).annotate({
86
86
  identifier: "SignOutPayload",
87
87
  });
88
+ export const SignInSsoPayload = Schema.Struct({
89
+ providerId: Schema.NonEmptyString,
90
+ callbackURL: Schema.NonEmptyString,
91
+ errorCallbackURL: Schema.optional(Schema.NonEmptyString),
92
+ }).annotate({ identifier: "SignInSsoPayload" });
93
+ export const SsoPublicConfig = Schema.NullOr(Schema.Struct({
94
+ providerId: Schema.NonEmptyString,
95
+ })).annotate({ identifier: "SsoPublicConfig" });
96
+ export const SsoDiscoveryQuery = Schema.Struct({
97
+ email: Schema.optional(Schema.NonEmptyString),
98
+ organizationSlug: Schema.optional(Schema.NonEmptyString),
99
+ }).annotate({ identifier: "SsoDiscoveryQuery" });
100
+ export const OrganizationSsoQuery = Schema.Struct({
101
+ organizationId: Schema.NonEmptyString,
102
+ }).annotate({ identifier: "OrganizationSsoQuery" });
103
+ export const OrganizationSsoSettings = Schema.Struct({
104
+ organizationId: Schema.NonEmptyString,
105
+ issuer: Schema.NonEmptyString,
106
+ domain: Schema.NonEmptyString,
107
+ clientId: Schema.NonEmptyString,
108
+ clientSecret: Schema.optional(Schema.NonEmptyString),
109
+ }).annotate({ identifier: "OrganizationSsoSettings" });
110
+ export const OrganizationSsoEnabled = Schema.Struct({
111
+ organizationId: Schema.NonEmptyString,
112
+ enabled: Schema.Boolean,
113
+ }).annotate({ identifier: "OrganizationSsoEnabled" });
114
+ export const OrganizationSsoConnection = Schema.Struct({
115
+ callbackURL: Schema.optional(Schema.NonEmptyString),
116
+ organizationId: Schema.NonEmptyString,
117
+ providerId: Schema.NonEmptyString,
118
+ issuer: Schema.NonEmptyString,
119
+ domain: Schema.NonEmptyString,
120
+ clientId: Schema.NonEmptyString,
121
+ enabled: Schema.Boolean,
122
+ domainVerified: Schema.Boolean,
123
+ verificationName: Schema.NonEmptyString,
124
+ verificationToken: Schema.optional(Schema.NonEmptyString),
125
+ }).annotate({ identifier: "OrganizationSsoConnection" });
88
126
  export const AuthSuccessResponse = Schema.Struct({
89
127
  success: Schema.Boolean,
90
128
  }).annotate({ identifier: "AuthSuccessResponse", title: "Success response" });
@@ -8,7 +8,8 @@ import { Button } from "@/components/ui/button";
8
8
  import { Card, CardContent } from "@/components/ui/card";
9
9
  import { Input } from "@/components/ui/input";
10
10
  import { FieldLabel } from "@/components/ui/field";
11
- import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, } from "@/components/ui/dialog";
11
+ import { Dialog } from "@/components/ui/dialog";
12
+ import { DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, } from "./appearance.js";
12
13
  import { authClientApi } from "./auth-client-api.js";
13
14
  import { requestAccountDeletion } from "./account-deletion-request.js";
14
15
  import { refreshOnAuthChange } from "./auth-atoms.js";
@@ -4,8 +4,9 @@ import { FormBuilder, FormReact } from "@lucas-barake/effect-form-react";
4
4
  import { Effect, Schema } from "effect";
5
5
  import { AsyncResult, Atom } from "effect/reactivity";
6
6
  import { useState } from "react";
7
- import { ImageField, SingleSearchableSelectField, SubmitButton, SubmitError, TextField, } from "@krak-stack/registry/effect-form";
8
- import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "@/components/ui/dialog";
7
+ import { ImageField, SubmitButton, SubmitError, TextField, } from "@krak-stack/registry/effect-form";
8
+ import { Dialog } from "@/components/ui/dialog";
9
+ import { DialogContent, DialogDescription, DialogHeader, DialogTitle, SingleSearchableSelectField, } from "./appearance.js";
9
10
  import { AdminCreateOrganizationPayload, } from "../admin/schema.js";
10
11
  import { authClientApi, authHttpClient } from "./auth-client-api.js";
11
12
  import { useKrakstackAuth } from "./auth-provider.js";
@@ -4,12 +4,12 @@ import { Cause, Effect, Schema } from "effect";
4
4
  import { Atom, AsyncResult } from "effect/reactivity";
5
5
  import { Building2, Pencil, Trash2, UserCog } from "lucide-react";
6
6
  import { useEffect, useState } from "react";
7
- import { DataTable, } from "@krak-stack/registry/data-table";
7
+ import {} from "@krak-stack/registry/data-table";
8
8
  import { Query } from "@krak-stack/registry/query";
9
9
  import { ErrorMessage } from "@krak-stack/registry/effect-form";
10
- import { AppBrand } from "@krak-stack/registry/app-brand";
10
+ import { AppBrand, DataTable, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "./appearance.js";
11
11
  import { Badge } from "@/components/ui/badge";
12
- import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "@/components/ui/alert-dialog";
12
+ import { AlertDialog, AlertDialogAction, AlertDialogCancel, } from "@/components/ui/alert-dialog";
13
13
  import { AdminListQuery } from "../admin/schema.js";
14
14
  import { normalizeOrganizationRoles } from "../roles.js";
15
15
  import { AdminOrganizationForm } from "./admin-organization-form.js";
@@ -4,12 +4,12 @@ import { Atom, AsyncResult } from "effect/reactivity";
4
4
  import { Effect, Schema } from "effect";
5
5
  import { Ban, Loader2, ShieldOff, UserCog, UserIcon } from "lucide-react";
6
6
  import { useEffect, useState } from "react";
7
- import { DataTable, } from "@krak-stack/registry/data-table";
7
+ import {} from "@krak-stack/registry/data-table";
8
8
  import { Query } from "@krak-stack/registry/query";
9
9
  import { ErrorMessage } from "@krak-stack/registry/effect-form";
10
- import { AppBrand } from "@krak-stack/registry/app-brand";
10
+ import { AppBrand, DataTable, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "./appearance.js";
11
11
  import { Badge } from "@/components/ui/badge";
12
- import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "@/components/ui/alert-dialog";
12
+ import { AlertDialog, AlertDialogAction, AlertDialogCancel, } from "@/components/ui/alert-dialog";
13
13
  import { AdminListQuery } from "../admin/schema.js";
14
14
  import { reloadAfterImpersonation } from "./auth-atoms.js";
15
15
  import { authClientApi, authHttpClient } from "./auth-client-api.js";
@@ -0,0 +1,89 @@
1
+ import { type ComponentProps } from "react";
2
+ import { AppBrand as RegistryAppBrand } from "@krak-stack/registry/app-brand";
3
+ import { type DataTableProps } from "@krak-stack/registry/data-table";
4
+ import { SelectField as RegistrySelectField, SingleSearchableSelectField as RegistrySingleSearchableSelectField } from "@krak-stack/registry/effect-form";
5
+ type Slots<Key extends string> = Partial<Record<Key, string>>;
6
+ /** Optional presentation hooks. No auth, data or interaction policy lives here. */
7
+ export type AuthUIClassNames = {
8
+ trigger?: Slots<"visual" | "image" | "icon" | "content" | "label" | "subtitle" | "indicator" | "badge">;
9
+ menu?: Slots<"content" | "header" | "group" | "item" | "label" | "separator" | "subContent" | "subTrigger">;
10
+ dialog?: Slots<"content" | "header" | "title" | "description" | "body" | "footer">;
11
+ popup?: Slots<"select" | "combobox">;
12
+ /** Scope forms through existing field/input/button data-slot attributes. */
13
+ form?: Slots<"content">;
14
+ table?: {
15
+ className?: string;
16
+ classNames?: {
17
+ table?: Slots<"content" | "header" | "body" | "row" | "head" | "cell">;
18
+ toolbar?: Slots<"content" | "search" | "trigger">;
19
+ menu?: Slots<"content" | "subContent" | "label" | "item" | "separator" | "subTrigger">;
20
+ popup?: Slots<"select" | "tooltip">;
21
+ pagination?: string;
22
+ gallery?: string;
23
+ feedback?: Slots<"loading" | "empty" | "error">;
24
+ };
25
+ };
26
+ };
27
+ export declare const AuthUIStylesContext: import("react").Context<AuthUIClassNames | undefined>;
28
+ export declare const useAuthUIStyles: () => AuthUIClassNames | undefined;
29
+ export declare const DropdownMenuContent: (props: object & {
30
+ className?: string;
31
+ }) => import("react").JSX.Element;
32
+ export declare const DropdownMenuGroup: (props: object & {
33
+ className?: string;
34
+ }) => import("react").JSX.Element;
35
+ export declare const DropdownMenuLabel: (props: object & {
36
+ className?: string;
37
+ }) => import("react").JSX.Element;
38
+ export declare const DropdownMenuItem: (props: object & {
39
+ className?: string;
40
+ }) => import("react").JSX.Element;
41
+ export declare const DropdownMenuSeparator: (props: object & {
42
+ className?: string;
43
+ }) => import("react").JSX.Element;
44
+ export declare const DropdownMenuSubContent: (props: object & {
45
+ className?: string;
46
+ }) => import("react").JSX.Element;
47
+ export declare const DropdownMenuSubTrigger: (props: object & {
48
+ className?: string;
49
+ }) => import("react").JSX.Element;
50
+ export declare const DialogContent: (props: object & {
51
+ className?: string;
52
+ }) => import("react").JSX.Element;
53
+ export declare const DialogHeader: (props: object & {
54
+ className?: string;
55
+ }) => import("react").JSX.Element;
56
+ export declare const DialogTitle: (props: any & {
57
+ className?: string;
58
+ }) => import("react").JSX.Element;
59
+ export declare const DialogDescription: (props: object & {
60
+ className?: string;
61
+ }) => import("react").JSX.Element;
62
+ export declare const DialogFooter: (props: object & {
63
+ className?: string;
64
+ }) => import("react").JSX.Element;
65
+ export declare const AlertDialogContent: (props: object & {
66
+ className?: string;
67
+ }) => import("react").JSX.Element;
68
+ export declare const AlertDialogHeader: (props: object & {
69
+ className?: string;
70
+ }) => import("react").JSX.Element;
71
+ export declare const AlertDialogTitle: (props: object & {
72
+ className?: string;
73
+ }) => import("react").JSX.Element;
74
+ export declare const AlertDialogDescription: (props: object & {
75
+ className?: string;
76
+ }) => import("react").JSX.Element;
77
+ export declare const AlertDialogFooter: (props: object & {
78
+ className?: string;
79
+ }) => import("react").JSX.Element;
80
+ export declare const SelectContent: (props: object & {
81
+ className?: string;
82
+ }) => import("react").JSX.Element;
83
+ export declare const AppBrand: ({ appearance, ...props }: ComponentProps<typeof RegistryAppBrand> & {
84
+ appearance?: "default" | "menuHeader" | "trigger";
85
+ }) => import("react").JSX.Element;
86
+ export declare const DataTable: <Row extends object>(props: DataTableProps<Row>) => import("react").JSX.Element;
87
+ export declare const SelectField: <Value extends string>({ field, props, }: ComponentProps<typeof RegistrySelectField<Value>>) => import("react").JSX.Element;
88
+ export declare const SingleSearchableSelectField: <Value>({ field, props, }: ComponentProps<typeof RegistrySingleSearchableSelectField<Value>>) => import("react").JSX.Element;
89
+ export {};
@@ -0,0 +1,59 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext, } from "react";
3
+ import * as Menu from "@/components/ui/dropdown-menu";
4
+ import * as Dialog from "@/components/ui/dialog";
5
+ import * as Alert from "@/components/ui/alert-dialog";
6
+ import * as Select from "@/components/ui/select";
7
+ import { AppBrand as RegistryAppBrand } from "@krak-stack/registry/app-brand";
8
+ import { DataTable as RegistryDataTable, } from "@krak-stack/registry/data-table";
9
+ import { SelectField as RegistrySelectField, SingleSearchableSelectField as RegistrySingleSearchableSelectField, } from "@krak-stack/registry/effect-form";
10
+ import { cn } from "./utils.js";
11
+ export const AuthUIStylesContext = createContext(undefined);
12
+ export const useAuthUIStyles = () => useContext(AuthUIStylesContext);
13
+ const styled = (Part, slot, style) => {
14
+ const StyledPart = (props) => {
15
+ const styles = useAuthUIStyles();
16
+ const className = cn(props.className, style(styles));
17
+ return _jsx(Part, { "data-auth-slot": slot, ...props, className: className });
18
+ };
19
+ return StyledPart;
20
+ };
21
+ export const DropdownMenuContent = styled(Menu.DropdownMenuContent, "menu", (s) => s?.menu?.content);
22
+ export const DropdownMenuGroup = styled(Menu.DropdownMenuGroup, "menu-group", (s) => s?.menu?.group);
23
+ export const DropdownMenuLabel = styled(Menu.DropdownMenuLabel, "menu-label", (s) => s?.menu?.label);
24
+ export const DropdownMenuItem = styled(Menu.DropdownMenuItem, "menu-item", (s) => s?.menu?.item);
25
+ export const DropdownMenuSeparator = styled(Menu.DropdownMenuSeparator, "menu-separator", (s) => s?.menu?.separator);
26
+ export const DropdownMenuSubContent = styled(Menu.DropdownMenuSubContent, "submenu", (s) => s?.menu?.subContent);
27
+ export const DropdownMenuSubTrigger = styled(Menu.DropdownMenuSubTrigger, "submenu-trigger", (s) => s?.menu?.subTrigger);
28
+ export const DialogContent = styled(Dialog.DialogContent, "dialog", (s) => s?.dialog?.content);
29
+ export const DialogHeader = styled(Dialog.DialogHeader, "dialog-header", (s) => s?.dialog?.header);
30
+ export const DialogTitle = styled(Dialog.DialogTitle, "dialog-title", (s) => s?.dialog?.title);
31
+ export const DialogDescription = styled(Dialog.DialogDescription, "dialog-description", (s) => s?.dialog?.description);
32
+ export const DialogFooter = styled(Dialog.DialogFooter, "dialog-footer", (s) => s?.dialog?.footer);
33
+ export const AlertDialogContent = styled(Alert.AlertDialogContent, "alert-dialog", (s) => s?.dialog?.content);
34
+ export const AlertDialogHeader = styled(Alert.AlertDialogHeader, "alert-dialog-header", (s) => s?.dialog?.header);
35
+ export const AlertDialogTitle = styled(Alert.AlertDialogTitle, "alert-dialog-title", (s) => s?.dialog?.title);
36
+ export const AlertDialogDescription = styled(Alert.AlertDialogDescription, "alert-dialog-description", (s) => s?.dialog?.description);
37
+ export const AlertDialogFooter = styled(Alert.AlertDialogFooter, "alert-dialog-footer", (s) => s?.dialog?.footer);
38
+ export const SelectContent = styled(Select.SelectContent, "select-popup", (s) => s?.popup?.select);
39
+ export const AppBrand = ({ appearance = "default", ...props }) => {
40
+ const styles = useAuthUIStyles();
41
+ const appearanceProps = appearance === "trigger" && styles?.trigger
42
+ ? { classNames: styles.trigger }
43
+ : {};
44
+ return (_jsx(RegistryAppBrand, { ...props, ...appearanceProps, className: cn(props.className, appearance === "menuHeader" && styles?.menu?.header) }));
45
+ };
46
+ export const DataTable = (props) => {
47
+ const styles = useAuthUIStyles();
48
+ return _jsx(RegistryDataTable, { ...styles?.table, ...props });
49
+ };
50
+ export const SelectField = ({ field, props, }) => {
51
+ const styles = useAuthUIStyles();
52
+ const appearance = { contentClassName: styles?.popup?.select };
53
+ return (_jsx(RegistrySelectField, { field: field, props: { ...props, ...appearance } }));
54
+ };
55
+ export const SingleSearchableSelectField = ({ field, props, }) => {
56
+ const styles = useAuthUIStyles();
57
+ const appearance = { contentClassName: styles?.popup?.combobox };
58
+ return (_jsx(RegistrySingleSearchableSelectField, { field: field, props: { ...props, ...appearance } }));
59
+ };