@builder.io/sdk-react-nextjs 0.18.2 → 0.18.9

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.
Files changed (61) hide show
  1. package/lib/browser/blocks/columns/columns.cjs +3 -2
  2. package/lib/browser/blocks/columns/columns.mjs +7 -6
  3. package/lib/browser/blocks/custom-code/custom-code.cjs +1 -1
  4. package/lib/browser/blocks/custom-code/custom-code.mjs +27 -17
  5. package/lib/browser/blocks/embed/embed.cjs +1 -1
  6. package/lib/browser/blocks/embed/embed.mjs +16 -15
  7. package/lib/browser/blocks/image/component-info.cjs +1 -1
  8. package/lib/browser/blocks/image/component-info.mjs +12 -8
  9. package/lib/browser/blocks/image/image.cjs +4 -4
  10. package/lib/browser/blocks/image/image.mjs +14 -13
  11. package/lib/browser/components/blocks/blocks-wrapper.cjs +2 -2
  12. package/lib/browser/components/blocks/blocks-wrapper.mjs +18 -16
  13. package/lib/browser/components/content-variants/helpers.cjs +9 -9
  14. package/lib/browser/components/content-variants/helpers.mjs +16 -16
  15. package/lib/browser/components/content-variants/inlined-fns.cjs +5 -2
  16. package/lib/browser/components/content-variants/inlined-fns.mjs +5 -2
  17. package/lib/browser/constants/sdk-version.cjs +1 -1
  18. package/lib/browser/constants/sdk-version.mjs +1 -1
  19. package/lib/edge/blocks/columns/columns.cjs +3 -2
  20. package/lib/edge/blocks/columns/columns.mjs +7 -6
  21. package/lib/edge/blocks/custom-code/custom-code.cjs +1 -1
  22. package/lib/edge/blocks/custom-code/custom-code.mjs +27 -17
  23. package/lib/edge/blocks/embed/embed.cjs +1 -1
  24. package/lib/edge/blocks/embed/embed.mjs +16 -15
  25. package/lib/edge/blocks/image/component-info.cjs +1 -1
  26. package/lib/edge/blocks/image/component-info.mjs +12 -8
  27. package/lib/edge/blocks/image/image.cjs +4 -4
  28. package/lib/edge/blocks/image/image.mjs +14 -13
  29. package/lib/edge/components/blocks/blocks-wrapper.cjs +2 -2
  30. package/lib/edge/components/blocks/blocks-wrapper.mjs +18 -16
  31. package/lib/edge/components/content-variants/helpers.cjs +9 -9
  32. package/lib/edge/components/content-variants/helpers.mjs +16 -16
  33. package/lib/edge/components/content-variants/inlined-fns.cjs +5 -2
  34. package/lib/edge/components/content-variants/inlined-fns.mjs +5 -2
  35. package/lib/edge/constants/sdk-version.cjs +1 -1
  36. package/lib/edge/constants/sdk-version.mjs +1 -1
  37. package/lib/node/blocks/columns/columns.cjs +3 -2
  38. package/lib/node/blocks/columns/columns.mjs +7 -6
  39. package/lib/node/blocks/custom-code/custom-code.cjs +1 -1
  40. package/lib/node/blocks/custom-code/custom-code.mjs +27 -17
  41. package/lib/node/blocks/embed/embed.cjs +1 -1
  42. package/lib/node/blocks/embed/embed.mjs +16 -15
  43. package/lib/node/blocks/image/component-info.cjs +1 -1
  44. package/lib/node/blocks/image/component-info.mjs +12 -8
  45. package/lib/node/blocks/image/image.cjs +4 -4
  46. package/lib/node/blocks/image/image.mjs +14 -13
  47. package/lib/node/components/blocks/blocks-wrapper.cjs +2 -2
  48. package/lib/node/components/blocks/blocks-wrapper.mjs +18 -16
  49. package/lib/node/components/content-variants/helpers.cjs +9 -9
  50. package/lib/node/components/content-variants/helpers.mjs +16 -16
  51. package/lib/node/components/content-variants/inlined-fns.cjs +5 -2
  52. package/lib/node/components/content-variants/inlined-fns.mjs +5 -2
  53. package/lib/node/constants/sdk-version.cjs +1 -1
  54. package/lib/node/constants/sdk-version.mjs +1 -1
  55. package/package.json +1 -1
  56. package/types/cjs/blocks/image/image.types.d.ts +1 -0
  57. package/types/cjs/components/content-variants/inlined-fns.d.ts +1 -1
  58. package/types/cjs/constants/sdk-version.d.ts +1 -1
  59. package/types/esm/blocks/image/image.types.d.ts +1 -0
  60. package/types/esm/components/content-variants/inlined-fns.d.ts +1 -1
  61. package/types/esm/constants/sdk-version.d.ts +1 -1
@@ -1,4 +1,4 @@
1
- "use strict";const o=require("react/jsx-runtime"),W=require("../../components/blocks/blocks.cjs"),j=require("../../components/dynamic-renderer/dynamic-renderer.cjs"),q=require("../../components/inlined-styles.cjs"),z=require("../../constants/device-sizes.cjs"),B=require("../../functions/get-class-prop-name.cjs"),p=require("../../functions/get-style.cjs"),A=require("./helpers.cjs");function N(e){var f,g;const a=function(){return typeof e.space=="number"?e.space||0:20},s=function(){return e.columns||[]},u=function(){return e.stackColumnsAt||"tablet"},y=function(t){return t.link?e.builderLinkComponent||"a":"div"},S=function(t){var i;return((i=s()[t])==null?void 0:i.width)||100/s().length},x=function(t){const i=S(t),l=a()*(s().length-1)*(i/100);return`calc(${i}% - ${l}px)`},c=function({stackedStyle:t,desktopStyle:i}){return u()==="tablet"?t:i},m=function({stackedStyle:t,desktopStyle:i}){return u()==="never"?i:t},d=function(){return e.stackColumnsAt==="never"?"row":e.reverseColumnsWhenStacked?"column-reverse":"column"},C=function(){return{"--flex-dir":d(),"--flex-dir-tablet":c({stackedStyle:d(),desktopStyle:"row"})}},v=function(t){const i=t===0?0:a(),l=x(t),r=`${i}px`,k="100%",h=0;return{...{display:"flex",flexDirection:"column",alignItems:"stretch"},width:l,["marginLeft"]:r,"--column-width-mobile":m({stackedStyle:k,desktopStyle:l}),"--column-margin-left-mobile":m({stackedStyle:h,desktopStyle:r}),"--column-width-tablet":c({stackedStyle:k,desktopStyle:l}),"--column-margin-left-tablet":c({stackedStyle:h,desktopStyle:r})}},b=function(t){var l,r;return z.getSizesForBreakpoints(((r=(l=e.builderContext.content)==null?void 0:l.meta)==null?void 0:r.breakpoints)||{})[t].max},w=function(){const t=`.${e.builderBlock.id}-breakpoints > .builder-column`;return`
1
+ "use strict";const o=require("react/jsx-runtime"),W=require("../../components/blocks/blocks.cjs"),j=require("../../components/dynamic-renderer/dynamic-renderer.cjs"),q=require("../../components/inlined-styles.cjs"),z=require("../../constants/device-sizes.cjs"),B=require("../../functions/get-class-prop-name.cjs"),p=require("../../functions/get-style.cjs"),A=require("./helpers.cjs");function N(e){var g,f;const a=function(){return typeof e.space=="number"?e.space||0:20},s=function(){return e.columns||[]},u=function(){return e.stackColumnsAt||"tablet"},y=function(t){return t.link?e.builderLinkComponent||"a":"div"},S=function(t){var i;return((i=s()[t])==null?void 0:i.width)||100/s().length},x=function(t){const i=S(t),l=a()*(s().length-1)*(i/100);return`calc(${i}% - ${l}px)`},c=function({stackedStyle:t,desktopStyle:i}){return u()==="tablet"?t:i},d=function({stackedStyle:t,desktopStyle:i}){return u()==="never"?i:t},m=function(){return e.stackColumnsAt==="never"?"row":e.reverseColumnsWhenStacked?"column-reverse":"column"},C=function(){return{"--flex-dir":m(),"--flex-dir-tablet":c({stackedStyle:m(),desktopStyle:"row"})}},v=function(t){const i=t===0?0:a(),l=x(t),r=`${i}px`,h="100%",k=0;return{...{display:"flex",flexDirection:"column",alignItems:"stretch"},width:l,["marginLeft"]:r,"--column-width-mobile":d({stackedStyle:h,desktopStyle:l}),"--column-margin-left-mobile":d({stackedStyle:k,desktopStyle:r}),"--column-width-tablet":c({stackedStyle:h,desktopStyle:l}),"--column-margin-left-tablet":c({stackedStyle:k,desktopStyle:r})}},b=function(t){var l,r;return z.getSizesForBreakpoints(((r=(l=e.builderContext.content)==null?void 0:l.meta)==null?void 0:r.breakpoints)||{})[t].max},w=function(){const t=`.${e.builderBlock.id}-breakpoints > .builder-column`;return`
2
2
  @media (max-width: ${b("medium")}px) {
3
3
  .${e.builderBlock.id}-breakpoints {
4
4
  flex-direction: var(--flex-dir-tablet);
@@ -22,7 +22,8 @@
22
22
  margin-left: var(--column-margin-left-mobile) !important;
23
23
  }
24
24
  },
25
- `},$=function(t,i){return{...t.link?{href:t.link}:{},[B.getClassPropName()]:"builder-column",style:p.mapStyleObjToStrIfNeeded(v(i))}};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:A.getColumnsClass((f=e.builderBlock)==null?void 0:f.id)+" div-1aff548e",style:C(),children:[o.jsx(q,{id:"builderio-columns",styles:w(),nonce:e.builderContext.nonce}),(g=e.columns)==null?void 0:g.map((n,t)=>o.jsx(j,{TagName:y(n),actionAttributes:{},attributes:$(n,t),children:o.jsx(W,{path:`columns.${t}.blocks`,parent:e.builderBlock.id,context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent,blocks:n.blocks,styleProp:{flexGrow:"1"}})},t))]}),o.jsx("style",{children:`.div-1aff548e {
25
+ `},$=function(t,i){return{...t.link?{href:t.link}:{},[B.getClassPropName()]:"builder-column",style:p.mapStyleObjToStrIfNeeded(v(i))}};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:A.getColumnsClass((g=e.builderBlock)==null?void 0:g.id)+" div-3cd4dbac",style:C(),children:[o.jsx(q,{id:"builderio-columns",styles:w(),nonce:e.builderContext.nonce}),(f=e.columns)==null?void 0:f.map((n,t)=>o.jsx(j,{TagName:y(n),actionAttributes:{},attributes:$(n,t),children:o.jsx(W,{path:`columns.${t}.blocks`,parent:e.builderBlock.id,context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent,blocks:n.blocks,styleProp:{flexGrow:"1"}})},t))]}),o.jsx("style",{children:`.div-3cd4dbac {
26
26
  display: flex;
27
27
  line-height: normal;
28
+ height: 100%;
28
29
  }`})]})}module.exports=N;
@@ -7,7 +7,7 @@ import { getClassPropName as N } from "../../functions/get-class-prop-name.mjs";
7
7
  import { mapStyleObjToStrIfNeeded as T } from "../../functions/get-style.mjs";
8
8
  import { getColumnsClass as D } from "./helpers.mjs";
9
9
  function q(e) {
10
- var b, g;
10
+ var f, g;
11
11
  const a = function() {
12
12
  return typeof e.space == "number" ? e.space || 0 : 20;
13
13
  }, s = function() {
@@ -69,7 +69,7 @@ function q(e) {
69
69
  desktopStyle: o
70
70
  })
71
71
  };
72
- }, f = function(t) {
72
+ }, b = function(t) {
73
73
  var l, o;
74
74
  return L(
75
75
  ((o = (l = e.builderContext.content) == null ? void 0 : l.meta) == null ? void 0 : o.breakpoints) || {}
@@ -77,7 +77,7 @@ function q(e) {
77
77
  }, p = function() {
78
78
  const t = `.${e.builderBlock.id}-breakpoints > .builder-column`;
79
79
  return `
80
- @media (max-width: ${f("medium")}px) {
80
+ @media (max-width: ${b("medium")}px) {
81
81
  .${e.builderBlock.id}-breakpoints {
82
82
  flex-direction: var(--flex-dir-tablet);
83
83
  align-items: stretch;
@@ -89,7 +89,7 @@ function q(e) {
89
89
  }
90
90
  }
91
91
 
92
- @media (max-width: ${f("small")}px) {
92
+ @media (max-width: ${b("small")}px) {
93
93
  .${e.builderBlock.id}-breakpoints {
94
94
  flex-direction: var(--flex-dir);
95
95
  align-items: stretch;
@@ -114,7 +114,7 @@ function q(e) {
114
114
  /* @__PURE__ */ y(
115
115
  "div",
116
116
  {
117
- className: D((b = e.builderBlock) == null ? void 0 : b.id) + " div-1aff548e",
117
+ className: D((f = e.builderBlock) == null ? void 0 : f.id) + " div-3cd4dbac",
118
118
  style: v(),
119
119
  children: [
120
120
  /* @__PURE__ */ r(
@@ -151,9 +151,10 @@ function q(e) {
151
151
  ]
152
152
  }
153
153
  ),
154
- /* @__PURE__ */ r("style", { children: `.div-1aff548e {
154
+ /* @__PURE__ */ r("style", { children: `.div-3cd4dbac {
155
155
  display: flex;
156
156
  line-height: normal;
157
+ height: 100%;
157
158
  }` })
158
159
  ] });
159
160
  }
@@ -1 +1 @@
1
- "use client";"use strict";const p=require("react/jsx-runtime"),n=require("react");function l(r){const s=n.useRef(null),[i,d]=n.useState(()=>[]),[u,m]=n.useState(()=>[]);return n.useEffect(()=>{var a;if(!((a=s.current)!=null&&a.getElementsByTagName)||typeof window=="undefined")return;const o=s.current.getElementsByTagName("script");for(let c=0;c<o.length;c++){const e=o[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){console.warn("`CustomCode`: Error running script:",t)}}}},[]),p.jsx("div",{ref:s,className:"builder-custom-code"+(r.replaceNodes?" replace-nodes":""),dangerouslySetInnerHTML:{__html:r.code}})}module.exports=l;
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 p } from "react/jsx-runtime";
3
- import { useRef as l, useState as a, useEffect as d } from "react";
4
- function h(s) {
5
- const n = l(null), [c, m] = a(() => []), [i, f] = a(() => []);
6
- return d(() => {
7
- var u;
8
- if (!((u = n.current) != null && u.getElementsByTagName) || typeof window == "undefined")
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 o = n.current.getElementsByTagName("script");
11
- for (let r = 0; r < o.length; r++) {
12
- const e = o[r];
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 (c.includes(e.src))
16
+ if (s.includes(e.src))
15
17
  continue;
16
- c.push(e.src);
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
- console.warn("`CustomCode`: Error running script:", t);
31
+ g.warn(
32
+ "[BUILDER.IO] `CustomCode`: Error running script:",
33
+ t
34
+ );
30
35
  }
31
36
  }
32
37
  }
33
- }, []), /* @__PURE__ */ p(
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" + (s.replaceNodes ? " replace-nodes" : ""),
38
- dangerouslySetInnerHTML: { __html: s.code }
47
+ className: "builder-custom-code" + (r.replaceNodes ? " replace-nodes" : ""),
48
+ dangerouslySetInnerHTML: { __html: r.code }
39
49
  }
40
50
  );
41
51
  }
42
52
  export {
43
- h as default
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 f(a){const t=r.useRef(null),[c,S]=r.useState(()=>[]),[i,h]=r.useState(()=>[]),[u,l]=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(m.isJsScript(e)&&!i.includes(e.innerText))try{i.push(e.innerText),new Function(e.innerText)()}catch(n){console.warn("`Embed`: Error running script:",n)}}}return r.useEffect(()=>{t.current&&!u&&(l(!0),p())},[t.current,u]),d.jsx("div",{className:"builder-embed",ref:t,dangerouslySetInnerHTML:{__html:a.content}})}module.exports=f;
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 m } from "react/jsx-runtime";
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 { isJsScript as g } from "./helpers.mjs";
5
- function y(l) {
6
- const t = d(null), [c, h] = s(() => []), [i, E] = s(() => []), [u, p] = s(() => !1);
7
- function a() {
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 r = 0; r < o.length; r++) {
12
- const e = o[r];
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 n = document.createElement("script");
16
- n.async = !0, n.src = e.src, document.head.appendChild(n);
17
- } else if (g(e) && !i.includes(e.innerText))
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 (n) {
21
- console.warn("`Embed`: Error running script:", n);
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), a());
27
- }, [t.current, u]), /* @__PURE__ */ m(
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: l.content }
33
+ dangerouslySetInnerHTML: { __html: m.content }
33
34
  }
34
35
  );
35
36
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../../constants/file-types.cjs"),p={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:m.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 s(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",d=>{console.warn("Image load failed",d.error),n(d.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 s(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:"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=p;
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 m } from "../../constants/file-types.mjs";
2
- const g = {
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: m,
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 h(e, o = 6e4) {
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", (d) => {
29
- console.warn("Image load failed", d.error), n(d.error);
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 h(a).then((e) => {
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
- g as componentInfo
116
+ c as componentInfo
113
117
  };
@@ -1,11 +1,11 @@
1
- "use client";"use strict";const t=require("react/jsx-runtime"),a=require("./image.helpers.cjs");function b(e){var s,r,u,o,d,g;function n(){var h;const i=e.image||e.src;if(!i||!(typeof i=="string"&&(i.match(/builder\.io/)||i.match(/cdn\.shopify\.com/))))return e.srcset;if(!e.noWebp){if(e.srcset&&((h=e.image)!=null&&h.includes("builder.io/api/v1/image"))){if(!e.srcset.includes(e.image.split("?")[0]))return console.debug("Removed given srcset"),a.getSrcSet(i)}else if(e.image&&!e.srcset)return a.getSrcSet(i);return a.getSrcSet(i)}}function l(){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:[l()?t.jsx("source",{type:"image/webp",srcSet:l()}):null,t.jsx("img",{loading:e.highPriority?"eager":"lazy",fetchPriority:e.highPriority?"high":"auto",alt:e.altText,role:e.altText?void 0:"presentation",style:{objectPosition:e.backgroundPosition||"center",objectFit:e.backgroundSize||"cover",...m()},className:"builder-image"+(e.className?" "+e.className:"")+" img-606b99a4",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-606b99a4",style:{paddingTop:e.aspectRatio*100+"%"}}):null,(o=(u=e.builderBlock)==null?void 0:u.children)!=null&&o.length&&e.fitContent?t.jsx(t.Fragment,{children:e.children}):null,!e.fitContent&&((g=(d=e.builderBlock)==null?void 0:d.children)!=null&&g.length)?t.jsx("div",{className:"div-606b99a4-2",children:e.children}):null]}),t.jsx("style",{children:`.img-606b99a4 {
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-606b99a4 {
4
+ }.div-0525a549 {
5
5
  width: 100%;
6
6
  pointer-events: none;
7
7
  font-size: 0;
8
- }.div-606b99a4-2 {
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=b;
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, s, u, g, h, m;
5
+ var d, u, s, g, h, m;
6
6
  function n() {
7
- var b;
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 && ((b = e.image) != null && b.includes("builder.io/api/v1/image"))) {
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 f() {
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
- ...f()
51
+ ...b()
51
52
  },
52
- className: "builder-image" + (e.className ? " " + e.className : "") + " img-606b99a4",
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 && !((s = (d = e.builderBlock) == null ? void 0 : d.children) != null && s.length && e.fitContent) ? /* @__PURE__ */ t(
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-606b99a4",
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 = (u = e.builderBlock) == null ? void 0 : u.children) != null && g.length && e.fitContent ? /* @__PURE__ */ t(c, { children: e.children }) : null,
69
- !e.fitContent && ((m = (h = e.builderBlock) == null ? void 0 : h.children) != null && m.length) ? /* @__PURE__ */ t("div", { className: "div-606b99a4-2", children: e.children }) : null
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-606b99a4 {
72
+ /* @__PURE__ */ t("style", { children: `.img-0525a549 {
72
73
  opacity: 1;
73
74
  transition: opacity 0.2s ease-in-out;
74
- }.div-606b99a4 {
75
+ }.div-0525a549 {
75
76
  width: 100%;
76
77
  pointer-events: none;
77
78
  font-size: 0;
78
- }.div-606b99a4-2 {
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 i=require("react/jsx-runtime"),r=require("react"),l=require("../../functions/is-editing.cjs");function u(e){const c=r.useRef(null);function o(){var t;return["builder-blocks",(t=e.blocks)!=null&&t.length?"":"no-blocks",e.classNameProp].filter(Boolean).join(" ")}function a(){if(!e.path)return;const t="this.",n="component.options.";return e.path.startsWith(t)?e.path.replace(t,""):e.path.startsWith(n)?e.path:`${n}${e.path||""}`}function s(){var t,n;l.isEditing()&&!((t=e.blocks)!=null&&t.length)&&((n=window.parent)==null||n.postMessage({type:"builder.clickEmptyBlocks",data:{parentElementId:e.parent,dataPath:a()}},"*"))}function d(){var t,n;l.isEditing()&&!((t=e.blocks)!=null&&t.length)&&((n=window.parent)==null||n.postMessage({type:"builder.hoverEmptyBlocks",data:{parentElementId:e.parent,dataPath:a()}},"*"))}return r.useEffect(()=>{},[]),i.jsxs(i.Fragment,{children:[i.jsx(e.BlocksWrapper,{ref:c,className:o()+" props-blocks-wrapper-78b0d3be","builder-path":a(),"builder-parent-id":e.parent,style:e.styleProp,onClick:t=>s(),onMouseEnter:t=>d(),onKeyPress:t=>s(),...e.BlocksWrapperProps,children:e.children}),i.jsx("style",{children:`.props-blocks-wrapper-78b0d3be {
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=u;
5
+ }`})]})}module.exports=d;
@@ -1,10 +1,11 @@
1
1
  "use client";
2
- import { jsxs as d, Fragment as h, jsx as r } from "react/jsx-runtime";
3
- import { useRef as f, useEffect as u } from "react";
4
- import { isEditing as i } from "../../functions/is-editing.mjs";
5
- function k(e) {
6
- const o = f(null);
7
- function s() {
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
- i() && !((t = e.blocks) != null && t.length) && ((n = window.parent) == null || n.postMessage(
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 c() {
35
+ function d() {
35
36
  var t, n;
36
- i() && !((t = e.blocks) != null && t.length) && ((n = window.parent) == null || n.postMessage(
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 u(() => {
48
- }, []), /* @__PURE__ */ d(h, { children: [
48
+ return i(() => {
49
+ }, []), i(() => {
50
+ }, [e.blocks]), /* @__PURE__ */ h(f, { children: [
49
51
  /* @__PURE__ */ r(
50
52
  e.BlocksWrapper,
51
53
  {
52
- ref: o,
53
- className: s() + " props-blocks-wrapper-78b0d3be",
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) => c(),
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-78b0d3be {
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
- k as default
74
+ y as default
73
75
  };
@@ -1,9 +1,9 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../constants/target.cjs"),S=require("../../functions/is-browser.cjs"),r=require("./inlined-fns.cjs"),e="builderIoAbTest",s="builderIoRenderContent",a=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})=>!(!(a(t).length>0)||!i||S.isBrowser()),I=i=>i==="react"||i==="reactNative",n=I(o.TARGET),T=()=>`
2
- window.${e} = ${r.UPDATE_COOKIES_AND_STYLES_SCRIPT}
3
- window.${s} = ${r.UPDATE_VARIANT_VISIBILITY_SCRIPT}
4
- `,c=(i,t)=>`
5
- window.${e}(
6
- "${t}",${JSON.stringify(i)}, ${n}
7
- )`,g=({contentId:i,variationId:t})=>`window.${s}(
8
- "${t}", "${i}", ${n}
9
- )`;exports.checkShouldRenderVariants=d;exports.getInitVariantsFnsScriptString=T;exports.getUpdateCookieAndStylesScript=c;exports.getUpdateVariantVisibilityScript=g;exports.getVariants=a;
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 e } from "../../constants/target.mjs";
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 I, UPDATE_VARIANT_VISIBILITY_SCRIPT as n } from "./inlined-fns.mjs";
4
- const t = "builderIoAbTest", s = "builderIoRenderContent", S = (i) => Object.values((i == null ? void 0 : i.variations) || {}).map((r) => ({
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", a = T(e), E = () => `
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
- `, f = (i, r) => `
15
- window.${t}(
16
- "${r}",${JSON.stringify(i)}, ${a}
17
- )`, l = ({
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.${s}(
21
- "${r}", "${i}", ${a}
20
+ }) => `window.${a}(
21
+ "${r}", "${i}", ${e}
22
22
  )`;
23
23
  export {
24
- $ as checkShouldRenderVariants,
25
- E as getInitVariantsFnsScriptString,
26
- f as getUpdateCookieAndStylesScript,
27
- l as getUpdateVariantVisibilityScript,
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
- const styleEl = document.currentScript?.previousElementSibling;
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
- const styleEl = document.currentScript?.previousElementSibling;
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.2";exports.SDK_VERSION=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.18.9";exports.SDK_VERSION=e;
@@ -1,4 +1,4 @@
1
- const o = "0.18.2";
1
+ const o = "0.18.9";
2
2
  export {
3
3
  o as SDK_VERSION
4
4
  };