@vibexnpm/talkx 8.4.1 → 8.5.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 CHANGED
@@ -1340,6 +1340,71 @@ export interface RoomUnreadUpdatedEvent {
1340
1340
  unreadVersion: number;
1341
1341
  }
1342
1342
 
1343
+ /** Gmail 새 메일 미리보기 — 서버 `MAIL_CHANGED.messages[]` 원소. 본문은 없다. */
1344
+ export interface MailPreview {
1345
+ messageId: string;
1346
+ threadId?: string | null;
1347
+ from?: { name?: string | null; email: string } | null;
1348
+ subject?: string | null;
1349
+ /** ISO-8601 UTC. */
1350
+ receivedAt?: string | null;
1351
+ }
1352
+
1353
+ /**
1354
+ * `mailChanged` 이벤트 — 서버 `/user/queue/mail` 그대로. 받으면 열려 있는 메일 목록·안읽은 수를 다시 읽는다.
1355
+ * 읽음·보관 같은 변화면 `messages` 가 비어 있다(새 메일 알림을 띄우지 않는다).
1356
+ */
1357
+ export interface MailChangedEvent {
1358
+ eventType: 'MAIL_CHANGED';
1359
+ connectionId: string;
1360
+ /** 받은메일함 안읽은 수, 모르면 -1. */
1361
+ inboxUnread: number;
1362
+ newMessages: number;
1363
+ /** true 면 놓친 변화가 있을 수 있다 — 목록을 첫 쪽부터 다시 읽는다. */
1364
+ resync: boolean;
1365
+ timestamp: string;
1366
+ messages: MailPreview[];
1367
+ }
1368
+
1369
+ /**
1370
+ * `newMail` 이벤트 — 새 메일 한 통. 웹소켓 미리보기(`source: 'socket'`)와 포그라운드 FCM 메일 푸시(`source: 'push'`)를
1371
+ * `(projectId, connectionId, messageId)` 로 합쳐 메일마다 한 번만 온다.
1372
+ */
1373
+ export interface NewMailEvent {
1374
+ projectId: string | null;
1375
+ connectionId: string;
1376
+ messageId: string;
1377
+ threadId: string | null;
1378
+ /** 보낸 사람 표시(이름, 없으면 주소). */
1379
+ sender: string | null;
1380
+ /** 웹소켓으로 왔을 때만. */
1381
+ from: { name?: string | null; email: string } | null;
1382
+ subject: string | null;
1383
+ /** 웹소켓으로 왔을 때만(ISO-8601 UTC). */
1384
+ receivedAt: string | null;
1385
+ source: 'socket' | 'push';
1386
+ }
1387
+
1388
+ /**
1389
+ * `newMailSummary` 이벤트 — 한 번에 4통 이상 온 묶음 푸시(포그라운드). 받은메일함을 다시 읽는다.
1390
+ * 묶은 메일 중 아직 `newMail` 로 알리지 않은 것만 센다 — 전부 알린 메일이면 오지 않는다.
1391
+ */
1392
+ export interface NewMailSummaryEvent {
1393
+ projectId: string | null;
1394
+ connectionId: string;
1395
+ /** 처음 알리는 메일 수(구버전 서버의 묶음이면 서버가 준 건수). */
1396
+ count: number | null;
1397
+ /** 처음 알리는 메일 ID(구버전 서버의 묶음이면 빈 배열). */
1398
+ messageIds: string[];
1399
+ source: 'push';
1400
+ }
1401
+
1402
+ /** 알림 클릭으로 열린 앱이 꺼내는 메일 이동 — `messageId` 가 없으면(묶음 알림) 받은메일함으로. */
1403
+ export interface PendingMail {
1404
+ connectionId: string;
1405
+ messageId: string | null;
1406
+ }
1407
+
1343
1408
  /** 포그라운드 푸시 알림 payload. */
1344
1409
  export interface PushNotificationPayload {
1345
1410
  title: string;
@@ -1980,6 +2045,9 @@ export interface TalkFlowClientEvents {
1980
2045
  roomListRoomUpdated: RoomListUpdateEvent;
1981
2046
  /** 내가 어느 기기에서 읽든 방별 미독 절대값(+version)을 통지 — 크로스-디바이스 badge 동기화. */
1982
2047
  roomListUnreadUpdated: RoomUnreadUpdatedEvent;
2048
+ mailSubscribed: Record<string, unknown>;
2049
+ mailUnsubscribed: Record<string, unknown>;
2050
+ mailChanged: MailChangedEvent;
1983
2051
  retentionCleanup: RetentionCleanupPayload;
1984
2052
 
1985
2053
  // 갭 복구 — 복구된 메시지 자체는 일반 chatMessage 로 재생되므로 아래는 모두 선택 구독용.
@@ -2010,6 +2078,10 @@ export interface TalkFlowClientEvents {
2010
2078
  */
2011
2079
  pushFailed: PushFailedPayload;
2012
2080
  pushNotification: PushNotificationPayload;
2081
+ /** Gmail 새 메일 한 통 — 웹소켓·포그라운드 푸시를 합쳐 메일마다 한 번. 메일 푸시는 pushNotification 으로 오지 않는다. */
2082
+ newMail: NewMailEvent;
2083
+ /** Gmail 묶음 푸시(4통 이상) — 포그라운드. */
2084
+ newMailSummary: NewMailSummaryEvent;
2013
2085
 
2014
2086
  // WebRTC (re-emit from WebRTCClient)
2015
2087
  localStreamStarted: unknown;
@@ -2087,6 +2159,9 @@ export interface ChatClientEvents {
2087
2159
  roomListRoomUpdated: RoomListUpdateEvent;
2088
2160
  /** 내가 어느 기기에서 읽든 방별 미독 절대값(+version)을 통지 — 크로스-디바이스 badge 동기화. */
2089
2161
  roomListUnreadUpdated: RoomUnreadUpdatedEvent;
2162
+ mailSubscribed: Record<string, unknown>;
2163
+ mailUnsubscribed: Record<string, unknown>;
2164
+ mailChanged: MailChangedEvent;
2090
2165
  retentionCleanup: RetentionCleanupPayload;
2091
2166
  messageRead: MessageReadEventPayload;
2092
2167
  typing: TypingEvent;
@@ -2297,6 +2372,10 @@ export class ChatClient implements SdkEventEmitter<ChatClientEvents> {
2297
2372
  subscribeRoomList(): Promise<void>;
2298
2373
  unsubscribeRoomList(): void;
2299
2374
  isRoomListSubscribed(): boolean;
2375
+ /** Gmail 메일함 변화 구독(`/user/queue/mail`) — 자동 구독하지 않는다. */
2376
+ subscribeMail(): Promise<void>;
2377
+ unsubscribeMail(): void;
2378
+ isMailSubscribed(): boolean;
2300
2379
  getSubscribedRooms(): string[];
2301
2380
  isSubscribed(roomId: string): boolean;
2302
2381
 
@@ -2447,6 +2526,8 @@ export const PushErrorCode: {
2447
2526
 
2448
2527
  export class PushManager {
2449
2528
  consumePendingRoom(): Promise<string | null>;
2529
+ /** 알림 클릭(cold start)으로 저장된 Gmail 메일 이동을 꺼내고 지운다 — 10분 안의 것만. */
2530
+ consumePendingMail(): Promise<PendingMail | null>;
2450
2531
  reset(): void;
2451
2532
  getToken(): string | null;
2452
2533
  isEnabled(): boolean;
@@ -2457,6 +2538,7 @@ export class PushManager {
2457
2538
  /** 현재 디바이스의 푸시 수신 여부 토글. */
2458
2539
  setCurrentDeviceEnabled(enabled: boolean): Promise<void>;
2459
2540
  static consumePendingRoom(projectId?: string): Promise<string | null>;
2541
+ static consumePendingMail(projectId?: string): Promise<PendingMail | null>;
2460
2542
  /**
2461
2543
  * 현재 브라우저의 푸시 권한 상태. 인스턴스 없이도 호출 가능.
2462
2544
  */
@@ -2588,6 +2670,8 @@ export default class TalkFlowClient implements SdkEventEmitter<TalkFlowClientEve
2588
2670
  /** 푸시 상태 초기화 — 로그아웃 또는 사용자 전환 시 호출. logout() 내부에서 자동 호출됨. */
2589
2671
  resetPush(): void;
2590
2672
  consumePendingRoom(): Promise<string | null>;
2673
+ /** 알림 클릭(cold start)으로 저장된 Gmail 메일 이동을 꺼내고 지운다 — 앱 부팅 때 한 번. */
2674
+ consumePendingMail(): Promise<PendingMail | null>;
2591
2675
  /** 현재 디바이스의 푸시 수신 여부 토글. enable 선행 안 됐으면 undefined 반환. */
2592
2676
  setCurrentDeviceEnabled(enabled: boolean): Promise<void> | undefined;
2593
2677
  /** 특정 디바이스 토글 (관리 UI 용). enable 선행 안 됐으면 undefined 반환. */
@@ -2750,6 +2834,10 @@ export default class TalkFlowClient implements SdkEventEmitter<TalkFlowClientEve
2750
2834
  subscribeRoomList(): Promise<void>;
2751
2835
  unsubscribeRoomList(): void;
2752
2836
  isRoomListSubscribed(): boolean;
2837
+ /** Gmail 메일함 변화 구독(`/user/queue/mail`) — 자동 구독하지 않는다. */
2838
+ subscribeMail(): Promise<void>;
2839
+ unsubscribeMail(): void;
2840
+ isMailSubscribed(): boolean;
2753
2841
  getSubscribedRooms(): string[];
2754
2842
  isSubscribed(roomId: string): boolean;
2755
2843