@vibexnpm/talkx 8.4.1 → 8.6.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.
- package/dist/index.d.ts +108 -2
- package/dist/talkflow-sdk.esm.js +1 -1
- package/dist/talkflow-sdk.esm.js.map +1 -1
- package/dist/talkflow-sdk.standalone.js +1 -1
- package/dist/talkflow-sdk.standalone.js.map +1 -1
- package/dist/talkflow-sdk.umd.js +1 -1
- package/dist/talkflow-sdk.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/TalkFlowClient.js +1 -0
- package/src/chat/ChatClient.js +110 -17
- package/src/constants.js +5 -0
- package/src/core/ConnectionManager.js +166 -63
- package/src/push/PushManager.js +72 -0
- package/src/talkflow/delegates.js +3 -0
- package/src/talkflow/eventForwarding.js +8 -0
- package/src/talkflow/mailNotifications.js +154 -0
- package/src/talkflow/session.js +14 -0
- package/src/webrtc/PeerConnectionManager.js +10 -1
- package/src/webrtc/WebRTCClient.js +287 -28
- package/types/index.d.ts +108 -2
package/types/index.d.ts
CHANGED
|
@@ -577,6 +577,7 @@ export const DefaultConfig: {
|
|
|
577
577
|
readonly environment: EnvironmentValue;
|
|
578
578
|
readonly reconnectDelay: number;
|
|
579
579
|
readonly maxReconnectAttempts: number;
|
|
580
|
+
readonly reconnectRecoveryDelay: number;
|
|
580
581
|
readonly heartbeatIncoming: number;
|
|
581
582
|
readonly heartbeatOutgoing: number;
|
|
582
583
|
readonly apiTimeout: number;
|
|
@@ -1340,6 +1341,71 @@ export interface RoomUnreadUpdatedEvent {
|
|
|
1340
1341
|
unreadVersion: number;
|
|
1341
1342
|
}
|
|
1342
1343
|
|
|
1344
|
+
/** Gmail 새 메일 미리보기 — 서버 `MAIL_CHANGED.messages[]` 원소. 본문은 없다. */
|
|
1345
|
+
export interface MailPreview {
|
|
1346
|
+
messageId: string;
|
|
1347
|
+
threadId?: string | null;
|
|
1348
|
+
from?: { name?: string | null; email: string } | null;
|
|
1349
|
+
subject?: string | null;
|
|
1350
|
+
/** ISO-8601 UTC. */
|
|
1351
|
+
receivedAt?: string | null;
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
/**
|
|
1355
|
+
* `mailChanged` 이벤트 — 서버 `/user/queue/mail` 그대로. 받으면 열려 있는 메일 목록·안읽은 수를 다시 읽는다.
|
|
1356
|
+
* 읽음·보관 같은 변화면 `messages` 가 비어 있다(새 메일 알림을 띄우지 않는다).
|
|
1357
|
+
*/
|
|
1358
|
+
export interface MailChangedEvent {
|
|
1359
|
+
eventType: 'MAIL_CHANGED';
|
|
1360
|
+
connectionId: string;
|
|
1361
|
+
/** 받은메일함 안읽은 수, 모르면 -1. */
|
|
1362
|
+
inboxUnread: number;
|
|
1363
|
+
newMessages: number;
|
|
1364
|
+
/** true 면 놓친 변화가 있을 수 있다 — 목록을 첫 쪽부터 다시 읽는다. */
|
|
1365
|
+
resync: boolean;
|
|
1366
|
+
timestamp: string;
|
|
1367
|
+
messages: MailPreview[];
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
/**
|
|
1371
|
+
* `newMail` 이벤트 — 새 메일 한 통. 웹소켓 미리보기(`source: 'socket'`)와 포그라운드 FCM 메일 푸시(`source: 'push'`)를
|
|
1372
|
+
* `(projectId, connectionId, messageId)` 로 합쳐 메일마다 한 번만 온다.
|
|
1373
|
+
*/
|
|
1374
|
+
export interface NewMailEvent {
|
|
1375
|
+
projectId: string | null;
|
|
1376
|
+
connectionId: string;
|
|
1377
|
+
messageId: string;
|
|
1378
|
+
threadId: string | null;
|
|
1379
|
+
/** 보낸 사람 표시(이름, 없으면 주소). */
|
|
1380
|
+
sender: string | null;
|
|
1381
|
+
/** 웹소켓으로 왔을 때만. */
|
|
1382
|
+
from: { name?: string | null; email: string } | null;
|
|
1383
|
+
subject: string | null;
|
|
1384
|
+
/** 웹소켓으로 왔을 때만(ISO-8601 UTC). */
|
|
1385
|
+
receivedAt: string | null;
|
|
1386
|
+
source: 'socket' | 'push';
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
/**
|
|
1390
|
+
* `newMailSummary` 이벤트 — 한 번에 4통 이상 온 묶음 푸시(포그라운드). 받은메일함을 다시 읽는다.
|
|
1391
|
+
* 묶은 메일 중 아직 `newMail` 로 알리지 않은 것만 센다 — 전부 알린 메일이면 오지 않는다.
|
|
1392
|
+
*/
|
|
1393
|
+
export interface NewMailSummaryEvent {
|
|
1394
|
+
projectId: string | null;
|
|
1395
|
+
connectionId: string;
|
|
1396
|
+
/** 처음 알리는 메일 수(구버전 서버의 묶음이면 서버가 준 건수). */
|
|
1397
|
+
count: number | null;
|
|
1398
|
+
/** 처음 알리는 메일 ID(구버전 서버의 묶음이면 빈 배열). */
|
|
1399
|
+
messageIds: string[];
|
|
1400
|
+
source: 'push';
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
/** 알림 클릭으로 열린 앱이 꺼내는 메일 이동 — `messageId` 가 없으면(묶음 알림) 받은메일함으로. */
|
|
1404
|
+
export interface PendingMail {
|
|
1405
|
+
connectionId: string;
|
|
1406
|
+
messageId: string | null;
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1343
1409
|
/** 포그라운드 푸시 알림 payload. */
|
|
1344
1410
|
export interface PushNotificationPayload {
|
|
1345
1411
|
title: string;
|
|
@@ -1544,6 +1610,8 @@ export interface TalkFlowClientOptions {
|
|
|
1544
1610
|
maxReconnectDelay?: number;
|
|
1545
1611
|
/** 최대 재연결 시도. 기본 10. */
|
|
1546
1612
|
maxReconnectAttempts?: number;
|
|
1613
|
+
/** 기존 연결의 재시도 소진 후 자동 복구 대기(ms, 기본 60000, ±20% 지터). 0이면 비활성화. */
|
|
1614
|
+
reconnectRecoveryDelay?: number;
|
|
1547
1615
|
/** 수신 하트비트 간격 (ms). 기본 10000. */
|
|
1548
1616
|
heartbeatIncoming?: number;
|
|
1549
1617
|
/** 발신 하트비트 간격 (ms). 기본 10000. */
|
|
@@ -1980,6 +2048,9 @@ export interface TalkFlowClientEvents {
|
|
|
1980
2048
|
roomListRoomUpdated: RoomListUpdateEvent;
|
|
1981
2049
|
/** 내가 어느 기기에서 읽든 방별 미독 절대값(+version)을 통지 — 크로스-디바이스 badge 동기화. */
|
|
1982
2050
|
roomListUnreadUpdated: RoomUnreadUpdatedEvent;
|
|
2051
|
+
mailSubscribed: Record<string, unknown>;
|
|
2052
|
+
mailUnsubscribed: Record<string, unknown>;
|
|
2053
|
+
mailChanged: MailChangedEvent;
|
|
1983
2054
|
retentionCleanup: RetentionCleanupPayload;
|
|
1984
2055
|
|
|
1985
2056
|
// 갭 복구 — 복구된 메시지 자체는 일반 chatMessage 로 재생되므로 아래는 모두 선택 구독용.
|
|
@@ -2010,6 +2081,10 @@ export interface TalkFlowClientEvents {
|
|
|
2010
2081
|
*/
|
|
2011
2082
|
pushFailed: PushFailedPayload;
|
|
2012
2083
|
pushNotification: PushNotificationPayload;
|
|
2084
|
+
/** Gmail 새 메일 한 통 — 웹소켓·포그라운드 푸시를 합쳐 메일마다 한 번. 메일 푸시는 pushNotification 으로 오지 않는다. */
|
|
2085
|
+
newMail: NewMailEvent;
|
|
2086
|
+
/** Gmail 묶음 푸시(4통 이상) — 포그라운드. */
|
|
2087
|
+
newMailSummary: NewMailSummaryEvent;
|
|
2013
2088
|
|
|
2014
2089
|
// WebRTC (re-emit from WebRTCClient)
|
|
2015
2090
|
localStreamStarted: unknown;
|
|
@@ -2021,6 +2096,8 @@ export interface TalkFlowClientEvents {
|
|
|
2021
2096
|
mediaStateChanged: unknown;
|
|
2022
2097
|
callStarted: unknown;
|
|
2023
2098
|
callEnded: unknown;
|
|
2099
|
+
/** 그룹 통화 재참가가 불가능해 로컬 통화를 종료한 경우. */
|
|
2100
|
+
callRecoveryFailed: { roomId: string; error: unknown };
|
|
2024
2101
|
callRequested: unknown;
|
|
2025
2102
|
callAccepted: unknown;
|
|
2026
2103
|
callRejected: unknown;
|
|
@@ -2087,6 +2164,9 @@ export interface ChatClientEvents {
|
|
|
2087
2164
|
roomListRoomUpdated: RoomListUpdateEvent;
|
|
2088
2165
|
/** 내가 어느 기기에서 읽든 방별 미독 절대값(+version)을 통지 — 크로스-디바이스 badge 동기화. */
|
|
2089
2166
|
roomListUnreadUpdated: RoomUnreadUpdatedEvent;
|
|
2167
|
+
mailSubscribed: Record<string, unknown>;
|
|
2168
|
+
mailUnsubscribed: Record<string, unknown>;
|
|
2169
|
+
mailChanged: MailChangedEvent;
|
|
2090
2170
|
retentionCleanup: RetentionCleanupPayload;
|
|
2091
2171
|
messageRead: MessageReadEventPayload;
|
|
2092
2172
|
typing: TypingEvent;
|
|
@@ -2111,6 +2191,8 @@ export interface WebRTCClientEvents {
|
|
|
2111
2191
|
error: unknown;
|
|
2112
2192
|
callStarted: unknown;
|
|
2113
2193
|
callEnded: unknown;
|
|
2194
|
+
/** 그룹 통화 재참가가 불가능해 로컬 통화를 종료한 경우. */
|
|
2195
|
+
callRecoveryFailed: { roomId: string; error: unknown };
|
|
2114
2196
|
callRequested: unknown;
|
|
2115
2197
|
callAccepted: unknown;
|
|
2116
2198
|
callRejected: unknown;
|
|
@@ -2297,6 +2379,10 @@ export class ChatClient implements SdkEventEmitter<ChatClientEvents> {
|
|
|
2297
2379
|
subscribeRoomList(): Promise<void>;
|
|
2298
2380
|
unsubscribeRoomList(): void;
|
|
2299
2381
|
isRoomListSubscribed(): boolean;
|
|
2382
|
+
/** Gmail 메일함 변화 구독(`/user/queue/mail`) — 자동 구독하지 않는다. */
|
|
2383
|
+
subscribeMail(): Promise<void>;
|
|
2384
|
+
unsubscribeMail(): void;
|
|
2385
|
+
isMailSubscribed(): boolean;
|
|
2300
2386
|
getSubscribedRooms(): string[];
|
|
2301
2387
|
isSubscribed(roomId: string): boolean;
|
|
2302
2388
|
|
|
@@ -2315,6 +2401,13 @@ export class ChatClient implements SdkEventEmitter<ChatClientEvents> {
|
|
|
2315
2401
|
resumeAssistantStreams(reason?: string): Promise<void>;
|
|
2316
2402
|
}
|
|
2317
2403
|
|
|
2404
|
+
/** POST /api/v1/webrtc/rooms 요청. 생략한 값은 서버 기본값을 사용합니다. */
|
|
2405
|
+
export interface CreateCallRoomRequest {
|
|
2406
|
+
invitedUsers?: string[];
|
|
2407
|
+
title?: string;
|
|
2408
|
+
maxParticipants?: number;
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2318
2411
|
export class WebRTCClient implements SdkEventEmitter<WebRTCClientEvents> {
|
|
2319
2412
|
on<K extends keyof WebRTCClientEvents>(event: K, listener: (payload: WebRTCClientEvents[K]) => void): () => void;
|
|
2320
2413
|
once<K extends keyof WebRTCClientEvents>(event: K, listener: (payload: WebRTCClientEvents[K]) => void): () => void;
|
|
@@ -2326,7 +2419,7 @@ export class WebRTCClient implements SdkEventEmitter<WebRTCClientEvents> {
|
|
|
2326
2419
|
initializeIceServers(): Promise<RTCIceServer[]>;
|
|
2327
2420
|
getTurnCredentials(): Promise<{ iceServers: RTCIceServer[] }>;
|
|
2328
2421
|
|
|
2329
|
-
createCallRoom(data:
|
|
2422
|
+
createCallRoom(data: CreateCallRoomRequest): Promise<unknown>;
|
|
2330
2423
|
getCallRoom(roomId: string): Promise<unknown>;
|
|
2331
2424
|
joinCallRoomApi(roomId: string): Promise<unknown>;
|
|
2332
2425
|
leaveCallRoomApi(roomId: string): Promise<unknown>;
|
|
@@ -2447,6 +2540,8 @@ export const PushErrorCode: {
|
|
|
2447
2540
|
|
|
2448
2541
|
export class PushManager {
|
|
2449
2542
|
consumePendingRoom(): Promise<string | null>;
|
|
2543
|
+
/** 알림 클릭(cold start)으로 저장된 Gmail 메일 이동을 꺼내고 지운다 — 10분 안의 것만. */
|
|
2544
|
+
consumePendingMail(): Promise<PendingMail | null>;
|
|
2450
2545
|
reset(): void;
|
|
2451
2546
|
getToken(): string | null;
|
|
2452
2547
|
isEnabled(): boolean;
|
|
@@ -2457,6 +2552,7 @@ export class PushManager {
|
|
|
2457
2552
|
/** 현재 디바이스의 푸시 수신 여부 토글. */
|
|
2458
2553
|
setCurrentDeviceEnabled(enabled: boolean): Promise<void>;
|
|
2459
2554
|
static consumePendingRoom(projectId?: string): Promise<string | null>;
|
|
2555
|
+
static consumePendingMail(projectId?: string): Promise<PendingMail | null>;
|
|
2460
2556
|
/**
|
|
2461
2557
|
* 현재 브라우저의 푸시 권한 상태. 인스턴스 없이도 호출 가능.
|
|
2462
2558
|
*/
|
|
@@ -2549,6 +2645,10 @@ export default class TalkFlowClient implements SdkEventEmitter<TalkFlowClientEve
|
|
|
2549
2645
|
changeMyPassword(params: { currentPassword: string; newPassword: string }): Promise<unknown>;
|
|
2550
2646
|
|
|
2551
2647
|
// Connection lifecycle
|
|
2648
|
+
/**
|
|
2649
|
+
* 연결 완료까지 기다립니다. 이전 연결의 자동 복구가 이어지는 동안 재시도 한도 소진으로 reject하지 않습니다.
|
|
2650
|
+
* 복구 연결 시 resolve하며, 명시적 disconnect·인증 종료·최초 연결 실패 시 reject합니다.
|
|
2651
|
+
*/
|
|
2552
2652
|
connect(jwt?: string, options?: ConnectOptions): Promise<void>;
|
|
2553
2653
|
disconnect(): Promise<void>;
|
|
2554
2654
|
logout(): Promise<void>;
|
|
@@ -2588,6 +2688,8 @@ export default class TalkFlowClient implements SdkEventEmitter<TalkFlowClientEve
|
|
|
2588
2688
|
/** 푸시 상태 초기화 — 로그아웃 또는 사용자 전환 시 호출. logout() 내부에서 자동 호출됨. */
|
|
2589
2689
|
resetPush(): void;
|
|
2590
2690
|
consumePendingRoom(): Promise<string | null>;
|
|
2691
|
+
/** 알림 클릭(cold start)으로 저장된 Gmail 메일 이동을 꺼내고 지운다 — 앱 부팅 때 한 번. */
|
|
2692
|
+
consumePendingMail(): Promise<PendingMail | null>;
|
|
2591
2693
|
/** 현재 디바이스의 푸시 수신 여부 토글. enable 선행 안 됐으면 undefined 반환. */
|
|
2592
2694
|
setCurrentDeviceEnabled(enabled: boolean): Promise<void> | undefined;
|
|
2593
2695
|
/** 특정 디바이스 토글 (관리 UI 용). enable 선행 안 됐으면 undefined 반환. */
|
|
@@ -2750,6 +2852,10 @@ export default class TalkFlowClient implements SdkEventEmitter<TalkFlowClientEve
|
|
|
2750
2852
|
subscribeRoomList(): Promise<void>;
|
|
2751
2853
|
unsubscribeRoomList(): void;
|
|
2752
2854
|
isRoomListSubscribed(): boolean;
|
|
2855
|
+
/** Gmail 메일함 변화 구독(`/user/queue/mail`) — 자동 구독하지 않는다. */
|
|
2856
|
+
subscribeMail(): Promise<void>;
|
|
2857
|
+
unsubscribeMail(): void;
|
|
2858
|
+
isMailSubscribed(): boolean;
|
|
2753
2859
|
getSubscribedRooms(): string[];
|
|
2754
2860
|
isSubscribed(roomId: string): boolean;
|
|
2755
2861
|
|
|
@@ -2771,7 +2877,7 @@ export default class TalkFlowClient implements SdkEventEmitter<TalkFlowClientEve
|
|
|
2771
2877
|
initializeIceServers(): Promise<RTCIceServer[]>;
|
|
2772
2878
|
getTurnCredentials(): Promise<{ iceServers: RTCIceServer[] }>;
|
|
2773
2879
|
|
|
2774
|
-
createCallRoom(data:
|
|
2880
|
+
createCallRoom(data: CreateCallRoomRequest): Promise<unknown>;
|
|
2775
2881
|
getCallRoom(roomId: string): Promise<unknown>;
|
|
2776
2882
|
joinCallRoomApi(roomId: string): Promise<unknown>;
|
|
2777
2883
|
leaveCallRoomApi(roomId: string): Promise<unknown>;
|