@vizbeetv/sdk-qa 7.8.36 → 7.8.38

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.
Files changed (31) hide show
  1. package/README.md +42 -18
  2. package/chromecast/index.js +1 -1
  3. package/chromecast-v2/es5/index.js +1 -1
  4. package/chromecast-v2/es6/index.js +1 -1
  5. package/lg/es5/index.js +1 -1
  6. package/lg/es6/index.js +1 -1
  7. package/package.json +54 -15
  8. package/samsung/es5/index.js +1 -1
  9. package/samsung/es6/index.js +1 -1
  10. package/types/index.d.ts +486 -0
  11. package/types/vtvsdk/src/core/session/SessionState.d.ts +45 -0
  12. package/types/vtvsdk/src/core/session/SessionStateListener.d.ts +23 -0
  13. package/types/vtvsdk/src/core/session/base/VizbeeMessagingClient.d.ts +38 -0
  14. package/types/vtvsdk/src/core/session/base/VizbeePresenceClient.d.ts +7 -0
  15. package/types/vtvsdk/src/core/session/bicast/VizbeeBicastMemberPresenceClientImpl.d.ts +17 -0
  16. package/types/vtvsdk/src/core/session/bicast/VizbeeBicastMessagingClientImpl.d.ts +54 -0
  17. package/types/vtvsdk/src/core/session/bicast/VizbeeBicastSession.d.ts +25 -0
  18. package/types/vtvsdk/src/core/session/bicast/VizbeeBicastSessionManager.d.ts +63 -0
  19. package/types/vtvsdk/src/core/session/bicast/VizbeePresenceManager.d.ts +24 -0
  20. package/types/vtvsdk/src/core/session/models/MemberInfo.d.ts +39 -0
  21. package/types/vtvsdk/src/core/session/models/MemberType.d.ts +49 -0
  22. package/types/vtvsdk/src/core/session/models/VizbeeDevice.d.ts +26 -0
  23. package/types/vtvsdk/src/core/session/models/VizbeeDeviceType.d.ts +10 -0
  24. package/types/vtvsdk/src/core/session/models/presence/PresenceEventResult.d.ts +11 -0
  25. package/types/vtvsdk/src/core/sync/presence/Device.d.ts +34 -0
  26. package/types/vtvsdk/src/core/sync/presence/DeviceType.d.ts +6 -0
  27. package/types/vtvsdk/src/core/sync/presence/PresenceEvent.d.ts +4 -0
  28. package/types/vtvsdk/src/core/sync/presence/PresenceEventResult.d.ts +8 -0
  29. package/vizio/index.js +1 -1
  30. package/xbox/es5/index.js +1 -1
  31. package/xbox/es6/index.js +1 -1
@@ -0,0 +1,486 @@
1
+ // ---------------------------------------------------------------------------
2
+ // Vizbee TV SDK — TypeScript type declarations
3
+ // ---------------------------------------------------------------------------
4
+ //
5
+ // Hybrid surface:
6
+ // • The session / presence / messaging MODEL types below are RE-EXPORTED from
7
+ // declarations auto-generated off the TypeScript source (tsconfig.npm-types.json),
8
+ // so they never drift from the implementation.
9
+ // • The rest — the default-export `VizbeeSDK` API and its `continuity` tree
10
+ // (adapters, messages, context, UI, analytics, interceptors) — is plain JS
11
+ // in the SDK, has no TS source, and is therefore hand-maintained here.
12
+ //
13
+ // Named exports are intended for type annotations. Runtime values are reached
14
+ // through the default export / `window.VizbeeSDK` (e.g.
15
+ // `vizbee.continuity.adapters.PlayerAdapter`), not via value imports.
16
+ // ---------------------------------------------------------------------------
17
+
18
+ // ========================
19
+ // Models & Enums (auto-generated from TS source — do not redeclare here)
20
+ // ========================
21
+
22
+ import {
23
+ SessionState,
24
+ SessionStateUtils,
25
+ } from './vtvsdk/src/core/session/SessionState.js';
26
+ import { SessionStateListener } from './vtvsdk/src/core/session/SessionStateListener.js';
27
+ import { MemberInfo } from './vtvsdk/src/core/session/models/MemberInfo.js';
28
+ import { MemberType, MemberTypeInfo } from './vtvsdk/src/core/session/models/MemberType.js';
29
+ import { VizbeeDevice } from './vtvsdk/src/core/session/models/VizbeeDevice.js';
30
+ import { VizbeeDeviceType } from './vtvsdk/src/core/session/models/VizbeeDeviceType.js';
31
+ import {
32
+ PresenceEventResult,
33
+ PresenceEvent,
34
+ } from './vtvsdk/src/core/session/models/presence/PresenceEventResult.js';
35
+ import { VizbeeMessagingClient } from './vtvsdk/src/core/session/base/VizbeeMessagingClient.js';
36
+ import { VizbeePresenceClient } from './vtvsdk/src/core/session/base/VizbeePresenceClient.js';
37
+ import { VizbeeBicastSession } from './vtvsdk/src/core/session/bicast/VizbeeBicastSession.js';
38
+ import { VizbeeBicastSessionManager } from './vtvsdk/src/core/session/bicast/VizbeeBicastSessionManager.js';
39
+ import { VizbeePresenceManager } from './vtvsdk/src/core/session/bicast/VizbeePresenceManager.js';
40
+
41
+ export {
42
+ SessionState,
43
+ SessionStateUtils,
44
+ SessionStateListener,
45
+ MemberInfo,
46
+ MemberType,
47
+ MemberTypeInfo,
48
+ VizbeeDevice,
49
+ VizbeeDeviceType,
50
+ PresenceEventResult,
51
+ PresenceEvent,
52
+ VizbeeMessagingClient,
53
+ VizbeePresenceClient,
54
+ VizbeeBicastSession,
55
+ VizbeeBicastSessionManager,
56
+ VizbeePresenceManager,
57
+ };
58
+
59
+ // ========================
60
+ // Messages
61
+ // ========================
62
+
63
+ export declare class Track {
64
+ type: string;
65
+ id: number;
66
+
67
+ toJSON(): Record<string, unknown>;
68
+ fromJSON(trackInfo: Record<string, unknown>): void;
69
+ }
70
+
71
+ export declare class SubtitleTrack extends Track {
72
+ lang: string;
73
+ subtype: string;
74
+
75
+ toJSON(): Record<string, unknown>;
76
+ fromJSON(trackInfo: Record<string, unknown>): void;
77
+ }
78
+
79
+ export declare class VideoInfo {
80
+ guid: string;
81
+ isLive: boolean;
82
+ startTime: number;
83
+ videoUrl: string;
84
+ deeplink: string;
85
+ imgUrl: string;
86
+ title: string;
87
+ subtitle: string;
88
+ desc: string;
89
+ tracks: Track[];
90
+ cuepoints: number[];
91
+ customStreamInfo: unknown;
92
+ customMetadata: unknown;
93
+
94
+ toJson(): Record<string, unknown>;
95
+ fromJson(syncVideoInfo: Record<string, unknown>): void;
96
+ }
97
+
98
+ export declare class VideoStatus {
99
+ guid: string;
100
+ state: string;
101
+ currentPosition: number;
102
+ duration: number;
103
+ isLive: boolean;
104
+ isDvrSupported: boolean;
105
+ title: string;
106
+ subtitle: string;
107
+ videoUrl: string;
108
+ imgUrl: string;
109
+ }
110
+
111
+ export declare class VizbeeEvent {
112
+ type: string;
113
+ data: unknown;
114
+ }
115
+
116
+ export declare class AdStatus {
117
+ eventType: string;
118
+ eventData: Record<string, unknown>;
119
+
120
+ constructor(eventType: string, eventData: Record<string, unknown>);
121
+ }
122
+
123
+ export declare class PlayerState {
124
+ static readonly IDLE: string;
125
+ static readonly PREPARING: string;
126
+ static readonly LOADING: string;
127
+ static readonly STARTED: string;
128
+ static readonly PLAYING: string;
129
+ static readonly PAUSED: string;
130
+ static readonly BUFFERING: string;
131
+ static readonly INTERRUPTED: string;
132
+ static readonly ENDED: string;
133
+ static readonly ERROR: string;
134
+ }
135
+
136
+ export declare class AdEventType {
137
+ static readonly AD_POD_WAITING: string;
138
+ static readonly AD_POD_START: string;
139
+ static readonly AD_PREPARING: string;
140
+ static readonly AD_START: string;
141
+ static readonly AD_PLAYING: string;
142
+ static readonly AD_PAUSED: string;
143
+ static readonly AD_END: string;
144
+ static readonly AD_POD_END: string;
145
+ static readonly AD_ERROR: string;
146
+ }
147
+
148
+ // ========================
149
+ // Adapters
150
+ // ========================
151
+
152
+ export declare class AppAdapter {
153
+ deeplinkHandler?: (videoInfo: VideoInfo) => void;
154
+ vizbeeEventHandler?: (event: VizbeeEvent) => void;
155
+ vizbeeSigninEventHandler?: (event: VizbeeEvent) => void;
156
+
157
+ setDeeplinkHandler(handler: (videoInfo: VideoInfo) => void): void;
158
+ setVizbeeEventHandler(handler: (event: VizbeeEvent) => void): void;
159
+ /** @deprecated since 7.5 — use setVizbeeEventHandler instead */
160
+ setSignInHandler(handler: (event: VizbeeEvent) => void): void;
161
+ /** @deprecated since 7.5 — use setVizbeeEventHandler instead */
162
+ setVizbeeSigninEventHandler(handler: (event: VizbeeEvent) => void): void;
163
+ }
164
+
165
+ export declare class BasePlayerAdapter {
166
+ playHandler?: () => void;
167
+ pauseHandler?: () => void;
168
+ seekHandler?: (timeInMs: number) => void;
169
+ stopHandler?: (stopReason?: string) => void;
170
+ videoInfoGetter?: () => VideoStatus | undefined;
171
+ availableTracksGetter?: () => Track[];
172
+ enabledTracksGetter?: () => Track[];
173
+ enableTracksHandler?: (trackIds: number[]) => void;
174
+ disableTracksHandler?: (trackIds: number[]) => void;
175
+ vizbeeEventHandler?: (event: VizbeeEvent) => void;
176
+
177
+ updateVideoInfo(videoInfo: VideoInfo): void;
178
+ setVideoInfoGetter(getter: () => VideoStatus | undefined): void;
179
+ getVideoInfo(): VideoStatus | undefined;
180
+ updateVideoStatus(videoStatus: VideoStatus): void;
181
+ setPlayHandler(handler: () => void): void;
182
+ setPauseHandler(handler: () => void): void;
183
+ setSeekHandler(handler: (timeInMs: number) => void): void;
184
+ setStopHandler(handler: (stopReason?: string) => void): void;
185
+ setAvailableTracksGetter(getter: () => Track[]): void;
186
+ setEnabledTracksGetter(getter: () => Track[]): void;
187
+ setEnableTracksHandler(handler: (trackIds: number[]) => void): void;
188
+ setDisableTracksHandler(handler: (trackIds: number[]) => void): void;
189
+ setVizbeeEventHandler(handler: (event: VizbeeEvent) => void): void;
190
+ }
191
+
192
+ export declare class PlayerAdapter extends BasePlayerAdapter {
193
+ playerType: string;
194
+ playerElement: HTMLElement;
195
+
196
+ constructor(playerType: string, playerElement: HTMLElement);
197
+
198
+ /** @deprecated since 7.5 — pass playerType in constructor */
199
+ setPlayerType(playerType: string): void;
200
+ /** @deprecated since 7.5 — pass playerElement in constructor */
201
+ setPlayerElement(playerElement: HTMLElement): void;
202
+ /** @deprecated since 7.5 — use setAvailableTracksGetter */
203
+ getTracksHandler(handler: () => Track[]): void;
204
+ /** @deprecated since 7.5 — use setEnabledTracksGetter */
205
+ getEnabledTracksHandler(handler: () => Track[]): void;
206
+ setCustomAttributesForMetrics(attributes: Record<string, unknown>): void;
207
+ }
208
+
209
+ export declare class AVPlayerAdapter extends PlayerAdapter {
210
+ constructor();
211
+
212
+ wrapListener(listener: Record<string, Function>): Record<string, Function>;
213
+ getListener(): Record<string, Function> | undefined;
214
+ }
215
+
216
+ export declare class AdAdapter {
217
+ adType: string;
218
+ playerElement: HTMLElement;
219
+
220
+ constructor(adType: string, playerElement: HTMLElement);
221
+
222
+ updateAdStatus(adStatus: AdStatus): void;
223
+ }
224
+
225
+ export declare class PlayerType {
226
+ static readonly UNKNOWN: string;
227
+ static readonly HTML: string;
228
+ static readonly AVPLAYER: string;
229
+ static readonly BITMOVIN: string;
230
+ static readonly VIDEOJS: string;
231
+ static readonly THEO: string;
232
+ static readonly SHAKA: string;
233
+ }
234
+
235
+ export declare class AdType {
236
+ static readonly UNKNOWN: string;
237
+ static readonly SSAI: string;
238
+ static readonly CSAI: string;
239
+ }
240
+
241
+ export declare class VideoStopReason {
242
+ static readonly STOP_REASON_UNKNOWN: string;
243
+ static readonly STOP_BY_USER: string;
244
+ static readonly STOP_IMPLICIT: string;
245
+ static readonly STOP_REASON_BEFORE_NEXT_VIDEO: string;
246
+ }
247
+
248
+ // ========================
249
+ // Options
250
+ // ========================
251
+
252
+ export declare class ContinuityOptions {
253
+ configServiceProxyHost: string | undefined;
254
+ customAttributesForMetrics: Record<string, unknown> | undefined;
255
+ }
256
+
257
+ // ========================
258
+ // Context
259
+ // ========================
260
+
261
+ export declare class ContinuityContext {
262
+ static getInstance(): ContinuityContext;
263
+
264
+ start(appId: string): void;
265
+ startWithOptions(appId: string, options: ContinuityOptions): void;
266
+
267
+ getAppAdapter(): AppAdapter;
268
+ setAppAdapter(appAdapter: AppAdapter): void;
269
+
270
+ getPlayerAdapter(): PlayerAdapter | undefined;
271
+ setPlayerAdapter(playerAdapter: PlayerAdapter): boolean;
272
+ removePlayerAdapter(playerAdapter: PlayerAdapter): boolean;
273
+ setPlayerAdapterWithVideoInfo(playerAdapter: PlayerAdapter, videoInfo: VideoInfo): boolean;
274
+
275
+ setVideoInfo(videoInfo: VideoInfo): boolean;
276
+ getVideoInfo(): VideoStatus | undefined;
277
+
278
+ getAdAdapter(adAdapterType?: string): AdAdapter | undefined;
279
+ setAdAdapter(adAdapter: AdAdapter): void | false;
280
+ removeAdAdapter(adAdapter: AdAdapter): void;
281
+ setAdType(adType: string): void;
282
+
283
+ stopVideo(): void;
284
+ }
285
+
286
+ // ========================
287
+ // Analytics
288
+ // ========================
289
+
290
+ export declare class AnalyticsProvider {
291
+ wasAppLaunchedByVizbee(): boolean;
292
+ wasVideoStartedByVizbee(): boolean;
293
+ addProvider(attributesProvider: unknown, filterRegEx?: RegExp): void;
294
+ removeProvider(attributesProvider: unknown): void;
295
+ logMetrics(eventName: string, properties?: Record<string, unknown>): void;
296
+ setCustomAttributes(customAttributes: Record<string, unknown>): void;
297
+ }
298
+
299
+ // ========================
300
+ // UI
301
+ // ========================
302
+
303
+ export interface LayoutPositionMap {
304
+ TOP_LEFT: string;
305
+ TOP_RIGHT: string;
306
+ BOTTOM_LEFT: string;
307
+ BOTTOM_RIGHT: string;
308
+ }
309
+
310
+ export interface SnackbarTheme {
311
+ color?: string;
312
+ bgColor?: string;
313
+ }
314
+
315
+ export interface SnackbarLayout {
316
+ position?: string;
317
+ }
318
+
319
+ export interface SnackbarBorder {
320
+ color?: string;
321
+ }
322
+
323
+ export interface SnackbarFont {
324
+ uri?: string;
325
+ family?: string;
326
+ size?: string;
327
+ weight?: string;
328
+ }
329
+
330
+ export interface SnackbarIcon {
331
+ uri?: string;
332
+ }
333
+
334
+ export declare class SnackbarUIConfig {
335
+ message: string;
336
+ theme: SnackbarTheme;
337
+ layout: SnackbarLayout;
338
+ border: SnackbarBorder;
339
+ font: SnackbarFont;
340
+ icon: SnackbarIcon;
341
+
342
+ fromJSON(options: Record<string, unknown>): void;
343
+ toJSON(): Record<string, unknown>;
344
+ }
345
+
346
+ export declare class Snackbar {
347
+ constructor(uiConfig: SnackbarUIConfig);
348
+
349
+ show(ttlInSec?: number): void;
350
+ hide(): void;
351
+ }
352
+
353
+ // ========================
354
+ // Interceptors (Chromecast CAF)
355
+ // ========================
356
+
357
+ export declare class LoadRequestInterceptor {
358
+ constructor(adaptLoadRequest: (loadRequest: unknown) => unknown);
359
+
360
+ update(loadRequest: unknown): unknown;
361
+ }
362
+
363
+ // ========================
364
+ // ContinuityFramework
365
+ // ========================
366
+
367
+ export interface AdaptersMap {
368
+ AppAdapter: typeof AppAdapter;
369
+ PlayerAdapter: typeof PlayerAdapter;
370
+ BasePlayerAdapter: typeof BasePlayerAdapter;
371
+ AVPlayerAdapter: typeof AVPlayerAdapter;
372
+ PlayerType: typeof PlayerType;
373
+ AdAdapter: typeof AdAdapter;
374
+ AdType: typeof AdType;
375
+ VideoStopReason: typeof VideoStopReason;
376
+ }
377
+
378
+ export interface MessagesMap {
379
+ VizbeeEvent: typeof VizbeeEvent;
380
+ VideoInfo: typeof VideoInfo;
381
+ VideoStatus: typeof VideoStatus;
382
+ AdEventType: typeof AdEventType;
383
+ AdStatus: typeof AdStatus;
384
+ PlayerState: typeof PlayerState;
385
+ SubtitleTrack: typeof SubtitleTrack;
386
+ }
387
+
388
+ export interface AnalyticsMap {
389
+ AnalyticsProvider: typeof AnalyticsProvider;
390
+ }
391
+
392
+ export interface UIMap {
393
+ LayoutPosition: LayoutPositionMap;
394
+ Snackbar: typeof Snackbar;
395
+ SnackbarUIConfig: typeof SnackbarUIConfig;
396
+ }
397
+
398
+ export interface XMessagesMap {
399
+ VizbeeBicastSessionManager: typeof VizbeeBicastSessionManager;
400
+ VizbeeBicastSession: typeof VizbeeBicastSession;
401
+ VizbeeMessagingClient: VizbeeMessagingClient;
402
+ VizbeePresenceManager: typeof VizbeePresenceManager;
403
+ }
404
+
405
+ export interface InterceptorsMap {
406
+ LoadRequestInterceptor: typeof LoadRequestInterceptor;
407
+ }
408
+
409
+ export interface ContinuityFramework {
410
+ ContinuityContext: typeof ContinuityContext;
411
+ ContinuityOptions: typeof ContinuityOptions;
412
+
413
+ /** Available on Samsung, LG, Vizio, Xbox platforms */
414
+ adapters: AdaptersMap;
415
+ /** Available on Samsung, LG, Vizio, Xbox platforms */
416
+ messages: MessagesMap;
417
+ /** Available on Samsung, LG, Vizio, Xbox platforms */
418
+ analytics: AnalyticsMap;
419
+ /** Available on Samsung, LG, Vizio, Xbox platforms */
420
+ ui: UIMap;
421
+
422
+ /** Available on all platforms */
423
+ xmessages: XMessagesMap;
424
+
425
+ /** Available on Chromecast only */
426
+ interceptors?: InterceptorsMap;
427
+ /** @deprecated — use interceptors.LoadRequestInterceptor */
428
+ LoadRequestInterceptor?: typeof LoadRequestInterceptor;
429
+ }
430
+
431
+ // ========================
432
+ // Logger
433
+ // ========================
434
+
435
+ export interface VizbeeLogger {
436
+ setPrefix(prefix: string): void;
437
+ error(...args: unknown[]): void;
438
+ warn(...args: unknown[]): void;
439
+ info(...args: unknown[]): void;
440
+ debug(...args: unknown[]): void;
441
+ d(...args: unknown[]): void;
442
+ w(...args: unknown[]): void;
443
+ }
444
+
445
+ // ========================
446
+ // VizbeeSDK (default export)
447
+ // ========================
448
+
449
+ export interface VizbeeSDK {
450
+ /** SDK version string */
451
+ readonly VERSION: string;
452
+
453
+ /** Logger instance */
454
+ logger: VizbeeLogger;
455
+
456
+ /** V2 continuity framework — primary API surface */
457
+ readonly continuity: ContinuityFramework;
458
+
459
+ /** @deprecated — alias for continuity (backward compatibility) */
460
+ readonly framework: ContinuityFramework;
461
+
462
+ /**
463
+ * Initialize the SDK (V1 API).
464
+ * For V2 API, use `vizbee.continuity.ContinuityContext.getInstance().start(appId)` instead.
465
+ */
466
+ init(
467
+ appId: string,
468
+ adapters: Record<string, unknown>,
469
+ platformConfig?: Record<string, unknown>,
470
+ vzbOptions?: Record<string, unknown>,
471
+ ): void;
472
+
473
+ // -- V1 legacy methods --
474
+
475
+ setVideoGuid(guid: string, isLive?: boolean): boolean | undefined;
476
+ setVideoInfo(videoInfo: Record<string, unknown>): boolean | undefined;
477
+ setVideoStop(): boolean | undefined;
478
+ getAdsManager(): unknown;
479
+ setAdsVideo(adsVideo: unknown): boolean | undefined;
480
+ setVideoElement(newVideoElement: HTMLElement): boolean;
481
+ setAdAdapterType(adAdapterType: string): boolean | undefined;
482
+ wrapAVPlayerListener(listeners: Record<string, Function>): unknown;
483
+ }
484
+
485
+ declare const vizbee: VizbeeSDK;
486
+ export default vizbee;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Represents the possible states of a Vizbee session.
3
+ * These states define the lifecycle of a connection between devices.
4
+ */
5
+ export declare enum SessionState {
6
+ /** Initial state or when connection is lost/terminated */
7
+ NOT_CONNECTED = 1,
8
+ /** Intermediate state while establishing connection */
9
+ CONNECTING = 2,
10
+ /** Successfully established connection */
11
+ CONNECTED = 3
12
+ }
13
+ /**
14
+ * Utility class providing helper methods for SessionState operations.
15
+ * This class is not instantiable and serves as a namespace for session state-related functions.
16
+ */
17
+ export declare class SessionStateUtils {
18
+ /**
19
+ * Private constructor to prevent instantiation of utility class.
20
+ * All methods in this class are static and should be accessed directly via the class.
21
+ */
22
+ private constructor();
23
+ /**
24
+ * Converts a SessionState enum value to its human-readable string representation.
25
+ * Useful for logging, debugging, and UI display purposes.
26
+ *
27
+ * @param state - The SessionState enum value to convert
28
+ * @returns A human-readable string representation of the state
29
+ */
30
+ static toString(state: SessionState): string;
31
+ /**
32
+ * Type guard that checks if a number represents a valid SessionState.
33
+ * Useful for runtime validation of state values received from external sources.
34
+ *
35
+ * @param state - The number to check
36
+ * @returns A type predicate indicating if the number is a valid SessionState
37
+ *
38
+ * @example
39
+ * if (SessionStateUtils.isValidState(someNumber)) {
40
+ * // TypeScript now knows someNumber is a SessionState
41
+ * const stateString = SessionStateUtils.toString(someNumber);
42
+ * }
43
+ */
44
+ static isValidState(state: number): state is SessionState;
45
+ }
@@ -0,0 +1,23 @@
1
+ import { SessionState } from './SessionState.js';
2
+ /**
3
+ * Defines a listener interface for monitoring session state changes in the Vizbee receiver SDK.
4
+ * This interface is implemented by components that need to react to changes in the connection
5
+ * state between devices.
6
+ *
7
+ * Implementation Note:
8
+ * This interface is part of the receiver SDK and corresponds to the SessionStateListener
9
+ * in the receiver-x-sdk, with package name differences to accommodate screen-specific
10
+ * functionality.
11
+ *
12
+ * @interface
13
+ */
14
+ export interface SessionStateListener {
15
+ /**
16
+ * Called when the session state changes.
17
+ * Implementations should handle the transition to the new state appropriately,
18
+ * such as updating UI, managing resources, or triggering dependent operations.
19
+ *
20
+ * @param newState - The new session state that has been entered
21
+ */
22
+ onSessionStateChanged(newState: SessionState): void;
23
+ }
@@ -0,0 +1,38 @@
1
+ import { VizbeeDevice } from '../models/VizbeeDevice.js';
2
+ /**
3
+ * VizbeeMessagingClient defines the contract for handling device-to-device messaging
4
+ * in a Vizbee network environment. This interface provides methods for sending messages
5
+ * to specific devices and managing message receivers.
6
+ *
7
+ * @interface
8
+ */
9
+ export interface VizbeeMessagingClient {
10
+ /**
11
+ * Sends a message to a specific device within a designated namespace.
12
+ *
13
+ * @param payload - An object containing the message data to be sent
14
+ * @param namespace - A string identifying the messaging channel/category
15
+ * @param callback - Optional callback function to handle the send operation result
16
+ *
17
+ * @throws {Error} May throw an error if the message cannot be sent or if parameters are invalid
18
+ */
19
+ send(payload: Record<string, any>, namespace: string, callback?: (error?: Error) => void): void;
20
+ /**
21
+ * Registers a callback function to handle incoming messages for a specific namespace.
22
+ * Multiple receivers can be registered for the same namespace.
23
+ *
24
+ * @param namespace - The namespace to listen for messages on
25
+ * @param onReceive - Callback function that will be invoked when a message is received
26
+ * The callback receives the message payload, namespace, and source device
27
+ */
28
+ addReceiver(namespace: string, onReceive: (payload: Record<string, any>, namespace: string, device: VizbeeDevice) => void): void;
29
+ /**
30
+ * Unregisters a previously registered message receiver for a specific namespace.
31
+ * Both the namespace and callback function must match the original registration.
32
+ *
33
+ * @param namespace - The namespace from which to remove the receiver
34
+ * @param onReceive - The callback function to be removed. Must be the same reference
35
+ * as the one used in addReceiver
36
+ */
37
+ removeReceiver(namespace: string, onReceive: (payload: Record<string, any>, namespace: string, device: VizbeeDevice) => void): void;
38
+ }
@@ -0,0 +1,7 @@
1
+ import { VizbeeDevice } from '../models/VizbeeDevice.js';
2
+ import { PresenceEventResult } from '../models/presence/PresenceEventResult.js';
3
+ export interface VizbeePresenceClient {
4
+ subscribe(onPresenceChanged: (result: PresenceEventResult) => void): void;
5
+ unsubscribe(onPresenceChanged: (result: PresenceEventResult) => void): void;
6
+ getMembers(): VizbeeDevice[];
7
+ }
@@ -0,0 +1,17 @@
1
+ import { VizbeePresenceClient } from '../base/VizbeePresenceClient.js';
2
+ import { PresenceEventResult } from '../models/presence/PresenceEventResult.js';
3
+ import { VizbeeDevice } from '../models/VizbeeDevice.js';
4
+ declare class VizbeeBicastMemberPresenceClientImpl implements VizbeePresenceClient {
5
+ private static readonly LOG_TAG;
6
+ private presenceCallbacks;
7
+ private syncController;
8
+ constructor();
9
+ private init;
10
+ private listenForSyncControllerAvailability;
11
+ private listenForSyncControllerSessionState;
12
+ subscribe(onPresenceChanged: (result: PresenceEventResult) => void): void;
13
+ unsubscribe(onPresenceChanged: (result: PresenceEventResult) => void): void;
14
+ getMembers(): VizbeeDevice[];
15
+ private toVizbeeDevice;
16
+ }
17
+ export { VizbeeBicastMemberPresenceClientImpl };
@@ -0,0 +1,54 @@
1
+ import { VizbeeMessagingClient } from '../base/VizbeeMessagingClient.js';
2
+ import { VizbeeDevice } from '../models/VizbeeDevice.js';
3
+ /**
4
+ * Implementation of VizbeeMessagingClient that handles bi-directional messaging
5
+ * between devices in a Vizbee network. This implementation specifically interfaces
6
+ * with the global VZB SDK core for message handling.
7
+ *
8
+ * Note: This class expects the VZB global object to be available in the window context.
9
+ *
10
+ * @implements {VizbeeMessagingClient}
11
+ */
12
+ declare class VizbeeBicastMessagingClientImpl implements VizbeeMessagingClient {
13
+ /**
14
+ * Map storing message receivers for each namespace.
15
+ * Key: namespace string
16
+ * Value: callback function to handle received messages
17
+ */
18
+ private namespaceAndReceiverMap;
19
+ constructor();
20
+ /**
21
+ * Sends a message through the VZB SDK core within the specified namespace.
22
+ * Returns a promise that resolves when the message is successfully sent.
23
+ *
24
+ * @param payload - The message data to be sent
25
+ * @param namespace - The target namespace for the message
26
+ * @returns Promise<void> - Resolves on successful send, rejects on failure
27
+ * @throws {Error} When the VZB SDK encounters an error during message transmission
28
+ */
29
+ send(payload: any, namespace: string): Promise<void>;
30
+ /**
31
+ * Registers a callback function to handle incoming messages for a specific namespace.
32
+ *
33
+ * @param namespace - The namespace to listen for messages on
34
+ * @param onReceive - Callback function to be invoked when a message is received
35
+ */
36
+ addReceiver(namespace: string, onReceive: (payload: any, namespace: string, device: VizbeeDevice) => void): void;
37
+ /**
38
+ * Removes a previously registered message receiver for a specific namespace.
39
+ *
40
+ * @param namespace - The namespace from which to remove the receiver
41
+ * @param onReceive - The callback function to be removed
42
+ */
43
+ removeReceiver(namespace: string, onReceive: (payload: any, namespace: string, device: VizbeeDevice) => void): void;
44
+ /**
45
+ * Internal message handler that processes incoming messages and routes them
46
+ * to the appropriate receiver callback based on the namespace.
47
+ *
48
+ * @param namespace - The namespace of the received message
49
+ * @param payload - The message data received
50
+ * @param device - The source device that sent the message
51
+ */
52
+ onReceive(namespace: string, payload: any, device: VizbeeDevice): void;
53
+ }
54
+ export { VizbeeBicastMessagingClientImpl };