@builder.io/sdk-react-nextjs 0.17.1 → 0.17.3
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/lib/browser/blocks/columns/columns.cjs +2 -2
- package/lib/browser/blocks/columns/columns.mjs +2 -2
- package/lib/browser/blocks/image/image.cjs +3 -3
- package/lib/browser/blocks/image/image.mjs +8 -8
- package/lib/browser/blocks/text/text.cjs +1 -1
- package/lib/browser/blocks/text/text.mjs +6 -24
- package/lib/browser/components/awaiter.cjs +1 -1
- package/lib/browser/components/block/block.cjs +1 -1
- package/lib/browser/components/block/block.mjs +27 -28
- package/lib/browser/components/blocks/blocks-wrapper.cjs +1 -1
- package/lib/browser/components/blocks/blocks-wrapper.mjs +2 -2
- package/lib/browser/components/content/components/enable-editor.cjs +1 -1
- package/lib/browser/components/content/components/enable-editor.mjs +102 -96
- package/lib/browser/constants/sdk-version.cjs +1 -1
- package/lib/browser/constants/sdk-version.mjs +1 -1
- package/lib/browser/functions/get-block-component-options.cjs +1 -1
- package/lib/browser/functions/get-block-component-options.mjs +21 -5
- package/lib/browser/functions/get-content/generate-content-url.cjs +1 -1
- package/lib/browser/functions/get-content/generate-content-url.mjs +60 -40
- package/lib/browser/functions/get-processed-block.cjs +1 -1
- package/lib/browser/functions/get-processed-block.mjs +18 -19
- package/lib/browser/helpers/flatten.cjs +1 -1
- package/lib/browser/helpers/flatten.mjs +28 -15
- package/lib/edge/blocks/columns/columns.cjs +2 -2
- package/lib/edge/blocks/columns/columns.mjs +2 -2
- package/lib/edge/blocks/image/image.cjs +3 -3
- package/lib/edge/blocks/image/image.mjs +8 -8
- package/lib/edge/blocks/text/text.cjs +1 -1
- package/lib/edge/blocks/text/text.mjs +6 -24
- package/lib/edge/components/awaiter.cjs +1 -1
- package/lib/edge/components/block/block.cjs +1 -1
- package/lib/edge/components/block/block.mjs +27 -28
- package/lib/edge/components/blocks/blocks-wrapper.cjs +1 -1
- package/lib/edge/components/blocks/blocks-wrapper.mjs +2 -2
- package/lib/edge/components/content/components/enable-editor.cjs +1 -1
- package/lib/edge/components/content/components/enable-editor.mjs +102 -96
- package/lib/edge/constants/sdk-version.cjs +1 -1
- package/lib/edge/constants/sdk-version.mjs +1 -1
- package/lib/edge/functions/evaluate/edge-runtime/edge-runtime.cjs +5 -5
- package/lib/edge/functions/evaluate/edge-runtime/edge-runtime.mjs +25 -28
- package/lib/edge/functions/get-block-component-options.cjs +1 -1
- package/lib/edge/functions/get-block-component-options.mjs +21 -5
- package/lib/edge/functions/get-content/generate-content-url.cjs +1 -1
- package/lib/edge/functions/get-content/generate-content-url.mjs +60 -40
- package/lib/edge/functions/get-processed-block.cjs +1 -1
- package/lib/edge/functions/get-processed-block.mjs +18 -19
- package/lib/edge/helpers/flatten.cjs +1 -1
- package/lib/edge/helpers/flatten.mjs +28 -15
- package/lib/node/blocks/columns/columns.cjs +2 -2
- package/lib/node/blocks/columns/columns.mjs +2 -2
- package/lib/node/blocks/image/image.cjs +3 -3
- package/lib/node/blocks/image/image.mjs +8 -8
- package/lib/node/blocks/text/text.cjs +1 -1
- package/lib/node/blocks/text/text.mjs +6 -24
- package/lib/node/components/awaiter.cjs +1 -1
- package/lib/node/components/block/block.cjs +1 -1
- package/lib/node/components/block/block.mjs +27 -28
- package/lib/node/components/blocks/blocks-wrapper.cjs +1 -1
- package/lib/node/components/blocks/blocks-wrapper.mjs +2 -2
- package/lib/node/components/content/components/enable-editor.cjs +1 -1
- package/lib/node/components/content/components/enable-editor.mjs +102 -96
- package/lib/node/constants/sdk-version.cjs +1 -1
- package/lib/node/constants/sdk-version.mjs +1 -1
- package/lib/node/functions/get-block-component-options.cjs +1 -1
- package/lib/node/functions/get-block-component-options.mjs +21 -5
- package/lib/node/functions/get-content/generate-content-url.cjs +1 -1
- package/lib/node/functions/get-content/generate-content-url.mjs +60 -40
- package/lib/node/functions/get-processed-block.cjs +1 -1
- package/lib/node/functions/get-processed-block.mjs +18 -19
- package/lib/node/helpers/flatten.cjs +1 -1
- package/lib/node/helpers/flatten.mjs +28 -15
- package/package.json +1 -1
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/cjs/functions/get-block-component-options.d.ts +2 -1
- package/types/cjs/functions/get-processed-block.d.ts +1 -6
- package/types/cjs/helpers/flatten.d.ts +6 -0
- package/types/cjs/server-index.d.ts +1 -1
- package/types/cjs/types/builder-content.d.ts +1 -0
- package/types/cjs/types/input.d.ts +10 -0
- package/types/esm/constants/sdk-version.d.ts +1 -1
- package/types/esm/functions/get-block-component-options.d.ts +2 -1
- package/types/esm/functions/get-processed-block.d.ts +1 -6
- package/types/esm/helpers/flatten.d.ts +6 -0
- package/types/esm/server-index.d.ts +1 -1
- package/types/esm/types/builder-content.d.ts +1 -0
- package/types/esm/types/input.d.ts +10 -0
|
@@ -1,23 +1,36 @@
|
|
|
1
|
-
function
|
|
2
|
-
return Object.keys(
|
|
3
|
-
const
|
|
4
|
-
return [typeof
|
|
5
|
-
...
|
|
6
|
-
...
|
|
1
|
+
function c(l, s = null, o = ".") {
|
|
2
|
+
return Object.keys(l).reduce((n, t) => {
|
|
3
|
+
const e = l[t], r = [s, t].filter(Boolean).join(o);
|
|
4
|
+
return [typeof e == "object", e !== null, !(Array.isArray(e) && e.length === 0)].every(Boolean) ? {
|
|
5
|
+
...n,
|
|
6
|
+
...c(e, r, o)
|
|
7
7
|
} : {
|
|
8
|
-
...
|
|
9
|
-
[
|
|
8
|
+
...n,
|
|
9
|
+
[r]: e
|
|
10
10
|
};
|
|
11
11
|
}, {});
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
for (const
|
|
15
|
-
const
|
|
16
|
-
|
|
13
|
+
function i(l, s, o = {}) {
|
|
14
|
+
for (const n in l) {
|
|
15
|
+
const t = l[n], e = s ? s + "." + n : n;
|
|
16
|
+
t && typeof t == "object" && !Array.isArray(t) && !Object.keys(t).find((r) => r.startsWith("$")) ? i(t, e, o) : o[e] = t;
|
|
17
17
|
}
|
|
18
|
-
return
|
|
18
|
+
return o;
|
|
19
|
+
}
|
|
20
|
+
function u(l) {
|
|
21
|
+
const s = {};
|
|
22
|
+
for (const o in l) {
|
|
23
|
+
const n = o.split(".");
|
|
24
|
+
let t = s;
|
|
25
|
+
for (let e = 0; e < n.length; e++) {
|
|
26
|
+
const r = n[e];
|
|
27
|
+
e === n.length - 1 ? t[r] = l[o] : (t[r] = t[r] || {}, t = t[r]);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return s;
|
|
19
31
|
}
|
|
20
32
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
33
|
+
c as flatten,
|
|
34
|
+
i as flattenMongoQuery,
|
|
35
|
+
u as unflatten
|
|
23
36
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const o=require("react/jsx-runtime"),W=require("../../components/blocks/blocks.cjs"),j=require("../../components/dynamic-renderer/dynamic-renderer.cjs"),q=require("../../components/inlined-styles.cjs"),z=require("../../constants/device-sizes.cjs"),B=require("../../functions/get-class-prop-name.cjs"),p=require("../../functions/get-style.cjs"),A=require("./helpers.cjs");function N(e){var g,f;const a=function(){return typeof e.space=="number"?e.space||0:20},s=function(){return e.columns||[]},u=function(){return e.stackColumnsAt||"tablet"},y=function(t){return t.link?e.builderLinkComponent||"a":"div"},S=function(t){var i;return((i=s()[t])==null?void 0:i.width)||100/s().length},x=function(t){const i=S(t),l=a()*(s().length-1)*(i/100);return`calc(${i}% - ${l}px)`},c=function({stackedStyle:t,desktopStyle:i}){return u()==="tablet"?t:i},
|
|
1
|
+
"use strict";const o=require("react/jsx-runtime"),W=require("../../components/blocks/blocks.cjs"),j=require("../../components/dynamic-renderer/dynamic-renderer.cjs"),q=require("../../components/inlined-styles.cjs"),z=require("../../constants/device-sizes.cjs"),B=require("../../functions/get-class-prop-name.cjs"),p=require("../../functions/get-style.cjs"),A=require("./helpers.cjs");function N(e){var g,f;const a=function(){return typeof e.space=="number"?e.space||0:20},s=function(){return e.columns||[]},u=function(){return e.stackColumnsAt||"tablet"},y=function(t){return t.link?e.builderLinkComponent||"a":"div"},S=function(t){var i;return((i=s()[t])==null?void 0:i.width)||100/s().length},x=function(t){const i=S(t),l=a()*(s().length-1)*(i/100);return`calc(${i}% - ${l}px)`},c=function({stackedStyle:t,desktopStyle:i}){return u()==="tablet"?t:i},d=function({stackedStyle:t,desktopStyle:i}){return u()==="never"?i:t},m=function(){return e.stackColumnsAt==="never"?"row":e.reverseColumnsWhenStacked?"column-reverse":"column"},C=function(){return{"--flex-dir":m(),"--flex-dir-tablet":c({stackedStyle:m(),desktopStyle:"row"})}},v=function(t){const i=t===0?0:a(),l=x(t),r=`${i}px`,k="100%",h=0;return{...{display:"flex",flexDirection:"column",alignItems:"stretch"},width:l,["marginLeft"]:r,"--column-width-mobile":d({stackedStyle:k,desktopStyle:l}),"--column-margin-left-mobile":d({stackedStyle:h,desktopStyle:r}),"--column-width-tablet":c({stackedStyle:k,desktopStyle:l}),"--column-margin-left-tablet":c({stackedStyle:h,desktopStyle:r})}},b=function(t){var l,r;return z.getSizesForBreakpoints(((r=(l=e.builderContext.content)==null?void 0:l.meta)==null?void 0:r.breakpoints)||{})[t].max},w=function(){const t=`.${e.builderBlock.id}-breakpoints > .builder-column`;return`
|
|
2
2
|
@media (max-width: ${b("medium")}px) {
|
|
3
3
|
.${e.builderBlock.id}-breakpoints {
|
|
4
4
|
flex-direction: var(--flex-dir-tablet);
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
margin-left: var(--column-margin-left-mobile) !important;
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
|
-
`},$=function(t,i){return{...t.link?{href:t.link}:{},[B.getClassPropName()]:"builder-column",style:p.mapStyleObjToStrIfNeeded(v(i))}};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:A.getColumnsClass((g=e.builderBlock)==null?void 0:g.id)+" div-
|
|
25
|
+
`},$=function(t,i){return{...t.link?{href:t.link}:{},[B.getClassPropName()]:"builder-column",style:p.mapStyleObjToStrIfNeeded(v(i))}};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:A.getColumnsClass((g=e.builderBlock)==null?void 0:g.id)+" div-035056da",style:C(),children:[o.jsx(q,{id:"builderio-columns",styles:w(),nonce:e.builderContext.nonce}),(f=e.columns)==null?void 0:f.map((n,t)=>o.jsx(j,{TagName:y(n),actionAttributes:{},attributes:$(n,t),children:o.jsx(W,{path:`columns.${t}.blocks`,parent:e.builderBlock.id,styleProp:{flexGrow:"1"},context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent,blocks:n.blocks})},t))]}),o.jsx("style",{children:`.div-035056da {
|
|
26
26
|
display: flex;
|
|
27
27
|
line-height: normal;
|
|
28
28
|
}`})]})}module.exports=N;
|
|
@@ -114,7 +114,7 @@ function q(e) {
|
|
|
114
114
|
/* @__PURE__ */ y(
|
|
115
115
|
"div",
|
|
116
116
|
{
|
|
117
|
-
className: D((b = e.builderBlock) == null ? void 0 : b.id) + " div-
|
|
117
|
+
className: D((b = e.builderBlock) == null ? void 0 : b.id) + " div-035056da",
|
|
118
118
|
style: v(),
|
|
119
119
|
children: [
|
|
120
120
|
/* @__PURE__ */ r(
|
|
@@ -151,7 +151,7 @@ function q(e) {
|
|
|
151
151
|
]
|
|
152
152
|
}
|
|
153
153
|
),
|
|
154
|
-
/* @__PURE__ */ r("style", { children: `.div-
|
|
154
|
+
/* @__PURE__ */ r("style", { children: `.div-035056da {
|
|
155
155
|
display: flex;
|
|
156
156
|
line-height: normal;
|
|
157
157
|
}` })
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use client";"use strict";const t=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";const t=require("react/jsx-runtime"),f=require("react"),l=require("./image.helpers.cjs");function b(e){var s,r,u,o,d,g;function n(){var h;const i=e.image||e.src;if(!i||!(typeof i=="string"&&(i.match(/builder\.io/)||i.match(/cdn\.shopify\.com/))))return e.srcset;if(!e.noWebp){if(e.srcset&&((h=e.image)!=null&&h.includes("builder.io/api/v1/image"))){if(!e.srcset.includes(e.image.split("?")[0]))return console.debug("Removed given srcset"),l.getSrcSet(i)}else if(e.image&&!e.srcset)return l.getSrcSet(i);return l.getSrcSet(i)}}function a(){var c;return(c=n==null?void 0:n())!=null&&c.match(/builder\.io/)&&!e.noWebp?n().replace(/\?/g,"?format=webp&"):""}function m(){const c={position:"absolute",height:"100%",width:"100%",left:"0px",top:"0px"};return e.aspectRatio?c:void 0}return f.useEffect(()=>{},[]),t.jsxs(t.Fragment,{children:[t.jsxs(t.Fragment,{children:[t.jsxs("picture",{children:[a()?t.jsx("source",{type:"image/webp",srcSet:a()}):null,t.jsx("img",{loading:e.highPriority?"eager":"lazy",fetchPriority:e.highPriority?"high":"auto",alt:e.altText,role:e.altText?void 0:"presentation",style:{objectPosition:e.backgroundPosition||"center",objectFit:e.backgroundSize||"cover",...m()},className:"builder-image"+(e.className?" "+e.className:"")+" img-5e5f3633",src:e.image,srcSet:n(),sizes:e.sizes})]}),e.aspectRatio&&!((r=(s=e.builderBlock)==null?void 0:s.children)!=null&&r.length&&e.fitContent)?t.jsx("div",{className:"builder-image-sizer div-5e5f3633",style:{paddingTop:e.aspectRatio*100+"%"}}):null,(o=(u=e.builderBlock)==null?void 0:u.children)!=null&&o.length&&e.fitContent?t.jsx(t.Fragment,{children:e.children}):null,!e.fitContent&&((g=(d=e.builderBlock)==null?void 0:d.children)!=null&&g.length)?t.jsx("div",{className:"div-5e5f3633-2",children:e.children}):null]}),t.jsx("style",{children:`.img-5e5f3633 {
|
|
2
2
|
opacity: 1;
|
|
3
3
|
transition: opacity 0.2s ease-in-out;
|
|
4
|
-
}.div-
|
|
4
|
+
}.div-5e5f3633 {
|
|
5
5
|
width: 100%;
|
|
6
6
|
pointer-events: none;
|
|
7
7
|
font-size: 0;
|
|
8
|
-
}.div-
|
|
8
|
+
}.div-5e5f3633-2 {
|
|
9
9
|
display: flex;
|
|
10
10
|
flex-direction: column;
|
|
11
11
|
align-items: stretch;
|
|
@@ -3,7 +3,7 @@ import { jsxs as l, Fragment as a, jsx as t } from "react/jsx-runtime";
|
|
|
3
3
|
import { useEffect as v } from "react";
|
|
4
4
|
import { getSrcSet as o } from "./image.helpers.mjs";
|
|
5
5
|
function w(e) {
|
|
6
|
-
var d, s, u,
|
|
6
|
+
var d, s, u, g, m, f;
|
|
7
7
|
function n() {
|
|
8
8
|
var h;
|
|
9
9
|
const i = e.image || e.src;
|
|
@@ -51,7 +51,7 @@ function w(e) {
|
|
|
51
51
|
objectFit: e.backgroundSize || "cover",
|
|
52
52
|
...b()
|
|
53
53
|
},
|
|
54
|
-
className: "builder-image" + (e.className ? " " + e.className : "") + " img-
|
|
54
|
+
className: "builder-image" + (e.className ? " " + e.className : "") + " img-5e5f3633",
|
|
55
55
|
src: e.image,
|
|
56
56
|
srcSet: n(),
|
|
57
57
|
sizes: e.sizes
|
|
@@ -61,23 +61,23 @@ function w(e) {
|
|
|
61
61
|
e.aspectRatio && !((s = (d = e.builderBlock) == null ? void 0 : d.children) != null && s.length && e.fitContent) ? /* @__PURE__ */ t(
|
|
62
62
|
"div",
|
|
63
63
|
{
|
|
64
|
-
className: "builder-image-sizer div-
|
|
64
|
+
className: "builder-image-sizer div-5e5f3633",
|
|
65
65
|
style: {
|
|
66
66
|
paddingTop: e.aspectRatio * 100 + "%"
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
) : null,
|
|
70
|
-
(
|
|
71
|
-
!e.fitContent && ((
|
|
70
|
+
(g = (u = e.builderBlock) == null ? void 0 : u.children) != null && g.length && e.fitContent ? /* @__PURE__ */ t(a, { children: e.children }) : null,
|
|
71
|
+
!e.fitContent && ((f = (m = e.builderBlock) == null ? void 0 : m.children) != null && f.length) ? /* @__PURE__ */ t("div", { className: "div-5e5f3633-2", children: e.children }) : null
|
|
72
72
|
] }),
|
|
73
|
-
/* @__PURE__ */ t("style", { children: `.img-
|
|
73
|
+
/* @__PURE__ */ t("style", { children: `.img-5e5f3633 {
|
|
74
74
|
opacity: 1;
|
|
75
75
|
transition: opacity 0.2s ease-in-out;
|
|
76
|
-
}.div-
|
|
76
|
+
}.div-5e5f3633 {
|
|
77
77
|
width: 100%;
|
|
78
78
|
pointer-events: none;
|
|
79
79
|
font-size: 0;
|
|
80
|
-
}.div-
|
|
80
|
+
}.div-5e5f3633-2 {
|
|
81
81
|
display: flex;
|
|
82
82
|
flex-direction: column;
|
|
83
83
|
align-items: stretch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime");function r(e){var t;return n.jsx("div",{className:"builder-text",dangerouslySetInnerHTML:{__html:((t=e.text)==null?void 0:t.toString())||""},style:{outline:"none"}})}module.exports=r;
|
|
@@ -1,29 +1,11 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
return /* @__PURE__ */
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
function o(e) {
|
|
3
|
+
var t;
|
|
4
|
+
return /* @__PURE__ */ n(
|
|
5
5
|
"div",
|
|
6
6
|
{
|
|
7
7
|
className: "builder-text",
|
|
8
|
-
dangerouslySetInnerHTML: { __html:
|
|
9
|
-
var e;
|
|
10
|
-
const o = t.builderContext, {
|
|
11
|
-
context: n,
|
|
12
|
-
localState: r,
|
|
13
|
-
rootState: c,
|
|
14
|
-
rootSetState: s
|
|
15
|
-
} = o;
|
|
16
|
-
return String(((e = t.text) == null ? void 0 : e.toString()) || "").replace(
|
|
17
|
-
/{{([^}]+)}}/g,
|
|
18
|
-
(d, x) => l({
|
|
19
|
-
code: x,
|
|
20
|
-
context: n,
|
|
21
|
-
localState: r,
|
|
22
|
-
rootState: c,
|
|
23
|
-
rootSetState: s
|
|
24
|
-
})
|
|
25
|
-
);
|
|
26
|
-
}() },
|
|
8
|
+
dangerouslySetInnerHTML: { __html: ((t = e.text) == null ? void 0 : t.toString()) || "" },
|
|
27
9
|
style: {
|
|
28
10
|
outline: "none"
|
|
29
11
|
}
|
|
@@ -31,5 +13,5 @@ function f(t) {
|
|
|
31
13
|
);
|
|
32
14
|
}
|
|
33
15
|
export {
|
|
34
|
-
|
|
16
|
+
o as default
|
|
35
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const e=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";const e=require("react/jsx-runtime"),r=require("react");function n(t){return r.useEffect(()=>{},[]),e.jsx(e.Fragment,{children:t.children})}module.exports=n;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),v=require("../../constants/target.cjs"),S=require("../../functions/get-block-component-options.cjs"),j=require("../../functions/get-processed-block.cjs"),P=require("../../functions/is-previewing.cjs");require("../../functions/get-fetch.cjs");const m=require("./block.helpers.cjs"),q=require("./components/block-styles.cjs"),O=require("./components/block-wrapper.cjs"),p=require("./components/component-ref/component-ref.cjs"),g=require("./components/repeated-block.cjs");function b(e){var a,C,x,h;const d=function(){return m.getRepeatItemData({block:e.block,context:e.context})},u={value:null,update:!1},c=function(){var i;if(u.value&&!u.update&&!P.isPreviewing())return u.value;const r=(i=e.block.repeat)!=null&&i.collection?e.block:j.getProcessedBlock({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context});return u.value=r,u.update=!1,r},l=function(){return m.getComponent({block:c(),registeredComponents:e.registeredComponents,model:e.context.model})},f=function(){var i;return e.block.tagName==="a"||((i=c().properties)==null?void 0:i.href)||c().href?e.linkComponent||"a":e.block.tagName||"div"},B=function(){var s,k;if((s=e.block.repeat)!=null&&s.collection)return!!((k=d())!=null&&k.length);const r="hide"in c()?c().hide:!1;return("show"in c()?c().show:!0)&&!r},R=function(){var i,s;return!((i=l())!=null&&i.component)&&!d()?(s=c().children)!=null?s:[]:[]},n=function(){var r,i,s,k;return{blockChildren:(r=c().children)!=null?r:[],componentRef:(i=l())==null?void 0:i.component,componentOptions:{...S.getBlockComponentOptions(c(),e.context),...m.provideBuilderBlock(l(),c()),...m.provideBuilderContext(l(),e.context),...m.provideLinkComponent(l(),e.linkComponent),...m.provideRegisteredComponents(l(),e.registeredComponents,e.context.model)},context:e.context,linkComponent:e.linkComponent,registeredComponents:e.registeredComponents,builderBlock:c(),includeBlockProps:((s=l())==null?void 0:s.noWrap)===!0,isInteractive:!((k=l())!=null&&k.isRSC&&v.TARGET==="rsc")}};return t.jsx(t.Fragment,{children:B()?t.jsxs(t.Fragment,{children:[t.jsx(q,{block:c(),context:e.context}),(a=l())!=null&&a.noWrap?d()?t.jsx(t.Fragment,{children:(h=d())==null?void 0:h.map((o,r)=>t.jsx(g,{repeatContext:o.context,block:o.block,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent},r))}):t.jsx(p,{componentRef:n().componentRef,componentOptions:n().componentOptions,blockChildren:n().blockChildren,context:n().context,registeredComponents:n().registeredComponents,linkComponent:n().linkComponent,builderBlock:n().builderBlock,includeBlockProps:n().includeBlockProps,isInteractive:n().isInteractive}):t.jsx(t.Fragment,{children:d()?t.jsx(t.Fragment,{children:(x=d())==null?void 0:x.map((o,r)=>t.jsx(g,{repeatContext:o.context,block:o.block,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent},r))}):t.jsxs(O,{Wrapper:f(),block:c(),context:e.context,children:[t.jsx(p,{componentRef:n().componentRef,componentOptions:n().componentOptions,blockChildren:n().blockChildren,context:n().context,registeredComponents:n().registeredComponents,linkComponent:n().linkComponent,builderBlock:n().builderBlock,includeBlockProps:n().includeBlockProps,isInteractive:n().isInteractive}),(C=R())==null?void 0:C.map(o=>t.jsx(b,{block:o,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent,context:e.context},o.id))]})})]}):null})}module.exports=b;
|
|
@@ -6,10 +6,10 @@ import { isPreviewing as I } from "../../functions/is-previewing.mjs";
|
|
|
6
6
|
import "../../functions/get-fetch.mjs";
|
|
7
7
|
import { getRepeatItemData as O, getComponent as w, provideBuilderBlock as W, provideBuilderContext as T, provideLinkComponent as L, provideRegisteredComponents as U } from "./block.helpers.mjs";
|
|
8
8
|
import j from "./components/block-styles.mjs";
|
|
9
|
-
import
|
|
9
|
+
import N from "./components/block-wrapper.mjs";
|
|
10
10
|
import x from "./components/component-ref/component-ref.mjs";
|
|
11
11
|
import b from "./components/repeated-block.mjs";
|
|
12
|
-
function
|
|
12
|
+
function y(e) {
|
|
13
13
|
var a, C, p, f;
|
|
14
14
|
const d = function() {
|
|
15
15
|
return O({
|
|
@@ -19,7 +19,7 @@ function N(e) {
|
|
|
19
19
|
}, s = {
|
|
20
20
|
value: null,
|
|
21
21
|
update: !1
|
|
22
|
-
},
|
|
22
|
+
}, n = function() {
|
|
23
23
|
var i;
|
|
24
24
|
if (s.value && !s.update && !I())
|
|
25
25
|
return s.value;
|
|
@@ -28,36 +28,35 @@ function N(e) {
|
|
|
28
28
|
localState: e.context.localState,
|
|
29
29
|
rootState: e.context.rootState,
|
|
30
30
|
rootSetState: e.context.rootSetState,
|
|
31
|
-
context: e.context.context
|
|
32
|
-
shouldEvaluateBindings: !0
|
|
31
|
+
context: e.context.context
|
|
33
32
|
});
|
|
34
33
|
return s.value = c, s.update = !1, c;
|
|
35
34
|
}, r = function() {
|
|
36
35
|
return w({
|
|
37
|
-
block:
|
|
36
|
+
block: n(),
|
|
38
37
|
registeredComponents: e.registeredComponents,
|
|
39
38
|
model: e.context.model
|
|
40
39
|
});
|
|
41
40
|
}, g = function() {
|
|
42
41
|
var i;
|
|
43
|
-
return e.block.tagName === "a" || ((i =
|
|
42
|
+
return e.block.tagName === "a" || ((i = n().properties) == null ? void 0 : i.href) || n().href ? e.linkComponent || "a" : e.block.tagName || "div";
|
|
44
43
|
}, B = function() {
|
|
45
44
|
var m, k;
|
|
46
45
|
if ((m = e.block.repeat) != null && m.collection)
|
|
47
46
|
return !!((k = d()) != null && k.length);
|
|
48
|
-
const c = "hide" in
|
|
49
|
-
return ("show" in
|
|
47
|
+
const c = "hide" in n() ? n().hide : !1;
|
|
48
|
+
return ("show" in n() ? n().show : !0) && !c;
|
|
50
49
|
}, R = function() {
|
|
51
50
|
var i, m;
|
|
52
|
-
return !((i = r()) != null && i.component) && !d() ? (m =
|
|
51
|
+
return !((i = r()) != null && i.component) && !d() ? (m = n().children) != null ? m : [] : [];
|
|
53
52
|
}, o = function() {
|
|
54
53
|
var c, i, m, k;
|
|
55
54
|
return {
|
|
56
|
-
blockChildren: (c =
|
|
55
|
+
blockChildren: (c = n().children) != null ? c : [],
|
|
57
56
|
componentRef: (i = r()) == null ? void 0 : i.component,
|
|
58
57
|
componentOptions: {
|
|
59
|
-
...S(
|
|
60
|
-
...W(r(),
|
|
58
|
+
...S(n(), e.context),
|
|
59
|
+
...W(r(), n()),
|
|
61
60
|
...T(r(), e.context),
|
|
62
61
|
...L(r(), e.linkComponent),
|
|
63
62
|
...U(
|
|
@@ -69,18 +68,18 @@ function N(e) {
|
|
|
69
68
|
context: e.context,
|
|
70
69
|
linkComponent: e.linkComponent,
|
|
71
70
|
registeredComponents: e.registeredComponents,
|
|
72
|
-
builderBlock:
|
|
71
|
+
builderBlock: n(),
|
|
73
72
|
includeBlockProps: ((m = r()) == null ? void 0 : m.noWrap) === !0,
|
|
74
73
|
isInteractive: !((k = r()) != null && k.isRSC && v === "rsc")
|
|
75
74
|
};
|
|
76
75
|
};
|
|
77
76
|
return /* @__PURE__ */ l(u, { children: B() ? /* @__PURE__ */ h(u, { children: [
|
|
78
|
-
/* @__PURE__ */ l(j, { block:
|
|
79
|
-
(a = r()) != null && a.noWrap ? d() ? /* @__PURE__ */ l(u, { children: (f = d()) == null ? void 0 : f.map((
|
|
77
|
+
/* @__PURE__ */ l(j, { block: n(), context: e.context }),
|
|
78
|
+
(a = r()) != null && a.noWrap ? d() ? /* @__PURE__ */ l(u, { children: (f = d()) == null ? void 0 : f.map((t, c) => /* @__PURE__ */ l(
|
|
80
79
|
b,
|
|
81
80
|
{
|
|
82
|
-
repeatContext:
|
|
83
|
-
block:
|
|
81
|
+
repeatContext: t.context,
|
|
82
|
+
block: t.block,
|
|
84
83
|
registeredComponents: e.registeredComponents,
|
|
85
84
|
linkComponent: e.linkComponent
|
|
86
85
|
},
|
|
@@ -98,20 +97,20 @@ function N(e) {
|
|
|
98
97
|
includeBlockProps: o().includeBlockProps,
|
|
99
98
|
isInteractive: o().isInteractive
|
|
100
99
|
}
|
|
101
|
-
) : /* @__PURE__ */ l(u, { children: d() ? /* @__PURE__ */ l(u, { children: (p = d()) == null ? void 0 : p.map((
|
|
100
|
+
) : /* @__PURE__ */ l(u, { children: d() ? /* @__PURE__ */ l(u, { children: (p = d()) == null ? void 0 : p.map((t, c) => /* @__PURE__ */ l(
|
|
102
101
|
b,
|
|
103
102
|
{
|
|
104
|
-
repeatContext:
|
|
105
|
-
block:
|
|
103
|
+
repeatContext: t.context,
|
|
104
|
+
block: t.block,
|
|
106
105
|
registeredComponents: e.registeredComponents,
|
|
107
106
|
linkComponent: e.linkComponent
|
|
108
107
|
},
|
|
109
108
|
c
|
|
110
109
|
)) }) : /* @__PURE__ */ h(
|
|
111
|
-
|
|
110
|
+
N,
|
|
112
111
|
{
|
|
113
112
|
Wrapper: g(),
|
|
114
|
-
block:
|
|
113
|
+
block: n(),
|
|
115
114
|
context: e.context,
|
|
116
115
|
children: [
|
|
117
116
|
/* @__PURE__ */ l(
|
|
@@ -128,15 +127,15 @@ function N(e) {
|
|
|
128
127
|
isInteractive: o().isInteractive
|
|
129
128
|
}
|
|
130
129
|
),
|
|
131
|
-
(C = R()) == null ? void 0 : C.map((
|
|
132
|
-
|
|
130
|
+
(C = R()) == null ? void 0 : C.map((t) => /* @__PURE__ */ l(
|
|
131
|
+
y,
|
|
133
132
|
{
|
|
134
|
-
block:
|
|
133
|
+
block: t,
|
|
135
134
|
registeredComponents: e.registeredComponents,
|
|
136
135
|
linkComponent: e.linkComponent,
|
|
137
136
|
context: e.context
|
|
138
137
|
},
|
|
139
|
-
|
|
138
|
+
t.id
|
|
140
139
|
))
|
|
141
140
|
]
|
|
142
141
|
}
|
|
@@ -144,5 +143,5 @@ function N(e) {
|
|
|
144
143
|
] }) : null });
|
|
145
144
|
}
|
|
146
145
|
export {
|
|
147
|
-
|
|
146
|
+
y as default
|
|
148
147
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";"use strict";const
|
|
1
|
+
"use client";"use strict";const i=require("react/jsx-runtime"),l=require("react"),s=require("../../functions/is-editing.cjs");function d(e){const c=l.useRef(null);function o(){var t;return["builder-blocks",(t=e.blocks)!=null&&t.length?"":"no-blocks",e.classNameProp].filter(Boolean).join(" ")}function a(){if(!e.path)return;const t="component.options.";return e.path.startsWith(t)?e.path:`${t}${e.path||""}`}function r(){var t,n;s.isEditing()&&!((t=e.blocks)!=null&&t.length)&&((n=window.parent)==null||n.postMessage({type:"builder.clickEmptyBlocks",data:{parentElementId:e.parent,dataPath:a()}},"*"))}function u(){var t,n;s.isEditing()&&!((t=e.blocks)!=null&&t.length)&&((n=window.parent)==null||n.postMessage({type:"builder.hoverEmptyBlocks",data:{parentElementId:e.parent,dataPath:a()}},"*"))}return l.useEffect(()=>{},[]),i.jsxs(i.Fragment,{children:[i.jsx(e.BlocksWrapper,{ref:c,className:o()+" props-blocks-wrapper-754e6138","builder-path":a(),"builder-parent-id":e.parent,style:e.styleProp,onClick:t=>r(),onMouseEnter:t=>u(),onKeyPress:t=>r(),...e.BlocksWrapperProps,children:e.children}),i.jsx("style",{children:`.props-blocks-wrapper-754e6138 {
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
align-items: stretch;
|
|
@@ -50,7 +50,7 @@ function b(e) {
|
|
|
50
50
|
e.BlocksWrapper,
|
|
51
51
|
{
|
|
52
52
|
ref: o,
|
|
53
|
-
className: c() + " props-blocks-wrapper-
|
|
53
|
+
className: c() + " props-blocks-wrapper-754e6138",
|
|
54
54
|
"builder-path": a(),
|
|
55
55
|
"builder-parent-id": e.parent,
|
|
56
56
|
style: e.styleProp,
|
|
@@ -61,7 +61,7 @@ function b(e) {
|
|
|
61
61
|
children: e.children
|
|
62
62
|
}
|
|
63
63
|
),
|
|
64
|
-
/* @__PURE__ */ r("style", { children: `.props-blocks-wrapper-
|
|
64
|
+
/* @__PURE__ */ r("style", { children: `.props-blocks-wrapper-754e6138 {
|
|
65
65
|
display: flex;
|
|
66
66
|
flex-direction: column;
|
|
67
67
|
align-items: stretch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const
|
|
1
|
+
"use client";"use strict";const w=require("react/jsx-runtime"),o=require("react"),F=require("../../../context/builder.context.cjs"),V=require("../../../functions/evaluate/evaluate.cjs"),M=require("../../../functions/fast-clone.cjs"),N=require("../../../functions/get-content/index.cjs"),k=require("../../../functions/is-browser.cjs"),g=require("../../../functions/is-editing.cjs"),O=require("../../../functions/is-previewing.cjs"),W=require("../../../functions/log-fetch.cjs"),A=require("../../../functions/register-component.cjs"),y=require("../../../functions/track/index.cjs"),$=require("../../../functions/track/interaction.cjs"),P=require("../../../helpers/canTrack.cjs"),z=require("../../../helpers/preview-lru-cache/set.cjs"),G=require("../../../helpers/subscribe-to-editor.cjs"),L=require("../../../scripts/init-editing.cjs"),J=require("../../block/animator.cjs"),H=require("./enable-editor.helpers.cjs"),Q=require("./styles.helpers.cjs"),X=require("next/navigation");function Y(e){var q,I,R;const l=o.useRef(null);function f(n){var i,a;const t={...e.builderContextSignal.rootState,...n};e.builderContextSignal.rootSetState?(a=(i=e.builderContextSignal).rootSetState)==null||a.call(i,t):e.builderContextSignal.rootState=t}function m(n){var i,a,r,c,d;const t={...e.builderContextSignal.content,...n,data:{...(i=e.builderContextSignal.content)==null?void 0:i.data,...n==null?void 0:n.data},meta:{...(a=e.builderContextSignal.content)==null?void 0:a.meta,...n==null?void 0:n.meta,breakpoints:((r=n==null?void 0:n.meta)==null?void 0:r.breakpoints)||((d=(c=e.builderContextSignal.content)==null?void 0:c.meta)==null?void 0:d.breakpoints)}};z.postPreviewContent({value:t,key:t.id}).then(()=>{j.refresh()})}function T(){return e.showContent?{}:{hidden:!0,"aria-hidden":!0}}const[D,Z]=o.useState(()=>e.contentWrapper||"div");function S(n){return G.createEditorListener({model:e.model,trustedHosts:e.trustedHosts,callbacks:{configureSdk:t=>{var r;const{breakpoints:i,contentId:a}=t;!a||a!==((r=e.builderContextSignal.content)==null?void 0:r.id)||i&&m({meta:{breakpoints:i}})},animation:t=>{J.triggerAnimation(t)},contentUpdate:t=>{m(t)}}})(n)}const[v,p]=o.useState(()=>({})),[b,ee]=o.useState(()=>({})),[h,K]=o.useState(()=>!1);function _(n){var t,i;if(e.builderContextSignal.content){const a=(t=e.builderContextSignal.content)==null?void 0:t.testVariationId,r=(i=e.builderContextSignal.content)==null?void 0:i.id;y._track({apiHost:e.apiHost,type:"click",canTrack:P.getDefaultCanTrack(e.canTrack),contentId:r,apiKey:e.apiKey,variationId:a!==r?a:void 0,...$.getInteractionPropertiesForEvent(n),unique:!h})}h||K(!0)}function U(){var t,i,a;const n=(a=(i=(t=e.builderContextSignal.content)==null?void 0:t.data)==null?void 0:i.httpRequests)!=null?a:{};Object.entries(n).forEach(([r,c])=>{if(!c||b[r]||v[r]&&!g.isEditing())return;b[r]=!0;const d=c.replace(/{{([^}]+)}}/g,(s,B)=>String(V.evaluate({code:B,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState})));W.logFetch(d),fetch(d).then(s=>s.json()).then(s=>{f({[r]:s}),v[r]=!0}).catch(s=>{console.error("error fetching dynamic data",c,s)}).finally(()=>{b[r]=!1})})}function u(){g.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:M.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}function E(n){window.addEventListener("message",S),L.registerInsertMenu(),L.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.enrich?{enrich:e.enrich}:{},...e.trustedHosts?{trustedHosts:e.trustedHosts}:{}}),Object.values(e.builderContextSignal.componentInfos).forEach(t=>{var i,a;if(!e.model||!((i=t.models)!=null&&i.length)||t.models.includes(e.model)){const r=A.createRegisterComponentMessage(t);(a=window.parent)==null||a.postMessage(r,"*")}}),window.addEventListener("builder:component:stateChangeListenerActivated",u)}function x(n){var c;const t=new URL(location.href).searchParams,i=t.get("builder.preview"),a=t.get(`builder.overrides.${i}`),r=t.get("apiKey")||t.get("builder.space");(i==="BUILDER_STUDIO"||i===e.model&&r===e.apiKey&&(!e.content||a===e.content.id))&&N.fetchOneEntry({model:e.model||"",apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion,...i==="BUILDER_STUDIO"&&((c=e.context)!=null&&c.symbolId)?{query:{id:e.context.symbolId}}:{}}).then(d=>{d&&m(d)})}const j=X.useRouter(),C=o.useRef(!1);return C.current||(U(),u(),C.current=!0),o.useEffect(()=>{var n;return(n=l.current)==null||n.addEventListener("initeditingbldr",E),()=>{var t;return(t=l.current)==null?void 0:t.removeEventListener("initeditingbldr",E)}},[]),o.useEffect(()=>{var n;return(n=l.current)==null||n.addEventListener("initpreviewingbldr",x),()=>{var t;return(t=l.current)==null?void 0:t.removeEventListener("initpreviewingbldr",x)}},[]),o.useEffect(()=>{var n,t;if(k.isBrowser()){if(g.isEditing()&&!e.isNestedRender&&l.current&&l.current.dispatchEvent(new CustomEvent("initeditingbldr")),e.builderContextSignal.content&&P.getDefaultCanTrack(e.canTrack)){const a=(n=e.builderContextSignal.content)==null?void 0:n.testVariationId,r=(t=e.builderContextSignal.content)==null?void 0:t.id,c=e.apiKey;y._track({apiHost:e.apiHost,type:"impression",canTrack:!0,contentId:r,apiKey:c,variationId:a!==r?a:void 0})}O.isPreviewing()&&g.isEditing()}},[]),o.useEffect(()=>{},[e.content]),o.useEffect(()=>{u()},[e.builderContextSignal.rootState]),o.useEffect(()=>{e.data&&f(e.data)},[e.data]),o.useEffect(()=>{e.locale&&f({locale:e.locale})},[e.locale]),o.useEffect(()=>()=>{k.isBrowser()&&(window.removeEventListener("message",S),window.removeEventListener("builder:component:stateChangeListenerActivated",u))},[]),w.jsx(F.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content||H.needsElementRefDivForEditing()?w.jsx(D,{ref:l,onClick:n=>_(n),"builder-content-id":(q=e.builderContextSignal.content)==null?void 0:q.id,"builder-model":e.model,className:Q.getWrapperClassName(((I=e.content)==null?void 0:I.testVariationId)||((R=e.content)==null?void 0:R.id)),style:{display:!e.builderContextSignal.content&&H.needsElementRefDivForEditing()?"none":void 0},...T(),...e.contentWrapperProps,children:e.children}):null})}module.exports=Y;
|