@zyratalk1/zyra-twilio-wrapper 1.2.9 → 1.3.1
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/dist/index.d.mts +87 -1
- package/dist/index.d.ts +87 -1
- package/dist/index.js +422 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +419 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/types/interface.ts +42 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
|
+
type MemberStatus = "Idle" | "Active" | "Ringing" | "ringing";
|
|
2
|
+
interface MemberStatusUpdate {
|
|
3
|
+
memberId: number;
|
|
4
|
+
status: MemberStatus;
|
|
5
|
+
timestamp: string;
|
|
6
|
+
}
|
|
1
7
|
interface Config {
|
|
2
8
|
serverUrl: string;
|
|
3
9
|
identity: string;
|
|
4
10
|
waitUrl?: string;
|
|
5
11
|
sdkToken: string;
|
|
12
|
+
/** WebSocket URL for member status (default: wss://nextdev.zyratalk.com/websocket) */
|
|
13
|
+
websocketUrl?: string;
|
|
14
|
+
/** Connect member-status WebSocket after init (default: true) */
|
|
15
|
+
autoConnectMemberStatus?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Routing member id for this agent. When set, Idle status updates for this member
|
|
18
|
+
* dismiss a ringing incoming call if the caller hung up before answer.
|
|
19
|
+
*/
|
|
20
|
+
memberId?: number;
|
|
6
21
|
accessToken?: string;
|
|
7
22
|
enableAndroidVoiceRegister?: boolean;
|
|
8
23
|
requestTimeoutMs?: number;
|
|
@@ -79,6 +94,11 @@ interface WelcomeConfigResult {
|
|
|
79
94
|
welcomeType: WelcomeType;
|
|
80
95
|
routingConfigId: number;
|
|
81
96
|
}
|
|
97
|
+
interface HoldMusicUrlConfigResult {
|
|
98
|
+
success: boolean;
|
|
99
|
+
message: string;
|
|
100
|
+
routingConfigId: number;
|
|
101
|
+
}
|
|
82
102
|
/**
|
|
83
103
|
* Routing Config
|
|
84
104
|
*/
|
|
@@ -316,16 +336,28 @@ declare class BridgeClient {
|
|
|
316
336
|
|
|
317
337
|
declare class ReactNativeVoipSdk {
|
|
318
338
|
private readonly sdkConfig;
|
|
339
|
+
private readonly websocketUrl;
|
|
340
|
+
private readonly autoConnectMemberStatus;
|
|
341
|
+
private readonly memberId?;
|
|
319
342
|
protected readonly bridge: BridgeClient;
|
|
320
343
|
private readonly retry;
|
|
321
344
|
private readonly authManager;
|
|
322
345
|
private readonly callEngine;
|
|
323
346
|
private readonly conferenceManager;
|
|
324
347
|
private readonly configService;
|
|
348
|
+
private memberStatusWebSocket;
|
|
325
349
|
private initialized;
|
|
326
350
|
protected activeCallId: string | null;
|
|
327
351
|
protected internalConferenceName: string;
|
|
352
|
+
private pendingIncomingCallId;
|
|
353
|
+
private incomingCallAccepted;
|
|
354
|
+
onMemberStatusUpdate?: (update: MemberStatusUpdate) => void;
|
|
355
|
+
onMemberStatusWebSocketConnected?: () => void;
|
|
356
|
+
onMemberStatusWebSocketDisconnected?: () => void;
|
|
328
357
|
constructor(config: Config, nativeModule?: NativeModule);
|
|
358
|
+
private setupIncomingCallTracking;
|
|
359
|
+
private handleMemberStatusUpdate;
|
|
360
|
+
private dismissIncomingCallFromMemberIdle;
|
|
329
361
|
on(eventName: SDKEventName | string, listener: (payload: Record<string, unknown>) => void): () => void;
|
|
330
362
|
initializeSDK(config?: Partial<SDKConfig>): Promise<void>;
|
|
331
363
|
authenticate(payload?: AuthPayload): Promise<ConsumerAuth>;
|
|
@@ -366,10 +398,64 @@ declare class ReactNativeVoipSdk {
|
|
|
366
398
|
deregisterWebhook(): Promise<CallResponse<null>>;
|
|
367
399
|
isWebhookConfigured(): Promise<CallResponse<WebhookConfigResult>>;
|
|
368
400
|
welcomeMessageConfig(welcomeType: "audio" | "tts", welcomeMessage: string): Promise<CallResponse<WelcomeConfigResult>>;
|
|
401
|
+
/**
|
|
402
|
+
* Set hold music audio URL (MP3 or WAV HTTPS URL, e.g. from upload-audio).
|
|
403
|
+
*/
|
|
404
|
+
holdMusicUrlConfig(audioUrl: string): Promise<CallResponse<HoldMusicUrlConfigResult>>;
|
|
405
|
+
/**
|
|
406
|
+
* Connect to member status WebSocket (default: wss://nextdev.zyratalk.com/websocket).
|
|
407
|
+
*/
|
|
408
|
+
connectMemberStatusWebSocket(url?: string): void;
|
|
409
|
+
disconnectMemberStatusWebSocket(): void;
|
|
410
|
+
get isMemberStatusWebSocketConnected(): boolean;
|
|
411
|
+
getMemberStatus(memberId: number): MemberStatus | undefined;
|
|
412
|
+
getMemberStatusMap(): ReadonlyMap<number, MemberStatus>;
|
|
369
413
|
destroy(): void;
|
|
370
414
|
private ensureAuthenticated;
|
|
371
415
|
}
|
|
372
416
|
|
|
417
|
+
interface MemberStatusWebSocketOptions {
|
|
418
|
+
url: string;
|
|
419
|
+
maxReconnectAttempts?: number;
|
|
420
|
+
reconnectDelayMs?: number;
|
|
421
|
+
onStatusUpdate?: (update: MemberStatusUpdate) => void;
|
|
422
|
+
onConnected?: () => void;
|
|
423
|
+
onDisconnected?: () => void;
|
|
424
|
+
onError?: (error: Error) => void;
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* WebSocket client for real-time routing member status updates.
|
|
428
|
+
* Protocol matches zyratalk-next websocket-service (same as browser VOIP wrapper).
|
|
429
|
+
*/
|
|
430
|
+
declare class MemberStatusWebSocketClient {
|
|
431
|
+
private readonly url;
|
|
432
|
+
private readonly maxReconnectAttempts;
|
|
433
|
+
private readonly reconnectDelayMs;
|
|
434
|
+
private readonly onStatusUpdate?;
|
|
435
|
+
private readonly onConnected?;
|
|
436
|
+
private readonly onDisconnected?;
|
|
437
|
+
private readonly onError?;
|
|
438
|
+
private ws;
|
|
439
|
+
private reconnectTimeout;
|
|
440
|
+
private reconnectAttempts;
|
|
441
|
+
private isConnecting;
|
|
442
|
+
private intentionalClose;
|
|
443
|
+
private readonly statusMap;
|
|
444
|
+
constructor(options: MemberStatusWebSocketOptions);
|
|
445
|
+
get isConnected(): boolean;
|
|
446
|
+
getStatus(memberId: number): MemberStatus | undefined;
|
|
447
|
+
getStatusMap(): ReadonlyMap<number, MemberStatus>;
|
|
448
|
+
connect(): void;
|
|
449
|
+
disconnect(): void;
|
|
450
|
+
destroy(): void;
|
|
451
|
+
private clearReconnectTimeout;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/** Default API base URL when `serverUrl` is omitted (nextdev). */
|
|
455
|
+
declare const DEFAULT_SERVER_URL = "https://nextdev.zyratalk.com/api/trpc";
|
|
456
|
+
/** Default member-status WebSocket URL when `websocketUrl` is omitted (nextdev). */
|
|
457
|
+
declare const DEFAULT_WEBSOCKET_URL = "wss://nextdev.zyratalk.com/websocket/";
|
|
458
|
+
|
|
373
459
|
/**
|
|
374
460
|
* Backward-compatible wrapper class retaining the original export name.
|
|
375
461
|
* Existing consumers can continue to construct `new ZyraTwilioWrapper(config)`.
|
|
@@ -390,4 +476,4 @@ declare class ZyraTwilioWrapper extends ReactNativeVoipSdk {
|
|
|
390
476
|
destroy(): void;
|
|
391
477
|
}
|
|
392
478
|
|
|
393
|
-
export { type AuthPayload, type CallSession, type ConsumerAuth, type NativeModule, type Participant, ReactNativeVoipSdk, type SDKConfig, type SDKEventName, ZyraTwilioWrapper as default };
|
|
479
|
+
export { type AuthPayload, type CallSession, type ConsumerAuth, DEFAULT_SERVER_URL, DEFAULT_WEBSOCKET_URL, type MemberStatus, type MemberStatusUpdate, MemberStatusWebSocketClient, type NativeModule, type Participant, ReactNativeVoipSdk, type SDKConfig, type SDKEventName, ZyraTwilioWrapper as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
|
+
type MemberStatus = "Idle" | "Active" | "Ringing" | "ringing";
|
|
2
|
+
interface MemberStatusUpdate {
|
|
3
|
+
memberId: number;
|
|
4
|
+
status: MemberStatus;
|
|
5
|
+
timestamp: string;
|
|
6
|
+
}
|
|
1
7
|
interface Config {
|
|
2
8
|
serverUrl: string;
|
|
3
9
|
identity: string;
|
|
4
10
|
waitUrl?: string;
|
|
5
11
|
sdkToken: string;
|
|
12
|
+
/** WebSocket URL for member status (default: wss://nextdev.zyratalk.com/websocket) */
|
|
13
|
+
websocketUrl?: string;
|
|
14
|
+
/** Connect member-status WebSocket after init (default: true) */
|
|
15
|
+
autoConnectMemberStatus?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Routing member id for this agent. When set, Idle status updates for this member
|
|
18
|
+
* dismiss a ringing incoming call if the caller hung up before answer.
|
|
19
|
+
*/
|
|
20
|
+
memberId?: number;
|
|
6
21
|
accessToken?: string;
|
|
7
22
|
enableAndroidVoiceRegister?: boolean;
|
|
8
23
|
requestTimeoutMs?: number;
|
|
@@ -79,6 +94,11 @@ interface WelcomeConfigResult {
|
|
|
79
94
|
welcomeType: WelcomeType;
|
|
80
95
|
routingConfigId: number;
|
|
81
96
|
}
|
|
97
|
+
interface HoldMusicUrlConfigResult {
|
|
98
|
+
success: boolean;
|
|
99
|
+
message: string;
|
|
100
|
+
routingConfigId: number;
|
|
101
|
+
}
|
|
82
102
|
/**
|
|
83
103
|
* Routing Config
|
|
84
104
|
*/
|
|
@@ -316,16 +336,28 @@ declare class BridgeClient {
|
|
|
316
336
|
|
|
317
337
|
declare class ReactNativeVoipSdk {
|
|
318
338
|
private readonly sdkConfig;
|
|
339
|
+
private readonly websocketUrl;
|
|
340
|
+
private readonly autoConnectMemberStatus;
|
|
341
|
+
private readonly memberId?;
|
|
319
342
|
protected readonly bridge: BridgeClient;
|
|
320
343
|
private readonly retry;
|
|
321
344
|
private readonly authManager;
|
|
322
345
|
private readonly callEngine;
|
|
323
346
|
private readonly conferenceManager;
|
|
324
347
|
private readonly configService;
|
|
348
|
+
private memberStatusWebSocket;
|
|
325
349
|
private initialized;
|
|
326
350
|
protected activeCallId: string | null;
|
|
327
351
|
protected internalConferenceName: string;
|
|
352
|
+
private pendingIncomingCallId;
|
|
353
|
+
private incomingCallAccepted;
|
|
354
|
+
onMemberStatusUpdate?: (update: MemberStatusUpdate) => void;
|
|
355
|
+
onMemberStatusWebSocketConnected?: () => void;
|
|
356
|
+
onMemberStatusWebSocketDisconnected?: () => void;
|
|
328
357
|
constructor(config: Config, nativeModule?: NativeModule);
|
|
358
|
+
private setupIncomingCallTracking;
|
|
359
|
+
private handleMemberStatusUpdate;
|
|
360
|
+
private dismissIncomingCallFromMemberIdle;
|
|
329
361
|
on(eventName: SDKEventName | string, listener: (payload: Record<string, unknown>) => void): () => void;
|
|
330
362
|
initializeSDK(config?: Partial<SDKConfig>): Promise<void>;
|
|
331
363
|
authenticate(payload?: AuthPayload): Promise<ConsumerAuth>;
|
|
@@ -366,10 +398,64 @@ declare class ReactNativeVoipSdk {
|
|
|
366
398
|
deregisterWebhook(): Promise<CallResponse<null>>;
|
|
367
399
|
isWebhookConfigured(): Promise<CallResponse<WebhookConfigResult>>;
|
|
368
400
|
welcomeMessageConfig(welcomeType: "audio" | "tts", welcomeMessage: string): Promise<CallResponse<WelcomeConfigResult>>;
|
|
401
|
+
/**
|
|
402
|
+
* Set hold music audio URL (MP3 or WAV HTTPS URL, e.g. from upload-audio).
|
|
403
|
+
*/
|
|
404
|
+
holdMusicUrlConfig(audioUrl: string): Promise<CallResponse<HoldMusicUrlConfigResult>>;
|
|
405
|
+
/**
|
|
406
|
+
* Connect to member status WebSocket (default: wss://nextdev.zyratalk.com/websocket).
|
|
407
|
+
*/
|
|
408
|
+
connectMemberStatusWebSocket(url?: string): void;
|
|
409
|
+
disconnectMemberStatusWebSocket(): void;
|
|
410
|
+
get isMemberStatusWebSocketConnected(): boolean;
|
|
411
|
+
getMemberStatus(memberId: number): MemberStatus | undefined;
|
|
412
|
+
getMemberStatusMap(): ReadonlyMap<number, MemberStatus>;
|
|
369
413
|
destroy(): void;
|
|
370
414
|
private ensureAuthenticated;
|
|
371
415
|
}
|
|
372
416
|
|
|
417
|
+
interface MemberStatusWebSocketOptions {
|
|
418
|
+
url: string;
|
|
419
|
+
maxReconnectAttempts?: number;
|
|
420
|
+
reconnectDelayMs?: number;
|
|
421
|
+
onStatusUpdate?: (update: MemberStatusUpdate) => void;
|
|
422
|
+
onConnected?: () => void;
|
|
423
|
+
onDisconnected?: () => void;
|
|
424
|
+
onError?: (error: Error) => void;
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* WebSocket client for real-time routing member status updates.
|
|
428
|
+
* Protocol matches zyratalk-next websocket-service (same as browser VOIP wrapper).
|
|
429
|
+
*/
|
|
430
|
+
declare class MemberStatusWebSocketClient {
|
|
431
|
+
private readonly url;
|
|
432
|
+
private readonly maxReconnectAttempts;
|
|
433
|
+
private readonly reconnectDelayMs;
|
|
434
|
+
private readonly onStatusUpdate?;
|
|
435
|
+
private readonly onConnected?;
|
|
436
|
+
private readonly onDisconnected?;
|
|
437
|
+
private readonly onError?;
|
|
438
|
+
private ws;
|
|
439
|
+
private reconnectTimeout;
|
|
440
|
+
private reconnectAttempts;
|
|
441
|
+
private isConnecting;
|
|
442
|
+
private intentionalClose;
|
|
443
|
+
private readonly statusMap;
|
|
444
|
+
constructor(options: MemberStatusWebSocketOptions);
|
|
445
|
+
get isConnected(): boolean;
|
|
446
|
+
getStatus(memberId: number): MemberStatus | undefined;
|
|
447
|
+
getStatusMap(): ReadonlyMap<number, MemberStatus>;
|
|
448
|
+
connect(): void;
|
|
449
|
+
disconnect(): void;
|
|
450
|
+
destroy(): void;
|
|
451
|
+
private clearReconnectTimeout;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/** Default API base URL when `serverUrl` is omitted (nextdev). */
|
|
455
|
+
declare const DEFAULT_SERVER_URL = "https://nextdev.zyratalk.com/api/trpc";
|
|
456
|
+
/** Default member-status WebSocket URL when `websocketUrl` is omitted (nextdev). */
|
|
457
|
+
declare const DEFAULT_WEBSOCKET_URL = "wss://nextdev.zyratalk.com/websocket/";
|
|
458
|
+
|
|
373
459
|
/**
|
|
374
460
|
* Backward-compatible wrapper class retaining the original export name.
|
|
375
461
|
* Existing consumers can continue to construct `new ZyraTwilioWrapper(config)`.
|
|
@@ -390,4 +476,4 @@ declare class ZyraTwilioWrapper extends ReactNativeVoipSdk {
|
|
|
390
476
|
destroy(): void;
|
|
391
477
|
}
|
|
392
478
|
|
|
393
|
-
export { type AuthPayload, type CallSession, type ConsumerAuth, type NativeModule, type Participant, ReactNativeVoipSdk, type SDKConfig, type SDKEventName, ZyraTwilioWrapper as default };
|
|
479
|
+
export { type AuthPayload, type CallSession, type ConsumerAuth, DEFAULT_SERVER_URL, DEFAULT_WEBSOCKET_URL, type MemberStatus, type MemberStatusUpdate, MemberStatusWebSocketClient, type NativeModule, type Participant, ReactNativeVoipSdk, type SDKConfig, type SDKEventName, ZyraTwilioWrapper as default };
|