@mydoormot/app-types 2.3.1 → 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 +18 -18
- package/CHANGELOG.md +6 -0
- package/dist/index.cjs +48 -2
- package/dist/index.d.cts +286 -228
- package/dist/index.d.ts +286 -228
- package/dist/index.js +42 -1
- package/package.json +1 -1
- package/src/errand.ts +7 -4
- package/src/index.ts +1 -0
- package/src/invoice.ts +3 -0
- package/src/rating.ts +73 -0
- package/src/whatsapp.ts +1 -0
package/dist/index.d.ts
CHANGED
|
@@ -92,230 +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
|
-
/** When an errand last went to or from this address. */
|
|
115
|
-
lastUsedAt?: string;
|
|
116
|
-
createdAt: string;
|
|
117
|
-
updatedAt: string;
|
|
118
|
-
}
|
|
119
|
-
interface Customer {
|
|
120
|
-
id: string;
|
|
121
|
-
businessId: string;
|
|
122
|
-
phoneNumber: string;
|
|
123
|
-
fullName: string;
|
|
124
|
-
cityId: string;
|
|
125
|
-
/** @deprecated Mirrored from the default entry in `addresses`. */
|
|
126
|
-
address: string;
|
|
127
|
-
/** @deprecated Mirrored from the default entry in `addresses`. */
|
|
128
|
-
landmark?: string;
|
|
129
|
-
/** Absent on customers created before the address-book backfill. */
|
|
130
|
-
addresses?: CustomerAddress[];
|
|
131
|
-
createdAt: string;
|
|
132
|
-
updatedAt: string;
|
|
133
|
-
customerBusinessId?: string;
|
|
134
|
-
/** How this customer normally pays; new errands for them start with it. Unset reads as `invoice`. */
|
|
135
|
-
paymentMode?: FeeSettlement;
|
|
136
|
-
transactionStats?: CustomerTransactionStats;
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* What a customer owes, computed server-side. `unbilled` is a SET, not a
|
|
140
|
-
* period — it has no start or end date, and `oldestUnbilledAt` is simply its
|
|
141
|
-
* earliest member.
|
|
142
|
-
*/
|
|
143
|
-
interface CustomerBilling {
|
|
144
|
-
/**
|
|
145
|
-
* What is still owed on work that has not reached a statement — net of
|
|
146
|
-
* anything already paid on those errands, which is why it can be smaller than
|
|
147
|
-
* the sum of their prices.
|
|
148
|
-
*/
|
|
149
|
-
unbilledAmount: number;
|
|
150
|
-
/** How many errands are not on a statement yet, paid ones included. */
|
|
151
|
-
unbilledCount: number;
|
|
152
|
-
oldestUnbilledAt: string | null;
|
|
153
|
-
outstandingAmount: number;
|
|
154
|
-
openInvoiceCount: number;
|
|
155
|
-
/** End of the newest period already invoiced. */
|
|
156
|
-
lastInvoicedThrough: string | null;
|
|
157
|
-
/**
|
|
158
|
-
* The next invoice window, derived rather than typed: from the day after the
|
|
159
|
-
* last invoice closed, to today. Consecutive periods therefore tile with no
|
|
160
|
-
* gap and no overlap.
|
|
161
|
-
*/
|
|
162
|
-
nextPeriod: {
|
|
163
|
-
from: string | null;
|
|
164
|
-
to: string;
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
declare enum InvoiceStatus {
|
|
169
|
-
Pending = "pending",
|
|
170
|
-
Processing = "processing",
|
|
171
|
-
Paid = "paid",
|
|
172
|
-
Cancelled = "cancelled",
|
|
173
|
-
Failed = "failed"
|
|
174
|
-
}
|
|
175
|
-
declare enum InvoiceItemType {
|
|
176
|
-
Errand = "errand",
|
|
177
|
-
Manual = "manual"
|
|
178
|
-
}
|
|
179
|
-
declare enum InvoiceGenerationType {
|
|
180
|
-
Auto = "auto",
|
|
181
|
-
Manual = "manual"
|
|
182
|
-
}
|
|
183
|
-
declare enum PaymentOptions {
|
|
184
|
-
Cash = "cash",
|
|
185
|
-
Card = "card",
|
|
186
|
-
BusinessInvoice = "business_invoice"
|
|
187
|
-
}
|
|
188
|
-
declare enum InvoicePaymentMethod {
|
|
189
|
-
Transfer = "transfer",
|
|
190
|
-
Cash = "cash",
|
|
191
|
-
Card = "card",
|
|
192
|
-
Pos = "pos",
|
|
193
|
-
Other = "other"
|
|
194
|
-
}
|
|
195
|
-
declare enum InvoiceEventType {
|
|
196
|
-
Frozen = "frozen",
|
|
197
|
-
ErrandsAdded = "errands_added",
|
|
198
|
-
ErrandRemoved = "errand_removed",
|
|
199
|
-
Recalculated = "recalculated",
|
|
200
|
-
LineAmountChanged = "line_amount_changed",
|
|
201
|
-
PaymentRecorded = "payment_recorded",
|
|
202
|
-
PaymentReversed = "payment_reversed",
|
|
203
|
-
PaymentUpdated = "payment_updated",
|
|
204
|
-
StatusChanged = "status_changed",
|
|
205
|
-
ErrandSettlementChanged = "errand_settlement_changed",
|
|
206
|
-
Viewed = "viewed"
|
|
207
|
-
}
|
|
208
|
-
/** Why an errand in the period was not charged on the statement. */
|
|
209
|
-
declare enum SweepExclusionReason {
|
|
210
|
-
Cancelled = "cancelled",
|
|
211
|
-
AlreadyInvoiced = "already_invoiced",
|
|
212
|
-
Owed = "owed",
|
|
213
|
-
NotInvoiceable = "not_invoiceable"
|
|
214
|
-
}
|
|
215
|
-
interface InvoicePayment {
|
|
216
|
-
id: string;
|
|
217
|
-
invoiceId: string;
|
|
218
|
-
businessId: string;
|
|
219
|
-
amount: number;
|
|
220
|
-
paidAt: string;
|
|
221
|
-
method?: InvoicePaymentMethod | `${InvoicePaymentMethod}`;
|
|
222
|
-
reference?: string;
|
|
223
|
-
note?: string;
|
|
224
|
-
errandId?: string;
|
|
225
|
-
recordedBy: string;
|
|
226
|
-
reversedAt?: string;
|
|
227
|
-
reversedBy?: string;
|
|
228
|
-
reversalReason?: string;
|
|
229
|
-
createdAt: string;
|
|
230
|
-
updatedAt: string;
|
|
231
|
-
}
|
|
232
|
-
interface InvoiceEvent {
|
|
233
|
-
id: string;
|
|
234
|
-
invoiceId: string;
|
|
235
|
-
businessId: string;
|
|
236
|
-
type: InvoiceEventType | `${InvoiceEventType}`;
|
|
237
|
-
actorUserId?: string;
|
|
238
|
-
amountBefore?: number;
|
|
239
|
-
amountAfter?: number;
|
|
240
|
-
summary?: string;
|
|
241
|
-
/** Repeated back to the customer on their own statement. */
|
|
242
|
-
customerVisible: boolean;
|
|
243
|
-
meta?: Record<string, unknown>;
|
|
244
|
-
createdAt: string;
|
|
245
|
-
}
|
|
246
|
-
/** Whether a frozen invoice has fallen out of date, and by how much. */
|
|
247
|
-
interface InvoiceDrift {
|
|
248
|
-
errandCount: number;
|
|
249
|
-
amount: number;
|
|
250
|
-
}
|
|
251
|
-
interface Invoice {
|
|
252
|
-
id: string;
|
|
253
|
-
businessId: string;
|
|
254
|
-
userId: string;
|
|
255
|
-
invoiceNumber: string;
|
|
256
|
-
/**
|
|
257
|
-
* Slug for the public statement URL, and the only credential guarding it.
|
|
258
|
-
* Written at freeze time, so every invoice is shareable immediately. Absent on
|
|
259
|
-
* invoices frozen before the field existed.
|
|
260
|
-
*/
|
|
261
|
-
statementSlug?: string;
|
|
262
|
-
startDate: string;
|
|
263
|
-
endDate: string;
|
|
264
|
-
/** What the customer is asked for. Excludes zero-rated lines. */
|
|
265
|
-
totalAmount: number;
|
|
266
|
-
/**
|
|
267
|
-
* What the settled-at-the-door lines were worth. Never owed, never part of
|
|
268
|
-
* `totalAmount` — carried so the statement can show the period's full
|
|
269
|
-
* activity without charging for it twice.
|
|
270
|
-
*/
|
|
271
|
-
zeroRatedTotal: number;
|
|
272
|
-
paidAmount: number;
|
|
273
|
-
unpaidAmount: number;
|
|
274
|
-
lastRecalculatedAt?: string;
|
|
275
|
-
/**
|
|
276
|
-
* Document lifecycle, kept separate from `status`: an invoice can be
|
|
277
|
-
* part-paid and viewed, or paid and never opened.
|
|
278
|
-
*/
|
|
279
|
-
firstViewedAt?: string;
|
|
280
|
-
lastViewedAt?: string;
|
|
281
|
-
viewCount?: number;
|
|
282
|
-
drift?: InvoiceDrift;
|
|
283
|
-
status: InvoiceStatus | `${InvoiceStatus}`;
|
|
284
|
-
customerId: string;
|
|
285
|
-
items: InvoiceItem[];
|
|
286
|
-
createdAt: string;
|
|
287
|
-
updatedAt: string;
|
|
288
|
-
customerDetails?: Customer;
|
|
289
|
-
paidErrandsCount?: number;
|
|
290
|
-
unpaidErrandsCount?: number;
|
|
291
|
-
}
|
|
292
|
-
interface InvoiceItem {
|
|
293
|
-
id: string;
|
|
294
|
-
invoiceId: string;
|
|
295
|
-
itemType: InvoiceItemType | `${InvoiceItemType}`;
|
|
296
|
-
itemId: string;
|
|
297
|
-
/** Contribution to the invoice total. Zero for a settled line. */
|
|
298
|
-
amount: number;
|
|
299
|
-
/**
|
|
300
|
-
* Shown but not charged — work whose fee the customer already settled, either
|
|
301
|
-
* in cash at the door or prepaid before dispatch.
|
|
302
|
-
*/
|
|
303
|
-
zeroRated?: boolean;
|
|
304
|
-
/**
|
|
305
|
-
* Which already-settled route a zero-rated line took. Unset on a charged line.
|
|
306
|
-
* The invoice's `zeroRatedTotal` is one number for the period; sum lines by
|
|
307
|
-
* this field for the "paid at the door" / "paid in advance" split.
|
|
308
|
-
*/
|
|
309
|
-
settledBy?: 'cash' | 'prepaid';
|
|
310
|
-
/** What the work was worth, on a zero-rated line only. */
|
|
311
|
-
originalAmount?: number;
|
|
312
|
-
description: string;
|
|
313
|
-
date: string;
|
|
314
|
-
createdAt: string;
|
|
315
|
-
updatedAt: string;
|
|
316
|
-
itemDetails?: Errand;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
95
|
/**
|
|
320
96
|
* @deprecated Retired. `SELF_FULFILLMENT` asked "may this business use its own
|
|
321
97
|
* rider instead of ours?" — a question that only makes sense when
|
|
@@ -634,6 +410,232 @@ interface BusinessCourierLink {
|
|
|
634
410
|
toBusinessDetails: Business | NullOrUndefined;
|
|
635
411
|
}
|
|
636
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;
|
|
574
|
+
/**
|
|
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.
|
|
578
|
+
*/
|
|
579
|
+
statementSlug?: string;
|
|
580
|
+
startDate: string;
|
|
581
|
+
endDate: string;
|
|
582
|
+
/** What the customer is asked for. Excludes zero-rated lines. */
|
|
583
|
+
totalAmount: number;
|
|
584
|
+
/**
|
|
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.
|
|
588
|
+
*/
|
|
589
|
+
zeroRatedTotal: number;
|
|
590
|
+
paidAmount: number;
|
|
591
|
+
unpaidAmount: number;
|
|
592
|
+
lastRecalculatedAt?: string;
|
|
593
|
+
/**
|
|
594
|
+
* Document lifecycle, kept separate from `status`: an invoice can be
|
|
595
|
+
* part-paid and viewed, or paid and never opened.
|
|
596
|
+
*/
|
|
597
|
+
firstViewedAt?: string;
|
|
598
|
+
lastViewedAt?: string;
|
|
599
|
+
viewCount?: number;
|
|
600
|
+
drift?: InvoiceDrift;
|
|
601
|
+
status: InvoiceStatus | `${InvoiceStatus}`;
|
|
602
|
+
customerId: string;
|
|
603
|
+
items: InvoiceItem[];
|
|
604
|
+
createdAt: string;
|
|
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;
|
|
611
|
+
}
|
|
612
|
+
interface InvoiceItem {
|
|
613
|
+
id: string;
|
|
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;
|
|
634
|
+
createdAt: string;
|
|
635
|
+
updatedAt: string;
|
|
636
|
+
itemDetails?: Errand;
|
|
637
|
+
}
|
|
638
|
+
|
|
637
639
|
declare enum VehicleType {
|
|
638
640
|
Bike = "bike",
|
|
639
641
|
Shuttle = "shuttle"
|
|
@@ -1080,10 +1082,11 @@ interface AggregatedErrand extends Errand {
|
|
|
1080
1082
|
riderUserDetails?: User;
|
|
1081
1083
|
}
|
|
1082
1084
|
type PublicBusiness = Pick<Business, 'id' | 'name' | 'logoUrl' | 'officeNumber'>;
|
|
1083
|
-
type PublicPlace = Pick<AddressDetails, 'fullName' | 'address' | 'landmark'>;
|
|
1085
|
+
type PublicPlace = Pick<AddressDetails, 'fullName' | 'address' | 'landmark' | 'location'>;
|
|
1084
1086
|
/**
|
|
1085
|
-
* `GET /errands/:alias/tracking`, which
|
|
1086
|
-
* 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.
|
|
1087
1090
|
*/
|
|
1088
1091
|
type PublicTrackedErrand = Pick<AggregatedErrand, 'aliasId' | 'deliveryStatus' | 'updatedAt' | 'nameOfItem' | 'additionalData'> & {
|
|
1089
1092
|
errandTimeline: (Pick<ErrandTimeline, 'currTimelineIndex'> & {
|
|
@@ -1609,6 +1612,7 @@ declare enum WhatsappButtonType {
|
|
|
1609
1612
|
}
|
|
1610
1613
|
declare enum WhatsappTemplateParamSource {
|
|
1611
1614
|
ERRAND_ALIAS_ID = "errand.aliasId",
|
|
1615
|
+
ERRAND_TRACKING_CODE = "errand.trackingCode",
|
|
1612
1616
|
ERRAND_PICKUP_NAME = "errand.pickupDetails.fullName",
|
|
1613
1617
|
ERRAND_DELIVERY_NAME = "errand.deliveryDetails.fullName",
|
|
1614
1618
|
BUSINESS_NAME = "business.name",
|
|
@@ -1749,6 +1753,60 @@ type LynqoneIntegrationSummary = {
|
|
|
1749
1753
|
trackerCount: number;
|
|
1750
1754
|
};
|
|
1751
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
|
+
|
|
1752
1810
|
interface PaginateResult<T> {
|
|
1753
1811
|
docs: T[];
|
|
1754
1812
|
totalDocs: number;
|
|
@@ -1771,4 +1829,4 @@ declare enum LinkDestination {
|
|
|
1771
1829
|
}
|
|
1772
1830
|
type NullOrUndefined = null | undefined;
|
|
1773
1831
|
|
|
1774
|
-
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, 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 PublicTrackedErrand, RemittanceStatus, type Rider, type RiderPayout, type RiderPayoutAdjustment, type RiderPayoutPreview, type RiderPayoutPreviewItem, RiderPayoutStatus, type RiderPerformanceItem, type RiderPerformanceStats, type RiderPerformanceSummary, type RiderPerformanceTimeSeries, 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, errandTimeline };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -329,6 +329,7 @@ var WhatsappButtonType = /* @__PURE__ */ ((WhatsappButtonType2) => {
|
|
|
329
329
|
})(WhatsappButtonType || {});
|
|
330
330
|
var WhatsappTemplateParamSource = /* @__PURE__ */ ((WhatsappTemplateParamSource2) => {
|
|
331
331
|
WhatsappTemplateParamSource2["ERRAND_ALIAS_ID"] = "errand.aliasId";
|
|
332
|
+
WhatsappTemplateParamSource2["ERRAND_TRACKING_CODE"] = "errand.trackingCode";
|
|
332
333
|
WhatsappTemplateParamSource2["ERRAND_PICKUP_NAME"] = "errand.pickupDetails.fullName";
|
|
333
334
|
WhatsappTemplateParamSource2["ERRAND_DELIVERY_NAME"] = "errand.deliveryDetails.fullName";
|
|
334
335
|
WhatsappTemplateParamSource2["BUSINESS_NAME"] = "business.name";
|
|
@@ -339,6 +340,41 @@ var WhatsappTemplateParamSource = /* @__PURE__ */ ((WhatsappTemplateParamSource2
|
|
|
339
340
|
return WhatsappTemplateParamSource2;
|
|
340
341
|
})(WhatsappTemplateParamSource || {});
|
|
341
342
|
|
|
343
|
+
// src/rating.ts
|
|
344
|
+
var ErrandRatingTag = /* @__PURE__ */ ((ErrandRatingTag2) => {
|
|
345
|
+
ErrandRatingTag2["OnTime"] = "on-time";
|
|
346
|
+
ErrandRatingTag2["CalledBeforeArriving"] = "called-before-arriving";
|
|
347
|
+
ErrandRatingTag2["Polite"] = "polite";
|
|
348
|
+
ErrandRatingTag2["ItemInGoodShape"] = "item-in-good-shape";
|
|
349
|
+
ErrandRatingTag2["FollowedDirections"] = "followed-directions";
|
|
350
|
+
ErrandRatingTag2["Late"] = "late";
|
|
351
|
+
ErrandRatingTag2["DidNotCall"] = "did-not-call";
|
|
352
|
+
ErrandRatingTag2["Rude"] = "rude";
|
|
353
|
+
ErrandRatingTag2["ItemDamaged"] = "item-damaged";
|
|
354
|
+
ErrandRatingTag2["HardToFindMe"] = "hard-to-find-me";
|
|
355
|
+
return ErrandRatingTag2;
|
|
356
|
+
})(ErrandRatingTag || {});
|
|
357
|
+
var goodRatingTags = [
|
|
358
|
+
"on-time" /* OnTime */,
|
|
359
|
+
"called-before-arriving" /* CalledBeforeArriving */,
|
|
360
|
+
"polite" /* Polite */,
|
|
361
|
+
"item-in-good-shape" /* ItemInGoodShape */,
|
|
362
|
+
"followed-directions" /* FollowedDirections */
|
|
363
|
+
];
|
|
364
|
+
var badRatingTags = [
|
|
365
|
+
"late" /* Late */,
|
|
366
|
+
"did-not-call" /* DidNotCall */,
|
|
367
|
+
"rude" /* Rude */,
|
|
368
|
+
"item-damaged" /* ItemDamaged */,
|
|
369
|
+
"hard-to-find-me" /* HardToFindMe */
|
|
370
|
+
];
|
|
371
|
+
var ErrandRatingStatus = /* @__PURE__ */ ((ErrandRatingStatus2) => {
|
|
372
|
+
ErrandRatingStatus2["Visible"] = "visible";
|
|
373
|
+
ErrandRatingStatus2["Hidden"] = "hidden";
|
|
374
|
+
return ErrandRatingStatus2;
|
|
375
|
+
})(ErrandRatingStatus || {});
|
|
376
|
+
var minRatingsForAverage = 10;
|
|
377
|
+
|
|
342
378
|
// src/index.ts
|
|
343
379
|
var LinkDestination = /* @__PURE__ */ ((LinkDestination2) => {
|
|
344
380
|
LinkDestination2["Website"] = "web";
|
|
@@ -362,6 +398,8 @@ export {
|
|
|
362
398
|
EnterpriseType,
|
|
363
399
|
ErrandFulfilment,
|
|
364
400
|
ErrandInvoiceState,
|
|
401
|
+
ErrandRatingStatus,
|
|
402
|
+
ErrandRatingTag,
|
|
365
403
|
ErrandStatus,
|
|
366
404
|
FeePaymentStatus,
|
|
367
405
|
FeeSettlement,
|
|
@@ -391,5 +429,8 @@ export {
|
|
|
391
429
|
WhatsappRecipient,
|
|
392
430
|
WhatsappTemplateMetaStatus,
|
|
393
431
|
WhatsappTemplateParamSource,
|
|
394
|
-
|
|
432
|
+
badRatingTags,
|
|
433
|
+
errandTimeline,
|
|
434
|
+
goodRatingTags,
|
|
435
|
+
minRatingsForAverage
|
|
395
436
|
};
|
package/package.json
CHANGED
package/src/errand.ts
CHANGED
|
@@ -257,11 +257,15 @@ type PublicBusiness = Pick<
|
|
|
257
257
|
Business,
|
|
258
258
|
'id' | 'name' | 'logoUrl' | 'officeNumber'
|
|
259
259
|
>;
|
|
260
|
-
type PublicPlace = Pick<
|
|
260
|
+
type PublicPlace = Pick<
|
|
261
|
+
AddressDetails,
|
|
262
|
+
'fullName' | 'address' | 'landmark' | 'location'
|
|
263
|
+
>;
|
|
261
264
|
|
|
262
265
|
/**
|
|
263
|
-
* `GET /errands/:alias/tracking`, which
|
|
264
|
-
* cut down to what a tracking page shows: same
|
|
266
|
+
* `GET /errands/:alias/tracking` and `GET /errands/track/:code`, which need no
|
|
267
|
+
* login. An `AggregatedErrand` cut down to what a tracking page shows: same
|
|
268
|
+
* field names, fewer fields.
|
|
265
269
|
*/
|
|
266
270
|
export type PublicTrackedErrand = Pick<
|
|
267
271
|
AggregatedErrand,
|
|
@@ -384,4 +388,3 @@ export interface DraftErrand {
|
|
|
384
388
|
riderDetails?: Rider;
|
|
385
389
|
riderUserDetails?: User | null;
|
|
386
390
|
}
|
|
387
|
-
|
package/src/index.ts
CHANGED
package/src/invoice.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Business } from './business';
|
|
1
2
|
import { Customer } from './customer';
|
|
2
3
|
import { Errand } from './errand';
|
|
3
4
|
|
|
@@ -134,6 +135,8 @@ export interface Invoice {
|
|
|
134
135
|
updatedAt: string;
|
|
135
136
|
|
|
136
137
|
customerDetails?: Customer;
|
|
138
|
+
/** The issuing courier, on the received list and on detail. */
|
|
139
|
+
courierBusiness?: Pick<Business, 'name' | 'logoUrl' | 'officeNumber'>;
|
|
137
140
|
paidErrandsCount?: number;
|
|
138
141
|
unpaidErrandsCount?: number;
|
|
139
142
|
}
|