@soma-vertical-web/multi-lib 0.0.69 → 0.0.71
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/cms/ContentTypes/LPCadastro/LPCadastroContent.d.ts +4 -0
- package/cms/server.d.ts +1 -0
- package/contexts/contexts/header/HeaderCategoryContext.d.ts +7 -0
- package/contexts/contexts/header/MenuMobileContext.d.ts +5 -4
- package/contexts/index.d.ts +2 -2
- package/index.js +16 -16
- package/index.mjs +5250 -5068
- package/index2.js +1 -1
- package/index2.mjs +452 -437
- package/layout/index.d.ts +14 -2
- package/layout/team-component/Form/Composite/Content.d.ts +4 -0
- package/layout/team-component/Form/Composite/FieldGroup.d.ts +7 -0
- package/layout/team-component/Form/Composite/FieldWrapper.d.ts +7 -0
- package/layout/team-component/Form/Composite/FormError.d.ts +4 -0
- package/layout/team-component/Form/Composite/Success.d.ts +4 -0
- package/layout/team-component/Form/Composite/index.d.ts +4 -0
- package/layout/team-component/Form/Form.d.ts +11 -0
- package/layout/team-component/Form/FormContext.d.ts +5 -0
- package/layout/team-component/Form/index.d.ts +1 -0
- package/layout/team-component/Header/Composite/HeaderDesktopWrapper.d.ts +5 -1
- package/layout/team-component/Header/Composite/HeaderMobileWrapper.d.ts +6 -1
- package/layout/team-component/Header/index.d.ts +1 -1
- package/layout/team-component/Menu/Composite/Mobile/Body/Body.d.ts +7 -0
- package/layout/team-component/Menu/Composite/Mobile/Body/Category/Banner.d.ts +7 -0
- package/layout/team-component/Menu/Composite/Mobile/Body/Category/Category.d.ts +7 -0
- package/layout/team-component/Menu/Composite/Mobile/Body/Category/List.d.ts +7 -0
- package/layout/team-component/Menu/Composite/Mobile/Body/Category/SubCategory.d.ts +7 -0
- package/layout/team-component/Menu/Composite/Mobile/Body/Category/Title.d.ts +7 -0
- package/layout/team-component/Menu/Composite/Mobile/Body/Category/index.d.ts +22 -0
- package/layout/team-component/Menu/Composite/Mobile/{Body/SubMenu/SubMenu.d.ts → Header/Header.d.ts} +2 -2
- package/layout/team-component/Menu/Composite/Mobile/MenuRoot.d.ts +4 -7
- package/layout/team-component/Menu/Composite/Mobile/Navigation/{NavigationBarItem.d.ts → BarItem.d.ts} +1 -1
- package/layout/team-component/Menu/MenuMobile.d.ts +7 -8
- package/layout/team-component/UserMenu/Composite/Menu.d.ts +1 -1
- package/layout/team-component/UserMenu/UserMenu.d.ts +1 -1
- package/layout/team-component/UserMenu/index.d.ts +3 -1
- package/layout/template/LPCadastro/index.d.ts +3 -0
- package/package.json +1 -1
- package/style.css +1 -1
- package/types/cms/ContentTypes/Header/index.d.ts +9 -1
- package/types/constants.d.ts +12 -14
- package/types/layout/team-components/Form/index.d.ts +16 -3
- package/types/layout/team-components/Header/index.d.ts +9 -1
- package/types/layout/team-components/Menu/Mobile/Body/Category/index.d.ts +23 -0
- package/types/layout/team-components/Menu/Mobile/Body/index.d.ts +3 -0
- package/types/layout/team-components/Menu/Mobile/index.d.ts +10 -1
- package/types/layout/team-components/UserMenu/index.d.ts +10 -7
- package/types/layout/templates/LPCadastro/index.d.ts +31 -0
- package/Footer-93X9fl_J.mjs +0 -7055
- package/Footer-BjB3blIh.mjs +0 -6956
- package/Footer-By1Gk2Ku.mjs +0 -7050
- package/Footer-COiI-tye.mjs +0 -7049
- package/Footer-CZqTxkCn.js +0 -41
- package/Footer-D3zDoa2N.mjs +0 -6961
- package/Footer-DfAuGt3s.js +0 -41
- package/Footer-TLfR7lta.js +0 -41
- package/Footer-okPVOqRy.js +0 -41
- package/Footer-rMb9FYog.js +0 -41
- package/SearchPageScreening-BIyp1dAW.mjs +0 -112
- package/SearchPageScreening-gO7dG13l.js +0 -1
- package/__vite-browser-external-B8mGO3z6.js +0 -1
- package/__vite-browser-external-BYRIRx8p.mjs +0 -8
- package/__vite-browser-external-C4n7rb1H.mjs +0 -85
- package/__vite-browser-external-Cjz79hOw.js +0 -1
- package/__vite-browser-external-CpdIDx9o.mjs +0 -79
- package/__vite-browser-external-DDWPeg5L.js +0 -1
- package/cms/ContentTypes/CommonPage/index.d.ts +0 -2
- package/cms/ContentTypes/FlagsAndTags/index.d.ts +0 -1
- package/cms/ContentTypes/PLP/PLPContentContext.d.ts +0 -4
- package/cms/ContentTypes/Search/SearchContentScreening.d.ts +0 -3
- package/cms/ContentTypes/index.d.ts +0 -6
- package/data/actions/masterDataServices.d.ts +0 -5
- package/data/api/user/index.d.ts +0 -3
- package/data/helpers/search/policy.d.ts +0 -3
- package/data/helpers/search/product/utils/index.d.ts +0 -8
- package/data/helpers/search/region.d.ts +0 -3
- package/index-ASRiF3PD.js +0 -1
- package/index-BJzBUeMp.js +0 -1
- package/index-BR5lPUsH.js +0 -1
- package/index-BRfMTuMz.mjs +0 -405
- package/index-BYY2x6mQ.js +0 -1
- package/index-Ba7fQCkk.js +0 -1
- package/index-BzNV29ol.mjs +0 -402
- package/index-C3QT-3iu.mjs +0 -355
- package/index-C5zOWvXN.js +0 -1
- package/index-CbOiLJQX.mjs +0 -403
- package/index-CiBRnp7U.js +0 -1
- package/index-CiMxj6Pg.mjs +0 -412
- package/index-CkcBCfzG.js +0 -1
- package/index-CuKKHhKx.mjs +0 -355
- package/index-D3ONVIla.mjs +0 -412
- package/index-DD12Nl4r.mjs +0 -412
- package/index-DJR4CcKO.mjs +0 -398
- package/index-DJeLEsRl.js +0 -1
- package/index-DKnolQoT.mjs +0 -412
- package/index-DYpuW0tu.mjs +0 -354
- package/index-D__YfUie.js +0 -1
- package/index-DfnS9D5I.mjs +0 -354
- package/index-Do5eAlCL.mjs +0 -219
- package/index-VkanwPXK.mjs +0 -221
- package/index-WV5Gjz3i.js +0 -1
- package/index-catAI5a3.mjs +0 -258
- package/index-drKDwA8_.js +0 -1
- package/layout/team-component/Menu/Composite/Mobile/Body/MenuBody.d.ts +0 -7
- package/layout/team-component/Menu/Composite/Mobile/Body/MenuCategories.d.ts +0 -7
- package/layout/team-component/Menu/Composite/Mobile/Body/MenuCategoriesWrapper.d.ts +0 -7
- package/layout/team-component/Menu/Composite/Mobile/Body/SubMenu/SubMenuItem.d.ts +0 -7
- package/layout/team-component/Menu/Composite/Mobile/Body/SubMenu/SubMenuSubCategory.d.ts +0 -7
- package/layout/team-component/Menu/Composite/Mobile/Header/MenuHeaderContainer.d.ts +0 -5
- package/layout/team-component/Menu/Composite/Mobile/Header/MenuHeaderNavLinks.d.ts +0 -7
- package/layout/team-component/Menu/Composite/Mobile/Header/MenuHeaderWrapper.d.ts +0 -7
- package/types/data/actions/index.d.ts +0 -27
- package/types/layout/team-components/PDCNavigation/intex.d.ts +0 -9
- package/types/layout/team-components/ProductList/Composite/Card/index.d.ts +0 -9
- package/types/utils.d.ts +0 -3
- /package/layout/team-component/Menu/Composite/Mobile/Navigation/{NavigationBar.d.ts → Bar.d.ts} +0 -0
package/index-DfnS9D5I.mjs
DELETED
|
@@ -1,354 +0,0 @@
|
|
|
1
|
-
import { jsxs as y, Fragment as w, jsx as f } from "react/jsx-runtime";
|
|
2
|
-
import { Utils as N } from "@soma-vertical-web/core-components";
|
|
3
|
-
const h = (e, t = !0) => Intl.NumberFormat("pt-BR", {
|
|
4
|
-
style: "currency",
|
|
5
|
-
currency: "BRL",
|
|
6
|
-
minimumFractionDigits: t ? 2 : 0
|
|
7
|
-
}).format(e), O = ({ valueInCents: e, hasFree: t, freeTaxMessage: n }) => e === 0 ? t ? n : h(0) : h(e / 100), I = (e, t) => {
|
|
8
|
-
const [n, s] = e.split(t);
|
|
9
|
-
return { name: n.trim(), size: s ? s.trim() : "" };
|
|
10
|
-
}, P = (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
|
-
}, R = (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
|
-
}, F = (e, t) => e.replace(t, "").trim(), z = (e) => e.replace(/\//g, ""), C = ({ 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 = (r, i) => {
|
|
30
|
-
var m;
|
|
31
|
-
i && (i.sellerId = r.sellerId, i.sellerName = r.sellerName, i.available = !0, i.isSellerDefault = r.sellerDefault);
|
|
32
|
-
const {
|
|
33
|
-
Price: c,
|
|
34
|
-
ListPrice: p,
|
|
35
|
-
PaymentOptions: { installmentOptions: d }
|
|
36
|
-
} = r.commertialOffer;
|
|
37
|
-
n.price = c, n.listPrice = p;
|
|
38
|
-
const l = (m = d == null ? void 0 : d[0]) == null ? void 0 : m.installments;
|
|
39
|
-
if (l) {
|
|
40
|
-
const { count: u, value: g } = l[l.length - 1];
|
|
41
|
-
n.installments = {
|
|
42
|
-
count: u,
|
|
43
|
-
value: g / 100
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
let a = !0;
|
|
48
|
-
const o = e.reduce((r, i) => {
|
|
49
|
-
var d;
|
|
50
|
-
const c = {
|
|
51
|
-
name: i.name,
|
|
52
|
-
sku: i.itemId,
|
|
53
|
-
value: ((d = i.Tamanho) == null ? void 0 : d[0]) ?? I(i.nameComplete ?? i.name, t).size,
|
|
54
|
-
available: !1,
|
|
55
|
-
sellerId: "",
|
|
56
|
-
sellerName: "",
|
|
57
|
-
isSellerDefault: !1
|
|
58
|
-
}, p = i.sellers.filter((l) => (l.sellerDefault && l.commertialOffer.IsAvailable && (c.available = !0, s(l, c)), l.commertialOffer.IsAvailable));
|
|
59
|
-
return !c.isSellerDefault && p.length > 0 && (c.available = !0, s(p[0], {
|
|
60
|
-
...c,
|
|
61
|
-
sellerId: p[0].sellerId,
|
|
62
|
-
sellerName: p[0].sellerName
|
|
63
|
-
})), c.available === !1 && (a = !1), r.push(c), r;
|
|
64
|
-
}, []);
|
|
65
|
-
return {
|
|
66
|
-
...n,
|
|
67
|
-
sizes: o,
|
|
68
|
-
allSizesAvailable: a
|
|
69
|
-
};
|
|
70
|
-
}, j = (e) => e ? !e.offers.offers.find(({ quantity: t = 0 }) => t > 0) : !1, T = (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
|
-
}, A = ({ images: e, TEXTURE_IMAGE: t }) => e.find((n) => t.includes(n.imageLabel)) ?? e[0], D = (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
|
-
}, B = (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
|
-
}, x = ({
|
|
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[0]] : 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
|
-
}, ee = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
105
|
-
__proto__: null,
|
|
106
|
-
disableSKU: j,
|
|
107
|
-
formatPriceToCurrency: h,
|
|
108
|
-
freightParsePrice: O,
|
|
109
|
-
getAspectRatio: E,
|
|
110
|
-
getColorAndSizeFromSkuName: P,
|
|
111
|
-
getFirstImages: x,
|
|
112
|
-
getProductNameWithoutSku: F,
|
|
113
|
-
getSKUName: R,
|
|
114
|
-
getSkuInfos: C,
|
|
115
|
-
getThumbImage: A,
|
|
116
|
-
getValidOffer: T,
|
|
117
|
-
removeSlashes: z,
|
|
118
|
-
resizingImg: D,
|
|
119
|
-
setVideoPlay: L,
|
|
120
|
-
splitNameAndSizeFromFullName: I,
|
|
121
|
-
updatedResizedImg: B
|
|
122
|
-
}, Symbol.toStringTag, { value: "Module" })), b = "fuzzy", _ = "operator", U = (e) => ({
|
|
123
|
-
isDepartment: e != null && e.length ? e[0].key === "category-1" : !1
|
|
124
|
-
}), te = (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 a = s.values;
|
|
129
|
-
return {
|
|
130
|
-
...s,
|
|
131
|
-
values: a.filter(
|
|
132
|
-
(o) => !n.find(
|
|
133
|
-
(r) => r.toLowerCase() === o.value || r.toLowerCase() === o.name.toLowerCase()
|
|
134
|
-
)
|
|
135
|
-
)
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
return s;
|
|
139
|
-
});
|
|
140
|
-
}, S = (e, t) => t ? e === "category-1" : !1, M = (e) => e.key === "operator" && (e.value === "and" || e.value === "or"), q = (e) => e.type === "TEXT", K = (e) => e.key === "fuzzy" && (e.value === "0" || e.value === "1" || e.value === "auto"), V = (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((a, o) => a.name.localeCompare(o.name))
|
|
147
|
-
};
|
|
148
|
-
}, Y = ({ key: e, values: t }) => ({
|
|
149
|
-
__typename: "FacetRange",
|
|
150
|
-
key: e,
|
|
151
|
-
values: t
|
|
152
|
-
}), ne = (e, t, n) => {
|
|
153
|
-
if (!(e instanceof Object) || !("facets" in e))
|
|
154
|
-
return [];
|
|
155
|
-
const { facets: s = [] } = e, a = t != null && t.length ? t[0].key === "category-1" : !1;
|
|
156
|
-
return s.filter(
|
|
157
|
-
(r) => !n || !S(r.key, a)
|
|
158
|
-
).map(
|
|
159
|
-
(r) => q(r) ? V(r) : Y(r)
|
|
160
|
-
);
|
|
161
|
-
}, se = (e, t) => {
|
|
162
|
-
const n = e.find(({ key: a }) => a === b) ?? null, s = e.find(({ key: a }) => a === _) ?? null;
|
|
163
|
-
n && K(n) && t.append(b, n.value), s && M(s) && t.append(_, s.value);
|
|
164
|
-
}, J = (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: a } = U(s);
|
|
172
|
-
return s == null ? void 0 : s.filter((o) => !S(o.key, a));
|
|
173
|
-
}, ae = ({ pathname: e, searchParams: t }, n) => {
|
|
174
|
-
const s = t.get("sort") ?? "", a = t.get("query") ?? null, o = parseInt(t.get("page") ?? "1", 10);
|
|
175
|
-
return {
|
|
176
|
-
sort: s,
|
|
177
|
-
facets: J(n),
|
|
178
|
-
term: a,
|
|
179
|
-
base: a ? "" : e,
|
|
180
|
-
page: o
|
|
181
|
-
};
|
|
182
|
-
}, oe = (e) => {
|
|
183
|
-
const t = new URLSearchParams();
|
|
184
|
-
return Object.entries(e).forEach(([n, s]) => {
|
|
185
|
-
Array.isArray(s) ? s.forEach((a) => t.append(n, a)) : s !== void 0 && t.append(n, s);
|
|
186
|
-
}), t;
|
|
187
|
-
}, v = {
|
|
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
|
-
}, $ = {}, ie = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
193
|
-
__proto__: null,
|
|
194
|
-
default: $
|
|
195
|
-
}, Symbol.toStringTag, { value: "Module" })), le = ({
|
|
196
|
-
children: e,
|
|
197
|
-
data: t,
|
|
198
|
-
SectionZone: n,
|
|
199
|
-
className: s
|
|
200
|
-
}) => {
|
|
201
|
-
var d, l;
|
|
202
|
-
const a = ((d = t == null ? void 0 : t.filter((m) => {
|
|
203
|
-
var u, g;
|
|
204
|
-
return ((g = (u = m.config) == null ? void 0 : u.responsive) == null ? void 0 : g.deviceType) === "mobile";
|
|
205
|
-
})[0]) == null ? void 0 : d.sections) || [], o = ((l = t == null ? void 0 : t.filter((m) => {
|
|
206
|
-
var u, g;
|
|
207
|
-
return ((g = (u = m.config) == null ? void 0 : u.responsive) == null ? void 0 : g.deviceType) === "desktop";
|
|
208
|
-
})[0]) == null ? void 0 : l.sections) || [], r = a.slice(0, 1), i = a.slice(1, a.length), c = o.slice(0, 1), p = o.slice(1, o.length);
|
|
209
|
-
return /* @__PURE__ */ y(w, { children: [
|
|
210
|
-
/* @__PURE__ */ y("div", { className: s, children: [
|
|
211
|
-
/* @__PURE__ */ f("div", { className: v["responsive-mobile-flex"], children: /* @__PURE__ */ f(n, { data: r ?? [] }) }),
|
|
212
|
-
/* @__PURE__ */ f("div", { className: v["responsive-desktop-flex"], children: /* @__PURE__ */ f(n, { data: c ?? [] }) })
|
|
213
|
-
] }),
|
|
214
|
-
e,
|
|
215
|
-
/* @__PURE__ */ f("div", { className: v["responsive-mobile-flex"], children: /* @__PURE__ */ f(n, { data: i ?? [] }) }),
|
|
216
|
-
/* @__PURE__ */ f("div", { className: v["responsive-desktop-flex"], children: /* @__PURE__ */ f(n, { data: p ?? [] }) }),
|
|
217
|
-
/* @__PURE__ */ f(N.Divider, {})
|
|
218
|
-
] });
|
|
219
|
-
};
|
|
220
|
-
async function W({ contentType: e, storeId: t, CMS_PROJECT_NAME: n, NextCookies: s }) {
|
|
221
|
-
const a = await k({
|
|
222
|
-
contentType: e,
|
|
223
|
-
storeId: t,
|
|
224
|
-
CMS_PROJECT_NAME: n,
|
|
225
|
-
NextCookies: s
|
|
226
|
-
});
|
|
227
|
-
if (a.status === 200) {
|
|
228
|
-
const o = {
|
|
229
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
230
|
-
contentType: e,
|
|
231
|
-
data: a.data
|
|
232
|
-
};
|
|
233
|
-
console.log("Resultado da chamada:", a);
|
|
234
|
-
const r = `backup-${e}-${Date.now()}.json`;
|
|
235
|
-
return await $.writeFile(
|
|
236
|
-
`./backups/${r}`,
|
|
237
|
-
JSON.stringify(o, null, 2),
|
|
238
|
-
"utf-8"
|
|
239
|
-
), { success: !0, fileName: r };
|
|
240
|
-
}
|
|
241
|
-
return { success: !1, error: a.error || "No data to backup" };
|
|
242
|
-
}
|
|
243
|
-
async function G(e) {
|
|
244
|
-
return W(e);
|
|
245
|
-
}
|
|
246
|
-
async function H({
|
|
247
|
-
contentType: e,
|
|
248
|
-
documentId: t,
|
|
249
|
-
versionId: n,
|
|
250
|
-
storeId: s,
|
|
251
|
-
CMS_PROJECT_NAME: a
|
|
252
|
-
}) {
|
|
253
|
-
const o = t && t.length ? `/${t}` : "", r = n && n.length ? `?versionId=${n}` : "";
|
|
254
|
-
return fetch(
|
|
255
|
-
`https://${s}.myvtex.com/_v/cms/api/${a}/${e}${o}${r}`,
|
|
256
|
-
{ cache: "no-cache" }
|
|
257
|
-
);
|
|
258
|
-
}
|
|
259
|
-
async function X({
|
|
260
|
-
contentType: e,
|
|
261
|
-
documents: t,
|
|
262
|
-
NextCookies: n,
|
|
263
|
-
previewId: s,
|
|
264
|
-
CMS_PROJECT_NAME: a,
|
|
265
|
-
storeId: o
|
|
266
|
-
}) {
|
|
267
|
-
var i;
|
|
268
|
-
const r = JSON.parse(
|
|
269
|
-
s ?? ((i = n == null ? void 0 : n().get("cms_preview_data")) == null ? void 0 : i.value) ?? "{}"
|
|
270
|
-
);
|
|
271
|
-
if (r && (r == null ? void 0 : r.contentType) === e) {
|
|
272
|
-
const c = r.documentId && r.documentId.length ? `/${r.documentId}` : "", p = r != null && r.versionId && (r != null && r.versionId.length) ? `?versionId=${r == null ? void 0 : r.versionId}` : "", l = await (await fetch(
|
|
273
|
-
`https://${o}.myvtex.com/_v/cms/api/${a}/${e}${c}${p}`,
|
|
274
|
-
{ cache: "no-store" }
|
|
275
|
-
)).json(), m = t.filter(
|
|
276
|
-
(u) => l.id !== u.documentId
|
|
277
|
-
);
|
|
278
|
-
return m.unshift(l), m;
|
|
279
|
-
}
|
|
280
|
-
return t;
|
|
281
|
-
}
|
|
282
|
-
async function k({
|
|
283
|
-
contentType: e,
|
|
284
|
-
NextCookies: t,
|
|
285
|
-
CMS_PROJECT_NAME: n,
|
|
286
|
-
storeId: s,
|
|
287
|
-
previewId: a
|
|
288
|
-
}) {
|
|
289
|
-
var d, l;
|
|
290
|
-
const o = JSON.parse(
|
|
291
|
-
a ?? ((d = t == null ? void 0 : t().get("cms_preview_data")) == null ? void 0 : d.value) ?? "{}"
|
|
292
|
-
), r = [];
|
|
293
|
-
let i = 1, c = 0, p = !0;
|
|
294
|
-
try {
|
|
295
|
-
do {
|
|
296
|
-
const u = await (await fetch(
|
|
297
|
-
`https://${s}.myvtex.com/_v/cms/api/${n}/${e}?page=${i}`
|
|
298
|
-
)).json();
|
|
299
|
-
i === 1 && (c = u.totalItems), (l = u == null ? void 0 : u.data) != null && l.length && r.push(...u.data), p = u.hasNextPage, i++;
|
|
300
|
-
} while (p && r.length < c);
|
|
301
|
-
if (o.previewMode && r.length) {
|
|
302
|
-
const m = await X({
|
|
303
|
-
contentType: e,
|
|
304
|
-
documents: r,
|
|
305
|
-
NextCookies: t,
|
|
306
|
-
CMS_PROJECT_NAME: n,
|
|
307
|
-
storeId: s
|
|
308
|
-
});
|
|
309
|
-
return {
|
|
310
|
-
status: m.length > 0 ? 200 : 404,
|
|
311
|
-
data: m ?? []
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
return {
|
|
315
|
-
status: r.length ? 200 : 404,
|
|
316
|
-
data: r
|
|
317
|
-
};
|
|
318
|
-
} catch (m) {
|
|
319
|
-
return { status: "error", data: [], error: m };
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
const ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
323
|
-
__proto__: null,
|
|
324
|
-
cmsBackup: G,
|
|
325
|
-
getCMSContentType: H,
|
|
326
|
-
getContentType: k
|
|
327
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
328
|
-
export {
|
|
329
|
-
le as S,
|
|
330
|
-
ie as _,
|
|
331
|
-
C as a,
|
|
332
|
-
A as b,
|
|
333
|
-
oe as c,
|
|
334
|
-
R as d,
|
|
335
|
-
j as e,
|
|
336
|
-
ee as f,
|
|
337
|
-
P as g,
|
|
338
|
-
h,
|
|
339
|
-
O as i,
|
|
340
|
-
T as j,
|
|
341
|
-
x as k,
|
|
342
|
-
L as l,
|
|
343
|
-
D as m,
|
|
344
|
-
k as n,
|
|
345
|
-
se as o,
|
|
346
|
-
ae as p,
|
|
347
|
-
ne as q,
|
|
348
|
-
v as r,
|
|
349
|
-
I as s,
|
|
350
|
-
te as t,
|
|
351
|
-
B as u,
|
|
352
|
-
re as v,
|
|
353
|
-
ce as w
|
|
354
|
-
};
|
package/index-Do5eAlCL.mjs
DELETED
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
import { jsxs as y, Fragment as C, jsx as l } from "react/jsx-runtime";
|
|
2
|
-
import { Utils as I } from "@soma-vertical-web/core-components";
|
|
3
|
-
const h = "fuzzy", b = "operator", x = (e) => ({
|
|
4
|
-
isDepartment: e != null && e.length ? e[0].key === "category-1" : !1
|
|
5
|
-
}), E = (e, t) => {
|
|
6
|
-
const s = decodeURIComponent(t ?? "").slice(1).split("/");
|
|
7
|
-
return e.map((n) => {
|
|
8
|
-
if (n.key === "category-2" && n.__typename === "FacetBoolean") {
|
|
9
|
-
const r = n.values;
|
|
10
|
-
return {
|
|
11
|
-
...n,
|
|
12
|
-
values: r.filter(
|
|
13
|
-
(o) => !s.find(
|
|
14
|
-
(a) => a.toLowerCase() === o.value || a.toLowerCase() === o.name.toLowerCase()
|
|
15
|
-
)
|
|
16
|
-
)
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
return n;
|
|
20
|
-
});
|
|
21
|
-
}, _ = (e, t) => t ? e === "category-1" : !1, S = (e) => e.key === "operator" && (e.value === "and" || e.value === "or"), w = (e) => e.type === "TEXT", O = (e) => e.key === "fuzzy" && (e.value === "0" || e.value === "1" || e.value === "auto"), N = (e) => {
|
|
22
|
-
const { key: t, name: s, values: n } = e;
|
|
23
|
-
return {
|
|
24
|
-
__typename: "FacetBoolean",
|
|
25
|
-
key: t,
|
|
26
|
-
label: s,
|
|
27
|
-
values: n.slice().sort((r, o) => r.name.localeCompare(o.name))
|
|
28
|
-
};
|
|
29
|
-
}, R = ({ key: e, values: t }) => ({
|
|
30
|
-
__typename: "FacetRange",
|
|
31
|
-
key: e,
|
|
32
|
-
values: t
|
|
33
|
-
}), M = (e, t, s) => {
|
|
34
|
-
if (!(e instanceof Object) || !("facets" in e))
|
|
35
|
-
return [];
|
|
36
|
-
const { facets: n = [] } = e, r = t != null && t.length ? t[0].key === "category-1" : !1;
|
|
37
|
-
return n.filter(
|
|
38
|
-
(a) => !s || !_(a.key, r)
|
|
39
|
-
).map(
|
|
40
|
-
(a) => w(a) ? N(a) : R(a)
|
|
41
|
-
);
|
|
42
|
-
}, L = (e, t) => {
|
|
43
|
-
const s = e.find(({ key: r }) => r === h) ?? null, n = e.find(({ key: r }) => r === b) ?? null;
|
|
44
|
-
s && O(s) && t.append(h, s.value), n && S(n) && t.append(b, n.value);
|
|
45
|
-
}, j = (e) => e.map((t) => {
|
|
46
|
-
const [s, n] = t.split("/");
|
|
47
|
-
return { key: s, value: n };
|
|
48
|
-
}), Y = (e, t) => {
|
|
49
|
-
const s = decodeURIComponent(t ?? "").slice(1).split("/"), n = e.filter(({ value: o }) => !s.includes(decodeURIComponent(o))).map((o) => ({
|
|
50
|
-
...o,
|
|
51
|
-
value: decodeURIComponent(o.value)
|
|
52
|
-
})), { isDepartment: r } = x(n);
|
|
53
|
-
return n == null ? void 0 : n.filter((o) => !_(o.key, r));
|
|
54
|
-
}, A = ({ pathname: e, searchParams: t }, s) => {
|
|
55
|
-
const n = t.get("sort") ?? "", r = t.get("query") ?? null, o = parseInt(t.get("page") ?? "1", 10);
|
|
56
|
-
return {
|
|
57
|
-
sort: n,
|
|
58
|
-
facets: j(s),
|
|
59
|
-
term: r,
|
|
60
|
-
base: r ? "" : e,
|
|
61
|
-
page: o
|
|
62
|
-
};
|
|
63
|
-
}, J = (e) => {
|
|
64
|
-
const t = new URLSearchParams();
|
|
65
|
-
return Object.entries(e).forEach(([s, n]) => {
|
|
66
|
-
Array.isArray(n) ? n.forEach((r) => t.append(s, r)) : n !== void 0 && t.append(s, n);
|
|
67
|
-
}), t;
|
|
68
|
-
}, v = {
|
|
69
|
-
"responsive-mobile-flex": "_responsive-mobile-flex_t5bry_2",
|
|
70
|
-
"responsive-desktop-flex": "_responsive-desktop-flex_t5bry_13",
|
|
71
|
-
"responsive-mobile-block": "_responsive-mobile-block_t5bry_24",
|
|
72
|
-
"responsive-desktop-block": "_responsive-desktop-block_t5bry_35"
|
|
73
|
-
}, k = {}, K = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
74
|
-
__proto__: null,
|
|
75
|
-
default: k
|
|
76
|
-
}, Symbol.toStringTag, { value: "Module" })), V = ({
|
|
77
|
-
children: e,
|
|
78
|
-
data: t,
|
|
79
|
-
SectionZone: s,
|
|
80
|
-
className: n
|
|
81
|
-
}) => {
|
|
82
|
-
var p, i;
|
|
83
|
-
const r = ((p = t == null ? void 0 : t.filter((c) => {
|
|
84
|
-
var f, g;
|
|
85
|
-
return ((g = (f = c.config) == null ? void 0 : f.responsive) == null ? void 0 : g.deviceType) === "mobile";
|
|
86
|
-
})[0]) == null ? void 0 : p.sections) || [], o = ((i = t == null ? void 0 : t.filter((c) => {
|
|
87
|
-
var f, g;
|
|
88
|
-
return ((g = (f = c.config) == null ? void 0 : f.responsive) == null ? void 0 : g.deviceType) === "desktop";
|
|
89
|
-
})[0]) == null ? void 0 : i.sections) || [], a = r.slice(0, 1), u = r.slice(1, r.length), d = o.slice(0, 1), m = o.slice(1, o.length);
|
|
90
|
-
return /* @__PURE__ */ y(C, { children: [
|
|
91
|
-
/* @__PURE__ */ y("div", { className: n, children: [
|
|
92
|
-
/* @__PURE__ */ l("div", { className: v["responsive-mobile-flex"], children: /* @__PURE__ */ l(s, { data: a ?? [] }) }),
|
|
93
|
-
/* @__PURE__ */ l("div", { className: v["responsive-desktop-flex"], children: /* @__PURE__ */ l(s, { data: d ?? [] }) })
|
|
94
|
-
] }),
|
|
95
|
-
e,
|
|
96
|
-
/* @__PURE__ */ l("div", { className: v["responsive-mobile-flex"], children: /* @__PURE__ */ l(s, { data: u ?? [] }) }),
|
|
97
|
-
/* @__PURE__ */ l("div", { className: v["responsive-desktop-flex"], children: /* @__PURE__ */ l(s, { data: m ?? [] }) }),
|
|
98
|
-
/* @__PURE__ */ l(I.Divider, {})
|
|
99
|
-
] });
|
|
100
|
-
};
|
|
101
|
-
async function z({ contentType: e, storeId: t, CMS_PROJECT_NAME: s, NextCookies: n }) {
|
|
102
|
-
const r = await $({
|
|
103
|
-
contentType: e,
|
|
104
|
-
storeId: t,
|
|
105
|
-
CMS_PROJECT_NAME: s,
|
|
106
|
-
NextCookies: n
|
|
107
|
-
});
|
|
108
|
-
if (r.status === 200) {
|
|
109
|
-
const o = {
|
|
110
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
111
|
-
contentType: e,
|
|
112
|
-
data: r.data
|
|
113
|
-
};
|
|
114
|
-
console.log("Resultado da chamada:", r);
|
|
115
|
-
const a = `backup-${e}-${Date.now()}.json`;
|
|
116
|
-
return await k.writeFile(
|
|
117
|
-
`./backups/${a}`,
|
|
118
|
-
JSON.stringify(o, null, 2),
|
|
119
|
-
"utf-8"
|
|
120
|
-
), { success: !0, fileName: a };
|
|
121
|
-
}
|
|
122
|
-
return { success: !1, error: r.error || "No data to backup" };
|
|
123
|
-
}
|
|
124
|
-
async function F(e) {
|
|
125
|
-
return z(e);
|
|
126
|
-
}
|
|
127
|
-
async function B({
|
|
128
|
-
contentType: e,
|
|
129
|
-
documentId: t,
|
|
130
|
-
versionId: s,
|
|
131
|
-
storeId: n,
|
|
132
|
-
CMS_PROJECT_NAME: r
|
|
133
|
-
}) {
|
|
134
|
-
const o = t && t.length ? `/${t}` : "", a = s && s.length ? `?versionId=${s}` : "";
|
|
135
|
-
return fetch(
|
|
136
|
-
`https://${n}.myvtex.com/_v/cms/api/${r}/${e}${o}${a}`,
|
|
137
|
-
{ cache: "no-cache" }
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
async function T({
|
|
141
|
-
contentType: e,
|
|
142
|
-
documents: t,
|
|
143
|
-
NextCookies: s,
|
|
144
|
-
CMS_PROJECT_NAME: n,
|
|
145
|
-
storeId: r
|
|
146
|
-
}) {
|
|
147
|
-
var a;
|
|
148
|
-
const o = JSON.parse(
|
|
149
|
-
((a = s().get("cms_preview_data")) == null ? void 0 : a.value) ?? "{}"
|
|
150
|
-
);
|
|
151
|
-
if (o && (o == null ? void 0 : o.contentType) === e) {
|
|
152
|
-
const u = o.documentId && o.documentId.length ? `/${o.documentId}` : "", d = o != null && o.versionId && (o != null && o.versionId.length) ? `?versionId=${o == null ? void 0 : o.versionId}` : "", p = await (await fetch(
|
|
153
|
-
`https://${r}.myvtex.com/_v/cms/api/${n}/${e}${u}${d}`,
|
|
154
|
-
{ cache: "no-store" }
|
|
155
|
-
)).json(), i = t.filter(
|
|
156
|
-
(c) => p.id !== c.documentId
|
|
157
|
-
);
|
|
158
|
-
return i.unshift(p), i;
|
|
159
|
-
}
|
|
160
|
-
return t;
|
|
161
|
-
}
|
|
162
|
-
async function $({
|
|
163
|
-
contentType: e,
|
|
164
|
-
NextCookies: t,
|
|
165
|
-
CMS_PROJECT_NAME: s,
|
|
166
|
-
storeId: n
|
|
167
|
-
}) {
|
|
168
|
-
var m, p;
|
|
169
|
-
const r = JSON.parse(
|
|
170
|
-
((m = t().get("cms_preview_data")) == null ? void 0 : m.value) ?? "{}"
|
|
171
|
-
), o = [];
|
|
172
|
-
let a = 1, u = 0, d = !0;
|
|
173
|
-
try {
|
|
174
|
-
do {
|
|
175
|
-
const c = await (await fetch(
|
|
176
|
-
`https://${n}.myvtex.com/_v/cms/api/${s}/${e}?page=${a}`
|
|
177
|
-
)).json();
|
|
178
|
-
a === 1 && (u = c.totalItems), (p = c == null ? void 0 : c.data) != null && p.length && o.push(...c.data), d = c.hasNextPage, a++;
|
|
179
|
-
} while (d && o.length < u);
|
|
180
|
-
if (r.previewMode && o.length) {
|
|
181
|
-
const i = await T({
|
|
182
|
-
contentType: e,
|
|
183
|
-
documents: o,
|
|
184
|
-
NextCookies: t,
|
|
185
|
-
CMS_PROJECT_NAME: s,
|
|
186
|
-
storeId: n
|
|
187
|
-
});
|
|
188
|
-
return {
|
|
189
|
-
status: i.length > 0 ? 200 : 404,
|
|
190
|
-
data: i ?? []
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
return {
|
|
194
|
-
status: o.length ? 200 : 404,
|
|
195
|
-
data: o
|
|
196
|
-
};
|
|
197
|
-
} catch (i) {
|
|
198
|
-
return { status: "error", data: [], error: i };
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
const q = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
202
|
-
__proto__: null,
|
|
203
|
-
cmsBackup: F,
|
|
204
|
-
getCMSContentType: B,
|
|
205
|
-
getContentType: $
|
|
206
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
207
|
-
export {
|
|
208
|
-
V as S,
|
|
209
|
-
K as _,
|
|
210
|
-
L as a,
|
|
211
|
-
E as b,
|
|
212
|
-
J as c,
|
|
213
|
-
Y as d,
|
|
214
|
-
q as e,
|
|
215
|
-
M as f,
|
|
216
|
-
$ as g,
|
|
217
|
-
A as p,
|
|
218
|
-
v as r
|
|
219
|
-
};
|