@djust-b2b/djust-front-sdk 2.1.1 → 2.2.0
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/index.d.ts +4 -8
- package/lib/index.js +2 -2
- package/lib/interfaces/index.d.ts +0 -1
- package/lib/interfaces/index.js +0 -1
- package/lib/services/auth/__mocks__/auth.mocks.d.ts +248 -0
- package/lib/services/auth/__mocks__/auth.mocks.js +220 -0
- package/lib/services/auth/index.d.ts +2 -2
- package/lib/services/auth/index.js +2 -2
- package/lib/services/custom-field/index.d.ts +2 -1
- package/lib/services/custom-field/index.js +2 -1
- package/lib/services/customer-account/index.d.ts +1 -1
- package/lib/services/customer-account/index.js +1 -1
- package/lib/services/incident/definitions.d.ts +1 -0
- package/lib/services/incident/index.d.ts +41 -1
- package/lib/services/incident/index.js +60 -1
- package/lib/services/offer-prices/__mocks__/offer-prices.mocks.d.ts +108 -0
- package/lib/services/offer-prices/__mocks__/offer-prices.mocks.js +200 -0
- package/lib/services/payment/index.js +1 -1
- package/lib/services/supplier/__mocks__/supplier-mocks.d.ts +48 -0
- package/lib/services/supplier/__mocks__/supplier-mocks.js +167 -0
- package/lib/services/supplier/definitions.d.ts +3 -3
- package/lib/services/supplier/index.js +0 -2
- package/package.json +4 -3
- package/lib/interfaces/models/buying-list.d.ts +0 -16
- package/lib/interfaces/models/buying-list.js +0 -2
- package/lib/services/buying-list/definitions.d.ts +0 -43
- package/lib/services/buying-list/definitions.js +0 -2
- package/lib/services/buying-list/index.d.ts +0 -33
- package/lib/services/buying-list/index.js +0 -104
|
@@ -47,7 +47,6 @@ async function getSuppliers({ pageable, supplierStatus, supplierIds, idType, })
|
|
|
47
47
|
method: "GET",
|
|
48
48
|
path: `/v1/shop/suppliers`,
|
|
49
49
|
params: {
|
|
50
|
-
pageable,
|
|
51
50
|
page: pageable.page,
|
|
52
51
|
size: pageable.size,
|
|
53
52
|
sort: pageable.sort,
|
|
@@ -137,7 +136,6 @@ async function getSupplierEvaluations({ supplierId, idType, pageable, }) {
|
|
|
137
136
|
path: `/v1/shop/suppliers/${supplierId}/evaluations`,
|
|
138
137
|
params: {
|
|
139
138
|
idType,
|
|
140
|
-
pageable,
|
|
141
139
|
page: pageable.page,
|
|
142
140
|
size: pageable.size,
|
|
143
141
|
sort: pageable.sort,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djust-b2b/djust-front-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "DJUST Front SDK is a versatile JavaScript Software Development Kit (SDK)",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"@semantic-release/npm": "^11.0.2",
|
|
28
28
|
"@types/jest": "^29.0.1",
|
|
29
29
|
"@types/node": "^18.7.16",
|
|
30
|
-
"@vitest/
|
|
30
|
+
"@vitest/coverage-v8": "3.0.9",
|
|
31
|
+
"@vitest/ui": "3.0.9",
|
|
31
32
|
"cz-conventional-changelog": "^3.3.0",
|
|
32
33
|
"dotenv": "^16.0.2",
|
|
33
34
|
"esbuild": "^0.20.1",
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
"typedoc": "0.27.3",
|
|
44
45
|
"typedoc-plugin-markdown": "4.3.1",
|
|
45
46
|
"typescript": "^5.6.3",
|
|
46
|
-
"vitest": "
|
|
47
|
+
"vitest": "3.0.9"
|
|
47
48
|
},
|
|
48
49
|
"files": [
|
|
49
50
|
"lib/**/**.js",
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { OfferInventory, OfferPriceResponse } from "./offer";
|
|
2
|
-
import { SupplierResponse } from "./supplier";
|
|
3
|
-
export interface BuyingList {
|
|
4
|
-
buyingListItems: BuyingListItem[];
|
|
5
|
-
createdAt?: string;
|
|
6
|
-
customerUserId: string;
|
|
7
|
-
id: string;
|
|
8
|
-
name: string;
|
|
9
|
-
}
|
|
10
|
-
export interface BuyingListItem {
|
|
11
|
-
id: string;
|
|
12
|
-
offerPrice: OfferPriceResponse;
|
|
13
|
-
offerInventory: OfferInventory;
|
|
14
|
-
quantity: number;
|
|
15
|
-
supplier: SupplierResponse;
|
|
16
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { BuyingList, BuyingListItem } from "../../interfaces/models/buying-list";
|
|
2
|
-
/**
|
|
3
|
-
* Request parameters type definitions
|
|
4
|
-
*/
|
|
5
|
-
export interface GetBuyingListParameters {
|
|
6
|
-
buyingListId: string;
|
|
7
|
-
locale?: string;
|
|
8
|
-
}
|
|
9
|
-
export interface CreateBuyingListParameters {
|
|
10
|
-
name: string;
|
|
11
|
-
}
|
|
12
|
-
export interface UpdateBuyingListParameters {
|
|
13
|
-
buyingListId: string;
|
|
14
|
-
name?: string;
|
|
15
|
-
}
|
|
16
|
-
export interface UpdateBuyingListItemsParameters {
|
|
17
|
-
buyingListId: string;
|
|
18
|
-
products: BuyingListItem[];
|
|
19
|
-
}
|
|
20
|
-
export interface DeleteBuyingListParameters {
|
|
21
|
-
buyingListId: string;
|
|
22
|
-
}
|
|
23
|
-
export interface DeleteBuyingListItemsParameters {
|
|
24
|
-
buyingListId: string;
|
|
25
|
-
itemIds: string[];
|
|
26
|
-
}
|
|
27
|
-
export interface UpdateBuyingListOwnerParameters {
|
|
28
|
-
buyingListId: string;
|
|
29
|
-
newOwnerEmail: string;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Response type definitions
|
|
33
|
-
*/
|
|
34
|
-
export interface GetBuyingListResponse extends BuyingList {
|
|
35
|
-
}
|
|
36
|
-
export interface GetBuyingListsResponse extends Array<BuyingList> {
|
|
37
|
-
}
|
|
38
|
-
export interface CreateBuyingListResponse extends BuyingList {
|
|
39
|
-
}
|
|
40
|
-
export interface UpdateBuyingListResponse extends BuyingList {
|
|
41
|
-
}
|
|
42
|
-
export interface UpdateBuyingListItemsResponse extends BuyingList {
|
|
43
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { CreateBuyingListParameters, CreateBuyingListResponse, DeleteBuyingListItemsParameters, DeleteBuyingListParameters, GetBuyingListParameters, GetBuyingListResponse, GetBuyingListsResponse, UpdateBuyingListItemsParameters, UpdateBuyingListItemsResponse, UpdateBuyingListOwnerParameters, UpdateBuyingListParameters, UpdateBuyingListResponse } from "./definitions";
|
|
2
|
-
/**
|
|
3
|
-
* Get buying list by id
|
|
4
|
-
*/
|
|
5
|
-
export declare function getBuyingList({ buyingListId, locale, }: GetBuyingListParameters): Promise<GetBuyingListResponse>;
|
|
6
|
-
/**
|
|
7
|
-
* Get buying lists
|
|
8
|
-
*/
|
|
9
|
-
export declare function getBuyingLists(): Promise<GetBuyingListsResponse>;
|
|
10
|
-
/**
|
|
11
|
-
* Create a buying list
|
|
12
|
-
*/
|
|
13
|
-
export declare function createBuyingList({ name, }: CreateBuyingListParameters): Promise<CreateBuyingListResponse>;
|
|
14
|
-
/**
|
|
15
|
-
* Update a buying list
|
|
16
|
-
*/
|
|
17
|
-
export declare function updateBuyingList({ buyingListId, name, }: UpdateBuyingListParameters): Promise<UpdateBuyingListResponse>;
|
|
18
|
-
/**
|
|
19
|
-
* Add products to a buying list
|
|
20
|
-
*/
|
|
21
|
-
export declare function updateBuyingListItems({ buyingListId, products, }: UpdateBuyingListItemsParameters): Promise<UpdateBuyingListItemsResponse>;
|
|
22
|
-
/**
|
|
23
|
-
* Delete a buying list
|
|
24
|
-
*/
|
|
25
|
-
export declare function deleteBuyingList({ buyingListId, }: DeleteBuyingListParameters): Promise<void>;
|
|
26
|
-
/**
|
|
27
|
-
* Delete products from a buying list
|
|
28
|
-
*/
|
|
29
|
-
export declare function deleteBuyingListItems({ buyingListId, itemIds, }: DeleteBuyingListItemsParameters): Promise<void>;
|
|
30
|
-
/**
|
|
31
|
-
* Update buying list's owner
|
|
32
|
-
*/
|
|
33
|
-
export declare function updateBuyingListOwner({ buyingListId, newOwnerEmail, }: UpdateBuyingListOwnerParameters): Promise<void>;
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBuyingList = getBuyingList;
|
|
4
|
-
exports.getBuyingLists = getBuyingLists;
|
|
5
|
-
exports.createBuyingList = createBuyingList;
|
|
6
|
-
exports.updateBuyingList = updateBuyingList;
|
|
7
|
-
exports.updateBuyingListItems = updateBuyingListItems;
|
|
8
|
-
exports.deleteBuyingList = deleteBuyingList;
|
|
9
|
-
exports.deleteBuyingListItems = deleteBuyingListItems;
|
|
10
|
-
exports.updateBuyingListOwner = updateBuyingListOwner;
|
|
11
|
-
const parameters_validation_1 = require("../../helpers/parameters-validation");
|
|
12
|
-
const fetch_instance_1 = require("../../settings/fetch-instance");
|
|
13
|
-
/**
|
|
14
|
-
* Get buying list by id
|
|
15
|
-
*/
|
|
16
|
-
async function getBuyingList({ buyingListId, locale, }) {
|
|
17
|
-
(0, parameters_validation_1.required)({ buyingListId });
|
|
18
|
-
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
19
|
-
method: "GET",
|
|
20
|
-
path: `/v1/shop/buying-lists/${buyingListId}`,
|
|
21
|
-
params: { locale },
|
|
22
|
-
});
|
|
23
|
-
return data;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Get buying lists
|
|
27
|
-
*/
|
|
28
|
-
async function getBuyingLists() {
|
|
29
|
-
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
30
|
-
method: "GET",
|
|
31
|
-
path: `/v1/shop/buying-lists`,
|
|
32
|
-
});
|
|
33
|
-
return data;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Create a buying list
|
|
37
|
-
*/
|
|
38
|
-
async function createBuyingList({ name, }) {
|
|
39
|
-
(0, parameters_validation_1.required)({ name });
|
|
40
|
-
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
41
|
-
method: "POST",
|
|
42
|
-
path: `/v1/shop/buying-lists`,
|
|
43
|
-
body: JSON.stringify({ name: name }),
|
|
44
|
-
});
|
|
45
|
-
return data;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Update a buying list
|
|
49
|
-
*/
|
|
50
|
-
async function updateBuyingList({ buyingListId, name, }) {
|
|
51
|
-
(0, parameters_validation_1.required)({ buyingListId, name });
|
|
52
|
-
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
53
|
-
method: "PUT",
|
|
54
|
-
path: `/v1/shop/buying-lists/${buyingListId}`,
|
|
55
|
-
body: JSON.stringify({ name }),
|
|
56
|
-
});
|
|
57
|
-
return data;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Add products to a buying list
|
|
61
|
-
*/
|
|
62
|
-
async function updateBuyingListItems({ buyingListId, products, }) {
|
|
63
|
-
(0, parameters_validation_1.required)({ buyingListId, products });
|
|
64
|
-
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
65
|
-
method: "PUT",
|
|
66
|
-
path: `/v1/shop/buying-lists/${buyingListId}/items`,
|
|
67
|
-
body: JSON.stringify(products),
|
|
68
|
-
});
|
|
69
|
-
return data;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Delete a buying list
|
|
73
|
-
*/
|
|
74
|
-
async function deleteBuyingList({ buyingListId, }) {
|
|
75
|
-
(0, parameters_validation_1.required)({ buyingListId });
|
|
76
|
-
(0, fetch_instance_1.enhancedFetch)({
|
|
77
|
-
method: "DELETE",
|
|
78
|
-
path: `/v1/shop/buying-lists/${buyingListId}`,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Delete products from a buying list
|
|
83
|
-
*/
|
|
84
|
-
async function deleteBuyingListItems({ buyingListId, itemIds, }) {
|
|
85
|
-
(0, parameters_validation_1.required)({ buyingListId, itemIds });
|
|
86
|
-
await (0, fetch_instance_1.enhancedFetch)({
|
|
87
|
-
method: "DELETE",
|
|
88
|
-
path: `/v1/shop/buying-lists/${buyingListId}/items`,
|
|
89
|
-
params: {
|
|
90
|
-
itemIds: itemIds,
|
|
91
|
-
},
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Update buying list's owner
|
|
96
|
-
*/
|
|
97
|
-
async function updateBuyingListOwner({ buyingListId, newOwnerEmail, }) {
|
|
98
|
-
(0, parameters_validation_1.required)({ buyingListId, newOwnerEmail });
|
|
99
|
-
await (0, fetch_instance_1.enhancedFetch)({
|
|
100
|
-
method: "PUT",
|
|
101
|
-
path: `/v1/shop/buying-lists/${buyingListId}/change-owner`,
|
|
102
|
-
body: JSON.stringify({ newOwnerEmail }),
|
|
103
|
-
});
|
|
104
|
-
}
|