mkfashion-sdk 1.2.8 → 1.2.9

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/mkfashion.js +25 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mkfashion-sdk",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
4
4
  "description": "SDK para integrar o provador virtual mKFashion com suporte a Wake Commerce",
5
5
  "main": "src/mkfashion.js",
6
6
  "scripts": {
package/src/mkfashion.js CHANGED
@@ -275,6 +275,31 @@ const mkfashion = {
275
275
  }
276
276
  },
277
277
 
278
+ /**
279
+ * Lista todos os produtos disponíveis para try-on
280
+ * @returns {Promise<Array>} - Lista de produtos disponíveis
281
+ */
282
+ async getAvailableProducts() {
283
+ this._log('Buscando produtos disponíveis')
284
+
285
+ try {
286
+ const response = await fetch(`${this.apiUrl}/api/availability/products`)
287
+
288
+ if (!response.ok) {
289
+ const errorData = await response.json().catch(() => ({}))
290
+ throw new Error(errorData.error || `Erro na API: ${response.status}`)
291
+ }
292
+
293
+ const data = await response.json()
294
+ this._log('Produtos disponíveis recebidos', data)
295
+ return data
296
+
297
+ } catch (error) {
298
+ console.error('[mKFashion] Erro ao buscar produtos disponíveis:', error)
299
+ throw error
300
+ }
301
+ },
302
+
278
303
  /**
279
304
  * Busca feedbacks enviados (para testes)
280
305
  * @param {number} page - Pagina (padrao: 1)