@bisondesk/core-sdk 1.0.681 → 1.0.682

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.
@@ -55,6 +55,20 @@ export declare enum UnpaidPurchaseGroup {
55
55
  Arrived = "arrived",
56
56
  Expected = "expected"
57
57
  }
58
+ export declare enum UnpaidPurchaseLogisticStatus {
59
+ Delivered = "delivered",
60
+ Arrived = "arrived",
61
+ Expected = "expected"
62
+ }
63
+ export type UnpaidPurchasesFilters = {
64
+ q?: string;
65
+ sold?: boolean;
66
+ logisticStatus?: UnpaidPurchaseLogisticStatus;
67
+ purchasedBy?: string[];
68
+ branchId?: string;
69
+ used?: boolean;
70
+ group?: UnpaidPurchaseGroup;
71
+ };
58
72
  export type UnpaidPurchase = {
59
73
  group: UnpaidPurchaseGroup;
60
74
  vehicle: SearchVehicle;
@@ -67,6 +81,7 @@ export type UnpaidPurchase = {
67
81
  };
68
82
  export type UnpaidPurchasesMeta = {
69
83
  canAllowPayment: boolean;
84
+ purchasers: string[];
70
85
  counts: Record<UnpaidPurchaseGroup, number>;
71
86
  };
72
87
  export type ExportPaymentsRequest = {
@@ -1 +1 @@
1
- {"version":3,"file":"vehicle-purchase-payments.d.ts","sourceRoot":"/","sources":["types/vehicle-purchase-payments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,8BAA8B,EAAE,MAAM,iCAAiC,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,eAAO,MAAM,oDAAoD,kDAChB,CAAC;AASlD,oBAAY,YAAY;IACtB,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,QAAQ,aAAa;CACtB;AAMD,MAAM,MAAM,6BAA6B,GAAG;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IAErB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AA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O,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG;IAC9C,OAAO,EAAE,sBAAsB,CAAC;IAChC,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,MAAM,EAAE,QAAQ,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG;IAC9C,OAAO,EAAE,sBAAsB,CAAC;IAChC,eAAe,EAAE,sBAAsB,CAAC;IACxC,MAAM,EAAE,QAAQ,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG;IAC9C,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,eAAe,EAAE,sBAAsB,CAAC;IACxC,MAAM,EAAE,QAAQ,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,SAAS,GACjD,CACI,iCAAiC,GACjC,iCAAiC,GACjC,iCAAiC,CACpC,CAAC"}
@@ -11,4 +11,10 @@ export var UnpaidPurchaseGroup;
11
11
  UnpaidPurchaseGroup["Arrived"] = "arrived";
12
12
  UnpaidPurchaseGroup["Expected"] = "expected";
13
13
  })(UnpaidPurchaseGroup || (UnpaidPurchaseGroup = {}));
14
+ export var UnpaidPurchaseLogisticStatus;
15
+ (function (UnpaidPurchaseLogisticStatus) {
16
+ UnpaidPurchaseLogisticStatus["Delivered"] = "delivered";
17
+ UnpaidPurchaseLogisticStatus["Arrived"] = "arrived";
18
+ UnpaidPurchaseLogisticStatus["Expected"] = "expected";
19
+ })(UnpaidPurchaseLogisticStatus || (UnpaidPurchaseLogisticStatus = {}));
14
20
  //# sourceMappingURL=vehicle-purchase-payments.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vehicle-purchase-payments.js","sourceRoot":"/","sources":["types/vehicle-purchase-payments.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,oDAAoD,GAC/D,+CAA+C,CAAC;AASlD,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,mCAAmB,CAAA;IACnB,yCAAyB,CAAA;IACzB,qCAAqB,CAAA;AACvB,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AA6FD,MAAM,CAAN,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC7B,oCAAa,CAAA;IACb,0CAAmB,CAAA;IACnB,4CAAqB,CAAA;AACvB,CAAC,EAJW,mBAAmB,KAAnB,mBAAmB,QAI9B","sourcesContent":["import { BaseEvent } from './internal-events.js';\nimport { OrganizationBankAccountActions } from './organization-bank-accounts.js';\nimport { SearchVehicle } from './vehicles.js';\n\nexport const VEHICLE_PURCHASE_PAYMENT_ALLOWED_NOTIFICATION_ORIGIN =\n 'vehicle-purchase-payment-allowed-notification';\n\n/**\n * The stage a supplier payment sits at, driving the Unpaid/Allowed/Processing/Executed tabs.\n * A payment only ever moves forward: an authorised payment is `allowed`; sending it to processing\n * groups it into a payment batch and hands it to accounting (`processing`), which exports it\n * to the Isabel bank file; marking it paid moves it to `executed`.\n * (`unpaid` is not a stage — it is an agreed purchase with an amount still to authorise.)\n */\nexport enum PaymentStage {\n Allowed = 'allowed',\n Processing = 'processing',\n Executed = 'executed',\n}\n\n/**\n * A payment on a purchase priced in another currency is authorized and paid in that currency.\n * `amount` then holds its value in branch currency: `foreign.amount × foreign.exchangeRate`.\n */\nexport type VehiclePurchasePaymentForeign = {\n amount: string;\n currencyCode: string;\n /** Branch currency units per 1 unit of `currencyCode`, the purchase's rate. */\n exchangeRate: string;\n};\n\nexport type NewVehiclePurchasePayment = {\n vehicleId: string;\n /** Branch currency. Derived from `foreign` when the purchase is priced in another currency. */\n amount: string;\n /** The backend takes the rate from the purchase. */\n foreign?: Pick<VehiclePurchasePaymentForeign, 'amount' | 'currencyCode'>;\n description?: string;\n paidAt?: string;\n paidBy?: string;\n};\n\nexport type VehiclePurchasePayment = Omit<NewVehiclePurchasePayment, 'foreign'> & {\n id: string;\n createdBy: string;\n createdAt: string;\n foreign?: VehiclePurchasePaymentForeign;\n stage: PaymentStage;\n /** Manual settlement priority within the Allowed tab; lower is paid first. */\n priority: number;\n /** Set once the payment has been exported; links it to its payment export. */\n exportId?: string;\n /** The payment batch this payment was sent to processing in; unset while Allowed, and on payments\n * marked paid straight from Allowed. */\n paymentBatchId?: string;\n /**\n * Supplier-facing communication that becomes the SEPA transfer's remittance information (`RmtInf`),\n * so the supplier can reconcile the payment to an invoice. Editable while Processing and not yet\n * exported; prefilled from the latest purchase invoice. This is not the file's per-line\n * `EndToEndId`.\n */\n transferReference?: string;\n /** Who sent the payment to processing, and when — set at the Allowed → Processing step. */\n sentToProcessingBy?: string;\n sentToProcessingAt?: string;\n};\n\n/**\n * One send to processing: the Allowed payments an accountant moved to Processing together, and who\n * sent them. The Processing tab groups its rows by batch. A batch holds no amount of its own; its\n * total is the sum of the payments still in it.\n */\nexport type PaymentBatch = {\n id: string;\n createdAt: string;\n createdBy: string;\n};\n\n/**\n * Whether a payment's supplier can be paid in an export. Mirrors the export gate: a transfer needs a\n * supplier bank account that carries an IBAN and holder name and has been verified. Shown as an\n * export-blocked marker on the Processing rows, where the accountant clears it before exporting.\n * (The invoice / pro-forma document half of the gate is not reflected here — its source is a Q3\n * residual the backend export gate also defers.)\n *\n * The bank account is the supplier's default one, `bankAccountId`, which is the account an export\n * pays. `bankAccountActions` lists what the current user may do on it, so a row can point out the\n * accounts they can verify themselves. Once the account number or holder name changed, verify is\n * left out for accountants, and for whichever Senior Accountant made the change (four-eyes).\n */\nexport type PaymentExportChecks = {\n bankAccountId?: string;\n hasBankAccount: boolean;\n bankAccountVerified: boolean;\n bankAccountActions: OrganizationBankAccountActions[];\n};\n\nexport type VehiclePurchasePaymentBff = {\n payment: VehiclePurchasePayment;\n vehicle: SearchVehicle;\n /** Name of the supplier organisation (`vehicle.purchase.organizationId`), resolved for display. */\n supplierName?: string;\n /** Export checks on the supplier bank account; filled for the Processing list only. */\n exportChecks?: PaymentExportChecks;\n};\n\n/**\n * The group an unpaid purchase is listed under, in the order the Unpaid list shows them: sold to a\n * client (whether or not it has arrived), arrived on our park and not sold, or still expected —\n * neither sold nor arrived.\n */\nexport enum UnpaidPurchaseGroup {\n Sold = 'sold',\n Arrived = 'arrived',\n Expected = 'expected',\n}\n\n/**\n * A row on the Unpaid tab: an agreed purchase that still has an amount to authorise for payment.\n * Derived from the purchase deal and the payments already authorised, not a payment record.\n */\nexport type UnpaidPurchase = {\n group: UnpaidPurchaseGroup;\n vehicle: SearchVehicle;\n /** The agreed purchase price including VAT (`deal.purchase` grossed up by `deal.purchaseVatRate`),\n * so it matches the VAT-inclusive cost the vehicle purchase tab authorises against. */\n purchaseAmount: string;\n /** Sum of amounts already authorised (payments in any stage) for this vehicle. */\n allowedAmount: string;\n /** Sum of the authorised amounts already settled (payments in Executed) for this vehicle. */\n paidAmount: string;\n /** `purchaseAmount − allowedAmount`; always greater than zero for rows shown here. */\n remainingAmount: string;\n /** Due date of the purchase invoice. */\n invoiceDueDate?: string;\n /** Name of the supplier organisation (`vehicle.purchase.organizationId`), resolved for display. */\n supplierName?: string;\n};\n\n/** What a page of one Unpaid group carries besides its rows. */\nexport type UnpaidPurchasesMeta = {\n /** Whether the requester may authorise a payment, as on the vehicle purchase tab. */\n canAllowPayment: boolean;\n /** How many purchases each group holds, for the group headers. */\n counts: Record<UnpaidPurchaseGroup, number>;\n};\n\n/** Body of the export request: the Processing payments to put in one file, the paying account, and the execution date. */\nexport type ExportPaymentsRequest = {\n paymentIds: string[];\n /** The bank account (from documents settings) to pay the file from — the file's debtor. */\n debtorBankAccountId: string;\n /** Single execution date (`yyyy-MM-dd`) written to `ReqdExctnDt`; defaults to today. */\n executionDate?: string;\n};\n\n/** Body of the mark-paid request: the payments (Allowed or Processing) to settle in one call. */\nexport type MarkPaymentsPaidRequest = {\n paymentIds: string[];\n};\n\n/** Body of the send-to-processing request: the Allowed payments to send together as one batch. */\nexport type SendPaymentsToProcessingRequest = {\n paymentIds: string[];\n};\n\n/**\n * How many rows sit behind each payment tab, for the tab counters. Executed is unbounded and has no\n * counter, so it is left out.\n */\nexport type PurchasePaymentCounts = {\n unpaid: number;\n allowed: number;\n processing: number;\n};\n\nexport type VehiclePurchasePaymentCreateEvent = {\n payment: VehiclePurchasePayment;\n previousPayment?: undefined;\n action: 'create';\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\nexport type VehiclePurchasePaymentUpdateEvent = {\n payment: VehiclePurchasePayment;\n previousPayment: VehiclePurchasePayment;\n action: 'update';\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\nexport type VehiclePurchasePaymentDeleteEvent = {\n payment?: undefined;\n previousPayment: VehiclePurchasePayment;\n action: 'delete';\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\nexport type VehiclePurchasePaymentEvent = BaseEvent &\n (\n | VehiclePurchasePaymentCreateEvent\n | VehiclePurchasePaymentUpdateEvent\n | VehiclePurchasePaymentDeleteEvent\n );\n"]}
1
+ {"version":3,"file":"vehicle-purchase-payments.js","sourceRoot":"/","sources":["types/vehicle-purchase-payments.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,oDAAoD,GAC/D,+CAA+C,CAAC;AASlD,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,mCAAmB,CAAA;IACnB,yCAAyB,CAAA;IACzB,qCAAqB,CAAA;AACvB,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AA8FD,MAAM,CAAN,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC7B,oCAAa,CAAA;IACb,0CAAmB,CAAA;IACnB,4CAAqB,CAAA;AACvB,CAAC,EAJW,mBAAmB,KAAnB,mBAAmB,QAI9B;AAOD,MAAM,CAAN,IAAY,4BAIX;AAJD,WAAY,4BAA4B;IACtC,uDAAuB,CAAA;IACvB,mDAAmB,CAAA;IACnB,qDAAqB,CAAA;AACvB,CAAC,EAJW,4BAA4B,KAA5B,4BAA4B,QAIvC","sourcesContent":["import { BaseEvent } from './internal-events.js';\nimport { OrganizationBankAccountActions } from './organization-bank-accounts.js';\nimport { SearchVehicle } from './vehicles.js';\n\nexport const VEHICLE_PURCHASE_PAYMENT_ALLOWED_NOTIFICATION_ORIGIN =\n 'vehicle-purchase-payment-allowed-notification';\n\n/**\n * The stage a supplier payment sits at, driving the Unpaid/Allowed/Processing/Executed tabs.\n * A payment only ever moves forward: an authorised payment is `allowed`; sending it to processing\n * groups it into a payment batch and hands it to accounting (`processing`), which exports it\n * to the Isabel bank file; marking it paid moves it to `executed`.\n * (`unpaid` is not a stage — it is an agreed purchase with an amount still to authorise.)\n */\nexport enum PaymentStage {\n Allowed = 'allowed',\n Processing = 'processing',\n Executed = 'executed',\n}\n\n/**\n * A payment on a purchase priced in another currency is authorized and paid in that currency.\n * `amount` then holds its value in branch currency: `foreign.amount × foreign.exchangeRate`.\n */\nexport type VehiclePurchasePaymentForeign = {\n amount: string;\n currencyCode: string;\n /** Branch currency units per 1 unit of `currencyCode`, the purchase's rate. */\n exchangeRate: string;\n};\n\nexport type NewVehiclePurchasePayment = {\n vehicleId: string;\n /** Branch currency. Derived from `foreign` when the purchase is priced in another currency. */\n amount: string;\n /** The backend takes the rate from the purchase. */\n foreign?: Pick<VehiclePurchasePaymentForeign, 'amount' | 'currencyCode'>;\n description?: string;\n paidAt?: string;\n paidBy?: string;\n};\n\nexport type VehiclePurchasePayment = Omit<NewVehiclePurchasePayment, 'foreign'> & {\n id: string;\n createdBy: string;\n createdAt: string;\n foreign?: VehiclePurchasePaymentForeign;\n stage: PaymentStage;\n /** Manual settlement priority within the Allowed tab; lower is paid first. */\n priority: number;\n /** Set once the payment has been exported; links it to its payment export. */\n exportId?: string;\n /** The payment batch this payment was sent to processing in; unset while Allowed, and on payments\n * marked paid straight from Allowed. */\n paymentBatchId?: string;\n /**\n * Supplier-facing communication that becomes the SEPA transfer's remittance information (`RmtInf`),\n * so the supplier can reconcile the payment to an invoice. Editable while Processing and not yet\n * exported; prefilled from the latest purchase invoice. This is not the file's per-line\n * `EndToEndId`.\n */\n transferReference?: string;\n /** Who sent the payment to processing, and when — set at the Allowed → Processing step. */\n sentToProcessingBy?: string;\n sentToProcessingAt?: string;\n};\n\n/**\n * One send to processing: the Allowed payments an accountant moved to Processing together, and who\n * sent them. The Processing tab groups its rows by batch. A batch holds no amount of its own; its\n * total is the sum of the payments still in it.\n */\nexport type PaymentBatch = {\n id: string;\n createdAt: string;\n createdBy: string;\n};\n\n/**\n * Whether a payment's supplier can be paid in an export. Mirrors the export gate: a transfer needs a\n * supplier bank account that carries an IBAN and holder name and has been verified. Shown as an\n * export-blocked marker on the Processing rows, where the accountant clears it before exporting.\n * (The invoice / pro-forma document half of the gate is not reflected here — its source is a Q3\n * residual the backend export gate also defers.)\n *\n * The bank account is the supplier's default one, `bankAccountId`, which is the account an export\n * pays. `bankAccountActions` lists what the current user may do on it, so a row can point out the\n * accounts they can verify themselves. Once the account number or holder name changed, verify is\n * left out for accountants, and for whichever Senior Accountant made the change (four-eyes).\n */\nexport type PaymentExportChecks = {\n bankAccountId?: string;\n hasBankAccount: boolean;\n bankAccountVerified: boolean;\n bankAccountActions: OrganizationBankAccountActions[];\n};\n\nexport type VehiclePurchasePaymentBff = {\n payment: VehiclePurchasePayment;\n vehicle: SearchVehicle;\n /** Name of the supplier organisation (`vehicle.purchase.organizationId`), resolved for display. */\n supplierName?: string;\n /** Export checks on the supplier bank account; filled for the Processing list only. */\n exportChecks?: PaymentExportChecks;\n};\n\n/**\n * The group an unpaid purchase falls in, in the order the Unpaid list ranks them: sold to a client\n * (whether or not it has arrived), arrived on our park and not sold, or still expected — neither\n * sold nor arrived. The single Unpaid list filters by `sold` and `logisticStatus` instead; the\n * `group` filter and `meta.counts` serve the client that paged each group on its own.\n */\nexport enum UnpaidPurchaseGroup {\n Sold = 'sold',\n Arrived = 'arrived',\n Expected = 'expected',\n}\n\n/**\n * Where the vehicle behind an unpaid purchase stands, in the order the Unpaid list ranks its sales:\n * delivered to the client, arrived on our park, or still expected from the supplier. Delivered comes\n * from the sale side, so only a sold vehicle is delivered, whether or not it passed our park.\n */\nexport enum UnpaidPurchaseLogisticStatus {\n Delivered = 'delivered',\n Arrived = 'arrived',\n Expected = 'expected',\n}\n\n/** The filters on the Unpaid list. A filter left out keeps every purchase. */\nexport type UnpaidPurchasesFilters = {\n /**\n * Free text, case-insensitive: every word must appear in the stock number, VIN, vehicle title or\n * supplier name.\n */\n q?: string;\n sold?: boolean;\n logisticStatus?: UnpaidPurchaseLogisticStatus;\n /** Purchasers (`purchase.purchasedBy`); a purchase matches any of them. */\n purchasedBy?: string[];\n branchId?: string;\n /** The vehicle's condition (`external.condition.used`); a vehicle without one matches neither. */\n used?: boolean;\n group?: UnpaidPurchaseGroup;\n};\n\n/**\n * A row on the Unpaid tab: an agreed purchase that still has an amount to authorise for payment.\n * Derived from the purchase deal and the payments already authorised, not a payment record.\n */\nexport type UnpaidPurchase = {\n group: UnpaidPurchaseGroup;\n vehicle: SearchVehicle;\n /** The agreed purchase price including VAT (`deal.purchase` grossed up by `deal.purchaseVatRate`),\n * so it matches the VAT-inclusive cost the vehicle purchase tab authorises against. */\n purchaseAmount: string;\n /** Sum of amounts already authorised (payments in any stage) for this vehicle. */\n allowedAmount: string;\n /** Sum of the authorised amounts already settled (payments in Executed) for this vehicle. */\n paidAmount: string;\n /** `purchaseAmount − allowedAmount`; always greater than zero for rows shown here. */\n remainingAmount: string;\n /** Due date of the purchase invoice. */\n invoiceDueDate?: string;\n /** Name of the supplier organisation (`vehicle.purchase.organizationId`), resolved for display. */\n supplierName?: string;\n};\n\n/** What a page of the Unpaid list carries besides its rows. */\nexport type UnpaidPurchasesMeta = {\n /** Whether the requester may authorise a payment, as on the vehicle purchase tab. */\n canAllowPayment: boolean;\n /** Everyone who purchased an unpaid purchase, unfiltered, for the purchaser filter. */\n purchasers: string[];\n /** How many purchases each group holds, unfiltered. */\n counts: Record<UnpaidPurchaseGroup, number>;\n};\n\n/** Body of the export request: the Processing payments to put in one file, the paying account, and the execution date. */\nexport type ExportPaymentsRequest = {\n paymentIds: string[];\n /** The bank account (from documents settings) to pay the file from — the file's debtor. */\n debtorBankAccountId: string;\n /** Single execution date (`yyyy-MM-dd`) written to `ReqdExctnDt`; defaults to today. */\n executionDate?: string;\n};\n\n/** Body of the mark-paid request: the payments (Allowed or Processing) to settle in one call. */\nexport type MarkPaymentsPaidRequest = {\n paymentIds: string[];\n};\n\n/** Body of the send-to-processing request: the Allowed payments to send together as one batch. */\nexport type SendPaymentsToProcessingRequest = {\n paymentIds: string[];\n};\n\n/**\n * How many rows sit behind each payment tab, for the tab counters. Executed is unbounded and has no\n * counter, so it is left out.\n */\nexport type PurchasePaymentCounts = {\n unpaid: number;\n allowed: number;\n processing: number;\n};\n\nexport type VehiclePurchasePaymentCreateEvent = {\n payment: VehiclePurchasePayment;\n previousPayment?: undefined;\n action: 'create';\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\nexport type VehiclePurchasePaymentUpdateEvent = {\n payment: VehiclePurchasePayment;\n previousPayment: VehiclePurchasePayment;\n action: 'update';\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\nexport type VehiclePurchasePaymentDeleteEvent = {\n payment?: undefined;\n previousPayment: VehiclePurchasePayment;\n action: 'delete';\n actionAt: string;\n userId: string;\n tenantId: string;\n};\n\nexport type VehiclePurchasePaymentEvent = BaseEvent &\n (\n | VehiclePurchasePaymentCreateEvent\n | VehiclePurchasePaymentUpdateEvent\n | VehiclePurchasePaymentDeleteEvent\n );\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bisondesk/core-sdk",
3
- "version": "1.0.681",
3
+ "version": "1.0.682",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "author": "TheTruckCompany",
@@ -105,9 +105,10 @@ export type VehiclePurchasePaymentBff = {
105
105
  };
106
106
 
107
107
  /**
108
- * The group an unpaid purchase is listed under, in the order the Unpaid list shows them: sold to a
109
- * client (whether or not it has arrived), arrived on our park and not sold, or still expected —
110
- * neither sold nor arrived.
108
+ * The group an unpaid purchase falls in, in the order the Unpaid list ranks them: sold to a client
109
+ * (whether or not it has arrived), arrived on our park and not sold, or still expected — neither
110
+ * sold nor arrived. The single Unpaid list filters by `sold` and `logisticStatus` instead; the
111
+ * `group` filter and `meta.counts` serve the client that paged each group on its own.
111
112
  */
112
113
  export enum UnpaidPurchaseGroup {
113
114
  Sold = 'sold',
@@ -115,6 +116,34 @@ export enum UnpaidPurchaseGroup {
115
116
  Expected = 'expected',
116
117
  }
117
118
 
119
+ /**
120
+ * Where the vehicle behind an unpaid purchase stands, in the order the Unpaid list ranks its sales:
121
+ * delivered to the client, arrived on our park, or still expected from the supplier. Delivered comes
122
+ * from the sale side, so only a sold vehicle is delivered, whether or not it passed our park.
123
+ */
124
+ export enum UnpaidPurchaseLogisticStatus {
125
+ Delivered = 'delivered',
126
+ Arrived = 'arrived',
127
+ Expected = 'expected',
128
+ }
129
+
130
+ /** The filters on the Unpaid list. A filter left out keeps every purchase. */
131
+ export type UnpaidPurchasesFilters = {
132
+ /**
133
+ * Free text, case-insensitive: every word must appear in the stock number, VIN, vehicle title or
134
+ * supplier name.
135
+ */
136
+ q?: string;
137
+ sold?: boolean;
138
+ logisticStatus?: UnpaidPurchaseLogisticStatus;
139
+ /** Purchasers (`purchase.purchasedBy`); a purchase matches any of them. */
140
+ purchasedBy?: string[];
141
+ branchId?: string;
142
+ /** The vehicle's condition (`external.condition.used`); a vehicle without one matches neither. */
143
+ used?: boolean;
144
+ group?: UnpaidPurchaseGroup;
145
+ };
146
+
118
147
  /**
119
148
  * A row on the Unpaid tab: an agreed purchase that still has an amount to authorise for payment.
120
149
  * Derived from the purchase deal and the payments already authorised, not a payment record.
@@ -137,11 +166,13 @@ export type UnpaidPurchase = {
137
166
  supplierName?: string;
138
167
  };
139
168
 
140
- /** What a page of one Unpaid group carries besides its rows. */
169
+ /** What a page of the Unpaid list carries besides its rows. */
141
170
  export type UnpaidPurchasesMeta = {
142
171
  /** Whether the requester may authorise a payment, as on the vehicle purchase tab. */
143
172
  canAllowPayment: boolean;
144
- /** How many purchases each group holds, for the group headers. */
173
+ /** Everyone who purchased an unpaid purchase, unfiltered, for the purchaser filter. */
174
+ purchasers: string[];
175
+ /** How many purchases each group holds, unfiltered. */
145
176
  counts: Record<UnpaidPurchaseGroup, number>;
146
177
  };
147
178