@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.
- package/CHANGELOG.md +20 -0
- package/README.md +37 -0
- package/dist/admin/api.group.d.ts +4 -4
- package/dist/admin/schema.d.ts +6 -6
- package/dist/api.d.ts +1577 -1331
- package/dist/auth/api.group.d.ts +124 -1
- package/dist/auth/api.group.js +36 -1
- package/dist/auth/schema.d.ts +38 -0
- package/dist/auth/schema.js +38 -0
- package/dist/components/account-deletion.js +2 -1
- package/dist/components/admin-organization-form.js +3 -2
- package/dist/components/admin-organizations.js +3 -3
- package/dist/components/admin-users.js +3 -3
- package/dist/components/appearance.d.ts +89 -0
- package/dist/components/appearance.js +59 -0
- package/dist/components/auth-client-api.d.ts +134 -4
- package/dist/components/auth-forms.d.ts +5 -1
- package/dist/components/auth-forms.js +60 -7
- package/dist/components/contact-fields.js +2 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/organization-sso-atom.d.ts +71 -0
- package/dist/components/organization-sso-atom.js +40 -0
- package/dist/components/organization-sso-messages.d.ts +76 -0
- package/dist/components/organization-sso-messages.js +77 -0
- package/dist/components/organization-sso-settings.d.ts +6 -0
- package/dist/components/organization-sso-settings.js +96 -0
- package/dist/components/organization-switcher.d.ts +8 -3
- package/dist/components/organization-switcher.js +25 -13
- package/dist/components/scrollable-dialog.d.ts +3 -2
- package/dist/components/scrollable-dialog.js +11 -4
- package/dist/components/user-button.d.ts +8 -2
- package/dist/components/user-button.js +8 -7
- package/dist/service.d.ts +260 -0
- package/package.json +3 -3
|
@@ -232,8 +232,8 @@ export declare const authHttpClient: (baseUrl?: string, getLocale?: () => "en" |
|
|
|
232
232
|
readonly updatedAt: import("effect/Schema").Date;
|
|
233
233
|
}>>>, import("effect/Schema").toCodecJson<typeof import("effect/http-api/HttpApiError").Unauthorized | typeof import("effect/http-api/HttpApiError").Forbidden | typeof import("effect/http-api/HttpApiError").InternalServerError>, never, never>, never, never>;
|
|
234
234
|
readonly listOrganizations: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"listOrganizations", "GET", "/api/auth/admin/organizations", never, import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
235
|
-
readonly page: import("effect/Schema").decodeTo<import("effect/Schema").Int, import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").
|
|
236
|
-
readonly pageSize: import("effect/Schema").decodeTo<import("effect/Schema").Int, import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").
|
|
235
|
+
readonly page: import("effect/Schema").decodeTo<import("effect/Schema").Int, import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Finite, import("effect/Schema").FiniteFromString]>>, never, never>;
|
|
236
|
+
readonly pageSize: import("effect/Schema").decodeTo<import("effect/Schema").Int, import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Finite, import("effect/Schema").FiniteFromString]>>, never, never>;
|
|
237
237
|
readonly globalFilter: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
238
238
|
readonly sort: import("effect/Schema").optional<import("effect/Schema").declare<readonly {
|
|
239
239
|
readonly id: string;
|
|
@@ -321,8 +321,8 @@ export declare const authHttpClient: (baseUrl?: string, getLocale?: () => "en" |
|
|
|
321
321
|
}>;
|
|
322
322
|
}>>, import("effect/Schema").toCodecJson<typeof import("effect/http-api/HttpApiError").Unauthorized | typeof import("effect/http-api/HttpApiError").Forbidden | typeof import("effect/http-api/HttpApiError").InternalServerError>, never, never>, never, never>;
|
|
323
323
|
readonly listUsers: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"listUsers", "GET", "/api/auth/admin/users", never, import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
324
|
-
readonly page: import("effect/Schema").decodeTo<import("effect/Schema").Int, import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").
|
|
325
|
-
readonly pageSize: import("effect/Schema").decodeTo<import("effect/Schema").Int, import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").
|
|
324
|
+
readonly page: import("effect/Schema").decodeTo<import("effect/Schema").Int, import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Finite, import("effect/Schema").FiniteFromString]>>, never, never>;
|
|
325
|
+
readonly pageSize: import("effect/Schema").decodeTo<import("effect/Schema").Int, import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Finite, import("effect/Schema").FiniteFromString]>>, never, never>;
|
|
326
326
|
readonly globalFilter: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
327
327
|
readonly sort: import("effect/Schema").optional<import("effect/Schema").declare<readonly {
|
|
328
328
|
readonly id: string;
|
|
@@ -848,6 +848,11 @@ export declare const authHttpClient: (baseUrl?: string, getLocale?: () => "en" |
|
|
|
848
848
|
readonly updatedAt: import("effect/Schema").DateFromString;
|
|
849
849
|
}>;
|
|
850
850
|
}>>, import("effect/Schema").toCodecJson<typeof import("../auth/schema.js").AuthBadRequest | typeof import("../auth/schema.js").AuthUnauthorized | typeof import("../auth/schema.js").AuthForbidden | typeof import("../auth/schema.js").AuthNotFound | typeof import("../auth/schema.js").AuthConflict | typeof import("../auth/schema.js").AuthExpectationFailed | typeof import("../auth/schema.js").AuthTooManyRequests | typeof import("../auth/schema.js").AuthInternalServerError>, never, never>, never, never>;
|
|
851
|
+
readonly deleteOrganizationSso: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"deleteOrganizationSso", "POST", "/api/auth/organization/sso/delete", never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
852
|
+
readonly organizationId: import("effect/Schema").NonEmptyString;
|
|
853
|
+
}>>, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
854
|
+
readonly success: import("effect/Schema").Boolean;
|
|
855
|
+
}>>, import("effect/Schema").toCodecJson<typeof import("../auth/schema.js").AuthBadRequest | typeof import("../auth/schema.js").AuthUnauthorized | typeof import("../auth/schema.js").AuthForbidden | typeof import("../auth/schema.js").AuthNotFound | typeof import("../auth/schema.js").AuthConflict | typeof import("../auth/schema.js").AuthExpectationFailed | typeof import("../auth/schema.js").AuthTooManyRequests | typeof import("../auth/schema.js").AuthInternalServerError>, never, never>, never, never>;
|
|
851
856
|
readonly deleteUser: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"deleteUser", "POST", "/api/auth/delete-user", never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
852
857
|
readonly password: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
853
858
|
readonly token: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
@@ -856,6 +861,20 @@ export declare const authHttpClient: (baseUrl?: string, getLocale?: () => "en" |
|
|
|
856
861
|
readonly success: import("effect/Schema").Boolean;
|
|
857
862
|
readonly message: import("effect/Schema").String;
|
|
858
863
|
}>>, import("effect/Schema").toCodecJson<typeof import("../auth/schema.js").AuthBadRequest | typeof import("../auth/schema.js").AuthUnauthorized | typeof import("../auth/schema.js").AuthForbidden | typeof import("../auth/schema.js").AuthNotFound | typeof import("../auth/schema.js").AuthInternalServerError>, never, never>, never, never>;
|
|
864
|
+
readonly getOrganizationSso: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"getOrganizationSso", "GET", "/api/auth/organization/sso", never, import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
865
|
+
readonly organizationId: import("effect/Schema").NonEmptyString;
|
|
866
|
+
}>>, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").NullOr<import("effect/Schema").Struct<{
|
|
867
|
+
readonly callbackURL: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
|
|
868
|
+
readonly organizationId: import("effect/Schema").NonEmptyString;
|
|
869
|
+
readonly providerId: import("effect/Schema").NonEmptyString;
|
|
870
|
+
readonly issuer: import("effect/Schema").NonEmptyString;
|
|
871
|
+
readonly domain: import("effect/Schema").NonEmptyString;
|
|
872
|
+
readonly clientId: import("effect/Schema").NonEmptyString;
|
|
873
|
+
readonly enabled: import("effect/Schema").Boolean;
|
|
874
|
+
readonly domainVerified: import("effect/Schema").Boolean;
|
|
875
|
+
readonly verificationName: import("effect/Schema").NonEmptyString;
|
|
876
|
+
readonly verificationToken: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
|
|
877
|
+
}>>>, import("effect/Schema").toCodecJson<typeof import("../auth/schema.js").AuthBadRequest | typeof import("../auth/schema.js").AuthUnauthorized | typeof import("../auth/schema.js").AuthForbidden | typeof import("../auth/schema.js").AuthNotFound | typeof import("../auth/schema.js").AuthConflict | typeof import("../auth/schema.js").AuthExpectationFailed | typeof import("../auth/schema.js").AuthTooManyRequests | typeof import("../auth/schema.js").AuthInternalServerError>, never, never>, never, never>;
|
|
859
878
|
readonly getSession: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"getSession", "GET", "/api/auth/get-session", never, import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
860
879
|
readonly disableCookieCache: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
861
880
|
readonly disableRefresh: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
@@ -922,6 +941,12 @@ export declare const authHttpClient: (baseUrl?: string, getLocale?: () => "en" |
|
|
|
922
941
|
readonly updatedAt: import("effect/Schema").DateFromString;
|
|
923
942
|
}>;
|
|
924
943
|
}>>>, import("effect/Schema").toCodecJson<typeof import("../auth/schema.js").AuthBadRequest | typeof import("../auth/schema.js").AuthUnauthorized | typeof import("../auth/schema.js").AuthForbidden | typeof import("../auth/schema.js").AuthNotFound | typeof import("../auth/schema.js").AuthConflict | typeof import("../auth/schema.js").AuthExpectationFailed | typeof import("../auth/schema.js").AuthTooManyRequests | typeof import("../auth/schema.js").AuthInternalServerError>, never, never>, never, never>;
|
|
944
|
+
readonly getSsoConfig: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"getSsoConfig", "GET", "/api/auth/sso/config", never, import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
945
|
+
readonly email: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
|
|
946
|
+
readonly organizationSlug: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
|
|
947
|
+
}>>, never, never, import("effect/Schema").toCodecJson<import("effect/Schema").NullOr<import("effect/Schema").Struct<{
|
|
948
|
+
readonly providerId: import("effect/Schema").NonEmptyString;
|
|
949
|
+
}>>>, import("effect/Schema").toCodecJson<typeof import("../auth/schema.js").AuthBadRequest | typeof import("../auth/schema.js").AuthUnauthorized | typeof import("../auth/schema.js").AuthForbidden | typeof import("../auth/schema.js").AuthNotFound | typeof import("../auth/schema.js").AuthConflict | typeof import("../auth/schema.js").AuthExpectationFailed | typeof import("../auth/schema.js").AuthTooManyRequests | typeof import("../auth/schema.js").AuthInternalServerError>, never, never>, never, never>;
|
|
925
950
|
readonly linkSocial: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"linkSocial", "POST", "/api/auth/link-social", never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
926
951
|
readonly callbackURL: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
927
952
|
readonly provider: import("effect/Schema").String;
|
|
@@ -1453,12 +1478,45 @@ export declare const authHttpClient: (baseUrl?: string, getLocale?: () => "en" |
|
|
|
1453
1478
|
}>>, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
1454
1479
|
readonly status: import("effect/Schema").Boolean;
|
|
1455
1480
|
}>>, import("effect/Schema").toCodecJson<typeof import("../auth/schema.js").AuthBadRequest | typeof import("../auth/schema.js").AuthUnauthorized | typeof import("../auth/schema.js").AuthForbidden | typeof import("../auth/schema.js").AuthNotFound | typeof import("../auth/schema.js").AuthConflict | typeof import("../auth/schema.js").AuthExpectationFailed | typeof import("../auth/schema.js").AuthTooManyRequests | typeof import("../auth/schema.js").AuthInternalServerError>, never, never>, never, never>;
|
|
1481
|
+
readonly saveOrganizationSso: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"saveOrganizationSso", "POST", "/api/auth/organization/sso", never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
1482
|
+
readonly organizationId: import("effect/Schema").NonEmptyString;
|
|
1483
|
+
readonly issuer: import("effect/Schema").NonEmptyString;
|
|
1484
|
+
readonly domain: import("effect/Schema").NonEmptyString;
|
|
1485
|
+
readonly clientId: import("effect/Schema").NonEmptyString;
|
|
1486
|
+
readonly clientSecret: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
|
|
1487
|
+
}>>, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
1488
|
+
readonly callbackURL: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
|
|
1489
|
+
readonly organizationId: import("effect/Schema").NonEmptyString;
|
|
1490
|
+
readonly providerId: import("effect/Schema").NonEmptyString;
|
|
1491
|
+
readonly issuer: import("effect/Schema").NonEmptyString;
|
|
1492
|
+
readonly domain: import("effect/Schema").NonEmptyString;
|
|
1493
|
+
readonly clientId: import("effect/Schema").NonEmptyString;
|
|
1494
|
+
readonly enabled: import("effect/Schema").Boolean;
|
|
1495
|
+
readonly domainVerified: import("effect/Schema").Boolean;
|
|
1496
|
+
readonly verificationName: import("effect/Schema").NonEmptyString;
|
|
1497
|
+
readonly verificationToken: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
|
|
1498
|
+
}>>, import("effect/Schema").toCodecJson<typeof import("../auth/schema.js").AuthBadRequest | typeof import("../auth/schema.js").AuthUnauthorized | typeof import("../auth/schema.js").AuthForbidden | typeof import("../auth/schema.js").AuthNotFound | typeof import("../auth/schema.js").AuthConflict | typeof import("../auth/schema.js").AuthExpectationFailed | typeof import("../auth/schema.js").AuthTooManyRequests | typeof import("../auth/schema.js").AuthInternalServerError>, never, never>, never, never>;
|
|
1456
1499
|
readonly sendVerificationOtp: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"sendVerificationOtp", "POST", "/api/auth/email-otp/send-verification-otp", never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
1457
1500
|
readonly email: import("effect/Schema").String;
|
|
1458
1501
|
readonly type: import("effect/Schema").Literals<readonly ["sign-in", "email-verification", "forget-password"]>;
|
|
1459
1502
|
}>>, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
1460
1503
|
readonly success: import("effect/Schema").Boolean;
|
|
1461
1504
|
}>>, import("effect/Schema").toCodecJson<typeof import("../auth/schema.js").AuthBadRequest | typeof import("../auth/schema.js").AuthUnauthorized | typeof import("../auth/schema.js").AuthForbidden | typeof import("../auth/schema.js").AuthNotFound | typeof import("../auth/schema.js").AuthConflict | typeof import("../auth/schema.js").AuthExpectationFailed | typeof import("../auth/schema.js").AuthTooManyRequests | typeof import("../auth/schema.js").AuthInternalServerError>, never, never>, never, never>;
|
|
1505
|
+
readonly setOrganizationSsoEnabled: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"setOrganizationSsoEnabled", "POST", "/api/auth/organization/sso/enabled", never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
1506
|
+
readonly organizationId: import("effect/Schema").NonEmptyString;
|
|
1507
|
+
readonly enabled: import("effect/Schema").Boolean;
|
|
1508
|
+
}>>, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
1509
|
+
readonly callbackURL: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
|
|
1510
|
+
readonly organizationId: import("effect/Schema").NonEmptyString;
|
|
1511
|
+
readonly providerId: import("effect/Schema").NonEmptyString;
|
|
1512
|
+
readonly issuer: import("effect/Schema").NonEmptyString;
|
|
1513
|
+
readonly domain: import("effect/Schema").NonEmptyString;
|
|
1514
|
+
readonly clientId: import("effect/Schema").NonEmptyString;
|
|
1515
|
+
readonly enabled: import("effect/Schema").Boolean;
|
|
1516
|
+
readonly domainVerified: import("effect/Schema").Boolean;
|
|
1517
|
+
readonly verificationName: import("effect/Schema").NonEmptyString;
|
|
1518
|
+
readonly verificationToken: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
|
|
1519
|
+
}>>, import("effect/Schema").toCodecJson<typeof import("../auth/schema.js").AuthBadRequest | typeof import("../auth/schema.js").AuthUnauthorized | typeof import("../auth/schema.js").AuthForbidden | typeof import("../auth/schema.js").AuthNotFound | typeof import("../auth/schema.js").AuthConflict | typeof import("../auth/schema.js").AuthExpectationFailed | typeof import("../auth/schema.js").AuthTooManyRequests | typeof import("../auth/schema.js").AuthInternalServerError>, never, never>, never, never>;
|
|
1462
1520
|
readonly signInEmail: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"signInEmail", "POST", "/api/auth/sign-in/email", never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
1463
1521
|
readonly email: import("effect/Schema").String;
|
|
1464
1522
|
readonly password: import("effect/Schema").String;
|
|
@@ -1657,6 +1715,64 @@ export declare const authHttpClient: (baseUrl?: string, getLocale?: () => "en" |
|
|
|
1657
1715
|
}>>;
|
|
1658
1716
|
readonly status: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
1659
1717
|
}>>, import("effect/Schema").toCodecJson<typeof import("../auth/schema.js").AuthBadRequest | typeof import("../auth/schema.js").AuthUnauthorized | typeof import("../auth/schema.js").AuthForbidden | typeof import("../auth/schema.js").AuthNotFound | typeof import("../auth/schema.js").AuthConflict | typeof import("../auth/schema.js").AuthExpectationFailed | typeof import("../auth/schema.js").AuthTooManyRequests | typeof import("../auth/schema.js").AuthInternalServerError>, never, never>, never, never>;
|
|
1718
|
+
readonly signInSso: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"signInSso", "POST", "/api/auth/sign-in/sso", never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
1719
|
+
readonly providerId: import("effect/Schema").NonEmptyString;
|
|
1720
|
+
readonly callbackURL: import("effect/Schema").NonEmptyString;
|
|
1721
|
+
readonly errorCallbackURL: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
|
|
1722
|
+
}>>, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
1723
|
+
readonly url: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
1724
|
+
readonly redirect: import("effect/Schema").Boolean;
|
|
1725
|
+
readonly token: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
1726
|
+
readonly user: import("effect/Schema").optional<import("effect/Schema").Struct<{
|
|
1727
|
+
readonly id: import("effect/Schema").String;
|
|
1728
|
+
readonly name: import("effect/Schema").String;
|
|
1729
|
+
readonly email: import("effect/Schema").String;
|
|
1730
|
+
readonly emailVerified: import("effect/Schema").Boolean;
|
|
1731
|
+
readonly locale: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["en", "fr"]>>;
|
|
1732
|
+
readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
1733
|
+
readonly metadata: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").decodeTo<import("effect/Schema").Struct<{
|
|
1734
|
+
readonly emails: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
1735
|
+
readonly email: import("effect/Schema").NonEmptyString;
|
|
1736
|
+
readonly translations: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
1737
|
+
readonly locale: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"en">, import("effect/Schema").Literal<"fr">]>;
|
|
1738
|
+
readonly label: import("effect/Schema").NonEmptyString;
|
|
1739
|
+
}>>;
|
|
1740
|
+
}>>>;
|
|
1741
|
+
readonly phones: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
1742
|
+
readonly number: import("effect/Schema").NonEmptyString;
|
|
1743
|
+
readonly extension: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
1744
|
+
readonly translations: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
1745
|
+
readonly locale: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"en">, import("effect/Schema").Literal<"fr">]>;
|
|
1746
|
+
readonly label: import("effect/Schema").NonEmptyString;
|
|
1747
|
+
}>>;
|
|
1748
|
+
}>>>;
|
|
1749
|
+
readonly websites: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
1750
|
+
readonly url: import("effect/Schema").NonEmptyString;
|
|
1751
|
+
readonly translations: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
1752
|
+
readonly locale: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"en">, import("effect/Schema").Literal<"fr">]>;
|
|
1753
|
+
readonly label: import("effect/Schema").NonEmptyString;
|
|
1754
|
+
}>>;
|
|
1755
|
+
}>>>;
|
|
1756
|
+
readonly socials: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
1757
|
+
readonly platform: import("effect/Schema").Literals<readonly ["facebook", "github", "instagram", "linkedin", "tiktok", "x", "youtube"]>;
|
|
1758
|
+
readonly url: import("effect/Schema").NonEmptyString;
|
|
1759
|
+
readonly translations: import("effect/Schema").$Array<import("effect/Schema").Struct<{
|
|
1760
|
+
readonly locale: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"en">, import("effect/Schema").Literal<"fr">]>;
|
|
1761
|
+
readonly label: import("effect/Schema").NonEmptyString;
|
|
1762
|
+
}>>;
|
|
1763
|
+
}>>>;
|
|
1764
|
+
}>, import("effect/Schema").Unknown, never, never>>>;
|
|
1765
|
+
readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
1766
|
+
readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
|
|
1767
|
+
readonly banReason: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
1768
|
+
readonly banExpires: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").DateFromString>>;
|
|
1769
|
+
readonly twoFactorEnabled: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
1770
|
+
readonly lastLoginMethod: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
1771
|
+
readonly createdAt: import("effect/Schema").DateFromString;
|
|
1772
|
+
readonly updatedAt: import("effect/Schema").DateFromString;
|
|
1773
|
+
}>>;
|
|
1774
|
+
readonly status: import("effect/Schema").optional<import("effect/Schema").Boolean>;
|
|
1775
|
+
}>>, import("effect/Schema").toCodecJson<typeof import("../auth/schema.js").AuthBadRequest | typeof import("../auth/schema.js").AuthUnauthorized | typeof import("../auth/schema.js").AuthForbidden | typeof import("../auth/schema.js").AuthNotFound | typeof import("../auth/schema.js").AuthConflict | typeof import("../auth/schema.js").AuthExpectationFailed | typeof import("../auth/schema.js").AuthTooManyRequests | typeof import("../auth/schema.js").AuthInternalServerError>, never, never>, never, never>;
|
|
1660
1776
|
readonly signOut: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"signOut", "POST", "/api/auth/sign-out", never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{}>>, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
1661
1777
|
readonly success: import("effect/Schema").Boolean;
|
|
1662
1778
|
}>>, import("effect/Schema").toCodecJson<typeof import("../auth/schema.js").AuthBadRequest | typeof import("../auth/schema.js").AuthUnauthorized | typeof import("../auth/schema.js").AuthForbidden | typeof import("../auth/schema.js").AuthNotFound | typeof import("../auth/schema.js").AuthConflict | typeof import("../auth/schema.js").AuthExpectationFailed | typeof import("../auth/schema.js").AuthTooManyRequests | typeof import("../auth/schema.js").AuthInternalServerError>, never, never>, never, never>;
|
|
@@ -1943,6 +2059,20 @@ export declare const authHttpClient: (baseUrl?: string, getLocale?: () => "en" |
|
|
|
1943
2059
|
readonly updatedAt: import("effect/Schema").DateFromString;
|
|
1944
2060
|
}>;
|
|
1945
2061
|
}>>, import("effect/Schema").toCodecJson<typeof import("../auth/schema.js").AuthBadRequest | typeof import("../auth/schema.js").AuthUnauthorized | typeof import("../auth/schema.js").AuthForbidden | typeof import("../auth/schema.js").AuthNotFound | typeof import("../auth/schema.js").AuthConflict | typeof import("../auth/schema.js").AuthExpectationFailed | typeof import("../auth/schema.js").AuthTooManyRequests | typeof import("../auth/schema.js").AuthInternalServerError>, never, never>, never, never>;
|
|
2062
|
+
readonly verifyOrganizationSso: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"verifyOrganizationSso", "POST", "/api/auth/organization/sso/verify", never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
2063
|
+
readonly organizationId: import("effect/Schema").NonEmptyString;
|
|
2064
|
+
}>>, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
2065
|
+
readonly callbackURL: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
|
|
2066
|
+
readonly organizationId: import("effect/Schema").NonEmptyString;
|
|
2067
|
+
readonly providerId: import("effect/Schema").NonEmptyString;
|
|
2068
|
+
readonly issuer: import("effect/Schema").NonEmptyString;
|
|
2069
|
+
readonly domain: import("effect/Schema").NonEmptyString;
|
|
2070
|
+
readonly clientId: import("effect/Schema").NonEmptyString;
|
|
2071
|
+
readonly enabled: import("effect/Schema").Boolean;
|
|
2072
|
+
readonly domainVerified: import("effect/Schema").Boolean;
|
|
2073
|
+
readonly verificationName: import("effect/Schema").NonEmptyString;
|
|
2074
|
+
readonly verificationToken: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
|
|
2075
|
+
}>>, import("effect/Schema").toCodecJson<typeof import("../auth/schema.js").AuthBadRequest | typeof import("../auth/schema.js").AuthUnauthorized | typeof import("../auth/schema.js").AuthForbidden | typeof import("../auth/schema.js").AuthNotFound | typeof import("../auth/schema.js").AuthConflict | typeof import("../auth/schema.js").AuthExpectationFailed | typeof import("../auth/schema.js").AuthTooManyRequests | typeof import("../auth/schema.js").AuthInternalServerError>, never, never>, never, never>;
|
|
1946
2076
|
};
|
|
1947
2077
|
readonly authExtra: {
|
|
1948
2078
|
readonly createApiKey: HttpApiClient.Client.Method<import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"createApiKey", "POST", "/api/auth/create-api-key", never, never, import("effect/Schema").toCodecJson<import("effect/Schema").Struct<{
|
|
@@ -13,7 +13,11 @@ export declare const resolveInitialAuthMethod: ({ requestedMethod, lastLoginMeth
|
|
|
13
13
|
emailPassword: boolean;
|
|
14
14
|
emailOtp: boolean;
|
|
15
15
|
}) => AuthMethod;
|
|
16
|
-
export declare function Signin(props: AuthFormProps
|
|
16
|
+
export declare function Signin(props: AuthFormProps & {
|
|
17
|
+
sso?: {
|
|
18
|
+
label: string;
|
|
19
|
+
};
|
|
20
|
+
}): import("react").JSX.Element;
|
|
17
21
|
export declare function VerifyEmail(props: AuthFormProps): import("react").JSX.Element;
|
|
18
22
|
export declare function ForgotPassword(props: AuthFormProps): import("react").JSX.Element;
|
|
19
23
|
export declare function ResetPassword(props: AuthFormProps): import("react").JSX.Element;
|
|
@@ -23,9 +23,10 @@ import { useKrakstackAuth } from "./auth-provider.js";
|
|
|
23
23
|
import { cn } from "./utils.js";
|
|
24
24
|
import { getOAuthAuthorizationQuery } from "../oauth/authorization.js";
|
|
25
25
|
import { ExtraProjectPublicConfig as ExtraProjectPublicConfigSchema, } from "../extra/schema.js";
|
|
26
|
+
import { EmailAddress } from "../schema.js";
|
|
26
27
|
import { AuthBadRequest, AuthInternalServerError, AuthTooManyRequests, AuthUnauthorized, AuthRedirectURLFromString, } from "../auth/schema.js";
|
|
27
28
|
const signinFormBuilder = FormBuilder.empty
|
|
28
|
-
.addField("email",
|
|
29
|
+
.addField("email", EmailAddress)
|
|
29
30
|
.addField("password", Schema.String)
|
|
30
31
|
.addField("otp", Schema.String);
|
|
31
32
|
const verifyEmailFormBuilder = FormBuilder.empty
|
|
@@ -297,7 +298,9 @@ export function Signin(props) {
|
|
|
297
298
|
emailPassword: options.emailPassword,
|
|
298
299
|
emailOtp: options.emailOtp,
|
|
299
300
|
}));
|
|
300
|
-
const initialMethodStep =
|
|
301
|
+
const initialMethodStep = Option.isSome(Schema.decodeOption(EmailAddress)(initialEmail)) &&
|
|
302
|
+
(options.emailPassword || options.emailOtp) &&
|
|
303
|
+
requestedMethod === initialAuthMethod;
|
|
301
304
|
const [emailSubmitted, setEmailSubmitted] = useState(initialMethodStep);
|
|
302
305
|
const [authMethod, setAuthMethod] = useState(initialAuthMethod);
|
|
303
306
|
const [otpSentTo, setOtpSentTo] = useState(initialMethodStep && initialAuthMethod === "emailOtp" ? initialEmail : "");
|
|
@@ -386,6 +389,11 @@ export function Signin(props) {
|
|
|
386
389
|
return;
|
|
387
390
|
}
|
|
388
391
|
if (!action.emailSubmitted) {
|
|
392
|
+
if ((!options.emailPassword && !options.emailOtp) ||
|
|
393
|
+
(props.sso && action.method === "emailOtp")) {
|
|
394
|
+
setEmailSubmitted(true);
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
389
397
|
if (action.method === "emailOtp")
|
|
390
398
|
yield* sendEmailOtp;
|
|
391
399
|
else {
|
|
@@ -459,6 +467,34 @@ export function Signin(props) {
|
|
|
459
467
|
})));
|
|
460
468
|
const startSocialSignIn = useAtomSet(socialSignIn);
|
|
461
469
|
const socialSignInResult = useAtomValue(socialSignIn);
|
|
470
|
+
const [ssoSignIn] = useState(() => authClientApi(baseUrl).runtime.fn((payload) => authHttpClient(baseUrl, locale).pipe(Effect.flatMap((client) => Effect.gen(function* () {
|
|
471
|
+
const query = {};
|
|
472
|
+
if (payload.email)
|
|
473
|
+
query.email = payload.email;
|
|
474
|
+
if (payload.organizationSlug)
|
|
475
|
+
query.organizationSlug = payload.organizationSlug;
|
|
476
|
+
const connection = yield* client.auth.getSsoConfig({
|
|
477
|
+
query,
|
|
478
|
+
});
|
|
479
|
+
if (!connection)
|
|
480
|
+
return yield* new AuthBadRequest({
|
|
481
|
+
message: "SSO unavailable",
|
|
482
|
+
});
|
|
483
|
+
return yield* client.auth.signInSso({
|
|
484
|
+
payload: {
|
|
485
|
+
providerId: connection.providerId,
|
|
486
|
+
callbackURL: payload.callbackURL,
|
|
487
|
+
errorCallbackURL: payload.errorCallbackURL,
|
|
488
|
+
},
|
|
489
|
+
});
|
|
490
|
+
})), Effect.flatMap((result) => {
|
|
491
|
+
const url = result.url;
|
|
492
|
+
return url
|
|
493
|
+
? Effect.promise(() => Promise.resolve(onNavigate(url)))
|
|
494
|
+
: Effect.void;
|
|
495
|
+
}))));
|
|
496
|
+
const startSsoSignIn = useAtomSet(ssoSignIn);
|
|
497
|
+
const ssoSignInResult = useAtomValue(ssoSignIn);
|
|
462
498
|
const formValues = Option.getOrElse(useAtomValue(form.values), () => ({
|
|
463
499
|
email: "",
|
|
464
500
|
password: "",
|
|
@@ -504,9 +540,18 @@ export function Signin(props) {
|
|
|
504
540
|
submit({ type: "resendEmailOtp" });
|
|
505
541
|
};
|
|
506
542
|
const signInWithGoogle = () => startSocialSignIn(getSocialSignInDestinations(router, props.defaultRedirectTo, window.location.href));
|
|
543
|
+
const signInWithSso = () => {
|
|
544
|
+
const { callbackURL, errorCallbackURL } = getSocialSignInDestinations(router, props.defaultRedirectTo, window.location.href);
|
|
545
|
+
startSsoSignIn({
|
|
546
|
+
email: formValues.email.trim(),
|
|
547
|
+
organizationSlug: getSearchParam(searchString, "organization") ?? undefined,
|
|
548
|
+
callbackURL,
|
|
549
|
+
errorCallbackURL,
|
|
550
|
+
});
|
|
551
|
+
};
|
|
507
552
|
return (_jsxs(Card, { className: "w-full max-w-md", children: [_jsxs(CardHeader, { children: [emailSubmitted ? (_jsxs(Button, { type: "button", variant: "link", className: "w-fit justify-self-start p-0", disabled: submitResult.waiting, onClick: resetEmailStep, children: [_jsx(ArrowLeft, {}), m.sign_in_change_email] })) : null, _jsx(CardTitle, { className: "text-3xl", children: m.auth_sign_in }), _jsx(CardDescription, { children: !emailSubmitted
|
|
508
553
|
? m.sign_in_description
|
|
509
|
-
: text(m.sign_in_email_as, { email: formValues.email }) })] }), _jsxs(CardContent, { children: [hasPrimaryAuth ? (_jsx(form.Initialize, { defaultValues: { email: initialEmail, password: "", otp: "" }, children: _jsxs("form", { className: "flex flex-col gap-4", onSubmit: (event) => {
|
|
554
|
+
: text(m.sign_in_email_as, { email: formValues.email }) })] }), _jsxs(CardContent, { children: [getSearchParam(searchString, "error") ? (_jsx(ErrorMessage, { text: m.sign_in_error })) : null, hasPrimaryAuth || props.sso ? (_jsx(form.Initialize, { defaultValues: { email: initialEmail, password: "", otp: "" }, children: hasPrimaryAuth || !emailSubmitted ? (_jsxs("form", { className: "flex flex-col gap-4", onSubmit: (event) => {
|
|
510
555
|
event.preventDefault();
|
|
511
556
|
event.stopPropagation();
|
|
512
557
|
setErrorContext(!emailSubmitted ||
|
|
@@ -533,7 +578,9 @@ export function Signin(props) {
|
|
|
533
578
|
setErrorContext("resetPassword");
|
|
534
579
|
submit({ type: "resetPassword" });
|
|
535
580
|
},
|
|
536
|
-
}, required: true }) })) : null, emailSubmitted &&
|
|
581
|
+
}, required: true }) })) : null, emailSubmitted &&
|
|
582
|
+
selectedAuthMethod === "emailOtp" &&
|
|
583
|
+
otpSentTo ? (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(form.otp, { label: m.sign_in_email_otp_code }), _jsx("p", { className: "text-muted-foreground text-sm", children: m.sign_in_otp_expiry }), _jsx("div", { className: "flex flex-wrap gap-x-4 gap-y-2 text-sm", children: otpSentTo ? (_jsx(Button, { type: "button", variant: "link", className: "h-auto px-0", disabled: submitResult.waiting || emailOtpResendSeconds > 0, onClick: resendEmailOtp, children: emailOtpResendSeconds > 0
|
|
537
584
|
? text(m.sign_in_email_otp_resend_countdown, {
|
|
538
585
|
seconds: String(emailOtpResendSeconds),
|
|
539
586
|
})
|
|
@@ -560,11 +607,17 @@ export function Signin(props) {
|
|
|
560
607
|
} }), _jsx("div", { children: _jsxs(Button, { type: "submit", disabled: submitResult.waiting, children: [submitResult.waiting ? (_jsx(Loader2, { className: "animate-spin", "data-icon": "inline-start" })) : null, !emailSubmitted
|
|
561
608
|
? m.sign_in_continue
|
|
562
609
|
: selectedAuthMethod === "emailOtp"
|
|
563
|
-
?
|
|
564
|
-
|
|
610
|
+
? otpSentTo
|
|
611
|
+
? m.sign_in_email_otp_verify
|
|
612
|
+
: m.sign_in_use_email_otp
|
|
613
|
+
: m.auth_sign_in] }) })] })) : null })) : null, (emailSubmitted && (canChangeAuthMethod || props.sso)) ||
|
|
565
614
|
(options.google && !emailSubmitted) ? (_jsxs("div", { className: "mt-4 flex flex-col gap-3", children: [hasPrimaryAuth ? (_jsx(Divider, { label: m.auth_or_continue_with })) : null, emailSubmitted && canChangeAuthMethod ? (_jsxs(Button, { type: "button", variant: "outline", className: "w-full", disabled: submitResult.waiting, onClick: switchAuthMethod, children: [selectedAuthMethod === "password" ? _jsx(Mail, {}) : _jsx(KeyRound, {}), selectedAuthMethod === "password"
|
|
566
615
|
? m.sign_in_use_email_otp
|
|
567
|
-
: m.sign_in_use_password] })) : null, options.google && !emailSubmitted ? (_jsxs(_Fragment, { children: [_jsxs(Button, { type: "button", variant: "outline", className: "w-full", disabled: submitResult.waiting
|
|
616
|
+
: m.sign_in_use_password] })) : null, options.google && !emailSubmitted ? (_jsxs(_Fragment, { children: [_jsxs(Button, { type: "button", variant: "outline", className: "w-full", disabled: submitResult.waiting ||
|
|
617
|
+
socialSignInResult.waiting ||
|
|
618
|
+
ssoSignInResult.waiting, onClick: signInWithGoogle, children: [_jsx(GoogleLogo, {}), m.auth_continue_with_google] }), _jsx(AuthSubmitError, { result: socialSignInResult, labels: m, messages: { fallback: m.sign_in_error } })] })) : null, props.sso && emailSubmitted ? (_jsxs(_Fragment, { children: [_jsxs(Button, { type: "button", variant: "outline", className: "w-full", disabled: submitResult.waiting ||
|
|
619
|
+
socialSignInResult.waiting ||
|
|
620
|
+
ssoSignInResult.waiting, onClick: signInWithSso, children: [ssoSignInResult.waiting ? (_jsx(Loader2, { className: "animate-spin" })) : (_jsx(KeyRound, {})), props.sso.label] }), _jsx(AuthSubmitError, { result: ssoSignInResult, labels: m, messages: { fallback: m.sign_in_error } })] })) : null] })) : null, !hasPrimaryAuth && !options.google && !props.sso ? (_jsx("p", { className: "text-muted-foreground text-sm", children: m.oauth_client_no_auth_methods })) : null] })] }));
|
|
568
621
|
}
|
|
569
622
|
export function VerifyEmail(props) {
|
|
570
623
|
const registry = useContext(RegistryContext);
|
|
@@ -7,7 +7,8 @@ import { ErrorMessage } from "@krak-stack/registry/effect-form";
|
|
|
7
7
|
import { Button } from "@/components/ui/button";
|
|
8
8
|
import { Field, FieldLabel } from "@/components/ui/field";
|
|
9
9
|
import { Input } from "@/components/ui/input";
|
|
10
|
-
import { Select,
|
|
10
|
+
import { Select, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select";
|
|
11
|
+
import { SelectContent } from "./appearance.js";
|
|
11
12
|
const socialPlatform = (value) => {
|
|
12
13
|
switch (value) {
|
|
13
14
|
case "facebook":
|
|
@@ -21,4 +21,5 @@ export type { AdminOrganizationsMessages } from "./admin-organizations.js";
|
|
|
21
21
|
export type { KrakstackAuthContextValue, KrakstackAuthLocale, KrakstackAuthProviderProps, KrakstackAuthRequiredProps, KrakstackAuthStatus, } from "./auth-provider.js";
|
|
22
22
|
export type { OrganizationSwitcherDialog, OrganizationSwitcherFeatures, OrganizationSwitcherProps, } from "./organization-switcher.js";
|
|
23
23
|
export type { UserButtonDialog, UserButtonProps } from "./user-button.js";
|
|
24
|
+
export type { AuthUIClassNames } from "./appearance.js";
|
|
24
25
|
export type { MemberRequiredMessages, MemberRequiredProps, } from "./member-required.js";
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { AsyncResult, Atom } from "effect/reactivity";
|
|
2
|
+
export declare const organizationSsoAtoms: (arg: string | undefined) => (arg: string) => {
|
|
3
|
+
settings: Atom.Writable<AsyncResult.AsyncResult<{
|
|
4
|
+
readonly callbackURL?: string | undefined;
|
|
5
|
+
readonly organizationId: string;
|
|
6
|
+
readonly providerId: string;
|
|
7
|
+
readonly issuer: string;
|
|
8
|
+
readonly domain: string;
|
|
9
|
+
readonly clientId: string;
|
|
10
|
+
readonly enabled: boolean;
|
|
11
|
+
readonly domainVerified: boolean;
|
|
12
|
+
readonly verificationName: string;
|
|
13
|
+
readonly verificationToken?: string | undefined;
|
|
14
|
+
} | null, import("../auth/schema.js").AuthBadRequest | import("../auth/schema.js").AuthConflict | import("../auth/schema.js").AuthExpectationFailed | import("../auth/schema.js").AuthForbidden | import("../auth/schema.js").AuthInternalServerError | import("../auth/schema.js").AuthNotFound | import("../auth/schema.js").AuthTooManyRequests | import("../auth/schema.js").AuthUnauthorized>, Atom.Atom<AsyncResult.AsyncResult<AsyncResult.AsyncResult<{
|
|
15
|
+
readonly callbackURL?: string | undefined;
|
|
16
|
+
readonly organizationId: string;
|
|
17
|
+
readonly providerId: string;
|
|
18
|
+
readonly issuer: string;
|
|
19
|
+
readonly domain: string;
|
|
20
|
+
readonly clientId: string;
|
|
21
|
+
readonly enabled: boolean;
|
|
22
|
+
readonly domainVerified: boolean;
|
|
23
|
+
readonly verificationName: string;
|
|
24
|
+
readonly verificationToken?: string | undefined;
|
|
25
|
+
} | null, import("../auth/schema.js").AuthBadRequest | import("../auth/schema.js").AuthConflict | import("../auth/schema.js").AuthExpectationFailed | import("../auth/schema.js").AuthForbidden | import("../auth/schema.js").AuthInternalServerError | import("../auth/schema.js").AuthNotFound | import("../auth/schema.js").AuthTooManyRequests | import("../auth/schema.js").AuthUnauthorized>, unknown>>>;
|
|
26
|
+
save: Atom.AtomResultFn<Omit<{
|
|
27
|
+
readonly organizationId: string;
|
|
28
|
+
readonly issuer: string;
|
|
29
|
+
readonly domain: string;
|
|
30
|
+
readonly clientId: string;
|
|
31
|
+
readonly clientSecret?: string | undefined;
|
|
32
|
+
}, "organizationId">, {
|
|
33
|
+
readonly callbackURL?: string | undefined;
|
|
34
|
+
readonly organizationId: string;
|
|
35
|
+
readonly providerId: string;
|
|
36
|
+
readonly issuer: string;
|
|
37
|
+
readonly domain: string;
|
|
38
|
+
readonly clientId: string;
|
|
39
|
+
readonly enabled: boolean;
|
|
40
|
+
readonly domainVerified: boolean;
|
|
41
|
+
readonly verificationName: string;
|
|
42
|
+
readonly verificationToken?: string | undefined;
|
|
43
|
+
}, import("../auth/schema.js").AuthBadRequest | import("../auth/schema.js").AuthConflict | import("../auth/schema.js").AuthExpectationFailed | import("../auth/schema.js").AuthForbidden | import("../auth/schema.js").AuthInternalServerError | import("../auth/schema.js").AuthNotFound | import("../auth/schema.js").AuthTooManyRequests | import("../auth/schema.js").AuthUnauthorized>;
|
|
44
|
+
verify: Atom.AtomResultFn<void, {
|
|
45
|
+
readonly callbackURL?: string | undefined;
|
|
46
|
+
readonly organizationId: string;
|
|
47
|
+
readonly providerId: string;
|
|
48
|
+
readonly issuer: string;
|
|
49
|
+
readonly domain: string;
|
|
50
|
+
readonly clientId: string;
|
|
51
|
+
readonly enabled: boolean;
|
|
52
|
+
readonly domainVerified: boolean;
|
|
53
|
+
readonly verificationName: string;
|
|
54
|
+
readonly verificationToken?: string | undefined;
|
|
55
|
+
}, import("../auth/schema.js").AuthBadRequest | import("../auth/schema.js").AuthConflict | import("../auth/schema.js").AuthExpectationFailed | import("../auth/schema.js").AuthForbidden | import("../auth/schema.js").AuthInternalServerError | import("../auth/schema.js").AuthNotFound | import("../auth/schema.js").AuthTooManyRequests | import("../auth/schema.js").AuthUnauthorized>;
|
|
56
|
+
remove: Atom.AtomResultFn<void, {
|
|
57
|
+
readonly success: boolean;
|
|
58
|
+
}, import("../auth/schema.js").AuthBadRequest | import("../auth/schema.js").AuthConflict | import("../auth/schema.js").AuthExpectationFailed | import("../auth/schema.js").AuthForbidden | import("../auth/schema.js").AuthInternalServerError | import("../auth/schema.js").AuthNotFound | import("../auth/schema.js").AuthTooManyRequests | import("../auth/schema.js").AuthUnauthorized>;
|
|
59
|
+
enable: Atom.AtomResultFn<boolean, {
|
|
60
|
+
readonly callbackURL?: string | undefined;
|
|
61
|
+
readonly organizationId: string;
|
|
62
|
+
readonly providerId: string;
|
|
63
|
+
readonly issuer: string;
|
|
64
|
+
readonly domain: string;
|
|
65
|
+
readonly clientId: string;
|
|
66
|
+
readonly enabled: boolean;
|
|
67
|
+
readonly domainVerified: boolean;
|
|
68
|
+
readonly verificationName: string;
|
|
69
|
+
readonly verificationToken?: string | undefined;
|
|
70
|
+
}, import("../auth/schema.js").AuthBadRequest | import("../auth/schema.js").AuthConflict | import("../auth/schema.js").AuthExpectationFailed | import("../auth/schema.js").AuthForbidden | import("../auth/schema.js").AuthInternalServerError | import("../auth/schema.js").AuthNotFound | import("../auth/schema.js").AuthTooManyRequests | import("../auth/schema.js").AuthUnauthorized>;
|
|
71
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AsyncResult, Atom } from "effect/reactivity";
|
|
2
|
+
import { authClientApi } from "./auth-client-api.js";
|
|
3
|
+
export const organizationSsoAtoms = Atom.family((baseUrl) => {
|
|
4
|
+
const client = authClientApi(baseUrl);
|
|
5
|
+
return Atom.family((organizationId) => {
|
|
6
|
+
const reactivityKeys = [
|
|
7
|
+
`organization-sso:${baseUrl ?? ""}:${organizationId}`,
|
|
8
|
+
];
|
|
9
|
+
const settings = Atom.optimistic(client.query("auth", "getOrganizationSso", {
|
|
10
|
+
query: { organizationId },
|
|
11
|
+
reactivityKeys,
|
|
12
|
+
timeToLive: "1 minute",
|
|
13
|
+
}));
|
|
14
|
+
const saveMutation = client.mutation("auth", "saveOrganizationSso");
|
|
15
|
+
const verifyMutation = client.mutation("auth", "verifyOrganizationSso");
|
|
16
|
+
const enableMutation = client.mutation("auth", "setOrganizationSsoEnabled");
|
|
17
|
+
const deleteMutation = client.mutation("auth", "deleteOrganizationSso");
|
|
18
|
+
// Discovery, DNS proof and account unlinking cannot be predicted safely.
|
|
19
|
+
const save = Atom.fn((payload, get) => get.setResult(saveMutation, {
|
|
20
|
+
payload: { ...payload, organizationId },
|
|
21
|
+
reactivityKeys,
|
|
22
|
+
}));
|
|
23
|
+
const verify = Atom.fn((_, get) => get.setResult(verifyMutation, {
|
|
24
|
+
payload: { organizationId },
|
|
25
|
+
reactivityKeys,
|
|
26
|
+
}));
|
|
27
|
+
const remove = Atom.fn((_, get) => get.setResult(deleteMutation, {
|
|
28
|
+
payload: { organizationId },
|
|
29
|
+
reactivityKeys,
|
|
30
|
+
}));
|
|
31
|
+
const enable = Atom.optimisticFn(settings, {
|
|
32
|
+
reducer: (state, enabled) => AsyncResult.map(state, (connection) => connection ? { ...connection, enabled } : null),
|
|
33
|
+
fn: Atom.fn((enabled, get) => get.setResult(enableMutation, {
|
|
34
|
+
payload: { organizationId, enabled },
|
|
35
|
+
reactivityKeys,
|
|
36
|
+
})),
|
|
37
|
+
});
|
|
38
|
+
return { settings, save, verify, remove, enable };
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export declare const organizationSsoMessages: {
|
|
2
|
+
en: {
|
|
3
|
+
organization_security: () => string;
|
|
4
|
+
organization_security_description: () => string;
|
|
5
|
+
sso_settings_title: () => string;
|
|
6
|
+
sso_settings_description: () => string;
|
|
7
|
+
sso_connection_details: () => string;
|
|
8
|
+
sso_callback_step: () => string;
|
|
9
|
+
sso_callback_help: () => string;
|
|
10
|
+
sso_status_enabled: () => string;
|
|
11
|
+
sso_status_disabled: () => string;
|
|
12
|
+
sso_update_help: () => string;
|
|
13
|
+
sso_loading: () => string;
|
|
14
|
+
sso_load_error: () => string;
|
|
15
|
+
sso_issuer: () => string;
|
|
16
|
+
sso_domain: () => string;
|
|
17
|
+
sso_client_id: () => string;
|
|
18
|
+
sso_client_secret: () => string;
|
|
19
|
+
sso_secret_unchanged: () => string;
|
|
20
|
+
sso_save_help: () => string;
|
|
21
|
+
sso_save: () => string;
|
|
22
|
+
sso_callback: () => string;
|
|
23
|
+
sso_domain_verification: () => string;
|
|
24
|
+
sso_dns_help: () => string;
|
|
25
|
+
sso_dns_name: () => string;
|
|
26
|
+
sso_dns_value: () => string;
|
|
27
|
+
sso_verified: () => string;
|
|
28
|
+
sso_unverified: () => string;
|
|
29
|
+
sso_verify: () => string;
|
|
30
|
+
sso_enable: () => string;
|
|
31
|
+
sso_disable: () => string;
|
|
32
|
+
sso_remove: () => string;
|
|
33
|
+
sso_remove_title: () => string;
|
|
34
|
+
sso_remove_warning: () => string;
|
|
35
|
+
sso_remove_confirm: () => string;
|
|
36
|
+
sso_cancel: () => string;
|
|
37
|
+
sso_action_error: () => string;
|
|
38
|
+
};
|
|
39
|
+
fr: {
|
|
40
|
+
organization_security: () => string;
|
|
41
|
+
organization_security_description: () => string;
|
|
42
|
+
sso_settings_title: () => string;
|
|
43
|
+
sso_settings_description: () => string;
|
|
44
|
+
sso_connection_details: () => string;
|
|
45
|
+
sso_callback_step: () => string;
|
|
46
|
+
sso_callback_help: () => string;
|
|
47
|
+
sso_status_enabled: () => string;
|
|
48
|
+
sso_status_disabled: () => string;
|
|
49
|
+
sso_update_help: () => string;
|
|
50
|
+
sso_loading: () => string;
|
|
51
|
+
sso_load_error: () => string;
|
|
52
|
+
sso_issuer: () => string;
|
|
53
|
+
sso_domain: () => string;
|
|
54
|
+
sso_client_id: () => string;
|
|
55
|
+
sso_client_secret: () => string;
|
|
56
|
+
sso_secret_unchanged: () => string;
|
|
57
|
+
sso_save_help: () => string;
|
|
58
|
+
sso_save: () => string;
|
|
59
|
+
sso_callback: () => string;
|
|
60
|
+
sso_domain_verification: () => string;
|
|
61
|
+
sso_dns_help: () => string;
|
|
62
|
+
sso_dns_name: () => string;
|
|
63
|
+
sso_dns_value: () => string;
|
|
64
|
+
sso_verified: () => string;
|
|
65
|
+
sso_unverified: () => string;
|
|
66
|
+
sso_verify: () => string;
|
|
67
|
+
sso_enable: () => string;
|
|
68
|
+
sso_disable: () => string;
|
|
69
|
+
sso_remove: () => string;
|
|
70
|
+
sso_remove_title: () => string;
|
|
71
|
+
sso_remove_warning: () => string;
|
|
72
|
+
sso_remove_confirm: () => string;
|
|
73
|
+
sso_cancel: () => string;
|
|
74
|
+
sso_action_error: () => string;
|
|
75
|
+
};
|
|
76
|
+
};
|