@builder.io/sdk-qwik 0.14.11 → 0.14.13

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.
@@ -4399,7 +4399,7 @@ function isFromTrustedHost(trustedHosts, e) {
4399
4399
  const url = new URL(e.origin), hostname = url.hostname;
4400
4400
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
4401
4401
  }
4402
- const SDK_VERSION = "0.14.11";
4402
+ const SDK_VERSION = "0.14.13";
4403
4403
  const registry = {};
4404
4404
  function register(type, info) {
4405
4405
  let typeList = registry[type];
@@ -4670,40 +4670,35 @@ const onClick = function onClick22(props, state, elementRef, event) {
4670
4670
  if (!state.clicked)
4671
4671
  state.clicked = true;
4672
4672
  };
4673
- const evalExpression = function evalExpression2(props, state, elementRef, expression) {
4674
- return expression.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
4675
- code: group,
4676
- context: props.context || {},
4677
- localState: void 0,
4678
- rootState: props.builderContextSignal.rootState,
4679
- rootSetState: props.builderContextSignal.rootSetState,
4680
- enableCache: true
4681
- })));
4682
- };
4683
- const handleRequest = function handleRequest2(props, state, elementRef, { url, key }) {
4684
- fetch$1(url).then((response) => response.json()).then((json) => {
4685
- var _a, _b;
4686
- const newState = {
4687
- ...props.builderContextSignal.rootState,
4688
- [key]: json
4689
- };
4690
- (_b = (_a = props.builderContextSignal).rootSetState) == null ? void 0 : _b.call(_a, newState);
4691
- state.httpReqsData[key] = true;
4692
- }).catch((err) => {
4693
- console.error("error fetching dynamic data", url, err);
4694
- });
4695
- };
4696
4673
  const runHttpRequests = function runHttpRequests2(props, state, elementRef) {
4697
4674
  var _a, _b;
4698
4675
  const requests = ((_b = (_a = props.builderContextSignal.content) == null ? void 0 : _a.data) == null ? void 0 : _b.httpRequests) ?? {};
4699
4676
  Object.entries(requests).forEach(([key, url]) => {
4700
- if (url && (!state.httpReqsData[key] || isEditing())) {
4701
- const evaluatedUrl = evalExpression(props, state, elementRef, url);
4702
- handleRequest(props, state, elementRef, {
4703
- url: evaluatedUrl,
4704
- key
4677
+ if (!url)
4678
+ return;
4679
+ if (state.httpReqsPending[key])
4680
+ return;
4681
+ if (state.httpReqsData[key] && !isEditing())
4682
+ return;
4683
+ state.httpReqsPending[key] = true;
4684
+ const evaluatedUrl = url.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
4685
+ code: group,
4686
+ context: props.context || {},
4687
+ localState: void 0,
4688
+ rootState: props.builderContextSignal.rootState,
4689
+ rootSetState: props.builderContextSignal.rootSetState,
4690
+ enableCache: true
4691
+ })));
4692
+ fetch$1(evaluatedUrl).then((response) => response.json()).then((json) => {
4693
+ mergeNewRootState(props, state, elementRef, {
4694
+ [key]: json
4705
4695
  });
4706
- }
4696
+ state.httpReqsData[key] = true;
4697
+ }).catch((err) => {
4698
+ console.error("error fetching dynamic data", url, err);
4699
+ }).finally(() => {
4700
+ state.httpReqsPending[key] = false;
4701
+ });
4707
4702
  });
4708
4703
  };
4709
4704
  const emitStateUpdate = function emitStateUpdate2(props, state, elementRef) {
@@ -4723,7 +4718,8 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
4723
4718
  const state = qwik.useStore({
4724
4719
  ContentWrapper: props.contentWrapper || "div",
4725
4720
  clicked: false,
4726
- httpReqsData: {}
4721
+ httpReqsData: {},
4722
+ httpReqsPending: {}
4727
4723
  }, {
4728
4724
  deep: true
4729
4725
  });
@@ -5784,6 +5780,7 @@ const fetchBuilderProps = async (_args) => {
5784
5780
  };
5785
5781
  };
5786
5782
  exports.Blocks = Blocks;
5783
+ exports.BuilderContext = builderContext;
5787
5784
  exports.Button = Button;
5788
5785
  exports.Columns = Columns;
5789
5786
  exports.Content = ContentVariants;
@@ -4397,7 +4397,7 @@ function isFromTrustedHost(trustedHosts, e) {
4397
4397
  const url = new URL(e.origin), hostname = url.hostname;
4398
4398
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
4399
4399
  }
4400
- const SDK_VERSION = "0.14.11";
4400
+ const SDK_VERSION = "0.14.13";
4401
4401
  const registry = {};
4402
4402
  function register(type, info) {
4403
4403
  let typeList = registry[type];
@@ -4668,40 +4668,35 @@ const onClick = function onClick22(props, state, elementRef, event) {
4668
4668
  if (!state.clicked)
4669
4669
  state.clicked = true;
4670
4670
  };
4671
- const evalExpression = function evalExpression2(props, state, elementRef, expression) {
4672
- return expression.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
4673
- code: group,
4674
- context: props.context || {},
4675
- localState: void 0,
4676
- rootState: props.builderContextSignal.rootState,
4677
- rootSetState: props.builderContextSignal.rootSetState,
4678
- enableCache: true
4679
- })));
4680
- };
4681
- const handleRequest = function handleRequest2(props, state, elementRef, { url, key }) {
4682
- fetch$1(url).then((response) => response.json()).then((json) => {
4683
- var _a, _b;
4684
- const newState = {
4685
- ...props.builderContextSignal.rootState,
4686
- [key]: json
4687
- };
4688
- (_b = (_a = props.builderContextSignal).rootSetState) == null ? void 0 : _b.call(_a, newState);
4689
- state.httpReqsData[key] = true;
4690
- }).catch((err) => {
4691
- console.error("error fetching dynamic data", url, err);
4692
- });
4693
- };
4694
4671
  const runHttpRequests = function runHttpRequests2(props, state, elementRef) {
4695
4672
  var _a, _b;
4696
4673
  const requests = ((_b = (_a = props.builderContextSignal.content) == null ? void 0 : _a.data) == null ? void 0 : _b.httpRequests) ?? {};
4697
4674
  Object.entries(requests).forEach(([key, url]) => {
4698
- if (url && (!state.httpReqsData[key] || isEditing())) {
4699
- const evaluatedUrl = evalExpression(props, state, elementRef, url);
4700
- handleRequest(props, state, elementRef, {
4701
- url: evaluatedUrl,
4702
- key
4675
+ if (!url)
4676
+ return;
4677
+ if (state.httpReqsPending[key])
4678
+ return;
4679
+ if (state.httpReqsData[key] && !isEditing())
4680
+ return;
4681
+ state.httpReqsPending[key] = true;
4682
+ const evaluatedUrl = url.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
4683
+ code: group,
4684
+ context: props.context || {},
4685
+ localState: void 0,
4686
+ rootState: props.builderContextSignal.rootState,
4687
+ rootSetState: props.builderContextSignal.rootSetState,
4688
+ enableCache: true
4689
+ })));
4690
+ fetch$1(evaluatedUrl).then((response) => response.json()).then((json) => {
4691
+ mergeNewRootState(props, state, elementRef, {
4692
+ [key]: json
4703
4693
  });
4704
- }
4694
+ state.httpReqsData[key] = true;
4695
+ }).catch((err) => {
4696
+ console.error("error fetching dynamic data", url, err);
4697
+ }).finally(() => {
4698
+ state.httpReqsPending[key] = false;
4699
+ });
4705
4700
  });
4706
4701
  };
4707
4702
  const emitStateUpdate = function emitStateUpdate2(props, state, elementRef) {
@@ -4721,7 +4716,8 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
4721
4716
  const state = useStore({
4722
4717
  ContentWrapper: props.contentWrapper || "div",
4723
4718
  clicked: false,
4724
- httpReqsData: {}
4719
+ httpReqsData: {},
4720
+ httpReqsPending: {}
4725
4721
  }, {
4726
4722
  deep: true
4727
4723
  });
@@ -5783,6 +5779,7 @@ const fetchBuilderProps = async (_args) => {
5783
5779
  };
5784
5780
  export {
5785
5781
  Blocks,
5782
+ builderContext as BuilderContext,
5786
5783
  Button,
5787
5784
  Columns,
5788
5785
  ContentVariants as Content,
@@ -7630,7 +7630,7 @@ function isFromTrustedHost(trustedHosts, e) {
7630
7630
  const url = new URL(e.origin), hostname = url.hostname;
7631
7631
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
7632
7632
  }
7633
- const SDK_VERSION = "0.14.11";
7633
+ const SDK_VERSION = "0.14.13";
7634
7634
  const registry = {};
7635
7635
  function register(type, info) {
7636
7636
  let typeList = registry[type];
@@ -7901,40 +7901,35 @@ const onClick = function onClick22(props, state, elementRef, event) {
7901
7901
  if (!state.clicked)
7902
7902
  state.clicked = true;
7903
7903
  };
7904
- const evalExpression = function evalExpression2(props, state, elementRef, expression) {
7905
- return expression.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
7906
- code: group,
7907
- context: props.context || {},
7908
- localState: void 0,
7909
- rootState: props.builderContextSignal.rootState,
7910
- rootSetState: props.builderContextSignal.rootSetState,
7911
- enableCache: true
7912
- })));
7913
- };
7914
- const handleRequest = function handleRequest2(props, state, elementRef, { url, key }) {
7915
- fetch$1(url).then((response) => response.json()).then((json) => {
7916
- var _a, _b;
7917
- const newState = {
7918
- ...props.builderContextSignal.rootState,
7919
- [key]: json
7920
- };
7921
- (_b = (_a = props.builderContextSignal).rootSetState) == null ? void 0 : _b.call(_a, newState);
7922
- state.httpReqsData[key] = true;
7923
- }).catch((err) => {
7924
- console.error("error fetching dynamic data", url, err);
7925
- });
7926
- };
7927
7904
  const runHttpRequests = function runHttpRequests2(props, state, elementRef) {
7928
7905
  var _a, _b;
7929
7906
  const requests = ((_b = (_a = props.builderContextSignal.content) == null ? void 0 : _a.data) == null ? void 0 : _b.httpRequests) ?? {};
7930
7907
  Object.entries(requests).forEach(([key, url]) => {
7931
- if (url && (!state.httpReqsData[key] || isEditing())) {
7932
- const evaluatedUrl = evalExpression(props, state, elementRef, url);
7933
- handleRequest(props, state, elementRef, {
7934
- url: evaluatedUrl,
7935
- key
7908
+ if (!url)
7909
+ return;
7910
+ if (state.httpReqsPending[key])
7911
+ return;
7912
+ if (state.httpReqsData[key] && !isEditing())
7913
+ return;
7914
+ state.httpReqsPending[key] = true;
7915
+ const evaluatedUrl = url.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
7916
+ code: group,
7917
+ context: props.context || {},
7918
+ localState: void 0,
7919
+ rootState: props.builderContextSignal.rootState,
7920
+ rootSetState: props.builderContextSignal.rootSetState,
7921
+ enableCache: true
7922
+ })));
7923
+ fetch$1(evaluatedUrl).then((response) => response.json()).then((json) => {
7924
+ mergeNewRootState(props, state, elementRef, {
7925
+ [key]: json
7936
7926
  });
7937
- }
7927
+ state.httpReqsData[key] = true;
7928
+ }).catch((err) => {
7929
+ console.error("error fetching dynamic data", url, err);
7930
+ }).finally(() => {
7931
+ state.httpReqsPending[key] = false;
7932
+ });
7938
7933
  });
7939
7934
  };
7940
7935
  const emitStateUpdate = function emitStateUpdate2(props, state, elementRef) {
@@ -7954,7 +7949,8 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
7954
7949
  const state = qwik.useStore({
7955
7950
  ContentWrapper: props.contentWrapper || "div",
7956
7951
  clicked: false,
7957
- httpReqsData: {}
7952
+ httpReqsData: {},
7953
+ httpReqsPending: {}
7958
7954
  }, {
7959
7955
  deep: true
7960
7956
  });
@@ -9015,6 +9011,7 @@ const fetchBuilderProps = async (_args) => {
9015
9011
  };
9016
9012
  };
9017
9013
  exports.Blocks = Blocks;
9014
+ exports.BuilderContext = builderContext;
9018
9015
  exports.Button = Button;
9019
9016
  exports.Columns = Columns;
9020
9017
  exports.Content = ContentVariants;
@@ -7628,7 +7628,7 @@ function isFromTrustedHost(trustedHosts, e) {
7628
7628
  const url = new URL(e.origin), hostname = url.hostname;
7629
7629
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
7630
7630
  }
7631
- const SDK_VERSION = "0.14.11";
7631
+ const SDK_VERSION = "0.14.13";
7632
7632
  const registry = {};
7633
7633
  function register(type, info) {
7634
7634
  let typeList = registry[type];
@@ -7899,40 +7899,35 @@ const onClick = function onClick22(props, state, elementRef, event) {
7899
7899
  if (!state.clicked)
7900
7900
  state.clicked = true;
7901
7901
  };
7902
- const evalExpression = function evalExpression2(props, state, elementRef, expression) {
7903
- return expression.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
7904
- code: group,
7905
- context: props.context || {},
7906
- localState: void 0,
7907
- rootState: props.builderContextSignal.rootState,
7908
- rootSetState: props.builderContextSignal.rootSetState,
7909
- enableCache: true
7910
- })));
7911
- };
7912
- const handleRequest = function handleRequest2(props, state, elementRef, { url, key }) {
7913
- fetch$1(url).then((response) => response.json()).then((json) => {
7914
- var _a, _b;
7915
- const newState = {
7916
- ...props.builderContextSignal.rootState,
7917
- [key]: json
7918
- };
7919
- (_b = (_a = props.builderContextSignal).rootSetState) == null ? void 0 : _b.call(_a, newState);
7920
- state.httpReqsData[key] = true;
7921
- }).catch((err) => {
7922
- console.error("error fetching dynamic data", url, err);
7923
- });
7924
- };
7925
7902
  const runHttpRequests = function runHttpRequests2(props, state, elementRef) {
7926
7903
  var _a, _b;
7927
7904
  const requests = ((_b = (_a = props.builderContextSignal.content) == null ? void 0 : _a.data) == null ? void 0 : _b.httpRequests) ?? {};
7928
7905
  Object.entries(requests).forEach(([key, url]) => {
7929
- if (url && (!state.httpReqsData[key] || isEditing())) {
7930
- const evaluatedUrl = evalExpression(props, state, elementRef, url);
7931
- handleRequest(props, state, elementRef, {
7932
- url: evaluatedUrl,
7933
- key
7906
+ if (!url)
7907
+ return;
7908
+ if (state.httpReqsPending[key])
7909
+ return;
7910
+ if (state.httpReqsData[key] && !isEditing())
7911
+ return;
7912
+ state.httpReqsPending[key] = true;
7913
+ const evaluatedUrl = url.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
7914
+ code: group,
7915
+ context: props.context || {},
7916
+ localState: void 0,
7917
+ rootState: props.builderContextSignal.rootState,
7918
+ rootSetState: props.builderContextSignal.rootSetState,
7919
+ enableCache: true
7920
+ })));
7921
+ fetch$1(evaluatedUrl).then((response) => response.json()).then((json) => {
7922
+ mergeNewRootState(props, state, elementRef, {
7923
+ [key]: json
7934
7924
  });
7935
- }
7925
+ state.httpReqsData[key] = true;
7926
+ }).catch((err) => {
7927
+ console.error("error fetching dynamic data", url, err);
7928
+ }).finally(() => {
7929
+ state.httpReqsPending[key] = false;
7930
+ });
7936
7931
  });
7937
7932
  };
7938
7933
  const emitStateUpdate = function emitStateUpdate2(props, state, elementRef) {
@@ -7952,7 +7947,8 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
7952
7947
  const state = useStore({
7953
7948
  ContentWrapper: props.contentWrapper || "div",
7954
7949
  clicked: false,
7955
- httpReqsData: {}
7950
+ httpReqsData: {},
7951
+ httpReqsPending: {}
7956
7952
  }, {
7957
7953
  deep: true
7958
7954
  });
@@ -9014,6 +9010,7 @@ const fetchBuilderProps = async (_args) => {
9014
9010
  };
9015
9011
  export {
9016
9012
  Blocks,
9013
+ builderContext as BuilderContext,
9017
9014
  Button,
9018
9015
  Columns,
9019
9016
  ContentVariants as Content,
@@ -4501,7 +4501,7 @@ function isFromTrustedHost(trustedHosts, e) {
4501
4501
  const url = new URL(e.origin), hostname = url.hostname;
4502
4502
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
4503
4503
  }
4504
- const SDK_VERSION = "0.14.11";
4504
+ const SDK_VERSION = "0.14.13";
4505
4505
  const registry = {};
4506
4506
  function register(type, info) {
4507
4507
  let typeList = registry[type];
@@ -4772,40 +4772,35 @@ const onClick = function onClick22(props, state, elementRef, event) {
4772
4772
  if (!state.clicked)
4773
4773
  state.clicked = true;
4774
4774
  };
4775
- const evalExpression = function evalExpression2(props, state, elementRef, expression) {
4776
- return expression.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
4777
- code: group,
4778
- context: props.context || {},
4779
- localState: void 0,
4780
- rootState: props.builderContextSignal.rootState,
4781
- rootSetState: props.builderContextSignal.rootSetState,
4782
- enableCache: true
4783
- })));
4784
- };
4785
- const handleRequest = function handleRequest2(props, state, elementRef, { url, key }) {
4786
- fetch$1(url).then((response) => response.json()).then((json) => {
4787
- var _a, _b;
4788
- const newState = {
4789
- ...props.builderContextSignal.rootState,
4790
- [key]: json
4791
- };
4792
- (_b = (_a = props.builderContextSignal).rootSetState) == null ? void 0 : _b.call(_a, newState);
4793
- state.httpReqsData[key] = true;
4794
- }).catch((err) => {
4795
- console.error("error fetching dynamic data", url, err);
4796
- });
4797
- };
4798
4775
  const runHttpRequests = function runHttpRequests2(props, state, elementRef) {
4799
4776
  var _a, _b;
4800
4777
  const requests = ((_b = (_a = props.builderContextSignal.content) == null ? void 0 : _a.data) == null ? void 0 : _b.httpRequests) ?? {};
4801
4778
  Object.entries(requests).forEach(([key, url]) => {
4802
- if (url && (!state.httpReqsData[key] || isEditing())) {
4803
- const evaluatedUrl = evalExpression(props, state, elementRef, url);
4804
- handleRequest(props, state, elementRef, {
4805
- url: evaluatedUrl,
4806
- key
4779
+ if (!url)
4780
+ return;
4781
+ if (state.httpReqsPending[key])
4782
+ return;
4783
+ if (state.httpReqsData[key] && !isEditing())
4784
+ return;
4785
+ state.httpReqsPending[key] = true;
4786
+ const evaluatedUrl = url.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
4787
+ code: group,
4788
+ context: props.context || {},
4789
+ localState: void 0,
4790
+ rootState: props.builderContextSignal.rootState,
4791
+ rootSetState: props.builderContextSignal.rootSetState,
4792
+ enableCache: true
4793
+ })));
4794
+ fetch$1(evaluatedUrl).then((response) => response.json()).then((json) => {
4795
+ mergeNewRootState(props, state, elementRef, {
4796
+ [key]: json
4807
4797
  });
4808
- }
4798
+ state.httpReqsData[key] = true;
4799
+ }).catch((err) => {
4800
+ console.error("error fetching dynamic data", url, err);
4801
+ }).finally(() => {
4802
+ state.httpReqsPending[key] = false;
4803
+ });
4809
4804
  });
4810
4805
  };
4811
4806
  const emitStateUpdate = function emitStateUpdate2(props, state, elementRef) {
@@ -4825,7 +4820,8 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
4825
4820
  const state = qwik.useStore({
4826
4821
  ContentWrapper: props.contentWrapper || "div",
4827
4822
  clicked: false,
4828
- httpReqsData: {}
4823
+ httpReqsData: {},
4824
+ httpReqsPending: {}
4829
4825
  }, {
4830
4826
  deep: true
4831
4827
  });
@@ -5886,6 +5882,7 @@ const fetchBuilderProps = async (_args) => {
5886
5882
  };
5887
5883
  };
5888
5884
  exports.Blocks = Blocks;
5885
+ exports.BuilderContext = builderContext;
5889
5886
  exports.Button = Button;
5890
5887
  exports.Columns = Columns;
5891
5888
  exports.Content = ContentVariants;
@@ -4499,7 +4499,7 @@ function isFromTrustedHost(trustedHosts, e) {
4499
4499
  const url = new URL(e.origin), hostname = url.hostname;
4500
4500
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
4501
4501
  }
4502
- const SDK_VERSION = "0.14.11";
4502
+ const SDK_VERSION = "0.14.13";
4503
4503
  const registry = {};
4504
4504
  function register(type, info) {
4505
4505
  let typeList = registry[type];
@@ -4770,40 +4770,35 @@ const onClick = function onClick22(props, state, elementRef, event) {
4770
4770
  if (!state.clicked)
4771
4771
  state.clicked = true;
4772
4772
  };
4773
- const evalExpression = function evalExpression2(props, state, elementRef, expression) {
4774
- return expression.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
4775
- code: group,
4776
- context: props.context || {},
4777
- localState: void 0,
4778
- rootState: props.builderContextSignal.rootState,
4779
- rootSetState: props.builderContextSignal.rootSetState,
4780
- enableCache: true
4781
- })));
4782
- };
4783
- const handleRequest = function handleRequest2(props, state, elementRef, { url, key }) {
4784
- fetch$1(url).then((response) => response.json()).then((json) => {
4785
- var _a, _b;
4786
- const newState = {
4787
- ...props.builderContextSignal.rootState,
4788
- [key]: json
4789
- };
4790
- (_b = (_a = props.builderContextSignal).rootSetState) == null ? void 0 : _b.call(_a, newState);
4791
- state.httpReqsData[key] = true;
4792
- }).catch((err) => {
4793
- console.error("error fetching dynamic data", url, err);
4794
- });
4795
- };
4796
4773
  const runHttpRequests = function runHttpRequests2(props, state, elementRef) {
4797
4774
  var _a, _b;
4798
4775
  const requests = ((_b = (_a = props.builderContextSignal.content) == null ? void 0 : _a.data) == null ? void 0 : _b.httpRequests) ?? {};
4799
4776
  Object.entries(requests).forEach(([key, url]) => {
4800
- if (url && (!state.httpReqsData[key] || isEditing())) {
4801
- const evaluatedUrl = evalExpression(props, state, elementRef, url);
4802
- handleRequest(props, state, elementRef, {
4803
- url: evaluatedUrl,
4804
- key
4777
+ if (!url)
4778
+ return;
4779
+ if (state.httpReqsPending[key])
4780
+ return;
4781
+ if (state.httpReqsData[key] && !isEditing())
4782
+ return;
4783
+ state.httpReqsPending[key] = true;
4784
+ const evaluatedUrl = url.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
4785
+ code: group,
4786
+ context: props.context || {},
4787
+ localState: void 0,
4788
+ rootState: props.builderContextSignal.rootState,
4789
+ rootSetState: props.builderContextSignal.rootSetState,
4790
+ enableCache: true
4791
+ })));
4792
+ fetch$1(evaluatedUrl).then((response) => response.json()).then((json) => {
4793
+ mergeNewRootState(props, state, elementRef, {
4794
+ [key]: json
4805
4795
  });
4806
- }
4796
+ state.httpReqsData[key] = true;
4797
+ }).catch((err) => {
4798
+ console.error("error fetching dynamic data", url, err);
4799
+ }).finally(() => {
4800
+ state.httpReqsPending[key] = false;
4801
+ });
4807
4802
  });
4808
4803
  };
4809
4804
  const emitStateUpdate = function emitStateUpdate2(props, state, elementRef) {
@@ -4823,7 +4818,8 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
4823
4818
  const state = useStore({
4824
4819
  ContentWrapper: props.contentWrapper || "div",
4825
4820
  clicked: false,
4826
- httpReqsData: {}
4821
+ httpReqsData: {},
4822
+ httpReqsPending: {}
4827
4823
  }, {
4828
4824
  deep: true
4829
4825
  });
@@ -5885,6 +5881,7 @@ const fetchBuilderProps = async (_args) => {
5885
5881
  };
5886
5882
  export {
5887
5883
  Blocks,
5884
+ builderContext as BuilderContext,
5888
5885
  Button,
5889
5886
  Columns,
5890
5887
  ContentVariants as Content,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-qwik",
3
- "version": "0.14.11",
3
+ "version": "0.14.13",
4
4
  "homepage": "https://github.com/BuilderIO/builder/tree/main/packages/sdks/output/qwik",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,11 +12,6 @@ export declare const mergeNewContent: (props: any, state: any, elementRef: any,
12
12
  export declare const processMessage: (props: any, state: any, elementRef: any, event: MessageEvent) => void;
13
13
  export declare const evaluateJsCode: (props: any, state: any, elementRef: any) => void;
14
14
  export declare const onClick: (props: any, state: any, elementRef: any, event: any) => void;
15
- export declare const evalExpression: (props: any, state: any, elementRef: any, expression: string) => string;
16
- export declare const handleRequest: (props: any, state: any, elementRef: any, { url, key, }: {
17
- key: string;
18
- url: string;
19
- }) => void;
20
15
  export declare const runHttpRequests: (props: any, state: any, elementRef: any) => void;
21
16
  export declare const emitStateUpdate: (props: any, state: any, elementRef: any) => void;
22
17
  export declare const EnableEditor: import("@builder.io/qwik").Component<BuilderEditorProps>;
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.14.11";
1
+ export declare const SDK_VERSION = "0.14.13";
@@ -0,0 +1 @@
1
+ export { default as BuilderContext } from './builder.context.js';
@@ -8,3 +8,7 @@ export { default as Text } from '../blocks/text/index.js';
8
8
  export { default as Video } from '../blocks/video/index.js';
9
9
  export { default as Blocks } from '../components/blocks/index.js';
10
10
  export { default as Content } from '../components/content-variants/index.js';
11
+ /**
12
+ * Builder Context
13
+ */
14
+ export { BuilderContext } from '../context/index.js';