@djust-b2b/djust-front-sdk 1.15.0 → 1.15.1

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.
@@ -1,120 +1,82 @@
1
1
  import { GetProductVariantAttributesParameters, GetProductVariantAttributesResponse, GetProductVariantSuppliersParameters, GetProductVariantSuppliersResponse, GetProductVariantsListParameters, GetProductVariantsListResponse } from "./definitions";
2
2
  /**
3
- * APICODE(pVAR300)
4
- * Retrieves a paginated list of product variants.
3
+ * 📄 Fetches a paginated list of product variants.
5
4
  *
6
- * This function fetches a list of product variants associated with a specific product SKU.
5
+ * This function retrieves a list of product variants associated with a specific product SKU.
6
+ * Pagination and sorting options are available to refine the results.
7
7
  *
8
- * @param {GetProductVariantsListParameters} params - The parameters to filter the product variants list, including:
9
- * #### productSku - `string` | <strong style={{ color: 'red' }}>required</strong>
10
- * The SKU of the product to fetch variants for.
8
+ * 🛠 **Endpoint**: `GET /v1/shop/product-variants`
11
9
  *
12
- * #### locale - `string` | optional
13
- * The locale for the product variants.
10
+ * | Parameter | Type | Required | Description |
11
+ * |-----------------|--------------|----------|---------------------------------------------------------------|
12
+ * | `productSku` | `string` | ✅ | The SKU of the product to fetch variants for. |
13
+ * | `locale` | `string` | ❌ | The locale for the product variants. |
14
+ * | `pageable.page` | `number` | ✅ | The page number to fetch (0-based index). |
15
+ * | `pageable.size` | `number` | ✅ | The number of items per page. |
16
+ * | `pageable.sort` | `string[]` | ❌ | Sorting criteria (e.g., `["name,asc"]`). |
14
17
  *
15
- * #### pageable - `object` | optional
16
- * Pagination details, including:
17
- * - `page`: The page number.
18
- * - `size`: The number of items per page.
19
- * - `sort`: Sorting criteria.
18
+ * 📤 **Returns**:
19
+ * A `Promise` resolving to a `GetProductVariantsListResponse` object, containing the paginated list of product variants with metadata.
20
20
  *
21
- * @returns {Promise<GetProductVariantsListResponse>} - A promise that resolves with the paginated list of product variants.
22
- *
23
- * @example
24
- * #### input
21
+ * 🛠 **Example usage**:
25
22
  * ```typescript
26
- * await getProductVariantsList({
23
+ * const variants = await getProductVariantsList({
27
24
  * productSku: 'product123',
28
25
  * locale: 'en-US',
29
- * pageable: { page: 1, size: 10, sort: 'name,asc' },
26
+ * pageable: { page: 0, size: 10, sort: ['name,asc'] },
30
27
  * });
28
+ * console.log(variants);
31
29
  * ```
32
- * #### output
33
- * ```json
34
- * {
35
- * "content": [
36
- * { "id": "variant1", "name": "Variant 1" },
37
- * { "id": "variant2", "name": "Variant 2" }
38
- * ],
39
- * "pageable": {
40
- * "page": 1,
41
- * "size": 10,
42
- * "totalPages": 5
43
- * }
44
- * }
45
- * ```
30
+ *
31
+ * @param {GetProductVariantsListParameters} params - The parameters for fetching product variants.
32
+ * @throws {Error} If `productSku` is missing.
33
+ * @returns {Promise<GetProductVariantsListResponse>} A promise resolving to the product variants response.
46
34
  */
47
35
  export declare function getProductVariantsList({ productSku, locale, pageable, }: GetProductVariantsListParameters): Promise<GetProductVariantsListResponse>;
48
36
  /**
49
- * APICODE(vSUP300)
50
- * Retrieves suppliers of a specific product variant.
37
+ * 📄 Fetches suppliers of a specific product variant.
38
+ *
39
+ * This function retrieves a list of suppliers associated with a specific product variant ID.
51
40
  *
52
- * This function fetches a list of suppliers associated with a product variant.
41
+ * 🛠 **Endpoint**: `GET /v1/shop/product-variants/{productVariantId}/suppliers`
53
42
  *
54
- * @param {GetProductVariantSuppliersParameters} params - The parameters to identify the product variant, including:
55
- * #### productVariantId - `string` | <strong style={{ color: 'red' }}>required</strong>
56
- * The ID of the product variant to fetch suppliers for.
43
+ * | Parameter | Type | Required | Description |
44
+ * |---------------------|--------------|----------|-------------------------------------------------|
45
+ * | `productVariantId` | `string` | ✅ | The ID of the product variant to fetch suppliers for. |
57
46
  *
58
- * @returns {Promise<GetProductVariantSuppliersResponse>} - A promise that resolves with the suppliers of the product variant.
47
+ * 📤 **Returns**:
48
+ * A `Promise` resolving to a `GetProductVariantSuppliersResponse` object, containing the list of suppliers for the product variant.
59
49
  *
60
- * @example
61
- * #### input
50
+ * 🛠 **Example usage**:
62
51
  * ```typescript
63
- * await getProductVariantSuppliers({ productVariantId: 'variant123' });
64
- * ```
65
- * #### output
66
- * ```json
67
- * {
68
- * "suppliers": [
69
- * { "id": "supplier1", "name": "Supplier 1" },
70
- * { "id": "supplier2", "name": "Supplier 2" }
71
- * ]
72
- * }
52
+ * const suppliers = await getProductVariantSuppliers({
53
+ * productVariantId: 'variant123',
54
+ * });
55
+ * console.log(suppliers);
73
56
  * ```
57
+ *
58
+ * @param {GetProductVariantSuppliersParameters} params - The parameters for fetching product variant suppliers.
59
+ * @throws {Error} If `productVariantId` is missing.
60
+ * @returns {Promise<GetProductVariantSuppliersResponse>} A promise resolving to the product variant suppliers response.
74
61
  */
75
62
  export declare function getProductVariantSuppliers({ productVariantId, }: GetProductVariantSuppliersParameters): Promise<GetProductVariantSuppliersResponse>;
76
63
  /**
77
- * ## 🛒 APICODE(vATT300) - Fetch Product Variant Attributes
78
- *
79
- * Retrieves detailed attributes of a product variant identified by SKU, ID, or external ID.
80
- * This metadata includes key details such as **color**, **size**, and **material**, making it easier to describe the variant.
64
+ * 📄 Fetches attributes of a product variant.
81
65
  *
82
- * ---
66
+ * This function retrieves detailed attributes of a product variant identified by SKU, ID, or external ID.
83
67
  *
84
- * ### 📥 Parameters
68
+ * 🛠 **Endpoint**: `GET /v1/shop/products/{productIdentifier}/variant-attributes`
85
69
  *
86
- * | Parameter | Type | Required | Description |
87
- * |---------------------|----------|----------|-----------------------------------------------------------------------------|
88
- * | `productIdentifier` | `string` | ✅ Yes | The unique identifier of the product variant (e.g., SKU, ID, external ID). |
89
- * | `productIdType` | `string` | ✅ Yes | The type of the identifier: `"sku"`, `"id"`, or `"externalId"`. |
90
- * | `locale` | `string` | ❌ No | The locale for localized data (e.g., `"en-US"`, `"fr-FR"`). Defaults to the system locale. |
70
+ * | Parameter | Type | Required | Description |
71
+ * |---------------------|--------------|----------|---------------------------------------------------------------|
72
+ * | `productIdentifier` | `string` | ✅ | The unique identifier of the product variant (e.g., SKU, ID, external ID). |
73
+ * | `productIdType` | `string` | ✅ | The type of the identifier (`sku`, `id`, or `externalId`). |
74
+ * | `locale` | `string` | ❌ | The locale for localized data (e.g., `en-US`, `fr-FR`). Defaults to system locale. |
91
75
  *
92
- * ---
76
+ * 📤 **Returns**:
77
+ * A `Promise` resolving to a `GetProductVariantAttributesResponse` object, containing metadata such as **color**, **size**, or **material**.
93
78
  *
94
- * ### 📤 Returns
95
- * **Type:** `Promise<GetProductVariantAttributesResponse>`
96
- * Resolves with the following structure:
97
- *
98
- * ```typescript
99
- * {
100
- * attributes: Array<{
101
- * id: string;
102
- * name: string;
103
- * value: string | number;
104
- * type: string;
105
- * isRequired: boolean;
106
- * description: string;
107
- * }>;
108
- * locale: string;
109
- * productIdentifier: string;
110
- * }
111
- * ```
112
- *
113
- * ---
114
- *
115
- * ### 🧑‍💻 Example Usage
116
- *
117
- * **Basic Example:**
79
+ * 🛠 **Example usage**:
118
80
  * ```typescript
119
81
  * const attributes = await getProductVariantAttributes({
120
82
  * productIdentifier: 'sku123',
@@ -124,77 +86,8 @@ export declare function getProductVariantSuppliers({ productVariantId, }: GetPro
124
86
  * console.log(attributes);
125
87
  * ```
126
88
  *
127
- * **Alternative Locale:**
128
- * ```typescript
129
- * const attributes = await getProductVariantAttributes({
130
- * productIdentifier: 'prod789',
131
- * productIdType: 'externalId',
132
- * locale: 'fr-FR',
133
- * });
134
- * console.log(attributes);
135
- * ```
136
- *
137
- * ---
138
- *
139
- * ### 📝 Example Input
140
- * ```json
141
- * {
142
- * "productIdentifier": "sku123",
143
- * "productIdType": "sku",
144
- * "locale": "en-US"
145
- * }
146
- * ```
147
- *
148
- * ---
149
- *
150
- * ### 📦 Example Output
151
- * ```json
152
- * {
153
- * "attributes": [
154
- * {
155
- * "id": "attr1",
156
- * "name": "Color",
157
- * "value": "Red",
158
- * "type": "text",
159
- * "isRequired": true,
160
- * "description": "The color of the product variant."
161
- * },
162
- * {
163
- * "id": "attr2",
164
- * "name": "Size",
165
- * "value": "M",
166
- * "type": "text",
167
- * "isRequired": false,
168
- * "description": "The size of the product variant."
169
- * }
170
- * ],
171
- * "locale": "en-US",
172
- * "productIdentifier": "sku123"
173
- * }
174
- * ```
175
- *
176
- * ---
177
- *
178
- * ### 🚨 Error Responses
179
- *
180
- * | Code | Message | Description |
181
- * |-------|------------------------------------------|------------------------------------------------------|
182
- * | `400` | `Bad Request` | Missing or invalid `productIdentifier` or `productIdType`. |
183
- * | `404` | `Not Found` | The specified product variant does not exist. |
184
- * | `500` | `Internal Server Error` | Unexpected error on the server. |
185
- *
186
- * ---
187
- *
188
- * ### 📚 Notes
189
- * - Ensure the `productIdType` matches the `productIdentifier` value to avoid mismatched requests.
190
- * - Providing a valid `locale` is recommended for fetching localized attribute data when applicable.
191
- * - This API version supports strict versioning; ensure compatibility with your application's requirements.
192
- *
193
- * ---
194
- *
195
- * ### 🔗 Additional Resources
196
- * - [API Authentication Guide](https://docs.example.com/api-authentication)
197
- * - [Product Variants Documentation](https://docs.example.com/product-variants)
198
- * - [Common Error Codes](https://docs.example.com/error-codes)
89
+ * @param {GetProductVariantAttributesParameters} params - The parameters for fetching product variant attributes.
90
+ * @throws {Error} If `productIdentifier` or `productIdType` is missing.
91
+ * @returns {Promise<GetProductVariantAttributesResponse>} A promise resolving to the product variant attributes response.
199
92
  */
200
93
  export declare function getProductVariantAttributes({ productIdentifier, productIdType, locale, }: GetProductVariantAttributesParameters): Promise<GetProductVariantAttributesResponse>;
@@ -6,49 +6,37 @@ exports.getProductVariantAttributes = getProductVariantAttributes;
6
6
  const parameters_validation_1 = require("../../helpers/parameters-validation");
7
7
  const fetch_instance_1 = require("../../settings/fetch-instance");
8
8
  /**
9
- * APICODE(pVAR300)
10
- * Retrieves a paginated list of product variants.
9
+ * 📄 Fetches a paginated list of product variants.
11
10
  *
12
- * This function fetches a list of product variants associated with a specific product SKU.
11
+ * This function retrieves a list of product variants associated with a specific product SKU.
12
+ * Pagination and sorting options are available to refine the results.
13
13
  *
14
- * @param {GetProductVariantsListParameters} params - The parameters to filter the product variants list, including:
15
- * #### productSku - `string` | <strong style={{ color: 'red' }}>required</strong>
16
- * The SKU of the product to fetch variants for.
14
+ * 🛠 **Endpoint**: `GET /v1/shop/product-variants`
17
15
  *
18
- * #### locale - `string` | optional
19
- * The locale for the product variants.
16
+ * | Parameter | Type | Required | Description |
17
+ * |-----------------|--------------|----------|---------------------------------------------------------------|
18
+ * | `productSku` | `string` | ✅ | The SKU of the product to fetch variants for. |
19
+ * | `locale` | `string` | ❌ | The locale for the product variants. |
20
+ * | `pageable.page` | `number` | ✅ | The page number to fetch (0-based index). |
21
+ * | `pageable.size` | `number` | ✅ | The number of items per page. |
22
+ * | `pageable.sort` | `string[]` | ❌ | Sorting criteria (e.g., `["name,asc"]`). |
20
23
  *
21
- * #### pageable - `object` | optional
22
- * Pagination details, including:
23
- * - `page`: The page number.
24
- * - `size`: The number of items per page.
25
- * - `sort`: Sorting criteria.
24
+ * 📤 **Returns**:
25
+ * A `Promise` resolving to a `GetProductVariantsListResponse` object, containing the paginated list of product variants with metadata.
26
26
  *
27
- * @returns {Promise<GetProductVariantsListResponse>} - A promise that resolves with the paginated list of product variants.
28
- *
29
- * @example
30
- * #### input
27
+ * 🛠 **Example usage**:
31
28
  * ```typescript
32
- * await getProductVariantsList({
29
+ * const variants = await getProductVariantsList({
33
30
  * productSku: 'product123',
34
31
  * locale: 'en-US',
35
- * pageable: { page: 1, size: 10, sort: 'name,asc' },
32
+ * pageable: { page: 0, size: 10, sort: ['name,asc'] },
36
33
  * });
34
+ * console.log(variants);
37
35
  * ```
38
- * #### output
39
- * ```json
40
- * {
41
- * "content": [
42
- * { "id": "variant1", "name": "Variant 1" },
43
- * { "id": "variant2", "name": "Variant 2" }
44
- * ],
45
- * "pageable": {
46
- * "page": 1,
47
- * "size": 10,
48
- * "totalPages": 5
49
- * }
50
- * }
51
- * ```
36
+ *
37
+ * @param {GetProductVariantsListParameters} params - The parameters for fetching product variants.
38
+ * @throws {Error} If `productSku` is missing.
39
+ * @returns {Promise<GetProductVariantsListResponse>} A promise resolving to the product variants response.
52
40
  */
53
41
  async function getProductVariantsList({ productSku, locale, pageable, }) {
54
42
  (0, parameters_validation_1.required)({ productSku });
@@ -66,31 +54,30 @@ async function getProductVariantsList({ productSku, locale, pageable, }) {
66
54
  return data;
67
55
  }
68
56
  /**
69
- * APICODE(vSUP300)
70
- * Retrieves suppliers of a specific product variant.
57
+ * 📄 Fetches suppliers of a specific product variant.
58
+ *
59
+ * This function retrieves a list of suppliers associated with a specific product variant ID.
71
60
  *
72
- * This function fetches a list of suppliers associated with a product variant.
61
+ * 🛠 **Endpoint**: `GET /v1/shop/product-variants/{productVariantId}/suppliers`
73
62
  *
74
- * @param {GetProductVariantSuppliersParameters} params - The parameters to identify the product variant, including:
75
- * #### productVariantId - `string` | <strong style={{ color: 'red' }}>required</strong>
76
- * The ID of the product variant to fetch suppliers for.
63
+ * | Parameter | Type | Required | Description |
64
+ * |---------------------|--------------|----------|-------------------------------------------------|
65
+ * | `productVariantId` | `string` | ✅ | The ID of the product variant to fetch suppliers for. |
77
66
  *
78
- * @returns {Promise<GetProductVariantSuppliersResponse>} - A promise that resolves with the suppliers of the product variant.
67
+ * 📤 **Returns**:
68
+ * A `Promise` resolving to a `GetProductVariantSuppliersResponse` object, containing the list of suppliers for the product variant.
79
69
  *
80
- * @example
81
- * #### input
70
+ * 🛠 **Example usage**:
82
71
  * ```typescript
83
- * await getProductVariantSuppliers({ productVariantId: 'variant123' });
84
- * ```
85
- * #### output
86
- * ```json
87
- * {
88
- * "suppliers": [
89
- * { "id": "supplier1", "name": "Supplier 1" },
90
- * { "id": "supplier2", "name": "Supplier 2" }
91
- * ]
92
- * }
72
+ * const suppliers = await getProductVariantSuppliers({
73
+ * productVariantId: 'variant123',
74
+ * });
75
+ * console.log(suppliers);
93
76
  * ```
77
+ *
78
+ * @param {GetProductVariantSuppliersParameters} params - The parameters for fetching product variant suppliers.
79
+ * @throws {Error} If `productVariantId` is missing.
80
+ * @returns {Promise<GetProductVariantSuppliersResponse>} A promise resolving to the product variant suppliers response.
94
81
  */
95
82
  async function getProductVariantSuppliers({ productVariantId, }) {
96
83
  (0, parameters_validation_1.required)({ productVariantId });
@@ -101,47 +88,22 @@ async function getProductVariantSuppliers({ productVariantId, }) {
101
88
  return data;
102
89
  }
103
90
  /**
104
- * ## 🛒 APICODE(vATT300) - Fetch Product Variant Attributes
105
- *
106
- * Retrieves detailed attributes of a product variant identified by SKU, ID, or external ID.
107
- * This metadata includes key details such as **color**, **size**, and **material**, making it easier to describe the variant.
91
+ * 📄 Fetches attributes of a product variant.
108
92
  *
109
- * ---
93
+ * This function retrieves detailed attributes of a product variant identified by SKU, ID, or external ID.
110
94
  *
111
- * ### 📥 Parameters
95
+ * 🛠 **Endpoint**: `GET /v1/shop/products/{productIdentifier}/variant-attributes`
112
96
  *
113
- * | Parameter | Type | Required | Description |
114
- * |---------------------|----------|----------|-----------------------------------------------------------------------------|
115
- * | `productIdentifier` | `string` | ✅ Yes | The unique identifier of the product variant (e.g., SKU, ID, external ID). |
116
- * | `productIdType` | `string` | ✅ Yes | The type of the identifier: `"sku"`, `"id"`, or `"externalId"`. |
117
- * | `locale` | `string` | ❌ No | The locale for localized data (e.g., `"en-US"`, `"fr-FR"`). Defaults to the system locale. |
97
+ * | Parameter | Type | Required | Description |
98
+ * |---------------------|--------------|----------|---------------------------------------------------------------|
99
+ * | `productIdentifier` | `string` | ✅ | The unique identifier of the product variant (e.g., SKU, ID, external ID). |
100
+ * | `productIdType` | `string` | ✅ | The type of the identifier (`sku`, `id`, or `externalId`). |
101
+ * | `locale` | `string` | ❌ | The locale for localized data (e.g., `en-US`, `fr-FR`). Defaults to system locale. |
118
102
  *
119
- * ---
103
+ * 📤 **Returns**:
104
+ * A `Promise` resolving to a `GetProductVariantAttributesResponse` object, containing metadata such as **color**, **size**, or **material**.
120
105
  *
121
- * ### 📤 Returns
122
- * **Type:** `Promise<GetProductVariantAttributesResponse>`
123
- * Resolves with the following structure:
124
- *
125
- * ```typescript
126
- * {
127
- * attributes: Array<{
128
- * id: string;
129
- * name: string;
130
- * value: string | number;
131
- * type: string;
132
- * isRequired: boolean;
133
- * description: string;
134
- * }>;
135
- * locale: string;
136
- * productIdentifier: string;
137
- * }
138
- * ```
139
- *
140
- * ---
141
- *
142
- * ### 🧑‍💻 Example Usage
143
- *
144
- * **Basic Example:**
106
+ * 🛠 **Example usage**:
145
107
  * ```typescript
146
108
  * const attributes = await getProductVariantAttributes({
147
109
  * productIdentifier: 'sku123',
@@ -151,78 +113,9 @@ async function getProductVariantSuppliers({ productVariantId, }) {
151
113
  * console.log(attributes);
152
114
  * ```
153
115
  *
154
- * **Alternative Locale:**
155
- * ```typescript
156
- * const attributes = await getProductVariantAttributes({
157
- * productIdentifier: 'prod789',
158
- * productIdType: 'externalId',
159
- * locale: 'fr-FR',
160
- * });
161
- * console.log(attributes);
162
- * ```
163
- *
164
- * ---
165
- *
166
- * ### 📝 Example Input
167
- * ```json
168
- * {
169
- * "productIdentifier": "sku123",
170
- * "productIdType": "sku",
171
- * "locale": "en-US"
172
- * }
173
- * ```
174
- *
175
- * ---
176
- *
177
- * ### 📦 Example Output
178
- * ```json
179
- * {
180
- * "attributes": [
181
- * {
182
- * "id": "attr1",
183
- * "name": "Color",
184
- * "value": "Red",
185
- * "type": "text",
186
- * "isRequired": true,
187
- * "description": "The color of the product variant."
188
- * },
189
- * {
190
- * "id": "attr2",
191
- * "name": "Size",
192
- * "value": "M",
193
- * "type": "text",
194
- * "isRequired": false,
195
- * "description": "The size of the product variant."
196
- * }
197
- * ],
198
- * "locale": "en-US",
199
- * "productIdentifier": "sku123"
200
- * }
201
- * ```
202
- *
203
- * ---
204
- *
205
- * ### 🚨 Error Responses
206
- *
207
- * | Code | Message | Description |
208
- * |-------|------------------------------------------|------------------------------------------------------|
209
- * | `400` | `Bad Request` | Missing or invalid `productIdentifier` or `productIdType`. |
210
- * | `404` | `Not Found` | The specified product variant does not exist. |
211
- * | `500` | `Internal Server Error` | Unexpected error on the server. |
212
- *
213
- * ---
214
- *
215
- * ### 📚 Notes
216
- * - Ensure the `productIdType` matches the `productIdentifier` value to avoid mismatched requests.
217
- * - Providing a valid `locale` is recommended for fetching localized attribute data when applicable.
218
- * - This API version supports strict versioning; ensure compatibility with your application's requirements.
219
- *
220
- * ---
221
- *
222
- * ### 🔗 Additional Resources
223
- * - [API Authentication Guide](https://docs.example.com/api-authentication)
224
- * - [Product Variants Documentation](https://docs.example.com/product-variants)
225
- * - [Common Error Codes](https://docs.example.com/error-codes)
116
+ * @param {GetProductVariantAttributesParameters} params - The parameters for fetching product variant attributes.
117
+ * @throws {Error} If `productIdentifier` or `productIdType` is missing.
118
+ * @returns {Promise<GetProductVariantAttributesResponse>} A promise resolving to the product variant attributes response.
226
119
  */
227
120
  async function getProductVariantAttributes({ productIdentifier, productIdType, locale, }) {
228
121
  (0, parameters_validation_1.required)({ productIdentifier, productIdType });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djust-b2b/djust-front-sdk",
3
- "version": "1.15.0",
3
+ "version": "1.15.1",
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",