@bisondesk/core-sdk 1.0.352 → 1.0.354
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/crm.d.ts.map +1 -1
- package/lib/apis/crm.js +60 -32
- package/lib/apis/crm.js.map +1 -1
- package/lib/apis/debtors.d.ts.map +1 -1
- package/lib/apis/debtors.js +7 -3
- package/lib/apis/debtors.js.map +1 -1
- package/lib/apis/internet-vehicles.d.ts.map +1 -1
- package/lib/apis/internet-vehicles.js +5 -3
- package/lib/apis/internet-vehicles.js.map +1 -1
- package/lib/apis/leasing-administration.d.ts.map +1 -1
- package/lib/apis/leasing-administration.js +10 -6
- package/lib/apis/leasing-administration.js.map +1 -1
- package/lib/apis/leasing.d.ts.map +1 -1
- package/lib/apis/leasing.js +39 -25
- package/lib/apis/leasing.js.map +1 -1
- package/lib/apis/opportunities.d.ts +0 -1
- package/lib/apis/opportunities.d.ts.map +1 -1
- package/lib/apis/opportunities.js +0 -9
- package/lib/apis/opportunities.js.map +1 -1
- package/lib/apis/tenants.d.ts.map +1 -1
- package/lib/apis/tenants.js +15 -10
- package/lib/apis/tenants.js.map +1 -1
- package/lib/apis/users.d.ts.map +1 -1
- package/lib/apis/users.js +9 -7
- package/lib/apis/users.js.map +1 -1
- package/lib/apis/vehicles.d.ts.map +1 -1
- package/lib/apis/vehicles.js +38 -24
- package/lib/apis/vehicles.js.map +1 -1
- package/lib/constants.d.ts +1 -0
- package/lib/constants.d.ts.map +1 -1
- package/lib/constants.js +1 -0
- package/lib/constants.js.map +1 -1
- package/lib/types/quotes.d.ts +1 -0
- package/lib/types/quotes.d.ts.map +1 -1
- package/lib/types/quotes.js.map +1 -1
- package/lib/types/vehicles.d.ts +2 -8
- package/lib/types/vehicles.d.ts.map +1 -1
- package/lib/types/vehicles.js.map +1 -1
- package/package.json +2 -2
- package/src/apis/crm.ts +128 -130
- package/src/apis/debtors.ts +13 -12
- package/src/apis/internet-vehicles.ts +5 -3
- package/src/apis/leasing-administration.ts +26 -28
- package/src/apis/leasing.ts +88 -101
- package/src/apis/opportunities.ts +0 -16
- package/src/apis/tenants.ts +31 -38
- package/src/apis/users.ts +9 -7
- package/src/apis/vehicles.ts +90 -103
- package/src/constants.ts +1 -0
- package/src/types/quotes.ts +2 -0
- package/src/types/vehicles.ts +2 -7
- package/tsconfig.tsbuildinfo +1 -1
- package/tsconfig.deploy.json +0 -5
- package/tsconfig.deploy.tsbuildinfo +0 -1
package/src/apis/vehicles.ts
CHANGED
|
@@ -10,22 +10,20 @@ export const getVehicle = async (
|
|
|
10
10
|
vehicleId: string
|
|
11
11
|
): Promise<DataRecord<Vehicle> | undefined> => {
|
|
12
12
|
const auth = await getAdminAuth();
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
);
|
|
13
|
+
const url = `${process.env.CORE_API_ORIGIN}/api/vehicles/${vehicleId}`;
|
|
14
|
+
const response: Response = await fetch(url, {
|
|
15
|
+
headers: {
|
|
16
|
+
Authorization: auth,
|
|
17
|
+
[TENANT_ID_ADMIN_HEADER]: tenantId,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
22
20
|
|
|
23
21
|
if (response.ok) {
|
|
24
22
|
return response.status === 200 ? (response.json() as any) : undefined;
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
const body = await response.text();
|
|
28
|
-
throw new XError(response.statusText, { body });
|
|
26
|
+
throw new XError(response.statusText, { url, body });
|
|
29
27
|
};
|
|
30
28
|
|
|
31
29
|
export const getVehicleByChassisNumber = async (
|
|
@@ -46,22 +44,20 @@ export const getVehiclePurchase = async (
|
|
|
46
44
|
vehicleId: string
|
|
47
45
|
): Promise<DataRecord<VehiclePurchase> | undefined> => {
|
|
48
46
|
const auth = await getAdminAuth();
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
{
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
);
|
|
47
|
+
const url = `${process.env.CORE_API_ORIGIN}/api/vehicles/${vehicleId}/purchase`;
|
|
48
|
+
const response: Response = await fetch(url, {
|
|
49
|
+
headers: {
|
|
50
|
+
Authorization: auth,
|
|
51
|
+
[TENANT_ID_ADMIN_HEADER]: tenantId,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
58
54
|
|
|
59
55
|
if (response.ok) {
|
|
60
56
|
return response.status === 200 ? (response.json() as any) : undefined;
|
|
61
57
|
}
|
|
62
58
|
|
|
63
59
|
const body = await response.text();
|
|
64
|
-
throw new XError(response.statusText, { body });
|
|
60
|
+
throw new XError(response.statusText, { url, body });
|
|
65
61
|
};
|
|
66
62
|
|
|
67
63
|
export const getVehicleByStockNumber = async (
|
|
@@ -69,22 +65,20 @@ export const getVehicleByStockNumber = async (
|
|
|
69
65
|
stockNumber: string
|
|
70
66
|
): Promise<Vehicle | undefined> => {
|
|
71
67
|
const auth = await getAdminAuth();
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
{
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
);
|
|
68
|
+
const url = `${process.env.CORE_API_ORIGIN}/api/vehicles/stock-number/${stockNumber}`;
|
|
69
|
+
const response: Response = await fetch(url, {
|
|
70
|
+
headers: {
|
|
71
|
+
Authorization: auth,
|
|
72
|
+
[TENANT_ID_ADMIN_HEADER]: tenantId,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
81
75
|
|
|
82
76
|
if (response.ok) {
|
|
83
77
|
return response.status === 200 ? (response.json() as any) : undefined;
|
|
84
78
|
}
|
|
85
79
|
|
|
86
80
|
const body = await response.text();
|
|
87
|
-
throw new XError(response.statusText, { body });
|
|
81
|
+
throw new XError(response.statusText, { url, body });
|
|
88
82
|
};
|
|
89
83
|
|
|
90
84
|
export const getVehicleByPurchaseStockNumber = async (
|
|
@@ -92,22 +86,20 @@ export const getVehicleByPurchaseStockNumber = async (
|
|
|
92
86
|
stockNumber: string
|
|
93
87
|
): Promise<Vehicle | undefined> => {
|
|
94
88
|
const auth = await getAdminAuth();
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
{
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
);
|
|
89
|
+
const url = `${process.env.CORE_API_ORIGIN}/api/vehicles/purchase-stock-number/${stockNumber}`;
|
|
90
|
+
const response: Response = await fetch(url, {
|
|
91
|
+
headers: {
|
|
92
|
+
Authorization: auth,
|
|
93
|
+
[TENANT_ID_ADMIN_HEADER]: tenantId,
|
|
94
|
+
},
|
|
95
|
+
});
|
|
104
96
|
|
|
105
97
|
if (response.ok) {
|
|
106
98
|
return response.status === 200 ? (response.json() as any) : undefined;
|
|
107
99
|
}
|
|
108
100
|
|
|
109
101
|
const body = await response.text();
|
|
110
|
-
throw new XError(response.statusText, { body });
|
|
102
|
+
throw new XError(response.statusText, { url, body });
|
|
111
103
|
};
|
|
112
104
|
|
|
113
105
|
export const listVehiclesMarketing = async (
|
|
@@ -117,23 +109,21 @@ export const listVehiclesMarketing = async (
|
|
|
117
109
|
opts?: { serviceId: string }
|
|
118
110
|
): Promise<{ id: string; data: VehicleMarketing }[]> => {
|
|
119
111
|
const auth = await getAdminAuth();
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
{
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
);
|
|
112
|
+
const url = `${process.env.CORE_API_ORIGIN}/api/vehicles/marketing/list?offset=${offset}&limit=${limit}`;
|
|
113
|
+
const response: Response = await fetch(url, {
|
|
114
|
+
headers: cleanHeaders({
|
|
115
|
+
Authorization: auth,
|
|
116
|
+
[TENANT_ID_ADMIN_HEADER]: tenantId,
|
|
117
|
+
[SERVICE_ID_ADMIN_HEADER]: opts?.serviceId,
|
|
118
|
+
}),
|
|
119
|
+
});
|
|
130
120
|
|
|
131
121
|
if (response.ok) {
|
|
132
122
|
return response.status === 200 ? (response.json() as any) : undefined;
|
|
133
123
|
}
|
|
134
124
|
|
|
135
125
|
const body = await response.text();
|
|
136
|
-
throw new XError(response.statusText, { tenantId, body, offset, limit });
|
|
126
|
+
throw new XError(response.statusText, { url, tenantId, body, offset, limit });
|
|
137
127
|
};
|
|
138
128
|
|
|
139
129
|
export const getVehicleMarketing = async (
|
|
@@ -141,22 +131,20 @@ export const getVehicleMarketing = async (
|
|
|
141
131
|
vehicleId: string
|
|
142
132
|
): Promise<VehicleMarketing | undefined> => {
|
|
143
133
|
const auth = await getAdminAuth();
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
{
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
);
|
|
134
|
+
const url = `${process.env.CORE_API_ORIGIN}/api/vehicles/${vehicleId}/marketing`;
|
|
135
|
+
const response: Response = await fetch(url, {
|
|
136
|
+
headers: {
|
|
137
|
+
Authorization: auth,
|
|
138
|
+
[TENANT_ID_ADMIN_HEADER]: tenantId,
|
|
139
|
+
},
|
|
140
|
+
});
|
|
153
141
|
|
|
154
142
|
if (response.ok) {
|
|
155
143
|
return response.status === 200 ? (response.json() as any) : undefined;
|
|
156
144
|
}
|
|
157
145
|
|
|
158
146
|
const body = await response.text();
|
|
159
|
-
throw new XError(response.statusText, { body });
|
|
147
|
+
throw new XError(response.statusText, { url, body });
|
|
160
148
|
};
|
|
161
149
|
|
|
162
150
|
export const saveMarketing = async (
|
|
@@ -166,24 +154,23 @@ export const saveMarketing = async (
|
|
|
166
154
|
): Promise<VehicleMarketing> => {
|
|
167
155
|
const auth = await getAdminAuth();
|
|
168
156
|
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
);
|
|
157
|
+
const url = `${process.env.CORE_API_ORIGIN}/api/vehicles/${vehicleId}/marketing`;
|
|
158
|
+
const method = 'POST';
|
|
159
|
+
const response: Response = await fetch(url, {
|
|
160
|
+
method,
|
|
161
|
+
headers: cleanHeaders({
|
|
162
|
+
Authorization: auth,
|
|
163
|
+
'Content-Type': 'application/json',
|
|
164
|
+
[TENANT_ID_ADMIN_HEADER]: tenantId,
|
|
165
|
+
}),
|
|
166
|
+
body: JSON.stringify(marketing),
|
|
167
|
+
});
|
|
181
168
|
|
|
182
169
|
if (response.ok) {
|
|
183
170
|
return response.json() as any;
|
|
184
171
|
}
|
|
185
172
|
const body = await response.text();
|
|
186
|
-
throw new XError(response.statusText, { body, tenantId, vehicleId, marketing });
|
|
173
|
+
throw new XError(response.statusText, { method, url, body, tenantId, vehicleId, marketing });
|
|
187
174
|
};
|
|
188
175
|
|
|
189
176
|
export const saveVehiclePurchase = async (
|
|
@@ -193,25 +180,24 @@ export const saveVehiclePurchase = async (
|
|
|
193
180
|
opts?: { serviceId: string }
|
|
194
181
|
): Promise<Vehicle> => {
|
|
195
182
|
const auth = await getAdminAuth();
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
);
|
|
183
|
+
const url = `${process.env.CORE_API_ORIGIN}/api/vehicles/${vehicleId}/purchase`;
|
|
184
|
+
const method = 'POST';
|
|
185
|
+
const response: Response = await fetch(url, {
|
|
186
|
+
method,
|
|
187
|
+
headers: cleanHeaders({
|
|
188
|
+
Authorization: auth,
|
|
189
|
+
'Content-Type': 'application/json',
|
|
190
|
+
[TENANT_ID_ADMIN_HEADER]: tenantId,
|
|
191
|
+
[SERVICE_ID_ADMIN_HEADER]: opts?.serviceId,
|
|
192
|
+
}),
|
|
193
|
+
body: JSON.stringify(purchase),
|
|
194
|
+
});
|
|
209
195
|
|
|
210
196
|
if (response.ok) {
|
|
211
197
|
return response.json() as any;
|
|
212
198
|
}
|
|
213
199
|
const body = await response.text();
|
|
214
|
-
throw new XError(response.statusText, { body, tenantId, vehicleId, purchase, opts });
|
|
200
|
+
throw new XError(response.statusText, { method, url, body, tenantId, vehicleId, purchase, opts });
|
|
215
201
|
};
|
|
216
202
|
|
|
217
203
|
export const saveVehicle = async (
|
|
@@ -220,8 +206,10 @@ export const saveVehicle = async (
|
|
|
220
206
|
opts?: { serviceId: string }
|
|
221
207
|
): Promise<Vehicle> => {
|
|
222
208
|
const auth = await getAdminAuth();
|
|
223
|
-
const
|
|
224
|
-
|
|
209
|
+
const url = `${process.env.CORE_API_ORIGIN}/api/vehicles`;
|
|
210
|
+
const method = 'POST';
|
|
211
|
+
const response: Response = await fetch(url, {
|
|
212
|
+
method,
|
|
225
213
|
headers: cleanHeaders({
|
|
226
214
|
Authorization: auth,
|
|
227
215
|
'Content-Type': 'application/json',
|
|
@@ -235,7 +223,7 @@ export const saveVehicle = async (
|
|
|
235
223
|
return response.json() as any;
|
|
236
224
|
}
|
|
237
225
|
const body = await response.text();
|
|
238
|
-
throw new XError(response.statusText, { body, tenantId, vehicle, opts });
|
|
226
|
+
throw new XError(response.statusText, { method, url, body, tenantId, vehicle, opts });
|
|
239
227
|
};
|
|
240
228
|
|
|
241
229
|
export const deleteVehicle = async (
|
|
@@ -244,22 +232,21 @@ export const deleteVehicle = async (
|
|
|
244
232
|
opts?: { serviceId: string }
|
|
245
233
|
): Promise<void> => {
|
|
246
234
|
const auth = await getAdminAuth();
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
);
|
|
235
|
+
const url = `${process.env.CORE_API_ORIGIN}/api/vehicles/${vehicleId}`;
|
|
236
|
+
const method = 'DELETE';
|
|
237
|
+
const response: Response = await fetch(url, {
|
|
238
|
+
method,
|
|
239
|
+
headers: cleanHeaders({
|
|
240
|
+
Authorization: auth,
|
|
241
|
+
[TENANT_ID_ADMIN_HEADER]: tenantId,
|
|
242
|
+
[SERVICE_ID_ADMIN_HEADER]: opts?.serviceId,
|
|
243
|
+
}),
|
|
244
|
+
});
|
|
258
245
|
|
|
259
246
|
if (response.ok) {
|
|
260
247
|
return;
|
|
261
248
|
}
|
|
262
249
|
|
|
263
250
|
const body = await response.text();
|
|
264
|
-
throw new XError(response.statusText, { body, tenantId, vehicleId, opts });
|
|
251
|
+
throw new XError(response.statusText, { method, url, body, tenantId, vehicleId, opts });
|
|
265
252
|
};
|
package/src/constants.ts
CHANGED
|
@@ -980,6 +980,7 @@ export const DEBTORS_MONTHS_UNTIL_TODAY_COUNT = 6;
|
|
|
980
980
|
// Email Template IDs
|
|
981
981
|
export const VEHICLE_SHARE_TEMPLATE_ID = 'vehicle-share';
|
|
982
982
|
export const SIGNATURE_EMAIL_TEMPLATE_ID = 'signature-email';
|
|
983
|
+
export const DOCUMENT_SHARE_TEMPLATE_ID = 'document-share';
|
|
983
984
|
|
|
984
985
|
export enum WarningHints {
|
|
985
986
|
INFO = 'info',
|
package/src/types/quotes.ts
CHANGED
package/src/types/vehicles.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { EmailDestination } from '@bisondesk/commons-sdk/messages';
|
|
2
1
|
import {
|
|
3
2
|
AttachmentValue,
|
|
4
3
|
Document,
|
|
5
4
|
LocationValue,
|
|
6
5
|
MultiLangValue,
|
|
7
6
|
SearchPermissions,
|
|
7
|
+
ShareEmailRequest,
|
|
8
8
|
} from '@bisondesk/commons-sdk/types';
|
|
9
9
|
import { OpportunityReservation } from './reservations.js';
|
|
10
10
|
|
|
@@ -647,11 +647,6 @@ export enum PurchaseActions {
|
|
|
647
647
|
ViewFinanceDocuments = 'view_finance_documents',
|
|
648
648
|
}
|
|
649
649
|
|
|
650
|
-
export type VehicleShareEmailRequest = {
|
|
651
|
-
country: string; // Lowercase ISO 3166-1 alpha-2 code, e.g. 'be'
|
|
652
|
-
to: EmailDestination[];
|
|
653
|
-
message: string;
|
|
654
|
-
subject: string;
|
|
650
|
+
export type VehicleShareEmailRequest = ShareEmailRequest & {
|
|
655
651
|
pictures: AttachmentValue[];
|
|
656
|
-
attachments?: AttachmentValue[];
|
|
657
652
|
};
|