@bisondesk/core-sdk 1.0.588 → 1.0.590
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.js.map +1 -1
- package/lib/apis/debtors.js.map +1 -1
- package/lib/apis/email-templates.js.map +1 -1
- package/lib/apis/insights.d.ts.map +1 -1
- package/lib/apis/insights.js.map +1 -1
- package/lib/apis/leasing-administration.js.map +1 -1
- package/lib/apis/leasing.d.ts +1 -1
- package/lib/apis/leasing.d.ts.map +1 -1
- package/lib/apis/leasing.js.map +1 -1
- package/lib/apis/offers.d.ts.map +1 -1
- package/lib/apis/offers.js.map +1 -1
- package/lib/apis/opportunities.d.ts.map +1 -1
- package/lib/apis/opportunities.js.map +1 -1
- package/lib/apis/tenants.js.map +1 -1
- package/lib/apis/users.d.ts.map +1 -1
- package/lib/apis/users.js +1 -1
- package/lib/apis/users.js.map +1 -1
- package/lib/apis/vehicle-sales.js.map +1 -1
- package/lib/apis/vehicles.js.map +1 -1
- package/lib/types/leasing-administration.js.map +1 -1
- package/lib/types/leasing.d.ts.map +1 -1
- package/lib/types/leasing.js.map +1 -1
- package/lib/types/offers.d.ts.map +1 -1
- package/lib/types/offers.js +1 -4
- package/lib/types/offers.js.map +1 -1
- package/lib/types/opportunities.d.ts +4 -0
- package/lib/types/opportunities.d.ts.map +1 -1
- package/lib/types/opportunities.js.map +1 -1
- package/lib/types/prospects.d.ts +4 -5
- package/lib/types/prospects.d.ts.map +1 -1
- package/lib/types/prospects.js.map +1 -1
- package/lib/types/quotes.d.ts.map +1 -1
- package/lib/types/quotes.js.map +1 -1
- package/lib/types/recently-viewed.js.map +1 -1
- package/lib/types/tenants.d.ts +2 -1
- package/lib/types/tenants.d.ts.map +1 -1
- package/lib/types/tenants.js +1 -0
- package/lib/types/tenants.js.map +1 -1
- package/lib/types/transports.d.ts +110 -0
- package/lib/types/transports.d.ts.map +1 -0
- package/lib/types/transports.js +44 -0
- package/lib/types/transports.js.map +1 -0
- package/lib/types/vehicles.d.ts +11 -2
- package/lib/types/vehicles.d.ts.map +1 -1
- package/lib/types/vehicles.js.map +1 -1
- package/lib/utils/debtors-dossiers.js.map +1 -1
- package/lib/utils/forms.js.map +1 -1
- package/lib/utils/integrations/vehicles.js.map +1 -1
- package/lib/utils/interests.js.map +1 -1
- package/lib/utils/leasing.d.ts +1 -1
- package/lib/utils/leasing.d.ts.map +1 -1
- package/lib/utils/leasing.js.map +1 -1
- package/lib/utils/opportunities.js.map +1 -1
- package/lib/utils/search.d.ts +1 -1
- package/lib/utils/search.d.ts.map +1 -1
- package/lib/utils/search.js.map +1 -1
- package/lib/utils/slug.js.map +1 -1
- package/lib/utils/vehicles.js.map +1 -1
- package/lib/utils/vehicles.test.js +1 -1
- package/lib/utils/vehicles.test.js.map +1 -1
- package/package.json +15 -10
- package/src/apis/crm.ts +14 -14
- package/src/apis/debtors.ts +1 -1
- package/src/apis/email-templates.ts +2 -2
- package/src/apis/insights.ts +3 -3
- package/src/apis/leasing-administration.ts +2 -2
- package/src/apis/leasing.ts +19 -19
- package/src/apis/offers.ts +9 -12
- package/src/apis/opportunities.ts +21 -24
- package/src/apis/tenants.ts +3 -3
- package/src/apis/users.ts +2 -2
- package/src/apis/vehicle-sales.ts +4 -4
- package/src/apis/vehicles.ts +12 -12
- package/src/types/activities.js +13 -0
- package/src/types/activities.js.map +1 -0
- package/src/types/comparables.js +2 -0
- package/src/types/comparables.js.map +1 -0
- package/src/types/crm.js +58 -0
- package/src/types/crm.js.map +1 -0
- package/src/types/dashboard.js +2 -0
- package/src/types/dashboard.js.map +1 -0
- package/src/types/definitions.js +2 -0
- package/src/types/definitions.js.map +1 -0
- package/src/types/fields.js +2 -0
- package/src/types/fields.js.map +1 -0
- package/src/types/insights.js +2 -0
- package/src/types/insights.js.map +1 -0
- package/src/types/interests.js +6 -0
- package/src/types/interests.js.map +1 -0
- package/src/types/internal-events.js +18 -0
- package/src/types/internal-events.js.map +1 -0
- package/src/types/internet-opportunities.js +2 -0
- package/src/types/internet-opportunities.js.map +1 -0
- package/src/types/internet-vehicles.js +2 -0
- package/src/types/internet-vehicles.js.map +1 -0
- package/src/types/leasing-administration.js +2 -0
- package/src/types/leasing-administration.js.map +1 -0
- package/src/types/leasing-administration.ts +3 -3
- package/src/types/leasing-debtors.js +2 -0
- package/src/types/leasing-debtors.js.map +1 -0
- package/src/types/leasing-search.js +2 -0
- package/src/types/leasing-search.js.map +1 -0
- package/src/types/leasing-settings.js +7 -0
- package/src/types/leasing-settings.js.map +1 -0
- package/src/types/leasing.js +38 -0
- package/src/types/leasing.js.map +1 -0
- package/src/types/leasing.ts +2 -2
- package/src/types/marketing.js +35 -0
- package/src/types/marketing.js.map +1 -0
- package/src/types/offers.js +56 -0
- package/src/types/offers.ts +1 -4
- package/src/types/opportunities.js +107 -0
- package/src/types/opportunities.js.map +1 -0
- package/src/types/opportunities.ts +4 -0
- package/src/types/payments.js +7 -0
- package/src/types/picklists.js +2 -0
- package/src/types/picklists.js.map +1 -0
- package/src/types/prospects.ts +4 -5
- package/src/types/quotes.js +42 -0
- package/src/types/quotes.ts +5 -5
- package/src/types/recently-viewed.js +2 -0
- package/src/types/recently-viewed.js.map +1 -0
- package/src/types/recently-viewed.ts +1 -1
- package/src/types/reservations.js +5 -0
- package/src/types/reservations.js.map +1 -0
- package/src/types/roi-ratings.js +5 -0
- package/src/types/roi-ratings.js.map +1 -0
- package/src/types/saved-filters.js +9 -0
- package/src/types/saved-filters.js.map +1 -0
- package/src/types/search.js +2 -0
- package/src/types/search.js.map +1 -0
- package/src/types/settings.js +2 -0
- package/src/types/settings.js.map +1 -0
- package/src/types/templates.js +2 -0
- package/src/types/templates.js.map +1 -0
- package/src/types/tenants.js +21 -0
- package/src/types/tenants.js.map +1 -0
- package/src/types/tenants.ts +1 -0
- package/src/types/transports.ts +149 -0
- package/src/types/user-performance.js +7 -0
- package/src/types/user-performance.js.map +1 -0
- package/src/types/utils.js +2 -0
- package/src/types/validation.js +2 -0
- package/src/types/validation.js.map +1 -0
- package/src/types/vehicle-sales.js +6 -0
- package/src/types/vehicle-sales.js.map +1 -0
- package/src/types/vehicles.js +98 -0
- package/src/types/vehicles.js.map +1 -0
- package/src/types/vehicles.ts +13 -2
- package/src/utils/debtors-dossiers.ts +1 -1
- package/src/utils/forms.ts +1 -1
- package/src/utils/integrations/vehicles.ts +1 -1
- package/src/utils/interests.ts +2 -2
- package/src/utils/leasing.js +6 -0
- package/src/utils/leasing.js.map +1 -0
- package/src/utils/leasing.ts +6 -6
- package/src/utils/opportunities.js +48 -0
- package/src/utils/opportunities.js.map +1 -0
- package/src/utils/opportunities.ts +1 -1
- package/src/utils/search.ts +16 -16
- package/src/utils/slug.ts +1 -1
- package/src/utils/vehicles.test.ts +1 -1
- package/src/utils/vehicles.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/src/apis/crm.ts
CHANGED
|
@@ -27,7 +27,7 @@ const emptyPaginatedList = {
|
|
|
27
27
|
export const getCrmOrganization = async (
|
|
28
28
|
tenantId: string,
|
|
29
29
|
organizationId: string,
|
|
30
|
-
opts?: { serviceId: string }
|
|
30
|
+
opts?: { serviceId: string },
|
|
31
31
|
): Promise<Organization | undefined> => {
|
|
32
32
|
const auth = await getAdminAuth();
|
|
33
33
|
const url = `${process.env.CORE_API_ORIGIN}/api/crm/organizations/${organizationId}`;
|
|
@@ -52,7 +52,7 @@ export const getCrmOrganization = async (
|
|
|
52
52
|
export const getCrmOrganizationByExternalId = async (
|
|
53
53
|
tenantId: string,
|
|
54
54
|
externalId: string,
|
|
55
|
-
opts?: { serviceId: string }
|
|
55
|
+
opts?: { serviceId: string },
|
|
56
56
|
): Promise<Organization | undefined> => {
|
|
57
57
|
const auth = await getAdminAuth();
|
|
58
58
|
const url = `${process.env.CORE_API_ORIGIN}/api/crm/organizations/external-id/${externalId}`;
|
|
@@ -76,7 +76,7 @@ export const getCrmOrganizationByExternalId = async (
|
|
|
76
76
|
|
|
77
77
|
export const getCrmOrganizationsByVatNumber = async (
|
|
78
78
|
tenantId: string,
|
|
79
|
-
vatNumber: string
|
|
79
|
+
vatNumber: string,
|
|
80
80
|
): Promise<Organization[]> => {
|
|
81
81
|
const auth = await getAdminAuth();
|
|
82
82
|
const url = `${process.env.CORE_API_ORIGIN}/admin/crm/organizations/vat/${encodeURIComponent(vatNumber)}`;
|
|
@@ -98,7 +98,7 @@ export const getCrmOrganizationsByVatNumber = async (
|
|
|
98
98
|
export const saveCrmOrganization = async (
|
|
99
99
|
tenantId: string,
|
|
100
100
|
org: Organization | NewOrganization,
|
|
101
|
-
opts?: { serviceId: string }
|
|
101
|
+
opts?: { serviceId: string },
|
|
102
102
|
): Promise<Organization> => {
|
|
103
103
|
const auth = await getAdminAuth();
|
|
104
104
|
const url = `${process.env.CORE_API_ORIGIN}/api/crm/organizations`;
|
|
@@ -126,7 +126,7 @@ export const patchCrmOrganization = async (
|
|
|
126
126
|
tenantId: string,
|
|
127
127
|
organizationId: string,
|
|
128
128
|
changes: Patch[],
|
|
129
|
-
opts?: { serviceId: string }
|
|
129
|
+
opts?: { serviceId: string },
|
|
130
130
|
): Promise<Organization> => {
|
|
131
131
|
const auth = await getAdminAuth();
|
|
132
132
|
const url = `${process.env.CORE_API_ORIGIN}/api/crm/organizations/${organizationId}`;
|
|
@@ -161,7 +161,7 @@ export const patchCrmOrganization = async (
|
|
|
161
161
|
export const searchCrmOrganizations = async (
|
|
162
162
|
tenantId: string,
|
|
163
163
|
req: SearchRequest,
|
|
164
|
-
opts?: { serviceId: string }
|
|
164
|
+
opts?: { serviceId: string },
|
|
165
165
|
): Promise<PaginatedList<SearchOrganization, ReferenceData>> => {
|
|
166
166
|
const auth = await getAdminAuth();
|
|
167
167
|
const url = `${process.env.CORE_API_ORIGIN}/api/crm/organizations/search/results`;
|
|
@@ -187,7 +187,7 @@ export const searchCrmOrganizations = async (
|
|
|
187
187
|
|
|
188
188
|
export const listUsedBranchIdsForOrganization = async (
|
|
189
189
|
tenantId: string,
|
|
190
|
-
organizationId: string
|
|
190
|
+
organizationId: string,
|
|
191
191
|
): Promise<string[]> => {
|
|
192
192
|
const auth = await getAdminAuth();
|
|
193
193
|
const url = `${process.env.CORE_API_ORIGIN}/api/crm/organizations/${organizationId}/branches`;
|
|
@@ -212,7 +212,7 @@ export const listUsedBranchIdsForOrganization = async (
|
|
|
212
212
|
export const searchCrmContacts = async (
|
|
213
213
|
tenantId: string,
|
|
214
214
|
req: SearchRequest,
|
|
215
|
-
opts?: { serviceId: string }
|
|
215
|
+
opts?: { serviceId: string },
|
|
216
216
|
): Promise<PaginatedList<SearchContact, ReferenceData>> => {
|
|
217
217
|
const auth = await getAdminAuth();
|
|
218
218
|
const url = `${process.env.CORE_API_ORIGIN}/api/crm/contacts/search/results`;
|
|
@@ -239,7 +239,7 @@ export const searchCrmContacts = async (
|
|
|
239
239
|
export const deleteCrmOrganization = async (
|
|
240
240
|
tenantId: string,
|
|
241
241
|
orgId: string,
|
|
242
|
-
opts?: { serviceId: string }
|
|
242
|
+
opts?: { serviceId: string },
|
|
243
243
|
): Promise<void> => {
|
|
244
244
|
const auth = await getAdminAuth();
|
|
245
245
|
const url = `${process.env.CORE_API_ORIGIN}/api/crm/organizations/${orgId}`;
|
|
@@ -262,7 +262,7 @@ export const deleteCrmOrganization = async (
|
|
|
262
262
|
export const listCrmContacts = async (
|
|
263
263
|
tenantId: string,
|
|
264
264
|
organizationId: string,
|
|
265
|
-
opts?: { serviceId: string }
|
|
265
|
+
opts?: { serviceId: string },
|
|
266
266
|
): Promise<Contact[]> => {
|
|
267
267
|
const auth = await getAdminAuth();
|
|
268
268
|
const url = `${process.env.CORE_API_ORIGIN}/admin/crm/organizations/${organizationId}/contacts`;
|
|
@@ -285,7 +285,7 @@ export const listCrmContacts = async (
|
|
|
285
285
|
export const listPotentialDuplicateOrgs = async (
|
|
286
286
|
tenantId: string,
|
|
287
287
|
org: Partial<Organization>,
|
|
288
|
-
opts?: { serviceId?: string; limit?: number; offset?: number }
|
|
288
|
+
opts?: { serviceId?: string; limit?: number; offset?: number },
|
|
289
289
|
): Promise<PaginatedList<SearchOrganization, ReferenceData>> => {
|
|
290
290
|
const auth = await getAdminAuth();
|
|
291
291
|
const limit = opts?.limit ?? '';
|
|
@@ -314,7 +314,7 @@ export const listPotentialDuplicateOrgs = async (
|
|
|
314
314
|
export const getCrmContact = async (
|
|
315
315
|
tenantId: string,
|
|
316
316
|
contactId: string,
|
|
317
|
-
opts?: { serviceId: string }
|
|
317
|
+
opts?: { serviceId: string },
|
|
318
318
|
): Promise<Contact | undefined> => {
|
|
319
319
|
const auth = await getAdminAuth();
|
|
320
320
|
const url = `${process.env.CORE_API_ORIGIN}/api/crm/contacts/${contactId}`;
|
|
@@ -337,7 +337,7 @@ export const getCrmContact = async (
|
|
|
337
337
|
export const saveCrmContact = async (
|
|
338
338
|
tenantId: string,
|
|
339
339
|
contact: Contact | NewContact,
|
|
340
|
-
opts?: { serviceId: string }
|
|
340
|
+
opts?: { serviceId: string },
|
|
341
341
|
): Promise<Contact> => {
|
|
342
342
|
const auth = await getAdminAuth();
|
|
343
343
|
const url = `${process.env.CORE_API_ORIGIN}/api/crm/contacts`;
|
|
@@ -365,7 +365,7 @@ export const deleteCrmContact = async (
|
|
|
365
365
|
tenantId: string,
|
|
366
366
|
contactId: string,
|
|
367
367
|
orgId: string = '',
|
|
368
|
-
opts?: { serviceId: string }
|
|
368
|
+
opts?: { serviceId: string },
|
|
369
369
|
): Promise<void> => {
|
|
370
370
|
const auth = await getAdminAuth();
|
|
371
371
|
const url = `${process.env.CORE_API_ORIGIN}/api/crm/contacts/${contactId}?orgId=${orgId}`;
|
package/src/apis/debtors.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { ReferenceData } from '../types/utils.js';
|
|
|
8
8
|
|
|
9
9
|
export const searchDebtorsInfo = async (
|
|
10
10
|
tenantId: string,
|
|
11
|
-
request: SearchRequest
|
|
11
|
+
request: SearchRequest,
|
|
12
12
|
): Promise<PaginatedList<SearchDebtorInfo, ReferenceData> | undefined> => {
|
|
13
13
|
const auth = await getAdminAuth();
|
|
14
14
|
const method = 'POST';
|
|
@@ -6,7 +6,7 @@ import { Template } from '../types/templates.js';
|
|
|
6
6
|
export const getEmailTemplate = async (
|
|
7
7
|
tenantId: string,
|
|
8
8
|
templateId: string,
|
|
9
|
-
country: string
|
|
9
|
+
country: string,
|
|
10
10
|
): Promise<Template> => {
|
|
11
11
|
const auth = await getAdminAuth();
|
|
12
12
|
const response: Response = await fetch(
|
|
@@ -18,7 +18,7 @@ export const getEmailTemplate = async (
|
|
|
18
18
|
[TENANT_ID_ADMIN_HEADER]: tenantId,
|
|
19
19
|
'Content-Type': 'application/json',
|
|
20
20
|
},
|
|
21
|
-
}
|
|
21
|
+
},
|
|
22
22
|
);
|
|
23
23
|
|
|
24
24
|
if (response.ok) {
|
package/src/apis/insights.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TENANT_ID_ADMIN_HEADER } from '@bisondesk/commons-sdk/constants';
|
|
2
|
-
import { NextList } from '@bisondesk/commons-sdk/types';
|
|
3
2
|
import { XError } from '@bisondesk/commons-sdk/errors';
|
|
4
3
|
import { getAdminAuth } from '@bisondesk/commons-sdk/fetch';
|
|
4
|
+
import { NextList } from '@bisondesk/commons-sdk/types';
|
|
5
5
|
import fetch, { Response } from 'node-fetch';
|
|
6
6
|
import { InsightsSimilarRequest, InsightsVehicleComparableResponse } from '../types/insights.js';
|
|
7
7
|
import { ReferenceData } from '../types/utils.js';
|
|
@@ -9,7 +9,7 @@ import { SearchVehicle } from '../types/vehicles.js';
|
|
|
9
9
|
|
|
10
10
|
export const getStockVehicleComparableWithMeta = async (
|
|
11
11
|
tenantId: string,
|
|
12
|
-
vehicleId: string
|
|
12
|
+
vehicleId: string,
|
|
13
13
|
): Promise<InsightsVehicleComparableResponse> => {
|
|
14
14
|
const auth = await getAdminAuth();
|
|
15
15
|
const url = `${process.env.CORE_API_ORIGIN}/api/insights/comparable/stock-vehicle/${vehicleId}`;
|
|
@@ -30,7 +30,7 @@ export const getStockVehicleComparableWithMeta = async (
|
|
|
30
30
|
|
|
31
31
|
export const getSimilarStockVehicles = async (
|
|
32
32
|
tenantId: string,
|
|
33
|
-
request: InsightsSimilarRequest
|
|
33
|
+
request: InsightsSimilarRequest,
|
|
34
34
|
): Promise<NextList<SearchVehicle, ReferenceData>> => {
|
|
35
35
|
const auth = await getAdminAuth();
|
|
36
36
|
const url = `${process.env.CORE_API_ORIGIN}/api/insights/similar/stock`;
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
export const createLeasingAdminUpload = async (
|
|
12
12
|
tenantId: string,
|
|
13
13
|
data: NewLeasingAdminUploadRequest,
|
|
14
|
-
opts?: { serviceId: string }
|
|
14
|
+
opts?: { serviceId: string },
|
|
15
15
|
): Promise<LeasingAdminUpload> => {
|
|
16
16
|
const auth = await getAdminAuth();
|
|
17
17
|
const url = `${process.env.CORE_API_ORIGIN}/api/leasing/administration/uploads`;
|
|
@@ -40,7 +40,7 @@ export const updateLeasingAdminUploadStatus = async (
|
|
|
40
40
|
handlerId: string,
|
|
41
41
|
uploadId: string,
|
|
42
42
|
newStatus: LeasingAdminUploadStatus,
|
|
43
|
-
opts?: { serviceId: string }
|
|
43
|
+
opts?: { serviceId: string },
|
|
44
44
|
): Promise<LeasingAdminUpload> => {
|
|
45
45
|
const auth = await getAdminAuth();
|
|
46
46
|
const url = `${process.env.CORE_API_ORIGIN}/api/leasing/administration/uploads/${handlerId}/${uploadId}/status`;
|
package/src/apis/leasing.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { XError } from '@bisondesk/commons-sdk/errors';
|
|
|
3
3
|
import { cleanHeaders, fetchJson, getAdminAuth } from '@bisondesk/commons-sdk/fetch';
|
|
4
4
|
import { AttachmentValue, PaginatedList } from '@bisondesk/commons-sdk/types';
|
|
5
5
|
import fetch, { Response } from 'node-fetch';
|
|
6
|
-
import { SearchLeasingContract } from '../types/leasing-search.js';
|
|
7
6
|
import {
|
|
8
7
|
AmortizationDocs,
|
|
9
8
|
AmortizationTable,
|
|
@@ -14,6 +13,7 @@ import {
|
|
|
14
13
|
NewLeasingConditions,
|
|
15
14
|
NewLeasingContract,
|
|
16
15
|
} from '../types/leasing.js';
|
|
16
|
+
import { SearchLeasingContract } from '../types/leasing-search.js';
|
|
17
17
|
import { SearchRequest } from '../types/search.js';
|
|
18
18
|
import { DataRecord, ReferenceData } from '../types/utils.js';
|
|
19
19
|
|
|
@@ -21,7 +21,7 @@ export const listLeasingClients = async (
|
|
|
21
21
|
tenantId: string,
|
|
22
22
|
offset: number,
|
|
23
23
|
limit: number,
|
|
24
|
-
opts?: { serviceId: string }
|
|
24
|
+
opts?: { serviceId: string },
|
|
25
25
|
): Promise<string[]> => {
|
|
26
26
|
const auth = await getAdminAuth();
|
|
27
27
|
const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts/clients?offset=${offset}&limit=${limit}`;
|
|
@@ -45,7 +45,7 @@ export const listLeasingContracts = async (
|
|
|
45
45
|
tenantId: string,
|
|
46
46
|
offset: number,
|
|
47
47
|
limit: number,
|
|
48
|
-
opts?: { serviceId: string }
|
|
48
|
+
opts?: { serviceId: string },
|
|
49
49
|
): Promise<LeasingContract[]> => {
|
|
50
50
|
const auth = await getAdminAuth();
|
|
51
51
|
const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts?offset=${offset}&limit=${limit}`;
|
|
@@ -67,7 +67,7 @@ export const listLeasingContracts = async (
|
|
|
67
67
|
|
|
68
68
|
export const getLeasingConditions = async (
|
|
69
69
|
tenantId: string,
|
|
70
|
-
conditionsId: string
|
|
70
|
+
conditionsId: string,
|
|
71
71
|
): Promise<LeasingConditions | undefined> => {
|
|
72
72
|
const auth = await getAdminAuth();
|
|
73
73
|
const url = `${process.env.CORE_API_ORIGIN}/api/leasing/conditions/${conditionsId}`;
|
|
@@ -88,7 +88,7 @@ export const getLeasingConditions = async (
|
|
|
88
88
|
|
|
89
89
|
export const createLeasingConditions = async (
|
|
90
90
|
tenantId: string,
|
|
91
|
-
conditions: NewLeasingConditions
|
|
91
|
+
conditions: NewLeasingConditions,
|
|
92
92
|
): Promise<LeasingConditions> => {
|
|
93
93
|
const auth = await getAdminAuth();
|
|
94
94
|
const url = `${process.env.CORE_API_ORIGIN}/api/leasing/conditions`;
|
|
@@ -113,7 +113,7 @@ export const createLeasingConditions = async (
|
|
|
113
113
|
|
|
114
114
|
export const getLeasingContractByStockNumber = async (
|
|
115
115
|
tenantId: string,
|
|
116
|
-
stockNumber: string
|
|
116
|
+
stockNumber: string,
|
|
117
117
|
): Promise<LeasingContract | undefined> => {
|
|
118
118
|
const auth = await getAdminAuth();
|
|
119
119
|
const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts/stock-number/${stockNumber}`;
|
|
@@ -127,7 +127,7 @@ export const getLeasingContractByStockNumber = async (
|
|
|
127
127
|
|
|
128
128
|
export const getLeasingContractByVehicleId = async (
|
|
129
129
|
tenantId: string,
|
|
130
|
-
vehicleId: string
|
|
130
|
+
vehicleId: string,
|
|
131
131
|
): Promise<LeasingContract | undefined> => {
|
|
132
132
|
const auth = await getAdminAuth();
|
|
133
133
|
const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts/vehicle-id/${vehicleId}`;
|
|
@@ -141,7 +141,7 @@ export const getLeasingContractByVehicleId = async (
|
|
|
141
141
|
|
|
142
142
|
export const getLeasingContractByNumber = async (
|
|
143
143
|
tenantId: string,
|
|
144
|
-
contractNumber: string
|
|
144
|
+
contractNumber: string,
|
|
145
145
|
): Promise<LeasingContract | undefined> => {
|
|
146
146
|
const auth = await getAdminAuth();
|
|
147
147
|
const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts/number/${contractNumber}`;
|
|
@@ -162,7 +162,7 @@ export const getLeasingContractByNumber = async (
|
|
|
162
162
|
|
|
163
163
|
export const getLeasingContract = async (
|
|
164
164
|
tenantId: string,
|
|
165
|
-
contractId: string
|
|
165
|
+
contractId: string,
|
|
166
166
|
): Promise<DataRecord<LeasingContract> | undefined> => {
|
|
167
167
|
const auth = await getAdminAuth();
|
|
168
168
|
const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts/${contractId}`;
|
|
@@ -184,13 +184,13 @@ export const getLeasingContract = async (
|
|
|
184
184
|
export const getLeasingContractDebtInfo = async (
|
|
185
185
|
tenantId: string,
|
|
186
186
|
contractId: string,
|
|
187
|
-
date?: Date
|
|
187
|
+
date?: Date,
|
|
188
188
|
): Promise<LeasingContractDebtInfo | undefined> => {
|
|
189
189
|
const auth = await getAdminAuth();
|
|
190
190
|
|
|
191
191
|
const url = new URL(
|
|
192
192
|
`/api/leasing/contracts/${contractId}/debt-info`,
|
|
193
|
-
process.env.CORE_API_ORIGIN
|
|
193
|
+
process.env.CORE_API_ORIGIN,
|
|
194
194
|
);
|
|
195
195
|
|
|
196
196
|
if (date != null) {
|
|
@@ -214,7 +214,7 @@ export const getLeasingContractDebtInfo = async (
|
|
|
214
214
|
|
|
215
215
|
export const searchLeasingContracts = async (
|
|
216
216
|
tenantId: string,
|
|
217
|
-
request: SearchRequest
|
|
217
|
+
request: SearchRequest,
|
|
218
218
|
): Promise<PaginatedList<SearchLeasingContract, ReferenceData> | undefined> => {
|
|
219
219
|
const auth = await getAdminAuth();
|
|
220
220
|
const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts/search/results`;
|
|
@@ -240,7 +240,7 @@ export const searchLeasingContracts = async (
|
|
|
240
240
|
export const findLeasingContracts = async (
|
|
241
241
|
tenantId: string,
|
|
242
242
|
clientId: string,
|
|
243
|
-
vehicleId: string
|
|
243
|
+
vehicleId: string,
|
|
244
244
|
): Promise<LeasingContract[]> => {
|
|
245
245
|
const auth = await getAdminAuth();
|
|
246
246
|
const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts/find?clientId=${clientId}&vehicleId=${vehicleId}`;
|
|
@@ -261,7 +261,7 @@ export const findLeasingContracts = async (
|
|
|
261
261
|
|
|
262
262
|
export const upsertLeasingContract = async (
|
|
263
263
|
tenantId: string,
|
|
264
|
-
contract: NewLeasingContract | LeasingContract
|
|
264
|
+
contract: NewLeasingContract | LeasingContract,
|
|
265
265
|
): Promise<LeasingContract> => {
|
|
266
266
|
const auth = await getAdminAuth();
|
|
267
267
|
const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts`;
|
|
@@ -286,7 +286,7 @@ export const upsertLeasingContract = async (
|
|
|
286
286
|
|
|
287
287
|
export const getLeasingAmortizations = async (
|
|
288
288
|
tenantId: string,
|
|
289
|
-
contractId: string
|
|
289
|
+
contractId: string,
|
|
290
290
|
): Promise<AmortizationTable | undefined> => {
|
|
291
291
|
const auth = await getAdminAuth();
|
|
292
292
|
const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts/${contractId}/amortization`;
|
|
@@ -308,7 +308,7 @@ export const getLeasingAmortizations = async (
|
|
|
308
308
|
export const addAmortizationDocs = async (
|
|
309
309
|
tenantId: string,
|
|
310
310
|
contractId: string,
|
|
311
|
-
docs: AmortizationDocs
|
|
311
|
+
docs: AmortizationDocs,
|
|
312
312
|
): Promise<AmortizationDocs> => {
|
|
313
313
|
const auth = await getAdminAuth();
|
|
314
314
|
const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts/${contractId}/amortization/add-docs`;
|
|
@@ -333,7 +333,7 @@ export const addAmortizationDocs = async (
|
|
|
333
333
|
|
|
334
334
|
export const listAmortizationDocsByContract = async (
|
|
335
335
|
tenantId: string,
|
|
336
|
-
contractId: string
|
|
336
|
+
contractId: string,
|
|
337
337
|
): Promise<AmortizationDocs[]> => {
|
|
338
338
|
const auth = await getAdminAuth();
|
|
339
339
|
const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts/${contractId}/amortization/docs`;
|
|
@@ -354,7 +354,7 @@ export const listAmortizationDocsByContract = async (
|
|
|
354
354
|
|
|
355
355
|
export const printLeasingAmortization = async (
|
|
356
356
|
tenantId: string,
|
|
357
|
-
contractId: string
|
|
357
|
+
contractId: string,
|
|
358
358
|
): Promise<AttachmentValue | undefined> => {
|
|
359
359
|
const auth = await getAdminAuth();
|
|
360
360
|
const url = `${process.env.CORE_API_ORIGIN}/api/leasing/contracts/${contractId}/amortization/print`;
|
|
@@ -375,7 +375,7 @@ export const printLeasingAmortization = async (
|
|
|
375
375
|
|
|
376
376
|
export const getDocumentAmortizationData = async (
|
|
377
377
|
tenantId: string,
|
|
378
|
-
documentId: string
|
|
378
|
+
documentId: string,
|
|
379
379
|
): Promise<DocumentAmortizationData[] | undefined> => {
|
|
380
380
|
const auth = await getAdminAuth();
|
|
381
381
|
const url = `${process.env.CORE_API_ORIGIN}/api/documents/finance/${documentId}/leasing`;
|
package/src/apis/offers.ts
CHANGED
|
@@ -4,18 +4,15 @@ import { NewOffer, Offer } from '../types/offers.js';
|
|
|
4
4
|
|
|
5
5
|
export const createOffer = async (tenantId: string, offer: NewOffer): Promise<Offer> => {
|
|
6
6
|
const auth = await getAdminAuth();
|
|
7
|
-
const response: Offer | undefined = await fetchJson(
|
|
8
|
-
|
|
9
|
-
{
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
body: JSON.stringify(offer),
|
|
17
|
-
}
|
|
18
|
-
);
|
|
7
|
+
const response: Offer | undefined = await fetchJson(`${process.env.CORE_API_ORIGIN}/api/offers`, {
|
|
8
|
+
method: 'POST',
|
|
9
|
+
headers: cleanHeaders({
|
|
10
|
+
Authorization: auth,
|
|
11
|
+
[TENANT_ID_ADMIN_HEADER]: tenantId,
|
|
12
|
+
'Content-Type': 'application/json',
|
|
13
|
+
}),
|
|
14
|
+
body: JSON.stringify(offer),
|
|
15
|
+
});
|
|
19
16
|
|
|
20
17
|
if (response == null) {
|
|
21
18
|
throw new Error('Offer not created');
|
|
@@ -15,7 +15,7 @@ import { OpportunityReservation } from '../types/reservations.js';
|
|
|
15
15
|
|
|
16
16
|
export const listOpportunities = async (
|
|
17
17
|
tenantId: string,
|
|
18
|
-
filterOptions: ListOpportunitiesFilters = {}
|
|
18
|
+
filterOptions: ListOpportunitiesFilters = {},
|
|
19
19
|
): Promise<Opportunity[]> => {
|
|
20
20
|
const auth = await getAdminAuth();
|
|
21
21
|
const result = await fetchJson<Opportunity[]>(
|
|
@@ -28,7 +28,7 @@ export const listOpportunities = async (
|
|
|
28
28
|
'Content-Type': 'application/json',
|
|
29
29
|
}),
|
|
30
30
|
body: JSON.stringify(filterOptions),
|
|
31
|
-
}
|
|
31
|
+
},
|
|
32
32
|
);
|
|
33
33
|
|
|
34
34
|
return result ?? [];
|
|
@@ -36,7 +36,7 @@ export const listOpportunities = async (
|
|
|
36
36
|
|
|
37
37
|
export const getOpportunityById = async (
|
|
38
38
|
tenantId: string,
|
|
39
|
-
opportunityId: string
|
|
39
|
+
opportunityId: string,
|
|
40
40
|
): Promise<Opportunity | undefined> => {
|
|
41
41
|
const auth = await getAdminAuth();
|
|
42
42
|
return fetchJson(`${process.env.CORE_API_ORIGIN}/api/opportunities/${opportunityId}`, {
|
|
@@ -49,7 +49,7 @@ export const getOpportunityById = async (
|
|
|
49
49
|
|
|
50
50
|
export const getOpportunityBff = async (
|
|
51
51
|
tenantId: string,
|
|
52
|
-
opportunityId: string
|
|
52
|
+
opportunityId: string,
|
|
53
53
|
): Promise<OpportunityBFF | undefined> => {
|
|
54
54
|
const auth = await getAdminAuth();
|
|
55
55
|
return fetchJson(`${process.env.CORE_API_ORIGIN}/api/opportunities/${opportunityId}/bff`, {
|
|
@@ -63,7 +63,7 @@ export const getOpportunityBff = async (
|
|
|
63
63
|
export const updateOpportunity = async (
|
|
64
64
|
tenantId: string,
|
|
65
65
|
opportunity: OpportunityUpdate,
|
|
66
|
-
opportunityId: string
|
|
66
|
+
opportunityId: string,
|
|
67
67
|
): Promise<OpportunityBFF | undefined> => {
|
|
68
68
|
const auth = await getAdminAuth();
|
|
69
69
|
return fetchJson(`${process.env.CORE_API_ORIGIN}/api/opportunities/${opportunityId}`, {
|
|
@@ -78,7 +78,7 @@ export const updateOpportunity = async (
|
|
|
78
78
|
|
|
79
79
|
export const createOpportunity = async (
|
|
80
80
|
tenantId: string,
|
|
81
|
-
opportunity: NewOpportunity
|
|
81
|
+
opportunity: NewOpportunity,
|
|
82
82
|
): Promise<Opportunity> => {
|
|
83
83
|
const auth = await getAdminAuth();
|
|
84
84
|
const response: Opportunity | undefined = await fetchJson(
|
|
@@ -91,7 +91,7 @@ export const createOpportunity = async (
|
|
|
91
91
|
'Content-Type': 'application/json',
|
|
92
92
|
}),
|
|
93
93
|
body: JSON.stringify(opportunity),
|
|
94
|
-
}
|
|
94
|
+
},
|
|
95
95
|
);
|
|
96
96
|
|
|
97
97
|
if (response == null) {
|
|
@@ -106,18 +106,15 @@ export const createOpportunity = async (
|
|
|
106
106
|
//
|
|
107
107
|
export const createBid = async (tenantId: string, bid: NewBid): Promise<Bid> => {
|
|
108
108
|
const auth = await getAdminAuth();
|
|
109
|
-
const response: Bid | undefined = await fetchJson(
|
|
110
|
-
|
|
111
|
-
{
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
body: JSON.stringify(bid),
|
|
119
|
-
}
|
|
120
|
-
);
|
|
109
|
+
const response: Bid | undefined = await fetchJson(`${process.env.CORE_API_ORIGIN}/api/bids`, {
|
|
110
|
+
method: 'POST',
|
|
111
|
+
headers: cleanHeaders({
|
|
112
|
+
Authorization: auth,
|
|
113
|
+
[TENANT_ID_ADMIN_HEADER]: tenantId,
|
|
114
|
+
'Content-Type': 'application/json',
|
|
115
|
+
}),
|
|
116
|
+
body: JSON.stringify(bid),
|
|
117
|
+
});
|
|
121
118
|
|
|
122
119
|
if (response == null) {
|
|
123
120
|
throw new Error('Bid not created');
|
|
@@ -128,7 +125,7 @@ export const createBid = async (tenantId: string, bid: NewBid): Promise<Bid> =>
|
|
|
128
125
|
|
|
129
126
|
export const getLeasingQuoteParams = async (
|
|
130
127
|
tenantId: string,
|
|
131
|
-
settingId: string
|
|
128
|
+
settingId: string,
|
|
132
129
|
): Promise<LeasingQuoteParams | undefined> => {
|
|
133
130
|
const auth = await getAdminAuth();
|
|
134
131
|
return fetchJson(
|
|
@@ -138,7 +135,7 @@ export const getLeasingQuoteParams = async (
|
|
|
138
135
|
Authorization: auth,
|
|
139
136
|
[TENANT_ID_ADMIN_HEADER]: tenantId,
|
|
140
137
|
}),
|
|
141
|
-
}
|
|
138
|
+
},
|
|
142
139
|
);
|
|
143
140
|
};
|
|
144
141
|
|
|
@@ -147,7 +144,7 @@ export const getLeasingQuoteParams = async (
|
|
|
147
144
|
//
|
|
148
145
|
export const getQuoteById = async (
|
|
149
146
|
tenantId: string,
|
|
150
|
-
quoteId: string
|
|
147
|
+
quoteId: string,
|
|
151
148
|
): Promise<Quote | undefined> => {
|
|
152
149
|
const auth = await getAdminAuth();
|
|
153
150
|
return fetchJson(`${process.env.CORE_API_ORIGIN}/api/quotes/${quoteId}`, {
|
|
@@ -163,7 +160,7 @@ export const getQuoteById = async (
|
|
|
163
160
|
//
|
|
164
161
|
export const getReservationByVehicleId = async (
|
|
165
162
|
tenantId: string,
|
|
166
|
-
vehicleId: string
|
|
163
|
+
vehicleId: string,
|
|
167
164
|
): Promise<OpportunityReservation | undefined> => {
|
|
168
165
|
const auth = await getAdminAuth();
|
|
169
166
|
return fetchJson(
|
|
@@ -173,6 +170,6 @@ export const getReservationByVehicleId = async (
|
|
|
173
170
|
Authorization: auth,
|
|
174
171
|
[TENANT_ID_ADMIN_HEADER]: tenantId,
|
|
175
172
|
}),
|
|
176
|
-
}
|
|
173
|
+
},
|
|
177
174
|
);
|
|
178
175
|
};
|
package/src/apis/tenants.ts
CHANGED
|
@@ -76,7 +76,7 @@ export const listTenantsSyncSettings = async (): Promise<TenantSyncSettings[]> =
|
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
export const getTenantsSyncSettings = async (
|
|
79
|
-
tenantId: string
|
|
79
|
+
tenantId: string,
|
|
80
80
|
): Promise<TenantSyncSettings | undefined> => {
|
|
81
81
|
const auth = await getAdminAuth();
|
|
82
82
|
const url = `${process.env.CORE_API_ORIGIN}/admin/tenants/settings/sync/${tenantId}`;
|
|
@@ -113,7 +113,7 @@ export const getTenant = async (tenantId: string): Promise<Tenant | undefined> =
|
|
|
113
113
|
};
|
|
114
114
|
|
|
115
115
|
export const getTenantByHyperdmsId = async (
|
|
116
|
-
hyperdmsTenantId: string
|
|
116
|
+
hyperdmsTenantId: string,
|
|
117
117
|
): Promise<Tenant | undefined> => {
|
|
118
118
|
const auth = await getAdminAuth();
|
|
119
119
|
const url = `${process.env.CORE_API_ORIGIN}/admin/tenants/hyperdms/${hyperdmsTenantId}`;
|
|
@@ -132,7 +132,7 @@ export const getTenantByHyperdmsId = async (
|
|
|
132
132
|
};
|
|
133
133
|
|
|
134
134
|
export const getTenantByHyperportalId = async (
|
|
135
|
-
hyperportalTenantId: string
|
|
135
|
+
hyperportalTenantId: string,
|
|
136
136
|
): Promise<Tenant | undefined> => {
|
|
137
137
|
const auth = await getAdminAuth();
|
|
138
138
|
const url = `${process.env.CORE_API_ORIGIN}/admin/tenants/hyperportal/${hyperportalTenantId}`;
|
package/src/apis/users.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { URL } from 'url';
|
|
1
2
|
import { AppRoles, TENANT_ID_ADMIN_HEADER } from '@bisondesk/commons-sdk/constants';
|
|
2
3
|
import { XError } from '@bisondesk/commons-sdk/errors';
|
|
3
4
|
import { cleanHeaders, getAdminAuth } from '@bisondesk/commons-sdk/fetch';
|
|
4
5
|
import fetch, { Response } from 'node-fetch';
|
|
5
|
-
import { URL } from 'url';
|
|
6
6
|
import { User } from '../types/users.js';
|
|
7
7
|
|
|
8
8
|
export const getUser = async (tenantId: string, userId: string): Promise<User | undefined> => {
|
|
@@ -25,7 +25,7 @@ export const getUser = async (tenantId: string, userId: string): Promise<User |
|
|
|
25
25
|
|
|
26
26
|
export const listUsers = async (
|
|
27
27
|
tenantId: string,
|
|
28
|
-
opts?: { roles?: AppRoles[]; includeInactive?: boolean }
|
|
28
|
+
opts?: { roles?: AppRoles[]; includeInactive?: boolean },
|
|
29
29
|
): Promise<User[]> => {
|
|
30
30
|
const auth = await getAdminAuth();
|
|
31
31
|
const url = `${process.env.CORE_API_ORIGIN}/api/users`;
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
export const getVehicleSaleInfo = async (
|
|
11
11
|
tenantId: string,
|
|
12
12
|
vehicleId: string,
|
|
13
|
-
opts?: { serviceId: string }
|
|
13
|
+
opts?: { serviceId: string },
|
|
14
14
|
): Promise<DataRecord<VehicleSaleInfo> | undefined> => {
|
|
15
15
|
const auth = await getAdminAuth();
|
|
16
16
|
return fetchJson(`${process.env.CORE_API_ORIGIN}/api/vehicle-sales/${vehicleId}`, {
|
|
@@ -25,7 +25,7 @@ export const getVehicleSaleInfo = async (
|
|
|
25
25
|
export const getExternalVehicleSale = async (
|
|
26
26
|
tenantId: string,
|
|
27
27
|
saleId: string,
|
|
28
|
-
opts?: { serviceId: string }
|
|
28
|
+
opts?: { serviceId: string },
|
|
29
29
|
): Promise<ExternalVehicleSale | undefined> => {
|
|
30
30
|
const auth = await getAdminAuth();
|
|
31
31
|
return fetchJson(`${process.env.CORE_API_ORIGIN}/api/external-sales/${saleId}`, {
|
|
@@ -40,7 +40,7 @@ export const getExternalVehicleSale = async (
|
|
|
40
40
|
export const saveExternalVehicleSale = async (
|
|
41
41
|
tenantId: string,
|
|
42
42
|
data: NewExternalVehicleSale,
|
|
43
|
-
opts?: { serviceId: string }
|
|
43
|
+
opts?: { serviceId: string },
|
|
44
44
|
): Promise<ExternalVehicleSale | undefined> => {
|
|
45
45
|
const auth = await getAdminAuth();
|
|
46
46
|
return fetchJson(`${process.env.CORE_API_ORIGIN}/api/external-sales`, {
|
|
@@ -58,7 +58,7 @@ export const saveExternalVehicleSale = async (
|
|
|
58
58
|
export const deleteExternalVehicleSale = async (
|
|
59
59
|
tenantId: string,
|
|
60
60
|
saleId: string,
|
|
61
|
-
opts?: { serviceId: string }
|
|
61
|
+
opts?: { serviceId: string },
|
|
62
62
|
): Promise<void> => {
|
|
63
63
|
const auth = await getAdminAuth();
|
|
64
64
|
return fetchJson(`${process.env.CORE_API_ORIGIN}/api/external-sales/${saleId}`, {
|