@bisondesk/core-sdk 1.0.651 → 1.0.652

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.
Files changed (129) hide show
  1. package/lib/apis/leasing.d.ts +1 -1
  2. package/lib/apis/leasing.d.ts.map +1 -1
  3. package/lib/apis/leasing.js +3 -2
  4. package/lib/apis/leasing.js.map +1 -1
  5. package/lib/types/quotes.d.ts +1 -0
  6. package/lib/types/quotes.d.ts.map +1 -1
  7. package/lib/types/quotes.js.map +1 -1
  8. package/lib/types/reports-arrivals.d.ts +67 -0
  9. package/lib/types/reports-arrivals.d.ts.map +1 -0
  10. package/lib/types/reports-arrivals.js +4 -0
  11. package/lib/types/reports-arrivals.js.map +1 -0
  12. package/lib/types/reports-sales.d.ts +7 -0
  13. package/lib/types/reports-sales.d.ts.map +1 -1
  14. package/lib/types/reports-sales.js.map +1 -1
  15. package/lib/types/templates.d.ts +22 -0
  16. package/lib/types/templates.d.ts.map +1 -1
  17. package/lib/types/templates.js.map +1 -1
  18. package/lib/types/tenants.d.ts +1 -1
  19. package/lib/types/tenants.d.ts.map +1 -1
  20. package/lib/types/tenants.js +1 -1
  21. package/lib/types/tenants.js.map +1 -1
  22. package/lib/types/transports.d.ts +5 -1
  23. package/lib/types/transports.d.ts.map +1 -1
  24. package/lib/types/transports.js +6 -0
  25. package/lib/types/transports.js.map +1 -1
  26. package/lib/utils/leasing.d.ts +1 -0
  27. package/lib/utils/leasing.d.ts.map +1 -1
  28. package/lib/utils/leasing.js +7 -1
  29. package/lib/utils/leasing.js.map +1 -1
  30. package/lib/utils/leasing.test.d.ts +2 -0
  31. package/lib/utils/leasing.test.d.ts.map +1 -0
  32. package/lib/utils/leasing.test.js +69 -0
  33. package/lib/utils/leasing.test.js.map +1 -0
  34. package/lib/utils/reports-arrivals.d.ts +3 -0
  35. package/lib/utils/reports-arrivals.d.ts.map +1 -0
  36. package/lib/utils/reports-arrivals.js +15 -0
  37. package/lib/utils/reports-arrivals.js.map +1 -0
  38. package/lib/utils/transports.d.ts +1 -0
  39. package/lib/utils/transports.d.ts.map +1 -1
  40. package/lib/utils/transports.js +3 -4
  41. package/lib/utils/transports.js.map +1 -1
  42. package/lib/utils/vehicles.d.ts +3 -1
  43. package/lib/utils/vehicles.d.ts.map +1 -1
  44. package/lib/utils/vehicles.js +6 -1
  45. package/lib/utils/vehicles.js.map +1 -1
  46. package/package.json +1 -1
  47. package/src/apis/leasing.ts +3 -1
  48. package/src/types/activities.js +13 -0
  49. package/src/types/activities.js.map +1 -0
  50. package/src/types/comparables.js +2 -0
  51. package/src/types/comparables.js.map +1 -0
  52. package/src/types/crm.js +58 -0
  53. package/src/types/crm.js.map +1 -0
  54. package/src/types/dashboard.js +2 -0
  55. package/src/types/dashboard.js.map +1 -0
  56. package/src/types/definitions.js +2 -0
  57. package/src/types/definitions.js.map +1 -0
  58. package/src/types/fields.js +2 -0
  59. package/src/types/fields.js.map +1 -0
  60. package/src/types/insights.js +2 -0
  61. package/src/types/insights.js.map +1 -0
  62. package/src/types/interests.js +6 -0
  63. package/src/types/interests.js.map +1 -0
  64. package/src/types/internal-events.js +18 -0
  65. package/src/types/internal-events.js.map +1 -0
  66. package/src/types/internet-opportunities.js +2 -0
  67. package/src/types/internet-opportunities.js.map +1 -0
  68. package/src/types/internet-vehicles.js +2 -0
  69. package/src/types/internet-vehicles.js.map +1 -0
  70. package/src/types/leasing-administration.js +2 -0
  71. package/src/types/leasing-administration.js.map +1 -0
  72. package/src/types/leasing-debtors.js +2 -0
  73. package/src/types/leasing-debtors.js.map +1 -0
  74. package/src/types/leasing-search.js +2 -0
  75. package/src/types/leasing-search.js.map +1 -0
  76. package/src/types/leasing-settings.js +7 -0
  77. package/src/types/leasing-settings.js.map +1 -0
  78. package/src/types/leasing.js +38 -0
  79. package/src/types/leasing.js.map +1 -0
  80. package/src/types/marketing.js +35 -0
  81. package/src/types/marketing.js.map +1 -0
  82. package/src/types/offers.js +56 -0
  83. package/src/types/opportunities.js +107 -0
  84. package/src/types/opportunities.js.map +1 -0
  85. package/src/types/payments.js +7 -0
  86. package/src/types/picklists.js +2 -0
  87. package/src/types/picklists.js.map +1 -0
  88. package/src/types/quotes.js +42 -0
  89. package/src/types/quotes.ts +1 -0
  90. package/src/types/recently-viewed.js +2 -0
  91. package/src/types/recently-viewed.js.map +1 -0
  92. package/src/types/reports-arrivals.ts +95 -0
  93. package/src/types/reports-sales.ts +13 -0
  94. package/src/types/reservations.js +5 -0
  95. package/src/types/reservations.js.map +1 -0
  96. package/src/types/roi-ratings.js +5 -0
  97. package/src/types/roi-ratings.js.map +1 -0
  98. package/src/types/saved-filters.js +9 -0
  99. package/src/types/saved-filters.js.map +1 -0
  100. package/src/types/search.js +2 -0
  101. package/src/types/search.js.map +1 -0
  102. package/src/types/settings.js +2 -0
  103. package/src/types/settings.js.map +1 -0
  104. package/src/types/templates.js +2 -0
  105. package/src/types/templates.js.map +1 -0
  106. package/src/types/templates.ts +27 -0
  107. package/src/types/tenants.js +21 -0
  108. package/src/types/tenants.js.map +1 -0
  109. package/src/types/tenants.ts +1 -1
  110. package/src/types/transports.ts +11 -1
  111. package/src/types/user-performance.js +7 -0
  112. package/src/types/user-performance.js.map +1 -0
  113. package/src/types/utils.js +2 -0
  114. package/src/types/validation.js +2 -0
  115. package/src/types/validation.js.map +1 -0
  116. package/src/types/vehicle-sales.js +6 -0
  117. package/src/types/vehicle-sales.js.map +1 -0
  118. package/src/types/vehicles.js +98 -0
  119. package/src/types/vehicles.js.map +1 -0
  120. package/src/utils/leasing.js +6 -0
  121. package/src/utils/leasing.js.map +1 -0
  122. package/src/utils/leasing.test.ts +79 -0
  123. package/src/utils/leasing.ts +22 -1
  124. package/src/utils/opportunities.js +48 -0
  125. package/src/utils/opportunities.js.map +1 -0
  126. package/src/utils/reports-arrivals.ts +19 -0
  127. package/src/utils/transports.ts +13 -7
  128. package/src/utils/vehicles.ts +10 -0
  129. package/tsconfig.tsbuildinfo +1 -1
@@ -8,8 +8,11 @@ import { DataRecord, ReferenceData } from './utils.js';
8
8
  import { Vehicle, VehiclePurchase } from './vehicles.js';
9
9
  export declare enum TransportType {
10
10
  PurchasePickUp = "PURCHASE_PICK_UP",
11
+ PurchaseDropOff = "PURCHASE_DROP_OFF",
11
12
  SaleDelivery = "SALE_DELIVERY"
12
13
  }
14
+ export type TransportPurchaseType = TransportType.PurchasePickUp | TransportType.PurchaseDropOff;
15
+ export declare const TransportPurchaseTypes: TransportPurchaseType[];
13
16
  export declare enum TransportStatus {
14
17
  Todo = "TODO",
15
18
  Planning = "PLANNING",
@@ -81,7 +84,7 @@ export type Transport = {
81
84
  updatedAt: string;
82
85
  updatedBy: string;
83
86
  } & ({
84
- type: TransportType.PurchasePickUp;
87
+ type: TransportPurchaseType;
85
88
  delivery: TransportPurchaseDeliveryType;
86
89
  } | {
87
90
  type: TransportType.SaleDelivery;
@@ -131,6 +134,7 @@ export type TransportUpdateEvent = BaseTransportEvent & {
131
134
  };
132
135
  export type TransportEvent = BaseEvent & (TransportCreateEvent | TransportUpdateEvent);
133
136
  export declare enum TransportPaymentStatus {
137
+ PaymentNotNeeded = "payment_not_needed",
134
138
  NoPayment = "no_payment",
135
139
  PartialPaymentReceived = "partial_payment_received",
136
140
  FullPaymentReceived = "full_payment_received",
@@ -1 +1 @@
1
- {"version":3,"file":"transports.d.ts","sourceRoot":"/","sources":["types/transports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAA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AC1B,aAAa,EAAE,sBAAsB,CAAC;QAStC,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,GAAG,KAAK,CAAC,CAAC;QACzC,cAAc,CAAC,EAAE,uBAAuB,CAAC;KAC1C,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,aAAa,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;AAEhF,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,MAAM,EAAE,qBAAqB,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,iBAAiB,GAAG;IAC9D,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAChD,YAAY,CAAC,EAAE,MAAM,CAAC,eAAe,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,SAAS,CAAA;KAAE,EAAE,CAAC,CAAC;CACjF,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,IAAI,CACzC,QAAQ,CAAC,qBAAqB,EAAE,aAAa,CAAC,EAC9C,WAAW,CACZ,GAAG;IACF,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CACjD,CAAC"}
@@ -2,8 +2,13 @@ import { DeliveryTypes, } from './quotes.js';
2
2
  export var TransportType;
3
3
  (function (TransportType) {
4
4
  TransportType["PurchasePickUp"] = "PURCHASE_PICK_UP";
5
+ TransportType["PurchaseDropOff"] = "PURCHASE_DROP_OFF";
5
6
  TransportType["SaleDelivery"] = "SALE_DELIVERY";
6
7
  })(TransportType || (TransportType = {}));
8
+ export const TransportPurchaseTypes = [
9
+ TransportType.PurchasePickUp,
10
+ TransportType.PurchaseDropOff,
11
+ ];
7
12
  export var TransportStatus;
8
13
  (function (TransportStatus) {
9
14
  TransportStatus["Todo"] = "TODO";
@@ -55,6 +60,7 @@ export var TransportActions;
55
60
  })(TransportActions || (TransportActions = {}));
56
61
  export var TransportPaymentStatus;
57
62
  (function (TransportPaymentStatus) {
63
+ TransportPaymentStatus["PaymentNotNeeded"] = "payment_not_needed";
58
64
  TransportPaymentStatus["NoPayment"] = "no_payment";
59
65
  TransportPaymentStatus["PartialPaymentReceived"] = "partial_payment_received";
60
66
  TransportPaymentStatus["FullPaymentReceived"] = "full_payment_received";
@@ -1 +1 @@
1
- {"version":3,"file":"transports.js","sourceRoot":"/","sources":["types/transports.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,aAAa,GAGd,MAAM,aAAa,CAAC;AAKrB,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,oDAAmC,CAAA;IACnC,+CAA8B,CAAA;AAChC,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB;AAED,MAAM,CAAN,IAAY,eAQX;AARD,WAAY,eAAe;IACzB,gCAAa,CAAA;IACb,wCAAqB,CAAA;IACrB,kCAAe,CAAA;IACf,2DAAwC,CAAA;IACxC,uDAAoC,CAAA;IACpC,+CAA4B,CAAA;IAC5B,gCAAa,CAAA;AACf,CAAC,EARW,eAAe,KAAf,eAAe,QAQ1B;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAsB;IACrD,eAAe,CAAC,IAAI;IACpB,eAAe,CAAC,QAAQ;IACxB,eAAe,CAAC,KAAK;IACrB,eAAe,CAAC,iBAAiB;IACjC,eAAe,CAAC,eAAe;IAC/B,eAAe,CAAC,WAAW;CAC5B,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CAAC,IAAI,CAAC;AAE1D,MAAM,CAAC,MAAM,yBAAyB,GAAsB,CAAC,qBAAqB,CAAC,CAAC;AACpF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organization } from './crm.js';\nimport { BaseEvent } from './internal-events.js';\nimport { Opportunity, OpportunityPaymentStatus } from './opportunities.js';\nimport {\n AddressDeliveryType,\n DeliveryTypes,\n PickUpDeliveryType,\n PortDeliverytype,\n} from './quotes.js';\nimport { BaseSearchRequest, SortOrder } from './search.js';\nimport { DataRecord, ReferenceData } from './utils.js';\nimport { Vehicle, VehiclePurchase } from './vehicles.js';\n\nexport enum TransportType {\n PurchasePickUp = 'PURCHASE_PICK_UP',\n SaleDelivery = 'SALE_DELIVERY',\n}\n\nexport enum TransportStatus {\n Todo = 'TODO',\n Planning = 'PLANNING',\n Ready = 'READY',\n ScheduledExternal = 'SCHEDULED_EXTERNAL',\n OngoingInternal = 'ONGOING_INTERNAL',\n OngoingShip = 'ONGOING_SHIP',\n Done = 'DONE',\n}\n\nexport const TransportStatusOrder: TransportStatus[] = [\n TransportStatus.Todo,\n TransportStatus.Planning,\n TransportStatus.Ready,\n TransportStatus.ScheduledExternal,\n TransportStatus.OngoingInternal,\n TransportStatus.OngoingShip,\n];\n\nexport const TransportDoneColumnId = TransportStatus.Done;\n\nexport const TransportKanbanEndColumns: TransportStatus[] = [TransportDoneColumnId];\nexport const TransportKanbanColumns: TransportStatus[] = [\n ...TransportStatusOrder,\n ...TransportKanbanEndColumns,\n];\n\nexport enum TransportPriority {\n Normal = 'NORMAL',\n High = 'HIGH',\n Urgent = 'URGENT',\n}\n\nexport const TransportSalesDeliveryType = {\n Address: DeliveryTypes.ADDRESS,\n Port: DeliveryTypes.PORT,\n PortAndShip: DeliveryTypes.PORT_AND_SHIP,\n PickUp: DeliveryTypes.PICK_UP,\n} as const;\n\n/**\n * The customer collects the vehicle. Nothing is driven anywhere, but the papers still have to be\n * arranged and paid for — transit plates, technical control, insurance — which is why it is a\n * delivery type administration reviews rather than the absence of one.\n *\n * `dateOfPickUpByCustomer` is dropped from the quote's shape: the transport's own `date` is the\n * collection day, and two fields for one date only ever disagree.\n */\nexport type TransportPickUpDeliveryType = Omit<PickUpDeliveryType, 'dateOfPickUpByCustomer'>;\n\nexport type TransportSalesDeliveryType = (\n | PortDeliverytype\n | AddressDeliveryType\n | TransportPickUpDeliveryType\n) & {\n cleaningNeeded?: boolean;\n driver?: string;\n transportCompany?: string;\n date?: string; // Pick-up (purchase) | Delivery (OPP) (leaves parking)\n adminCost?: string; // user-entered administrative cost summed into totalCostExclVat\n stackingVehicleCostPrice?: string; // overrides the stacking rate from the delivery settings\n};\n\nexport type TransportPurchaseDeliveryType = AddressDeliveryType & {\n cleaningNeeded?: boolean;\n driver?: string;\n transportCompany?: string;\n date?: string; // Pick-up (purchase) | Delivery (OPP) (leaves parking)\n adminCost?: string; // user-entered administrative cost summed into totalCostExclVat\n stackingVehicleCostPrice?: string; // overrides the stacking rate from the delivery settings\n};\n\nexport type Transport = {\n id: string;\n vehicleId: string;\n opportunityId?: string;\n\n status: TransportStatus;\n priority: TransportPriority;\n\n // administrative fields\n adminApproved: boolean;\n adminApprovedAt?: string;\n adminApprovedBy?: string;\n transportWithoutPayment?: boolean;\n notes?: string;\n\n totals: {\n totalRetailAmountExclVat: string;\n totalCostExclVat: string;\n estimatedTotalCostExclVat?: string;\n };\n\n log: Array<{\n status: TransportStatus;\n completedAt: string;\n completedBy: string;\n }>;\n\n doneAt?: string;\n doneBy?: string;\n canceledAt?: string;\n canceledBy?: string;\n\n createdAt: string;\n createdBy: string;\n updatedAt: string;\n updatedBy: string;\n} & (\n | {\n type: TransportType.PurchasePickUp;\n delivery: TransportPurchaseDeliveryType;\n }\n | {\n type: TransportType.SaleDelivery;\n delivery: TransportSalesDeliveryType;\n }\n);\n\nexport enum TransportWarningCode {\n PurchaseLogisticsNotReady = 'purchase_logistics_not_ready',\n}\n\nexport type TransportWarning = {\n code: TransportWarningCode;\n details?: Record<string, string | number | boolean>;\n};\n\nexport type TransportCost = Pick<Transport, 'totals'>;\n\nexport type TransportRecord = DataRecord<Transport>;\n\n/**\n * What a requester may change on a transport, field group by field group. The server filters an\n * update through these and returns the ones granted on the record, so the drawer disables what the\n * user cannot touch instead of deciding for itself from the user's roles.\n */\nexport enum TransportActions {\n /** The route: addresses, ports, dates, costs. */\n SetDelivery = 'set_delivery',\n SetNotes = 'set_notes',\n /** The administrative sign-off, and the clearance to move before the payment. */\n SetApproval = 'set_approval',\n /** The board column. */\n SetStatus = 'set_status',\n SetPriority = 'set_priority',\n SetBookingRef = 'set_booking_ref',\n}\n\n/**\n * Every field a write may set, in one shape. `delivery` is replaced whole when it is sent — there is\n * no partial merge into the stored one — which is why `bookingRef` rides alongside as a scalar the\n * server writes into the delivery it ends up with.\n */\nexport type TransportUpdate = {\n delivery?: TransportSalesDeliveryType | TransportPurchaseDeliveryType;\n notes?: string | null;\n adminApproved?: boolean;\n transportWithoutPayment?: boolean;\n status?: TransportStatus;\n priority?: TransportPriority;\n bookingRef?: string | null;\n};\n\ntype BaseTransportEvent = {\n actionAt: string;\n userId: string;\n tenantId: string;\n transportId: string;\n};\n\nexport type TransportCreateEvent = BaseTransportEvent & {\n action: 'create';\n data: Transport;\n previousData?: undefined;\n};\n\nexport type TransportUpdateEvent = BaseTransportEvent & {\n action: 'update';\n data: Transport;\n previousData: Transport;\n};\n\n/** Published whenever a transport is written. Carries both sides so subscribers judge relevance. */\nexport type TransportEvent = BaseEvent & (TransportCreateEvent | TransportUpdateEvent);\n\nexport enum TransportPaymentStatus {\n NoPayment = 'no_payment',\n PartialPaymentReceived = 'partial_payment_received',\n FullPaymentReceived = 'full_payment_received',\n PartialPaymentSent = 'partial_payment_sent',\n FullPaymentSent = 'full_payment_sent',\n}\n\n/**\n * Where the money stands on the record the transport serves: the customer's payments on the\n * opportunity for a sale delivery, ours to the supplier for a purchase pick-up. Denormalised at\n * indexing time so the board can show it without joining.\n */\nexport type TransportPayment = {\n status: OpportunityPaymentStatus;\n /** Only a sale delivery knows the ratio — a pick-up has milestones, not a running total. */\n percentagePaid?: string;\n};\n\n/** Which address the map pin came from, so the UI can tell an exact pin from an approximate one. */\nexport enum TransportLocationSource {\n DeliveryAddress = 'delivery_address',\n OriginPort = 'origin_port',\n OrgAddress = 'org_address',\n}\n\nexport type SearchTransport = {\n transport: Transport;\n vehicle: Vehicle;\n org: Organization;\n opportunity?: Opportunity;\n purchase: VehiclePurchase;\n tasks: {\n totalTasks: number;\n openTasks: number;\n nextDueAt?: string;\n };\n custom: {\n commercialUserIds: string[];\n warnings: TransportWarning[];\n priorityOrdinal: number;\n payment: TransportPayment;\n paymentStatus: TransportPaymentStatus;\n /**\n * Where the transport happens: the delivery address, or the origin port for a shipped delivery.\n * Denormalised into one field because the map clusters over a single geo_point, and a port\n * delivery carries no address of its own.\n *\n * Deliberately narrower than `GPSCoord`: a geo_point field rejects any key beyond lat/lon, so\n * the map zoom the coordinates picker stores must not reach the index.\n */\n location?: Pick<GPSCoord, 'lat' | 'lon'>;\n locationSource?: TransportLocationSource;\n };\n};\n\nexport type SearchTransportList = PaginatedList<SearchTransport, ReferenceData>;\n\nexport type TransportKanbanColumn = {\n status: TransportStatus;\n results: SearchTransport[];\n totalCount: number;\n};\n\nexport type MSearchTransportsKanbanColumn = {\n column: TransportKanbanColumn;\n nextToken?: string;\n};\n\nexport type KanbanTransportsSearchRequest = BaseSearchRequest & {\n nextTokens?: Record<string, string | undefined>;\n statusSortBy?: Record<TransportStatus, { fieldId: string; order: SortOrder }[]>;\n};\n\nexport type KanbanTransportsNextList = Omit<\n NextList<TransportKanbanColumn, ReferenceData>,\n 'nextToken'\n> & {\n nextTokens?: Record<string, string | undefined>;\n};\n"]}
1
+ {"version":3,"file":"transports.js","sourceRoot":"/","sources":["types/transports.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,aAAa,GAGd,MAAM,aAAa,CAAC;AAKrB,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,oDAAmC,CAAA;IACnC,sDAAqC,CAAA;IACrC,+CAA8B,CAAA;AAChC,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;AAKD,MAAM,CAAC,MAAM,s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AY,gBAUX;AAVD,WAAY,gBAAgB;IAE1B,gDAA4B,CAAA;IAC5B,0CAAsB,CAAA;IAEtB,gDAA4B,CAAA;IAE5B,4CAAwB,CAAA;IACxB,gDAA4B,CAAA;IAC5B,qDAAiC,CAAA;AACnC,CAAC,EAVW,gBAAgB,KAAhB,gBAAgB,QAU3B;AAuCD,MAAM,CAAN,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,iEAAuC,CAAA;IACvC,kDAAwB,CAAA;IACxB,6EAAmD,CAAA;IACnD,uEAA6C,CAAA;IAC7C,qEAA2C,CAAA;IAC3C,+DAAqC,CAAA;AACvC,CAAC,EAPW,sBAAsB,KAAtB,sBAAsB,QAOjC;AAcD,MAAM,CAAN,IAAY,uBAIX;AAJD,WAAY,uBAAuB;IACjC,+DAAoC,CAAA;IACpC,qDAA0B,CAAA;IAC1B,qDAA0B,CAAA;AAC5B,CAAC,EAJW,uBAAuB,KAAvB,uBAAuB,QAIlC","sourcesContent":["import { GPSCoord, NextList, PaginatedList } from '@bisondesk/commons-sdk/types';\nimport { Organization } from './crm.js';\nimport { BaseEvent } from './internal-events.js';\nimport { Opportunity, OpportunityPaymentStatus } from './opportunities.js';\nimport {\n AddressDeliveryType,\n DeliveryTypes,\n PickUpDeliveryType,\n PortDeliverytype,\n} from './quotes.js';\nimport { BaseSearchRequest, SortOrder } from './search.js';\nimport { DataRecord, ReferenceData } from './utils.js';\nimport { Vehicle, VehiclePurchase } from './vehicles.js';\n\nexport enum TransportType {\n PurchasePickUp = 'PURCHASE_PICK_UP',\n PurchaseDropOff = 'PURCHASE_DROP_OFF',\n SaleDelivery = 'SALE_DELIVERY',\n}\n\n/** Both inbound journeys, whoever drives them. Mirrors the purchase's own delivery type. */\nexport type TransportPurchaseType = TransportType.PurchasePickUp | TransportType.PurchaseDropOff;\n\nexport const TransportPurchaseTypes: TransportPurchaseType[] = [\n TransportType.PurchasePickUp,\n TransportType.PurchaseDropOff,\n];\n\nexport enum TransportStatus {\n Todo = 'TODO',\n Planning = 'PLANNING',\n Ready = 'READY',\n ScheduledExternal = 'SCHEDULED_EXTERNAL',\n OngoingInternal = 'ONGOING_INTERNAL',\n OngoingShip = 'ONGOING_SHIP',\n Done = 'DONE',\n}\n\nexport const TransportStatusOrder: TransportStatus[] = [\n TransportStatus.Todo,\n TransportStatus.Planning,\n TransportStatus.Ready,\n TransportStatus.ScheduledExternal,\n TransportStatus.OngoingInternal,\n TransportStatus.OngoingShip,\n];\n\nexport const TransportDoneColumnId = TransportStatus.Done;\n\nexport const TransportKanbanEndColumns: TransportStatus[] = [TransportDoneColumnId];\nexport const TransportKanbanColumns: TransportStatus[] = [\n ...TransportStatusOrder,\n ...TransportKanbanEndColumns,\n];\n\nexport enum TransportPriority {\n Normal = 'NORMAL',\n High = 'HIGH',\n Urgent = 'URGENT',\n}\n\nexport const TransportSalesDeliveryType = {\n Address: DeliveryTypes.ADDRESS,\n Port: DeliveryTypes.PORT,\n PortAndShip: DeliveryTypes.PORT_AND_SHIP,\n PickUp: DeliveryTypes.PICK_UP,\n} as const;\n\n/**\n * The customer collects the vehicle. Nothing is driven anywhere, but the papers still have to be\n * arranged and paid for — transit plates, technical control, insurance — which is why it is a\n * delivery type administration reviews rather than the absence of one.\n *\n * `dateOfPickUpByCustomer` is dropped from the quote's shape: the transport's own `date` is the\n * collection day, and two fields for one date only ever disagree.\n */\nexport type TransportPickUpDeliveryType = Omit<PickUpDeliveryType, 'dateOfPickUpByCustomer'>;\n\nexport type TransportSalesDeliveryType = (\n | PortDeliverytype\n | AddressDeliveryType\n | TransportPickUpDeliveryType\n) & {\n cleaningNeeded?: boolean;\n driver?: string;\n transportCompany?: string;\n date?: string; // Pick-up (purchase) | Delivery (OPP) (leaves parking)\n adminCost?: string; // user-entered administrative cost summed into totalCostExclVat\n stackingVehicleCostPrice?: string; // overrides the stacking rate from the delivery settings\n};\n\nexport type TransportPurchaseDeliveryType = AddressDeliveryType & {\n cleaningNeeded?: boolean;\n driver?: string;\n transportCompany?: string;\n date?: string; // Pick-up (purchase) | Delivery (OPP) (leaves parking)\n adminCost?: string; // user-entered administrative cost summed into totalCostExclVat\n stackingVehicleCostPrice?: string; // overrides the stacking rate from the delivery settings\n};\n\nexport type Transport = {\n id: string;\n vehicleId: string;\n opportunityId?: string;\n\n status: TransportStatus;\n priority: TransportPriority;\n\n // administrative fields\n adminApproved: boolean;\n adminApprovedAt?: string;\n adminApprovedBy?: string;\n transportWithoutPayment?: boolean;\n notes?: string;\n\n totals: {\n totalRetailAmountExclVat: string;\n totalCostExclVat: string;\n estimatedTotalCostExclVat?: string;\n };\n\n log: Array<{\n status: TransportStatus;\n completedAt: string;\n completedBy: string;\n }>;\n\n doneAt?: string;\n doneBy?: string;\n canceledAt?: string;\n canceledBy?: string;\n\n createdAt: string;\n createdBy: string;\n updatedAt: string;\n updatedBy: string;\n} & (\n | {\n type: TransportPurchaseType;\n delivery: TransportPurchaseDeliveryType;\n }\n | {\n type: TransportType.SaleDelivery;\n delivery: TransportSalesDeliveryType;\n }\n);\n\nexport enum TransportWarningCode {\n PurchaseLogisticsNotReady = 'purchase_logistics_not_ready',\n}\n\nexport type TransportWarning = {\n code: TransportWarningCode;\n details?: Record<string, string | number | boolean>;\n};\n\nexport type TransportCost = Pick<Transport, 'totals'>;\n\nexport type TransportRecord = DataRecord<Transport>;\n\n/**\n * What a requester may change on a transport, field group by field group. The server filters an\n * update through these and returns the ones granted on the record, so the drawer disables what the\n * user cannot touch instead of deciding for itself from the user's roles.\n */\nexport enum TransportActions {\n /** The route: addresses, ports, dates, costs. */\n SetDelivery = 'set_delivery',\n SetNotes = 'set_notes',\n /** The administrative sign-off, and the clearance to move before the payment. */\n SetApproval = 'set_approval',\n /** The board column. */\n SetStatus = 'set_status',\n SetPriority = 'set_priority',\n SetBookingRef = 'set_booking_ref',\n}\n\n/**\n * Every field a write may set, in one shape. `delivery` is replaced whole when it is sent — there is\n * no partial merge into the stored one — which is why `bookingRef` rides alongside as a scalar the\n * server writes into the delivery it ends up with.\n */\nexport type TransportUpdate = {\n delivery?: TransportSalesDeliveryType | TransportPurchaseDeliveryType;\n notes?: string | null;\n adminApproved?: boolean;\n transportWithoutPayment?: boolean;\n status?: TransportStatus;\n priority?: TransportPriority;\n bookingRef?: string | null;\n};\n\ntype BaseTransportEvent = {\n actionAt: string;\n userId: string;\n tenantId: string;\n transportId: string;\n};\n\nexport type TransportCreateEvent = BaseTransportEvent & {\n action: 'create';\n data: Transport;\n previousData?: undefined;\n};\n\nexport type TransportUpdateEvent = BaseTransportEvent & {\n action: 'update';\n data: Transport;\n previousData: Transport;\n};\n\n/** Published whenever a transport is written. Carries both sides so subscribers judge relevance. */\nexport type TransportEvent = BaseEvent & (TransportCreateEvent | TransportUpdateEvent);\n\nexport enum TransportPaymentStatus {\n PaymentNotNeeded = 'payment_not_needed',\n NoPayment = 'no_payment',\n PartialPaymentReceived = 'partial_payment_received',\n FullPaymentReceived = 'full_payment_received',\n PartialPaymentSent = 'partial_payment_sent',\n FullPaymentSent = 'full_payment_sent',\n}\n\n/**\n * Where the money stands on the record the transport serves: the customer's payments on the\n * opportunity for a sale delivery, ours to the supplier for a purchase pick-up. Denormalised at\n * indexing time so the board can show it without joining.\n */\nexport type TransportPayment = {\n status: OpportunityPaymentStatus;\n /** Only a sale delivery knows the ratio — a pick-up has milestones, not a running total. */\n percentagePaid?: string;\n};\n\n/** Which address the map pin came from, so the UI can tell an exact pin from an approximate one. */\nexport enum TransportLocationSource {\n DeliveryAddress = 'delivery_address',\n OriginPort = 'origin_port',\n OrgAddress = 'org_address',\n}\n\nexport type SearchTransport = {\n transport: Transport;\n vehicle: Vehicle;\n org: Organization;\n opportunity?: Opportunity;\n purchase: VehiclePurchase;\n tasks: {\n totalTasks: number;\n openTasks: number;\n nextDueAt?: string;\n };\n custom: {\n commercialUserIds: string[];\n warnings: TransportWarning[];\n priorityOrdinal: number;\n payment: TransportPayment;\n paymentStatus: TransportPaymentStatus;\n /**\n * Where the transport happens: the delivery address, or the origin port for a shipped delivery.\n * Denormalised into one field because the map clusters over a single geo_point, and a port\n * delivery carries no address of its own.\n *\n * Deliberately narrower than `GPSCoord`: a geo_point field rejects any key beyond lat/lon, so\n * the map zoom the coordinates picker stores must not reach the index.\n */\n location?: Pick<GPSCoord, 'lat' | 'lon'>;\n locationSource?: TransportLocationSource;\n };\n};\n\nexport type SearchTransportList = PaginatedList<SearchTransport, ReferenceData>;\n\nexport type TransportKanbanColumn = {\n status: TransportStatus;\n results: SearchTransport[];\n totalCount: number;\n};\n\nexport type MSearchTransportsKanbanColumn = {\n column: TransportKanbanColumn;\n nextToken?: string;\n};\n\nexport type KanbanTransportsSearchRequest = BaseSearchRequest & {\n nextTokens?: Record<string, string | undefined>;\n statusSortBy?: Record<TransportStatus, { fieldId: string; order: SortOrder }[]>;\n};\n\nexport type KanbanTransportsNextList = Omit<\n NextList<TransportKanbanColumn, ReferenceData>,\n 'nextToken'\n> & {\n nextTokens?: Record<string, string | undefined>;\n};\n"]}
@@ -3,6 +3,7 @@ import { ConditionsRef, LeasingContract, LeasingContractClient, OpportunityRef }
3
3
  import { CustomLeasingQuoteExtraInput, LeasingItemsPaymentSplit } from '../types/leasing-settings.js';
4
4
  export declare const sortContractClients: (clients: LeasingContractClient[]) => LeasingContractClient[];
5
5
  export declare const getDealRef: ({ conditions, opportunities, }: Pick<LeasingContract, 'conditions' | 'opportunities'>) => ConditionsRef | OpportunityRef;
6
+ export declare const getDealRefAsOf: ({ conditions, opportunities }: Pick<LeasingContract, 'conditions' | 'opportunities'>, asOfDate: string) => ConditionsRef | OpportunityRef;
6
7
  export declare const getItemClientPercentage: (value: LeasingItemsPaymentSplit) => Decimal;
7
8
  export declare const getLeasingExtrasTotal: (extras: CustomLeasingQuoteExtraInput[]) => Decimal;
8
9
  //# sourceMappingURL=leasing.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"leasing.d.ts","sourceRoot":"/","sources":["utils/leasing.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,O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} from '@date-fns/utc';
2
2
  import { format } from 'date-fns';
3
3
  import { Decimal } from 'decimal.js';
4
- import { last, map, sortBy, uniqBy } from 'lodash-es';
4
+ import { first, last, map, sortBy, uniqBy } from 'lodash-es';
5
5
  import { LeasingItemsPaymentSplit, } from '../types/leasing-settings.js';
6
6
  export const sortContractClients = (clients) => sortBy(map(uniqBy(clients, (c) => c.takeoverId), (c) => ({ ...c, since: format(new UTCDate(c.since), 'yyyy-MM-dd') })), (cli) => cli.since, (cli) => (cli.takeoverId ? parseInt(cli.takeoverId.replace(/[^0-9]/g, '')) : 0));
7
7
  export const getDealRef = ({ conditions, opportunities, }) => last(conditions) ?? last(opportunities);
8
+ const refEffectiveFrom = (ref) => 'validSince' in ref ? ref.validSince : ref.createdAt;
9
+ export const getDealRefAsOf = ({ conditions, opportunities }, asOfDate) => {
10
+ const refs = conditions ?? opportunities ?? [];
11
+ const inForce = refs.filter((ref) => refEffectiveFrom(ref).slice(0, 10) <= asOfDate.slice(0, 10));
12
+ return last(inForce) ?? first(refs) ?? last(refs);
13
+ };
8
14
  export const getItemClientPercentage = (value) => {
9
15
  switch (value) {
10
16
  case LeasingItemsPaymentSplit.Company:
@@ -1 +1 @@
1
- {"version":3,"file":"leasing.js","sourceRoot":"/","sources":["utils/leasing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAOtD,OAAO,EAEL,wBAAwB,GACzB,MAAM,8BAA8B,CAAC;AAGtC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,OAAgC,EAA2B,EAAE,CAC/F,MAAM,CACJ,GAAG,CACD,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE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E,CAAC,GAAG,CAAC,EAAE,CAAC;YAClD,MAAM,YAAY,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,KAAM,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YACxF,MAAM,iBAAiB,GAAG,uBAAuB,CAAC,KAAM,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAChF,MAAM,gBAAgB,GAAG,IAAI,OAAO,CAAC,KAAM,CAAC,WAAW,CAAC;iBACrD,GAAG,CAAC,KAAM,CAAC,QAAQ,CAAC;iBACpB,GAAG,CAAC,iBAAiB,CAAC;iBACtB,GAAG,CAAC,YAAY,CAAC,CAAC;YACrB,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC","sourcesContent":["import { UTCDate } from '@date-fns/utc';\nimport { format } from 'date-fns';\nimport { Decimal } from 'decimal.js';\nimport { last, map, sortBy, uniqBy } from 'lodash-es';\nimport {\n ConditionsRef,\n LeasingContract,\n LeasingContractClient,\n OpportunityRef,\n} from '../types/leasing.js';\nimport {\n CustomLeasingQuoteExtraInput,\n LeasingItemsPaymentSplit,\n} from '../types/leasing-settings.js';\n\n/* sort from oldest to most recent client */\nexport const sortContractClients = (clients: LeasingContractClient[]): LeasingContractClient[] =>\n sortBy(\n map(\n uniqBy(clients, (c) => c.takeoverId),\n (c) => ({ ...c, since: format(new UTCDate(c.since), 'yyyy-MM-dd') }), // doing a map to also fix legacy data\n ),\n (cli) => cli.since,\n (cli) => (cli.takeoverId ? parseInt(cli.takeoverId.replace(/[^0-9]/g, '')) : 0),\n );\n\nexport const getDealRef = ({\n conditions,\n opportunities,\n}: Pick<LeasingContract, 'conditions' | 'opportunities'>): ConditionsRef | OpportunityRef =>\n last(conditions) ?? last(opportunities)!;\n\nexport const getItemClientPercentage = (value: LeasingItemsPaymentSplit): Decimal => {\n switch (value) {\n case LeasingItemsPaymentSplit.Company:\n return new Decimal(0);\n case LeasingItemsPaymentSplit.Split:\n return new Decimal(50);\n case LeasingItemsPaymentSplit.Customer:\n default:\n return new Decimal(100);\n }\n};\n\nexport const getLeasingExtrasTotal = (extras: CustomLeasingQuoteExtraInput[]) => {\n let total = new Decimal(0);\n for (const extra of extras) {\n if (new Decimal(extra!.leasingPercentage).lt(100)) {\n const leasingRatio = new Decimal(1).sub(new Decimal(extra!.leasingPercentage).div(100));\n const paymentSplitRatio = getItemClientPercentage(extra!.paymentSplit).div(100);\n const extraAgreedPrice = new Decimal(extra!.agreedPrice)\n .mul(extra!.quantity)\n .mul(paymentSplitRatio)\n .mul(leasingRatio);\n total = total.add(extraAgreedPrice);\n }\n }\n return total;\n};\n"]}
1
+ {"version":3,"file":"leasing.js","sourceRoot":"/","sources":["utils/leasing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAO7D,OAAO,EAEL,wBAAwB,GACzB,MAAM,8BAA8B,CAAC;AAGtC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,OAAgC,EAA2B,EAAE,CAC/F,MAAM,CACJ,GAAG,CACD,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,EACpC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC,EAAE,CAAC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,CAAC;QACxB,KAAK,wBAAwB,CAAC,KAAK;YACjC,OAAO,IAAI,OAAO,CAAC,EAAE,CAAC,CAAC;QACzB,KAAK,wBAAwB,CAAC,QAAQ,CAAC;QACvC;YACE,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,MAAsC,EAAE,EAAE;IAC9E,IAAI,KAAK,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,IAAI,OAAO,CAAC,KAAM,CAAC,iBAAiB,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;YAClD,MAAM,YAAY,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,KAAM,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YACxF,MAAM,iBAAiB,GAAG,uBAAuB,CAAC,KAAM,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAChF,MAAM,gBAAgB,GAAG,IAAI,OAAO,CAAC,KAAM,CAAC,WAAW,CAAC;iBACrD,GAAG,CAAC,KAAM,CAAC,QAAQ,CAAC;iBACpB,GAAG,CAAC,iBAAiB,CAAC;iBACtB,GAAG,CAAC,YAAY,CAAC,CAAC;YACrB,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC","sourcesContent":["import { UTCDate } from '@date-fns/utc';\nimport { format } from 'date-fns';\nimport { Decimal } from 'decimal.js';\nimport { first, last, map, sortBy, uniqBy } from 'lodash-es';\nimport {\n ConditionsRef,\n LeasingContract,\n LeasingContractClient,\n OpportunityRef,\n} from '../types/leasing.js';\nimport {\n CustomLeasingQuoteExtraInput,\n LeasingItemsPaymentSplit,\n} from '../types/leasing-settings.js';\n\n/* sort from oldest to most recent client */\nexport const sortContractClients = (clients: LeasingContractClient[]): LeasingContractClient[] =>\n sortBy(\n map(\n uniqBy(clients, (c) => c.takeoverId),\n (c) => ({ ...c, since: format(new UTCDate(c.since), 'yyyy-MM-dd') }), // doing a map to also fix legacy data\n ),\n (cli) => cli.since,\n (cli) => (cli.takeoverId ? parseInt(cli.takeoverId.replace(/[^0-9]/g, '')) : 0),\n );\n\nexport const getDealRef = ({\n conditions,\n opportunities,\n}: Pick<LeasingContract, 'conditions' | 'opportunities'>): ConditionsRef | OpportunityRef =>\n last(conditions) ?? last(opportunities)!;\n\nconst refEffectiveFrom = (ref: ConditionsRef | OpportunityRef): string =>\n 'validSince' in ref ? ref.validSince : ref.createdAt;\n\n/**\n * Picks the conditions snapshot that was in force on a given date, rather than the latest one.\n *\n * A contract keeps its conditions/opportunities snapshots oldest first, each with an effective\n * date. This returns the most recent snapshot effective on or before `asOfDate` — the terms a\n * document issued on that date was billed under. Dates are compared by day, so the mix of\n * date-only `validSince` and datetime `createdAt` strings behaves consistently. When `asOfDate`\n * predates every snapshot, it falls back to the earliest one.\n */\nexport const getDealRefAsOf = (\n { conditions, opportunities }: Pick<LeasingContract, 'conditions' | 'opportunities'>,\n asOfDate: string,\n): ConditionsRef | OpportunityRef => {\n const refs: (ConditionsRef | OpportunityRef)[] = conditions ?? opportunities ?? [];\n const inForce = refs.filter((ref) => refEffectiveFrom(ref).slice(0, 10) <= asOfDate.slice(0, 10));\n return last(inForce) ?? first(refs) ?? last(refs)!;\n};\n\nexport const getItemClientPercentage = (value: LeasingItemsPaymentSplit): Decimal => {\n switch (value) {\n case LeasingItemsPaymentSplit.Company:\n return new Decimal(0);\n case LeasingItemsPaymentSplit.Split:\n return new Decimal(50);\n case LeasingItemsPaymentSplit.Customer:\n default:\n return new Decimal(100);\n }\n};\n\nexport const getLeasingExtrasTotal = (extras: CustomLeasingQuoteExtraInput[]) => {\n let total = new Decimal(0);\n for (const extra of extras) {\n if (new Decimal(extra!.leasingPercentage).lt(100)) {\n const leasingRatio = new Decimal(1).sub(new Decimal(extra!.leasingPercentage).div(100));\n const paymentSplitRatio = getItemClientPercentage(extra!.paymentSplit).div(100);\n const extraAgreedPrice = new Decimal(extra!.agreedPrice)\n .mul(extra!.quantity)\n .mul(paymentSplitRatio)\n .mul(leasingRatio);\n total = total.add(extraAgreedPrice);\n }\n }\n return total;\n};\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=leasing.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leasing.test.d.ts","sourceRoot":"/","sources":["utils/leasing.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,69 @@
1
+ import { getDealRefAsOf } from './leasing.js';
2
+ const makeOpportunityRef = (overrides = {}) => ({
3
+ id: 'opp',
4
+ createdAt: '2025-01-01',
5
+ quoteId: 'q',
6
+ depositAmount: '0',
7
+ durationInMonths: 24,
8
+ saleAmount: '0',
9
+ interestRate: '0',
10
+ residualAmount: '0',
11
+ leasingMonthlyAmount: '0',
12
+ otherMonthlyAmounts: '0',
13
+ totalMonthlyAmount: '0',
14
+ ...overrides,
15
+ });
16
+ const makeConditionsRef = (overrides = {}) => ({
17
+ id: 'cond',
18
+ validSince: '2025-01-01',
19
+ depositAmount: '0',
20
+ durationInMonths: 24,
21
+ saleAmount: '0',
22
+ interestRate: '0',
23
+ residualAmount: '0',
24
+ leasingMonthlyAmount: '0',
25
+ otherMonthlyAmounts: '0',
26
+ totalMonthlyAmount: '0',
27
+ ...overrides,
28
+ });
29
+ describe('getDealRefAsOf', () => {
30
+ test('picks the opportunity snapshot in force when the invoice was issued (the failing case)', () => {
31
+ const original = makeOpportunityRef({
32
+ id: 'original',
33
+ createdAt: '2025-06-19T09:20:28.019Z',
34
+ insuranceAmount: '196',
35
+ otherMonthlyAmounts: '213',
36
+ totalMonthlyAmount: '1423',
37
+ });
38
+ const renegotiated = makeOpportunityRef({
39
+ id: 'renegotiated',
40
+ createdAt: '2026-01-01',
41
+ insuranceAmount: '211.65',
42
+ otherMonthlyAmounts: '228.65',
43
+ totalMonthlyAmount: '1438.65',
44
+ });
45
+ const contract = { conditions: undefined, opportunities: [original, renegotiated] };
46
+ expect(getDealRefAsOf(contract, '2025-11-01').id).toBe('original');
47
+ expect(getDealRefAsOf(contract, '2026-02-01').id).toBe('renegotiated');
48
+ });
49
+ test('picks the conditions snapshot in force by validSince', () => {
50
+ const first = makeConditionsRef({ id: 'first', validSince: '2024-01-01' });
51
+ const second = makeConditionsRef({ id: 'second', validSince: '2025-01-01' });
52
+ const contract = { conditions: [first, second], opportunities: undefined };
53
+ expect(getDealRefAsOf(contract, '2024-06-01').id).toBe('first');
54
+ expect(getDealRefAsOf(contract, '2025-06-01').id).toBe('second');
55
+ });
56
+ test('is inclusive of a snapshot effective on the same day as the invoice', () => {
57
+ const before = makeConditionsRef({ id: 'before', validSince: '2024-01-01' });
58
+ const sameDay = makeConditionsRef({ id: 'sameDay', validSince: '2025-05-10' });
59
+ const contract = { conditions: [before, sameDay], opportunities: undefined };
60
+ expect(getDealRefAsOf(contract, '2025-05-10').id).toBe('sameDay');
61
+ });
62
+ test('falls back to the earliest snapshot when the date predates all of them', () => {
63
+ const first = makeConditionsRef({ id: 'first', validSince: '2025-01-01' });
64
+ const second = makeConditionsRef({ id: 'second', validSince: '2026-01-01' });
65
+ const contract = { conditions: [first, second], opportunities: undefined };
66
+ expect(getDealRefAsOf(contract, '2024-01-01').id).toBe('first');
67
+ });
68
+ });
69
+ //# sourceMappingURL=leasing.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leasing.test.js","sourceRoot":"/","sources":["utils/leasing.test.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,kBAAkB,GAAG,CAAC,SAAS,GAA4B,EAAE,EAAkB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,SAAS,EAAE,CAAC;QAE7E,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,wEAAwE,EAAE,GAAG,EAAE;QAClF,MAAM,KAAK,GAAG,iBAAiB,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC,CAAC;QAC3E,MAAM,MAAM,GAAG,iBAAiB,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC,CAAC;QAC7E,MAAM,QAAQ,GAAG,EAAE,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC;QAE3E,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { ConditionsRef, OpportunityRef } from '../types/leasing.js';\nimport { getDealRefAsOf } from './leasing.js';\n\nconst makeOpportunityRef = (overrides: Partial<OpportunityRef> = {}): OpportunityRef => ({\n id: 'opp',\n createdAt: '2025-01-01',\n quoteId: 'q',\n depositAmount: '0',\n durationInMonths: 24,\n saleAmount: '0',\n interestRate: '0',\n residualAmount: '0',\n leasingMonthlyAmount: '0',\n otherMonthlyAmounts: '0',\n totalMonthlyAmount: '0',\n ...overrides,\n});\n\nconst makeConditionsRef = (overrides: Partial<ConditionsRef> = {}): ConditionsRef => ({\n id: 'cond',\n validSince: '2025-01-01',\n depositAmount: '0',\n durationInMonths: 24,\n saleAmount: '0',\n interestRate: '0',\n residualAmount: '0',\n leasingMonthlyAmount: '0',\n otherMonthlyAmounts: '0',\n totalMonthlyAmount: '0',\n ...overrides,\n});\n\ndescribe('getDealRefAsOf', () => {\n test('picks the opportunity snapshot in force when the invoice was issued (the failing case)', () => {\n const original = makeOpportunityRef({\n id: 'original',\n createdAt: '2025-06-19T09:20:28.019Z',\n insuranceAmount: '196',\n otherMonthlyAmounts: '213',\n totalMonthlyAmount: '1423',\n });\n const renegotiated = makeOpportunityRef({\n id: 'renegotiated',\n createdAt: '2026-01-01',\n insuranceAmount: '211.65',\n otherMonthlyAmounts: '228.65',\n totalMonthlyAmount: '1438.65',\n });\n const contract = { conditions: undefined, opportunities: [original, renegotiated] };\n\n expect(getDealRefAsOf(contract, '2025-11-01').id).toBe('original');\n expect(getDealRefAsOf(contract, '2026-02-01').id).toBe('renegotiated');\n });\n\n test('picks the conditions snapshot in force by validSince', () => {\n const first = makeConditionsRef({ id: 'first', validSince: '2024-01-01' });\n const second = makeConditionsRef({ id: 'second', validSince: '2025-01-01' });\n const contract = { conditions: [first, second], opportunities: undefined };\n\n expect(getDealRefAsOf(contract, '2024-06-01').id).toBe('first');\n expect(getDealRefAsOf(contract, '2025-06-01').id).toBe('second');\n });\n\n test('is inclusive of a snapshot effective on the same day as the invoice', () => {\n const before = makeConditionsRef({ id: 'before', validSince: '2024-01-01' });\n const sameDay = makeConditionsRef({ id: 'sameDay', validSince: '2025-05-10' });\n const contract = { conditions: [before, sameDay], opportunities: undefined };\n\n expect(getDealRefAsOf(contract, '2025-05-10').id).toBe('sameDay');\n });\n\n test('falls back to the earliest snapshot when the date predates all of them', () => {\n const first = makeConditionsRef({ id: 'first', validSince: '2025-01-01' });\n const second = makeConditionsRef({ id: 'second', validSince: '2026-01-01' });\n const contract = { conditions: [first, second], opportunities: undefined };\n\n expect(getDealRefAsOf(contract, '2024-01-01').id).toBe('first');\n });\n});\n"]}
@@ -0,0 +1,3 @@
1
+ import { ExpectedArrivalRow } from '../types/reports-arrivals.js';
2
+ export declare const getArrivalDeliveryType: (row: ExpectedArrivalRow) => 'pickUp' | 'dropOff' | 'direct' | undefined;
3
+ //# sourceMappingURL=reports-arrivals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reports-arrivals.d.ts","sourceRoot":"/","sources":["utils/reports-arrivals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAIlE,eAAO,MAAM,sBAAsB,QAC5B,kBAAkB,KACtB,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,SAYpC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { TransportType } from '../types/transports.js';
2
+ export const getArrivalDeliveryType = (row) => {
3
+ if (row.readyToDeliver) {
4
+ return 'direct';
5
+ }
6
+ switch (row.transport?.type) {
7
+ case TransportType.PurchasePickUp:
8
+ return 'pickUp';
9
+ case TransportType.PurchaseDropOff:
10
+ return 'dropOff';
11
+ default:
12
+ return undefined;
13
+ }
14
+ };
15
+ //# sourceMappingURL=reports-arrivals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reports-arrivals.js","sourceRoot":"/","sources":["utils/reports-arrivals.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,GAAuB,EACsB,EAAE;IAC/C,IAAI,GAAG,CAAC,cAAc,EAAE,CAAC;QACvB,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,QAAQ,GAAG,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC;QAC5B,KAAK,aAAa,CAAC,cAAc;YAC/B,OAAO,QAAQ,CAAC;QAClB,KAAK,aAAa,CAAC,eAAe;YAChC,OAAO,SAAS,CAAC;QACnB;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { ExpectedArrivalRow } from '../types/reports-arrivals.js';\nimport { TransportType } from '../types/transports.js';\n\n/** Pick up and drop off come from the transport; direct-to-client deliveries stay separate. */\nexport const getArrivalDeliveryType = (\n row: ExpectedArrivalRow,\n): 'pickUp' | 'dropOff' | 'direct' | undefined => {\n if (row.readyToDeliver) {\n return 'direct';\n }\n switch (row.transport?.type) {\n case TransportType.PurchasePickUp:\n return 'pickUp';\n case TransportType.PurchaseDropOff:\n return 'dropOff';\n default:\n return undefined;\n }\n};\n"]}
@@ -1,6 +1,7 @@
1
1
  import { Opportunity } from '../types/opportunities.js';
2
2
  import { SearchTransport, Transport } from '../types/transports.js';
3
3
  import { VehiclePurchase } from '../types/vehicles.js';
4
+ export declare const isPurchaseTransport: (transport: Transport) => boolean;
4
5
  export declare const isTransportCompleted: (transport: Transport, context: {
5
6
  opportunity?: Opportunity;
6
7
  purchase?: VehiclePurchase;
@@ -1 +1 @@
1
- {"version":3,"file":"transports.d.ts","sourceRoot":"/","sources":["utils/transports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,SAAS,EAAiB,MAAM,wBAAwB,CAAC;AACnF,OAAO,EAAE,eAAe,EAAkC,MAAM,sBAAsB,CAAC;AAcvF,eAAO,MAAM,oBAAoB,cACpB,SAAS,WACX;IAAE,WAAW,CAAC,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,EAAE,eAAe,CAAA;CAAE,KACjE,OAUF,CAAC;AAGF,eAAO,MAAM,0BAA0B,WAAY,eAAe,KAAG,OAIjE,CAAC"}
1
+ {"version":3,"file":"transports.d.ts","sourceRoot":"/","sources":["utils/transports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,SAAS,EAAiB,MAAM,wBAAwB,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AASvD,eAAO,MAAM,mBAAmB,cAAe,SAAS,KAAG,OACZ,CAAC;AAchD,eAAO,MAAM,oBAAoB,cACpB,SAAS,WACX;IAAE,WAAW,CAAC,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,EAAE,eAAe,CAAA;CAAE,KACjE,OAMF,CAAC;AAGF,eAAO,MAAM,0BAA0B,WAAY,eAAe,KAAG,OAIjE,CAAC"}
@@ -1,12 +1,11 @@
1
1
  import { TransportType } from '../types/transports.js';
2
- import { VehiclePurchaseLogisticsStatus } from '../types/vehicles.js';
2
+ import { hasPurchaseArrived } from './vehicles.js';
3
+ export const isPurchaseTransport = (transport) => transport.type !== TransportType.SaleDelivery;
3
4
  export const isTransportCompleted = (transport, context) => {
4
5
  if (transport.type === TransportType.SaleDelivery) {
5
6
  return context.opportunity?.deliveredAt != null;
6
7
  }
7
- const status = context.purchase?.logistics.status;
8
- return (status === VehiclePurchaseLogisticsStatus.Arrived ||
9
- status === VehiclePurchaseLogisticsStatus.CheckedIn);
8
+ return context.purchase != null && hasPurchaseArrived(context.purchase);
10
9
  };
11
10
  export const isSearchTransportCompleted = (record) => isTransportCompleted(record.transport, {
12
11
  opportunity: record.opportunity,
@@ -1 +1 @@
1
- {"version":3,"file":"transports.js","sourceRoot":"/","sources":["utils/transports.ts"],"names":[],"mappings":"AACA,OAAO,EAA8B,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,EAAmB,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AAcvF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,SAAoB,EACpB,OAAkE,EACzD,EAAE;IACX,IAAI,SAAS,CAAC,IAAI,KAAK,aAAa,CAAC,YAAY,EAAE,CAAC;QAClD,OAAO,OAAO,CAAC,WAAW,EAAE,WAAW,IAAI,IAAI,CAAC;IAClD,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC;IAClD,OAAO,CACL,MAAM,KAAK,8BAA8B,CAAC,OAAO;QACjD,MAAM,KAAK,8BAA8B,CAAC,SAAS,CACpD,CAAC;AACJ,CAAC,CAAC;AAGF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,MAAuB,EAAW,EAAE,CAC7E,oBAAoB,CAAC,MAAM,CAAC,SAAS,EAAE;IACrC,WAAW,EAAE,MAAM,CAAC,WAAW;IAC/B,QAAQ,EAAE,MAAM,CAAC,QAAQ;CAC1B,CAAC,CAAC","sourcesContent":["import { Opportunity } from '../types/opportunities.js';\nimport { SearchTransport, Transport, TransportType } from '../types/transports.js';\nimport { VehiclePurchase, VehiclePurchaseLogisticsStatus } from '../types/vehicles.js';\n\n/**\n * A transport is finished when the journey it describes has demonstrably happened: the customer has\n * the vehicle for a sale delivery, the vehicle is on our park for a purchase pick-up. From then on\n * the record is history and the server refuses edits to it.\n *\n * Not the same thing as the transport's own `doneAt`. Delivery can be declared on the opportunity\n * (a CMR, a delivery confirmation) and arrival on the purchase, without the transport ever being\n * moved — and reversing either of those is what unlocks the transport again, which a status stamped\n * on the transport itself could not express.\n *\n * Shared so the board, the drawer and the server all answer the question the same way.\n */\nexport const isTransportCompleted = (\n transport: Transport,\n context: { opportunity?: Opportunity; purchase?: VehiclePurchase },\n): boolean => {\n if (transport.type === TransportType.SaleDelivery) {\n return context.opportunity?.deliveredAt != null;\n }\n\n const status = context.purchase?.logistics.status;\n return (\n status === VehiclePurchaseLogisticsStatus.Arrived ||\n status === VehiclePurchaseLogisticsStatus.CheckedIn\n );\n};\n\n/** The same question asked of a search document, which already carries both sides. */\nexport const isSearchTransportCompleted = (record: SearchTransport): boolean =>\n isTransportCompleted(record.transport, {\n opportunity: record.opportunity,\n purchase: record.purchase,\n });\n"]}
1
+ {"version":3,"file":"transports.js","sourceRoot":"/","sources":["utils/transports.ts"],"names":[],"mappings":"AACA,OAAO,EAA8B,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAQnD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,SAAoB,EAAW,EAAE,CACnE,SAAS,CAAC,IAAI,KAAK,aAAa,CAAC,YAAY,CAAC;AAchD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,SAAoB,EACpB,OAAkE,EACzD,EAAE;IACX,IAAI,SAAS,CAAC,IAAI,KAAK,aAAa,CAAC,YAAY,EAAE,CAAC;QAClD,OAAO,OAAO,CAAC,WAAW,EAAE,WAAW,IAAI,IAAI,CAAC;IAClD,CAAC;IAED,OAAO,OAAO,CAAC,QAAQ,IAAI,IAAI,IAAI,kBAAkB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC1E,CAAC,CAAC;AAGF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,MAAuB,EAAW,EAAE,CAC7E,oBAAoB,CAAC,MAAM,CAAC,SAAS,EAAE;IACrC,WAAW,EAAE,MAAM,CAAC,WAAW;IAC/B,QAAQ,EAAE,MAAM,CAAC,QAAQ;CAC1B,CAAC,CAAC","sourcesContent":["import { Opportunity } from '../types/opportunities.js';\nimport { SearchTransport, Transport, TransportType } from '../types/transports.js';\nimport { VehiclePurchase } from '../types/vehicles.js';\nimport { hasPurchaseArrived } from './vehicles.js';\n\n/**\n * Which side of the trade the transport serves. Both purchase types answer yes: a pick-up we drive\n * and a drop-off the supplier drives differ only in who is behind the wheel, and every rule that\n * asks this question — what it costs, whose money moved, which papers it needs — is the same for\n * both.\n */\nexport const isPurchaseTransport = (transport: Transport): boolean =>\n transport.type !== TransportType.SaleDelivery;\n\n/**\n * A transport is finished when the journey it describes has demonstrably happened: the customer has\n * the vehicle for a sale delivery, the vehicle is on our park for a purchase. From then on\n * the record is history and the server refuses edits to it.\n *\n * Not the same thing as the transport's own `doneAt`. Delivery can be declared on the opportunity\n * (a CMR, a delivery confirmation) and arrival on the purchase, without the transport ever being\n * moved — and reversing either of those is what unlocks the transport again, which a status stamped\n * on the transport itself could not express.\n *\n * Shared so the board, the drawer and the server all answer the question the same way.\n */\nexport const isTransportCompleted = (\n transport: Transport,\n context: { opportunity?: Opportunity; purchase?: VehiclePurchase },\n): boolean => {\n if (transport.type === TransportType.SaleDelivery) {\n return context.opportunity?.deliveredAt != null;\n }\n\n return context.purchase != null && hasPurchaseArrived(context.purchase);\n};\n\n/** The same question asked of a search document, which already carries both sides. */\nexport const isSearchTransportCompleted = (record: SearchTransport): boolean =>\n isTransportCompleted(record.transport, {\n opportunity: record.opportunity,\n purchase: record.purchase,\n });\n"]}
@@ -1,4 +1,6 @@
1
- import { Vehicle, VehicleExternalInfo, VehiclePurchase } from '../types/vehicles.js';
1
+ import { Vehicle, VehicleExternalInfo, VehiclePurchase, VehiclePurchaseLogisticsStatus } from '../types/vehicles.js';
2
+ export declare const PURCHASE_ARRIVED_STATUSES: readonly VehiclePurchaseLogisticsStatus[];
3
+ export declare const hasPurchaseArrived: (purchase: Pick<VehiclePurchase, 'logistics'>) => boolean;
2
4
  export declare const isDealInMarketing: (purchase: VehiclePurchase | undefined) => boolean;
3
5
  export declare const isSourceMastered: (vehicle: Pick<Vehicle, 'original'>, purchase: VehiclePurchase | undefined) => boolean;
4
6
  export declare const isUnavailableFromSource: (vehicle: Pick<Vehicle, 'original'>, purchase: VehiclePurchase | undefined) => boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"vehicles.d.ts","sourceRoot":"/","sources":["utils/vehicles.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,eAAe,EAEhB,MAAM,sBAAsB,CAAC;AAO9B,eAAO,MAAM,iBAAiB,aAAc,eAAe,GAAG,SAAS,KAAG,OACQ,CAAC;AASnF,eAAO,MAAM,gBAAgB,YAClB,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,YACxB,eAAe,GAAG,SAAS,KACpC,OAAkE,CAAC;AAQtE,eAAO,MAAM,uBAAuB,YACzB,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,YACxB,eAAe,GAAG,SAAS,KACpC,OAC+F,CAAC;AAOnG,eAAO,MAAM,YAAY,YAAa,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,KAAG,OAG1B,CAAC;AAEzC,eAAO,MAA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@bisondesk/commons-sdk/formatting';
3
3
  import { Categories } from '../constants.js';
4
- import { VehiclePurchaseDealStatus, } from '../types/vehicles.js';
4
+ import { VehiclePurchaseDealStatus, VehiclePurchaseLogisticsStatus, } from '../types/vehicles.js';
5
+ export const PURCHASE_ARRIVED_STATUSES = [
6
+ VehiclePurchaseLogisticsStatus.Arrived,
7
+ VehiclePurchaseLogisticsStatus.CheckedIn,
8
+ ];
9
+ export const hasPurchaseArrived = (purchase) => PURCHASE_ARRIVED_STATUSES.includes(purchase.logistics.status);
5
10
  export const isDealInMarketing = (purchase) => purchase == null || purchase.deal.status === VehiclePurchaseDealStatus.Marketing;
6
11
  export const isSourceMastered = (vehicle, purchase) => vehicle.original != null && isDealInMarketing(purchase);
7
12
  export const isUnavailableFromSource = (vehicle, purchase) => isSourceMastered(vehicle, purchase) && (vehicle.original?.salesConditions?.unavailable ?? false);
@@ -1 +1 @@
1
- {"version":3,"file":"vehicles.js","sourceRoot":"/","sources":["utils/vehicles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAIL,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAO9B,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,QAAqC,EAAW,EAAE,CAClF,QAAQ,IAAI,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,KAAK,yBAAyB,CAAC,SAAS,CAAC;AASnF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,OAAkC,EAClC,QAAqC,EAC5B,EAAE,CAAC,OAAO,CAAC,QAAQ,IAAI,IAAI,IAAI,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAQtE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,OAAkC,EAClC,QAAqC,EAC5B,E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AU,GAAG;QACjB,QAAQ,CAAC,cAAc,EAAE,UAAU,EAAE,QAAQ;QAC7C,QAAQ,CAAC,cAAc,EAAE,UAAU,EAAE,UAAU;KAChD;SACE,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;SAC1B,IAAI,CAAC,EAAE,CAAC,CAAC;IACZ,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE;QAC1C,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,WAAW;KAClB,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,iBAAiB,CAAC;QAC7B,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;QACjE,QAAQ,CAAC,OAAO,EAAE,eAAe;QACjC,QAAQ,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,IAAI,IAAI;YACtC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC;YACpD,CAAC,CAAC,SAAS;QACb,QAAQ,CAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,IAAI,QAAQ,CAAC,UAAU,EAAE,SAAS,EAAE,KAAK;QACjF,UAAU;QACV,qBAAqB,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,SAAS;KAC9E,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["import { XError } from '@bisondesk/commons-sdk/errors';\nimport { joinWithSeparator } from '@bisondesk/commons-sdk/formatting';\nimport { Categories } from '../constants.js';\nimport {\n Vehicle,\n VehicleExternalInfo,\n VehiclePurchase,\n VehiclePurchaseDealStatus,\n} from '../types/vehicles.js';\n\n/**\n * The deal has not been committed: there is no purchase yet, or its deal is still in\n * `Marketing`. Copies are created in this state; it ends when the owner agrees to buy\n * (e.g. an ICO invoice moves the deal to PurchaseAgreed).\n */\nexport const isDealInMarketing = (purchase: VehiclePurchase | undefined): boolean =>\n purchase == null || purchase.deal.status === VehiclePurchaseDealStatus.Marketing;\n\n/**\n * A cross-tenant copy whose source still masters it: it has an `original` link and its deal is\n * still in Marketing ({@link isDealInMarketing}). While this holds, the next sync overwrites\n * `external` (specs, pictures, videos) and `salesConditions` from the source; once the deal\n * progresses, the vehicle is the owner's own stock and the sync hands off. Native vehicles are\n * never source-mastered.\n */\nexport const isSourceMastered = (\n vehicle: Pick<Vehicle, 'original'>,\n purchase: VehiclePurchase | undefined,\n): boolean => vehicle.original != null && isDealInMarketing(purchase);\n\n/**\n * A cross-tenant copy whose source is not sellable, as stamped on the last sync hop. Only\n * meaningful while the source still masters the copy ({@link isSourceMastered}): past Marketing\n * the vehicle is the owner's own stock, and a still-present flag is merely stale — the sync\n * clears it on the next source event — so it must be ignored.\n */\nexport const isUnavailableFromSource = (\n vehicle: Pick<Vehicle, 'original'>,\n purchase: VehiclePurchase | undefined,\n): boolean =>\n isSourceMastered(vehicle, purchase) && (vehicle.original?.salesConditions?.unavailable ?? false);\n\n/**\n * A trailer or semi-trailer that has never been used — what the sales ladder calls a new\n * trailer, and the reason it has opportunity types of its own (`NEW_TRAILER`,\n * `NEW_TRAILER_NEW_PRODUCTION`) instead of going through plain sales.\n */\nexport const isNewTrailer = (vehicle: Pick<Vehicle, 'external'>): boolean =>\n [Categories.Trailer, Categories.SemiTrailer].includes(\n vehicle.external.general.category as Categories,\n ) && !vehicle.external.condition?.used;\n\nexport const extractCustomFeatures = (vehicle: VehicleExternalInfo): string[] => {\n const features: {\n getValue: (vehicle: VehicleExternalInfo) => any;\n picklistValueId: string;\n }[] = [\n {\n getValue: (vehicle) => vehicle.superstructure?.crane?.present,\n picklistValueId: 'crane',\n },\n {\n getValue: (vehicle) => vehicle.superstructure?.tailgate?.present,\n picklistValueId: 'tailgate',\n },\n { getValue: (vehicle) => vehicle.accessories.adr, picklistValueId: 'adr' },\n {\n getValue: (vehicle) => vehicle.accessories.retarderIntarder,\n picklistValueId: 'retarderIntarder',\n },\n {\n getValue: (vehicle) => vehicle.accessories.hydraulicTipperKit,\n picklistValueId: 'hydraulicTipperKit',\n },\n {\n getValue: (vehicle) => vehicle.accessories.lowDeck,\n picklistValueId: 'lowDeck',\n },\n {\n getValue: (vehicle) => vehicle.accessories.coil,\n picklistValueId: 'coil',\n },\n {\n getValue: (vehicle) => vehicle.accessories.doubleStock,\n picklistValueId: 'doubleStock',\n },\n {\n getValue: (vehicle) => vehicle.accessories.mega,\n picklistValueId: 'mega',\n },\n {\n getValue: (vehicle) =>\n vehicle.salesConditions?.manufacturerWarranty?.available ||\n vehicle.salesConditions?.manufacturerWarranty?.included,\n picklistValueId: 'warranty',\n },\n ];\n\n return features\n .filter((feature) => !!feature.getValue(vehicle))\n .map((feature) => feature.picklistValueId);\n};\n\nexport const getInternalTitle = ({\n make,\n category,\n modelName,\n bodywork,\n modelTypeName,\n}: {\n category: string;\n make?: string;\n modelName?: string;\n modelTypeName?: string;\n bodywork?: string;\n}): string => {\n if (category === Categories.Trailer || category === Categories.SemiTrailer) {\n return [make, modelName, modelTypeName, bodywork]\n .filter((v): v is string => !!v)\n .map((v) => v.trim())\n .join(' ')\n .trim();\n }\n\n return [make, modelName, modelTypeName]\n .filter((v): v is string => !!v)\n .map((v) => v.trim())\n .join(' ')\n .trim();\n};\n\nconst ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n\n// example: 1 -> A, 2 -> B, 26 -> Z, 27 -> AA, 28 -> AB, 52 -> AZ, 53 -> BA, 54 -> BB, 702 -> ZZ\nexport const convertNumberToLetters = (num: number): string => {\n const lettersLength = ALPHABET.length;\n\n if (num < 1) {\n return '';\n }\n\n let remainder = num % lettersLength;\n let quotient = Math.floor(num / lettersLength);\n\n // If remainder is 0, it means we should map it to 'Z' and reduce the quotient by 1\n if (remainder === 0) {\n remainder = lettersLength;\n quotient -= 1;\n }\n\n return convertNumberToLetters(quotient) + ALPHABET.charAt(remainder - 1);\n};\n\n// example: A -> 1, B -> 2, Z -> 26, AA -> 27, AB -> 28, AZ -> 52, BA -> 53, BB -> 54, ZZ -> 702\nexport const convertLettersToNumber = (letters: string): number => {\n const base = ALPHABET.length;\n\n let result = 0;\n\n for (let i = 0; i < letters.length; i++) {\n const charValue = ALPHABET.indexOf(letters[i]) + 1;\n result = result * base + charValue;\n }\n\n return result;\n};\n\n/**\n * Canonical stock-number shape: a branch prefix of 1 to 3 letters followed by exactly 5 digits\n * and up to 2 trailing counter letters (e.g. B49397AB, TC12345 — see\n * {@link getNextRelatedStockNumber}). Callers supply the prefix pattern (concrete branch\n * prefixes, or a policy like `[A-Z]{2}`) and wrap their own boundary/anchor policy around the\n * returned pattern.\n */\nexport const buildStockNumberPattern = (prefixPattern: string): string =>\n `(?:${prefixPattern})\\\\d{5}[A-Z]{0,2}`;\n\nexport const getNextRelatedStockNumber = (stockNumber: string): string => {\n const counterPattern = /^([A-Z]+\\d{5})([A-Z]{0,2})$/;\n const match = stockNumber.match(counterPattern);\n if (match == null) {\n throw new XError('core-sdk.vehicles.bad-stock-number', { stockNumber });\n }\n\n const baseStockNumber = match[1];\n const counterLetters = match[2];\n const counterNumber = convertLettersToNumber(counterLetters);\n const nextCounterNumber = counterNumber + 1;\n const nextCounterLetters = convertNumberToLetters(nextCounterNumber);\n return `${baseStockNumber}${nextCounterLetters}`;\n};\n\n/**\n * Canonical VIN shape: exactly 17 characters from the VIN alphabet — letters A–Z and\n * digits 0–9, excluding I, O and Q. Unanchored so callers can wrap their own\n * boundary/anchor policy when scanning free text (mirror of {@link buildStockNumberPattern}).\n * Use {@link VIN_PATTERN} / {@link isValidVin} to validate a whole string.\n */\nexport const VIN_BODY_PATTERN = '[A-HJ-NPR-Z0-9]{17}';\n\nexport const VIN_PATTERN = new RegExp(`^${VIN_BODY_PATTERN}$`);\n\nexport const isValidVin = (vin: string): boolean => VIN_PATTERN.test(vin);\n\nexport const getVehicleDescription = (\n external: VehicleExternalInfo,\n {\n showStockNumber = false,\n showAxleConfiguration = false,\n lang,\n }: {\n showStockNumber?: boolean;\n showAxleConfiguration?: boolean;\n lang?: string;\n },\n) => {\n const dimensions = [\n external.superstructure?.dimensions?.extended,\n external.superstructure?.dimensions?.heightened,\n ]\n .filter((value) => !!value)\n .join('');\n const kmFormatter = Intl.NumberFormat(lang, {\n style: 'unit',\n unit: 'kilometer',\n });\n\n const text = joinWithSeparator([\n showStockNumber ? external.identification.stockNumber : undefined,\n external.history?.advertisingYear,\n external.condition?.odometer?.km != null\n ? kmFormatter.format(external.condition.odometer.km)\n : undefined,\n external.powertrain?.emissions?.subclass ?? external.powertrain?.emissions?.class,\n dimensions,\n showAxleConfiguration ? external.powertrain?.axles?.configuration : undefined,\n ]);\n\n return text;\n};\n"]}
1
+ {"version":3,"file":"vehicles.js","sourceRoot":"/","sources":["utils/vehicles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAIL,yBAAyB,EACzB,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAG9B,MAAM,CAAC,MAAM,yBAAyB,GAA8C;IAClF,8BAA8B,CAAC,OAAO;IACtC,8BAA8B,CAAC,SAAS;CACzC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,QAA4C,EAAW,EAAE,CAC1F,yBAAyB,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AAOhE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,QAAqC,EAAW,EAAE,CAClF,QAAQ,IAAI,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,KAAK,yBAAyB,CAAC,SAAS,CAAC;AASnF,MAAM,CA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ator } from '@bisondesk/commons-sdk/formatting';\nimport { Categories } from '../constants.js';\nimport {\n Vehicle,\n VehicleExternalInfo,\n VehiclePurchase,\n VehiclePurchaseDealStatus,\n VehiclePurchaseLogisticsStatus,\n} from '../types/vehicles.js';\n\n/** The logistics statuses at which the purchased vehicle is on our park. */\nexport const PURCHASE_ARRIVED_STATUSES: readonly VehiclePurchaseLogisticsStatus[] = [\n VehiclePurchaseLogisticsStatus.Arrived,\n VehiclePurchaseLogisticsStatus.CheckedIn,\n];\n\nexport const hasPurchaseArrived = (purchase: Pick<VehiclePurchase, 'logistics'>): boolean =>\n PURCHASE_ARRIVED_STATUSES.includes(purchase.logistics.status);\n\n/**\n * The deal has not been committed: there is no purchase yet, or its deal is still in\n * `Marketing`. Copies are created in this state; it ends when the owner agrees to buy\n * (e.g. an ICO invoice moves the deal to PurchaseAgreed).\n */\nexport const isDealInMarketing = (purchase: VehiclePurchase | undefined): boolean =>\n purchase == null || purchase.deal.status === VehiclePurchaseDealStatus.Marketing;\n\n/**\n * A cross-tenant copy whose source still masters it: it has an `original` link and its deal is\n * still in Marketing ({@link isDealInMarketing}). While this holds, the next sync overwrites\n * `external` (specs, pictures, videos) and `salesConditions` from the source; once the deal\n * progresses, the vehicle is the owner's own stock and the sync hands off. Native vehicles are\n * never source-mastered.\n */\nexport const isSourceMastered = (\n vehicle: Pick<Vehicle, 'original'>,\n purchase: VehiclePurchase | undefined,\n): boolean => vehicle.original != null && isDealInMarketing(purchase);\n\n/**\n * A cross-tenant copy whose source is not sellable, as stamped on the last sync hop. Only\n * meaningful while the source still masters the copy ({@link isSourceMastered}): past Marketing\n * the vehicle is the owner's own stock, and a still-present flag is merely stale — the sync\n * clears it on the next source event — so it must be ignored.\n */\nexport const isUnavailableFromSource = (\n vehicle: Pick<Vehicle, 'original'>,\n purchase: VehiclePurchase | undefined,\n): boolean =>\n isSourceMastered(vehicle, purchase) && (vehicle.original?.salesConditions?.unavailable ?? false);\n\n/**\n * A trailer or semi-trailer that has never been used — what the sales ladder calls a new\n * trailer, and the reason it has opportunity types of its own (`NEW_TRAILER`,\n * `NEW_TRAILER_NEW_PRODUCTION`) instead of going through plain sales.\n */\nexport const isNewTrailer = (vehicle: Pick<Vehicle, 'external'>): boolean =>\n [Categories.Trailer, Categories.SemiTrailer].includes(\n vehicle.external.general.category as Categories,\n ) && !vehicle.external.condition?.used;\n\nexport const extractCustomFeatures = (vehicle: VehicleExternalInfo): string[] => {\n const features: {\n getValue: (vehicle: VehicleExternalInfo) => any;\n picklistValueId: string;\n }[] = [\n {\n getValue: (vehicle) => vehicle.superstructure?.crane?.present,\n picklistValueId: 'crane',\n },\n {\n getValue: (vehicle) => vehicle.superstructure?.tailgate?.present,\n picklistValueId: 'tailgate',\n },\n { getValue: (vehicle) => vehicle.accessories.adr, picklistValueId: 'adr' },\n {\n getValue: (vehicle) => vehicle.accessories.retarderIntarder,\n picklistValueId: 'retarderIntarder',\n },\n {\n getValue: (vehicle) => vehicle.accessories.hydraulicTipperKit,\n picklistValueId: 'hydraulicTipperKit',\n },\n {\n getValue: (vehicle) => vehicle.accessories.lowDeck,\n picklistValueId: 'lowDeck',\n },\n {\n getValue: (vehicle) => vehicle.accessories.coil,\n picklistValueId: 'coil',\n },\n {\n getValue: (vehicle) => vehicle.accessories.doubleStock,\n picklistValueId: 'doubleStock',\n },\n {\n getValue: (vehicle) => vehicle.accessories.mega,\n picklistValueId: 'mega',\n },\n {\n getValue: (vehicle) =>\n vehicle.salesConditions?.manufacturerWarranty?.available ||\n vehicle.salesConditions?.manufacturerWarranty?.included,\n picklistValueId: 'warranty',\n },\n ];\n\n return features\n .filter((feature) => !!feature.getValue(vehicle))\n .map((feature) => feature.picklistValueId);\n};\n\nexport const getInternalTitle = ({\n make,\n category,\n modelName,\n bodywork,\n modelTypeName,\n}: {\n category: string;\n make?: string;\n modelName?: string;\n modelTypeName?: string;\n bodywork?: string;\n}): string => {\n if (category === Categories.Trailer || category === Categories.SemiTrailer) {\n return [make, modelName, modelTypeName, bodywork]\n .filter((v): v is string => !!v)\n .map((v) => v.trim())\n .join(' ')\n .trim();\n }\n\n return [make, modelName, modelTypeName]\n .filter((v): v is string => !!v)\n .map((v) => v.trim())\n .join(' ')\n .trim();\n};\n\nconst ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n\n// example: 1 -> A, 2 -> B, 26 -> Z, 27 -> AA, 28 -> AB, 52 -> AZ, 53 -> BA, 54 -> BB, 702 -> ZZ\nexport const convertNumberToLetters = (num: number): string => {\n const lettersLength = ALPHABET.length;\n\n if (num < 1) {\n return '';\n }\n\n let remainder = num % lettersLength;\n let quotient = Math.floor(num / lettersLength);\n\n // If remainder is 0, it means we should map it to 'Z' and reduce the quotient by 1\n if (remainder === 0) {\n remainder = lettersLength;\n quotient -= 1;\n }\n\n return convertNumberToLetters(quotient) + ALPHABET.charAt(remainder - 1);\n};\n\n// example: A -> 1, B -> 2, Z -> 26, AA -> 27, AB -> 28, AZ -> 52, BA -> 53, BB -> 54, ZZ -> 702\nexport const convertLettersToNumber = (letters: string): number => {\n const base = ALPHABET.length;\n\n let result = 0;\n\n for (let i = 0; i < letters.length; i++) {\n const charValue = ALPHABET.indexOf(letters[i]) + 1;\n result = result * base + charValue;\n }\n\n return result;\n};\n\n/**\n * Canonical stock-number shape: a branch prefix of 1 to 3 letters followed by exactly 5 digits\n * and up to 2 trailing counter letters (e.g. B49397AB, TC12345 — see\n * {@link getNextRelatedStockNumber}). Callers supply the prefix pattern (concrete branch\n * prefixes, or a policy like `[A-Z]{2}`) and wrap their own boundary/anchor policy around the\n * returned pattern.\n */\nexport const buildStockNumberPattern = (prefixPattern: string): string =>\n `(?:${prefixPattern})\\\\d{5}[A-Z]{0,2}`;\n\nexport const getNextRelatedStockNumber = (stockNumber: string): string => {\n const counterPattern = /^([A-Z]+\\d{5})([A-Z]{0,2})$/;\n const match = stockNumber.match(counterPattern);\n if (match == null) {\n throw new XError('core-sdk.vehicles.bad-stock-number', { stockNumber });\n }\n\n const baseStockNumber = match[1];\n const counterLetters = match[2];\n const counterNumber = convertLettersToNumber(counterLetters);\n const nextCounterNumber = counterNumber + 1;\n const nextCounterLetters = convertNumberToLetters(nextCounterNumber);\n return `${baseStockNumber}${nextCounterLetters}`;\n};\n\n/**\n * Canonical VIN shape: exactly 17 characters from the VIN alphabet — letters A–Z and\n * digits 0–9, excluding I, O and Q. Unanchored so callers can wrap their own\n * boundary/anchor policy when scanning free text (mirror of {@link buildStockNumberPattern}).\n * Use {@link VIN_PATTERN} / {@link isValidVin} to validate a whole string.\n */\nexport const VIN_BODY_PATTERN = '[A-HJ-NPR-Z0-9]{17}';\n\nexport const VIN_PATTERN = new RegExp(`^${VIN_BODY_PATTERN}$`);\n\nexport const isValidVin = (vin: string): boolean => VIN_PATTERN.test(vin);\n\nexport const getVehicleDescription = (\n external: VehicleExternalInfo,\n {\n showStockNumber = false,\n showAxleConfiguration = false,\n lang,\n }: {\n showStockNumber?: boolean;\n showAxleConfiguration?: boolean;\n lang?: string;\n },\n) => {\n const dimensions = [\n external.superstructure?.dimensions?.extended,\n external.superstructure?.dimensions?.heightened,\n ]\n .filter((value) => !!value)\n .join('');\n const kmFormatter = Intl.NumberFormat(lang, {\n style: 'unit',\n unit: 'kilometer',\n });\n\n const text = joinWithSeparator([\n showStockNumber ? external.identification.stockNumber : undefined,\n external.history?.advertisingYear,\n external.condition?.odometer?.km != null\n ? kmFormatter.format(external.condition.odometer.km)\n : undefined,\n external.powertrain?.emissions?.subclass ?? external.powertrain?.emissions?.class,\n dimensions,\n showAxleConfiguration ? external.powertrain?.axles?.configuration : undefined,\n ]);\n\n return text;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bisondesk/core-sdk",
3
- "version": "1.0.651",
3
+ "version": "1.0.652",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "author": "TheTruckCompany",
@@ -287,9 +287,11 @@ export const upsertLeasingContract = async (
287
287
  export const getLeasingAmortizations = async (
288
288
  tenantId: string,
289
289
  contractId: string,
290
+ asOfDate?: string,
290
291
  ): Promise<AmortizationTable | undefined> => {
291
292
  const auth = await getAdminAuth();
292
- const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts/${contractId}/amortization`;
293
+ const query = asOfDate != null ? `?asOfDate=${encodeURIComponent(asOfDate)}` : '';
294
+ const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts/${contractId}/amortization${query}`;
293
295
  const response: Response = await fetch(url, {
294
296
  headers: {
295
297
  Authorization: auth,
@@ -0,0 +1,13 @@
1
+ export var ActivityType;
2
+ (function (ActivityType) {
3
+ ActivityType["CALL"] = "call";
4
+ ActivityType["MEETING"] = "meeting";
5
+ ActivityType["EMAIL"] = "email";
6
+ ActivityType["CHAT"] = "chat";
7
+ })(ActivityType || (ActivityType = {}));
8
+ export var ActivityActions;
9
+ (function (ActivityActions) {
10
+ ActivityActions["DELETE"] = "delete";
11
+ ActivityActions["EDIT"] = "edit";
12
+ })(ActivityActions || (ActivityActions = {}));
13
+ //# sourceMappingURL=activities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activities.js","sourceRoot":"","sources":["activities.ts"],"names":[],"mappings":"AAGA,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,mCAAmB,CAAA;IACnB,+BAAe,CAAA;IACf,6BAAa,CAAA;AACf,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AAED,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,oCAAiB,CAAA;IACjB,gCAAa,CAAA;AACf,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=comparables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comparables.js","sourceRoot":"","sources":["comparables.ts"],"names":[],"mappings":""}
@@ -0,0 +1,58 @@
1
+ export var OrganizatioRiskTags;
2
+ (function (OrganizatioRiskTags) {
3
+ OrganizatioRiskTags["BAD_FINANCIAL_INFO"] = "BAD_FINANCIAL_INFO";
4
+ OrganizatioRiskTags["VAT_NUMBER_INVALID"] = "VAT_NUMBER_INVALID";
5
+ OrganizatioRiskTags["INSTINCT"] = "INSTINCT";
6
+ OrganizatioRiskTags["NEW_CUSTOMER"] = "NEW_CUSTOMER";
7
+ OrganizatioRiskTags["BANK_ACCOUNT_BLOCKED"] = "BANK_ACCOUNT_BLOCKED";
8
+ OrganizatioRiskTags["NO_GPS"] = "NO_GPS";
9
+ })(OrganizatioRiskTags || (OrganizatioRiskTags = {}));
10
+ export var ContactActions;
11
+ (function (ContactActions) {
12
+ ContactActions["UPSERT"] = "upsert";
13
+ ContactActions["DELETE"] = "delete";
14
+ })(ContactActions || (ContactActions = {}));
15
+ export var OrganizationActions;
16
+ (function (OrganizationActions) {
17
+ OrganizationActions["ADD_ACTIVITY"] = "add_activity";
18
+ OrganizationActions["UPSERT"] = "upsert";
19
+ OrganizationActions["DELETE"] = "delete";
20
+ OrganizationActions["SELL_TO_ORGANIZATION"] = "sell_to_organization";
21
+ })(OrganizationActions || (OrganizationActions = {}));
22
+ export var MarketingChannel;
23
+ (function (MarketingChannel) {
24
+ MarketingChannel["Email"] = "email";
25
+ MarketingChannel["Whatsapp"] = "whatsapp";
26
+ MarketingChannel["Sms"] = "sms";
27
+ MarketingChannel["Phone"] = "phone";
28
+ })(MarketingChannel || (MarketingChannel = {}));
29
+ export var PartnerLevel;
30
+ (function (PartnerLevel) {
31
+ PartnerLevel["Internal"] = "05-internal";
32
+ PartnerLevel["Gold"] = "10-gold";
33
+ PartnerLevel["Silver"] = "20-silver";
34
+ PartnerLevel["Bronze"] = "30-bronze";
35
+ })(PartnerLevel || (PartnerLevel = {}));
36
+ export var SaveContactResolution;
37
+ (function (SaveContactResolution) {
38
+ SaveContactResolution["IgnoreDuplicates"] = "IGNORE_DUPLICATES";
39
+ SaveContactResolution["BlockDuplicates"] = "BLOCK_DUPLICATES";
40
+ })(SaveContactResolution || (SaveContactResolution = {}));
41
+ export var SaveOrgResolution;
42
+ (function (SaveOrgResolution) {
43
+ SaveOrgResolution["IgnoreDuplicates"] = "IGNORE_DUPLICATES";
44
+ SaveOrgResolution["BlockDuplicates"] = "BLOCK_DUPLICATES";
45
+ })(SaveOrgResolution || (SaveOrgResolution = {}));
46
+ export var CrmSearchScope;
47
+ (function (CrmSearchScope) {
48
+ CrmSearchScope["Tenant"] = "tenant";
49
+ CrmSearchScope["Conglomerate"] = "conglomerate";
50
+ })(CrmSearchScope || (CrmSearchScope = {}));
51
+ export var OrgEngagementType;
52
+ (function (OrgEngagementType) {
53
+ OrgEngagementType["offers"] = "offers";
54
+ OrgEngagementType["purchases"] = "purchases";
55
+ OrgEngagementType["opportunities"] = "opportunities";
56
+ OrgEngagementType["sales"] = "sales";
57
+ })(OrgEngagementType || (OrgEngagementType = {}));
58
+ //# sourceMappingURL=crm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crm.js","sourceRoot":"","sources":["crm.ts"],"names":[],"mappings":"AAUA,MAAM,CAAN,IAAY,mBAOX;AAPD,WAAY,mBAAmB;IAC7B,gEAAyC,CAAA;IACzC,gEAAyC,CAAA;IACzC,4CAAqB,CAAA;IACrB,oDAA6B,CAAA;IAC7B,oEAA6C,CAAA;IAC7C,wCAAiB,CAAA;AACnB,CAAC,EAPW,mBAAmB,KAAnB,mBAAmB,QAO9B;AAED,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,mCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAED,MAAM,CAAN,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC7B,oDAA6B,CAAA;IAC7B,wCAAiB,CAAA;IACjB,wCAAiB,CAAA;IACjB,oEAA6C,CAAA;AAC/C,CAAC,EALW,mBAAmB,KAAnB,mBAAmB,QAK9B;AAgKD,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,mCAAe,CAAA;IACf,yCAAqB,CAAA;IACrB,+BAAW,CAAA;IACX,mCAAe,CAAA;AACjB,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B;AAWD,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,wCAAwB,CAAA;IACxB,gCAAgB,CAAA;IAChB,oCAAoB,CAAA;IACpB,oCAAoB,CAAA;AACtB,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AA6CD,MAAM,CAAN,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,+DAAsC,CAAA;IACtC,6DAAoC,CAAA;AACtC,CAAC,EAHW,qBAAqB,KAArB,qBAAqB,QAGhC;AAED,MAAM,CAAN,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,2DAAsC,CAAA;IACtC,yDAAoC,CAAA;AACtC,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,QAG5B;AAED,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,+CAA6B,CAAA;AAC/B,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAED,MAAM,CAAN,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,4CAAuB,CAAA;IACvB,oDAA+B,CAAA;IAC/B,oCAAe,CAAA;AACjB,CAAC,EALW,iBAAiB,KAAjB,iBAAiB,QAK5B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=dashboard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dashboard.js","sourceRoot":"","sources":["dashboard.ts"],"names":[],"mappings":""}