@flow-industries/id 0.22.1 → 0.23.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.
@@ -3,7 +3,7 @@ import type { Chain, Hex, PrepareTransactionRequestParameters, SendTransactionPa
3
3
  import type { SendCallsParameters } from "viem/actions";
4
4
  import type { RawValue } from "../json";
5
5
  import type { AdditionalSession, FlowCredential, FlowUser, WebAuthnSignature } from "./auth";
6
- import type { ConnectCapabilities, ConnectResponse } from "./protocol";
6
+ import type { ConnectCapabilities } from "./protocol";
7
7
  import type { RoomsApi } from "./rooms";
8
8
  export type Address = `0x${string}`;
9
9
  /**
@@ -133,10 +133,9 @@ export type FlowCookieNames = {
133
133
  refresh: string;
134
134
  };
135
135
  export type LoginOptions = {
136
- mode?: "iframe" | "popup";
136
+ returnTo?: string;
137
137
  signUp?: boolean;
138
138
  signIn?: boolean;
139
- signInHeadless?: boolean;
140
139
  };
141
140
  export type Session = {
142
141
  user: FlowUser;
@@ -197,7 +196,7 @@ export type ColorScheme = "light" | "dark" | "light dark";
197
196
  export type ProfilePosition = "top-right" | "top-left" | "bottom-right" | "bottom-left";
198
197
  export type MountProfileOptions = {
199
198
  /**
200
- * Element to mount the pill iframe into. When omitted, a fixed-position
199
+ * Element to mount the native account button into. When omitted, a fixed-position
201
200
  * container is created and anchored via `position` — the path of least
202
201
  * resistance for non-DOM hosts (the Godot canvas overlay).
203
202
  */
@@ -221,12 +220,10 @@ export type MountProfileOptions = {
221
220
  };
222
221
  export type ProfileButtonHandle = {
223
222
  /**
224
- * Recolors the mounted pill (and its profile dialog) in place. A host with a
225
- * theme toggle calls this instead of remounting: rebuilding the iframe would
226
- * reload the widget and flash the pill out of the layout on every toggle.
223
+ * Recolors the mounted account button without remounting it.
227
224
  */
228
225
  setTheme: (theme: ColorScheme) => void;
229
- /** Tears down the iframe, listeners, and any auto-created container. */
226
+ /** Tears down the button, listeners, and any auto-created container. */
230
227
  destroy: () => void;
231
228
  };
232
229
  export type OpenProfileOptions = {
@@ -332,7 +329,8 @@ export type Flow = {
332
329
  * actions on `!isGuest`, not on `isAuthenticated`.
333
330
  */
334
331
  readonly isGuest: boolean;
335
- login(options?: LoginOptions): Promise<Session>;
332
+ login(options?: LoginOptions): Promise<never>;
333
+ openAccount(): boolean;
336
334
  logout(): Promise<void>;
337
335
  restore(): Promise<boolean>;
338
336
  /**
@@ -413,18 +411,6 @@ export type ProfileButtonProps = {
413
411
  /** Color scheme for the widget chrome; defaults to "light dark" (the OS). */
414
412
  theme?: ColorScheme;
415
413
  };
416
- export type RunLoginParams = {
417
- dialog: DialogHost;
418
- store: Store<FlowState>;
419
- options?: LoginOptions;
420
- extraCapabilities?: ConnectCapabilities;
421
- };
422
- export type RunLoginResult = {
423
- session: Session;
424
- refreshToken: string;
425
- webauthn: ConnectResponse["webauthn"];
426
- additionalSessions?: AdditionalSession[];
427
- };
428
414
  export type FinalizeAccessKeyParams = {
429
415
  address: Address;
430
416
  credential: FlowCredential;
@@ -53,6 +53,12 @@ export type SessionRouteSession = {
53
53
  };
54
54
  export type SessionRouteResponse = {
55
55
  state: SessionRouteSession | null;
56
+ loginCompletion?: {
57
+ loginId: string;
58
+ userId: string;
59
+ expires: number;
60
+ webauthn?: import("./auth").WebAuthnSignature;
61
+ };
56
62
  /**
57
63
  * Additional-audience sessions minted by a reconcile request (POST `{ mint }`)
58
64
  * — one per allowed audience the caller asked to provision. The consumer
@@ -5,12 +5,9 @@ flowConnector.type = "flow";
5
5
  function loginOptionsFromCapabilities(capabilities) {
6
6
  const signUp = capabilities?.type === "sign-up" || capabilities?.createAccount;
7
7
  const signIn = capabilities?.type === "sign-in" || capabilities?.signIn;
8
- const headless = !signUp &&
9
- (capabilities?.signInHeadless || capabilities?.type === "sign-in");
10
8
  return {
11
9
  signUp: signUp ? true : undefined,
12
10
  signIn: !signUp && signIn ? true : undefined,
13
- signInHeadless: headless ? true : undefined,
14
11
  };
15
12
  }
16
13
  export function flowConnector(parameters = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flow-industries/id",
3
- "version": "0.22.1",
3
+ "version": "0.23.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -66,9 +66,10 @@
66
66
  "scripts": {
67
67
  "dev": "./dev.sh",
68
68
  "build:dialog": "bunx vite build",
69
+ "build:legacy-dialog": "bunx vite build --config vite.legacy.config.ts",
69
70
  "build:playground": "bunx vite build --config vite.playground.config.ts",
70
71
  "build:landing": "bunx vite build --config vite.landing.config.ts",
71
- "build": "bunx vite build && bunx vite build --config vite.playground.config.ts && bunx vite build --config vite.landing.config.ts",
72
+ "build": "bun run build:legacy-dialog && bunx vite build && bunx vite build --config vite.playground.config.ts && bunx vite build --config vite.landing.config.ts",
72
73
  "build:sdk": "tsc --project tsconfig.sdk.json",
73
74
  "prepublishOnly": "bun run build:sdk",
74
75
  "start": "bun run src/index.ts",
@@ -84,7 +85,7 @@
84
85
  "test:sdk-package": "bash scripts/test-sdk-package.sh",
85
86
  "format": "biome format --write",
86
87
  "check": "biome check --write",
87
- "typecheck": "tsr generate && tsc --noEmit",
88
+ "typecheck": "tsr generate && (cd src/legacy-dialog && bunx tsr generate) && tsc --noEmit && tsc -p tsconfig.legacy.json --noEmit",
88
89
  "contracts:generate": "bun scripts/generate-contracts.ts",
89
90
  "contracts:check": "bun scripts/generate-contracts.ts --check && bun scripts/check-contract-compatibility.ts",
90
91
  "db:check": "bun scripts/db-check.ts",