@soma-vertical-web/multi-lib 0.0.49 → 0.0.51
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/SearchPageScreening-BIyp1dAW.mjs +112 -0
- package/SearchPageScreening-gO7dG13l.js +1 -0
- package/cms/ContentTypes/Search/SearchContentScreening.d.ts +3 -0
- package/cms/Sections/Newsletter/Component.d.ts +5 -0
- package/cms/index.d.ts +5 -0
- package/cms/server.d.ts +1 -0
- package/contexts/contexts/newsletter/Context.d.ts +6 -0
- package/contexts/contexts/pdp/PDPDataContext.d.ts +1 -1
- package/contexts/hooks/useDisableZoom.d.ts +1 -0
- package/contexts/hooks/useLocalStorage.d.ts +1 -0
- package/contexts/hooks/useSentinel.d.ts +11 -0
- package/contexts/hooks/useTouchZoomPan.d.ts +8 -0
- package/contexts/index.d.ts +29 -1
- package/data/api/checkout/order-form/attachments/marketing-data/index.d.ts +1 -1
- package/data/api/checkout/order-form/seller-code/index.d.ts +1 -1
- package/data/api/cms/index.d.ts +1 -1
- package/data/api/master-data/index.d.ts +3 -0
- package/data/api/master-data/masterdata/index.d.ts +26 -0
- package/data/api/master-data/search/index.d.ts +61 -0
- package/data/api/master-data/update/index.d.ts +29 -0
- package/data/helpers/events/index.d.ts +1 -1
- package/data/helpers/product/thumb.d.ts +2 -2
- package/index-CkcBCfzG.js +1 -0
- package/index-catAI5a3.mjs +258 -0
- package/index.js +26 -26
- package/index.mjs +5966 -5240
- package/index2.js +1 -1
- package/index2.mjs +846 -835
- package/layout/index.d.ts +5 -1
- package/layout/team-component/Header/Composite/HeaderDesktopWrapper.d.ts +1 -3
- package/layout/team-component/Header/Composite/HeaderMobileWrapper.d.ts +1 -3
- package/layout/team-component/Header/Composite/SearchButton.d.ts +1 -5
- package/layout/team-component/Header/index.d.ts +1 -1
- package/layout/team-component/Newsletter/Composite/Form.d.ts +7 -0
- package/layout/team-component/Newsletter/Composite/FormFields.d.ts +7 -0
- package/layout/team-component/Newsletter/Composite/Input.d.ts +7 -0
- package/layout/team-component/Newsletter/Composite/SubmitButton.d.ts +8 -0
- package/layout/team-component/Newsletter/Composite/Success.d.ts +10 -0
- package/layout/team-component/Newsletter/Composite/Terms.d.ts +7 -0
- package/layout/team-component/Newsletter/helpers.d.ts +21 -0
- package/layout/team-component/Newsletter/index.d.ts +7 -0
- package/layout/template/PDP/Composite/Gallery/Wrapper.d.ts +1 -1
- package/layout/template/PDP/Composite/Gallery/index.d.ts +1 -1
- package/package.json +1 -1
- package/server.d.ts +4 -1
- package/style.css +1 -1
- package/types/cms/ContentTypes/Search/index.d.ts +31 -0
- package/types/cms/ContentTypes/Tipbar/index.d.ts +1 -0
- package/types/constants.d.ts +34 -0
- package/types/contexts/contexts/pdp.d.ts +3 -1
- package/types/contexts/store/cart.d.ts +3 -0
- package/types/data/api/cms/index.d.ts +2 -1
- package/types/data/events/index.d.ts +1 -0
- package/types/data/helpers/index.d.ts +5 -1
- package/types/layout/team-components/Header/index.d.ts +1 -5
- package/types/layout/team-components/Newsletter/index.d.ts +13 -2
- package/types/layout/templates/PDP/index.d.ts +1 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { jsxs as v, Fragment as R, jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { Utils as w } from "@soma-vertical-web/core-components";
|
|
3
|
+
const b = "fuzzy", _ = "operator", S = (e) => ({
|
|
4
|
+
isDepartment: e != null && e.length ? e[0].key === "category-1" : !1
|
|
5
|
+
}), M = (e, t) => {
|
|
6
|
+
const s = decodeURIComponent(t ?? "").slice(1).split("/");
|
|
7
|
+
return e.map((o) => {
|
|
8
|
+
if (o.key === "category-2" && o.__typename === "FacetBoolean") {
|
|
9
|
+
const r = o.values;
|
|
10
|
+
return {
|
|
11
|
+
...o,
|
|
12
|
+
values: r.filter(
|
|
13
|
+
(a) => !s.find(
|
|
14
|
+
(n) => n.toLowerCase() === a.value || n.toLowerCase() === a.name.toLowerCase()
|
|
15
|
+
)
|
|
16
|
+
)
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
return o;
|
|
20
|
+
});
|
|
21
|
+
}, $ = (e, t) => t ? e === "category-1" : !1, C = (e) => e.key === "operator" && (e.value === "and" || e.value === "or"), E = (e) => e.type === "TEXT", O = (e) => e.key === "fuzzy" && (e.value === "0" || e.value === "1" || e.value === "auto"), j = (e) => {
|
|
22
|
+
const { key: t, name: s, values: o } = e;
|
|
23
|
+
return {
|
|
24
|
+
__typename: "FacetBoolean",
|
|
25
|
+
key: t,
|
|
26
|
+
label: s,
|
|
27
|
+
values: o.slice().sort((r, a) => r.name.localeCompare(a.name))
|
|
28
|
+
};
|
|
29
|
+
}, T = ({ key: e, values: t }) => ({
|
|
30
|
+
__typename: "FacetRange",
|
|
31
|
+
key: e,
|
|
32
|
+
values: t
|
|
33
|
+
}), N = (e, t, s) => {
|
|
34
|
+
if (!(e instanceof Object) || !("facets" in e))
|
|
35
|
+
return [];
|
|
36
|
+
const { facets: o = [] } = e, r = t != null && t.length ? t[0].key === "category-1" : !1;
|
|
37
|
+
return o.filter(
|
|
38
|
+
(n) => !s || !$(n.key, r)
|
|
39
|
+
).map(
|
|
40
|
+
(n) => E(n) ? j(n) : T(n)
|
|
41
|
+
);
|
|
42
|
+
}, V = (e, t) => {
|
|
43
|
+
const s = e.find(({ key: r }) => r === b) ?? null, o = e.find(({ key: r }) => r === _) ?? null;
|
|
44
|
+
s && O(s) && t.append(b, s.value), o && C(o) && t.append(_, o.value);
|
|
45
|
+
}, F = (e) => e.map((t) => {
|
|
46
|
+
const [s, o] = t.split("/");
|
|
47
|
+
return { key: s, value: o };
|
|
48
|
+
}), J = (e, t) => {
|
|
49
|
+
const s = decodeURIComponent(t ?? "").slice(1).split("/"), o = e.filter(({ value: a }) => !s.includes(decodeURIComponent(a))).map((a) => ({
|
|
50
|
+
...a,
|
|
51
|
+
value: decodeURIComponent(a.value)
|
|
52
|
+
})), { isDepartment: r } = S(o);
|
|
53
|
+
return o == null ? void 0 : o.filter((a) => !$(a.key, r));
|
|
54
|
+
}, Y = ({ pathname: e, searchParams: t }, s) => {
|
|
55
|
+
const o = t.get("sort") ?? "", r = t.get("query") ?? null, a = parseInt(t.get("page") ?? "1", 10);
|
|
56
|
+
return {
|
|
57
|
+
sort: o,
|
|
58
|
+
facets: F(s),
|
|
59
|
+
term: r,
|
|
60
|
+
base: r ? "" : e,
|
|
61
|
+
page: a
|
|
62
|
+
};
|
|
63
|
+
}, K = (e) => {
|
|
64
|
+
const t = new URLSearchParams();
|
|
65
|
+
return Object.entries(e).forEach(([s, o]) => {
|
|
66
|
+
Array.isArray(o) ? o.forEach((r) => t.append(s, r)) : o !== void 0 && t.append(s, o);
|
|
67
|
+
}), t;
|
|
68
|
+
}, x = async (e, t = {}) => {
|
|
69
|
+
const { method: s = "GET", body: o, headers: r = {}, priority: a = "auto", cache: n = "default" } = t;
|
|
70
|
+
return fetch(e, {
|
|
71
|
+
method: s,
|
|
72
|
+
headers: {
|
|
73
|
+
...r,
|
|
74
|
+
Accept: "application/json",
|
|
75
|
+
"Content-Type": "application/json"
|
|
76
|
+
},
|
|
77
|
+
priority: a,
|
|
78
|
+
cache: n,
|
|
79
|
+
...o ? { body: JSON.stringify(o) } : {}
|
|
80
|
+
// not body in get
|
|
81
|
+
}).then((i) => i.json()).catch((i) => {
|
|
82
|
+
console.error("[ERROR FETCH VTEX]", i);
|
|
83
|
+
});
|
|
84
|
+
}, h = /* @__PURE__ */ new Map();
|
|
85
|
+
async function P(e, t = {}) {
|
|
86
|
+
var s;
|
|
87
|
+
try {
|
|
88
|
+
const { abort: o = !1 } = t, r = new AbortController();
|
|
89
|
+
o && (h.has(e) && ((s = h.get(e)) == null || s.abort(), h.delete(e)), h.set(e, r));
|
|
90
|
+
const a = x(e, {
|
|
91
|
+
...t,
|
|
92
|
+
...o ? { signal: r.signal } : {}
|
|
93
|
+
});
|
|
94
|
+
return o && h.delete(e), a;
|
|
95
|
+
} catch (o) {
|
|
96
|
+
if (o.name === "AbortError") {
|
|
97
|
+
console.log(`[REQUEST CANCELLED]: ${e}`);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
throw console.error(`[ERROR API]: ${o.message}`), o;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
const y = {
|
|
104
|
+
"responsive-mobile-flex": "_responsive-mobile-flex_t5bry_2",
|
|
105
|
+
"responsive-desktop-flex": "_responsive-desktop-flex_t5bry_13",
|
|
106
|
+
"responsive-mobile-block": "_responsive-mobile-block_t5bry_24",
|
|
107
|
+
"responsive-desktop-block": "_responsive-desktop-block_t5bry_35"
|
|
108
|
+
}, k = {}, X = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
109
|
+
__proto__: null,
|
|
110
|
+
default: k
|
|
111
|
+
}, Symbol.toStringTag, { value: "Module" })), q = ({
|
|
112
|
+
children: e,
|
|
113
|
+
data: t,
|
|
114
|
+
SectionZone: s,
|
|
115
|
+
className: o
|
|
116
|
+
}) => {
|
|
117
|
+
var m, u;
|
|
118
|
+
const r = ((m = t == null ? void 0 : t.filter((l) => {
|
|
119
|
+
var c, g;
|
|
120
|
+
return ((g = (c = l.config) == null ? void 0 : c.responsive) == null ? void 0 : g.deviceType) === "mobile";
|
|
121
|
+
})[0]) == null ? void 0 : m.sections) || [], a = ((u = t == null ? void 0 : t.filter((l) => {
|
|
122
|
+
var c, g;
|
|
123
|
+
return ((g = (c = l.config) == null ? void 0 : c.responsive) == null ? void 0 : g.deviceType) === "desktop";
|
|
124
|
+
})[0]) == null ? void 0 : u.sections) || [], n = r.slice(0, 1), i = r.slice(1, r.length), d = a.slice(0, 1), f = a.slice(1, a.length);
|
|
125
|
+
return /* @__PURE__ */ v(R, { children: [
|
|
126
|
+
/* @__PURE__ */ v("div", { className: o, children: [
|
|
127
|
+
/* @__PURE__ */ p("div", { className: y["responsive-mobile-flex"], children: /* @__PURE__ */ p(s, { data: n ?? [] }) }),
|
|
128
|
+
/* @__PURE__ */ p("div", { className: y["responsive-desktop-flex"], children: /* @__PURE__ */ p(s, { data: d ?? [] }) })
|
|
129
|
+
] }),
|
|
130
|
+
e,
|
|
131
|
+
/* @__PURE__ */ p("div", { className: y["responsive-mobile-flex"], children: /* @__PURE__ */ p(s, { data: i ?? [] }) }),
|
|
132
|
+
/* @__PURE__ */ p("div", { className: y["responsive-desktop-flex"], children: /* @__PURE__ */ p(s, { data: f ?? [] }) }),
|
|
133
|
+
/* @__PURE__ */ p(w.Divider, {})
|
|
134
|
+
] });
|
|
135
|
+
};
|
|
136
|
+
async function z({ contentType: e, storeId: t, CMS_PROJECT_NAME: s, NextCookies: o }) {
|
|
137
|
+
const r = await I({
|
|
138
|
+
contentType: e,
|
|
139
|
+
storeId: t,
|
|
140
|
+
CMS_PROJECT_NAME: s,
|
|
141
|
+
NextCookies: o
|
|
142
|
+
});
|
|
143
|
+
if (r.status === 200) {
|
|
144
|
+
const a = {
|
|
145
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
146
|
+
contentType: e,
|
|
147
|
+
data: r.data
|
|
148
|
+
};
|
|
149
|
+
console.log("Resultado da chamada:", r);
|
|
150
|
+
const n = `backup-${e}-${Date.now()}.json`;
|
|
151
|
+
return await k.writeFile(
|
|
152
|
+
`./backups/${n}`,
|
|
153
|
+
JSON.stringify(a, null, 2),
|
|
154
|
+
"utf-8"
|
|
155
|
+
), { success: !0, fileName: n };
|
|
156
|
+
}
|
|
157
|
+
return { success: !1, error: r.error || "No data to backup" };
|
|
158
|
+
}
|
|
159
|
+
async function A(e) {
|
|
160
|
+
return z(e);
|
|
161
|
+
}
|
|
162
|
+
async function B({
|
|
163
|
+
contentType: e,
|
|
164
|
+
documentId: t,
|
|
165
|
+
versionId: s,
|
|
166
|
+
storeId: o,
|
|
167
|
+
CMS_PROJECT_NAME: r
|
|
168
|
+
}) {
|
|
169
|
+
const a = t && t.length ? `/${t}` : "", n = s && s.length ? `?versionId=${s}` : "";
|
|
170
|
+
return fetch(
|
|
171
|
+
`https://${o}.myvtex.com/_v/cms/api/${r}/${e}${a}${n}`,
|
|
172
|
+
{ cache: "no-cache" }
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
async function U({
|
|
176
|
+
contentType: e,
|
|
177
|
+
documents: t,
|
|
178
|
+
NextCookies: s,
|
|
179
|
+
previewId: o,
|
|
180
|
+
CMS_PROJECT_NAME: r,
|
|
181
|
+
storeId: a
|
|
182
|
+
}) {
|
|
183
|
+
var i;
|
|
184
|
+
const n = JSON.parse(
|
|
185
|
+
o ?? ((i = s == null ? void 0 : s().get("cms_preview_data")) == null ? void 0 : i.value) ?? "{}"
|
|
186
|
+
);
|
|
187
|
+
if (n && (n == null ? void 0 : n.contentType) === e) {
|
|
188
|
+
const d = n.documentId && n.documentId.length ? `/${n.documentId}` : "", f = n != null && n.versionId && (n != null && n.versionId.length) ? `?versionId=${n == null ? void 0 : n.versionId}` : "", u = await (await fetch(
|
|
189
|
+
`https://${a}.myvtex.com/_v/cms/api/${r}/${e}${d}${f}`,
|
|
190
|
+
{ cache: "no-store" }
|
|
191
|
+
)).json(), l = t.filter(
|
|
192
|
+
(c) => u.id !== c.documentId
|
|
193
|
+
);
|
|
194
|
+
return l.unshift(u), l;
|
|
195
|
+
}
|
|
196
|
+
return t;
|
|
197
|
+
}
|
|
198
|
+
async function I({
|
|
199
|
+
contentType: e,
|
|
200
|
+
NextCookies: t,
|
|
201
|
+
CMS_PROJECT_NAME: s,
|
|
202
|
+
storeId: o,
|
|
203
|
+
previewId: r
|
|
204
|
+
}) {
|
|
205
|
+
var m, u;
|
|
206
|
+
const a = JSON.parse(
|
|
207
|
+
r ?? ((m = t == null ? void 0 : t().get("cms_preview_data")) == null ? void 0 : m.value) ?? "{}"
|
|
208
|
+
), n = [];
|
|
209
|
+
let i = 1, d = 0, f = !0;
|
|
210
|
+
try {
|
|
211
|
+
do {
|
|
212
|
+
const c = await (await fetch(
|
|
213
|
+
`https://${o}.myvtex.com/_v/cms/api/${s}/${e}?page=${i}`
|
|
214
|
+
)).json();
|
|
215
|
+
i === 1 && (d = c.totalItems), (u = c == null ? void 0 : c.data) != null && u.length && n.push(...c.data), f = c.hasNextPage, i++;
|
|
216
|
+
} while (f && n.length < d);
|
|
217
|
+
if (a.previewMode && n.length) {
|
|
218
|
+
const l = await U({
|
|
219
|
+
contentType: e,
|
|
220
|
+
documents: n,
|
|
221
|
+
NextCookies: t,
|
|
222
|
+
CMS_PROJECT_NAME: s,
|
|
223
|
+
storeId: o
|
|
224
|
+
});
|
|
225
|
+
return {
|
|
226
|
+
status: l.length > 0 ? 200 : 404,
|
|
227
|
+
data: l ?? []
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
status: n.length ? 200 : 404,
|
|
232
|
+
data: n
|
|
233
|
+
};
|
|
234
|
+
} catch (l) {
|
|
235
|
+
return { status: "error", data: [], error: l };
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
const G = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
239
|
+
__proto__: null,
|
|
240
|
+
cmsBackup: A,
|
|
241
|
+
getCMSContentType: B,
|
|
242
|
+
getContentType: I
|
|
243
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
244
|
+
export {
|
|
245
|
+
q as S,
|
|
246
|
+
X as _,
|
|
247
|
+
V as a,
|
|
248
|
+
P as b,
|
|
249
|
+
K as c,
|
|
250
|
+
N as d,
|
|
251
|
+
M as e,
|
|
252
|
+
x as f,
|
|
253
|
+
I as g,
|
|
254
|
+
J as h,
|
|
255
|
+
G as i,
|
|
256
|
+
Y as p,
|
|
257
|
+
y as r
|
|
258
|
+
};
|