@mydoormot/app-types 1.7.41 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +12 -0
- package/dist/index.cjs +17 -17
- package/dist/index.d.cts +56 -83
- package/dist/index.d.ts +56 -83
- package/dist/index.js +15 -15
- package/package.json +1 -1
- package/src/errand.ts +44 -10
- package/src/index.ts +0 -2
- package/src/rider.ts +8 -8
- package/src/vehicle.ts +36 -0
- package/src/coupon.ts +0 -14
- package/src/tracker.ts +0 -59
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @mydoormot/app-types@1.7.
|
|
2
|
+
> @mydoormot/app-types@1.7.42 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 11.
|
|
12
|
-
ESM ⚡️ Build success in
|
|
13
|
-
CJS dist/index.cjs 13.
|
|
14
|
-
CJS ⚡️ Build success in
|
|
11
|
+
ESM dist/index.js 11.40 KB
|
|
12
|
+
ESM ⚡️ Build success in 56ms
|
|
13
|
+
CJS dist/index.cjs 13.82 KB
|
|
14
|
+
CJS ⚡️ Build success in 56ms
|
|
15
15
|
DTS Build start
|
|
16
|
-
DTS ⚡️ Build success in
|
|
17
|
-
DTS dist/index.d.ts 34.
|
|
18
|
-
DTS dist/index.d.cts 34.
|
|
16
|
+
DTS ⚡️ Build success in 669ms
|
|
17
|
+
DTS dist/index.d.ts 34.23 KB
|
|
18
|
+
DTS dist/index.d.cts 34.23 KB
|
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -32,6 +32,8 @@ __export(src_exports, {
|
|
|
32
32
|
DraftErrandStatus: () => DraftErrandStatus,
|
|
33
33
|
EnterpriseType: () => EnterpriseType,
|
|
34
34
|
ErrandStatus: () => ErrandStatus,
|
|
35
|
+
FeePaymentStatus: () => FeePaymentStatus,
|
|
36
|
+
FeeSettlement: () => FeeSettlement,
|
|
35
37
|
GlobalRoles: () => GlobalRoles,
|
|
36
38
|
InvoiceGenerationType: () => InvoiceGenerationType,
|
|
37
39
|
InvoiceItemType: () => InvoiceItemType,
|
|
@@ -43,8 +45,6 @@ __export(src_exports, {
|
|
|
43
45
|
PaymentOptions: () => PaymentOptions,
|
|
44
46
|
RemittanceStatus: () => RemittanceStatus,
|
|
45
47
|
RoleType: () => RoleType,
|
|
46
|
-
SettlementType: () => SettlementType,
|
|
47
|
-
TraccarDeviceStatus: () => TraccarDeviceStatus,
|
|
48
48
|
VehicleLogType: () => VehicleLogType,
|
|
49
49
|
VehicleType: () => VehicleType,
|
|
50
50
|
WhatsappButtonType: () => WhatsappButtonType,
|
|
@@ -124,6 +124,19 @@ var errandTimeline = [
|
|
|
124
124
|
description: "Your package has been delivered and the errand closed, please leave a review and a rating for the rider"
|
|
125
125
|
}
|
|
126
126
|
];
|
|
127
|
+
var FeePaymentStatus = /* @__PURE__ */ ((FeePaymentStatus2) => {
|
|
128
|
+
FeePaymentStatus2["Unpaid"] = "unpaid";
|
|
129
|
+
FeePaymentStatus2["Partial"] = "partial";
|
|
130
|
+
FeePaymentStatus2["Paid"] = "paid";
|
|
131
|
+
return FeePaymentStatus2;
|
|
132
|
+
})(FeePaymentStatus || {});
|
|
133
|
+
var FeeSettlement = /* @__PURE__ */ ((FeeSettlement2) => {
|
|
134
|
+
FeeSettlement2["CashOnDelivery"] = "cash_on_delivery";
|
|
135
|
+
FeeSettlement2["Prepaid"] = "prepaid";
|
|
136
|
+
FeeSettlement2["Invoice"] = "invoice";
|
|
137
|
+
FeeSettlement2["Owed"] = "owed";
|
|
138
|
+
return FeeSettlement2;
|
|
139
|
+
})(FeeSettlement || {});
|
|
127
140
|
var AddressTypes = /* @__PURE__ */ ((AddressTypes2) => {
|
|
128
141
|
AddressTypes2["DeliveryAddress"] = "deliveryAddress";
|
|
129
142
|
AddressTypes2["PickupAddress"] = "pickupAddress";
|
|
@@ -203,11 +216,6 @@ var RemittanceStatus = /* @__PURE__ */ ((RemittanceStatus2) => {
|
|
|
203
216
|
RemittanceStatus2["Cancelled"] = "cancelled";
|
|
204
217
|
return RemittanceStatus2;
|
|
205
218
|
})(RemittanceStatus || {});
|
|
206
|
-
var SettlementType = /* @__PURE__ */ ((SettlementType2) => {
|
|
207
|
-
SettlementType2["DeliveryFee"] = "delivery_fee";
|
|
208
|
-
SettlementType2["Additional"] = "additional";
|
|
209
|
-
return SettlementType2;
|
|
210
|
-
})(SettlementType || {});
|
|
211
219
|
|
|
212
220
|
// src/enterprise.ts
|
|
213
221
|
var EnterpriseType = /* @__PURE__ */ ((EnterpriseType2) => {
|
|
@@ -281,14 +289,6 @@ var BusinessCourierLinkStatus = /* @__PURE__ */ ((BusinessCourierLinkStatus2) =>
|
|
|
281
289
|
return BusinessCourierLinkStatus2;
|
|
282
290
|
})(BusinessCourierLinkStatus || {});
|
|
283
291
|
|
|
284
|
-
// src/tracker.ts
|
|
285
|
-
var TraccarDeviceStatus = /* @__PURE__ */ ((TraccarDeviceStatus2) => {
|
|
286
|
-
TraccarDeviceStatus2["ONLINE"] = "online";
|
|
287
|
-
TraccarDeviceStatus2["OFFLINE"] = "offline";
|
|
288
|
-
TraccarDeviceStatus2["UNKNOWN"] = "unknown";
|
|
289
|
-
return TraccarDeviceStatus2;
|
|
290
|
-
})(TraccarDeviceStatus || {});
|
|
291
|
-
|
|
292
292
|
// src/whatsapp.ts
|
|
293
293
|
var WhatsappEvent = /* @__PURE__ */ ((WhatsappEvent2) => {
|
|
294
294
|
WhatsappEvent2["ERRAND_CREATED"] = "errand.created";
|
|
@@ -357,6 +357,8 @@ var LinkDestination = /* @__PURE__ */ ((LinkDestination2) => {
|
|
|
357
357
|
DraftErrandStatus,
|
|
358
358
|
EnterpriseType,
|
|
359
359
|
ErrandStatus,
|
|
360
|
+
FeePaymentStatus,
|
|
361
|
+
FeeSettlement,
|
|
360
362
|
GlobalRoles,
|
|
361
363
|
InvoiceGenerationType,
|
|
362
364
|
InvoiceItemType,
|
|
@@ -368,8 +370,6 @@ var LinkDestination = /* @__PURE__ */ ((LinkDestination2) => {
|
|
|
368
370
|
PaymentOptions,
|
|
369
371
|
RemittanceStatus,
|
|
370
372
|
RoleType,
|
|
371
|
-
SettlementType,
|
|
372
|
-
TraccarDeviceStatus,
|
|
373
373
|
VehicleLogType,
|
|
374
374
|
VehicleType,
|
|
375
375
|
WhatsappButtonType,
|
package/dist/index.d.cts
CHANGED
|
@@ -93,21 +93,6 @@ type UserAddress = {
|
|
|
93
93
|
direction?: string;
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
-
interface Coupon {
|
|
97
|
-
id: string;
|
|
98
|
-
phoneNumber: string;
|
|
99
|
-
couponType: 'errand';
|
|
100
|
-
isUsed: boolean;
|
|
101
|
-
expiresAt: Date;
|
|
102
|
-
couponCode: string;
|
|
103
|
-
updatedAt: Date;
|
|
104
|
-
createdAt: Date;
|
|
105
|
-
hasExpired: boolean;
|
|
106
|
-
couponValue: number;
|
|
107
|
-
ref?: string;
|
|
108
|
-
fullName?: string;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
96
|
interface CustomerTransactionStats {
|
|
112
97
|
totalSaleCount: number;
|
|
113
98
|
totalSaleAmount: number;
|
|
@@ -332,6 +317,34 @@ declare enum VehicleType {
|
|
|
332
317
|
Bike = "bike",
|
|
333
318
|
Shuttle = "shuttle"
|
|
334
319
|
}
|
|
320
|
+
/** GeoJSON Point. `coordinates` is `[longitude, latitude]`. */
|
|
321
|
+
type GeoPoint = {
|
|
322
|
+
type: 'Point';
|
|
323
|
+
coordinates: [number, number];
|
|
324
|
+
};
|
|
325
|
+
/**
|
|
326
|
+
* A trimmed-down Traccar position kept as the vehicle's latest fix. Carries the
|
|
327
|
+
* scalar fields a GeoPoint can't — `speed`/`course` drive derived state
|
|
328
|
+
* (moving vs. idle, heading), `recordedAt` gauges staleness.
|
|
329
|
+
*/
|
|
330
|
+
type TrackerPosition = {
|
|
331
|
+
latitude: number;
|
|
332
|
+
longitude: number;
|
|
333
|
+
speed?: number;
|
|
334
|
+
course?: number;
|
|
335
|
+
accuracy?: number;
|
|
336
|
+
valid?: boolean;
|
|
337
|
+
/** Traccar's moving/stopped determination — steadier than speed alone. */
|
|
338
|
+
motion?: boolean;
|
|
339
|
+
/** Engine on/off, when the device reports it. */
|
|
340
|
+
ignition?: boolean;
|
|
341
|
+
/** ISO time the GPS computed the position — the truest "when". */
|
|
342
|
+
fixTime?: string;
|
|
343
|
+
/** ISO time from the device's own clock (drift/buffering signal). */
|
|
344
|
+
deviceTime?: string;
|
|
345
|
+
/** ISO time Traccar received the report — lags `fixTime` when buffered. */
|
|
346
|
+
serverTime?: string;
|
|
347
|
+
};
|
|
335
348
|
type Vehicle = {
|
|
336
349
|
id: string;
|
|
337
350
|
vehicleNumber: string;
|
|
@@ -342,6 +355,12 @@ type Vehicle = {
|
|
|
342
355
|
businessId: string;
|
|
343
356
|
shortName?: string;
|
|
344
357
|
userId?: string;
|
|
358
|
+
/** External GPS device uniqueId bound to this vehicle. */
|
|
359
|
+
trackerId?: string;
|
|
360
|
+
/** Latest known tracker position, as a GeoPoint for proximity queries. */
|
|
361
|
+
location?: GeoPoint;
|
|
362
|
+
/** Latest tracker fix with richer scalar fields (speed, course, …). */
|
|
363
|
+
position?: TrackerPosition;
|
|
345
364
|
};
|
|
346
365
|
type VehicleWithRider = Vehicle & {
|
|
347
366
|
riders: RiderWithUserDetails[];
|
|
@@ -443,10 +462,10 @@ interface RiderSettlement {
|
|
|
443
462
|
draftErrandId?: string;
|
|
444
463
|
riderId: string;
|
|
445
464
|
businessId: string;
|
|
446
|
-
deliveryFee: number;
|
|
447
|
-
additionalAmount: number;
|
|
448
465
|
totalCollectionAmount: number;
|
|
449
|
-
|
|
466
|
+
deliveryFee?: number;
|
|
467
|
+
additionalAmount?: number;
|
|
468
|
+
remittedAmount?: number;
|
|
450
469
|
remittanceStatus: RemittanceStatus | `${RemittanceStatus}`;
|
|
451
470
|
remittedAt?: Date;
|
|
452
471
|
remittedBy?: string;
|
|
@@ -477,10 +496,6 @@ interface RiderPerformanceStats {
|
|
|
477
496
|
riders: RiderPerformanceItem[];
|
|
478
497
|
timeSeries?: RiderPerformanceTimeSeries[];
|
|
479
498
|
}
|
|
480
|
-
declare enum SettlementType {
|
|
481
|
-
DeliveryFee = "delivery_fee",
|
|
482
|
-
Additional = "additional"
|
|
483
|
-
}
|
|
484
499
|
|
|
485
500
|
declare enum ErrandStatus {
|
|
486
501
|
Pending = "pending",
|
|
@@ -548,6 +563,18 @@ interface PendingErrand {
|
|
|
548
563
|
id: string;
|
|
549
564
|
ownerMobileNumber?: string;
|
|
550
565
|
}
|
|
566
|
+
declare enum FeePaymentStatus {
|
|
567
|
+
Unpaid = "unpaid",
|
|
568
|
+
Partial = "partial",
|
|
569
|
+
Paid = "paid"
|
|
570
|
+
}
|
|
571
|
+
declare enum FeeSettlement {
|
|
572
|
+
CashOnDelivery = "cash_on_delivery",
|
|
573
|
+
Prepaid = "prepaid",
|
|
574
|
+
Invoice = "invoice",
|
|
575
|
+
Owed = "owed"
|
|
576
|
+
}
|
|
577
|
+
type ExpensePaidBy = 'rider' | 'company' | 'customer';
|
|
551
578
|
interface Errand {
|
|
552
579
|
id: string;
|
|
553
580
|
nameOfItem: string;
|
|
@@ -566,13 +593,10 @@ interface Errand {
|
|
|
566
593
|
updatedAt: Date;
|
|
567
594
|
createdAt: Date;
|
|
568
595
|
errandRating?: string | ErrandRating;
|
|
569
|
-
payOnDeliveryAmount?: string;
|
|
570
596
|
additionalData?: string;
|
|
571
597
|
deliveryDate?: Date;
|
|
572
598
|
cityId?: City;
|
|
573
|
-
couponPrice?: number;
|
|
574
599
|
price: number;
|
|
575
|
-
coupon?: string | Coupon;
|
|
576
600
|
ownerMobileNumber?: string;
|
|
577
601
|
errandTimeline?: string | ErrandTimeline;
|
|
578
602
|
queuePosition?: number;
|
|
@@ -601,7 +625,6 @@ interface Errand {
|
|
|
601
625
|
isDelayed?: boolean;
|
|
602
626
|
delayedAt?: Date;
|
|
603
627
|
wasDeliveredBy?: 'rider' | 'admin' | 'system' | 'business';
|
|
604
|
-
paymentMethod?: 'cash_on_delivery' | 'prepaid_online' | 'prepaid_transfer' | 'business_invoice';
|
|
605
628
|
additionalFees?: Array<{
|
|
606
629
|
description: string;
|
|
607
630
|
amount: number;
|
|
@@ -610,6 +633,12 @@ interface Errand {
|
|
|
610
633
|
}>;
|
|
611
634
|
riderDetails?: Rider;
|
|
612
635
|
vehicleDetails?: Vehicle;
|
|
636
|
+
amountPaid?: number;
|
|
637
|
+
collections?: number;
|
|
638
|
+
feeSettlement?: `${FeeSettlement}`;
|
|
639
|
+
expenseAmount?: number;
|
|
640
|
+
expensePaidBy?: ExpensePaidBy;
|
|
641
|
+
feePaymentStatus?: `${FeePaymentStatus}`;
|
|
613
642
|
}
|
|
614
643
|
interface AggregatedErrand extends Errand {
|
|
615
644
|
parcelSize: `${ParcelSize}`;
|
|
@@ -729,7 +758,6 @@ interface DraftErrand {
|
|
|
729
758
|
deliveryDetails?: AddressDetails;
|
|
730
759
|
additionalData?: string;
|
|
731
760
|
parcelSize?: `${ParcelSize}`;
|
|
732
|
-
payOnDeliveryAmount?: number;
|
|
733
761
|
status: DraftErrandStatus;
|
|
734
762
|
convertedErrandId?: string;
|
|
735
763
|
settlementId?: string;
|
|
@@ -1058,61 +1086,6 @@ interface VehicleLogStatsSummary {
|
|
|
1058
1086
|
}[];
|
|
1059
1087
|
}
|
|
1060
1088
|
|
|
1061
|
-
declare enum TraccarDeviceStatus {
|
|
1062
|
-
ONLINE = "online",
|
|
1063
|
-
OFFLINE = "offline",
|
|
1064
|
-
UNKNOWN = "unknown"
|
|
1065
|
-
}
|
|
1066
|
-
interface TraccarDevice {
|
|
1067
|
-
id: number;
|
|
1068
|
-
attributes: Record<string, any>;
|
|
1069
|
-
groupId: number;
|
|
1070
|
-
calendarId: number;
|
|
1071
|
-
name: string;
|
|
1072
|
-
uniqueId: string;
|
|
1073
|
-
status: TraccarDeviceStatus | `${TraccarDeviceStatus}`;
|
|
1074
|
-
lastUpdate: string | Date;
|
|
1075
|
-
positionId: number;
|
|
1076
|
-
phone: string | NullOrUndefined;
|
|
1077
|
-
model: string | NullOrUndefined;
|
|
1078
|
-
contact: string | NullOrUndefined;
|
|
1079
|
-
category: string | NullOrUndefined;
|
|
1080
|
-
disabled: boolean;
|
|
1081
|
-
expirationTime: string | Date | NullOrUndefined;
|
|
1082
|
-
}
|
|
1083
|
-
interface TraccarPosition {
|
|
1084
|
-
id: number;
|
|
1085
|
-
attributes: Record<string, any>;
|
|
1086
|
-
deviceId: number;
|
|
1087
|
-
protocol: string;
|
|
1088
|
-
serverTime: string | Date;
|
|
1089
|
-
deviceTime: string | Date;
|
|
1090
|
-
fixTime: string | Date;
|
|
1091
|
-
valid: boolean;
|
|
1092
|
-
latitude: number;
|
|
1093
|
-
longitude: number;
|
|
1094
|
-
altitude: number;
|
|
1095
|
-
speed: number;
|
|
1096
|
-
course: number;
|
|
1097
|
-
address: string | NullOrUndefined;
|
|
1098
|
-
accuracy: number;
|
|
1099
|
-
network: Record<string, any> | NullOrUndefined;
|
|
1100
|
-
geofenceIds: number[] | NullOrUndefined;
|
|
1101
|
-
}
|
|
1102
|
-
interface TrackerDevice {
|
|
1103
|
-
id: string;
|
|
1104
|
-
name: string;
|
|
1105
|
-
traccarDeviceId: number;
|
|
1106
|
-
uniqueId: string;
|
|
1107
|
-
slug: string;
|
|
1108
|
-
businessId?: string | NullOrUndefined;
|
|
1109
|
-
vehicleId?: string | NullOrUndefined;
|
|
1110
|
-
createdAt: string | Date;
|
|
1111
|
-
updatedAt: string | Date;
|
|
1112
|
-
traccarDetails?: TraccarDevice | NullOrUndefined;
|
|
1113
|
-
lastPosition?: TraccarPosition | NullOrUndefined;
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
1089
|
/**
|
|
1117
1090
|
* Maintenance Item - catalog of parts/services used in maintenance
|
|
1118
1091
|
*/
|
|
@@ -1302,4 +1275,4 @@ declare enum LinkDestination {
|
|
|
1302
1275
|
}
|
|
1303
1276
|
type NullOrUndefined = null | undefined;
|
|
1304
1277
|
|
|
1305
|
-
export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type BusinessMember, type BusinessModules, type BusinessPg, BusinessRole, type BusinessSettings, BusinessStatus, type BusinessWhatsappConfig, type City, type Collection, type
|
|
1278
|
+
export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type BusinessMember, type BusinessModules, type BusinessPg, BusinessRole, type BusinessSettings, BusinessStatus, type BusinessWhatsappConfig, type City, type Collection, type Customer, type CustomerTransactionStats, DEFAULT_BUSINESS_MODULES, DEFAULT_BUSINESS_SETTINGS, DeliveryStatus, type DraftErrand, DraftErrandStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, type ExpensePaidBy, FeePaymentStatus, FeeSettlement, type GeoPoint, GlobalRoles, type Invoice, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, 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, ParcelSize, PaymentOptions, type PendingErrand, type Product, type ProductCategory, type ProductImage, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductTag, type ProductVariant, type ProductVariantPrice, RemittanceStatus, type Rider, type RiderPerformanceItem, type RiderPerformanceStats, type RiderPerformanceSummary, type RiderPerformanceTimeSeries, type RiderSettlement, type RiderWithUserDetails, RoleType, type State, type TrackerPosition, type Transaction, type TransactionCategory, type TransactionItem, 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
|
@@ -93,21 +93,6 @@ type UserAddress = {
|
|
|
93
93
|
direction?: string;
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
-
interface Coupon {
|
|
97
|
-
id: string;
|
|
98
|
-
phoneNumber: string;
|
|
99
|
-
couponType: 'errand';
|
|
100
|
-
isUsed: boolean;
|
|
101
|
-
expiresAt: Date;
|
|
102
|
-
couponCode: string;
|
|
103
|
-
updatedAt: Date;
|
|
104
|
-
createdAt: Date;
|
|
105
|
-
hasExpired: boolean;
|
|
106
|
-
couponValue: number;
|
|
107
|
-
ref?: string;
|
|
108
|
-
fullName?: string;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
96
|
interface CustomerTransactionStats {
|
|
112
97
|
totalSaleCount: number;
|
|
113
98
|
totalSaleAmount: number;
|
|
@@ -332,6 +317,34 @@ declare enum VehicleType {
|
|
|
332
317
|
Bike = "bike",
|
|
333
318
|
Shuttle = "shuttle"
|
|
334
319
|
}
|
|
320
|
+
/** GeoJSON Point. `coordinates` is `[longitude, latitude]`. */
|
|
321
|
+
type GeoPoint = {
|
|
322
|
+
type: 'Point';
|
|
323
|
+
coordinates: [number, number];
|
|
324
|
+
};
|
|
325
|
+
/**
|
|
326
|
+
* A trimmed-down Traccar position kept as the vehicle's latest fix. Carries the
|
|
327
|
+
* scalar fields a GeoPoint can't — `speed`/`course` drive derived state
|
|
328
|
+
* (moving vs. idle, heading), `recordedAt` gauges staleness.
|
|
329
|
+
*/
|
|
330
|
+
type TrackerPosition = {
|
|
331
|
+
latitude: number;
|
|
332
|
+
longitude: number;
|
|
333
|
+
speed?: number;
|
|
334
|
+
course?: number;
|
|
335
|
+
accuracy?: number;
|
|
336
|
+
valid?: boolean;
|
|
337
|
+
/** Traccar's moving/stopped determination — steadier than speed alone. */
|
|
338
|
+
motion?: boolean;
|
|
339
|
+
/** Engine on/off, when the device reports it. */
|
|
340
|
+
ignition?: boolean;
|
|
341
|
+
/** ISO time the GPS computed the position — the truest "when". */
|
|
342
|
+
fixTime?: string;
|
|
343
|
+
/** ISO time from the device's own clock (drift/buffering signal). */
|
|
344
|
+
deviceTime?: string;
|
|
345
|
+
/** ISO time Traccar received the report — lags `fixTime` when buffered. */
|
|
346
|
+
serverTime?: string;
|
|
347
|
+
};
|
|
335
348
|
type Vehicle = {
|
|
336
349
|
id: string;
|
|
337
350
|
vehicleNumber: string;
|
|
@@ -342,6 +355,12 @@ type Vehicle = {
|
|
|
342
355
|
businessId: string;
|
|
343
356
|
shortName?: string;
|
|
344
357
|
userId?: string;
|
|
358
|
+
/** External GPS device uniqueId bound to this vehicle. */
|
|
359
|
+
trackerId?: string;
|
|
360
|
+
/** Latest known tracker position, as a GeoPoint for proximity queries. */
|
|
361
|
+
location?: GeoPoint;
|
|
362
|
+
/** Latest tracker fix with richer scalar fields (speed, course, …). */
|
|
363
|
+
position?: TrackerPosition;
|
|
345
364
|
};
|
|
346
365
|
type VehicleWithRider = Vehicle & {
|
|
347
366
|
riders: RiderWithUserDetails[];
|
|
@@ -443,10 +462,10 @@ interface RiderSettlement {
|
|
|
443
462
|
draftErrandId?: string;
|
|
444
463
|
riderId: string;
|
|
445
464
|
businessId: string;
|
|
446
|
-
deliveryFee: number;
|
|
447
|
-
additionalAmount: number;
|
|
448
465
|
totalCollectionAmount: number;
|
|
449
|
-
|
|
466
|
+
deliveryFee?: number;
|
|
467
|
+
additionalAmount?: number;
|
|
468
|
+
remittedAmount?: number;
|
|
450
469
|
remittanceStatus: RemittanceStatus | `${RemittanceStatus}`;
|
|
451
470
|
remittedAt?: Date;
|
|
452
471
|
remittedBy?: string;
|
|
@@ -477,10 +496,6 @@ interface RiderPerformanceStats {
|
|
|
477
496
|
riders: RiderPerformanceItem[];
|
|
478
497
|
timeSeries?: RiderPerformanceTimeSeries[];
|
|
479
498
|
}
|
|
480
|
-
declare enum SettlementType {
|
|
481
|
-
DeliveryFee = "delivery_fee",
|
|
482
|
-
Additional = "additional"
|
|
483
|
-
}
|
|
484
499
|
|
|
485
500
|
declare enum ErrandStatus {
|
|
486
501
|
Pending = "pending",
|
|
@@ -548,6 +563,18 @@ interface PendingErrand {
|
|
|
548
563
|
id: string;
|
|
549
564
|
ownerMobileNumber?: string;
|
|
550
565
|
}
|
|
566
|
+
declare enum FeePaymentStatus {
|
|
567
|
+
Unpaid = "unpaid",
|
|
568
|
+
Partial = "partial",
|
|
569
|
+
Paid = "paid"
|
|
570
|
+
}
|
|
571
|
+
declare enum FeeSettlement {
|
|
572
|
+
CashOnDelivery = "cash_on_delivery",
|
|
573
|
+
Prepaid = "prepaid",
|
|
574
|
+
Invoice = "invoice",
|
|
575
|
+
Owed = "owed"
|
|
576
|
+
}
|
|
577
|
+
type ExpensePaidBy = 'rider' | 'company' | 'customer';
|
|
551
578
|
interface Errand {
|
|
552
579
|
id: string;
|
|
553
580
|
nameOfItem: string;
|
|
@@ -566,13 +593,10 @@ interface Errand {
|
|
|
566
593
|
updatedAt: Date;
|
|
567
594
|
createdAt: Date;
|
|
568
595
|
errandRating?: string | ErrandRating;
|
|
569
|
-
payOnDeliveryAmount?: string;
|
|
570
596
|
additionalData?: string;
|
|
571
597
|
deliveryDate?: Date;
|
|
572
598
|
cityId?: City;
|
|
573
|
-
couponPrice?: number;
|
|
574
599
|
price: number;
|
|
575
|
-
coupon?: string | Coupon;
|
|
576
600
|
ownerMobileNumber?: string;
|
|
577
601
|
errandTimeline?: string | ErrandTimeline;
|
|
578
602
|
queuePosition?: number;
|
|
@@ -601,7 +625,6 @@ interface Errand {
|
|
|
601
625
|
isDelayed?: boolean;
|
|
602
626
|
delayedAt?: Date;
|
|
603
627
|
wasDeliveredBy?: 'rider' | 'admin' | 'system' | 'business';
|
|
604
|
-
paymentMethod?: 'cash_on_delivery' | 'prepaid_online' | 'prepaid_transfer' | 'business_invoice';
|
|
605
628
|
additionalFees?: Array<{
|
|
606
629
|
description: string;
|
|
607
630
|
amount: number;
|
|
@@ -610,6 +633,12 @@ interface Errand {
|
|
|
610
633
|
}>;
|
|
611
634
|
riderDetails?: Rider;
|
|
612
635
|
vehicleDetails?: Vehicle;
|
|
636
|
+
amountPaid?: number;
|
|
637
|
+
collections?: number;
|
|
638
|
+
feeSettlement?: `${FeeSettlement}`;
|
|
639
|
+
expenseAmount?: number;
|
|
640
|
+
expensePaidBy?: ExpensePaidBy;
|
|
641
|
+
feePaymentStatus?: `${FeePaymentStatus}`;
|
|
613
642
|
}
|
|
614
643
|
interface AggregatedErrand extends Errand {
|
|
615
644
|
parcelSize: `${ParcelSize}`;
|
|
@@ -729,7 +758,6 @@ interface DraftErrand {
|
|
|
729
758
|
deliveryDetails?: AddressDetails;
|
|
730
759
|
additionalData?: string;
|
|
731
760
|
parcelSize?: `${ParcelSize}`;
|
|
732
|
-
payOnDeliveryAmount?: number;
|
|
733
761
|
status: DraftErrandStatus;
|
|
734
762
|
convertedErrandId?: string;
|
|
735
763
|
settlementId?: string;
|
|
@@ -1058,61 +1086,6 @@ interface VehicleLogStatsSummary {
|
|
|
1058
1086
|
}[];
|
|
1059
1087
|
}
|
|
1060
1088
|
|
|
1061
|
-
declare enum TraccarDeviceStatus {
|
|
1062
|
-
ONLINE = "online",
|
|
1063
|
-
OFFLINE = "offline",
|
|
1064
|
-
UNKNOWN = "unknown"
|
|
1065
|
-
}
|
|
1066
|
-
interface TraccarDevice {
|
|
1067
|
-
id: number;
|
|
1068
|
-
attributes: Record<string, any>;
|
|
1069
|
-
groupId: number;
|
|
1070
|
-
calendarId: number;
|
|
1071
|
-
name: string;
|
|
1072
|
-
uniqueId: string;
|
|
1073
|
-
status: TraccarDeviceStatus | `${TraccarDeviceStatus}`;
|
|
1074
|
-
lastUpdate: string | Date;
|
|
1075
|
-
positionId: number;
|
|
1076
|
-
phone: string | NullOrUndefined;
|
|
1077
|
-
model: string | NullOrUndefined;
|
|
1078
|
-
contact: string | NullOrUndefined;
|
|
1079
|
-
category: string | NullOrUndefined;
|
|
1080
|
-
disabled: boolean;
|
|
1081
|
-
expirationTime: string | Date | NullOrUndefined;
|
|
1082
|
-
}
|
|
1083
|
-
interface TraccarPosition {
|
|
1084
|
-
id: number;
|
|
1085
|
-
attributes: Record<string, any>;
|
|
1086
|
-
deviceId: number;
|
|
1087
|
-
protocol: string;
|
|
1088
|
-
serverTime: string | Date;
|
|
1089
|
-
deviceTime: string | Date;
|
|
1090
|
-
fixTime: string | Date;
|
|
1091
|
-
valid: boolean;
|
|
1092
|
-
latitude: number;
|
|
1093
|
-
longitude: number;
|
|
1094
|
-
altitude: number;
|
|
1095
|
-
speed: number;
|
|
1096
|
-
course: number;
|
|
1097
|
-
address: string | NullOrUndefined;
|
|
1098
|
-
accuracy: number;
|
|
1099
|
-
network: Record<string, any> | NullOrUndefined;
|
|
1100
|
-
geofenceIds: number[] | NullOrUndefined;
|
|
1101
|
-
}
|
|
1102
|
-
interface TrackerDevice {
|
|
1103
|
-
id: string;
|
|
1104
|
-
name: string;
|
|
1105
|
-
traccarDeviceId: number;
|
|
1106
|
-
uniqueId: string;
|
|
1107
|
-
slug: string;
|
|
1108
|
-
businessId?: string | NullOrUndefined;
|
|
1109
|
-
vehicleId?: string | NullOrUndefined;
|
|
1110
|
-
createdAt: string | Date;
|
|
1111
|
-
updatedAt: string | Date;
|
|
1112
|
-
traccarDetails?: TraccarDevice | NullOrUndefined;
|
|
1113
|
-
lastPosition?: TraccarPosition | NullOrUndefined;
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
1089
|
/**
|
|
1117
1090
|
* Maintenance Item - catalog of parts/services used in maintenance
|
|
1118
1091
|
*/
|
|
@@ -1302,4 +1275,4 @@ declare enum LinkDestination {
|
|
|
1302
1275
|
}
|
|
1303
1276
|
type NullOrUndefined = null | undefined;
|
|
1304
1277
|
|
|
1305
|
-
export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type BusinessMember, type BusinessModules, type BusinessPg, BusinessRole, type BusinessSettings, BusinessStatus, type BusinessWhatsappConfig, type City, type Collection, type
|
|
1278
|
+
export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type BusinessMember, type BusinessModules, type BusinessPg, BusinessRole, type BusinessSettings, BusinessStatus, type BusinessWhatsappConfig, type City, type Collection, type Customer, type CustomerTransactionStats, DEFAULT_BUSINESS_MODULES, DEFAULT_BUSINESS_SETTINGS, DeliveryStatus, type DraftErrand, DraftErrandStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, type ExpensePaidBy, FeePaymentStatus, FeeSettlement, type GeoPoint, GlobalRoles, type Invoice, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, 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, ParcelSize, PaymentOptions, type PendingErrand, type Product, type ProductCategory, type ProductImage, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductTag, type ProductVariant, type ProductVariantPrice, RemittanceStatus, type Rider, type RiderPerformanceItem, type RiderPerformanceStats, type RiderPerformanceSummary, type RiderPerformanceTimeSeries, type RiderSettlement, type RiderWithUserDetails, RoleType, type State, type TrackerPosition, type Transaction, type TransactionCategory, type TransactionItem, 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
|
@@ -65,6 +65,19 @@ var errandTimeline = [
|
|
|
65
65
|
description: "Your package has been delivered and the errand closed, please leave a review and a rating for the rider"
|
|
66
66
|
}
|
|
67
67
|
];
|
|
68
|
+
var FeePaymentStatus = /* @__PURE__ */ ((FeePaymentStatus2) => {
|
|
69
|
+
FeePaymentStatus2["Unpaid"] = "unpaid";
|
|
70
|
+
FeePaymentStatus2["Partial"] = "partial";
|
|
71
|
+
FeePaymentStatus2["Paid"] = "paid";
|
|
72
|
+
return FeePaymentStatus2;
|
|
73
|
+
})(FeePaymentStatus || {});
|
|
74
|
+
var FeeSettlement = /* @__PURE__ */ ((FeeSettlement2) => {
|
|
75
|
+
FeeSettlement2["CashOnDelivery"] = "cash_on_delivery";
|
|
76
|
+
FeeSettlement2["Prepaid"] = "prepaid";
|
|
77
|
+
FeeSettlement2["Invoice"] = "invoice";
|
|
78
|
+
FeeSettlement2["Owed"] = "owed";
|
|
79
|
+
return FeeSettlement2;
|
|
80
|
+
})(FeeSettlement || {});
|
|
68
81
|
var AddressTypes = /* @__PURE__ */ ((AddressTypes2) => {
|
|
69
82
|
AddressTypes2["DeliveryAddress"] = "deliveryAddress";
|
|
70
83
|
AddressTypes2["PickupAddress"] = "pickupAddress";
|
|
@@ -144,11 +157,6 @@ var RemittanceStatus = /* @__PURE__ */ ((RemittanceStatus2) => {
|
|
|
144
157
|
RemittanceStatus2["Cancelled"] = "cancelled";
|
|
145
158
|
return RemittanceStatus2;
|
|
146
159
|
})(RemittanceStatus || {});
|
|
147
|
-
var SettlementType = /* @__PURE__ */ ((SettlementType2) => {
|
|
148
|
-
SettlementType2["DeliveryFee"] = "delivery_fee";
|
|
149
|
-
SettlementType2["Additional"] = "additional";
|
|
150
|
-
return SettlementType2;
|
|
151
|
-
})(SettlementType || {});
|
|
152
160
|
|
|
153
161
|
// src/enterprise.ts
|
|
154
162
|
var EnterpriseType = /* @__PURE__ */ ((EnterpriseType2) => {
|
|
@@ -222,14 +230,6 @@ var BusinessCourierLinkStatus = /* @__PURE__ */ ((BusinessCourierLinkStatus2) =>
|
|
|
222
230
|
return BusinessCourierLinkStatus2;
|
|
223
231
|
})(BusinessCourierLinkStatus || {});
|
|
224
232
|
|
|
225
|
-
// src/tracker.ts
|
|
226
|
-
var TraccarDeviceStatus = /* @__PURE__ */ ((TraccarDeviceStatus2) => {
|
|
227
|
-
TraccarDeviceStatus2["ONLINE"] = "online";
|
|
228
|
-
TraccarDeviceStatus2["OFFLINE"] = "offline";
|
|
229
|
-
TraccarDeviceStatus2["UNKNOWN"] = "unknown";
|
|
230
|
-
return TraccarDeviceStatus2;
|
|
231
|
-
})(TraccarDeviceStatus || {});
|
|
232
|
-
|
|
233
233
|
// src/whatsapp.ts
|
|
234
234
|
var WhatsappEvent = /* @__PURE__ */ ((WhatsappEvent2) => {
|
|
235
235
|
WhatsappEvent2["ERRAND_CREATED"] = "errand.created";
|
|
@@ -297,6 +297,8 @@ export {
|
|
|
297
297
|
DraftErrandStatus,
|
|
298
298
|
EnterpriseType,
|
|
299
299
|
ErrandStatus,
|
|
300
|
+
FeePaymentStatus,
|
|
301
|
+
FeeSettlement,
|
|
300
302
|
GlobalRoles,
|
|
301
303
|
InvoiceGenerationType,
|
|
302
304
|
InvoiceItemType,
|
|
@@ -308,8 +310,6 @@ export {
|
|
|
308
310
|
PaymentOptions,
|
|
309
311
|
RemittanceStatus,
|
|
310
312
|
RoleType,
|
|
311
|
-
SettlementType,
|
|
312
|
-
TraccarDeviceStatus,
|
|
313
313
|
VehicleLogType,
|
|
314
314
|
VehicleType,
|
|
315
315
|
WhatsappButtonType,
|
package/package.json
CHANGED
package/src/errand.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Business } from '.';
|
|
2
|
-
import { Coupon } from './coupon';
|
|
3
2
|
import { Invoice, InvoiceStatus } from './invoice';
|
|
4
3
|
import { City } from './location';
|
|
5
4
|
import { Rider } from './rider';
|
|
@@ -112,6 +111,34 @@ export interface PendingErrand {
|
|
|
112
111
|
ownerMobileNumber?: string;
|
|
113
112
|
}
|
|
114
113
|
|
|
114
|
+
// --- money model redesign (see docs/errand-money-model-redesign.md) ---
|
|
115
|
+
// Customer-facing form of "customer owes us": derived from `price - amountPaid`,
|
|
116
|
+
// never hand-set. Distinct from the legacy 5-value `paymentStatus` (InvoiceStatus).
|
|
117
|
+
export enum FeePaymentStatus {
|
|
118
|
+
Unpaid = 'unpaid',
|
|
119
|
+
Partial = 'partial',
|
|
120
|
+
Paid = 'paid',
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// How our fee gets settled — the single business fact behind three behaviours:
|
|
124
|
+
// what `amountPaid` starts at, whether the errand is invoiced, and whether the
|
|
125
|
+
// rider is carrying our fee. Replaces the `payOnDelivery` boolean, which could
|
|
126
|
+
// not tell `prepaid` / `invoice` / `owed` apart. See docs §2.9.
|
|
127
|
+
export enum FeeSettlement {
|
|
128
|
+
// Rider collects the fee at the door. Paid on arrival; rider owes it to us.
|
|
129
|
+
CashOnDelivery = 'cash_on_delivery',
|
|
130
|
+
// Already paid before dispatch. Paid; nobody is carrying it.
|
|
131
|
+
Prepaid = 'prepaid',
|
|
132
|
+
// Goes on the customer's statement. Unpaid until the invoice is paid.
|
|
133
|
+
Invoice = 'invoice',
|
|
134
|
+
// Owed by the customer with no settlement arranged yet. Unpaid, NOT invoiced.
|
|
135
|
+
Owed = 'owed',
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Who fronted an errand expense. `customer` covers "paid on call" and
|
|
139
|
+
// "handed to the rider directly" — only `company`-fronted expenses are billed.
|
|
140
|
+
export type ExpensePaidBy = 'rider' | 'company' | 'customer';
|
|
141
|
+
|
|
115
142
|
export interface Errand {
|
|
116
143
|
// NOTE: Deprecated fields
|
|
117
144
|
// rider: string | Rider;
|
|
@@ -143,13 +170,10 @@ export interface Errand {
|
|
|
143
170
|
updatedAt: Date;
|
|
144
171
|
createdAt: Date;
|
|
145
172
|
errandRating?: string | ErrandRating;
|
|
146
|
-
payOnDeliveryAmount?: string;
|
|
147
173
|
additionalData?: string;
|
|
148
174
|
deliveryDate?: Date;
|
|
149
175
|
cityId?: City;
|
|
150
|
-
couponPrice?: number;
|
|
151
176
|
price: number;
|
|
152
|
-
coupon?: string | Coupon;
|
|
153
177
|
ownerMobileNumber?: string;
|
|
154
178
|
errandTimeline?: string | ErrandTimeline;
|
|
155
179
|
queuePosition?: number;
|
|
@@ -173,11 +197,6 @@ export interface Errand {
|
|
|
173
197
|
isDelayed?: boolean;
|
|
174
198
|
delayedAt?: Date;
|
|
175
199
|
wasDeliveredBy?: 'rider' | 'admin' | 'system' | 'business';
|
|
176
|
-
paymentMethod?:
|
|
177
|
-
| 'cash_on_delivery'
|
|
178
|
-
| 'prepaid_online'
|
|
179
|
-
| 'prepaid_transfer'
|
|
180
|
-
| 'business_invoice';
|
|
181
200
|
additionalFees?: Array<{
|
|
182
201
|
description: string;
|
|
183
202
|
amount: number;
|
|
@@ -188,6 +207,22 @@ export interface Errand {
|
|
|
188
207
|
// new fields
|
|
189
208
|
riderDetails?: Rider;
|
|
190
209
|
vehicleDetails?: Vehicle;
|
|
210
|
+
|
|
211
|
+
// --- money model redesign (Phase 1: additive; see docs/errand-money-model-redesign.md) ---
|
|
212
|
+
// How much of `price` has been paid, by any route. Drives `feePaymentStatus`.
|
|
213
|
+
amountPaid?: number;
|
|
214
|
+
// Goods money the rider collects for the customer — NEVER our fee.
|
|
215
|
+
// This IS "we owe the customer".
|
|
216
|
+
collections?: number;
|
|
217
|
+
// How our fee is settled (§2.9). Drives `amountPaid` at creation, invoice
|
|
218
|
+
// eligibility, and whether the rider carries our fee. Orthogonal to
|
|
219
|
+
// `collections`, which is always goods money for the customer.
|
|
220
|
+
feeSettlement?: `${FeeSettlement}`;
|
|
221
|
+
// Out-of-pocket cost during the errand (e.g. waybill).
|
|
222
|
+
expenseAmount?: number;
|
|
223
|
+
expensePaidBy?: ExpensePaidBy;
|
|
224
|
+
// Derived from `price - amountPaid` (never hand-set). Stored so Mongo can filter on it.
|
|
225
|
+
feePaymentStatus?: `${FeePaymentStatus}`;
|
|
191
226
|
}
|
|
192
227
|
|
|
193
228
|
export interface AggregatedErrand extends Errand {
|
|
@@ -322,7 +357,6 @@ export interface DraftErrand {
|
|
|
322
357
|
deliveryDetails?: AddressDetails;
|
|
323
358
|
additionalData?: string;
|
|
324
359
|
parcelSize?: `${ParcelSize}`;
|
|
325
|
-
payOnDeliveryAmount?: number;
|
|
326
360
|
|
|
327
361
|
// Lifecycle
|
|
328
362
|
status: DraftErrandStatus;
|
package/src/index.ts
CHANGED
|
@@ -30,12 +30,10 @@ export * from './notification';
|
|
|
30
30
|
export * from './rider';
|
|
31
31
|
export * from './vehicle';
|
|
32
32
|
export * from './enterprise';
|
|
33
|
-
export * from './coupon';
|
|
34
33
|
export * from './business';
|
|
35
34
|
export * from './commerce';
|
|
36
35
|
export * from './customer';
|
|
37
36
|
export * from './transaction';
|
|
38
37
|
export * from './stat';
|
|
39
|
-
export * from './tracker';
|
|
40
38
|
export * from './maintenance';
|
|
41
39
|
export * from './whatsapp';
|
package/src/rider.ts
CHANGED
|
@@ -55,11 +55,15 @@ export interface RiderSettlement {
|
|
|
55
55
|
riderId: string;
|
|
56
56
|
businessId: string;
|
|
57
57
|
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
additionalAmount: number;
|
|
58
|
+
// The cash the rider collected and owes us. Remittance is all-or-nothing
|
|
59
|
+
// (see `remittanceStatus`) — no partial remittance, no fee/additional split.
|
|
61
60
|
totalCollectionAmount: number;
|
|
62
|
-
|
|
61
|
+
|
|
62
|
+
// DEPRECATED (read-only, transitional; see docs §7.5). Historical records
|
|
63
|
+
// store money here; kept for the balance fallback until the Phase 5 drop.
|
|
64
|
+
deliveryFee?: number;
|
|
65
|
+
additionalAmount?: number;
|
|
66
|
+
remittedAmount?: number;
|
|
63
67
|
|
|
64
68
|
// Status
|
|
65
69
|
remittanceStatus: RemittanceStatus | `${RemittanceStatus}`;
|
|
@@ -101,7 +105,3 @@ export interface RiderPerformanceStats {
|
|
|
101
105
|
timeSeries?: RiderPerformanceTimeSeries[];
|
|
102
106
|
}
|
|
103
107
|
|
|
104
|
-
export enum SettlementType {
|
|
105
|
-
DeliveryFee = 'delivery_fee',
|
|
106
|
-
Additional = 'additional',
|
|
107
|
-
}
|
package/src/vehicle.ts
CHANGED
|
@@ -5,6 +5,36 @@ export enum VehicleType {
|
|
|
5
5
|
Shuttle = 'shuttle',
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
/** GeoJSON Point. `coordinates` is `[longitude, latitude]`. */
|
|
9
|
+
export type GeoPoint = {
|
|
10
|
+
type: 'Point';
|
|
11
|
+
coordinates: [number, number];
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A trimmed-down Traccar position kept as the vehicle's latest fix. Carries the
|
|
16
|
+
* scalar fields a GeoPoint can't — `speed`/`course` drive derived state
|
|
17
|
+
* (moving vs. idle, heading), `recordedAt` gauges staleness.
|
|
18
|
+
*/
|
|
19
|
+
export type TrackerPosition = {
|
|
20
|
+
latitude: number;
|
|
21
|
+
longitude: number;
|
|
22
|
+
speed?: number;
|
|
23
|
+
course?: number;
|
|
24
|
+
accuracy?: number;
|
|
25
|
+
valid?: boolean;
|
|
26
|
+
/** Traccar's moving/stopped determination — steadier than speed alone. */
|
|
27
|
+
motion?: boolean;
|
|
28
|
+
/** Engine on/off, when the device reports it. */
|
|
29
|
+
ignition?: boolean;
|
|
30
|
+
/** ISO time the GPS computed the position — the truest "when". */
|
|
31
|
+
fixTime?: string;
|
|
32
|
+
/** ISO time from the device's own clock (drift/buffering signal). */
|
|
33
|
+
deviceTime?: string;
|
|
34
|
+
/** ISO time Traccar received the report — lags `fixTime` when buffered. */
|
|
35
|
+
serverTime?: string;
|
|
36
|
+
};
|
|
37
|
+
|
|
8
38
|
export type Vehicle = {
|
|
9
39
|
id: string;
|
|
10
40
|
vehicleNumber: string;
|
|
@@ -16,6 +46,12 @@ export type Vehicle = {
|
|
|
16
46
|
|
|
17
47
|
shortName?: string;
|
|
18
48
|
userId?: string;
|
|
49
|
+
/** External GPS device uniqueId bound to this vehicle. */
|
|
50
|
+
trackerId?: string;
|
|
51
|
+
/** Latest known tracker position, as a GeoPoint for proximity queries. */
|
|
52
|
+
location?: GeoPoint;
|
|
53
|
+
/** Latest tracker fix with richer scalar fields (speed, course, …). */
|
|
54
|
+
position?: TrackerPosition;
|
|
19
55
|
};
|
|
20
56
|
|
|
21
57
|
export type VehicleWithRider = Vehicle & {
|
package/src/coupon.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export interface Coupon {
|
|
2
|
-
id: string;
|
|
3
|
-
phoneNumber: string;
|
|
4
|
-
couponType: 'errand';
|
|
5
|
-
isUsed: boolean;
|
|
6
|
-
expiresAt: Date;
|
|
7
|
-
couponCode: string;
|
|
8
|
-
updatedAt: Date;
|
|
9
|
-
createdAt: Date;
|
|
10
|
-
hasExpired: boolean;
|
|
11
|
-
couponValue: number;
|
|
12
|
-
ref?: string;
|
|
13
|
-
fullName?: string;
|
|
14
|
-
}
|
package/src/tracker.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { NullOrUndefined } from '.';
|
|
2
|
-
|
|
3
|
-
export enum TraccarDeviceStatus {
|
|
4
|
-
ONLINE = 'online',
|
|
5
|
-
OFFLINE = 'offline',
|
|
6
|
-
UNKNOWN = 'unknown',
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface TraccarDevice {
|
|
10
|
-
id: number;
|
|
11
|
-
attributes: Record<string, any>;
|
|
12
|
-
groupId: number;
|
|
13
|
-
calendarId: number;
|
|
14
|
-
name: string;
|
|
15
|
-
uniqueId: string;
|
|
16
|
-
status: TraccarDeviceStatus | `${TraccarDeviceStatus}`;
|
|
17
|
-
lastUpdate: string | Date;
|
|
18
|
-
positionId: number;
|
|
19
|
-
phone: string | NullOrUndefined;
|
|
20
|
-
model: string | NullOrUndefined;
|
|
21
|
-
contact: string | NullOrUndefined;
|
|
22
|
-
category: string | NullOrUndefined;
|
|
23
|
-
disabled: boolean;
|
|
24
|
-
expirationTime: string | Date | NullOrUndefined;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface TraccarPosition {
|
|
28
|
-
id: number;
|
|
29
|
-
attributes: Record<string, any>;
|
|
30
|
-
deviceId: number;
|
|
31
|
-
protocol: string;
|
|
32
|
-
serverTime: string | Date;
|
|
33
|
-
deviceTime: string | Date;
|
|
34
|
-
fixTime: string | Date;
|
|
35
|
-
valid: boolean;
|
|
36
|
-
latitude: number;
|
|
37
|
-
longitude: number;
|
|
38
|
-
altitude: number;
|
|
39
|
-
speed: number;
|
|
40
|
-
course: number;
|
|
41
|
-
address: string | NullOrUndefined;
|
|
42
|
-
accuracy: number;
|
|
43
|
-
network: Record<string, any> | NullOrUndefined;
|
|
44
|
-
geofenceIds: number[] | NullOrUndefined;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface TrackerDevice {
|
|
48
|
-
id: string;
|
|
49
|
-
name: string;
|
|
50
|
-
traccarDeviceId: number;
|
|
51
|
-
uniqueId: string;
|
|
52
|
-
slug: string;
|
|
53
|
-
businessId?: string | NullOrUndefined;
|
|
54
|
-
vehicleId?: string | NullOrUndefined;
|
|
55
|
-
createdAt: string | Date;
|
|
56
|
-
updatedAt: string | Date;
|
|
57
|
-
traccarDetails?: TraccarDevice | NullOrUndefined;
|
|
58
|
-
lastPosition?: TraccarPosition | NullOrUndefined;
|
|
59
|
-
}
|