@djust-b2b/djust-front-sdk 1.15.0 → 1.16.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 +7 -7
- package/lib/services/auth/definitions.requests.d.ts +21 -0
- package/lib/services/auth/definitions.requests.js +2 -0
- package/lib/services/auth/index.d.ts +146 -120
- package/lib/services/auth/index.js +144 -119
- package/lib/services/cart/index.d.ts +185 -254
- package/lib/services/cart/index.js +198 -257
- package/lib/services/custom-field/index.d.ts +55 -100
- package/lib/services/custom-field/index.js +55 -105
- package/lib/services/customer-user/index.d.ts +107 -125
- package/lib/services/customer-user/index.js +107 -125
- package/lib/services/navigation-category/index.d.ts +68 -119
- package/lib/services/navigation-category/index.js +68 -119
- package/lib/services/product/index.d.ts +296 -1687
- package/lib/services/product/index.js +312 -1706
- package/lib/services/product-variant/index.d.ts +53 -160
- package/lib/services/product-variant/index.js +53 -160
- package/package.json +1 -1
|
@@ -1,121 +1,76 @@
|
|
|
1
1
|
import type { GetCustomFieldParameters, GetCustomFieldResponse, PostMediaCustomFieldParameters } from "./definitions";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* Retrieves custom fields.
|
|
3
|
+
* 📋 Retrieves custom fields.
|
|
5
4
|
*
|
|
6
|
-
* This function
|
|
5
|
+
* This function fetches custom fields based on the provided parameters.
|
|
7
6
|
*
|
|
8
|
-
*
|
|
9
|
-
* #### fieldType - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
7
|
+
* 🛠 **Endpoint**: `GET /v2/shop/custom-fields`
|
|
10
8
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* | **Parameter** | **Type** | **Required** | **Description** |
|
|
10
|
+
* |----------------------|------------|--------------|---------------------------------------------------------------------------|
|
|
11
|
+
* | `fieldType` | `string` | ✅ | The type of custom field to retrieve. |
|
|
12
|
+
* | `includeInactive` | `boolean` | | Whether to include inactive custom fields in the response. |
|
|
13
|
+
* | `limit` | `number` | | The maximum number of custom fields to return. |
|
|
14
|
+
* | `offset` | `number` | | The number of custom fields to skip before starting to collect results. |
|
|
13
15
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
+
* 📤 **Returns**:
|
|
17
|
+
* A `Promise<GetCustomFieldResponse>` containing the retrieved custom fields.
|
|
16
18
|
*
|
|
17
|
-
*
|
|
18
|
-
* #### offset - `number`
|
|
19
|
-
*
|
|
20
|
-
* The number of custom fields to skip before starting to collect the result set.
|
|
21
|
-
*
|
|
22
|
-
* @returns {Promise<GetCustomFieldResponse>} - An object containing the retrieved custom fields.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* #### input
|
|
19
|
+
* 🛠 **Example Usage**:
|
|
26
20
|
* ```typescript
|
|
27
|
-
* const customFields = await getCustomFields({
|
|
28
|
-
*
|
|
29
|
-
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* {
|
|
34
|
-
* "externalId": "field1",
|
|
35
|
-
* "externalSource": "MIRAKL",
|
|
36
|
-
* "faceted": true,
|
|
37
|
-
* "id": "field1",
|
|
38
|
-
* "indexable": true,
|
|
39
|
-
* "mandatory": true,
|
|
40
|
-
* "name": "Field 1",
|
|
41
|
-
* "role": "PRODUCT_TAX_RATE",
|
|
42
|
-
* "sealedTarget": true,
|
|
43
|
-
* "searchable": true,
|
|
44
|
-
* "sortable": true,
|
|
45
|
-
* "status": "ACTIVE",
|
|
46
|
-
* "type": "TEXT"
|
|
47
|
-
* },
|
|
48
|
-
* {
|
|
49
|
-
* "externalId": "field2",
|
|
50
|
-
* "externalSource": "CLIENT",
|
|
51
|
-
* "faceted": false,
|
|
52
|
-
* "id": "field2",
|
|
53
|
-
* "indexable": false,
|
|
54
|
-
* "mandatory": false,
|
|
55
|
-
* "name": "Field 2",
|
|
56
|
-
* "role": "SHIPPING_TAX_CODE",
|
|
57
|
-
* "sealedTarget": false,
|
|
58
|
-
* "searchable": false,
|
|
59
|
-
* "sortable": false,
|
|
60
|
-
* "status": "INACTIVE",
|
|
61
|
-
* "type": "LONG_TEXT"
|
|
62
|
-
* }
|
|
63
|
-
* ],
|
|
64
|
-
* "empty": false,
|
|
65
|
-
* "first": true,
|
|
66
|
-
* "last": false,
|
|
67
|
-
* "number": 0,
|
|
68
|
-
* "numberOfElements": 2,
|
|
69
|
-
* "pageable": {
|
|
70
|
-
* "page": 0,
|
|
71
|
-
* "size": 10,
|
|
72
|
-
* "sort": []
|
|
73
|
-
* },
|
|
74
|
-
* "size": 10,
|
|
75
|
-
* "sort": [],
|
|
76
|
-
* "totalElemets": 2,
|
|
77
|
-
* "totalPages": 1
|
|
78
|
-
* }
|
|
21
|
+
* const customFields = await getCustomFields({
|
|
22
|
+
* fieldType: 'text',
|
|
23
|
+
* includeInactive: false,
|
|
24
|
+
* limit: 10,
|
|
25
|
+
* offset: 0,
|
|
26
|
+
* });
|
|
79
27
|
* ```
|
|
28
|
+
*
|
|
29
|
+
* @param {GetCustomFieldParameters} params - The parameters for fetching custom fields:
|
|
30
|
+
* - `fieldType` - The type of custom field to retrieve.
|
|
31
|
+
* - `includeInactive` (optional) - Whether to include inactive custom fields.
|
|
32
|
+
* - `limit` (optional) - The maximum number of fields to return.
|
|
33
|
+
* - `offset` (optional) - The number of fields to skip before collecting results.
|
|
34
|
+
*
|
|
35
|
+
* @returns {Promise<GetCustomFieldResponse>} - The response containing the retrieved custom fields.
|
|
80
36
|
*/
|
|
81
37
|
export declare function getCustomFields(params: GetCustomFieldParameters): Promise<GetCustomFieldResponse>;
|
|
82
38
|
/**
|
|
83
|
-
*
|
|
84
|
-
* Publishes a media custom field.
|
|
39
|
+
* 🎥 Publishes a media custom field.
|
|
85
40
|
*
|
|
86
|
-
* This function allows
|
|
41
|
+
* This function allows uploading a media file associated with a specific custom field.
|
|
87
42
|
*
|
|
88
|
-
*
|
|
89
|
-
* #### id - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
43
|
+
* 🛠 **Endpoint**: `POST /v2/shop/custom-fields/{id}/media`
|
|
90
44
|
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
45
|
+
* | **Parameter** | **Type** | **Required** | **Description** |
|
|
46
|
+
* |-----------------------|------------|--------------|----------------------------------------------------------------------|
|
|
47
|
+
* | `id` | `string` | ✅ | The ID of the custom field associated with the media. |
|
|
48
|
+
* | `customFieldIdType` | `string` | ✅ | The type of the custom field identifier (e.g., `externalId`). |
|
|
49
|
+
* | `sealedTarget` | `boolean` | | Indicates whether the media should be sealed. |
|
|
50
|
+
* | `fileName` | `string` | ✅ | The name of the media file being uploaded. |
|
|
51
|
+
* | `fileSize` | `number` | ✅ | The size of the media file in bytes. |
|
|
93
52
|
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
53
|
+
* 📤 **Returns**:
|
|
54
|
+
* A `Promise<string>` containing the URL where the media can be uploaded.
|
|
96
55
|
*
|
|
97
|
-
*
|
|
98
|
-
* #### fileName - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
99
|
-
*
|
|
100
|
-
* The name of the media file being uploaded.
|
|
101
|
-
* #### fileSize - `number` | <strong style={{ color: 'red' }}>required</strong>
|
|
102
|
-
*
|
|
103
|
-
* The size of the media file in bytes.
|
|
104
|
-
*
|
|
105
|
-
* @returns {Promise<string>} - A promise that resolves to the url where post the media.
|
|
106
|
-
*
|
|
107
|
-
* @example
|
|
108
|
-
* #### input
|
|
56
|
+
* 🛠 **Example Usage**:
|
|
109
57
|
* ```typescript
|
|
110
|
-
* const
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
* }
|
|
118
|
-
* );
|
|
58
|
+
* const mediaUrl = await postMediaCustomField({
|
|
59
|
+
* id: 'field1',
|
|
60
|
+
* customFieldIdType: 'externalId',
|
|
61
|
+
* sealedTarget: true,
|
|
62
|
+
* fileName: 'image.jpg',
|
|
63
|
+
* fileSize: 2048,
|
|
64
|
+
* });
|
|
119
65
|
* ```
|
|
66
|
+
*
|
|
67
|
+
* @param {PostMediaCustomFieldParameters} params - The parameters for uploading a media custom field:
|
|
68
|
+
* - `id` - The ID of the custom field.
|
|
69
|
+
* - `customFieldIdType` - The type of the custom field identifier.
|
|
70
|
+
* - `sealedTarget` (optional) - Whether the media should be sealed.
|
|
71
|
+
* - `fileName` - The name of the media file.
|
|
72
|
+
* - `fileSize` - The size of the media file in bytes.
|
|
73
|
+
*
|
|
74
|
+
* @returns {Promise<string>} - The URL for uploading the media file.
|
|
120
75
|
*/
|
|
121
76
|
export declare function postMediaCustomField(params: PostMediaCustomFieldParameters): Promise<string>;
|
|
@@ -2,90 +2,41 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCustomFields = getCustomFields;
|
|
4
4
|
exports.postMediaCustomField = postMediaCustomField;
|
|
5
|
-
/**
|
|
6
|
-
* @packageDocumentation
|
|
7
|
-
*
|
|
8
|
-
* @document documents/custom-field.md
|
|
9
|
-
*/
|
|
10
5
|
const fetch_instance_1 = require("../../settings/fetch-instance");
|
|
11
6
|
/**
|
|
12
|
-
*
|
|
13
|
-
* Retrieves custom fields.
|
|
14
|
-
*
|
|
15
|
-
* This function allows fetching custom fields based on the provided parameters.
|
|
7
|
+
* 📋 Retrieves custom fields.
|
|
16
8
|
*
|
|
17
|
-
*
|
|
18
|
-
* #### fieldType - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
9
|
+
* This function fetches custom fields based on the provided parameters.
|
|
19
10
|
*
|
|
20
|
-
*
|
|
21
|
-
* #### includeInactive - `boolean`
|
|
11
|
+
* 🛠 **Endpoint**: `GET /v2/shop/custom-fields`
|
|
22
12
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
13
|
+
* | **Parameter** | **Type** | **Required** | **Description** |
|
|
14
|
+
* |----------------------|------------|--------------|---------------------------------------------------------------------------|
|
|
15
|
+
* | `fieldType` | `string` | ✅ | The type of custom field to retrieve. |
|
|
16
|
+
* | `includeInactive` | `boolean` | | Whether to include inactive custom fields in the response. |
|
|
17
|
+
* | `limit` | `number` | | The maximum number of custom fields to return. |
|
|
18
|
+
* | `offset` | `number` | | The number of custom fields to skip before starting to collect results. |
|
|
25
19
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
20
|
+
* 📤 **Returns**:
|
|
21
|
+
* A `Promise<GetCustomFieldResponse>` containing the retrieved custom fields.
|
|
28
22
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* @returns {Promise<GetCustomFieldResponse>} - An object containing the retrieved custom fields.
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* #### input
|
|
23
|
+
* 🛠 **Example Usage**:
|
|
35
24
|
* ```typescript
|
|
36
|
-
* const customFields = await getCustomFields({
|
|
37
|
-
*
|
|
38
|
-
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* {
|
|
43
|
-
* "externalId": "field1",
|
|
44
|
-
* "externalSource": "MIRAKL",
|
|
45
|
-
* "faceted": true,
|
|
46
|
-
* "id": "field1",
|
|
47
|
-
* "indexable": true,
|
|
48
|
-
* "mandatory": true,
|
|
49
|
-
* "name": "Field 1",
|
|
50
|
-
* "role": "PRODUCT_TAX_RATE",
|
|
51
|
-
* "sealedTarget": true,
|
|
52
|
-
* "searchable": true,
|
|
53
|
-
* "sortable": true,
|
|
54
|
-
* "status": "ACTIVE",
|
|
55
|
-
* "type": "TEXT"
|
|
56
|
-
* },
|
|
57
|
-
* {
|
|
58
|
-
* "externalId": "field2",
|
|
59
|
-
* "externalSource": "CLIENT",
|
|
60
|
-
* "faceted": false,
|
|
61
|
-
* "id": "field2",
|
|
62
|
-
* "indexable": false,
|
|
63
|
-
* "mandatory": false,
|
|
64
|
-
* "name": "Field 2",
|
|
65
|
-
* "role": "SHIPPING_TAX_CODE",
|
|
66
|
-
* "sealedTarget": false,
|
|
67
|
-
* "searchable": false,
|
|
68
|
-
* "sortable": false,
|
|
69
|
-
* "status": "INACTIVE",
|
|
70
|
-
* "type": "LONG_TEXT"
|
|
71
|
-
* }
|
|
72
|
-
* ],
|
|
73
|
-
* "empty": false,
|
|
74
|
-
* "first": true,
|
|
75
|
-
* "last": false,
|
|
76
|
-
* "number": 0,
|
|
77
|
-
* "numberOfElements": 2,
|
|
78
|
-
* "pageable": {
|
|
79
|
-
* "page": 0,
|
|
80
|
-
* "size": 10,
|
|
81
|
-
* "sort": []
|
|
82
|
-
* },
|
|
83
|
-
* "size": 10,
|
|
84
|
-
* "sort": [],
|
|
85
|
-
* "totalElemets": 2,
|
|
86
|
-
* "totalPages": 1
|
|
87
|
-
* }
|
|
25
|
+
* const customFields = await getCustomFields({
|
|
26
|
+
* fieldType: 'text',
|
|
27
|
+
* includeInactive: false,
|
|
28
|
+
* limit: 10,
|
|
29
|
+
* offset: 0,
|
|
30
|
+
* });
|
|
88
31
|
* ```
|
|
32
|
+
*
|
|
33
|
+
* @param {GetCustomFieldParameters} params - The parameters for fetching custom fields:
|
|
34
|
+
* - `fieldType` - The type of custom field to retrieve.
|
|
35
|
+
* - `includeInactive` (optional) - Whether to include inactive custom fields.
|
|
36
|
+
* - `limit` (optional) - The maximum number of fields to return.
|
|
37
|
+
* - `offset` (optional) - The number of fields to skip before collecting results.
|
|
38
|
+
*
|
|
39
|
+
* @returns {Promise<GetCustomFieldResponse>} - The response containing the retrieved custom fields.
|
|
89
40
|
*/
|
|
90
41
|
async function getCustomFields(params) {
|
|
91
42
|
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
@@ -96,43 +47,42 @@ async function getCustomFields(params) {
|
|
|
96
47
|
return data;
|
|
97
48
|
}
|
|
98
49
|
/**
|
|
99
|
-
*
|
|
100
|
-
* Publishes a media custom field.
|
|
101
|
-
*
|
|
102
|
-
* This function allows publishing a media file associated with a specific custom field.
|
|
103
|
-
*
|
|
104
|
-
* @param {PostMediaCustomFieldParameters} params - The parameters for publishing the media field, including:
|
|
105
|
-
* #### id - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
106
|
-
*
|
|
107
|
-
* The identifier of the custom field to which the media is associated.
|
|
108
|
-
* #### customFieldIdType - `string` | <strong style={{ color: 'red' }}>required</strong></strong>
|
|
50
|
+
* 🎥 Publishes a media custom field.
|
|
109
51
|
*
|
|
110
|
-
*
|
|
111
|
-
* #### sealedTarget - `boolean`
|
|
52
|
+
* This function allows uploading a media file associated with a specific custom field.
|
|
112
53
|
*
|
|
113
|
-
*
|
|
114
|
-
* #### fileName - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
54
|
+
* 🛠 **Endpoint**: `POST /v2/shop/custom-fields/{id}/media`
|
|
115
55
|
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
56
|
+
* | **Parameter** | **Type** | **Required** | **Description** |
|
|
57
|
+
* |-----------------------|------------|--------------|----------------------------------------------------------------------|
|
|
58
|
+
* | `id` | `string` | ✅ | The ID of the custom field associated with the media. |
|
|
59
|
+
* | `customFieldIdType` | `string` | ✅ | The type of the custom field identifier (e.g., `externalId`). |
|
|
60
|
+
* | `sealedTarget` | `boolean` | | Indicates whether the media should be sealed. |
|
|
61
|
+
* | `fileName` | `string` | ✅ | The name of the media file being uploaded. |
|
|
62
|
+
* | `fileSize` | `number` | ✅ | The size of the media file in bytes. |
|
|
118
63
|
*
|
|
119
|
-
*
|
|
64
|
+
* 📤 **Returns**:
|
|
65
|
+
* A `Promise<string>` containing the URL where the media can be uploaded.
|
|
120
66
|
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
* @example
|
|
124
|
-
* #### input
|
|
67
|
+
* 🛠 **Example Usage**:
|
|
125
68
|
* ```typescript
|
|
126
|
-
* const
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* }
|
|
134
|
-
* );
|
|
69
|
+
* const mediaUrl = await postMediaCustomField({
|
|
70
|
+
* id: 'field1',
|
|
71
|
+
* customFieldIdType: 'externalId',
|
|
72
|
+
* sealedTarget: true,
|
|
73
|
+
* fileName: 'image.jpg',
|
|
74
|
+
* fileSize: 2048,
|
|
75
|
+
* });
|
|
135
76
|
* ```
|
|
77
|
+
*
|
|
78
|
+
* @param {PostMediaCustomFieldParameters} params - The parameters for uploading a media custom field:
|
|
79
|
+
* - `id` - The ID of the custom field.
|
|
80
|
+
* - `customFieldIdType` - The type of the custom field identifier.
|
|
81
|
+
* - `sealedTarget` (optional) - Whether the media should be sealed.
|
|
82
|
+
* - `fileName` - The name of the media file.
|
|
83
|
+
* - `fileSize` - The size of the media file in bytes.
|
|
84
|
+
*
|
|
85
|
+
* @returns {Promise<string>} - The URL for uploading the media file.
|
|
136
86
|
*/
|
|
137
87
|
async function postMediaCustomField(params) {
|
|
138
88
|
const { id, customFieldIdType, sealedTarget, fileName, fileSize } = params;
|