@soma-vertical-web/multi-lib 0.0.60 → 0.0.62

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 (92) hide show
  1. package/contexts/index.d.ts +0 -2
  2. package/data/helpers/product/orderSizes.d.ts +3 -0
  3. package/index-ASRiF3PD.js +1 -0
  4. package/index-BRfMTuMz.mjs +405 -0
  5. package/index-BzNV29ol.mjs +402 -0
  6. package/index-C5zOWvXN.js +1 -0
  7. package/index-CbOiLJQX.mjs +403 -0
  8. package/index-CiBRnp7U.js +1 -0
  9. package/index-D3ONVIla.mjs +412 -0
  10. package/index-DD12Nl4r.mjs +412 -0
  11. package/index-DJR4CcKO.mjs +398 -0
  12. package/index-DJeLEsRl.js +1 -0
  13. package/index-D__YfUie.js +1 -0
  14. package/index-drKDwA8_.js +1 -0
  15. package/index.js +28 -27
  16. package/index.mjs +7440 -5960
  17. package/index2.js +1 -1
  18. package/index2.mjs +545 -529
  19. package/layout/index.d.ts +1 -1
  20. package/layout/team-component/Header/index.d.ts +1 -1
  21. package/layout/team-component/ImageZoom/Composite/ButtonClose.d.ts +4 -0
  22. package/layout/team-component/ImageZoom/Composite/Common/BlurImage.d.ts +3 -0
  23. package/layout/team-component/ImageZoom/Composite/Desktop/ImageDesktop.d.ts +5 -0
  24. package/layout/team-component/ImageZoom/Composite/Desktop/ImagesThumbs.d.ts +5 -0
  25. package/layout/team-component/ImageZoom/Composite/Desktop/WrapperDesktop.d.ts +4 -0
  26. package/layout/team-component/ImageZoom/Composite/Mobile/Carousel.d.ts +7 -0
  27. package/layout/team-component/ImageZoom/Composite/Mobile/ImageMobile.d.ts +7 -0
  28. package/layout/team-component/ImageZoom/Composite/Mobile/ImageZoom.d.ts +7 -0
  29. package/layout/team-component/ImageZoom/Composite/Mobile/WrapperMobile.d.ts +4 -0
  30. package/layout/team-component/ImageZoom/Composite/Mobile/ZoomPopup.d.ts +7 -0
  31. package/layout/team-component/ImageZoom/ImageZoom.d.ts +7 -0
  32. package/layout/team-component/ImageZoom/index.d.ts +1 -0
  33. package/layout/team-component/Notify/Composite/Controls.d.ts +7 -0
  34. package/layout/team-component/Notify/Composite/Form.d.ts +7 -0
  35. package/layout/team-component/Notify/Composite/Loading.d.ts +7 -0
  36. package/layout/team-component/Notify/Composite/Selector.d.ts +7 -0
  37. package/layout/team-component/Notify/Composite/Status.d.ts +7 -0
  38. package/layout/team-component/Notify/helpers.d.ts +3 -0
  39. package/layout/team-component/Notify/index.d.ts +7 -0
  40. package/layout/team-component/Table/Composite/Head.d.ts +4 -0
  41. package/layout/team-component/Table/Composite/Root.d.ts +4 -0
  42. package/layout/team-component/Table/Composite/Rows.d.ts +4 -0
  43. package/layout/team-component/Table/Table.d.ts +6 -0
  44. package/layout/team-component/Table/index.d.ts +1 -0
  45. package/layout/template/PDP/Composite/BreadCrumb/index.d.ts +7 -0
  46. package/layout/template/PDP/Composite/Containers/Gallery.d.ts +3 -0
  47. package/layout/template/PDP/Composite/Containers/Main.d.ts +3 -0
  48. package/layout/template/PDP/Composite/Containers/PDP.d.ts +3 -0
  49. package/layout/template/PDP/Composite/Containers/Secondary.d.ts +3 -0
  50. package/layout/template/PDP/Composite/Containers/index.d.ts +6 -0
  51. package/layout/template/PDP/Composite/Credits/index.d.ts +7 -0
  52. package/layout/template/PDP/Composite/Gallery/Wrapper.d.ts +2 -2
  53. package/layout/template/PDP/Composite/Gallery/index.d.ts +1 -1
  54. package/layout/template/PDP/Composite/Info/Divider.d.ts +4 -0
  55. package/layout/template/PDP/Composite/Info/MainContent/Actions/AddToCart.d.ts +4 -0
  56. package/layout/template/PDP/Composite/Info/MainContent/Actions/AddToCartObserver.d.ts +6 -0
  57. package/layout/template/PDP/Composite/Info/MainContent/Actions/AddToWishlist.d.ts +4 -0
  58. package/layout/template/PDP/Composite/Info/MainContent/Actions/index.d.ts +4 -0
  59. package/layout/template/PDP/Composite/Info/MainContent/BottomNavigation/Actions.d.ts +4 -0
  60. package/layout/template/PDP/Composite/Info/MainContent/BottomNavigation/index.d.ts +4 -0
  61. package/layout/template/PDP/Composite/Info/MainContent/Header/index.d.ts +8 -0
  62. package/layout/template/PDP/Composite/Info/MainContent/Links/index.d.ts +4 -0
  63. package/layout/template/PDP/Composite/Info/MainContent/Price/index.d.ts +4 -0
  64. package/layout/template/PDP/Composite/Info/MainContent/ProductMeasurements/index.d.ts +4 -0
  65. package/layout/template/PDP/Composite/Info/MainContent/Root.d.ts +4 -0
  66. package/layout/template/PDP/Composite/Info/MainContent/Similars/AccessibilityInfo.d.ts +2 -0
  67. package/layout/template/PDP/Composite/Info/MainContent/Similars/Items.d.ts +4 -0
  68. package/layout/template/PDP/Composite/Info/MainContent/Similars/ToggleWrapper.d.ts +4 -0
  69. package/layout/template/PDP/Composite/Info/MainContent/Similars/index.d.ts +3 -0
  70. package/layout/template/PDP/Composite/Info/MainContent/Sizes/index.d.ts +4 -0
  71. package/layout/template/PDP/Composite/Info/MainContent/SubSectionWrapper.d.ts +4 -0
  72. package/layout/template/PDP/Composite/Info/Root.d.ts +6 -0
  73. package/layout/template/PDP/Composite/Info/SecondaryContent/DescriptionsTabs.d.ts +2 -0
  74. package/layout/template/PDP/Composite/Info/SecondaryContent/Freight.d.ts +4 -0
  75. package/layout/template/PDP/index.d.ts +18 -1
  76. package/layout/template/QuickShop/Composite/Body.d.ts +4 -0
  77. package/layout/template/QuickShop/Composite/Header.d.ts +3 -0
  78. package/layout/template/QuickShop/Composite/Similars.d.ts +7 -0
  79. package/layout/template/QuickShop/index.d.ts +3 -0
  80. package/package.json +1 -1
  81. package/server.d.ts +8 -1
  82. package/style.css +1 -1
  83. package/types/constants.d.ts +72 -7
  84. package/types/contexts/contexts/global.d.ts +1 -0
  85. package/types/contexts/contexts/pdp.d.ts +5 -46
  86. package/types/data/helpers/index.d.ts +6 -1
  87. package/types/layout/team-components/Header/index.d.ts +3 -2
  88. package/types/layout/team-components/ImageZoom/index.d.ts +36 -3
  89. package/types/layout/team-components/Notify/index.d.ts +22 -2
  90. package/types/layout/team-components/Table/index.d.ts +22 -0
  91. package/types/layout/templates/PDP/index.d.ts +144 -4
  92. package/types/layout/templates/QuickShop/index.d.ts +21 -0
@@ -0,0 +1,412 @@
1
+ import { jsxs as g, Fragment as S, jsx as f } from "react/jsx-runtime";
2
+ import { Utils as $ } 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
+ }, O = (e, t) => e.replace(t, "").trim(), N = (e) => e.replace(/\//g, ""), z = ({ 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 m;
31
+ i && (i.sellerId = a.sellerId, i.sellerName = a.sellerName, i.available = !0, i.isSellerDefault = a.sellerDefault);
32
+ const {
33
+ Price: l,
34
+ ListPrice: _,
35
+ PaymentOptions: { installmentOptions: u }
36
+ } = a.commertialOffer;
37
+ n.price = l, n.listPrice = _;
38
+ const c = (m = u == null ? void 0 : u[0]) == null ? void 0 : m.installments;
39
+ if (c) {
40
+ const { count: d, value: p } = c[c.length - 1];
41
+ n.installments = {
42
+ count: d,
43
+ value: p / 100
44
+ };
45
+ }
46
+ };
47
+ let r = !0;
48
+ const o = e.reduce((a, i) => {
49
+ var u;
50
+ const l = {
51
+ name: i.name,
52
+ sku: i.itemId,
53
+ value: ((u = i.Tamanho) == null ? void 0 : u[0]) ?? x(i.nameComplete ?? i.name, t).size,
54
+ available: !1,
55
+ sellerId: "",
56
+ sellerName: "",
57
+ isSellerDefault: !1
58
+ }, _ = i.sellers.filter((c) => (c.sellerDefault && c.commertialOffer.IsAvailable && (l.available = !0, s(c, l)), c.commertialOffer.IsAvailable));
59
+ return !l.isSellerDefault && _.length > 0 && (l.available = !0, s(_[0], {
60
+ ...l,
61
+ sellerId: _[0].sellerId,
62
+ sellerName: _[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
+ }, we = /* @__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: O,
113
+ getSKUName: C,
114
+ getSkuInfos: z,
115
+ getThumbImage: j,
116
+ getValidOffer: F,
117
+ removeSlashes: N,
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
+ }), ke = (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
+ }), Se = (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
+ }, $e = (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
+ }), Re = (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
+ }, Te = ({ 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
+ }, Ce = (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 = {}, Oe = /* @__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 = "_pdplinks_1dxfy_112", Z = "_similars_1dxfy_139", ee = "_sizes_1dxfy_178", te = "_measurementTable_1dxfy_194", ne = "_measurementHead_1dxfy_207", se = "_measurementRows_1dxfy_212", ae = "_measurementRowsTitle_1dxfy_229", re = "_measurementRowsText_1dxfy_241", oe = "_measurementImage_1dxfy_252", ie = "_measurementImageContainer_1dxfy_255", ce = "_measurementContent_1dxfy_264", le = "_measurementTitle_1dxfy_268", de = "_measurementClose_1dxfy_279", me = "_productref_1dxfy_344", _e = "_slideOut_1dxfy_1", ue = "_slideIn_1dxfy_1", fe = "_content_1dxfy_324", pe = "_pdp_1dxfy_112", ye = "_divider_1dxfy_507", Ne = {
196
+ "bottom-navigation": "_bottom-navigation_1dxfy_1",
197
+ "bottom-navigation__credits-modifier": "_bottom-navigation__credits-modifier_1dxfy_18",
198
+ "bottom-navigation__header": "_bottom-navigation__header_1dxfy_21",
199
+ "bottom-navigation__price-and-promo": "_bottom-navigation__price-and-promo_1dxfy_31",
200
+ header: J,
201
+ actions: W,
202
+ "add-to-cart": "_add-to-cart_1dxfy_68",
203
+ breadcrumb: G,
204
+ "breadcrumb--active": "_breadcrumb--active_1dxfy_77",
205
+ credits: X,
206
+ "gallery-carousel-modifier": "_gallery-carousel-modifier_1dxfy_92",
207
+ pdplinks: Q,
208
+ "links-wrapper": "_links-wrapper_1dxfy_122",
209
+ similars: Z,
210
+ "similars-info": "_similars-info_1dxfy_151",
211
+ "toggle-style-modifier": "_toggle-style-modifier_1dxfy_160",
212
+ "accessibility-info": "_accessibility-info_1dxfy_164",
213
+ sizes: ee,
214
+ "price-wrapper": "_price-wrapper_1dxfy_190",
215
+ measurementTable: te,
216
+ measurementHead: ne,
217
+ measurementRows: se,
218
+ measurementRowsTitle: ae,
219
+ measurementRowsText: re,
220
+ measurementImage: oe,
221
+ measurementImageContainer: ie,
222
+ measurementContent: ce,
223
+ measurementTitle: le,
224
+ measurementClose: de,
225
+ "tabs-root-modifier": "_tabs-root-modifier_1dxfy_285",
226
+ "tabs-list-modifier": "_tabs-list-modifier_1dxfy_303",
227
+ "tabs-item-modifier": "_tabs-item-modifier_1dxfy_320",
228
+ "content-wrapper": "_content-wrapper_1dxfy_324",
229
+ productref: me,
230
+ "tabs-panel": "_tabs-panel_1dxfy_355",
231
+ "tabs-panel-exit": "_tabs-panel-exit_1dxfy_361",
232
+ slideOut: _e,
233
+ "tabs-panel-enter": "_tabs-panel-enter_1dxfy_365",
234
+ slideIn: ue,
235
+ content: fe,
236
+ pdp: pe,
237
+ "pdp-main": "_pdp-main_1dxfy_423",
238
+ "pdp-main__gallery-wrapper": "_pdp-main__gallery-wrapper_1dxfy_428",
239
+ "pdp-main__info": "_pdp-main__info_1dxfy_445",
240
+ "pdp-main__info-main-content": "_pdp-main__info-main-content_1dxfy_465",
241
+ "pdp-main__info-subsection": "_pdp-main__info-subsection_1dxfy_465",
242
+ "subsection-product-info": "_subsection-product-info_1dxfy_476",
243
+ "subsection-similars": "_subsection-similars_1dxfy_479",
244
+ "subsection-sizes": "_subsection-sizes_1dxfy_482",
245
+ "subsection-actions": "_subsection-actions_1dxfy_485",
246
+ "pdp-main__info-secondary-content": "_pdp-main__info-secondary-content_1dxfy_489",
247
+ "sections-title": "_sections-title_1dxfy_495",
248
+ divider: ye,
249
+ "breadcrumbs-desktop": "_breadcrumbs-desktop_1dxfy_512",
250
+ "breadcrumbs-mobile": "_breadcrumbs-mobile_1dxfy_521"
251
+ }, ze = ({
252
+ children: e,
253
+ data: t,
254
+ SectionZone: n,
255
+ className: s
256
+ }) => {
257
+ var u, c;
258
+ const r = ((u = t == null ? void 0 : t.filter((m) => {
259
+ var d, p;
260
+ return ((p = (d = m.config) == null ? void 0 : d.responsive) == null ? void 0 : p.deviceType) === "mobile";
261
+ })[0]) == null ? void 0 : u.sections) || [], o = ((c = t == null ? void 0 : t.filter((m) => {
262
+ var d, p;
263
+ return ((p = (d = m.config) == null ? void 0 : d.responsive) == null ? void 0 : p.deviceType) === "desktop";
264
+ })[0]) == null ? void 0 : c.sections) || [], a = r.slice(0, 1), i = r.slice(1, r.length), l = o.slice(0, 1), _ = o.slice(1, o.length);
265
+ return /* @__PURE__ */ g(S, { children: [
266
+ /* @__PURE__ */ g("div", { className: s, children: [
267
+ /* @__PURE__ */ f("div", { className: y["responsive-mobile-flex"], children: /* @__PURE__ */ f(n, { data: a ?? [] }) }),
268
+ /* @__PURE__ */ f("div", { className: y["responsive-desktop-flex"], children: /* @__PURE__ */ f(n, { data: l ?? [] }) })
269
+ ] }),
270
+ e,
271
+ /* @__PURE__ */ f("div", { className: y["responsive-mobile-flex"], children: /* @__PURE__ */ f(n, { data: i ?? [] }) }),
272
+ /* @__PURE__ */ f("div", { className: y["responsive-desktop-flex"], children: /* @__PURE__ */ f(n, { data: _ ?? [] }) }),
273
+ /* @__PURE__ */ f($.Divider, {})
274
+ ] });
275
+ };
276
+ async function be({ contentType: e, storeId: t, CMS_PROJECT_NAME: n, NextCookies: s }) {
277
+ const r = await k({
278
+ contentType: e,
279
+ storeId: t,
280
+ CMS_PROJECT_NAME: n,
281
+ NextCookies: s
282
+ });
283
+ if (r.status === 200) {
284
+ const o = {
285
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
286
+ contentType: e,
287
+ data: r.data
288
+ };
289
+ console.log("Resultado da chamada:", r);
290
+ const a = `backup-${e}-${Date.now()}.json`;
291
+ return await w.writeFile(
292
+ `./backups/${a}`,
293
+ JSON.stringify(o, null, 2),
294
+ "utf-8"
295
+ ), { success: !0, fileName: a };
296
+ }
297
+ return { success: !1, error: r.error || "No data to backup" };
298
+ }
299
+ async function ge(e) {
300
+ return be(e);
301
+ }
302
+ async function ve({
303
+ contentType: e,
304
+ documentId: t,
305
+ versionId: n,
306
+ storeId: s,
307
+ CMS_PROJECT_NAME: r
308
+ }) {
309
+ const o = t && t.length ? `/${t}` : "", a = n && n.length ? `?versionId=${n}` : "";
310
+ return fetch(
311
+ `https://${s}.myvtex.com/_v/cms/api/${r}/${e}${o}${a}`,
312
+ { cache: "no-cache" }
313
+ );
314
+ }
315
+ async function he({
316
+ contentType: e,
317
+ documents: t,
318
+ NextCookies: n,
319
+ previewId: s,
320
+ CMS_PROJECT_NAME: r,
321
+ storeId: o
322
+ }) {
323
+ var i;
324
+ const a = JSON.parse(
325
+ s ?? ((i = n == null ? void 0 : n().get("cms_preview_data")) == null ? void 0 : i.value) ?? "{}"
326
+ );
327
+ if (a && (a == null ? void 0 : a.contentType) === e) {
328
+ const l = a.documentId && a.documentId.length ? `/${a.documentId}` : "", _ = a != null && a.versionId && (a != null && a.versionId.length) ? `?versionId=${a == null ? void 0 : a.versionId}` : "", c = await (await fetch(
329
+ `https://${o}.myvtex.com/_v/cms/api/${r}/${e}${l}${_}`,
330
+ { cache: "no-store" }
331
+ )).json(), m = t.filter(
332
+ (d) => c.id !== d.documentId
333
+ );
334
+ return m.unshift(c), m;
335
+ }
336
+ return t;
337
+ }
338
+ async function k({
339
+ contentType: e,
340
+ NextCookies: t,
341
+ CMS_PROJECT_NAME: n,
342
+ storeId: s,
343
+ previewId: r
344
+ }) {
345
+ var u, c;
346
+ const o = JSON.parse(
347
+ r ?? ((u = t == null ? void 0 : t().get("cms_preview_data")) == null ? void 0 : u.value) ?? "{}"
348
+ ), a = [];
349
+ let i = 1, l = 0, _ = !0;
350
+ try {
351
+ do {
352
+ const d = await (await fetch(
353
+ `https://${s}.myvtex.com/_v/cms/api/${n}/${e}?page=${i}`
354
+ )).json();
355
+ i === 1 && (l = d.totalItems), (c = d == null ? void 0 : d.data) != null && c.length && a.push(...d.data), _ = d.hasNextPage, i++;
356
+ } while (_ && a.length < l);
357
+ if (o.previewMode && a.length) {
358
+ const m = await he({
359
+ contentType: e,
360
+ documents: a,
361
+ NextCookies: t,
362
+ CMS_PROJECT_NAME: n,
363
+ storeId: s
364
+ });
365
+ return {
366
+ status: m.length > 0 ? 200 : 404,
367
+ data: m ?? []
368
+ };
369
+ }
370
+ return {
371
+ status: a.length ? 200 : 404,
372
+ data: a
373
+ };
374
+ } catch (m) {
375
+ return { status: "error", data: [], error: m };
376
+ }
377
+ }
378
+ const Pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
379
+ __proto__: null,
380
+ cmsBackup: ge,
381
+ getCMSContentType: ve,
382
+ getContentType: k
383
+ }, Symbol.toStringTag, { value: "Module" }));
384
+ export {
385
+ ze as S,
386
+ Oe as _,
387
+ z as a,
388
+ j as b,
389
+ Ce as c,
390
+ C as d,
391
+ P as e,
392
+ we as f,
393
+ T as g,
394
+ b as h,
395
+ R as i,
396
+ F as j,
397
+ B as k,
398
+ L as l,
399
+ O as m,
400
+ Ne as n,
401
+ A as o,
402
+ Te as p,
403
+ k as q,
404
+ y as r,
405
+ x as s,
406
+ $e as t,
407
+ D as u,
408
+ Se as v,
409
+ ke as w,
410
+ Re as x,
411
+ Pe as y
412
+ };