@builder.io/sdk-svelte 1.0.15 → 1.0.16

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 (49) hide show
  1. package/lib/browser/blocks/columns/columns.svelte +1 -1
  2. package/lib/browser/components/block/components/block-styles.svelte +1 -1
  3. package/lib/browser/components/content/components/styles.svelte +1 -1
  4. package/lib/browser/components/content/content.svelte +1 -1
  5. package/lib/browser/components/content-variants/content-variants.svelte +9 -6
  6. package/lib/browser/components/content-variants/helpers.d.ts +1 -1
  7. package/lib/browser/components/content-variants/helpers.js +1 -1
  8. package/lib/browser/components/inlined-script.svelte +2 -2
  9. package/lib/browser/components/inlined-script.svelte.d.ts +2 -2
  10. package/lib/browser/components/inlined-styles.svelte +2 -2
  11. package/lib/browser/components/inlined-styles.svelte.d.ts +2 -2
  12. package/lib/browser/constants/sdk-version.d.ts +1 -1
  13. package/lib/browser/constants/sdk-version.js +1 -1
  14. package/lib/edge/blocks/columns/columns.svelte +1 -1
  15. package/lib/edge/components/block/components/block-styles.svelte +1 -1
  16. package/lib/edge/components/content/components/styles.svelte +1 -1
  17. package/lib/edge/components/content/content.svelte +1 -1
  18. package/lib/edge/components/content-variants/content-variants.svelte +9 -6
  19. package/lib/edge/components/content-variants/helpers.d.ts +1 -1
  20. package/lib/edge/components/content-variants/helpers.js +1 -1
  21. package/lib/edge/components/inlined-script.svelte +2 -2
  22. package/lib/edge/components/inlined-script.svelte.d.ts +2 -2
  23. package/lib/edge/components/inlined-styles.svelte +2 -2
  24. package/lib/edge/components/inlined-styles.svelte.d.ts +2 -2
  25. package/lib/edge/constants/sdk-version.d.ts +1 -1
  26. package/lib/edge/constants/sdk-version.js +1 -1
  27. package/lib/node/blocks/columns/columns.svelte +1 -1
  28. package/lib/node/components/block/components/block-styles.svelte +1 -1
  29. package/lib/node/components/content/components/styles.svelte +1 -1
  30. package/lib/node/components/content/content.svelte +1 -1
  31. package/lib/node/components/content-variants/content-variants.svelte +9 -6
  32. package/lib/node/components/content-variants/helpers.d.ts +1 -1
  33. package/lib/node/components/content-variants/helpers.js +1 -1
  34. package/lib/node/components/inlined-script.svelte +2 -2
  35. package/lib/node/components/inlined-script.svelte.d.ts +2 -2
  36. package/lib/node/components/inlined-styles.svelte +2 -2
  37. package/lib/node/components/inlined-styles.svelte.d.ts +2 -2
  38. package/lib/node/constants/sdk-version.d.ts +1 -1
  39. package/lib/node/constants/sdk-version.js +1 -1
  40. package/package.json +1 -1
  41. package/src/blocks/columns/columns.svelte +1 -1
  42. package/src/components/block/components/block-styles.svelte +1 -1
  43. package/src/components/content/components/styles.svelte +1 -1
  44. package/src/components/content/content.svelte +1 -1
  45. package/src/components/content-variants/content-variants.svelte +9 -6
  46. package/src/components/content-variants/helpers.ts +1 -1
  47. package/src/components/inlined-script.svelte +3 -3
  48. package/src/components/inlined-styles.svelte +3 -3
  49. package/src/constants/sdk-version.ts +1 -1
@@ -129,7 +129,7 @@ let flexDir = stackColumnsAt === "never"
129
129
  {...{}}
130
130
  >
131
131
  {#if TARGET !== "reactNative"}
132
- <InlinedStyles styles={columnsStyles()} />
132
+ <InlinedStyles id="builderio-columns" styles={columnsStyles()} />
133
133
  {/if}
134
134
  {#each columns as column, index (index)}
135
135
  <DynamicRenderer
@@ -70,5 +70,5 @@ $: css = () => {
70
70
  </script>
71
71
 
72
72
  {#if TARGET !== "reactNative" && css() && canShowBlock()}
73
- <InlinedStyles styles={css()} />
73
+ <InlinedStyles id="builderio-block" styles={css()} />
74
74
  {/if}
@@ -18,4 +18,4 @@ ${getDefaultStyles(isNestedRender)}
18
18
  `.trim();
19
19
  </script>
20
20
 
21
- <InlinedStyles styles={injectedStyles} />
21
+ <InlinedStyles id="builderio-content" styles={injectedStyles} />
@@ -98,7 +98,7 @@ setContext(ComponentsContext.key, {
98
98
  {...{}}
99
99
  >
100
100
  {#if isSsrAbTest}
101
- <InlinedScript {scriptStr} />
101
+ <InlinedScript id="builderio-variant-visibility" {scriptStr} />
102
102
  {/if}
103
103
  {#if TARGET !== "reactNative"}
104
104
  <ContentStyles
@@ -7,7 +7,7 @@ import { getDefaultCanTrack } from "../../helpers/canTrack.js";
7
7
  import ContentComponent from "../content/content.svelte";
8
8
  import InlinedScript from "../inlined-script.svelte";
9
9
  import InlinedStyles from "../inlined-styles.svelte";
10
- import { checkShouldRenderVariants, getScriptString, getUpdateCookieAndStylesScript, getVariants, } from "./helpers.js";
10
+ import { checkShouldRenderVariants, getInitVariantsFnsScriptString, getUpdateCookieAndStylesScript, getVariants, } from "./helpers.js";
11
11
  export let canTrack = undefined;
12
12
  export let content = undefined;
13
13
  export let isNestedRender = undefined;
@@ -60,15 +60,18 @@ onMount(() => {
60
60
  </script>
61
61
 
62
62
  {#if !isNestedRender && TARGET !== "reactNative"}
63
- <InlinedScript scriptStr={getScriptString()} />
63
+ <InlinedScript
64
+ id="builderio-init-variants-fns"
65
+ scriptStr={getInitVariantsFnsScriptString()}
66
+ />
64
67
  {/if}
65
68
 
66
69
  {#if shouldRenderVariants}
67
- <InlinedStyles
68
- id={`variants-styles-${content?.id}`}
69
- styles={hideVariantsStyleString()}
70
+ <InlinedStyles id="builderio-variants" styles={hideVariantsStyleString()} />
71
+ <InlinedScript
72
+ id="builderio-variants-visibility"
73
+ scriptStr={updateCookieAndStylesScriptStr()}
70
74
  />
71
- <InlinedScript scriptStr={updateCookieAndStylesScriptStr()} />
72
75
 
73
76
  {#each getVariants(content) as variant (variant.testVariationId)}
74
77
  <ContentComponent
@@ -32,7 +32,7 @@ type VariantData = {
32
32
  id: string;
33
33
  testRatio?: number;
34
34
  };
35
- export declare const getScriptString: () => string;
35
+ export declare const getInitVariantsFnsScriptString: () => string;
36
36
  export declare const getUpdateCookieAndStylesScript: (variants: VariantData[], contentId: string) => string;
37
37
  export declare const getUpdateVariantVisibilityScript: ({ contentId, variationId }: {
38
38
  variationId: string;
@@ -41,7 +41,7 @@ export const checkShouldRenderVariants = ({ canTrack, content }) => {
41
41
  };
42
42
  const getIsHydrationTarget = (target) => target === 'react' || target === 'reactNative';
43
43
  const isHydrationTarget = getIsHydrationTarget(TARGET);
44
- export const getScriptString = () => `
44
+ export const getInitVariantsFnsScriptString = () => `
45
45
  window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
46
46
  window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
47
47
  `;
@@ -1,7 +1,7 @@
1
1
  <script context="module"></script>
2
2
 
3
3
  <script>export let scriptStr;
4
- export let id = undefined;
4
+ export let id;
5
5
  </script>
6
6
 
7
- {@html `<script id=${id || ""}>${scriptStr}</script>`}
7
+ {@html `<script data-id=${id}>${scriptStr}</script>`}
@@ -1,12 +1,12 @@
1
1
  import { SvelteComponent } from "svelte";
2
2
  interface Props {
3
3
  scriptStr: string;
4
- id?: string;
4
+ id: string;
5
5
  }
6
6
  declare const __propDef: {
7
7
  props: {
8
8
  scriptStr: Props["scriptStr"];
9
- id?: Props["id"];
9
+ id: Props["id"];
10
10
  };
11
11
  events: {
12
12
  [evt: string]: CustomEvent<any>;
@@ -1,7 +1,7 @@
1
1
  <script context="module"></script>
2
2
 
3
3
  <script>export let styles;
4
- export let id = undefined;
4
+ export let id;
5
5
  </script>
6
6
 
7
- {@html `<${"style"} id=${id} >${styles}<${"/style"}>`}
7
+ {@html `<${"style"} data-id=${id} >${styles}<${"/style"}>`}
@@ -1,12 +1,12 @@
1
1
  import { SvelteComponent } from "svelte";
2
2
  interface Props {
3
3
  styles: string;
4
- id?: string;
4
+ id: string;
5
5
  }
6
6
  declare const __propDef: {
7
7
  props: {
8
8
  styles: Props["styles"];
9
- id?: Props["id"];
9
+ id: Props["id"];
10
10
  };
11
11
  events: {
12
12
  [evt: string]: CustomEvent<any>;
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.0.15";
1
+ export declare const SDK_VERSION = "1.0.16";
@@ -1 +1 @@
1
- export const SDK_VERSION = "1.0.15";
1
+ export const SDK_VERSION = "1.0.16";
@@ -129,7 +129,7 @@ let flexDir = stackColumnsAt === "never"
129
129
  {...{}}
130
130
  >
131
131
  {#if TARGET !== "reactNative"}
132
- <InlinedStyles styles={columnsStyles()} />
132
+ <InlinedStyles id="builderio-columns" styles={columnsStyles()} />
133
133
  {/if}
134
134
  {#each columns as column, index (index)}
135
135
  <DynamicRenderer
@@ -70,5 +70,5 @@ $: css = () => {
70
70
  </script>
71
71
 
72
72
  {#if TARGET !== "reactNative" && css() && canShowBlock()}
73
- <InlinedStyles styles={css()} />
73
+ <InlinedStyles id="builderio-block" styles={css()} />
74
74
  {/if}
@@ -18,4 +18,4 @@ ${getDefaultStyles(isNestedRender)}
18
18
  `.trim();
19
19
  </script>
20
20
 
21
- <InlinedStyles styles={injectedStyles} />
21
+ <InlinedStyles id="builderio-content" styles={injectedStyles} />
@@ -98,7 +98,7 @@ setContext(ComponentsContext.key, {
98
98
  {...{}}
99
99
  >
100
100
  {#if isSsrAbTest}
101
- <InlinedScript {scriptStr} />
101
+ <InlinedScript id="builderio-variant-visibility" {scriptStr} />
102
102
  {/if}
103
103
  {#if TARGET !== "reactNative"}
104
104
  <ContentStyles
@@ -7,7 +7,7 @@ import { getDefaultCanTrack } from "../../helpers/canTrack.js";
7
7
  import ContentComponent from "../content/content.svelte";
8
8
  import InlinedScript from "../inlined-script.svelte";
9
9
  import InlinedStyles from "../inlined-styles.svelte";
10
- import { checkShouldRenderVariants, getScriptString, getUpdateCookieAndStylesScript, getVariants, } from "./helpers.js";
10
+ import { checkShouldRenderVariants, getInitVariantsFnsScriptString, getUpdateCookieAndStylesScript, getVariants, } from "./helpers.js";
11
11
  export let canTrack = undefined;
12
12
  export let content = undefined;
13
13
  export let isNestedRender = undefined;
@@ -60,15 +60,18 @@ onMount(() => {
60
60
  </script>
61
61
 
62
62
  {#if !isNestedRender && TARGET !== "reactNative"}
63
- <InlinedScript scriptStr={getScriptString()} />
63
+ <InlinedScript
64
+ id="builderio-init-variants-fns"
65
+ scriptStr={getInitVariantsFnsScriptString()}
66
+ />
64
67
  {/if}
65
68
 
66
69
  {#if shouldRenderVariants}
67
- <InlinedStyles
68
- id={`variants-styles-${content?.id}`}
69
- styles={hideVariantsStyleString()}
70
+ <InlinedStyles id="builderio-variants" styles={hideVariantsStyleString()} />
71
+ <InlinedScript
72
+ id="builderio-variants-visibility"
73
+ scriptStr={updateCookieAndStylesScriptStr()}
70
74
  />
71
- <InlinedScript scriptStr={updateCookieAndStylesScriptStr()} />
72
75
 
73
76
  {#each getVariants(content) as variant (variant.testVariationId)}
74
77
  <ContentComponent
@@ -32,7 +32,7 @@ type VariantData = {
32
32
  id: string;
33
33
  testRatio?: number;
34
34
  };
35
- export declare const getScriptString: () => string;
35
+ export declare const getInitVariantsFnsScriptString: () => string;
36
36
  export declare const getUpdateCookieAndStylesScript: (variants: VariantData[], contentId: string) => string;
37
37
  export declare const getUpdateVariantVisibilityScript: ({ contentId, variationId }: {
38
38
  variationId: string;
@@ -41,7 +41,7 @@ export const checkShouldRenderVariants = ({ canTrack, content }) => {
41
41
  };
42
42
  const getIsHydrationTarget = (target) => target === 'react' || target === 'reactNative';
43
43
  const isHydrationTarget = getIsHydrationTarget(TARGET);
44
- export const getScriptString = () => `
44
+ export const getInitVariantsFnsScriptString = () => `
45
45
  window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
46
46
  window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
47
47
  `;
@@ -1,7 +1,7 @@
1
1
  <script context="module"></script>
2
2
 
3
3
  <script>export let scriptStr;
4
- export let id = undefined;
4
+ export let id;
5
5
  </script>
6
6
 
7
- {@html `<script id=${id || ""}>${scriptStr}</script>`}
7
+ {@html `<script data-id=${id}>${scriptStr}</script>`}
@@ -1,12 +1,12 @@
1
1
  import { SvelteComponent } from "svelte";
2
2
  interface Props {
3
3
  scriptStr: string;
4
- id?: string;
4
+ id: string;
5
5
  }
6
6
  declare const __propDef: {
7
7
  props: {
8
8
  scriptStr: Props["scriptStr"];
9
- id?: Props["id"];
9
+ id: Props["id"];
10
10
  };
11
11
  events: {
12
12
  [evt: string]: CustomEvent<any>;
@@ -1,7 +1,7 @@
1
1
  <script context="module"></script>
2
2
 
3
3
  <script>export let styles;
4
- export let id = undefined;
4
+ export let id;
5
5
  </script>
6
6
 
7
- {@html `<${"style"} id=${id} >${styles}<${"/style"}>`}
7
+ {@html `<${"style"} data-id=${id} >${styles}<${"/style"}>`}
@@ -1,12 +1,12 @@
1
1
  import { SvelteComponent } from "svelte";
2
2
  interface Props {
3
3
  styles: string;
4
- id?: string;
4
+ id: string;
5
5
  }
6
6
  declare const __propDef: {
7
7
  props: {
8
8
  styles: Props["styles"];
9
- id?: Props["id"];
9
+ id: Props["id"];
10
10
  };
11
11
  events: {
12
12
  [evt: string]: CustomEvent<any>;
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.0.15";
1
+ export declare const SDK_VERSION = "1.0.16";
@@ -1 +1 @@
1
- export const SDK_VERSION = "1.0.15";
1
+ export const SDK_VERSION = "1.0.16";
@@ -129,7 +129,7 @@ let flexDir = stackColumnsAt === "never"
129
129
  {...{}}
130
130
  >
131
131
  {#if TARGET !== "reactNative"}
132
- <InlinedStyles styles={columnsStyles()} />
132
+ <InlinedStyles id="builderio-columns" styles={columnsStyles()} />
133
133
  {/if}
134
134
  {#each columns as column, index (index)}
135
135
  <DynamicRenderer
@@ -70,5 +70,5 @@ $: css = () => {
70
70
  </script>
71
71
 
72
72
  {#if TARGET !== "reactNative" && css() && canShowBlock()}
73
- <InlinedStyles styles={css()} />
73
+ <InlinedStyles id="builderio-block" styles={css()} />
74
74
  {/if}
@@ -18,4 +18,4 @@ ${getDefaultStyles(isNestedRender)}
18
18
  `.trim();
19
19
  </script>
20
20
 
21
- <InlinedStyles styles={injectedStyles} />
21
+ <InlinedStyles id="builderio-content" styles={injectedStyles} />
@@ -98,7 +98,7 @@ setContext(ComponentsContext.key, {
98
98
  {...{}}
99
99
  >
100
100
  {#if isSsrAbTest}
101
- <InlinedScript {scriptStr} />
101
+ <InlinedScript id="builderio-variant-visibility" {scriptStr} />
102
102
  {/if}
103
103
  {#if TARGET !== "reactNative"}
104
104
  <ContentStyles
@@ -7,7 +7,7 @@ import { getDefaultCanTrack } from "../../helpers/canTrack.js";
7
7
  import ContentComponent from "../content/content.svelte";
8
8
  import InlinedScript from "../inlined-script.svelte";
9
9
  import InlinedStyles from "../inlined-styles.svelte";
10
- import { checkShouldRenderVariants, getScriptString, getUpdateCookieAndStylesScript, getVariants, } from "./helpers.js";
10
+ import { checkShouldRenderVariants, getInitVariantsFnsScriptString, getUpdateCookieAndStylesScript, getVariants, } from "./helpers.js";
11
11
  export let canTrack = undefined;
12
12
  export let content = undefined;
13
13
  export let isNestedRender = undefined;
@@ -60,15 +60,18 @@ onMount(() => {
60
60
  </script>
61
61
 
62
62
  {#if !isNestedRender && TARGET !== "reactNative"}
63
- <InlinedScript scriptStr={getScriptString()} />
63
+ <InlinedScript
64
+ id="builderio-init-variants-fns"
65
+ scriptStr={getInitVariantsFnsScriptString()}
66
+ />
64
67
  {/if}
65
68
 
66
69
  {#if shouldRenderVariants}
67
- <InlinedStyles
68
- id={`variants-styles-${content?.id}`}
69
- styles={hideVariantsStyleString()}
70
+ <InlinedStyles id="builderio-variants" styles={hideVariantsStyleString()} />
71
+ <InlinedScript
72
+ id="builderio-variants-visibility"
73
+ scriptStr={updateCookieAndStylesScriptStr()}
70
74
  />
71
- <InlinedScript scriptStr={updateCookieAndStylesScriptStr()} />
72
75
 
73
76
  {#each getVariants(content) as variant (variant.testVariationId)}
74
77
  <ContentComponent
@@ -32,7 +32,7 @@ type VariantData = {
32
32
  id: string;
33
33
  testRatio?: number;
34
34
  };
35
- export declare const getScriptString: () => string;
35
+ export declare const getInitVariantsFnsScriptString: () => string;
36
36
  export declare const getUpdateCookieAndStylesScript: (variants: VariantData[], contentId: string) => string;
37
37
  export declare const getUpdateVariantVisibilityScript: ({ contentId, variationId }: {
38
38
  variationId: string;
@@ -41,7 +41,7 @@ export const checkShouldRenderVariants = ({ canTrack, content }) => {
41
41
  };
42
42
  const getIsHydrationTarget = (target) => target === 'react' || target === 'reactNative';
43
43
  const isHydrationTarget = getIsHydrationTarget(TARGET);
44
- export const getScriptString = () => `
44
+ export const getInitVariantsFnsScriptString = () => `
45
45
  window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
46
46
  window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
47
47
  `;
@@ -1,7 +1,7 @@
1
1
  <script context="module"></script>
2
2
 
3
3
  <script>export let scriptStr;
4
- export let id = undefined;
4
+ export let id;
5
5
  </script>
6
6
 
7
- {@html `<script id=${id || ""}>${scriptStr}</script>`}
7
+ {@html `<script data-id=${id}>${scriptStr}</script>`}
@@ -1,12 +1,12 @@
1
1
  import { SvelteComponent } from "svelte";
2
2
  interface Props {
3
3
  scriptStr: string;
4
- id?: string;
4
+ id: string;
5
5
  }
6
6
  declare const __propDef: {
7
7
  props: {
8
8
  scriptStr: Props["scriptStr"];
9
- id?: Props["id"];
9
+ id: Props["id"];
10
10
  };
11
11
  events: {
12
12
  [evt: string]: CustomEvent<any>;
@@ -1,7 +1,7 @@
1
1
  <script context="module"></script>
2
2
 
3
3
  <script>export let styles;
4
- export let id = undefined;
4
+ export let id;
5
5
  </script>
6
6
 
7
- {@html `<${"style"} id=${id} >${styles}<${"/style"}>`}
7
+ {@html `<${"style"} data-id=${id} >${styles}<${"/style"}>`}
@@ -1,12 +1,12 @@
1
1
  import { SvelteComponent } from "svelte";
2
2
  interface Props {
3
3
  styles: string;
4
- id?: string;
4
+ id: string;
5
5
  }
6
6
  declare const __propDef: {
7
7
  props: {
8
8
  styles: Props["styles"];
9
- id?: Props["id"];
9
+ id: Props["id"];
10
10
  };
11
11
  events: {
12
12
  [evt: string]: CustomEvent<any>;
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.0.15";
1
+ export declare const SDK_VERSION = "1.0.16";
@@ -1 +1 @@
1
- export const SDK_VERSION = "1.0.15";
1
+ export const SDK_VERSION = "1.0.16";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-svelte",
3
3
  "description": "Builder.io SDK for Svelte",
4
- "version": "1.0.15",
4
+ "version": "1.0.16",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "lib",
@@ -155,7 +155,7 @@
155
155
  {...{}}
156
156
  >
157
157
  {#if TARGET !== "reactNative"}
158
- <InlinedStyles styles={columnsStyles()} />
158
+ <InlinedStyles id="builderio-columns" styles={columnsStyles()} />
159
159
  {/if}
160
160
  {#each columns as column, index (index)}
161
161
  <DynamicRenderer
@@ -91,5 +91,5 @@
91
91
  </script>
92
92
 
93
93
  {#if TARGET !== "reactNative" && css() && canShowBlock()}
94
- <InlinedStyles styles={css()} />
94
+ <InlinedStyles id="builderio-block" styles={css()} />
95
95
  {/if}
@@ -29,4 +29,4 @@ ${getDefaultStyles(isNestedRender)}
29
29
  `.trim();
30
30
  </script>
31
31
 
32
- <InlinedStyles styles={injectedStyles} />
32
+ <InlinedStyles id="builderio-content" styles={injectedStyles} />
@@ -122,7 +122,7 @@
122
122
  {...{}}
123
123
  >
124
124
  {#if isSsrAbTest}
125
- <InlinedScript {scriptStr} />
125
+ <InlinedScript id="builderio-variant-visibility" {scriptStr} />
126
126
  {/if}
127
127
  {#if TARGET !== "reactNative"}
128
128
  <ContentStyles
@@ -19,7 +19,7 @@
19
19
  import type { ContentVariantsPrps } from "./content-variants.types.js";
20
20
  import {
21
21
  checkShouldRenderVariants,
22
- getScriptString,
22
+ getInitVariantsFnsScriptString,
23
23
  getUpdateCookieAndStylesScript,
24
24
  getVariants,
25
25
  } from "./helpers.js";
@@ -87,15 +87,18 @@
87
87
  </script>
88
88
 
89
89
  {#if !isNestedRender && TARGET !== "reactNative"}
90
- <InlinedScript scriptStr={getScriptString()} />
90
+ <InlinedScript
91
+ id="builderio-init-variants-fns"
92
+ scriptStr={getInitVariantsFnsScriptString()}
93
+ />
91
94
  {/if}
92
95
 
93
96
  {#if shouldRenderVariants}
94
- <InlinedStyles
95
- id={`variants-styles-${content?.id}`}
96
- styles={hideVariantsStyleString()}
97
+ <InlinedStyles id="builderio-variants" styles={hideVariantsStyleString()} />
98
+ <InlinedScript
99
+ id="builderio-variants-visibility"
100
+ scriptStr={updateCookieAndStylesScriptStr()}
97
101
  />
98
- <InlinedScript scriptStr={updateCookieAndStylesScriptStr()} />
99
102
 
100
103
  {#each getVariants(content) as variant (variant.testVariationId)}
101
104
  <ContentComponent
@@ -52,7 +52,7 @@ type VariantData = {
52
52
  };
53
53
  const getIsHydrationTarget = (target: Target) => target === 'react' || target === 'reactNative';
54
54
  const isHydrationTarget = getIsHydrationTarget(TARGET);
55
- export const getScriptString = () => `
55
+ export const getInitVariantsFnsScriptString = () => `
56
56
  window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
57
57
  window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
58
58
  `;
@@ -1,13 +1,13 @@
1
1
  <script context="module" lang="ts">
2
2
  interface Props {
3
3
  scriptStr: string;
4
- id?: string;
4
+ id: string;
5
5
  }
6
6
  </script>
7
7
 
8
8
  <script lang="ts">
9
9
  export let scriptStr: Props["scriptStr"];
10
- export let id: Props["id"] = undefined;
10
+ export let id: Props["id"];
11
11
  </script>
12
12
 
13
- {@html `<script id=${id || ""}>${scriptStr}</script>`}
13
+ {@html `<script data-id=${id}>${scriptStr}</script>`}
@@ -1,13 +1,13 @@
1
1
  <script context="module" lang="ts">
2
2
  interface Props {
3
3
  styles: string;
4
- id?: string;
4
+ id: string;
5
5
  }
6
6
  </script>
7
7
 
8
8
  <script lang="ts">
9
9
  export let styles: Props["styles"];
10
- export let id: Props["id"] = undefined;
10
+ export let id: Props["id"];
11
11
  </script>
12
12
 
13
- {@html `<${"style"} id=${id} >${styles}<${"/style"}>`}
13
+ {@html `<${"style"} data-id=${id} >${styles}<${"/style"}>`}
@@ -1 +1 @@
1
- export const SDK_VERSION = "1.0.15"
1
+ export const SDK_VERSION = "1.0.16"