@mydoormot/app-types 2.3.0 → 2.3.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 +18 -18
- package/CHANGELOG.md +6 -0
- package/dist/index.cjs +1 -22
- package/dist/index.d.cts +10 -203
- package/dist/index.d.ts +10 -203
- package/dist/index.js +1 -19
- package/package.json +1 -1
- package/src/business.ts +0 -16
- package/src/customer.ts +2 -0
- package/src/errand.ts +5 -47
- package/src/index.ts +0 -2
- package/src/invoice.ts +2 -0
- package/src/vehicle.ts +0 -100
- package/src/platform.ts +0 -17
- package/src/portal.ts +0 -46
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
> @mydoormot/app-types@2.
|
|
3
|
-
> tsup src/index.ts --format esm,cjs --dts
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
|
|
2
|
+
> @mydoormot/app-types@2.3.0 build /Users/chuksben/Desktop/projects/microservices/mydoormot/packages/app-types
|
|
3
|
+
> tsup src/index.ts --format esm,cjs --dts
|
|
4
|
+
|
|
5
|
+
CLI Building entry: src/index.ts
|
|
6
|
+
CLI Using tsconfig: tsconfig.json
|
|
7
|
+
CLI tsup v7.3.0
|
|
8
|
+
CLI Target: es2021
|
|
9
|
+
ESM Build start
|
|
10
|
+
CJS Build start
|
|
11
|
+
CJS dist/index.cjs 17.50 KB
|
|
12
|
+
CJS ⚡️ Build success in 243ms
|
|
13
|
+
ESM dist/index.js 14.57 KB
|
|
14
|
+
ESM ⚡️ Build success in 246ms
|
|
15
|
+
DTS Build start
|
|
16
|
+
DTS ⚡️ Build success in 1079ms
|
|
17
|
+
DTS dist/index.d.ts 53.90 KB
|
|
18
|
+
DTS dist/index.d.cts 53.90 KB
|
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -28,7 +28,6 @@ __export(src_exports, {
|
|
|
28
28
|
BusinessRole: () => BusinessRole,
|
|
29
29
|
BusinessStatus: () => BusinessStatus,
|
|
30
30
|
BusinessType: () => BusinessType,
|
|
31
|
-
DEFAULT_BUSINESS_FUEL_SETTINGS: () => DEFAULT_BUSINESS_FUEL_SETTINGS,
|
|
32
31
|
DEFAULT_BUSINESS_RIDER_PAY_SETTINGS: () => DEFAULT_BUSINESS_RIDER_PAY_SETTINGS,
|
|
33
32
|
DEFAULT_BUSINESS_SETTINGS: () => DEFAULT_BUSINESS_SETTINGS,
|
|
34
33
|
DeliveryStatus: () => DeliveryStatus,
|
|
@@ -39,7 +38,6 @@ __export(src_exports, {
|
|
|
39
38
|
ErrandStatus: () => ErrandStatus,
|
|
40
39
|
FeePaymentStatus: () => FeePaymentStatus,
|
|
41
40
|
FeeSettlement: () => FeeSettlement,
|
|
42
|
-
FuelDueStatus: () => FuelDueStatus,
|
|
43
41
|
GlobalRoles: () => GlobalRoles,
|
|
44
42
|
InvoiceEventType: () => InvoiceEventType,
|
|
45
43
|
InvoiceGenerationType: () => InvoiceGenerationType,
|
|
@@ -54,7 +52,6 @@ __export(src_exports, {
|
|
|
54
52
|
PaymentOptions: () => PaymentOptions,
|
|
55
53
|
PayoutPeriodType: () => PayoutPeriodType,
|
|
56
54
|
PayoutRateSource: () => PayoutRateSource,
|
|
57
|
-
PortalStatus: () => PortalStatus,
|
|
58
55
|
RemittanceStatus: () => RemittanceStatus,
|
|
59
56
|
RiderPayoutStatus: () => RiderPayoutStatus,
|
|
60
57
|
RoleType: () => RoleType,
|
|
@@ -219,6 +216,7 @@ var InvoiceEventType = /* @__PURE__ */ ((InvoiceEventType2) => {
|
|
|
219
216
|
InvoiceEventType2["PaymentReversed"] = "payment_reversed";
|
|
220
217
|
InvoiceEventType2["PaymentUpdated"] = "payment_updated";
|
|
221
218
|
InvoiceEventType2["StatusChanged"] = "status_changed";
|
|
219
|
+
InvoiceEventType2["ErrandSettlementChanged"] = "errand_settlement_changed";
|
|
222
220
|
InvoiceEventType2["Viewed"] = "viewed";
|
|
223
221
|
return InvoiceEventType2;
|
|
224
222
|
})(InvoiceEventType || {});
|
|
@@ -249,11 +247,6 @@ var VehicleLogType = /* @__PURE__ */ ((VehicleLogType2) => {
|
|
|
249
247
|
VehicleLogType2["REFUEL"] = "REFUEL";
|
|
250
248
|
return VehicleLogType2;
|
|
251
249
|
})(VehicleLogType || {});
|
|
252
|
-
var FuelDueStatus = /* @__PURE__ */ ((FuelDueStatus2) => {
|
|
253
|
-
FuelDueStatus2["Due"] = "DUE";
|
|
254
|
-
FuelDueStatus2["Ok"] = "OK";
|
|
255
|
-
return FuelDueStatus2;
|
|
256
|
-
})(FuelDueStatus || {});
|
|
257
250
|
|
|
258
251
|
// src/rider.ts
|
|
259
252
|
var RemittanceStatus = /* @__PURE__ */ ((RemittanceStatus2) => {
|
|
@@ -333,9 +326,6 @@ var MembershipStatus = /* @__PURE__ */ ((MembershipStatus2) => {
|
|
|
333
326
|
MembershipStatus2["DISABLED"] = "DISABLED";
|
|
334
327
|
return MembershipStatus2;
|
|
335
328
|
})(MembershipStatus || {});
|
|
336
|
-
var DEFAULT_BUSINESS_FUEL_SETTINGS = {
|
|
337
|
-
revenuePercent: null
|
|
338
|
-
};
|
|
339
329
|
var DEFAULT_BUSINESS_RIDER_PAY_SETTINGS = {
|
|
340
330
|
defaultPercentage: null,
|
|
341
331
|
periodType: null
|
|
@@ -363,7 +353,6 @@ var DEFAULT_BUSINESS_SETTINGS = {
|
|
|
363
353
|
tiktok: null,
|
|
364
354
|
website: null
|
|
365
355
|
},
|
|
366
|
-
fuel: DEFAULT_BUSINESS_FUEL_SETTINGS,
|
|
367
356
|
riderPay: DEFAULT_BUSINESS_RIDER_PAY_SETTINGS
|
|
368
357
|
};
|
|
369
358
|
var BusinessCourierLinkStatus = /* @__PURE__ */ ((BusinessCourierLinkStatus2) => {
|
|
@@ -420,13 +409,6 @@ var WhatsappTemplateParamSource = /* @__PURE__ */ ((WhatsappTemplateParamSource2
|
|
|
420
409
|
return WhatsappTemplateParamSource2;
|
|
421
410
|
})(WhatsappTemplateParamSource || {});
|
|
422
411
|
|
|
423
|
-
// src/portal.ts
|
|
424
|
-
var PortalStatus = /* @__PURE__ */ ((PortalStatus2) => {
|
|
425
|
-
PortalStatus2["Draft"] = "draft";
|
|
426
|
-
PortalStatus2["Published"] = "published";
|
|
427
|
-
return PortalStatus2;
|
|
428
|
-
})(PortalStatus || {});
|
|
429
|
-
|
|
430
412
|
// src/index.ts
|
|
431
413
|
var LinkDestination = /* @__PURE__ */ ((LinkDestination2) => {
|
|
432
414
|
LinkDestination2["Website"] = "web";
|
|
@@ -444,7 +426,6 @@ var LinkDestination = /* @__PURE__ */ ((LinkDestination2) => {
|
|
|
444
426
|
BusinessRole,
|
|
445
427
|
BusinessStatus,
|
|
446
428
|
BusinessType,
|
|
447
|
-
DEFAULT_BUSINESS_FUEL_SETTINGS,
|
|
448
429
|
DEFAULT_BUSINESS_RIDER_PAY_SETTINGS,
|
|
449
430
|
DEFAULT_BUSINESS_SETTINGS,
|
|
450
431
|
DeliveryStatus,
|
|
@@ -455,7 +436,6 @@ var LinkDestination = /* @__PURE__ */ ((LinkDestination2) => {
|
|
|
455
436
|
ErrandStatus,
|
|
456
437
|
FeePaymentStatus,
|
|
457
438
|
FeeSettlement,
|
|
458
|
-
FuelDueStatus,
|
|
459
439
|
GlobalRoles,
|
|
460
440
|
InvoiceEventType,
|
|
461
441
|
InvoiceGenerationType,
|
|
@@ -470,7 +450,6 @@ var LinkDestination = /* @__PURE__ */ ((LinkDestination2) => {
|
|
|
470
450
|
PaymentOptions,
|
|
471
451
|
PayoutPeriodType,
|
|
472
452
|
PayoutRateSource,
|
|
473
|
-
PortalStatus,
|
|
474
453
|
RemittanceStatus,
|
|
475
454
|
RiderPayoutStatus,
|
|
476
455
|
RoleType,
|
package/dist/index.d.cts
CHANGED
|
@@ -111,6 +111,8 @@ interface CustomerAddress {
|
|
|
111
111
|
coordinates: number[];
|
|
112
112
|
};
|
|
113
113
|
isDefault: boolean;
|
|
114
|
+
/** When an errand last went to or from this address. */
|
|
115
|
+
lastUsedAt?: string;
|
|
114
116
|
createdAt: string;
|
|
115
117
|
updatedAt: string;
|
|
116
118
|
}
|
|
@@ -200,6 +202,7 @@ declare enum InvoiceEventType {
|
|
|
200
202
|
PaymentReversed = "payment_reversed",
|
|
201
203
|
PaymentUpdated = "payment_updated",
|
|
202
204
|
StatusChanged = "status_changed",
|
|
205
|
+
ErrandSettlementChanged = "errand_settlement_changed",
|
|
203
206
|
Viewed = "viewed"
|
|
204
207
|
}
|
|
205
208
|
/** Why an errand in the period was not charged on the statement. */
|
|
@@ -218,6 +221,7 @@ interface InvoicePayment {
|
|
|
218
221
|
method?: InvoicePaymentMethod | `${InvoicePaymentMethod}`;
|
|
219
222
|
reference?: string;
|
|
220
223
|
note?: string;
|
|
224
|
+
errandId?: string;
|
|
221
225
|
recordedBy: string;
|
|
222
226
|
reversedAt?: string;
|
|
223
227
|
reversedBy?: string;
|
|
@@ -556,15 +560,6 @@ interface BusinessModules {
|
|
|
556
560
|
}
|
|
557
561
|
/** Every module key, so a plan map can be checked for completeness. */
|
|
558
562
|
type BusinessModuleKey = keyof BusinessModules;
|
|
559
|
-
/**
|
|
560
|
-
* How a business funds fuel. `revenuePercent` is the share of errand revenue a
|
|
561
|
-
* vehicle sets aside for its own fuel — the single knob behind the fuel-owed
|
|
562
|
-
* balance. `null` (the default) means the business hasn't configured it and the
|
|
563
|
-
* balance is not computed at all.
|
|
564
|
-
*/
|
|
565
|
-
interface BusinessFuelSettings {
|
|
566
|
-
revenuePercent: number | null;
|
|
567
|
-
}
|
|
568
563
|
/**
|
|
569
564
|
* How a business pays its riders. `defaultPercentage` is the share of the
|
|
570
565
|
* errand fees a rider earned that the rider takes home, used for every rider
|
|
@@ -599,10 +594,8 @@ interface BusinessSettings {
|
|
|
599
594
|
tiktok: string | null;
|
|
600
595
|
website: string | null;
|
|
601
596
|
};
|
|
602
|
-
fuel?: BusinessFuelSettings;
|
|
603
597
|
riderPay?: BusinessRiderPaySettings;
|
|
604
598
|
}
|
|
605
|
-
declare const DEFAULT_BUSINESS_FUEL_SETTINGS: BusinessFuelSettings;
|
|
606
599
|
declare const DEFAULT_BUSINESS_RIDER_PAY_SETTINGS: BusinessRiderPaySettings;
|
|
607
600
|
declare const DEFAULT_BUSINESS_SETTINGS: BusinessSettings;
|
|
608
601
|
interface BusinessMember {
|
|
@@ -737,95 +730,6 @@ interface VehiclePerformanceData {
|
|
|
737
730
|
totals: VehiclePerformanceTotals;
|
|
738
731
|
filters: VehiclePerformanceFilters;
|
|
739
732
|
}
|
|
740
|
-
declare enum FuelDueStatus {
|
|
741
|
-
/** Worked through the fuel it was last given. Fuel this one. */
|
|
742
|
-
Due = "DUE",
|
|
743
|
-
/** Still running on fuel already paid for. Leave it. */
|
|
744
|
-
Ok = "OK"
|
|
745
|
-
}
|
|
746
|
-
/** What the vehicle has done since the fuel it was last given. */
|
|
747
|
-
interface FuelSinceLastRefuel {
|
|
748
|
-
revenue: number;
|
|
749
|
-
errandCount: number;
|
|
750
|
-
fuelEarned: number;
|
|
751
|
-
}
|
|
752
|
-
interface FuelDueItem {
|
|
753
|
-
vehicleId: string;
|
|
754
|
-
vehicleNumber: string;
|
|
755
|
-
shortName: string | null;
|
|
756
|
-
vehicleType: VehicleType | `${VehicleType}`;
|
|
757
|
-
/**
|
|
758
|
-
* The fuel gauge, and the field to lead a UI with: how much of the fuel this
|
|
759
|
-
* vehicle was last given it has worked through. 0 is freshly filled, 100 is
|
|
760
|
-
* due, past 100 is overdue. Null when it has never been fuelled.
|
|
761
|
-
*/
|
|
762
|
-
fuelUsedPercent: number | null;
|
|
763
|
-
/** `fuelEarned - fuelSpent`, in naira — how much to give, not whether to. */
|
|
764
|
-
fuelDue: number;
|
|
765
|
-
fuelEarned: number;
|
|
766
|
-
fuelSpent: number;
|
|
767
|
-
revenue: number;
|
|
768
|
-
errandCount: number;
|
|
769
|
-
refuelCount: number;
|
|
770
|
-
/** What this vehicle is typically fuelled with; null if never fuelled. */
|
|
771
|
-
averageRefuelCost: number | null;
|
|
772
|
-
/**
|
|
773
|
-
* The figure has drifted far past what this vehicle is ever fuelled with —
|
|
774
|
-
* the signature of a wrong `revenuePercent` compounding rather than a real
|
|
775
|
-
* fuel need. Prompt to check the percentage instead of showing the figure.
|
|
776
|
-
*/
|
|
777
|
-
needsCalibration: boolean;
|
|
778
|
-
lastRefuel: {
|
|
779
|
-
at: string;
|
|
780
|
-
cost: number;
|
|
781
|
-
} | null;
|
|
782
|
-
sinceLastRefuel: FuelSinceLastRefuel | null;
|
|
783
|
-
dueStatus: FuelDueStatus | `${FuelDueStatus}`;
|
|
784
|
-
/** Counting starts here when the prediction has been reset; null otherwise. */
|
|
785
|
-
countingFrom: string | null;
|
|
786
|
-
}
|
|
787
|
-
interface FuelDueTotals {
|
|
788
|
-
totalDue: number;
|
|
789
|
-
totalEarned: number;
|
|
790
|
-
totalSpent: number;
|
|
791
|
-
vehiclesDue: number;
|
|
792
|
-
vehiclesNeedingCalibration: number;
|
|
793
|
-
}
|
|
794
|
-
interface FuelDueData {
|
|
795
|
-
/** False when the business has not set `settings.fuel.revenuePercent`. */
|
|
796
|
-
configured: boolean;
|
|
797
|
-
revenuePercent: number | null;
|
|
798
|
-
/** Only when `configured` is false: what history says the percent should be. */
|
|
799
|
-
suggestedPercent?: number | null;
|
|
800
|
-
vehicles: FuelDueItem[];
|
|
801
|
-
totals: FuelDueTotals;
|
|
802
|
-
}
|
|
803
|
-
type FuelSuggestionConfidence = 'low' | 'medium' | 'high';
|
|
804
|
-
interface FuelPercentSuggestion {
|
|
805
|
-
/**
|
|
806
|
-
* Fuel spend as a share of the revenue that earned it, to one decimal —
|
|
807
|
-
* the percentage this business has actually been running at. Null when
|
|
808
|
-
* there is too little history; `reason` says which.
|
|
809
|
-
*/
|
|
810
|
-
suggestedPercent: number | null;
|
|
811
|
-
/**
|
|
812
|
-
* Read off the number of refuels behind the suggestion, not the length of
|
|
813
|
-
* the window. Fuel bought near a window's edge is burnt outside it, so a
|
|
814
|
-
* thin refuel count gives a volatile ratio however many days were read.
|
|
815
|
-
*/
|
|
816
|
-
confidence: FuelSuggestionConfidence;
|
|
817
|
-
reason: string | null;
|
|
818
|
-
days: number;
|
|
819
|
-
basedOn: {
|
|
820
|
-
totalFuelCost: number;
|
|
821
|
-
totalRevenue: number;
|
|
822
|
-
refuelCount: number;
|
|
823
|
-
errandCount: number;
|
|
824
|
-
refuelledVehicles: number;
|
|
825
|
-
/** Refuels per vehicle — what says whether the ratio has settled. */
|
|
826
|
-
refuelsPerVehicle: number | null;
|
|
827
|
-
};
|
|
828
|
-
}
|
|
829
733
|
|
|
830
734
|
type Rider = {
|
|
831
735
|
id: string;
|
|
@@ -1108,7 +1012,6 @@ interface Errand {
|
|
|
1108
1012
|
aliasId: string;
|
|
1109
1013
|
updatedAt: Date;
|
|
1110
1014
|
createdAt: Date;
|
|
1111
|
-
errandRating?: string | ErrandRating;
|
|
1112
1015
|
additionalData?: string;
|
|
1113
1016
|
deliveryDate?: Date;
|
|
1114
1017
|
cityId?: City;
|
|
@@ -1201,17 +1104,6 @@ type PublicTrackedErrand = Pick<AggregatedErrand, 'aliasId' | 'deliveryStatus' |
|
|
|
1201
1104
|
cityName?: string;
|
|
1202
1105
|
};
|
|
1203
1106
|
};
|
|
1204
|
-
interface ErrandRating {
|
|
1205
|
-
createdAt: string;
|
|
1206
|
-
errandId: string;
|
|
1207
|
-
rating: number;
|
|
1208
|
-
ratingText: string;
|
|
1209
|
-
riderId: string;
|
|
1210
|
-
updatedAt: string;
|
|
1211
|
-
userId: string;
|
|
1212
|
-
version: number;
|
|
1213
|
-
_id: string;
|
|
1214
|
-
}
|
|
1215
1107
|
declare enum AddressTypes {
|
|
1216
1108
|
DeliveryAddress = "deliveryAddress",
|
|
1217
1109
|
PickupAddress = "pickupAddress"
|
|
@@ -1254,25 +1146,18 @@ type AddressDetails = {
|
|
|
1254
1146
|
cityId: string;
|
|
1255
1147
|
address: string;
|
|
1256
1148
|
fullName: string;
|
|
1257
|
-
|
|
1149
|
+
/** GeoJSON point, `[longitude, latitude]`. Absent when the stop has no coordinates. */
|
|
1150
|
+
location?: {
|
|
1151
|
+
type: 'Point';
|
|
1258
1152
|
coordinates: number[];
|
|
1259
1153
|
};
|
|
1260
1154
|
mobileNumber?: string;
|
|
1261
1155
|
alternateMobileNumber?: string;
|
|
1262
1156
|
landmark?: string;
|
|
1263
1157
|
addressId?: string;
|
|
1158
|
+
/** The saved customer this stop came from. */
|
|
1159
|
+
customerId?: string;
|
|
1264
1160
|
};
|
|
1265
|
-
interface ErrandReviewLink {
|
|
1266
|
-
id: string;
|
|
1267
|
-
errandId: string;
|
|
1268
|
-
phoneNumber: string;
|
|
1269
|
-
token: string;
|
|
1270
|
-
expiresAt: string;
|
|
1271
|
-
isUsed: boolean;
|
|
1272
|
-
usedAt: string;
|
|
1273
|
-
createdBy: string;
|
|
1274
|
-
createdAt: string;
|
|
1275
|
-
}
|
|
1276
1161
|
declare enum DraftErrandStatus {
|
|
1277
1162
|
Draft = "draft",
|
|
1278
1163
|
RiderCompleted = "rider_completed",
|
|
@@ -1304,23 +1189,6 @@ interface DraftErrand {
|
|
|
1304
1189
|
riderDetails?: Rider;
|
|
1305
1190
|
riderUserDetails?: User | null;
|
|
1306
1191
|
}
|
|
1307
|
-
type ErrandDeliveryTiming = 'early' | 'on_time' | 'late';
|
|
1308
|
-
type ErrandPackagingQuality = 'excellent' | 'average' | 'poor';
|
|
1309
|
-
type ErrandRiderBehavior = 'outstanding' | 'acceptable' | 'unsatisfactory';
|
|
1310
|
-
interface ErrandReview {
|
|
1311
|
-
id: string;
|
|
1312
|
-
errandId: string;
|
|
1313
|
-
riderId: string;
|
|
1314
|
-
reviewText: string;
|
|
1315
|
-
rating: number;
|
|
1316
|
-
deliveryTiming: ErrandDeliveryTiming;
|
|
1317
|
-
packagingQuality: ErrandPackagingQuality;
|
|
1318
|
-
riderBehavior: ErrandRiderBehavior;
|
|
1319
|
-
reviewerMobile: string;
|
|
1320
|
-
reviewerType: 'creator' | 'recipient';
|
|
1321
|
-
createdAt: string;
|
|
1322
|
-
updatedAt: string;
|
|
1323
|
-
}
|
|
1324
1192
|
|
|
1325
1193
|
declare enum NotificationType {
|
|
1326
1194
|
Errand = "errand",
|
|
@@ -1800,67 +1668,6 @@ interface WhatsappSendLog {
|
|
|
1800
1668
|
sentAt: string | Date;
|
|
1801
1669
|
}
|
|
1802
1670
|
|
|
1803
|
-
declare enum PortalStatus {
|
|
1804
|
-
Draft = "draft",
|
|
1805
|
-
Published = "published"
|
|
1806
|
-
}
|
|
1807
|
-
interface BusinessPortal {
|
|
1808
|
-
id: string;
|
|
1809
|
-
businessId: string;
|
|
1810
|
-
/** Compose the URL yourself, e.g. `https://mydoormot.io/b/${handle}`. */
|
|
1811
|
-
handle: string;
|
|
1812
|
-
previousHandles: string[];
|
|
1813
|
-
status: PortalStatus;
|
|
1814
|
-
publishedAt?: string;
|
|
1815
|
-
createdAt: string;
|
|
1816
|
-
updatedAt: string;
|
|
1817
|
-
}
|
|
1818
|
-
interface PublicPortalBusiness {
|
|
1819
|
-
name?: string;
|
|
1820
|
-
description?: string;
|
|
1821
|
-
officeNumber?: string;
|
|
1822
|
-
address?: string;
|
|
1823
|
-
logoUrl?: string;
|
|
1824
|
-
logoBlurHash?: string;
|
|
1825
|
-
coverImageUrl?: string;
|
|
1826
|
-
coverImageBlurHash?: string;
|
|
1827
|
-
isOnline?: boolean;
|
|
1828
|
-
openingHours?: Record<string, unknown>;
|
|
1829
|
-
socialLinks?: Record<string, unknown>;
|
|
1830
|
-
}
|
|
1831
|
-
/** `GET /api/v2/portals/:handle` — unauthenticated. */
|
|
1832
|
-
interface PublicPortal {
|
|
1833
|
-
handle: string;
|
|
1834
|
-
/** Set when the requested handle was retired — redirect to `handle`. */
|
|
1835
|
-
redirectedFrom?: string;
|
|
1836
|
-
business: PublicPortalBusiness;
|
|
1837
|
-
}
|
|
1838
|
-
/** `GET /api/v2/portals/handles/:handle` — unauthenticated. */
|
|
1839
|
-
interface PortalHandleAvailability {
|
|
1840
|
-
/** Normalised — what you would actually be assigned. */
|
|
1841
|
-
handle: string;
|
|
1842
|
-
available: boolean;
|
|
1843
|
-
reason?: string;
|
|
1844
|
-
}
|
|
1845
|
-
|
|
1846
|
-
/**
|
|
1847
|
-
* Platform-wide suggestions for businesses that haven't set their own values.
|
|
1848
|
-
* Prefill forms only — e.g. `business.settings.fuel?.revenuePercent ??
|
|
1849
|
-
* platform.fuel.revenuePercent`. Never applied to a business's calculations.
|
|
1850
|
-
*/
|
|
1851
|
-
interface PlatformSettings {
|
|
1852
|
-
fuel: {
|
|
1853
|
-
/** Current pump price per litre, for prefilling refuel logs. */
|
|
1854
|
-
pumpPrice: number | null;
|
|
1855
|
-
revenuePercent: number | null;
|
|
1856
|
-
};
|
|
1857
|
-
riderPay: {
|
|
1858
|
-
defaultPercentage: number | null;
|
|
1859
|
-
};
|
|
1860
|
-
createdAt: string;
|
|
1861
|
-
updatedAt: string;
|
|
1862
|
-
}
|
|
1863
|
-
|
|
1864
1671
|
/** GeoJSON Point. `coordinates` is `[longitude, latitude]`. */
|
|
1865
1672
|
type GeoPoint = {
|
|
1866
1673
|
type: 'Point';
|
|
@@ -1964,4 +1771,4 @@ declare enum LinkDestination {
|
|
|
1964
1771
|
}
|
|
1965
1772
|
type NullOrUndefined = null | undefined;
|
|
1966
1773
|
|
|
1967
|
-
export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -111,6 +111,8 @@ interface CustomerAddress {
|
|
|
111
111
|
coordinates: number[];
|
|
112
112
|
};
|
|
113
113
|
isDefault: boolean;
|
|
114
|
+
/** When an errand last went to or from this address. */
|
|
115
|
+
lastUsedAt?: string;
|
|
114
116
|
createdAt: string;
|
|
115
117
|
updatedAt: string;
|
|
116
118
|
}
|
|
@@ -200,6 +202,7 @@ declare enum InvoiceEventType {
|
|
|
200
202
|
PaymentReversed = "payment_reversed",
|
|
201
203
|
PaymentUpdated = "payment_updated",
|
|
202
204
|
StatusChanged = "status_changed",
|
|
205
|
+
ErrandSettlementChanged = "errand_settlement_changed",
|
|
203
206
|
Viewed = "viewed"
|
|
204
207
|
}
|
|
205
208
|
/** Why an errand in the period was not charged on the statement. */
|
|
@@ -218,6 +221,7 @@ interface InvoicePayment {
|
|
|
218
221
|
method?: InvoicePaymentMethod | `${InvoicePaymentMethod}`;
|
|
219
222
|
reference?: string;
|
|
220
223
|
note?: string;
|
|
224
|
+
errandId?: string;
|
|
221
225
|
recordedBy: string;
|
|
222
226
|
reversedAt?: string;
|
|
223
227
|
reversedBy?: string;
|
|
@@ -556,15 +560,6 @@ interface BusinessModules {
|
|
|
556
560
|
}
|
|
557
561
|
/** Every module key, so a plan map can be checked for completeness. */
|
|
558
562
|
type BusinessModuleKey = keyof BusinessModules;
|
|
559
|
-
/**
|
|
560
|
-
* How a business funds fuel. `revenuePercent` is the share of errand revenue a
|
|
561
|
-
* vehicle sets aside for its own fuel — the single knob behind the fuel-owed
|
|
562
|
-
* balance. `null` (the default) means the business hasn't configured it and the
|
|
563
|
-
* balance is not computed at all.
|
|
564
|
-
*/
|
|
565
|
-
interface BusinessFuelSettings {
|
|
566
|
-
revenuePercent: number | null;
|
|
567
|
-
}
|
|
568
563
|
/**
|
|
569
564
|
* How a business pays its riders. `defaultPercentage` is the share of the
|
|
570
565
|
* errand fees a rider earned that the rider takes home, used for every rider
|
|
@@ -599,10 +594,8 @@ interface BusinessSettings {
|
|
|
599
594
|
tiktok: string | null;
|
|
600
595
|
website: string | null;
|
|
601
596
|
};
|
|
602
|
-
fuel?: BusinessFuelSettings;
|
|
603
597
|
riderPay?: BusinessRiderPaySettings;
|
|
604
598
|
}
|
|
605
|
-
declare const DEFAULT_BUSINESS_FUEL_SETTINGS: BusinessFuelSettings;
|
|
606
599
|
declare const DEFAULT_BUSINESS_RIDER_PAY_SETTINGS: BusinessRiderPaySettings;
|
|
607
600
|
declare const DEFAULT_BUSINESS_SETTINGS: BusinessSettings;
|
|
608
601
|
interface BusinessMember {
|
|
@@ -737,95 +730,6 @@ interface VehiclePerformanceData {
|
|
|
737
730
|
totals: VehiclePerformanceTotals;
|
|
738
731
|
filters: VehiclePerformanceFilters;
|
|
739
732
|
}
|
|
740
|
-
declare enum FuelDueStatus {
|
|
741
|
-
/** Worked through the fuel it was last given. Fuel this one. */
|
|
742
|
-
Due = "DUE",
|
|
743
|
-
/** Still running on fuel already paid for. Leave it. */
|
|
744
|
-
Ok = "OK"
|
|
745
|
-
}
|
|
746
|
-
/** What the vehicle has done since the fuel it was last given. */
|
|
747
|
-
interface FuelSinceLastRefuel {
|
|
748
|
-
revenue: number;
|
|
749
|
-
errandCount: number;
|
|
750
|
-
fuelEarned: number;
|
|
751
|
-
}
|
|
752
|
-
interface FuelDueItem {
|
|
753
|
-
vehicleId: string;
|
|
754
|
-
vehicleNumber: string;
|
|
755
|
-
shortName: string | null;
|
|
756
|
-
vehicleType: VehicleType | `${VehicleType}`;
|
|
757
|
-
/**
|
|
758
|
-
* The fuel gauge, and the field to lead a UI with: how much of the fuel this
|
|
759
|
-
* vehicle was last given it has worked through. 0 is freshly filled, 100 is
|
|
760
|
-
* due, past 100 is overdue. Null when it has never been fuelled.
|
|
761
|
-
*/
|
|
762
|
-
fuelUsedPercent: number | null;
|
|
763
|
-
/** `fuelEarned - fuelSpent`, in naira — how much to give, not whether to. */
|
|
764
|
-
fuelDue: number;
|
|
765
|
-
fuelEarned: number;
|
|
766
|
-
fuelSpent: number;
|
|
767
|
-
revenue: number;
|
|
768
|
-
errandCount: number;
|
|
769
|
-
refuelCount: number;
|
|
770
|
-
/** What this vehicle is typically fuelled with; null if never fuelled. */
|
|
771
|
-
averageRefuelCost: number | null;
|
|
772
|
-
/**
|
|
773
|
-
* The figure has drifted far past what this vehicle is ever fuelled with —
|
|
774
|
-
* the signature of a wrong `revenuePercent` compounding rather than a real
|
|
775
|
-
* fuel need. Prompt to check the percentage instead of showing the figure.
|
|
776
|
-
*/
|
|
777
|
-
needsCalibration: boolean;
|
|
778
|
-
lastRefuel: {
|
|
779
|
-
at: string;
|
|
780
|
-
cost: number;
|
|
781
|
-
} | null;
|
|
782
|
-
sinceLastRefuel: FuelSinceLastRefuel | null;
|
|
783
|
-
dueStatus: FuelDueStatus | `${FuelDueStatus}`;
|
|
784
|
-
/** Counting starts here when the prediction has been reset; null otherwise. */
|
|
785
|
-
countingFrom: string | null;
|
|
786
|
-
}
|
|
787
|
-
interface FuelDueTotals {
|
|
788
|
-
totalDue: number;
|
|
789
|
-
totalEarned: number;
|
|
790
|
-
totalSpent: number;
|
|
791
|
-
vehiclesDue: number;
|
|
792
|
-
vehiclesNeedingCalibration: number;
|
|
793
|
-
}
|
|
794
|
-
interface FuelDueData {
|
|
795
|
-
/** False when the business has not set `settings.fuel.revenuePercent`. */
|
|
796
|
-
configured: boolean;
|
|
797
|
-
revenuePercent: number | null;
|
|
798
|
-
/** Only when `configured` is false: what history says the percent should be. */
|
|
799
|
-
suggestedPercent?: number | null;
|
|
800
|
-
vehicles: FuelDueItem[];
|
|
801
|
-
totals: FuelDueTotals;
|
|
802
|
-
}
|
|
803
|
-
type FuelSuggestionConfidence = 'low' | 'medium' | 'high';
|
|
804
|
-
interface FuelPercentSuggestion {
|
|
805
|
-
/**
|
|
806
|
-
* Fuel spend as a share of the revenue that earned it, to one decimal —
|
|
807
|
-
* the percentage this business has actually been running at. Null when
|
|
808
|
-
* there is too little history; `reason` says which.
|
|
809
|
-
*/
|
|
810
|
-
suggestedPercent: number | null;
|
|
811
|
-
/**
|
|
812
|
-
* Read off the number of refuels behind the suggestion, not the length of
|
|
813
|
-
* the window. Fuel bought near a window's edge is burnt outside it, so a
|
|
814
|
-
* thin refuel count gives a volatile ratio however many days were read.
|
|
815
|
-
*/
|
|
816
|
-
confidence: FuelSuggestionConfidence;
|
|
817
|
-
reason: string | null;
|
|
818
|
-
days: number;
|
|
819
|
-
basedOn: {
|
|
820
|
-
totalFuelCost: number;
|
|
821
|
-
totalRevenue: number;
|
|
822
|
-
refuelCount: number;
|
|
823
|
-
errandCount: number;
|
|
824
|
-
refuelledVehicles: number;
|
|
825
|
-
/** Refuels per vehicle — what says whether the ratio has settled. */
|
|
826
|
-
refuelsPerVehicle: number | null;
|
|
827
|
-
};
|
|
828
|
-
}
|
|
829
733
|
|
|
830
734
|
type Rider = {
|
|
831
735
|
id: string;
|
|
@@ -1108,7 +1012,6 @@ interface Errand {
|
|
|
1108
1012
|
aliasId: string;
|
|
1109
1013
|
updatedAt: Date;
|
|
1110
1014
|
createdAt: Date;
|
|
1111
|
-
errandRating?: string | ErrandRating;
|
|
1112
1015
|
additionalData?: string;
|
|
1113
1016
|
deliveryDate?: Date;
|
|
1114
1017
|
cityId?: City;
|
|
@@ -1201,17 +1104,6 @@ type PublicTrackedErrand = Pick<AggregatedErrand, 'aliasId' | 'deliveryStatus' |
|
|
|
1201
1104
|
cityName?: string;
|
|
1202
1105
|
};
|
|
1203
1106
|
};
|
|
1204
|
-
interface ErrandRating {
|
|
1205
|
-
createdAt: string;
|
|
1206
|
-
errandId: string;
|
|
1207
|
-
rating: number;
|
|
1208
|
-
ratingText: string;
|
|
1209
|
-
riderId: string;
|
|
1210
|
-
updatedAt: string;
|
|
1211
|
-
userId: string;
|
|
1212
|
-
version: number;
|
|
1213
|
-
_id: string;
|
|
1214
|
-
}
|
|
1215
1107
|
declare enum AddressTypes {
|
|
1216
1108
|
DeliveryAddress = "deliveryAddress",
|
|
1217
1109
|
PickupAddress = "pickupAddress"
|
|
@@ -1254,25 +1146,18 @@ type AddressDetails = {
|
|
|
1254
1146
|
cityId: string;
|
|
1255
1147
|
address: string;
|
|
1256
1148
|
fullName: string;
|
|
1257
|
-
|
|
1149
|
+
/** GeoJSON point, `[longitude, latitude]`. Absent when the stop has no coordinates. */
|
|
1150
|
+
location?: {
|
|
1151
|
+
type: 'Point';
|
|
1258
1152
|
coordinates: number[];
|
|
1259
1153
|
};
|
|
1260
1154
|
mobileNumber?: string;
|
|
1261
1155
|
alternateMobileNumber?: string;
|
|
1262
1156
|
landmark?: string;
|
|
1263
1157
|
addressId?: string;
|
|
1158
|
+
/** The saved customer this stop came from. */
|
|
1159
|
+
customerId?: string;
|
|
1264
1160
|
};
|
|
1265
|
-
interface ErrandReviewLink {
|
|
1266
|
-
id: string;
|
|
1267
|
-
errandId: string;
|
|
1268
|
-
phoneNumber: string;
|
|
1269
|
-
token: string;
|
|
1270
|
-
expiresAt: string;
|
|
1271
|
-
isUsed: boolean;
|
|
1272
|
-
usedAt: string;
|
|
1273
|
-
createdBy: string;
|
|
1274
|
-
createdAt: string;
|
|
1275
|
-
}
|
|
1276
1161
|
declare enum DraftErrandStatus {
|
|
1277
1162
|
Draft = "draft",
|
|
1278
1163
|
RiderCompleted = "rider_completed",
|
|
@@ -1304,23 +1189,6 @@ interface DraftErrand {
|
|
|
1304
1189
|
riderDetails?: Rider;
|
|
1305
1190
|
riderUserDetails?: User | null;
|
|
1306
1191
|
}
|
|
1307
|
-
type ErrandDeliveryTiming = 'early' | 'on_time' | 'late';
|
|
1308
|
-
type ErrandPackagingQuality = 'excellent' | 'average' | 'poor';
|
|
1309
|
-
type ErrandRiderBehavior = 'outstanding' | 'acceptable' | 'unsatisfactory';
|
|
1310
|
-
interface ErrandReview {
|
|
1311
|
-
id: string;
|
|
1312
|
-
errandId: string;
|
|
1313
|
-
riderId: string;
|
|
1314
|
-
reviewText: string;
|
|
1315
|
-
rating: number;
|
|
1316
|
-
deliveryTiming: ErrandDeliveryTiming;
|
|
1317
|
-
packagingQuality: ErrandPackagingQuality;
|
|
1318
|
-
riderBehavior: ErrandRiderBehavior;
|
|
1319
|
-
reviewerMobile: string;
|
|
1320
|
-
reviewerType: 'creator' | 'recipient';
|
|
1321
|
-
createdAt: string;
|
|
1322
|
-
updatedAt: string;
|
|
1323
|
-
}
|
|
1324
1192
|
|
|
1325
1193
|
declare enum NotificationType {
|
|
1326
1194
|
Errand = "errand",
|
|
@@ -1800,67 +1668,6 @@ interface WhatsappSendLog {
|
|
|
1800
1668
|
sentAt: string | Date;
|
|
1801
1669
|
}
|
|
1802
1670
|
|
|
1803
|
-
declare enum PortalStatus {
|
|
1804
|
-
Draft = "draft",
|
|
1805
|
-
Published = "published"
|
|
1806
|
-
}
|
|
1807
|
-
interface BusinessPortal {
|
|
1808
|
-
id: string;
|
|
1809
|
-
businessId: string;
|
|
1810
|
-
/** Compose the URL yourself, e.g. `https://mydoormot.io/b/${handle}`. */
|
|
1811
|
-
handle: string;
|
|
1812
|
-
previousHandles: string[];
|
|
1813
|
-
status: PortalStatus;
|
|
1814
|
-
publishedAt?: string;
|
|
1815
|
-
createdAt: string;
|
|
1816
|
-
updatedAt: string;
|
|
1817
|
-
}
|
|
1818
|
-
interface PublicPortalBusiness {
|
|
1819
|
-
name?: string;
|
|
1820
|
-
description?: string;
|
|
1821
|
-
officeNumber?: string;
|
|
1822
|
-
address?: string;
|
|
1823
|
-
logoUrl?: string;
|
|
1824
|
-
logoBlurHash?: string;
|
|
1825
|
-
coverImageUrl?: string;
|
|
1826
|
-
coverImageBlurHash?: string;
|
|
1827
|
-
isOnline?: boolean;
|
|
1828
|
-
openingHours?: Record<string, unknown>;
|
|
1829
|
-
socialLinks?: Record<string, unknown>;
|
|
1830
|
-
}
|
|
1831
|
-
/** `GET /api/v2/portals/:handle` — unauthenticated. */
|
|
1832
|
-
interface PublicPortal {
|
|
1833
|
-
handle: string;
|
|
1834
|
-
/** Set when the requested handle was retired — redirect to `handle`. */
|
|
1835
|
-
redirectedFrom?: string;
|
|
1836
|
-
business: PublicPortalBusiness;
|
|
1837
|
-
}
|
|
1838
|
-
/** `GET /api/v2/portals/handles/:handle` — unauthenticated. */
|
|
1839
|
-
interface PortalHandleAvailability {
|
|
1840
|
-
/** Normalised — what you would actually be assigned. */
|
|
1841
|
-
handle: string;
|
|
1842
|
-
available: boolean;
|
|
1843
|
-
reason?: string;
|
|
1844
|
-
}
|
|
1845
|
-
|
|
1846
|
-
/**
|
|
1847
|
-
* Platform-wide suggestions for businesses that haven't set their own values.
|
|
1848
|
-
* Prefill forms only — e.g. `business.settings.fuel?.revenuePercent ??
|
|
1849
|
-
* platform.fuel.revenuePercent`. Never applied to a business's calculations.
|
|
1850
|
-
*/
|
|
1851
|
-
interface PlatformSettings {
|
|
1852
|
-
fuel: {
|
|
1853
|
-
/** Current pump price per litre, for prefilling refuel logs. */
|
|
1854
|
-
pumpPrice: number | null;
|
|
1855
|
-
revenuePercent: number | null;
|
|
1856
|
-
};
|
|
1857
|
-
riderPay: {
|
|
1858
|
-
defaultPercentage: number | null;
|
|
1859
|
-
};
|
|
1860
|
-
createdAt: string;
|
|
1861
|
-
updatedAt: string;
|
|
1862
|
-
}
|
|
1863
|
-
|
|
1864
1671
|
/** GeoJSON Point. `coordinates` is `[longitude, latitude]`. */
|
|
1865
1672
|
type GeoPoint = {
|
|
1866
1673
|
type: 'Point';
|
|
@@ -1964,4 +1771,4 @@ declare enum LinkDestination {
|
|
|
1964
1771
|
}
|
|
1965
1772
|
type NullOrUndefined = null | undefined;
|
|
1966
1773
|
|
|
1967
|
-
export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -146,6 +146,7 @@ var InvoiceEventType = /* @__PURE__ */ ((InvoiceEventType2) => {
|
|
|
146
146
|
InvoiceEventType2["PaymentReversed"] = "payment_reversed";
|
|
147
147
|
InvoiceEventType2["PaymentUpdated"] = "payment_updated";
|
|
148
148
|
InvoiceEventType2["StatusChanged"] = "status_changed";
|
|
149
|
+
InvoiceEventType2["ErrandSettlementChanged"] = "errand_settlement_changed";
|
|
149
150
|
InvoiceEventType2["Viewed"] = "viewed";
|
|
150
151
|
return InvoiceEventType2;
|
|
151
152
|
})(InvoiceEventType || {});
|
|
@@ -176,11 +177,6 @@ var VehicleLogType = /* @__PURE__ */ ((VehicleLogType2) => {
|
|
|
176
177
|
VehicleLogType2["REFUEL"] = "REFUEL";
|
|
177
178
|
return VehicleLogType2;
|
|
178
179
|
})(VehicleLogType || {});
|
|
179
|
-
var FuelDueStatus = /* @__PURE__ */ ((FuelDueStatus2) => {
|
|
180
|
-
FuelDueStatus2["Due"] = "DUE";
|
|
181
|
-
FuelDueStatus2["Ok"] = "OK";
|
|
182
|
-
return FuelDueStatus2;
|
|
183
|
-
})(FuelDueStatus || {});
|
|
184
180
|
|
|
185
181
|
// src/rider.ts
|
|
186
182
|
var RemittanceStatus = /* @__PURE__ */ ((RemittanceStatus2) => {
|
|
@@ -260,9 +256,6 @@ var MembershipStatus = /* @__PURE__ */ ((MembershipStatus2) => {
|
|
|
260
256
|
MembershipStatus2["DISABLED"] = "DISABLED";
|
|
261
257
|
return MembershipStatus2;
|
|
262
258
|
})(MembershipStatus || {});
|
|
263
|
-
var DEFAULT_BUSINESS_FUEL_SETTINGS = {
|
|
264
|
-
revenuePercent: null
|
|
265
|
-
};
|
|
266
259
|
var DEFAULT_BUSINESS_RIDER_PAY_SETTINGS = {
|
|
267
260
|
defaultPercentage: null,
|
|
268
261
|
periodType: null
|
|
@@ -290,7 +283,6 @@ var DEFAULT_BUSINESS_SETTINGS = {
|
|
|
290
283
|
tiktok: null,
|
|
291
284
|
website: null
|
|
292
285
|
},
|
|
293
|
-
fuel: DEFAULT_BUSINESS_FUEL_SETTINGS,
|
|
294
286
|
riderPay: DEFAULT_BUSINESS_RIDER_PAY_SETTINGS
|
|
295
287
|
};
|
|
296
288
|
var BusinessCourierLinkStatus = /* @__PURE__ */ ((BusinessCourierLinkStatus2) => {
|
|
@@ -347,13 +339,6 @@ var WhatsappTemplateParamSource = /* @__PURE__ */ ((WhatsappTemplateParamSource2
|
|
|
347
339
|
return WhatsappTemplateParamSource2;
|
|
348
340
|
})(WhatsappTemplateParamSource || {});
|
|
349
341
|
|
|
350
|
-
// src/portal.ts
|
|
351
|
-
var PortalStatus = /* @__PURE__ */ ((PortalStatus2) => {
|
|
352
|
-
PortalStatus2["Draft"] = "draft";
|
|
353
|
-
PortalStatus2["Published"] = "published";
|
|
354
|
-
return PortalStatus2;
|
|
355
|
-
})(PortalStatus || {});
|
|
356
|
-
|
|
357
342
|
// src/index.ts
|
|
358
343
|
var LinkDestination = /* @__PURE__ */ ((LinkDestination2) => {
|
|
359
344
|
LinkDestination2["Website"] = "web";
|
|
@@ -370,7 +355,6 @@ export {
|
|
|
370
355
|
BusinessRole,
|
|
371
356
|
BusinessStatus,
|
|
372
357
|
BusinessType,
|
|
373
|
-
DEFAULT_BUSINESS_FUEL_SETTINGS,
|
|
374
358
|
DEFAULT_BUSINESS_RIDER_PAY_SETTINGS,
|
|
375
359
|
DEFAULT_BUSINESS_SETTINGS,
|
|
376
360
|
DeliveryStatus,
|
|
@@ -381,7 +365,6 @@ export {
|
|
|
381
365
|
ErrandStatus,
|
|
382
366
|
FeePaymentStatus,
|
|
383
367
|
FeeSettlement,
|
|
384
|
-
FuelDueStatus,
|
|
385
368
|
GlobalRoles,
|
|
386
369
|
InvoiceEventType,
|
|
387
370
|
InvoiceGenerationType,
|
|
@@ -396,7 +379,6 @@ export {
|
|
|
396
379
|
PaymentOptions,
|
|
397
380
|
PayoutPeriodType,
|
|
398
381
|
PayoutRateSource,
|
|
399
|
-
PortalStatus,
|
|
400
382
|
RemittanceStatus,
|
|
401
383
|
RiderPayoutStatus,
|
|
402
384
|
RoleType,
|
package/package.json
CHANGED
package/src/business.ts
CHANGED
|
@@ -279,16 +279,6 @@ export interface BusinessModules {
|
|
|
279
279
|
/** Every module key, so a plan map can be checked for completeness. */
|
|
280
280
|
export type BusinessModuleKey = keyof BusinessModules;
|
|
281
281
|
|
|
282
|
-
/**
|
|
283
|
-
* How a business funds fuel. `revenuePercent` is the share of errand revenue a
|
|
284
|
-
* vehicle sets aside for its own fuel — the single knob behind the fuel-owed
|
|
285
|
-
* balance. `null` (the default) means the business hasn't configured it and the
|
|
286
|
-
* balance is not computed at all.
|
|
287
|
-
*/
|
|
288
|
-
export interface BusinessFuelSettings {
|
|
289
|
-
revenuePercent: number | null;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
282
|
/**
|
|
293
283
|
* How a business pays its riders. `defaultPercentage` is the share of the
|
|
294
284
|
* errand fees a rider earned that the rider takes home, used for every rider
|
|
@@ -324,14 +314,9 @@ export interface BusinessSettings {
|
|
|
324
314
|
tiktok: string | null;
|
|
325
315
|
website: string | null;
|
|
326
316
|
};
|
|
327
|
-
fuel?: BusinessFuelSettings;
|
|
328
317
|
riderPay?: BusinessRiderPaySettings;
|
|
329
318
|
}
|
|
330
319
|
|
|
331
|
-
export const DEFAULT_BUSINESS_FUEL_SETTINGS: BusinessFuelSettings = {
|
|
332
|
-
revenuePercent: null,
|
|
333
|
-
};
|
|
334
|
-
|
|
335
320
|
export const DEFAULT_BUSINESS_RIDER_PAY_SETTINGS: BusinessRiderPaySettings = {
|
|
336
321
|
defaultPercentage: null,
|
|
337
322
|
periodType: null,
|
|
@@ -360,7 +345,6 @@ export const DEFAULT_BUSINESS_SETTINGS: BusinessSettings = {
|
|
|
360
345
|
tiktok: null,
|
|
361
346
|
website: null,
|
|
362
347
|
},
|
|
363
|
-
fuel: DEFAULT_BUSINESS_FUEL_SETTINGS,
|
|
364
348
|
riderPay: DEFAULT_BUSINESS_RIDER_PAY_SETTINGS,
|
|
365
349
|
};
|
|
366
350
|
|
package/src/customer.ts
CHANGED
package/src/errand.ts
CHANGED
|
@@ -177,7 +177,6 @@ export interface Errand {
|
|
|
177
177
|
aliasId: string;
|
|
178
178
|
updatedAt: Date;
|
|
179
179
|
createdAt: Date;
|
|
180
|
-
errandRating?: string | ErrandRating;
|
|
181
180
|
additionalData?: string;
|
|
182
181
|
deliveryDate?: Date;
|
|
183
182
|
cityId?: City;
|
|
@@ -300,18 +299,6 @@ export interface ErrandTimeline {
|
|
|
300
299
|
createdAt: Date;
|
|
301
300
|
}
|
|
302
301
|
|
|
303
|
-
export interface ErrandRating {
|
|
304
|
-
createdAt: string;
|
|
305
|
-
errandId: string;
|
|
306
|
-
rating: number;
|
|
307
|
-
ratingText: string;
|
|
308
|
-
riderId: string;
|
|
309
|
-
updatedAt: string;
|
|
310
|
-
userId: string;
|
|
311
|
-
version: number;
|
|
312
|
-
_id: string;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
302
|
export enum AddressTypes {
|
|
316
303
|
DeliveryAddress = 'deliveryAddress',
|
|
317
304
|
PickupAddress = 'pickupAddress',
|
|
@@ -343,27 +330,19 @@ export type AddressDetails = {
|
|
|
343
330
|
cityId: string;
|
|
344
331
|
address: string;
|
|
345
332
|
fullName: string;
|
|
346
|
-
|
|
333
|
+
/** GeoJSON point, `[longitude, latitude]`. Absent when the stop has no coordinates. */
|
|
334
|
+
location?: {
|
|
335
|
+
type: 'Point';
|
|
347
336
|
coordinates: number[];
|
|
348
337
|
};
|
|
349
338
|
mobileNumber?: string;
|
|
350
339
|
alternateMobileNumber?: string;
|
|
351
340
|
landmark?: string;
|
|
352
341
|
addressId?: string;
|
|
342
|
+
/** The saved customer this stop came from. */
|
|
343
|
+
customerId?: string;
|
|
353
344
|
};
|
|
354
345
|
|
|
355
|
-
export interface ErrandReviewLink {
|
|
356
|
-
id: string;
|
|
357
|
-
errandId: string;
|
|
358
|
-
phoneNumber: string;
|
|
359
|
-
token: string;
|
|
360
|
-
expiresAt: string;
|
|
361
|
-
isUsed: boolean;
|
|
362
|
-
usedAt: string;
|
|
363
|
-
createdBy: string;
|
|
364
|
-
createdAt: string;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
346
|
export enum DraftErrandStatus {
|
|
368
347
|
Draft = 'draft',
|
|
369
348
|
RiderCompleted = 'rider_completed',
|
|
@@ -406,24 +385,3 @@ export interface DraftErrand {
|
|
|
406
385
|
riderUserDetails?: User | null;
|
|
407
386
|
}
|
|
408
387
|
|
|
409
|
-
export type ErrandDeliveryTiming = 'early' | 'on_time' | 'late';
|
|
410
|
-
export type ErrandPackagingQuality = 'excellent' | 'average' | 'poor';
|
|
411
|
-
export type ErrandRiderBehavior =
|
|
412
|
-
| 'outstanding'
|
|
413
|
-
| 'acceptable'
|
|
414
|
-
| 'unsatisfactory';
|
|
415
|
-
|
|
416
|
-
export interface ErrandReview {
|
|
417
|
-
id: string;
|
|
418
|
-
errandId: string;
|
|
419
|
-
riderId: string;
|
|
420
|
-
reviewText: string;
|
|
421
|
-
rating: number;
|
|
422
|
-
deliveryTiming: ErrandDeliveryTiming;
|
|
423
|
-
packagingQuality: ErrandPackagingQuality;
|
|
424
|
-
riderBehavior: ErrandRiderBehavior;
|
|
425
|
-
reviewerMobile: string;
|
|
426
|
-
reviewerType: 'creator' | 'recipient';
|
|
427
|
-
createdAt: string;
|
|
428
|
-
updatedAt: string;
|
|
429
|
-
}
|
package/src/index.ts
CHANGED
package/src/invoice.ts
CHANGED
|
@@ -44,6 +44,7 @@ export enum InvoiceEventType {
|
|
|
44
44
|
PaymentReversed = 'payment_reversed',
|
|
45
45
|
PaymentUpdated = 'payment_updated',
|
|
46
46
|
StatusChanged = 'status_changed',
|
|
47
|
+
ErrandSettlementChanged = 'errand_settlement_changed',
|
|
47
48
|
Viewed = 'viewed',
|
|
48
49
|
}
|
|
49
50
|
|
|
@@ -64,6 +65,7 @@ export interface InvoicePayment {
|
|
|
64
65
|
method?: InvoicePaymentMethod | `${InvoicePaymentMethod}`;
|
|
65
66
|
reference?: string;
|
|
66
67
|
note?: string;
|
|
68
|
+
errandId?: string;
|
|
67
69
|
recordedBy: string;
|
|
68
70
|
reversedAt?: string;
|
|
69
71
|
reversedBy?: string;
|
package/src/vehicle.ts
CHANGED
|
@@ -109,103 +109,3 @@ export interface VehiclePerformanceData {
|
|
|
109
109
|
filters: VehiclePerformanceFilters;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
// Fuel Due Types
|
|
113
|
-
//
|
|
114
|
-
// These answer "which vehicles are due for fuel" without anyone counting
|
|
115
|
-
// errands by hand. Errands generate fuel money at the business's
|
|
116
|
-
// `settings.fuel.revenuePercent`; logged refuels spend it. The difference is
|
|
117
|
-
// `fuelDue`, and `fuelUsedPercent` reads it back as a fuel gauge — 0 freshly
|
|
118
|
-
// filled, 100 due, beyond that overdue.
|
|
119
|
-
|
|
120
|
-
export enum FuelDueStatus {
|
|
121
|
-
/** Worked through the fuel it was last given. Fuel this one. */
|
|
122
|
-
Due = 'DUE',
|
|
123
|
-
/** Still running on fuel already paid for. Leave it. */
|
|
124
|
-
Ok = 'OK',
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/** What the vehicle has done since the fuel it was last given. */
|
|
128
|
-
export interface FuelSinceLastRefuel {
|
|
129
|
-
revenue: number;
|
|
130
|
-
errandCount: number;
|
|
131
|
-
fuelEarned: number;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export interface FuelDueItem {
|
|
135
|
-
vehicleId: string;
|
|
136
|
-
vehicleNumber: string;
|
|
137
|
-
shortName: string | null;
|
|
138
|
-
vehicleType: VehicleType | `${VehicleType}`;
|
|
139
|
-
/**
|
|
140
|
-
* The fuel gauge, and the field to lead a UI with: how much of the fuel this
|
|
141
|
-
* vehicle was last given it has worked through. 0 is freshly filled, 100 is
|
|
142
|
-
* due, past 100 is overdue. Null when it has never been fuelled.
|
|
143
|
-
*/
|
|
144
|
-
fuelUsedPercent: number | null;
|
|
145
|
-
/** `fuelEarned - fuelSpent`, in naira — how much to give, not whether to. */
|
|
146
|
-
fuelDue: number;
|
|
147
|
-
fuelEarned: number;
|
|
148
|
-
fuelSpent: number;
|
|
149
|
-
revenue: number;
|
|
150
|
-
errandCount: number;
|
|
151
|
-
refuelCount: number;
|
|
152
|
-
/** What this vehicle is typically fuelled with; null if never fuelled. */
|
|
153
|
-
averageRefuelCost: number | null;
|
|
154
|
-
/**
|
|
155
|
-
* The figure has drifted far past what this vehicle is ever fuelled with —
|
|
156
|
-
* the signature of a wrong `revenuePercent` compounding rather than a real
|
|
157
|
-
* fuel need. Prompt to check the percentage instead of showing the figure.
|
|
158
|
-
*/
|
|
159
|
-
needsCalibration: boolean;
|
|
160
|
-
lastRefuel: { at: string; cost: number } | null;
|
|
161
|
-
sinceLastRefuel: FuelSinceLastRefuel | null;
|
|
162
|
-
dueStatus: FuelDueStatus | `${FuelDueStatus}`;
|
|
163
|
-
/** Counting starts here when the prediction has been reset; null otherwise. */
|
|
164
|
-
countingFrom: string | null;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export interface FuelDueTotals {
|
|
168
|
-
totalDue: number;
|
|
169
|
-
totalEarned: number;
|
|
170
|
-
totalSpent: number;
|
|
171
|
-
vehiclesDue: number;
|
|
172
|
-
vehiclesNeedingCalibration: number;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export interface FuelDueData {
|
|
176
|
-
/** False when the business has not set `settings.fuel.revenuePercent`. */
|
|
177
|
-
configured: boolean;
|
|
178
|
-
revenuePercent: number | null;
|
|
179
|
-
/** Only when `configured` is false: what history says the percent should be. */
|
|
180
|
-
suggestedPercent?: number | null;
|
|
181
|
-
vehicles: FuelDueItem[];
|
|
182
|
-
totals: FuelDueTotals;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
export type FuelSuggestionConfidence = 'low' | 'medium' | 'high';
|
|
186
|
-
|
|
187
|
-
export interface FuelPercentSuggestion {
|
|
188
|
-
/**
|
|
189
|
-
* Fuel spend as a share of the revenue that earned it, to one decimal —
|
|
190
|
-
* the percentage this business has actually been running at. Null when
|
|
191
|
-
* there is too little history; `reason` says which.
|
|
192
|
-
*/
|
|
193
|
-
suggestedPercent: number | null;
|
|
194
|
-
/**
|
|
195
|
-
* Read off the number of refuels behind the suggestion, not the length of
|
|
196
|
-
* the window. Fuel bought near a window's edge is burnt outside it, so a
|
|
197
|
-
* thin refuel count gives a volatile ratio however many days were read.
|
|
198
|
-
*/
|
|
199
|
-
confidence: FuelSuggestionConfidence;
|
|
200
|
-
reason: string | null;
|
|
201
|
-
days: number;
|
|
202
|
-
basedOn: {
|
|
203
|
-
totalFuelCost: number;
|
|
204
|
-
totalRevenue: number;
|
|
205
|
-
refuelCount: number;
|
|
206
|
-
errandCount: number;
|
|
207
|
-
refuelledVehicles: number;
|
|
208
|
-
/** Refuels per vehicle — what says whether the ratio has settled. */
|
|
209
|
-
refuelsPerVehicle: number | null;
|
|
210
|
-
};
|
|
211
|
-
}
|
package/src/platform.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Platform-wide suggestions for businesses that haven't set their own values.
|
|
3
|
-
* Prefill forms only — e.g. `business.settings.fuel?.revenuePercent ??
|
|
4
|
-
* platform.fuel.revenuePercent`. Never applied to a business's calculations.
|
|
5
|
-
*/
|
|
6
|
-
export interface PlatformSettings {
|
|
7
|
-
fuel: {
|
|
8
|
-
/** Current pump price per litre, for prefilling refuel logs. */
|
|
9
|
-
pumpPrice: number | null;
|
|
10
|
-
revenuePercent: number | null;
|
|
11
|
-
};
|
|
12
|
-
riderPay: {
|
|
13
|
-
defaultPercentage: number | null;
|
|
14
|
-
};
|
|
15
|
-
createdAt: string;
|
|
16
|
-
updatedAt: string;
|
|
17
|
-
}
|
package/src/portal.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export enum PortalStatus {
|
|
2
|
-
Draft = 'draft',
|
|
3
|
-
Published = 'published',
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export interface BusinessPortal {
|
|
7
|
-
id: string;
|
|
8
|
-
businessId: string;
|
|
9
|
-
/** Compose the URL yourself, e.g. `https://mydoormot.io/b/${handle}`. */
|
|
10
|
-
handle: string;
|
|
11
|
-
previousHandles: string[];
|
|
12
|
-
status: PortalStatus;
|
|
13
|
-
publishedAt?: string;
|
|
14
|
-
createdAt: string;
|
|
15
|
-
updatedAt: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface PublicPortalBusiness {
|
|
19
|
-
name?: string;
|
|
20
|
-
description?: string;
|
|
21
|
-
officeNumber?: string;
|
|
22
|
-
address?: string;
|
|
23
|
-
logoUrl?: string;
|
|
24
|
-
logoBlurHash?: string;
|
|
25
|
-
coverImageUrl?: string;
|
|
26
|
-
coverImageBlurHash?: string;
|
|
27
|
-
isOnline?: boolean;
|
|
28
|
-
openingHours?: Record<string, unknown>;
|
|
29
|
-
socialLinks?: Record<string, unknown>;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/** `GET /api/v2/portals/:handle` — unauthenticated. */
|
|
33
|
-
export interface PublicPortal {
|
|
34
|
-
handle: string;
|
|
35
|
-
/** Set when the requested handle was retired — redirect to `handle`. */
|
|
36
|
-
redirectedFrom?: string;
|
|
37
|
-
business: PublicPortalBusiness;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** `GET /api/v2/portals/handles/:handle` — unauthenticated. */
|
|
41
|
-
export interface PortalHandleAvailability {
|
|
42
|
-
/** Normalised — what you would actually be assigned. */
|
|
43
|
-
handle: string;
|
|
44
|
-
available: boolean;
|
|
45
|
-
reason?: string;
|
|
46
|
-
}
|