@ikonai/sdk 1.8.0 → 1.10.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.
@@ -62,9 +62,20 @@ export interface ProtocolMessageSubscriptionOptions {
62
62
  * State handler callback type for state subscribers.
63
63
  */
64
64
  export type StateHandler = (state: ConnectionState) => void;
65
+ /** How a dispatched UI action should be treated when the server refuses it. */
66
+ export interface SendActionCallOptions {
67
+ /**
68
+ * The dispatch is a component's own bookkeeping rather than something a person did, so a refusal
69
+ * is not worth a person's attention: a controlled overlay reports itself closed as it unmounts,
70
+ * and when the whole subtree is going away the server has already retired that action. Such a
71
+ * failure is logged at debug instead of error.
72
+ */
73
+ bestEffort?: boolean;
74
+ }
65
75
  /** The server-side outcome of a dispatched UI action (see {@link IkonClient.sendActionCallWithResult}). */
66
76
  export interface ActionOutcome {
67
77
  success: boolean;
78
+ /** Empty: the server keeps the exception in its own log, so a failure carries no reason here. */
68
79
  errorMessage: string;
69
80
  }
70
81
  export declare class IkonClient {
@@ -102,6 +113,7 @@ export declare class IkonClient {
102
113
  private readonly _pendingActionAcks;
103
114
  private _ackRttMs;
104
115
  private readonly _actionIdByCallId;
116
+ private readonly _bestEffortCallIds;
105
117
  private readonly _pendingActionResults;
106
118
  private readonly endpointSelector;
107
119
  private readonly _webRtcReachability;
@@ -129,8 +141,10 @@ export declare class IkonClient {
129
141
  private unregisterBrowserFunctions;
130
142
  private unregisterMediaCaptureFunctions;
131
143
  private unregisterSoundFunctions;
144
+ private unregisterDownloadFunctions;
132
145
  private unregisterLoginInterceptor;
133
146
  private nextProtocolPortId;
147
+ private _deliveringViaDataChannel;
134
148
  private nextProtocolSendPortId;
135
149
  private readonly _audioEnabled;
136
150
  private readonly _videoEnabled;
@@ -161,6 +175,7 @@ export declare class IkonClient {
161
175
  private _reconnectTimer;
162
176
  private _joinWatchdogTimer;
163
177
  private _serverStopped;
178
+ private _credentialRejected;
164
179
  private _hasBeenConnected;
165
180
  private _waitForExternalConnectUrl;
166
181
  private _externalConnectUrlCleanup;
@@ -403,7 +418,7 @@ export declare class IkonClient {
403
418
  * Disconnect from the server.
404
419
  */
405
420
  disconnect(): void;
406
- sendActionCall(actionId: string, payload?: string): void;
421
+ sendActionCall(actionId: string, payload?: string, options?: SendActionCallOptions): void;
407
422
  /**
408
423
  * Dispatch a UI action and resolve with the server handler's actual outcome — the
409
424
  * ActionResult the server emits when the handler finishes (the ActionCallAck is only a
@@ -446,6 +461,14 @@ export declare class IkonClient {
446
461
  * Routes to appropriate channel based on the message's opcode group.
447
462
  */
448
463
  sendProtocolMessage(message: ProtocolMessage): void;
464
+ /**
465
+ * Hand an error to the app's onError callback.
466
+ *
467
+ * For SDK subsystems (media playback, capture) whose failure leaves the connection itself
468
+ * intact: the client stays connected, so this callback is the only place the app can learn
469
+ * that a session went silent or blind.
470
+ */
471
+ reportError(error: Error): void;
449
472
  /**
450
473
  * Send a client context update to the server.
451
474
  * This notifies the server of changes to viewport size, theme, or timezone.
@@ -0,0 +1,8 @@
1
+ import { FunctionRegistry } from './function-registry';
2
+ export declare const DownloadFunctionNames: {
3
+ readonly DownloadFile: "ikon.client.downloadFile";
4
+ };
5
+ /**
6
+ * Register download functions with a registry. Returns an unregister function.
7
+ */
8
+ export declare function registerDownloadFunctions(registry: FunctionRegistry): () => void;
@@ -3,3 +3,4 @@ export { withResultData, FunctionCallError } from './types';
3
3
  export { FunctionRegistry, type FunctionRegistryConfig, type ErrorInterceptor } from './function-registry';
4
4
  export { registerBrowserFunctions, isBrowserEnvironment } from './browser-functions';
5
5
  export { registerSoundFunctions, SoundFunctionNames } from './sound-functions';
6
+ export { registerDownloadFunctions, DownloadFunctionNames } from './download-functions';
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { IkonClient, type ActionOutcome, type ProtocolMessageHandler, type StateHandler, type ProtocolMessageSubscriptionOptions, type ProtocolMessagePort, type ProtocolSendPort, type WebRTCTrackMapInfo } from './client/ikon-client';
1
+ export { IkonClient, type ActionOutcome, type SendActionCallOptions, type ProtocolMessageHandler, type StateHandler, type ProtocolMessageSubscriptionOptions, type ProtocolMessagePort, type ProtocolSendPort, type WebRTCTrackMapInfo } from './client/ikon-client';
2
2
  export { AppMessaging, appMessaging, type AppMessageType, type AppMessageSubscription } from './app-messaging';
3
3
  export type { IkonClientConfig, LocalConfig, ApiKeyConfig, SessionTokenConfig, CloudConnectionConfig, CommonConnectionConfig, TimeoutConfig, BackendType, AudioConfig, VideoConfig, MediaSessionConfig, WebRtcConfig } from './client/ikon-client-config';
4
4
  export { DEFAULT_LOCAL_SERVER_HOST, DEFAULT_LOCAL_SERVER_PORT, DEFAULT_SLOW_CONNECTION_THRESHOLD_MS } from './client/ikon-client-config';