@builder.io/sdk-solid 1.0.15 → 1.0.17

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.
@@ -871,7 +871,7 @@ function InlinedStyles(props) {
871
871
  effect((_p$) => {
872
872
  const _v$ = props.styles, _v$2 = props.id;
873
873
  _v$ !== _p$._v$ && (_el$.innerHTML = _p$._v$ = _v$);
874
- _v$2 !== _p$._v$2 && setAttribute(_el$, "id", _p$._v$2 = _v$2);
874
+ _v$2 !== _p$._v$2 && setAttribute(_el$, "data-id", _p$._v$2 = _v$2);
875
875
  return _p$;
876
876
  }, {
877
877
  _v$: void 0,
@@ -942,6 +942,7 @@ function BlockStyles(props) {
942
942
  },
943
943
  get children() {
944
944
  return createComponent(inlined_styles_default, {
945
+ id: "builderio-block",
945
946
  get styles() {
946
947
  return css5();
947
948
  }
@@ -1658,6 +1659,7 @@ function Columns(props) {
1658
1659
  when: TARGET !== "reactNative",
1659
1660
  get children() {
1660
1661
  return createComponent(inlined_styles_default, {
1662
+ id: "builderio-columns",
1661
1663
  get styles() {
1662
1664
  return columnsStyles();
1663
1665
  }
@@ -3929,7 +3931,7 @@ var checkShouldRenderVariants = ({
3929
3931
  };
3930
3932
  var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
3931
3933
  var isHydrationTarget = getIsHydrationTarget(TARGET);
3932
- var getScriptString = () => `
3934
+ var getInitVariantsFnsScriptString = () => `
3933
3935
  window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
3934
3936
  window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
3935
3937
  `;
@@ -3948,9 +3950,9 @@ function InlinedScript(props) {
3948
3950
  return (() => {
3949
3951
  const _el$ = _tmpl$16();
3950
3952
  effect((_p$) => {
3951
- const _v$ = props.scriptStr, _v$2 = props.id || "";
3953
+ const _v$ = props.scriptStr, _v$2 = props.id;
3952
3954
  _v$ !== _p$._v$ && (_el$.innerHTML = _p$._v$ = _v$);
3953
- _v$2 !== _p$._v$2 && setAttribute(_el$, "id", _p$._v$2 = _v$2);
3955
+ _v$2 !== _p$._v$2 && setAttribute(_el$, "data-id", _p$._v$2 = _v$2);
3954
3956
  return _p$;
3955
3957
  }, {
3956
3958
  _v$: void 0,
@@ -4447,7 +4449,7 @@ function isFromTrustedHost(trustedHosts, e) {
4447
4449
  }
4448
4450
 
4449
4451
  // src/constants/sdk-version.ts
4450
- var SDK_VERSION = "1.0.15";
4452
+ var SDK_VERSION = "1.0.17";
4451
4453
 
4452
4454
  // src/functions/register.ts
4453
4455
  var registry = {};
@@ -4648,6 +4650,7 @@ var subscribeToEditor = (model, callback, options) => {
4648
4650
  function EnableEditor(props) {
4649
4651
  const [ContentWrapper, setContentWrapper] = createSignal(props.contentWrapper || "div");
4650
4652
  const [httpReqsData, setHttpReqsData] = createSignal({});
4653
+ const [httpReqsPending, setHttpReqsPending] = createSignal({});
4651
4654
  const [clicked, setClicked] = createSignal(false);
4652
4655
  function mergeNewRootState(newData) {
4653
4656
  const combinedState = {
@@ -4746,41 +4749,34 @@ function EnableEditor(props) {
4746
4749
  setClicked(true);
4747
4750
  }
4748
4751
  }
4749
- function evalExpression(expression) {
4750
- return expression.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
4751
- code: group,
4752
- context: props.context || {},
4753
- localState: void 0,
4754
- rootState: props.builderContextSignal.rootState,
4755
- rootSetState: props.builderContextSignal.rootSetState,
4756
- enableCache: true
4757
- })));
4758
- }
4759
- function handleRequest({
4760
- url,
4761
- key
4762
- }) {
4763
- fetch2(url).then((response) => response.json()).then((json) => {
4764
- const newState = {
4765
- ...props.builderContextSignal.rootState,
4766
- [key]: json
4767
- };
4768
- props.builderContextSignal.rootSetState?.(newState);
4769
- httpReqsData()[key] = true;
4770
- }).catch((err) => {
4771
- console.error("error fetching dynamic data", url, err);
4772
- });
4773
- }
4774
4752
  function runHttpRequests() {
4775
4753
  const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
4776
4754
  Object.entries(requests).forEach(([key, url]) => {
4777
- if (url && (!httpReqsData()[key] || isEditing())) {
4778
- const evaluatedUrl = evalExpression(url);
4779
- handleRequest({
4780
- url: evaluatedUrl,
4781
- key
4755
+ if (!url)
4756
+ return;
4757
+ if (httpReqsPending()[key])
4758
+ return;
4759
+ if (httpReqsData()[key] && !isEditing())
4760
+ return;
4761
+ httpReqsPending()[key] = true;
4762
+ const evaluatedUrl = url.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
4763
+ code: group,
4764
+ context: props.context || {},
4765
+ localState: void 0,
4766
+ rootState: props.builderContextSignal.rootState,
4767
+ rootSetState: props.builderContextSignal.rootSetState,
4768
+ enableCache: true
4769
+ })));
4770
+ fetch2(evaluatedUrl).then((response) => response.json()).then((json) => {
4771
+ mergeNewRootState({
4772
+ [key]: json
4782
4773
  });
4783
- }
4774
+ httpReqsData()[key] = true;
4775
+ }).catch((err) => {
4776
+ console.error("error fetching dynamic data", url, err);
4777
+ }).finally(() => {
4778
+ httpReqsPending()[key] = false;
4779
+ });
4784
4780
  });
4785
4781
  }
4786
4782
  function emitStateUpdate() {
@@ -5029,6 +5025,7 @@ ${getFontCss({
5029
5025
  ${getDefaultStyles(props.isNestedRender)}
5030
5026
  `.trim());
5031
5027
  return createComponent(inlined_styles_default, {
5028
+ id: "builderio-content",
5032
5029
  get styles() {
5033
5030
  return injectedStyles();
5034
5031
  }
@@ -5182,6 +5179,7 @@ function ContentComponent(props) {
5182
5179
  },
5183
5180
  get children() {
5184
5181
  return createComponent(inlined_script_default, {
5182
+ id: "builderio-variant-visibility",
5185
5183
  get scriptStr() {
5186
5184
  return scriptStr();
5187
5185
  }
@@ -5259,8 +5257,9 @@ function ContentVariants(props) {
5259
5257
  },
5260
5258
  get children() {
5261
5259
  return createComponent(inlined_script_default, {
5260
+ id: "builderio-init-variants-fns",
5262
5261
  get scriptStr() {
5263
- return getScriptString();
5262
+ return getInitVariantsFnsScriptString();
5264
5263
  }
5265
5264
  });
5266
5265
  }
@@ -5270,13 +5269,12 @@ function ContentVariants(props) {
5270
5269
  },
5271
5270
  get children() {
5272
5271
  return [createComponent(inlined_styles_default, {
5273
- get id() {
5274
- return `variants-styles-${props.content?.id}`;
5275
- },
5272
+ id: "builderio-variants",
5276
5273
  get styles() {
5277
5274
  return hideVariantsStyleString();
5278
5275
  }
5279
5276
  }), createComponent(inlined_script_default, {
5277
+ id: "builderio-variants-visibility",
5280
5278
  get scriptStr() {
5281
5279
  return updateCookieAndStylesScriptStr();
5282
5280
  }
@@ -857,7 +857,7 @@ var getSizesForBreakpoints = ({
857
857
 
858
858
  // src/components/inlined-styles.tsx
859
859
  function InlinedStyles(props) {
860
- return <style innerHTML={props.styles} id={props.id} />;
860
+ return <style innerHTML={props.styles} data-id={props.id} />;
861
861
  }
862
862
  var Inlined_styles_default = InlinedStyles;
863
863
 
@@ -923,7 +923,7 @@ function BlockStyles(props) {
923
923
  }) : "";
924
924
  return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
925
925
  });
926
- return <Show2 when={TARGET !== "reactNative" && css5() && canShowBlock()}><Inlined_styles_default styles={css5()} /></Show2>;
926
+ return <Show2 when={TARGET !== "reactNative" && css5() && canShowBlock()}><Inlined_styles_default id="builderio-block" styles={css5()} /></Show2>;
927
927
  }
928
928
  var Block_styles_default = BlockStyles;
929
929
 
@@ -1458,7 +1458,10 @@ function Columns(props) {
1458
1458
  style={columnsCssVars()}
1459
1459
  {...{}}
1460
1460
  >
1461
- <Show6 when={TARGET !== "reactNative"}><Inlined_styles_default styles={columnsStyles()} /></Show6>
1461
+ <Show6 when={TARGET !== "reactNative"}><Inlined_styles_default
1462
+ id="builderio-columns"
1463
+ styles={columnsStyles()}
1464
+ /></Show6>
1462
1465
  <For4 each={props.columns}>{(column, _index) => {
1463
1466
  const index = _index();
1464
1467
  return <Dynamic_renderer_default
@@ -3512,7 +3515,7 @@ var checkShouldRenderVariants = ({
3512
3515
  };
3513
3516
  var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
3514
3517
  var isHydrationTarget = getIsHydrationTarget(TARGET);
3515
- var getScriptString = () => `
3518
+ var getInitVariantsFnsScriptString = () => `
3516
3519
  window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
3517
3520
  window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
3518
3521
  `;
@@ -3529,7 +3532,7 @@ var getUpdateVariantVisibilityScript = ({
3529
3532
 
3530
3533
  // src/components/inlined-script.tsx
3531
3534
  function InlinedScript(props) {
3532
- return <script innerHTML={props.scriptStr} id={props.id || ""} />;
3535
+ return <script innerHTML={props.scriptStr} data-id={props.id} />;
3533
3536
  }
3534
3537
  var Inlined_script_default = InlinedScript;
3535
3538
 
@@ -4030,7 +4033,7 @@ function isFromTrustedHost(trustedHosts, e) {
4030
4033
  }
4031
4034
 
4032
4035
  // src/constants/sdk-version.ts
4033
- var SDK_VERSION = "1.0.15";
4036
+ var SDK_VERSION = "1.0.17";
4034
4037
 
4035
4038
  // src/functions/register.ts
4036
4039
  var registry = {};
@@ -4233,6 +4236,7 @@ function EnableEditor(props) {
4233
4236
  props.contentWrapper || "div"
4234
4237
  );
4235
4238
  const [httpReqsData, setHttpReqsData] = createSignal12({});
4239
+ const [httpReqsPending, setHttpReqsPending] = createSignal12({});
4236
4240
  const [clicked, setClicked] = createSignal12(false);
4237
4241
  function mergeNewRootState(newData) {
4238
4242
  const combinedState = {
@@ -4328,43 +4332,39 @@ function EnableEditor(props) {
4328
4332
  setClicked(true);
4329
4333
  }
4330
4334
  }
4331
- function evalExpression(expression) {
4332
- return expression.replace(
4333
- /{{([^}]+)}}/g,
4334
- (_match, group) => String(
4335
- evaluate({
4336
- code: group,
4337
- context: props.context || {},
4338
- localState: void 0,
4339
- rootState: props.builderContextSignal.rootState,
4340
- rootSetState: props.builderContextSignal.rootSetState,
4341
- enableCache: true
4342
- })
4343
- )
4344
- );
4345
- }
4346
- function handleRequest({ url, key }) {
4347
- fetch2(url).then((response) => response.json()).then((json) => {
4348
- const newState = {
4349
- ...props.builderContextSignal.rootState,
4350
- [key]: json
4351
- };
4352
- props.builderContextSignal.rootSetState?.(newState);
4353
- httpReqsData()[key] = true;
4354
- }).catch((err) => {
4355
- console.error("error fetching dynamic data", url, err);
4356
- });
4357
- }
4358
4335
  function runHttpRequests() {
4359
4336
  const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
4360
4337
  Object.entries(requests).forEach(([key, url]) => {
4361
- if (url && (!httpReqsData()[key] || isEditing())) {
4362
- const evaluatedUrl = evalExpression(url);
4363
- handleRequest({
4364
- url: evaluatedUrl,
4365
- key
4338
+ if (!url)
4339
+ return;
4340
+ if (httpReqsPending()[key])
4341
+ return;
4342
+ if (httpReqsData()[key] && !isEditing())
4343
+ return;
4344
+ httpReqsPending()[key] = true;
4345
+ const evaluatedUrl = url.replace(
4346
+ /{{([^}]+)}}/g,
4347
+ (_match, group) => String(
4348
+ evaluate({
4349
+ code: group,
4350
+ context: props.context || {},
4351
+ localState: void 0,
4352
+ rootState: props.builderContextSignal.rootState,
4353
+ rootSetState: props.builderContextSignal.rootSetState,
4354
+ enableCache: true
4355
+ })
4356
+ )
4357
+ );
4358
+ fetch2(evaluatedUrl).then((response) => response.json()).then((json) => {
4359
+ mergeNewRootState({
4360
+ [key]: json
4366
4361
  });
4367
- }
4362
+ httpReqsData()[key] = true;
4363
+ }).catch((err) => {
4364
+ console.error("error fetching dynamic data", url, err);
4365
+ }).finally(() => {
4366
+ httpReqsPending()[key] = false;
4367
+ });
4368
4368
  });
4369
4369
  }
4370
4370
  function emitStateUpdate() {
@@ -4624,7 +4624,10 @@ ${getFontCss({
4624
4624
  ${getDefaultStyles(props.isNestedRender)}
4625
4625
  `.trim()
4626
4626
  );
4627
- return <Inlined_styles_default styles={injectedStyles()} />;
4627
+ return <Inlined_styles_default
4628
+ id="builderio-content"
4629
+ styles={injectedStyles()}
4630
+ />;
4628
4631
  }
4629
4632
  var Styles_default = ContentStyles;
4630
4633
 
@@ -4747,7 +4750,10 @@ function ContentComponent(props) {
4747
4750
  setBuilderContextSignal
4748
4751
  }}
4749
4752
  >
4750
- <Show11 when={props.isSsrAbTest}><Inlined_script_default scriptStr={scriptStr()} /></Show11>
4753
+ <Show11 when={props.isSsrAbTest}><Inlined_script_default
4754
+ id="builderio-variant-visibility"
4755
+ scriptStr={scriptStr()}
4756
+ /></Show11>
4751
4757
  <Show11 when={TARGET !== "reactNative"}><Styles_default
4752
4758
  isNestedRender={props.isNestedRender}
4753
4759
  contentId={builderContextSignal().content?.id}
@@ -4797,13 +4803,17 @@ function ContentVariants(props) {
4797
4803
  setShouldRenderVariants(false);
4798
4804
  });
4799
4805
  return <>
4800
- <Show12 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default scriptStr={getScriptString()} /></Show12>
4806
+ <Show12 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
4807
+ id="builderio-init-variants-fns"
4808
+ scriptStr={getInitVariantsFnsScriptString()}
4809
+ /></Show12>
4801
4810
  <Show12 when={shouldRenderVariants()}>
4802
4811
  <Inlined_styles_default
4803
- id={`variants-styles-${props.content?.id}`}
4812
+ id="builderio-variants"
4804
4813
  styles={hideVariantsStyleString()}
4805
4814
  />
4806
4815
  <Inlined_script_default
4816
+ id="builderio-variants-visibility"
4807
4817
  scriptStr={updateCookieAndStylesScriptStr()}
4808
4818
  />
4809
4819
  <For7 each={getVariants(props.content)}>{(variant, _index) => {
@@ -865,7 +865,7 @@ function InlinedStyles(props) {
865
865
  effect((_p$) => {
866
866
  const _v$ = props.styles, _v$2 = props.id;
867
867
  _v$ !== _p$._v$ && (_el$.innerHTML = _p$._v$ = _v$);
868
- _v$2 !== _p$._v$2 && setAttribute(_el$, "id", _p$._v$2 = _v$2);
868
+ _v$2 !== _p$._v$2 && setAttribute(_el$, "data-id", _p$._v$2 = _v$2);
869
869
  return _p$;
870
870
  }, {
871
871
  _v$: void 0,
@@ -936,6 +936,7 @@ function BlockStyles(props) {
936
936
  },
937
937
  get children() {
938
938
  return createComponent(inlined_styles_default, {
939
+ id: "builderio-block",
939
940
  get styles() {
940
941
  return css5();
941
942
  }
@@ -1652,6 +1653,7 @@ function Columns(props) {
1652
1653
  when: TARGET !== "reactNative",
1653
1654
  get children() {
1654
1655
  return createComponent(inlined_styles_default, {
1656
+ id: "builderio-columns",
1655
1657
  get styles() {
1656
1658
  return columnsStyles();
1657
1659
  }
@@ -3919,7 +3921,7 @@ var checkShouldRenderVariants = ({
3919
3921
  };
3920
3922
  var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
3921
3923
  var isHydrationTarget = getIsHydrationTarget(TARGET);
3922
- var getScriptString = () => `
3924
+ var getInitVariantsFnsScriptString = () => `
3923
3925
  window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
3924
3926
  window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
3925
3927
  `;
@@ -3938,9 +3940,9 @@ function InlinedScript(props) {
3938
3940
  return (() => {
3939
3941
  const _el$ = _tmpl$16();
3940
3942
  effect((_p$) => {
3941
- const _v$ = props.scriptStr, _v$2 = props.id || "";
3943
+ const _v$ = props.scriptStr, _v$2 = props.id;
3942
3944
  _v$ !== _p$._v$ && (_el$.innerHTML = _p$._v$ = _v$);
3943
- _v$2 !== _p$._v$2 && setAttribute(_el$, "id", _p$._v$2 = _v$2);
3945
+ _v$2 !== _p$._v$2 && setAttribute(_el$, "data-id", _p$._v$2 = _v$2);
3944
3946
  return _p$;
3945
3947
  }, {
3946
3948
  _v$: void 0,
@@ -4432,7 +4434,7 @@ function isFromTrustedHost(trustedHosts, e) {
4432
4434
  }
4433
4435
 
4434
4436
  // src/constants/sdk-version.ts
4435
- var SDK_VERSION = "1.0.15";
4437
+ var SDK_VERSION = "1.0.17";
4436
4438
 
4437
4439
  // src/functions/register.ts
4438
4440
  var registry = {};
@@ -4632,6 +4634,7 @@ var subscribeToEditor = (model, callback, options) => {
4632
4634
  function EnableEditor(props) {
4633
4635
  const [ContentWrapper, setContentWrapper] = createSignal(props.contentWrapper || "div");
4634
4636
  const [httpReqsData, setHttpReqsData] = createSignal({});
4637
+ const [httpReqsPending, setHttpReqsPending] = createSignal({});
4635
4638
  const [clicked, setClicked] = createSignal(false);
4636
4639
  function mergeNewRootState(newData) {
4637
4640
  const combinedState = {
@@ -4730,40 +4733,33 @@ function EnableEditor(props) {
4730
4733
  setClicked(true);
4731
4734
  }
4732
4735
  }
4733
- function evalExpression(expression) {
4734
- return expression.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
4735
- code: group,
4736
- context: props.context || {},
4737
- localState: void 0,
4738
- rootState: props.builderContextSignal.rootState,
4739
- rootSetState: props.builderContextSignal.rootSetState,
4740
- enableCache: true
4741
- })));
4742
- }
4743
- function handleRequest({
4744
- url,
4745
- key
4746
- }) {
4747
- fetch2(url).then((response) => response.json()).then((json) => {
4748
- const newState = {
4749
- ...props.builderContextSignal.rootState,
4750
- [key]: json
4751
- };
4752
- props.builderContextSignal.rootSetState?.(newState);
4753
- httpReqsData()[key] = true;
4754
- }).catch((err) => {
4755
- });
4756
- }
4757
4736
  function runHttpRequests() {
4758
4737
  const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
4759
4738
  Object.entries(requests).forEach(([key, url]) => {
4760
- if (url && (!httpReqsData()[key] || isEditing())) {
4761
- const evaluatedUrl = evalExpression(url);
4762
- handleRequest({
4763
- url: evaluatedUrl,
4764
- key
4739
+ if (!url)
4740
+ return;
4741
+ if (httpReqsPending()[key])
4742
+ return;
4743
+ if (httpReqsData()[key] && !isEditing())
4744
+ return;
4745
+ httpReqsPending()[key] = true;
4746
+ const evaluatedUrl = url.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
4747
+ code: group,
4748
+ context: props.context || {},
4749
+ localState: void 0,
4750
+ rootState: props.builderContextSignal.rootState,
4751
+ rootSetState: props.builderContextSignal.rootSetState,
4752
+ enableCache: true
4753
+ })));
4754
+ fetch2(evaluatedUrl).then((response) => response.json()).then((json) => {
4755
+ mergeNewRootState({
4756
+ [key]: json
4765
4757
  });
4766
- }
4758
+ httpReqsData()[key] = true;
4759
+ }).catch((err) => {
4760
+ }).finally(() => {
4761
+ httpReqsPending()[key] = false;
4762
+ });
4767
4763
  });
4768
4764
  }
4769
4765
  function emitStateUpdate() {
@@ -5012,6 +5008,7 @@ ${getFontCss({
5012
5008
  ${getDefaultStyles(props.isNestedRender)}
5013
5009
  `.trim());
5014
5010
  return createComponent(inlined_styles_default, {
5011
+ id: "builderio-content",
5015
5012
  get styles() {
5016
5013
  return injectedStyles();
5017
5014
  }
@@ -5165,6 +5162,7 @@ function ContentComponent(props) {
5165
5162
  },
5166
5163
  get children() {
5167
5164
  return createComponent(inlined_script_default, {
5165
+ id: "builderio-variant-visibility",
5168
5166
  get scriptStr() {
5169
5167
  return scriptStr();
5170
5168
  }
@@ -5242,8 +5240,9 @@ function ContentVariants(props) {
5242
5240
  },
5243
5241
  get children() {
5244
5242
  return createComponent(inlined_script_default, {
5243
+ id: "builderio-init-variants-fns",
5245
5244
  get scriptStr() {
5246
- return getScriptString();
5245
+ return getInitVariantsFnsScriptString();
5247
5246
  }
5248
5247
  });
5249
5248
  }
@@ -5253,13 +5252,12 @@ function ContentVariants(props) {
5253
5252
  },
5254
5253
  get children() {
5255
5254
  return [createComponent(inlined_styles_default, {
5256
- get id() {
5257
- return `variants-styles-${props.content?.id}`;
5258
- },
5255
+ id: "builderio-variants",
5259
5256
  get styles() {
5260
5257
  return hideVariantsStyleString();
5261
5258
  }
5262
5259
  }), createComponent(inlined_script_default, {
5260
+ id: "builderio-variants-visibility",
5263
5261
  get scriptStr() {
5264
5262
  return updateCookieAndStylesScriptStr();
5265
5263
  }
@@ -851,7 +851,7 @@ var getSizesForBreakpoints = ({
851
851
 
852
852
  // src/components/inlined-styles.tsx
853
853
  function InlinedStyles(props) {
854
- return <style innerHTML={props.styles} id={props.id} />;
854
+ return <style innerHTML={props.styles} data-id={props.id} />;
855
855
  }
856
856
  var Inlined_styles_default = InlinedStyles;
857
857
 
@@ -917,7 +917,7 @@ function BlockStyles(props) {
917
917
  }) : "";
918
918
  return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
919
919
  });
920
- return <Show2 when={TARGET !== "reactNative" && css5() && canShowBlock()}><Inlined_styles_default styles={css5()} /></Show2>;
920
+ return <Show2 when={TARGET !== "reactNative" && css5() && canShowBlock()}><Inlined_styles_default id="builderio-block" styles={css5()} /></Show2>;
921
921
  }
922
922
  var Block_styles_default = BlockStyles;
923
923
 
@@ -1452,7 +1452,10 @@ function Columns(props) {
1452
1452
  style={columnsCssVars()}
1453
1453
  {...{}}
1454
1454
  >
1455
- <Show6 when={TARGET !== "reactNative"}><Inlined_styles_default styles={columnsStyles()} /></Show6>
1455
+ <Show6 when={TARGET !== "reactNative"}><Inlined_styles_default
1456
+ id="builderio-columns"
1457
+ styles={columnsStyles()}
1458
+ /></Show6>
1456
1459
  <For4 each={props.columns}>{(column, _index) => {
1457
1460
  const index = _index();
1458
1461
  return <Dynamic_renderer_default
@@ -3502,7 +3505,7 @@ var checkShouldRenderVariants = ({
3502
3505
  };
3503
3506
  var getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
3504
3507
  var isHydrationTarget = getIsHydrationTarget(TARGET);
3505
- var getScriptString = () => `
3508
+ var getInitVariantsFnsScriptString = () => `
3506
3509
  window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
3507
3510
  window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
3508
3511
  `;
@@ -3519,7 +3522,7 @@ var getUpdateVariantVisibilityScript = ({
3519
3522
 
3520
3523
  // src/components/inlined-script.tsx
3521
3524
  function InlinedScript(props) {
3522
- return <script innerHTML={props.scriptStr} id={props.id || ""} />;
3525
+ return <script innerHTML={props.scriptStr} data-id={props.id} />;
3523
3526
  }
3524
3527
  var Inlined_script_default = InlinedScript;
3525
3528
 
@@ -4015,7 +4018,7 @@ function isFromTrustedHost(trustedHosts, e) {
4015
4018
  }
4016
4019
 
4017
4020
  // src/constants/sdk-version.ts
4018
- var SDK_VERSION = "1.0.15";
4021
+ var SDK_VERSION = "1.0.17";
4019
4022
 
4020
4023
  // src/functions/register.ts
4021
4024
  var registry = {};
@@ -4217,6 +4220,7 @@ function EnableEditor(props) {
4217
4220
  props.contentWrapper || "div"
4218
4221
  );
4219
4222
  const [httpReqsData, setHttpReqsData] = createSignal12({});
4223
+ const [httpReqsPending, setHttpReqsPending] = createSignal12({});
4220
4224
  const [clicked, setClicked] = createSignal12(false);
4221
4225
  function mergeNewRootState(newData) {
4222
4226
  const combinedState = {
@@ -4312,42 +4316,38 @@ function EnableEditor(props) {
4312
4316
  setClicked(true);
4313
4317
  }
4314
4318
  }
4315
- function evalExpression(expression) {
4316
- return expression.replace(
4317
- /{{([^}]+)}}/g,
4318
- (_match, group) => String(
4319
- evaluate({
4320
- code: group,
4321
- context: props.context || {},
4322
- localState: void 0,
4323
- rootState: props.builderContextSignal.rootState,
4324
- rootSetState: props.builderContextSignal.rootSetState,
4325
- enableCache: true
4326
- })
4327
- )
4328
- );
4329
- }
4330
- function handleRequest({ url, key }) {
4331
- fetch2(url).then((response) => response.json()).then((json) => {
4332
- const newState = {
4333
- ...props.builderContextSignal.rootState,
4334
- [key]: json
4335
- };
4336
- props.builderContextSignal.rootSetState?.(newState);
4337
- httpReqsData()[key] = true;
4338
- }).catch((err) => {
4339
- });
4340
- }
4341
4319
  function runHttpRequests() {
4342
4320
  const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
4343
4321
  Object.entries(requests).forEach(([key, url]) => {
4344
- if (url && (!httpReqsData()[key] || isEditing())) {
4345
- const evaluatedUrl = evalExpression(url);
4346
- handleRequest({
4347
- url: evaluatedUrl,
4348
- key
4322
+ if (!url)
4323
+ return;
4324
+ if (httpReqsPending()[key])
4325
+ return;
4326
+ if (httpReqsData()[key] && !isEditing())
4327
+ return;
4328
+ httpReqsPending()[key] = true;
4329
+ const evaluatedUrl = url.replace(
4330
+ /{{([^}]+)}}/g,
4331
+ (_match, group) => String(
4332
+ evaluate({
4333
+ code: group,
4334
+ context: props.context || {},
4335
+ localState: void 0,
4336
+ rootState: props.builderContextSignal.rootState,
4337
+ rootSetState: props.builderContextSignal.rootSetState,
4338
+ enableCache: true
4339
+ })
4340
+ )
4341
+ );
4342
+ fetch2(evaluatedUrl).then((response) => response.json()).then((json) => {
4343
+ mergeNewRootState({
4344
+ [key]: json
4349
4345
  });
4350
- }
4346
+ httpReqsData()[key] = true;
4347
+ }).catch((err) => {
4348
+ }).finally(() => {
4349
+ httpReqsPending()[key] = false;
4350
+ });
4351
4351
  });
4352
4352
  }
4353
4353
  function emitStateUpdate() {
@@ -4607,7 +4607,10 @@ ${getFontCss({
4607
4607
  ${getDefaultStyles(props.isNestedRender)}
4608
4608
  `.trim()
4609
4609
  );
4610
- return <Inlined_styles_default styles={injectedStyles()} />;
4610
+ return <Inlined_styles_default
4611
+ id="builderio-content"
4612
+ styles={injectedStyles()}
4613
+ />;
4611
4614
  }
4612
4615
  var Styles_default = ContentStyles;
4613
4616
 
@@ -4730,7 +4733,10 @@ function ContentComponent(props) {
4730
4733
  setBuilderContextSignal
4731
4734
  }}
4732
4735
  >
4733
- <Show11 when={props.isSsrAbTest}><Inlined_script_default scriptStr={scriptStr()} /></Show11>
4736
+ <Show11 when={props.isSsrAbTest}><Inlined_script_default
4737
+ id="builderio-variant-visibility"
4738
+ scriptStr={scriptStr()}
4739
+ /></Show11>
4734
4740
  <Show11 when={TARGET !== "reactNative"}><Styles_default
4735
4741
  isNestedRender={props.isNestedRender}
4736
4742
  contentId={builderContextSignal().content?.id}
@@ -4780,13 +4786,17 @@ function ContentVariants(props) {
4780
4786
  setShouldRenderVariants(false);
4781
4787
  });
4782
4788
  return <>
4783
- <Show12 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default scriptStr={getScriptString()} /></Show12>
4789
+ <Show12 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
4790
+ id="builderio-init-variants-fns"
4791
+ scriptStr={getInitVariantsFnsScriptString()}
4792
+ /></Show12>
4784
4793
  <Show12 when={shouldRenderVariants()}>
4785
4794
  <Inlined_styles_default
4786
- id={`variants-styles-${props.content?.id}`}
4795
+ id="builderio-variants"
4787
4796
  styles={hideVariantsStyleString()}
4788
4797
  />
4789
4798
  <Inlined_script_default
4799
+ id="builderio-variants-visibility"
4790
4800
  scriptStr={updateCookieAndStylesScriptStr()}
4791
4801
  />
4792
4802
  <For7 each={getVariants(props.content)}>{(variant, _index) => {