@builder.io/sdk-react-nextjs 0.20.1 → 0.22.0
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/symbol/symbol.cjs +1 -1
- package/lib/browser/blocks/symbol/symbol.mjs +27 -25
- package/lib/browser/blocks/text/component-info.cjs +1 -1
- package/lib/browser/blocks/text/component-info.mjs +0 -1
- package/lib/browser/blocks/text/text.cjs +1 -1
- package/lib/browser/blocks/text/text.mjs +3 -2
- package/lib/browser/components/block/block.cjs +1 -1
- package/lib/browser/components/block/block.mjs +27 -20
- package/lib/browser/components/block/components/component-ref/component-ref.cjs +1 -1
- package/lib/browser/components/block/components/component-ref/component-ref.mjs +11 -11
- package/lib/browser/components/block/components/interactive-element.cjs +1 -1
- package/lib/browser/components/block/components/interactive-element.mjs +27 -15
- package/lib/browser/components/block/components/live-edit-block-styles.cjs +1 -0
- package/lib/browser/components/block/components/live-edit-block-styles.mjs +94 -0
- package/lib/browser/components/block/components/style-wrapper.cjs +1 -0
- package/lib/browser/components/block/components/style-wrapper.mjs +24 -0
- 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 +195 -166
- package/lib/browser/components/live-edit.cjs +1 -0
- package/lib/browser/components/live-edit.mjs +19 -0
- package/lib/browser/constants/builder-registered-components.cjs +1 -1
- package/lib/browser/constants/builder-registered-components.mjs +3 -2
- package/lib/browser/constants/extra-components.cjs +1 -1
- package/lib/browser/constants/extra-components.mjs +3 -2
- package/lib/browser/constants/sdk-version.cjs +1 -1
- package/lib/browser/constants/sdk-version.mjs +1 -1
- package/lib/browser/helpers/find-block.cjs +1 -0
- package/lib/browser/helpers/find-block.mjs +30 -0
- package/lib/browser/helpers/subscribe-to-editor.cjs +1 -1
- package/lib/browser/helpers/subscribe-to-editor.mjs +15 -15
- package/lib/edge/blocks/symbol/symbol.cjs +1 -1
- package/lib/edge/blocks/symbol/symbol.mjs +27 -25
- package/lib/edge/blocks/text/component-info.cjs +1 -1
- package/lib/edge/blocks/text/component-info.mjs +0 -1
- package/lib/edge/blocks/text/text.cjs +1 -1
- package/lib/edge/blocks/text/text.mjs +3 -2
- package/lib/edge/components/block/block.cjs +1 -1
- package/lib/edge/components/block/block.mjs +27 -20
- package/lib/edge/components/block/components/component-ref/component-ref.cjs +1 -1
- package/lib/edge/components/block/components/component-ref/component-ref.mjs +11 -11
- package/lib/edge/components/block/components/interactive-element.cjs +1 -1
- package/lib/edge/components/block/components/interactive-element.mjs +27 -15
- package/lib/edge/components/block/components/live-edit-block-styles.cjs +1 -0
- package/lib/edge/components/block/components/live-edit-block-styles.mjs +94 -0
- package/lib/edge/components/block/components/style-wrapper.cjs +1 -0
- package/lib/edge/components/block/components/style-wrapper.mjs +24 -0
- 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 +195 -166
- package/lib/edge/components/live-edit.cjs +1 -0
- package/lib/edge/components/live-edit.mjs +19 -0
- package/lib/edge/constants/builder-registered-components.cjs +1 -1
- package/lib/edge/constants/builder-registered-components.mjs +3 -2
- package/lib/edge/constants/extra-components.cjs +1 -1
- package/lib/edge/constants/extra-components.mjs +3 -2
- package/lib/edge/constants/sdk-version.cjs +1 -1
- package/lib/edge/constants/sdk-version.mjs +1 -1
- package/lib/edge/helpers/find-block.cjs +1 -0
- package/lib/edge/helpers/find-block.mjs +30 -0
- package/lib/edge/helpers/subscribe-to-editor.cjs +1 -1
- package/lib/edge/helpers/subscribe-to-editor.mjs +15 -15
- package/lib/node/blocks/symbol/symbol.cjs +1 -1
- package/lib/node/blocks/symbol/symbol.mjs +27 -25
- package/lib/node/blocks/text/component-info.cjs +1 -1
- package/lib/node/blocks/text/component-info.mjs +0 -1
- package/lib/node/blocks/text/text.cjs +1 -1
- package/lib/node/blocks/text/text.mjs +3 -2
- package/lib/node/components/block/block.cjs +1 -1
- package/lib/node/components/block/block.mjs +27 -20
- package/lib/node/components/block/components/component-ref/component-ref.cjs +1 -1
- package/lib/node/components/block/components/component-ref/component-ref.mjs +11 -11
- package/lib/node/components/block/components/interactive-element.cjs +1 -1
- package/lib/node/components/block/components/interactive-element.mjs +27 -15
- package/lib/node/components/block/components/live-edit-block-styles.cjs +1 -0
- package/lib/node/components/block/components/live-edit-block-styles.mjs +94 -0
- package/lib/node/components/block/components/style-wrapper.cjs +1 -0
- package/lib/node/components/block/components/style-wrapper.mjs +24 -0
- 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 +195 -166
- package/lib/node/components/live-edit.cjs +1 -0
- package/lib/node/components/live-edit.mjs +19 -0
- package/lib/node/constants/builder-registered-components.cjs +1 -1
- package/lib/node/constants/builder-registered-components.mjs +3 -2
- package/lib/node/constants/extra-components.cjs +1 -1
- package/lib/node/constants/extra-components.mjs +3 -2
- package/lib/node/constants/sdk-version.cjs +1 -1
- package/lib/node/constants/sdk-version.mjs +1 -1
- package/lib/node/helpers/find-block.cjs +1 -0
- package/lib/node/helpers/find-block.mjs +30 -0
- package/lib/node/helpers/subscribe-to-editor.cjs +1 -1
- package/lib/node/helpers/subscribe-to-editor.mjs +15 -15
- package/package.json +1 -1
- package/types/cjs/blocks/symbol/symbol.types.d.ts +1 -2
- package/types/cjs/components/awaiter.d.ts +1 -11
- package/types/cjs/components/awaiter.types.d.ts +7 -0
- package/types/cjs/components/block/components/live-edit-block-styles.d.ts +8 -0
- package/types/cjs/components/block/components/style-wrapper.d.ts +9 -0
- package/types/cjs/components/live-edit.d.ts +9 -0
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/cjs/helpers/find-block.d.ts +18 -0
- package/types/cjs/helpers/subscribe-to-editor.d.ts +3 -2
- package/types/esm/blocks/symbol/symbol.types.d.ts +1 -2
- package/types/esm/components/awaiter.d.ts +1 -11
- package/types/esm/components/awaiter.types.d.ts +7 -0
- package/types/esm/components/block/components/live-edit-block-styles.d.ts +8 -0
- package/types/esm/components/block/components/style-wrapper.d.ts +9 -0
- package/types/esm/components/live-edit.d.ts +9 -0
- package/types/esm/constants/sdk-version.d.ts +1 -1
- package/types/esm/helpers/find-block.d.ts +18 -0
- package/types/esm/helpers/subscribe-to-editor.d.ts +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const
|
|
1
|
+
"use client";"use strict";const D=require("react/jsx-runtime"),c=require("react"),$=require("../../../context/builder.context.cjs"),G=require("../../../functions/evaluate/evaluate.cjs"),z=require("../../../functions/fast-clone.cjs"),Q=require("../../../functions/get-content/index.cjs"),H=require("../../../functions/is-browser.cjs"),m=require("../../../functions/is-editing.cjs"),X=require("../../../functions/is-previewing.cjs"),Y=require("../../../functions/log-fetch.cjs"),Z=require("../../../functions/register-component.cjs"),K=require("../../../functions/track/index.cjs"),p=require("../../../functions/track/interaction.cjs"),O=require("../../../helpers/canTrack.cjs"),ee=require("../../../helpers/cookie.cjs"),te=require("../../../helpers/preview-lru-cache/set.cjs"),ne=require("../../../helpers/subscribe-to-editor.cjs"),ie=require("../../../scripts/init-editing.cjs"),ae=require("../../block/animator.cjs"),N=require("./enable-editor.helpers.cjs"),re=require("./styles.helpers.cjs"),oe=require("next/navigation");function ce(e){var P,R,L;const u=c.useRef(null);c.useState(()=>!1);const[h,E]=c.useState(()=>e.builderContextSignal),[V,_]=c.useState(()=>null),[U,j]=c.useState(()=>"");function g(i,t){var o,a,r,d;const n={...e.builderContextSignal.rootState,...i};if(e.builderContextSignal.rootSetState?(a=(o=e.builderContextSignal).rootSetState)==null||a.call(o,n):e.builderContextSignal.rootState=n,t==="server")e.builderContextSignal.rootSetState?(d=(r=e.builderContextSignal).rootSetState)==null||d.call(r,n):e.builderContextSignal.rootState=n;else{const l={...e.builderContextSignal,rootState:n};E(l)}}function v(i,t){var o,a,r,d,l;const n={...e.builderContextSignal.content,...i,data:{...(o=e.builderContextSignal.content)==null?void 0:o.data,...i==null?void 0:i.data},meta:{...(a=e.builderContextSignal.content)==null?void 0:a.meta,...i==null?void 0:i.meta,breakpoints:((r=i==null?void 0:i.meta)==null?void 0:r.breakpoints)||((l=(d=e.builderContextSignal.content)==null?void 0:d.meta)==null?void 0:l.breakpoints)}};if(t==="server")te.postPreviewContent({value:n,key:n.id,url:window.location.pathname});else{const b=JSON.parse(JSON.stringify(n)),s={...h,content:b};E(s)}}function B(){return e.showContent?{}:{hidden:!0,"aria-hidden":!0}}const[F,de]=c.useState(()=>e.contentWrapper||"div");function C(i){return ne.createEditorListener({model:e.model,trustedHosts:e.trustedHosts,callbacks:{configureSdk:t=>{var a;const{breakpoints:n,contentId:o}=t;!o||o!==((a=e.builderContextSignal.content)==null?void 0:a.id)||n&&v({meta:{breakpoints:n}})},animation:t=>{ae.triggerAnimation(t)},contentUpdate:(t,n)=>{v(t,n)},stateUpdate:(t,n)=>{g(t,n)}}})(i)}const[q,le]=c.useState(()=>({})),[x,se]=c.useState(()=>({})),[y,W]=c.useState(()=>!1);function A(i){var t,n;if(e.builderContextSignal.content){const o=(t=e.builderContextSignal.content)==null?void 0:t.testVariationId,a=(n=e.builderContextSignal.content)==null?void 0:n.id;K._track({apiHost:e.apiHost,type:"click",canTrack:O.getDefaultCanTrack(e.canTrack),contentId:a,apiKey:e.apiKey,variationId:o!==a?o:void 0,...p.getInteractionPropertiesForEvent(i),unique:!y})}y||W(!0)}function J(){var t,n,o;const i=(o=(n=(t=e.builderContextSignal.content)==null?void 0:t.data)==null?void 0:n.httpRequests)!=null?o:{};Object.entries(i).forEach(([a,r])=>{if(!r)return;const d=typeof r=="object"&&r["@type"]==="@builder.io/core:Request";if(x[a]||q[a]&&!m.isEditing())return;const l=d?r.request.url:r;x[a]=!0;const b=l.replace(/{{([^}]+)}}/g,(f,M)=>String(G.evaluate({code:M,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState}))),s=d?{url:b,method:r.request.method,headers:r.request.headers,body:r.request.body}:{url:b,method:"GET"};Y.logFetch(JSON.stringify(s));const T={method:s.method,headers:s.headers,body:s.body};s.method==="GET"&&delete T.body,fetch(s.url,T).then(f=>f.json()).then(f=>{g({[a]:f}),q[a]=!0}).catch(f=>{console.error("error fetching dynamic data",JSON.stringify(r),f)}).finally(()=>{x[a]=!1})})}function S(){m.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:z.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}function I(i){var t;window.addEventListener("message",C),ie.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(n=>{var o,a;if(!((o=n.models)!=null&&o.length)||n.models.includes(e.model)){const r=Z.createRegisterComponentMessage(n);(a=window.parent)==null||a.postMessage(r,"*")}}),window.addEventListener("builder:component:stateChangeListenerActivated",S)}function w(i){var r;const t=new URL(location.href).searchParams,n=t.get("builder.preview"),o=t.get(`builder.overrides.${n}`),a=t.get("apiKey")||t.get("builder.space");(n==="BUILDER_STUDIO"||n===e.model&&a===e.apiKey&&(!e.content||o===e.content.id))&&Q.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion,...n==="BUILDER_STUDIO"&&((r=e.context)!=null&&r.symbolId)?{query:{id:e.context.symbolId}}:{}}).then(d=>{d&&v(d)})}oe.useRouter();const k=c.useRef(!1);return k.current||(J(),S(),k.current=!0),c.useEffect(()=>{var i;return(i=u.current)==null||i.addEventListener("initeditingbldr",I),()=>{var t;return(t=u.current)==null?void 0:t.removeEventListener("initeditingbldr",I)}},[]),c.useEffect(()=>{var i;return(i=u.current)==null||i.addEventListener("initpreviewingbldr",w),()=>{var t;return(t=u.current)==null?void 0:t.removeEventListener("initpreviewingbldr",w)}},[]),c.useEffect(()=>{var i,t,n;if(H.isBrowser()){m.isEditing()&&!e.isNestedRender&&u.current&&u.current.dispatchEvent(new CustomEvent("initeditingbldr"));const o=e.builderContextSignal.content&&O.getDefaultCanTrack(e.canTrack),a=ee.getCookieSync({name:`builder.tests.${(i=e.builderContextSignal.content)==null?void 0:i.id}`,canTrack:!0}),r=(t=e.builderContextSignal.content)==null?void 0:t.testVariationId;if(o&&r===a){const d=(n=e.builderContextSignal.content)==null?void 0:n.id,l=e.apiKey;K._track({apiHost:e.apiHost,type:"impression",canTrack:!0,contentId:d,apiKey:l,variationId:a!==d?a:void 0})}X.isPreviewing()&&m.isEditing()}},[]),c.useEffect(()=>{},[e.content]),c.useEffect(()=>{S()},[e.builderContextSignal.rootState]),c.useEffect(()=>{if(e.data){if(V===e.data)return;g(e.data),_(e.data)}},[e.data]),c.useEffect(()=>{if(e.locale){if(U===e.locale)return;g({locale:e.locale}),j(e.locale)}},[e.locale]),c.useEffect(()=>()=>{H.isBrowser()&&(window.removeEventListener("message",C),window.removeEventListener("builder:component:stateChangeListenerActivated",S))},[]),D.jsx($.Provider,{value:h,children:e.builderContextSignal.content||N.needsElementRefDivForEditing()?D.jsx(F,{ref:u,onClick:i=>A(i),"builder-content-id":(P=e.builderContextSignal.content)==null?void 0:P.id,"builder-model":e.model,className:re.getWrapperClassName(((R=e.content)==null?void 0:R.testVariationId)||((L=e.content)==null?void 0:L.id)),style:{display:!e.builderContextSignal.content&&N.needsElementRefDivForEditing()?"none":void 0},...B(),...e.contentWrapperProps,children:e.children}):null})}module.exports=ce;
|
|
@@ -1,171 +1,192 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useRef as
|
|
4
|
-
import
|
|
5
|
-
import { evaluate as
|
|
6
|
-
import { fastClone as
|
|
7
|
-
import { fetchOneEntry as
|
|
8
|
-
import { isBrowser as
|
|
9
|
-
import { isEditing as
|
|
10
|
-
import { isPreviewing as
|
|
11
|
-
import { logFetch as
|
|
12
|
-
import { createRegisterComponentMessage as
|
|
13
|
-
import { _track as
|
|
14
|
-
import { getInteractionPropertiesForEvent as
|
|
15
|
-
import { getDefaultCanTrack as
|
|
16
|
-
import { getCookieSync as
|
|
17
|
-
import { postPreviewContent as
|
|
18
|
-
import { createEditorListener as
|
|
19
|
-
import { setupBrowserForEditing as
|
|
20
|
-
import { triggerAnimation as
|
|
21
|
-
import { needsElementRefDivForEditing as
|
|
22
|
-
import { getWrapperClassName as
|
|
23
|
-
import { useRouter as
|
|
24
|
-
function
|
|
25
|
-
var
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
2
|
+
import { jsx as T } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as D, useState as u, useEffect as s } from "react";
|
|
4
|
+
import z from "../../../context/builder.context.mjs";
|
|
5
|
+
import { evaluate as Q } from "../../../functions/evaluate/evaluate.mjs";
|
|
6
|
+
import { fastClone as X } from "../../../functions/fast-clone.mjs";
|
|
7
|
+
import { fetchOneEntry as Y } from "../../../functions/get-content/index.mjs";
|
|
8
|
+
import { isBrowser as N } from "../../../functions/is-browser.mjs";
|
|
9
|
+
import { isEditing as v } from "../../../functions/is-editing.mjs";
|
|
10
|
+
import { isPreviewing as Z } from "../../../functions/is-previewing.mjs";
|
|
11
|
+
import { logFetch as p } from "../../../functions/log-fetch.mjs";
|
|
12
|
+
import { createRegisterComponentMessage as ee } from "../../../functions/register-component.mjs";
|
|
13
|
+
import { _track as V } from "../../../functions/track/index.mjs";
|
|
14
|
+
import { getInteractionPropertiesForEvent as te } from "../../../functions/track/interaction.mjs";
|
|
15
|
+
import { getDefaultCanTrack as U } from "../../../helpers/canTrack.mjs";
|
|
16
|
+
import { getCookieSync as ne } from "../../../helpers/cookie.mjs";
|
|
17
|
+
import { postPreviewContent as ie } from "../../../helpers/preview-lru-cache/set.mjs";
|
|
18
|
+
import { createEditorListener as ae } from "../../../helpers/subscribe-to-editor.mjs";
|
|
19
|
+
import { setupBrowserForEditing as oe } from "../../../scripts/init-editing.mjs";
|
|
20
|
+
import { triggerAnimation as re } from "../../block/animator.mjs";
|
|
21
|
+
import { needsElementRefDivForEditing as q } from "./enable-editor.helpers.mjs";
|
|
22
|
+
import { getWrapperClassName as de } from "./styles.helpers.mjs";
|
|
23
|
+
import { useRouter as le } from "next/navigation";
|
|
24
|
+
function Ne(e) {
|
|
25
|
+
var R, H, K;
|
|
26
|
+
const m = D(null);
|
|
27
|
+
u(() => !1);
|
|
28
|
+
const [C, y] = u(
|
|
29
|
+
() => e.builderContextSignal
|
|
30
|
+
), [j, _] = u(() => null), [W, A] = u(() => "");
|
|
31
|
+
function g(i, t) {
|
|
32
|
+
var r, a, o, d;
|
|
33
|
+
const n = {
|
|
31
34
|
...e.builderContextSignal.rootState,
|
|
32
|
-
...
|
|
35
|
+
...i
|
|
33
36
|
};
|
|
34
|
-
e.builderContextSignal.rootSetState ? (
|
|
37
|
+
if (e.builderContextSignal.rootSetState ? (a = (r = e.builderContextSignal).rootSetState) == null || a.call(r, n) : e.builderContextSignal.rootState = n, t === "server")
|
|
38
|
+
e.builderContextSignal.rootSetState ? (d = (o = e.builderContextSignal).rootSetState) == null || d.call(o, n) : e.builderContextSignal.rootState = n;
|
|
39
|
+
else {
|
|
40
|
+
const l = {
|
|
41
|
+
...e.builderContextSignal,
|
|
42
|
+
rootState: n
|
|
43
|
+
};
|
|
44
|
+
y(l);
|
|
45
|
+
}
|
|
35
46
|
}
|
|
36
|
-
function
|
|
37
|
-
var
|
|
38
|
-
const
|
|
47
|
+
function h(i, t) {
|
|
48
|
+
var r, a, o, d, l;
|
|
49
|
+
const n = {
|
|
39
50
|
...e.builderContextSignal.content,
|
|
40
|
-
...
|
|
51
|
+
...i,
|
|
41
52
|
data: {
|
|
42
|
-
...(
|
|
43
|
-
...
|
|
53
|
+
...(r = e.builderContextSignal.content) == null ? void 0 : r.data,
|
|
54
|
+
...i == null ? void 0 : i.data
|
|
44
55
|
},
|
|
45
56
|
meta: {
|
|
46
|
-
...(
|
|
47
|
-
...
|
|
48
|
-
breakpoints: ((
|
|
57
|
+
...(a = e.builderContextSignal.content) == null ? void 0 : a.meta,
|
|
58
|
+
...i == null ? void 0 : i.meta,
|
|
59
|
+
breakpoints: ((o = i == null ? void 0 : i.meta) == null ? void 0 : o.breakpoints) || ((l = (d = e.builderContextSignal.content) == null ? void 0 : d.meta) == null ? void 0 : l.breakpoints)
|
|
49
60
|
}
|
|
50
61
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
62
|
+
if (t === "server")
|
|
63
|
+
ie({
|
|
64
|
+
value: n,
|
|
65
|
+
key: n.id,
|
|
66
|
+
url: window.location.pathname
|
|
67
|
+
});
|
|
68
|
+
else {
|
|
69
|
+
const S = JSON.parse(JSON.stringify(n)), c = {
|
|
70
|
+
...C,
|
|
71
|
+
content: S
|
|
72
|
+
};
|
|
73
|
+
y(c);
|
|
74
|
+
}
|
|
56
75
|
}
|
|
57
|
-
function
|
|
76
|
+
function B() {
|
|
58
77
|
return e.showContent ? {} : {
|
|
59
78
|
hidden: !0,
|
|
60
79
|
"aria-hidden": !0
|
|
61
80
|
};
|
|
62
81
|
}
|
|
63
|
-
const [
|
|
82
|
+
const [F, ce] = u(
|
|
64
83
|
() => e.contentWrapper || "div"
|
|
65
84
|
);
|
|
66
|
-
function
|
|
67
|
-
return
|
|
85
|
+
function E(i) {
|
|
86
|
+
return ae({
|
|
68
87
|
model: e.model,
|
|
69
88
|
trustedHosts: e.trustedHosts,
|
|
70
89
|
callbacks: {
|
|
71
90
|
configureSdk: (t) => {
|
|
72
91
|
var a;
|
|
73
|
-
const { breakpoints:
|
|
74
|
-
!
|
|
92
|
+
const { breakpoints: n, contentId: r } = t;
|
|
93
|
+
!r || r !== ((a = e.builderContextSignal.content) == null ? void 0 : a.id) || n && h({
|
|
75
94
|
meta: {
|
|
76
|
-
breakpoints:
|
|
95
|
+
breakpoints: n
|
|
77
96
|
}
|
|
78
97
|
});
|
|
79
98
|
},
|
|
80
99
|
animation: (t) => {
|
|
81
|
-
|
|
100
|
+
re(t);
|
|
82
101
|
},
|
|
83
|
-
contentUpdate: (t) => {
|
|
84
|
-
|
|
102
|
+
contentUpdate: (t, n) => {
|
|
103
|
+
h(t, n);
|
|
85
104
|
},
|
|
86
|
-
stateUpdate: (t) => {
|
|
87
|
-
|
|
105
|
+
stateUpdate: (t, n) => {
|
|
106
|
+
g(t, n);
|
|
88
107
|
}
|
|
89
108
|
}
|
|
90
|
-
})(
|
|
109
|
+
})(i);
|
|
91
110
|
}
|
|
92
|
-
const [
|
|
93
|
-
function
|
|
94
|
-
var t,
|
|
111
|
+
const [I, ue] = u(() => ({})), [x, se] = u(() => ({})), [w, J] = u(() => !1);
|
|
112
|
+
function M(i) {
|
|
113
|
+
var t, n;
|
|
95
114
|
if (e.builderContextSignal.content) {
|
|
96
|
-
const
|
|
97
|
-
|
|
115
|
+
const r = (t = e.builderContextSignal.content) == null ? void 0 : t.testVariationId, a = (n = e.builderContextSignal.content) == null ? void 0 : n.id;
|
|
116
|
+
V({
|
|
98
117
|
apiHost: e.apiHost,
|
|
99
118
|
type: "click",
|
|
100
|
-
canTrack:
|
|
119
|
+
canTrack: U(e.canTrack),
|
|
101
120
|
contentId: a,
|
|
102
121
|
apiKey: e.apiKey,
|
|
103
|
-
variationId:
|
|
104
|
-
...
|
|
105
|
-
unique: !
|
|
122
|
+
variationId: r !== a ? r : void 0,
|
|
123
|
+
...te(i),
|
|
124
|
+
unique: !w
|
|
106
125
|
});
|
|
107
126
|
}
|
|
108
|
-
|
|
127
|
+
w || J(!0);
|
|
109
128
|
}
|
|
110
|
-
function
|
|
111
|
-
var t,
|
|
112
|
-
const
|
|
113
|
-
Object.entries(
|
|
114
|
-
([a,
|
|
115
|
-
if (!
|
|
129
|
+
function G() {
|
|
130
|
+
var t, n, r;
|
|
131
|
+
const i = (r = (n = (t = e.builderContextSignal.content) == null ? void 0 : t.data) == null ? void 0 : n.httpRequests) != null ? r : {};
|
|
132
|
+
Object.entries(i).forEach(
|
|
133
|
+
([a, o]) => {
|
|
134
|
+
if (!o)
|
|
116
135
|
return;
|
|
117
|
-
const d = typeof
|
|
118
|
-
if (
|
|
136
|
+
const d = typeof o == "object" && o["@type"] === "@builder.io/core:Request";
|
|
137
|
+
if (x[a] || I[a] && !v())
|
|
119
138
|
return;
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
const
|
|
139
|
+
const l = d ? o.request.url : o;
|
|
140
|
+
x[a] = !0;
|
|
141
|
+
const S = l.replace(
|
|
123
142
|
/{{([^}]+)}}/g,
|
|
124
|
-
(
|
|
125
|
-
|
|
126
|
-
code:
|
|
143
|
+
(f, $) => String(
|
|
144
|
+
Q({
|
|
145
|
+
code: $,
|
|
127
146
|
context: e.context || {},
|
|
128
147
|
localState: void 0,
|
|
129
148
|
rootState: e.builderContextSignal.rootState,
|
|
130
149
|
rootSetState: e.builderContextSignal.rootSetState
|
|
131
150
|
})
|
|
132
151
|
)
|
|
133
|
-
),
|
|
134
|
-
url:
|
|
135
|
-
method:
|
|
136
|
-
headers:
|
|
137
|
-
body:
|
|
152
|
+
), c = d ? {
|
|
153
|
+
url: S,
|
|
154
|
+
method: o.request.method,
|
|
155
|
+
headers: o.request.headers,
|
|
156
|
+
body: o.request.body
|
|
138
157
|
} : {
|
|
139
|
-
url:
|
|
158
|
+
url: S,
|
|
140
159
|
method: "GET"
|
|
141
160
|
};
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
161
|
+
p(JSON.stringify(c));
|
|
162
|
+
const O = {
|
|
163
|
+
method: c.method,
|
|
164
|
+
headers: c.headers,
|
|
165
|
+
body: c.body
|
|
166
|
+
};
|
|
167
|
+
c.method === "GET" && delete O.body, fetch(c.url, O).then((f) => f.json()).then((f) => {
|
|
168
|
+
g({
|
|
169
|
+
[a]: f
|
|
170
|
+
}), I[a] = !0;
|
|
171
|
+
}).catch((f) => {
|
|
151
172
|
console.error(
|
|
152
173
|
"error fetching dynamic data",
|
|
153
|
-
JSON.stringify(
|
|
154
|
-
|
|
174
|
+
JSON.stringify(o),
|
|
175
|
+
f
|
|
155
176
|
);
|
|
156
177
|
}).finally(() => {
|
|
157
|
-
|
|
178
|
+
x[a] = !1;
|
|
158
179
|
});
|
|
159
180
|
}
|
|
160
181
|
);
|
|
161
182
|
}
|
|
162
|
-
function
|
|
163
|
-
|
|
183
|
+
function b() {
|
|
184
|
+
v() && window.dispatchEvent(
|
|
164
185
|
new CustomEvent(
|
|
165
186
|
"builder:component:stateChange",
|
|
166
187
|
{
|
|
167
188
|
detail: {
|
|
168
|
-
state:
|
|
189
|
+
state: X(e.builderContextSignal.rootState),
|
|
169
190
|
ref: {
|
|
170
191
|
name: e.model
|
|
171
192
|
}
|
|
@@ -174,9 +195,9 @@ function Le(e) {
|
|
|
174
195
|
)
|
|
175
196
|
);
|
|
176
197
|
}
|
|
177
|
-
function
|
|
198
|
+
function P(i) {
|
|
178
199
|
var t;
|
|
179
|
-
window.addEventListener("message",
|
|
200
|
+
window.addEventListener("message", E), oe({
|
|
180
201
|
...e.locale ? {
|
|
181
202
|
locale: e.locale
|
|
182
203
|
} : {},
|
|
@@ -190,115 +211,123 @@ function Le(e) {
|
|
|
190
211
|
apiKey: e.apiKey
|
|
191
212
|
}), Object.values(
|
|
192
213
|
e.builderContextSignal.componentInfos
|
|
193
|
-
).forEach((
|
|
194
|
-
var
|
|
195
|
-
if (!((
|
|
196
|
-
const
|
|
197
|
-
(a = window.parent) == null || a.postMessage(
|
|
214
|
+
).forEach((n) => {
|
|
215
|
+
var r, a;
|
|
216
|
+
if (!((r = n.models) != null && r.length) || n.models.includes(e.model)) {
|
|
217
|
+
const o = ee(n);
|
|
218
|
+
(a = window.parent) == null || a.postMessage(o, "*");
|
|
198
219
|
}
|
|
199
220
|
}), window.addEventListener(
|
|
200
221
|
"builder:component:stateChangeListenerActivated",
|
|
201
|
-
|
|
222
|
+
b
|
|
202
223
|
);
|
|
203
224
|
}
|
|
204
|
-
function
|
|
205
|
-
var
|
|
206
|
-
const t = new URL(location.href).searchParams,
|
|
207
|
-
`builder.overrides.${
|
|
225
|
+
function k(i) {
|
|
226
|
+
var o;
|
|
227
|
+
const t = new URL(location.href).searchParams, n = t.get("builder.preview"), r = t.get(
|
|
228
|
+
`builder.overrides.${n}`
|
|
208
229
|
), a = t.get("apiKey") || t.get("builder.space");
|
|
209
|
-
(
|
|
230
|
+
(n === "BUILDER_STUDIO" || n === e.model && a === e.apiKey && (!e.content || r === e.content.id)) && Y({
|
|
210
231
|
model: e.model,
|
|
211
232
|
apiKey: e.apiKey,
|
|
212
233
|
apiVersion: e.builderContextSignal.apiVersion,
|
|
213
|
-
...
|
|
234
|
+
...n === "BUILDER_STUDIO" && ((o = e.context) != null && o.symbolId) ? {
|
|
214
235
|
query: {
|
|
215
236
|
id: e.context.symbolId
|
|
216
237
|
}
|
|
217
238
|
} : {}
|
|
218
239
|
}).then((d) => {
|
|
219
|
-
d &&
|
|
240
|
+
d && h(d);
|
|
220
241
|
});
|
|
221
242
|
}
|
|
222
|
-
|
|
223
|
-
const
|
|
224
|
-
return
|
|
225
|
-
var
|
|
226
|
-
return (
|
|
243
|
+
le();
|
|
244
|
+
const L = D(!1);
|
|
245
|
+
return L.current || (G(), b(), L.current = !0), s(() => {
|
|
246
|
+
var i;
|
|
247
|
+
return (i = m.current) == null || i.addEventListener(
|
|
227
248
|
"initeditingbldr",
|
|
228
|
-
|
|
249
|
+
P
|
|
229
250
|
), () => {
|
|
230
251
|
var t;
|
|
231
|
-
return (t =
|
|
252
|
+
return (t = m.current) == null ? void 0 : t.removeEventListener(
|
|
232
253
|
"initeditingbldr",
|
|
233
|
-
|
|
254
|
+
P
|
|
234
255
|
);
|
|
235
256
|
};
|
|
236
|
-
}, []),
|
|
237
|
-
var
|
|
238
|
-
return (
|
|
257
|
+
}, []), s(() => {
|
|
258
|
+
var i;
|
|
259
|
+
return (i = m.current) == null || i.addEventListener(
|
|
239
260
|
"initpreviewingbldr",
|
|
240
|
-
|
|
261
|
+
k
|
|
241
262
|
), () => {
|
|
242
263
|
var t;
|
|
243
|
-
return (t =
|
|
264
|
+
return (t = m.current) == null ? void 0 : t.removeEventListener(
|
|
244
265
|
"initpreviewingbldr",
|
|
245
|
-
|
|
266
|
+
k
|
|
246
267
|
);
|
|
247
268
|
};
|
|
248
|
-
}, []),
|
|
249
|
-
var
|
|
250
|
-
if (
|
|
251
|
-
|
|
252
|
-
const
|
|
253
|
-
name: `builder.tests.${(
|
|
269
|
+
}, []), s(() => {
|
|
270
|
+
var i, t, n;
|
|
271
|
+
if (N()) {
|
|
272
|
+
v() && !e.isNestedRender && m.current && m.current.dispatchEvent(new CustomEvent("initeditingbldr"));
|
|
273
|
+
const r = e.builderContextSignal.content && U(e.canTrack), a = ne({
|
|
274
|
+
name: `builder.tests.${(i = e.builderContextSignal.content) == null ? void 0 : i.id}`,
|
|
254
275
|
canTrack: !0
|
|
255
|
-
}),
|
|
256
|
-
if (
|
|
257
|
-
const d = (
|
|
258
|
-
|
|
276
|
+
}), o = (t = e.builderContextSignal.content) == null ? void 0 : t.testVariationId;
|
|
277
|
+
if (r && o === a) {
|
|
278
|
+
const d = (n = e.builderContextSignal.content) == null ? void 0 : n.id, l = e.apiKey;
|
|
279
|
+
V({
|
|
259
280
|
apiHost: e.apiHost,
|
|
260
281
|
type: "impression",
|
|
261
282
|
canTrack: !0,
|
|
262
283
|
contentId: d,
|
|
263
|
-
apiKey:
|
|
284
|
+
apiKey: l,
|
|
264
285
|
variationId: a !== d ? a : void 0
|
|
265
286
|
});
|
|
266
287
|
}
|
|
267
|
-
|
|
288
|
+
Z() && v();
|
|
268
289
|
}
|
|
269
|
-
}, []),
|
|
270
|
-
}, [e.content]),
|
|
271
|
-
|
|
272
|
-
}, [e.builderContextSignal.rootState]),
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}
|
|
278
|
-
}, [e.
|
|
279
|
-
|
|
290
|
+
}, []), s(() => {
|
|
291
|
+
}, [e.content]), s(() => {
|
|
292
|
+
b();
|
|
293
|
+
}, [e.builderContextSignal.rootState]), s(() => {
|
|
294
|
+
if (e.data) {
|
|
295
|
+
if (j === e.data)
|
|
296
|
+
return;
|
|
297
|
+
g(e.data), _(e.data);
|
|
298
|
+
}
|
|
299
|
+
}, [e.data]), s(() => {
|
|
300
|
+
if (e.locale) {
|
|
301
|
+
if (W === e.locale)
|
|
302
|
+
return;
|
|
303
|
+
g({
|
|
304
|
+
locale: e.locale
|
|
305
|
+
}), A(e.locale);
|
|
306
|
+
}
|
|
307
|
+
}, [e.locale]), s(() => () => {
|
|
308
|
+
N() && (window.removeEventListener("message", E), window.removeEventListener(
|
|
280
309
|
"builder:component:stateChangeListenerActivated",
|
|
281
|
-
|
|
310
|
+
b
|
|
282
311
|
));
|
|
283
|
-
}, []), /* @__PURE__ */
|
|
284
|
-
|
|
312
|
+
}, []), /* @__PURE__ */ T(z.Provider, { value: C, children: e.builderContextSignal.content || q() ? /* @__PURE__ */ T(
|
|
313
|
+
F,
|
|
285
314
|
{
|
|
286
|
-
ref:
|
|
287
|
-
onClick: (
|
|
288
|
-
"builder-content-id": (
|
|
315
|
+
ref: m,
|
|
316
|
+
onClick: (i) => M(i),
|
|
317
|
+
"builder-content-id": (R = e.builderContextSignal.content) == null ? void 0 : R.id,
|
|
289
318
|
"builder-model": e.model,
|
|
290
|
-
className:
|
|
291
|
-
((
|
|
319
|
+
className: de(
|
|
320
|
+
((H = e.content) == null ? void 0 : H.testVariationId) || ((K = e.content) == null ? void 0 : K.id)
|
|
292
321
|
),
|
|
293
322
|
style: {
|
|
294
|
-
display: !e.builderContextSignal.content &&
|
|
323
|
+
display: !e.builderContextSignal.content && q() ? "none" : void 0
|
|
295
324
|
},
|
|
296
|
-
...
|
|
325
|
+
...B(),
|
|
297
326
|
...e.contentWrapperProps,
|
|
298
327
|
children: e.children
|
|
299
328
|
}
|
|
300
329
|
) : null });
|
|
301
330
|
}
|
|
302
331
|
export {
|
|
303
|
-
|
|
332
|
+
Ne as default
|
|
304
333
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";const o=require("react/jsx-runtime"),u=require("react"),s=require("../context/builder.context.cjs"),d=require("../helpers/find-block.cjs");function x(t){function e(){return d.findBlockById(c.content,t.id)}function r(){var n,i;return((i=(n=e==null?void 0:e())==null?void 0:n.component)==null?void 0:i.options)||{}}const c=u.useContext(s);return o.jsx(t.Wrapper,{...r(),attributes:t.attributes,children:t.children})}module.exports=x;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
3
|
+
import { useContext as c } from "react";
|
|
4
|
+
import f from "../context/builder.context.mjs";
|
|
5
|
+
import { findBlockById as m } from "../helpers/find-block.mjs";
|
|
6
|
+
function x(t) {
|
|
7
|
+
function n() {
|
|
8
|
+
return m(r.content, t.id);
|
|
9
|
+
}
|
|
10
|
+
function i() {
|
|
11
|
+
var e, o;
|
|
12
|
+
return ((o = (e = n == null ? void 0 : n()) == null ? void 0 : e.component) == null ? void 0 : o.options) || {};
|
|
13
|
+
}
|
|
14
|
+
const r = c(f);
|
|
15
|
+
return /* @__PURE__ */ u(t.Wrapper, { ...i(), attributes: t.attributes, children: t.children });
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
x as default
|
|
19
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("react");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("react");const e=require("./target.cjs");require("../functions/evaluate/edge-runtime/edge-runtime.cjs");require("../helpers/user-attributes.cjs");require("../functions/get-fetch.cjs");require("../context/builder.context.cjs");const o=require("../blocks/button/component-info.cjs"),n=require("../blocks/button/button.cjs"),t=require("../blocks/columns/component-info.cjs"),r=require("../blocks/columns/columns.cjs"),c=require("../blocks/fragment/component-info.cjs"),i=require("../blocks/fragment/fragment.cjs"),s=require("../blocks/image/component-info.cjs"),m=require("../blocks/image/image.cjs"),u=require("../blocks/personalization-container/component-info.cjs"),p=require("../blocks/personalization-container/helpers.cjs"),q=require("../blocks/personalization-container/personalization-container.cjs"),f=require("../blocks/section/component-info.cjs"),I=require("../blocks/section/section.cjs"),a=require("../blocks/slot/component-info.cjs"),l=require("../blocks/slot/slot.cjs"),g=require("../blocks/symbol/component-info.cjs"),$=require("../blocks/symbol/symbol.cjs"),S=require("../blocks/text/component-info.cjs"),d=require("../blocks/text/text.cjs"),C=require("./extra-components.cjs"),R=()=>[{component:n,...o.componentInfo},{component:r,...t.componentInfo},{component:i,...c.componentInfo},{component:m,...s.componentInfo},{component:I,...f.componentInfo},{component:l,...a.componentInfo},{component:$,...g.componentInfo},{component:d,...S.componentInfo},...p.SDKS_SUPPORTING_PERSONALIZATION.includes(e.TARGET)?[{component:q,...u.componentInfo}]:[],...C.getExtraComponents()];exports.getDefaultRegisteredComponents=R;
|
|
@@ -4,6 +4,7 @@ import { TARGET as o } from "./target.mjs";
|
|
|
4
4
|
import "../functions/evaluate/edge-runtime/edge-runtime.mjs";
|
|
5
5
|
import "../helpers/user-attributes.mjs";
|
|
6
6
|
import "../functions/get-fetch.mjs";
|
|
7
|
+
import "../context/builder.context.mjs";
|
|
7
8
|
import { componentInfo as n } from "../blocks/button/component-info.mjs";
|
|
8
9
|
import m from "../blocks/button/button.mjs";
|
|
9
10
|
import { componentInfo as t } from "../blocks/columns/component-info.mjs";
|
|
@@ -24,7 +25,7 @@ import g from "../blocks/symbol/symbol.mjs";
|
|
|
24
25
|
import { componentInfo as T } from "../blocks/text/component-info.mjs";
|
|
25
26
|
import u from "../blocks/text/text.mjs";
|
|
26
27
|
import { getExtraComponents as P } from "./extra-components.mjs";
|
|
27
|
-
const
|
|
28
|
+
const M = () => [{
|
|
28
29
|
component: m,
|
|
29
30
|
...n
|
|
30
31
|
}, {
|
|
@@ -53,5 +54,5 @@ const J = () => [{
|
|
|
53
54
|
...c
|
|
54
55
|
}] : [], ...P()];
|
|
55
56
|
export {
|
|
56
|
-
|
|
57
|
+
M as getDefaultRegisteredComponents
|
|
57
58
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../blocks/custom-code/component-info.cjs"),o=require("../blocks/custom-code/custom-code.cjs"),n=require("../blocks/embed/component-info.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../blocks/custom-code/component-info.cjs"),o=require("../blocks/custom-code/custom-code.cjs"),n=require("../blocks/embed/component-info.cjs"),r=require("../blocks/embed/embed.cjs");require("react/jsx-runtime");require("react");require("../functions/evaluate/edge-runtime/edge-runtime.cjs");require("../helpers/user-attributes.cjs");require("../functions/get-fetch.cjs");require("../context/builder.context.cjs");const t=require("../blocks/img/component-info.cjs"),c=require("../blocks/img/img.cjs"),i=require("../blocks/video/component-info.cjs"),m=require("../blocks/video/video.cjs"),u=()=>[{component:o,...e.componentInfo},{component:r,...n.componentInfo},{component:c,...t.componentInfo},{component:m,...i.componentInfo}];exports.getExtraComponents=u;
|
|
@@ -7,11 +7,12 @@ import "react";
|
|
|
7
7
|
import "../functions/evaluate/edge-runtime/edge-runtime.mjs";
|
|
8
8
|
import "../helpers/user-attributes.mjs";
|
|
9
9
|
import "../functions/get-fetch.mjs";
|
|
10
|
+
import "../context/builder.context.mjs";
|
|
10
11
|
import { componentInfo as p } from "../blocks/img/component-info.mjs";
|
|
11
12
|
import r from "../blocks/img/img.mjs";
|
|
12
13
|
import { componentInfo as e } from "../blocks/video/component-info.mjs";
|
|
13
14
|
import f from "../blocks/video/video.mjs";
|
|
14
|
-
const
|
|
15
|
+
const h = () => [{
|
|
15
16
|
component: m,
|
|
16
17
|
...o
|
|
17
18
|
}, {
|
|
@@ -25,5 +26,5 @@ const V = () => [{
|
|
|
25
26
|
...e
|
|
26
27
|
}];
|
|
27
28
|
export {
|
|
28
|
-
|
|
29
|
+
h as getExtraComponents
|
|
29
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.22.0";exports.SDK_VERSION=e;
|