@djust-b2b/djust-front-sdk 1.15.1 → 1.17.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 +1 -1
- package/lib/services/auth/index.d.ts +133 -117
- package/lib/services/auth/index.js +133 -117
- package/lib/services/cart/index.d.ts +185 -249
- package/lib/services/cart/index.js +198 -252
- package/lib/services/custom-field/index.d.ts +56 -96
- package/lib/services/custom-field/index.js +56 -96
- package/lib/services/customer-account/index.d.ts +399 -1628
- package/lib/services/customer-account/index.js +401 -1637
- package/package.json +1 -1
|
@@ -1,116 +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
|
-
*
|
|
39
|
+
* 🎥 Publishes a media custom field.
|
|
40
|
+
*
|
|
41
|
+
* This function allows uploading a media file associated with a specific custom field.
|
|
85
42
|
*
|
|
86
|
-
*
|
|
43
|
+
* 🛠 **Endpoint**: `POST /v2/shop/custom-fields/{id}/media`
|
|
87
44
|
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* The
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* #### fileName - `string` | **required**
|
|
96
|
-
* The name of the media file being uploaded.
|
|
97
|
-
* #### fileSize - `number` | **required**
|
|
98
|
-
* The size of the media file in bytes.
|
|
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. |
|
|
99
52
|
*
|
|
100
|
-
*
|
|
53
|
+
* 📤 **Returns**:
|
|
54
|
+
* A `Promise<string>` containing the URL where the media can be uploaded.
|
|
101
55
|
*
|
|
102
|
-
*
|
|
103
|
-
* #### input
|
|
56
|
+
* 🛠 **Example Usage**:
|
|
104
57
|
* ```typescript
|
|
105
|
-
* const
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* }
|
|
113
|
-
* );
|
|
58
|
+
* const mediaUrl = await postMediaCustomField({
|
|
59
|
+
* id: 'field1',
|
|
60
|
+
* customFieldIdType: 'externalId',
|
|
61
|
+
* sealedTarget: true,
|
|
62
|
+
* fileName: 'image.jpg',
|
|
63
|
+
* fileSize: 2048,
|
|
64
|
+
* });
|
|
114
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.
|
|
115
75
|
*/
|
|
116
76
|
export declare function postMediaCustomField(params: PostMediaCustomFieldParameters): Promise<string>;
|
|
@@ -4,83 +4,39 @@ exports.getCustomFields = getCustomFields;
|
|
|
4
4
|
exports.postMediaCustomField = postMediaCustomField;
|
|
5
5
|
const fetch_instance_1 = require("../../settings/fetch-instance");
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
* Retrieves custom fields.
|
|
7
|
+
* 📋 Retrieves custom fields.
|
|
9
8
|
*
|
|
10
|
-
* This function
|
|
9
|
+
* This function fetches custom fields based on the provided parameters.
|
|
11
10
|
*
|
|
12
|
-
*
|
|
13
|
-
* #### fieldType - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
11
|
+
* 🛠 **Endpoint**: `GET /v2/shop/custom-fields`
|
|
14
12
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
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. |
|
|
17
19
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
+
* 📤 **Returns**:
|
|
21
|
+
* A `Promise<GetCustomFieldResponse>` containing the retrieved custom fields.
|
|
20
22
|
*
|
|
21
|
-
*
|
|
22
|
-
* #### offset - `number`
|
|
23
|
-
*
|
|
24
|
-
* The number of custom fields to skip before starting to collect the result set.
|
|
25
|
-
*
|
|
26
|
-
* @returns {Promise<GetCustomFieldResponse>} - An object containing the retrieved custom fields.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* #### input
|
|
23
|
+
* 🛠 **Example Usage**:
|
|
30
24
|
* ```typescript
|
|
31
|
-
* const customFields = await getCustomFields({
|
|
32
|
-
*
|
|
33
|
-
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* {
|
|
38
|
-
* "externalId": "field1",
|
|
39
|
-
* "externalSource": "MIRAKL",
|
|
40
|
-
* "faceted": true,
|
|
41
|
-
* "id": "field1",
|
|
42
|
-
* "indexable": true,
|
|
43
|
-
* "mandatory": true,
|
|
44
|
-
* "name": "Field 1",
|
|
45
|
-
* "role": "PRODUCT_TAX_RATE",
|
|
46
|
-
* "sealedTarget": true,
|
|
47
|
-
* "searchable": true,
|
|
48
|
-
* "sortable": true,
|
|
49
|
-
* "status": "ACTIVE",
|
|
50
|
-
* "type": "TEXT"
|
|
51
|
-
* },
|
|
52
|
-
* {
|
|
53
|
-
* "externalId": "field2",
|
|
54
|
-
* "externalSource": "CLIENT",
|
|
55
|
-
* "faceted": false,
|
|
56
|
-
* "id": "field2",
|
|
57
|
-
* "indexable": false,
|
|
58
|
-
* "mandatory": false,
|
|
59
|
-
* "name": "Field 2",
|
|
60
|
-
* "role": "SHIPPING_TAX_CODE",
|
|
61
|
-
* "sealedTarget": false,
|
|
62
|
-
* "searchable": false,
|
|
63
|
-
* "sortable": false,
|
|
64
|
-
* "status": "INACTIVE",
|
|
65
|
-
* "type": "LONG_TEXT"
|
|
66
|
-
* }
|
|
67
|
-
* ],
|
|
68
|
-
* "empty": false,
|
|
69
|
-
* "first": true,
|
|
70
|
-
* "last": false,
|
|
71
|
-
* "number": 0,
|
|
72
|
-
* "numberOfElements": 2,
|
|
73
|
-
* "pageable": {
|
|
74
|
-
* "page": 0,
|
|
75
|
-
* "size": 10,
|
|
76
|
-
* "sort": []
|
|
77
|
-
* },
|
|
78
|
-
* "size": 10,
|
|
79
|
-
* "sort": [],
|
|
80
|
-
* "totalElemets": 2,
|
|
81
|
-
* "totalPages": 1
|
|
82
|
-
* }
|
|
25
|
+
* const customFields = await getCustomFields({
|
|
26
|
+
* fieldType: 'text',
|
|
27
|
+
* includeInactive: false,
|
|
28
|
+
* limit: 10,
|
|
29
|
+
* offset: 0,
|
|
30
|
+
* });
|
|
83
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.
|
|
84
40
|
*/
|
|
85
41
|
async function getCustomFields(params) {
|
|
86
42
|
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
@@ -91,38 +47,42 @@ async function getCustomFields(params) {
|
|
|
91
47
|
return data;
|
|
92
48
|
}
|
|
93
49
|
/**
|
|
94
|
-
*
|
|
95
|
-
*
|
|
50
|
+
* 🎥 Publishes a media custom field.
|
|
51
|
+
*
|
|
52
|
+
* This function allows uploading a media file associated with a specific custom field.
|
|
96
53
|
*
|
|
97
|
-
*
|
|
54
|
+
* 🛠 **Endpoint**: `POST /v2/shop/custom-fields/{id}/media`
|
|
98
55
|
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* The
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
* #### fileName - `string` | **required**
|
|
107
|
-
* The name of the media file being uploaded.
|
|
108
|
-
* #### fileSize - `number` | **required**
|
|
109
|
-
* The size of the media file in bytes.
|
|
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. |
|
|
110
63
|
*
|
|
111
|
-
*
|
|
64
|
+
* 📤 **Returns**:
|
|
65
|
+
* A `Promise<string>` containing the URL where the media can be uploaded.
|
|
112
66
|
*
|
|
113
|
-
*
|
|
114
|
-
* #### input
|
|
67
|
+
* 🛠 **Example Usage**:
|
|
115
68
|
* ```typescript
|
|
116
|
-
* const
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
* }
|
|
124
|
-
* );
|
|
69
|
+
* const mediaUrl = await postMediaCustomField({
|
|
70
|
+
* id: 'field1',
|
|
71
|
+
* customFieldIdType: 'externalId',
|
|
72
|
+
* sealedTarget: true,
|
|
73
|
+
* fileName: 'image.jpg',
|
|
74
|
+
* fileSize: 2048,
|
|
75
|
+
* });
|
|
125
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.
|
|
126
86
|
*/
|
|
127
87
|
async function postMediaCustomField(params) {
|
|
128
88
|
const { id, customFieldIdType, sealedTarget, fileName, fileSize } = params;
|