@iveri/contracts 0.96.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/README.md +13 -0
- 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/dist/api/delivery/delivery-admin.type.d.ts +128 -0
- package/dist/api/delivery/delivery-admin.type.js +1 -0
- package/dist/api/delivery/delivery-job-status.enum.d.ts +25 -0
- package/dist/api/delivery/delivery-job-status.enum.js +26 -0
- package/dist/api/delivery/index.d.ts +2 -0
- package/dist/api/delivery/index.js +2 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -219,6 +219,19 @@ What a company running a taxi service reads in its own panel: `TaxiRideStatus`,
|
|
|
219
219
|
- **A day's totals are the rides requested on it**, so `completed` can never exceed `requested`, and the panel names the
|
|
220
220
|
time zone the days were cut in.
|
|
221
221
|
|
|
222
|
+
### `api/delivery/` → `@iveri/contracts/delivery`
|
|
223
|
+
|
|
224
|
+
What a company running a delivery service reads in its own panel, shaped like Taxi's: `DeliveryJobStatus`, the live
|
|
225
|
+
board (`DeliveryBoard`, `DeliveryBoardJob`), each courier's work since a moment (`DeliveryCourierActivityList`), its
|
|
226
|
+
senders (`DeliverySendersPage`), its fee settings (`DeliveryFeeSettings`, `UpdateDeliveryFeeSettingsRequest`) and its
|
|
227
|
+
daily totals (`DeliveryDailyReport`).
|
|
228
|
+
|
|
229
|
+
- **A job the company asked for itself has no sender** (`senderUserId: null`), as a shop shipping its own orders does;
|
|
230
|
+
it is on the board and in the totals, and in nobody's row of the senders list.
|
|
231
|
+
- **Proof is a yes or no and the recipient's name.** The photograph is private evidence and is never in these shapes.
|
|
232
|
+
- **`expired` folds quote-expired into no courier found, and `failed` stays apart**, because a refused request is a
|
|
233
|
+
fault on Iveri's side rather than the company's.
|
|
234
|
+
|
|
222
235
|
### Why the wire shapes moved here
|
|
223
236
|
|
|
224
237
|
`conduit-admin-web` hand-transcribed all of it, carefully and with comments. It still drifted:
|
|
@@ -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';
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import type { IsoDateTime } from '../../type/iso-date-time.type.js';
|
|
2
|
+
import type { Nullable } from '../../type/nil.type.js';
|
|
3
|
+
import type { Paginated } from '../../type/paginated.type.js';
|
|
4
|
+
import type { UUID } from '../../type/uuid.type.js';
|
|
5
|
+
import type { DeliveryJobStatus } from './delivery-job-status.enum.js';
|
|
6
|
+
/** A stop as the sender gave it. There is no address search, so it is coordinates only. */
|
|
7
|
+
export interface DeliveryPoint {
|
|
8
|
+
latitude: number;
|
|
9
|
+
longitude: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* One job as the company running the delivery service sees it on its board.
|
|
13
|
+
*
|
|
14
|
+
* The company sees its own customers' stops; Iveri's backoffice never does. A stop is null once the job's location is
|
|
15
|
+
* past the retention window, which differs from never having one. People are identifiers: the panel names them from
|
|
16
|
+
* identity's public profile.
|
|
17
|
+
*/
|
|
18
|
+
export interface DeliveryBoardJob {
|
|
19
|
+
id: UUID;
|
|
20
|
+
status: DeliveryJobStatus;
|
|
21
|
+
/** Null when the company asked for the delivery itself, as a shop shipping its own orders does. */
|
|
22
|
+
senderUserId: Nullable<UUID>;
|
|
23
|
+
/** The Mobility worker carrying it, once a courier accepted. */
|
|
24
|
+
courierWorkerId: Nullable<UUID>;
|
|
25
|
+
/** The courier as a person; briefly null after acceptance while Delivery resolves the worker. */
|
|
26
|
+
courierUserId: Nullable<UUID>;
|
|
27
|
+
pickup: Nullable<DeliveryPoint>;
|
|
28
|
+
dropoff: Nullable<DeliveryPoint>;
|
|
29
|
+
/** A straight-line floor, never a final charge. */
|
|
30
|
+
quotedFeeMinor: number;
|
|
31
|
+
quotedFeeCurrency: string;
|
|
32
|
+
quotedDistanceMeters: number;
|
|
33
|
+
createdAt: IsoDateTime;
|
|
34
|
+
assignedAt: Nullable<IsoDateTime>;
|
|
35
|
+
pickedUpAt: Nullable<IsoDateTime>;
|
|
36
|
+
inTransitAt: Nullable<IsoDateTime>;
|
|
37
|
+
deliveredAt: Nullable<IsoDateTime>;
|
|
38
|
+
cancelledAt: Nullable<IsoDateTime>;
|
|
39
|
+
/** Whether the courier left proof. The photograph itself is private evidence and is never on the board. */
|
|
40
|
+
hasProof: boolean;
|
|
41
|
+
/** The name the courier entered for whoever took the parcel; null without proof or past its retention window. */
|
|
42
|
+
recipientName: Nullable<string>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* `GET /company/board?since=`: what is happening now, and what finished since `since` (the start of the company's
|
|
46
|
+
* day, which only the panel knows). Each list is capped and newest first.
|
|
47
|
+
*/
|
|
48
|
+
export interface DeliveryBoard {
|
|
49
|
+
since: IsoDateTime;
|
|
50
|
+
/** Looking for a courier, assigned, picked up or in transit. Waiting quotes are not work yet. */
|
|
51
|
+
active: DeliveryBoardJob[];
|
|
52
|
+
/** Delivered, cancelled, expired, quote-expired or failed since `since`. */
|
|
53
|
+
finished: DeliveryBoardJob[];
|
|
54
|
+
}
|
|
55
|
+
/** One courier's work since a moment, keyed by their Mobility worker. Couriers with no jobs are absent. */
|
|
56
|
+
export interface DeliveryCourierActivity {
|
|
57
|
+
workerId: UUID;
|
|
58
|
+
deliveredJobs: number;
|
|
59
|
+
lastDeliveredAt: Nullable<IsoDateTime>;
|
|
60
|
+
/** The job they are carrying now, if any. */
|
|
61
|
+
activeJobId: Nullable<UUID>;
|
|
62
|
+
activeJobStatus: Nullable<DeliveryJobStatus>;
|
|
63
|
+
}
|
|
64
|
+
/** `GET /company/couriers/activity?since=`. */
|
|
65
|
+
export interface DeliveryCourierActivityList {
|
|
66
|
+
since: IsoDateTime;
|
|
67
|
+
couriers: DeliveryCourierActivity[];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Somebody who has asked this company to carry something. Named by the panel from identity. Jobs the company asked
|
|
71
|
+
* for itself have no sender and are not anybody's here.
|
|
72
|
+
*/
|
|
73
|
+
export interface DeliverySenderSummary {
|
|
74
|
+
userId: UUID;
|
|
75
|
+
/** Every job they asked for, including quotes they never accepted. */
|
|
76
|
+
jobs: number;
|
|
77
|
+
deliveredJobs: number;
|
|
78
|
+
lastJobAt: IsoDateTime;
|
|
79
|
+
}
|
|
80
|
+
/** `GET /company/senders`, most recent sender first. */
|
|
81
|
+
export type DeliverySendersPage = Paginated<DeliverySenderSummary>;
|
|
82
|
+
/**
|
|
83
|
+
* What a quote costs: `base + round(metres × perKilometre / 1000)`, in minor units of `currency`. The distance is a
|
|
84
|
+
* straight line, so the quote stays a floor whatever these are set to.
|
|
85
|
+
*/
|
|
86
|
+
export interface DeliveryFeeSettings {
|
|
87
|
+
currency: string;
|
|
88
|
+
baseFeeMinor: number;
|
|
89
|
+
perKilometreMinor: number;
|
|
90
|
+
/** True while the company has never set its own prices and the service's defaults apply. */
|
|
91
|
+
isDefault: boolean;
|
|
92
|
+
updatedAt: Nullable<IsoDateTime>;
|
|
93
|
+
}
|
|
94
|
+
/** `PUT /company/fee-settings`. Applies to quotes made afterwards; a quote already given keeps its price. */
|
|
95
|
+
export interface UpdateDeliveryFeeSettingsRequest {
|
|
96
|
+
currency: string;
|
|
97
|
+
baseFeeMinor: number;
|
|
98
|
+
perKilometreMinor: number;
|
|
99
|
+
}
|
|
100
|
+
/** Quoted fees of a day's delivered jobs in one currency. Quoted, not earned: nothing settles a fee yet. */
|
|
101
|
+
export interface DeliveryQuotedFeeTotal {
|
|
102
|
+
currency: string;
|
|
103
|
+
quotedFeeMinor: number;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* One day of the jobs requested on it, in the report's time zone: how many were asked for, and how those ended. A job
|
|
107
|
+
* requested late and delivered after midnight counts on the day it was asked for.
|
|
108
|
+
*/
|
|
109
|
+
export interface DeliveryDailyTotals {
|
|
110
|
+
/** `YYYY-MM-DD`. */
|
|
111
|
+
date: string;
|
|
112
|
+
requested: number;
|
|
113
|
+
delivered: number;
|
|
114
|
+
cancelled: number;
|
|
115
|
+
/** No courier was found, or the sender let the quote run out. */
|
|
116
|
+
expired: number;
|
|
117
|
+
/** Mobility refused the request: a fault on Iveri's side rather than the company's. */
|
|
118
|
+
failed: number;
|
|
119
|
+
/** Sum of the quoted fees of that day's delivered jobs, per currency. */
|
|
120
|
+
deliveredQuotedFees: DeliveryQuotedFeeTotal[];
|
|
121
|
+
}
|
|
122
|
+
/** `GET /company/reports/daily?days=&timeZone=`: oldest day first, every day present, zeroes included. */
|
|
123
|
+
export interface DeliveryDailyReport {
|
|
124
|
+
timeZone: string;
|
|
125
|
+
from: string;
|
|
126
|
+
to: string;
|
|
127
|
+
days: DeliveryDailyTotals[];
|
|
128
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a delivery job stands. `delivery-api` owns the lifecycle; this is its wire vocabulary, so a company's panel and
|
|
3
|
+
* Iveri's backoffice can label a job without restating it.
|
|
4
|
+
*/
|
|
5
|
+
export declare enum DeliveryJobStatus {
|
|
6
|
+
/** Priced and waiting for the sender to accept it. */
|
|
7
|
+
QUOTED = "quoted",
|
|
8
|
+
/** Confirmed, and looking for a courier. */
|
|
9
|
+
DISPATCHING = "dispatching",
|
|
10
|
+
/** A courier accepted and is on the way to the pickup. */
|
|
11
|
+
COURIER_ASSIGNED = "courier-assigned",
|
|
12
|
+
/** The courier has the parcel. */
|
|
13
|
+
PICKED_UP = "picked-up",
|
|
14
|
+
/** The parcel is on its way to the drop-off. */
|
|
15
|
+
IN_TRANSIT = "in-transit",
|
|
16
|
+
/** Handed over, with the recipient's name and a photograph as proof. */
|
|
17
|
+
DELIVERED = "delivered",
|
|
18
|
+
/** The sender never accepted the quote before it ran out. */
|
|
19
|
+
QUOTE_EXPIRED = "quote-expired",
|
|
20
|
+
/** Mobility found no courier. */
|
|
21
|
+
EXPIRED = "expired",
|
|
22
|
+
/** Mobility refused the request outright; the job never reached a courier. */
|
|
23
|
+
FAILED = "failed",
|
|
24
|
+
CANCELLED = "cancelled"
|
|
25
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a delivery job stands. `delivery-api` owns the lifecycle; this is its wire vocabulary, so a company's panel and
|
|
3
|
+
* Iveri's backoffice can label a job without restating it.
|
|
4
|
+
*/
|
|
5
|
+
export var DeliveryJobStatus;
|
|
6
|
+
(function (DeliveryJobStatus) {
|
|
7
|
+
/** Priced and waiting for the sender to accept it. */
|
|
8
|
+
DeliveryJobStatus["QUOTED"] = "quoted";
|
|
9
|
+
/** Confirmed, and looking for a courier. */
|
|
10
|
+
DeliveryJobStatus["DISPATCHING"] = "dispatching";
|
|
11
|
+
/** A courier accepted and is on the way to the pickup. */
|
|
12
|
+
DeliveryJobStatus["COURIER_ASSIGNED"] = "courier-assigned";
|
|
13
|
+
/** The courier has the parcel. */
|
|
14
|
+
DeliveryJobStatus["PICKED_UP"] = "picked-up";
|
|
15
|
+
/** The parcel is on its way to the drop-off. */
|
|
16
|
+
DeliveryJobStatus["IN_TRANSIT"] = "in-transit";
|
|
17
|
+
/** Handed over, with the recipient's name and a photograph as proof. */
|
|
18
|
+
DeliveryJobStatus["DELIVERED"] = "delivered";
|
|
19
|
+
/** The sender never accepted the quote before it ran out. */
|
|
20
|
+
DeliveryJobStatus["QUOTE_EXPIRED"] = "quote-expired";
|
|
21
|
+
/** Mobility found no courier. */
|
|
22
|
+
DeliveryJobStatus["EXPIRED"] = "expired";
|
|
23
|
+
/** Mobility refused the request outright; the job never reached a courier. */
|
|
24
|
+
DeliveryJobStatus["FAILED"] = "failed";
|
|
25
|
+
DeliveryJobStatus["CANCELLED"] = "cancelled";
|
|
26
|
+
})(DeliveryJobStatus || (DeliveryJobStatus = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iveri/contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.98.0",
|
|
4
4
|
"description": "Wire contracts shared by every Iveri backend and frontend. Zero runtime dependencies.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -84,6 +84,10 @@
|
|
|
84
84
|
"types": "./dist/api/taxi/index.d.ts",
|
|
85
85
|
"default": "./dist/api/taxi/index.js"
|
|
86
86
|
},
|
|
87
|
+
"./delivery": {
|
|
88
|
+
"types": "./dist/api/delivery/index.d.ts",
|
|
89
|
+
"default": "./dist/api/delivery/index.js"
|
|
90
|
+
},
|
|
87
91
|
"./billing": {
|
|
88
92
|
"types": "./dist/api/billing/index.d.ts",
|
|
89
93
|
"default": "./dist/api/billing/index.js"
|