@mydoormot/app-types 2.0.4 → 2.0.6
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 +0 -9
- package/dist/index.d.cts +23 -13
- package/dist/index.d.ts +23 -13
- package/dist/index.js +0 -8
- package/package.json +1 -1
- package/src/delivery.ts +0 -7
- package/src/errand.ts +0 -11
- package/src/rider.ts +23 -3
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @mydoormot/app-types@2.0.
|
|
2
|
+
> @mydoormot/app-types@2.0.5 build /Users/chuksben/Desktop/projects/microservices/mydoormot/packages/app-types
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --dts
|
|
4
4
|
|
|
5
5
|
CLI Building entry: src/index.ts
|
|
@@ -8,11 +8,11 @@ CLI tsup v7.3.0
|
|
|
8
8
|
CLI Target: es2021
|
|
9
9
|
ESM Build start
|
|
10
10
|
CJS Build start
|
|
11
|
-
ESM dist/index.js 14.
|
|
12
|
-
ESM ⚡️ Build success in
|
|
13
|
-
CJS dist/index.cjs 17.
|
|
14
|
-
CJS ⚡️ Build success in
|
|
11
|
+
ESM dist/index.js 14.38 KB
|
|
12
|
+
ESM ⚡️ Build success in 180ms
|
|
13
|
+
CJS dist/index.cjs 17.31 KB
|
|
14
|
+
CJS ⚡️ Build success in 180ms
|
|
15
15
|
DTS Build start
|
|
16
|
-
DTS ⚡️ Build success in
|
|
17
|
-
DTS dist/index.d.ts
|
|
18
|
-
DTS dist/index.d.cts
|
|
16
|
+
DTS ⚡️ Build success in 682ms
|
|
17
|
+
DTS dist/index.d.ts 50.65 KB
|
|
18
|
+
DTS dist/index.d.cts 50.65 KB
|
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -47,7 +47,6 @@ __export(src_exports, {
|
|
|
47
47
|
LinkDestination: () => LinkDestination,
|
|
48
48
|
MembershipStatus: () => MembershipStatus,
|
|
49
49
|
NotificationType: () => NotificationType,
|
|
50
|
-
ParcelSize: () => ParcelSize,
|
|
51
50
|
PaymentOptions: () => PaymentOptions,
|
|
52
51
|
PayoutPeriodType: () => PayoutPeriodType,
|
|
53
52
|
PayoutRateSource: () => PayoutRateSource,
|
|
@@ -166,13 +165,6 @@ var DeliveryStatus = /* @__PURE__ */ ((DeliveryStatus2) => {
|
|
|
166
165
|
DeliveryStatus2["Cancelled"] = "cancelled";
|
|
167
166
|
return DeliveryStatus2;
|
|
168
167
|
})(DeliveryStatus || {});
|
|
169
|
-
var ParcelSize = /* @__PURE__ */ ((ParcelSize2) => {
|
|
170
|
-
ParcelSize2["Bike"] = "bike";
|
|
171
|
-
ParcelSize2["Large"] = "large";
|
|
172
|
-
ParcelSize2["Medium"] = "medium";
|
|
173
|
-
ParcelSize2["Small"] = "small";
|
|
174
|
-
return ParcelSize2;
|
|
175
|
-
})(ParcelSize || {});
|
|
176
168
|
var DraftErrandStatus = /* @__PURE__ */ ((DraftErrandStatus2) => {
|
|
177
169
|
DraftErrandStatus2["Draft"] = "draft";
|
|
178
170
|
DraftErrandStatus2["RiderCompleted"] = "rider_completed";
|
|
@@ -456,7 +448,6 @@ var LinkDestination = /* @__PURE__ */ ((LinkDestination2) => {
|
|
|
456
448
|
LinkDestination,
|
|
457
449
|
MembershipStatus,
|
|
458
450
|
NotificationType,
|
|
459
|
-
ParcelSize,
|
|
460
451
|
PaymentOptions,
|
|
461
452
|
PayoutPeriodType,
|
|
462
453
|
PayoutRateSource,
|
package/dist/index.d.cts
CHANGED
|
@@ -731,13 +731,21 @@ type Rider = {
|
|
|
731
731
|
hasBeenRated: boolean;
|
|
732
732
|
payoutPercentage?: number | null;
|
|
733
733
|
state?: string | State;
|
|
734
|
-
currentErrand?: Errand;
|
|
735
|
-
lastDeliveredErrand?: Errand;
|
|
736
734
|
};
|
|
737
735
|
type RiderWithUserDetails = Rider & {
|
|
738
736
|
userDetails?: User;
|
|
739
737
|
vehicleDetails?: Vehicle | null;
|
|
740
738
|
businessMemberDetails?: BusinessMember;
|
|
739
|
+
/**
|
|
740
|
+
* What the rider owes us: the sum of their pending (unremitted) settlements,
|
|
741
|
+
* scoped to the rider's own business. Same figure as the rider register's
|
|
742
|
+
* `cashOwed`.
|
|
743
|
+
*/
|
|
744
|
+
cashOwed?: number;
|
|
745
|
+
/** How many pending settlements make up `cashOwed`. */
|
|
746
|
+
unremittedSettlements?: number;
|
|
747
|
+
/** When the oldest of those settlements was raised — null when none are. */
|
|
748
|
+
oldestUnremittedAt?: Date | null;
|
|
741
749
|
};
|
|
742
750
|
declare enum RemittanceStatus {
|
|
743
751
|
Pending = "pending",
|
|
@@ -857,6 +865,15 @@ interface RiderPayoutPreviewItem {
|
|
|
857
865
|
/** Set when a payout for this rider and the same period already exists. */
|
|
858
866
|
existingPayoutId?: string;
|
|
859
867
|
existingPayoutStatus?: RiderPayoutStatus | `${RiderPayoutStatus}`;
|
|
868
|
+
/**
|
|
869
|
+
* Errands in the period this rider has not marked delivered (and that are not
|
|
870
|
+
* cancelled). NOT included in `grossEarnings` or `payoutAmount` — riders are
|
|
871
|
+
* paid for delivered work only. Surfaced so the gap can be chased before
|
|
872
|
+
* payroll is committed, since an unmarked errand otherwise misses every
|
|
873
|
+
* payout silently.
|
|
874
|
+
*/
|
|
875
|
+
undeliveredCount: number;
|
|
876
|
+
undeliveredAmount: number;
|
|
860
877
|
}
|
|
861
878
|
interface RiderPayoutPreview {
|
|
862
879
|
periodStart: Date;
|
|
@@ -869,6 +886,9 @@ interface RiderPayoutPreview {
|
|
|
869
886
|
totalPayoutAmount: number;
|
|
870
887
|
/** Riders skipped because no percentage is configured for them. */
|
|
871
888
|
unratedRiderCount: number;
|
|
889
|
+
/** Totals of the non-paying undelivered figure. See the item type. */
|
|
890
|
+
totalUndeliveredErrands: number;
|
|
891
|
+
totalUndeliveredAmount: number;
|
|
872
892
|
};
|
|
873
893
|
riders: RiderPayoutPreviewItem[];
|
|
874
894
|
}
|
|
@@ -892,7 +912,6 @@ interface PendingErrand {
|
|
|
892
912
|
_id: string;
|
|
893
913
|
rider: string;
|
|
894
914
|
customerId: string;
|
|
895
|
-
parcelSize: ParcelSize;
|
|
896
915
|
deliveryStatus: ErrandStatus;
|
|
897
916
|
invoice: {
|
|
898
917
|
invoiceStatus: string;
|
|
@@ -966,7 +985,6 @@ interface Errand {
|
|
|
966
985
|
courierBusinessId?: string;
|
|
967
986
|
pickupDetails: AddressDetails;
|
|
968
987
|
deliveryDetails: AddressDetails;
|
|
969
|
-
parcelSize: `${ParcelSize}`;
|
|
970
988
|
deliveryStatus: ErrandStatus | `${ErrandStatus}`;
|
|
971
989
|
paymentStatus: `${InvoiceStatus}`;
|
|
972
990
|
invoiceId?: string;
|
|
@@ -1022,7 +1040,6 @@ interface Errand {
|
|
|
1022
1040
|
feePaymentStatus?: `${FeePaymentStatus}`;
|
|
1023
1041
|
}
|
|
1024
1042
|
interface AggregatedErrand extends Errand {
|
|
1025
|
-
parcelSize: `${ParcelSize}`;
|
|
1026
1043
|
invoiceDetails: Invoice;
|
|
1027
1044
|
pickupLocation: {
|
|
1028
1045
|
cityId: string;
|
|
@@ -1063,12 +1080,6 @@ declare enum DeliveryStatus {
|
|
|
1063
1080
|
Delivered = "delivered",
|
|
1064
1081
|
Cancelled = "cancelled"
|
|
1065
1082
|
}
|
|
1066
|
-
declare enum ParcelSize {
|
|
1067
|
-
Bike = "bike",
|
|
1068
|
-
Large = "large",
|
|
1069
|
-
Medium = "medium",
|
|
1070
|
-
Small = "small"
|
|
1071
|
-
}
|
|
1072
1083
|
interface ErrandTimeline {
|
|
1073
1084
|
id: string;
|
|
1074
1085
|
errandId: string;
|
|
@@ -1138,7 +1149,6 @@ interface DraftErrand {
|
|
|
1138
1149
|
pickupDetails?: AddressDetails;
|
|
1139
1150
|
deliveryDetails?: AddressDetails;
|
|
1140
1151
|
additionalData?: string;
|
|
1141
|
-
parcelSize?: `${ParcelSize}`;
|
|
1142
1152
|
status: DraftErrandStatus;
|
|
1143
1153
|
convertedErrandId?: string;
|
|
1144
1154
|
settlementId?: string;
|
|
@@ -1713,4 +1723,4 @@ declare enum LinkDestination {
|
|
|
1713
1723
|
}
|
|
1714
1724
|
type NullOrUndefined = null | undefined;
|
|
1715
1725
|
|
|
1716
|
-
export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type BusinessFuelSettings, type BusinessMember, type BusinessModules, type BusinessPg, type BusinessPortal, type BusinessRiderPaySettings, BusinessRole, type BusinessSettings, BusinessStatus, type BusinessWhatsappConfig, type City, type Collection, type Customer, type CustomerAddress, type CustomerBilling, type CustomerTransactionStats, DEFAULT_BUSINESS_FUEL_SETTINGS, DEFAULT_BUSINESS_MODULES, DEFAULT_BUSINESS_RIDER_PAY_SETTINGS, DEFAULT_BUSINESS_SETTINGS, DeliveryStatus, type DraftErrand, DraftErrandStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, ErrandInvoiceState, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, type ExpensePaidBy, FeePaymentStatus, FeeSettlement, type FuelDueData, type FuelDueItem, FuelDueStatus, type FuelDueTotals, type FuelPercentSuggestion, type FuelSinceLastRefuel, type FuelSuggestionConfidence, type GeoPoint, GlobalRoles, type Invoice, type InvoiceDrift, type InvoiceEvent, InvoiceEventType, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, type InvoicePayment, InvoicePaymentMethod, InvoiceStatus, type LatLng, LinkDestination, type MaintenanceItem, type MaintenancePartUsage, type MaintenanceRecord, type MaintenanceStats, type MaintenanceStatsSummary, type MaintenanceTopItem, MembershipStatus, type Notification, type NotificationData, NotificationType, type NullOrUndefined, type OpeningHours, type PaginateResult,
|
|
1726
|
+
export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type BusinessFuelSettings, type BusinessMember, type BusinessModules, type BusinessPg, type BusinessPortal, type BusinessRiderPaySettings, BusinessRole, type BusinessSettings, BusinessStatus, type BusinessWhatsappConfig, type City, type Collection, type Customer, type CustomerAddress, type CustomerBilling, type CustomerTransactionStats, DEFAULT_BUSINESS_FUEL_SETTINGS, DEFAULT_BUSINESS_MODULES, DEFAULT_BUSINESS_RIDER_PAY_SETTINGS, DEFAULT_BUSINESS_SETTINGS, DeliveryStatus, type DraftErrand, DraftErrandStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, ErrandInvoiceState, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, type ExpensePaidBy, FeePaymentStatus, FeeSettlement, type FuelDueData, type FuelDueItem, FuelDueStatus, type FuelDueTotals, type FuelPercentSuggestion, type FuelSinceLastRefuel, type FuelSuggestionConfidence, type GeoPoint, GlobalRoles, type Invoice, type InvoiceDrift, type InvoiceEvent, InvoiceEventType, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, type InvoicePayment, InvoicePaymentMethod, InvoiceStatus, type LatLng, LinkDestination, type MaintenanceItem, type MaintenancePartUsage, type MaintenanceRecord, type MaintenanceStats, type MaintenanceStatsSummary, type MaintenanceTopItem, MembershipStatus, type Notification, type NotificationData, NotificationType, type NullOrUndefined, type OpeningHours, type PaginateResult, PaymentOptions, PayoutPeriodType, PayoutRateSource, type PendingErrand, type PortalHandleAvailability, PortalStatus, type Product, type ProductCategory, type ProductImage, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductTag, type ProductVariant, type ProductVariantPrice, type PublicPortal, type PublicPortalBusiness, RemittanceStatus, type Rider, type RiderPayout, type RiderPayoutAdjustment, type RiderPayoutPreview, type RiderPayoutPreviewItem, RiderPayoutStatus, type RiderPerformanceItem, type RiderPerformanceStats, type RiderPerformanceSummary, type RiderPerformanceTimeSeries, type RiderSettlement, type RiderWithUserDetails, RoleType, type State, SweepExclusionReason, type TrackerPosition, type Transaction, type TransactionCategory, type TransactionItem, type TransactionRiderUser, type TransactionType, type TransactionWithCategory, type TransactionWithJoin, type User, type UserAddress, type Vehicle, type VehicleErrandStats, type VehicleFuelStats, type VehicleLog, type VehicleLogStatsSummary, VehicleLogType, type VehicleLogWithErrands, type VehicleMaintenanceStats, type VehiclePerformanceData, type VehiclePerformanceFilters, type VehiclePerformanceItem, type VehiclePerformanceTotals, VehicleType, type VehicleWithRider, type Vendor, WhatsappButtonType, WhatsappComponentType, WhatsappEvent, WhatsappRecipient, type WhatsappSendLog, type WhatsappTemplate, type WhatsappTemplateButton, type WhatsappTemplateComponent, WhatsappTemplateMetaStatus, WhatsappTemplateParamSource, type WhatsappTemplateSource, errandTimeline };
|
package/dist/index.d.ts
CHANGED
|
@@ -731,13 +731,21 @@ type Rider = {
|
|
|
731
731
|
hasBeenRated: boolean;
|
|
732
732
|
payoutPercentage?: number | null;
|
|
733
733
|
state?: string | State;
|
|
734
|
-
currentErrand?: Errand;
|
|
735
|
-
lastDeliveredErrand?: Errand;
|
|
736
734
|
};
|
|
737
735
|
type RiderWithUserDetails = Rider & {
|
|
738
736
|
userDetails?: User;
|
|
739
737
|
vehicleDetails?: Vehicle | null;
|
|
740
738
|
businessMemberDetails?: BusinessMember;
|
|
739
|
+
/**
|
|
740
|
+
* What the rider owes us: the sum of their pending (unremitted) settlements,
|
|
741
|
+
* scoped to the rider's own business. Same figure as the rider register's
|
|
742
|
+
* `cashOwed`.
|
|
743
|
+
*/
|
|
744
|
+
cashOwed?: number;
|
|
745
|
+
/** How many pending settlements make up `cashOwed`. */
|
|
746
|
+
unremittedSettlements?: number;
|
|
747
|
+
/** When the oldest of those settlements was raised — null when none are. */
|
|
748
|
+
oldestUnremittedAt?: Date | null;
|
|
741
749
|
};
|
|
742
750
|
declare enum RemittanceStatus {
|
|
743
751
|
Pending = "pending",
|
|
@@ -857,6 +865,15 @@ interface RiderPayoutPreviewItem {
|
|
|
857
865
|
/** Set when a payout for this rider and the same period already exists. */
|
|
858
866
|
existingPayoutId?: string;
|
|
859
867
|
existingPayoutStatus?: RiderPayoutStatus | `${RiderPayoutStatus}`;
|
|
868
|
+
/**
|
|
869
|
+
* Errands in the period this rider has not marked delivered (and that are not
|
|
870
|
+
* cancelled). NOT included in `grossEarnings` or `payoutAmount` — riders are
|
|
871
|
+
* paid for delivered work only. Surfaced so the gap can be chased before
|
|
872
|
+
* payroll is committed, since an unmarked errand otherwise misses every
|
|
873
|
+
* payout silently.
|
|
874
|
+
*/
|
|
875
|
+
undeliveredCount: number;
|
|
876
|
+
undeliveredAmount: number;
|
|
860
877
|
}
|
|
861
878
|
interface RiderPayoutPreview {
|
|
862
879
|
periodStart: Date;
|
|
@@ -869,6 +886,9 @@ interface RiderPayoutPreview {
|
|
|
869
886
|
totalPayoutAmount: number;
|
|
870
887
|
/** Riders skipped because no percentage is configured for them. */
|
|
871
888
|
unratedRiderCount: number;
|
|
889
|
+
/** Totals of the non-paying undelivered figure. See the item type. */
|
|
890
|
+
totalUndeliveredErrands: number;
|
|
891
|
+
totalUndeliveredAmount: number;
|
|
872
892
|
};
|
|
873
893
|
riders: RiderPayoutPreviewItem[];
|
|
874
894
|
}
|
|
@@ -892,7 +912,6 @@ interface PendingErrand {
|
|
|
892
912
|
_id: string;
|
|
893
913
|
rider: string;
|
|
894
914
|
customerId: string;
|
|
895
|
-
parcelSize: ParcelSize;
|
|
896
915
|
deliveryStatus: ErrandStatus;
|
|
897
916
|
invoice: {
|
|
898
917
|
invoiceStatus: string;
|
|
@@ -966,7 +985,6 @@ interface Errand {
|
|
|
966
985
|
courierBusinessId?: string;
|
|
967
986
|
pickupDetails: AddressDetails;
|
|
968
987
|
deliveryDetails: AddressDetails;
|
|
969
|
-
parcelSize: `${ParcelSize}`;
|
|
970
988
|
deliveryStatus: ErrandStatus | `${ErrandStatus}`;
|
|
971
989
|
paymentStatus: `${InvoiceStatus}`;
|
|
972
990
|
invoiceId?: string;
|
|
@@ -1022,7 +1040,6 @@ interface Errand {
|
|
|
1022
1040
|
feePaymentStatus?: `${FeePaymentStatus}`;
|
|
1023
1041
|
}
|
|
1024
1042
|
interface AggregatedErrand extends Errand {
|
|
1025
|
-
parcelSize: `${ParcelSize}`;
|
|
1026
1043
|
invoiceDetails: Invoice;
|
|
1027
1044
|
pickupLocation: {
|
|
1028
1045
|
cityId: string;
|
|
@@ -1063,12 +1080,6 @@ declare enum DeliveryStatus {
|
|
|
1063
1080
|
Delivered = "delivered",
|
|
1064
1081
|
Cancelled = "cancelled"
|
|
1065
1082
|
}
|
|
1066
|
-
declare enum ParcelSize {
|
|
1067
|
-
Bike = "bike",
|
|
1068
|
-
Large = "large",
|
|
1069
|
-
Medium = "medium",
|
|
1070
|
-
Small = "small"
|
|
1071
|
-
}
|
|
1072
1083
|
interface ErrandTimeline {
|
|
1073
1084
|
id: string;
|
|
1074
1085
|
errandId: string;
|
|
@@ -1138,7 +1149,6 @@ interface DraftErrand {
|
|
|
1138
1149
|
pickupDetails?: AddressDetails;
|
|
1139
1150
|
deliveryDetails?: AddressDetails;
|
|
1140
1151
|
additionalData?: string;
|
|
1141
|
-
parcelSize?: `${ParcelSize}`;
|
|
1142
1152
|
status: DraftErrandStatus;
|
|
1143
1153
|
convertedErrandId?: string;
|
|
1144
1154
|
settlementId?: string;
|
|
@@ -1713,4 +1723,4 @@ declare enum LinkDestination {
|
|
|
1713
1723
|
}
|
|
1714
1724
|
type NullOrUndefined = null | undefined;
|
|
1715
1725
|
|
|
1716
|
-
export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type BusinessFuelSettings, type BusinessMember, type BusinessModules, type BusinessPg, type BusinessPortal, type BusinessRiderPaySettings, BusinessRole, type BusinessSettings, BusinessStatus, type BusinessWhatsappConfig, type City, type Collection, type Customer, type CustomerAddress, type CustomerBilling, type CustomerTransactionStats, DEFAULT_BUSINESS_FUEL_SETTINGS, DEFAULT_BUSINESS_MODULES, DEFAULT_BUSINESS_RIDER_PAY_SETTINGS, DEFAULT_BUSINESS_SETTINGS, DeliveryStatus, type DraftErrand, DraftErrandStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, ErrandInvoiceState, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, type ExpensePaidBy, FeePaymentStatus, FeeSettlement, type FuelDueData, type FuelDueItem, FuelDueStatus, type FuelDueTotals, type FuelPercentSuggestion, type FuelSinceLastRefuel, type FuelSuggestionConfidence, type GeoPoint, GlobalRoles, type Invoice, type InvoiceDrift, type InvoiceEvent, InvoiceEventType, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, type InvoicePayment, InvoicePaymentMethod, InvoiceStatus, type LatLng, LinkDestination, type MaintenanceItem, type MaintenancePartUsage, type MaintenanceRecord, type MaintenanceStats, type MaintenanceStatsSummary, type MaintenanceTopItem, MembershipStatus, type Notification, type NotificationData, NotificationType, type NullOrUndefined, type OpeningHours, type PaginateResult,
|
|
1726
|
+
export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type BusinessFuelSettings, type BusinessMember, type BusinessModules, type BusinessPg, type BusinessPortal, type BusinessRiderPaySettings, BusinessRole, type BusinessSettings, BusinessStatus, type BusinessWhatsappConfig, type City, type Collection, type Customer, type CustomerAddress, type CustomerBilling, type CustomerTransactionStats, DEFAULT_BUSINESS_FUEL_SETTINGS, DEFAULT_BUSINESS_MODULES, DEFAULT_BUSINESS_RIDER_PAY_SETTINGS, DEFAULT_BUSINESS_SETTINGS, DeliveryStatus, type DraftErrand, DraftErrandStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, ErrandInvoiceState, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, type ExpensePaidBy, FeePaymentStatus, FeeSettlement, type FuelDueData, type FuelDueItem, FuelDueStatus, type FuelDueTotals, type FuelPercentSuggestion, type FuelSinceLastRefuel, type FuelSuggestionConfidence, type GeoPoint, GlobalRoles, type Invoice, type InvoiceDrift, type InvoiceEvent, InvoiceEventType, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, type InvoicePayment, InvoicePaymentMethod, InvoiceStatus, type LatLng, LinkDestination, type MaintenanceItem, type MaintenancePartUsage, type MaintenanceRecord, type MaintenanceStats, type MaintenanceStatsSummary, type MaintenanceTopItem, MembershipStatus, type Notification, type NotificationData, NotificationType, type NullOrUndefined, type OpeningHours, type PaginateResult, PaymentOptions, PayoutPeriodType, PayoutRateSource, type PendingErrand, type PortalHandleAvailability, PortalStatus, type Product, type ProductCategory, type ProductImage, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductTag, type ProductVariant, type ProductVariantPrice, type PublicPortal, type PublicPortalBusiness, RemittanceStatus, type Rider, type RiderPayout, type RiderPayoutAdjustment, type RiderPayoutPreview, type RiderPayoutPreviewItem, RiderPayoutStatus, type RiderPerformanceItem, type RiderPerformanceStats, type RiderPerformanceSummary, type RiderPerformanceTimeSeries, type RiderSettlement, type RiderWithUserDetails, RoleType, type State, SweepExclusionReason, type TrackerPosition, type Transaction, type TransactionCategory, type TransactionItem, type TransactionRiderUser, type TransactionType, type TransactionWithCategory, type TransactionWithJoin, type User, type UserAddress, type Vehicle, type VehicleErrandStats, type VehicleFuelStats, type VehicleLog, type VehicleLogStatsSummary, VehicleLogType, type VehicleLogWithErrands, type VehicleMaintenanceStats, type VehiclePerformanceData, type VehiclePerformanceFilters, type VehiclePerformanceItem, type VehiclePerformanceTotals, VehicleType, type VehicleWithRider, type Vendor, WhatsappButtonType, WhatsappComponentType, WhatsappEvent, WhatsappRecipient, type WhatsappSendLog, type WhatsappTemplate, type WhatsappTemplateButton, type WhatsappTemplateComponent, WhatsappTemplateMetaStatus, WhatsappTemplateParamSource, type WhatsappTemplateSource, errandTimeline };
|
package/dist/index.js
CHANGED
|
@@ -96,13 +96,6 @@ var DeliveryStatus = /* @__PURE__ */ ((DeliveryStatus2) => {
|
|
|
96
96
|
DeliveryStatus2["Cancelled"] = "cancelled";
|
|
97
97
|
return DeliveryStatus2;
|
|
98
98
|
})(DeliveryStatus || {});
|
|
99
|
-
var ParcelSize = /* @__PURE__ */ ((ParcelSize2) => {
|
|
100
|
-
ParcelSize2["Bike"] = "bike";
|
|
101
|
-
ParcelSize2["Large"] = "large";
|
|
102
|
-
ParcelSize2["Medium"] = "medium";
|
|
103
|
-
ParcelSize2["Small"] = "small";
|
|
104
|
-
return ParcelSize2;
|
|
105
|
-
})(ParcelSize || {});
|
|
106
99
|
var DraftErrandStatus = /* @__PURE__ */ ((DraftErrandStatus2) => {
|
|
107
100
|
DraftErrandStatus2["Draft"] = "draft";
|
|
108
101
|
DraftErrandStatus2["RiderCompleted"] = "rider_completed";
|
|
@@ -385,7 +378,6 @@ export {
|
|
|
385
378
|
LinkDestination,
|
|
386
379
|
MembershipStatus,
|
|
387
380
|
NotificationType,
|
|
388
|
-
ParcelSize,
|
|
389
381
|
PaymentOptions,
|
|
390
382
|
PayoutPeriodType,
|
|
391
383
|
PayoutRateSource,
|
package/package.json
CHANGED
package/src/delivery.ts
CHANGED
package/src/errand.ts
CHANGED
|
@@ -62,7 +62,6 @@ export interface PendingErrand {
|
|
|
62
62
|
_id: string;
|
|
63
63
|
rider: string;
|
|
64
64
|
customerId: string;
|
|
65
|
-
parcelSize: ParcelSize;
|
|
66
65
|
deliveryStatus: ErrandStatus;
|
|
67
66
|
invoice: {
|
|
68
67
|
invoiceStatus: string;
|
|
@@ -169,7 +168,6 @@ export interface Errand {
|
|
|
169
168
|
|
|
170
169
|
pickupDetails: AddressDetails;
|
|
171
170
|
deliveryDetails: AddressDetails;
|
|
172
|
-
parcelSize: `${ParcelSize}`;
|
|
173
171
|
deliveryStatus: ErrandStatus | `${ErrandStatus}`;
|
|
174
172
|
paymentStatus: `${InvoiceStatus}`;
|
|
175
173
|
invoiceId?: string;
|
|
@@ -241,7 +239,6 @@ export interface Errand {
|
|
|
241
239
|
}
|
|
242
240
|
|
|
243
241
|
export interface AggregatedErrand extends Errand {
|
|
244
|
-
parcelSize: `${ParcelSize}`;
|
|
245
242
|
invoiceDetails: Invoice;
|
|
246
243
|
pickupLocation: {
|
|
247
244
|
cityId: string;
|
|
@@ -301,13 +298,6 @@ export enum DeliveryStatus {
|
|
|
301
298
|
Cancelled = 'cancelled',
|
|
302
299
|
}
|
|
303
300
|
|
|
304
|
-
export enum ParcelSize {
|
|
305
|
-
Bike = 'bike',
|
|
306
|
-
Large = 'large',
|
|
307
|
-
Medium = 'medium',
|
|
308
|
-
Small = 'small',
|
|
309
|
-
}
|
|
310
|
-
|
|
311
301
|
export interface ErrandTimeline {
|
|
312
302
|
id: string;
|
|
313
303
|
errandId: string;
|
|
@@ -371,7 +361,6 @@ export interface DraftErrand {
|
|
|
371
361
|
pickupDetails?: AddressDetails;
|
|
372
362
|
deliveryDetails?: AddressDetails;
|
|
373
363
|
additionalData?: string;
|
|
374
|
-
parcelSize?: `${ParcelSize}`;
|
|
375
364
|
|
|
376
365
|
// Lifecycle
|
|
377
366
|
status: DraftErrandStatus;
|
package/src/rider.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// import { Enterprise } from './enterprise';
|
|
2
2
|
import { BusinessMember } from './business';
|
|
3
|
-
import { Errand } from './errand';
|
|
4
3
|
import { State } from './location';
|
|
5
4
|
import { User } from './user';
|
|
6
5
|
import type { Vehicle } from './vehicle';
|
|
@@ -48,14 +47,23 @@ export type Rider = {
|
|
|
48
47
|
// isTracking: boolean;
|
|
49
48
|
|
|
50
49
|
state?: string | State;
|
|
51
|
-
currentErrand?: Errand;
|
|
52
|
-
lastDeliveredErrand?: Errand;
|
|
53
50
|
};
|
|
54
51
|
|
|
55
52
|
export type RiderWithUserDetails = Rider & {
|
|
56
53
|
userDetails?: User;
|
|
57
54
|
vehicleDetails?: Vehicle | null;
|
|
58
55
|
businessMemberDetails?: BusinessMember;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* What the rider owes us: the sum of their pending (unremitted) settlements,
|
|
59
|
+
* scoped to the rider's own business. Same figure as the rider register's
|
|
60
|
+
* `cashOwed`.
|
|
61
|
+
*/
|
|
62
|
+
cashOwed?: number;
|
|
63
|
+
/** How many pending settlements make up `cashOwed`. */
|
|
64
|
+
unremittedSettlements?: number;
|
|
65
|
+
/** When the oldest of those settlements was raised — null when none are. */
|
|
66
|
+
oldestUnremittedAt?: Date | null;
|
|
59
67
|
};
|
|
60
68
|
|
|
61
69
|
// Rider Settlement Types
|
|
@@ -216,6 +224,15 @@ export interface RiderPayoutPreviewItem {
|
|
|
216
224
|
/** Set when a payout for this rider and the same period already exists. */
|
|
217
225
|
existingPayoutId?: string;
|
|
218
226
|
existingPayoutStatus?: RiderPayoutStatus | `${RiderPayoutStatus}`;
|
|
227
|
+
/**
|
|
228
|
+
* Errands in the period this rider has not marked delivered (and that are not
|
|
229
|
+
* cancelled). NOT included in `grossEarnings` or `payoutAmount` — riders are
|
|
230
|
+
* paid for delivered work only. Surfaced so the gap can be chased before
|
|
231
|
+
* payroll is committed, since an unmarked errand otherwise misses every
|
|
232
|
+
* payout silently.
|
|
233
|
+
*/
|
|
234
|
+
undeliveredCount: number;
|
|
235
|
+
undeliveredAmount: number;
|
|
219
236
|
}
|
|
220
237
|
|
|
221
238
|
export interface RiderPayoutPreview {
|
|
@@ -229,6 +246,9 @@ export interface RiderPayoutPreview {
|
|
|
229
246
|
totalPayoutAmount: number;
|
|
230
247
|
/** Riders skipped because no percentage is configured for them. */
|
|
231
248
|
unratedRiderCount: number;
|
|
249
|
+
/** Totals of the non-paying undelivered figure. See the item type. */
|
|
250
|
+
totalUndeliveredErrands: number;
|
|
251
|
+
totalUndeliveredAmount: number;
|
|
232
252
|
};
|
|
233
253
|
riders: RiderPayoutPreviewItem[];
|
|
234
254
|
}
|