@bisondesk/core-sdk 1.0.432 → 1.0.434
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/types/dashboard.d.ts +34 -0
- package/lib/types/dashboard.d.ts.map +1 -0
- package/lib/types/dashboard.js +2 -0
- package/lib/types/dashboard.js.map +1 -0
- package/lib/types/internal-events.d.ts +13 -3
- package/lib/types/internal-events.d.ts.map +1 -1
- package/lib/types/internal-events.js +9 -0
- package/lib/types/internal-events.js.map +1 -1
- package/lib/types/leasing.d.ts +1 -3
- package/lib/types/leasing.d.ts.map +1 -1
- package/lib/types/leasing.js.map +1 -1
- package/lib/types/offers.d.ts +3 -7
- package/lib/types/offers.d.ts.map +1 -1
- package/lib/types/offers.js.map +1 -1
- package/lib/types/opportunities.d.ts +11 -8
- package/lib/types/opportunities.d.ts.map +1 -1
- package/lib/types/opportunities.js +7 -0
- package/lib/types/opportunities.js.map +1 -1
- package/lib/types/payments.d.ts +2 -1
- package/lib/types/payments.d.ts.map +1 -1
- package/lib/types/payments.js.map +1 -1
- package/lib/types/quotes.d.ts +1 -10
- package/lib/types/quotes.d.ts.map +1 -1
- package/lib/types/quotes.js.map +1 -1
- package/lib/types/vehicle-sales.d.ts +1 -1
- package/lib/types/vehicle-sales.d.ts.map +1 -1
- package/lib/types/vehicle-sales.js.map +1 -1
- package/lib/types/vehicles.d.ts +3 -4
- package/lib/types/vehicles.d.ts.map +1 -1
- package/lib/types/vehicles.js +0 -1
- package/lib/types/vehicles.js.map +1 -1
- package/lib/utils/vehicles.js +6 -6
- package/lib/utils/vehicles.js.map +1 -1
- package/package.json +1 -1
- package/src/types/dashboard.ts +41 -0
- package/src/types/internal-events.ts +13 -2
- package/src/types/leasing.ts +1 -3
- package/src/types/offers.ts +3 -8
- package/src/types/opportunities.ts +14 -12
- package/src/types/payments.ts +4 -1
- package/src/types/quotes.ts +1 -4
- package/src/types/vehicle-sales.ts +1 -1
- package/src/types/vehicles.ts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G,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACrC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,WAAmB,EAAU,EAAE;IACvE,MAAM,cAAc,GAAG,6BAA6B,CAAC;IACrD,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAChD,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAClB,MAAM,IAAI,MAAM,CAAC,oCAAoC,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,MAAM,eAAe,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACjC,MAAM,cAAc,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,aAAa,GAAG,sBAAsB,CAAC,cAAc,CAAC,CAAC;IAC7D,MAAM,iBAAiB,GAAG,aAAa,GAAG,CAAC,CAAC;IAC5C,MAAM,kBAAkB,GAAG,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;IACrE,OAAO,GAAG,eAAe,GAAG,kBAAkB,EAAE,CAAC;AACnD,CAAC,CAAC","sourcesContent":["import { XError } from '@bisondesk/commons-sdk/errors';\nimport { Categories } from '../constants.js';\nimport { VehicleExternalInfo } from '../types/vehicles.js';\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\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, 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\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"]}
|
package/package.json
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type KeyMetric = {
|
|
2
|
+
value: number;
|
|
3
|
+
target?: number;
|
|
4
|
+
format?: Intl.NumberFormatOptions;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export type LabeledKeyMetric = KeyMetric & {
|
|
8
|
+
id: string; // useful for linking translations to this metric
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type KeyMetricsData = {
|
|
12
|
+
data: LabeledKeyMetric[];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type HistoricalDataPoint = {
|
|
16
|
+
month: string; // Format: "YYYY-MM"
|
|
17
|
+
data: KeyMetric[];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type HistoricalData = {
|
|
21
|
+
metricIds: string[];
|
|
22
|
+
data: HistoricalDataPoint[];
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// Activity Log (Git-style) component data structure
|
|
26
|
+
export type PeriodActivity = {
|
|
27
|
+
period: string; // Format: "YYYY-MM-DD"
|
|
28
|
+
count: number;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type ActivityLogData = {
|
|
32
|
+
since: string; // Format: "YYYY-MM-DD"
|
|
33
|
+
until: string; // Format: "YYYY-MM-DD"
|
|
34
|
+
activities: PeriodActivity[];
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type DashboardData = {
|
|
38
|
+
keyMetrics: KeyMetricsData;
|
|
39
|
+
historicalData: HistoricalData;
|
|
40
|
+
activityLog: ActivityLogData;
|
|
41
|
+
};
|
|
@@ -3,7 +3,7 @@ export interface NotificationHandler {
|
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
export interface NotificationSubHandler {
|
|
6
|
-
accepts(evt: BaseEvent): boolean
|
|
6
|
+
accepts(evt: BaseEvent): Promise<boolean>;
|
|
7
7
|
handle(evt: BaseEvent): Promise<void>;
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -11,6 +11,15 @@ export enum InternalEventTypes {
|
|
|
11
11
|
VEHICLE_PURCHASE = 'vehicle-purchases',
|
|
12
12
|
ORGANIZATION = 'organizations',
|
|
13
13
|
CONTACT = 'contacts',
|
|
14
|
+
OPPORTUNITY = 'opportunities',
|
|
15
|
+
VEHICLE = 'vehicles',
|
|
16
|
+
PAYMENT = 'payments',
|
|
17
|
+
OFFER = 'offers',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export enum InternalNotificationChannels {
|
|
21
|
+
APP = 'app',
|
|
22
|
+
EMAIL = 'email',
|
|
14
23
|
}
|
|
15
24
|
|
|
16
25
|
export type BaseEvent = {
|
|
@@ -21,14 +30,16 @@ export type InternalNotificationDestination =
|
|
|
21
30
|
| {
|
|
22
31
|
email: string;
|
|
23
32
|
userId?: undefined;
|
|
33
|
+
channels: [InternalNotificationChannels.EMAIL];
|
|
24
34
|
}
|
|
25
35
|
| {
|
|
26
36
|
userId: string;
|
|
37
|
+
channels: InternalNotificationChannels[];
|
|
27
38
|
email?: undefined;
|
|
28
39
|
};
|
|
29
40
|
|
|
30
41
|
export type InternalNotificationEmailBaseData = {
|
|
31
|
-
mainPicture
|
|
42
|
+
mainPicture?: string;
|
|
32
43
|
body: string;
|
|
33
44
|
url: string;
|
|
34
45
|
emailHeader: string;
|
package/src/types/leasing.ts
CHANGED
|
@@ -106,14 +106,12 @@ type BaseLeasingContract<T = LeasingContractHyperportal | LeasingContractBisonde
|
|
|
106
106
|
startDate: string;
|
|
107
107
|
deliveryDate?: string;
|
|
108
108
|
endDate?: string;
|
|
109
|
+
slbPartner?: string;
|
|
109
110
|
links?: LinkValue[];
|
|
110
111
|
accountManager?: string;
|
|
111
112
|
clients: LeasingContractClient[];
|
|
112
113
|
hasSlbPartnerAmortisationTable?: boolean;
|
|
113
|
-
slbPartner?: string;
|
|
114
|
-
slbBankAccountOrganizationId?: string;
|
|
115
114
|
slbContractNumber?: string;
|
|
116
|
-
slbContractAmount?: string;
|
|
117
115
|
externalTracking?: boolean;
|
|
118
116
|
vehicle: {
|
|
119
117
|
id: string;
|
package/src/types/offers.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { DistributiveOmit, Document, LocationValue, NextList } from '@bisondesk/
|
|
|
2
2
|
import { BusinessEntityIds, WarningHints } from '../constants.js';
|
|
3
3
|
import { Contact, Organization, PartnerLevel } from './crm.js';
|
|
4
4
|
import { Insights, InsightsComparableSpecs } from './insights.js';
|
|
5
|
+
import { BaseEvent } from './internal-events.js';
|
|
5
6
|
import { BaseSearchRequest } from './search.js';
|
|
6
7
|
import { DataRecord, ReferenceData } from './utils.js';
|
|
7
8
|
import {
|
|
@@ -322,7 +323,7 @@ export type OfferPurchase = {
|
|
|
322
323
|
};
|
|
323
324
|
};
|
|
324
325
|
|
|
325
|
-
type BaseOfferEvent = {
|
|
326
|
+
type BaseOfferEvent = BaseEvent & {
|
|
326
327
|
id: string;
|
|
327
328
|
actionAt: string;
|
|
328
329
|
tenantId: string;
|
|
@@ -341,10 +342,4 @@ export type OfferUpdatedEvent = BaseOfferEvent & {
|
|
|
341
342
|
previousOffer: Offer;
|
|
342
343
|
};
|
|
343
344
|
|
|
344
|
-
export type
|
|
345
|
-
action: 'delete';
|
|
346
|
-
offer?: undefined;
|
|
347
|
-
previousOffer: Offer;
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
export type OfferEvent = OfferCreatedEvent | OfferUpdatedEvent | OfferDeletedEvent;
|
|
345
|
+
export type OfferEvent = OfferCreatedEvent | OfferUpdatedEvent;
|
|
@@ -2,6 +2,7 @@ import { Document, NextList } from '@bisondesk/commons-sdk/types';
|
|
|
2
2
|
import { BusinessEntityIds, OpportunityType, WarningHints } from '../constants.js';
|
|
3
3
|
import { Contact, Organization } from './crm.js';
|
|
4
4
|
import type { InterestBffMeta, OpportunityInterest } from './interests.js';
|
|
5
|
+
import { BaseEvent } from './internal-events.js';
|
|
5
6
|
import { Payment } from './payments.js';
|
|
6
7
|
import { Quote, QuoteStatus } from './quotes.js';
|
|
7
8
|
import { OpportunityReservation } from './reservations.js';
|
|
@@ -251,7 +252,7 @@ export type OpportunityBFF = {
|
|
|
251
252
|
};
|
|
252
253
|
};
|
|
253
254
|
|
|
254
|
-
type BaseOpportunityEvent = {
|
|
255
|
+
type BaseOpportunityEvent = BaseEvent & {
|
|
255
256
|
actionAt: string;
|
|
256
257
|
userId: string;
|
|
257
258
|
tenantId: string;
|
|
@@ -269,21 +270,12 @@ export type OpportunityUpdateEvent = BaseOpportunityEvent & {
|
|
|
269
270
|
action: 'update';
|
|
270
271
|
};
|
|
271
272
|
|
|
272
|
-
export type
|
|
273
|
-
opportunity?: undefined;
|
|
274
|
-
previousOpportunity: Opportunity;
|
|
275
|
-
action: 'delete';
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
export type OpportunityEvent =
|
|
279
|
-
| OpportunityCreateEvent
|
|
280
|
-
| OpportunityUpdateEvent
|
|
281
|
-
| OpportunityDeleteEvent;
|
|
273
|
+
export type OpportunityEvent = OpportunityCreateEvent | OpportunityUpdateEvent;
|
|
282
274
|
|
|
283
275
|
export type QuoteEvent = {
|
|
284
276
|
quote: Quote;
|
|
285
277
|
opportunity: Opportunity;
|
|
286
|
-
action: 'create' | 'update'
|
|
278
|
+
action: 'create' | 'update';
|
|
287
279
|
actionAt: string;
|
|
288
280
|
userId: string;
|
|
289
281
|
tenantId: string;
|
|
@@ -315,6 +307,7 @@ export type SearchOpportunity = {
|
|
|
315
307
|
export const QUOTE_NEEDS_VALIDATION_NOTIFICATION_ORIGIN = 'quote-validation';
|
|
316
308
|
export const QUOTE_NOT_CREATED_BY_ACCOUNT_MANAGER = 'quote-not-created-by-account-manager';
|
|
317
309
|
export const QUOTE_VALIDATOR_FEEDBACK_NOTIFICATION_ORIGIN = 'quote-validation-feedback';
|
|
310
|
+
|
|
318
311
|
export const OPPORTUNITY_VEHICLE_AVAILABLE_NOTIFICATION_ORIGIN = 'opportunity-vehicle-available';
|
|
319
312
|
export const OPPORTUNITY_VEHICLE_DELIVERY_NOTIFICATION_ORIGIN = 'opportunity-vehicle-delivery';
|
|
320
313
|
export const OPPORTUNITY_VEHICLE_RESERVATION_ABOUT_TO_EXPIRE_NOTIFICATION_ORIGIN =
|
|
@@ -322,6 +315,15 @@ export const OPPORTUNITY_VEHICLE_RESERVATION_ABOUT_TO_EXPIRE_NOTIFICATION_ORIGIN
|
|
|
322
315
|
export const OPPORTUNITY_VEHICLE_RESERVATION_EXPIRED_NOTIFICATION_ORIGIN =
|
|
323
316
|
'opportunity-vehicle-reservation-expired';
|
|
324
317
|
|
|
318
|
+
export const OFFER_SET_FINAL_VALUATION_ORIGIN = 'offer-set-final-valuation';
|
|
319
|
+
|
|
320
|
+
export const VEHICLE_PRICE_DECREASES_NOTIFICATION_ORIGIN = 'vehicle-price-decreased';
|
|
321
|
+
export const VEHICLE_ARRIVED_NOTIFICATION_ORIGIN = 'vehicle-arrived';
|
|
322
|
+
export const VEHICLE_CHECKEDIN_NOTIFICATION_ORIGIN = 'vehicle-checkedin';
|
|
323
|
+
export const VEHICLE_PURCHASED_NOTIFICATION_ORIGIN = 'vehicle-purchased';
|
|
324
|
+
export const VEHICLE_PRICE_CHANGED_NOTIFICATION_ORIGIN = 'vehicle-price-changed';
|
|
325
|
+
export const VEHICLE_SOLD_NOTIFICATION_ORIGIN = 'vehicle-sold';
|
|
326
|
+
|
|
325
327
|
export type OpportunityNotificationData = {
|
|
326
328
|
quoteVersion?: number;
|
|
327
329
|
snippet?: string;
|
package/src/types/payments.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { BaseEvent } from './internal-events.js';
|
|
2
|
+
|
|
1
3
|
export enum PaymentActions {
|
|
2
4
|
DELETE = 'delete',
|
|
3
5
|
EDIT = 'edit',
|
|
@@ -71,4 +73,5 @@ export type PaymentDeleteEvent = {
|
|
|
71
73
|
branchId: string;
|
|
72
74
|
};
|
|
73
75
|
|
|
74
|
-
export type PaymentEvent =
|
|
76
|
+
export type PaymentEvent = BaseEvent &
|
|
77
|
+
(PaymentCreateEvent | PaymentUpdateEvent | PaymentDeleteEvent);
|
package/src/types/quotes.ts
CHANGED
|
@@ -104,10 +104,7 @@ export type LeasingCalculatorInput = BaseQuoteCalculatorInput & {
|
|
|
104
104
|
residualPercentage: string;
|
|
105
105
|
duration: number;
|
|
106
106
|
salesPrice: string;
|
|
107
|
-
}
|
|
108
|
-
| { selfFinancing: true; financing?: undefined }
|
|
109
|
-
| { selfFinancing: false; financing?: { bankAccountOrganizationId: string; amount: string } }
|
|
110
|
-
);
|
|
107
|
+
};
|
|
111
108
|
taxes: {
|
|
112
109
|
yearlyRoadTax: boolean;
|
|
113
110
|
oneTimeRoadTax: boolean;
|
package/src/types/vehicles.ts
CHANGED
|
@@ -18,7 +18,6 @@ export enum VehicleRoles {
|
|
|
18
18
|
RENTAL = 'RENTAL',
|
|
19
19
|
BUILD = 'BUILD',
|
|
20
20
|
UNKNOWN = 'UNKNOWN',
|
|
21
|
-
BANK_FINANCE = 'BANK_FINANCE',
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
export enum VehicleFuelType {
|
|
@@ -50,7 +49,7 @@ export enum VehicleTachoTypes {
|
|
|
50
49
|
SmartTacho2 = 'SMART_TACHO_2',
|
|
51
50
|
}
|
|
52
51
|
|
|
53
|
-
type BaseVehicleEvent = {
|
|
52
|
+
type BaseVehicleEvent = BaseEvent & {
|
|
54
53
|
id: string;
|
|
55
54
|
actionAt: string;
|
|
56
55
|
userId: string;
|
|
@@ -250,6 +249,7 @@ export type SearchVehicle = {
|
|
|
250
249
|
dealStatus?: VehiclePurchaseDealStatus;
|
|
251
250
|
logisticsStatus?: VehiclePurchaseLogisticsStatus;
|
|
252
251
|
purchasedBy?: string;
|
|
252
|
+
parkingName?: string;
|
|
253
253
|
};
|
|
254
254
|
reservation?: Pick<OpportunityReservation, 'expiresAt' | 'opportunityId' | 'createdBy'>;
|
|
255
255
|
vehicle: Vehicle;
|
|
@@ -462,7 +462,6 @@ export type VehicleExternalInfo = {
|
|
|
462
462
|
};
|
|
463
463
|
salesConditions: {
|
|
464
464
|
leasing?: boolean;
|
|
465
|
-
expected?: boolean;
|
|
466
465
|
price?: string | undefined;
|
|
467
466
|
currency?: string | undefined;
|
|
468
467
|
marginScheme?: boolean;
|
package/src/utils/vehicles.ts
CHANGED
|
@@ -100,16 +100,16 @@ export const convertLettersToNumber = (letters: string): number => {
|
|
|
100
100
|
};
|
|
101
101
|
|
|
102
102
|
export const getNextRelatedStockNumber = (stockNumber: string): string => {
|
|
103
|
-
const counterPattern = /^([A-Z]
|
|
103
|
+
const counterPattern = /^([A-Z]+\d{5})([A-Z]{0,2})$/;
|
|
104
104
|
const match = stockNumber.match(counterPattern);
|
|
105
105
|
if (match == null) {
|
|
106
106
|
throw new XError('core-sdk.vehicles.bad-stock-number', { stockNumber });
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
const counterNumber = convertLettersToNumber(
|
|
109
|
+
const baseStockNumber = match[1];
|
|
110
|
+
const counterLetters = match[2];
|
|
111
|
+
const counterNumber = convertLettersToNumber(counterLetters);
|
|
112
112
|
const nextCounterNumber = counterNumber + 1;
|
|
113
|
-
const
|
|
114
|
-
return `${
|
|
113
|
+
const nextCounterLetters = convertNumberToLetters(nextCounterNumber);
|
|
114
|
+
return `${baseStockNumber}${nextCounterLetters}`;
|
|
115
115
|
};
|