mkfashion-sdk 2.2.2 → 2.2.4

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,7 +1,7 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(curl:*)"
5
- ]
6
- }
7
- }
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(curl:*)"
5
+ ]
6
+ }
7
+ }
package/.gitattributes CHANGED
@@ -1,2 +1,2 @@
1
- # Auto detect text files and perform LF normalization
2
- * text=auto
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
@@ -1,15 +1,15 @@
1
- {
2
- // Use IntelliSense to learn about possible attributes.
3
- // Hover to view descriptions of existing attributes.
4
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
- "version": "0.2.0",
6
- "configurations": [
7
- {
8
- "type": "chrome",
9
- "request": "launch",
10
- "name": "Launch Chrome against localhost",
11
- "url": "http://localhost:8080",
12
- "webRoot": "${workspaceFolder}"
13
- }
14
- ]
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+ {
8
+ "type": "chrome",
9
+ "request": "launch",
10
+ "name": "Launch Chrome against localhost",
11
+ "url": "http://localhost:8080",
12
+ "webRoot": "${workspaceFolder}"
13
+ }
14
+ ]
15
15
  }
package/index.html CHANGED
@@ -1,67 +1,83 @@
1
- <!DOCTYPE html>
2
- <html>
3
-
4
- <head>
5
- <meta charset="UTF-8">
6
- <title>Integração mKFashion</title>
7
- <!-- Para testar localmente, use o caminho local -->
8
- <script src="./src/mkfashion.js"></script>
9
- <!-- Para produção, use o CDN: -->
10
- <!-- <script src="https://unpkg.com/mkfashion-sdk/src/mkfashion.js"></script> -->
11
- <style>
12
- .btn-provar {
13
- background: #000;
14
- color: #fff;
15
- padding: 12px 24px;
16
- border: none;
17
- border-radius: 8px;
18
- cursor: pointer;
19
- font-size: 16px;
20
- display: none;
21
- }
22
-
23
- .btn-provar:hover {
24
- background: #333;
25
- }
26
- </style>
27
- </head>
28
-
29
- <body>
30
-
31
- <h1>Produto XYZ</h1>
32
- <p>SKU: 165230</p>
33
-
34
- <button class="btn-provar" id="btn-provar">
35
- Provador Virtual
36
- </button>
37
-
38
- <script>
39
- // 1. Verifica disponibilidade e configura botão
40
- mkfashion.isAvailable('309728').then(function (disponivel) {
41
- if (disponivel) {
42
-
43
- // 2. Registra callback do carrinho (ANTES de abrir)
44
- mkfashion.addToCart(function (payload) {
45
- console.log('Payload completo:', JSON.stringify(payload, null, 2));
46
- });
47
-
48
-
49
- console.log('✅ Produto SKU 306636 disponível para prova virtual');
50
- var btn = document.getElementById('btn-provar');
51
- btn.style.display = 'inline-block';
52
-
53
- btn.onclick = function () {
54
- mkfashion.open({
55
- store: 'gregory',
56
- identifier: '165182'
57
- });
58
- };
59
- } else {
60
- console.log('❌ Produto SKU 306636 NÃO disponível para prova virtual');
61
- }
62
- });
63
- </script>
64
-
65
- </body>
66
-
1
+ <!DOCTYPE html>
2
+ <html>
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <title>Integração mKFashion</title>
7
+ <!-- Para testar localmente, use o caminho local -->
8
+ <script src="./src/mkfashion.js"></script>
9
+ <!-- Para produção, use o CDN: -->
10
+ <!-- <script src="https://unpkg.com/mkfashion-sdk/src/mkfashion.js"></script> -->
11
+ <style>
12
+ .btn-provar {
13
+ background: #000;
14
+ color: #fff;
15
+ padding: 12px 24px;
16
+ border: none;
17
+ border-radius: 8px;
18
+ cursor: pointer;
19
+ font-size: 16px;
20
+ display: none;
21
+ }
22
+
23
+ .btn-provar:hover {
24
+ background: #333;
25
+ }
26
+ </style>
27
+ </head>
28
+
29
+ <body>
30
+
31
+ <h1>Produto XYZ</h1>
32
+ <p>SKU: 165230</p>
33
+
34
+ <button class="btn-provar" id="btn-provar">
35
+ Provador Virtual
36
+ </button>
37
+
38
+ <script>
39
+ // 1. Registra callback do carrinho (ANTES de abrir)
40
+ mkfashion.addToCart(function (payload) {
41
+ console.log('=== PAYLOAD DO PROVADOR ===');
42
+ console.log('SKU:', payload.sku);
43
+ console.log('Tamanho selecionado:', payload.size);
44
+ console.log('Produto completo:', payload.product);
45
+ console.log('Payload completo:', JSON.stringify(payload, null, 2));
46
+ });
47
+
48
+ // 2. Registra callback de erro
49
+ mkfashion.onError(function (error) {
50
+ console.error('Erro no provador:', error);
51
+ });
52
+
53
+ // 3. Busca e exibe informações do produto no console
54
+ mkfashion.getProduct('gregory', '165230').then(function (produto) {
55
+ console.log('=== Informações do Produto 165230 ===');
56
+ console.log(produto);
57
+ }).catch(function (error) {
58
+ console.error('Erro ao buscar produto:', error);
59
+ });
60
+
61
+ // 4. Verifica disponibilidade e configura botão
62
+ mkfashion.isAvailable(165230).then(function (disponivel) {
63
+ if (disponivel) {
64
+ console.log('✅ Produto SKU 306636 disponível para prova virtual');
65
+ var btn = document.getElementById('btn-provar');
66
+ btn.style.display = 'inline-block';
67
+
68
+ btn.onclick = function () {
69
+ mkfashion.open({
70
+ mode: 'wake',
71
+ store: 'gregory',
72
+ sku: '165230'
73
+ });
74
+ };
75
+ } else {
76
+ console.log('❌ Produto SKU 306636 NÃO disponível para prova virtual');
77
+ }
78
+ });
79
+ </script>
80
+
81
+ </body>
82
+
67
83
  </html>
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
- {
2
- "name": "mkfashion-sdk",
3
- "version": "2.2.2",
4
- "description": "SDK para integrar o provador virtual mKFashion com suporte a Wake Commerce",
5
- "main": "src/mkfashion.js",
6
- "scripts": {
7
- "test": "echo \"Abra test.html no navegador\""
8
- },
9
- "keywords": [
10
- "fashion",
11
- "virtual",
12
- "try-on",
13
- "sdk",
14
- "metakosmos"
15
- ],
16
- "author": "metaKosmos",
17
- "license": "MIT"
1
+ {
2
+ "name": "mkfashion-sdk",
3
+ "version": "2.2.4",
4
+ "description": "SDK para integrar o provador virtual mKFashion com suporte a Wake Commerce",
5
+ "main": "src/mkfashion.js",
6
+ "scripts": {
7
+ "test": "echo \"Abra test.html no navegador\""
8
+ },
9
+ "keywords": [
10
+ "fashion",
11
+ "virtual",
12
+ "try-on",
13
+ "sdk",
14
+ "metakosmos"
15
+ ],
16
+ "author": "metaKosmos",
17
+ "license": "MIT"
18
18
  }