@builder.io/sdk-react-nextjs 0.21.1 → 0.22.1
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/img/component-info.cjs +1 -1
- package/lib/browser/blocks/img/component-info.mjs +33 -3
- package/lib/browser/blocks/img/img.cjs +1 -1
- package/lib/browser/blocks/img/img.mjs +22 -17
- 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/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/content/components/enable-editor.cjs +1 -1
- package/lib/browser/components/content/components/enable-editor.mjs +182 -164
- 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/functions/get-content/generate-content-url.cjs +1 -1
- package/lib/browser/functions/get-content/generate-content-url.mjs +38 -42
- package/lib/browser/functions/get-content/index.cjs +1 -1
- package/lib/browser/functions/get-content/index.mjs +42 -36
- 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/img/component-info.cjs +1 -1
- package/lib/edge/blocks/img/component-info.mjs +33 -3
- package/lib/edge/blocks/img/img.cjs +1 -1
- package/lib/edge/blocks/img/img.mjs +22 -17
- 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/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/content/components/enable-editor.cjs +1 -1
- package/lib/edge/components/content/components/enable-editor.mjs +182 -164
- 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/functions/get-content/generate-content-url.cjs +1 -1
- package/lib/edge/functions/get-content/generate-content-url.mjs +38 -42
- package/lib/edge/functions/get-content/index.cjs +1 -1
- package/lib/edge/functions/get-content/index.mjs +42 -36
- 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/img/component-info.cjs +1 -1
- package/lib/node/blocks/img/component-info.mjs +33 -3
- package/lib/node/blocks/img/img.cjs +1 -1
- package/lib/node/blocks/img/img.mjs +22 -17
- 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/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/content/components/enable-editor.cjs +1 -1
- package/lib/node/components/content/components/enable-editor.mjs +182 -164
- 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/functions/get-content/generate-content-url.cjs +1 -1
- package/lib/node/functions/get-content/generate-content-url.mjs +38 -42
- package/lib/node/functions/get-content/index.cjs +1 -1
- package/lib/node/functions/get-content/index.mjs +42 -36
- 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/img/img.d.ts +2 -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/img/img.d.ts +2 -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 strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../constants/file-types.cjs"),t={name:"Raw:Img",hideFromInsertMenu:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",inputs:[{name:"image",bubble:!0,type:"file",allowedFileTypes:e.IMAGE_FILE_TYPES,required:!0}],
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../constants/file-types.cjs"),t={name:"Raw:Img",hideFromInsertMenu:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",inputs:[{name:"image",bubble:!0,type:"file",allowedFileTypes:e.IMAGE_FILE_TYPES,required:!0},{name:"backgroundSize",type:"text",defaultValue:"cover",enum:[{label:"contain",value:"contain",helperText:"The image should never get cropped"},{label:"cover",value:"cover",helperText:"The image should fill it's box, cropping when needed"}]},{name:"backgroundPosition",type:"text",defaultValue:"center",enum:["center","top","left","right","bottom","top left","top right","bottom left","bottom right"]},{name:"altText",type:"string",helperText:"Text to display when the user has images off"},{name:"title",type:"string",helperText:"Text to display when hovering over the asset"},{name:"aspectRatio",type:"number",helperText:"This is the ratio of height/width, e.g. set to 1.5 for a 300px wide and 200px tall photo. Set to 0 to not force the image to maintain it's aspect ratio",advanced:!0,defaultValue:.7041}],noWrap:!0};exports.componentInfo=t;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { IMAGE_FILE_TYPES as e } from "../../constants/file-types.mjs";
|
|
2
2
|
const o = {
|
|
3
|
-
// friendlyName?
|
|
4
3
|
name: "Raw:Img",
|
|
5
4
|
hideFromInsertMenu: !0,
|
|
6
5
|
image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",
|
|
@@ -10,9 +9,40 @@ const o = {
|
|
|
10
9
|
type: "file",
|
|
11
10
|
allowedFileTypes: e,
|
|
12
11
|
required: !0
|
|
12
|
+
}, {
|
|
13
|
+
name: "backgroundSize",
|
|
14
|
+
type: "text",
|
|
15
|
+
defaultValue: "cover",
|
|
16
|
+
enum: [{
|
|
17
|
+
label: "contain",
|
|
18
|
+
value: "contain",
|
|
19
|
+
helperText: "The image should never get cropped"
|
|
20
|
+
}, {
|
|
21
|
+
label: "cover",
|
|
22
|
+
value: "cover",
|
|
23
|
+
helperText: "The image should fill it's box, cropping when needed"
|
|
24
|
+
}]
|
|
25
|
+
}, {
|
|
26
|
+
name: "backgroundPosition",
|
|
27
|
+
type: "text",
|
|
28
|
+
defaultValue: "center",
|
|
29
|
+
enum: ["center", "top", "left", "right", "bottom", "top left", "top right", "bottom left", "bottom right"]
|
|
30
|
+
}, {
|
|
31
|
+
name: "altText",
|
|
32
|
+
type: "string",
|
|
33
|
+
helperText: "Text to display when the user has images off"
|
|
34
|
+
}, {
|
|
35
|
+
name: "title",
|
|
36
|
+
type: "string",
|
|
37
|
+
helperText: "Text to display when hovering over the asset"
|
|
38
|
+
}, {
|
|
39
|
+
name: "aspectRatio",
|
|
40
|
+
type: "number",
|
|
41
|
+
helperText: "This is the ratio of height/width, e.g. set to 1.5 for a 300px wide and 200px tall photo. Set to 0 to not force the image to maintain it's aspect ratio",
|
|
42
|
+
advanced: !0,
|
|
43
|
+
defaultValue: 0.7041
|
|
13
44
|
}],
|
|
14
|
-
noWrap: !0
|
|
15
|
-
static: !0
|
|
45
|
+
noWrap: !0
|
|
16
46
|
};
|
|
17
47
|
export {
|
|
18
48
|
o as componentInfo
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const
|
|
1
|
+
"use client";"use strict";const s=require("react/jsx-runtime"),c=require("../../functions/is-editing.cjs"),a=require("../../functions/get-class-prop-name.cjs");function r(t){var e;function n(){const i={...t.attributes,[a.getClassPropName()]:`builder-raw-img ${t.attributes[a.getClassPropName()]||""}`};return delete i.style,i}return s.jsx("img",{loading:"lazy",alt:t.altText,title:t.title,src:t.imgSrc||t.image,...n(),style:{objectFit:t.backgroundSize||"cover",objectPosition:t.backgroundPosition||"center",aspectRatio:t.aspectRatio||void 0,...((e=t.attributes)==null?void 0:e.style)||{}}},c.isEditing()&&t.imgSrc||"default-key")}module.exports=r;
|
|
@@ -1,29 +1,34 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { isEditing as
|
|
4
|
-
import {
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { isEditing as r } from "../../functions/is-editing.mjs";
|
|
4
|
+
import { getClassPropName as a } from "../../functions/get-class-prop-name.mjs";
|
|
5
|
+
function u(t) {
|
|
6
|
+
var e;
|
|
7
|
+
function n() {
|
|
8
|
+
const i = {
|
|
9
|
+
...t.attributes,
|
|
10
|
+
[a()]: `builder-raw-img ${t.attributes[a()] || ""}`
|
|
11
|
+
};
|
|
12
|
+
return delete i.style, i;
|
|
10
13
|
}
|
|
11
|
-
return /* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ o(
|
|
12
15
|
"img",
|
|
13
16
|
{
|
|
14
17
|
loading: "lazy",
|
|
15
|
-
style: {
|
|
16
|
-
objectFit: t.backgroundSize || "cover",
|
|
17
|
-
objectPosition: t.backgroundPosition || "center"
|
|
18
|
-
},
|
|
19
18
|
alt: t.altText,
|
|
19
|
+
title: t.title,
|
|
20
20
|
src: t.imgSrc || t.image,
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
...n(),
|
|
22
|
+
style: {
|
|
23
|
+
objectFit: t.backgroundSize || "cover",
|
|
24
|
+
objectPosition: t.backgroundPosition || "center",
|
|
25
|
+
aspectRatio: t.aspectRatio || void 0,
|
|
26
|
+
...((e = t.attributes) == null ? void 0 : e.style) || {}
|
|
27
|
+
}
|
|
23
28
|
},
|
|
24
|
-
|
|
29
|
+
r() && t.imgSrc || "default-key"
|
|
25
30
|
);
|
|
26
31
|
}
|
|
27
32
|
export {
|
|
28
|
-
|
|
33
|
+
u as default
|
|
29
34
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={shouldReceiveBuilderProps:{},name:"Text",static:!0,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={shouldReceiveBuilderProps:{},name:"Text",static:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-text_fields-24px%20(1).svg?alt=media&token=12177b73-0ee3-42ca-98c6-0dd003de1929",inputs:[{name:"text",type:"html",required:!0,autoFocus:!0,bubble:!0,defaultValue:"Enter some text..."}],defaultStyles:{lineHeight:"normal",height:"auto",textAlign:"center"}};exports.componentInfo=e;
|
|
@@ -2,7 +2,6 @@ const e = {
|
|
|
2
2
|
shouldReceiveBuilderProps: {},
|
|
3
3
|
name: "Text",
|
|
4
4
|
static: !0,
|
|
5
|
-
isRSC: !0,
|
|
6
5
|
image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-text_fields-24px%20(1).svg?alt=media&token=12177b73-0ee3-42ca-98c6-0dd003de1929",
|
|
7
6
|
inputs: [{
|
|
8
7
|
name: "text",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("react/jsx-runtime");function
|
|
1
|
+
"use client";"use strict";const n=require("react/jsx-runtime");function s(t){var e;return n.jsx("div",{className:"builder-text",dangerouslySetInnerHTML:{__html:((e=t.text)==null?void 0:e.toString())||""},style:{outline:"none"}})}module.exports=s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=require("react/jsx-runtime"),v=require("../../constants/target.cjs"),
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),v=require("../../constants/target.cjs"),j=require("../../functions/get-block-component-options.cjs"),P=require("../../functions/get-processed-block.cjs"),S=require("../../functions/is-previewing.cjs");require("../../helpers/user-attributes.cjs");require("../../functions/get-fetch.cjs");const d=require("./block.helpers.cjs"),q=require("./components/block-wrapper.cjs"),h=require("./components/component-ref/component-ref.cjs"),p=require("./components/repeated-block.cjs"),O=require("./components/style-wrapper.cjs");function b(e){var a,C,x,g;const m=function(){return d.getRepeatItemData({block:e.block,context:e.context})},u={value:null,update:!1},c=function(){var i;if(u.value&&!u.update&&!S.isPreviewing())return u.value;const r=(i=e.block.repeat)!=null&&i.collection?e.block:P.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 d.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=m())!=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)&&!m()?(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:{...j.getBlockComponentOptions(c(),e.context),...d.provideBuilderBlock(l(),c()),...d.provideBuilderContext(l(),e.context),...d.provideLinkComponent(l(),e.linkComponent),...d.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(O,{block:c(),context:e.context,id:e.block.id}),(a=l())!=null&&a.noWrap?m()?t.jsx(t.Fragment,{children:(g=m())==null?void 0:g.map((o,r)=>t.jsx(p,{repeatContext:o.context,block:o.block,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent},d.generateKey(r)))}):t.jsx(h,{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:m()?t.jsx(t.Fragment,{children:(x=m())==null?void 0:x.map((o,r)=>t.jsx(p,{repeatContext:o.context,block:o.block,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent},d.generateKey(r)))}):t.jsxs(q,{Wrapper:f(),block:c(),context:e.context,children:[t.jsx(h,{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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as r, Fragment as u, jsxs as h } from "react/jsx-runtime";
|
|
2
2
|
import { TARGET as S } from "../../constants/target.mjs";
|
|
3
3
|
import { getBlockComponentOptions as P } from "../../functions/get-block-component-options.mjs";
|
|
4
4
|
import { getProcessedBlock as I } from "../../functions/get-processed-block.mjs";
|
|
@@ -6,10 +6,10 @@ import { isPreviewing as O } from "../../functions/is-previewing.mjs";
|
|
|
6
6
|
import "../../helpers/user-attributes.mjs";
|
|
7
7
|
import "../../functions/get-fetch.mjs";
|
|
8
8
|
import { generateKey as x, getRepeatItemData as w, getComponent as W, provideBuilderBlock as T, provideBuilderContext as L, provideLinkComponent as U, provideRegisteredComponents as j } from "./block.helpers.mjs";
|
|
9
|
-
import y from "./components/block-
|
|
10
|
-
import N from "./components/block-wrapper.mjs";
|
|
9
|
+
import y from "./components/block-wrapper.mjs";
|
|
11
10
|
import b from "./components/component-ref/component-ref.mjs";
|
|
12
11
|
import g from "./components/repeated-block.mjs";
|
|
12
|
+
import N from "./components/style-wrapper.mjs";
|
|
13
13
|
function A(e) {
|
|
14
14
|
var a, C, p, f;
|
|
15
15
|
const d = function() {
|
|
@@ -32,7 +32,7 @@ function A(e) {
|
|
|
32
32
|
context: e.context.context
|
|
33
33
|
});
|
|
34
34
|
return s.value = c, s.update = !1, c;
|
|
35
|
-
},
|
|
35
|
+
}, l = function() {
|
|
36
36
|
return W({
|
|
37
37
|
block: n(),
|
|
38
38
|
registeredComponents: e.registeredComponents,
|
|
@@ -49,19 +49,19 @@ function A(e) {
|
|
|
49
49
|
return ("show" in n() ? n().show : !0) && !c;
|
|
50
50
|
}, v = function() {
|
|
51
51
|
var i, m;
|
|
52
|
-
return !((i =
|
|
52
|
+
return !((i = l()) != null && i.component) && !d() ? (m = n().children) != null ? m : [] : [];
|
|
53
53
|
}, o = function() {
|
|
54
54
|
var c, i, m, k;
|
|
55
55
|
return {
|
|
56
56
|
blockChildren: (c = n().children) != null ? c : [],
|
|
57
|
-
componentRef: (i =
|
|
57
|
+
componentRef: (i = l()) == null ? void 0 : i.component,
|
|
58
58
|
componentOptions: {
|
|
59
59
|
...P(n(), e.context),
|
|
60
|
-
...T(
|
|
61
|
-
...L(
|
|
62
|
-
...U(
|
|
60
|
+
...T(l(), n()),
|
|
61
|
+
...L(l(), e.context),
|
|
62
|
+
...U(l(), e.linkComponent),
|
|
63
63
|
...j(
|
|
64
|
-
|
|
64
|
+
l(),
|
|
65
65
|
e.registeredComponents,
|
|
66
66
|
e.context.model
|
|
67
67
|
)
|
|
@@ -70,13 +70,20 @@ function A(e) {
|
|
|
70
70
|
linkComponent: e.linkComponent,
|
|
71
71
|
registeredComponents: e.registeredComponents,
|
|
72
72
|
builderBlock: n(),
|
|
73
|
-
includeBlockProps: ((m =
|
|
74
|
-
isInteractive: !((k =
|
|
73
|
+
includeBlockProps: ((m = l()) == null ? void 0 : m.noWrap) === !0,
|
|
74
|
+
isInteractive: !((k = l()) != null && k.isRSC && S === "rsc")
|
|
75
75
|
};
|
|
76
76
|
};
|
|
77
|
-
return /* @__PURE__ */
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
|
|
77
|
+
return /* @__PURE__ */ r(u, { children: R() ? /* @__PURE__ */ h(u, { children: [
|
|
78
|
+
/* @__PURE__ */ r(
|
|
79
|
+
N,
|
|
80
|
+
{
|
|
81
|
+
block: n(),
|
|
82
|
+
context: e.context,
|
|
83
|
+
id: e.block.id
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
(a = l()) != null && a.noWrap ? d() ? /* @__PURE__ */ r(u, { children: (f = d()) == null ? void 0 : f.map((t, c) => /* @__PURE__ */ r(
|
|
80
87
|
g,
|
|
81
88
|
{
|
|
82
89
|
repeatContext: t.context,
|
|
@@ -85,7 +92,7 @@ function A(e) {
|
|
|
85
92
|
linkComponent: e.linkComponent
|
|
86
93
|
},
|
|
87
94
|
x(c)
|
|
88
|
-
)) }) : /* @__PURE__ */
|
|
95
|
+
)) }) : /* @__PURE__ */ r(
|
|
89
96
|
b,
|
|
90
97
|
{
|
|
91
98
|
componentRef: o().componentRef,
|
|
@@ -98,7 +105,7 @@ function A(e) {
|
|
|
98
105
|
includeBlockProps: o().includeBlockProps,
|
|
99
106
|
isInteractive: o().isInteractive
|
|
100
107
|
}
|
|
101
|
-
) : /* @__PURE__ */
|
|
108
|
+
) : /* @__PURE__ */ r(u, { children: d() ? /* @__PURE__ */ r(u, { children: (p = d()) == null ? void 0 : p.map((t, c) => /* @__PURE__ */ r(
|
|
102
109
|
g,
|
|
103
110
|
{
|
|
104
111
|
repeatContext: t.context,
|
|
@@ -108,13 +115,13 @@ function A(e) {
|
|
|
108
115
|
},
|
|
109
116
|
x(c)
|
|
110
117
|
)) }) : /* @__PURE__ */ h(
|
|
111
|
-
|
|
118
|
+
y,
|
|
112
119
|
{
|
|
113
120
|
Wrapper: B(),
|
|
114
121
|
block: n(),
|
|
115
122
|
context: e.context,
|
|
116
123
|
children: [
|
|
117
|
-
/* @__PURE__ */
|
|
124
|
+
/* @__PURE__ */ r(
|
|
118
125
|
b,
|
|
119
126
|
{
|
|
120
127
|
componentRef: o().componentRef,
|
|
@@ -128,7 +135,7 @@ function A(e) {
|
|
|
128
135
|
isInteractive: o().isInteractive
|
|
129
136
|
}
|
|
130
137
|
),
|
|
131
|
-
(C = v()) == null ? void 0 : C.map((t) => /* @__PURE__ */
|
|
138
|
+
(C = v()) == null ? void 0 : C.map((t) => /* @__PURE__ */ r(
|
|
132
139
|
A,
|
|
133
140
|
{
|
|
134
141
|
block: t,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const e=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";const e=require("react/jsx-runtime"),i=require("react"),o=require("../../../functions/get-block-actions.cjs"),l=require("../../../functions/get-block-properties.cjs"),u=require("../../../functions/is-editing.cjs");require("../../../helpers/user-attributes.cjs");require("../../../functions/get-fetch.cjs");const d=require("../../awaiter.cjs"),s=require("../../live-edit.cjs");function x(t){var c,n;i.useState(()=>0);function r(){return t.includeBlockProps?{...l.getBlockProperties({block:t.block,context:t.context}),...o.getBlockActions({block:t.block,rootState:t.context.rootState,rootSetState:t.context.rootSetState,localState:t.context.localState,context:t.context.context})}:{}}function a(){return t.wrapperProps}return i.useEffect(()=>{},[t.wrapperProps,(n=(c=t.block)==null?void 0:c.component)==null?void 0:n.options]),e.jsx(e.Fragment,{children:t.Wrapper.load?e.jsx(e.Fragment,{children:e.jsx(d,{load:t.Wrapper.load,fallback:t.Wrapper.fallback,props:t.wrapperProps,attributes:r(),children:t.children})}):u.isEditing()?e.jsx(s,{Wrapper:t.Wrapper,id:t.block.id||"",attributes:r(),children:t.children}):e.jsx(t.Wrapper,{...a(),attributes:r(),children:t.children})})}module.exports=x;
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as e, Fragment as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { getBlockActions as
|
|
5
|
-
import { getBlockProperties as
|
|
6
|
-
import
|
|
7
|
-
|
|
2
|
+
import { jsx as e, Fragment as i } from "react/jsx-runtime";
|
|
3
|
+
import { useState as n, useEffect as l } from "react";
|
|
4
|
+
import { getBlockActions as m } from "../../../functions/get-block-actions.mjs";
|
|
5
|
+
import { getBlockProperties as d } from "../../../functions/get-block-properties.mjs";
|
|
6
|
+
import { isEditing as f } from "../../../functions/is-editing.mjs";
|
|
7
|
+
import "../../../helpers/user-attributes.mjs";
|
|
8
|
+
import "../../../functions/get-fetch.mjs";
|
|
9
|
+
import u from "../../awaiter.mjs";
|
|
10
|
+
import b from "../../live-edit.mjs";
|
|
11
|
+
function B(t) {
|
|
8
12
|
var o, c;
|
|
9
|
-
|
|
13
|
+
n(() => 0);
|
|
10
14
|
function r() {
|
|
11
15
|
return t.includeBlockProps ? {
|
|
12
|
-
...
|
|
16
|
+
...d({
|
|
13
17
|
block: t.block,
|
|
14
18
|
context: t.context
|
|
15
19
|
}),
|
|
16
|
-
...
|
|
20
|
+
...m({
|
|
17
21
|
block: t.block,
|
|
18
22
|
rootState: t.context.rootState,
|
|
19
23
|
rootSetState: t.context.rootSetState,
|
|
@@ -22,12 +26,12 @@ function h(t) {
|
|
|
22
26
|
})
|
|
23
27
|
} : {};
|
|
24
28
|
}
|
|
25
|
-
function
|
|
29
|
+
function a() {
|
|
26
30
|
return t.wrapperProps;
|
|
27
31
|
}
|
|
28
|
-
return
|
|
29
|
-
}, [t.wrapperProps, (c = (o = t.block) == null ? void 0 : o.component) == null ? void 0 : c.options]), /* @__PURE__ */ e(
|
|
30
|
-
|
|
32
|
+
return l(() => {
|
|
33
|
+
}, [t.wrapperProps, (c = (o = t.block) == null ? void 0 : o.component) == null ? void 0 : c.options]), /* @__PURE__ */ e(i, { children: t.Wrapper.load ? /* @__PURE__ */ e(i, { children: /* @__PURE__ */ e(
|
|
34
|
+
u,
|
|
31
35
|
{
|
|
32
36
|
load: t.Wrapper.load,
|
|
33
37
|
fallback: t.Wrapper.fallback,
|
|
@@ -35,8 +39,16 @@ function h(t) {
|
|
|
35
39
|
attributes: r(),
|
|
36
40
|
children: t.children
|
|
37
41
|
}
|
|
38
|
-
) }) : /* @__PURE__ */ e(
|
|
42
|
+
) }) : f() ? /* @__PURE__ */ e(
|
|
43
|
+
b,
|
|
44
|
+
{
|
|
45
|
+
Wrapper: t.Wrapper,
|
|
46
|
+
id: t.block.id || "",
|
|
47
|
+
attributes: r(),
|
|
48
|
+
children: t.children
|
|
49
|
+
}
|
|
50
|
+
) : /* @__PURE__ */ e(t.Wrapper, { ...a(), attributes: r(), children: t.children }) });
|
|
39
51
|
}
|
|
40
52
|
export {
|
|
41
|
-
|
|
53
|
+
B as default
|
|
42
54
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";const r=require("react/jsx-runtime"),u=require("../../../constants/device-sizes.cjs"),w=require("../../../functions/camel-to-kebab-case.cjs"),D=require("../../../functions/get-processed-block.cjs"),l=require("../../../helpers/css.cjs"),I=require("../../../helpers/find-block.cjs"),z=require("../../../helpers/nullable.cjs"),M=require("../../inlined-styles.cjs");function U(i){function F(){return I.findBlockById(i.contextProvider.content,i.id)}function e(){var n;const t=F();return t?(n=t.repeat)!=null&&n.collection?t:D.getProcessedBlock({block:t,localState:i.contextProvider.localState,rootState:i.contextProvider.rootState,rootSetState:i.contextProvider.rootSetState,context:i.contextProvider.context}):null}function Q(){var t,s,n,c;return z.checkIsDefined((t=e==null?void 0:e())==null?void 0:t.hide)?!((s=e==null?void 0:e())!=null&&s.hide):z.checkIsDefined((n=e==null?void 0:e())==null?void 0:n.show)?(c=e==null?void 0:e())==null?void 0:c.show:!0}function d(){var f,v,g,b,P,k,q;const t=(f=e==null?void 0:e())==null?void 0:f.responsiveStyles,s=i.contextProvider.content,n=u.getSizesForBreakpoints(((v=s==null?void 0:s.meta)==null?void 0:v.breakpoints)||{}),c=!!((b=(g=s==null?void 0:s.meta)==null?void 0:g.breakpoints)!=null&&b.xsmall),S=t==null?void 0:t.large,y=t==null?void 0:t.medium,x=t==null?void 0:t.small,h=t==null?void 0:t.xsmall,a=(P=e==null?void 0:e())==null?void 0:P.id;if(!a)return"";const j=S?l.createCssClass({className:a,styles:S}):"",$=y?l.createCssClass({className:a,styles:y,mediaQuery:u.getMaxWidthQueryForSize("medium",n)}):"",T=x?l.createCssClass({className:a,styles:x,mediaQuery:u.getMaxWidthQueryForSize("small",n)}):"",W=h&&c?l.createCssClass({className:a,styles:h,mediaQuery:u.getMaxWidthQueryForSize("xsmall",n)}):"",o=e().animations&&e().animations.find(m=>m.trigger==="hover");let C="";if(o){const m=((q=(k=o.steps)==null?void 0:k[1])==null?void 0:q.styles)||{};C=l.createCssClass({className:`${a}:hover`,styles:{...m,transition:`all ${o.duration}s ${w.camelToKebabCase(o.easing)}`,transitionDelay:o.delay?`${o.delay}s`:"0s"}})||""}return[j,$,T,W,C].join(" ")}return r.jsx(r.Fragment,{children:d()&&Q()?r.jsx(r.Fragment,{children:r.jsx(M,{id:"builderio-block",styles:d(),nonce:i.contextProvider.nonce})}):null})}module.exports=U;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as c, Fragment as $ } from "react/jsx-runtime";
|
|
3
|
+
import { getSizesForBreakpoints as D, getMaxWidthQueryForSize as u } from "../../../constants/device-sizes.mjs";
|
|
4
|
+
import { camelToKebabCase as N } from "../../../functions/camel-to-kebab-case.mjs";
|
|
5
|
+
import { getProcessedBlock as W } from "../../../functions/get-processed-block.mjs";
|
|
6
|
+
import { createCssClass as l } from "../../../helpers/css.mjs";
|
|
7
|
+
import { findBlockById as A } from "../../../helpers/find-block.mjs";
|
|
8
|
+
import { checkIsDefined as w } from "../../../helpers/nullable.mjs";
|
|
9
|
+
import E from "../../inlined-styles.mjs";
|
|
10
|
+
function O(i) {
|
|
11
|
+
function z() {
|
|
12
|
+
return A(i.contextProvider.content, i.id);
|
|
13
|
+
}
|
|
14
|
+
function t() {
|
|
15
|
+
var o;
|
|
16
|
+
const e = z();
|
|
17
|
+
return e ? (o = e.repeat) != null && o.collection ? e : W({
|
|
18
|
+
block: e,
|
|
19
|
+
localState: i.contextProvider.localState,
|
|
20
|
+
rootState: i.contextProvider.rootState,
|
|
21
|
+
rootSetState: i.contextProvider.rootSetState,
|
|
22
|
+
context: i.contextProvider.context
|
|
23
|
+
}) : null;
|
|
24
|
+
}
|
|
25
|
+
function F() {
|
|
26
|
+
var e, n, o, s;
|
|
27
|
+
return w((e = t == null ? void 0 : t()) == null ? void 0 : e.hide) ? !((n = t == null ? void 0 : t()) != null && n.hide) : w((o = t == null ? void 0 : t()) == null ? void 0 : o.show) ? (s = t == null ? void 0 : t()) == null ? void 0 : s.show : !0;
|
|
28
|
+
}
|
|
29
|
+
function d() {
|
|
30
|
+
var v, b, g, C, P, k, Q;
|
|
31
|
+
const e = (v = t == null ? void 0 : t()) == null ? void 0 : v.responsiveStyles, n = i.contextProvider.content, o = D(
|
|
32
|
+
((b = n == null ? void 0 : n.meta) == null ? void 0 : b.breakpoints) || {}
|
|
33
|
+
), s = !!((C = (g = n == null ? void 0 : n.meta) == null ? void 0 : g.breakpoints) != null && C.xsmall), S = e == null ? void 0 : e.large, f = e == null ? void 0 : e.medium, y = e == null ? void 0 : e.small, x = e == null ? void 0 : e.xsmall, r = (P = t == null ? void 0 : t()) == null ? void 0 : P.id;
|
|
34
|
+
if (!r)
|
|
35
|
+
return "";
|
|
36
|
+
const I = S ? l({
|
|
37
|
+
className: r,
|
|
38
|
+
styles: S
|
|
39
|
+
}) : "", T = f ? l({
|
|
40
|
+
className: r,
|
|
41
|
+
styles: f,
|
|
42
|
+
mediaQuery: u(
|
|
43
|
+
"medium",
|
|
44
|
+
o
|
|
45
|
+
)
|
|
46
|
+
}) : "", U = y ? l({
|
|
47
|
+
className: r,
|
|
48
|
+
styles: y,
|
|
49
|
+
mediaQuery: u(
|
|
50
|
+
"small",
|
|
51
|
+
o
|
|
52
|
+
)
|
|
53
|
+
}) : "", j = x && s ? l({
|
|
54
|
+
className: r,
|
|
55
|
+
styles: x,
|
|
56
|
+
mediaQuery: u(
|
|
57
|
+
"xsmall",
|
|
58
|
+
o
|
|
59
|
+
)
|
|
60
|
+
}) : "", a = t().animations && t().animations.find((m) => m.trigger === "hover");
|
|
61
|
+
let h = "";
|
|
62
|
+
if (a) {
|
|
63
|
+
const m = ((Q = (k = a.steps) == null ? void 0 : k[1]) == null ? void 0 : Q.styles) || {};
|
|
64
|
+
h = l({
|
|
65
|
+
className: `${r}:hover`,
|
|
66
|
+
styles: {
|
|
67
|
+
...m,
|
|
68
|
+
transition: `all ${a.duration}s ${N(
|
|
69
|
+
a.easing
|
|
70
|
+
)}`,
|
|
71
|
+
transitionDelay: a.delay ? `${a.delay}s` : "0s"
|
|
72
|
+
}
|
|
73
|
+
}) || "";
|
|
74
|
+
}
|
|
75
|
+
return [
|
|
76
|
+
I,
|
|
77
|
+
T,
|
|
78
|
+
U,
|
|
79
|
+
j,
|
|
80
|
+
h
|
|
81
|
+
].join(" ");
|
|
82
|
+
}
|
|
83
|
+
return /* @__PURE__ */ c($, { children: d() && F() ? /* @__PURE__ */ c($, { children: /* @__PURE__ */ c(
|
|
84
|
+
E,
|
|
85
|
+
{
|
|
86
|
+
id: "builderio-block",
|
|
87
|
+
styles: d(),
|
|
88
|
+
nonce: i.contextProvider.nonce
|
|
89
|
+
}
|
|
90
|
+
) }) : null });
|
|
91
|
+
}
|
|
92
|
+
export {
|
|
93
|
+
O as default
|
|
94
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";const e=require("react/jsx-runtime"),i=require("react"),u=require("../../../context/builder.context.cjs"),d=require("../../../functions/is-editing.cjs");require("../../../helpers/user-attributes.cjs");require("../../../functions/get-fetch.cjs");const n=require("./block-styles.cjs"),x=require("./live-edit-block-styles.cjs");function a(t){const[s,r]=i.useState(()=>!1),[c,o]=i.useState(()=>!1),l=i.useContext(u);return i.useEffect(()=>{r(d.isEditing()),o(!0)},[]),e.jsx(e.Fragment,{children:c?e.jsx(e.Fragment,{children:s?e.jsx(x,{id:t.block.id,contextProvider:l}):e.jsx(e.Fragment,{children:e.jsx(n,{block:t.block,context:t.context})})}):e.jsx(e.Fragment,{children:e.jsx(n,{block:t.block,context:t.context})})})}module.exports=a;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as t, Fragment as i } from "react/jsx-runtime";
|
|
3
|
+
import { useState as o, useContext as m, useEffect as f } from "react";
|
|
4
|
+
import a from "../../../context/builder.context.mjs";
|
|
5
|
+
import { isEditing as u } from "../../../functions/is-editing.mjs";
|
|
6
|
+
import "../../../helpers/user-attributes.mjs";
|
|
7
|
+
import "../../../functions/get-fetch.mjs";
|
|
8
|
+
import r from "./block-styles.mjs";
|
|
9
|
+
import x from "./live-edit-block-styles.mjs";
|
|
10
|
+
function p(e) {
|
|
11
|
+
const [n, c] = o(() => !1), [l, d] = o(() => !1), s = m(a);
|
|
12
|
+
return f(() => {
|
|
13
|
+
c(u()), d(!0);
|
|
14
|
+
}, []), /* @__PURE__ */ t(i, { children: l ? /* @__PURE__ */ t(i, { children: n ? /* @__PURE__ */ t(
|
|
15
|
+
x,
|
|
16
|
+
{
|
|
17
|
+
id: e.block.id,
|
|
18
|
+
contextProvider: s
|
|
19
|
+
}
|
|
20
|
+
) : /* @__PURE__ */ t(i, { children: /* @__PURE__ */ t(r, { block: e.block, context: e.context }) }) }) : /* @__PURE__ */ t(i, { children: /* @__PURE__ */ t(r, { block: e.block, context: e.context }) }) });
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
p as default
|
|
24
|
+
};
|
|
@@ -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;
|