@mydoormot/app-types 2.0.5 → 2.1.1
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 +27 -21
- package/dist/index.d.cts +140 -29
- package/dist/index.d.ts +140 -29
- package/dist/index.js +24 -20
- package/package.json +1 -1
- package/src/business.ts +138 -28
- package/src/delivery.ts +0 -7
- package/src/errand.ts +0 -11
- package/src/rider.ts +11 -3
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @mydoormot/app-types@2.0
|
|
2
|
+
> @mydoormot/app-types@2.1.0 build /Users/chuksben/Desktop/projects/microservices/mydoormot/packages/app-types
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --dts
|
|
4
4
|
|
|
5
5
|
CLI Building entry: src/index.ts
|
|
@@ -8,11 +8,11 @@ CLI tsup v7.3.0
|
|
|
8
8
|
CLI Target: es2021
|
|
9
9
|
ESM Build start
|
|
10
10
|
CJS Build start
|
|
11
|
-
ESM dist/index.js 14.
|
|
12
|
-
ESM ⚡️ Build success in
|
|
13
|
-
CJS dist/index.cjs 17.
|
|
14
|
-
CJS ⚡️ Build success in
|
|
11
|
+
ESM dist/index.js 14.90 KB
|
|
12
|
+
ESM ⚡️ Build success in 59ms
|
|
13
|
+
CJS dist/index.cjs 17.95 KB
|
|
14
|
+
CJS ⚡️ Build success in 59ms
|
|
15
15
|
DTS Build start
|
|
16
|
-
DTS ⚡️ Build success in
|
|
17
|
-
DTS dist/index.d.ts
|
|
18
|
-
DTS dist/index.d.cts
|
|
16
|
+
DTS ⚡️ Build success in 738ms
|
|
17
|
+
DTS dist/index.d.ts 55.42 KB
|
|
18
|
+
DTS dist/index.d.cts 55.42 KB
|
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -24,8 +24,10 @@ __export(src_exports, {
|
|
|
24
24
|
AuthType: () => AuthType,
|
|
25
25
|
BusinessCapability: () => BusinessCapability,
|
|
26
26
|
BusinessCourierLinkStatus: () => BusinessCourierLinkStatus,
|
|
27
|
+
BusinessPlan: () => BusinessPlan,
|
|
27
28
|
BusinessRole: () => BusinessRole,
|
|
28
29
|
BusinessStatus: () => BusinessStatus,
|
|
30
|
+
BusinessType: () => BusinessType,
|
|
29
31
|
DEFAULT_BUSINESS_FUEL_SETTINGS: () => DEFAULT_BUSINESS_FUEL_SETTINGS,
|
|
30
32
|
DEFAULT_BUSINESS_MODULES: () => DEFAULT_BUSINESS_MODULES,
|
|
31
33
|
DEFAULT_BUSINESS_RIDER_PAY_SETTINGS: () => DEFAULT_BUSINESS_RIDER_PAY_SETTINGS,
|
|
@@ -33,6 +35,7 @@ __export(src_exports, {
|
|
|
33
35
|
DeliveryStatus: () => DeliveryStatus,
|
|
34
36
|
DraftErrandStatus: () => DraftErrandStatus,
|
|
35
37
|
EnterpriseType: () => EnterpriseType,
|
|
38
|
+
ErrandFulfilment: () => ErrandFulfilment,
|
|
36
39
|
ErrandInvoiceState: () => ErrandInvoiceState,
|
|
37
40
|
ErrandStatus: () => ErrandStatus,
|
|
38
41
|
FeePaymentStatus: () => FeePaymentStatus,
|
|
@@ -47,7 +50,6 @@ __export(src_exports, {
|
|
|
47
50
|
LinkDestination: () => LinkDestination,
|
|
48
51
|
MembershipStatus: () => MembershipStatus,
|
|
49
52
|
NotificationType: () => NotificationType,
|
|
50
|
-
ParcelSize: () => ParcelSize,
|
|
51
53
|
PaymentOptions: () => PaymentOptions,
|
|
52
54
|
PayoutPeriodType: () => PayoutPeriodType,
|
|
53
55
|
PayoutRateSource: () => PayoutRateSource,
|
|
@@ -166,13 +168,6 @@ var DeliveryStatus = /* @__PURE__ */ ((DeliveryStatus2) => {
|
|
|
166
168
|
DeliveryStatus2["Cancelled"] = "cancelled";
|
|
167
169
|
return DeliveryStatus2;
|
|
168
170
|
})(DeliveryStatus || {});
|
|
169
|
-
var ParcelSize = /* @__PURE__ */ ((ParcelSize2) => {
|
|
170
|
-
ParcelSize2["Bike"] = "bike";
|
|
171
|
-
ParcelSize2["Large"] = "large";
|
|
172
|
-
ParcelSize2["Medium"] = "medium";
|
|
173
|
-
ParcelSize2["Small"] = "small";
|
|
174
|
-
return ParcelSize2;
|
|
175
|
-
})(ParcelSize || {});
|
|
176
171
|
var DraftErrandStatus = /* @__PURE__ */ ((DraftErrandStatus2) => {
|
|
177
172
|
DraftErrandStatus2["Draft"] = "draft";
|
|
178
173
|
DraftErrandStatus2["RiderCompleted"] = "rider_completed";
|
|
@@ -299,6 +294,22 @@ var BusinessCapability = /* @__PURE__ */ ((BusinessCapability2) => {
|
|
|
299
294
|
BusinessCapability2["SELF_FULFILLMENT"] = "self_fulfillment";
|
|
300
295
|
return BusinessCapability2;
|
|
301
296
|
})(BusinessCapability || {});
|
|
297
|
+
var ErrandFulfilment = /* @__PURE__ */ ((ErrandFulfilment2) => {
|
|
298
|
+
ErrandFulfilment2["OWN"] = "own";
|
|
299
|
+
ErrandFulfilment2["NETWORK"] = "network";
|
|
300
|
+
return ErrandFulfilment2;
|
|
301
|
+
})(ErrandFulfilment || {});
|
|
302
|
+
var BusinessType = /* @__PURE__ */ ((BusinessType2) => {
|
|
303
|
+
BusinessType2["MERCHANT"] = "merchant";
|
|
304
|
+
BusinessType2["COURIER"] = "courier";
|
|
305
|
+
return BusinessType2;
|
|
306
|
+
})(BusinessType || {});
|
|
307
|
+
var BusinessPlan = /* @__PURE__ */ ((BusinessPlan2) => {
|
|
308
|
+
BusinessPlan2["MVP"] = "mvp";
|
|
309
|
+
BusinessPlan2["FULL"] = "full";
|
|
310
|
+
BusinessPlan2["INTERNAL"] = "internal";
|
|
311
|
+
return BusinessPlan2;
|
|
312
|
+
})(BusinessPlan || {});
|
|
302
313
|
var BusinessStatus = /* @__PURE__ */ ((BusinessStatus2) => {
|
|
303
314
|
BusinessStatus2["ACTIVE"] = "active";
|
|
304
315
|
BusinessStatus2["DISABLED"] = "disabled";
|
|
@@ -324,22 +335,15 @@ var DEFAULT_BUSINESS_RIDER_PAY_SETTINGS = {
|
|
|
324
335
|
defaultPercentage: null,
|
|
325
336
|
periodType: null
|
|
326
337
|
};
|
|
327
|
-
var DEFAULT_BUSINESS_MODULES = {
|
|
328
|
-
draftErrands: true,
|
|
329
|
-
team: true,
|
|
330
|
-
maintenance: true,
|
|
331
|
-
fuelLogs: true,
|
|
332
|
-
invoices: true,
|
|
333
|
-
remittances: true
|
|
334
|
-
};
|
|
338
|
+
var DEFAULT_BUSINESS_MODULES = {};
|
|
335
339
|
var DEFAULT_BUSINESS_SETTINGS = {
|
|
336
|
-
|
|
340
|
+
whatsappNotificationEnabled: true,
|
|
337
341
|
whatsapp: {
|
|
338
342
|
enabled: false,
|
|
339
343
|
templates: {}
|
|
340
344
|
},
|
|
341
|
-
|
|
342
|
-
|
|
345
|
+
isOnline: true,
|
|
346
|
+
openingHours: {
|
|
343
347
|
monday: { open: "09:00", close: "17:00" },
|
|
344
348
|
tuesday: { open: "09:00", close: "17:00" },
|
|
345
349
|
wednesday: { open: "09:00", close: "17:00" },
|
|
@@ -348,7 +352,7 @@ var DEFAULT_BUSINESS_SETTINGS = {
|
|
|
348
352
|
saturday: null,
|
|
349
353
|
sunday: null
|
|
350
354
|
},
|
|
351
|
-
|
|
355
|
+
socialLinks: {
|
|
352
356
|
instagram: null,
|
|
353
357
|
facebook: null,
|
|
354
358
|
twitter: null,
|
|
@@ -433,8 +437,10 @@ var LinkDestination = /* @__PURE__ */ ((LinkDestination2) => {
|
|
|
433
437
|
AuthType,
|
|
434
438
|
BusinessCapability,
|
|
435
439
|
BusinessCourierLinkStatus,
|
|
440
|
+
BusinessPlan,
|
|
436
441
|
BusinessRole,
|
|
437
442
|
BusinessStatus,
|
|
443
|
+
BusinessType,
|
|
438
444
|
DEFAULT_BUSINESS_FUEL_SETTINGS,
|
|
439
445
|
DEFAULT_BUSINESS_MODULES,
|
|
440
446
|
DEFAULT_BUSINESS_RIDER_PAY_SETTINGS,
|
|
@@ -442,6 +448,7 @@ var LinkDestination = /* @__PURE__ */ ((LinkDestination2) => {
|
|
|
442
448
|
DeliveryStatus,
|
|
443
449
|
DraftErrandStatus,
|
|
444
450
|
EnterpriseType,
|
|
451
|
+
ErrandFulfilment,
|
|
445
452
|
ErrandInvoiceState,
|
|
446
453
|
ErrandStatus,
|
|
447
454
|
FeePaymentStatus,
|
|
@@ -456,7 +463,6 @@ var LinkDestination = /* @__PURE__ */ ((LinkDestination2) => {
|
|
|
456
463
|
LinkDestination,
|
|
457
464
|
MembershipStatus,
|
|
458
465
|
NotificationType,
|
|
459
|
-
ParcelSize,
|
|
460
466
|
PaymentOptions,
|
|
461
467
|
PayoutPeriodType,
|
|
462
468
|
PayoutRateSource,
|
package/dist/index.d.cts
CHANGED
|
@@ -309,9 +309,59 @@ interface InvoiceItem {
|
|
|
309
309
|
itemDetails?: Errand;
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
+
/**
|
|
313
|
+
* @deprecated Retired. `SELF_FULFILLMENT` asked "may this business use its own
|
|
314
|
+
* rider instead of ours?" — a question that only makes sense when
|
|
315
|
+
* self-fulfilment is the exception. Every merchant has riders, so the flag was
|
|
316
|
+
* true for everyone and said nothing.
|
|
317
|
+
*
|
|
318
|
+
* What replaced it: the `riders` module for whether the business manages its
|
|
319
|
+
* own riders at all, and {@link ErrandFulfilment} on each errand for who
|
|
320
|
+
* actually carried it. A restaurant with two riders still overflows to the
|
|
321
|
+
* network on a busy Friday, which a business-level boolean cannot express and
|
|
322
|
+
* an errand-level field can — and the errand-level one is what rider-cost
|
|
323
|
+
* reporting needs.
|
|
324
|
+
*/
|
|
312
325
|
declare enum BusinessCapability {
|
|
313
326
|
SELF_FULFILLMENT = "self_fulfillment"
|
|
314
327
|
}
|
|
328
|
+
/**
|
|
329
|
+
* Who carried an errand: the originating business's own rider, or the wider
|
|
330
|
+
* network. The field rider-cost reporting splits on — own-rider cost against
|
|
331
|
+
* network payout.
|
|
332
|
+
*/
|
|
333
|
+
declare enum ErrandFulfilment {
|
|
334
|
+
OWN = "own",
|
|
335
|
+
NETWORK = "network"
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Which product a business is using. The one stored fact about its shape —
|
|
339
|
+
* a courier runs deliveries for other businesses, a merchant sends its own out.
|
|
340
|
+
*
|
|
341
|
+
* Replaces the free-text business-category collection, whose only reader was a
|
|
342
|
+
* `name.includes('courier')` string match: a category rename silently reshaped
|
|
343
|
+
* the account, and five of the seven call sites omitted `toLowerCase()` so a
|
|
344
|
+
* capitalised name read as `false` everywhere.
|
|
345
|
+
*/
|
|
346
|
+
declare enum BusinessType {
|
|
347
|
+
MERCHANT = "merchant",
|
|
348
|
+
COURIER = "courier"
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* How much of its product a business gets. Orthogonal to {@link BusinessType}:
|
|
352
|
+
* `type` decides which features are even relevant, `plan` decides which of
|
|
353
|
+
* those are unlocked. A merchant's `full` and a courier's `full` are different
|
|
354
|
+
* sets, which is the point — upgrading a restaurant must never hand it
|
|
355
|
+
* client-invoicing.
|
|
356
|
+
*
|
|
357
|
+
* `internal` is where new work lands: features default to it alone, so nothing
|
|
358
|
+
* reaches customers by someone forgetting to hide it.
|
|
359
|
+
*/
|
|
360
|
+
declare enum BusinessPlan {
|
|
361
|
+
MVP = "mvp",
|
|
362
|
+
FULL = "full",
|
|
363
|
+
INTERNAL = "internal"
|
|
364
|
+
}
|
|
315
365
|
declare enum BusinessStatus {
|
|
316
366
|
ACTIVE = "active",
|
|
317
367
|
DISABLED = "disabled"
|
|
@@ -322,6 +372,8 @@ interface Business {
|
|
|
322
372
|
name: string;
|
|
323
373
|
description: string;
|
|
324
374
|
officeNumber: string;
|
|
375
|
+
type: BusinessType | `${BusinessType}`;
|
|
376
|
+
plan: BusinessPlan | `${BusinessPlan}`;
|
|
325
377
|
categoryId: string;
|
|
326
378
|
address: string | NullOrUndefined;
|
|
327
379
|
addressCoordinates: number[] | NullOrUndefined | {
|
|
@@ -351,13 +403,26 @@ interface Business {
|
|
|
351
403
|
updatedAt: string | NullOrUndefined | Date;
|
|
352
404
|
verifiedAt: string | NullOrUndefined | Date;
|
|
353
405
|
registrationCompletedAt: string | NullOrUndefined | Date;
|
|
406
|
+
/**
|
|
407
|
+
* Derived from `type`, not stored. Kept on the wire because installed mobile
|
|
408
|
+
* binaries still read it; new readers want `type`.
|
|
409
|
+
*
|
|
410
|
+
* @deprecated Read `type` instead.
|
|
411
|
+
*/
|
|
354
412
|
businessCategoryDetails: BusinessCategory | NullOrUndefined;
|
|
355
|
-
capabilities: BusinessCapability[] | NullOrUndefined;
|
|
356
413
|
status: BusinessStatus | `${BusinessStatus}`;
|
|
357
414
|
disabledAt: string | NullOrUndefined | Date;
|
|
358
415
|
disabledBy: string | NullOrUndefined;
|
|
359
416
|
disabledReason: string | NullOrUndefined;
|
|
360
417
|
settings: BusinessSettings | NullOrUndefined;
|
|
418
|
+
/**
|
|
419
|
+
* The resolved feature set — the plan's defaults with this business's own
|
|
420
|
+
* overrides applied. Server-computed; read this, never `settings.modules`,
|
|
421
|
+
* which holds only the deliberate exceptions.
|
|
422
|
+
*/
|
|
423
|
+
modules: Required<{
|
|
424
|
+
[K in keyof BusinessModules]: boolean;
|
|
425
|
+
}>;
|
|
361
426
|
}
|
|
362
427
|
interface BusinessPg extends Business {
|
|
363
428
|
pgId: any;
|
|
@@ -392,14 +457,58 @@ interface OpeningHours {
|
|
|
392
457
|
open: string;
|
|
393
458
|
close: string;
|
|
394
459
|
}
|
|
460
|
+
/**
|
|
461
|
+
* Which features a business sees.
|
|
462
|
+
*
|
|
463
|
+
* Every value is optional, and `undefined` means *inherit from the plan* — not
|
|
464
|
+
* `false`. That distinction is the whole point: a stored `true` is a decision
|
|
465
|
+
* somebody made, so the plan can never quietly take it back, while an unset key
|
|
466
|
+
* follows whatever the plan says today. Storing a resolved default would
|
|
467
|
+
* collapse the two and freeze every business on the defaults it was created
|
|
468
|
+
* with.
|
|
469
|
+
*
|
|
470
|
+
* Resolve with `modulesForPlan(type, plan)[key] ?? ...` — never read a key off
|
|
471
|
+
* this object directly.
|
|
472
|
+
*/
|
|
395
473
|
interface BusinessModules {
|
|
396
|
-
draftErrands
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
474
|
+
draftErrands?: boolean;
|
|
475
|
+
maintenance?: boolean;
|
|
476
|
+
fuelLogs?: boolean;
|
|
477
|
+
invoices?: boolean;
|
|
478
|
+
remittances?: boolean;
|
|
479
|
+
/** Manage its own riders: the roster, their pay, what they cost. */
|
|
480
|
+
riders?: boolean;
|
|
481
|
+
/**
|
|
482
|
+
* Route new errands to its own riders rather than to the network.
|
|
483
|
+
*
|
|
484
|
+
* Deliberately separate from `riders`. A merchant can run a roster and still
|
|
485
|
+
* send most deliveries out — managing riders and defaulting to them are
|
|
486
|
+
* different questions, and the old `SELF_FULFILLMENT` capability answered
|
|
487
|
+
* only the second one. Folding them together made every merchant
|
|
488
|
+
* self-fulfil and silently bypass each city's default courier.
|
|
489
|
+
*/
|
|
490
|
+
selfFulfilment?: boolean;
|
|
491
|
+
vehicles?: boolean;
|
|
492
|
+
expenses?: boolean;
|
|
493
|
+
/**
|
|
494
|
+
* Calculate what riders earned for a period and generate payout records.
|
|
495
|
+
* `riders/rider-payouts.controller.ts`, and the `rider-payouts` screens.
|
|
496
|
+
*/
|
|
497
|
+
riderPayouts?: boolean;
|
|
498
|
+
/** External GPS tracker feed; needs an API key to be useful. */
|
|
499
|
+
trackerDevices?: boolean;
|
|
500
|
+
/**
|
|
501
|
+
* WhatsApp notifications to the business's users and customers on errand
|
|
502
|
+
* events.
|
|
503
|
+
*
|
|
504
|
+
* Declared here so it appears in the plan map and the admin UI, but nothing
|
|
505
|
+
* reads it yet: `updateWhatsappConfig` is still gated on `isOwnFulfiller`.
|
|
506
|
+
* Moving that gate onto this key is the follow-up.
|
|
507
|
+
*/
|
|
508
|
+
whatsapp?: boolean;
|
|
402
509
|
}
|
|
510
|
+
/** Every module key, so a plan map can be checked for completeness. */
|
|
511
|
+
type BusinessModuleKey = keyof BusinessModules;
|
|
403
512
|
/**
|
|
404
513
|
* How a business funds fuel. `revenuePercent` is the share of errand revenue a
|
|
405
514
|
* vehicle sets aside for its own fuel — the single knob behind the fuel-owed
|
|
@@ -424,10 +533,10 @@ interface BusinessRiderPaySettings {
|
|
|
424
533
|
periodType: PayoutPeriodType | `${PayoutPeriodType}` | null;
|
|
425
534
|
}
|
|
426
535
|
interface BusinessSettings {
|
|
427
|
-
|
|
536
|
+
whatsappNotificationEnabled: boolean;
|
|
428
537
|
whatsapp: BusinessWhatsappConfig;
|
|
429
|
-
|
|
430
|
-
|
|
538
|
+
isOnline: boolean;
|
|
539
|
+
openingHours: {
|
|
431
540
|
monday: OpeningHours | null;
|
|
432
541
|
tuesday: OpeningHours | null;
|
|
433
542
|
wednesday: OpeningHours | null;
|
|
@@ -436,24 +545,28 @@ interface BusinessSettings {
|
|
|
436
545
|
saturday: OpeningHours | null;
|
|
437
546
|
sunday: OpeningHours | null;
|
|
438
547
|
};
|
|
439
|
-
|
|
548
|
+
socialLinks: {
|
|
440
549
|
instagram: string | null;
|
|
441
550
|
facebook: string | null;
|
|
442
551
|
twitter: string | null;
|
|
443
552
|
tiktok: string | null;
|
|
444
553
|
website: string | null;
|
|
445
554
|
};
|
|
446
|
-
limits?: {
|
|
447
|
-
maxRiders: number | null;
|
|
448
|
-
maxVehicles: number | null;
|
|
449
|
-
maxErrands: number | null;
|
|
450
|
-
};
|
|
451
555
|
modules: BusinessModules;
|
|
452
556
|
fuel?: BusinessFuelSettings;
|
|
453
557
|
riderPay?: BusinessRiderPaySettings;
|
|
454
558
|
}
|
|
455
559
|
declare const DEFAULT_BUSINESS_FUEL_SETTINGS: BusinessFuelSettings;
|
|
456
560
|
declare const DEFAULT_BUSINESS_RIDER_PAY_SETTINGS: BusinessRiderPaySettings;
|
|
561
|
+
/**
|
|
562
|
+
* @deprecated Defaults live in `modulesForPlan(type, plan)` on the server. This
|
|
563
|
+
* was an all-`true` deny-list: every new feature shipped to every business
|
|
564
|
+
* until someone remembered to switch it off, and writing it into each new
|
|
565
|
+
* business made the stored value indistinguishable from a deliberate grant.
|
|
566
|
+
*
|
|
567
|
+
* Kept only so nothing importing it breaks mid-migration. Empty on purpose —
|
|
568
|
+
* unset means inherit.
|
|
569
|
+
*/
|
|
457
570
|
declare const DEFAULT_BUSINESS_MODULES: BusinessModules;
|
|
458
571
|
declare const DEFAULT_BUSINESS_SETTINGS: BusinessSettings;
|
|
459
572
|
interface BusinessMember {
|
|
@@ -731,13 +844,21 @@ type Rider = {
|
|
|
731
844
|
hasBeenRated: boolean;
|
|
732
845
|
payoutPercentage?: number | null;
|
|
733
846
|
state?: string | State;
|
|
734
|
-
currentErrand?: Errand;
|
|
735
|
-
lastDeliveredErrand?: Errand;
|
|
736
847
|
};
|
|
737
848
|
type RiderWithUserDetails = Rider & {
|
|
738
849
|
userDetails?: User;
|
|
739
850
|
vehicleDetails?: Vehicle | null;
|
|
740
851
|
businessMemberDetails?: BusinessMember;
|
|
852
|
+
/**
|
|
853
|
+
* What the rider owes us: the sum of their pending (unremitted) settlements,
|
|
854
|
+
* scoped to the rider's own business. Same figure as the rider register's
|
|
855
|
+
* `cashOwed`.
|
|
856
|
+
*/
|
|
857
|
+
cashOwed?: number;
|
|
858
|
+
/** How many pending settlements make up `cashOwed`. */
|
|
859
|
+
unremittedSettlements?: number;
|
|
860
|
+
/** When the oldest of those settlements was raised — null when none are. */
|
|
861
|
+
oldestUnremittedAt?: Date | null;
|
|
741
862
|
};
|
|
742
863
|
declare enum RemittanceStatus {
|
|
743
864
|
Pending = "pending",
|
|
@@ -904,7 +1025,6 @@ interface PendingErrand {
|
|
|
904
1025
|
_id: string;
|
|
905
1026
|
rider: string;
|
|
906
1027
|
customerId: string;
|
|
907
|
-
parcelSize: ParcelSize;
|
|
908
1028
|
deliveryStatus: ErrandStatus;
|
|
909
1029
|
invoice: {
|
|
910
1030
|
invoiceStatus: string;
|
|
@@ -978,7 +1098,6 @@ interface Errand {
|
|
|
978
1098
|
courierBusinessId?: string;
|
|
979
1099
|
pickupDetails: AddressDetails;
|
|
980
1100
|
deliveryDetails: AddressDetails;
|
|
981
|
-
parcelSize: `${ParcelSize}`;
|
|
982
1101
|
deliveryStatus: ErrandStatus | `${ErrandStatus}`;
|
|
983
1102
|
paymentStatus: `${InvoiceStatus}`;
|
|
984
1103
|
invoiceId?: string;
|
|
@@ -1034,7 +1153,6 @@ interface Errand {
|
|
|
1034
1153
|
feePaymentStatus?: `${FeePaymentStatus}`;
|
|
1035
1154
|
}
|
|
1036
1155
|
interface AggregatedErrand extends Errand {
|
|
1037
|
-
parcelSize: `${ParcelSize}`;
|
|
1038
1156
|
invoiceDetails: Invoice;
|
|
1039
1157
|
pickupLocation: {
|
|
1040
1158
|
cityId: string;
|
|
@@ -1075,12 +1193,6 @@ declare enum DeliveryStatus {
|
|
|
1075
1193
|
Delivered = "delivered",
|
|
1076
1194
|
Cancelled = "cancelled"
|
|
1077
1195
|
}
|
|
1078
|
-
declare enum ParcelSize {
|
|
1079
|
-
Bike = "bike",
|
|
1080
|
-
Large = "large",
|
|
1081
|
-
Medium = "medium",
|
|
1082
|
-
Small = "small"
|
|
1083
|
-
}
|
|
1084
1196
|
interface ErrandTimeline {
|
|
1085
1197
|
id: string;
|
|
1086
1198
|
errandId: string;
|
|
@@ -1150,7 +1262,6 @@ interface DraftErrand {
|
|
|
1150
1262
|
pickupDetails?: AddressDetails;
|
|
1151
1263
|
deliveryDetails?: AddressDetails;
|
|
1152
1264
|
additionalData?: string;
|
|
1153
|
-
parcelSize?: `${ParcelSize}`;
|
|
1154
1265
|
status: DraftErrandStatus;
|
|
1155
1266
|
convertedErrandId?: string;
|
|
1156
1267
|
settlementId?: string;
|
|
@@ -1725,4 +1836,4 @@ declare enum LinkDestination {
|
|
|
1725
1836
|
}
|
|
1726
1837
|
type NullOrUndefined = null | undefined;
|
|
1727
1838
|
|
|
1728
|
-
export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type BusinessFuelSettings, type BusinessMember, type BusinessModules, type BusinessPg, type BusinessPortal, type BusinessRiderPaySettings, BusinessRole, type BusinessSettings, BusinessStatus, type BusinessWhatsappConfig, type City, type Collection, type Customer, type CustomerAddress, type CustomerBilling, type CustomerTransactionStats, DEFAULT_BUSINESS_FUEL_SETTINGS, DEFAULT_BUSINESS_MODULES, DEFAULT_BUSINESS_RIDER_PAY_SETTINGS, DEFAULT_BUSINESS_SETTINGS, DeliveryStatus, type DraftErrand, DraftErrandStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, ErrandInvoiceState, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, type ExpensePaidBy, FeePaymentStatus, FeeSettlement, type FuelDueData, type FuelDueItem, FuelDueStatus, type FuelDueTotals, type FuelPercentSuggestion, type FuelSinceLastRefuel, type FuelSuggestionConfidence, type GeoPoint, GlobalRoles, type Invoice, type InvoiceDrift, type InvoiceEvent, InvoiceEventType, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, type InvoicePayment, InvoicePaymentMethod, InvoiceStatus, type LatLng, LinkDestination, type MaintenanceItem, type MaintenancePartUsage, type MaintenanceRecord, type MaintenanceStats, type MaintenanceStatsSummary, type MaintenanceTopItem, MembershipStatus, type Notification, type NotificationData, NotificationType, type NullOrUndefined, type OpeningHours, type PaginateResult,
|
|
1839
|
+
export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type BusinessFuelSettings, type BusinessMember, type BusinessModuleKey, type BusinessModules, type BusinessPg, BusinessPlan, type BusinessPortal, type BusinessRiderPaySettings, BusinessRole, type BusinessSettings, BusinessStatus, BusinessType, type BusinessWhatsappConfig, type City, type Collection, type Customer, type CustomerAddress, type CustomerBilling, type CustomerTransactionStats, DEFAULT_BUSINESS_FUEL_SETTINGS, DEFAULT_BUSINESS_MODULES, DEFAULT_BUSINESS_RIDER_PAY_SETTINGS, DEFAULT_BUSINESS_SETTINGS, DeliveryStatus, type DraftErrand, DraftErrandStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, ErrandFulfilment, ErrandInvoiceState, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, type ExpensePaidBy, FeePaymentStatus, FeeSettlement, type FuelDueData, type FuelDueItem, FuelDueStatus, type FuelDueTotals, type FuelPercentSuggestion, type FuelSinceLastRefuel, type FuelSuggestionConfidence, type GeoPoint, GlobalRoles, type Invoice, type InvoiceDrift, type InvoiceEvent, InvoiceEventType, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, type InvoicePayment, InvoicePaymentMethod, InvoiceStatus, type LatLng, LinkDestination, type MaintenanceItem, type MaintenancePartUsage, type MaintenanceRecord, type MaintenanceStats, type MaintenanceStatsSummary, type MaintenanceTopItem, MembershipStatus, type Notification, type NotificationData, NotificationType, type NullOrUndefined, type OpeningHours, type PaginateResult, PaymentOptions, PayoutPeriodType, PayoutRateSource, type PendingErrand, type PortalHandleAvailability, PortalStatus, type Product, type ProductCategory, type ProductImage, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductTag, type ProductVariant, type ProductVariantPrice, type PublicPortal, type PublicPortalBusiness, 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 TrackerPosition, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -309,9 +309,59 @@ interface InvoiceItem {
|
|
|
309
309
|
itemDetails?: Errand;
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
+
/**
|
|
313
|
+
* @deprecated Retired. `SELF_FULFILLMENT` asked "may this business use its own
|
|
314
|
+
* rider instead of ours?" — a question that only makes sense when
|
|
315
|
+
* self-fulfilment is the exception. Every merchant has riders, so the flag was
|
|
316
|
+
* true for everyone and said nothing.
|
|
317
|
+
*
|
|
318
|
+
* What replaced it: the `riders` module for whether the business manages its
|
|
319
|
+
* own riders at all, and {@link ErrandFulfilment} on each errand for who
|
|
320
|
+
* actually carried it. A restaurant with two riders still overflows to the
|
|
321
|
+
* network on a busy Friday, which a business-level boolean cannot express and
|
|
322
|
+
* an errand-level field can — and the errand-level one is what rider-cost
|
|
323
|
+
* reporting needs.
|
|
324
|
+
*/
|
|
312
325
|
declare enum BusinessCapability {
|
|
313
326
|
SELF_FULFILLMENT = "self_fulfillment"
|
|
314
327
|
}
|
|
328
|
+
/**
|
|
329
|
+
* Who carried an errand: the originating business's own rider, or the wider
|
|
330
|
+
* network. The field rider-cost reporting splits on — own-rider cost against
|
|
331
|
+
* network payout.
|
|
332
|
+
*/
|
|
333
|
+
declare enum ErrandFulfilment {
|
|
334
|
+
OWN = "own",
|
|
335
|
+
NETWORK = "network"
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Which product a business is using. The one stored fact about its shape —
|
|
339
|
+
* a courier runs deliveries for other businesses, a merchant sends its own out.
|
|
340
|
+
*
|
|
341
|
+
* Replaces the free-text business-category collection, whose only reader was a
|
|
342
|
+
* `name.includes('courier')` string match: a category rename silently reshaped
|
|
343
|
+
* the account, and five of the seven call sites omitted `toLowerCase()` so a
|
|
344
|
+
* capitalised name read as `false` everywhere.
|
|
345
|
+
*/
|
|
346
|
+
declare enum BusinessType {
|
|
347
|
+
MERCHANT = "merchant",
|
|
348
|
+
COURIER = "courier"
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* How much of its product a business gets. Orthogonal to {@link BusinessType}:
|
|
352
|
+
* `type` decides which features are even relevant, `plan` decides which of
|
|
353
|
+
* those are unlocked. A merchant's `full` and a courier's `full` are different
|
|
354
|
+
* sets, which is the point — upgrading a restaurant must never hand it
|
|
355
|
+
* client-invoicing.
|
|
356
|
+
*
|
|
357
|
+
* `internal` is where new work lands: features default to it alone, so nothing
|
|
358
|
+
* reaches customers by someone forgetting to hide it.
|
|
359
|
+
*/
|
|
360
|
+
declare enum BusinessPlan {
|
|
361
|
+
MVP = "mvp",
|
|
362
|
+
FULL = "full",
|
|
363
|
+
INTERNAL = "internal"
|
|
364
|
+
}
|
|
315
365
|
declare enum BusinessStatus {
|
|
316
366
|
ACTIVE = "active",
|
|
317
367
|
DISABLED = "disabled"
|
|
@@ -322,6 +372,8 @@ interface Business {
|
|
|
322
372
|
name: string;
|
|
323
373
|
description: string;
|
|
324
374
|
officeNumber: string;
|
|
375
|
+
type: BusinessType | `${BusinessType}`;
|
|
376
|
+
plan: BusinessPlan | `${BusinessPlan}`;
|
|
325
377
|
categoryId: string;
|
|
326
378
|
address: string | NullOrUndefined;
|
|
327
379
|
addressCoordinates: number[] | NullOrUndefined | {
|
|
@@ -351,13 +403,26 @@ interface Business {
|
|
|
351
403
|
updatedAt: string | NullOrUndefined | Date;
|
|
352
404
|
verifiedAt: string | NullOrUndefined | Date;
|
|
353
405
|
registrationCompletedAt: string | NullOrUndefined | Date;
|
|
406
|
+
/**
|
|
407
|
+
* Derived from `type`, not stored. Kept on the wire because installed mobile
|
|
408
|
+
* binaries still read it; new readers want `type`.
|
|
409
|
+
*
|
|
410
|
+
* @deprecated Read `type` instead.
|
|
411
|
+
*/
|
|
354
412
|
businessCategoryDetails: BusinessCategory | NullOrUndefined;
|
|
355
|
-
capabilities: BusinessCapability[] | NullOrUndefined;
|
|
356
413
|
status: BusinessStatus | `${BusinessStatus}`;
|
|
357
414
|
disabledAt: string | NullOrUndefined | Date;
|
|
358
415
|
disabledBy: string | NullOrUndefined;
|
|
359
416
|
disabledReason: string | NullOrUndefined;
|
|
360
417
|
settings: BusinessSettings | NullOrUndefined;
|
|
418
|
+
/**
|
|
419
|
+
* The resolved feature set — the plan's defaults with this business's own
|
|
420
|
+
* overrides applied. Server-computed; read this, never `settings.modules`,
|
|
421
|
+
* which holds only the deliberate exceptions.
|
|
422
|
+
*/
|
|
423
|
+
modules: Required<{
|
|
424
|
+
[K in keyof BusinessModules]: boolean;
|
|
425
|
+
}>;
|
|
361
426
|
}
|
|
362
427
|
interface BusinessPg extends Business {
|
|
363
428
|
pgId: any;
|
|
@@ -392,14 +457,58 @@ interface OpeningHours {
|
|
|
392
457
|
open: string;
|
|
393
458
|
close: string;
|
|
394
459
|
}
|
|
460
|
+
/**
|
|
461
|
+
* Which features a business sees.
|
|
462
|
+
*
|
|
463
|
+
* Every value is optional, and `undefined` means *inherit from the plan* — not
|
|
464
|
+
* `false`. That distinction is the whole point: a stored `true` is a decision
|
|
465
|
+
* somebody made, so the plan can never quietly take it back, while an unset key
|
|
466
|
+
* follows whatever the plan says today. Storing a resolved default would
|
|
467
|
+
* collapse the two and freeze every business on the defaults it was created
|
|
468
|
+
* with.
|
|
469
|
+
*
|
|
470
|
+
* Resolve with `modulesForPlan(type, plan)[key] ?? ...` — never read a key off
|
|
471
|
+
* this object directly.
|
|
472
|
+
*/
|
|
395
473
|
interface BusinessModules {
|
|
396
|
-
draftErrands
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
474
|
+
draftErrands?: boolean;
|
|
475
|
+
maintenance?: boolean;
|
|
476
|
+
fuelLogs?: boolean;
|
|
477
|
+
invoices?: boolean;
|
|
478
|
+
remittances?: boolean;
|
|
479
|
+
/** Manage its own riders: the roster, their pay, what they cost. */
|
|
480
|
+
riders?: boolean;
|
|
481
|
+
/**
|
|
482
|
+
* Route new errands to its own riders rather than to the network.
|
|
483
|
+
*
|
|
484
|
+
* Deliberately separate from `riders`. A merchant can run a roster and still
|
|
485
|
+
* send most deliveries out — managing riders and defaulting to them are
|
|
486
|
+
* different questions, and the old `SELF_FULFILLMENT` capability answered
|
|
487
|
+
* only the second one. Folding them together made every merchant
|
|
488
|
+
* self-fulfil and silently bypass each city's default courier.
|
|
489
|
+
*/
|
|
490
|
+
selfFulfilment?: boolean;
|
|
491
|
+
vehicles?: boolean;
|
|
492
|
+
expenses?: boolean;
|
|
493
|
+
/**
|
|
494
|
+
* Calculate what riders earned for a period and generate payout records.
|
|
495
|
+
* `riders/rider-payouts.controller.ts`, and the `rider-payouts` screens.
|
|
496
|
+
*/
|
|
497
|
+
riderPayouts?: boolean;
|
|
498
|
+
/** External GPS tracker feed; needs an API key to be useful. */
|
|
499
|
+
trackerDevices?: boolean;
|
|
500
|
+
/**
|
|
501
|
+
* WhatsApp notifications to the business's users and customers on errand
|
|
502
|
+
* events.
|
|
503
|
+
*
|
|
504
|
+
* Declared here so it appears in the plan map and the admin UI, but nothing
|
|
505
|
+
* reads it yet: `updateWhatsappConfig` is still gated on `isOwnFulfiller`.
|
|
506
|
+
* Moving that gate onto this key is the follow-up.
|
|
507
|
+
*/
|
|
508
|
+
whatsapp?: boolean;
|
|
402
509
|
}
|
|
510
|
+
/** Every module key, so a plan map can be checked for completeness. */
|
|
511
|
+
type BusinessModuleKey = keyof BusinessModules;
|
|
403
512
|
/**
|
|
404
513
|
* How a business funds fuel. `revenuePercent` is the share of errand revenue a
|
|
405
514
|
* vehicle sets aside for its own fuel — the single knob behind the fuel-owed
|
|
@@ -424,10 +533,10 @@ interface BusinessRiderPaySettings {
|
|
|
424
533
|
periodType: PayoutPeriodType | `${PayoutPeriodType}` | null;
|
|
425
534
|
}
|
|
426
535
|
interface BusinessSettings {
|
|
427
|
-
|
|
536
|
+
whatsappNotificationEnabled: boolean;
|
|
428
537
|
whatsapp: BusinessWhatsappConfig;
|
|
429
|
-
|
|
430
|
-
|
|
538
|
+
isOnline: boolean;
|
|
539
|
+
openingHours: {
|
|
431
540
|
monday: OpeningHours | null;
|
|
432
541
|
tuesday: OpeningHours | null;
|
|
433
542
|
wednesday: OpeningHours | null;
|
|
@@ -436,24 +545,28 @@ interface BusinessSettings {
|
|
|
436
545
|
saturday: OpeningHours | null;
|
|
437
546
|
sunday: OpeningHours | null;
|
|
438
547
|
};
|
|
439
|
-
|
|
548
|
+
socialLinks: {
|
|
440
549
|
instagram: string | null;
|
|
441
550
|
facebook: string | null;
|
|
442
551
|
twitter: string | null;
|
|
443
552
|
tiktok: string | null;
|
|
444
553
|
website: string | null;
|
|
445
554
|
};
|
|
446
|
-
limits?: {
|
|
447
|
-
maxRiders: number | null;
|
|
448
|
-
maxVehicles: number | null;
|
|
449
|
-
maxErrands: number | null;
|
|
450
|
-
};
|
|
451
555
|
modules: BusinessModules;
|
|
452
556
|
fuel?: BusinessFuelSettings;
|
|
453
557
|
riderPay?: BusinessRiderPaySettings;
|
|
454
558
|
}
|
|
455
559
|
declare const DEFAULT_BUSINESS_FUEL_SETTINGS: BusinessFuelSettings;
|
|
456
560
|
declare const DEFAULT_BUSINESS_RIDER_PAY_SETTINGS: BusinessRiderPaySettings;
|
|
561
|
+
/**
|
|
562
|
+
* @deprecated Defaults live in `modulesForPlan(type, plan)` on the server. This
|
|
563
|
+
* was an all-`true` deny-list: every new feature shipped to every business
|
|
564
|
+
* until someone remembered to switch it off, and writing it into each new
|
|
565
|
+
* business made the stored value indistinguishable from a deliberate grant.
|
|
566
|
+
*
|
|
567
|
+
* Kept only so nothing importing it breaks mid-migration. Empty on purpose —
|
|
568
|
+
* unset means inherit.
|
|
569
|
+
*/
|
|
457
570
|
declare const DEFAULT_BUSINESS_MODULES: BusinessModules;
|
|
458
571
|
declare const DEFAULT_BUSINESS_SETTINGS: BusinessSettings;
|
|
459
572
|
interface BusinessMember {
|
|
@@ -731,13 +844,21 @@ type Rider = {
|
|
|
731
844
|
hasBeenRated: boolean;
|
|
732
845
|
payoutPercentage?: number | null;
|
|
733
846
|
state?: string | State;
|
|
734
|
-
currentErrand?: Errand;
|
|
735
|
-
lastDeliveredErrand?: Errand;
|
|
736
847
|
};
|
|
737
848
|
type RiderWithUserDetails = Rider & {
|
|
738
849
|
userDetails?: User;
|
|
739
850
|
vehicleDetails?: Vehicle | null;
|
|
740
851
|
businessMemberDetails?: BusinessMember;
|
|
852
|
+
/**
|
|
853
|
+
* What the rider owes us: the sum of their pending (unremitted) settlements,
|
|
854
|
+
* scoped to the rider's own business. Same figure as the rider register's
|
|
855
|
+
* `cashOwed`.
|
|
856
|
+
*/
|
|
857
|
+
cashOwed?: number;
|
|
858
|
+
/** How many pending settlements make up `cashOwed`. */
|
|
859
|
+
unremittedSettlements?: number;
|
|
860
|
+
/** When the oldest of those settlements was raised — null when none are. */
|
|
861
|
+
oldestUnremittedAt?: Date | null;
|
|
741
862
|
};
|
|
742
863
|
declare enum RemittanceStatus {
|
|
743
864
|
Pending = "pending",
|
|
@@ -904,7 +1025,6 @@ interface PendingErrand {
|
|
|
904
1025
|
_id: string;
|
|
905
1026
|
rider: string;
|
|
906
1027
|
customerId: string;
|
|
907
|
-
parcelSize: ParcelSize;
|
|
908
1028
|
deliveryStatus: ErrandStatus;
|
|
909
1029
|
invoice: {
|
|
910
1030
|
invoiceStatus: string;
|
|
@@ -978,7 +1098,6 @@ interface Errand {
|
|
|
978
1098
|
courierBusinessId?: string;
|
|
979
1099
|
pickupDetails: AddressDetails;
|
|
980
1100
|
deliveryDetails: AddressDetails;
|
|
981
|
-
parcelSize: `${ParcelSize}`;
|
|
982
1101
|
deliveryStatus: ErrandStatus | `${ErrandStatus}`;
|
|
983
1102
|
paymentStatus: `${InvoiceStatus}`;
|
|
984
1103
|
invoiceId?: string;
|
|
@@ -1034,7 +1153,6 @@ interface Errand {
|
|
|
1034
1153
|
feePaymentStatus?: `${FeePaymentStatus}`;
|
|
1035
1154
|
}
|
|
1036
1155
|
interface AggregatedErrand extends Errand {
|
|
1037
|
-
parcelSize: `${ParcelSize}`;
|
|
1038
1156
|
invoiceDetails: Invoice;
|
|
1039
1157
|
pickupLocation: {
|
|
1040
1158
|
cityId: string;
|
|
@@ -1075,12 +1193,6 @@ declare enum DeliveryStatus {
|
|
|
1075
1193
|
Delivered = "delivered",
|
|
1076
1194
|
Cancelled = "cancelled"
|
|
1077
1195
|
}
|
|
1078
|
-
declare enum ParcelSize {
|
|
1079
|
-
Bike = "bike",
|
|
1080
|
-
Large = "large",
|
|
1081
|
-
Medium = "medium",
|
|
1082
|
-
Small = "small"
|
|
1083
|
-
}
|
|
1084
1196
|
interface ErrandTimeline {
|
|
1085
1197
|
id: string;
|
|
1086
1198
|
errandId: string;
|
|
@@ -1150,7 +1262,6 @@ interface DraftErrand {
|
|
|
1150
1262
|
pickupDetails?: AddressDetails;
|
|
1151
1263
|
deliveryDetails?: AddressDetails;
|
|
1152
1264
|
additionalData?: string;
|
|
1153
|
-
parcelSize?: `${ParcelSize}`;
|
|
1154
1265
|
status: DraftErrandStatus;
|
|
1155
1266
|
convertedErrandId?: string;
|
|
1156
1267
|
settlementId?: string;
|
|
@@ -1725,4 +1836,4 @@ declare enum LinkDestination {
|
|
|
1725
1836
|
}
|
|
1726
1837
|
type NullOrUndefined = null | undefined;
|
|
1727
1838
|
|
|
1728
|
-
export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type BusinessFuelSettings, type BusinessMember, type BusinessModules, type BusinessPg, type BusinessPortal, type BusinessRiderPaySettings, BusinessRole, type BusinessSettings, BusinessStatus, type BusinessWhatsappConfig, type City, type Collection, type Customer, type CustomerAddress, type CustomerBilling, type CustomerTransactionStats, DEFAULT_BUSINESS_FUEL_SETTINGS, DEFAULT_BUSINESS_MODULES, DEFAULT_BUSINESS_RIDER_PAY_SETTINGS, DEFAULT_BUSINESS_SETTINGS, DeliveryStatus, type DraftErrand, DraftErrandStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, ErrandInvoiceState, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, type ExpensePaidBy, FeePaymentStatus, FeeSettlement, type FuelDueData, type FuelDueItem, FuelDueStatus, type FuelDueTotals, type FuelPercentSuggestion, type FuelSinceLastRefuel, type FuelSuggestionConfidence, type GeoPoint, GlobalRoles, type Invoice, type InvoiceDrift, type InvoiceEvent, InvoiceEventType, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, type InvoicePayment, InvoicePaymentMethod, InvoiceStatus, type LatLng, LinkDestination, type MaintenanceItem, type MaintenancePartUsage, type MaintenanceRecord, type MaintenanceStats, type MaintenanceStatsSummary, type MaintenanceTopItem, MembershipStatus, type Notification, type NotificationData, NotificationType, type NullOrUndefined, type OpeningHours, type PaginateResult,
|
|
1839
|
+
export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type BusinessFuelSettings, type BusinessMember, type BusinessModuleKey, type BusinessModules, type BusinessPg, BusinessPlan, type BusinessPortal, type BusinessRiderPaySettings, BusinessRole, type BusinessSettings, BusinessStatus, BusinessType, type BusinessWhatsappConfig, type City, type Collection, type Customer, type CustomerAddress, type CustomerBilling, type CustomerTransactionStats, DEFAULT_BUSINESS_FUEL_SETTINGS, DEFAULT_BUSINESS_MODULES, DEFAULT_BUSINESS_RIDER_PAY_SETTINGS, DEFAULT_BUSINESS_SETTINGS, DeliveryStatus, type DraftErrand, DraftErrandStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, ErrandFulfilment, ErrandInvoiceState, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, type ExpensePaidBy, FeePaymentStatus, FeeSettlement, type FuelDueData, type FuelDueItem, FuelDueStatus, type FuelDueTotals, type FuelPercentSuggestion, type FuelSinceLastRefuel, type FuelSuggestionConfidence, type GeoPoint, GlobalRoles, type Invoice, type InvoiceDrift, type InvoiceEvent, InvoiceEventType, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, type InvoicePayment, InvoicePaymentMethod, InvoiceStatus, type LatLng, LinkDestination, type MaintenanceItem, type MaintenancePartUsage, type MaintenanceRecord, type MaintenanceStats, type MaintenanceStatsSummary, type MaintenanceTopItem, MembershipStatus, type Notification, type NotificationData, NotificationType, type NullOrUndefined, type OpeningHours, type PaginateResult, PaymentOptions, PayoutPeriodType, PayoutRateSource, type PendingErrand, type PortalHandleAvailability, PortalStatus, type Product, type ProductCategory, type ProductImage, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductTag, type ProductVariant, type ProductVariantPrice, type PublicPortal, type PublicPortalBusiness, 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 TrackerPosition, 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 };
|
package/dist/index.js
CHANGED
|
@@ -96,13 +96,6 @@ var DeliveryStatus = /* @__PURE__ */ ((DeliveryStatus2) => {
|
|
|
96
96
|
DeliveryStatus2["Cancelled"] = "cancelled";
|
|
97
97
|
return DeliveryStatus2;
|
|
98
98
|
})(DeliveryStatus || {});
|
|
99
|
-
var ParcelSize = /* @__PURE__ */ ((ParcelSize2) => {
|
|
100
|
-
ParcelSize2["Bike"] = "bike";
|
|
101
|
-
ParcelSize2["Large"] = "large";
|
|
102
|
-
ParcelSize2["Medium"] = "medium";
|
|
103
|
-
ParcelSize2["Small"] = "small";
|
|
104
|
-
return ParcelSize2;
|
|
105
|
-
})(ParcelSize || {});
|
|
106
99
|
var DraftErrandStatus = /* @__PURE__ */ ((DraftErrandStatus2) => {
|
|
107
100
|
DraftErrandStatus2["Draft"] = "draft";
|
|
108
101
|
DraftErrandStatus2["RiderCompleted"] = "rider_completed";
|
|
@@ -229,6 +222,22 @@ var BusinessCapability = /* @__PURE__ */ ((BusinessCapability2) => {
|
|
|
229
222
|
BusinessCapability2["SELF_FULFILLMENT"] = "self_fulfillment";
|
|
230
223
|
return BusinessCapability2;
|
|
231
224
|
})(BusinessCapability || {});
|
|
225
|
+
var ErrandFulfilment = /* @__PURE__ */ ((ErrandFulfilment2) => {
|
|
226
|
+
ErrandFulfilment2["OWN"] = "own";
|
|
227
|
+
ErrandFulfilment2["NETWORK"] = "network";
|
|
228
|
+
return ErrandFulfilment2;
|
|
229
|
+
})(ErrandFulfilment || {});
|
|
230
|
+
var BusinessType = /* @__PURE__ */ ((BusinessType2) => {
|
|
231
|
+
BusinessType2["MERCHANT"] = "merchant";
|
|
232
|
+
BusinessType2["COURIER"] = "courier";
|
|
233
|
+
return BusinessType2;
|
|
234
|
+
})(BusinessType || {});
|
|
235
|
+
var BusinessPlan = /* @__PURE__ */ ((BusinessPlan2) => {
|
|
236
|
+
BusinessPlan2["MVP"] = "mvp";
|
|
237
|
+
BusinessPlan2["FULL"] = "full";
|
|
238
|
+
BusinessPlan2["INTERNAL"] = "internal";
|
|
239
|
+
return BusinessPlan2;
|
|
240
|
+
})(BusinessPlan || {});
|
|
232
241
|
var BusinessStatus = /* @__PURE__ */ ((BusinessStatus2) => {
|
|
233
242
|
BusinessStatus2["ACTIVE"] = "active";
|
|
234
243
|
BusinessStatus2["DISABLED"] = "disabled";
|
|
@@ -254,22 +263,15 @@ var DEFAULT_BUSINESS_RIDER_PAY_SETTINGS = {
|
|
|
254
263
|
defaultPercentage: null,
|
|
255
264
|
periodType: null
|
|
256
265
|
};
|
|
257
|
-
var DEFAULT_BUSINESS_MODULES = {
|
|
258
|
-
draftErrands: true,
|
|
259
|
-
team: true,
|
|
260
|
-
maintenance: true,
|
|
261
|
-
fuelLogs: true,
|
|
262
|
-
invoices: true,
|
|
263
|
-
remittances: true
|
|
264
|
-
};
|
|
266
|
+
var DEFAULT_BUSINESS_MODULES = {};
|
|
265
267
|
var DEFAULT_BUSINESS_SETTINGS = {
|
|
266
|
-
|
|
268
|
+
whatsappNotificationEnabled: true,
|
|
267
269
|
whatsapp: {
|
|
268
270
|
enabled: false,
|
|
269
271
|
templates: {}
|
|
270
272
|
},
|
|
271
|
-
|
|
272
|
-
|
|
273
|
+
isOnline: true,
|
|
274
|
+
openingHours: {
|
|
273
275
|
monday: { open: "09:00", close: "17:00" },
|
|
274
276
|
tuesday: { open: "09:00", close: "17:00" },
|
|
275
277
|
wednesday: { open: "09:00", close: "17:00" },
|
|
@@ -278,7 +280,7 @@ var DEFAULT_BUSINESS_SETTINGS = {
|
|
|
278
280
|
saturday: null,
|
|
279
281
|
sunday: null
|
|
280
282
|
},
|
|
281
|
-
|
|
283
|
+
socialLinks: {
|
|
282
284
|
instagram: null,
|
|
283
285
|
facebook: null,
|
|
284
286
|
twitter: null,
|
|
@@ -362,8 +364,10 @@ export {
|
|
|
362
364
|
AuthType,
|
|
363
365
|
BusinessCapability,
|
|
364
366
|
BusinessCourierLinkStatus,
|
|
367
|
+
BusinessPlan,
|
|
365
368
|
BusinessRole,
|
|
366
369
|
BusinessStatus,
|
|
370
|
+
BusinessType,
|
|
367
371
|
DEFAULT_BUSINESS_FUEL_SETTINGS,
|
|
368
372
|
DEFAULT_BUSINESS_MODULES,
|
|
369
373
|
DEFAULT_BUSINESS_RIDER_PAY_SETTINGS,
|
|
@@ -371,6 +375,7 @@ export {
|
|
|
371
375
|
DeliveryStatus,
|
|
372
376
|
DraftErrandStatus,
|
|
373
377
|
EnterpriseType,
|
|
378
|
+
ErrandFulfilment,
|
|
374
379
|
ErrandInvoiceState,
|
|
375
380
|
ErrandStatus,
|
|
376
381
|
FeePaymentStatus,
|
|
@@ -385,7 +390,6 @@ export {
|
|
|
385
390
|
LinkDestination,
|
|
386
391
|
MembershipStatus,
|
|
387
392
|
NotificationType,
|
|
388
|
-
ParcelSize,
|
|
389
393
|
PaymentOptions,
|
|
390
394
|
PayoutPeriodType,
|
|
391
395
|
PayoutRateSource,
|
package/package.json
CHANGED
package/src/business.ts
CHANGED
|
@@ -5,10 +5,64 @@ import {
|
|
|
5
5
|
User,
|
|
6
6
|
} from '.';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated Retired. `SELF_FULFILLMENT` asked "may this business use its own
|
|
10
|
+
* rider instead of ours?" — a question that only makes sense when
|
|
11
|
+
* self-fulfilment is the exception. Every merchant has riders, so the flag was
|
|
12
|
+
* true for everyone and said nothing.
|
|
13
|
+
*
|
|
14
|
+
* What replaced it: the `riders` module for whether the business manages its
|
|
15
|
+
* own riders at all, and {@link ErrandFulfilment} on each errand for who
|
|
16
|
+
* actually carried it. A restaurant with two riders still overflows to the
|
|
17
|
+
* network on a busy Friday, which a business-level boolean cannot express and
|
|
18
|
+
* an errand-level field can — and the errand-level one is what rider-cost
|
|
19
|
+
* reporting needs.
|
|
20
|
+
*/
|
|
8
21
|
export enum BusinessCapability {
|
|
9
22
|
SELF_FULFILLMENT = 'self_fulfillment',
|
|
10
23
|
}
|
|
11
24
|
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Who carried an errand: the originating business's own rider, or the wider
|
|
28
|
+
* network. The field rider-cost reporting splits on — own-rider cost against
|
|
29
|
+
* network payout.
|
|
30
|
+
*/
|
|
31
|
+
export enum ErrandFulfilment {
|
|
32
|
+
OWN = 'own',
|
|
33
|
+
NETWORK = 'network',
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Which product a business is using. The one stored fact about its shape —
|
|
38
|
+
* a courier runs deliveries for other businesses, a merchant sends its own out.
|
|
39
|
+
*
|
|
40
|
+
* Replaces the free-text business-category collection, whose only reader was a
|
|
41
|
+
* `name.includes('courier')` string match: a category rename silently reshaped
|
|
42
|
+
* the account, and five of the seven call sites omitted `toLowerCase()` so a
|
|
43
|
+
* capitalised name read as `false` everywhere.
|
|
44
|
+
*/
|
|
45
|
+
export enum BusinessType {
|
|
46
|
+
MERCHANT = 'merchant',
|
|
47
|
+
COURIER = 'courier',
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* How much of its product a business gets. Orthogonal to {@link BusinessType}:
|
|
52
|
+
* `type` decides which features are even relevant, `plan` decides which of
|
|
53
|
+
* those are unlocked. A merchant's `full` and a courier's `full` are different
|
|
54
|
+
* sets, which is the point — upgrading a restaurant must never hand it
|
|
55
|
+
* client-invoicing.
|
|
56
|
+
*
|
|
57
|
+
* `internal` is where new work lands: features default to it alone, so nothing
|
|
58
|
+
* reaches customers by someone forgetting to hide it.
|
|
59
|
+
*/
|
|
60
|
+
export enum BusinessPlan {
|
|
61
|
+
MVP = 'mvp',
|
|
62
|
+
FULL = 'full',
|
|
63
|
+
INTERNAL = 'internal',
|
|
64
|
+
}
|
|
65
|
+
|
|
12
66
|
export enum BusinessStatus {
|
|
13
67
|
ACTIVE = 'active',
|
|
14
68
|
DISABLED = 'disabled',
|
|
@@ -20,6 +74,8 @@ export interface Business {
|
|
|
20
74
|
name: string;
|
|
21
75
|
description: string;
|
|
22
76
|
officeNumber: string;
|
|
77
|
+
type: BusinessType | `${BusinessType}`;
|
|
78
|
+
plan: BusinessPlan | `${BusinessPlan}`;
|
|
23
79
|
categoryId: string;
|
|
24
80
|
address: string | NullOrUndefined;
|
|
25
81
|
addressCoordinates:
|
|
@@ -57,8 +113,13 @@ export interface Business {
|
|
|
57
113
|
updatedAt: string | NullOrUndefined | Date;
|
|
58
114
|
verifiedAt: string | NullOrUndefined | Date;
|
|
59
115
|
registrationCompletedAt: string | NullOrUndefined | Date;
|
|
116
|
+
/**
|
|
117
|
+
* Derived from `type`, not stored. Kept on the wire because installed mobile
|
|
118
|
+
* binaries still read it; new readers want `type`.
|
|
119
|
+
*
|
|
120
|
+
* @deprecated Read `type` instead.
|
|
121
|
+
*/
|
|
60
122
|
businessCategoryDetails: BusinessCategory | NullOrUndefined;
|
|
61
|
-
capabilities: BusinessCapability[] | NullOrUndefined;
|
|
62
123
|
|
|
63
124
|
status: BusinessStatus | `${BusinessStatus}`;
|
|
64
125
|
disabledAt: string | NullOrUndefined | Date;
|
|
@@ -66,6 +127,13 @@ export interface Business {
|
|
|
66
127
|
disabledReason: string | NullOrUndefined;
|
|
67
128
|
|
|
68
129
|
settings: BusinessSettings | NullOrUndefined;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* The resolved feature set — the plan's defaults with this business's own
|
|
133
|
+
* overrides applied. Server-computed; read this, never `settings.modules`,
|
|
134
|
+
* which holds only the deliberate exceptions.
|
|
135
|
+
*/
|
|
136
|
+
modules: Required<{ [K in keyof BusinessModules]: boolean }>;
|
|
69
137
|
}
|
|
70
138
|
|
|
71
139
|
export interface BusinessPg extends Business {
|
|
@@ -109,15 +177,60 @@ export interface OpeningHours {
|
|
|
109
177
|
close: string;
|
|
110
178
|
}
|
|
111
179
|
|
|
180
|
+
/**
|
|
181
|
+
* Which features a business sees.
|
|
182
|
+
*
|
|
183
|
+
* Every value is optional, and `undefined` means *inherit from the plan* — not
|
|
184
|
+
* `false`. That distinction is the whole point: a stored `true` is a decision
|
|
185
|
+
* somebody made, so the plan can never quietly take it back, while an unset key
|
|
186
|
+
* follows whatever the plan says today. Storing a resolved default would
|
|
187
|
+
* collapse the two and freeze every business on the defaults it was created
|
|
188
|
+
* with.
|
|
189
|
+
*
|
|
190
|
+
* Resolve with `modulesForPlan(type, plan)[key] ?? ...` — never read a key off
|
|
191
|
+
* this object directly.
|
|
192
|
+
*/
|
|
112
193
|
export interface BusinessModules {
|
|
113
|
-
draftErrands
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
194
|
+
draftErrands?: boolean;
|
|
195
|
+
maintenance?: boolean;
|
|
196
|
+
fuelLogs?: boolean;
|
|
197
|
+
invoices?: boolean;
|
|
198
|
+
remittances?: boolean;
|
|
199
|
+
/** Manage its own riders: the roster, their pay, what they cost. */
|
|
200
|
+
riders?: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* Route new errands to its own riders rather than to the network.
|
|
203
|
+
*
|
|
204
|
+
* Deliberately separate from `riders`. A merchant can run a roster and still
|
|
205
|
+
* send most deliveries out — managing riders and defaulting to them are
|
|
206
|
+
* different questions, and the old `SELF_FULFILLMENT` capability answered
|
|
207
|
+
* only the second one. Folding them together made every merchant
|
|
208
|
+
* self-fulfil and silently bypass each city's default courier.
|
|
209
|
+
*/
|
|
210
|
+
selfFulfilment?: boolean;
|
|
211
|
+
vehicles?: boolean;
|
|
212
|
+
expenses?: boolean;
|
|
213
|
+
/**
|
|
214
|
+
* Calculate what riders earned for a period and generate payout records.
|
|
215
|
+
* `riders/rider-payouts.controller.ts`, and the `rider-payouts` screens.
|
|
216
|
+
*/
|
|
217
|
+
riderPayouts?: boolean;
|
|
218
|
+
/** External GPS tracker feed; needs an API key to be useful. */
|
|
219
|
+
trackerDevices?: boolean;
|
|
220
|
+
/**
|
|
221
|
+
* WhatsApp notifications to the business's users and customers on errand
|
|
222
|
+
* events.
|
|
223
|
+
*
|
|
224
|
+
* Declared here so it appears in the plan map and the admin UI, but nothing
|
|
225
|
+
* reads it yet: `updateWhatsappConfig` is still gated on `isOwnFulfiller`.
|
|
226
|
+
* Moving that gate onto this key is the follow-up.
|
|
227
|
+
*/
|
|
228
|
+
whatsapp?: boolean;
|
|
119
229
|
}
|
|
120
230
|
|
|
231
|
+
/** Every module key, so a plan map can be checked for completeness. */
|
|
232
|
+
export type BusinessModuleKey = keyof BusinessModules;
|
|
233
|
+
|
|
121
234
|
/**
|
|
122
235
|
* How a business funds fuel. `revenuePercent` is the share of errand revenue a
|
|
123
236
|
* vehicle sets aside for its own fuel — the single knob behind the fuel-owed
|
|
@@ -144,10 +257,10 @@ export interface BusinessRiderPaySettings {
|
|
|
144
257
|
}
|
|
145
258
|
|
|
146
259
|
export interface BusinessSettings {
|
|
147
|
-
|
|
260
|
+
whatsappNotificationEnabled: boolean;
|
|
148
261
|
whatsapp: BusinessWhatsappConfig;
|
|
149
|
-
|
|
150
|
-
|
|
262
|
+
isOnline: boolean;
|
|
263
|
+
openingHours: {
|
|
151
264
|
monday: OpeningHours | null;
|
|
152
265
|
tuesday: OpeningHours | null;
|
|
153
266
|
wednesday: OpeningHours | null;
|
|
@@ -156,18 +269,13 @@ export interface BusinessSettings {
|
|
|
156
269
|
saturday: OpeningHours | null;
|
|
157
270
|
sunday: OpeningHours | null;
|
|
158
271
|
};
|
|
159
|
-
|
|
272
|
+
socialLinks: {
|
|
160
273
|
instagram: string | null;
|
|
161
274
|
facebook: string | null;
|
|
162
275
|
twitter: string | null;
|
|
163
276
|
tiktok: string | null;
|
|
164
277
|
website: string | null;
|
|
165
278
|
};
|
|
166
|
-
limits?: {
|
|
167
|
-
maxRiders: number | null;
|
|
168
|
-
maxVehicles: number | null;
|
|
169
|
-
maxErrands: number | null;
|
|
170
|
-
};
|
|
171
279
|
modules: BusinessModules;
|
|
172
280
|
fuel?: BusinessFuelSettings;
|
|
173
281
|
riderPay?: BusinessRiderPaySettings;
|
|
@@ -182,23 +290,25 @@ export const DEFAULT_BUSINESS_RIDER_PAY_SETTINGS: BusinessRiderPaySettings = {
|
|
|
182
290
|
periodType: null,
|
|
183
291
|
};
|
|
184
292
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
293
|
+
/**
|
|
294
|
+
* @deprecated Defaults live in `modulesForPlan(type, plan)` on the server. This
|
|
295
|
+
* was an all-`true` deny-list: every new feature shipped to every business
|
|
296
|
+
* until someone remembered to switch it off, and writing it into each new
|
|
297
|
+
* business made the stored value indistinguishable from a deliberate grant.
|
|
298
|
+
*
|
|
299
|
+
* Kept only so nothing importing it breaks mid-migration. Empty on purpose —
|
|
300
|
+
* unset means inherit.
|
|
301
|
+
*/
|
|
302
|
+
export const DEFAULT_BUSINESS_MODULES: BusinessModules = {};
|
|
193
303
|
|
|
194
304
|
export const DEFAULT_BUSINESS_SETTINGS: BusinessSettings = {
|
|
195
|
-
|
|
305
|
+
whatsappNotificationEnabled: true,
|
|
196
306
|
whatsapp: {
|
|
197
307
|
enabled: false,
|
|
198
308
|
templates: {},
|
|
199
309
|
},
|
|
200
|
-
|
|
201
|
-
|
|
310
|
+
isOnline: true,
|
|
311
|
+
openingHours: {
|
|
202
312
|
monday: { open: '09:00', close: '17:00' },
|
|
203
313
|
tuesday: { open: '09:00', close: '17:00' },
|
|
204
314
|
wednesday: { open: '09:00', close: '17:00' },
|
|
@@ -207,7 +317,7 @@ export const DEFAULT_BUSINESS_SETTINGS: BusinessSettings = {
|
|
|
207
317
|
saturday: null,
|
|
208
318
|
sunday: null,
|
|
209
319
|
},
|
|
210
|
-
|
|
320
|
+
socialLinks: {
|
|
211
321
|
instagram: null,
|
|
212
322
|
facebook: null,
|
|
213
323
|
twitter: null,
|
package/src/delivery.ts
CHANGED
package/src/errand.ts
CHANGED
|
@@ -62,7 +62,6 @@ export interface PendingErrand {
|
|
|
62
62
|
_id: string;
|
|
63
63
|
rider: string;
|
|
64
64
|
customerId: string;
|
|
65
|
-
parcelSize: ParcelSize;
|
|
66
65
|
deliveryStatus: ErrandStatus;
|
|
67
66
|
invoice: {
|
|
68
67
|
invoiceStatus: string;
|
|
@@ -169,7 +168,6 @@ export interface Errand {
|
|
|
169
168
|
|
|
170
169
|
pickupDetails: AddressDetails;
|
|
171
170
|
deliveryDetails: AddressDetails;
|
|
172
|
-
parcelSize: `${ParcelSize}`;
|
|
173
171
|
deliveryStatus: ErrandStatus | `${ErrandStatus}`;
|
|
174
172
|
paymentStatus: `${InvoiceStatus}`;
|
|
175
173
|
invoiceId?: string;
|
|
@@ -241,7 +239,6 @@ export interface Errand {
|
|
|
241
239
|
}
|
|
242
240
|
|
|
243
241
|
export interface AggregatedErrand extends Errand {
|
|
244
|
-
parcelSize: `${ParcelSize}`;
|
|
245
242
|
invoiceDetails: Invoice;
|
|
246
243
|
pickupLocation: {
|
|
247
244
|
cityId: string;
|
|
@@ -301,13 +298,6 @@ export enum DeliveryStatus {
|
|
|
301
298
|
Cancelled = 'cancelled',
|
|
302
299
|
}
|
|
303
300
|
|
|
304
|
-
export enum ParcelSize {
|
|
305
|
-
Bike = 'bike',
|
|
306
|
-
Large = 'large',
|
|
307
|
-
Medium = 'medium',
|
|
308
|
-
Small = 'small',
|
|
309
|
-
}
|
|
310
|
-
|
|
311
301
|
export interface ErrandTimeline {
|
|
312
302
|
id: string;
|
|
313
303
|
errandId: string;
|
|
@@ -371,7 +361,6 @@ export interface DraftErrand {
|
|
|
371
361
|
pickupDetails?: AddressDetails;
|
|
372
362
|
deliveryDetails?: AddressDetails;
|
|
373
363
|
additionalData?: string;
|
|
374
|
-
parcelSize?: `${ParcelSize}`;
|
|
375
364
|
|
|
376
365
|
// Lifecycle
|
|
377
366
|
status: DraftErrandStatus;
|
package/src/rider.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// import { Enterprise } from './enterprise';
|
|
2
2
|
import { BusinessMember } from './business';
|
|
3
|
-
import { Errand } from './errand';
|
|
4
3
|
import { State } from './location';
|
|
5
4
|
import { User } from './user';
|
|
6
5
|
import type { Vehicle } from './vehicle';
|
|
@@ -48,14 +47,23 @@ export type Rider = {
|
|
|
48
47
|
// isTracking: boolean;
|
|
49
48
|
|
|
50
49
|
state?: string | State;
|
|
51
|
-
currentErrand?: Errand;
|
|
52
|
-
lastDeliveredErrand?: Errand;
|
|
53
50
|
};
|
|
54
51
|
|
|
55
52
|
export type RiderWithUserDetails = Rider & {
|
|
56
53
|
userDetails?: User;
|
|
57
54
|
vehicleDetails?: Vehicle | null;
|
|
58
55
|
businessMemberDetails?: BusinessMember;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* What the rider owes us: the sum of their pending (unremitted) settlements,
|
|
59
|
+
* scoped to the rider's own business. Same figure as the rider register's
|
|
60
|
+
* `cashOwed`.
|
|
61
|
+
*/
|
|
62
|
+
cashOwed?: number;
|
|
63
|
+
/** How many pending settlements make up `cashOwed`. */
|
|
64
|
+
unremittedSettlements?: number;
|
|
65
|
+
/** When the oldest of those settlements was raised — null when none are. */
|
|
66
|
+
oldestUnremittedAt?: Date | null;
|
|
59
67
|
};
|
|
60
68
|
|
|
61
69
|
// Rider Settlement Types
|