@soma-vertical-web/multi-lib 0.0.30 → 0.0.31

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