@mydoormot/app-types 1.7.29 → 1.7.31

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.
@@ -1,18 +1,18 @@
1
-
2
- > @mydoormot/app-types@1.7.28 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
- ESM dist/index.js 7.13 KB
12
- ESM ⚡️ Build success in 64ms
13
- CJS dist/index.cjs 8.99 KB
14
- CJS ⚡️ Build success in 64ms
15
- DTS Build start
16
- DTS ⚡️ Build success in 872ms
17
- DTS dist/index.d.ts 26.76 KB
18
- DTS dist/index.d.cts 26.76 KB
1
+
2
+ > @mydoormot/app-types@1.7.30 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
+ DTS Build start
12
+ CJS dist/index.cjs 9.00 KB
13
+ CJS ⚡️ Build success in 272ms
14
+ ESM dist/index.js 7.15 KB
15
+ ESM ⚡️ Build success in 272ms
16
+ DTS ⚡️ Build success in 668ms
17
+ DTS dist/index.d.ts 27.96 KB
18
+ DTS dist/index.d.cts 27.96 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @mydoormot/app-types
2
2
 
3
+ ## 1.7.31
4
+
5
+ ### Patch Changes
6
+
7
+ - Modified errand app types
8
+
9
+ ## 1.7.30
10
+
11
+ ### Patch Changes
12
+
13
+ - Refactored vehicle types
14
+
3
15
  ## 1.7.29
4
16
 
5
17
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -167,7 +167,7 @@ var NotificationType = /* @__PURE__ */ ((NotificationType2) => {
167
167
  return NotificationType2;
168
168
  })(NotificationType || {});
169
169
 
170
- // src/rider.ts
170
+ // src/vehicle.ts
171
171
  var VehicleType = /* @__PURE__ */ ((VehicleType2) => {
172
172
  VehicleType2["Bike"] = "bike";
173
173
  VehicleType2["Shuttle"] = "shuttle";
@@ -177,6 +177,8 @@ var VehicleLogType = /* @__PURE__ */ ((VehicleLogType2) => {
177
177
  VehicleLogType2["REFUEL"] = "REFUEL";
178
178
  return VehicleLogType2;
179
179
  })(VehicleLogType || {});
180
+
181
+ // src/rider.ts
180
182
  var RemittanceStatus = /* @__PURE__ */ ((RemittanceStatus2) => {
181
183
  RemittanceStatus2["Pending"] = "pending";
182
184
  RemittanceStatus2["Remitted"] = "remitted";
package/dist/index.d.cts CHANGED
@@ -72,7 +72,6 @@ type User = {
72
72
  accountType?: 'business' | 'personal';
73
73
  hasOnboarded?: boolean;
74
74
  lastActivity?: string;
75
- isManaged?: boolean;
76
75
  lastLoggedInBusinessId?: string;
77
76
  globalRole: GlobalRoles | `${GlobalRoles}`;
78
77
  isActive?: boolean;
@@ -180,25 +179,6 @@ interface InvoiceItem {
180
179
  itemDetails?: Errand;
181
180
  }
182
181
 
183
- type Rider = {
184
- id: string;
185
- userId: string;
186
- vehicleId?: string;
187
- currLocation: {
188
- coordinates: number[];
189
- };
190
- vehicleNumber?: string;
191
- verified: boolean;
192
- active: boolean;
193
- updatedAt: Date;
194
- createdAt: Date;
195
- rating: number;
196
- version: number;
197
- hasBeenRated: boolean;
198
- state?: string | State;
199
- currentErrand?: Errand;
200
- lastDeliveredErrand?: Errand;
201
- };
202
182
  declare enum VehicleType {
203
183
  Bike = "bike",
204
184
  Shuttle = "shuttle"
@@ -214,9 +194,6 @@ type Vehicle = {
214
194
  shortName?: string;
215
195
  userId?: string;
216
196
  };
217
- type RiderWithUserDetails = Rider & {
218
- userDetails?: User;
219
- };
220
197
  type VehicleWithRider = Vehicle & {
221
198
  riders: RiderWithUserDetails[];
222
199
  };
@@ -235,12 +212,75 @@ type VehicleLog = {
235
212
  updatedAt: string;
236
213
  previousLogId?: string;
237
214
  errandIdsSinceLastRefuel?: string[];
215
+ lastRecalculatedAt?: string;
238
216
  vehicleDetails?: Vehicle;
239
217
  };
240
218
  type VehicleLogWithErrands = VehicleLog & {
241
219
  errandsCount?: number;
242
220
  totalErrandsRevenue?: number;
243
221
  };
222
+ interface VehicleErrandStats {
223
+ count: number;
224
+ totalRevenue: number;
225
+ }
226
+ interface VehicleFuelStats {
227
+ totalCost: number;
228
+ totalLiters: number;
229
+ refuelCount: number;
230
+ }
231
+ interface VehicleMaintenanceStats {
232
+ totalCost: number;
233
+ recordCount: number;
234
+ }
235
+ interface VehiclePerformanceItem {
236
+ vehicleId: string;
237
+ vehicleNumber: string;
238
+ shortName: string | null;
239
+ errands: VehicleErrandStats;
240
+ fuel: VehicleFuelStats;
241
+ maintenance: VehicleMaintenanceStats;
242
+ netProfit: number;
243
+ }
244
+ interface VehiclePerformanceTotals {
245
+ totalRevenue: number;
246
+ totalFuelCost: number;
247
+ totalMaintenanceCost: number;
248
+ netProfit: number;
249
+ }
250
+ interface VehiclePerformanceFilters {
251
+ businessId: string;
252
+ vehicleId: string | null;
253
+ startDate: string | null;
254
+ endDate: string | null;
255
+ }
256
+ interface VehiclePerformanceData {
257
+ vehicles: VehiclePerformanceItem[];
258
+ totals: VehiclePerformanceTotals;
259
+ filters: VehiclePerformanceFilters;
260
+ }
261
+
262
+ type Rider = {
263
+ id: string;
264
+ userId: string;
265
+ vehicleId?: string;
266
+ currLocation: {
267
+ coordinates: number[];
268
+ };
269
+ vehicleNumber?: string;
270
+ verified: boolean;
271
+ active: boolean;
272
+ updatedAt: Date;
273
+ createdAt: Date;
274
+ rating: number;
275
+ version: number;
276
+ hasBeenRated: boolean;
277
+ state?: string | State;
278
+ currentErrand?: Errand;
279
+ lastDeliveredErrand?: Errand;
280
+ };
281
+ type RiderWithUserDetails = Rider & {
282
+ userDetails?: User;
283
+ };
244
284
  declare enum RemittanceStatus {
245
285
  Pending = "pending",
246
286
  Remitted = "remitted",
@@ -402,6 +442,7 @@ interface Errand {
402
442
  userDetails?: User;
403
443
  courierBusinessDetails?: Business;
404
444
  riderDetails?: Rider;
445
+ vehicleDetails?: Vehicle;
405
446
  }
406
447
  interface AggregatedErrand extends Errand {
407
448
  parcelSize: `${ParcelSize}`;
@@ -628,7 +669,6 @@ interface Business {
628
669
  updatedAt: string | NullOrUndefined | Date;
629
670
  verifiedAt: string | NullOrUndefined | Date;
630
671
  registrationCompletedAt: string | NullOrUndefined | Date;
631
- isManaged: boolean | NullOrUndefined;
632
672
  businessCategoryDetails: BusinessCategory | NullOrUndefined;
633
673
  capabilities: BusinessCapability[] | NullOrUndefined;
634
674
  }
@@ -835,6 +875,9 @@ interface TransactionItem {
835
875
  quantity: number;
836
876
  unitPrice: number;
837
877
  totalPrice: number;
878
+ productId?: string;
879
+ variantId?: string;
880
+ isAddon?: boolean;
838
881
  }
839
882
  interface Transaction {
840
883
  id: string;
@@ -1047,4 +1090,4 @@ declare enum LinkDestination {
1047
1090
  }
1048
1091
  type NullOrUndefined = null | undefined;
1049
1092
 
1050
- export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessMember, type BusinessPg, BusinessRole, type City, type Collection, type Coupon, type Customer, type CustomerTransactionStats, DeliveryStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, 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 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, SettlementType, type State, type TraccarDevice, TraccarDeviceStatus, type TraccarPosition, type TrackerDevice, type Transaction, type TransactionCategory, type TransactionItem, type TransactionType, type TransactionWithCategory, type TransactionWithJoin, type User, type UserAddress, type Vehicle, type VehicleLog, type VehicleLogStatsSummary, VehicleLogType, type VehicleLogWithErrands, VehicleType, type VehicleWithRider, type Vendor, errandTimeline };
1093
+ export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessMember, type BusinessPg, BusinessRole, type City, type Collection, type Coupon, type Customer, type CustomerTransactionStats, DeliveryStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, 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 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, SettlementType, type State, type TraccarDevice, TraccarDeviceStatus, type TraccarPosition, type TrackerDevice, 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, errandTimeline };
package/dist/index.d.ts CHANGED
@@ -72,7 +72,6 @@ type User = {
72
72
  accountType?: 'business' | 'personal';
73
73
  hasOnboarded?: boolean;
74
74
  lastActivity?: string;
75
- isManaged?: boolean;
76
75
  lastLoggedInBusinessId?: string;
77
76
  globalRole: GlobalRoles | `${GlobalRoles}`;
78
77
  isActive?: boolean;
@@ -180,25 +179,6 @@ interface InvoiceItem {
180
179
  itemDetails?: Errand;
181
180
  }
182
181
 
183
- type Rider = {
184
- id: string;
185
- userId: string;
186
- vehicleId?: string;
187
- currLocation: {
188
- coordinates: number[];
189
- };
190
- vehicleNumber?: string;
191
- verified: boolean;
192
- active: boolean;
193
- updatedAt: Date;
194
- createdAt: Date;
195
- rating: number;
196
- version: number;
197
- hasBeenRated: boolean;
198
- state?: string | State;
199
- currentErrand?: Errand;
200
- lastDeliveredErrand?: Errand;
201
- };
202
182
  declare enum VehicleType {
203
183
  Bike = "bike",
204
184
  Shuttle = "shuttle"
@@ -214,9 +194,6 @@ type Vehicle = {
214
194
  shortName?: string;
215
195
  userId?: string;
216
196
  };
217
- type RiderWithUserDetails = Rider & {
218
- userDetails?: User;
219
- };
220
197
  type VehicleWithRider = Vehicle & {
221
198
  riders: RiderWithUserDetails[];
222
199
  };
@@ -235,12 +212,75 @@ type VehicleLog = {
235
212
  updatedAt: string;
236
213
  previousLogId?: string;
237
214
  errandIdsSinceLastRefuel?: string[];
215
+ lastRecalculatedAt?: string;
238
216
  vehicleDetails?: Vehicle;
239
217
  };
240
218
  type VehicleLogWithErrands = VehicleLog & {
241
219
  errandsCount?: number;
242
220
  totalErrandsRevenue?: number;
243
221
  };
222
+ interface VehicleErrandStats {
223
+ count: number;
224
+ totalRevenue: number;
225
+ }
226
+ interface VehicleFuelStats {
227
+ totalCost: number;
228
+ totalLiters: number;
229
+ refuelCount: number;
230
+ }
231
+ interface VehicleMaintenanceStats {
232
+ totalCost: number;
233
+ recordCount: number;
234
+ }
235
+ interface VehiclePerformanceItem {
236
+ vehicleId: string;
237
+ vehicleNumber: string;
238
+ shortName: string | null;
239
+ errands: VehicleErrandStats;
240
+ fuel: VehicleFuelStats;
241
+ maintenance: VehicleMaintenanceStats;
242
+ netProfit: number;
243
+ }
244
+ interface VehiclePerformanceTotals {
245
+ totalRevenue: number;
246
+ totalFuelCost: number;
247
+ totalMaintenanceCost: number;
248
+ netProfit: number;
249
+ }
250
+ interface VehiclePerformanceFilters {
251
+ businessId: string;
252
+ vehicleId: string | null;
253
+ startDate: string | null;
254
+ endDate: string | null;
255
+ }
256
+ interface VehiclePerformanceData {
257
+ vehicles: VehiclePerformanceItem[];
258
+ totals: VehiclePerformanceTotals;
259
+ filters: VehiclePerformanceFilters;
260
+ }
261
+
262
+ type Rider = {
263
+ id: string;
264
+ userId: string;
265
+ vehicleId?: string;
266
+ currLocation: {
267
+ coordinates: number[];
268
+ };
269
+ vehicleNumber?: string;
270
+ verified: boolean;
271
+ active: boolean;
272
+ updatedAt: Date;
273
+ createdAt: Date;
274
+ rating: number;
275
+ version: number;
276
+ hasBeenRated: boolean;
277
+ state?: string | State;
278
+ currentErrand?: Errand;
279
+ lastDeliveredErrand?: Errand;
280
+ };
281
+ type RiderWithUserDetails = Rider & {
282
+ userDetails?: User;
283
+ };
244
284
  declare enum RemittanceStatus {
245
285
  Pending = "pending",
246
286
  Remitted = "remitted",
@@ -402,6 +442,7 @@ interface Errand {
402
442
  userDetails?: User;
403
443
  courierBusinessDetails?: Business;
404
444
  riderDetails?: Rider;
445
+ vehicleDetails?: Vehicle;
405
446
  }
406
447
  interface AggregatedErrand extends Errand {
407
448
  parcelSize: `${ParcelSize}`;
@@ -628,7 +669,6 @@ interface Business {
628
669
  updatedAt: string | NullOrUndefined | Date;
629
670
  verifiedAt: string | NullOrUndefined | Date;
630
671
  registrationCompletedAt: string | NullOrUndefined | Date;
631
- isManaged: boolean | NullOrUndefined;
632
672
  businessCategoryDetails: BusinessCategory | NullOrUndefined;
633
673
  capabilities: BusinessCapability[] | NullOrUndefined;
634
674
  }
@@ -835,6 +875,9 @@ interface TransactionItem {
835
875
  quantity: number;
836
876
  unitPrice: number;
837
877
  totalPrice: number;
878
+ productId?: string;
879
+ variantId?: string;
880
+ isAddon?: boolean;
838
881
  }
839
882
  interface Transaction {
840
883
  id: string;
@@ -1047,4 +1090,4 @@ declare enum LinkDestination {
1047
1090
  }
1048
1091
  type NullOrUndefined = null | undefined;
1049
1092
 
1050
- export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessMember, type BusinessPg, BusinessRole, type City, type Collection, type Coupon, type Customer, type CustomerTransactionStats, DeliveryStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, 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 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, SettlementType, type State, type TraccarDevice, TraccarDeviceStatus, type TraccarPosition, type TrackerDevice, type Transaction, type TransactionCategory, type TransactionItem, type TransactionType, type TransactionWithCategory, type TransactionWithJoin, type User, type UserAddress, type Vehicle, type VehicleLog, type VehicleLogStatsSummary, VehicleLogType, type VehicleLogWithErrands, VehicleType, type VehicleWithRider, type Vendor, errandTimeline };
1093
+ export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessMember, type BusinessPg, BusinessRole, type City, type Collection, type Coupon, type Customer, type CustomerTransactionStats, DeliveryStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, 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 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, SettlementType, type State, type TraccarDevice, TraccarDeviceStatus, type TraccarPosition, type TrackerDevice, 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, errandTimeline };
package/dist/index.js CHANGED
@@ -119,7 +119,7 @@ var NotificationType = /* @__PURE__ */ ((NotificationType2) => {
119
119
  return NotificationType2;
120
120
  })(NotificationType || {});
121
121
 
122
- // src/rider.ts
122
+ // src/vehicle.ts
123
123
  var VehicleType = /* @__PURE__ */ ((VehicleType2) => {
124
124
  VehicleType2["Bike"] = "bike";
125
125
  VehicleType2["Shuttle"] = "shuttle";
@@ -129,6 +129,8 @@ var VehicleLogType = /* @__PURE__ */ ((VehicleLogType2) => {
129
129
  VehicleLogType2["REFUEL"] = "REFUEL";
130
130
  return VehicleLogType2;
131
131
  })(VehicleLogType || {});
132
+
133
+ // src/rider.ts
132
134
  var RemittanceStatus = /* @__PURE__ */ ((RemittanceStatus2) => {
133
135
  RemittanceStatus2["Pending"] = "pending";
134
136
  RemittanceStatus2["Remitted"] = "remitted";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mydoormot/app-types",
3
- "version": "1.7.29",
3
+ "version": "1.7.31",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
package/src/business.ts CHANGED
@@ -40,7 +40,6 @@ export interface Business {
40
40
  updatedAt: string | NullOrUndefined | Date;
41
41
  verifiedAt: string | NullOrUndefined | Date;
42
42
  registrationCompletedAt: string | NullOrUndefined | Date;
43
- isManaged: boolean | NullOrUndefined;
44
43
  businessCategoryDetails: BusinessCategory | NullOrUndefined;
45
44
  capabilities: BusinessCapability[] | NullOrUndefined;
46
45
  }
package/src/errand.ts CHANGED
@@ -4,6 +4,7 @@ import { Invoice, InvoiceStatus } from './invoice';
4
4
  import { City } from './location';
5
5
  import { Rider } from './rider';
6
6
  import { User } from './user';
7
+ import { Vehicle } from './vehicle';
7
8
 
8
9
  export enum ErrandStatus {
9
10
  Pending = 'pending',
@@ -163,7 +164,7 @@ export interface Errand {
163
164
 
164
165
  // new fields
165
166
  riderDetails?: Rider;
166
- // vehicleDetails?: Vehicle;
167
+ vehicleDetails?: Vehicle;
167
168
  }
168
169
 
169
170
  export interface AggregatedErrand extends Errand {
package/src/index.ts CHANGED
@@ -28,6 +28,7 @@ export * from './location';
28
28
  export * from './invoice';
29
29
  export * from './notification';
30
30
  export * from './rider';
31
+ export * from './vehicle';
31
32
  export * from './enterprise';
32
33
  export * from './coupon';
33
34
  export * from './business';
package/src/rider.ts CHANGED
@@ -3,6 +3,10 @@ import { Errand } from './errand';
3
3
  import { State } from './location';
4
4
  import { User } from './user';
5
5
 
6
+ // Re-export vehicle types for backwards compatibility
7
+ export type { Vehicle, VehicleWithRider, VehicleLog, VehicleLogWithErrands } from './vehicle';
8
+ export { VehicleType, VehicleLogType } from './vehicle';
9
+
6
10
  export type Rider = {
7
11
  id: string;
8
12
  userId: string;
@@ -29,56 +33,10 @@ export type Rider = {
29
33
  lastDeliveredErrand?: Errand;
30
34
  };
31
35
 
32
- export enum VehicleType {
33
- Bike = 'bike',
34
- Shuttle = 'shuttle',
35
- }
36
-
37
- export type Vehicle = {
38
- id: string;
39
- vehicleNumber: string;
40
- version: number;
41
- createdAt: string;
42
- updatedAt: string;
43
- vehicleType: VehicleType | `${VehicleType}`;
44
- businessId: string;
45
-
46
- shortName?: string;
47
- userId?: string;
48
- };
49
-
50
36
  export type RiderWithUserDetails = Rider & {
51
37
  userDetails?: User;
52
38
  };
53
39
 
54
- export type VehicleWithRider = Vehicle & {
55
- riders: RiderWithUserDetails[];
56
- };
57
-
58
- export enum VehicleLogType {
59
- REFUEL = 'REFUEL',
60
- }
61
-
62
- export type VehicleLog = {
63
- id: string;
64
- vehicleId: string;
65
- businessId: string;
66
- type: VehicleLogType | `${VehicleLogType}`;
67
- fuelLiters?: number;
68
- fuelCost?: number;
69
- note?: string;
70
- createdAt: string;
71
- updatedAt: string;
72
- previousLogId?: string;
73
- errandIdsSinceLastRefuel?: string[];
74
- vehicleDetails?: Vehicle;
75
- };
76
-
77
- export type VehicleLogWithErrands = VehicleLog & {
78
- errandsCount?: number;
79
- totalErrandsRevenue?: number;
80
- };
81
-
82
40
  // Rider Settlement Types
83
41
  export enum RemittanceStatus {
84
42
  Pending = 'pending',
@@ -7,6 +7,9 @@ export interface TransactionItem {
7
7
  quantity: number;
8
8
  unitPrice: number;
9
9
  totalPrice: number;
10
+ productId?: string;
11
+ variantId?: string;
12
+ isAddon?: boolean;
10
13
  }
11
14
 
12
15
  export interface Transaction {
package/src/user.ts CHANGED
@@ -44,7 +44,6 @@ export type User = {
44
44
  accountType?: 'business' | 'personal';
45
45
  hasOnboarded?: boolean;
46
46
  lastActivity?: string;
47
- isManaged?: boolean;
48
47
  lastLoggedInBusinessId?: string;
49
48
  globalRole: GlobalRoles | `${GlobalRoles}`;
50
49
  isActive?: boolean;
package/src/vehicle.ts ADDED
@@ -0,0 +1,95 @@
1
+ import { RiderWithUserDetails } from './rider';
2
+
3
+ export enum VehicleType {
4
+ Bike = 'bike',
5
+ Shuttle = 'shuttle',
6
+ }
7
+
8
+ export type Vehicle = {
9
+ id: string;
10
+ vehicleNumber: string;
11
+ version: number;
12
+ createdAt: string;
13
+ updatedAt: string;
14
+ vehicleType: VehicleType | `${VehicleType}`;
15
+ businessId: string;
16
+
17
+ shortName?: string;
18
+ userId?: string;
19
+ };
20
+
21
+ export type VehicleWithRider = Vehicle & {
22
+ riders: RiderWithUserDetails[];
23
+ };
24
+
25
+ export enum VehicleLogType {
26
+ REFUEL = 'REFUEL',
27
+ }
28
+
29
+ export type VehicleLog = {
30
+ id: string;
31
+ vehicleId: string;
32
+ businessId: string;
33
+ type: VehicleLogType | `${VehicleLogType}`;
34
+ fuelLiters?: number;
35
+ fuelCost?: number;
36
+ note?: string;
37
+ createdAt: string;
38
+ updatedAt: string;
39
+ previousLogId?: string;
40
+ errandIdsSinceLastRefuel?: string[];
41
+ lastRecalculatedAt?: string;
42
+ vehicleDetails?: Vehicle;
43
+ };
44
+
45
+ export type VehicleLogWithErrands = VehicleLog & {
46
+ errandsCount?: number;
47
+ totalErrandsRevenue?: number;
48
+ };
49
+
50
+ // Vehicle Performance Types
51
+ export interface VehicleErrandStats {
52
+ count: number;
53
+ totalRevenue: number;
54
+ }
55
+
56
+ export interface VehicleFuelStats {
57
+ totalCost: number;
58
+ totalLiters: number;
59
+ refuelCount: number;
60
+ }
61
+
62
+ export interface VehicleMaintenanceStats {
63
+ totalCost: number;
64
+ recordCount: number;
65
+ }
66
+
67
+ export interface VehiclePerformanceItem {
68
+ vehicleId: string;
69
+ vehicleNumber: string;
70
+ shortName: string | null;
71
+ errands: VehicleErrandStats;
72
+ fuel: VehicleFuelStats;
73
+ maintenance: VehicleMaintenanceStats;
74
+ netProfit: number;
75
+ }
76
+
77
+ export interface VehiclePerformanceTotals {
78
+ totalRevenue: number;
79
+ totalFuelCost: number;
80
+ totalMaintenanceCost: number;
81
+ netProfit: number;
82
+ }
83
+
84
+ export interface VehiclePerformanceFilters {
85
+ businessId: string;
86
+ vehicleId: string | null;
87
+ startDate: string | null;
88
+ endDate: string | null;
89
+ }
90
+
91
+ export interface VehiclePerformanceData {
92
+ vehicles: VehiclePerformanceItem[];
93
+ totals: VehiclePerformanceTotals;
94
+ filters: VehiclePerformanceFilters;
95
+ }