@soma-vertical-web/multi-lib 0.0.20 → 0.0.22
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/index.d.ts +1 -1
- package/contexts/contexts/header/TipBarContext.d.ts +6 -0
- package/data/api/cms/index.d.ts +11 -0
- package/data/index.d.ts +0 -7
- package/index-B8dtKJc0.mjs +68 -0
- package/index-BArDD1Jh.mjs +68 -0
- package/index-BK5yScKK.js +1 -0
- package/index-BcniWgv2.mjs +68 -0
- package/index-C3_oOo51.js +1 -0
- package/index-CHaVlwnS.js +1 -0
- package/index-Dq-m7diJ.mjs +68 -0
- package/index-lWJI65gt.js +1 -0
- package/index.js +4 -4
- package/index.mjs +2924 -2603
- package/index2.js +1 -1
- package/index2.mjs +73 -2
- package/layout/index.d.ts +8 -0
- package/layout/team-component/BuyPackage/BuyPackage.d.ts +4 -0
- package/layout/team-component/BuyPackage/Composite/GroupCart.d.ts +4 -0
- package/layout/team-component/BuyPackage/Composite/Header.d.ts +4 -0
- package/layout/team-component/BuyPackage/helpers.d.ts +5 -0
- package/layout/team-component/BuyPackage/index.d.ts +1 -0
- package/layout/team-component/Timer/index.d.ts +4 -0
- package/layout/team-component/TipBar/Composite/Fields/CountDown.d.ts +3 -0
- package/layout/team-component/TipBar/Composite/Fields/Coupon.d.ts +3 -0
- package/layout/team-component/TipBar/Composite/Fields/FieldsScreening.d.ts +3 -0
- package/layout/team-component/TipBar/Composite/Fields/TextContent.d.ts +3 -0
- package/layout/team-component/TipBar/Composite/Root.d.ts +5 -0
- package/layout/team-component/TipBar/Composite/Structure/Carousel.d.ts +9 -0
- package/layout/team-component/TipBar/Composite/Structure/Container.d.ts +3 -0
- package/layout/team-component/TipBar/Composite/Structure/Item.d.ts +3 -0
- package/layout/team-component/TipBar/Composite/Support/CloseBtn.d.ts +3 -0
- package/layout/team-component/TipBar/index.d.ts +7 -0
- package/layout/utils/ProductShelf/Composite/Card.d.ts +7 -0
- package/layout/utils/ProductShelf/Composite/Shelf.d.ts +4 -0
- package/layout/utils/ProductShelf/Composite/Title.d.ts +4 -0
- package/layout/utils/ProductShelf/index.d.ts +8 -0
- package/layout/utils/SnackBar/index.d.ts +7 -0
- package/package.json +1 -1
- package/server.d.ts +9 -1
- package/style.css +1 -1
- package/types/cms/api/index.d.ts +5 -11
- package/types/constants.d.ts +39 -5
- package/types/contexts/contexts/header.d.ts +25 -1
- package/types/layout/team-components/BuyPackage/index.d.ts +29 -0
- package/types/layout/team-components/ProductCard/Selectors/index.d.ts +2 -2
- package/types/layout/team-components/ProductCard/index.d.ts +2 -2
- package/types/layout/team-components/Timer/index.d.ts +8 -0
- package/types/layout/team-components/TipBar/index.d.ts +57 -0
- package/types/layout/utils/index.d.ts +23 -1
package/cms/index.d.ts
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TipBarContextProps, TipBarProviderProps } from '../../../types/contexts/contexts/header';
|
|
2
|
+
|
|
3
|
+
declare const TipBarContext: import('react').Context<TipBarContextProps>;
|
|
4
|
+
declare const TipBarProvider: ({ data, children, ...rest }: TipBarProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare const useTipBarContext: () => TipBarContextProps;
|
|
6
|
+
export { TipBarContext, TipBarProvider, useTipBarContext };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GetContentTypeProps } from '../../../types/cms/api';
|
|
2
|
+
|
|
3
|
+
export declare function getContentType<T>({ contentType, NextCookies, CMS_PROJECT_NAME, storeId, }: GetContentTypeProps): Promise<{
|
|
4
|
+
status: number;
|
|
5
|
+
data: T[];
|
|
6
|
+
error?: undefined;
|
|
7
|
+
} | {
|
|
8
|
+
status: string;
|
|
9
|
+
data: never[];
|
|
10
|
+
error: unknown;
|
|
11
|
+
}>;
|
package/data/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { freightSimulation } from './api/checkout/simulation';
|
|
2
|
-
|
|
3
1
|
import * as cart from "./helpers/cart";
|
|
4
2
|
import * as events from "./helpers/events";
|
|
5
3
|
import * as product from "./helpers/product";
|
|
@@ -11,9 +9,4 @@ export declare const data: {
|
|
|
11
9
|
product: typeof product;
|
|
12
10
|
utils: typeof utils;
|
|
13
11
|
};
|
|
14
|
-
api: {
|
|
15
|
-
checkout: {
|
|
16
|
-
freightSimulation: typeof freightSimulation;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
12
|
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
async function g({
|
|
2
|
+
contentType: a,
|
|
3
|
+
documents: s,
|
|
4
|
+
cookies: c,
|
|
5
|
+
CMS_PROJECT_NAME: d,
|
|
6
|
+
storeId: i
|
|
7
|
+
}) {
|
|
8
|
+
var o;
|
|
9
|
+
const t = JSON.parse(
|
|
10
|
+
((o = c().get("cms_preview_data")) == null ? void 0 : o.value) ?? "{}"
|
|
11
|
+
);
|
|
12
|
+
if (t && (t == null ? void 0 : t.contentType) === a) {
|
|
13
|
+
const u = t.documentId && t.documentId.length ? `/${t.documentId}` : "", l = t != null && t.versionId && (t != null && t.versionId.length) ? `?versionId=${t == null ? void 0 : t.versionId}` : "", r = await (await fetch(
|
|
14
|
+
`https://${i}.myvtex.com/_v/cms/api/${d}/${a}${u}${l}`,
|
|
15
|
+
{ cache: "no-store" }
|
|
16
|
+
)).json(), e = s.filter(
|
|
17
|
+
(n) => r.id !== n.documentId
|
|
18
|
+
);
|
|
19
|
+
return e.unshift(r), e;
|
|
20
|
+
}
|
|
21
|
+
return s;
|
|
22
|
+
}
|
|
23
|
+
async function m({
|
|
24
|
+
contentType: a,
|
|
25
|
+
cookies: s,
|
|
26
|
+
CMS_PROJECT_NAME: c,
|
|
27
|
+
storeId: d
|
|
28
|
+
}) {
|
|
29
|
+
var h, r;
|
|
30
|
+
const i = JSON.parse(
|
|
31
|
+
((h = s().get("cms_preview_data")) == null ? void 0 : h.value) ?? "{}"
|
|
32
|
+
), t = [];
|
|
33
|
+
let o = 1, u = 0, l = !0;
|
|
34
|
+
try {
|
|
35
|
+
do {
|
|
36
|
+
const n = await (await fetch(
|
|
37
|
+
`https://${d}.myvtex.com/_v/cms/api/${c}/${a}?page=${o}`
|
|
38
|
+
)).json();
|
|
39
|
+
o === 1 && (u = n.totalItems), (r = n == null ? void 0 : n.data) != null && r.length && t.push(...n.data), l = n.hasNextPage, o++;
|
|
40
|
+
} while (l && t.length < u);
|
|
41
|
+
if (i.previewMode && t.length) {
|
|
42
|
+
const e = await g({
|
|
43
|
+
contentType: a,
|
|
44
|
+
documents: t,
|
|
45
|
+
cookies: s,
|
|
46
|
+
CMS_PROJECT_NAME: c,
|
|
47
|
+
storeId: d
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
status: e.length > 0 ? 200 : 404,
|
|
51
|
+
data: e ?? []
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
status: t.length ? 200 : 404,
|
|
56
|
+
data: t
|
|
57
|
+
};
|
|
58
|
+
} catch (e) {
|
|
59
|
+
return { status: "error", data: [], error: e };
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const p = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
63
|
+
__proto__: null,
|
|
64
|
+
getContentType: m
|
|
65
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
66
|
+
export {
|
|
67
|
+
p as c
|
|
68
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
async function g({
|
|
2
|
+
contentType: s,
|
|
3
|
+
documents: a,
|
|
4
|
+
cookies: d,
|
|
5
|
+
CMS_PROJECT_NAME: c,
|
|
6
|
+
api: i
|
|
7
|
+
}) {
|
|
8
|
+
var o;
|
|
9
|
+
const t = JSON.parse(
|
|
10
|
+
((o = d().get("cms_preview_data")) == null ? void 0 : o.value) ?? "{}"
|
|
11
|
+
);
|
|
12
|
+
if (t && (t == null ? void 0 : t.contentType) === s) {
|
|
13
|
+
const u = t.documentId && t.documentId.length ? `/${t.documentId}` : "", l = t != null && t.versionId && (t != null && t.versionId.length) ? `?versionId=${t == null ? void 0 : t.versionId}` : "", r = await (await fetch(
|
|
14
|
+
`https://${i.storeId}.myvtex.com/_v/cms/api/${c}/${s}${u}${l}`,
|
|
15
|
+
{ cache: "no-store" }
|
|
16
|
+
)).json(), e = a.filter(
|
|
17
|
+
(n) => r.id !== n.documentId
|
|
18
|
+
);
|
|
19
|
+
return e.unshift(r), e;
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
}
|
|
23
|
+
async function m({
|
|
24
|
+
contentType: s,
|
|
25
|
+
cookies: a,
|
|
26
|
+
CMS_PROJECT_NAME: d,
|
|
27
|
+
api: c
|
|
28
|
+
}) {
|
|
29
|
+
var h, r;
|
|
30
|
+
const i = JSON.parse(
|
|
31
|
+
((h = a().get("cms_preview_data")) == null ? void 0 : h.value) ?? "{}"
|
|
32
|
+
), t = [];
|
|
33
|
+
let o = 1, u = 0, l = !0;
|
|
34
|
+
try {
|
|
35
|
+
do {
|
|
36
|
+
const n = await (await fetch(
|
|
37
|
+
`https://${c.storeId}.myvtex.com/_v/cms/api/${d}/${s}?page=${o}`
|
|
38
|
+
)).json();
|
|
39
|
+
o === 1 && (u = n.totalItems), (r = n == null ? void 0 : n.data) != null && r.length && t.push(...n.data), l = n.hasNextPage, o++;
|
|
40
|
+
} while (l && t.length < u);
|
|
41
|
+
if (i.previewMode && t.length) {
|
|
42
|
+
const e = await g({
|
|
43
|
+
contentType: s,
|
|
44
|
+
documents: t,
|
|
45
|
+
cookies: a,
|
|
46
|
+
CMS_PROJECT_NAME: d,
|
|
47
|
+
api: c
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
status: e.length > 0 ? 200 : 404,
|
|
51
|
+
data: e ?? []
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
status: t.length ? 200 : 404,
|
|
56
|
+
data: t
|
|
57
|
+
};
|
|
58
|
+
} catch (e) {
|
|
59
|
+
return { status: "error", data: [], error: e };
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const p = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
63
|
+
__proto__: null,
|
|
64
|
+
getContentType: m
|
|
65
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
66
|
+
export {
|
|
67
|
+
p as c
|
|
68
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";async function g({contentType:s,documents:a,NextCookies:c,CMS_PROJECT_NAME:d,storeId:i}){var o;const t=JSON.parse(((o=c().get("cms_preview_data"))==null?void 0:o.value)??"{}");if(t&&(t==null?void 0:t.contentType)===s){const u=t.documentId&&t.documentId.length?`/${t.documentId}`:"",l=t!=null&&t.versionId&&(t!=null&&t.versionId.length)?`?versionId=${t==null?void 0:t.versionId}`:"",r=await(await fetch(`https://${i}.myvtex.com/_v/cms/api/${d}/${s}${u}${l}`,{cache:"no-store"})).json(),e=a.filter(n=>r.id!==n.documentId);return e.unshift(r),e}return a}async function m({contentType:s,NextCookies:a,CMS_PROJECT_NAME:c,storeId:d}){var h,r;const i=JSON.parse(((h=a().get("cms_preview_data"))==null?void 0:h.value)??"{}"),t=[];let o=1,u=0,l=!0;try{do{const n=await(await fetch(`https://${d}.myvtex.com/_v/cms/api/${c}/${s}?page=${o}`)).json();o===1&&(u=n.totalItems),(r=n==null?void 0:n.data)!=null&&r.length&&t.push(...n.data),l=n.hasNextPage,o++}while(l&&t.length<u);if(i.previewMode&&t.length){const e=await g({contentType:s,documents:t,NextCookies:a,CMS_PROJECT_NAME:c,storeId:d});return{status:e.length>0?200:404,data:e??[]}}return{status:t.length?200:404,data:t}}catch(e){return{status:"error",data:[],error:e}}}const p=Object.freeze(Object.defineProperty({__proto__:null,getContentType:m},Symbol.toStringTag,{value:"Module"}));exports.cms=p;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
async function g({
|
|
2
|
+
contentType: a,
|
|
3
|
+
documents: s,
|
|
4
|
+
NextCookies: c,
|
|
5
|
+
CMS_PROJECT_NAME: d,
|
|
6
|
+
storeId: i
|
|
7
|
+
}) {
|
|
8
|
+
var o;
|
|
9
|
+
const t = JSON.parse(
|
|
10
|
+
((o = c().get("cms_preview_data")) == null ? void 0 : o.value) ?? "{}"
|
|
11
|
+
);
|
|
12
|
+
if (t && (t == null ? void 0 : t.contentType) === a) {
|
|
13
|
+
const u = t.documentId && t.documentId.length ? `/${t.documentId}` : "", l = t != null && t.versionId && (t != null && t.versionId.length) ? `?versionId=${t == null ? void 0 : t.versionId}` : "", r = await (await fetch(
|
|
14
|
+
`https://${i}.myvtex.com/_v/cms/api/${d}/${a}${u}${l}`,
|
|
15
|
+
{ cache: "no-store" }
|
|
16
|
+
)).json(), e = s.filter(
|
|
17
|
+
(n) => r.id !== n.documentId
|
|
18
|
+
);
|
|
19
|
+
return e.unshift(r), e;
|
|
20
|
+
}
|
|
21
|
+
return s;
|
|
22
|
+
}
|
|
23
|
+
async function m({
|
|
24
|
+
contentType: a,
|
|
25
|
+
NextCookies: s,
|
|
26
|
+
CMS_PROJECT_NAME: c,
|
|
27
|
+
storeId: d
|
|
28
|
+
}) {
|
|
29
|
+
var h, r;
|
|
30
|
+
const i = JSON.parse(
|
|
31
|
+
((h = s().get("cms_preview_data")) == null ? void 0 : h.value) ?? "{}"
|
|
32
|
+
), t = [];
|
|
33
|
+
let o = 1, u = 0, l = !0;
|
|
34
|
+
try {
|
|
35
|
+
do {
|
|
36
|
+
const n = await (await fetch(
|
|
37
|
+
`https://${d}.myvtex.com/_v/cms/api/${c}/${a}?page=${o}`
|
|
38
|
+
)).json();
|
|
39
|
+
o === 1 && (u = n.totalItems), (r = n == null ? void 0 : n.data) != null && r.length && t.push(...n.data), l = n.hasNextPage, o++;
|
|
40
|
+
} while (l && t.length < u);
|
|
41
|
+
if (i.previewMode && t.length) {
|
|
42
|
+
const e = await g({
|
|
43
|
+
contentType: a,
|
|
44
|
+
documents: t,
|
|
45
|
+
NextCookies: s,
|
|
46
|
+
CMS_PROJECT_NAME: c,
|
|
47
|
+
storeId: d
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
status: e.length > 0 ? 200 : 404,
|
|
51
|
+
data: e ?? []
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
status: t.length ? 200 : 404,
|
|
56
|
+
data: t
|
|
57
|
+
};
|
|
58
|
+
} catch (e) {
|
|
59
|
+
return { status: "error", data: [], error: e };
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const p = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
63
|
+
__proto__: null,
|
|
64
|
+
getContentType: m
|
|
65
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
66
|
+
export {
|
|
67
|
+
p as c
|
|
68
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";async function g({contentType:s,documents:a,cookies:d,CMS_PROJECT_NAME:c,api:i}){var o;const t=JSON.parse(((o=d().get("cms_preview_data"))==null?void 0:o.value)??"{}");if(t&&(t==null?void 0:t.contentType)===s){const u=t.documentId&&t.documentId.length?`/${t.documentId}`:"",l=t!=null&&t.versionId&&(t!=null&&t.versionId.length)?`?versionId=${t==null?void 0:t.versionId}`:"",r=await(await fetch(`https://${i.storeId}.myvtex.com/_v/cms/api/${c}/${s}${u}${l}`,{cache:"no-store"})).json(),e=a.filter(n=>r.id!==n.documentId);return e.unshift(r),e}return a}async function m({contentType:s,cookies:a,CMS_PROJECT_NAME:d,api:c}){var h,r;const i=JSON.parse(((h=a().get("cms_preview_data"))==null?void 0:h.value)??"{}");let t=[],o=1,u=0,l=!0;try{do{const n=await(await fetch(`https://${c.storeId}.myvtex.com/_v/cms/api/${d}/${s}?page=${o}`)).json();o===1&&(u=n.totalItems),(r=n==null?void 0:n.data)!=null&&r.length&&t.push(...n.data),l=n.hasNextPage,o++}while(l&&t.length<u);if(i.previewMode&&t.length){const e=await g({contentType:s,documents:t,cookies:a,CMS_PROJECT_NAME:d,api:c});return{status:e.length>0?200:404,data:e??[]}}return{status:t.length?200:404,data:t}}catch(e){return{status:"error",data:[],error:e}}}const I=Object.freeze(Object.defineProperty({__proto__:null,getContentType:m},Symbol.toStringTag,{value:"Module"}));exports.cms=I;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";async function g({contentType:s,documents:a,cookies:d,CMS_PROJECT_NAME:c,api:i}){var o;const t=JSON.parse(((o=d().get("cms_preview_data"))==null?void 0:o.value)??"{}");if(t&&(t==null?void 0:t.contentType)===s){const u=t.documentId&&t.documentId.length?`/${t.documentId}`:"",l=t!=null&&t.versionId&&(t!=null&&t.versionId.length)?`?versionId=${t==null?void 0:t.versionId}`:"",r=await(await fetch(`https://${i.storeId}.myvtex.com/_v/cms/api/${c}/${s}${u}${l}`,{cache:"no-store"})).json(),e=a.filter(n=>r.id!==n.documentId);return e.unshift(r),e}return a}async function m({contentType:s,cookies:a,CMS_PROJECT_NAME:d,api:c}){var h,r;const i=JSON.parse(((h=a().get("cms_preview_data"))==null?void 0:h.value)??"{}"),t=[];let o=1,u=0,l=!0;try{do{const n=await(await fetch(`https://${c.storeId}.myvtex.com/_v/cms/api/${d}/${s}?page=${o}`)).json();o===1&&(u=n.totalItems),(r=n==null?void 0:n.data)!=null&&r.length&&t.push(...n.data),l=n.hasNextPage,o++}while(l&&t.length<u);if(i.previewMode&&t.length){const e=await g({contentType:s,documents:t,cookies:a,CMS_PROJECT_NAME:d,api:c});return{status:e.length>0?200:404,data:e??[]}}return{status:t.length?200:404,data:t}}catch(e){return{status:"error",data:[],error:e}}}const I=Object.freeze(Object.defineProperty({__proto__:null,getContentType:m},Symbol.toStringTag,{value:"Module"}));exports.cms=I;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
async function g({
|
|
2
|
+
contentType: s,
|
|
3
|
+
documents: a,
|
|
4
|
+
cookies: d,
|
|
5
|
+
CMS_PROJECT_NAME: c,
|
|
6
|
+
api: i
|
|
7
|
+
}) {
|
|
8
|
+
var o;
|
|
9
|
+
const t = JSON.parse(
|
|
10
|
+
((o = d().get("cms_preview_data")) == null ? void 0 : o.value) ?? "{}"
|
|
11
|
+
);
|
|
12
|
+
if (t && (t == null ? void 0 : t.contentType) === s) {
|
|
13
|
+
const l = t.documentId && t.documentId.length ? `/${t.documentId}` : "", u = t != null && t.versionId && (t != null && t.versionId.length) ? `?versionId=${t == null ? void 0 : t.versionId}` : "", r = await (await fetch(
|
|
14
|
+
`https://${i.storeId}.myvtex.com/_v/cms/api/${c}/${s}${l}${u}`,
|
|
15
|
+
{ cache: "no-store" }
|
|
16
|
+
)).json(), e = a.filter(
|
|
17
|
+
(n) => r.id !== n.documentId
|
|
18
|
+
);
|
|
19
|
+
return e.unshift(r), e;
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
}
|
|
23
|
+
async function m({
|
|
24
|
+
contentType: s,
|
|
25
|
+
cookies: a,
|
|
26
|
+
CMS_PROJECT_NAME: d,
|
|
27
|
+
api: c
|
|
28
|
+
}) {
|
|
29
|
+
var h, r;
|
|
30
|
+
const i = JSON.parse(
|
|
31
|
+
((h = a().get("cms_preview_data")) == null ? void 0 : h.value) ?? "{}"
|
|
32
|
+
);
|
|
33
|
+
let t = [], o = 1, l = 0, u = !0;
|
|
34
|
+
try {
|
|
35
|
+
do {
|
|
36
|
+
const n = await (await fetch(
|
|
37
|
+
`https://${c.storeId}.myvtex.com/_v/cms/api/${d}/${s}?page=${o}`
|
|
38
|
+
)).json();
|
|
39
|
+
o === 1 && (l = n.totalItems), (r = n == null ? void 0 : n.data) != null && r.length && t.push(...n.data), u = n.hasNextPage, o++;
|
|
40
|
+
} while (u && t.length < l);
|
|
41
|
+
if (i.previewMode && t.length) {
|
|
42
|
+
const e = await g({
|
|
43
|
+
contentType: s,
|
|
44
|
+
documents: t,
|
|
45
|
+
cookies: a,
|
|
46
|
+
CMS_PROJECT_NAME: d,
|
|
47
|
+
api: c
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
status: e.length > 0 ? 200 : 404,
|
|
51
|
+
data: e ?? []
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
status: t.length ? 200 : 404,
|
|
56
|
+
data: t
|
|
57
|
+
};
|
|
58
|
+
} catch (e) {
|
|
59
|
+
return { status: "error", data: [], error: e };
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const p = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
63
|
+
__proto__: null,
|
|
64
|
+
getContentType: m
|
|
65
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
66
|
+
export {
|
|
67
|
+
p as c
|
|
68
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";async function g({contentType:s,documents:a,cookies:c,CMS_PROJECT_NAME:d,storeId:i}){var o;const t=JSON.parse(((o=c().get("cms_preview_data"))==null?void 0:o.value)??"{}");if(t&&(t==null?void 0:t.contentType)===s){const u=t.documentId&&t.documentId.length?`/${t.documentId}`:"",l=t!=null&&t.versionId&&(t!=null&&t.versionId.length)?`?versionId=${t==null?void 0:t.versionId}`:"",r=await(await fetch(`https://${i}.myvtex.com/_v/cms/api/${d}/${s}${u}${l}`,{cache:"no-store"})).json(),e=a.filter(n=>r.id!==n.documentId);return e.unshift(r),e}return a}async function m({contentType:s,cookies:a,CMS_PROJECT_NAME:c,storeId:d}){var h,r;const i=JSON.parse(((h=a().get("cms_preview_data"))==null?void 0:h.value)??"{}"),t=[];let o=1,u=0,l=!0;try{do{const n=await(await fetch(`https://${d}.myvtex.com/_v/cms/api/${c}/${s}?page=${o}`)).json();o===1&&(u=n.totalItems),(r=n==null?void 0:n.data)!=null&&r.length&&t.push(...n.data),l=n.hasNextPage,o++}while(l&&t.length<u);if(i.previewMode&&t.length){const e=await g({contentType:s,documents:t,cookies:a,CMS_PROJECT_NAME:c,storeId:d});return{status:e.length>0?200:404,data:e??[]}}return{status:t.length?200:404,data:t}}catch(e){return{status:"error",data:[],error:e}}}const p=Object.freeze(Object.defineProperty({__proto__:null,getContentType:m},Symbol.toStringTag,{value:"Module"}));exports.cms=p;
|