@imessaging/core 0.8.6 → 0.8.7
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 +1 -1
- package/src/index.ts +3 -0
- package/src/types.ts +19 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -16,6 +16,7 @@ export { createPeerKey } from "./peer-key";
|
|
|
16
16
|
export {
|
|
17
17
|
canEdit,
|
|
18
18
|
canFindByPhone,
|
|
19
|
+
canSaveContact,
|
|
19
20
|
canMarkRead,
|
|
20
21
|
canReact,
|
|
21
22
|
canReceive,
|
|
@@ -40,6 +41,8 @@ export type {
|
|
|
40
41
|
export type {
|
|
41
42
|
EditableMessage,
|
|
42
43
|
EditableMessageTransport,
|
|
44
|
+
ContactCard,
|
|
45
|
+
ContactTransport,
|
|
43
46
|
DraftTransport,
|
|
44
47
|
EditedMessageTransport,
|
|
45
48
|
MessageDraft,
|
package/src/types.ts
CHANGED
|
@@ -436,6 +436,25 @@ export function canFindByPhone(transport: MessageTransport): transport is PhoneL
|
|
|
436
436
|
return typeof (transport as PhoneLookupTransport).findByPhone === "function";
|
|
437
437
|
}
|
|
438
438
|
|
|
439
|
+
/** Карточка контакта в адресной книге учётки: имя и заметка о человеке, текст заметки даёт продукт. */
|
|
440
|
+
export type ContactCard = {
|
|
441
|
+
userId: string;
|
|
442
|
+
/** E.164; нужен, только если номер ещё не известен учётке. */
|
|
443
|
+
phone?: string;
|
|
444
|
+
firstName: string;
|
|
445
|
+
lastName?: string;
|
|
446
|
+
note?: string;
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
/** Сохранить или обновить контакт — тем же вызовом: есть контакт — имя и заметка перезаписываются. */
|
|
450
|
+
export interface ContactTransport extends MessageTransport {
|
|
451
|
+
saveContact(contact: ContactCard): Promise<void>;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
export function canSaveContact(transport: MessageTransport): transport is ContactTransport {
|
|
455
|
+
return typeof (transport as ContactTransport).saveContact === "function";
|
|
456
|
+
}
|
|
457
|
+
|
|
439
458
|
/** Пункт меню команд канала: `/menu` и подпись рядом с ним. */
|
|
440
459
|
export type ChannelCommand = {
|
|
441
460
|
/** Без ведущей косой черты. */
|