@soma-vertical-web/multi-lib 0.0.31 → 0.0.32
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/__vite-browser-external-BYRIRx8p.mjs +8 -0
- package/__vite-browser-external-Cjz79hOw.js +1 -0
- package/data/api/cms/backup/index.d.ts +11 -0
- package/data/api/cms/content-type/index.d.ts +3 -0
- package/data/api/cms/index.d.ts +2 -0
- package/data/helpers/cms/index.d.ts +11 -0
- package/index.js +14 -14
- package/index.mjs +2122 -2129
- package/index2.js +1 -1
- package/index2.mjs +322 -280
- package/package.json +1 -1
- package/types/data/api/cms/index.d.ts +5 -0
package/index2.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import * as r from "yup";
|
|
2
|
+
import { f as $ } from "./__vite-browser-external-BYRIRx8p.mjs";
|
|
3
|
+
const l = async (t, e = {}) => {
|
|
4
|
+
const { method: o = "GET", body: n, headers: s = {}, priority: a = "auto" } = e;
|
|
4
5
|
return fetch(t, {
|
|
5
6
|
method: o,
|
|
6
7
|
headers: {
|
|
@@ -14,42 +15,42 @@ const l = async (t, r = {}) => {
|
|
|
14
15
|
}).then((i) => i.json()).catch((i) => {
|
|
15
16
|
console.error("[ERROR FETCH VTEX]", i);
|
|
16
17
|
});
|
|
17
|
-
},
|
|
18
|
-
country:
|
|
19
|
-
postalCode:
|
|
18
|
+
}, R = r.object({
|
|
19
|
+
country: r.string().length(3, "Country code must be 3 characters long").required("Country is required"),
|
|
20
|
+
postalCode: r.string().nullable()
|
|
20
21
|
});
|
|
21
|
-
async function
|
|
22
|
-
if (!
|
|
22
|
+
async function O({ apiUrl: t, body: e, fetchOptions: o }) {
|
|
23
|
+
if (!e) {
|
|
23
24
|
console.error("[ERROR FETCHING] Body is required");
|
|
24
25
|
return;
|
|
25
26
|
}
|
|
26
|
-
await
|
|
27
|
-
const { country: n, postalCode: s } =
|
|
27
|
+
await R.validate(e);
|
|
28
|
+
const { country: n, postalCode: s } = e;
|
|
28
29
|
return await l(
|
|
29
30
|
`${t}/api/checkout/pub/postal-code/${n}/${s}`,
|
|
30
31
|
{
|
|
31
32
|
method: "POST",
|
|
32
|
-
body:
|
|
33
|
+
body: e,
|
|
33
34
|
...o
|
|
34
35
|
}
|
|
35
36
|
);
|
|
36
37
|
}
|
|
37
|
-
const
|
|
38
|
-
orderFormId:
|
|
39
|
-
sellerCode:
|
|
40
|
-
sellerName:
|
|
38
|
+
const y = r.object({
|
|
39
|
+
orderFormId: r.string().nullable(),
|
|
40
|
+
sellerCode: r.string().nullable(),
|
|
41
|
+
sellerName: r.string().nullable()
|
|
41
42
|
});
|
|
42
43
|
async function b({
|
|
43
44
|
apiUrl: t,
|
|
44
|
-
body:
|
|
45
|
+
body: e,
|
|
45
46
|
fetchOptions: o
|
|
46
47
|
}) {
|
|
47
|
-
if (!
|
|
48
|
+
if (!e) {
|
|
48
49
|
console.error("[ERROR FETCHING] Body is required");
|
|
49
50
|
return;
|
|
50
51
|
}
|
|
51
|
-
await
|
|
52
|
-
const { orderFormId: n, sellerCode: s, sellerName: a } =
|
|
52
|
+
await y.validate(e);
|
|
53
|
+
const { orderFormId: n, sellerCode: s, sellerName: a } = e, i = s ? `${s.trim()} - ${a}` : null;
|
|
53
54
|
return l(
|
|
54
55
|
`${t}/api/checkout/pub/orderForm/${n}/attachments/openTextField`,
|
|
55
56
|
{
|
|
@@ -61,18 +62,18 @@ async function b({
|
|
|
61
62
|
}
|
|
62
63
|
);
|
|
63
64
|
}
|
|
64
|
-
const
|
|
65
|
-
orderFormId:
|
|
66
|
-
sellerCode:
|
|
67
|
-
marketingData:
|
|
65
|
+
const q = r.object({
|
|
66
|
+
orderFormId: r.string().nullable(),
|
|
67
|
+
sellerCode: r.string().nullable(),
|
|
68
|
+
marketingData: r.object()
|
|
68
69
|
});
|
|
69
|
-
async function F({ apiUrl: t, body:
|
|
70
|
-
if (!
|
|
70
|
+
async function F({ apiUrl: t, body: e, fetchOptions: o }) {
|
|
71
|
+
if (!e) {
|
|
71
72
|
console.error("[ERROR FETCHING] Body is required");
|
|
72
73
|
return;
|
|
73
74
|
}
|
|
74
|
-
await
|
|
75
|
-
const { orderFormId: n, sellerCode: s, marketingData: a } =
|
|
75
|
+
await q.validate(e);
|
|
76
|
+
const { orderFormId: n, sellerCode: s, marketingData: a } = e, i = s ? {
|
|
76
77
|
utmCampaign: s ? s.toUpperCase() : "",
|
|
77
78
|
utmiCampaign: s ? "codigodavendedora" : "semcodigo"
|
|
78
79
|
} : {};
|
|
@@ -88,42 +89,42 @@ async function F({ apiUrl: t, body: r, fetchOptions: o }) {
|
|
|
88
89
|
}
|
|
89
90
|
);
|
|
90
91
|
}
|
|
91
|
-
const
|
|
92
|
-
orderFormId:
|
|
93
|
-
sellerCode:
|
|
94
|
-
sellerName:
|
|
92
|
+
const T = r.object({
|
|
93
|
+
orderFormId: r.string().nullable(),
|
|
94
|
+
sellerCode: r.string().nullable(),
|
|
95
|
+
sellerName: r.string().nullable()
|
|
95
96
|
});
|
|
96
|
-
async function
|
|
97
|
-
if (!
|
|
97
|
+
async function S({ apiUrl: t, body: e, fetchOptions: o }) {
|
|
98
|
+
if (!e) {
|
|
98
99
|
console.error("[ERROR FETCHING] Body is required");
|
|
99
100
|
return;
|
|
100
101
|
}
|
|
101
|
-
await
|
|
102
|
-
const n = await b({ apiUrl: t, body:
|
|
102
|
+
await T.validate(e);
|
|
103
|
+
const n = await b({ apiUrl: t, body: e, fetchOptions: o });
|
|
103
104
|
return F({
|
|
104
105
|
apiUrl: t,
|
|
105
106
|
body: {
|
|
106
|
-
...
|
|
107
|
+
...e,
|
|
107
108
|
marketingData: n == null ? void 0 : n.marketingData
|
|
108
109
|
},
|
|
109
110
|
fetchOptions: o
|
|
110
111
|
});
|
|
111
112
|
}
|
|
112
|
-
const
|
|
113
|
-
orderFormId:
|
|
114
|
-
coupon:
|
|
113
|
+
const v = r.object({
|
|
114
|
+
orderFormId: r.string().nullable(),
|
|
115
|
+
coupon: r.string().nullable()
|
|
115
116
|
});
|
|
116
|
-
async function
|
|
117
|
+
async function E({
|
|
117
118
|
apiUrl: t,
|
|
118
|
-
body:
|
|
119
|
+
body: e,
|
|
119
120
|
fetchOptions: o
|
|
120
121
|
}) {
|
|
121
|
-
if (!
|
|
122
|
+
if (!e) {
|
|
122
123
|
console.error("[ERROR FETCHING] Body is required");
|
|
123
124
|
return;
|
|
124
125
|
}
|
|
125
|
-
await
|
|
126
|
-
const { coupon: n = "", orderFormId: s } =
|
|
126
|
+
await v.validate(e);
|
|
127
|
+
const { coupon: n = "", orderFormId: s } = e;
|
|
127
128
|
return l(
|
|
128
129
|
`${t}/api/checkout/pub/orderForm/${s}/coupons`,
|
|
129
130
|
{
|
|
@@ -133,22 +134,22 @@ async function v({
|
|
|
133
134
|
}
|
|
134
135
|
);
|
|
135
136
|
}
|
|
136
|
-
const
|
|
137
|
-
appId:
|
|
138
|
-
orderFormId:
|
|
139
|
-
key:
|
|
137
|
+
const j = r.object({
|
|
138
|
+
appId: r.string().required("App ID is required"),
|
|
139
|
+
orderFormId: r.string().nullable(),
|
|
140
|
+
key: r.array().of(r.string())
|
|
140
141
|
});
|
|
141
|
-
async function
|
|
142
|
+
async function w({
|
|
142
143
|
apiUrl: t,
|
|
143
|
-
body:
|
|
144
|
+
body: e,
|
|
144
145
|
fetchOptions: o
|
|
145
146
|
}) {
|
|
146
|
-
if (!
|
|
147
|
+
if (!e) {
|
|
147
148
|
console.error("[ERROR FETCHING] Body is required");
|
|
148
149
|
return;
|
|
149
150
|
}
|
|
150
|
-
await
|
|
151
|
-
const { appId: n = "faststore", orderFormId: s, key: a } =
|
|
151
|
+
await j.validate(e);
|
|
152
|
+
const { appId: n = "faststore", orderFormId: s, key: a } = e;
|
|
152
153
|
return l(
|
|
153
154
|
`${t}/api/checkout/pub/orderForm/${s}/customData/${n}/${a}`,
|
|
154
155
|
{
|
|
@@ -157,33 +158,33 @@ async function S({
|
|
|
157
158
|
}
|
|
158
159
|
);
|
|
159
160
|
}
|
|
160
|
-
const
|
|
161
|
-
name:
|
|
162
|
-
content:
|
|
161
|
+
const k = r.object().shape({
|
|
162
|
+
name: r.string().required("Attachment name is required"),
|
|
163
|
+
content: r.object().nullable()
|
|
163
164
|
});
|
|
164
165
|
var f;
|
|
165
|
-
const A =
|
|
166
|
-
attachments: (f =
|
|
167
|
-
id:
|
|
168
|
-
index:
|
|
169
|
-
quantity:
|
|
170
|
-
seller:
|
|
171
|
-
price:
|
|
172
|
-
}),
|
|
173
|
-
orderFormId:
|
|
174
|
-
orderItems:
|
|
166
|
+
const A = r.object().shape({
|
|
167
|
+
attachments: (f = r.array().of(k)) == null ? void 0 : f.nullable(),
|
|
168
|
+
id: r.string().required("ID of SKU is required"),
|
|
169
|
+
index: r.number().integer().nullable(),
|
|
170
|
+
quantity: r.number().integer().nullable(),
|
|
171
|
+
seller: r.string().required("Seller is required"),
|
|
172
|
+
price: r.number().integer()
|
|
173
|
+
}), N = r.object({
|
|
174
|
+
orderFormId: r.string().required("OrderFormId is required"),
|
|
175
|
+
orderItems: r.array().of(A)
|
|
175
176
|
});
|
|
176
|
-
async function
|
|
177
|
+
async function D({
|
|
177
178
|
apiUrl: t,
|
|
178
|
-
body:
|
|
179
|
+
body: e,
|
|
179
180
|
fetchOptions: o
|
|
180
181
|
}) {
|
|
181
|
-
if (!
|
|
182
|
+
if (!e) {
|
|
182
183
|
console.error("[ERROR FETCHING] Body is required");
|
|
183
184
|
return;
|
|
184
185
|
}
|
|
185
|
-
await
|
|
186
|
-
const { orderFormId: n, orderItems: s } =
|
|
186
|
+
await N.validate(e);
|
|
187
|
+
const { orderFormId: n, orderItems: s } = e;
|
|
187
188
|
return l(
|
|
188
189
|
`${t}/api/checkout/pub/orderForm/${n}/items`,
|
|
189
190
|
{
|
|
@@ -193,20 +194,20 @@ async function k({
|
|
|
193
194
|
}
|
|
194
195
|
);
|
|
195
196
|
}
|
|
196
|
-
const
|
|
197
|
-
orderFormId:
|
|
197
|
+
const G = r.object({
|
|
198
|
+
orderFormId: r.string().nullable()
|
|
198
199
|
});
|
|
199
|
-
async function
|
|
200
|
+
async function P({
|
|
200
201
|
apiUrl: t,
|
|
201
|
-
body:
|
|
202
|
+
body: e,
|
|
202
203
|
fetchOptions: o
|
|
203
204
|
}) {
|
|
204
|
-
if (!
|
|
205
|
+
if (!e) {
|
|
205
206
|
console.error("[ERROR FETCHING] Body is required");
|
|
206
207
|
return;
|
|
207
208
|
}
|
|
208
|
-
await
|
|
209
|
-
const { orderFormId: n } =
|
|
209
|
+
await G.validate(e);
|
|
210
|
+
const { orderFormId: n } = e;
|
|
210
211
|
return l(
|
|
211
212
|
`${t}/api/checkout/pub/orderForm/${n}/items/removeAll`,
|
|
212
213
|
{
|
|
@@ -215,33 +216,33 @@ async function G({
|
|
|
215
216
|
}
|
|
216
217
|
);
|
|
217
218
|
}
|
|
218
|
-
const
|
|
219
|
-
name:
|
|
220
|
-
content:
|
|
219
|
+
const _ = r.object().shape({
|
|
220
|
+
name: r.string().required("Attachment name is required"),
|
|
221
|
+
content: r.object().nullable()
|
|
221
222
|
});
|
|
222
223
|
var I;
|
|
223
|
-
const
|
|
224
|
-
attachments: (I =
|
|
225
|
-
id:
|
|
226
|
-
index:
|
|
227
|
-
quantity:
|
|
228
|
-
seller:
|
|
229
|
-
price:
|
|
230
|
-
}), H =
|
|
231
|
-
orderFormId:
|
|
232
|
-
orderItems:
|
|
224
|
+
const B = r.object().shape({
|
|
225
|
+
attachments: (I = r.array().of(_)) == null ? void 0 : I.nullable(),
|
|
226
|
+
id: r.string().required("ID of SKU is required"),
|
|
227
|
+
index: r.number().integer().nullable(),
|
|
228
|
+
quantity: r.number().integer().nullable(),
|
|
229
|
+
seller: r.string().required("Seller is required"),
|
|
230
|
+
price: r.number().integer()
|
|
231
|
+
}), H = r.object({
|
|
232
|
+
orderFormId: r.string().nullable(),
|
|
233
|
+
orderItems: r.array().of(B)
|
|
233
234
|
});
|
|
234
|
-
async function
|
|
235
|
+
async function M({
|
|
235
236
|
apiUrl: t,
|
|
236
|
-
body:
|
|
237
|
+
body: e,
|
|
237
238
|
fetchOptions: o
|
|
238
239
|
}) {
|
|
239
|
-
if (!
|
|
240
|
+
if (!e) {
|
|
240
241
|
console.error("[ERROR FETCHING] Body is required");
|
|
241
242
|
return;
|
|
242
243
|
}
|
|
243
|
-
await H.validate(
|
|
244
|
-
const { orderFormId: n, orderItems: s } =
|
|
244
|
+
await H.validate(e);
|
|
245
|
+
const { orderFormId: n, orderItems: s } = e;
|
|
245
246
|
return l(
|
|
246
247
|
`${t}/api/checkout/pub/orderForm/${n}/items/update`,
|
|
247
248
|
{
|
|
@@ -251,20 +252,20 @@ async function _({
|
|
|
251
252
|
}
|
|
252
253
|
);
|
|
253
254
|
}
|
|
254
|
-
const
|
|
255
|
-
orderFormId:
|
|
255
|
+
const U = r.object({
|
|
256
|
+
orderFormId: r.string().nullable()
|
|
256
257
|
});
|
|
257
|
-
async function
|
|
258
|
+
async function x({
|
|
258
259
|
apiUrl: t,
|
|
259
|
-
body:
|
|
260
|
+
body: e,
|
|
260
261
|
fetchOptions: o
|
|
261
262
|
}) {
|
|
262
|
-
if (!
|
|
263
|
+
if (!e) {
|
|
263
264
|
console.error("[ERROR FETCHING] Body is required");
|
|
264
265
|
return;
|
|
265
266
|
}
|
|
266
|
-
await
|
|
267
|
-
const { orderFormId: n } =
|
|
267
|
+
await U.validate(e);
|
|
268
|
+
const { orderFormId: n } = e;
|
|
268
269
|
return l(
|
|
269
270
|
`${t}/api/checkout/pub/orderForm/${n}/messages/clear`,
|
|
270
271
|
{
|
|
@@ -273,66 +274,66 @@ async function M({
|
|
|
273
274
|
}
|
|
274
275
|
);
|
|
275
276
|
}
|
|
276
|
-
const
|
|
277
|
-
id:
|
|
277
|
+
const z = r.object({
|
|
278
|
+
id: r.string().nullable(),
|
|
278
279
|
// id offering
|
|
279
|
-
itemIndex:
|
|
280
|
-
orderFormId:
|
|
281
|
-
remove:
|
|
280
|
+
itemIndex: r.number().nullable(),
|
|
281
|
+
orderFormId: r.string().nullable(),
|
|
282
|
+
remove: r.boolean().nullable()
|
|
282
283
|
});
|
|
283
|
-
async function
|
|
284
|
-
if (!
|
|
284
|
+
async function L({ apiUrl: t, body: e, fetchOptions: o }) {
|
|
285
|
+
if (!e) {
|
|
285
286
|
console.error("[ERROR FETCHING] Body is required");
|
|
286
287
|
return;
|
|
287
288
|
}
|
|
288
|
-
await
|
|
289
|
-
const { itemIndex: n, orderFormId: s, id: a, remove: i } =
|
|
289
|
+
await z.validate(e);
|
|
290
|
+
const { itemIndex: n, orderFormId: s, id: a, remove: i } = e, d = i ? `/${a}/remove` : "", m = `${t}/api/checkout/pub/orderForm/${s}/items/${n}/offerings${d}`;
|
|
290
291
|
return l(m, {
|
|
291
292
|
method: "POST",
|
|
292
293
|
body: { id: a },
|
|
293
294
|
...o
|
|
294
295
|
});
|
|
295
296
|
}
|
|
296
|
-
const
|
|
297
|
-
orderFormId:
|
|
297
|
+
const V = r.object({
|
|
298
|
+
orderFormId: r.string().nullable()
|
|
298
299
|
});
|
|
299
|
-
async function
|
|
300
|
+
async function J({
|
|
300
301
|
apiUrl: t,
|
|
301
|
-
body:
|
|
302
|
+
body: e,
|
|
302
303
|
fetchOptions: o,
|
|
303
304
|
extraData: n
|
|
304
305
|
}) {
|
|
305
306
|
var i;
|
|
306
|
-
if (!
|
|
307
|
+
if (!e) {
|
|
307
308
|
console.error("[ERROR FETCHING] Body is required");
|
|
308
309
|
return;
|
|
309
310
|
}
|
|
310
|
-
await
|
|
311
|
+
await V.validate(e);
|
|
311
312
|
const s = new URLSearchParams({
|
|
312
313
|
refreshOutdatedData: "true"
|
|
313
|
-
}), a =
|
|
314
|
+
}), a = e.orderFormId && ((i = n.orderFormPurchaseId) == null ? void 0 : i.value) !== e.orderFormId ? `${t}/api/checkout/pub/orderForm/${e.orderFormId}?${String(s)}` : `${t}/api/checkout/pub/orderForm`;
|
|
314
315
|
return l(a, { method: "GET", ...o });
|
|
315
316
|
}
|
|
316
|
-
const K =
|
|
317
|
-
orderFormId:
|
|
318
|
-
email:
|
|
319
|
-
firstName:
|
|
320
|
-
lastName:
|
|
321
|
-
documentType:
|
|
322
|
-
document:
|
|
323
|
-
phone:
|
|
317
|
+
const K = r.object({
|
|
318
|
+
orderFormId: r.string().nullable(),
|
|
319
|
+
email: r.string().email().required(),
|
|
320
|
+
firstName: r.string().required(),
|
|
321
|
+
lastName: r.string().required(),
|
|
322
|
+
documentType: r.string().required(),
|
|
323
|
+
document: r.string().required(),
|
|
324
|
+
phone: r.string().matches(/^\+\d{1,3}\d{10,11}$/)
|
|
324
325
|
});
|
|
325
|
-
async function
|
|
326
|
+
async function Y({
|
|
326
327
|
apiUrl: t,
|
|
327
|
-
body:
|
|
328
|
+
body: e,
|
|
328
329
|
fetchOptions: o
|
|
329
330
|
}) {
|
|
330
|
-
if (!
|
|
331
|
+
if (!e) {
|
|
331
332
|
console.error("[ERROR FETCHING] Body is required");
|
|
332
333
|
return;
|
|
333
334
|
}
|
|
334
|
-
await K.validate(
|
|
335
|
-
const { orderFormId: n, ...s } =
|
|
335
|
+
await K.validate(e);
|
|
336
|
+
const { orderFormId: n, ...s } = e;
|
|
336
337
|
return l(
|
|
337
338
|
`${t}/api/checkout/pub/orderForm/${n}/attachments/clientProfileData`,
|
|
338
339
|
{
|
|
@@ -342,20 +343,20 @@ async function V({
|
|
|
342
343
|
}
|
|
343
344
|
);
|
|
344
345
|
}
|
|
345
|
-
const
|
|
346
|
-
sellerCode:
|
|
346
|
+
const Q = r.object({
|
|
347
|
+
sellerCode: r.string().nullable()
|
|
347
348
|
});
|
|
348
|
-
async function
|
|
349
|
+
async function X({
|
|
349
350
|
apiUrl: t,
|
|
350
|
-
body:
|
|
351
|
+
body: e,
|
|
351
352
|
fetchOptions: o
|
|
352
353
|
}) {
|
|
353
|
-
if (!
|
|
354
|
+
if (!e) {
|
|
354
355
|
console.error("[ERROR FETCHING] Body is required");
|
|
355
356
|
return;
|
|
356
357
|
}
|
|
357
|
-
await
|
|
358
|
-
const { sellerCode: n = "" } =
|
|
358
|
+
await Q.validate(e);
|
|
359
|
+
const { sellerCode: n = "" } = e;
|
|
359
360
|
return l(
|
|
360
361
|
`${t}/api/dataentities/VD/search?_fields=id,cod,name,ativo&cod=${n}`,
|
|
361
362
|
{
|
|
@@ -367,22 +368,22 @@ async function Y({
|
|
|
367
368
|
}
|
|
368
369
|
);
|
|
369
370
|
}
|
|
370
|
-
const
|
|
371
|
-
country:
|
|
372
|
-
orderFormId:
|
|
373
|
-
postalCode:
|
|
371
|
+
const W = r.object().shape({
|
|
372
|
+
country: r.string().length(3, "Country code must be 3 characters long").required("Country is required"),
|
|
373
|
+
orderFormId: r.string().nullable(),
|
|
374
|
+
postalCode: r.string().nullable()
|
|
374
375
|
});
|
|
375
|
-
async function
|
|
376
|
+
async function Z({
|
|
376
377
|
apiUrl: t,
|
|
377
|
-
body:
|
|
378
|
+
body: e,
|
|
378
379
|
fetchOptions: o
|
|
379
380
|
}) {
|
|
380
|
-
if (!
|
|
381
|
+
if (!e) {
|
|
381
382
|
console.error("[ERROR FETCHING] Body is required");
|
|
382
383
|
return;
|
|
383
384
|
}
|
|
384
|
-
await
|
|
385
|
-
const { country: n, orderFormId: s, postalCode: a } =
|
|
385
|
+
await W.validate(e);
|
|
386
|
+
const { country: n, orderFormId: s, postalCode: a } = e, i = a ? {
|
|
386
387
|
address: {
|
|
387
388
|
addressType: "residential",
|
|
388
389
|
postalCode: a,
|
|
@@ -401,41 +402,41 @@ async function X({
|
|
|
401
402
|
}
|
|
402
403
|
);
|
|
403
404
|
}
|
|
404
|
-
const
|
|
405
|
-
orderFormId:
|
|
406
|
-
options:
|
|
407
|
-
|
|
408
|
-
itemIndex:
|
|
409
|
-
selectedDeliveryChannel:
|
|
410
|
-
selectedSla:
|
|
405
|
+
const ee = r.object().shape({
|
|
406
|
+
orderFormId: r.string().nullable(),
|
|
407
|
+
options: r.array().of(
|
|
408
|
+
r.object().shape({
|
|
409
|
+
itemIndex: r.number(),
|
|
410
|
+
selectedDeliveryChannel: r.string(),
|
|
411
|
+
selectedSla: r.string()
|
|
411
412
|
})
|
|
412
413
|
),
|
|
413
|
-
selectedAddresses:
|
|
414
|
-
|
|
415
|
-
addressId:
|
|
416
|
-
addressType:
|
|
417
|
-
city:
|
|
418
|
-
complement:
|
|
419
|
-
country:
|
|
420
|
-
geoCoordinates:
|
|
421
|
-
isDisposable:
|
|
422
|
-
neighborhood:
|
|
423
|
-
number:
|
|
424
|
-
postalCode:
|
|
425
|
-
receiverName:
|
|
426
|
-
reference:
|
|
427
|
-
state:
|
|
428
|
-
street:
|
|
414
|
+
selectedAddresses: r.array().of(
|
|
415
|
+
r.object().shape({
|
|
416
|
+
addressId: r.string().required(),
|
|
417
|
+
addressType: r.string().required(),
|
|
418
|
+
city: r.string().nullable(),
|
|
419
|
+
complement: r.string().nullable(),
|
|
420
|
+
country: r.string().required().length(3),
|
|
421
|
+
geoCoordinates: r.array().of(r.number()).required().min(0),
|
|
422
|
+
isDisposable: r.boolean().required(),
|
|
423
|
+
neighborhood: r.string().nullable(),
|
|
424
|
+
number: r.string().nullable(),
|
|
425
|
+
postalCode: r.string().required(),
|
|
426
|
+
receiverName: r.string().nullable(),
|
|
427
|
+
reference: r.string().nullable(),
|
|
428
|
+
state: r.string().nullable(),
|
|
429
|
+
street: r.string().nullable()
|
|
429
430
|
})
|
|
430
431
|
)
|
|
431
432
|
});
|
|
432
|
-
async function
|
|
433
|
-
if (!
|
|
433
|
+
async function re({ apiUrl: t, body: e, fetchOptions: o }) {
|
|
434
|
+
if (!e) {
|
|
434
435
|
console.error("[ERROR FETCHING] Body is required");
|
|
435
436
|
return;
|
|
436
437
|
}
|
|
437
|
-
await
|
|
438
|
-
const { orderFormId: n, options: s, selectedAddresses: a } =
|
|
438
|
+
await ee.validate(e);
|
|
439
|
+
const { orderFormId: n, options: s, selectedAddresses: a } = e;
|
|
439
440
|
return l(
|
|
440
441
|
`${t}/api/checkout/pub/orderForm/${n}/attachments/shippingData`,
|
|
441
442
|
{
|
|
@@ -449,21 +450,21 @@ async function Z({ apiUrl: t, body: r, fetchOptions: o }) {
|
|
|
449
450
|
}
|
|
450
451
|
);
|
|
451
452
|
}
|
|
452
|
-
const
|
|
453
|
-
country:
|
|
454
|
-
postalCode:
|
|
455
|
-
geoCoordinates:
|
|
456
|
-
longitude:
|
|
457
|
-
latitude:
|
|
453
|
+
const te = r.object({
|
|
454
|
+
country: r.string().length(3, "Country code must be 3 characters long").required("Country is required"),
|
|
455
|
+
postalCode: r.string().nullable(),
|
|
456
|
+
geoCoordinates: r.object().shape({
|
|
457
|
+
longitude: r.number().required(),
|
|
458
|
+
latitude: r.number().required()
|
|
458
459
|
})
|
|
459
460
|
});
|
|
460
|
-
async function
|
|
461
|
-
if (!
|
|
461
|
+
async function oe({ apiUrl: t, body: e, fetchOptions: o }) {
|
|
462
|
+
if (!e) {
|
|
462
463
|
console.error("[ERROR FETCHING] Body is required");
|
|
463
464
|
return;
|
|
464
465
|
}
|
|
465
|
-
await
|
|
466
|
-
const { country: n = "", geoCoordinates: s, postalCode: a = "" } =
|
|
466
|
+
await te.validate(e);
|
|
467
|
+
const { country: n = "", geoCoordinates: s, postalCode: a = "" } = e, i = new URLSearchParams({ country: String(n) });
|
|
467
468
|
return a ? i.append("postalCode", a) : i.append(
|
|
468
469
|
"geoCoordinates",
|
|
469
470
|
`${s == null ? void 0 : s.longitude};${s == null ? void 0 : s.latitude}`
|
|
@@ -475,60 +476,60 @@ async function re({ apiUrl: t, body: r, fetchOptions: o }) {
|
|
|
475
476
|
}
|
|
476
477
|
);
|
|
477
478
|
}
|
|
478
|
-
const
|
|
479
|
-
id:
|
|
480
|
-
quantity:
|
|
481
|
-
seller:
|
|
482
|
-
}),
|
|
483
|
-
items:
|
|
484
|
-
country:
|
|
485
|
-
postalCode:
|
|
486
|
-
geoCoordinates:
|
|
479
|
+
const ne = r.object({
|
|
480
|
+
id: r.string().required("ID of SKU is required"),
|
|
481
|
+
quantity: r.number().integer().required("Quantity of item is required"),
|
|
482
|
+
seller: r.string()
|
|
483
|
+
}), ae = r.object({
|
|
484
|
+
items: r.array().of(ne),
|
|
485
|
+
country: r.string().length(3, "Country code must be 3 characters long").required("Country is required"),
|
|
486
|
+
postalCode: r.string().nullable(),
|
|
487
|
+
geoCoordinates: r.array().nullable().of(r.number()).length(2)
|
|
487
488
|
});
|
|
488
|
-
async function
|
|
489
|
-
if (!
|
|
489
|
+
async function se({ apiUrl: t, body: e, fetchOptions: o }) {
|
|
490
|
+
if (!e) {
|
|
490
491
|
console.error("[ERROR FETCHING] Body is required");
|
|
491
492
|
return;
|
|
492
493
|
}
|
|
493
|
-
return await
|
|
494
|
+
return await ae.validate(e), l(
|
|
494
495
|
`${t}/api/checkout/pub/orderForms/simulation`,
|
|
495
496
|
{
|
|
496
497
|
method: "POST",
|
|
497
|
-
body:
|
|
498
|
+
body: e,
|
|
498
499
|
...o
|
|
499
500
|
}
|
|
500
501
|
);
|
|
501
502
|
}
|
|
502
|
-
const
|
|
503
|
+
const ie = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
503
504
|
__proto__: null,
|
|
504
|
-
getMasterDataSellerCode:
|
|
505
|
-
getOrderForm:
|
|
506
|
-
postOrderFormAddCoupon:
|
|
507
|
-
postOrderFormAttachClientProfileData:
|
|
508
|
-
postOrderFormAttachOrderFormData:
|
|
509
|
-
postOrderFormAttachShippingData:
|
|
505
|
+
getMasterDataSellerCode: X,
|
|
506
|
+
getOrderForm: J,
|
|
507
|
+
postOrderFormAddCoupon: E,
|
|
508
|
+
postOrderFormAttachClientProfileData: Y,
|
|
509
|
+
postOrderFormAttachOrderFormData: S,
|
|
510
|
+
postOrderFormAttachShippingData: Z,
|
|
510
511
|
postOrderFormAttachmentsMarketingData: F,
|
|
511
512
|
postOrderFormAttachmentsOpenTextField: b,
|
|
512
|
-
postOrderFormClearMessages:
|
|
513
|
-
postOrderFormFreightSimulation:
|
|
514
|
-
postOrderFormItems:
|
|
515
|
-
postOrderFormRegion:
|
|
516
|
-
postOrderFormRemoveAllItems:
|
|
517
|
-
postOrderFormUpdateItems:
|
|
518
|
-
postOrderFormUpdateShippingData:
|
|
519
|
-
postOrderformAddress:
|
|
520
|
-
putOrderFormCustomData:
|
|
521
|
-
updateOrderFormOffering:
|
|
522
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
523
|
-
skuId:
|
|
513
|
+
postOrderFormClearMessages: x,
|
|
514
|
+
postOrderFormFreightSimulation: se,
|
|
515
|
+
postOrderFormItems: D,
|
|
516
|
+
postOrderFormRegion: oe,
|
|
517
|
+
postOrderFormRemoveAllItems: P,
|
|
518
|
+
postOrderFormUpdateItems: M,
|
|
519
|
+
postOrderFormUpdateShippingData: re,
|
|
520
|
+
postOrderformAddress: O,
|
|
521
|
+
putOrderFormCustomData: w,
|
|
522
|
+
updateOrderFormOffering: L
|
|
523
|
+
}, Symbol.toStringTag, { value: "Module" })), le = r.object({
|
|
524
|
+
skuId: r.string()
|
|
524
525
|
});
|
|
525
|
-
async function
|
|
526
|
-
if (!
|
|
526
|
+
async function de({ apiUrl: t, body: e, fetchOptions: o }) {
|
|
527
|
+
if (!e) {
|
|
527
528
|
console.error("[ERROR FETCHING] Body is required");
|
|
528
529
|
return;
|
|
529
530
|
}
|
|
530
|
-
await
|
|
531
|
-
const { skuId: n } =
|
|
531
|
+
await le.validate(e);
|
|
532
|
+
const { skuId: n } = e;
|
|
532
533
|
return l(
|
|
533
534
|
`${t}/api/catalog/pvt/stockkeepingunitkit?parentSkuId=${n}`,
|
|
534
535
|
{
|
|
@@ -536,16 +537,16 @@ async function ie({ apiUrl: t, body: r, fetchOptions: o }) {
|
|
|
536
537
|
}
|
|
537
538
|
);
|
|
538
539
|
}
|
|
539
|
-
const
|
|
540
|
-
ids:
|
|
540
|
+
const ce = r.object({
|
|
541
|
+
ids: r.array().of(r.string().required("ID are required")).required("IDs are required")
|
|
541
542
|
});
|
|
542
|
-
async function
|
|
543
|
-
if (!
|
|
543
|
+
async function ue({ apiUrl: t, body: e, fetchOptions: o }) {
|
|
544
|
+
if (!e) {
|
|
544
545
|
console.error("[ERROR FETCHING] Body is required");
|
|
545
546
|
return;
|
|
546
547
|
}
|
|
547
|
-
await
|
|
548
|
-
const { ids: n } =
|
|
548
|
+
await ce.validate(e);
|
|
549
|
+
const { ids: n } = e;
|
|
549
550
|
return l(
|
|
550
551
|
`${t}/api/catalog_system/pub/products/search?fq=${n.map((s) => `productId:${s}`).join("&fq=")}`,
|
|
551
552
|
{
|
|
@@ -553,16 +554,16 @@ async function de({ apiUrl: t, body: r, fetchOptions: o }) {
|
|
|
553
554
|
}
|
|
554
555
|
);
|
|
555
556
|
}
|
|
556
|
-
const
|
|
557
|
-
productId:
|
|
557
|
+
const me = r.object({
|
|
558
|
+
productId: r.number().required("Product ID is required")
|
|
558
559
|
});
|
|
559
|
-
async function
|
|
560
|
-
if (!
|
|
560
|
+
async function pe({ apiUrl: t, body: e, fetchOptions: o }) {
|
|
561
|
+
if (!e) {
|
|
561
562
|
console.error("[ERROR FETCHING] Body is required");
|
|
562
563
|
return;
|
|
563
564
|
}
|
|
564
|
-
await
|
|
565
|
-
const { productId: n } =
|
|
565
|
+
await me.validate(e);
|
|
566
|
+
const { productId: n } = e;
|
|
566
567
|
return l(
|
|
567
568
|
`${t}/api/catalog_system/pub/products/crossselling/similars/${n.toString()}`,
|
|
568
569
|
{
|
|
@@ -570,61 +571,61 @@ async function ue({ apiUrl: t, body: r, fetchOptions: o }) {
|
|
|
570
571
|
}
|
|
571
572
|
);
|
|
572
573
|
}
|
|
573
|
-
const
|
|
574
|
+
const ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
574
575
|
__proto__: null,
|
|
575
|
-
getCatalogKitProducts:
|
|
576
|
-
getCatalogProducts:
|
|
577
|
-
getCatalogSimilars:
|
|
578
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
576
|
+
getCatalogKitProducts: de,
|
|
577
|
+
getCatalogProducts: ue,
|
|
578
|
+
getCatalogSimilars: pe
|
|
579
|
+
}, Symbol.toStringTag, { value: "Module" })), he = (t = "") => t.charAt(0).toUpperCase() + t.slice(1), h = (t, e = " ") => !t || typeof t == "string" && t.length === 0 ? t : (Array.isArray(t) ? t : t.split("-")).map(he).join(e), fe = ({ canonical: t, seo: e, slug: o }) => {
|
|
579
580
|
const n = Array.isArray(o) ? o.join(", ") : o;
|
|
580
581
|
return {
|
|
581
582
|
id: 0,
|
|
582
|
-
Title: `${Array.isArray(o) ? o.map((a) => h(a)).join(",") : h(o)} - ${
|
|
583
|
-
MetaTagDescription:
|
|
583
|
+
Title: `${Array.isArray(o) ? o.map((a) => h(a)).join(",") : h(o)} - ${e.title}`,
|
|
584
|
+
MetaTagDescription: e.description,
|
|
584
585
|
name: n,
|
|
585
586
|
hasChildren: !1,
|
|
586
587
|
url: t,
|
|
587
588
|
children: []
|
|
588
589
|
};
|
|
589
|
-
},
|
|
590
|
-
category: String(
|
|
591
|
-
title: (
|
|
592
|
-
description: (
|
|
590
|
+
}, Ie = ({ canonical: t, category: e, previousImages: o, seo: n }) => ({
|
|
591
|
+
category: String(e == null ? void 0 : e.id),
|
|
592
|
+
title: (e == null ? void 0 : e.Title) ?? n.title,
|
|
593
|
+
description: (e == null ? void 0 : e.MetaTagDescription) ?? n.description,
|
|
593
594
|
alternates: { canonical: t },
|
|
594
595
|
openGraph: {
|
|
595
596
|
type: "website",
|
|
596
|
-
title: (
|
|
597
|
-
description: (
|
|
597
|
+
title: (e == null ? void 0 : e.Title) ?? n.title,
|
|
598
|
+
description: (e == null ? void 0 : e.MetaTagDescription) ?? n.description,
|
|
598
599
|
images: Array.isArray(o) ? [...o] : []
|
|
599
600
|
}
|
|
600
|
-
}),
|
|
601
|
+
}), be = ({ items: t, parent: e, apiUrl: o, find: n }) => {
|
|
601
602
|
const s = t.find(
|
|
602
|
-
(i) => i.url.replace(o, "") === decodeURIComponent(
|
|
603
|
+
(i) => i.url.replace(o, "") === decodeURIComponent(e.toLowerCase())
|
|
603
604
|
);
|
|
604
605
|
return (s == null ? void 0 : s.children.find(
|
|
605
606
|
(i) => i.name.toLowerCase() === decodeURIComponent(String(n))
|
|
606
607
|
)) ?? s;
|
|
607
|
-
},
|
|
608
|
+
}, Fe = (t) => {
|
|
608
609
|
t instanceof Error ? (console.error(`[ERROR CATEGORY INFO]: ${t.message}`), console.error(t.stack)) : console.error("[ERROR CATEGORY INFO]: Unknown error", t);
|
|
609
|
-
},
|
|
610
|
+
}, Ce = /* @__PURE__ */ new Set([
|
|
610
611
|
"brand",
|
|
611
612
|
"category",
|
|
612
613
|
"department",
|
|
613
614
|
"subcategory",
|
|
614
615
|
"collection",
|
|
615
616
|
"cluster"
|
|
616
|
-
]),
|
|
617
|
+
]), $e = (t) => typeof (t == null ? void 0 : t.pageType) == "string" && Ce.has(t == null ? void 0 : t.pageType.toLowerCase()), Re = (t) => ({
|
|
617
618
|
collection: t.Coleção,
|
|
618
619
|
categoryId: t.categoryId,
|
|
619
620
|
current_collection: t["Coleção Atual"],
|
|
620
621
|
items: t.items
|
|
621
|
-
}),
|
|
622
|
+
}), Oe = (t, e) => t.reduce((o, n) => {
|
|
622
623
|
if (n.items.filter(
|
|
623
624
|
(i) => i.sellers.find((d) => d.commertialOffer.IsAvailable)
|
|
624
625
|
).length === 0 || (o == null ? void 0 : o.find((i) => (i == null ? void 0 : i.productId) === (n == null ? void 0 : n.productId))) !== void 0)
|
|
625
626
|
return o;
|
|
626
627
|
const a = n.items[0].images.find(
|
|
627
|
-
(i) =>
|
|
628
|
+
(i) => e.includes(i.imageLabel)
|
|
628
629
|
);
|
|
629
630
|
return o.push({
|
|
630
631
|
slug: `/${n.linkText}/p`,
|
|
@@ -632,19 +633,58 @@ const me = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
632
633
|
textureImage: (a == null ? void 0 : a.imageUrl) ?? "",
|
|
633
634
|
textureAlt: (a == null ? void 0 : a.imageText) ?? ""
|
|
634
635
|
}), o;
|
|
635
|
-
}, []),
|
|
636
|
+
}, []), ye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
636
637
|
__proto__: null,
|
|
637
|
-
createEmptySeoCategory:
|
|
638
|
-
createSeoCategory:
|
|
639
|
-
findCategory:
|
|
640
|
-
formattedSimilars:
|
|
641
|
-
isCollectionPageType:
|
|
642
|
-
notFindCategoryError:
|
|
643
|
-
responseAdapter:
|
|
638
|
+
createEmptySeoCategory: fe,
|
|
639
|
+
createSeoCategory: Ie,
|
|
640
|
+
findCategory: be,
|
|
641
|
+
formattedSimilars: Oe,
|
|
642
|
+
isCollectionPageType: $e,
|
|
643
|
+
notFindCategoryError: Fe,
|
|
644
|
+
responseAdapter: Re
|
|
644
645
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
645
|
-
async function
|
|
646
|
+
async function qe({ contentType: t, storeId: e, CMS_PROJECT_NAME: o, NextCookies: n }) {
|
|
647
|
+
const s = await C({
|
|
648
|
+
contentType: t,
|
|
649
|
+
storeId: e,
|
|
650
|
+
CMS_PROJECT_NAME: o,
|
|
651
|
+
NextCookies: n
|
|
652
|
+
});
|
|
653
|
+
if (s.status === 200) {
|
|
654
|
+
const a = {
|
|
655
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
656
|
+
contentType: t,
|
|
657
|
+
data: s.data
|
|
658
|
+
};
|
|
659
|
+
console.log("Resultado da chamada:", s);
|
|
660
|
+
const i = `backup-${t}-${Date.now()}.json`;
|
|
661
|
+
return await $.writeFile(
|
|
662
|
+
`./backups/${i}`,
|
|
663
|
+
JSON.stringify(a, null, 2),
|
|
664
|
+
"utf-8"
|
|
665
|
+
), { success: !0, fileName: i };
|
|
666
|
+
}
|
|
667
|
+
return { success: !1, error: s.error || "No data to backup" };
|
|
668
|
+
}
|
|
669
|
+
async function Te(t) {
|
|
670
|
+
return qe(t);
|
|
671
|
+
}
|
|
672
|
+
async function Se({
|
|
673
|
+
contentType: t,
|
|
674
|
+
documentId: e,
|
|
675
|
+
versionId: o,
|
|
676
|
+
storeId: n,
|
|
677
|
+
CMS_PROJECT_NAME: s
|
|
678
|
+
}) {
|
|
679
|
+
const a = e && e.length ? `/${e}` : "", i = o && o.length ? `?versionId=${o}` : "";
|
|
680
|
+
return fetch(
|
|
681
|
+
`https://${n}.myvtex.com/_v/cms/api/${s}/${t}${a}${i}`,
|
|
682
|
+
{ cache: "no-cache" }
|
|
683
|
+
);
|
|
684
|
+
}
|
|
685
|
+
async function ve({
|
|
646
686
|
contentType: t,
|
|
647
|
-
documents:
|
|
687
|
+
documents: e,
|
|
648
688
|
NextCookies: o,
|
|
649
689
|
CMS_PROJECT_NAME: n,
|
|
650
690
|
storeId: s
|
|
@@ -657,22 +697,22 @@ async function $e({
|
|
|
657
697
|
const d = a.documentId && a.documentId.length ? `/${a.documentId}` : "", m = a != null && a.versionId && (a != null && a.versionId.length) ? `?versionId=${a == null ? void 0 : a.versionId}` : "", p = await (await fetch(
|
|
658
698
|
`https://${s}.myvtex.com/_v/cms/api/${n}/${t}${d}${m}`,
|
|
659
699
|
{ cache: "no-store" }
|
|
660
|
-
)).json(), c =
|
|
700
|
+
)).json(), c = e.filter(
|
|
661
701
|
(u) => p.id !== u.documentId
|
|
662
702
|
);
|
|
663
703
|
return c.unshift(p), c;
|
|
664
704
|
}
|
|
665
|
-
return
|
|
705
|
+
return e;
|
|
666
706
|
}
|
|
667
|
-
async function
|
|
707
|
+
async function C({
|
|
668
708
|
contentType: t,
|
|
669
|
-
NextCookies:
|
|
709
|
+
NextCookies: e,
|
|
670
710
|
CMS_PROJECT_NAME: o,
|
|
671
711
|
storeId: n
|
|
672
712
|
}) {
|
|
673
713
|
var g, p;
|
|
674
714
|
const s = JSON.parse(
|
|
675
|
-
((g =
|
|
715
|
+
((g = e().get("cms_preview_data")) == null ? void 0 : g.value) ?? "{}"
|
|
676
716
|
), a = [];
|
|
677
717
|
let i = 1, d = 0, m = !0;
|
|
678
718
|
try {
|
|
@@ -683,10 +723,10 @@ async function qe({
|
|
|
683
723
|
i === 1 && (d = u.totalItems), (p = u == null ? void 0 : u.data) != null && p.length && a.push(...u.data), m = u.hasNextPage, i++;
|
|
684
724
|
} while (m && a.length < d);
|
|
685
725
|
if (s.previewMode && a.length) {
|
|
686
|
-
const c = await
|
|
726
|
+
const c = await ve({
|
|
687
727
|
contentType: t,
|
|
688
728
|
documents: a,
|
|
689
|
-
NextCookies:
|
|
729
|
+
NextCookies: e,
|
|
690
730
|
CMS_PROJECT_NAME: o,
|
|
691
731
|
storeId: n
|
|
692
732
|
});
|
|
@@ -703,17 +743,19 @@ async function qe({
|
|
|
703
743
|
return { status: "error", data: [], error: c };
|
|
704
744
|
}
|
|
705
745
|
}
|
|
706
|
-
const
|
|
746
|
+
const Ee = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
707
747
|
__proto__: null,
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
748
|
+
cmsBackup: Te,
|
|
749
|
+
getCMSContentType: Se,
|
|
750
|
+
getContentType: C
|
|
751
|
+
}, Symbol.toStringTag, { value: "Module" })), we = {
|
|
752
|
+
checkout: ie,
|
|
753
|
+
catalog: ge,
|
|
754
|
+
cms: Ee
|
|
755
|
+
}, ke = {
|
|
756
|
+
catalog: ye
|
|
715
757
|
};
|
|
716
758
|
export {
|
|
717
|
-
|
|
718
|
-
|
|
759
|
+
we as serverAPIs,
|
|
760
|
+
ke as serverHelpers
|
|
719
761
|
};
|