@mydoormot/app-types 2.3.0 → 2.3.2
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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +12 -0
- package/dist/index.cjs +48 -23
- package/dist/index.d.cts +399 -534
- package/dist/index.d.ts +399 -534
- package/dist/index.js +42 -19
- package/package.json +1 -1
- package/src/business.ts +0 -16
- package/src/customer.ts +2 -0
- package/src/errand.ts +12 -51
- package/src/index.ts +1 -2
- package/src/invoice.ts +5 -0
- package/src/rating.ts +73 -0
- package/src/vehicle.ts +0 -100
- package/src/whatsapp.ts +1 -0
- package/src/platform.ts +0 -17
- package/src/portal.ts +0 -46
package/dist/index.d.cts
CHANGED
|
@@ -92,226 +92,6 @@ type UserAddress = {
|
|
|
92
92
|
direction?: string;
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
-
interface CustomerTransactionStats {
|
|
96
|
-
totalSaleCount: number;
|
|
97
|
-
totalSaleAmount: number;
|
|
98
|
-
totalExpenseCount: number;
|
|
99
|
-
totalExpenseAmount: number;
|
|
100
|
-
lastTransactionDate: string | null;
|
|
101
|
-
updatedAt: string;
|
|
102
|
-
}
|
|
103
|
-
interface CustomerAddress {
|
|
104
|
-
id: string;
|
|
105
|
-
label: string;
|
|
106
|
-
address: string;
|
|
107
|
-
landmark?: string;
|
|
108
|
-
cityId?: string;
|
|
109
|
-
location?: {
|
|
110
|
-
type: 'Point';
|
|
111
|
-
coordinates: number[];
|
|
112
|
-
};
|
|
113
|
-
isDefault: boolean;
|
|
114
|
-
createdAt: string;
|
|
115
|
-
updatedAt: string;
|
|
116
|
-
}
|
|
117
|
-
interface Customer {
|
|
118
|
-
id: string;
|
|
119
|
-
businessId: string;
|
|
120
|
-
phoneNumber: string;
|
|
121
|
-
fullName: string;
|
|
122
|
-
cityId: string;
|
|
123
|
-
/** @deprecated Mirrored from the default entry in `addresses`. */
|
|
124
|
-
address: string;
|
|
125
|
-
/** @deprecated Mirrored from the default entry in `addresses`. */
|
|
126
|
-
landmark?: string;
|
|
127
|
-
/** Absent on customers created before the address-book backfill. */
|
|
128
|
-
addresses?: CustomerAddress[];
|
|
129
|
-
createdAt: string;
|
|
130
|
-
updatedAt: string;
|
|
131
|
-
customerBusinessId?: string;
|
|
132
|
-
/** How this customer normally pays; new errands for them start with it. Unset reads as `invoice`. */
|
|
133
|
-
paymentMode?: FeeSettlement;
|
|
134
|
-
transactionStats?: CustomerTransactionStats;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* What a customer owes, computed server-side. `unbilled` is a SET, not a
|
|
138
|
-
* period — it has no start or end date, and `oldestUnbilledAt` is simply its
|
|
139
|
-
* earliest member.
|
|
140
|
-
*/
|
|
141
|
-
interface CustomerBilling {
|
|
142
|
-
/**
|
|
143
|
-
* What is still owed on work that has not reached a statement — net of
|
|
144
|
-
* anything already paid on those errands, which is why it can be smaller than
|
|
145
|
-
* the sum of their prices.
|
|
146
|
-
*/
|
|
147
|
-
unbilledAmount: number;
|
|
148
|
-
/** How many errands are not on a statement yet, paid ones included. */
|
|
149
|
-
unbilledCount: number;
|
|
150
|
-
oldestUnbilledAt: string | null;
|
|
151
|
-
outstandingAmount: number;
|
|
152
|
-
openInvoiceCount: number;
|
|
153
|
-
/** End of the newest period already invoiced. */
|
|
154
|
-
lastInvoicedThrough: string | null;
|
|
155
|
-
/**
|
|
156
|
-
* The next invoice window, derived rather than typed: from the day after the
|
|
157
|
-
* last invoice closed, to today. Consecutive periods therefore tile with no
|
|
158
|
-
* gap and no overlap.
|
|
159
|
-
*/
|
|
160
|
-
nextPeriod: {
|
|
161
|
-
from: string | null;
|
|
162
|
-
to: string;
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
declare enum InvoiceStatus {
|
|
167
|
-
Pending = "pending",
|
|
168
|
-
Processing = "processing",
|
|
169
|
-
Paid = "paid",
|
|
170
|
-
Cancelled = "cancelled",
|
|
171
|
-
Failed = "failed"
|
|
172
|
-
}
|
|
173
|
-
declare enum InvoiceItemType {
|
|
174
|
-
Errand = "errand",
|
|
175
|
-
Manual = "manual"
|
|
176
|
-
}
|
|
177
|
-
declare enum InvoiceGenerationType {
|
|
178
|
-
Auto = "auto",
|
|
179
|
-
Manual = "manual"
|
|
180
|
-
}
|
|
181
|
-
declare enum PaymentOptions {
|
|
182
|
-
Cash = "cash",
|
|
183
|
-
Card = "card",
|
|
184
|
-
BusinessInvoice = "business_invoice"
|
|
185
|
-
}
|
|
186
|
-
declare enum InvoicePaymentMethod {
|
|
187
|
-
Transfer = "transfer",
|
|
188
|
-
Cash = "cash",
|
|
189
|
-
Card = "card",
|
|
190
|
-
Pos = "pos",
|
|
191
|
-
Other = "other"
|
|
192
|
-
}
|
|
193
|
-
declare enum InvoiceEventType {
|
|
194
|
-
Frozen = "frozen",
|
|
195
|
-
ErrandsAdded = "errands_added",
|
|
196
|
-
ErrandRemoved = "errand_removed",
|
|
197
|
-
Recalculated = "recalculated",
|
|
198
|
-
LineAmountChanged = "line_amount_changed",
|
|
199
|
-
PaymentRecorded = "payment_recorded",
|
|
200
|
-
PaymentReversed = "payment_reversed",
|
|
201
|
-
PaymentUpdated = "payment_updated",
|
|
202
|
-
StatusChanged = "status_changed",
|
|
203
|
-
Viewed = "viewed"
|
|
204
|
-
}
|
|
205
|
-
/** Why an errand in the period was not charged on the statement. */
|
|
206
|
-
declare enum SweepExclusionReason {
|
|
207
|
-
Cancelled = "cancelled",
|
|
208
|
-
AlreadyInvoiced = "already_invoiced",
|
|
209
|
-
Owed = "owed",
|
|
210
|
-
NotInvoiceable = "not_invoiceable"
|
|
211
|
-
}
|
|
212
|
-
interface InvoicePayment {
|
|
213
|
-
id: string;
|
|
214
|
-
invoiceId: string;
|
|
215
|
-
businessId: string;
|
|
216
|
-
amount: number;
|
|
217
|
-
paidAt: string;
|
|
218
|
-
method?: InvoicePaymentMethod | `${InvoicePaymentMethod}`;
|
|
219
|
-
reference?: string;
|
|
220
|
-
note?: string;
|
|
221
|
-
recordedBy: string;
|
|
222
|
-
reversedAt?: string;
|
|
223
|
-
reversedBy?: string;
|
|
224
|
-
reversalReason?: string;
|
|
225
|
-
createdAt: string;
|
|
226
|
-
updatedAt: string;
|
|
227
|
-
}
|
|
228
|
-
interface InvoiceEvent {
|
|
229
|
-
id: string;
|
|
230
|
-
invoiceId: string;
|
|
231
|
-
businessId: string;
|
|
232
|
-
type: InvoiceEventType | `${InvoiceEventType}`;
|
|
233
|
-
actorUserId?: string;
|
|
234
|
-
amountBefore?: number;
|
|
235
|
-
amountAfter?: number;
|
|
236
|
-
summary?: string;
|
|
237
|
-
/** Repeated back to the customer on their own statement. */
|
|
238
|
-
customerVisible: boolean;
|
|
239
|
-
meta?: Record<string, unknown>;
|
|
240
|
-
createdAt: string;
|
|
241
|
-
}
|
|
242
|
-
/** Whether a frozen invoice has fallen out of date, and by how much. */
|
|
243
|
-
interface InvoiceDrift {
|
|
244
|
-
errandCount: number;
|
|
245
|
-
amount: number;
|
|
246
|
-
}
|
|
247
|
-
interface Invoice {
|
|
248
|
-
id: string;
|
|
249
|
-
businessId: string;
|
|
250
|
-
userId: string;
|
|
251
|
-
invoiceNumber: string;
|
|
252
|
-
/**
|
|
253
|
-
* Slug for the public statement URL, and the only credential guarding it.
|
|
254
|
-
* Written at freeze time, so every invoice is shareable immediately. Absent on
|
|
255
|
-
* invoices frozen before the field existed.
|
|
256
|
-
*/
|
|
257
|
-
statementSlug?: string;
|
|
258
|
-
startDate: string;
|
|
259
|
-
endDate: string;
|
|
260
|
-
/** What the customer is asked for. Excludes zero-rated lines. */
|
|
261
|
-
totalAmount: number;
|
|
262
|
-
/**
|
|
263
|
-
* What the settled-at-the-door lines were worth. Never owed, never part of
|
|
264
|
-
* `totalAmount` — carried so the statement can show the period's full
|
|
265
|
-
* activity without charging for it twice.
|
|
266
|
-
*/
|
|
267
|
-
zeroRatedTotal: number;
|
|
268
|
-
paidAmount: number;
|
|
269
|
-
unpaidAmount: number;
|
|
270
|
-
lastRecalculatedAt?: string;
|
|
271
|
-
/**
|
|
272
|
-
* Document lifecycle, kept separate from `status`: an invoice can be
|
|
273
|
-
* part-paid and viewed, or paid and never opened.
|
|
274
|
-
*/
|
|
275
|
-
firstViewedAt?: string;
|
|
276
|
-
lastViewedAt?: string;
|
|
277
|
-
viewCount?: number;
|
|
278
|
-
drift?: InvoiceDrift;
|
|
279
|
-
status: InvoiceStatus | `${InvoiceStatus}`;
|
|
280
|
-
customerId: string;
|
|
281
|
-
items: InvoiceItem[];
|
|
282
|
-
createdAt: string;
|
|
283
|
-
updatedAt: string;
|
|
284
|
-
customerDetails?: Customer;
|
|
285
|
-
paidErrandsCount?: number;
|
|
286
|
-
unpaidErrandsCount?: number;
|
|
287
|
-
}
|
|
288
|
-
interface InvoiceItem {
|
|
289
|
-
id: string;
|
|
290
|
-
invoiceId: string;
|
|
291
|
-
itemType: InvoiceItemType | `${InvoiceItemType}`;
|
|
292
|
-
itemId: string;
|
|
293
|
-
/** Contribution to the invoice total. Zero for a settled line. */
|
|
294
|
-
amount: number;
|
|
295
|
-
/**
|
|
296
|
-
* Shown but not charged — work whose fee the customer already settled, either
|
|
297
|
-
* in cash at the door or prepaid before dispatch.
|
|
298
|
-
*/
|
|
299
|
-
zeroRated?: boolean;
|
|
300
|
-
/**
|
|
301
|
-
* Which already-settled route a zero-rated line took. Unset on a charged line.
|
|
302
|
-
* The invoice's `zeroRatedTotal` is one number for the period; sum lines by
|
|
303
|
-
* this field for the "paid at the door" / "paid in advance" split.
|
|
304
|
-
*/
|
|
305
|
-
settledBy?: 'cash' | 'prepaid';
|
|
306
|
-
/** What the work was worth, on a zero-rated line only. */
|
|
307
|
-
originalAmount?: number;
|
|
308
|
-
description: string;
|
|
309
|
-
date: string;
|
|
310
|
-
createdAt: string;
|
|
311
|
-
updatedAt: string;
|
|
312
|
-
itemDetails?: Errand;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
95
|
/**
|
|
316
96
|
* @deprecated Retired. `SELF_FULFILLMENT` asked "may this business use its own
|
|
317
97
|
* rider instead of ours?" — a question that only makes sense when
|
|
@@ -510,135 +290,350 @@ interface OpeningHours {
|
|
|
510
290
|
open: string;
|
|
511
291
|
close: string;
|
|
512
292
|
}
|
|
513
|
-
/**
|
|
514
|
-
* Which features a business sees.
|
|
515
|
-
*
|
|
516
|
-
* Purely a function of its `type` and `plan` — there is no per-business
|
|
517
|
-
* override layer. A business needing something its plan does not include moves
|
|
518
|
-
* plan; there is no third place to look.
|
|
519
|
-
*/
|
|
520
|
-
interface BusinessModules {
|
|
521
|
-
draftErrands?: boolean;
|
|
522
|
-
maintenance?: boolean;
|
|
523
|
-
fuelLogs?: boolean;
|
|
524
|
-
invoices?: boolean;
|
|
525
|
-
remittances?: boolean;
|
|
526
|
-
/** Manage its own riders: the roster, their pay, what they cost. */
|
|
527
|
-
riders?: boolean;
|
|
293
|
+
/**
|
|
294
|
+
* Which features a business sees.
|
|
295
|
+
*
|
|
296
|
+
* Purely a function of its `type` and `plan` — there is no per-business
|
|
297
|
+
* override layer. A business needing something its plan does not include moves
|
|
298
|
+
* plan; there is no third place to look.
|
|
299
|
+
*/
|
|
300
|
+
interface BusinessModules {
|
|
301
|
+
draftErrands?: boolean;
|
|
302
|
+
maintenance?: boolean;
|
|
303
|
+
fuelLogs?: boolean;
|
|
304
|
+
invoices?: boolean;
|
|
305
|
+
remittances?: boolean;
|
|
306
|
+
/** Manage its own riders: the roster, their pay, what they cost. */
|
|
307
|
+
riders?: boolean;
|
|
308
|
+
/**
|
|
309
|
+
* Route new errands to its own riders rather than to the network.
|
|
310
|
+
*
|
|
311
|
+
* Deliberately separate from `riders`. A merchant can run a roster and still
|
|
312
|
+
* send most deliveries out — managing riders and defaulting to them are
|
|
313
|
+
* different questions, and the old `SELF_FULFILLMENT` capability answered
|
|
314
|
+
* only the second one. Folding them together made every merchant
|
|
315
|
+
* self-fulfil and silently bypass each city's default courier.
|
|
316
|
+
*/
|
|
317
|
+
selfFulfilment?: boolean;
|
|
318
|
+
vehicles?: boolean;
|
|
319
|
+
expenses?: boolean;
|
|
320
|
+
/**
|
|
321
|
+
* Calculate what riders earned for a period and generate payout records.
|
|
322
|
+
* `riders/rider-payouts.controller.ts`, and the `rider-payouts` screens.
|
|
323
|
+
*/
|
|
324
|
+
riderPayouts?: boolean;
|
|
325
|
+
/** External GPS tracker feed; needs an API key to be useful. */
|
|
326
|
+
vehicleTracking?: boolean;
|
|
327
|
+
/**
|
|
328
|
+
* WhatsApp notifications to the business's users and customers on errand
|
|
329
|
+
* events.
|
|
330
|
+
*
|
|
331
|
+
* Declared here so it appears in the plan map and the admin UI, but nothing
|
|
332
|
+
* reads it yet: `updateWhatsappConfig` is still gated on `isOwnFulfiller`.
|
|
333
|
+
* Moving that gate onto this key is the follow-up.
|
|
334
|
+
*/
|
|
335
|
+
whatsapp?: boolean;
|
|
336
|
+
}
|
|
337
|
+
/** Every module key, so a plan map can be checked for completeness. */
|
|
338
|
+
type BusinessModuleKey = keyof BusinessModules;
|
|
339
|
+
/**
|
|
340
|
+
* How a business pays its riders. `defaultPercentage` is the share of the
|
|
341
|
+
* errand fees a rider earned that the rider takes home, used for every rider
|
|
342
|
+
* without their own `payoutPercentage`. `null` (the default) means the business
|
|
343
|
+
* hasn't configured it — those riders simply can't have a payout generated
|
|
344
|
+
* until someone sets a rate, rather than being silently paid zero.
|
|
345
|
+
*
|
|
346
|
+
* `periodType` is only the default cadence the payout screens open on; a payout
|
|
347
|
+
* can always be generated for any period.
|
|
348
|
+
*/
|
|
349
|
+
interface BusinessRiderPaySettings {
|
|
350
|
+
defaultPercentage: number | null;
|
|
351
|
+
periodType: PayoutPeriodType | `${PayoutPeriodType}` | null;
|
|
352
|
+
}
|
|
353
|
+
interface BusinessSettings {
|
|
354
|
+
whatsappNotificationEnabled: boolean;
|
|
355
|
+
whatsapp: BusinessWhatsappConfig;
|
|
356
|
+
isOnline: boolean;
|
|
357
|
+
openingHours: {
|
|
358
|
+
monday: OpeningHours | null;
|
|
359
|
+
tuesday: OpeningHours | null;
|
|
360
|
+
wednesday: OpeningHours | null;
|
|
361
|
+
thursday: OpeningHours | null;
|
|
362
|
+
friday: OpeningHours | null;
|
|
363
|
+
saturday: OpeningHours | null;
|
|
364
|
+
sunday: OpeningHours | null;
|
|
365
|
+
};
|
|
366
|
+
socialLinks: {
|
|
367
|
+
instagram: string | null;
|
|
368
|
+
facebook: string | null;
|
|
369
|
+
twitter: string | null;
|
|
370
|
+
tiktok: string | null;
|
|
371
|
+
website: string | null;
|
|
372
|
+
};
|
|
373
|
+
riderPay?: BusinessRiderPaySettings;
|
|
374
|
+
}
|
|
375
|
+
declare const DEFAULT_BUSINESS_RIDER_PAY_SETTINGS: BusinessRiderPaySettings;
|
|
376
|
+
declare const DEFAULT_BUSINESS_SETTINGS: BusinessSettings;
|
|
377
|
+
interface BusinessMember {
|
|
378
|
+
id: string;
|
|
379
|
+
userId: string;
|
|
380
|
+
businessId: string;
|
|
381
|
+
pgId: string;
|
|
382
|
+
role: BusinessRole | `${BusinessRole}`;
|
|
383
|
+
status: MembershipStatus | `${MembershipStatus}`;
|
|
384
|
+
disabledAt: string | NullOrUndefined;
|
|
385
|
+
disabledBy: string | NullOrUndefined;
|
|
386
|
+
disabledReason: string | NullOrUndefined;
|
|
387
|
+
invitedBy: string | NullOrUndefined;
|
|
388
|
+
userDetails: User | NullOrUndefined;
|
|
389
|
+
invitedByUserDetails: User | NullOrUndefined;
|
|
390
|
+
createdAt: string;
|
|
391
|
+
updatedAt: string | NullOrUndefined;
|
|
392
|
+
}
|
|
393
|
+
declare enum BusinessCourierLinkStatus {
|
|
394
|
+
ACTIVE = "active",
|
|
395
|
+
SUSPENDED = "suspended",
|
|
396
|
+
REVOKED = "revoked"
|
|
397
|
+
}
|
|
398
|
+
interface BusinessCourierLink {
|
|
399
|
+
id: string;
|
|
400
|
+
fromBusinessId: string;
|
|
401
|
+
toBusinessId: string;
|
|
402
|
+
status: BusinessCourierLinkStatus | `${BusinessCourierLinkStatus}`;
|
|
403
|
+
createdBy: string | NullOrUndefined;
|
|
404
|
+
revokedAt: string | NullOrUndefined;
|
|
405
|
+
revokedBy: string | NullOrUndefined;
|
|
406
|
+
revokeReason: string | NullOrUndefined;
|
|
407
|
+
createdAt: string;
|
|
408
|
+
updatedAt: string | NullOrUndefined;
|
|
409
|
+
fromBusinessDetails: Business | NullOrUndefined;
|
|
410
|
+
toBusinessDetails: Business | NullOrUndefined;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
interface CustomerTransactionStats {
|
|
414
|
+
totalSaleCount: number;
|
|
415
|
+
totalSaleAmount: number;
|
|
416
|
+
totalExpenseCount: number;
|
|
417
|
+
totalExpenseAmount: number;
|
|
418
|
+
lastTransactionDate: string | null;
|
|
419
|
+
updatedAt: string;
|
|
420
|
+
}
|
|
421
|
+
interface CustomerAddress {
|
|
422
|
+
id: string;
|
|
423
|
+
label: string;
|
|
424
|
+
address: string;
|
|
425
|
+
landmark?: string;
|
|
426
|
+
cityId?: string;
|
|
427
|
+
location?: {
|
|
428
|
+
type: 'Point';
|
|
429
|
+
coordinates: number[];
|
|
430
|
+
};
|
|
431
|
+
isDefault: boolean;
|
|
432
|
+
/** When an errand last went to or from this address. */
|
|
433
|
+
lastUsedAt?: string;
|
|
434
|
+
createdAt: string;
|
|
435
|
+
updatedAt: string;
|
|
436
|
+
}
|
|
437
|
+
interface Customer {
|
|
438
|
+
id: string;
|
|
439
|
+
businessId: string;
|
|
440
|
+
phoneNumber: string;
|
|
441
|
+
fullName: string;
|
|
442
|
+
cityId: string;
|
|
443
|
+
/** @deprecated Mirrored from the default entry in `addresses`. */
|
|
444
|
+
address: string;
|
|
445
|
+
/** @deprecated Mirrored from the default entry in `addresses`. */
|
|
446
|
+
landmark?: string;
|
|
447
|
+
/** Absent on customers created before the address-book backfill. */
|
|
448
|
+
addresses?: CustomerAddress[];
|
|
449
|
+
createdAt: string;
|
|
450
|
+
updatedAt: string;
|
|
451
|
+
customerBusinessId?: string;
|
|
452
|
+
/** How this customer normally pays; new errands for them start with it. Unset reads as `invoice`. */
|
|
453
|
+
paymentMode?: FeeSettlement;
|
|
454
|
+
transactionStats?: CustomerTransactionStats;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* What a customer owes, computed server-side. `unbilled` is a SET, not a
|
|
458
|
+
* period — it has no start or end date, and `oldestUnbilledAt` is simply its
|
|
459
|
+
* earliest member.
|
|
460
|
+
*/
|
|
461
|
+
interface CustomerBilling {
|
|
462
|
+
/**
|
|
463
|
+
* What is still owed on work that has not reached a statement — net of
|
|
464
|
+
* anything already paid on those errands, which is why it can be smaller than
|
|
465
|
+
* the sum of their prices.
|
|
466
|
+
*/
|
|
467
|
+
unbilledAmount: number;
|
|
468
|
+
/** How many errands are not on a statement yet, paid ones included. */
|
|
469
|
+
unbilledCount: number;
|
|
470
|
+
oldestUnbilledAt: string | null;
|
|
471
|
+
outstandingAmount: number;
|
|
472
|
+
openInvoiceCount: number;
|
|
473
|
+
/** End of the newest period already invoiced. */
|
|
474
|
+
lastInvoicedThrough: string | null;
|
|
475
|
+
/**
|
|
476
|
+
* The next invoice window, derived rather than typed: from the day after the
|
|
477
|
+
* last invoice closed, to today. Consecutive periods therefore tile with no
|
|
478
|
+
* gap and no overlap.
|
|
479
|
+
*/
|
|
480
|
+
nextPeriod: {
|
|
481
|
+
from: string | null;
|
|
482
|
+
to: string;
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
declare enum InvoiceStatus {
|
|
487
|
+
Pending = "pending",
|
|
488
|
+
Processing = "processing",
|
|
489
|
+
Paid = "paid",
|
|
490
|
+
Cancelled = "cancelled",
|
|
491
|
+
Failed = "failed"
|
|
492
|
+
}
|
|
493
|
+
declare enum InvoiceItemType {
|
|
494
|
+
Errand = "errand",
|
|
495
|
+
Manual = "manual"
|
|
496
|
+
}
|
|
497
|
+
declare enum InvoiceGenerationType {
|
|
498
|
+
Auto = "auto",
|
|
499
|
+
Manual = "manual"
|
|
500
|
+
}
|
|
501
|
+
declare enum PaymentOptions {
|
|
502
|
+
Cash = "cash",
|
|
503
|
+
Card = "card",
|
|
504
|
+
BusinessInvoice = "business_invoice"
|
|
505
|
+
}
|
|
506
|
+
declare enum InvoicePaymentMethod {
|
|
507
|
+
Transfer = "transfer",
|
|
508
|
+
Cash = "cash",
|
|
509
|
+
Card = "card",
|
|
510
|
+
Pos = "pos",
|
|
511
|
+
Other = "other"
|
|
512
|
+
}
|
|
513
|
+
declare enum InvoiceEventType {
|
|
514
|
+
Frozen = "frozen",
|
|
515
|
+
ErrandsAdded = "errands_added",
|
|
516
|
+
ErrandRemoved = "errand_removed",
|
|
517
|
+
Recalculated = "recalculated",
|
|
518
|
+
LineAmountChanged = "line_amount_changed",
|
|
519
|
+
PaymentRecorded = "payment_recorded",
|
|
520
|
+
PaymentReversed = "payment_reversed",
|
|
521
|
+
PaymentUpdated = "payment_updated",
|
|
522
|
+
StatusChanged = "status_changed",
|
|
523
|
+
ErrandSettlementChanged = "errand_settlement_changed",
|
|
524
|
+
Viewed = "viewed"
|
|
525
|
+
}
|
|
526
|
+
/** Why an errand in the period was not charged on the statement. */
|
|
527
|
+
declare enum SweepExclusionReason {
|
|
528
|
+
Cancelled = "cancelled",
|
|
529
|
+
AlreadyInvoiced = "already_invoiced",
|
|
530
|
+
Owed = "owed",
|
|
531
|
+
NotInvoiceable = "not_invoiceable"
|
|
532
|
+
}
|
|
533
|
+
interface InvoicePayment {
|
|
534
|
+
id: string;
|
|
535
|
+
invoiceId: string;
|
|
536
|
+
businessId: string;
|
|
537
|
+
amount: number;
|
|
538
|
+
paidAt: string;
|
|
539
|
+
method?: InvoicePaymentMethod | `${InvoicePaymentMethod}`;
|
|
540
|
+
reference?: string;
|
|
541
|
+
note?: string;
|
|
542
|
+
errandId?: string;
|
|
543
|
+
recordedBy: string;
|
|
544
|
+
reversedAt?: string;
|
|
545
|
+
reversedBy?: string;
|
|
546
|
+
reversalReason?: string;
|
|
547
|
+
createdAt: string;
|
|
548
|
+
updatedAt: string;
|
|
549
|
+
}
|
|
550
|
+
interface InvoiceEvent {
|
|
551
|
+
id: string;
|
|
552
|
+
invoiceId: string;
|
|
553
|
+
businessId: string;
|
|
554
|
+
type: InvoiceEventType | `${InvoiceEventType}`;
|
|
555
|
+
actorUserId?: string;
|
|
556
|
+
amountBefore?: number;
|
|
557
|
+
amountAfter?: number;
|
|
558
|
+
summary?: string;
|
|
559
|
+
/** Repeated back to the customer on their own statement. */
|
|
560
|
+
customerVisible: boolean;
|
|
561
|
+
meta?: Record<string, unknown>;
|
|
562
|
+
createdAt: string;
|
|
563
|
+
}
|
|
564
|
+
/** Whether a frozen invoice has fallen out of date, and by how much. */
|
|
565
|
+
interface InvoiceDrift {
|
|
566
|
+
errandCount: number;
|
|
567
|
+
amount: number;
|
|
568
|
+
}
|
|
569
|
+
interface Invoice {
|
|
570
|
+
id: string;
|
|
571
|
+
businessId: string;
|
|
572
|
+
userId: string;
|
|
573
|
+
invoiceNumber: string;
|
|
528
574
|
/**
|
|
529
|
-
*
|
|
530
|
-
*
|
|
531
|
-
*
|
|
532
|
-
* send most deliveries out — managing riders and defaulting to them are
|
|
533
|
-
* different questions, and the old `SELF_FULFILLMENT` capability answered
|
|
534
|
-
* only the second one. Folding them together made every merchant
|
|
535
|
-
* self-fulfil and silently bypass each city's default courier.
|
|
575
|
+
* Slug for the public statement URL, and the only credential guarding it.
|
|
576
|
+
* Written at freeze time, so every invoice is shareable immediately. Absent on
|
|
577
|
+
* invoices frozen before the field existed.
|
|
536
578
|
*/
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
579
|
+
statementSlug?: string;
|
|
580
|
+
startDate: string;
|
|
581
|
+
endDate: string;
|
|
582
|
+
/** What the customer is asked for. Excludes zero-rated lines. */
|
|
583
|
+
totalAmount: number;
|
|
540
584
|
/**
|
|
541
|
-
*
|
|
542
|
-
* `
|
|
585
|
+
* What the settled-at-the-door lines were worth. Never owed, never part of
|
|
586
|
+
* `totalAmount` — carried so the statement can show the period's full
|
|
587
|
+
* activity without charging for it twice.
|
|
543
588
|
*/
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
589
|
+
zeroRatedTotal: number;
|
|
590
|
+
paidAmount: number;
|
|
591
|
+
unpaidAmount: number;
|
|
592
|
+
lastRecalculatedAt?: string;
|
|
547
593
|
/**
|
|
548
|
-
*
|
|
549
|
-
*
|
|
550
|
-
*
|
|
551
|
-
* Declared here so it appears in the plan map and the admin UI, but nothing
|
|
552
|
-
* reads it yet: `updateWhatsappConfig` is still gated on `isOwnFulfiller`.
|
|
553
|
-
* Moving that gate onto this key is the follow-up.
|
|
594
|
+
* Document lifecycle, kept separate from `status`: an invoice can be
|
|
595
|
+
* part-paid and viewed, or paid and never opened.
|
|
554
596
|
*/
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
* balance. `null` (the default) means the business hasn't configured it and the
|
|
563
|
-
* balance is not computed at all.
|
|
564
|
-
*/
|
|
565
|
-
interface BusinessFuelSettings {
|
|
566
|
-
revenuePercent: number | null;
|
|
567
|
-
}
|
|
568
|
-
/**
|
|
569
|
-
* How a business pays its riders. `defaultPercentage` is the share of the
|
|
570
|
-
* errand fees a rider earned that the rider takes home, used for every rider
|
|
571
|
-
* without their own `payoutPercentage`. `null` (the default) means the business
|
|
572
|
-
* hasn't configured it — those riders simply can't have a payout generated
|
|
573
|
-
* until someone sets a rate, rather than being silently paid zero.
|
|
574
|
-
*
|
|
575
|
-
* `periodType` is only the default cadence the payout screens open on; a payout
|
|
576
|
-
* can always be generated for any period.
|
|
577
|
-
*/
|
|
578
|
-
interface BusinessRiderPaySettings {
|
|
579
|
-
defaultPercentage: number | null;
|
|
580
|
-
periodType: PayoutPeriodType | `${PayoutPeriodType}` | null;
|
|
581
|
-
}
|
|
582
|
-
interface BusinessSettings {
|
|
583
|
-
whatsappNotificationEnabled: boolean;
|
|
584
|
-
whatsapp: BusinessWhatsappConfig;
|
|
585
|
-
isOnline: boolean;
|
|
586
|
-
openingHours: {
|
|
587
|
-
monday: OpeningHours | null;
|
|
588
|
-
tuesday: OpeningHours | null;
|
|
589
|
-
wednesday: OpeningHours | null;
|
|
590
|
-
thursday: OpeningHours | null;
|
|
591
|
-
friday: OpeningHours | null;
|
|
592
|
-
saturday: OpeningHours | null;
|
|
593
|
-
sunday: OpeningHours | null;
|
|
594
|
-
};
|
|
595
|
-
socialLinks: {
|
|
596
|
-
instagram: string | null;
|
|
597
|
-
facebook: string | null;
|
|
598
|
-
twitter: string | null;
|
|
599
|
-
tiktok: string | null;
|
|
600
|
-
website: string | null;
|
|
601
|
-
};
|
|
602
|
-
fuel?: BusinessFuelSettings;
|
|
603
|
-
riderPay?: BusinessRiderPaySettings;
|
|
604
|
-
}
|
|
605
|
-
declare const DEFAULT_BUSINESS_FUEL_SETTINGS: BusinessFuelSettings;
|
|
606
|
-
declare const DEFAULT_BUSINESS_RIDER_PAY_SETTINGS: BusinessRiderPaySettings;
|
|
607
|
-
declare const DEFAULT_BUSINESS_SETTINGS: BusinessSettings;
|
|
608
|
-
interface BusinessMember {
|
|
609
|
-
id: string;
|
|
610
|
-
userId: string;
|
|
611
|
-
businessId: string;
|
|
612
|
-
pgId: string;
|
|
613
|
-
role: BusinessRole | `${BusinessRole}`;
|
|
614
|
-
status: MembershipStatus | `${MembershipStatus}`;
|
|
615
|
-
disabledAt: string | NullOrUndefined;
|
|
616
|
-
disabledBy: string | NullOrUndefined;
|
|
617
|
-
disabledReason: string | NullOrUndefined;
|
|
618
|
-
invitedBy: string | NullOrUndefined;
|
|
619
|
-
userDetails: User | NullOrUndefined;
|
|
620
|
-
invitedByUserDetails: User | NullOrUndefined;
|
|
597
|
+
firstViewedAt?: string;
|
|
598
|
+
lastViewedAt?: string;
|
|
599
|
+
viewCount?: number;
|
|
600
|
+
drift?: InvoiceDrift;
|
|
601
|
+
status: InvoiceStatus | `${InvoiceStatus}`;
|
|
602
|
+
customerId: string;
|
|
603
|
+
items: InvoiceItem[];
|
|
621
604
|
createdAt: string;
|
|
622
|
-
updatedAt: string
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
605
|
+
updatedAt: string;
|
|
606
|
+
customerDetails?: Customer;
|
|
607
|
+
/** The issuing courier, on the received list and on detail. */
|
|
608
|
+
courierBusiness?: Pick<Business, 'name' | 'logoUrl' | 'officeNumber'>;
|
|
609
|
+
paidErrandsCount?: number;
|
|
610
|
+
unpaidErrandsCount?: number;
|
|
628
611
|
}
|
|
629
|
-
interface
|
|
612
|
+
interface InvoiceItem {
|
|
630
613
|
id: string;
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
614
|
+
invoiceId: string;
|
|
615
|
+
itemType: InvoiceItemType | `${InvoiceItemType}`;
|
|
616
|
+
itemId: string;
|
|
617
|
+
/** Contribution to the invoice total. Zero for a settled line. */
|
|
618
|
+
amount: number;
|
|
619
|
+
/**
|
|
620
|
+
* Shown but not charged — work whose fee the customer already settled, either
|
|
621
|
+
* in cash at the door or prepaid before dispatch.
|
|
622
|
+
*/
|
|
623
|
+
zeroRated?: boolean;
|
|
624
|
+
/**
|
|
625
|
+
* Which already-settled route a zero-rated line took. Unset on a charged line.
|
|
626
|
+
* The invoice's `zeroRatedTotal` is one number for the period; sum lines by
|
|
627
|
+
* this field for the "paid at the door" / "paid in advance" split.
|
|
628
|
+
*/
|
|
629
|
+
settledBy?: 'cash' | 'prepaid';
|
|
630
|
+
/** What the work was worth, on a zero-rated line only. */
|
|
631
|
+
originalAmount?: number;
|
|
632
|
+
description: string;
|
|
633
|
+
date: string;
|
|
638
634
|
createdAt: string;
|
|
639
|
-
updatedAt: string
|
|
640
|
-
|
|
641
|
-
toBusinessDetails: Business | NullOrUndefined;
|
|
635
|
+
updatedAt: string;
|
|
636
|
+
itemDetails?: Errand;
|
|
642
637
|
}
|
|
643
638
|
|
|
644
639
|
declare enum VehicleType {
|
|
@@ -737,95 +732,6 @@ interface VehiclePerformanceData {
|
|
|
737
732
|
totals: VehiclePerformanceTotals;
|
|
738
733
|
filters: VehiclePerformanceFilters;
|
|
739
734
|
}
|
|
740
|
-
declare enum FuelDueStatus {
|
|
741
|
-
/** Worked through the fuel it was last given. Fuel this one. */
|
|
742
|
-
Due = "DUE",
|
|
743
|
-
/** Still running on fuel already paid for. Leave it. */
|
|
744
|
-
Ok = "OK"
|
|
745
|
-
}
|
|
746
|
-
/** What the vehicle has done since the fuel it was last given. */
|
|
747
|
-
interface FuelSinceLastRefuel {
|
|
748
|
-
revenue: number;
|
|
749
|
-
errandCount: number;
|
|
750
|
-
fuelEarned: number;
|
|
751
|
-
}
|
|
752
|
-
interface FuelDueItem {
|
|
753
|
-
vehicleId: string;
|
|
754
|
-
vehicleNumber: string;
|
|
755
|
-
shortName: string | null;
|
|
756
|
-
vehicleType: VehicleType | `${VehicleType}`;
|
|
757
|
-
/**
|
|
758
|
-
* The fuel gauge, and the field to lead a UI with: how much of the fuel this
|
|
759
|
-
* vehicle was last given it has worked through. 0 is freshly filled, 100 is
|
|
760
|
-
* due, past 100 is overdue. Null when it has never been fuelled.
|
|
761
|
-
*/
|
|
762
|
-
fuelUsedPercent: number | null;
|
|
763
|
-
/** `fuelEarned - fuelSpent`, in naira — how much to give, not whether to. */
|
|
764
|
-
fuelDue: number;
|
|
765
|
-
fuelEarned: number;
|
|
766
|
-
fuelSpent: number;
|
|
767
|
-
revenue: number;
|
|
768
|
-
errandCount: number;
|
|
769
|
-
refuelCount: number;
|
|
770
|
-
/** What this vehicle is typically fuelled with; null if never fuelled. */
|
|
771
|
-
averageRefuelCost: number | null;
|
|
772
|
-
/**
|
|
773
|
-
* The figure has drifted far past what this vehicle is ever fuelled with —
|
|
774
|
-
* the signature of a wrong `revenuePercent` compounding rather than a real
|
|
775
|
-
* fuel need. Prompt to check the percentage instead of showing the figure.
|
|
776
|
-
*/
|
|
777
|
-
needsCalibration: boolean;
|
|
778
|
-
lastRefuel: {
|
|
779
|
-
at: string;
|
|
780
|
-
cost: number;
|
|
781
|
-
} | null;
|
|
782
|
-
sinceLastRefuel: FuelSinceLastRefuel | null;
|
|
783
|
-
dueStatus: FuelDueStatus | `${FuelDueStatus}`;
|
|
784
|
-
/** Counting starts here when the prediction has been reset; null otherwise. */
|
|
785
|
-
countingFrom: string | null;
|
|
786
|
-
}
|
|
787
|
-
interface FuelDueTotals {
|
|
788
|
-
totalDue: number;
|
|
789
|
-
totalEarned: number;
|
|
790
|
-
totalSpent: number;
|
|
791
|
-
vehiclesDue: number;
|
|
792
|
-
vehiclesNeedingCalibration: number;
|
|
793
|
-
}
|
|
794
|
-
interface FuelDueData {
|
|
795
|
-
/** False when the business has not set `settings.fuel.revenuePercent`. */
|
|
796
|
-
configured: boolean;
|
|
797
|
-
revenuePercent: number | null;
|
|
798
|
-
/** Only when `configured` is false: what history says the percent should be. */
|
|
799
|
-
suggestedPercent?: number | null;
|
|
800
|
-
vehicles: FuelDueItem[];
|
|
801
|
-
totals: FuelDueTotals;
|
|
802
|
-
}
|
|
803
|
-
type FuelSuggestionConfidence = 'low' | 'medium' | 'high';
|
|
804
|
-
interface FuelPercentSuggestion {
|
|
805
|
-
/**
|
|
806
|
-
* Fuel spend as a share of the revenue that earned it, to one decimal —
|
|
807
|
-
* the percentage this business has actually been running at. Null when
|
|
808
|
-
* there is too little history; `reason` says which.
|
|
809
|
-
*/
|
|
810
|
-
suggestedPercent: number | null;
|
|
811
|
-
/**
|
|
812
|
-
* Read off the number of refuels behind the suggestion, not the length of
|
|
813
|
-
* the window. Fuel bought near a window's edge is burnt outside it, so a
|
|
814
|
-
* thin refuel count gives a volatile ratio however many days were read.
|
|
815
|
-
*/
|
|
816
|
-
confidence: FuelSuggestionConfidence;
|
|
817
|
-
reason: string | null;
|
|
818
|
-
days: number;
|
|
819
|
-
basedOn: {
|
|
820
|
-
totalFuelCost: number;
|
|
821
|
-
totalRevenue: number;
|
|
822
|
-
refuelCount: number;
|
|
823
|
-
errandCount: number;
|
|
824
|
-
refuelledVehicles: number;
|
|
825
|
-
/** Refuels per vehicle — what says whether the ratio has settled. */
|
|
826
|
-
refuelsPerVehicle: number | null;
|
|
827
|
-
};
|
|
828
|
-
}
|
|
829
735
|
|
|
830
736
|
type Rider = {
|
|
831
737
|
id: string;
|
|
@@ -1108,7 +1014,6 @@ interface Errand {
|
|
|
1108
1014
|
aliasId: string;
|
|
1109
1015
|
updatedAt: Date;
|
|
1110
1016
|
createdAt: Date;
|
|
1111
|
-
errandRating?: string | ErrandRating;
|
|
1112
1017
|
additionalData?: string;
|
|
1113
1018
|
deliveryDate?: Date;
|
|
1114
1019
|
cityId?: City;
|
|
@@ -1177,10 +1082,11 @@ interface AggregatedErrand extends Errand {
|
|
|
1177
1082
|
riderUserDetails?: User;
|
|
1178
1083
|
}
|
|
1179
1084
|
type PublicBusiness = Pick<Business, 'id' | 'name' | 'logoUrl' | 'officeNumber'>;
|
|
1180
|
-
type PublicPlace = Pick<AddressDetails, 'fullName' | 'address' | 'landmark'>;
|
|
1085
|
+
type PublicPlace = Pick<AddressDetails, 'fullName' | 'address' | 'landmark' | 'location'>;
|
|
1181
1086
|
/**
|
|
1182
|
-
* `GET /errands/:alias/tracking`, which
|
|
1183
|
-
* cut down to what a tracking page shows: same
|
|
1087
|
+
* `GET /errands/:alias/tracking` and `GET /errands/track/:code`, which need no
|
|
1088
|
+
* login. An `AggregatedErrand` cut down to what a tracking page shows: same
|
|
1089
|
+
* field names, fewer fields.
|
|
1184
1090
|
*/
|
|
1185
1091
|
type PublicTrackedErrand = Pick<AggregatedErrand, 'aliasId' | 'deliveryStatus' | 'updatedAt' | 'nameOfItem' | 'additionalData'> & {
|
|
1186
1092
|
errandTimeline: (Pick<ErrandTimeline, 'currTimelineIndex'> & {
|
|
@@ -1201,17 +1107,6 @@ type PublicTrackedErrand = Pick<AggregatedErrand, 'aliasId' | 'deliveryStatus' |
|
|
|
1201
1107
|
cityName?: string;
|
|
1202
1108
|
};
|
|
1203
1109
|
};
|
|
1204
|
-
interface ErrandRating {
|
|
1205
|
-
createdAt: string;
|
|
1206
|
-
errandId: string;
|
|
1207
|
-
rating: number;
|
|
1208
|
-
ratingText: string;
|
|
1209
|
-
riderId: string;
|
|
1210
|
-
updatedAt: string;
|
|
1211
|
-
userId: string;
|
|
1212
|
-
version: number;
|
|
1213
|
-
_id: string;
|
|
1214
|
-
}
|
|
1215
1110
|
declare enum AddressTypes {
|
|
1216
1111
|
DeliveryAddress = "deliveryAddress",
|
|
1217
1112
|
PickupAddress = "pickupAddress"
|
|
@@ -1254,25 +1149,18 @@ type AddressDetails = {
|
|
|
1254
1149
|
cityId: string;
|
|
1255
1150
|
address: string;
|
|
1256
1151
|
fullName: string;
|
|
1257
|
-
|
|
1152
|
+
/** GeoJSON point, `[longitude, latitude]`. Absent when the stop has no coordinates. */
|
|
1153
|
+
location?: {
|
|
1154
|
+
type: 'Point';
|
|
1258
1155
|
coordinates: number[];
|
|
1259
1156
|
};
|
|
1260
1157
|
mobileNumber?: string;
|
|
1261
1158
|
alternateMobileNumber?: string;
|
|
1262
1159
|
landmark?: string;
|
|
1263
1160
|
addressId?: string;
|
|
1161
|
+
/** The saved customer this stop came from. */
|
|
1162
|
+
customerId?: string;
|
|
1264
1163
|
};
|
|
1265
|
-
interface ErrandReviewLink {
|
|
1266
|
-
id: string;
|
|
1267
|
-
errandId: string;
|
|
1268
|
-
phoneNumber: string;
|
|
1269
|
-
token: string;
|
|
1270
|
-
expiresAt: string;
|
|
1271
|
-
isUsed: boolean;
|
|
1272
|
-
usedAt: string;
|
|
1273
|
-
createdBy: string;
|
|
1274
|
-
createdAt: string;
|
|
1275
|
-
}
|
|
1276
1164
|
declare enum DraftErrandStatus {
|
|
1277
1165
|
Draft = "draft",
|
|
1278
1166
|
RiderCompleted = "rider_completed",
|
|
@@ -1304,23 +1192,6 @@ interface DraftErrand {
|
|
|
1304
1192
|
riderDetails?: Rider;
|
|
1305
1193
|
riderUserDetails?: User | null;
|
|
1306
1194
|
}
|
|
1307
|
-
type ErrandDeliveryTiming = 'early' | 'on_time' | 'late';
|
|
1308
|
-
type ErrandPackagingQuality = 'excellent' | 'average' | 'poor';
|
|
1309
|
-
type ErrandRiderBehavior = 'outstanding' | 'acceptable' | 'unsatisfactory';
|
|
1310
|
-
interface ErrandReview {
|
|
1311
|
-
id: string;
|
|
1312
|
-
errandId: string;
|
|
1313
|
-
riderId: string;
|
|
1314
|
-
reviewText: string;
|
|
1315
|
-
rating: number;
|
|
1316
|
-
deliveryTiming: ErrandDeliveryTiming;
|
|
1317
|
-
packagingQuality: ErrandPackagingQuality;
|
|
1318
|
-
riderBehavior: ErrandRiderBehavior;
|
|
1319
|
-
reviewerMobile: string;
|
|
1320
|
-
reviewerType: 'creator' | 'recipient';
|
|
1321
|
-
createdAt: string;
|
|
1322
|
-
updatedAt: string;
|
|
1323
|
-
}
|
|
1324
1195
|
|
|
1325
1196
|
declare enum NotificationType {
|
|
1326
1197
|
Errand = "errand",
|
|
@@ -1741,6 +1612,7 @@ declare enum WhatsappButtonType {
|
|
|
1741
1612
|
}
|
|
1742
1613
|
declare enum WhatsappTemplateParamSource {
|
|
1743
1614
|
ERRAND_ALIAS_ID = "errand.aliasId",
|
|
1615
|
+
ERRAND_TRACKING_CODE = "errand.trackingCode",
|
|
1744
1616
|
ERRAND_PICKUP_NAME = "errand.pickupDetails.fullName",
|
|
1745
1617
|
ERRAND_DELIVERY_NAME = "errand.deliveryDetails.fullName",
|
|
1746
1618
|
BUSINESS_NAME = "business.name",
|
|
@@ -1800,67 +1672,6 @@ interface WhatsappSendLog {
|
|
|
1800
1672
|
sentAt: string | Date;
|
|
1801
1673
|
}
|
|
1802
1674
|
|
|
1803
|
-
declare enum PortalStatus {
|
|
1804
|
-
Draft = "draft",
|
|
1805
|
-
Published = "published"
|
|
1806
|
-
}
|
|
1807
|
-
interface BusinessPortal {
|
|
1808
|
-
id: string;
|
|
1809
|
-
businessId: string;
|
|
1810
|
-
/** Compose the URL yourself, e.g. `https://mydoormot.io/b/${handle}`. */
|
|
1811
|
-
handle: string;
|
|
1812
|
-
previousHandles: string[];
|
|
1813
|
-
status: PortalStatus;
|
|
1814
|
-
publishedAt?: string;
|
|
1815
|
-
createdAt: string;
|
|
1816
|
-
updatedAt: string;
|
|
1817
|
-
}
|
|
1818
|
-
interface PublicPortalBusiness {
|
|
1819
|
-
name?: string;
|
|
1820
|
-
description?: string;
|
|
1821
|
-
officeNumber?: string;
|
|
1822
|
-
address?: string;
|
|
1823
|
-
logoUrl?: string;
|
|
1824
|
-
logoBlurHash?: string;
|
|
1825
|
-
coverImageUrl?: string;
|
|
1826
|
-
coverImageBlurHash?: string;
|
|
1827
|
-
isOnline?: boolean;
|
|
1828
|
-
openingHours?: Record<string, unknown>;
|
|
1829
|
-
socialLinks?: Record<string, unknown>;
|
|
1830
|
-
}
|
|
1831
|
-
/** `GET /api/v2/portals/:handle` — unauthenticated. */
|
|
1832
|
-
interface PublicPortal {
|
|
1833
|
-
handle: string;
|
|
1834
|
-
/** Set when the requested handle was retired — redirect to `handle`. */
|
|
1835
|
-
redirectedFrom?: string;
|
|
1836
|
-
business: PublicPortalBusiness;
|
|
1837
|
-
}
|
|
1838
|
-
/** `GET /api/v2/portals/handles/:handle` — unauthenticated. */
|
|
1839
|
-
interface PortalHandleAvailability {
|
|
1840
|
-
/** Normalised — what you would actually be assigned. */
|
|
1841
|
-
handle: string;
|
|
1842
|
-
available: boolean;
|
|
1843
|
-
reason?: string;
|
|
1844
|
-
}
|
|
1845
|
-
|
|
1846
|
-
/**
|
|
1847
|
-
* Platform-wide suggestions for businesses that haven't set their own values.
|
|
1848
|
-
* Prefill forms only — e.g. `business.settings.fuel?.revenuePercent ??
|
|
1849
|
-
* platform.fuel.revenuePercent`. Never applied to a business's calculations.
|
|
1850
|
-
*/
|
|
1851
|
-
interface PlatformSettings {
|
|
1852
|
-
fuel: {
|
|
1853
|
-
/** Current pump price per litre, for prefilling refuel logs. */
|
|
1854
|
-
pumpPrice: number | null;
|
|
1855
|
-
revenuePercent: number | null;
|
|
1856
|
-
};
|
|
1857
|
-
riderPay: {
|
|
1858
|
-
defaultPercentage: number | null;
|
|
1859
|
-
};
|
|
1860
|
-
createdAt: string;
|
|
1861
|
-
updatedAt: string;
|
|
1862
|
-
}
|
|
1863
|
-
|
|
1864
1675
|
/** GeoJSON Point. `coordinates` is `[longitude, latitude]`. */
|
|
1865
1676
|
type GeoPoint = {
|
|
1866
1677
|
type: 'Point';
|
|
@@ -1942,6 +1753,60 @@ type LynqoneIntegrationSummary = {
|
|
|
1942
1753
|
trackerCount: number;
|
|
1943
1754
|
};
|
|
1944
1755
|
|
|
1756
|
+
declare enum ErrandRatingTag {
|
|
1757
|
+
OnTime = "on-time",
|
|
1758
|
+
CalledBeforeArriving = "called-before-arriving",
|
|
1759
|
+
Polite = "polite",
|
|
1760
|
+
ItemInGoodShape = "item-in-good-shape",
|
|
1761
|
+
FollowedDirections = "followed-directions",
|
|
1762
|
+
Late = "late",
|
|
1763
|
+
DidNotCall = "did-not-call",
|
|
1764
|
+
Rude = "rude",
|
|
1765
|
+
ItemDamaged = "item-damaged",
|
|
1766
|
+
HardToFindMe = "hard-to-find-me"
|
|
1767
|
+
}
|
|
1768
|
+
declare const goodRatingTags: ErrandRatingTag[];
|
|
1769
|
+
declare const badRatingTags: ErrandRatingTag[];
|
|
1770
|
+
declare enum ErrandRatingStatus {
|
|
1771
|
+
Visible = "visible",
|
|
1772
|
+
Hidden = "hidden"
|
|
1773
|
+
}
|
|
1774
|
+
interface PublicErrandRating {
|
|
1775
|
+
stars: number;
|
|
1776
|
+
tags: ErrandRatingTag[];
|
|
1777
|
+
comment: string | null;
|
|
1778
|
+
editableUntil: Date;
|
|
1779
|
+
}
|
|
1780
|
+
type PublicTrackedErrandWithRating = PublicTrackedErrand & {
|
|
1781
|
+
canRate: boolean;
|
|
1782
|
+
rating: PublicErrandRating | null;
|
|
1783
|
+
};
|
|
1784
|
+
interface ErrandRating {
|
|
1785
|
+
id: string;
|
|
1786
|
+
errandId: string;
|
|
1787
|
+
errandDetails?: {
|
|
1788
|
+
aliasId: string;
|
|
1789
|
+
};
|
|
1790
|
+
businessId: string;
|
|
1791
|
+
riderId: string | null;
|
|
1792
|
+
stars: number;
|
|
1793
|
+
tags: ErrandRatingTag[];
|
|
1794
|
+
comment: string | null;
|
|
1795
|
+
editCount: number;
|
|
1796
|
+
status: ErrandRatingStatus;
|
|
1797
|
+
hiddenAt?: Date;
|
|
1798
|
+
hiddenBy?: string;
|
|
1799
|
+
hiddenReason?: string;
|
|
1800
|
+
createdAt: Date;
|
|
1801
|
+
updatedAt: Date;
|
|
1802
|
+
}
|
|
1803
|
+
interface RiderRatingSummary {
|
|
1804
|
+
count: number;
|
|
1805
|
+
average: number | null;
|
|
1806
|
+
tags: Partial<Record<ErrandRatingTag, number>>;
|
|
1807
|
+
}
|
|
1808
|
+
declare const minRatingsForAverage = 10;
|
|
1809
|
+
|
|
1945
1810
|
interface PaginateResult<T> {
|
|
1946
1811
|
docs: T[];
|
|
1947
1812
|
totalDocs: number;
|
|
@@ -1964,4 +1829,4 @@ declare enum LinkDestination {
|
|
|
1964
1829
|
}
|
|
1965
1830
|
type NullOrUndefined = null | undefined;
|
|
1966
1831
|
|
|
1967
|
-
export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type
|
|
1832
|
+
export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type BusinessLimits, type BusinessMember, type BusinessModuleKey, type BusinessModuleStates, type BusinessModules, type BusinessPg, BusinessPlan, type BusinessRiderPaySettings, BusinessRole, type BusinessSettings, BusinessStatus, BusinessType, type BusinessWhatsappConfig, type City, type Collection, type ConnectionStatus, type Customer, type CustomerAddress, type CustomerBilling, type CustomerTransactionStats, DEFAULT_BUSINESS_RIDER_PAY_SETTINGS, DEFAULT_BUSINESS_SETTINGS, DeliveryStatus, type DraftErrand, DraftErrandStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, ErrandFulfilment, ErrandInvoiceState, type ErrandRating, ErrandRatingStatus, ErrandRatingTag, ErrandStatus, type ErrandTimeline, type ExpensePaidBy, FeePaymentStatus, FeeSettlement, type GeoPoint, GlobalRoles, type IntegrationProvider, type IntegrationStatus, type Invoice, type InvoiceDrift, type InvoiceEvent, InvoiceEventType, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, type InvoicePayment, InvoicePaymentMethod, InvoiceStatus, type LatLng, LinkDestination, type LynqoneIntegrationSummary, type MaintenanceItem, type MaintenancePartUsage, type MaintenanceRecord, type MaintenanceStats, type MaintenanceStatsSummary, type MaintenanceTopItem, MembershipStatus, type ModuleState, type MotionState, type Notification, type NotificationData, NotificationType, type NullOrUndefined, type OpeningHours, PLAN_LIMIT_REACHED, PLAN_REQUIRED, type PaginateResult, PaymentOptions, PayoutPeriodType, PayoutRateSource, type PendingErrand, type Product, type ProductCategory, type ProductImage, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductTag, type ProductVariant, type ProductVariantPrice, type PublicErrandRating, type PublicTrackedErrand, type PublicTrackedErrandWithRating, RemittanceStatus, type Rider, type RiderPayout, type RiderPayoutAdjustment, type RiderPayoutPreview, type RiderPayoutPreviewItem, RiderPayoutStatus, type RiderPerformanceItem, type RiderPerformanceStats, type RiderPerformanceSummary, type RiderPerformanceTimeSeries, type RiderRatingSummary, type RiderSettlement, type RiderWithUserDetails, RoleType, type State, SweepExclusionReason, type Tracker, type TrackerPosition, type TrackerStatus, type TrackerType, type Transaction, type TransactionCategory, type TransactionItem, type TransactionRiderUser, type TransactionType, type TransactionWithCategory, type TransactionWithJoin, type User, type UserAddress, type Vehicle, type VehicleErrandStats, type VehicleFuelStats, type VehicleLog, type VehicleLogStatsSummary, VehicleLogType, type VehicleLogWithErrands, type VehicleMaintenanceStats, type VehiclePerformanceData, type VehiclePerformanceFilters, type VehiclePerformanceItem, type VehiclePerformanceTotals, VehicleType, type VehicleWithRider, type Vendor, WhatsappButtonType, WhatsappComponentType, WhatsappEvent, WhatsappRecipient, type WhatsappSendLog, type WhatsappTemplate, type WhatsappTemplateButton, type WhatsappTemplateComponent, WhatsappTemplateMetaStatus, WhatsappTemplateParamSource, type WhatsappTemplateSource, badRatingTags, errandTimeline, goodRatingTags, minRatingsForAverage };
|