@builder.io/sdk-svelte 4.2.4 → 5.0.0

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.
@@ -14,12 +14,12 @@ import EnableEditor from "./components/enable-editor.svelte";
14
14
  import ContentStyles from "./components/styles.svelte";
15
15
  import { getContentInitialValue, getRootStateInitialValue, } from "./content.helpers";
16
16
  import "./wrap-component-ref";
17
- export let apiKey;
18
- export let context = undefined;
19
17
  export let content;
20
- export let customComponents = undefined;
21
18
  export let data = undefined;
22
19
  export let locale = undefined;
20
+ export let apiKey;
21
+ export let context = undefined;
22
+ export let customComponents = undefined;
23
23
  export let canTrack = undefined;
24
24
  export let apiVersion = undefined;
25
25
  export let blocksWrapper = undefined;
@@ -100,6 +100,30 @@ if (jsCode) {
100
100
  isExpression: false,
101
101
  });
102
102
  }
103
+ function onUpdateFn_0(..._args) {
104
+ const updateContentAndRootState = () => {
105
+ const nextId = content?.id;
106
+ const currentId = $builderContextSignal.content?.id;
107
+ if (nextId && nextId !== currentId) {
108
+ // Update content and root state to reflect the new entry
109
+ $builderContextSignal.content = getContentInitialValue({
110
+ content: content,
111
+ data: data,
112
+ });
113
+ $builderContextSignal.rootState = getRootStateInitialValue({
114
+ content: content,
115
+ data: data,
116
+ locale: locale,
117
+ });
118
+ // Update AB-test visibility script
119
+ scriptStr = getUpdateVariantVisibilityScript({
120
+ variationId: content?.testVariationId || "",
121
+ contentId: nextId,
122
+ });
123
+ }
124
+ };
125
+ }
126
+ $: onUpdateFn_0(...[content, data, locale]);
103
127
  setContext(ComponentsContext.key, {
104
128
  registeredComponents: registeredComponents,
105
129
  });
@@ -2,12 +2,12 @@ import { SvelteComponent } from "svelte";
2
2
  import type { ContentProps } from "./content.types";
3
3
  declare const __propDef: {
4
4
  props: {
5
- apiKey: ContentProps["apiKey"];
6
- context?: ContentProps["context"];
7
5
  content: ContentProps["content"];
8
- customComponents?: ContentProps["customComponents"];
9
6
  data?: ContentProps["data"];
10
7
  locale?: ContentProps["locale"];
8
+ apiKey: ContentProps["apiKey"];
9
+ context?: ContentProps["context"];
10
+ customComponents?: ContentProps["customComponents"];
11
11
  canTrack?: ContentProps["canTrack"];
12
12
  apiVersion?: ContentProps["apiVersion"];
13
13
  blocksWrapper?: ContentProps["blocksWrapper"];
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "4.2.4";
1
+ export declare const SDK_VERSION = "5.0.0";
@@ -1 +1 @@
1
- export const SDK_VERSION = "4.2.4";
1
+ export const SDK_VERSION = "5.0.0";
@@ -14,12 +14,12 @@ import EnableEditor from "./components/enable-editor.svelte";
14
14
  import ContentStyles from "./components/styles.svelte";
15
15
  import { getContentInitialValue, getRootStateInitialValue, } from "./content.helpers";
16
16
  import "./wrap-component-ref";
17
- export let apiKey;
18
- export let context = undefined;
19
17
  export let content;
20
- export let customComponents = undefined;
21
18
  export let data = undefined;
22
19
  export let locale = undefined;
20
+ export let apiKey;
21
+ export let context = undefined;
22
+ export let customComponents = undefined;
23
23
  export let canTrack = undefined;
24
24
  export let apiVersion = undefined;
25
25
  export let blocksWrapper = undefined;
@@ -100,6 +100,30 @@ if (jsCode) {
100
100
  isExpression: false,
101
101
  });
102
102
  }
103
+ function onUpdateFn_0(..._args) {
104
+ const updateContentAndRootState = () => {
105
+ const nextId = content?.id;
106
+ const currentId = $builderContextSignal.content?.id;
107
+ if (nextId && nextId !== currentId) {
108
+ // Update content and root state to reflect the new entry
109
+ $builderContextSignal.content = getContentInitialValue({
110
+ content: content,
111
+ data: data,
112
+ });
113
+ $builderContextSignal.rootState = getRootStateInitialValue({
114
+ content: content,
115
+ data: data,
116
+ locale: locale,
117
+ });
118
+ // Update AB-test visibility script
119
+ scriptStr = getUpdateVariantVisibilityScript({
120
+ variationId: content?.testVariationId || "",
121
+ contentId: nextId,
122
+ });
123
+ }
124
+ };
125
+ }
126
+ $: onUpdateFn_0(...[content, data, locale]);
103
127
  setContext(ComponentsContext.key, {
104
128
  registeredComponents: registeredComponents,
105
129
  });
@@ -2,12 +2,12 @@ import { SvelteComponent } from "svelte";
2
2
  import type { ContentProps } from "./content.types";
3
3
  declare const __propDef: {
4
4
  props: {
5
- apiKey: ContentProps["apiKey"];
6
- context?: ContentProps["context"];
7
5
  content: ContentProps["content"];
8
- customComponents?: ContentProps["customComponents"];
9
6
  data?: ContentProps["data"];
10
7
  locale?: ContentProps["locale"];
8
+ apiKey: ContentProps["apiKey"];
9
+ context?: ContentProps["context"];
10
+ customComponents?: ContentProps["customComponents"];
11
11
  canTrack?: ContentProps["canTrack"];
12
12
  apiVersion?: ContentProps["apiVersion"];
13
13
  blocksWrapper?: ContentProps["blocksWrapper"];
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "4.2.4";
1
+ export declare const SDK_VERSION = "5.0.0";
@@ -1 +1 @@
1
- export const SDK_VERSION = "4.2.4";
1
+ export const SDK_VERSION = "5.0.0";
@@ -14,12 +14,12 @@ import EnableEditor from "./components/enable-editor.svelte";
14
14
  import ContentStyles from "./components/styles.svelte";
15
15
  import { getContentInitialValue, getRootStateInitialValue, } from "./content.helpers";
16
16
  import "./wrap-component-ref";
17
- export let apiKey;
18
- export let context = undefined;
19
17
  export let content;
20
- export let customComponents = undefined;
21
18
  export let data = undefined;
22
19
  export let locale = undefined;
20
+ export let apiKey;
21
+ export let context = undefined;
22
+ export let customComponents = undefined;
23
23
  export let canTrack = undefined;
24
24
  export let apiVersion = undefined;
25
25
  export let blocksWrapper = undefined;
@@ -100,6 +100,30 @@ if (jsCode) {
100
100
  isExpression: false,
101
101
  });
102
102
  }
103
+ function onUpdateFn_0(..._args) {
104
+ const updateContentAndRootState = () => {
105
+ const nextId = content?.id;
106
+ const currentId = $builderContextSignal.content?.id;
107
+ if (nextId && nextId !== currentId) {
108
+ // Update content and root state to reflect the new entry
109
+ $builderContextSignal.content = getContentInitialValue({
110
+ content: content,
111
+ data: data,
112
+ });
113
+ $builderContextSignal.rootState = getRootStateInitialValue({
114
+ content: content,
115
+ data: data,
116
+ locale: locale,
117
+ });
118
+ // Update AB-test visibility script
119
+ scriptStr = getUpdateVariantVisibilityScript({
120
+ variationId: content?.testVariationId || "",
121
+ contentId: nextId,
122
+ });
123
+ }
124
+ };
125
+ }
126
+ $: onUpdateFn_0(...[content, data, locale]);
103
127
  setContext(ComponentsContext.key, {
104
128
  registeredComponents: registeredComponents,
105
129
  });
@@ -2,12 +2,12 @@ import { SvelteComponent } from "svelte";
2
2
  import type { ContentProps } from "./content.types";
3
3
  declare const __propDef: {
4
4
  props: {
5
- apiKey: ContentProps["apiKey"];
6
- context?: ContentProps["context"];
7
5
  content: ContentProps["content"];
8
- customComponents?: ContentProps["customComponents"];
9
6
  data?: ContentProps["data"];
10
7
  locale?: ContentProps["locale"];
8
+ apiKey: ContentProps["apiKey"];
9
+ context?: ContentProps["context"];
10
+ customComponents?: ContentProps["customComponents"];
11
11
  canTrack?: ContentProps["canTrack"];
12
12
  apiVersion?: ContentProps["apiVersion"];
13
13
  blocksWrapper?: ContentProps["blocksWrapper"];
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "4.2.4";
1
+ export declare const SDK_VERSION = "5.0.0";
@@ -1 +1 @@
1
- export const SDK_VERSION = "4.2.4";
1
+ export const SDK_VERSION = "5.0.0";
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": "4.2.4",
4
+ "version": "5.0.0",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "lib",
@@ -48,7 +48,7 @@
48
48
  "check": "SDK_ENV=browser svelte-check --tsconfig ./tsconfig.json"
49
49
  },
50
50
  "dependencies": {
51
- "isolated-vm": "^5.0.0"
51
+ "isolated-vm": "^6.0.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@builder.io/sdks": "workspace:*",
@@ -28,12 +28,12 @@
28
28
  import type { ContentProps } from "./content.types";
29
29
  import { wrapComponentRef } from "./wrap-component-ref";
30
30
 
31
- export let apiKey: ContentProps["apiKey"];
32
- export let context: ContentProps["context"] = undefined;
33
31
  export let content: ContentProps["content"];
34
- export let customComponents: ContentProps["customComponents"] = undefined;
35
32
  export let data: ContentProps["data"] = undefined;
36
33
  export let locale: ContentProps["locale"] = undefined;
34
+ export let apiKey: ContentProps["apiKey"];
35
+ export let context: ContentProps["context"] = undefined;
36
+ export let customComponents: ContentProps["customComponents"] = undefined;
37
37
  export let canTrack: ContentProps["canTrack"] = undefined;
38
38
  export let apiVersion: ContentProps["apiVersion"] = undefined;
39
39
  export let blocksWrapper: ContentProps["blocksWrapper"] = undefined;
@@ -127,6 +127,33 @@
127
127
  });
128
128
  }
129
129
 
130
+ function onUpdateFn_0(..._args: any[]) {
131
+ const updateContentAndRootState = () => {
132
+ const nextId = content?.id;
133
+ const currentId = $builderContextSignal.content?.id;
134
+ if (nextId && nextId !== currentId) {
135
+ // Update content and root state to reflect the new entry
136
+ $builderContextSignal.content = getContentInitialValue({
137
+ content: content,
138
+ data: data,
139
+ });
140
+ $builderContextSignal.rootState = getRootStateInitialValue({
141
+ content: content,
142
+ data: data,
143
+ locale: locale,
144
+ });
145
+
146
+ // Update AB-test visibility script
147
+ scriptStr = getUpdateVariantVisibilityScript({
148
+ variationId: content?.testVariationId || "",
149
+ contentId: nextId,
150
+ });
151
+ }
152
+ };
153
+ }
154
+
155
+ $: onUpdateFn_0(...[content, data, locale]);
156
+
130
157
  setContext(ComponentsContext.key, {
131
158
  registeredComponents: registeredComponents,
132
159
  });
@@ -1 +1 @@
1
- export const SDK_VERSION = "4.2.4"
1
+ export const SDK_VERSION = "5.0.0"