@zitadel/sdk-react 0.1.0-alpha.0 → 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/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  React components for the Zitadel auth UI, for client-side SPAs.
4
4
 
5
+ ## Requirements
6
+
7
+ TypeScript ≥ 5.0 — the published type definitions re-export with `export type *`, which TypeScript introduced in 5.0.
8
+
5
9
  ## Usage
6
10
 
7
11
  ```tsx
package/dist/index.d.ts CHANGED
@@ -1,5 +1,27 @@
1
- export { ZitadelLogin, ZitadelLogout } from './react.js';
2
- export { ZitadelConfig, ZitadelProject, configureZitadel, getApi, getZitadelConfig } from '@zitadel/api/config';
3
- export { AuthResult, AuthState, NextgenMiddlewareOptions, NextgenSession, UnauthState } from '@zitadel/sdk-core/types';
4
- import '@lit/react';
5
- import '@zitadel/components';
1
+ import { configureZitadel, getApi, getZitadelConfig, ZitadelConfig, ZitadelProject } from '@zitadel/api/config';
2
+ import { ZitadelLogin as ZitadelLoginElement, ZitadelLogout as ZitadelLogoutElement } from '@zitadel/components';
3
+ import * as React from "react";
4
+ export { configureZitadel, getApi, getZitadelConfig };
5
+ export type { ZitadelConfig, ZitadelProject };
6
+ export * from './types';
7
+ /**
8
+ * React component wrapping the `<zitadel-login>` web component. Binds the
9
+ * `ZitadelProject` handle as a DOM property (or the discrete project id /
10
+ * proxy path as attributes) and forwards the widget's `zitadel-*` events as
11
+ * optional callbacks.
12
+ *
13
+ * A forwarded `ref` resolves to the underlying `<zitadel-login>` DOM element,
14
+ * so consumers can imperatively access the upgraded web component.
15
+ */
16
+ export declare const ZitadelLogin: React.ForwardRefExoticComponent<import('@zitadel/sdk-core/types').ZitadelLoginConfig & import('@zitadel/sdk-core/types').ZitadelLoginHandlers & React.RefAttributes<ZitadelLoginElement>>;
17
+ /**
18
+ * React component wrapping the `<zitadel-logout>` web component. Binds the
19
+ * `ZitadelProject` handle as a DOM property (or the discrete project id /
20
+ * proxy path as attributes) and forwards the widget's `zitadel-signout` event
21
+ * as an optional callback.
22
+ *
23
+ * A forwarded `ref` resolves to the underlying `<zitadel-logout>` DOM element,
24
+ * so consumers can imperatively access the upgraded web component.
25
+ */
26
+ export declare const ZitadelLogout: React.ForwardRefExoticComponent<import('@zitadel/sdk-core/types').ZitadelLogoutConfig & import('@zitadel/sdk-core/types').ZitadelLogoutHandlers & React.RefAttributes<ZitadelLogoutElement>>;
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,MAAM,EACN,gBAAgB,EAChB,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,YAAY,IAAI,mBAAmB,EACnC,aAAa,IAAI,oBAAoB,EACtC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;AACtD,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC;AAC9C,cAAc,SAAS,CAAC;AAiDxB;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,2LAiBxB,CAAC;AAIF;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,8LAUzB,CAAC"}
package/dist/index.js CHANGED
@@ -1,19 +1,59 @@
1
- import {
2
- ZitadelLogin,
3
- ZitadelLogout
4
- } from "./chunk-QJALWXNY.js";
5
- import "./chunk-6F4PWJZI.js";
6
-
7
- // src/index.ts
8
- import {
9
- configureZitadel,
10
- getApi,
11
- getZitadelConfig
12
- } from "@zitadel/api/config";
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { createComponent as r } from "@lit/react";
3
+ import { configureZitadel as N, getApi as x, getZitadelConfig as E } from "@zitadel/api/config";
4
+ import { ZitadelLogin as s, ZitadelLogout as p } from "@zitadel/components";
5
+ import * as l from "react";
6
+ const f = r({
7
+ react: l,
8
+ tagName: "zitadel-login",
9
+ elementClass: s,
10
+ events: {
11
+ onZitadelFlowStep: "zitadel-flow-step",
12
+ onZitadelFlowInput: "zitadel-flow-input",
13
+ onZitadelFlowComplete: "zitadel-flow-complete",
14
+ onZitadelFlowError: "zitadel-flow-error"
15
+ }
16
+ }), u = r({
17
+ react: l,
18
+ tagName: "zitadel-logout",
19
+ elementClass: p,
20
+ events: {
21
+ onZitadelSignout: "zitadel-signout"
22
+ }
23
+ }), c = l.forwardRef(
24
+ function({ purpose: e, onFlowStep: o, onFlowInput: i, onFlowComplete: a, onFlowError: d, ...g }, m) {
25
+ return /* @__PURE__ */ n(
26
+ f,
27
+ {
28
+ ...g,
29
+ ref: m,
30
+ purpose: e ?? "login",
31
+ onZitadelFlowStep: o && ((t) => o(t.detail)),
32
+ onZitadelFlowInput: i && ((t) => i(t.detail)),
33
+ onZitadelFlowComplete: a && ((t) => a(t.detail)),
34
+ onZitadelFlowError: d && ((t) => d(t.detail))
35
+ }
36
+ );
37
+ }
38
+ );
39
+ c.displayName = "ZitadelLogin";
40
+ const L = l.forwardRef(
41
+ function({ onSignout: e, ...o }, i) {
42
+ return /* @__PURE__ */ n(
43
+ u,
44
+ {
45
+ ...o,
46
+ ref: i,
47
+ onZitadelSignout: e && ((a) => e(a.detail))
48
+ }
49
+ );
50
+ }
51
+ );
52
+ L.displayName = "ZitadelLogout";
13
53
  export {
14
- ZitadelLogin,
15
- ZitadelLogout,
16
- configureZitadel,
17
- getApi,
18
- getZitadelConfig
54
+ c as ZitadelLogin,
55
+ L as ZitadelLogout,
56
+ N as configureZitadel,
57
+ x as getApi,
58
+ E as getZitadelConfig
19
59
  };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=test-setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-setup.d.ts","sourceRoot":"","sources":["../src/test-setup.ts"],"names":[],"mappings":""}
package/dist/types.d.ts CHANGED
@@ -1 +1,10 @@
1
- export { AuthResult, AuthState, NextgenMiddlewareOptions, NextgenSession, UnauthState } from '@zitadel/sdk-core/types';
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 CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "@zitadel/sdk-react",
3
- "version": "0.1.0-alpha.0",
3
+ "version": "0.1.0-alpha.11",
4
4
  "description": "React components for the Zitadel auth UI (client-side SPA).",
5
5
  "homepage": "https://github.com/zitadel/nextgen/tree/main/packages/sdk-react#readme",
6
6
  "bugs": {
7
7
  "url": "https://github.com/zitadel/nextgen/issues"
8
8
  },
9
- "license": "MIT",
10
9
  "repository": {
11
10
  "type": "git",
12
11
  "url": "git+https://github.com/zitadel/nextgen.git",
13
12
  "directory": "packages/sdk-react"
14
13
  },
14
+ "license": "MIT",
15
+ "type": "module",
15
16
  "files": [
16
17
  "dist"
17
18
  ],
18
- "type": "module",
19
19
  "exports": {
20
20
  ".": {
21
21
  "types": "./dist/index.d.ts",
@@ -27,9 +27,9 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@lit/react": "^1.0.8",
30
- "@zitadel/api": "0.1.0-alpha.0",
31
- "@zitadel/components": "0.1.0-alpha.0",
32
- "@zitadel/sdk-core": "0.1.0-alpha.0"
30
+ "@zitadel/sdk-core": "0.1.0-alpha.11",
31
+ "@zitadel/components": "0.1.0-alpha.11",
32
+ "@zitadel/api": "0.1.0-alpha.11"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "react": ">=18",
@@ -37,33 +37,34 @@
37
37
  },
38
38
  "devDependencies": {
39
39
  "@eslint/js": "^9.0.0",
40
+ "@eslint/json": "^0.11.0",
41
+ "@eslint/markdown": "^6.0.0",
40
42
  "@testing-library/react": "^16.3.2",
41
43
  "@types/react": "^19.2.14",
42
44
  "eslint": "^9.0.0",
43
- "jsdom": "^29.0.2",
44
- "react": "^19.2.5",
45
- "react-dom": "^19.2.5",
46
- "tsup": "^8.3.5",
47
- "typescript": "^5.7.3",
48
- "vitest": "^3.0.0",
49
- "@eslint/json": "^0.11.0",
50
- "@eslint/markdown": "^6.0.0",
51
45
  "eslint-config-prettier": "^10.0.0",
52
46
  "eslint-import-resolver-typescript": "^3.7.0",
53
47
  "eslint-plugin-import": "^2.31.0",
48
+ "eslint-plugin-jsx-a11y": "^6.10.0",
54
49
  "eslint-plugin-perfectionist": "^4.0.0",
55
50
  "eslint-plugin-prettier": "^5.0.0",
56
- "prettier": "^3.0.0",
57
- "typescript-eslint": "^8.0.0",
58
- "eslint-plugin-jsx-a11y": "^6.10.0",
59
51
  "eslint-plugin-react": "^7.37.0",
60
52
  "eslint-plugin-react-hooks": "^5.0.0",
61
- "eslint-plugin-testing-library": "^7.0.0"
53
+ "eslint-plugin-testing-library": "^7.0.0",
54
+ "jsdom": "^29.0.2",
55
+ "prettier": "^3.0.0",
56
+ "react": "^19.2.5",
57
+ "react-dom": "^19.2.5",
58
+ "typescript": "^6.0.3",
59
+ "typescript-eslint": "^8.0.0",
60
+ "vite": "^7.3.5",
61
+ "vite-plugin-dts": "^4.5.0",
62
+ "vitest": "^3.0.0"
62
63
  },
63
64
  "scripts": {
64
- "build": "tsup src/index.ts src/react.tsx src/types.ts --format esm --dts --clean --tsconfig tsconfig.json --external react react-dom",
65
+ "build": "vite build",
65
66
  "typecheck": "tsc --noEmit -p tsconfig.json",
66
- "test": "vitest run --passWithNoTests",
67
+ "test": "vitest run",
67
68
  "lint": "eslint ."
68
69
  }
69
70
  }
File without changes
@@ -1,22 +0,0 @@
1
- // src/react.tsx
2
- import { createComponent } from "@lit/react";
3
- import {
4
- ZitadelLogin as ZitadelLoginElement,
5
- ZitadelLogout as ZitadelLogoutElement
6
- } from "@zitadel/components";
7
- import * as React from "react";
8
- var ZitadelLogin = createComponent({
9
- react: React,
10
- tagName: "zitadel-login",
11
- elementClass: ZitadelLoginElement
12
- });
13
- var ZitadelLogout = createComponent({
14
- react: React,
15
- tagName: "zitadel-logout",
16
- elementClass: ZitadelLogoutElement
17
- });
18
-
19
- export {
20
- ZitadelLogin,
21
- ZitadelLogout
22
- };
package/dist/react.d.ts DELETED
@@ -1,32 +0,0 @@
1
- import * as _lit_react from '@lit/react';
2
- import { ZitadelLogin as ZitadelLogin$1, ZitadelLogout as ZitadelLogout$1 } from '@zitadel/components';
3
- import '@zitadel/api/config';
4
- import '@zitadel/sdk-core/types';
5
-
6
- /**
7
- * React components for the Zitadel auth widgets.
8
- *
9
- * These wrap the framework-agnostic Lit web components from
10
- * `@zitadel/components` with `@lit/react`'s `createComponent`, so they are real
11
- * React components: typed props, refs, and events, with the SDK `project`
12
- * handle bound as a DOM *property* (not an attribute) — which is what the
13
- * elements read at startup.
14
- *
15
- * In a client-side SPA, build the handle with `configureZitadel(...)` and pass
16
- * it as the `project` prop. Because the SPA renders after configuration, the
17
- * prop is present when the element upgrades:
18
- *
19
- * ```tsx
20
- * import { ZitadelLogin, configureZitadel } from "@zitadel/sdk-react";
21
- *
22
- * const project = configureZitadel({ projectId: "…", proxyPath: "/__nextgen" });
23
- *
24
- * export function LoginPage() {
25
- * return <ZitadelLogin project={project} purpose="login" postSignInUrl="/" />;
26
- * }
27
- * ```
28
- */
29
- declare const ZitadelLogin: _lit_react.ReactWebComponent<ZitadelLogin$1, {}>;
30
- declare const ZitadelLogout: _lit_react.ReactWebComponent<ZitadelLogout$1, {}>;
31
-
32
- export { ZitadelLogin, ZitadelLogout };
package/dist/react.js DELETED
@@ -1,8 +0,0 @@
1
- import {
2
- ZitadelLogin,
3
- ZitadelLogout
4
- } from "./chunk-QJALWXNY.js";
5
- export {
6
- ZitadelLogin,
7
- ZitadelLogout
8
- };
package/dist/types.js DELETED
@@ -1 +0,0 @@
1
- import "./chunk-6F4PWJZI.js";