@builder.io/sdk-react-nextjs 0.18.8 → 0.18.10
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 +3 -2
- package/lib/browser/blocks/columns/columns.mjs +7 -6
- package/lib/browser/components/content/components/enable-editor.cjs +1 -1
- package/lib/browser/components/content/components/enable-editor.mjs +125 -125
- package/lib/browser/constants/sdk-version.cjs +1 -1
- package/lib/browser/constants/sdk-version.mjs +1 -1
- package/lib/browser/functions/get-content/generate-content-url.cjs +1 -1
- package/lib/browser/functions/get-content/generate-content-url.mjs +30 -30
- package/lib/browser/helpers/preview-lru-cache/set.cjs +1 -1
- package/lib/browser/helpers/preview-lru-cache/set.mjs +7 -5
- package/lib/edge/blocks/columns/columns.cjs +3 -2
- package/lib/edge/blocks/columns/columns.mjs +7 -6
- package/lib/edge/components/content/components/enable-editor.cjs +1 -1
- package/lib/edge/components/content/components/enable-editor.mjs +125 -125
- package/lib/edge/constants/sdk-version.cjs +1 -1
- package/lib/edge/constants/sdk-version.mjs +1 -1
- package/lib/edge/functions/get-content/generate-content-url.cjs +1 -1
- package/lib/edge/functions/get-content/generate-content-url.mjs +30 -30
- package/lib/edge/helpers/preview-lru-cache/set.cjs +1 -1
- package/lib/edge/helpers/preview-lru-cache/set.mjs +7 -5
- package/lib/node/blocks/columns/columns.cjs +3 -2
- package/lib/node/blocks/columns/columns.mjs +7 -6
- package/lib/node/components/content/components/enable-editor.cjs +1 -1
- package/lib/node/components/content/components/enable-editor.mjs +125 -125
- package/lib/node/constants/sdk-version.cjs +1 -1
- package/lib/node/constants/sdk-version.mjs +1 -1
- package/lib/node/functions/get-content/generate-content-url.cjs +1 -1
- package/lib/node/functions/get-content/generate-content-url.mjs +30 -30
- package/lib/node/helpers/preview-lru-cache/set.cjs +1 -1
- package/lib/node/helpers/preview-lru-cache/set.mjs +7 -5
- package/package.json +1 -1
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/cjs/helpers/preview-lru-cache/set.d.ts +3 -4
- package/types/esm/constants/sdk-version.d.ts +1 -1
- package/types/esm/helpers/preview-lru-cache/set.d.ts +3 -4
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import { flatten as
|
|
1
|
+
import { flatten as w, flattenMongoQuery as E, unflatten as F } from "../../helpers/flatten.mjs";
|
|
2
2
|
import { normalizeSearchParams as O } from "../../helpers/search/search.mjs";
|
|
3
3
|
import { DEFAULT_API_VERSION as J } from "../../types/api-version.mjs";
|
|
4
4
|
import { getBuilderSearchParamsFromWindow as L } from "../get-builder-search-params/index.mjs";
|
|
5
5
|
import { isBrowser as R } from "../is-browser.mjs";
|
|
6
|
-
const
|
|
6
|
+
const y = (t) => typeof t == "number" && !isNaN(t) && t >= 0, _ = (t) => {
|
|
7
7
|
const {
|
|
8
8
|
limit: a = 30,
|
|
9
9
|
userAttributes: r,
|
|
10
|
-
query:
|
|
11
|
-
model:
|
|
12
|
-
apiKey:
|
|
13
|
-
enrich:
|
|
14
|
-
locale:
|
|
10
|
+
query: u,
|
|
11
|
+
model: A,
|
|
12
|
+
apiKey: d,
|
|
13
|
+
enrich: P,
|
|
14
|
+
locale: N,
|
|
15
15
|
apiVersion: o = J,
|
|
16
|
-
fields:
|
|
17
|
-
omit:
|
|
18
|
-
offset:
|
|
19
|
-
cacheSeconds:
|
|
20
|
-
staleCacheSeconds:
|
|
21
|
-
sort:
|
|
22
|
-
includeUnpublished:
|
|
16
|
+
fields: S,
|
|
17
|
+
omit: c,
|
|
18
|
+
offset: l,
|
|
19
|
+
cacheSeconds: f,
|
|
20
|
+
staleCacheSeconds: m,
|
|
21
|
+
sort: p,
|
|
22
|
+
includeUnpublished: b,
|
|
23
23
|
apiHost: v
|
|
24
24
|
} = t;
|
|
25
|
-
if (!
|
|
25
|
+
if (!d)
|
|
26
26
|
throw new Error("Missing API key");
|
|
27
27
|
if (!["v3"].includes(o))
|
|
28
28
|
throw new Error(`Invalid apiVersion: expected 'v3', received '${o}'`);
|
|
29
|
-
const k = a !== 1, I = v || "https://cdn.builder.io", e = new URL(`${I}/api/${o}/content/${
|
|
30
|
-
e.searchParams.set("apiKey",
|
|
31
|
-
const
|
|
29
|
+
const k = a !== 1, I = v || "https://cdn.builder.io", e = new URL(`${I}/api/${o}/content/${A}`);
|
|
30
|
+
e.searchParams.set("apiKey", d), e.searchParams.set("limit", String(a)), e.searchParams.set("noTraverse", String(k)), e.searchParams.set("includeRefs", String(!0));
|
|
31
|
+
const h = N || (r == null ? void 0 : r.locale);
|
|
32
32
|
let i = r || {};
|
|
33
|
-
if (
|
|
34
|
-
locale:
|
|
33
|
+
if (h && (e.searchParams.set("locale", h), i = {
|
|
34
|
+
locale: h,
|
|
35
35
|
...i
|
|
36
|
-
}),
|
|
37
|
-
const s =
|
|
38
|
-
sort:
|
|
36
|
+
}), P && e.searchParams.set("enrich", String(P)), e.searchParams.set("omit", c != null ? c : "meta.componentsUsed"), S && e.searchParams.set("fields", S), Number.isFinite(l) && l > -1 && e.searchParams.set("offset", String(Math.floor(l))), typeof b == "boolean" && e.searchParams.set("includeUnpublished", String(b)), f && y(f) && e.searchParams.set("cacheSeconds", String(f)), m && y(m) && e.searchParams.set("staleCacheSeconds", String(m)), p) {
|
|
37
|
+
const s = w({
|
|
38
|
+
sort: p
|
|
39
39
|
});
|
|
40
40
|
for (const n in s)
|
|
41
41
|
e.searchParams.set(n, JSON.stringify(s[n]));
|
|
42
42
|
}
|
|
43
|
-
const
|
|
43
|
+
const g = {
|
|
44
44
|
...L(),
|
|
45
45
|
...O(t.options || {})
|
|
46
46
|
};
|
|
47
47
|
i = {
|
|
48
48
|
...i,
|
|
49
|
-
...$(
|
|
49
|
+
...$(g)
|
|
50
50
|
};
|
|
51
|
-
const
|
|
52
|
-
for (const s in
|
|
53
|
-
e.searchParams.set(s, String(
|
|
54
|
-
if (Object.keys(i).length > 0 && e.searchParams.set("userAttributes", JSON.stringify(i)),
|
|
51
|
+
const U = w(g);
|
|
52
|
+
for (const s in U)
|
|
53
|
+
e.searchParams.set(s, String(U[s]));
|
|
54
|
+
if (Object.keys(i).length > 0 && e.searchParams.set("userAttributes", JSON.stringify(i)), u) {
|
|
55
55
|
const s = E({
|
|
56
|
-
query:
|
|
56
|
+
query: u
|
|
57
57
|
});
|
|
58
58
|
for (const n in s)
|
|
59
59
|
e.searchParams.set(n, JSON.stringify(s[n]));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use server";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./init.cjs");async function
|
|
1
|
+
"use server";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("next/cache"),r=require("./init.cjs");async function o({key:e,value:t,url:i}){r.init(),globalThis._BUILDER_PREVIEW_LRU_CACHE.set(e,t),n.revalidatePath(i)}exports.postPreviewContent=o;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use server";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { revalidatePath as r } from "next/cache";
|
|
3
|
+
import { init as i } from "./init.mjs";
|
|
4
|
+
async function a({
|
|
4
5
|
key: t,
|
|
5
|
-
value:
|
|
6
|
+
value: e,
|
|
7
|
+
url: o
|
|
6
8
|
}) {
|
|
7
|
-
|
|
9
|
+
i(), globalThis._BUILDER_PREVIEW_LRU_CACHE.set(t, e), r(o);
|
|
8
10
|
}
|
|
9
11
|
export {
|
|
10
|
-
|
|
12
|
+
a as postPreviewContent
|
|
11
13
|
};
|
|
@@ -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 f
|
|
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`,h="100%",k=0;return{...{display:"flex",flexDirection:"column",alignItems:"stretch"},width:l,["marginLeft"]:r,"--column-width-mobile":d({stackedStyle:h,desktopStyle:l}),"--column-margin-left-mobile":d({stackedStyle:k,desktopStyle:r}),"--column-width-tablet":c({stackedStyle:h,desktopStyle:l}),"--column-margin-left-tablet":c({stackedStyle:k,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,8 @@
|
|
|
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((
|
|
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-3cd4dbac",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,context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent,blocks:n.blocks,styleProp:{flexGrow:"1"}})},t))]}),o.jsx("style",{children:`.div-3cd4dbac {
|
|
26
26
|
display: flex;
|
|
27
27
|
line-height: normal;
|
|
28
|
+
height: 100%;
|
|
28
29
|
}`})]})}module.exports=N;
|
|
@@ -7,7 +7,7 @@ import { getClassPropName as N } from "../../functions/get-class-prop-name.mjs";
|
|
|
7
7
|
import { mapStyleObjToStrIfNeeded as T } from "../../functions/get-style.mjs";
|
|
8
8
|
import { getColumnsClass as D } from "./helpers.mjs";
|
|
9
9
|
function q(e) {
|
|
10
|
-
var
|
|
10
|
+
var f, g;
|
|
11
11
|
const a = function() {
|
|
12
12
|
return typeof e.space == "number" ? e.space || 0 : 20;
|
|
13
13
|
}, s = function() {
|
|
@@ -69,7 +69,7 @@ function q(e) {
|
|
|
69
69
|
desktopStyle: o
|
|
70
70
|
})
|
|
71
71
|
};
|
|
72
|
-
},
|
|
72
|
+
}, b = function(t) {
|
|
73
73
|
var l, o;
|
|
74
74
|
return L(
|
|
75
75
|
((o = (l = e.builderContext.content) == null ? void 0 : l.meta) == null ? void 0 : o.breakpoints) || {}
|
|
@@ -77,7 +77,7 @@ function q(e) {
|
|
|
77
77
|
}, p = function() {
|
|
78
78
|
const t = `.${e.builderBlock.id}-breakpoints > .builder-column`;
|
|
79
79
|
return `
|
|
80
|
-
@media (max-width: ${
|
|
80
|
+
@media (max-width: ${b("medium")}px) {
|
|
81
81
|
.${e.builderBlock.id}-breakpoints {
|
|
82
82
|
flex-direction: var(--flex-dir-tablet);
|
|
83
83
|
align-items: stretch;
|
|
@@ -89,7 +89,7 @@ function q(e) {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
@media (max-width: ${
|
|
92
|
+
@media (max-width: ${b("small")}px) {
|
|
93
93
|
.${e.builderBlock.id}-breakpoints {
|
|
94
94
|
flex-direction: var(--flex-dir);
|
|
95
95
|
align-items: stretch;
|
|
@@ -114,7 +114,7 @@ function q(e) {
|
|
|
114
114
|
/* @__PURE__ */ y(
|
|
115
115
|
"div",
|
|
116
116
|
{
|
|
117
|
-
className: D((
|
|
117
|
+
className: D((f = e.builderBlock) == null ? void 0 : f.id) + " div-3cd4dbac",
|
|
118
118
|
style: v(),
|
|
119
119
|
children: [
|
|
120
120
|
/* @__PURE__ */ r(
|
|
@@ -151,9 +151,10 @@ function q(e) {
|
|
|
151
151
|
]
|
|
152
152
|
}
|
|
153
153
|
),
|
|
154
|
-
/* @__PURE__ */ r("style", { children: `.div-
|
|
154
|
+
/* @__PURE__ */ r("style", { children: `.div-3cd4dbac {
|
|
155
155
|
display: flex;
|
|
156
156
|
line-height: normal;
|
|
157
|
+
height: 100%;
|
|
157
158
|
}` })
|
|
158
159
|
] });
|
|
159
160
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const
|
|
1
|
+
"use client";"use strict";const R=require("react/jsx-runtime"),o=require("react"),j=require("../../../context/builder.context.cjs"),B=require("../../../functions/evaluate/evaluate.cjs"),F=require("../../../functions/fast-clone.cjs"),N=require("../../../functions/get-content/index.cjs"),k=require("../../../functions/is-browser.cjs"),f=require("../../../functions/is-editing.cjs"),M=require("../../../functions/is-previewing.cjs"),O=require("../../../functions/log-fetch.cjs"),W=require("../../../functions/register-component.cjs"),y=require("../../../functions/track/index.cjs"),A=require("../../../functions/track/interaction.cjs"),P=require("../../../helpers/canTrack.cjs"),$=require("../../../helpers/cookie.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,w;const s=o.useRef(null);o.useState(()=>!1);function u(n){var i,r;const t={...e.builderContextSignal.rootState,...n};e.builderContextSignal.rootSetState?(r=(i=e.builderContextSignal).rootSetState)==null||r.call(i,t):e.builderContextSignal.rootState=t}function m(n){var i,r,a,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:{...(r=e.builderContextSignal.content)==null?void 0:r.meta,...n==null?void 0:n.meta,breakpoints:((a=n==null?void 0:n.meta)==null?void 0:a.breakpoints)||((d=(c=e.builderContextSignal.content)==null?void 0:c.meta)==null?void 0:d.breakpoints)}};z.postPreviewContent({value:t,key:t.id,url:window.location.pathname})}function K(){return e.showContent?{}:{hidden:!0,"aria-hidden":!0}}const[T,Z]=o.useState(()=>e.contentWrapper||"div");function S(n){return G.createEditorListener({model:e.model,trustedHosts:e.trustedHosts,callbacks:{configureSdk:t=>{var a;const{breakpoints:i,contentId:r}=t;!r||r!==((a=e.builderContextSignal.content)==null?void 0:a.id)||i&&m({meta:{breakpoints:i}})},animation:t=>{J.triggerAnimation(t)},contentUpdate:t=>{m(t)},stateUpdate:t=>{u(t)}}})(n)}const[v,p]=o.useState(()=>({})),[b,ee]=o.useState(()=>({})),[E,D]=o.useState(()=>!1);function _(n){var t,i;if(e.builderContextSignal.content){const r=(t=e.builderContextSignal.content)==null?void 0:t.testVariationId,a=(i=e.builderContextSignal.content)==null?void 0:i.id;y._track({apiHost:e.apiHost,type:"click",canTrack:P.getDefaultCanTrack(e.canTrack),contentId:a,apiKey:e.apiKey,variationId:r!==a?r:void 0,...A.getInteractionPropertiesForEvent(n),unique:!E})}E||D(!0)}function U(){var t,i,r;const n=(r=(i=(t=e.builderContextSignal.content)==null?void 0:t.data)==null?void 0:i.httpRequests)!=null?r:{};Object.entries(n).forEach(([a,c])=>{if(!c||b[a]||v[a]&&!f.isEditing())return;b[a]=!0;const d=c.replace(/{{([^}]+)}}/g,(l,V)=>String(B.evaluate({code:V,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState})));O.logFetch(d),fetch(d).then(l=>l.json()).then(l=>{u({[a]:l}),v[a]=!0}).catch(l=>{console.error("error fetching dynamic data",c,l)}).finally(()=>{b[a]=!1})})}function g(){f.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:F.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}function h(n){var t;window.addEventListener("message",S),L.registerInsertMenu(),L.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.enrich?{enrich:e.enrich}:{},...e.trustedHosts?{trustedHosts:e.trustedHosts}:{},modelName:(t=e.model)!=null?t:"",apiKey:e.apiKey}),Object.values(e.builderContextSignal.componentInfos).forEach(i=>{var r,a;if(!((r=i.models)!=null&&r.length)||i.models.includes(e.model)){const c=W.createRegisterComponentMessage(i);(a=window.parent)==null||a.postMessage(c,"*")}}),window.addEventListener("builder:component:stateChangeListenerActivated",g)}function x(n){var c;const t=new URL(location.href).searchParams,i=t.get("builder.preview"),r=t.get(`builder.overrides.${i}`),a=t.get("apiKey")||t.get("builder.space");(i==="BUILDER_STUDIO"||i===e.model&&a===e.apiKey&&(!e.content||r===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)})}X.useRouter();const C=o.useRef(!1);return C.current||(U(),g(),C.current=!0),o.useEffect(()=>{var n;return(n=s.current)==null||n.addEventListener("initeditingbldr",h),()=>{var t;return(t=s.current)==null?void 0:t.removeEventListener("initeditingbldr",h)}},[]),o.useEffect(()=>{var n;return(n=s.current)==null||n.addEventListener("initpreviewingbldr",x),()=>{var t;return(t=s.current)==null?void 0:t.removeEventListener("initpreviewingbldr",x)}},[]),o.useEffect(()=>{var n,t,i;if(k.isBrowser()){f.isEditing()&&!e.isNestedRender&&s.current&&s.current.dispatchEvent(new CustomEvent("initeditingbldr"));const r=e.builderContextSignal.content&&P.getDefaultCanTrack(e.canTrack),a=$.getCookieSync({name:`builder.tests.${(n=e.builderContextSignal.content)==null?void 0:n.id}`,canTrack:!0}),c=(t=e.builderContextSignal.content)==null?void 0:t.testVariationId;if(r&&c===a){const d=(i=e.builderContextSignal.content)==null?void 0:i.id,l=e.apiKey;y._track({apiHost:e.apiHost,type:"impression",canTrack:!0,contentId:d,apiKey:l,variationId:a!==d?a:void 0})}M.isPreviewing()&&f.isEditing()}},[]),o.useEffect(()=>{},[e.content]),o.useEffect(()=>{g()},[e.builderContextSignal.rootState]),o.useEffect(()=>{e.data&&u(e.data)},[e.data]),o.useEffect(()=>{e.locale&&u({locale:e.locale})},[e.locale]),o.useEffect(()=>()=>{k.isBrowser()&&(window.removeEventListener("message",S),window.removeEventListener("builder:component:stateChangeListenerActivated",g))},[]),R.jsx(j.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content||H.needsElementRefDivForEditing()?R.jsx(T,{ref:s,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)||((w=e.content)==null?void 0:w.id)),style:{display:!e.builderContextSignal.content&&H.needsElementRefDivForEditing()?"none":void 0},...K(),...e.contentWrapperProps,children:e.children}):null})}module.exports=Y;
|
|
@@ -1,138 +1,137 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as k } from "react/jsx-runtime";
|
|
3
3
|
import { useRef as P, useState as m, useEffect as c } from "react";
|
|
4
|
-
import
|
|
5
|
-
import { evaluate as
|
|
6
|
-
import { fastClone as
|
|
7
|
-
import { fetchOneEntry as
|
|
4
|
+
import M from "../../../context/builder.context.mjs";
|
|
5
|
+
import { evaluate as O } from "../../../functions/evaluate/evaluate.mjs";
|
|
6
|
+
import { fastClone as W } from "../../../functions/fast-clone.mjs";
|
|
7
|
+
import { fetchOneEntry as j } from "../../../functions/get-content/index.mjs";
|
|
8
8
|
import { isBrowser as L } from "../../../functions/is-browser.mjs";
|
|
9
9
|
import { isEditing as g } from "../../../functions/is-editing.mjs";
|
|
10
|
-
import { isPreviewing as
|
|
11
|
-
import { logFetch as
|
|
12
|
-
import { createRegisterComponentMessage as
|
|
10
|
+
import { isPreviewing as A } from "../../../functions/is-previewing.mjs";
|
|
11
|
+
import { logFetch as B } from "../../../functions/log-fetch.mjs";
|
|
12
|
+
import { createRegisterComponentMessage as F } from "../../../functions/register-component.mjs";
|
|
13
13
|
import { _track as H } from "../../../functions/track/index.mjs";
|
|
14
|
-
import { getInteractionPropertiesForEvent as
|
|
14
|
+
import { getInteractionPropertiesForEvent as $ } from "../../../functions/track/interaction.mjs";
|
|
15
15
|
import { getDefaultCanTrack as K } from "../../../helpers/canTrack.mjs";
|
|
16
|
-
import { getCookieSync as
|
|
17
|
-
import { postPreviewContent as
|
|
18
|
-
import { createEditorListener as
|
|
19
|
-
import { registerInsertMenu as
|
|
20
|
-
import { triggerAnimation as
|
|
16
|
+
import { getCookieSync as z } from "../../../helpers/cookie.mjs";
|
|
17
|
+
import { postPreviewContent as G } from "../../../helpers/preview-lru-cache/set.mjs";
|
|
18
|
+
import { createEditorListener as J } from "../../../helpers/subscribe-to-editor.mjs";
|
|
19
|
+
import { registerInsertMenu as Q, setupBrowserForEditing as X } from "../../../scripts/init-editing.mjs";
|
|
20
|
+
import { triggerAnimation as Y } from "../../block/animator.mjs";
|
|
21
21
|
import { needsElementRefDivForEditing as q } from "./enable-editor.helpers.mjs";
|
|
22
|
-
import { getWrapperClassName as
|
|
23
|
-
import { useRouter as
|
|
24
|
-
function
|
|
25
|
-
var y, R
|
|
22
|
+
import { getWrapperClassName as Z } from "./styles.helpers.mjs";
|
|
23
|
+
import { useRouter as p } from "next/navigation";
|
|
24
|
+
function Rt(t) {
|
|
25
|
+
var w, y, R;
|
|
26
26
|
const u = P(null);
|
|
27
27
|
m(() => !1);
|
|
28
28
|
function s(n) {
|
|
29
|
-
var i,
|
|
30
|
-
const
|
|
31
|
-
...
|
|
29
|
+
var i, o;
|
|
30
|
+
const e = {
|
|
31
|
+
...t.builderContextSignal.rootState,
|
|
32
32
|
...n
|
|
33
33
|
};
|
|
34
|
-
|
|
34
|
+
t.builderContextSignal.rootSetState ? (o = (i = t.builderContextSignal).rootSetState) == null || o.call(i, e) : t.builderContextSignal.rootState = e;
|
|
35
35
|
}
|
|
36
36
|
function b(n) {
|
|
37
|
-
var i,
|
|
38
|
-
const
|
|
39
|
-
...
|
|
37
|
+
var i, o, a, r, d;
|
|
38
|
+
const e = {
|
|
39
|
+
...t.builderContextSignal.content,
|
|
40
40
|
...n,
|
|
41
41
|
data: {
|
|
42
|
-
...(i =
|
|
42
|
+
...(i = t.builderContextSignal.content) == null ? void 0 : i.data,
|
|
43
43
|
...n == null ? void 0 : n.data
|
|
44
44
|
},
|
|
45
45
|
meta: {
|
|
46
|
-
...(
|
|
46
|
+
...(o = t.builderContextSignal.content) == null ? void 0 : o.meta,
|
|
47
47
|
...n == null ? void 0 : n.meta,
|
|
48
|
-
breakpoints: ((a = n == null ? void 0 : n.meta) == null ? void 0 : a.breakpoints) || ((d = (
|
|
48
|
+
breakpoints: ((a = n == null ? void 0 : n.meta) == null ? void 0 : a.breakpoints) || ((d = (r = t.builderContextSignal.content) == null ? void 0 : r.meta) == null ? void 0 : d.breakpoints)
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
|
-
|
|
52
|
-
value:
|
|
53
|
-
key:
|
|
54
|
-
|
|
55
|
-
_.refresh();
|
|
51
|
+
G({
|
|
52
|
+
value: e,
|
|
53
|
+
key: e.id,
|
|
54
|
+
url: window.location.pathname
|
|
56
55
|
});
|
|
57
56
|
}
|
|
58
57
|
function T() {
|
|
59
|
-
return
|
|
58
|
+
return t.showContent ? {} : {
|
|
60
59
|
hidden: !0,
|
|
61
60
|
"aria-hidden": !0
|
|
62
61
|
};
|
|
63
62
|
}
|
|
64
|
-
const [U,
|
|
65
|
-
() =>
|
|
63
|
+
const [U, tt] = m(
|
|
64
|
+
() => t.contentWrapper || "div"
|
|
66
65
|
);
|
|
67
66
|
function v(n) {
|
|
68
|
-
return
|
|
69
|
-
model:
|
|
70
|
-
trustedHosts:
|
|
67
|
+
return J({
|
|
68
|
+
model: t.model,
|
|
69
|
+
trustedHosts: t.trustedHosts,
|
|
71
70
|
callbacks: {
|
|
72
|
-
configureSdk: (
|
|
71
|
+
configureSdk: (e) => {
|
|
73
72
|
var a;
|
|
74
|
-
const { breakpoints: i, contentId:
|
|
75
|
-
!
|
|
73
|
+
const { breakpoints: i, contentId: o } = e;
|
|
74
|
+
!o || o !== ((a = t.builderContextSignal.content) == null ? void 0 : a.id) || i && b({
|
|
76
75
|
meta: {
|
|
77
76
|
breakpoints: i
|
|
78
77
|
}
|
|
79
78
|
});
|
|
80
79
|
},
|
|
81
|
-
animation: (
|
|
82
|
-
|
|
80
|
+
animation: (e) => {
|
|
81
|
+
Y(e);
|
|
83
82
|
},
|
|
84
|
-
contentUpdate: (
|
|
85
|
-
b(
|
|
83
|
+
contentUpdate: (e) => {
|
|
84
|
+
b(e);
|
|
86
85
|
},
|
|
87
|
-
stateUpdate: (
|
|
88
|
-
s(
|
|
86
|
+
stateUpdate: (e) => {
|
|
87
|
+
s(e);
|
|
89
88
|
}
|
|
90
89
|
}
|
|
91
90
|
})(n);
|
|
92
91
|
}
|
|
93
|
-
const [h,
|
|
92
|
+
const [h, et] = m(() => ({})), [S, nt] = m(() => ({})), [x, D] = m(() => !1);
|
|
94
93
|
function V(n) {
|
|
95
|
-
var
|
|
96
|
-
if (
|
|
97
|
-
const
|
|
94
|
+
var e, i;
|
|
95
|
+
if (t.builderContextSignal.content) {
|
|
96
|
+
const o = (e = t.builderContextSignal.content) == null ? void 0 : e.testVariationId, a = (i = t.builderContextSignal.content) == null ? void 0 : i.id;
|
|
98
97
|
H({
|
|
99
|
-
apiHost:
|
|
98
|
+
apiHost: t.apiHost,
|
|
100
99
|
type: "click",
|
|
101
|
-
canTrack: K(
|
|
100
|
+
canTrack: K(t.canTrack),
|
|
102
101
|
contentId: a,
|
|
103
|
-
apiKey:
|
|
104
|
-
variationId:
|
|
105
|
-
|
|
102
|
+
apiKey: t.apiKey,
|
|
103
|
+
variationId: o !== a ? o : void 0,
|
|
104
|
+
...$(n),
|
|
106
105
|
unique: !x
|
|
107
106
|
});
|
|
108
107
|
}
|
|
109
108
|
x || D(!0);
|
|
110
109
|
}
|
|
111
110
|
function N() {
|
|
112
|
-
var
|
|
113
|
-
const n = (
|
|
114
|
-
Object.entries(n).forEach(([a,
|
|
115
|
-
if (!
|
|
111
|
+
var e, i, o;
|
|
112
|
+
const n = (o = (i = (e = t.builderContextSignal.content) == null ? void 0 : e.data) == null ? void 0 : i.httpRequests) != null ? o : {};
|
|
113
|
+
Object.entries(n).forEach(([a, r]) => {
|
|
114
|
+
if (!r || S[a] || h[a] && !g())
|
|
116
115
|
return;
|
|
117
116
|
S[a] = !0;
|
|
118
|
-
const d =
|
|
117
|
+
const d = r.replace(
|
|
119
118
|
/{{([^}]+)}}/g,
|
|
120
|
-
(l,
|
|
121
|
-
|
|
122
|
-
code:
|
|
123
|
-
context:
|
|
119
|
+
(l, _) => String(
|
|
120
|
+
O({
|
|
121
|
+
code: _,
|
|
122
|
+
context: t.context || {},
|
|
124
123
|
localState: void 0,
|
|
125
|
-
rootState:
|
|
126
|
-
rootSetState:
|
|
124
|
+
rootState: t.builderContextSignal.rootState,
|
|
125
|
+
rootSetState: t.builderContextSignal.rootSetState
|
|
127
126
|
})
|
|
128
127
|
)
|
|
129
128
|
);
|
|
130
|
-
|
|
129
|
+
B(d), fetch(d).then((l) => l.json()).then((l) => {
|
|
131
130
|
s({
|
|
132
131
|
[a]: l
|
|
133
132
|
}), h[a] = !0;
|
|
134
133
|
}).catch((l) => {
|
|
135
|
-
console.error("error fetching dynamic data",
|
|
134
|
+
console.error("error fetching dynamic data", r, l);
|
|
136
135
|
}).finally(() => {
|
|
137
136
|
S[a] = !1;
|
|
138
137
|
});
|
|
@@ -144,9 +143,9 @@ function ke(e) {
|
|
|
144
143
|
"builder:component:stateChange",
|
|
145
144
|
{
|
|
146
145
|
detail: {
|
|
147
|
-
state:
|
|
146
|
+
state: W(t.builderContextSignal.rootState),
|
|
148
147
|
ref: {
|
|
149
|
-
name:
|
|
148
|
+
name: t.model
|
|
150
149
|
}
|
|
151
150
|
}
|
|
152
151
|
}
|
|
@@ -154,26 +153,26 @@ function ke(e) {
|
|
|
154
153
|
);
|
|
155
154
|
}
|
|
156
155
|
function C(n) {
|
|
157
|
-
var
|
|
158
|
-
window.addEventListener("message", v),
|
|
159
|
-
...
|
|
160
|
-
locale:
|
|
156
|
+
var e;
|
|
157
|
+
window.addEventListener("message", v), Q(), X({
|
|
158
|
+
...t.locale ? {
|
|
159
|
+
locale: t.locale
|
|
161
160
|
} : {},
|
|
162
|
-
...
|
|
163
|
-
enrich:
|
|
161
|
+
...t.enrich ? {
|
|
162
|
+
enrich: t.enrich
|
|
164
163
|
} : {},
|
|
165
|
-
...
|
|
166
|
-
trustedHosts:
|
|
164
|
+
...t.trustedHosts ? {
|
|
165
|
+
trustedHosts: t.trustedHosts
|
|
167
166
|
} : {},
|
|
168
|
-
modelName: (
|
|
169
|
-
apiKey:
|
|
167
|
+
modelName: (e = t.model) != null ? e : "",
|
|
168
|
+
apiKey: t.apiKey
|
|
170
169
|
}), Object.values(
|
|
171
|
-
|
|
170
|
+
t.builderContextSignal.componentInfos
|
|
172
171
|
).forEach((i) => {
|
|
173
|
-
var
|
|
174
|
-
if (!((
|
|
175
|
-
const
|
|
176
|
-
(a = window.parent) == null || a.postMessage(
|
|
172
|
+
var o, a;
|
|
173
|
+
if (!((o = i.models) != null && o.length) || i.models.includes(t.model)) {
|
|
174
|
+
const r = F(i);
|
|
175
|
+
(a = window.parent) == null || a.postMessage(r, "*");
|
|
177
176
|
}
|
|
178
177
|
}), window.addEventListener(
|
|
179
178
|
"builder:component:stateChangeListenerActivated",
|
|
@@ -181,32 +180,33 @@ function ke(e) {
|
|
|
181
180
|
);
|
|
182
181
|
}
|
|
183
182
|
function E(n) {
|
|
184
|
-
var
|
|
185
|
-
const
|
|
183
|
+
var r;
|
|
184
|
+
const e = new URL(location.href).searchParams, i = e.get("builder.preview"), o = e.get(
|
|
186
185
|
`builder.overrides.${i}`
|
|
187
|
-
), a =
|
|
188
|
-
(i === "BUILDER_STUDIO" || i ===
|
|
189
|
-
model:
|
|
190
|
-
apiKey:
|
|
191
|
-
apiVersion:
|
|
192
|
-
...i === "BUILDER_STUDIO" && ((
|
|
186
|
+
), a = e.get("apiKey") || e.get("builder.space");
|
|
187
|
+
(i === "BUILDER_STUDIO" || i === t.model && a === t.apiKey && (!t.content || o === t.content.id)) && j({
|
|
188
|
+
model: t.model,
|
|
189
|
+
apiKey: t.apiKey,
|
|
190
|
+
apiVersion: t.builderContextSignal.apiVersion,
|
|
191
|
+
...i === "BUILDER_STUDIO" && ((r = t.context) != null && r.symbolId) ? {
|
|
193
192
|
query: {
|
|
194
|
-
id:
|
|
193
|
+
id: t.context.symbolId
|
|
195
194
|
}
|
|
196
195
|
} : {}
|
|
197
196
|
}).then((d) => {
|
|
198
197
|
d && b(d);
|
|
199
198
|
});
|
|
200
199
|
}
|
|
201
|
-
|
|
200
|
+
p();
|
|
201
|
+
const I = P(!1);
|
|
202
202
|
return I.current || (N(), f(), I.current = !0), c(() => {
|
|
203
203
|
var n;
|
|
204
204
|
return (n = u.current) == null || n.addEventListener(
|
|
205
205
|
"initeditingbldr",
|
|
206
206
|
C
|
|
207
207
|
), () => {
|
|
208
|
-
var
|
|
209
|
-
return (
|
|
208
|
+
var e;
|
|
209
|
+
return (e = u.current) == null ? void 0 : e.removeEventListener(
|
|
210
210
|
"initeditingbldr",
|
|
211
211
|
C
|
|
212
212
|
);
|
|
@@ -217,24 +217,24 @@ function ke(e) {
|
|
|
217
217
|
"initpreviewingbldr",
|
|
218
218
|
E
|
|
219
219
|
), () => {
|
|
220
|
-
var
|
|
221
|
-
return (
|
|
220
|
+
var e;
|
|
221
|
+
return (e = u.current) == null ? void 0 : e.removeEventListener(
|
|
222
222
|
"initpreviewingbldr",
|
|
223
223
|
E
|
|
224
224
|
);
|
|
225
225
|
};
|
|
226
226
|
}, []), c(() => {
|
|
227
|
-
var n,
|
|
227
|
+
var n, e, i;
|
|
228
228
|
if (L()) {
|
|
229
|
-
g() && !
|
|
230
|
-
const
|
|
231
|
-
name: `builder.tests.${(n =
|
|
229
|
+
g() && !t.isNestedRender && u.current && u.current.dispatchEvent(new CustomEvent("initeditingbldr"));
|
|
230
|
+
const o = t.builderContextSignal.content && K(t.canTrack), a = z({
|
|
231
|
+
name: `builder.tests.${(n = t.builderContextSignal.content) == null ? void 0 : n.id}`,
|
|
232
232
|
canTrack: !0
|
|
233
|
-
}),
|
|
234
|
-
if (
|
|
235
|
-
const d = (i =
|
|
233
|
+
}), r = (e = t.builderContextSignal.content) == null ? void 0 : e.testVariationId;
|
|
234
|
+
if (o && r === a) {
|
|
235
|
+
const d = (i = t.builderContextSignal.content) == null ? void 0 : i.id, l = t.apiKey;
|
|
236
236
|
H({
|
|
237
|
-
apiHost:
|
|
237
|
+
apiHost: t.apiHost,
|
|
238
238
|
type: "impression",
|
|
239
239
|
canTrack: !0,
|
|
240
240
|
contentId: d,
|
|
@@ -242,41 +242,41 @@ function ke(e) {
|
|
|
242
242
|
variationId: a !== d ? a : void 0
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
|
-
|
|
245
|
+
A() && g();
|
|
246
246
|
}
|
|
247
247
|
}, []), c(() => {
|
|
248
|
-
}, [
|
|
248
|
+
}, [t.content]), c(() => {
|
|
249
249
|
f();
|
|
250
|
-
}, [
|
|
251
|
-
|
|
252
|
-
}, [
|
|
253
|
-
|
|
254
|
-
locale:
|
|
250
|
+
}, [t.builderContextSignal.rootState]), c(() => {
|
|
251
|
+
t.data && s(t.data);
|
|
252
|
+
}, [t.data]), c(() => {
|
|
253
|
+
t.locale && s({
|
|
254
|
+
locale: t.locale
|
|
255
255
|
});
|
|
256
|
-
}, [
|
|
256
|
+
}, [t.locale]), c(() => () => {
|
|
257
257
|
L() && (window.removeEventListener("message", v), window.removeEventListener(
|
|
258
258
|
"builder:component:stateChangeListenerActivated",
|
|
259
259
|
f
|
|
260
260
|
));
|
|
261
|
-
}, []), /* @__PURE__ */ k(
|
|
261
|
+
}, []), /* @__PURE__ */ k(M.Provider, { value: t.builderContextSignal, children: t.builderContextSignal.content || q() ? /* @__PURE__ */ k(
|
|
262
262
|
U,
|
|
263
263
|
{
|
|
264
264
|
ref: u,
|
|
265
265
|
onClick: (n) => V(n),
|
|
266
|
-
"builder-content-id": (
|
|
267
|
-
"builder-model":
|
|
268
|
-
className:
|
|
269
|
-
((
|
|
266
|
+
"builder-content-id": (w = t.builderContextSignal.content) == null ? void 0 : w.id,
|
|
267
|
+
"builder-model": t.model,
|
|
268
|
+
className: Z(
|
|
269
|
+
((y = t.content) == null ? void 0 : y.testVariationId) || ((R = t.content) == null ? void 0 : R.id)
|
|
270
270
|
),
|
|
271
271
|
style: {
|
|
272
|
-
display: !
|
|
272
|
+
display: !t.builderContextSignal.content && q() ? "none" : void 0
|
|
273
273
|
},
|
|
274
274
|
...T(),
|
|
275
|
-
...
|
|
276
|
-
children:
|
|
275
|
+
...t.contentWrapperProps,
|
|
276
|
+
children: t.children
|
|
277
277
|
}
|
|
278
278
|
) : null });
|
|
279
279
|
}
|
|
280
280
|
export {
|
|
281
|
-
|
|
281
|
+
Rt as default
|
|
282
282
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.18.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.18.10";exports.SDK_VERSION=e;
|