@soma-vertical-web/multi-lib 0.0.61 → 0.0.63

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 (33) hide show
  1. package/cms/ContentTypes/HelpButton/FormatHelpButtonContent.d.ts +13 -0
  2. package/cms/ContentTypes/HelpButton/HelpButtonContent.d.ts +3 -0
  3. package/cms/ContentTypes/Search/SearchContent.d.ts +1 -1
  4. package/cms/index.d.ts +1 -1
  5. package/cms/server.d.ts +1 -0
  6. package/contexts/index.d.ts +0 -2
  7. package/index-DD12Nl4r.mjs +412 -0
  8. package/index-DJeLEsRl.js +1 -0
  9. package/index.js +28 -27
  10. package/index.mjs +8019 -6430
  11. package/index2.js +1 -1
  12. package/index2.mjs +837 -770
  13. package/layout/index.d.ts +1 -0
  14. package/layout/team-component/BuyPackage/helpers.d.ts +1 -1
  15. package/layout/team-component/HelpButton/Composite/Body.d.ts +4 -0
  16. package/layout/team-component/HelpButton/Composite/CallToAction.d.ts +7 -0
  17. package/layout/team-component/HelpButton/Composite/Wrapper.d.ts +4 -0
  18. package/layout/team-component/HelpButton/HelpButton.d.ts +4 -0
  19. package/layout/team-component/HelpButton/index.d.ts +1 -0
  20. package/layout/template/PDP/Composite/Gallery/Wrapper.d.ts +2 -2
  21. package/layout/template/PDP/Composite/Gallery/index.d.ts +1 -1
  22. package/layout/template/PDP/index.d.ts +18 -1
  23. package/package.json +1 -1
  24. package/server.d.ts +8 -1
  25. package/style.css +1 -1
  26. package/types/cms/ContentTypes/HelpButton/index.d.ts +17 -6
  27. package/types/constants.d.ts +72 -7
  28. package/types/contexts/contexts/pdp.d.ts +5 -46
  29. package/types/data/helpers/index.d.ts +6 -1
  30. package/types/layout/team-components/HelpButton/index.d.ts +9 -3
  31. package/types/layout/team-components/ImageZoom/index.d.ts +36 -3
  32. package/types/layout/team-components/Notify/index.d.ts +22 -2
  33. package/types/layout/templates/PDP/index.d.ts +144 -4
@@ -0,0 +1,13 @@
1
+ import { IContentTypeResponseBase } from '../../../types/cms/Factories';
2
+
3
+ export declare const formatHelpButtonContent: (data: IContentTypeResponseBase[]) => {
4
+ iconLabel: string;
5
+ label: string;
6
+ content: never[];
7
+ helpButtonSize?: undefined;
8
+ } | {
9
+ iconLabel: any;
10
+ label: any;
11
+ helpButtonSize: any;
12
+ content: any;
13
+ };
@@ -0,0 +1,3 @@
1
+ import { HelpButtonContentProps } from '../../../types/cms/ContentTypes/HelpButton';
2
+
3
+ export declare const HelpButtonContent: ({ HelpButton, ICONS, className, ...props }: HelpButtonContentProps) => Promise<import("react/jsx-runtime").JSX.Element>;
@@ -1,3 +1,3 @@
1
1
  import { SearchContentProps } from '../../../types/cms/ContentTypes/Search';
2
2
 
3
- export declare const SearchContent: ({ SectionZone, CMS_PROJECT_NAME, storeId, previewId }: SearchContentProps) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const SearchContent: ({ SectionZone, CMS_PROJECT_NAME, storeId, previewId, }: SearchContentProps) => import("react/jsx-runtime").JSX.Element;
package/cms/index.d.ts CHANGED
@@ -15,7 +15,7 @@ export declare const clientCMS: {
15
15
  TipbarScreening: ({ CONSTANTS, data }: import('../types/cms/ContentTypes/Tipbar').TipbarScreeningProps) => import("react/jsx-runtime").JSX.Element;
16
16
  ImageGrid: (data: import('../types/cms/Sections/ImageGrid').ImageGridSectionType) => import("react/jsx-runtime").JSX.Element;
17
17
  SearchPageScreening: ({ children, data, SectionZone, className, }: import('../types/cms/ContentTypes/Search').SearchPageScrenningProps) => import("react/jsx-runtime").JSX.Element;
18
- SearchContent: ({ SectionZone, CMS_PROJECT_NAME, storeId, previewId }: import('../types/cms/ContentTypes/Search').SearchContentProps) => import("react/jsx-runtime").JSX.Element;
18
+ SearchContent: ({ SectionZone, CMS_PROJECT_NAME, storeId, previewId, }: import('../types/cms/ContentTypes/Search').SearchContentProps) => import("react/jsx-runtime").JSX.Element;
19
19
  NewsletterSection: ({ data: { componentIndex, ...props }, ClientNewsletterSection, }: import('../types/cms/Sections/Newsletter').NewsLetterSectionType & {
20
20
  ClientNewsletterSection: React.ComponentType<any>;
21
21
  }) => import("react/jsx-runtime").JSX.Element;
package/cms/server.d.ts CHANGED
@@ -37,5 +37,6 @@ export declare const serverCMS: {
37
37
  description: string;
38
38
  } | null>;
39
39
  SearchPageContent: ({ children, SectionZone, className, ...props }: import('../types/cms/ContentTypes/Search').SearchPageContentProps) => Promise<import("react/jsx-runtime").JSX.Element>;
40
+ HelpButtonContent: ({ HelpButton, ICONS, className, ...props }: import('../types/cms/ContentTypes/HelpButton').HelpButtonContentProps) => Promise<import("react/jsx-runtime").JSX.Element>;
40
41
  };
41
42
  };
@@ -74,7 +74,6 @@ export declare const contexts: {
74
74
  };
75
75
  pdp: {
76
76
  provider: ({ children, gridScrollBack }: import('../types/contexts/contexts/pdp').PDPProviderProps) => import("react/jsx-runtime").JSX.Element;
77
- hook: () => import('../types/contexts/contexts/pdp').PDPContextProps;
78
77
  };
79
78
  PDPContent: {
80
79
  provider: ({ children, data, productId, COMMON_PAGE_COLUMN_GAP, SectionZone, }: import('../types/cms/ContentTypes/PDP').PDPContentProviderProps) => import("react/jsx-runtime").JSX.Element;
@@ -99,7 +98,6 @@ export declare const contexts: {
99
98
  hook: () => import('../types/contexts/contexts/plp').PLPInfiniteContextProps;
100
99
  };
101
100
  pdpdata: {
102
- hook: () => import('../types/contexts/contexts/pdp').PDPDataContextProps;
103
101
  provider: ({ children, productData, isKit, PDP_INFO, NAME_SPLIT_SYMBOL, TEXTURE_IMAGE, }: import('../types/contexts/contexts/pdp').PDPDataProviderProps) => import("react/jsx-runtime").JSX.Element;
104
102
  };
105
103
  searchFacets: {
@@ -0,0 +1,412 @@
1
+ import { jsxs as g, Fragment as S, jsx as p } 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), y = (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, o) => {
30
+ var _;
31
+ o && (o.sellerId = a.sellerId, o.sellerName = a.sellerName, o.available = !0, o.isSellerDefault = a.sellerDefault);
32
+ const {
33
+ Price: l,
34
+ ListPrice: u,
35
+ PaymentOptions: { installmentOptions: d }
36
+ } = a.commertialOffer;
37
+ n.price = l, n.listPrice = u;
38
+ const c = (_ = d == null ? void 0 : d[0]) == null ? void 0 : _.installments;
39
+ if (c) {
40
+ const { count: m, value: f } = c[c.length - 1];
41
+ n.installments = {
42
+ count: m,
43
+ value: f / 100
44
+ };
45
+ }
46
+ };
47
+ let r = !0;
48
+ const i = e.reduce((a, o) => {
49
+ var d;
50
+ const l = {
51
+ name: o.name,
52
+ sku: o.itemId,
53
+ value: ((d = o.Tamanho) == null ? void 0 : d[0]) ?? y(o.nameComplete ?? o.name, t).size,
54
+ available: !1,
55
+ sellerId: "",
56
+ sellerName: "",
57
+ isSellerDefault: !1
58
+ }, u = o.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: i,
68
+ allSizesAvailable: r
69
+ };
70
+ }, P = (e) => e ? !e.offers.offers.find(({ quantity: t = 0 }) => t > 0) : !1, x = (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
+ }, F = ({ images: e, TEXTURE_IMAGE: t }) => e.find((n) => t.includes(n.imageLabel)) ?? e[0], j = (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
+ }, A = (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
+ }, D = ({
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
+ }, B = (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
+ }, E = (e, t, n) => {
103
+ t && (e ? (t.getAttribute("src") || (t.src = n ?? ""), t.play()) : t.pause());
104
+ }, Ie = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
105
+ __proto__: null,
106
+ disableSKU: P,
107
+ formatPriceToCurrency: b,
108
+ freightParsePrice: R,
109
+ getAspectRatio: B,
110
+ getColorAndSizeFromSkuName: T,
111
+ getFirstImages: D,
112
+ getProductNameWithoutSku: O,
113
+ getSKUName: C,
114
+ getSkuInfos: z,
115
+ getThumbImage: F,
116
+ getValidOffer: x,
117
+ removeSlashes: N,
118
+ resizingImg: j,
119
+ setVideoPlay: E,
120
+ splitNameAndSizeFromFullName: y,
121
+ updatedResizedImg: A
122
+ }, Symbol.toStringTag, { value: "Module" })), k = "fuzzy", v = "operator", L = (e) => ({
123
+ isDepartment: e != null && e.length ? e[0].key === "category-1" : !1
124
+ }), we = (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
+ (i) => !n.find(
133
+ (a) => a.toLowerCase() === i.value || a.toLowerCase() === i.name.toLowerCase()
134
+ )
135
+ )
136
+ };
137
+ }
138
+ return s;
139
+ });
140
+ }, q = (e, t) => t ? e === "category-1" : !1, U = (e) => e.key === "operator" && (e.value === "and" || e.value === "or"), M = (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, i) => r.name.localeCompare(i.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 || !q(a.key, r)
158
+ ).map(
159
+ (a) => M(a) ? K(a) : V(a)
160
+ );
161
+ }, $e = (e, t) => {
162
+ const n = e.find(({ key: r }) => r === k) ?? null, s = e.find(({ key: r }) => r === v) ?? null;
163
+ n && H(n) && t.append(k, n.value), s && U(s) && t.append(v, 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: i }) => !n.includes(decodeURIComponent(i))).map((i) => ({
169
+ ...i,
170
+ value: decodeURIComponent(i.value)
171
+ })), { isDepartment: r } = L(s);
172
+ return s == null ? void 0 : s.filter((i) => !q(i.key, r));
173
+ }, Te = ({ pathname: e, searchParams: t }, n) => {
174
+ const s = t.get("sort") ?? "", r = t.get("query") ?? null, i = parseInt(t.get("page") ?? "1", 10);
175
+ return {
176
+ sort: s,
177
+ facets: Y(n),
178
+ term: r,
179
+ base: r ? "" : e,
180
+ page: i
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
+ }, h = {
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
+ }, I = {}, Oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
193
+ __proto__: null,
194
+ default: I
195
+ }, Symbol.toStringTag, { value: "Module" })), J = "_header_qh6ki_40", W = "_actions_qh6ki_61", G = "_breadcrumb_qh6ki_72", X = "_credits_qh6ki_87", Q = "_pdplinks_qh6ki_115", Z = "_similars_qh6ki_142", ee = "_sizes_qh6ki_181", te = "_measurementTable_qh6ki_197", ne = "_measurementHead_qh6ki_210", se = "_measurementRows_qh6ki_215", ae = "_measurementRowsTitle_qh6ki_232", re = "_measurementRowsText_qh6ki_244", ie = "_measurementImage_qh6ki_255", oe = "_measurementImageContainer_qh6ki_258", ce = "_measurementContent_qh6ki_267", le = "_measurementTitle_qh6ki_271", me = "_measurementClose_qh6ki_282", _e = "_productref_qh6ki_347", ue = "_slideOut_qh6ki_1", de = "_slideIn_qh6ki_1", pe = "_content_qh6ki_327", fe = "_pdp_qh6ki_115", he = "_divider_qh6ki_510", Ne = {
196
+ "bottom-navigation": "_bottom-navigation_qh6ki_1",
197
+ "bottom-navigation__credits-modifier": "_bottom-navigation__credits-modifier_qh6ki_18",
198
+ "bottom-navigation__header": "_bottom-navigation__header_qh6ki_21",
199
+ "bottom-navigation__price-and-promo": "_bottom-navigation__price-and-promo_qh6ki_31",
200
+ header: J,
201
+ actions: W,
202
+ "add-to-cart": "_add-to-cart_qh6ki_68",
203
+ breadcrumb: G,
204
+ "breadcrumb--active": "_breadcrumb--active_qh6ki_77",
205
+ credits: X,
206
+ "gallery-carousel-modifier": "_gallery-carousel-modifier_qh6ki_92",
207
+ pdplinks: Q,
208
+ "links-wrapper": "_links-wrapper_qh6ki_125",
209
+ similars: Z,
210
+ "similars-info": "_similars-info_qh6ki_154",
211
+ "toggle-style-modifier": "_toggle-style-modifier_qh6ki_163",
212
+ "accessibility-info": "_accessibility-info_qh6ki_167",
213
+ sizes: ee,
214
+ "price-wrapper": "_price-wrapper_qh6ki_193",
215
+ measurementTable: te,
216
+ measurementHead: ne,
217
+ measurementRows: se,
218
+ measurementRowsTitle: ae,
219
+ measurementRowsText: re,
220
+ measurementImage: ie,
221
+ measurementImageContainer: oe,
222
+ measurementContent: ce,
223
+ measurementTitle: le,
224
+ measurementClose: me,
225
+ "tabs-root-modifier": "_tabs-root-modifier_qh6ki_288",
226
+ "tabs-list-modifier": "_tabs-list-modifier_qh6ki_306",
227
+ "tabs-item-modifier": "_tabs-item-modifier_qh6ki_323",
228
+ "content-wrapper": "_content-wrapper_qh6ki_327",
229
+ productref: _e,
230
+ "tabs-panel": "_tabs-panel_qh6ki_358",
231
+ "tabs-panel-exit": "_tabs-panel-exit_qh6ki_364",
232
+ slideOut: ue,
233
+ "tabs-panel-enter": "_tabs-panel-enter_qh6ki_368",
234
+ slideIn: de,
235
+ content: pe,
236
+ pdp: fe,
237
+ "pdp-main": "_pdp-main_qh6ki_426",
238
+ "pdp-main__gallery-wrapper": "_pdp-main__gallery-wrapper_qh6ki_431",
239
+ "pdp-main__info": "_pdp-main__info_qh6ki_448",
240
+ "pdp-main__info-main-content": "_pdp-main__info-main-content_qh6ki_468",
241
+ "pdp-main__info-subsection": "_pdp-main__info-subsection_qh6ki_468",
242
+ "subsection-product-info": "_subsection-product-info_qh6ki_479",
243
+ "subsection-similars": "_subsection-similars_qh6ki_482",
244
+ "subsection-sizes": "_subsection-sizes_qh6ki_485",
245
+ "subsection-actions": "_subsection-actions_qh6ki_488",
246
+ "pdp-main__info-secondary-content": "_pdp-main__info-secondary-content_qh6ki_492",
247
+ "sections-title": "_sections-title_qh6ki_498",
248
+ divider: he,
249
+ "breadcrumbs-desktop": "_breadcrumbs-desktop_qh6ki_515",
250
+ "breadcrumbs-mobile": "_breadcrumbs-mobile_qh6ki_524"
251
+ }, ze = ({
252
+ children: e,
253
+ data: t,
254
+ SectionZone: n,
255
+ className: s
256
+ }) => {
257
+ var d, c;
258
+ const r = ((d = t == null ? void 0 : t.filter((_) => {
259
+ var m, f;
260
+ return ((f = (m = _.config) == null ? void 0 : m.responsive) == null ? void 0 : f.deviceType) === "mobile";
261
+ })[0]) == null ? void 0 : d.sections) || [], i = ((c = t == null ? void 0 : t.filter((_) => {
262
+ var m, f;
263
+ return ((f = (m = _.config) == null ? void 0 : m.responsive) == null ? void 0 : f.deviceType) === "desktop";
264
+ })[0]) == null ? void 0 : c.sections) || [], a = r.slice(0, 1), o = r.slice(1, r.length), l = i.slice(0, 1), u = i.slice(1, i.length);
265
+ return /* @__PURE__ */ g(S, { children: [
266
+ /* @__PURE__ */ g("div", { className: s, children: [
267
+ /* @__PURE__ */ p("div", { className: h["responsive-mobile-flex"], children: /* @__PURE__ */ p(n, { data: a ?? [] }) }),
268
+ /* @__PURE__ */ p("div", { className: h["responsive-desktop-flex"], children: /* @__PURE__ */ p(n, { data: l ?? [] }) })
269
+ ] }),
270
+ e,
271
+ /* @__PURE__ */ p("div", { className: h["responsive-mobile-flex"], children: /* @__PURE__ */ p(n, { data: o ?? [] }) }),
272
+ /* @__PURE__ */ p("div", { className: h["responsive-desktop-flex"], children: /* @__PURE__ */ p(n, { data: u ?? [] }) }),
273
+ /* @__PURE__ */ p($.Divider, {})
274
+ ] });
275
+ };
276
+ async function be({ contentType: e, storeId: t, CMS_PROJECT_NAME: n, NextCookies: s }) {
277
+ const r = await w({
278
+ contentType: e,
279
+ storeId: t,
280
+ CMS_PROJECT_NAME: n,
281
+ NextCookies: s
282
+ });
283
+ if (r.status === 200) {
284
+ const i = {
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 I.writeFile(
292
+ `./backups/${a}`,
293
+ JSON.stringify(i, 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 ke({
303
+ contentType: e,
304
+ documentId: t,
305
+ versionId: n,
306
+ storeId: s,
307
+ CMS_PROJECT_NAME: r
308
+ }) {
309
+ const i = t && t.length ? `/${t}` : "", a = n && n.length ? `?versionId=${n}` : "";
310
+ return fetch(
311
+ `https://${s}.myvtex.com/_v/cms/api/${r}/${e}${i}${a}`,
312
+ { cache: "no-cache" }
313
+ );
314
+ }
315
+ async function ve({
316
+ contentType: e,
317
+ documents: t,
318
+ NextCookies: n,
319
+ previewId: s,
320
+ CMS_PROJECT_NAME: r,
321
+ storeId: i
322
+ }) {
323
+ var o;
324
+ const a = JSON.parse(
325
+ s ?? ((o = n == null ? void 0 : n().get("cms_preview_data")) == null ? void 0 : o.value) ?? "{}"
326
+ );
327
+ if (a && (a == null ? void 0 : a.contentType) === e) {
328
+ 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(
329
+ `https://${i}.myvtex.com/_v/cms/api/${r}/${e}${l}${u}`,
330
+ { cache: "no-store" }
331
+ )).json(), _ = t.filter(
332
+ (m) => c.id !== m.documentId
333
+ );
334
+ return _.unshift(c), _;
335
+ }
336
+ return t;
337
+ }
338
+ async function w({
339
+ contentType: e,
340
+ NextCookies: t,
341
+ CMS_PROJECT_NAME: n,
342
+ storeId: s,
343
+ previewId: r
344
+ }) {
345
+ var d, c;
346
+ const i = JSON.parse(
347
+ r ?? ((d = t == null ? void 0 : t().get("cms_preview_data")) == null ? void 0 : d.value) ?? "{}"
348
+ ), a = [];
349
+ let o = 1, l = 0, u = !0;
350
+ try {
351
+ do {
352
+ const m = await (await fetch(
353
+ `https://${s}.myvtex.com/_v/cms/api/${n}/${e}?page=${o}`
354
+ )).json();
355
+ o === 1 && (l = m.totalItems), (c = m == null ? void 0 : m.data) != null && c.length && a.push(...m.data), u = m.hasNextPage, o++;
356
+ } while (u && a.length < l);
357
+ if (i.previewMode && a.length) {
358
+ const _ = await ve({
359
+ contentType: e,
360
+ documents: a,
361
+ NextCookies: t,
362
+ CMS_PROJECT_NAME: n,
363
+ storeId: s
364
+ });
365
+ return {
366
+ status: _.length > 0 ? 200 : 404,
367
+ data: _ ?? []
368
+ };
369
+ }
370
+ return {
371
+ status: a.length ? 200 : 404,
372
+ data: a
373
+ };
374
+ } catch (_) {
375
+ return { status: "error", data: [], error: _ };
376
+ }
377
+ }
378
+ const Pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
379
+ __proto__: null,
380
+ cmsBackup: ge,
381
+ getCMSContentType: ke,
382
+ getContentType: w
383
+ }, Symbol.toStringTag, { value: "Module" }));
384
+ export {
385
+ ze as S,
386
+ Oe as _,
387
+ z as a,
388
+ F as b,
389
+ Ce as c,
390
+ C as d,
391
+ P as e,
392
+ Ie as f,
393
+ T as g,
394
+ b as h,
395
+ R as i,
396
+ x as j,
397
+ D as k,
398
+ E as l,
399
+ O as m,
400
+ Ne as n,
401
+ j as o,
402
+ Te as p,
403
+ w as q,
404
+ h as r,
405
+ y as s,
406
+ $e as t,
407
+ A as u,
408
+ Se as v,
409
+ we as w,
410
+ Re as x,
411
+ Pe as y
412
+ };
@@ -0,0 +1 @@
1
+ "use strict";const p=require("react/jsx-runtime"),j=require("@soma-vertical-web/core-components"),b=(e,t=!0)=>Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL",minimumFractionDigits:t?2:0}).format(e),q=({valueInCents:e,hasFree:t,freeTaxMessage:n})=>e===0?t?n:b(0):b(e/100),g=(e,t)=>{const[n,s]=e.split(t);return{name:n.trim(),size:s?s.trim():""}},I=(e,t)=>{if(!e)return{};const[n,s]=e.split(t);return{color:n==null?void 0:n.trim(),size:s==null?void 0:s.trim()}},S=(e,t="tamanho")=>{if(e.additionalProperty){const[n]=e.additionalProperty;return n!=null&&n.name?n.name.toLocaleLowerCase()===t?n.value:e.name:""}return e.name},w=(e,t)=>e.replace(t,"").trim(),A=e=>e.replace(/\//g,""),$=({items:e,NAME_SPLIT_SYMBOL:t})=>{const n={price:0,listPrice:0,installments:{count:0,value:0}},s=(r,a)=>{var _;a&&(a.sellerId=r.sellerId,a.sellerName=r.sellerName,a.available=!0,a.isSellerDefault=r.sellerDefault);const{Price:l,ListPrice:u,PaymentOptions:{installmentOptions:d}}=r.commertialOffer;n.price=l,n.listPrice=u;const c=(_=d==null?void 0:d[0])==null?void 0:_.installments;if(c){const{count:m,value:f}=c[c.length-1];n.installments={count:m,value:f/100}}};let i=!0;const o=e.reduce((r,a)=>{var d;const l={name:a.name,sku:a.itemId,value:((d=a.Tamanho)==null?void 0:d[0])??g(a.nameComplete??a.name,t).size,available:!1,sellerId:"",sellerName:"",isSellerDefault:!1},u=a.sellers.filter(c=>(c.sellerDefault&&c.commertialOffer.IsAvailable&&(l.available=!0,s(c,l)),c.commertialOffer.IsAvailable));return!l.isSellerDefault&&u.length>0&&(l.available=!0,s(u[0],{...l,sellerId:u[0].sellerId,sellerName:u[0].sellerName})),l.available===!1&&(i=!1),r.push(l),r},[]);return{...n,sizes:o,allSizesAvailable:i}},C=e=>e?!e.offers.offers.find(({quantity:t=0})=>t>0):!1,N=(e,t)=>{const n=e.find(s=>s.availability.includes("InStock")&&s.quantity&&s.listPrice>0&&s.seller.identifier===t);return n||e.find(s=>s.availability.includes("InStock")&&s.quantity&&s.listPrice>0)},R=({images:e,TEXTURE_IMAGE:t})=>e.find(n=>t.includes(n.imageLabel))??e[0],T=(e,t)=>{const n=/\/ids\/(\d+)\//,s=e.match(n);return s?e.replace(`/${s[1]}/`,`/${s[1]}-${t.width}-${t.height}/`):e},x=(e,t)=>{const n=/\/ids\/(\d+)-(\d+)-(\d+)\//,s=e.match(n);return s?e.replace(`/${s[1]}-${s[2]}-${s[3]}/`,`/${s[1]}-${t.width}-${t.height}/`):e},P=({images:e,label:t})=>{const n=e.filter(s=>s.keywords===t.first||s.keywords===t.second||s.alternateName===t.first||s.alternateName===t.second);return n.length===0?e.slice(0,2):n},B=e=>{const[t,n]=e.split("/").map(Number);if(Number.isNaN(t)||Number.isNaN(n))throw new Error("[ERROR ASPECT RATIO IMAGE]: Invalid aspect ratio format");return n/t},z=(e,t,n)=>{t&&(e?(t.getAttribute("src")||(t.src=n??""),t.play()):t.pause())},D=Object.freeze(Object.defineProperty({__proto__:null,disableSKU:C,formatPriceToCurrency:b,freightParsePrice:q,getAspectRatio:B,getColorAndSizeFromSkuName:I,getFirstImages:P,getProductNameWithoutSku:w,getSKUName:S,getSkuInfos:$,getThumbImage:R,getValidOffer:N,removeSlashes:A,resizingImg:T,setVideoPlay:z,splitNameAndSizeFromFullName:g,updatedResizedImg:x},Symbol.toStringTag,{value:"Module"})),v="fuzzy",y="operator",U=e=>({isDepartment:e!=null&&e.length?e[0].key==="category-1":!1}),E=(e,t)=>{const n=decodeURIComponent(t??"").slice(1).split("/");return e.map(s=>{if(s.key==="category-2"&&s.__typename==="FacetBoolean"){const i=s.values;return{...s,values:i.filter(o=>!n.find(r=>r.toLowerCase()===o.value||r.toLowerCase()===o.name.toLowerCase()))}}return s})},O=(e,t)=>t?e==="category-1":!1,L=e=>e.key==="operator"&&(e.value==="and"||e.value==="or"),M=e=>e.type==="TEXT",K=e=>e.key==="fuzzy"&&(e.value==="0"||e.value==="1"||e.value==="auto"),V=e=>{const{key:t,name:n,values:s}=e;return{__typename:"FacetBoolean",key:t,label:n,values:s.slice().sort((i,o)=>i.name.localeCompare(o.name))}},H=({key:e,values:t})=>({__typename:"FacetRange",key:e,values:t}),W=(e,t,n)=>{if(!(e instanceof Object)||!("facets"in e))return[];const{facets:s=[]}=e,i=t!=null&&t.length?t[0].key==="category-1":!1;return s.filter(r=>!n||!O(r.key,i)).map(r=>M(r)?V(r):H(r))},Y=(e,t)=>{const n=e.find(({key:i})=>i===v)??null,s=e.find(({key:i})=>i===y)??null;n&&K(n)&&t.append(v,n.value),s&&L(s)&&t.append(y,s.value)},J=e=>e.map(t=>{const[n,s]=t.split("/");return{key:n,value:s}}),G=(e,t)=>{const n=decodeURIComponent(t??"").slice(1).split("/"),s=e.filter(({value:o})=>!n.includes(decodeURIComponent(o))).map(o=>({...o,value:decodeURIComponent(o.value)})),{isDepartment:i}=U(s);return s==null?void 0:s.filter(o=>!O(o.key,i))},X=({pathname:e,searchParams:t},n)=>{const s=t.get("sort")??"",i=t.get("query")??null,o=parseInt(t.get("page")??"1",10);return{sort:s,facets:J(n),term:i,base:i?"":e,page:o}},Q=e=>{const t=new URLSearchParams;return Object.entries(e).forEach(([n,s])=>{Array.isArray(s)?s.forEach(i=>t.append(n,i)):s!==void 0&&t.append(n,s)}),t},h={"responsive-mobile-flex":"_responsive-mobile-flex_t5bry_2","responsive-desktop-flex":"_responsive-desktop-flex_t5bry_13","responsive-mobile-block":"_responsive-mobile-block_t5bry_24","responsive-desktop-block":"_responsive-desktop-block_t5bry_35"},F={},Z=Object.freeze(Object.defineProperty({__proto__:null,default:F},Symbol.toStringTag,{value:"Module"})),ee="_header_qh6ki_40",te="_actions_qh6ki_61",ne="_breadcrumb_qh6ki_72",se="_credits_qh6ki_87",re="_pdplinks_qh6ki_115",ie="_similars_qh6ki_142",oe="_sizes_qh6ki_181",ae="_measurementTable_qh6ki_197",ce="_measurementHead_qh6ki_210",le="_measurementRows_qh6ki_215",me="_measurementRowsTitle_qh6ki_232",_e="_measurementRowsText_qh6ki_244",ue="_measurementImage_qh6ki_255",de="_measurementImageContainer_qh6ki_258",pe="_measurementContent_qh6ki_267",fe="_measurementTitle_qh6ki_271",he="_measurementClose_qh6ki_282",be="_productref_qh6ki_347",ge="_slideOut_qh6ki_1",ke="_slideIn_qh6ki_1",ve="_content_qh6ki_327",ye="_pdp_qh6ki_115",qe="_divider_qh6ki_510",Ie={"bottom-navigation":"_bottom-navigation_qh6ki_1","bottom-navigation__credits-modifier":"_bottom-navigation__credits-modifier_qh6ki_18","bottom-navigation__header":"_bottom-navigation__header_qh6ki_21","bottom-navigation__price-and-promo":"_bottom-navigation__price-and-promo_qh6ki_31",header:ee,actions:te,"add-to-cart":"_add-to-cart_qh6ki_68",breadcrumb:ne,"breadcrumb--active":"_breadcrumb--active_qh6ki_77",credits:se,"gallery-carousel-modifier":"_gallery-carousel-modifier_qh6ki_92",pdplinks:re,"links-wrapper":"_links-wrapper_qh6ki_125",similars:ie,"similars-info":"_similars-info_qh6ki_154","toggle-style-modifier":"_toggle-style-modifier_qh6ki_163","accessibility-info":"_accessibility-info_qh6ki_167",sizes:oe,"price-wrapper":"_price-wrapper_qh6ki_193",measurementTable:ae,measurementHead:ce,measurementRows:le,measurementRowsTitle:me,measurementRowsText:_e,measurementImage:ue,measurementImageContainer:de,measurementContent:pe,measurementTitle:fe,measurementClose:he,"tabs-root-modifier":"_tabs-root-modifier_qh6ki_288","tabs-list-modifier":"_tabs-list-modifier_qh6ki_306","tabs-item-modifier":"_tabs-item-modifier_qh6ki_323","content-wrapper":"_content-wrapper_qh6ki_327",productref:be,"tabs-panel":"_tabs-panel_qh6ki_358","tabs-panel-exit":"_tabs-panel-exit_qh6ki_364",slideOut:ge,"tabs-panel-enter":"_tabs-panel-enter_qh6ki_368",slideIn:ke,content:ve,pdp:ye,"pdp-main":"_pdp-main_qh6ki_426","pdp-main__gallery-wrapper":"_pdp-main__gallery-wrapper_qh6ki_431","pdp-main__info":"_pdp-main__info_qh6ki_448","pdp-main__info-main-content":"_pdp-main__info-main-content_qh6ki_468","pdp-main__info-subsection":"_pdp-main__info-subsection_qh6ki_468","subsection-product-info":"_subsection-product-info_qh6ki_479","subsection-similars":"_subsection-similars_qh6ki_482","subsection-sizes":"_subsection-sizes_qh6ki_485","subsection-actions":"_subsection-actions_qh6ki_488","pdp-main__info-secondary-content":"_pdp-main__info-secondary-content_qh6ki_492","sections-title":"_sections-title_qh6ki_498",divider:qe,"breadcrumbs-desktop":"_breadcrumbs-desktop_qh6ki_515","breadcrumbs-mobile":"_breadcrumbs-mobile_qh6ki_524"},Se=({children:e,data:t,SectionZone:n,className:s})=>{var d,c;const i=((d=t==null?void 0:t.filter(_=>{var m,f;return((f=(m=_.config)==null?void 0:m.responsive)==null?void 0:f.deviceType)==="mobile"})[0])==null?void 0:d.sections)||[],o=((c=t==null?void 0:t.filter(_=>{var m,f;return((f=(m=_.config)==null?void 0:m.responsive)==null?void 0:f.deviceType)==="desktop"})[0])==null?void 0:c.sections)||[],r=i.slice(0,1),a=i.slice(1,i.length),l=o.slice(0,1),u=o.slice(1,o.length);return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:s,children:[p.jsx("div",{className:h["responsive-mobile-flex"],children:p.jsx(n,{data:r??[]})}),p.jsx("div",{className:h["responsive-desktop-flex"],children:p.jsx(n,{data:l??[]})})]}),e,p.jsx("div",{className:h["responsive-mobile-flex"],children:p.jsx(n,{data:a??[]})}),p.jsx("div",{className:h["responsive-desktop-flex"],children:p.jsx(n,{data:u??[]})}),p.jsx(j.Utils.Divider,{})]})};async function we({contentType:e,storeId:t,CMS_PROJECT_NAME:n,NextCookies:s}){const i=await k({contentType:e,storeId:t,CMS_PROJECT_NAME:n,NextCookies:s});if(i.status===200){const o={timestamp:new Date().toISOString(),contentType:e,data:i.data};console.log("Resultado da chamada:",i);const r=`backup-${e}-${Date.now()}.json`;return await F.writeFile(`./backups/${r}`,JSON.stringify(o,null,2),"utf-8"),{success:!0,fileName:r}}return{success:!1,error:i.error||"No data to backup"}}async function $e(e){return we(e)}async function Ce({contentType:e,documentId:t,versionId:n,storeId:s,CMS_PROJECT_NAME:i}){const o=t&&t.length?`/${t}`:"",r=n&&n.length?`?versionId=${n}`:"";return fetch(`https://${s}.myvtex.com/_v/cms/api/${i}/${e}${o}${r}`,{cache:"no-cache"})}async function Ne({contentType:e,documents:t,NextCookies:n,previewId:s,CMS_PROJECT_NAME:i,storeId:o}){var a;const r=JSON.parse(s??((a=n==null?void 0:n().get("cms_preview_data"))==null?void 0:a.value)??"{}");if(r&&(r==null?void 0:r.contentType)===e){const l=r.documentId&&r.documentId.length?`/${r.documentId}`:"",u=r!=null&&r.versionId&&(r!=null&&r.versionId.length)?`?versionId=${r==null?void 0:r.versionId}`:"",c=await(await fetch(`https://${o}.myvtex.com/_v/cms/api/${i}/${e}${l}${u}`,{cache:"no-store"})).json(),_=t.filter(m=>c.id!==m.documentId);return _.unshift(c),_}return t}async function k({contentType:e,NextCookies:t,CMS_PROJECT_NAME:n,storeId:s,previewId:i}){var d,c;const o=JSON.parse(i??((d=t==null?void 0:t().get("cms_preview_data"))==null?void 0:d.value)??"{}"),r=[];let a=1,l=0,u=!0;try{do{const m=await(await fetch(`https://${s}.myvtex.com/_v/cms/api/${n}/${e}?page=${a}`)).json();a===1&&(l=m.totalItems),(c=m==null?void 0:m.data)!=null&&c.length&&r.push(...m.data),u=m.hasNextPage,a++}while(u&&r.length<l);if(o.previewMode&&r.length){const _=await Ne({contentType:e,documents:r,NextCookies:t,CMS_PROJECT_NAME:n,storeId:s});return{status:_.length>0?200:404,data:_??[]}}return{status:r.length?200:404,data:r}}catch(_){return{status:"error",data:[],error:_}}}const Re=Object.freeze(Object.defineProperty({__proto__:null,cmsBackup:$e,getCMSContentType:Ce,getContentType:k},Symbol.toStringTag,{value:"Module"}));exports.SearchPageScreening=Se;exports.__viteBrowserExternal=Z;exports.addSearchParamsFacets=Y;exports.cms=Re;exports.convertSearchParams=Q;exports.disableSKU=C;exports.filterNonCategorySelected=E;exports.filterNonRootFacets=G;exports.formatPriceToCurrency=b;exports.formattedFacets=W;exports.freightParsePrice=q;exports.getColorAndSizeFromSkuName=I;exports.getContentType=k;exports.getFirstImages=P;exports.getProductNameWithoutSku=w;exports.getSKUName=S;exports.getSkuInfos=$;exports.getThumbImage=R;exports.getValidOffer=N;exports.parseSearchState=X;exports.productHelpers=D;exports.resizingImg=T;exports.responsive=h;exports.setVideoPlay=z;exports.splitNameAndSizeFromFullName=g;exports.styles=Ie;exports.updatedResizedImg=x;