@imessaging/core 0.8.8 → 0.8.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imessaging/core",
3
- "version": "0.8.8",
3
+ "version": "0.8.10",
4
4
  "description": "Core messaging transport contracts and Telegram peer storage",
5
5
  "keywords": [
6
6
  "messaging",
package/src/index.ts CHANGED
@@ -18,6 +18,7 @@ export {
18
18
  canFindByPhone,
19
19
  canSaveContact,
20
20
  canMarkRead,
21
+ canObserveOutgoingRead,
21
22
  canReact,
22
23
  canReceive,
23
24
  canObserveOutgoing,
@@ -35,6 +36,8 @@ export type {
35
36
  IncomingLink,
36
37
  IncomingMessage,
37
38
  IncomingMessageTransport,
39
+ OutgoingReadReceipt,
40
+ OutgoingReadReceiptTransport,
38
41
  ReadReceiptTransport,
39
42
  TypingTransport,
40
43
  } from "./types";
package/src/types.ts CHANGED
@@ -84,6 +84,11 @@ export type OutboundMessage = {
84
84
  threadId?: number;
85
85
  documents?: OutboundDocument[];
86
86
  buttons?: OutboundButton[][];
87
+ /**
88
+ * Снять постоянную клавиатуру (ReplyKeyboardMarkup) у собеседника. Действует без `buttons`;
89
+ * канал без такой клавиатуры поле не замечает.
90
+ */
91
+ removeKeyboard?: boolean;
87
92
  /**
88
93
  * Как написан `text`: транспорт сам переводит разметку в формат своего канала — Telegram и MAX
89
94
  * получают выделения, почта HTML и простой текст, hh простой текст. Не задан — прежнее поведение
@@ -508,3 +513,22 @@ export interface ReadReceiptTransport extends MessageTransport {
508
513
  export function canMarkRead(transport: MessageTransport): transport is ReadReceiptTransport {
509
514
  return typeof (transport as ReadReceiptTransport).markRead === "function";
510
515
  }
516
+
517
+ /** Отметка о том, что адресат прочитал наши исходящие сообщения. */
518
+ export type OutgoingReadReceipt = {
519
+ chatId: string;
520
+ /** Включительно: все исходящие до этого номера прочтены. */
521
+ maxMessageId: string;
522
+ readAt: Date;
523
+ };
524
+
525
+ /** Канал, умеющий сообщать о прочтении адресатом наших исходящих сообщений. */
526
+ export interface OutgoingReadReceiptTransport extends MessageTransport {
527
+ onOutgoingRead(handler: (receipt: OutgoingReadReceipt) => void | Promise<void>): () => void;
528
+ }
529
+
530
+ export function canObserveOutgoingRead(
531
+ transport: MessageTransport,
532
+ ): transport is OutgoingReadReceiptTransport {
533
+ return typeof (transport as OutgoingReadReceiptTransport).onOutgoingRead === "function";
534
+ }