@mydoormot/app-types 1.9.1 → 1.9.2

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,5 +1,5 @@
1
1
 
2
- > @mydoormot/app-types@1.9.0 build /Users/chuksben/Desktop/projects/microservices/mydoormot/packages/app-types
2
+ > @mydoormot/app-types@1.9.1 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 @@
8
8
  CLI Target: es2021
9
9
  ESM Build start
10
10
  CJS Build start
11
+ ESM dist/index.js 13.48 KB
12
+ ESM ⚡️ Build success in 55ms
13
+ CJS dist/index.cjs 16.12 KB
14
+ CJS ⚡️ Build success in 55ms
11
15
  DTS Build start
12
- CJS dist/index.cjs 15.79 KB
13
- CJS ⚡️ Build success in 301ms
14
- ESM dist/index.js 13.19 KB
15
- ESM ⚡️ Build success in 301ms
16
- DTS ⚡️ Build success in 931ms
17
- DTS dist/index.d.ts 40.67 KB
18
- DTS dist/index.d.cts 40.67 KB
16
+ DTS ⚡️ Build success in 635ms
17
+ DTS dist/index.d.ts 41.80 KB
18
+ DTS dist/index.d.cts 41.80 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @mydoormot/app-types
2
2
 
3
+ ## 1.9.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Modified transactions
8
+
3
9
  ## 1.9.1
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -31,6 +31,7 @@ __export(src_exports, {
31
31
  DeliveryStatus: () => DeliveryStatus,
32
32
  DraftErrandStatus: () => DraftErrandStatus,
33
33
  EnterpriseType: () => EnterpriseType,
34
+ ErrandInvoiceState: () => ErrandInvoiceState,
34
35
  ErrandStatus: () => ErrandStatus,
35
36
  FeePaymentStatus: () => FeePaymentStatus,
36
37
  FeeSettlement: () => FeeSettlement,
@@ -141,6 +142,12 @@ var FeeSettlement = /* @__PURE__ */ ((FeeSettlement2) => {
141
142
  FeeSettlement2["Owed"] = "owed";
142
143
  return FeeSettlement2;
143
144
  })(FeeSettlement || {});
145
+ var ErrandInvoiceState = /* @__PURE__ */ ((ErrandInvoiceState2) => {
146
+ ErrandInvoiceState2["Unbilled"] = "unbilled";
147
+ ErrandInvoiceState2["Invoiced"] = "invoiced";
148
+ ErrandInvoiceState2["Excluded"] = "excluded";
149
+ return ErrandInvoiceState2;
150
+ })(ErrandInvoiceState || {});
144
151
  var AddressTypes = /* @__PURE__ */ ((AddressTypes2) => {
145
152
  AddressTypes2["DeliveryAddress"] = "deliveryAddress";
146
153
  AddressTypes2["PickupAddress"] = "pickupAddress";
@@ -398,6 +405,7 @@ var LinkDestination = /* @__PURE__ */ ((LinkDestination2) => {
398
405
  DeliveryStatus,
399
406
  DraftErrandStatus,
400
407
  EnterpriseType,
408
+ ErrandInvoiceState,
401
409
  ErrandStatus,
402
410
  FeePaymentStatus,
403
411
  FeeSettlement,
package/dist/index.d.cts CHANGED
@@ -138,7 +138,13 @@ interface Customer {
138
138
  * earliest member.
139
139
  */
140
140
  interface CustomerBilling {
141
+ /**
142
+ * What is still owed on work that has not reached a statement — net of
143
+ * anything already paid on those errands, which is why it can be smaller than
144
+ * the sum of their prices.
145
+ */
141
146
  unbilledAmount: number;
147
+ /** How many errands are not on a statement yet, paid ones included. */
142
148
  unbilledCount: number;
143
149
  oldestUnbilledAt: string | null;
144
150
  outstandingAmount: number;
@@ -332,6 +338,12 @@ interface Business {
332
338
  registrationCompleted: boolean | NullOrUndefined;
333
339
  stateId: string | NullOrUndefined;
334
340
  cityId: string | NullOrUndefined;
341
+ /**
342
+ * IANA zone the business's own calendar runs on — the clock its reports are cut
343
+ * against, so a 23:30 errand lands on the day the operator worked it rather than
344
+ * on whatever day it was in UTC. Unset means the platform default, Africa/Lagos.
345
+ */
346
+ timezone: string | NullOrUndefined;
335
347
  originalLogoUrl: string | NullOrUndefined;
336
348
  logoUrl: string | NullOrUndefined;
337
349
  logoBlurHash: string | NullOrUndefined;
@@ -726,6 +738,11 @@ declare enum FeeSettlement {
726
738
  Invoice = "invoice",
727
739
  Owed = "owed"
728
740
  }
741
+ declare enum ErrandInvoiceState {
742
+ Unbilled = "unbilled",
743
+ Invoiced = "invoiced",
744
+ Excluded = "excluded"
745
+ }
729
746
  type ExpensePaidBy = 'rider' | 'company' | 'customer';
730
747
  interface Errand {
731
748
  id: string;
@@ -1181,6 +1198,12 @@ interface TransactionItem {
1181
1198
  variantId?: string;
1182
1199
  isAddon?: boolean;
1183
1200
  }
1201
+ /**
1202
+ * Rider user attached to a transaction — the same `riderUserDetails` field the
1203
+ * errand types carry, narrowed to what the UI needs to label an expense with
1204
+ * its rider. Derived from User so it can't drift from the canonical shape.
1205
+ */
1206
+ type TransactionRiderUser = Pick<User, 'id' | 'firstName' | 'lastName' | 'mobileNumber' | 'avatarUrl'>;
1184
1207
  interface Transaction {
1185
1208
  id: string;
1186
1209
  type: TransactionType;
@@ -1194,6 +1217,7 @@ interface Transaction {
1194
1217
  categoryId?: string;
1195
1218
  customerId?: string;
1196
1219
  riderId?: string;
1220
+ riderUserDetails?: TransactionRiderUser | null;
1197
1221
  items?: TransactionItem[];
1198
1222
  customerDetails?: Customer;
1199
1223
  }
@@ -1477,4 +1501,4 @@ declare enum LinkDestination {
1477
1501
  }
1478
1502
  type NullOrUndefined = null | undefined;
1479
1503
 
1480
- 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, type BusinessPortal, BusinessRole, type BusinessSettings, BusinessStatus, type BusinessWhatsappConfig, type City, type Collection, type Customer, type CustomerAddress, type CustomerBilling, 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, type InvoiceDrift, type InvoiceEvent, InvoiceEventType, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, type InvoicePayment, InvoicePaymentMethod, type InvoiceStatementLink, 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 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 RiderPerformanceItem, type RiderPerformanceStats, type RiderPerformanceSummary, type RiderPerformanceTimeSeries, type RiderSettlement, type RiderWithUserDetails, RoleType, type State, SweepExclusionReason, 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 };
1504
+ 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, type BusinessPortal, BusinessRole, type BusinessSettings, BusinessStatus, type BusinessWhatsappConfig, type City, type Collection, type Customer, type CustomerAddress, type CustomerBilling, type CustomerTransactionStats, DEFAULT_BUSINESS_MODULES, 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 GeoPoint, GlobalRoles, type Invoice, type InvoiceDrift, type InvoiceEvent, InvoiceEventType, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, type InvoicePayment, InvoicePaymentMethod, type InvoiceStatementLink, 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 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 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
@@ -138,7 +138,13 @@ interface Customer {
138
138
  * earliest member.
139
139
  */
140
140
  interface CustomerBilling {
141
+ /**
142
+ * What is still owed on work that has not reached a statement — net of
143
+ * anything already paid on those errands, which is why it can be smaller than
144
+ * the sum of their prices.
145
+ */
141
146
  unbilledAmount: number;
147
+ /** How many errands are not on a statement yet, paid ones included. */
142
148
  unbilledCount: number;
143
149
  oldestUnbilledAt: string | null;
144
150
  outstandingAmount: number;
@@ -332,6 +338,12 @@ interface Business {
332
338
  registrationCompleted: boolean | NullOrUndefined;
333
339
  stateId: string | NullOrUndefined;
334
340
  cityId: string | NullOrUndefined;
341
+ /**
342
+ * IANA zone the business's own calendar runs on — the clock its reports are cut
343
+ * against, so a 23:30 errand lands on the day the operator worked it rather than
344
+ * on whatever day it was in UTC. Unset means the platform default, Africa/Lagos.
345
+ */
346
+ timezone: string | NullOrUndefined;
335
347
  originalLogoUrl: string | NullOrUndefined;
336
348
  logoUrl: string | NullOrUndefined;
337
349
  logoBlurHash: string | NullOrUndefined;
@@ -726,6 +738,11 @@ declare enum FeeSettlement {
726
738
  Invoice = "invoice",
727
739
  Owed = "owed"
728
740
  }
741
+ declare enum ErrandInvoiceState {
742
+ Unbilled = "unbilled",
743
+ Invoiced = "invoiced",
744
+ Excluded = "excluded"
745
+ }
729
746
  type ExpensePaidBy = 'rider' | 'company' | 'customer';
730
747
  interface Errand {
731
748
  id: string;
@@ -1181,6 +1198,12 @@ interface TransactionItem {
1181
1198
  variantId?: string;
1182
1199
  isAddon?: boolean;
1183
1200
  }
1201
+ /**
1202
+ * Rider user attached to a transaction — the same `riderUserDetails` field the
1203
+ * errand types carry, narrowed to what the UI needs to label an expense with
1204
+ * its rider. Derived from User so it can't drift from the canonical shape.
1205
+ */
1206
+ type TransactionRiderUser = Pick<User, 'id' | 'firstName' | 'lastName' | 'mobileNumber' | 'avatarUrl'>;
1184
1207
  interface Transaction {
1185
1208
  id: string;
1186
1209
  type: TransactionType;
@@ -1194,6 +1217,7 @@ interface Transaction {
1194
1217
  categoryId?: string;
1195
1218
  customerId?: string;
1196
1219
  riderId?: string;
1220
+ riderUserDetails?: TransactionRiderUser | null;
1197
1221
  items?: TransactionItem[];
1198
1222
  customerDetails?: Customer;
1199
1223
  }
@@ -1477,4 +1501,4 @@ declare enum LinkDestination {
1477
1501
  }
1478
1502
  type NullOrUndefined = null | undefined;
1479
1503
 
1480
- 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, type BusinessPortal, BusinessRole, type BusinessSettings, BusinessStatus, type BusinessWhatsappConfig, type City, type Collection, type Customer, type CustomerAddress, type CustomerBilling, 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, type InvoiceDrift, type InvoiceEvent, InvoiceEventType, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, type InvoicePayment, InvoicePaymentMethod, type InvoiceStatementLink, 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 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 RiderPerformanceItem, type RiderPerformanceStats, type RiderPerformanceSummary, type RiderPerformanceTimeSeries, type RiderSettlement, type RiderWithUserDetails, RoleType, type State, SweepExclusionReason, 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 };
1504
+ 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, type BusinessPortal, BusinessRole, type BusinessSettings, BusinessStatus, type BusinessWhatsappConfig, type City, type Collection, type Customer, type CustomerAddress, type CustomerBilling, type CustomerTransactionStats, DEFAULT_BUSINESS_MODULES, 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 GeoPoint, GlobalRoles, type Invoice, type InvoiceDrift, type InvoiceEvent, InvoiceEventType, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, type InvoicePayment, InvoicePaymentMethod, type InvoiceStatementLink, 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 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 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
@@ -78,6 +78,12 @@ var FeeSettlement = /* @__PURE__ */ ((FeeSettlement2) => {
78
78
  FeeSettlement2["Owed"] = "owed";
79
79
  return FeeSettlement2;
80
80
  })(FeeSettlement || {});
81
+ var ErrandInvoiceState = /* @__PURE__ */ ((ErrandInvoiceState2) => {
82
+ ErrandInvoiceState2["Unbilled"] = "unbilled";
83
+ ErrandInvoiceState2["Invoiced"] = "invoiced";
84
+ ErrandInvoiceState2["Excluded"] = "excluded";
85
+ return ErrandInvoiceState2;
86
+ })(ErrandInvoiceState || {});
81
87
  var AddressTypes = /* @__PURE__ */ ((AddressTypes2) => {
82
88
  AddressTypes2["DeliveryAddress"] = "deliveryAddress";
83
89
  AddressTypes2["PickupAddress"] = "pickupAddress";
@@ -334,6 +340,7 @@ export {
334
340
  DeliveryStatus,
335
341
  DraftErrandStatus,
336
342
  EnterpriseType,
343
+ ErrandInvoiceState,
337
344
  ErrandStatus,
338
345
  FeePaymentStatus,
339
346
  FeeSettlement,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mydoormot/app-types",
3
- "version": "1.9.1",
3
+ "version": "1.9.2",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
package/src/business.ts CHANGED
@@ -33,6 +33,13 @@ export interface Business {
33
33
  stateId: string | NullOrUndefined;
34
34
  cityId: string | NullOrUndefined;
35
35
 
36
+ /**
37
+ * IANA zone the business's own calendar runs on — the clock its reports are cut
38
+ * against, so a 23:30 errand lands on the day the operator worked it rather than
39
+ * on whatever day it was in UTC. Unset means the platform default, Africa/Lagos.
40
+ */
41
+ timezone: string | NullOrUndefined;
42
+
36
43
  originalLogoUrl: string | NullOrUndefined;
37
44
  logoUrl: string | NullOrUndefined;
38
45
  logoBlurHash: string | NullOrUndefined;
package/src/customer.ts CHANGED
@@ -55,7 +55,13 @@ export interface Customer {
55
55
  * earliest member.
56
56
  */
57
57
  export interface CustomerBilling {
58
+ /**
59
+ * What is still owed on work that has not reached a statement — net of
60
+ * anything already paid on those errands, which is why it can be smaller than
61
+ * the sum of their prices.
62
+ */
58
63
  unbilledAmount: number;
64
+ /** How many errands are not on a statement yet, paid ones included. */
59
65
  unbilledCount: number;
60
66
  oldestUnbilledAt: string | null;
61
67
  outstandingAmount: number;
package/src/errand.ts CHANGED
@@ -135,6 +135,21 @@ export enum FeeSettlement {
135
135
  Owed = 'owed',
136
136
  }
137
137
 
138
+ // Where an errand sits in the billing lifecycle — the axis orthogonal to
139
+ // `feePaymentStatus`. One asks "does the customer owe us?", this asks "has it
140
+ // been put on a bill yet?", and every useful listing is a product of the two
141
+ // (e.g. `invoiced` + `unpaid` is the chase list).
142
+ export enum ErrandInvoiceState {
143
+ // Billable and not yet on any invoice — the statement sweep would pick it up.
144
+ Unbilled = 'unbilled',
145
+ // Already attached to an invoice (or a business invoice batch).
146
+ Invoiced = 'invoiced',
147
+ // Settles some way that never reaches a statement: prepaid, cash on
148
+ // delivery, or `owed`. Notably where `owed` lands, which is what keeps it out
149
+ // of a collections list it would otherwise sit in forever.
150
+ Excluded = 'excluded',
151
+ }
152
+
138
153
  // Who fronted an errand expense. `customer` covers "paid on call" and
139
154
  // "handed to the rider directly" — only `company`-fronted expenses are billed.
140
155
  export type ExpensePaidBy = 'rider' | 'company' | 'customer';
@@ -1,4 +1,5 @@
1
1
  import { Customer } from './customer';
2
+ import { User } from './user';
2
3
 
3
4
  export type TransactionType = 'sale' | 'expense';
4
5
 
@@ -12,6 +13,16 @@ export interface TransactionItem {
12
13
  isAddon?: boolean;
13
14
  }
14
15
 
16
+ /**
17
+ * Rider user attached to a transaction — the same `riderUserDetails` field the
18
+ * errand types carry, narrowed to what the UI needs to label an expense with
19
+ * its rider. Derived from User so it can't drift from the canonical shape.
20
+ */
21
+ export type TransactionRiderUser = Pick<
22
+ User,
23
+ 'id' | 'firstName' | 'lastName' | 'mobileNumber' | 'avatarUrl'
24
+ >;
25
+
15
26
  export interface Transaction {
16
27
  id: string;
17
28
  type: TransactionType;
@@ -25,6 +36,7 @@ export interface Transaction {
25
36
  categoryId?: string;
26
37
  customerId?: string;
27
38
  riderId?: string;
39
+ riderUserDetails?: TransactionRiderUser | null;
28
40
  items?: TransactionItem[];
29
41
  customerDetails?: Customer;
30
42
  }