@decocms/apps-nuvemshop 7.74.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.
Files changed (35) hide show
  1. package/package.json +48 -0
  2. package/src/__fixtures__/browse-category.json +813 -0
  3. package/src/__fixtures__/categories.json +60 -0
  4. package/src/__fixtures__/checkout.json +3 -0
  5. package/src/__fixtures__/product-custom-fields.json +199 -0
  6. package/src/__fixtures__/product.json +313 -0
  7. package/src/__fixtures__/search.json +636 -0
  8. package/src/__fixtures__/shipping-options.json +9 -0
  9. package/src/__tests__/client.test.ts +118 -0
  10. package/src/__tests__/loaders.test.ts +220 -0
  11. package/src/__tests__/mod.test.ts +51 -0
  12. package/src/actions/createCheckout.ts +36 -0
  13. package/src/client.ts +165 -0
  14. package/src/hooks/__tests__/useCart.test.ts +81 -0
  15. package/src/hooks/useCart.ts +115 -0
  16. package/src/index.ts +23 -0
  17. package/src/loaders/categories.ts +27 -0
  18. package/src/loaders/productDetailsPage.ts +30 -0
  19. package/src/loaders/productList.ts +49 -0
  20. package/src/loaders/productListingPage.ts +94 -0
  21. package/src/loaders/relatedProducts.ts +41 -0
  22. package/src/loaders/shippingOptions.ts +29 -0
  23. package/src/loaders/suggestions.ts +24 -0
  24. package/src/manifest.gen.ts +31 -0
  25. package/src/mod.ts +42 -0
  26. package/src/registry.ts +9 -0
  27. package/src/utils/__tests__/listing.test.ts +167 -0
  28. package/src/utils/__tests__/transform.test.ts +212 -0
  29. package/src/utils/instrumentedFetch.ts +40 -0
  30. package/src/utils/listing.ts +183 -0
  31. package/src/utils/operationRouter.ts +21 -0
  32. package/src/utils/request.ts +17 -0
  33. package/src/utils/transform.ts +231 -0
  34. package/src/utils/types.ts +141 -0
  35. package/tsconfig.json +7 -0
@@ -0,0 +1,60 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "id": 41376194,
5
+ "name": "Camisas",
6
+ "handle": "camisas",
7
+ "parent": null,
8
+ "subcategories": [],
9
+ "description": "",
10
+ "seo_title": "",
11
+ "seo_description": ""
12
+ },
13
+ {
14
+ "id": 41376195,
15
+ "name": "Vestidos",
16
+ "handle": "vestidos",
17
+ "parent": null,
18
+ "subcategories": [],
19
+ "description": "",
20
+ "seo_title": "",
21
+ "seo_description": ""
22
+ },
23
+ {
24
+ "id": 41376197,
25
+ "name": "Calçados",
26
+ "handle": "calcados",
27
+ "parent": null,
28
+ "subcategories": [41376198, 41376199],
29
+ "description": "",
30
+ "seo_title": "",
31
+ "seo_description": ""
32
+ },
33
+ {
34
+ "id": 41376198,
35
+ "name": "Masculino",
36
+ "handle": "masculino",
37
+ "parent": 41376197,
38
+ "subcategories": [],
39
+ "description": "",
40
+ "seo_title": "",
41
+ "seo_description": ""
42
+ },
43
+ {
44
+ "id": 41376199,
45
+ "name": "Feminino",
46
+ "handle": "feminino",
47
+ "parent": 41376197,
48
+ "subcategories": [],
49
+ "description": "",
50
+ "seo_title": "",
51
+ "seo_description": ""
52
+ }
53
+ ],
54
+ "pagination": {
55
+ "page": 1,
56
+ "per_page": 200,
57
+ "total": 5,
58
+ "total_pages": 1
59
+ }
60
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "checkout_url": "https://demodeco.lojavirtualnuvem.com.br/checkout/v3/proxy/2088248589/054c853213dd9296e77f15cb3ce105bd231e356d"
3
+ }
@@ -0,0 +1,199 @@
1
+ {
2
+ "id": 296114659,
3
+ "name": "Cadeira Freedom",
4
+ "handle": "cadeira-freedom",
5
+ "description": "<p>Cadeira ergonômica com encosto reclinável.</p>",
6
+ "images": [
7
+ {
8
+ "id": 987025135,
9
+ "src": "https://cdn.example.com/products/ca3186f247dfeeb411fd08b8709c058-2de62a8eace3217c2217588225505387-1024-1024.jpg",
10
+ "alt": "Cadeira ergonômica Freedom com estofado marrom e estrutura branca, com rodas para mobilidade",
11
+ "height": 1600,
12
+ "width": 1600
13
+ },
14
+ {
15
+ "id": 987025928,
16
+ "src": "https://cdn.example.com/products/b1dc08503e123833c72259703a915b9-d302a062937284415f17588225988200-1024-1024.jpg",
17
+ "alt": "Cadeira ergonômica Freedom com assento e encosto cinza escuro e base branca com rodízios",
18
+ "height": 1600,
19
+ "width": 1600
20
+ },
21
+ {
22
+ "id": 987025134,
23
+ "src": "https://cdn.example.com/products/63906a3320a879fdd12314a65c2da84-c5b0aba8d5e16a429617588225504194-1024-1024.jpg",
24
+ "alt": "",
25
+ "height": 1600,
26
+ "width": 1600
27
+ },
28
+ {
29
+ "id": 1126804011,
30
+ "src": "https://cdn.example.com/products/dimensoes-freedom-bf6142824e918b1c0617721972082523-1024-1024.jpg",
31
+ "alt": "",
32
+ "height": 1500,
33
+ "width": 1500
34
+ },
35
+ {
36
+ "id": 987025117,
37
+ "src": "https://cdn.example.com/products/9856aeacb9b7e7ee477e1d0ab28bfcc-96dd78cb0213a7e66917588225499616-1024-1024.jpg",
38
+ "alt": "",
39
+ "height": 1600,
40
+ "width": 1600
41
+ },
42
+ {
43
+ "id": 987025115,
44
+ "src": "https://cdn.example.com/products/99c99a8fc954feee4cc92ff649ae5cc-daef110dfaa77351f817588225498568-1024-1024.jpg",
45
+ "alt": "",
46
+ "height": 1600,
47
+ "width": 1600
48
+ },
49
+ {
50
+ "id": 987025114,
51
+ "src": "https://cdn.example.com/products/7e57f5b1da7240cd09d8fa84b2b588c-b332218cca10e07c5117588225497708-1024-1024.jpg",
52
+ "alt": "",
53
+ "height": 1600,
54
+ "width": 1600
55
+ },
56
+ {
57
+ "id": 987025128,
58
+ "src": "https://cdn.example.com/products/5a4a0393e162ad463687a7f6238e711-352eb2cf05afd4ef0a17588225502422-1024-1024.jpg",
59
+ "alt": "",
60
+ "height": 1600,
61
+ "width": 1600
62
+ },
63
+ {
64
+ "id": 987025905,
65
+ "src": "https://cdn.example.com/products/d8485528a0e82f517cd319e68176e5f-a2e0f7c22a244231fe17588225981493-1024-1024.jpg",
66
+ "alt": "",
67
+ "height": 1600,
68
+ "width": 1600
69
+ },
70
+ {
71
+ "id": 1106281200,
72
+ "src": "https://cdn.example.com/products/freedom-gato-6fce0629d90092640317703892407376-1024-1024.png",
73
+ "alt": "Cadeira Freedom ergonômica marrom em ambiente moderno com um gato deitado no apoio para os pés e um notebook sobre a parte traseira da cadeira. ESTUDANDO DE MEDICINA",
74
+ "height": 1025,
75
+ "width": 1024
76
+ },
77
+ {
78
+ "id": 987025921,
79
+ "src": "https://cdn.example.com/products/97cdf8c81a9bd64ce3fe0a756174202-07b2d050a6ec06890717588225985854-1024-1024.jpg",
80
+ "alt": "",
81
+ "height": 1600,
82
+ "width": 1600
83
+ },
84
+ {
85
+ "id": 987025916,
86
+ "src": "https://cdn.example.com/products/2906f4c2199556245795e447abb9c76-abf80c79646abf772217588225984321-1024-1024.jpg",
87
+ "alt": "",
88
+ "height": 1600,
89
+ "width": 1600
90
+ },
91
+ {
92
+ "id": 987025909,
93
+ "src": "https://cdn.example.com/products/52c990ebc0b355004cdc65e8bc50fcd-e2310791e9798b2a4117588225982097-1024-1024.jpg",
94
+ "alt": "",
95
+ "height": 1600,
96
+ "width": 1600
97
+ }
98
+ ],
99
+ "variants": [
100
+ {
101
+ "id": 1322141554,
102
+ "image_id": 987025135,
103
+ "product_id": 296114659,
104
+ "position": 1,
105
+ "price": "3499.00",
106
+ "price_without_taxes": null,
107
+ "compare_at_price": "3499.00",
108
+ "promotional_price": "3149.10",
109
+ "stock_management": true,
110
+ "stock": 2,
111
+ "weight": "24.000",
112
+ "width": "56.00",
113
+ "height": "52.00",
114
+ "depth": "46.00",
115
+ "sku": "EC-FRDM-BR",
116
+ "values": ["Marrom"],
117
+ "barcode": null,
118
+ "mpn": null,
119
+ "age_group": null,
120
+ "gender": null,
121
+ "created_at": "2025-09-24T21:52:35+0000",
122
+ "updated_at": "2026-09-14T14:23:11+0000",
123
+ "cost": null,
124
+ "visible": true,
125
+ "inventory_levels": [
126
+ {
127
+ "id": 952639018,
128
+ "variant_id": 1322141554,
129
+ "location_id": "01H6MX0ZSE5XD7ZYM6MXWPSDKG",
130
+ "stock": 2
131
+ }
132
+ ]
133
+ },
134
+ {
135
+ "id": 1322141564,
136
+ "image_id": 987025928,
137
+ "product_id": 296114659,
138
+ "position": 2,
139
+ "price": "3499.00",
140
+ "price_without_taxes": null,
141
+ "compare_at_price": "3499.00",
142
+ "promotional_price": "3149.10",
143
+ "stock_management": true,
144
+ "stock": 11,
145
+ "weight": "24.000",
146
+ "width": "56.00",
147
+ "height": "52.00",
148
+ "depth": "46.00",
149
+ "sku": "EC-FRDM-GY",
150
+ "values": ["Cinza"],
151
+ "barcode": null,
152
+ "mpn": null,
153
+ "age_group": null,
154
+ "gender": null,
155
+ "created_at": "2025-09-24T21:52:35+0000",
156
+ "updated_at": "2026-09-15T14:48:03+0000",
157
+ "cost": null,
158
+ "visible": true,
159
+ "inventory_levels": [
160
+ {
161
+ "id": 952639030,
162
+ "variant_id": 1322141564,
163
+ "location_id": "01H6MX0ZSE5XD7ZYM6MXWPSDKG",
164
+ "stock": 11
165
+ }
166
+ ]
167
+ }
168
+ ],
169
+ "brand": "ACME",
170
+ "tags": "",
171
+ "categories": [
172
+ {
173
+ "id": 20024336,
174
+ "name": "Cadeiras Ergonômicas",
175
+ "handle": "cadeiras-ergonomicas",
176
+ "parent": null,
177
+ "google_shopping_category": "Móveis > Móveis para escritório > Cadeiras de escritório"
178
+ },
179
+ {
180
+ "id": 20024339,
181
+ "name": "Relacionados SD",
182
+ "handle": "relacionados-sd",
183
+ "parent": null,
184
+ "google_shopping_category": ""
185
+ }
186
+ ],
187
+ "attributes": ["Cor da base"],
188
+ "seo_title": "Cadeira Ergônomica Freedom: Se movimente com seu pet",
189
+ "seo_description": "Descubra a Cadeira Freedom: conforto ajustável, movimento ativo e espaço para seu pet. Trabalhe e relaxe com saúde. Compre agora e transforme seu dia!",
190
+ "free_shipping": false,
191
+ "video_url": null,
192
+ "created_at": "2025-09-24T21:52:35+0000",
193
+ "custom_fields": [
194
+ {
195
+ "key": "manual",
196
+ "value": "https://files.example.com/manuals/ergonomic-chair-freedom-pt.pdf"
197
+ }
198
+ ]
199
+ }
@@ -0,0 +1,313 @@
1
+ {
2
+ "id": 372190453,
3
+ "name": "Camisa Xadrez Lenhador Azul",
4
+ "handle": "camisa-xadrez-lenhador-azul",
5
+ "description": "<p>Camisa xadrez de flanela macia, com bolsos frontais e botões de pressão. Ideal para os dias mais frescos, por cima de uma camiseta ou fechada.</p><p><strong>Cores disponíveis:</strong> Azul e Preto, Vermelho e Preto<br><strong>Tamanhos:</strong> P / M / G / GG</p><p><strong>Cuidados:</strong></p><ul><li>Lavar à mão ou na máquina em ciclo delicado</li><li>Não usar alvejante</li><li>Passar em temperatura média</li></ul>",
6
+ "images": [
7
+ {
8
+ "id": 1289344969,
9
+ "src": "https://dcdn-us.mitiendanube.com/stores/008/336/778/products/1-0dc6e3225f75c6be6617912360695512-1024-1024.webp",
10
+ "alt": "",
11
+ "height": 1000,
12
+ "width": 1000
13
+ },
14
+ {
15
+ "id": 1289344973,
16
+ "src": "https://dcdn-us.mitiendanube.com/stores/008/336/778/products/2-c444e295855213e1e117912360699859-1024-1024.webp",
17
+ "alt": "",
18
+ "height": 1000,
19
+ "width": 1000
20
+ }
21
+ ],
22
+ "variants": [
23
+ {
24
+ "id": 1612648502,
25
+ "image_id": 1289344969,
26
+ "product_id": 372190453,
27
+ "position": 1,
28
+ "price": "189.90",
29
+ "price_without_taxes": null,
30
+ "compare_at_price": "189.90",
31
+ "promotional_price": null,
32
+ "stock_management": true,
33
+ "stock": 17,
34
+ "weight": "0.350",
35
+ "width": "0.00",
36
+ "height": "0.00",
37
+ "depth": "0.00",
38
+ "sku": "MD001-1-P",
39
+ "values": ["P", "Azul e Preto"],
40
+ "barcode": null,
41
+ "mpn": null,
42
+ "age_group": null,
43
+ "gender": null,
44
+ "created_at": "2026-10-05T21:34:27+0000",
45
+ "updated_at": "2026-10-05T21:34:30+0000",
46
+ "cost": null,
47
+ "visible": true,
48
+ "inventory_levels": [
49
+ {
50
+ "id": 1243980509,
51
+ "variant_id": 1612648502,
52
+ "location_id": "01M46ZD8MN4T7KKYQNDV2NDS7J",
53
+ "stock": 17
54
+ }
55
+ ]
56
+ },
57
+ {
58
+ "id": 1612648503,
59
+ "image_id": 1289344969,
60
+ "product_id": 372190453,
61
+ "position": 2,
62
+ "price": "189.90",
63
+ "price_without_taxes": null,
64
+ "compare_at_price": "189.90",
65
+ "promotional_price": null,
66
+ "stock_management": true,
67
+ "stock": 20,
68
+ "weight": "0.350",
69
+ "width": "0.00",
70
+ "height": "0.00",
71
+ "depth": "0.00",
72
+ "sku": "MD001-1-M",
73
+ "values": ["M", "Azul e Preto"],
74
+ "barcode": null,
75
+ "mpn": null,
76
+ "age_group": null,
77
+ "gender": null,
78
+ "created_at": "2026-10-05T21:34:28+0000",
79
+ "updated_at": "2026-10-05T21:34:30+0000",
80
+ "cost": null,
81
+ "visible": true,
82
+ "inventory_levels": [
83
+ {
84
+ "id": 1243980547,
85
+ "variant_id": 1612648503,
86
+ "location_id": "01M46ZD8MN4T7KKYQNDV2NDS7J",
87
+ "stock": 20
88
+ }
89
+ ]
90
+ },
91
+ {
92
+ "id": 1612648506,
93
+ "image_id": 1289344969,
94
+ "product_id": 372190453,
95
+ "position": 3,
96
+ "price": "189.90",
97
+ "price_without_taxes": null,
98
+ "compare_at_price": "189.90",
99
+ "promotional_price": null,
100
+ "stock_management": true,
101
+ "stock": 23,
102
+ "weight": "0.350",
103
+ "width": "0.00",
104
+ "height": "0.00",
105
+ "depth": "0.00",
106
+ "sku": "MD001-1-G",
107
+ "values": ["G", "Azul e Preto"],
108
+ "barcode": null,
109
+ "mpn": null,
110
+ "age_group": null,
111
+ "gender": null,
112
+ "created_at": "2026-10-05T21:34:28+0000",
113
+ "updated_at": "2026-10-05T21:34:30+0000",
114
+ "cost": null,
115
+ "visible": true,
116
+ "inventory_levels": [
117
+ {
118
+ "id": 1243980553,
119
+ "variant_id": 1612648506,
120
+ "location_id": "01M46ZD8MN4T7KKYQNDV2NDS7J",
121
+ "stock": 23
122
+ }
123
+ ]
124
+ },
125
+ {
126
+ "id": 1612648508,
127
+ "image_id": 1289344969,
128
+ "product_id": 372190453,
129
+ "position": 4,
130
+ "price": "189.90",
131
+ "price_without_taxes": null,
132
+ "compare_at_price": "189.90",
133
+ "promotional_price": null,
134
+ "stock_management": true,
135
+ "stock": 26,
136
+ "weight": "0.350",
137
+ "width": "0.00",
138
+ "height": "0.00",
139
+ "depth": "0.00",
140
+ "sku": "MD001-1-GG",
141
+ "values": ["GG", "Azul e Preto"],
142
+ "barcode": null,
143
+ "mpn": null,
144
+ "age_group": null,
145
+ "gender": null,
146
+ "created_at": "2026-10-05T21:34:28+0000",
147
+ "updated_at": "2026-10-05T21:34:30+0000",
148
+ "cost": null,
149
+ "visible": true,
150
+ "inventory_levels": [
151
+ {
152
+ "id": 1243980556,
153
+ "variant_id": 1612648508,
154
+ "location_id": "01M46ZD8MN4T7KKYQNDV2NDS7J",
155
+ "stock": 26
156
+ }
157
+ ]
158
+ },
159
+ {
160
+ "id": 1612648511,
161
+ "image_id": 1289344969,
162
+ "product_id": 372190453,
163
+ "position": 5,
164
+ "price": "189.90",
165
+ "price_without_taxes": null,
166
+ "compare_at_price": "189.90",
167
+ "promotional_price": null,
168
+ "stock_management": true,
169
+ "stock": 29,
170
+ "weight": "0.350",
171
+ "width": "0.00",
172
+ "height": "0.00",
173
+ "depth": "0.00",
174
+ "sku": "MD001-2-P",
175
+ "values": ["P", "Vermelho e Preto"],
176
+ "barcode": null,
177
+ "mpn": null,
178
+ "age_group": null,
179
+ "gender": null,
180
+ "created_at": "2026-10-05T21:34:28+0000",
181
+ "updated_at": "2026-10-05T21:34:30+0000",
182
+ "cost": null,
183
+ "visible": true,
184
+ "inventory_levels": [
185
+ {
186
+ "id": 1243980557,
187
+ "variant_id": 1612648511,
188
+ "location_id": "01M46ZD8MN4T7KKYQNDV2NDS7J",
189
+ "stock": 29
190
+ }
191
+ ]
192
+ },
193
+ {
194
+ "id": 1612648513,
195
+ "image_id": 1289344969,
196
+ "product_id": 372190453,
197
+ "position": 6,
198
+ "price": "189.90",
199
+ "price_without_taxes": null,
200
+ "compare_at_price": "189.90",
201
+ "promotional_price": null,
202
+ "stock_management": true,
203
+ "stock": 32,
204
+ "weight": "0.350",
205
+ "width": "0.00",
206
+ "height": "0.00",
207
+ "depth": "0.00",
208
+ "sku": "MD001-2-M",
209
+ "values": ["M", "Vermelho e Preto"],
210
+ "barcode": null,
211
+ "mpn": null,
212
+ "age_group": null,
213
+ "gender": null,
214
+ "created_at": "2026-10-05T21:34:28+0000",
215
+ "updated_at": "2026-10-05T21:34:30+0000",
216
+ "cost": null,
217
+ "visible": true,
218
+ "inventory_levels": [
219
+ {
220
+ "id": 1243980560,
221
+ "variant_id": 1612648513,
222
+ "location_id": "01M46ZD8MN4T7KKYQNDV2NDS7J",
223
+ "stock": 32
224
+ }
225
+ ]
226
+ },
227
+ {
228
+ "id": 1612648515,
229
+ "image_id": 1289344969,
230
+ "product_id": 372190453,
231
+ "position": 7,
232
+ "price": "189.90",
233
+ "price_without_taxes": null,
234
+ "compare_at_price": "189.90",
235
+ "promotional_price": null,
236
+ "stock_management": true,
237
+ "stock": 10,
238
+ "weight": "0.350",
239
+ "width": "0.00",
240
+ "height": "0.00",
241
+ "depth": "0.00",
242
+ "sku": "MD001-2-G",
243
+ "values": ["G", "Vermelho e Preto"],
244
+ "barcode": null,
245
+ "mpn": null,
246
+ "age_group": null,
247
+ "gender": null,
248
+ "created_at": "2026-10-05T21:34:29+0000",
249
+ "updated_at": "2026-10-05T21:34:30+0000",
250
+ "cost": null,
251
+ "visible": true,
252
+ "inventory_levels": [
253
+ {
254
+ "id": 1243980563,
255
+ "variant_id": 1612648515,
256
+ "location_id": "01M46ZD8MN4T7KKYQNDV2NDS7J",
257
+ "stock": 10
258
+ }
259
+ ]
260
+ },
261
+ {
262
+ "id": 1612648518,
263
+ "image_id": 1289344969,
264
+ "product_id": 372190453,
265
+ "position": 8,
266
+ "price": "189.90",
267
+ "price_without_taxes": null,
268
+ "compare_at_price": "189.90",
269
+ "promotional_price": null,
270
+ "stock_management": true,
271
+ "stock": 13,
272
+ "weight": "0.350",
273
+ "width": "0.00",
274
+ "height": "0.00",
275
+ "depth": "0.00",
276
+ "sku": "MD001-2-GG",
277
+ "values": ["GG", "Vermelho e Preto"],
278
+ "barcode": null,
279
+ "mpn": null,
280
+ "age_group": null,
281
+ "gender": null,
282
+ "created_at": "2026-10-05T21:34:29+0000",
283
+ "updated_at": "2026-10-05T21:34:30+0000",
284
+ "cost": null,
285
+ "visible": true,
286
+ "inventory_levels": [
287
+ {
288
+ "id": 1243980565,
289
+ "variant_id": 1612648518,
290
+ "location_id": "01M46ZD8MN4T7KKYQNDV2NDS7J",
291
+ "stock": 13
292
+ }
293
+ ]
294
+ }
295
+ ],
296
+ "brand": null,
297
+ "tags": "",
298
+ "categories": [
299
+ {
300
+ "id": 41376194,
301
+ "name": "Camisas",
302
+ "handle": "camisas",
303
+ "parent": null,
304
+ "google_shopping_category": ""
305
+ }
306
+ ],
307
+ "attributes": ["Tamanho", "Cor"],
308
+ "seo_title": "",
309
+ "seo_description": "",
310
+ "free_shipping": false,
311
+ "video_url": null,
312
+ "created_at": "2026-10-05T21:34:27+0000"
313
+ }