@bisondesk/core-sdk 1.0.598 → 1.0.600
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/apis/leasing.d.ts +1 -0
- package/lib/apis/leasing.d.ts.map +1 -1
- package/lib/apis/leasing.js +18 -0
- package/lib/apis/leasing.js.map +1 -1
- package/lib/constants.d.ts.map +1 -1
- package/lib/constants.js.map +1 -1
- package/lib/types/analysis-purchases.d.ts +77 -0
- package/lib/types/analysis-purchases.d.ts.map +1 -0
- package/lib/types/analysis-purchases.js +2 -0
- package/lib/types/analysis-purchases.js.map +1 -0
- package/lib/types/crm.d.ts +3 -1
- package/lib/types/crm.d.ts.map +1 -1
- package/lib/types/crm.js +1 -0
- package/lib/types/crm.js.map +1 -1
- package/lib/types/import-markup.d.ts +6 -0
- package/lib/types/import-markup.d.ts.map +1 -0
- package/lib/types/import-markup.js +2 -0
- package/lib/types/import-markup.js.map +1 -0
- package/lib/types/leasing-debtors.d.ts +4 -1
- package/lib/types/leasing-debtors.d.ts.map +1 -1
- package/lib/types/leasing-debtors.js.map +1 -1
- package/lib/types/leasing-search.d.ts +2 -0
- package/lib/types/leasing-search.d.ts.map +1 -1
- package/lib/types/leasing-search.js.map +1 -1
- package/lib/types/leasing.d.ts +5 -0
- package/lib/types/leasing.d.ts.map +1 -1
- package/lib/types/leasing.js.map +1 -1
- package/lib/types/offers.d.ts +1 -0
- package/lib/types/offers.d.ts.map +1 -1
- package/lib/types/offers.js.map +1 -1
- package/lib/types/opportunities.d.ts +2 -1
- package/lib/types/opportunities.d.ts.map +1 -1
- package/lib/types/opportunities.js +1 -0
- package/lib/types/opportunities.js.map +1 -1
- package/lib/types/vehicles.d.ts +1 -0
- package/lib/types/vehicles.d.ts.map +1 -1
- package/lib/types/vehicles.js.map +1 -1
- package/lib/utils/contacts.d.ts +6 -0
- package/lib/utils/contacts.d.ts.map +1 -0
- package/lib/utils/contacts.js +8 -0
- package/lib/utils/contacts.js.map +1 -0
- package/package.json +1 -1
- package/src/apis/leasing.ts +26 -0
- package/src/constants.ts +1 -0
- package/src/types/analysis-purchases.ts +128 -0
- package/src/types/crm.ts +3 -0
- package/src/types/import-markup.ts +34 -0
- package/src/types/leasing-debtors.ts +6 -1
- package/src/types/leasing-search.ts +2 -0
- package/src/types/leasing.ts +10 -0
- package/src/types/offers.ts +1 -0
- package/src/types/opportunities.ts +11 -7
- package/src/types/vehicles.ts +2 -0
- package/src/utils/contacts.ts +16 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-tenant rule that marks up the **advertised** price of cross-tenant vehicle
|
|
3
|
+
* copies, without touching the cost recorded on the receiving tenant's purchase
|
|
4
|
+
* deal. Exactly one rule per tenant (singleton). Applied during cross-tenant sync
|
|
5
|
+
* while BisonDesk still owns the price (deal status `Marketing`); once an operator
|
|
6
|
+
* takes over pricing the rule no longer re-applies, so the markup never compounds.
|
|
7
|
+
*
|
|
8
|
+
* See `cross-tenant-sync/vehicles/markup.ts` for the application logic.
|
|
9
|
+
*/
|
|
10
|
+
export type ImportMarkupRule = {
|
|
11
|
+
/**
|
|
12
|
+
* Percentage added on top of the converted cost, e.g. `15` for +15%. `0` (or an
|
|
13
|
+
* absent rule) is a no-op — behaviour is identical to having no markup at all.
|
|
14
|
+
*/
|
|
15
|
+
markupPercent: number;
|
|
16
|
+
/**
|
|
17
|
+
* Optional absolute floor on the margin amount, expressed in the tenant's
|
|
18
|
+
* `defaultCurrency`. Converted to the target branch currency at apply-time. When
|
|
19
|
+
* the percentage markup yields a smaller margin than this, the floor wins:
|
|
20
|
+
* `price = max(cost × (1 + markupPercent/100), cost + minMargin)`. Only applied
|
|
21
|
+
* to the primary branch-currency `price`/`previousPrice`, never to the
|
|
22
|
+
* multi-currency `localizedPricing` entries (where an absolute floor is undefined
|
|
23
|
+
* without per-currency configuration).
|
|
24
|
+
*/
|
|
25
|
+
minMargin?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Optional rounding granularity for the primary branch-currency
|
|
28
|
+
* `price`/`previousPrice`. The marked-up amount is rounded **up** to the nearest
|
|
29
|
+
* multiple of `roundingStep`, so rounding never undercuts the intended margin.
|
|
30
|
+
* Example: `1000` turns 47 320 into 48 000. `localizedPricing` entries are rounded
|
|
31
|
+
* to whole units only.
|
|
32
|
+
*/
|
|
33
|
+
roundingStep?: number;
|
|
34
|
+
};
|
|
@@ -18,6 +18,7 @@ export type MonthData = {
|
|
|
18
18
|
|
|
19
19
|
export type DebtorInfo = {
|
|
20
20
|
clientId: string;
|
|
21
|
+
branchIds: string[];
|
|
21
22
|
months: MonthData[];
|
|
22
23
|
|
|
23
24
|
// properties related to the current month
|
|
@@ -247,6 +248,7 @@ export type LegalDossier = {
|
|
|
247
248
|
id: string;
|
|
248
249
|
debtorDossierId: string;
|
|
249
250
|
caseNumber?: string;
|
|
251
|
+
courtDate?: string; // ISO date string (YYYY-MM-DD)
|
|
250
252
|
notes?: string;
|
|
251
253
|
createdAt: string;
|
|
252
254
|
createdBy: string;
|
|
@@ -260,7 +262,9 @@ export type NewLegalDossier = Omit<
|
|
|
260
262
|
'id' | 'createdAt' | 'updatedAt' | 'createdBy' | 'updatedBy'
|
|
261
263
|
>;
|
|
262
264
|
|
|
263
|
-
export type UpdateLegalDossier = Partial<
|
|
265
|
+
export type UpdateLegalDossier = Partial<
|
|
266
|
+
Pick<LegalDossier, 'caseNumber' | 'courtDate' | 'status' | 'notes'>
|
|
267
|
+
>;
|
|
264
268
|
|
|
265
269
|
/******
|
|
266
270
|
* Debtor Dossier Events
|
|
@@ -307,6 +311,7 @@ export type SearchDebtorsDossier = {
|
|
|
307
311
|
legalDossier?: LegalDossier;
|
|
308
312
|
paymentPlan?: DebtorsPaymentPlan;
|
|
309
313
|
hasPaymentPlan?: boolean;
|
|
314
|
+
branchIds?: string[];
|
|
310
315
|
tasks: {
|
|
311
316
|
totalTasks: number;
|
|
312
317
|
openTasks: number;
|
package/src/types/leasing.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AttachmentValue, Document, LinkValue } from '@bisondesk/commons-sdk/types';
|
|
2
2
|
import { BaseEvent } from './internal-events.js';
|
|
3
|
+
import { VehiclePurchaseLogisticsStatus } from './vehicles.js';
|
|
3
4
|
|
|
4
5
|
export enum LeasingContractActions {
|
|
5
6
|
CREATE_FINANCE_DOCUMENT = 'create_finance_document',
|
|
@@ -453,9 +454,18 @@ export type VehicleRetakeRequest = {
|
|
|
453
454
|
totalLoss?: boolean;
|
|
454
455
|
cloneVehicle?: boolean;
|
|
455
456
|
stopBilling?: boolean;
|
|
457
|
+
/** Initial logistics status of the cloned vehicle's purchase. Only honored when cloneVehicle is true. */
|
|
458
|
+
cloneLogisticsStatus?:
|
|
459
|
+
| VehiclePurchaseLogisticsStatus.AtOrigin
|
|
460
|
+
| VehiclePurchaseLogisticsStatus.Arrived;
|
|
456
461
|
};
|
|
457
462
|
|
|
458
463
|
export type LeasingContractEndRequest = {
|
|
459
464
|
contractId: string;
|
|
460
465
|
endDate?: string;
|
|
461
466
|
};
|
|
467
|
+
|
|
468
|
+
export type CloneRetakeVehicleRequest = {
|
|
469
|
+
/** Initial logistics status of the cloned vehicle's purchase. */
|
|
470
|
+
logisticsStatus: VehiclePurchaseLogisticsStatus.AtOrigin | VehiclePurchaseLogisticsStatus.Arrived;
|
|
471
|
+
};
|
package/src/types/offers.ts
CHANGED
|
@@ -140,13 +140,16 @@ type BaseOpportunity = {
|
|
|
140
140
|
branchCountry: string;
|
|
141
141
|
};
|
|
142
142
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
143
|
+
// type, branch and branchCountry are optional: when omitted, the server defaults them
|
|
144
|
+
// from the requester's preferred branches/opportunity types, then the tenant defaults.
|
|
145
|
+
export type NewOpportunity = Omit<BaseOpportunity, 'type' | 'branch' | 'branchCountry'> &
|
|
146
|
+
Partial<Pick<BaseOpportunity, 'type' | 'branch' | 'branchCountry'>> & {
|
|
147
|
+
id?: undefined;
|
|
148
|
+
createdAt?: undefined;
|
|
149
|
+
createdBy?: undefined;
|
|
150
|
+
modifiedAt?: undefined;
|
|
151
|
+
modifiedBy?: undefined;
|
|
152
|
+
};
|
|
150
153
|
|
|
151
154
|
export enum VehicleSaleDealStatus {
|
|
152
155
|
SaleAgreed = 'SALE_AGREED',
|
|
@@ -343,6 +346,7 @@ export const QUOTE_NEEDS_VALIDATION_NOTIFICATION_ORIGIN = 'quote-validation';
|
|
|
343
346
|
export const QUOTE_NOT_CREATED_BY_ACCOUNT_MANAGER = 'quote-not-created-by-account-manager';
|
|
344
347
|
export const QUOTE_VALIDATOR_FEEDBACK_NOTIFICATION_ORIGIN = 'quote-validation-feedback';
|
|
345
348
|
|
|
349
|
+
export const OPPORTUNITY_ASSIGNED_NOTIFICATION_ORIGIN = 'opportunity-assigned';
|
|
346
350
|
export const OPPORTUNITY_VEHICLE_AVAILABLE_NOTIFICATION_ORIGIN = 'opportunity-vehicle-available';
|
|
347
351
|
export const OPPORTUNITY_VEHICLE_DELIVERY_NOTIFICATION_ORIGIN = 'opportunity-vehicle-delivery';
|
|
348
352
|
export const OPPORTUNITY_VEHICLE_RESERVATION_ABOUT_TO_EXPIRE_NOTIFICATION_ORIGIN =
|
package/src/types/vehicles.ts
CHANGED
|
@@ -251,6 +251,8 @@ export type SearchVehicle = {
|
|
|
251
251
|
priceChangedAt?: string;
|
|
252
252
|
checkedInAt?: string;
|
|
253
253
|
saleAgreementAt?: string;
|
|
254
|
+
/** Date the vehicle entered virtual inventory (marketing ?? evaluation ?? purchase-agreed). */
|
|
255
|
+
virtualInventoryStartedAt?: string;
|
|
254
256
|
};
|
|
255
257
|
purchase?: {
|
|
256
258
|
supplierStockNumber?: string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const JOB_CATEGORY_OTHER_ID = 'job_category_other';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Resolves a contact's job to the value that downstream systems should see.
|
|
5
|
+
* When the picklist selection is "Other", the custom `jobOther` text takes precedence;
|
|
6
|
+
* otherwise the picklist id in `job` is returned as-is.
|
|
7
|
+
*/
|
|
8
|
+
export const resolveContactJob = (contact: {
|
|
9
|
+
job?: string;
|
|
10
|
+
jobOther?: string;
|
|
11
|
+
}): string | undefined => {
|
|
12
|
+
if (contact.job === JOB_CATEGORY_OTHER_ID && contact.jobOther) {
|
|
13
|
+
return contact.jobOther;
|
|
14
|
+
}
|
|
15
|
+
return contact.job;
|
|
16
|
+
};
|