@iveri/contracts 0.97.0 → 0.98.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/api/chat/chat-app.type.d.ts +2 -1
- package/dist/api/chat/chat-call-end-reason.enum.d.ts +15 -0
- package/dist/api/chat/chat-call-end-reason.enum.js +16 -0
- package/dist/api/chat/chat-call-kind.enum.d.ts +5 -0
- package/dist/api/chat/chat-call-kind.enum.js +6 -0
- package/dist/api/chat/chat-call-participant-state.enum.d.ts +8 -0
- package/dist/api/chat/chat-call-participant-state.enum.js +9 -0
- package/dist/api/chat/chat-call-status.enum.d.ts +6 -0
- package/dist/api/chat/chat-call-status.enum.js +7 -0
- package/dist/api/chat/chat-call.type.d.ts +58 -0
- package/dist/api/chat/chat-call.type.js +1 -0
- package/dist/api/chat/chat-conversation.type.d.ts +5 -0
- package/dist/api/chat/chat-embed.type.d.ts +5 -0
- package/dist/api/chat/chat-realtime-event.enum.d.ts +3 -1
- package/dist/api/chat/chat-realtime-event.enum.js +2 -0
- package/dist/api/chat/chat-realtime.type.d.ts +8 -0
- package/dist/api/chat/chat-refusal.enum.d.ts +4 -0
- package/dist/api/chat/chat-refusal.enum.js +4 -0
- package/dist/api/chat/index.d.ts +5 -0
- package/dist/api/chat/index.js +5 -0
- package/package.json +1 -1
|
@@ -81,7 +81,8 @@ export type ServerChatParticipant = Omit<EmbeddedChatParticipant, 'userId'> & {
|
|
|
81
81
|
* `PUT /server/conversations`: the embed request, with each participant named by the app's own id for them rather
|
|
82
82
|
* than a Baasi id.
|
|
83
83
|
*/
|
|
84
|
-
|
|
84
|
+
/** Calls are not offered to other companies' apps yet, so an app's server cannot ask for them. */
|
|
85
|
+
export type OpenServerChatRequest = Omit<OpenEmbeddedChatRequest, 'participants' | 'callable'> & {
|
|
85
86
|
participants: ServerChatParticipant[];
|
|
86
87
|
};
|
|
87
88
|
/** `GET /server/users/:userId/export`: everything Baasi holds about one user of an app. */
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** How a call ended. Each is a different sentence in the conversation afterwards. */
|
|
2
|
+
export declare enum ChatCallEndReason {
|
|
3
|
+
/** Somebody answered, and then somebody hung up. */
|
|
4
|
+
COMPLETED = "completed",
|
|
5
|
+
/** Nobody answered before the ringing stopped. */
|
|
6
|
+
MISSED = "missed",
|
|
7
|
+
/** The person called said no. */
|
|
8
|
+
DECLINED = "declined",
|
|
9
|
+
/** The caller hung up before anybody answered. */
|
|
10
|
+
CANCELLED = "cancelled",
|
|
11
|
+
/** The person called was already in another call. */
|
|
12
|
+
BUSY = "busy",
|
|
13
|
+
/** It was answered and nobody reached the call server, which is a network fault, not a person's choice. */
|
|
14
|
+
FAILED = "failed"
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** How a call ended. Each is a different sentence in the conversation afterwards. */
|
|
2
|
+
export var ChatCallEndReason;
|
|
3
|
+
(function (ChatCallEndReason) {
|
|
4
|
+
/** Somebody answered, and then somebody hung up. */
|
|
5
|
+
ChatCallEndReason["COMPLETED"] = "completed";
|
|
6
|
+
/** Nobody answered before the ringing stopped. */
|
|
7
|
+
ChatCallEndReason["MISSED"] = "missed";
|
|
8
|
+
/** The person called said no. */
|
|
9
|
+
ChatCallEndReason["DECLINED"] = "declined";
|
|
10
|
+
/** The caller hung up before anybody answered. */
|
|
11
|
+
ChatCallEndReason["CANCELLED"] = "cancelled";
|
|
12
|
+
/** The person called was already in another call. */
|
|
13
|
+
ChatCallEndReason["BUSY"] = "busy";
|
|
14
|
+
/** It was answered and nobody reached the call server, which is a network fault, not a person's choice. */
|
|
15
|
+
ChatCallEndReason["FAILED"] = "failed";
|
|
16
|
+
})(ChatCallEndReason || (ChatCallEndReason = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** What one person did with a call. */
|
|
2
|
+
export var ChatCallParticipantState;
|
|
3
|
+
(function (ChatCallParticipantState) {
|
|
4
|
+
ChatCallParticipantState["RINGING"] = "ringing";
|
|
5
|
+
ChatCallParticipantState["JOINED"] = "joined";
|
|
6
|
+
ChatCallParticipantState["DECLINED"] = "declined";
|
|
7
|
+
ChatCallParticipantState["MISSED"] = "missed";
|
|
8
|
+
ChatCallParticipantState["LEFT"] = "left";
|
|
9
|
+
})(ChatCallParticipantState || (ChatCallParticipantState = {}));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Where a call is. Only `ended` is final, and only an ended call has an end reason. */
|
|
2
|
+
export var ChatCallStatus;
|
|
3
|
+
(function (ChatCallStatus) {
|
|
4
|
+
ChatCallStatus["RINGING"] = "ringing";
|
|
5
|
+
ChatCallStatus["ACTIVE"] = "active";
|
|
6
|
+
ChatCallStatus["ENDED"] = "ended";
|
|
7
|
+
})(ChatCallStatus || (ChatCallStatus = {}));
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { IsoDateTime } from '../../type/iso-date-time.type.js';
|
|
2
|
+
import type { Nullable } from '../../type/nil.type.js';
|
|
3
|
+
import type { UUID } from '../../type/uuid.type.js';
|
|
4
|
+
import type { ChatImage } from './chat-attachment.type.js';
|
|
5
|
+
import type { ChatCallEndReason } from './chat-call-end-reason.enum.js';
|
|
6
|
+
import type { ChatCallKind } from './chat-call-kind.enum.js';
|
|
7
|
+
import type { ChatCallParticipantState } from './chat-call-participant-state.enum.js';
|
|
8
|
+
import type { ChatCallStatus } from './chat-call-status.enum.js';
|
|
9
|
+
/** Somebody in a call, named the way the conversation names them. */
|
|
10
|
+
export interface ChatCallParticipant {
|
|
11
|
+
userId: UUID;
|
|
12
|
+
displayName: string;
|
|
13
|
+
avatar: Nullable<ChatImage>;
|
|
14
|
+
state: ChatCallParticipantState;
|
|
15
|
+
joinedAt: Nullable<IsoDateTime>;
|
|
16
|
+
leftAt: Nullable<IsoDateTime>;
|
|
17
|
+
isMe: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* `GET /calls/:callId`. Who rang whom, and what happened. Nothing of what was said or shown: the call server
|
|
21
|
+
* carries the media and Baasi keeps none of it.
|
|
22
|
+
*/
|
|
23
|
+
export interface ChatCall {
|
|
24
|
+
id: UUID;
|
|
25
|
+
conversationId: UUID;
|
|
26
|
+
kind: ChatCallKind;
|
|
27
|
+
status: ChatCallStatus;
|
|
28
|
+
/** Set once the call has ended, and only then. */
|
|
29
|
+
endReason: Nullable<ChatCallEndReason>;
|
|
30
|
+
startedBy: UUID;
|
|
31
|
+
participants: ChatCallParticipant[];
|
|
32
|
+
/** When an unanswered call stops ringing and becomes missed. */
|
|
33
|
+
ringExpiresAt: IsoDateTime;
|
|
34
|
+
answeredAt: Nullable<IsoDateTime>;
|
|
35
|
+
endedAt: Nullable<IsoDateTime>;
|
|
36
|
+
createdAt: IsoDateTime;
|
|
37
|
+
}
|
|
38
|
+
/** `POST /conversations/:conversationId/calls`. */
|
|
39
|
+
export interface StartChatCallRequest {
|
|
40
|
+
kind: ChatCallKind;
|
|
41
|
+
/** So a retried start rings once. Unique per caller. */
|
|
42
|
+
clientCallId: UUID;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* What a client needs to connect to the call server: the address and a token for this one call, valid only long
|
|
46
|
+
* enough to connect. Answered by starting a call, accepting one and `POST /calls/:callId/join` after a dropped
|
|
47
|
+
* connection.
|
|
48
|
+
*/
|
|
49
|
+
export interface ChatCallJoin {
|
|
50
|
+
call: ChatCall;
|
|
51
|
+
url: string;
|
|
52
|
+
token: string;
|
|
53
|
+
expiresAt: IsoDateTime;
|
|
54
|
+
}
|
|
55
|
+
/** `GET /conversations/:conversationId/calls/current`: the call ringing or under way there, if any. */
|
|
56
|
+
export interface ChatCurrentCall {
|
|
57
|
+
call: Nullable<ChatCall>;
|
|
58
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -70,6 +70,11 @@ export interface ChatConversationSummary {
|
|
|
70
70
|
/** Whether I can send here now. When false, `refusal` says why. */
|
|
71
71
|
canSend: boolean;
|
|
72
72
|
refusal: Nullable<ChatRefusal>;
|
|
73
|
+
/**
|
|
74
|
+
* Whether I can call here now: the same people who may send, in a conversation that takes calls. A group takes
|
|
75
|
+
* none yet, and a product's conversation only while the product allows it.
|
|
76
|
+
*/
|
|
77
|
+
canCall: boolean;
|
|
73
78
|
updatedAt: IsoDateTime;
|
|
74
79
|
}
|
|
75
80
|
export interface ChatParticipant {
|
|
@@ -36,6 +36,11 @@ export interface OpenEmbeddedChatRequest {
|
|
|
36
36
|
isGroup?: boolean;
|
|
37
37
|
/** Sending ends here and reading stays. Omitted means until closed. */
|
|
38
38
|
writableUntil?: Nullable<IsoDateTime>;
|
|
39
|
+
/**
|
|
40
|
+
* Whether its people may call each other, honoured only while it is writable. Sent on every `PUT`; omitted means
|
|
41
|
+
* false. Taxi allows it from a driver's assignment until the ride is over.
|
|
42
|
+
*/
|
|
43
|
+
callable?: boolean;
|
|
39
44
|
link?: Nullable<{
|
|
40
45
|
web?: Nullable<string>;
|
|
41
46
|
app?: Nullable<string>;
|
|
@@ -2,5 +2,7 @@
|
|
|
2
2
|
export declare enum ChatRealtimeEvent {
|
|
3
3
|
CONVERSATION_UPDATED = "chat.conversation.updated",
|
|
4
4
|
CONVERSATION_TYPING = "chat.conversation.typing",
|
|
5
|
-
INBOX_UPDATED = "chat.inbox.updated"
|
|
5
|
+
INBOX_UPDATED = "chat.inbox.updated",
|
|
6
|
+
/** A call rang, was answered or ended. The frame names the call and its conversation; the client fetches the call. */
|
|
7
|
+
CALL_UPDATED = "chat.call.updated"
|
|
6
8
|
}
|
|
@@ -4,4 +4,6 @@ export var ChatRealtimeEvent;
|
|
|
4
4
|
ChatRealtimeEvent["CONVERSATION_UPDATED"] = "chat.conversation.updated";
|
|
5
5
|
ChatRealtimeEvent["CONVERSATION_TYPING"] = "chat.conversation.typing";
|
|
6
6
|
ChatRealtimeEvent["INBOX_UPDATED"] = "chat.inbox.updated";
|
|
7
|
+
/** A call rang, was answered or ended. The frame names the call and its conversation; the client fetches the call. */
|
|
8
|
+
ChatRealtimeEvent["CALL_UPDATED"] = "chat.call.updated";
|
|
7
9
|
})(ChatRealtimeEvent || (ChatRealtimeEvent = {}));
|
|
@@ -11,6 +11,8 @@ export interface ChatRealtimeFrame {
|
|
|
11
11
|
seq: Nullable<number>;
|
|
12
12
|
/** Who is typing. */
|
|
13
13
|
userId: Nullable<UUID>;
|
|
14
|
+
/** The call a `chat.call.updated` frame is about. */
|
|
15
|
+
callId?: Nullable<UUID>;
|
|
14
16
|
}
|
|
15
17
|
/** `PUT /me/devices`. One row per installation; signing out removes it. */
|
|
16
18
|
export interface RegisterChatDeviceRequest {
|
|
@@ -20,4 +22,10 @@ export interface RegisterChatDeviceRequest {
|
|
|
20
22
|
/** Omitted means `expo`, which is what every Iveri app holds. An app's own build may hold a raw APNs or FCM token. */
|
|
21
23
|
tokenKind?: ChatPushTokenKind;
|
|
22
24
|
locale?: Nullable<string>;
|
|
25
|
+
/**
|
|
26
|
+
* What rings this device for a call while the app is closed: an iOS PushKit VoIP token, or on Android the FCM
|
|
27
|
+
* registration token. Expo cannot deliver either kind of push, so it is sent straight to Apple or Google.
|
|
28
|
+
* Omitted leaves the stored one; null forgets it.
|
|
29
|
+
*/
|
|
30
|
+
callPushToken?: Nullable<string>;
|
|
23
31
|
}
|
|
@@ -16,6 +16,10 @@ export declare enum ChatRefusal {
|
|
|
16
16
|
SUSPENDED = "suspended",
|
|
17
17
|
ATTACHMENT_REFUSED = "attachment-refused",
|
|
18
18
|
REQUEST_PENDING = "request-pending",
|
|
19
|
+
/** This conversation takes no calls: a group, a product's conversation that does not allow them, or an app's. */
|
|
20
|
+
CALLS_OFF = "calls-off",
|
|
21
|
+
/** The call has ended, or this person is not in it. */
|
|
22
|
+
CALL_UNAVAILABLE = "call-unavailable",
|
|
19
23
|
/**
|
|
20
24
|
* The app's plan does not allow it this month: a new user over the monthly-active-user limit, or a message over the
|
|
21
25
|
* message limit. The value is `USAGE_LIMIT_REACHED_REASON` from `@iveri/contracts/billing`, and the details name the
|
|
@@ -17,6 +17,10 @@ export var ChatRefusal;
|
|
|
17
17
|
ChatRefusal["SUSPENDED"] = "suspended";
|
|
18
18
|
ChatRefusal["ATTACHMENT_REFUSED"] = "attachment-refused";
|
|
19
19
|
ChatRefusal["REQUEST_PENDING"] = "request-pending";
|
|
20
|
+
/** This conversation takes no calls: a group, a product's conversation that does not allow them, or an app's. */
|
|
21
|
+
ChatRefusal["CALLS_OFF"] = "calls-off";
|
|
22
|
+
/** The call has ended, or this person is not in it. */
|
|
23
|
+
ChatRefusal["CALL_UNAVAILABLE"] = "call-unavailable";
|
|
20
24
|
/**
|
|
21
25
|
* The app's plan does not allow it this month: a new user over the monthly-active-user limit, or a message over the
|
|
22
26
|
* message limit. The value is `USAGE_LIMIT_REACHED_REASON` from `@iveri/contracts/billing`, and the details name the
|
package/dist/api/chat/index.d.ts
CHANGED
|
@@ -6,6 +6,11 @@ export * from './chat-app.constant.js';
|
|
|
6
6
|
export * from './chat-app.type.js';
|
|
7
7
|
export * from './chat-attachment-kind.enum.js';
|
|
8
8
|
export * from './chat-attachment.type.js';
|
|
9
|
+
export * from './chat-call-end-reason.enum.js';
|
|
10
|
+
export * from './chat-call-kind.enum.js';
|
|
11
|
+
export * from './chat-call-participant-state.enum.js';
|
|
12
|
+
export * from './chat-call-status.enum.js';
|
|
13
|
+
export * from './chat-call.type.js';
|
|
9
14
|
export * from './chat-case-decision.enum.js';
|
|
10
15
|
export * from './chat-case-status.enum.js';
|
|
11
16
|
export * from './chat-contact.type.js';
|
package/dist/api/chat/index.js
CHANGED
|
@@ -6,6 +6,11 @@ export * from './chat-app.constant.js';
|
|
|
6
6
|
export * from './chat-app.type.js';
|
|
7
7
|
export * from './chat-attachment-kind.enum.js';
|
|
8
8
|
export * from './chat-attachment.type.js';
|
|
9
|
+
export * from './chat-call-end-reason.enum.js';
|
|
10
|
+
export * from './chat-call-kind.enum.js';
|
|
11
|
+
export * from './chat-call-participant-state.enum.js';
|
|
12
|
+
export * from './chat-call-status.enum.js';
|
|
13
|
+
export * from './chat-call.type.js';
|
|
9
14
|
export * from './chat-case-decision.enum.js';
|
|
10
15
|
export * from './chat-case-status.enum.js';
|
|
11
16
|
export * from './chat-contact.type.js';
|