@builder.io/sdk-svelte 4.0.0 → 4.0.1

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.
@@ -98,6 +98,9 @@ function processMessage(event) {
98
98
  contentUpdate: (newContent) => {
99
99
  mergeNewContent(newContent);
100
100
  },
101
+ stateUpdate: (newState) => {
102
+ mergeNewRootState(newState);
103
+ },
101
104
  },
102
105
  })(event);
103
106
  }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "4.0.0";
1
+ export declare const SDK_VERSION = "4.0.1";
@@ -1 +1 @@
1
- export const SDK_VERSION = "4.0.0";
1
+ export const SDK_VERSION = "4.0.1";
@@ -1,9 +1,11 @@
1
1
  import type { ContentProps } from '../components/content/content.types';
2
2
  import type { BuilderAnimation } from '../types/builder-block';
3
3
  import type { BuilderContent } from '../types/builder-content';
4
+ import type { Dictionary } from '../types/typescript';
4
5
  type ContentListener = Required<Pick<ContentProps, 'model' | 'trustedHosts'>> & {
5
6
  callbacks: {
6
7
  contentUpdate: (updatedContent: BuilderContent) => void;
8
+ stateUpdate: (newState: Dictionary<string>) => void;
7
9
  animation: (updatedContent: BuilderAnimation) => void;
8
10
  configureSdk: (updatedContent: any) => void;
9
11
  };
@@ -20,6 +20,16 @@ export const createEditorListener = ({ model, trustedHosts, callbacks }) => {
20
20
  callbacks.animation(data.data);
21
21
  break;
22
22
  }
23
+ case 'builder.resetState':
24
+ {
25
+ const messageContent = data.data;
26
+ const modelName = messageContent.model;
27
+ const newState = messageContent?.state;
28
+ if (modelName === model && newState) {
29
+ callbacks.stateUpdate(newState);
30
+ }
31
+ break;
32
+ }
23
33
  case 'builder.contentUpdate':
24
34
  {
25
35
  const messageContent = data.data;
@@ -51,7 +61,8 @@ export const subscribeToEditor = ({ model, apiKey, callback, trustedHosts }) =>
51
61
  callbacks: {
52
62
  contentUpdate: callback,
53
63
  animation: () => { },
54
- configureSdk: () => { }
64
+ configureSdk: () => { },
65
+ stateUpdate: () => { }
55
66
  },
56
67
  model,
57
68
  trustedHosts
@@ -98,6 +98,9 @@ function processMessage(event) {
98
98
  contentUpdate: (newContent) => {
99
99
  mergeNewContent(newContent);
100
100
  },
101
+ stateUpdate: (newState) => {
102
+ mergeNewRootState(newState);
103
+ },
101
104
  },
102
105
  })(event);
103
106
  }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "4.0.0";
1
+ export declare const SDK_VERSION = "4.0.1";
@@ -1 +1 @@
1
- export const SDK_VERSION = "4.0.0";
1
+ export const SDK_VERSION = "4.0.1";
@@ -1,9 +1,11 @@
1
1
  import type { ContentProps } from '../components/content/content.types';
2
2
  import type { BuilderAnimation } from '../types/builder-block';
3
3
  import type { BuilderContent } from '../types/builder-content';
4
+ import type { Dictionary } from '../types/typescript';
4
5
  type ContentListener = Required<Pick<ContentProps, 'model' | 'trustedHosts'>> & {
5
6
  callbacks: {
6
7
  contentUpdate: (updatedContent: BuilderContent) => void;
8
+ stateUpdate: (newState: Dictionary<string>) => void;
7
9
  animation: (updatedContent: BuilderAnimation) => void;
8
10
  configureSdk: (updatedContent: any) => void;
9
11
  };
@@ -20,6 +20,16 @@ export const createEditorListener = ({ model, trustedHosts, callbacks }) => {
20
20
  callbacks.animation(data.data);
21
21
  break;
22
22
  }
23
+ case 'builder.resetState':
24
+ {
25
+ const messageContent = data.data;
26
+ const modelName = messageContent.model;
27
+ const newState = messageContent?.state;
28
+ if (modelName === model && newState) {
29
+ callbacks.stateUpdate(newState);
30
+ }
31
+ break;
32
+ }
23
33
  case 'builder.contentUpdate':
24
34
  {
25
35
  const messageContent = data.data;
@@ -51,7 +61,8 @@ export const subscribeToEditor = ({ model, apiKey, callback, trustedHosts }) =>
51
61
  callbacks: {
52
62
  contentUpdate: callback,
53
63
  animation: () => { },
54
- configureSdk: () => { }
64
+ configureSdk: () => { },
65
+ stateUpdate: () => { }
55
66
  },
56
67
  model,
57
68
  trustedHosts
@@ -98,6 +98,9 @@ function processMessage(event) {
98
98
  contentUpdate: (newContent) => {
99
99
  mergeNewContent(newContent);
100
100
  },
101
+ stateUpdate: (newState) => {
102
+ mergeNewRootState(newState);
103
+ },
101
104
  },
102
105
  })(event);
103
106
  }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "4.0.0";
1
+ export declare const SDK_VERSION = "4.0.1";
@@ -1 +1 @@
1
- export const SDK_VERSION = "4.0.0";
1
+ export const SDK_VERSION = "4.0.1";
@@ -1,9 +1,11 @@
1
1
  import type { ContentProps } from '../components/content/content.types';
2
2
  import type { BuilderAnimation } from '../types/builder-block';
3
3
  import type { BuilderContent } from '../types/builder-content';
4
+ import type { Dictionary } from '../types/typescript';
4
5
  type ContentListener = Required<Pick<ContentProps, 'model' | 'trustedHosts'>> & {
5
6
  callbacks: {
6
7
  contentUpdate: (updatedContent: BuilderContent) => void;
8
+ stateUpdate: (newState: Dictionary<string>) => void;
7
9
  animation: (updatedContent: BuilderAnimation) => void;
8
10
  configureSdk: (updatedContent: any) => void;
9
11
  };
@@ -20,6 +20,16 @@ export const createEditorListener = ({ model, trustedHosts, callbacks }) => {
20
20
  callbacks.animation(data.data);
21
21
  break;
22
22
  }
23
+ case 'builder.resetState':
24
+ {
25
+ const messageContent = data.data;
26
+ const modelName = messageContent.model;
27
+ const newState = messageContent?.state;
28
+ if (modelName === model && newState) {
29
+ callbacks.stateUpdate(newState);
30
+ }
31
+ break;
32
+ }
23
33
  case 'builder.contentUpdate':
24
34
  {
25
35
  const messageContent = data.data;
@@ -51,7 +61,8 @@ export const subscribeToEditor = ({ model, apiKey, callback, trustedHosts }) =>
51
61
  callbacks: {
52
62
  contentUpdate: callback,
53
63
  animation: () => { },
54
- configureSdk: () => { }
64
+ configureSdk: () => { },
65
+ stateUpdate: () => { }
55
66
  },
56
67
  model,
57
68
  trustedHosts
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.0.0",
4
+ "version": "4.0.1",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "lib",
@@ -130,6 +130,9 @@
130
130
  contentUpdate: (newContent) => {
131
131
  mergeNewContent(newContent);
132
132
  },
133
+ stateUpdate: (newState) => {
134
+ mergeNewRootState(newState);
135
+ },
133
136
  },
134
137
  })(event);
135
138
  }
@@ -1 +1 @@
1
- export const SDK_VERSION = "4.0.0"
1
+ export const SDK_VERSION = "4.0.1"
@@ -4,10 +4,12 @@ import { isFromTrustedHost } from '../functions/is-from-trusted-host';
4
4
  import { setupBrowserForEditing } from '../scripts/init-editing';
5
5
  import type { BuilderAnimation } from '../types/builder-block';
6
6
  import type { BuilderContent } from '../types/builder-content';
7
+ import type { Dictionary } from '../types/typescript';
7
8
  import { logger } from './logger';
8
9
  type ContentListener = Required<Pick<ContentProps, 'model' | 'trustedHosts'>> & {
9
10
  callbacks: {
10
11
  contentUpdate: (updatedContent: BuilderContent) => void;
12
+ stateUpdate: (newState: Dictionary<string>) => void;
11
13
  animation: (updatedContent: BuilderAnimation) => void;
12
14
  configureSdk: (updatedContent: any) => void;
13
15
  };
@@ -36,6 +38,16 @@ export const createEditorListener = ({
36
38
  callbacks.animation(data.data);
37
39
  break;
38
40
  }
41
+ case 'builder.resetState':
42
+ {
43
+ const messageContent = data.data;
44
+ const modelName = messageContent.model;
45
+ const newState = messageContent?.state;
46
+ if (modelName === model && newState) {
47
+ callbacks.stateUpdate(newState);
48
+ }
49
+ break;
50
+ }
39
51
  case 'builder.contentUpdate':
40
52
  {
41
53
  const messageContent = data.data;
@@ -96,7 +108,8 @@ export const subscribeToEditor: SubscribeToEditor = ({
96
108
  callbacks: {
97
109
  contentUpdate: callback,
98
110
  animation: () => {},
99
- configureSdk: () => {}
111
+ configureSdk: () => {},
112
+ stateUpdate: () => {}
100
113
  },
101
114
  model,
102
115
  trustedHosts