mkfashion-sdk 1.2.8 → 1.3.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/package.json +2 -2
- package/src/mkfashion.js +26 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mkfashion-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "SDK para integrar o provador virtual mKFashion com suporte a Wake Commerce",
|
|
5
5
|
"main": "src/mkfashion.js",
|
|
6
6
|
"scripts": {
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
],
|
|
16
16
|
"author": "metaKosmos",
|
|
17
17
|
"license": "MIT"
|
|
18
|
-
}
|
|
18
|
+
}
|
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)
|
|
@@ -523,7 +548,7 @@ const mkfashion = {
|
|
|
523
548
|
iframe.style.width = typeof width === 'number' ? `${width}px` : width
|
|
524
549
|
iframe.style.height = typeof height === 'number' ? `${height}px` : height
|
|
525
550
|
iframe.style.border = 'none'
|
|
526
|
-
iframe.setAttribute('allow', 'camera
|
|
551
|
+
iframe.setAttribute('allow', 'camera *; microphone *')
|
|
527
552
|
iframe.setAttribute('allowfullscreen', 'true')
|
|
528
553
|
return iframe
|
|
529
554
|
},
|