@ikonai/sdk 1.0.44 → 1.0.45

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.
@@ -0,0 +1,4 @@
1
+ export { getLoginPromptState, setLoginPromptRequired, clearLoginPrompt, subscribe, setLoginPendingCall, consumeLoginPendingCall, PENDING_CALL_KEY } from './login-store';
2
+ export type { LoginPromptState, LoginPendingCall } from './login-store';
3
+ export { loginErrorInterceptor } from './login-error-interceptor';
4
+ export { reprovisionAfterLogin, consumeLoginHandoff } from './reprovision';
@@ -0,0 +1,13 @@
1
+ import { ErrorInterceptor } from '../functions/function-registry';
2
+ /**
3
+ * Error interceptor for the deferred-login flow.
4
+ *
5
+ * When a function call fails with code "login_required":
6
+ * 1. Stashes the pending call in sessionStorage (for replay after page reload).
7
+ * 2. Sets the login prompt state to required (triggers the login dialog).
8
+ * 3. Returns null so the original promise rejects normally with the error.
9
+ *
10
+ * After the user logs in, the page reloads against the new endpoint.
11
+ * The app's mount logic reads the pending call from sessionStorage and auto-invokes it.
12
+ */
13
+ export declare const loginErrorInterceptor: ErrorInterceptor;
@@ -0,0 +1,17 @@
1
+ export declare const PENDING_CALL_KEY = "ikon.login.pendingCall";
2
+ export interface LoginPromptState {
3
+ required: boolean;
4
+ reason: string | null;
5
+ }
6
+ export interface LoginPendingCall {
7
+ functionName: string;
8
+ args: unknown[];
9
+ }
10
+ type Listener = () => void;
11
+ export declare function getLoginPromptState(): LoginPromptState;
12
+ export declare function setLoginPromptRequired(reason: string | null): void;
13
+ export declare function clearLoginPrompt(): void;
14
+ export declare function subscribe(listener: Listener): () => void;
15
+ export declare function setLoginPendingCall(pending: LoginPendingCall): void;
16
+ export declare function consumeLoginPendingCall(): LoginPendingCall | null;
17
+ export {};
@@ -0,0 +1,22 @@
1
+ import { consumeLoginPendingCall } from './login-store';
2
+ /**
3
+ * Reprovision the client by reloading the page against a new server endpoint.
4
+ *
5
+ * The deferred-login handoff data (pending call, app route) lives in sessionStorage
6
+ * and survives the page reload. On reload, the app boots against the new endpoint
7
+ * (which now has a real user identity) and the app's mount logic can replay the
8
+ * pending call from sessionStorage via {@link consumeLoginHandoff}.
9
+ *
10
+ * This follows the same pattern as `ikon.client.logout` (clear + reload).
11
+ *
12
+ * @param connectUrl The full connect URL for the authenticated session.
13
+ */
14
+ export declare function reprovisionAfterLogin(connectUrl: string): void;
15
+ /**
16
+ * Check on app mount whether we just came back from a login reprovision.
17
+ * Returns the app route to restore and any pending call to replay.
18
+ */
19
+ export declare function consumeLoginHandoff(): {
20
+ appRoute: string | null;
21
+ pendingCall: ReturnType<typeof consumeLoginPendingCall>;
22
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikonai/sdk",
3
- "version": "1.0.44",
3
+ "version": "1.0.45",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -18,6 +18,8 @@
18
18
  * - ikon-video Force video on (true) or off (false)
19
19
  * - ikon-webrtc Force WebRTC on (true) or off (false)
20
20
  * - ikon-inspect Enable element inspection overlay (true)
21
+ * - ikon-retry Enable retry loops in auth/channel connect (default true; set false to fail fast)
22
+ * - ikon-api Route backend API calls through same-origin /ikon/api path (true) instead of api.{env}.ikon.live
21
23
  */
22
24
  export declare const IKON_PARAM_PROXY = "ikon-proxy";
23
25
  export declare const IKON_PARAM_WEBSOCKET = "ikon-websocket";
@@ -31,6 +33,8 @@ export declare const IKON_PARAM_AUDIO = "ikon-audio";
31
33
  export declare const IKON_PARAM_VIDEO = "ikon-video";
32
34
  export declare const IKON_PARAM_WEBRTC = "ikon-webrtc";
33
35
  export declare const IKON_PARAM_INSPECT = "ikon-inspect";
36
+ export declare const IKON_PARAM_RETRY = "ikon-retry";
37
+ export declare const IKON_PARAM_API = "ikon-api";
34
38
  /**
35
39
  * Set an SDK query parameter in the URL via history.replaceState.
36
40
  */
@@ -45,3 +49,5 @@ export declare function getAudioParam(): boolean | null;
45
49
  export declare function getVideoParam(): boolean | null;
46
50
  export declare function getWebRtcParam(): boolean | null;
47
51
  export declare function getInspectParam(): boolean;
52
+ export declare function getRetryParam(): boolean;
53
+ export declare function getApiParam(): boolean | null;