@bisondesk/core-sdk 1.0.503 → 1.0.505
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/comparables.d.ts +9 -6
- package/lib/types/comparables.d.ts.map +1 -1
- package/lib/types/comparables.js.map +1 -1
- package/lib/types/leasing-debtors.d.ts +2 -1
- package/lib/types/leasing-debtors.d.ts.map +1 -1
- package/lib/types/leasing-debtors.js.map +1 -1
- package/lib/types/marketing-emails.d.ts +7 -5
- package/lib/types/marketing-emails.d.ts.map +1 -1
- package/lib/types/marketing-emails.js.map +1 -1
- package/lib/types/vehicles.d.ts +12 -1
- package/lib/types/vehicles.d.ts.map +1 -1
- package/lib/types/vehicles.js.map +1 -1
- package/lib/utils/vehicles.d.ts +1 -0
- package/lib/utils/vehicles.d.ts.map +1 -1
- package/lib/utils/vehicles.js +23 -0
- package/lib/utils/vehicles.js.map +1 -1
- package/package.json +1 -1
- package/src/types/comparables.ts +9 -7
- package/src/types/leasing-debtors.ts +2 -4
- package/src/types/marketing-emails.ts +7 -6
- package/src/types/vehicles.ts +10 -1
- package/src/utils/vehicles.ts +30 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -7,10 +7,7 @@ export type CampaignSearchRequest = {
|
|
|
7
7
|
query: NonNullable<SearchRequest['query']>;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
export type
|
|
11
|
-
id: string;
|
|
12
|
-
createdAt: string;
|
|
13
|
-
createdBy: string;
|
|
10
|
+
export type NewMarketingEmailCampaign = {
|
|
14
11
|
name: string;
|
|
15
12
|
|
|
16
13
|
vehicleIds: string[];
|
|
@@ -23,10 +20,14 @@ export type MarketingEmailCampaign = {
|
|
|
23
20
|
queries?: CampaignSearchRequest[];
|
|
24
21
|
leads?: boolean;
|
|
25
22
|
};
|
|
23
|
+
};
|
|
26
24
|
|
|
25
|
+
export type MarketingEmailCampaign = NewMarketingEmailCampaign & {
|
|
26
|
+
id: string;
|
|
27
|
+
createdAt: string;
|
|
28
|
+
createdBy: string;
|
|
29
|
+
distinctEmailCount: number;
|
|
27
30
|
runAt?: string;
|
|
28
|
-
// determined on the moment of sending by merging all the targets
|
|
29
|
-
fullEmailList?: string[];
|
|
30
31
|
};
|
|
31
32
|
|
|
32
33
|
export type MarketingCampaignSentEmail = {
|
package/src/types/vehicles.ts
CHANGED
|
@@ -12,8 +12,8 @@ import { BaseEvent } from './internal-events.js';
|
|
|
12
12
|
import { VehicleSaleLogisticsStatus } from './opportunities.js';
|
|
13
13
|
import { OpportunityReservation } from './reservations.js';
|
|
14
14
|
import { DataRecord } from './utils.js';
|
|
15
|
-
import { VehicleSaleInfo } from './vehicle-sales.js';
|
|
16
15
|
import { VehicleBusinessOverviewXL } from './vehicle-performance.js';
|
|
16
|
+
import { VehicleSaleInfo } from './vehicle-sales.js';
|
|
17
17
|
|
|
18
18
|
export enum VehicleRoles {
|
|
19
19
|
SALE = 'SALE',
|
|
@@ -778,9 +778,18 @@ export type VehicleShareData = {
|
|
|
778
778
|
name: string;
|
|
779
779
|
}[];
|
|
780
780
|
stockNumber: string;
|
|
781
|
+
price?: string;
|
|
782
|
+
description?: string;
|
|
781
783
|
publicLink?: string;
|
|
782
784
|
};
|
|
783
785
|
|
|
786
|
+
export type MarketingEmailData = {
|
|
787
|
+
message: string;
|
|
788
|
+
vehicles: VehicleShareData[];
|
|
789
|
+
vehiclePairs: { first: VehicleShareData; second?: VehicleShareData }[];
|
|
790
|
+
lastVehicle?: VehicleShareData;
|
|
791
|
+
};
|
|
792
|
+
|
|
784
793
|
export type VehicleReservationCreateEvent = BaseVehicleEvent & {
|
|
785
794
|
action: 'create';
|
|
786
795
|
reservation: OpportunityReservation;
|
package/src/utils/vehicles.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { XError } from '@bisondesk/commons-sdk/errors';
|
|
2
|
+
import { joinWithSeparator } from '@bisondesk/commons-sdk/formatting';
|
|
2
3
|
import { Categories } from '../constants.js';
|
|
3
4
|
import { VehicleExternalInfo } from '../types/vehicles.js';
|
|
4
5
|
|
|
@@ -117,3 +118,32 @@ export const getNextRelatedStockNumber = (stockNumber: string): string => {
|
|
|
117
118
|
const nextCounterLetters = convertNumberToLetters(nextCounterNumber);
|
|
118
119
|
return `${baseStockNumber}${nextCounterLetters}`;
|
|
119
120
|
};
|
|
121
|
+
|
|
122
|
+
export const getVehicleDescription = (
|
|
123
|
+
external: VehicleExternalInfo,
|
|
124
|
+
showStockNumber: boolean = false,
|
|
125
|
+
lang?: string
|
|
126
|
+
) => {
|
|
127
|
+
const dimensions = [
|
|
128
|
+
external.superstructure?.dimensions?.extended,
|
|
129
|
+
external.superstructure?.dimensions?.heightened,
|
|
130
|
+
]
|
|
131
|
+
.filter((value) => !!value)
|
|
132
|
+
.join('');
|
|
133
|
+
const kmFormatter = Intl.NumberFormat(lang, {
|
|
134
|
+
style: 'unit',
|
|
135
|
+
unit: 'kilometer',
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
const text = joinWithSeparator([
|
|
139
|
+
showStockNumber ? external.identification.stockNumber : undefined,
|
|
140
|
+
external.history?.advertisingYear,
|
|
141
|
+
external.condition?.odometer?.km != null
|
|
142
|
+
? kmFormatter.format(external.condition.odometer.km)
|
|
143
|
+
: undefined,
|
|
144
|
+
external.powertrain?.emissions?.class,
|
|
145
|
+
dimensions,
|
|
146
|
+
]);
|
|
147
|
+
|
|
148
|
+
return text;
|
|
149
|
+
};
|