@zitadel/sdk-solid 0.1.0-alpha.11
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/LICENSE +21 -0
- package/README.md +54 -0
- package/dist/index.d.ts +58 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/test-setup.d.ts +2 -0
- package/dist/test-setup.d.ts.map +1 -0
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +65 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ZITADEL
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# @zitadel/sdk-solid
|
|
2
|
+
|
|
3
|
+
Solid components for the Zitadel auth UI, for client-side SPAs (Vite, etc.).
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
TypeScript ≥ 5.0 — the published type definitions re-export with `export type *`, which TypeScript introduced in 5.0.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { ZitadelLogin, configureZitadel } from '@zitadel/sdk-solid';
|
|
13
|
+
|
|
14
|
+
const project = configureZitadel({
|
|
15
|
+
projectId: import.meta.env.VITE_ZITADEL_PROJECT_ID,
|
|
16
|
+
proxyPath: '/__nextgen',
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export default function LoginPage() {
|
|
20
|
+
return <ZitadelLogin project={project} purpose="login" postSignInUrl="/" />;
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`<ZitadelLogout project={project} postSignOutUrl="/login" />` works the same way.
|
|
25
|
+
|
|
26
|
+
The widget's flow events are also surfaced as optional callbacks:
|
|
27
|
+
`onFlowStep`, `onFlowInput`, `onFlowComplete`, and `onFlowError`.
|
|
28
|
+
|
|
29
|
+
## Proxying to the backend (deployment)
|
|
30
|
+
|
|
31
|
+
The widgets call `${proxyPath}/…` same-origin (default `/__nextgen`). A SPA has no
|
|
32
|
+
server, so on Vercel use `@zitadel/edge-proxy` to forward those calls:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
// api/__nextgen/[...path].ts (Vercel Edge Function)
|
|
36
|
+
import { handleProxy, resolveConfig } from '@zitadel/edge-proxy';
|
|
37
|
+
export const config = { runtime: 'edge' };
|
|
38
|
+
const proxyConfig = resolveConfig({
|
|
39
|
+
apiUrl: process.env.NEXTGEN_API_URL ?? '',
|
|
40
|
+
});
|
|
41
|
+
export default (req: Request) => handleProxy(req, proxyConfig);
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
// vercel.json
|
|
46
|
+
{
|
|
47
|
+
"rewrites": [
|
|
48
|
+
{ "source": "/__nextgen/(.*)", "destination": "/api/__nextgen/$1" }
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
For local development you can skip the proxy and point `proxyPath` straight at the
|
|
54
|
+
backend (cross-origin), e.g. `proxyPath: "http://localhost:4000"`.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ZitadelLogin as ZitadelLoginElement, ZitadelLogout as ZitadelLogoutElement } from '@zitadel/components';
|
|
2
|
+
import { JSX } from 'solid-js';
|
|
3
|
+
import { configureZitadel, getApi, getZitadelConfig, ZitadelConfig, ZitadelProject } from '@zitadel/api/config';
|
|
4
|
+
import { ZitadelFlowCompleteDetail, ZitadelFlowErrorDetail, ZitadelFlowInputDetail, ZitadelFlowStepDetail, ZitadelLoginProps, ZitadelLogoutProps, ZitadelSignoutDetail } from './types';
|
|
5
|
+
declare module "solid-js" {
|
|
6
|
+
namespace JSX {
|
|
7
|
+
interface IntrinsicElements {
|
|
8
|
+
"zitadel-login": Omit<HTMLAttributes<HTMLElement>, "ref"> & {
|
|
9
|
+
ref?: ZitadelLoginElement | ((el: ZitadelLoginElement) => void);
|
|
10
|
+
"prop:project"?: ZitadelProject;
|
|
11
|
+
"project-id"?: string;
|
|
12
|
+
"proxy-path"?: string;
|
|
13
|
+
purpose?: string;
|
|
14
|
+
"post-sign-in-url"?: string;
|
|
15
|
+
"on:zitadel-flow-step"?: (event: CustomEvent<ZitadelFlowStepDetail>) => void;
|
|
16
|
+
"on:zitadel-flow-input"?: (event: CustomEvent<ZitadelFlowInputDetail>) => void;
|
|
17
|
+
"on:zitadel-flow-complete"?: (event: CustomEvent<ZitadelFlowCompleteDetail>) => void;
|
|
18
|
+
"on:zitadel-flow-error"?: (event: CustomEvent<ZitadelFlowErrorDetail>) => void;
|
|
19
|
+
};
|
|
20
|
+
"zitadel-logout": Omit<HTMLAttributes<HTMLElement>, "ref"> & {
|
|
21
|
+
ref?: ZitadelLogoutElement | ((el: ZitadelLogoutElement) => void);
|
|
22
|
+
"prop:project"?: ZitadelProject;
|
|
23
|
+
"project-id"?: string;
|
|
24
|
+
"proxy-path"?: string;
|
|
25
|
+
"post-sign-out-url"?: string;
|
|
26
|
+
"on:zitadel-signout"?: (event: CustomEvent<ZitadelSignoutDetail>) => void;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export { configureZitadel, getApi, getZitadelConfig };
|
|
32
|
+
export type { ZitadelConfig, ZitadelProject };
|
|
33
|
+
export * from './types';
|
|
34
|
+
/**
|
|
35
|
+
* Solid component wrapping the `<zitadel-login>` web component. Binds the
|
|
36
|
+
* {@link ZitadelProject} handle as a DOM property (or the discrete project id /
|
|
37
|
+
* proxy path as attributes) and forwards the widget's `zitadel-*` events as
|
|
38
|
+
* optional callbacks.
|
|
39
|
+
*
|
|
40
|
+
* A forwarded `ref` resolves to the underlying `<zitadel-login>` DOM element,
|
|
41
|
+
* so consumers can imperatively access the upgraded web component.
|
|
42
|
+
*/
|
|
43
|
+
export declare function ZitadelLogin(props: ZitadelLoginProps & {
|
|
44
|
+
ref?: ZitadelLoginElement | ((el: ZitadelLoginElement) => void);
|
|
45
|
+
}): JSX.Element;
|
|
46
|
+
/**
|
|
47
|
+
* Solid component wrapping the `<zitadel-logout>` web component. Binds the
|
|
48
|
+
* {@link ZitadelProject} handle as a DOM property (or the discrete project id /
|
|
49
|
+
* proxy path as attributes) and forwards the widget's `zitadel-signout` event
|
|
50
|
+
* as an optional callback.
|
|
51
|
+
*
|
|
52
|
+
* A forwarded `ref` resolves to the underlying `<zitadel-logout>` DOM element,
|
|
53
|
+
* so consumers can imperatively access the upgraded web component.
|
|
54
|
+
*/
|
|
55
|
+
export declare function ZitadelLogout(props: ZitadelLogoutProps & {
|
|
56
|
+
ref?: ZitadelLogoutElement | ((el: ZitadelLogoutElement) => void);
|
|
57
|
+
}): JSX.Element;
|
|
58
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,IAAI,mBAAmB,EACnC,aAAa,IAAI,oBAAoB,EACtC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC,OAAO,EACL,gBAAgB,EAChB,MAAM,EACN,gBAAgB,EAChB,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EACV,yBAAyB,EACzB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAEjB,OAAO,QAAQ,UAAU,CAAC;IAExB,UAAU,GAAG,CAAC;QACZ,UAAU,iBAAiB;YACzB,eAAe,EAAE,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,GAAG;gBAC1D,GAAG,CAAC,EAAE,mBAAmB,GAAG,CAAC,CAAC,EAAE,EAAE,mBAAmB,KAAK,IAAI,CAAC,CAAC;gBAChE,cAAc,CAAC,EAAE,cAAc,CAAC;gBAChC,YAAY,CAAC,EAAE,MAAM,CAAC;gBACtB,YAAY,CAAC,EAAE,MAAM,CAAC;gBACtB,OAAO,CAAC,EAAE,MAAM,CAAC;gBACjB,kBAAkB,CAAC,EAAE,MAAM,CAAC;gBAC5B,sBAAsB,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,qBAAqB,CAAC,KAAK,IAAI,CAAC;gBAC7E,uBAAuB,CAAC,EAAE,CAAC,KAAK,EAAE,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|
package/dist/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { addEventListener as d, use as v, getOwner as u, effect as g, template as c } from "solid-js/web";
|
|
2
|
+
import "@zitadel/components";
|
|
3
|
+
import { configureZitadel as h, getApi as F, getZitadelConfig as P } from "@zitadel/api/config";
|
|
4
|
+
var w = /* @__PURE__ */ c("<zitadel-login>", !0, !1, !1), m = /* @__PURE__ */ c("<zitadel-logout>", !0, !1, !1);
|
|
5
|
+
function I(o) {
|
|
6
|
+
return (() => {
|
|
7
|
+
var t = w();
|
|
8
|
+
d(t, "zitadel-flow-error", (e) => o.onFlowError?.(e.detail)), d(t, "zitadel-flow-complete", (e) => o.onFlowComplete?.(e.detail)), d(t, "zitadel-flow-input", (e) => o.onFlowInput?.(e.detail)), d(t, "zitadel-flow-step", (e) => o.onFlowStep?.(e.detail));
|
|
9
|
+
var i = o.ref;
|
|
10
|
+
return typeof i == "function" ? v(i, t) : o.ref = t, t._$owner = u(), g((e) => {
|
|
11
|
+
var r = o.project, l = o.projectId, a = o.proxyPath, n = o.purpose ?? "login", f = o.postSignInUrl;
|
|
12
|
+
return r !== e.e && (t.project = e.e = r), l !== e.t && (t.projectId = e.t = l), a !== e.a && (t.proxyPath = e.a = a), n !== e.o && (t.purpose = e.o = n), f !== e.i && (t.postSignInUrl = e.i = f), e;
|
|
13
|
+
}, {
|
|
14
|
+
e: void 0,
|
|
15
|
+
t: void 0,
|
|
16
|
+
a: void 0,
|
|
17
|
+
o: void 0,
|
|
18
|
+
i: void 0
|
|
19
|
+
}), t;
|
|
20
|
+
})();
|
|
21
|
+
}
|
|
22
|
+
function x(o) {
|
|
23
|
+
return (() => {
|
|
24
|
+
var t = m();
|
|
25
|
+
d(t, "zitadel-signout", (e) => o.onSignout?.(e.detail));
|
|
26
|
+
var i = o.ref;
|
|
27
|
+
return typeof i == "function" ? v(i, t) : o.ref = t, t._$owner = u(), g((e) => {
|
|
28
|
+
var r = o.project, l = o.projectId, a = o.proxyPath, n = o.postSignOutUrl;
|
|
29
|
+
return r !== e.e && (t.project = e.e = r), l !== e.t && (t.projectId = e.t = l), a !== e.a && (t.proxyPath = e.a = a), n !== e.o && (t.postSignOutUrl = e.o = n), e;
|
|
30
|
+
}, {
|
|
31
|
+
e: void 0,
|
|
32
|
+
t: void 0,
|
|
33
|
+
a: void 0,
|
|
34
|
+
o: void 0
|
|
35
|
+
}), t;
|
|
36
|
+
})();
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
I as ZitadelLogin,
|
|
40
|
+
x as ZitadelLogout,
|
|
41
|
+
h as configureZitadel,
|
|
42
|
+
F as getApi,
|
|
43
|
+
P as getZitadelConfig
|
|
44
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-setup.d.ts","sourceRoot":"","sources":["../src/test-setup.ts"],"names":[],"mappings":""}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-exports the shared SPA widget types from `@zitadel/sdk-core`.
|
|
3
|
+
*
|
|
4
|
+
* `export type *` keeps this surface in lockstep with the core SPA contract: a
|
|
5
|
+
* type added there is re-exported here automatically, and none can be dropped by
|
|
6
|
+
* hand. The server-middleware types live in a separate core module and stay out
|
|
7
|
+
* of the browser SDK surface.
|
|
8
|
+
*/
|
|
9
|
+
export type * from '@zitadel/sdk-core/types';
|
|
10
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,mBAAmB,yBAAyB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zitadel/sdk-solid",
|
|
3
|
+
"version": "0.1.0-alpha.11",
|
|
4
|
+
"description": "Solid components for the Zitadel auth UI (client-side SPA).",
|
|
5
|
+
"homepage": "https://github.com/zitadel/nextgen/tree/main/packages/sdk-solid#readme",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/zitadel/nextgen/issues"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/zitadel/nextgen.git",
|
|
12
|
+
"directory": "packages/sdk-solid"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"import": "./dist/index.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@zitadel/api": "0.1.0-alpha.11",
|
|
30
|
+
"@zitadel/components": "0.1.0-alpha.11",
|
|
31
|
+
"@zitadel/sdk-core": "0.1.0-alpha.11"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"solid-js": ">=1.6"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@eslint/js": "^9.0.0",
|
|
38
|
+
"@eslint/json": "^0.11.0",
|
|
39
|
+
"@eslint/markdown": "^6.0.0",
|
|
40
|
+
"@solidjs/testing-library": "^0.8.10",
|
|
41
|
+
"@testing-library/jest-dom": "^6.0.0",
|
|
42
|
+
"eslint": "^9.0.0",
|
|
43
|
+
"eslint-config-prettier": "^10.0.0",
|
|
44
|
+
"eslint-import-resolver-typescript": "^3.7.0",
|
|
45
|
+
"eslint-plugin-import": "^2.31.0",
|
|
46
|
+
"eslint-plugin-perfectionist": "^4.0.0",
|
|
47
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
48
|
+
"eslint-plugin-solid": "^0.14.5",
|
|
49
|
+
"jsdom": "^29.0.2",
|
|
50
|
+
"prettier": "^3.0.0",
|
|
51
|
+
"solid-js": "^1.9.12",
|
|
52
|
+
"typescript": "^6.0.3",
|
|
53
|
+
"typescript-eslint": "^8.0.0",
|
|
54
|
+
"vite": "^7.3.5",
|
|
55
|
+
"vite-plugin-dts": "^4.5.0",
|
|
56
|
+
"vite-plugin-solid": "^2.11.0",
|
|
57
|
+
"vitest": "^3.0.0"
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build": "vite build",
|
|
61
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
62
|
+
"test": "vitest run",
|
|
63
|
+
"lint": "eslint ."
|
|
64
|
+
}
|
|
65
|
+
}
|