@yackey-labs/yauth-ui-solidjs 0.12.2 → 0.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1990 -404
- package/package.json +3 -3
- package/src/components/audit-destination-create.tsx +410 -0
- package/src/components/audit-destination-list.test.tsx +87 -0
- package/src/components/audit-destination-list.tsx +134 -0
- package/src/components/domain-claim.tsx +121 -0
- package/src/components/domain-list.tsx +94 -0
- package/src/components/domain-verify-step.tsx +81 -0
- package/src/components/invitation-accept.tsx +82 -0
- package/src/components/invite-form.tsx +108 -0
- package/src/components/member-list.tsx +214 -0
- package/src/components/organization-card.tsx +45 -0
- package/src/components/organization-create.tsx +147 -0
- package/src/components/organization-detail.tsx +68 -0
- package/src/components/organization-list.tsx +54 -0
- package/src/components/organization-switcher.tsx +139 -0
- package/src/components/role-selector.tsx +32 -0
- package/src/components/saml-connection-form.tsx +348 -0
- package/src/components/saml-login-button.tsx +53 -0
- package/src/components/scim-settings-panel.tsx +191 -0
- package/src/components/sso-connection-form.tsx +265 -0
- package/src/components/sso-connection-list.tsx +158 -0
- package/src/components/sso-login-button.tsx +46 -0
- package/src/components/transfer-ownership.tsx +122 -0
- package/src/hooks/create-active-org.ts +98 -0
- package/src/hooks/create-audit-destinations.ts +179 -0
- package/src/hooks/create-organizations.ts +495 -0
- package/src/hooks/create-sso-connections.ts +132 -0
- package/src/index.ts +43 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CreateSsoConnectionRequest,
|
|
3
|
+
SsoConnectionResponse,
|
|
4
|
+
SsoConnectionTestResponse,
|
|
5
|
+
UpdateSsoConnectionRequest,
|
|
6
|
+
} from "@yackey-labs/yauth-client";
|
|
7
|
+
import { type Accessor, createEffect, createSignal } from "solid-js";
|
|
8
|
+
import { useYAuth } from "../provider";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Headless hook for SSO OIDC connection management (issue #93, Phase B).
|
|
12
|
+
*
|
|
13
|
+
* Mirrors `useSsoConnections` from the Vue package. Pass an `orgId`
|
|
14
|
+
* accessor; the hook auto-refetches on mount and whenever the
|
|
15
|
+
* accessor's value changes.
|
|
16
|
+
*/
|
|
17
|
+
export function createSsoConnections(orgId: Accessor<string | null | undefined>) {
|
|
18
|
+
const { client } = useYAuth();
|
|
19
|
+
const [connections, setConnections] = createSignal<SsoConnectionResponse[]>([]);
|
|
20
|
+
const [loading, setLoading] = createSignal(false);
|
|
21
|
+
const [error, setError] = createSignal<string | null>(null);
|
|
22
|
+
|
|
23
|
+
const refetch = async () => {
|
|
24
|
+
const id = orgId();
|
|
25
|
+
if (!id || !client?.organizations) {
|
|
26
|
+
setConnections([]);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
setLoading(true);
|
|
30
|
+
setError(null);
|
|
31
|
+
try {
|
|
32
|
+
const rows = await client.organizations.listSsoConnections(id);
|
|
33
|
+
setConnections(rows);
|
|
34
|
+
} catch (e) {
|
|
35
|
+
setError(e instanceof Error ? e.message : "failed to load connections");
|
|
36
|
+
setConnections([]);
|
|
37
|
+
} finally {
|
|
38
|
+
setLoading(false);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
createEffect(() => {
|
|
43
|
+
void orgId();
|
|
44
|
+
void refetch();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const create = async (
|
|
48
|
+
input: CreateSsoConnectionRequest,
|
|
49
|
+
): Promise<SsoConnectionResponse | null> => {
|
|
50
|
+
const id = orgId();
|
|
51
|
+
if (!id || !client?.organizations) return null;
|
|
52
|
+
setError(null);
|
|
53
|
+
try {
|
|
54
|
+
const created = await client.organizations.createSsoConnection(id, input);
|
|
55
|
+
setConnections((prev) => [...prev, created]);
|
|
56
|
+
return created;
|
|
57
|
+
} catch (e) {
|
|
58
|
+
setError(e instanceof Error ? e.message : "create failed");
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const update = async (
|
|
64
|
+
connectionId: string,
|
|
65
|
+
changes: UpdateSsoConnectionRequest,
|
|
66
|
+
): Promise<SsoConnectionResponse | null> => {
|
|
67
|
+
const id = orgId();
|
|
68
|
+
if (!id || !client?.organizations) return null;
|
|
69
|
+
setError(null);
|
|
70
|
+
try {
|
|
71
|
+
const updated = await client.organizations.updateSsoConnection(
|
|
72
|
+
id,
|
|
73
|
+
connectionId,
|
|
74
|
+
changes,
|
|
75
|
+
);
|
|
76
|
+
setConnections((prev) => prev.map((c) => (c.id === updated.id ? updated : c)));
|
|
77
|
+
return updated;
|
|
78
|
+
} catch (e) {
|
|
79
|
+
setError(e instanceof Error ? e.message : "update failed");
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const disable = (connectionId: string) =>
|
|
85
|
+
update(connectionId, { status: "disabled" });
|
|
86
|
+
const enable = (connectionId: string) =>
|
|
87
|
+
update(connectionId, { status: "active" });
|
|
88
|
+
|
|
89
|
+
const remove = async (connectionId: string): Promise<boolean> => {
|
|
90
|
+
const id = orgId();
|
|
91
|
+
if (!id || !client?.organizations) return false;
|
|
92
|
+
setError(null);
|
|
93
|
+
try {
|
|
94
|
+
await client.organizations.deleteSsoConnection(id, connectionId);
|
|
95
|
+
setConnections((prev) => prev.filter((c) => c.id !== connectionId));
|
|
96
|
+
return true;
|
|
97
|
+
} catch (e) {
|
|
98
|
+
setError(e instanceof Error ? e.message : "delete failed");
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const test = async (
|
|
104
|
+
connectionId: string,
|
|
105
|
+
): Promise<SsoConnectionTestResponse | null> => {
|
|
106
|
+
const id = orgId();
|
|
107
|
+
if (!id || !client?.organizations) return null;
|
|
108
|
+
setError(null);
|
|
109
|
+
try {
|
|
110
|
+
return await client.organizations.testSsoConnection(id, connectionId);
|
|
111
|
+
} catch (e) {
|
|
112
|
+
setError(e instanceof Error ? e.message : "test failed");
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
connections,
|
|
119
|
+
loading,
|
|
120
|
+
error,
|
|
121
|
+
refetch,
|
|
122
|
+
create,
|
|
123
|
+
update,
|
|
124
|
+
disable,
|
|
125
|
+
enable,
|
|
126
|
+
remove,
|
|
127
|
+
test,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Build the user-facing SSO login URL via
|
|
132
|
+
// `useYAuth().client.sso.loginUrl({ org, domain, redirectTo })`.
|
package/src/index.ts
CHANGED
|
@@ -1,15 +1,58 @@
|
|
|
1
|
+
export { AuditDestinationCreate } from "./components/audit-destination-create";
|
|
2
|
+
export { AuditDestinationList } from "./components/audit-destination-list";
|
|
1
3
|
export { ChangePasswordForm } from "./components/change-password-form";
|
|
2
4
|
export { ConsentScreen } from "./components/consent-screen";
|
|
5
|
+
export { DomainClaim } from "./components/domain-claim";
|
|
6
|
+
export { DomainList } from "./components/domain-list";
|
|
7
|
+
export { DomainVerifyStep } from "./components/domain-verify-step";
|
|
3
8
|
export { ForgotPasswordForm } from "./components/forgot-password-form";
|
|
9
|
+
export { InvitationAccept } from "./components/invitation-accept";
|
|
10
|
+
export { InviteForm } from "./components/invite-form";
|
|
4
11
|
export { LoginForm } from "./components/login-form";
|
|
5
12
|
export { MagicLinkForm } from "./components/magic-link-form";
|
|
13
|
+
export { MemberList } from "./components/member-list";
|
|
6
14
|
export { MfaChallenge } from "./components/mfa-challenge";
|
|
7
15
|
export { MfaSetup } from "./components/mfa-setup";
|
|
8
16
|
export { OAuthButtons } from "./components/oauth-buttons";
|
|
17
|
+
export { OrganizationCard } from "./components/organization-card";
|
|
18
|
+
export { OrganizationCreate } from "./components/organization-create";
|
|
19
|
+
export { OrganizationDetail } from "./components/organization-detail";
|
|
20
|
+
export { OrganizationList } from "./components/organization-list";
|
|
21
|
+
export { OrganizationSwitcher } from "./components/organization-switcher";
|
|
9
22
|
export { PasskeyButton } from "./components/passkey-button";
|
|
10
23
|
export { ProfileSettings } from "./components/profile-settings";
|
|
11
24
|
export { RegisterForm } from "./components/register-form";
|
|
12
25
|
export { ResetPasswordForm } from "./components/reset-password-form";
|
|
26
|
+
export { RoleSelector } from "./components/role-selector";
|
|
27
|
+
export { SamlConnectionForm } from "./components/saml-connection-form";
|
|
28
|
+
export { SamlLoginButton } from "./components/saml-login-button";
|
|
29
|
+
export { ScimSettingsPanel } from "./components/scim-settings-panel";
|
|
30
|
+
export { SsoConnectionForm } from "./components/sso-connection-form";
|
|
31
|
+
export { SsoConnectionList } from "./components/sso-connection-list";
|
|
32
|
+
export { SsoLoginButton } from "./components/sso-login-button";
|
|
33
|
+
export { TransferOwnership } from "./components/transfer-ownership";
|
|
13
34
|
export { VerifyEmail } from "./components/verify-email";
|
|
35
|
+
export { createActiveOrg } from "./hooks/create-active-org";
|
|
36
|
+
export {
|
|
37
|
+
type AuditDestination,
|
|
38
|
+
type AuditDestinationKindTag,
|
|
39
|
+
createAuditDestinations,
|
|
40
|
+
type CreateAuditDestinationsOptions,
|
|
41
|
+
type CreateDestinationInput,
|
|
42
|
+
type OutboxEntry,
|
|
43
|
+
} from "./hooks/create-audit-destinations";
|
|
44
|
+
export {
|
|
45
|
+
type BuiltinRole,
|
|
46
|
+
createDomains,
|
|
47
|
+
createInvitation,
|
|
48
|
+
createMembers,
|
|
49
|
+
createOrganization,
|
|
50
|
+
createOrganizations,
|
|
51
|
+
createOrgPermissions,
|
|
52
|
+
createOrgRoles,
|
|
53
|
+
ROLES,
|
|
54
|
+
slugify,
|
|
55
|
+
} from "./hooks/create-organizations";
|
|
56
|
+
export { createSsoConnections } from "./hooks/create-sso-connections";
|
|
14
57
|
export type { YAuthClient } from "./provider";
|
|
15
58
|
export { useYAuth, YAuthProvider } from "./provider";
|