@builder.io/sdk-react-nextjs 0.18.2 → 0.18.8
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/custom-code/custom-code.cjs +1 -1
- package/lib/browser/blocks/custom-code/custom-code.mjs +27 -17
- package/lib/browser/blocks/embed/embed.cjs +1 -1
- package/lib/browser/blocks/embed/embed.mjs +16 -15
- package/lib/browser/blocks/image/component-info.cjs +1 -1
- package/lib/browser/blocks/image/component-info.mjs +12 -8
- package/lib/browser/blocks/image/image.cjs +4 -4
- package/lib/browser/blocks/image/image.mjs +14 -13
- package/lib/browser/components/blocks/blocks-wrapper.cjs +2 -2
- package/lib/browser/components/blocks/blocks-wrapper.mjs +18 -16
- package/lib/browser/components/content-variants/helpers.cjs +9 -9
- package/lib/browser/components/content-variants/helpers.mjs +16 -16
- package/lib/browser/components/content-variants/inlined-fns.cjs +5 -2
- package/lib/browser/components/content-variants/inlined-fns.mjs +5 -2
- package/lib/browser/constants/sdk-version.cjs +1 -1
- package/lib/browser/constants/sdk-version.mjs +1 -1
- package/lib/edge/blocks/custom-code/custom-code.cjs +1 -1
- package/lib/edge/blocks/custom-code/custom-code.mjs +27 -17
- package/lib/edge/blocks/embed/embed.cjs +1 -1
- package/lib/edge/blocks/embed/embed.mjs +16 -15
- package/lib/edge/blocks/image/component-info.cjs +1 -1
- package/lib/edge/blocks/image/component-info.mjs +12 -8
- package/lib/edge/blocks/image/image.cjs +4 -4
- package/lib/edge/blocks/image/image.mjs +14 -13
- package/lib/edge/components/blocks/blocks-wrapper.cjs +2 -2
- package/lib/edge/components/blocks/blocks-wrapper.mjs +18 -16
- package/lib/edge/components/content-variants/helpers.cjs +9 -9
- package/lib/edge/components/content-variants/helpers.mjs +16 -16
- package/lib/edge/components/content-variants/inlined-fns.cjs +5 -2
- package/lib/edge/components/content-variants/inlined-fns.mjs +5 -2
- package/lib/edge/constants/sdk-version.cjs +1 -1
- package/lib/edge/constants/sdk-version.mjs +1 -1
- package/lib/node/blocks/custom-code/custom-code.cjs +1 -1
- package/lib/node/blocks/custom-code/custom-code.mjs +27 -17
- package/lib/node/blocks/embed/embed.cjs +1 -1
- package/lib/node/blocks/embed/embed.mjs +16 -15
- package/lib/node/blocks/image/component-info.cjs +1 -1
- package/lib/node/blocks/image/component-info.mjs +12 -8
- package/lib/node/blocks/image/image.cjs +4 -4
- package/lib/node/blocks/image/image.mjs +14 -13
- package/lib/node/components/blocks/blocks-wrapper.cjs +2 -2
- package/lib/node/components/blocks/blocks-wrapper.mjs +18 -16
- package/lib/node/components/content-variants/helpers.cjs +9 -9
- package/lib/node/components/content-variants/helpers.mjs +16 -16
- package/lib/node/components/content-variants/inlined-fns.cjs +5 -2
- package/lib/node/components/content-variants/inlined-fns.mjs +5 -2
- package/lib/node/constants/sdk-version.cjs +1 -1
- package/lib/node/constants/sdk-version.mjs +1 -1
- package/package.json +1 -1
- package/types/cjs/blocks/image/image.types.d.ts +1 -0
- package/types/cjs/components/content-variants/inlined-fns.d.ts +1 -1
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/esm/blocks/image/image.types.d.ts +1 -0
- package/types/esm/components/content-variants/inlined-fns.d.ts +1 -1
- package/types/esm/constants/sdk-version.d.ts +1 -1
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
2
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
3
3
|
import { useRef as d, useState as s, useEffect as f } from "react";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { logger as g } from "../../helpers/logger.mjs";
|
|
5
|
+
import { isJsScript as E } from "./helpers.mjs";
|
|
6
|
+
function y(m) {
|
|
7
|
+
const t = d(null), [c, h] = s(() => []), [i, I] = s(() => []), [u, p] = s(() => !1);
|
|
8
|
+
function l() {
|
|
8
9
|
if (!t.current || !t.current.getElementsByTagName)
|
|
9
10
|
return;
|
|
10
11
|
const o = t.current.getElementsByTagName("script");
|
|
11
|
-
for (let
|
|
12
|
-
const e = o[
|
|
12
|
+
for (let n = 0; n < o.length; n++) {
|
|
13
|
+
const e = o[n];
|
|
13
14
|
if (e.src && !c.includes(e.src)) {
|
|
14
15
|
c.push(e.src);
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
} else if (
|
|
16
|
+
const r = document.createElement("script");
|
|
17
|
+
r.async = !0, r.src = e.src, document.head.appendChild(r);
|
|
18
|
+
} else if (E(e) && !i.includes(e.innerText))
|
|
18
19
|
try {
|
|
19
20
|
i.push(e.innerText), new Function(e.innerText)();
|
|
20
|
-
} catch (
|
|
21
|
-
|
|
21
|
+
} catch (r) {
|
|
22
|
+
g.warn("[BUILDER.IO] `Embed`: Error running script:", r);
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
return f(() => {
|
|
26
|
-
t.current && !u && (p(!0),
|
|
27
|
-
}, [t.current, u]), /* @__PURE__ */
|
|
27
|
+
t.current && !u && (p(!0), l());
|
|
28
|
+
}, [t.current, u]), /* @__PURE__ */ a(
|
|
28
29
|
"div",
|
|
29
30
|
{
|
|
30
31
|
className: "builder-embed",
|
|
31
32
|
ref: t,
|
|
32
|
-
dangerouslySetInnerHTML: { __html:
|
|
33
|
+
dangerouslySetInnerHTML: { __html: m.content }
|
|
33
34
|
}
|
|
34
35
|
);
|
|
35
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("../../constants/file-types.cjs"),m={name:"Image",static:!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",defaultStyles:{position:"relative",minHeight:"20px",minWidth:"20px",overflow:"hidden"},canHaveChildren:!0,inputs:[{name:"image",type:"file",bubble:!0,allowedFileTypes:p.IMAGE_FILE_TYPES,required:!0,defaultValue:"https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",onChange:t=>{t.delete("srcset"),t.delete("noWebp");function d(e,o=6e4){return new Promise((u,n)=>{const i=document.createElement("img");let l=!1;i.onload=()=>{l=!0,u(i)},i.addEventListener("error",s=>{console.warn("Image load failed",s.error),n(s.error)}),i.src=e,setTimeout(()=>{l||n(new Error("Image load timed out"))},o)})}function h(e){return Math.round(e*1e3)/1e3}const a=t.get("image"),r=t.get("aspectRatio");if(fetch(a).then(e=>e.blob()).then(e=>{e.type.includes("svg")&&t.set("noWebp",!0)}),a&&(!r||r===.7041))return d(a).then(e=>{const o=t.get("aspectRatio");t.get("image")===a&&(!o||o===.7041)&&e.width&&e.height&&(t.set("aspectRatio",h(e.height/e.width)),t.set("height",e.height),t.set("width",e.width))})}},{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:"height",type:"number",hideFromUI:!0},{name:"width",type:"number",hideFromUI:!0},{name:"sizes",type:"string",hideFromUI:!0},{name:"srcset",type:"string",hideFromUI:!0},{name:"lazy",type:"boolean",defaultValue:!0,hideFromUI:!0},{name:"fitContent",type:"boolean",helperText:"When child blocks are provided, fit to them instead of using the image's aspect ratio",defaultValue:!0},{name:"highPriority",type:"boolean",advanced:!0,helperText:"Mark this image as high priority compared to other images on the page. This prevents lazy loading of the image and tells the browser to load this image before others on the page."},{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}],shouldReceiveBuilderProps:{builderBlock:!0}};exports.componentInfo=m;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IMAGE_FILE_TYPES as
|
|
2
|
-
const
|
|
1
|
+
import { IMAGE_FILE_TYPES as p } from "../../constants/file-types.mjs";
|
|
2
|
+
const c = {
|
|
3
3
|
name: "Image",
|
|
4
4
|
static: !0,
|
|
5
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",
|
|
@@ -14,19 +14,19 @@ const g = {
|
|
|
14
14
|
name: "image",
|
|
15
15
|
type: "file",
|
|
16
16
|
bubble: !0,
|
|
17
|
-
allowedFileTypes:
|
|
17
|
+
allowedFileTypes: p,
|
|
18
18
|
required: !0,
|
|
19
19
|
defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
|
|
20
20
|
onChange: (t) => {
|
|
21
21
|
t.delete("srcset"), t.delete("noWebp");
|
|
22
|
-
function
|
|
22
|
+
function d(e, o = 6e4) {
|
|
23
23
|
return new Promise((u, n) => {
|
|
24
24
|
const i = document.createElement("img");
|
|
25
25
|
let l = !1;
|
|
26
26
|
i.onload = () => {
|
|
27
27
|
l = !0, u(i);
|
|
28
|
-
}, i.addEventListener("error", (
|
|
29
|
-
console.warn("Image load failed",
|
|
28
|
+
}, i.addEventListener("error", (h) => {
|
|
29
|
+
console.warn("Image load failed", h.error), n(h.error);
|
|
30
30
|
}), i.src = e, setTimeout(() => {
|
|
31
31
|
l || n(new Error("Image load timed out"));
|
|
32
32
|
}, o);
|
|
@@ -39,7 +39,7 @@ const g = {
|
|
|
39
39
|
if (fetch(a).then((e) => e.blob()).then((e) => {
|
|
40
40
|
e.type.includes("svg") && t.set("noWebp", !0);
|
|
41
41
|
}), a && (!r || r === 0.7041))
|
|
42
|
-
return
|
|
42
|
+
return d(a).then((e) => {
|
|
43
43
|
const o = t.get("aspectRatio");
|
|
44
44
|
t.get("image") === a && (!o || o === 0.7041) && e.width && e.height && (t.set("aspectRatio", s(e.height / e.width)), t.set("height", e.height), t.set("width", e.width));
|
|
45
45
|
});
|
|
@@ -66,6 +66,10 @@ const g = {
|
|
|
66
66
|
name: "altText",
|
|
67
67
|
type: "string",
|
|
68
68
|
helperText: "Text to display when the user has images off"
|
|
69
|
+
}, {
|
|
70
|
+
name: "title",
|
|
71
|
+
type: "string",
|
|
72
|
+
helperText: "Text to display when hovering over the asset"
|
|
69
73
|
}, {
|
|
70
74
|
name: "height",
|
|
71
75
|
type: "number",
|
|
@@ -109,5 +113,5 @@ const g = {
|
|
|
109
113
|
}
|
|
110
114
|
};
|
|
111
115
|
export {
|
|
112
|
-
|
|
116
|
+
c as componentInfo
|
|
113
117
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use client";"use strict";const t=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";const t=require("react/jsx-runtime"),l=require("./image.helpers.cjs");function f(e){var s,r,u,d,o,g;function n(){var h;const i=e.image||e.src;if(!i||!(typeof i=="string"&&(i.match(/builder\.io/)||i.match(/cdn\.shopify\.com/))))return e.srcset;if(!e.noWebp){if(e.srcset&&((h=e.image)!=null&&h.includes("builder.io/api/v1/image"))){if(!e.srcset.includes(e.image.split("?")[0]))return console.debug("Removed given srcset"),l.getSrcSet(i)}else if(e.image&&!e.srcset)return l.getSrcSet(i);return l.getSrcSet(i)}}function a(){var c;return(c=n==null?void 0:n())!=null&&c.match(/builder\.io/)&&!e.noWebp?n().replace(/\?/g,"?format=webp&"):""}function m(){const c={position:"absolute",height:"100%",width:"100%",left:"0px",top:"0px"};return e.aspectRatio?c:void 0}return t.jsxs(t.Fragment,{children:[t.jsxs(t.Fragment,{children:[t.jsxs("picture",{children:[a()?t.jsx("source",{type:"image/webp",srcSet:a()}):null,t.jsx("img",{loading:e.highPriority?"eager":"lazy",fetchPriority:e.highPriority?"high":"auto",alt:e.altText,title:e.title,role:e.altText?void 0:"presentation",style:{objectPosition:e.backgroundPosition||"center",objectFit:e.backgroundSize||"cover",...m()},className:"builder-image"+(e.className?" "+e.className:"")+" img-0525a549",src:e.image,srcSet:n(),sizes:e.sizes})]}),e.aspectRatio&&!((r=(s=e.builderBlock)==null?void 0:s.children)!=null&&r.length&&e.fitContent)?t.jsx("div",{className:"builder-image-sizer div-0525a549",style:{paddingTop:e.aspectRatio*100+"%"}}):null,(d=(u=e.builderBlock)==null?void 0:u.children)!=null&&d.length&&e.fitContent?t.jsx(t.Fragment,{children:e.children}):null,!e.fitContent&&((g=(o=e.builderBlock)==null?void 0:o.children)!=null&&g.length)?t.jsx("div",{className:"div-0525a549-2",children:e.children}):null]}),t.jsx("style",{children:`.img-0525a549 {
|
|
2
2
|
opacity: 1;
|
|
3
3
|
transition: opacity 0.2s ease-in-out;
|
|
4
|
-
}.div-
|
|
4
|
+
}.div-0525a549 {
|
|
5
5
|
width: 100%;
|
|
6
6
|
pointer-events: none;
|
|
7
7
|
font-size: 0;
|
|
8
|
-
}.div-
|
|
8
|
+
}.div-0525a549-2 {
|
|
9
9
|
display: flex;
|
|
10
10
|
flex-direction: column;
|
|
11
11
|
align-items: stretch;
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
left: 0;
|
|
15
15
|
width: 100%;
|
|
16
16
|
height: 100%;
|
|
17
|
-
}`})]})}module.exports=
|
|
17
|
+
}`})]})}module.exports=f;
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
import { jsxs as a, Fragment as c, jsx as t } from "react/jsx-runtime";
|
|
3
3
|
import { getSrcSet as o } from "./image.helpers.mjs";
|
|
4
4
|
function x(e) {
|
|
5
|
-
var d,
|
|
5
|
+
var d, u, s, g, h, m;
|
|
6
6
|
function n() {
|
|
7
|
-
var
|
|
7
|
+
var f;
|
|
8
8
|
const i = e.image || e.src;
|
|
9
9
|
if (!i || // We can auto add srcset for cdn.builder.io and shopify
|
|
10
10
|
// images, otherwise you can supply this prop manually
|
|
11
11
|
!(typeof i == "string" && (i.match(/builder\.io/) || i.match(/cdn\.shopify\.com/))))
|
|
12
12
|
return e.srcset;
|
|
13
13
|
if (!e.noWebp) {
|
|
14
|
-
if (e.srcset && ((
|
|
14
|
+
if (e.srcset && ((f = e.image) != null && f.includes("builder.io/api/v1/image"))) {
|
|
15
15
|
if (!e.srcset.includes(e.image.split("?")[0]))
|
|
16
16
|
return console.debug("Removed given srcset"), o(i);
|
|
17
17
|
} else if (e.image && !e.srcset)
|
|
@@ -23,7 +23,7 @@ function x(e) {
|
|
|
23
23
|
var l;
|
|
24
24
|
return (l = n == null ? void 0 : n()) != null && l.match(/builder\.io/) && !e.noWebp ? n().replace(/\?/g, "?format=webp&") : "";
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function b() {
|
|
27
27
|
const l = {
|
|
28
28
|
position: "absolute",
|
|
29
29
|
height: "100%",
|
|
@@ -43,39 +43,40 @@ function x(e) {
|
|
|
43
43
|
loading: e.highPriority ? "eager" : "lazy",
|
|
44
44
|
fetchPriority: e.highPriority ? "high" : "auto",
|
|
45
45
|
alt: e.altText,
|
|
46
|
+
title: e.title,
|
|
46
47
|
role: e.altText ? void 0 : "presentation",
|
|
47
48
|
style: {
|
|
48
49
|
objectPosition: e.backgroundPosition || "center",
|
|
49
50
|
objectFit: e.backgroundSize || "cover",
|
|
50
|
-
...
|
|
51
|
+
...b()
|
|
51
52
|
},
|
|
52
|
-
className: "builder-image" + (e.className ? " " + e.className : "") + " img-
|
|
53
|
+
className: "builder-image" + (e.className ? " " + e.className : "") + " img-0525a549",
|
|
53
54
|
src: e.image,
|
|
54
55
|
srcSet: n(),
|
|
55
56
|
sizes: e.sizes
|
|
56
57
|
}
|
|
57
58
|
)
|
|
58
59
|
] }),
|
|
59
|
-
e.aspectRatio && !((
|
|
60
|
+
e.aspectRatio && !((u = (d = e.builderBlock) == null ? void 0 : d.children) != null && u.length && e.fitContent) ? /* @__PURE__ */ t(
|
|
60
61
|
"div",
|
|
61
62
|
{
|
|
62
|
-
className: "builder-image-sizer div-
|
|
63
|
+
className: "builder-image-sizer div-0525a549",
|
|
63
64
|
style: {
|
|
64
65
|
paddingTop: e.aspectRatio * 100 + "%"
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
) : null,
|
|
68
|
-
(g = (
|
|
69
|
-
!e.fitContent && ((m = (h = e.builderBlock) == null ? void 0 : h.children) != null && m.length) ? /* @__PURE__ */ t("div", { className: "div-
|
|
69
|
+
(g = (s = e.builderBlock) == null ? void 0 : s.children) != null && g.length && e.fitContent ? /* @__PURE__ */ t(c, { children: e.children }) : null,
|
|
70
|
+
!e.fitContent && ((m = (h = e.builderBlock) == null ? void 0 : h.children) != null && m.length) ? /* @__PURE__ */ t("div", { className: "div-0525a549-2", children: e.children }) : null
|
|
70
71
|
] }),
|
|
71
|
-
/* @__PURE__ */ t("style", { children: `.img-
|
|
72
|
+
/* @__PURE__ */ t("style", { children: `.img-0525a549 {
|
|
72
73
|
opacity: 1;
|
|
73
74
|
transition: opacity 0.2s ease-in-out;
|
|
74
|
-
}.div-
|
|
75
|
+
}.div-0525a549 {
|
|
75
76
|
width: 100%;
|
|
76
77
|
pointer-events: none;
|
|
77
78
|
font-size: 0;
|
|
78
|
-
}.div-
|
|
79
|
+
}.div-0525a549-2 {
|
|
79
80
|
display: flex;
|
|
80
81
|
flex-direction: column;
|
|
81
82
|
align-items: stretch;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use client";"use strict";const
|
|
1
|
+
"use client";"use strict";const a=require("react/jsx-runtime"),i=require("react"),r=require("../../functions/is-editing.cjs");function d(e){const c=i.useRef(null);i.useState(()=>!1);function o(){var t;return["builder-blocks",(t=e.blocks)!=null&&t.length?"":"no-blocks",e.classNameProp].filter(Boolean).join(" ")}function s(){if(!e.path)return;const t="this.",n="component.options.";return e.path.startsWith(t)?e.path.replace(t,""):e.path.startsWith(n)?e.path:`${n}${e.path||""}`}function l(){var t,n;r.isEditing()&&!((t=e.blocks)!=null&&t.length)&&((n=window.parent)==null||n.postMessage({type:"builder.clickEmptyBlocks",data:{parentElementId:e.parent,dataPath:s()}},"*"))}function u(){var t,n;r.isEditing()&&!((t=e.blocks)!=null&&t.length)&&((n=window.parent)==null||n.postMessage({type:"builder.hoverEmptyBlocks",data:{parentElementId:e.parent,dataPath:s()}},"*"))}return i.useEffect(()=>{},[]),i.useEffect(()=>{},[e.blocks]),a.jsxs(a.Fragment,{children:[a.jsx(e.BlocksWrapper,{ref:c,className:o()+" props-blocks-wrapper-2b05e766","builder-path":s(),"builder-parent-id":e.parent,style:e.styleProp,onClick:t=>l(),onMouseEnter:t=>u(),onKeyPress:t=>l(),...e.BlocksWrapperProps,children:e.children}),a.jsx("style",{children:`.props-blocks-wrapper-2b05e766 {
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
align-items: stretch;
|
|
5
|
-
}`})]})}module.exports=
|
|
5
|
+
}`})]})}module.exports=d;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { isEditing as
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
|
|
2
|
+
import { jsxs as h, Fragment as f, jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as u, useState as k, useEffect as i } from "react";
|
|
4
|
+
import { isEditing as s } from "../../functions/is-editing.mjs";
|
|
5
|
+
function y(e) {
|
|
6
|
+
const c = u(null);
|
|
7
|
+
k(() => !1);
|
|
8
|
+
function o() {
|
|
8
9
|
var t;
|
|
9
10
|
return [
|
|
10
11
|
"builder-blocks",
|
|
@@ -20,7 +21,7 @@ function k(e) {
|
|
|
20
21
|
}
|
|
21
22
|
function l() {
|
|
22
23
|
var t, n;
|
|
23
|
-
|
|
24
|
+
s() && !((t = e.blocks) != null && t.length) && ((n = window.parent) == null || n.postMessage(
|
|
24
25
|
{
|
|
25
26
|
type: "builder.clickEmptyBlocks",
|
|
26
27
|
data: {
|
|
@@ -31,9 +32,9 @@ function k(e) {
|
|
|
31
32
|
"*"
|
|
32
33
|
));
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
+
function d() {
|
|
35
36
|
var t, n;
|
|
36
|
-
|
|
37
|
+
s() && !((t = e.blocks) != null && t.length) && ((n = window.parent) == null || n.postMessage(
|
|
37
38
|
{
|
|
38
39
|
type: "builder.hoverEmptyBlocks",
|
|
39
40
|
data: {
|
|
@@ -44,24 +45,25 @@ function k(e) {
|
|
|
44
45
|
"*"
|
|
45
46
|
));
|
|
46
47
|
}
|
|
47
|
-
return
|
|
48
|
-
}, []),
|
|
48
|
+
return i(() => {
|
|
49
|
+
}, []), i(() => {
|
|
50
|
+
}, [e.blocks]), /* @__PURE__ */ h(f, { children: [
|
|
49
51
|
/* @__PURE__ */ r(
|
|
50
52
|
e.BlocksWrapper,
|
|
51
53
|
{
|
|
52
|
-
ref:
|
|
53
|
-
className:
|
|
54
|
+
ref: c,
|
|
55
|
+
className: o() + " props-blocks-wrapper-2b05e766",
|
|
54
56
|
"builder-path": a(),
|
|
55
57
|
"builder-parent-id": e.parent,
|
|
56
58
|
style: e.styleProp,
|
|
57
59
|
onClick: (t) => l(),
|
|
58
|
-
onMouseEnter: (t) =>
|
|
60
|
+
onMouseEnter: (t) => d(),
|
|
59
61
|
onKeyPress: (t) => l(),
|
|
60
62
|
...e.BlocksWrapperProps,
|
|
61
63
|
children: e.children
|
|
62
64
|
}
|
|
63
65
|
),
|
|
64
|
-
/* @__PURE__ */ r("style", { children: `.props-blocks-wrapper-
|
|
66
|
+
/* @__PURE__ */ r("style", { children: `.props-blocks-wrapper-2b05e766 {
|
|
65
67
|
display: flex;
|
|
66
68
|
flex-direction: column;
|
|
67
69
|
align-items: stretch;
|
|
@@ -69,5 +71,5 @@ function k(e) {
|
|
|
69
71
|
] });
|
|
70
72
|
}
|
|
71
73
|
export {
|
|
72
|
-
|
|
74
|
+
y as default
|
|
73
75
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
window.${
|
|
3
|
-
window.${
|
|
4
|
-
`,
|
|
5
|
-
window.${
|
|
6
|
-
"${t}",${JSON.stringify(i)}, ${
|
|
7
|
-
)`,
|
|
8
|
-
"${t}", "${i}", ${
|
|
9
|
-
)`;exports.checkShouldRenderVariants=d;exports.getInitVariantsFnsScriptString=
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../constants/target.cjs"),S=require("../../functions/is-browser.cjs"),r=require("./inlined-fns.cjs"),s="builderIoAbTest",a="builderIoRenderContent",n=i=>Object.values((i==null?void 0:i.variations)||{}).map(t=>({...t,testVariationId:t.id,id:i==null?void 0:i.id})),d=({canTrack:i,content:t})=>!(!(n(t).length>0)||!i||S.isBrowser()),I=i=>i==="react"||i==="reactNative",T=e.TARGET==="angular",o=I(e.TARGET),c=()=>`
|
|
2
|
+
window.${s} = ${r.UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
3
|
+
window.${a} = ${r.UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
4
|
+
`,g=(i,t)=>`
|
|
5
|
+
window.${s}(
|
|
6
|
+
"${t}",${JSON.stringify(i)}, ${o}, ${T}
|
|
7
|
+
)`,l=({contentId:i,variationId:t})=>`window.${a}(
|
|
8
|
+
"${t}", "${i}", ${o}
|
|
9
|
+
)`;exports.checkShouldRenderVariants=d;exports.getInitVariantsFnsScriptString=c;exports.getUpdateCookieAndStylesScript=g;exports.getUpdateVariantVisibilityScript=l;exports.getVariants=n;
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { TARGET as
|
|
1
|
+
import { TARGET as t } from "../../constants/target.mjs";
|
|
2
2
|
import { isBrowser as o } from "../../functions/is-browser.mjs";
|
|
3
|
-
import { UPDATE_COOKIES_AND_STYLES_SCRIPT as
|
|
4
|
-
const
|
|
3
|
+
import { UPDATE_COOKIES_AND_STYLES_SCRIPT as n, UPDATE_VARIANT_VISIBILITY_SCRIPT as I } from "./inlined-fns.mjs";
|
|
4
|
+
const s = "builderIoAbTest", a = "builderIoRenderContent", S = (i) => Object.values((i == null ? void 0 : i.variations) || {}).map((r) => ({
|
|
5
5
|
...r,
|
|
6
6
|
testVariationId: r.id,
|
|
7
7
|
id: i == null ? void 0 : i.id
|
|
8
|
-
})),
|
|
8
|
+
})), V = ({
|
|
9
9
|
canTrack: i,
|
|
10
10
|
content: r
|
|
11
|
-
}) => !(!(S(r).length > 0) || !i || o()), T = (i) => i === "react" || i === "reactNative",
|
|
12
|
-
window.${t} = ${I}
|
|
11
|
+
}) => !(!(S(r).length > 0) || !i || o()), T = (i) => i === "react" || i === "reactNative", d = t === "angular", e = T(t), g = () => `
|
|
13
12
|
window.${s} = ${n}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
window.${a} = ${I}
|
|
14
|
+
`, u = (i, r) => `
|
|
15
|
+
window.${s}(
|
|
16
|
+
"${r}",${JSON.stringify(i)}, ${e}, ${d}
|
|
17
|
+
)`, E = ({
|
|
18
18
|
contentId: i,
|
|
19
19
|
variationId: r
|
|
20
|
-
}) => `window.${
|
|
21
|
-
"${r}", "${i}", ${
|
|
20
|
+
}) => `window.${a}(
|
|
21
|
+
"${r}", "${i}", ${e}
|
|
22
22
|
)`;
|
|
23
23
|
export {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
V as checkShouldRenderVariants,
|
|
25
|
+
g as getInitVariantsFnsScriptString,
|
|
26
|
+
u as getUpdateCookieAndStylesScript,
|
|
27
|
+
E as getUpdateVariantVisibilityScript,
|
|
28
28
|
S as getVariants
|
|
29
29
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=`function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=`function updateCookiesAndStyles(contentId, variants, isHydrationTarget, isAngularSDK) {
|
|
2
2
|
function getAndSetVariantId() {
|
|
3
3
|
function setCookie(name, value, days) {
|
|
4
4
|
let expires = '';
|
|
@@ -40,7 +40,10 @@
|
|
|
40
40
|
return contentId;
|
|
41
41
|
}
|
|
42
42
|
const winningVariantId = getAndSetVariantId();
|
|
43
|
-
|
|
43
|
+
let styleEl = document.currentScript?.previousElementSibling;
|
|
44
|
+
if (isAngularSDK) {
|
|
45
|
+
styleEl = document.currentScript?.parentElement?.previousElementSibling?.querySelector('style');
|
|
46
|
+
}
|
|
44
47
|
if (isHydrationTarget) {
|
|
45
48
|
styleEl.remove();
|
|
46
49
|
const thisScriptEl = document.currentScript;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const n = `function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {
|
|
1
|
+
const n = `function updateCookiesAndStyles(contentId, variants, isHydrationTarget, isAngularSDK) {
|
|
2
2
|
function getAndSetVariantId() {
|
|
3
3
|
function setCookie(name, value, days) {
|
|
4
4
|
let expires = '';
|
|
@@ -40,7 +40,10 @@ const n = `function updateCookiesAndStyles(contentId, variants, isHydrationTarge
|
|
|
40
40
|
return contentId;
|
|
41
41
|
}
|
|
42
42
|
const winningVariantId = getAndSetVariantId();
|
|
43
|
-
|
|
43
|
+
let styleEl = document.currentScript?.previousElementSibling;
|
|
44
|
+
if (isAngularSDK) {
|
|
45
|
+
styleEl = document.currentScript?.parentElement?.previousElementSibling?.querySelector('style');
|
|
46
|
+
}
|
|
44
47
|
if (isHydrationTarget) {
|
|
45
48
|
styleEl.remove();
|
|
46
49
|
const thisScriptEl = document.currentScript;
|
|
@@ -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.8";exports.SDK_VERSION=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const
|
|
1
|
+
"use client";"use strict";const l=require("react/jsx-runtime"),n=require("react"),p=require("../../functions/is-editing.cjs"),f=require("../../helpers/logger.cjs");function m(s){const r=n.useRef(null),[i,g]=n.useState(()=>[]),[u,E]=n.useState(()=>[]);function o(){var d;if(!r.current||!((d=r.current)!=null&&d.getElementsByTagName)||typeof window=="undefined")return;const a=r.current.getElementsByTagName("script");for(let c=0;c<a.length;c++){const e=a[c];if(e.src){if(i.includes(e.src))continue;i.push(e.src);const t=document.createElement("script");t.async=!0,t.src=e.src,document.head.appendChild(t)}else if(!e.type||["text/javascript","application/javascript","application/ecmascript"].includes(e.type)){if(u.includes(e.innerText))continue;try{u.push(e.innerText),new Function(e.innerText)()}catch(t){f.logger.warn("[BUILDER.IO] `CustomCode`: Error running script:",t)}}}}return n.useEffect(()=>{o()},[]),n.useEffect(()=>{p.isEditing()&&o()},[s.code]),l.jsx("div",{ref:r,className:"builder-custom-code"+(s.replaceNodes?" replace-nodes":""),dangerouslySetInnerHTML:{__html:s.code}})}module.exports=m;
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useRef as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as m, useState as a, useEffect as d } from "react";
|
|
4
|
+
import { isEditing as f } from "../../functions/is-editing.mjs";
|
|
5
|
+
import { logger as g } from "../../helpers/logger.mjs";
|
|
6
|
+
function w(r) {
|
|
7
|
+
const n = m(null), [s, y] = a(() => []), [i, h] = a(() => []);
|
|
8
|
+
function o() {
|
|
9
|
+
var p;
|
|
10
|
+
if (!n.current || !((p = n.current) != null && p.getElementsByTagName) || typeof window == "undefined")
|
|
9
11
|
return;
|
|
10
|
-
const
|
|
11
|
-
for (let
|
|
12
|
-
const e =
|
|
12
|
+
const u = n.current.getElementsByTagName("script");
|
|
13
|
+
for (let c = 0; c < u.length; c++) {
|
|
14
|
+
const e = u[c];
|
|
13
15
|
if (e.src) {
|
|
14
|
-
if (
|
|
16
|
+
if (s.includes(e.src))
|
|
15
17
|
continue;
|
|
16
|
-
|
|
18
|
+
s.push(e.src);
|
|
17
19
|
const t = document.createElement("script");
|
|
18
20
|
t.async = !0, t.src = e.src, document.head.appendChild(t);
|
|
19
21
|
} else if (!e.type || [
|
|
@@ -26,19 +28,27 @@ function h(s) {
|
|
|
26
28
|
try {
|
|
27
29
|
i.push(e.innerText), new Function(e.innerText)();
|
|
28
30
|
} catch (t) {
|
|
29
|
-
|
|
31
|
+
g.warn(
|
|
32
|
+
"[BUILDER.IO] `CustomCode`: Error running script:",
|
|
33
|
+
t
|
|
34
|
+
);
|
|
30
35
|
}
|
|
31
36
|
}
|
|
32
37
|
}
|
|
33
|
-
}
|
|
38
|
+
}
|
|
39
|
+
return d(() => {
|
|
40
|
+
o();
|
|
41
|
+
}, []), d(() => {
|
|
42
|
+
f() && o();
|
|
43
|
+
}, [r.code]), /* @__PURE__ */ l(
|
|
34
44
|
"div",
|
|
35
45
|
{
|
|
36
46
|
ref: n,
|
|
37
|
-
className: "builder-custom-code" + (
|
|
38
|
-
dangerouslySetInnerHTML: { __html:
|
|
47
|
+
className: "builder-custom-code" + (r.replaceNodes ? " replace-nodes" : ""),
|
|
48
|
+
dangerouslySetInnerHTML: { __html: r.code }
|
|
39
49
|
}
|
|
40
50
|
);
|
|
41
51
|
}
|
|
42
52
|
export {
|
|
43
|
-
|
|
53
|
+
w as default
|
|
44
54
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const d=require("react/jsx-runtime"),r=require("react"),m=require("./helpers.cjs");function
|
|
1
|
+
"use client";"use strict";const d=require("react/jsx-runtime"),r=require("react"),m=require("../../helpers/logger.cjs"),f=require("./helpers.cjs");function g(l){const t=r.useRef(null),[c,S]=r.useState(()=>[]),[i,h]=r.useState(()=>[]),[u,a]=r.useState(()=>!1);function p(){if(!t.current||!t.current.getElementsByTagName)return;const o=t.current.getElementsByTagName("script");for(let s=0;s<o.length;s++){const e=o[s];if(e.src&&!c.includes(e.src)){c.push(e.src);const n=document.createElement("script");n.async=!0,n.src=e.src,document.head.appendChild(n)}else if(f.isJsScript(e)&&!i.includes(e.innerText))try{i.push(e.innerText),new Function(e.innerText)()}catch(n){m.logger.warn("[BUILDER.IO] `Embed`: Error running script:",n)}}}return r.useEffect(()=>{t.current&&!u&&(a(!0),p())},[t.current,u]),d.jsx("div",{className:"builder-embed",ref:t,dangerouslySetInnerHTML:{__html:l.content}})}module.exports=g;
|
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
2
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
3
3
|
import { useRef as d, useState as s, useEffect as f } from "react";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { logger as g } from "../../helpers/logger.mjs";
|
|
5
|
+
import { isJsScript as E } from "./helpers.mjs";
|
|
6
|
+
function y(m) {
|
|
7
|
+
const t = d(null), [c, h] = s(() => []), [i, I] = s(() => []), [u, p] = s(() => !1);
|
|
8
|
+
function l() {
|
|
8
9
|
if (!t.current || !t.current.getElementsByTagName)
|
|
9
10
|
return;
|
|
10
11
|
const o = t.current.getElementsByTagName("script");
|
|
11
|
-
for (let
|
|
12
|
-
const e = o[
|
|
12
|
+
for (let n = 0; n < o.length; n++) {
|
|
13
|
+
const e = o[n];
|
|
13
14
|
if (e.src && !c.includes(e.src)) {
|
|
14
15
|
c.push(e.src);
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
} else if (
|
|
16
|
+
const r = document.createElement("script");
|
|
17
|
+
r.async = !0, r.src = e.src, document.head.appendChild(r);
|
|
18
|
+
} else if (E(e) && !i.includes(e.innerText))
|
|
18
19
|
try {
|
|
19
20
|
i.push(e.innerText), new Function(e.innerText)();
|
|
20
|
-
} catch (
|
|
21
|
-
|
|
21
|
+
} catch (r) {
|
|
22
|
+
g.warn("[BUILDER.IO] `Embed`: Error running script:", r);
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
return f(() => {
|
|
26
|
-
t.current && !u && (p(!0),
|
|
27
|
-
}, [t.current, u]), /* @__PURE__ */
|
|
27
|
+
t.current && !u && (p(!0), l());
|
|
28
|
+
}, [t.current, u]), /* @__PURE__ */ a(
|
|
28
29
|
"div",
|
|
29
30
|
{
|
|
30
31
|
className: "builder-embed",
|
|
31
32
|
ref: t,
|
|
32
|
-
dangerouslySetInnerHTML: { __html:
|
|
33
|
+
dangerouslySetInnerHTML: { __html: m.content }
|
|
33
34
|
}
|
|
34
35
|
);
|
|
35
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("../../constants/file-types.cjs"),m={name:"Image",static:!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",defaultStyles:{position:"relative",minHeight:"20px",minWidth:"20px",overflow:"hidden"},canHaveChildren:!0,inputs:[{name:"image",type:"file",bubble:!0,allowedFileTypes:p.IMAGE_FILE_TYPES,required:!0,defaultValue:"https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",onChange:t=>{t.delete("srcset"),t.delete("noWebp");function d(e,o=6e4){return new Promise((u,n)=>{const i=document.createElement("img");let l=!1;i.onload=()=>{l=!0,u(i)},i.addEventListener("error",s=>{console.warn("Image load failed",s.error),n(s.error)}),i.src=e,setTimeout(()=>{l||n(new Error("Image load timed out"))},o)})}function h(e){return Math.round(e*1e3)/1e3}const a=t.get("image"),r=t.get("aspectRatio");if(fetch(a).then(e=>e.blob()).then(e=>{e.type.includes("svg")&&t.set("noWebp",!0)}),a&&(!r||r===.7041))return d(a).then(e=>{const o=t.get("aspectRatio");t.get("image")===a&&(!o||o===.7041)&&e.width&&e.height&&(t.set("aspectRatio",h(e.height/e.width)),t.set("height",e.height),t.set("width",e.width))})}},{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:"height",type:"number",hideFromUI:!0},{name:"width",type:"number",hideFromUI:!0},{name:"sizes",type:"string",hideFromUI:!0},{name:"srcset",type:"string",hideFromUI:!0},{name:"lazy",type:"boolean",defaultValue:!0,hideFromUI:!0},{name:"fitContent",type:"boolean",helperText:"When child blocks are provided, fit to them instead of using the image's aspect ratio",defaultValue:!0},{name:"highPriority",type:"boolean",advanced:!0,helperText:"Mark this image as high priority compared to other images on the page. This prevents lazy loading of the image and tells the browser to load this image before others on the page."},{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}],shouldReceiveBuilderProps:{builderBlock:!0}};exports.componentInfo=m;
|