@soma-vertical-web/multi-lib 0.0.69 → 0.0.70

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 (100) hide show
  1. package/contexts/contexts/header/HeaderCategoryContext.d.ts +7 -0
  2. package/contexts/contexts/header/MenuMobileContext.d.ts +5 -4
  3. package/contexts/index.d.ts +2 -2
  4. package/index.js +17 -17
  5. package/index.mjs +4837 -4881
  6. package/layout/index.d.ts +2 -2
  7. package/layout/team-component/Header/Composite/HeaderDesktopWrapper.d.ts +5 -1
  8. package/layout/team-component/Header/Composite/HeaderMobileWrapper.d.ts +6 -1
  9. package/layout/team-component/Header/index.d.ts +1 -1
  10. package/layout/team-component/Menu/Composite/Mobile/Body/Body.d.ts +7 -0
  11. package/layout/team-component/Menu/Composite/Mobile/Body/Category/Banner.d.ts +7 -0
  12. package/layout/team-component/Menu/Composite/Mobile/Body/Category/Category.d.ts +7 -0
  13. package/layout/team-component/Menu/Composite/Mobile/Body/Category/List.d.ts +7 -0
  14. package/layout/team-component/Menu/Composite/Mobile/Body/Category/SubCategory.d.ts +7 -0
  15. package/layout/team-component/Menu/Composite/Mobile/Body/Category/Title.d.ts +7 -0
  16. package/layout/team-component/Menu/Composite/Mobile/Body/Category/index.d.ts +22 -0
  17. package/layout/team-component/Menu/Composite/Mobile/{Body/SubMenu/SubMenu.d.ts → Header/Header.d.ts} +2 -2
  18. package/layout/team-component/Menu/Composite/Mobile/MenuRoot.d.ts +4 -7
  19. package/layout/team-component/Menu/Composite/Mobile/Navigation/{NavigationBarItem.d.ts → BarItem.d.ts} +1 -1
  20. package/layout/team-component/Menu/MenuMobile.d.ts +7 -8
  21. package/layout/team-component/UserMenu/Composite/Menu.d.ts +1 -1
  22. package/layout/team-component/UserMenu/UserMenu.d.ts +1 -1
  23. package/layout/team-component/UserMenu/index.d.ts +3 -1
  24. package/package.json +1 -1
  25. package/style.css +1 -1
  26. package/types/cms/ContentTypes/Header/index.d.ts +9 -1
  27. package/types/constants.d.ts +12 -14
  28. package/types/layout/team-components/Header/index.d.ts +9 -1
  29. package/types/layout/team-components/Menu/Mobile/Body/Category/index.d.ts +23 -0
  30. package/types/layout/team-components/Menu/Mobile/Body/index.d.ts +3 -0
  31. package/types/layout/team-components/Menu/Mobile/index.d.ts +10 -1
  32. package/types/layout/team-components/UserMenu/index.d.ts +10 -7
  33. package/Footer-93X9fl_J.mjs +0 -7055
  34. package/Footer-BjB3blIh.mjs +0 -6956
  35. package/Footer-By1Gk2Ku.mjs +0 -7050
  36. package/Footer-COiI-tye.mjs +0 -7049
  37. package/Footer-CZqTxkCn.js +0 -41
  38. package/Footer-D3zDoa2N.mjs +0 -6961
  39. package/Footer-DfAuGt3s.js +0 -41
  40. package/Footer-TLfR7lta.js +0 -41
  41. package/Footer-okPVOqRy.js +0 -41
  42. package/Footer-rMb9FYog.js +0 -41
  43. package/SearchPageScreening-BIyp1dAW.mjs +0 -112
  44. package/SearchPageScreening-gO7dG13l.js +0 -1
  45. package/__vite-browser-external-B8mGO3z6.js +0 -1
  46. package/__vite-browser-external-BYRIRx8p.mjs +0 -8
  47. package/__vite-browser-external-C4n7rb1H.mjs +0 -85
  48. package/__vite-browser-external-Cjz79hOw.js +0 -1
  49. package/__vite-browser-external-CpdIDx9o.mjs +0 -79
  50. package/__vite-browser-external-DDWPeg5L.js +0 -1
  51. package/cms/ContentTypes/CommonPage/index.d.ts +0 -2
  52. package/cms/ContentTypes/FlagsAndTags/index.d.ts +0 -1
  53. package/cms/ContentTypes/PLP/PLPContentContext.d.ts +0 -4
  54. package/cms/ContentTypes/Search/SearchContentScreening.d.ts +0 -3
  55. package/cms/ContentTypes/index.d.ts +0 -6
  56. package/data/actions/masterDataServices.d.ts +0 -5
  57. package/data/api/user/index.d.ts +0 -3
  58. package/data/helpers/search/policy.d.ts +0 -3
  59. package/data/helpers/search/product/utils/index.d.ts +0 -8
  60. package/data/helpers/search/region.d.ts +0 -3
  61. package/index-ASRiF3PD.js +0 -1
  62. package/index-BJzBUeMp.js +0 -1
  63. package/index-BR5lPUsH.js +0 -1
  64. package/index-BRfMTuMz.mjs +0 -405
  65. package/index-BYY2x6mQ.js +0 -1
  66. package/index-Ba7fQCkk.js +0 -1
  67. package/index-BzNV29ol.mjs +0 -402
  68. package/index-C3QT-3iu.mjs +0 -355
  69. package/index-C5zOWvXN.js +0 -1
  70. package/index-CbOiLJQX.mjs +0 -403
  71. package/index-CiBRnp7U.js +0 -1
  72. package/index-CiMxj6Pg.mjs +0 -412
  73. package/index-CkcBCfzG.js +0 -1
  74. package/index-CuKKHhKx.mjs +0 -355
  75. package/index-D3ONVIla.mjs +0 -412
  76. package/index-DD12Nl4r.mjs +0 -412
  77. package/index-DJR4CcKO.mjs +0 -398
  78. package/index-DJeLEsRl.js +0 -1
  79. package/index-DKnolQoT.mjs +0 -412
  80. package/index-DYpuW0tu.mjs +0 -354
  81. package/index-D__YfUie.js +0 -1
  82. package/index-DfnS9D5I.mjs +0 -354
  83. package/index-Do5eAlCL.mjs +0 -219
  84. package/index-VkanwPXK.mjs +0 -221
  85. package/index-WV5Gjz3i.js +0 -1
  86. package/index-catAI5a3.mjs +0 -258
  87. package/index-drKDwA8_.js +0 -1
  88. package/layout/team-component/Menu/Composite/Mobile/Body/MenuBody.d.ts +0 -7
  89. package/layout/team-component/Menu/Composite/Mobile/Body/MenuCategories.d.ts +0 -7
  90. package/layout/team-component/Menu/Composite/Mobile/Body/MenuCategoriesWrapper.d.ts +0 -7
  91. package/layout/team-component/Menu/Composite/Mobile/Body/SubMenu/SubMenuItem.d.ts +0 -7
  92. package/layout/team-component/Menu/Composite/Mobile/Body/SubMenu/SubMenuSubCategory.d.ts +0 -7
  93. package/layout/team-component/Menu/Composite/Mobile/Header/MenuHeaderContainer.d.ts +0 -5
  94. package/layout/team-component/Menu/Composite/Mobile/Header/MenuHeaderNavLinks.d.ts +0 -7
  95. package/layout/team-component/Menu/Composite/Mobile/Header/MenuHeaderWrapper.d.ts +0 -7
  96. package/types/data/actions/index.d.ts +0 -27
  97. package/types/layout/team-components/PDCNavigation/intex.d.ts +0 -9
  98. package/types/layout/team-components/ProductList/Composite/Card/index.d.ts +0 -9
  99. package/types/utils.d.ts +0 -3
  100. /package/layout/team-component/Menu/Composite/Mobile/Navigation/{NavigationBar.d.ts → Bar.d.ts} +0 -0
@@ -1,402 +0,0 @@
1
- import { jsxs as g, Fragment as $, jsx as f } from "react/jsx-runtime";
2
- import { Utils as k } from "@soma-vertical-web/core-components";
3
- const b = (e, t = !0) => Intl.NumberFormat("pt-BR", {
4
- style: "currency",
5
- currency: "BRL",
6
- minimumFractionDigits: t ? 2 : 0
7
- }).format(e), R = ({ valueInCents: e, hasFree: t, freeTaxMessage: n }) => e === 0 ? t ? n : b(0) : b(e / 100), x = (e, t) => {
8
- const [n, s] = e.split(t);
9
- return { name: n.trim(), size: s ? s.trim() : "" };
10
- }, T = (e, t) => {
11
- if (!e)
12
- return {};
13
- const [n, s] = e.split(t);
14
- return { color: n == null ? void 0 : n.trim(), size: s == null ? void 0 : s.trim() };
15
- }, C = (e, t = "tamanho") => {
16
- if (e.additionalProperty) {
17
- const [n] = e.additionalProperty;
18
- return n != null && n.name ? n.name.toLocaleLowerCase() === t ? n.value : e.name : "";
19
- }
20
- return e.name;
21
- }, N = (e, t) => e.replace(t, "").trim(), z = (e) => e.replace(/\//g, ""), O = ({ items: e, NAME_SPLIT_SYMBOL: t }) => {
22
- const n = {
23
- price: 0,
24
- listPrice: 0,
25
- installments: {
26
- count: 0,
27
- value: 0
28
- }
29
- }, s = (a, i) => {
30
- var d;
31
- i && (i.sellerId = a.sellerId, i.sellerName = a.sellerName, i.available = !0, i.isSellerDefault = a.sellerDefault);
32
- const {
33
- Price: l,
34
- ListPrice: u,
35
- PaymentOptions: { installmentOptions: _ }
36
- } = a.commertialOffer;
37
- n.price = l, n.listPrice = u;
38
- const c = (d = _ == null ? void 0 : _[0]) == null ? void 0 : d.installments;
39
- if (c) {
40
- const { count: m, value: p } = c[c.length - 1];
41
- n.installments = {
42
- count: m,
43
- value: p / 100
44
- };
45
- }
46
- };
47
- let r = !0;
48
- const o = e.reduce((a, i) => {
49
- var _;
50
- const l = {
51
- name: i.name,
52
- sku: i.itemId,
53
- value: ((_ = i.Tamanho) == null ? void 0 : _[0]) ?? x(i.nameComplete ?? i.name, t).size,
54
- available: !1,
55
- sellerId: "",
56
- sellerName: "",
57
- isSellerDefault: !1
58
- }, u = i.sellers.filter((c) => (c.sellerDefault && c.commertialOffer.IsAvailable && (l.available = !0, s(c, l)), c.commertialOffer.IsAvailable));
59
- return !l.isSellerDefault && u.length > 0 && (l.available = !0, s(u[0], {
60
- ...l,
61
- sellerId: u[0].sellerId,
62
- sellerName: u[0].sellerName
63
- })), l.available === !1 && (r = !1), a.push(l), a;
64
- }, []);
65
- return {
66
- ...n,
67
- sizes: o,
68
- allSizesAvailable: r
69
- };
70
- }, P = (e) => e ? !e.offers.offers.find(({ quantity: t = 0 }) => t > 0) : !1, F = (e, t) => {
71
- const n = e.find(
72
- (s) => s.availability.includes("InStock") && s.quantity && s.listPrice > 0 && s.seller.identifier === t
73
- );
74
- return n || e.find(
75
- (s) => s.availability.includes("InStock") && s.quantity && s.listPrice > 0
76
- );
77
- }, j = ({ images: e, TEXTURE_IMAGE: t }) => e.find((n) => t.includes(n.imageLabel)) ?? e[0], A = (e, t) => {
78
- const n = /\/ids\/(\d+)\//, s = e.match(n);
79
- return s ? e.replace(
80
- `/${s[1]}/`,
81
- `/${s[1]}-${t.width}-${t.height}/`
82
- ) : e;
83
- }, D = (e, t) => {
84
- const n = /\/ids\/(\d+)-(\d+)-(\d+)\//, s = e.match(n);
85
- return s ? e.replace(
86
- `/${s[1]}-${s[2]}-${s[3]}/`,
87
- `/${s[1]}-${t.width}-${t.height}/`
88
- ) : e;
89
- }, B = ({
90
- images: e,
91
- label: t
92
- }) => {
93
- const n = e.filter(
94
- (s) => s.keywords === t.first || s.keywords === t.second || s.alternateName === t.first || s.alternateName === t.second
95
- );
96
- return n.length === 0 ? e.slice(0, 2) : n;
97
- }, E = (e) => {
98
- const [t, n] = e.split("/").map(Number);
99
- if (Number.isNaN(t) || Number.isNaN(n))
100
- throw new Error("[ERROR ASPECT RATIO IMAGE]: Invalid aspect ratio format");
101
- return n / t;
102
- }, L = (e, t, n) => {
103
- t && (e ? (t.getAttribute("src") || (t.src = n ?? ""), t.play()) : t.pause());
104
- }, ve = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
105
- __proto__: null,
106
- disableSKU: P,
107
- formatPriceToCurrency: b,
108
- freightParsePrice: R,
109
- getAspectRatio: E,
110
- getColorAndSizeFromSkuName: T,
111
- getFirstImages: B,
112
- getProductNameWithoutSku: N,
113
- getSKUName: C,
114
- getSkuInfos: O,
115
- getThumbImage: j,
116
- getValidOffer: F,
117
- removeSlashes: z,
118
- resizingImg: A,
119
- setVideoPlay: L,
120
- splitNameAndSizeFromFullName: x,
121
- updatedResizedImg: D
122
- }, Symbol.toStringTag, { value: "Module" })), v = "fuzzy", h = "operator", U = (e) => ({
123
- isDepartment: e != null && e.length ? e[0].key === "category-1" : !1
124
- }), he = (e, t) => {
125
- const n = decodeURIComponent(t ?? "").slice(1).split("/");
126
- return e.map((s) => {
127
- if (s.key === "category-2" && s.__typename === "FacetBoolean") {
128
- const r = s.values;
129
- return {
130
- ...s,
131
- values: r.filter(
132
- (o) => !n.find(
133
- (a) => a.toLowerCase() === o.value || a.toLowerCase() === o.name.toLowerCase()
134
- )
135
- )
136
- };
137
- }
138
- return s;
139
- });
140
- }, I = (e, t) => t ? e === "category-1" : !1, M = (e) => e.key === "operator" && (e.value === "and" || e.value === "or"), q = (e) => e.type === "TEXT", H = (e) => e.key === "fuzzy" && (e.value === "0" || e.value === "1" || e.value === "auto"), K = (e) => {
141
- const { key: t, name: n, values: s } = e;
142
- return {
143
- __typename: "FacetBoolean",
144
- key: t,
145
- label: n,
146
- values: s.slice().sort((r, o) => r.name.localeCompare(o.name))
147
- };
148
- }, V = ({ key: e, values: t }) => ({
149
- __typename: "FacetRange",
150
- key: e,
151
- values: t
152
- }), xe = (e, t, n) => {
153
- if (!(e instanceof Object) || !("facets" in e))
154
- return [];
155
- const { facets: s = [] } = e, r = t != null && t.length ? t[0].key === "category-1" : !1;
156
- return s.filter(
157
- (a) => !n || !I(a.key, r)
158
- ).map(
159
- (a) => q(a) ? K(a) : V(a)
160
- );
161
- }, Ie = (e, t) => {
162
- const n = e.find(({ key: r }) => r === v) ?? null, s = e.find(({ key: r }) => r === h) ?? null;
163
- n && H(n) && t.append(v, n.value), s && M(s) && t.append(h, s.value);
164
- }, Y = (e) => e.map((t) => {
165
- const [n, s] = t.split("/");
166
- return { key: n, value: s };
167
- }), we = (e, t) => {
168
- const n = decodeURIComponent(t ?? "").slice(1).split("/"), s = e.filter(({ value: o }) => !n.includes(decodeURIComponent(o))).map((o) => ({
169
- ...o,
170
- value: decodeURIComponent(o.value)
171
- })), { isDepartment: r } = U(s);
172
- return s == null ? void 0 : s.filter((o) => !I(o.key, r));
173
- }, Se = ({ pathname: e, searchParams: t }, n) => {
174
- const s = t.get("sort") ?? "", r = t.get("query") ?? null, o = parseInt(t.get("page") ?? "1", 10);
175
- return {
176
- sort: s,
177
- facets: Y(n),
178
- term: r,
179
- base: r ? "" : e,
180
- page: o
181
- };
182
- }, $e = (e) => {
183
- const t = new URLSearchParams();
184
- return Object.entries(e).forEach(([n, s]) => {
185
- Array.isArray(s) ? s.forEach((r) => t.append(n, r)) : s !== void 0 && t.append(n, s);
186
- }), t;
187
- }, y = {
188
- "responsive-mobile-flex": "_responsive-mobile-flex_t5bry_2",
189
- "responsive-desktop-flex": "_responsive-desktop-flex_t5bry_13",
190
- "responsive-mobile-block": "_responsive-mobile-block_t5bry_24",
191
- "responsive-desktop-block": "_responsive-desktop-block_t5bry_35"
192
- }, w = {}, ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
193
- __proto__: null,
194
- default: w
195
- }, Symbol.toStringTag, { value: "Module" })), J = "_header_1dxfy_40", W = "_actions_1dxfy_61", G = "_breadcrumb_1dxfy_72", X = "_credits_1dxfy_87", Q = "_similars_1dxfy_139", Z = "_sizes_1dxfy_178", ee = "_measurementTable_1dxfy_194", te = "_measurementHead_1dxfy_207", ne = "_measurementRows_1dxfy_212", se = "_measurementRowsTitle_1dxfy_229", ae = "_measurementRowsText_1dxfy_241", re = "_measurementImage_1dxfy_252", oe = "_measurementImageContainer_1dxfy_255", ie = "_measurementContent_1dxfy_264", ce = "_measurementTitle_1dxfy_268", le = "_measurementClose_1dxfy_279", me = "_productref_1dxfy_344", de = "_content_1dxfy_324", ue = "_pdp_1dxfy_112", Re = {
196
- "bottom-navigation": "_bottom-navigation_1dxfy_1",
197
- "bottom-navigation__header": "_bottom-navigation__header_1dxfy_21",
198
- header: J,
199
- actions: W,
200
- "add-to-cart": "_add-to-cart_1dxfy_68",
201
- breadcrumb: G,
202
- "breadcrumb--active": "_breadcrumb--active_1dxfy_77",
203
- credits: X,
204
- "gallery-carousel-modifier": "_gallery-carousel-modifier_1dxfy_92",
205
- "links-wrapper": "_links-wrapper_1dxfy_122",
206
- similars: Q,
207
- "similars-info": "_similars-info_1dxfy_151",
208
- sizes: Z,
209
- "price-wrapper": "_price-wrapper_1dxfy_190",
210
- measurementTable: ee,
211
- measurementHead: te,
212
- measurementRows: ne,
213
- measurementRowsTitle: se,
214
- measurementRowsText: ae,
215
- measurementImage: re,
216
- measurementImageContainer: oe,
217
- measurementContent: ie,
218
- measurementTitle: ce,
219
- measurementClose: le,
220
- "tabs-root-modifier": "_tabs-root-modifier_1dxfy_285",
221
- "tabs-list-modifier": "_tabs-list-modifier_1dxfy_303",
222
- "tabs-item-modifier": "_tabs-item-modifier_1dxfy_320",
223
- "content-wrapper": "_content-wrapper_1dxfy_324",
224
- productref: me,
225
- "tabs-panel": "_tabs-panel_1dxfy_355",
226
- "tabs-panel-exit": "_tabs-panel-exit_1dxfy_361",
227
- "tabs-panel-enter": "_tabs-panel-enter_1dxfy_365",
228
- content: de,
229
- pdp: ue,
230
- "pdp-main": "_pdp-main_1dxfy_423",
231
- "pdp-main__gallery-wrapper": "_pdp-main__gallery-wrapper_1dxfy_428",
232
- "pdp-main__info": "_pdp-main__info_1dxfy_445",
233
- "pdp-main__info-main-content": "_pdp-main__info-main-content_1dxfy_465",
234
- "pdp-main__info-subsection": "_pdp-main__info-subsection_1dxfy_465",
235
- "subsection-product-info": "_subsection-product-info_1dxfy_476",
236
- "subsection-similars": "_subsection-similars_1dxfy_479",
237
- "subsection-sizes": "_subsection-sizes_1dxfy_482",
238
- "subsection-actions": "_subsection-actions_1dxfy_485",
239
- "pdp-main__info-secondary-content": "_pdp-main__info-secondary-content_1dxfy_489",
240
- "sections-title": "_sections-title_1dxfy_495"
241
- }, Te = ({
242
- children: e,
243
- data: t,
244
- SectionZone: n,
245
- className: s
246
- }) => {
247
- var _, c;
248
- const r = ((_ = t == null ? void 0 : t.filter((d) => {
249
- var m, p;
250
- return ((p = (m = d.config) == null ? void 0 : m.responsive) == null ? void 0 : p.deviceType) === "mobile";
251
- })[0]) == null ? void 0 : _.sections) || [], o = ((c = t == null ? void 0 : t.filter((d) => {
252
- var m, p;
253
- return ((p = (m = d.config) == null ? void 0 : m.responsive) == null ? void 0 : p.deviceType) === "desktop";
254
- })[0]) == null ? void 0 : c.sections) || [], a = r.slice(0, 1), i = r.slice(1, r.length), l = o.slice(0, 1), u = o.slice(1, o.length);
255
- return /* @__PURE__ */ g($, { children: [
256
- /* @__PURE__ */ g("div", { className: s, children: [
257
- /* @__PURE__ */ f("div", { className: y["responsive-mobile-flex"], children: /* @__PURE__ */ f(n, { data: a ?? [] }) }),
258
- /* @__PURE__ */ f("div", { className: y["responsive-desktop-flex"], children: /* @__PURE__ */ f(n, { data: l ?? [] }) })
259
- ] }),
260
- e,
261
- /* @__PURE__ */ f("div", { className: y["responsive-mobile-flex"], children: /* @__PURE__ */ f(n, { data: i ?? [] }) }),
262
- /* @__PURE__ */ f("div", { className: y["responsive-desktop-flex"], children: /* @__PURE__ */ f(n, { data: u ?? [] }) }),
263
- /* @__PURE__ */ f(k.Divider, {})
264
- ] });
265
- };
266
- async function _e({ contentType: e, storeId: t, CMS_PROJECT_NAME: n, NextCookies: s }) {
267
- const r = await S({
268
- contentType: e,
269
- storeId: t,
270
- CMS_PROJECT_NAME: n,
271
- NextCookies: s
272
- });
273
- if (r.status === 200) {
274
- const o = {
275
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
276
- contentType: e,
277
- data: r.data
278
- };
279
- console.log("Resultado da chamada:", r);
280
- const a = `backup-${e}-${Date.now()}.json`;
281
- return await w.writeFile(
282
- `./backups/${a}`,
283
- JSON.stringify(o, null, 2),
284
- "utf-8"
285
- ), { success: !0, fileName: a };
286
- }
287
- return { success: !1, error: r.error || "No data to backup" };
288
- }
289
- async function fe(e) {
290
- return _e(e);
291
- }
292
- async function pe({
293
- contentType: e,
294
- documentId: t,
295
- versionId: n,
296
- storeId: s,
297
- CMS_PROJECT_NAME: r
298
- }) {
299
- const o = t && t.length ? `/${t}` : "", a = n && n.length ? `?versionId=${n}` : "";
300
- return fetch(
301
- `https://${s}.myvtex.com/_v/cms/api/${r}/${e}${o}${a}`,
302
- { cache: "no-cache" }
303
- );
304
- }
305
- async function ye({
306
- contentType: e,
307
- documents: t,
308
- NextCookies: n,
309
- previewId: s,
310
- CMS_PROJECT_NAME: r,
311
- storeId: o
312
- }) {
313
- var i;
314
- const a = JSON.parse(
315
- s ?? ((i = n == null ? void 0 : n().get("cms_preview_data")) == null ? void 0 : i.value) ?? "{}"
316
- );
317
- if (a && (a == null ? void 0 : a.contentType) === e) {
318
- const l = a.documentId && a.documentId.length ? `/${a.documentId}` : "", u = a != null && a.versionId && (a != null && a.versionId.length) ? `?versionId=${a == null ? void 0 : a.versionId}` : "", c = await (await fetch(
319
- `https://${o}.myvtex.com/_v/cms/api/${r}/${e}${l}${u}`,
320
- { cache: "no-store" }
321
- )).json(), d = t.filter(
322
- (m) => c.id !== m.documentId
323
- );
324
- return d.unshift(c), d;
325
- }
326
- return t;
327
- }
328
- async function S({
329
- contentType: e,
330
- NextCookies: t,
331
- CMS_PROJECT_NAME: n,
332
- storeId: s,
333
- previewId: r
334
- }) {
335
- var _, c;
336
- const o = JSON.parse(
337
- r ?? ((_ = t == null ? void 0 : t().get("cms_preview_data")) == null ? void 0 : _.value) ?? "{}"
338
- ), a = [];
339
- let i = 1, l = 0, u = !0;
340
- try {
341
- do {
342
- const m = await (await fetch(
343
- `https://${s}.myvtex.com/_v/cms/api/${n}/${e}?page=${i}`
344
- )).json();
345
- i === 1 && (l = m.totalItems), (c = m == null ? void 0 : m.data) != null && c.length && a.push(...m.data), u = m.hasNextPage, i++;
346
- } while (u && a.length < l);
347
- if (o.previewMode && a.length) {
348
- const d = await ye({
349
- contentType: e,
350
- documents: a,
351
- NextCookies: t,
352
- CMS_PROJECT_NAME: n,
353
- storeId: s
354
- });
355
- return {
356
- status: d.length > 0 ? 200 : 404,
357
- data: d ?? []
358
- };
359
- }
360
- return {
361
- status: a.length ? 200 : 404,
362
- data: a
363
- };
364
- } catch (d) {
365
- return { status: "error", data: [], error: d };
366
- }
367
- }
368
- const Ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
369
- __proto__: null,
370
- cmsBackup: fe,
371
- getCMSContentType: pe,
372
- getContentType: S
373
- }, Symbol.toStringTag, { value: "Module" }));
374
- export {
375
- Te as S,
376
- ke as _,
377
- O as a,
378
- j as b,
379
- $e as c,
380
- C as d,
381
- P as e,
382
- ve as f,
383
- T as g,
384
- b as h,
385
- R as i,
386
- F as j,
387
- B as k,
388
- L as l,
389
- N as m,
390
- A as n,
391
- Re as o,
392
- Se as p,
393
- S as q,
394
- y as r,
395
- x as s,
396
- Ie as t,
397
- D as u,
398
- xe as v,
399
- he as w,
400
- we as x,
401
- Ce as y
402
- };