@builder.io/sdk-solid 2.0.3 → 2.0.5

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.
@@ -690,6 +690,9 @@ function assign(target, ..._args) {
690
690
  return to;
691
691
  }
692
692
  function bindAnimations(animations) {
693
+ if (TARGET === "reactNative") {
694
+ return;
695
+ }
693
696
  for (const animation of animations) {
694
697
  switch (animation.trigger) {
695
698
  case "pageLoad":
@@ -1713,7 +1716,7 @@ function FragmentComponent(props) {
1713
1716
  var fragment_default = FragmentComponent;
1714
1717
 
1715
1718
  // src/blocks/image/image.tsx
1716
- import { Show as Show7, createMemo as createMemo8 } from "solid-js";
1719
+ import { Show as Show7, onMount as onMount2, createMemo as createMemo8 } from "solid-js";
1717
1720
 
1718
1721
  // src/blocks/image/image.helpers.ts
1719
1722
  function removeProtocol(path) {
@@ -1802,12 +1805,14 @@ function Image(props) {
1802
1805
  const out = props.aspectRatio ? aspectRatioStyles : void 0;
1803
1806
  return out;
1804
1807
  });
1808
+ onMount2(() => {
1809
+ });
1805
1810
  return <>
1806
1811
  <>
1807
1812
  <picture>
1808
1813
  <Show7 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show7>
1809
1814
  <img
1810
- class={"builder-image" + (props.className ? " " + props.className : "") + " img-e3b1053e"}
1815
+ class={"builder-image" + (props.className ? " " + props.className : "") + " img-4512e110"}
1811
1816
  loading={props.highPriority ? "eager" : "lazy"}
1812
1817
  fetchpriority={props.highPriority ? "high" : "auto"}
1813
1818
  alt={props.altText}
@@ -1825,22 +1830,22 @@ function Image(props) {
1825
1830
  <Show7
1826
1831
  when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
1827
1832
  ><div
1828
- class="builder-image-sizer div-e3b1053e"
1833
+ class="builder-image-sizer div-4512e110"
1829
1834
  style={{
1830
1835
  "padding-top": props.aspectRatio * 100 + "%"
1831
1836
  }}
1832
1837
  /></Show7>
1833
1838
  <Show7 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show7>
1834
- <Show7 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-e3b1053e-2">{props.children}</div></Show7>
1839
+ <Show7 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-4512e110-2">{props.children}</div></Show7>
1835
1840
  </>
1836
- <style>{`.img-e3b1053e {
1841
+ <style>{`.img-4512e110 {
1837
1842
  opacity: 1;
1838
1843
  transition: opacity 0.2s ease-in-out;
1839
- }.div-e3b1053e {
1844
+ }.div-4512e110 {
1840
1845
  width: 100%;
1841
1846
  pointer-events: none;
1842
1847
  font-size: 0;
1843
- }.div-e3b1053e-2 {
1848
+ }.div-4512e110-2 {
1844
1849
  display: flex;
1845
1850
  flex-direction: column;
1846
1851
  align-items: stretch;
@@ -1876,10 +1881,10 @@ function SectionComponent(props) {
1876
1881
  var section_default = SectionComponent;
1877
1882
 
1878
1883
  // src/blocks/symbol/symbol.tsx
1879
- import { onMount as onMount5, on as on3, createEffect as createEffect3, createMemo as createMemo19, createSignal as createSignal19 } from "solid-js";
1884
+ import { onMount as onMount6, on as on3, createEffect as createEffect3, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
1880
1885
 
1881
1886
  // src/components/content-variants/content-variants.tsx
1882
- import { Show as Show14, For as For9, onMount as onMount4, createSignal as createSignal18, createMemo as createMemo18 } from "solid-js";
1887
+ import { Show as Show14, For as For9, onMount as onMount5, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
1883
1888
 
1884
1889
  // src/helpers/url.ts
1885
1890
  var getTopLevelDomain = (host) => {
@@ -2073,7 +2078,7 @@ var handleABTesting = async ({
2073
2078
  var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
2074
2079
 
2075
2080
  // src/components/content/content.tsx
2076
- import { Show as Show13, createSignal as createSignal17 } from "solid-js";
2081
+ import { Show as Show13, createSignal as createSignal18 } from "solid-js";
2077
2082
 
2078
2083
  // src/blocks/accordion/component-info.ts
2079
2084
  var defaultTitle = {
@@ -3086,7 +3091,8 @@ var tabs_default = Tabs;
3086
3091
  // src/blocks/text/component-info.ts
3087
3092
  var componentInfo10 = {
3088
3093
  shouldReceiveBuilderProps: {
3089
- builderBlock: TARGET === "reactNative" ? true : false
3094
+ builderBlock: TARGET === "reactNative" ? true : false,
3095
+ builderContext: true
3090
3096
  },
3091
3097
  name: "Text",
3092
3098
  static: true,
@@ -3108,10 +3114,31 @@ var componentInfo10 = {
3108
3114
  };
3109
3115
 
3110
3116
  // src/blocks/text/text.tsx
3117
+ import { createMemo as createMemo11 } from "solid-js";
3111
3118
  function Text(props) {
3119
+ const processedText = createMemo11(() => {
3120
+ const context = props.builderContext;
3121
+ const {
3122
+ context: contextContext,
3123
+ localState,
3124
+ rootState,
3125
+ rootSetState
3126
+ } = context;
3127
+ return String(props.text?.toString() || "").replace(
3128
+ /{{([^}]+)}}/g,
3129
+ (match, group) => evaluate({
3130
+ code: group,
3131
+ context: contextContext,
3132
+ localState,
3133
+ rootState,
3134
+ rootSetState,
3135
+ enableCache: false
3136
+ })
3137
+ );
3138
+ });
3112
3139
  return <><div
3113
3140
  class="builder-text"
3114
- innerHTML={props.text?.toString() || ""}
3141
+ innerHTML={processedText()}
3115
3142
  style={{
3116
3143
  outline: "none"
3117
3144
  }}
@@ -3145,12 +3172,12 @@ var componentInfo11 = {
3145
3172
  };
3146
3173
 
3147
3174
  // src/blocks/custom-code/custom-code.tsx
3148
- import { onMount as onMount2, createSignal as createSignal11 } from "solid-js";
3175
+ import { onMount as onMount3, createSignal as createSignal12 } from "solid-js";
3149
3176
  function CustomCode(props) {
3150
- const [scriptsInserted, setScriptsInserted] = createSignal11([]);
3151
- const [scriptsRun, setScriptsRun] = createSignal11([]);
3177
+ const [scriptsInserted, setScriptsInserted] = createSignal12([]);
3178
+ const [scriptsRun, setScriptsRun] = createSignal12([]);
3152
3179
  let elementRef;
3153
- onMount2(() => {
3180
+ onMount3(() => {
3154
3181
  if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
3155
3182
  return;
3156
3183
  }
@@ -3209,7 +3236,7 @@ var componentInfo12 = {
3209
3236
  };
3210
3237
 
3211
3238
  // src/blocks/embed/embed.tsx
3212
- import { on, createEffect, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
3239
+ import { on, createEffect, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
3213
3240
 
3214
3241
  // src/blocks/embed/helpers.ts
3215
3242
  var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
@@ -3217,9 +3244,9 @@ var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
3217
3244
 
3218
3245
  // src/blocks/embed/embed.tsx
3219
3246
  function Embed(props) {
3220
- const [scriptsInserted, setScriptsInserted] = createSignal12([]);
3221
- const [scriptsRun, setScriptsRun] = createSignal12([]);
3222
- const [ranInitFn, setRanInitFn] = createSignal12(false);
3247
+ const [scriptsInserted, setScriptsInserted] = createSignal13([]);
3248
+ const [scriptsRun, setScriptsRun] = createSignal13([]);
3249
+ const [ranInitFn, setRanInitFn] = createSignal13(false);
3223
3250
  function findAndRunScripts() {
3224
3251
  if (!elem || !elem.getElementsByTagName)
3225
3252
  return;
@@ -3242,8 +3269,8 @@ function Embed(props) {
3242
3269
  }
3243
3270
  }
3244
3271
  let elem;
3245
- const onUpdateFn_0_elem = createMemo12(() => elem);
3246
- const onUpdateFn_0_ranInitFn__ = createMemo12(() => ranInitFn());
3272
+ const onUpdateFn_0_elem = createMemo13(() => elem);
3273
+ const onUpdateFn_0_ranInitFn__ = createMemo13(() => ranInitFn());
3247
3274
  function onUpdateFn_0() {
3248
3275
  if (elem && !ranInitFn()) {
3249
3276
  setRanInitFn(true);
@@ -3498,7 +3525,7 @@ var componentInfo13 = {
3498
3525
  };
3499
3526
 
3500
3527
  // src/blocks/form/form/form.tsx
3501
- import { Show as Show10, For as For7, createSignal as createSignal13 } from "solid-js";
3528
+ import { Show as Show10, For as For7, createSignal as createSignal14 } from "solid-js";
3502
3529
 
3503
3530
  // src/functions/get-env.ts
3504
3531
  var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
@@ -3515,9 +3542,9 @@ var get = (obj, path, defaultValue) => {
3515
3542
 
3516
3543
  // src/blocks/form/form/form.tsx
3517
3544
  function FormComponent(props) {
3518
- const [formState, setFormState] = createSignal13("unsubmitted");
3519
- const [responseData, setResponseData] = createSignal13(null);
3520
- const [formErrorMessage, setFormErrorMessage] = createSignal13("");
3545
+ const [formState, setFormState] = createSignal14("unsubmitted");
3546
+ const [responseData, setResponseData] = createSignal14(null);
3547
+ const [formErrorMessage, setFormErrorMessage] = createSignal14("");
3521
3548
  function mergeNewRootState(newData) {
3522
3549
  const combinedState = {
3523
3550
  ...props.builderContext.rootState,
@@ -4090,9 +4117,9 @@ var componentInfo19 = {
4090
4117
  };
4091
4118
 
4092
4119
  // src/blocks/video/video.tsx
4093
- import { Show as Show11, createMemo as createMemo14 } from "solid-js";
4120
+ import { Show as Show11, createMemo as createMemo15 } from "solid-js";
4094
4121
  function Video(props) {
4095
- const videoProps = createMemo14(() => {
4122
+ const videoProps = createMemo15(() => {
4096
4123
  return {
4097
4124
  ...props.autoPlay === true ? {
4098
4125
  autoPlay: true
@@ -4111,7 +4138,7 @@ function Video(props) {
4111
4138
  } : {}
4112
4139
  };
4113
4140
  });
4114
- const spreadProps = createMemo14(() => {
4141
+ const spreadProps = createMemo15(() => {
4115
4142
  return {
4116
4143
  ...videoProps()
4117
4144
  };
@@ -4317,11 +4344,11 @@ var Inlined_script_default = InlinedScript;
4317
4344
  // src/components/content/components/enable-editor.tsx
4318
4345
  import {
4319
4346
  Show as Show12,
4320
- onMount as onMount3,
4347
+ onMount as onMount4,
4321
4348
  on as on2,
4322
4349
  createEffect as createEffect2,
4323
- createMemo as createMemo15,
4324
- createSignal as createSignal15
4350
+ createMemo as createMemo16,
4351
+ createSignal as createSignal16
4325
4352
  } from "solid-js";
4326
4353
  import { Dynamic as Dynamic5 } from "solid-js/web";
4327
4354
 
@@ -4819,7 +4846,7 @@ function isFromTrustedHost(trustedHosts, e) {
4819
4846
  }
4820
4847
 
4821
4848
  // src/constants/sdk-version.ts
4822
- var SDK_VERSION = "2.0.3";
4849
+ var SDK_VERSION = "2.0.5";
4823
4850
 
4824
4851
  // src/functions/register.ts
4825
4852
  var registry = {};
@@ -5096,12 +5123,12 @@ var getWrapperClassName = (variationId) => {
5096
5123
 
5097
5124
  // src/components/content/components/enable-editor.tsx
5098
5125
  function EnableEditor(props) {
5099
- const [ContentWrapper, setContentWrapper] = createSignal15(
5126
+ const [ContentWrapper, setContentWrapper] = createSignal16(
5100
5127
  props.contentWrapper || "div"
5101
5128
  );
5102
- const [httpReqsData, setHttpReqsData] = createSignal15({});
5103
- const [httpReqsPending, setHttpReqsPending] = createSignal15({});
5104
- const [clicked, setClicked] = createSignal15(false);
5129
+ const [httpReqsData, setHttpReqsData] = createSignal16({});
5130
+ const [httpReqsPending, setHttpReqsPending] = createSignal16({});
5131
+ const [clicked, setClicked] = createSignal16(false);
5105
5132
  function mergeNewRootState(newData) {
5106
5133
  const combinedState = {
5107
5134
  ...props.builderContextSignal.rootState,
@@ -5135,7 +5162,7 @@ function EnableEditor(props) {
5135
5162
  content: newContentValue
5136
5163
  }));
5137
5164
  }
5138
- const showContentProps = createMemo15(() => {
5165
+ const showContentProps = createMemo16(() => {
5139
5166
  return props.showContent ? {} : {
5140
5167
  hidden: true,
5141
5168
  "aria-hidden": true
@@ -5254,7 +5281,7 @@ function EnableEditor(props) {
5254
5281
  }
5255
5282
  }
5256
5283
  let elementRef;
5257
- onMount3(() => {
5284
+ onMount4(() => {
5258
5285
  if (isBrowser()) {
5259
5286
  if (isEditing()) {
5260
5287
  window.addEventListener("message", processMessage);
@@ -5315,7 +5342,7 @@ function EnableEditor(props) {
5315
5342
  }
5316
5343
  }
5317
5344
  });
5318
- onMount3(() => {
5345
+ onMount4(() => {
5319
5346
  if (!props.apiKey) {
5320
5347
  logger.error(
5321
5348
  "No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
@@ -5325,14 +5352,14 @@ function EnableEditor(props) {
5325
5352
  runHttpRequests();
5326
5353
  emitStateUpdate();
5327
5354
  });
5328
- const onUpdateFn_0_props_content = createMemo15(() => props.content);
5355
+ const onUpdateFn_0_props_content = createMemo16(() => props.content);
5329
5356
  function onUpdateFn_0() {
5330
5357
  if (props.content) {
5331
5358
  mergeNewContent(props.content);
5332
5359
  }
5333
5360
  }
5334
5361
  createEffect2(on2(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
5335
- const onUpdateFn_1_props_builderContextSignal_content__data__jsCode = createMemo15(() => props.builderContextSignal.content?.data?.jsCode);
5362
+ const onUpdateFn_1_props_builderContextSignal_content__data__jsCode = createMemo16(() => props.builderContextSignal.content?.data?.jsCode);
5336
5363
  function onUpdateFn_1() {
5337
5364
  evaluateJsCode();
5338
5365
  }
@@ -5342,7 +5369,7 @@ function EnableEditor(props) {
5342
5369
  onUpdateFn_1
5343
5370
  )
5344
5371
  );
5345
- const onUpdateFn_2_props_builderContextSignal_content__data__httpRequests = createMemo15(() => props.builderContextSignal.content?.data?.httpRequests);
5372
+ const onUpdateFn_2_props_builderContextSignal_content__data__httpRequests = createMemo16(() => props.builderContextSignal.content?.data?.httpRequests);
5346
5373
  function onUpdateFn_2() {
5347
5374
  runHttpRequests();
5348
5375
  }
@@ -5354,7 +5381,7 @@ function EnableEditor(props) {
5354
5381
  onUpdateFn_2
5355
5382
  )
5356
5383
  );
5357
- const onUpdateFn_3_props_builderContextSignal_rootState = createMemo15(
5384
+ const onUpdateFn_3_props_builderContextSignal_rootState = createMemo16(
5358
5385
  () => props.builderContextSignal.rootState
5359
5386
  );
5360
5387
  function onUpdateFn_3() {
@@ -5366,14 +5393,14 @@ function EnableEditor(props) {
5366
5393
  onUpdateFn_3
5367
5394
  )
5368
5395
  );
5369
- const onUpdateFn_4_props_data = createMemo15(() => props.data);
5396
+ const onUpdateFn_4_props_data = createMemo16(() => props.data);
5370
5397
  function onUpdateFn_4() {
5371
5398
  if (props.data) {
5372
5399
  mergeNewRootState(props.data);
5373
5400
  }
5374
5401
  }
5375
5402
  createEffect2(on2(() => [onUpdateFn_4_props_data()], onUpdateFn_4));
5376
- const onUpdateFn_5_props_locale = createMemo15(() => props.locale);
5403
+ const onUpdateFn_5_props_locale = createMemo16(() => props.locale);
5377
5404
  function onUpdateFn_5() {
5378
5405
  if (props.locale) {
5379
5406
  mergeNewRootState({
@@ -5400,9 +5427,9 @@ function EnableEditor(props) {
5400
5427
  var Enable_editor_default = EnableEditor;
5401
5428
 
5402
5429
  // src/components/content/components/styles.tsx
5403
- import { createSignal as createSignal16 } from "solid-js";
5430
+ import { createSignal as createSignal17 } from "solid-js";
5404
5431
  function ContentStyles(props) {
5405
- const [injectedStyles, setInjectedStyles] = createSignal16(
5432
+ const [injectedStyles, setInjectedStyles] = createSignal17(
5406
5433
  `
5407
5434
  ${getCss({
5408
5435
  cssCode: props.cssCode,
@@ -5460,7 +5487,7 @@ var getContentInitialValue = ({
5460
5487
 
5461
5488
  // src/components/content/content.tsx
5462
5489
  function ContentComponent(props) {
5463
- const [scriptStr, setScriptStr] = createSignal17(
5490
+ const [scriptStr, setScriptStr] = createSignal18(
5464
5491
  getUpdateVariantVisibilityScript({
5465
5492
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
5466
5493
  variationId: props.content?.testVariationId,
@@ -5468,7 +5495,7 @@ function ContentComponent(props) {
5468
5495
  contentId: props.content?.id
5469
5496
  })
5470
5497
  );
5471
- const [registeredComponents, setRegisteredComponents] = createSignal17(
5498
+ const [registeredComponents, setRegisteredComponents] = createSignal18(
5472
5499
  [
5473
5500
  ...getDefaultRegisteredComponents(),
5474
5501
  ...props.customComponents?.filter(({ models }) => {
@@ -5489,7 +5516,7 @@ function ContentComponent(props) {
5489
5516
  {}
5490
5517
  )
5491
5518
  );
5492
- const [builderContextSignal, setBuilderContextSignal] = createSignal17({
5519
+ const [builderContextSignal, setBuilderContextSignal] = createSignal18({
5493
5520
  content: getContentInitialValue({
5494
5521
  content: props.content,
5495
5522
  data: props.data
@@ -5579,13 +5606,13 @@ var Content_default = ContentComponent;
5579
5606
 
5580
5607
  // src/components/content-variants/content-variants.tsx
5581
5608
  function ContentVariants(props) {
5582
- const [shouldRenderVariants, setShouldRenderVariants] = createSignal18(
5609
+ const [shouldRenderVariants, setShouldRenderVariants] = createSignal19(
5583
5610
  checkShouldRenderVariants({
5584
5611
  canTrack: getDefaultCanTrack(props.canTrack),
5585
5612
  content: props.content
5586
5613
  })
5587
5614
  );
5588
- const updateCookieAndStylesScriptStr = createMemo18(() => {
5615
+ const updateCookieAndStylesScriptStr = createMemo19(() => {
5589
5616
  return getUpdateCookieAndStylesScript(
5590
5617
  getVariants(props.content).map((value) => ({
5591
5618
  id: value.testVariationId,
@@ -5594,10 +5621,10 @@ function ContentVariants(props) {
5594
5621
  props.content?.id || ""
5595
5622
  );
5596
5623
  });
5597
- const hideVariantsStyleString = createMemo18(() => {
5624
+ const hideVariantsStyleString = createMemo19(() => {
5598
5625
  return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
5599
5626
  });
5600
- const defaultContent = createMemo18(() => {
5627
+ const defaultContent = createMemo19(() => {
5601
5628
  return shouldRenderVariants() ? {
5602
5629
  ...props.content,
5603
5630
  testVariationId: props.content?.id
@@ -5606,7 +5633,7 @@ function ContentVariants(props) {
5606
5633
  canTrack: getDefaultCanTrack(props.canTrack)
5607
5634
  });
5608
5635
  });
5609
- onMount4(() => {
5636
+ onMount5(() => {
5610
5637
  setShouldRenderVariants(false);
5611
5638
  });
5612
5639
  return <><>
@@ -5706,14 +5733,14 @@ var fetchSymbolContent = async ({
5706
5733
 
5707
5734
  // src/blocks/symbol/symbol.tsx
5708
5735
  function Symbol(props) {
5709
- const [contentToUse, setContentToUse] = createSignal19(props.symbol?.content);
5710
- const blocksWrapper = createMemo19(() => {
5736
+ const [contentToUse, setContentToUse] = createSignal20(props.symbol?.content);
5737
+ const blocksWrapper = createMemo20(() => {
5711
5738
  return "div";
5712
5739
  });
5713
- const contentWrapper = createMemo19(() => {
5740
+ const contentWrapper = createMemo20(() => {
5714
5741
  return "div";
5715
5742
  });
5716
- const className = createMemo19(() => {
5743
+ const className = createMemo20(() => {
5717
5744
  return [
5718
5745
  ...[props.attributes[getClassPropName()]],
5719
5746
  "builder-symbol",
@@ -5733,9 +5760,9 @@ function Symbol(props) {
5733
5760
  }
5734
5761
  });
5735
5762
  }
5736
- onMount5(() => {
5763
+ onMount6(() => {
5737
5764
  });
5738
- const onUpdateFn_0_props_symbol = createMemo19(() => props.symbol);
5765
+ const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
5739
5766
  function onUpdateFn_0() {
5740
5767
  setContent();
5741
5768
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-solid",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "description": "",
5
5
  "files": [
6
6
  "dist",