@sigmacomputing/embed-sdk 0.3.3 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +247 -0
- package/dist/index.d.mts +12 -5
- package/dist/index.d.ts +12 -5
- package/dist/index.js +15 -5
- package/dist/index.mjs +13 -4
- package/package.json +1 -1
package/README.md
ADDED
@@ -0,0 +1,247 @@
|
|
1
|
+
## Getting Started
|
2
|
+
|
3
|
+
To use the embed-sdk in your project, you can install it using your node package manager.
|
4
|
+
|
5
|
+
**Using npm:**
|
6
|
+
|
7
|
+
```code
|
8
|
+
npm install @sigmacomputing/embed-sdk
|
9
|
+
```
|
10
|
+
|
11
|
+
**yarn:**
|
12
|
+
|
13
|
+
```code
|
14
|
+
yarn add @sigmacomputing/embed-sdk
|
15
|
+
```
|
16
|
+
|
17
|
+
**pnpm:**
|
18
|
+
|
19
|
+
```code
|
20
|
+
pnpm add @sigmacomputing/embed-sdk
|
21
|
+
```
|
22
|
+
|
23
|
+
## Documentation
|
24
|
+
|
25
|
+
### Listeners
|
26
|
+
|
27
|
+
These are functions that can be used to listen for events from the embed, and react to them.
|
28
|
+
|
29
|
+
#### workbookLoadedListener
|
30
|
+
|
31
|
+
Listen for a workbook loaded event, and execute the given callback when it occurs.
|
32
|
+
|
33
|
+
```typescript
|
34
|
+
workbookLoadedListener(event: MessageEvent, iframe: HTMLIFrameElement, onLoaded: (event: WorkbookLoadedEvent) => void)
|
35
|
+
```
|
36
|
+
|
37
|
+
#### workbookErrorListener
|
38
|
+
|
39
|
+
Listen for a workbook error event, and execute the given callback when it occurs.
|
40
|
+
|
41
|
+
```typescript
|
42
|
+
workbookErrorListener(event: MessageEvent, iframe: HTMLIFrameElement, onError: (event: WorkbookErrorEvent) => void)
|
43
|
+
```
|
44
|
+
|
45
|
+
#### workbookVariableChangeListener
|
46
|
+
|
47
|
+
Listen for a workbook variable change event, and execute the given callback when it occurs.
|
48
|
+
|
49
|
+
```typescript
|
50
|
+
workbookVariableChangeListener(event: MessageEvent, iframe: HTMLIFrameElement, onVariable: (event: WorkbookVariableOnChangeEvent) => void)
|
51
|
+
```
|
52
|
+
|
53
|
+
#### workbookVariableCurrentListener
|
54
|
+
|
55
|
+
Listen for a workbook variable current event, and execute the given callback when it occurs.
|
56
|
+
|
57
|
+
```typescript
|
58
|
+
workbookVariableCurrentListener(event: MessageEvent, iframe: HTMLIFrameElement, onVariable: (event: WorkbookVariableCurrentEvent) => void)
|
59
|
+
```
|
60
|
+
|
61
|
+
#### workbookLinkSharingUpdateListener
|
62
|
+
|
63
|
+
Listen for a workbook sharing link update event, and execute the given callback when it occurs.
|
64
|
+
|
65
|
+
```typescript
|
66
|
+
workbookLinkSharingUpdateListener(event: MessageEvent, iframe: HTMLIFrameElement, onVariable: (event: WorkbookSharingLinkUpdateEvent) => void)
|
67
|
+
```
|
68
|
+
|
69
|
+
#### workbookTableCellSelectListener
|
70
|
+
|
71
|
+
Listen for a table cell select event, and execute the given callback when it occurs.
|
72
|
+
|
73
|
+
```typescript
|
74
|
+
workbookTableCellSelectListener(event: MessageEvent, iframe: HTMLIFrameElement, onTableCellSelect: (event: WorkbookTableCellSelectEvent) => void)
|
75
|
+
```
|
76
|
+
|
77
|
+
#### workbookPublishedListener
|
78
|
+
|
79
|
+
Listen for a workbook published event, and execute the given callback when it occurs.
|
80
|
+
|
81
|
+
```typescript
|
82
|
+
workbookPublishedListener(event: MessageEvent, iframe: HTMLIFrameElement, onPublished: (event: WorkbookPublishedEvent) => void)
|
83
|
+
```
|
84
|
+
|
85
|
+
#### workbookFullScreenListener
|
86
|
+
|
87
|
+
Listen for a workbook full screen event, and execute the given callback when it occurs.
|
88
|
+
|
89
|
+
```typescript
|
90
|
+
workbookFullScreenListener(event: MessageEvent, iframe: HTMLIFrameElement, onFullScreen: (event: WorkbookFullScreenEvent) => void)
|
91
|
+
```
|
92
|
+
|
93
|
+
#### workbookPageHeightListener
|
94
|
+
|
95
|
+
Listen for a workbook page height event, and execute the given callback when it occurs. Needs to be used with the responsive_height [URL Parameter](https://help.sigmacomputing.com/docs/embed-url-parameters).
|
96
|
+
|
97
|
+
```typescript
|
98
|
+
workbookPageHeightListener(event: MessageEvent, iframe: HTMLIFrameElement, onPageHeight: (event: WorkbookPageHeightEvent) => void)
|
99
|
+
```
|
100
|
+
|
101
|
+
#### workbookSelectedNodeListener
|
102
|
+
|
103
|
+
Listen for a workbook selected node event, and execute the given callback when it occurs.
|
104
|
+
|
105
|
+
```typescript
|
106
|
+
workbookSelectedNodeListener(event: MessageEvent, iframe: HTMLIFrameElement, onPageSelectedNode: (event: WorkbookSelectedNodeEvent) => void)
|
107
|
+
```
|
108
|
+
|
109
|
+
#### workbookPivotTableCellSelectListener
|
110
|
+
|
111
|
+
Listen for a pivot table cell select event, and execute the given callback when it occurs.
|
112
|
+
|
113
|
+
```typescript
|
114
|
+
workbookPivotTableCellSelectListener(event: MessageEvent, iframe: HTMLIFrameElement, onPivotTableCellSelect: (event: WorkbookPivotTableCellSelectEvent) => void)
|
115
|
+
```
|
116
|
+
|
117
|
+
#### workbookChartValueSelectListener
|
118
|
+
|
119
|
+
Listen for a chart value select event, and execute the given callback when it occurs.
|
120
|
+
|
121
|
+
```typescript
|
122
|
+
workbookChartValueSelectListener(event: MessageEvent, iframe: HTMLIFrameElement, onChartValueSelect: (event: WorkbookChartValueSelectEvent) => void)
|
123
|
+
```
|
124
|
+
|
125
|
+
#### workbookCurrentVariablesListener
|
126
|
+
|
127
|
+
Listen for a workbook current variables event, and execute the given callback when it occurs. This is to be used when `workbookVariablesList` is called.
|
128
|
+
|
129
|
+
```typescript
|
130
|
+
workbookCurrentVariablesListener(event: MessageEvent, iframe: HTMLIFrameElement, onCurrentVariables: (event: WorkbookCurrentVariablesEvent) => void)
|
131
|
+
```
|
132
|
+
|
133
|
+
#### workbookBookmarkCreateListener
|
134
|
+
|
135
|
+
Listen for a workbook bookmark create event, and execute the given callback when it occurs.
|
136
|
+
|
137
|
+
```typescript
|
138
|
+
workbookBookmarkCreateListener(event: MessageEvent, iframe: HTMLIFrameElement, onBookmarkCreate: (event: WorkbookBookmarkOnCreateEvent) => void)
|
139
|
+
```
|
140
|
+
|
141
|
+
#### workbookDataLoadedListener
|
142
|
+
|
143
|
+
Listen for a workbook data loaded event, and execute the given callback when it occurs.
|
144
|
+
|
145
|
+
```typescript
|
146
|
+
workbookDataLoadedListener(event: MessageEvent, iframe: HTMLIFrameElement, onWorkbookDataLoaded: (event: WorkbookDataLoadedEvent) => void)
|
147
|
+
```
|
148
|
+
|
149
|
+
#### workbookChartErrorListener
|
150
|
+
|
151
|
+
Listen for a workbook chart error event, and execute the given callback when it occurs.
|
152
|
+
|
153
|
+
```typescript
|
154
|
+
workbookChartErrorListener(event: MessageEvent, iframe: HTMLIFrameElement, onChartError: (event: WorkbookChartErrorEvent) => void)
|
155
|
+
```
|
156
|
+
|
157
|
+
#### workbookExploreKeyOnChangeListener
|
158
|
+
|
159
|
+
Listen for a workbook explore key change event, and execute the given callback when it occurs.
|
160
|
+
|
161
|
+
```typescript
|
162
|
+
workbookExploreKeyOnChangeListener(event: MessageEvent, iframe: HTMLIFrameElement, onExploreKeyOnChange: (event: WorkbookExploreKeyOnChangeEvent) => void)
|
163
|
+
```
|
164
|
+
|
165
|
+
#### workbookBookmarkOnChangeListener
|
166
|
+
|
167
|
+
Listen for a workbook bookmark change event, and execute the given callback when it occurs.
|
168
|
+
|
169
|
+
```typescript
|
170
|
+
workbookBookmarkOnChangeListener(event: MessageEvent, iframe: HTMLIFrameElement, onBookmarkChange: (event: WorkbookBookmarkOnChangeEvent) => void)
|
171
|
+
```
|
172
|
+
|
173
|
+
#### urlOnChangeListener
|
174
|
+
|
175
|
+
Listen for a url change event, and execute the given callback when it occurs.
|
176
|
+
|
177
|
+
```typescript
|
178
|
+
urlOnChangeListener(event: MessageEvent, iframe: HTMLIFrameElement, onUrlChange: (event: UrlOnChangeEvent) => void)
|
179
|
+
```
|
180
|
+
|
181
|
+
#### workbookIdOnChangeListener
|
182
|
+
|
183
|
+
Listen for a workbook id change event, and execute the given callback when it occurs.
|
184
|
+
|
185
|
+
```typescript
|
186
|
+
workbookIdOnChangeListener(event: MessageEvent, iframe: HTMLIFrameElement, onWorkbookIdChange: (event: WorkbookIdOnChangeEvent) => void)
|
187
|
+
```
|
188
|
+
|
189
|
+
### Mutations
|
190
|
+
|
191
|
+
These are functions that can be used to send messages to the embed. They may cause an event to be emitted from the embed.
|
192
|
+
|
193
|
+
#### workbookVariablesList
|
194
|
+
|
195
|
+
Send a message to the embed to list the current variables. This will cause a `workbook:variables:current` event to be emitted from the embed, and can be used with the `workbookCurrentVariablesListener` function.
|
196
|
+
|
197
|
+
```typescript
|
198
|
+
workbookVariablesList(iframe: HTMLIFrameElement)
|
199
|
+
```
|
200
|
+
|
201
|
+
#### workbookVariablesUpdate
|
202
|
+
|
203
|
+
Send a message to the embed to update the variables.
|
204
|
+
|
205
|
+
```typescript
|
206
|
+
workbookVariablesUpdate(iframe: HTMLIFrameElement, variables: Record<string, string>)
|
207
|
+
```
|
208
|
+
|
209
|
+
#### workbookSharingLinkUpdate
|
210
|
+
|
211
|
+
Send a message to the embed to update the sharing link.
|
212
|
+
|
213
|
+
```typescript
|
214
|
+
workbookSharingLinkUpdate(iframe: HTMLIFrameElement, sharingLink: string | null, sharingExplorationLink?: string | null)
|
215
|
+
```
|
216
|
+
|
217
|
+
#### workbookBookmarkCreate
|
218
|
+
|
219
|
+
Send a message to the embed to create a bookmark.
|
220
|
+
|
221
|
+
```typescript
|
222
|
+
workbookBookmarkCreate(iframe: HTMLIFrameElement, bookmark: WorkbookBookmarkCreateEvent)
|
223
|
+
```
|
224
|
+
|
225
|
+
#### workbookBookmarkUpdate
|
226
|
+
|
227
|
+
Send a message to the embed to update the current bookmark.
|
228
|
+
|
229
|
+
```typescript
|
230
|
+
workbookBookmarkUpdate(iframe: HTMLIFrameElement)
|
231
|
+
```
|
232
|
+
|
233
|
+
#### workbookFullscreenUpdate
|
234
|
+
|
235
|
+
Send a message to the embed to toggle the fullscreen state of the given element.
|
236
|
+
|
237
|
+
```typescript
|
238
|
+
workbookFullscreenUpdate(iframe: HTMLIFrameElement, nodeId: string | null)
|
239
|
+
```
|
240
|
+
|
241
|
+
#### workbookSelectedNodeIdUpdate
|
242
|
+
|
243
|
+
Send a message to the embed to update the selected element. Can be a pageId or elementId.
|
244
|
+
|
245
|
+
```typescript
|
246
|
+
workbookSelectedNodeIdUpdate(iframe: HTMLIFrameElement, nodeId: string, nodeType: "element" | "page")
|
247
|
+
```
|
package/dist/index.d.mts
CHANGED
@@ -45,7 +45,7 @@ declare const WorkbookTableCellSelectEventName: "workbook:table:oncellselect";
|
|
45
45
|
declare const WorkbookPublishedEventName: "workbook:published";
|
46
46
|
declare const WorkbookFullScreenEventName: "workbook:fullscreen:onchange";
|
47
47
|
declare const WorkbookPageHeightEventName: "workbook:pageheight:onchange";
|
48
|
-
declare const
|
48
|
+
declare const WorkbookSelectedNodeEventName: "workbook:selectednodeid:onchange";
|
49
49
|
declare const WorkbookPivotTableCellSelectEventName: "workbook:pivottable:oncellselect";
|
50
50
|
declare const WorkbookChartValueSelectEventName: "workbook:chart:onvalueselect";
|
51
51
|
declare const WorkbookCurrentVariablesEventName: "workbook:variables:current";
|
@@ -64,6 +64,7 @@ declare const WorkbookVariablesListEventName: "workbook:variables:list";
|
|
64
64
|
declare const WorkbookVariablesUpdateEventName: "workbook:variables:update";
|
65
65
|
declare const WorkbookVariablesCurrentEventName: "workbook:variables:current";
|
66
66
|
declare const WorkbookSharingLinkUpdateEventName: "workbook:sharinglink:update";
|
67
|
+
declare const ActionOutboundEventName: "action:outbound";
|
67
68
|
interface WorkbookLoadedEvent {
|
68
69
|
type: typeof WorkbookLoadedEventName;
|
69
70
|
workbook: {
|
@@ -105,8 +106,8 @@ type WorkbookPageHeightEvent = {
|
|
105
106
|
type: typeof WorkbookPageHeightEventName;
|
106
107
|
pageHeight: number;
|
107
108
|
};
|
108
|
-
type
|
109
|
-
type: typeof
|
109
|
+
type WorkbookSelectedNodeEvent = {
|
110
|
+
type: typeof WorkbookSelectedNodeEventName;
|
110
111
|
selectedNodeId: string | null;
|
111
112
|
};
|
112
113
|
type WorkbookPivotTableCellSelectEvent = {
|
@@ -165,6 +166,11 @@ type WorkbookBookmarkCreateEvent = {
|
|
165
166
|
isDefault: boolean;
|
166
167
|
isShared: boolean;
|
167
168
|
};
|
169
|
+
type ActionOutboundEvent = {
|
170
|
+
type: typeof ActionOutboundEventName;
|
171
|
+
name: string;
|
172
|
+
values: Record<string, unknown>;
|
173
|
+
};
|
168
174
|
|
169
175
|
declare const workbookLoadedListener: (event: MessageEvent, iframe: HTMLIFrameElement, onLoaded: (event: WorkbookLoadedEvent) => void) => void;
|
170
176
|
declare const workbookErrorListener: (event: MessageEvent, iframe: HTMLIFrameElement, onError: (event: WorkbookErrorEvent) => void) => void;
|
@@ -175,7 +181,7 @@ declare const workbookTableCellSelectListener: (event: MessageEvent, iframe: HTM
|
|
175
181
|
declare const workbookPublishedListener: (event: MessageEvent, iframe: HTMLIFrameElement, onPublished: (event: WorkbookPublishedEvent) => void) => void;
|
176
182
|
declare const workbookFullScreenListener: (event: MessageEvent, iframe: HTMLIFrameElement, onFullScreen: (event: WorkbookFullScreenEvent) => void) => void;
|
177
183
|
declare const workbookPageHeightListener: (event: MessageEvent, iframe: HTMLIFrameElement, onPageHeight: (event: WorkbookPageHeightEvent) => void) => void;
|
178
|
-
declare const
|
184
|
+
declare const workbookSelectedNodeListener: (event: MessageEvent, iframe: HTMLIFrameElement, onPageSelectedNode: (event: WorkbookSelectedNodeEvent) => void) => void;
|
179
185
|
declare const workbookPivotTableCellSelectListener: (event: MessageEvent, iframe: HTMLIFrameElement, onPivotTableCellSelect: (event: WorkbookPivotTableCellSelectEvent) => void) => void;
|
180
186
|
declare const workbookChartValueSelectListener: (event: MessageEvent, iframe: HTMLIFrameElement, onChartValueSelect: (event: WorkbookChartValueSelectEvent) => void) => void;
|
181
187
|
declare const workbookCurrentVariablesListener: (event: MessageEvent, iframe: HTMLIFrameElement, onCurrentVariables: (event: WorkbookCurrentVariablesEvent) => void) => void;
|
@@ -186,6 +192,7 @@ declare const workbookExploreKeyOnChangeListener: (event: MessageEvent, iframe:
|
|
186
192
|
declare const workbookBookmarkOnChangeListener: (event: MessageEvent, iframe: HTMLIFrameElement, onBookmarkChange: (event: WorkbookBookmarkOnChangeEvent) => void) => void;
|
187
193
|
declare const urlOnChangeListener: (event: MessageEvent, iframe: HTMLIFrameElement, onUrlChange: (event: UrlOnChangeEvent) => void) => void;
|
188
194
|
declare const workbookIdOnChangeListener: (event: MessageEvent, iframe: HTMLIFrameElement, onWorkbookIdChange: (event: WorkbookIdOnChangeEvent) => void) => void;
|
195
|
+
declare const actionOutboundListener: (event: MessageEvent, iframe: HTMLIFrameElement, onActionOutbound: (event: ActionOutboundEvent) => void) => void;
|
189
196
|
|
190
197
|
declare const workbookBookmarkCreate: (iframe: HTMLIFrameElement, bookmark: WorkbookBookmarkCreateEvent) => void;
|
191
198
|
declare const workbookBookmarkUpdate: (iframe: HTMLIFrameElement) => void;
|
@@ -195,4 +202,4 @@ declare const workbookVariablesList: (iframe: HTMLIFrameElement) => void;
|
|
195
202
|
declare const workbookVariablesUpdate: (iframe: HTMLIFrameElement, variables: Record<string, string>) => void;
|
196
203
|
declare const workbookSharingLinkUpdate: (iframe: HTMLIFrameElement, sharingLink: string | null, sharingExplorationLink?: string | null) => void;
|
197
204
|
|
198
|
-
export { CellType_t, type Cell_t, type ChartValue_t, type ChartValues_t, type DataRow_t, type DataRows_t, type Data_t, type LevelTableCell_t, type LevelTableCells, type LevelTableColumnCell_t, type LevelTableValueCell_t, type PathChunk_t, type PivotPath_t, type PivotTableCell_t, type PivotTableCells_t, type UrlOnChangeEvent, UrlOnChangeEventName, type Value_t, type WorkbookBookmarkCreateEvent, WorkbookBookmarkCreateEventName, type WorkbookBookmarkOnChangeEvent, WorkbookBookmarkOnChangeEventName, type WorkbookBookmarkOnCreateEvent, WorkbookBookmarkOnCreateEventName, WorkbookBookmarkUpdateEventName, type WorkbookChartErrorEvent, WorkbookChartErrorEventName, type WorkbookChartValueSelectEvent, WorkbookChartValueSelectEventName, type WorkbookCurrentVariablesEvent, WorkbookCurrentVariablesEventName, type WorkbookDataLoadedEvent, WorkbookDataLoadedEventName, type WorkbookErrorEvent, WorkbookErrorEventName, type WorkbookExploreKeyOnChangeEvent, WorkbookExploreKeyOnChangeEventName, type WorkbookFullScreenEvent, WorkbookFullScreenEventName, WorkbookFullscreenUpdateEventName, type WorkbookIdOnChangeEvent, WorkbookIdOnChangeEventName, type WorkbookLoadedEvent, WorkbookLoadedEventName, type WorkbookPageHeightEvent, WorkbookPageHeightEventName, type
|
205
|
+
export { type ActionOutboundEvent, ActionOutboundEventName, CellType_t, type Cell_t, type ChartValue_t, type ChartValues_t, type DataRow_t, type DataRows_t, type Data_t, type LevelTableCell_t, type LevelTableCells, type LevelTableColumnCell_t, type LevelTableValueCell_t, type PathChunk_t, type PivotPath_t, type PivotTableCell_t, type PivotTableCells_t, type UrlOnChangeEvent, UrlOnChangeEventName, type Value_t, type WorkbookBookmarkCreateEvent, WorkbookBookmarkCreateEventName, type WorkbookBookmarkOnChangeEvent, WorkbookBookmarkOnChangeEventName, type WorkbookBookmarkOnCreateEvent, WorkbookBookmarkOnCreateEventName, WorkbookBookmarkUpdateEventName, type WorkbookChartErrorEvent, WorkbookChartErrorEventName, type WorkbookChartValueSelectEvent, WorkbookChartValueSelectEventName, type WorkbookCurrentVariablesEvent, WorkbookCurrentVariablesEventName, type WorkbookDataLoadedEvent, WorkbookDataLoadedEventName, type WorkbookErrorEvent, WorkbookErrorEventName, type WorkbookExploreKeyOnChangeEvent, WorkbookExploreKeyOnChangeEventName, type WorkbookFullScreenEvent, WorkbookFullScreenEventName, WorkbookFullscreenUpdateEventName, type WorkbookIdOnChangeEvent, WorkbookIdOnChangeEventName, type WorkbookLoadedEvent, WorkbookLoadedEventName, type WorkbookPageHeightEvent, WorkbookPageHeightEventName, type WorkbookPivotTableCellSelectEvent, WorkbookPivotTableCellSelectEventName, type WorkbookPublishedEvent, WorkbookPublishedEventName, type WorkbookSelectedNodeEvent, WorkbookSelectedNodeEventName, WorkbookSelectedNodeIdUpdateEventName, type WorkbookSharingLinkUpdateEvent, WorkbookSharingLinkUpdateEventName, type WorkbookTableCellSelectEvent, WorkbookTableCellSelectEventName, type WorkbookVariableCurrentEvent, WorkbookVariableEventOnChangeName, type WorkbookVariableOnChangeEvent, WorkbookVariablesCurrentEventName, WorkbookVariablesListEventName, WorkbookVariablesUpdateEventName, actionOutboundListener, urlOnChangeListener, workbookBookmarkCreate, workbookBookmarkCreateListener, workbookBookmarkOnChangeListener, workbookBookmarkUpdate, workbookChartErrorListener, workbookChartValueSelectListener, workbookCurrentVariablesListener, workbookDataLoadedListener, workbookErrorListener, workbookExploreKeyOnChangeListener, workbookFullScreenListener, workbookFullscreenUpdate, workbookIdOnChangeListener, workbookLinkSharingUpdateListener, workbookLoadedListener, workbookPageHeightListener, workbookPivotTableCellSelectListener, workbookPublishedListener, workbookSelectedNodeIdUpdate, workbookSelectedNodeListener, workbookSharingLinkUpdate, workbookTableCellSelectListener, workbookVariableChangeListener, workbookVariableCurrentListener, workbookVariablesList, workbookVariablesUpdate };
|
package/dist/index.d.ts
CHANGED
@@ -45,7 +45,7 @@ declare const WorkbookTableCellSelectEventName: "workbook:table:oncellselect";
|
|
45
45
|
declare const WorkbookPublishedEventName: "workbook:published";
|
46
46
|
declare const WorkbookFullScreenEventName: "workbook:fullscreen:onchange";
|
47
47
|
declare const WorkbookPageHeightEventName: "workbook:pageheight:onchange";
|
48
|
-
declare const
|
48
|
+
declare const WorkbookSelectedNodeEventName: "workbook:selectednodeid:onchange";
|
49
49
|
declare const WorkbookPivotTableCellSelectEventName: "workbook:pivottable:oncellselect";
|
50
50
|
declare const WorkbookChartValueSelectEventName: "workbook:chart:onvalueselect";
|
51
51
|
declare const WorkbookCurrentVariablesEventName: "workbook:variables:current";
|
@@ -64,6 +64,7 @@ declare const WorkbookVariablesListEventName: "workbook:variables:list";
|
|
64
64
|
declare const WorkbookVariablesUpdateEventName: "workbook:variables:update";
|
65
65
|
declare const WorkbookVariablesCurrentEventName: "workbook:variables:current";
|
66
66
|
declare const WorkbookSharingLinkUpdateEventName: "workbook:sharinglink:update";
|
67
|
+
declare const ActionOutboundEventName: "action:outbound";
|
67
68
|
interface WorkbookLoadedEvent {
|
68
69
|
type: typeof WorkbookLoadedEventName;
|
69
70
|
workbook: {
|
@@ -105,8 +106,8 @@ type WorkbookPageHeightEvent = {
|
|
105
106
|
type: typeof WorkbookPageHeightEventName;
|
106
107
|
pageHeight: number;
|
107
108
|
};
|
108
|
-
type
|
109
|
-
type: typeof
|
109
|
+
type WorkbookSelectedNodeEvent = {
|
110
|
+
type: typeof WorkbookSelectedNodeEventName;
|
110
111
|
selectedNodeId: string | null;
|
111
112
|
};
|
112
113
|
type WorkbookPivotTableCellSelectEvent = {
|
@@ -165,6 +166,11 @@ type WorkbookBookmarkCreateEvent = {
|
|
165
166
|
isDefault: boolean;
|
166
167
|
isShared: boolean;
|
167
168
|
};
|
169
|
+
type ActionOutboundEvent = {
|
170
|
+
type: typeof ActionOutboundEventName;
|
171
|
+
name: string;
|
172
|
+
values: Record<string, unknown>;
|
173
|
+
};
|
168
174
|
|
169
175
|
declare const workbookLoadedListener: (event: MessageEvent, iframe: HTMLIFrameElement, onLoaded: (event: WorkbookLoadedEvent) => void) => void;
|
170
176
|
declare const workbookErrorListener: (event: MessageEvent, iframe: HTMLIFrameElement, onError: (event: WorkbookErrorEvent) => void) => void;
|
@@ -175,7 +181,7 @@ declare const workbookTableCellSelectListener: (event: MessageEvent, iframe: HTM
|
|
175
181
|
declare const workbookPublishedListener: (event: MessageEvent, iframe: HTMLIFrameElement, onPublished: (event: WorkbookPublishedEvent) => void) => void;
|
176
182
|
declare const workbookFullScreenListener: (event: MessageEvent, iframe: HTMLIFrameElement, onFullScreen: (event: WorkbookFullScreenEvent) => void) => void;
|
177
183
|
declare const workbookPageHeightListener: (event: MessageEvent, iframe: HTMLIFrameElement, onPageHeight: (event: WorkbookPageHeightEvent) => void) => void;
|
178
|
-
declare const
|
184
|
+
declare const workbookSelectedNodeListener: (event: MessageEvent, iframe: HTMLIFrameElement, onPageSelectedNode: (event: WorkbookSelectedNodeEvent) => void) => void;
|
179
185
|
declare const workbookPivotTableCellSelectListener: (event: MessageEvent, iframe: HTMLIFrameElement, onPivotTableCellSelect: (event: WorkbookPivotTableCellSelectEvent) => void) => void;
|
180
186
|
declare const workbookChartValueSelectListener: (event: MessageEvent, iframe: HTMLIFrameElement, onChartValueSelect: (event: WorkbookChartValueSelectEvent) => void) => void;
|
181
187
|
declare const workbookCurrentVariablesListener: (event: MessageEvent, iframe: HTMLIFrameElement, onCurrentVariables: (event: WorkbookCurrentVariablesEvent) => void) => void;
|
@@ -186,6 +192,7 @@ declare const workbookExploreKeyOnChangeListener: (event: MessageEvent, iframe:
|
|
186
192
|
declare const workbookBookmarkOnChangeListener: (event: MessageEvent, iframe: HTMLIFrameElement, onBookmarkChange: (event: WorkbookBookmarkOnChangeEvent) => void) => void;
|
187
193
|
declare const urlOnChangeListener: (event: MessageEvent, iframe: HTMLIFrameElement, onUrlChange: (event: UrlOnChangeEvent) => void) => void;
|
188
194
|
declare const workbookIdOnChangeListener: (event: MessageEvent, iframe: HTMLIFrameElement, onWorkbookIdChange: (event: WorkbookIdOnChangeEvent) => void) => void;
|
195
|
+
declare const actionOutboundListener: (event: MessageEvent, iframe: HTMLIFrameElement, onActionOutbound: (event: ActionOutboundEvent) => void) => void;
|
189
196
|
|
190
197
|
declare const workbookBookmarkCreate: (iframe: HTMLIFrameElement, bookmark: WorkbookBookmarkCreateEvent) => void;
|
191
198
|
declare const workbookBookmarkUpdate: (iframe: HTMLIFrameElement) => void;
|
@@ -195,4 +202,4 @@ declare const workbookVariablesList: (iframe: HTMLIFrameElement) => void;
|
|
195
202
|
declare const workbookVariablesUpdate: (iframe: HTMLIFrameElement, variables: Record<string, string>) => void;
|
196
203
|
declare const workbookSharingLinkUpdate: (iframe: HTMLIFrameElement, sharingLink: string | null, sharingExplorationLink?: string | null) => void;
|
197
204
|
|
198
|
-
export { CellType_t, type Cell_t, type ChartValue_t, type ChartValues_t, type DataRow_t, type DataRows_t, type Data_t, type LevelTableCell_t, type LevelTableCells, type LevelTableColumnCell_t, type LevelTableValueCell_t, type PathChunk_t, type PivotPath_t, type PivotTableCell_t, type PivotTableCells_t, type UrlOnChangeEvent, UrlOnChangeEventName, type Value_t, type WorkbookBookmarkCreateEvent, WorkbookBookmarkCreateEventName, type WorkbookBookmarkOnChangeEvent, WorkbookBookmarkOnChangeEventName, type WorkbookBookmarkOnCreateEvent, WorkbookBookmarkOnCreateEventName, WorkbookBookmarkUpdateEventName, type WorkbookChartErrorEvent, WorkbookChartErrorEventName, type WorkbookChartValueSelectEvent, WorkbookChartValueSelectEventName, type WorkbookCurrentVariablesEvent, WorkbookCurrentVariablesEventName, type WorkbookDataLoadedEvent, WorkbookDataLoadedEventName, type WorkbookErrorEvent, WorkbookErrorEventName, type WorkbookExploreKeyOnChangeEvent, WorkbookExploreKeyOnChangeEventName, type WorkbookFullScreenEvent, WorkbookFullScreenEventName, WorkbookFullscreenUpdateEventName, type WorkbookIdOnChangeEvent, WorkbookIdOnChangeEventName, type WorkbookLoadedEvent, WorkbookLoadedEventName, type WorkbookPageHeightEvent, WorkbookPageHeightEventName, type
|
205
|
+
export { type ActionOutboundEvent, ActionOutboundEventName, CellType_t, type Cell_t, type ChartValue_t, type ChartValues_t, type DataRow_t, type DataRows_t, type Data_t, type LevelTableCell_t, type LevelTableCells, type LevelTableColumnCell_t, type LevelTableValueCell_t, type PathChunk_t, type PivotPath_t, type PivotTableCell_t, type PivotTableCells_t, type UrlOnChangeEvent, UrlOnChangeEventName, type Value_t, type WorkbookBookmarkCreateEvent, WorkbookBookmarkCreateEventName, type WorkbookBookmarkOnChangeEvent, WorkbookBookmarkOnChangeEventName, type WorkbookBookmarkOnCreateEvent, WorkbookBookmarkOnCreateEventName, WorkbookBookmarkUpdateEventName, type WorkbookChartErrorEvent, WorkbookChartErrorEventName, type WorkbookChartValueSelectEvent, WorkbookChartValueSelectEventName, type WorkbookCurrentVariablesEvent, WorkbookCurrentVariablesEventName, type WorkbookDataLoadedEvent, WorkbookDataLoadedEventName, type WorkbookErrorEvent, WorkbookErrorEventName, type WorkbookExploreKeyOnChangeEvent, WorkbookExploreKeyOnChangeEventName, type WorkbookFullScreenEvent, WorkbookFullScreenEventName, WorkbookFullscreenUpdateEventName, type WorkbookIdOnChangeEvent, WorkbookIdOnChangeEventName, type WorkbookLoadedEvent, WorkbookLoadedEventName, type WorkbookPageHeightEvent, WorkbookPageHeightEventName, type WorkbookPivotTableCellSelectEvent, WorkbookPivotTableCellSelectEventName, type WorkbookPublishedEvent, WorkbookPublishedEventName, type WorkbookSelectedNodeEvent, WorkbookSelectedNodeEventName, WorkbookSelectedNodeIdUpdateEventName, type WorkbookSharingLinkUpdateEvent, WorkbookSharingLinkUpdateEventName, type WorkbookTableCellSelectEvent, WorkbookTableCellSelectEventName, type WorkbookVariableCurrentEvent, WorkbookVariableEventOnChangeName, type WorkbookVariableOnChangeEvent, WorkbookVariablesCurrentEventName, WorkbookVariablesListEventName, WorkbookVariablesUpdateEventName, actionOutboundListener, urlOnChangeListener, workbookBookmarkCreate, workbookBookmarkCreateListener, workbookBookmarkOnChangeListener, workbookBookmarkUpdate, workbookChartErrorListener, workbookChartValueSelectListener, workbookCurrentVariablesListener, workbookDataLoadedListener, workbookErrorListener, workbookExploreKeyOnChangeListener, workbookFullScreenListener, workbookFullscreenUpdate, workbookIdOnChangeListener, workbookLinkSharingUpdateListener, workbookLoadedListener, workbookPageHeightListener, workbookPivotTableCellSelectListener, workbookPublishedListener, workbookSelectedNodeIdUpdate, workbookSelectedNodeListener, workbookSharingLinkUpdate, workbookTableCellSelectListener, workbookVariableChangeListener, workbookVariableCurrentListener, workbookVariablesList, workbookVariablesUpdate };
|
package/dist/index.js
CHANGED
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
20
20
|
// src/index.ts
|
21
21
|
var src_exports = {};
|
22
22
|
__export(src_exports, {
|
23
|
+
actionOutboundListener: () => actionOutboundListener,
|
23
24
|
urlOnChangeListener: () => urlOnChangeListener,
|
24
25
|
workbookBookmarkCreate: () => workbookBookmarkCreate,
|
25
26
|
workbookBookmarkCreateListener: () => workbookBookmarkCreateListener,
|
@@ -37,10 +38,10 @@ __export(src_exports, {
|
|
37
38
|
workbookLinkSharingUpdateListener: () => workbookLinkSharingUpdateListener,
|
38
39
|
workbookLoadedListener: () => workbookLoadedListener,
|
39
40
|
workbookPageHeightListener: () => workbookPageHeightListener,
|
40
|
-
workbookPageSelectedNodeListener: () => workbookPageSelectedNodeListener,
|
41
41
|
workbookPivotTableCellSelectListener: () => workbookPivotTableCellSelectListener,
|
42
42
|
workbookPublishedListener: () => workbookPublishedListener,
|
43
43
|
workbookSelectedNodeIdUpdate: () => workbookSelectedNodeIdUpdate,
|
44
|
+
workbookSelectedNodeListener: () => workbookSelectedNodeListener,
|
44
45
|
workbookSharingLinkUpdate: () => workbookSharingLinkUpdate,
|
45
46
|
workbookTableCellSelectListener: () => workbookTableCellSelectListener,
|
46
47
|
workbookVariableChangeListener: () => workbookVariableChangeListener,
|
@@ -58,7 +59,7 @@ var WorkbookTableCellSelectEventName = "workbook:table:oncellselect";
|
|
58
59
|
var WorkbookPublishedEventName = "workbook:published";
|
59
60
|
var WorkbookFullScreenEventName = "workbook:fullscreen:onchange";
|
60
61
|
var WorkbookPageHeightEventName = "workbook:pageheight:onchange";
|
61
|
-
var
|
62
|
+
var WorkbookSelectedNodeEventName = "workbook:selectednodeid:onchange";
|
62
63
|
var WorkbookPivotTableCellSelectEventName = "workbook:pivottable:oncellselect";
|
63
64
|
var WorkbookChartValueSelectEventName = "workbook:chart:onvalueselect";
|
64
65
|
var WorkbookCurrentVariablesEventName = "workbook:variables:current";
|
@@ -77,6 +78,7 @@ var WorkbookVariablesListEventName = "workbook:variables:list";
|
|
77
78
|
var WorkbookVariablesUpdateEventName = "workbook:variables:update";
|
78
79
|
var WorkbookVariablesCurrentEventName = "workbook:variables:current";
|
79
80
|
var WorkbookSharingLinkUpdateEventName = "workbook:sharinglink:update";
|
81
|
+
var ActionOutboundEventName = "action:outbound";
|
80
82
|
|
81
83
|
// src/wrapper.ts
|
82
84
|
var checkEventOrigin = (url) => {
|
@@ -148,9 +150,9 @@ var workbookPageHeightListener = (event, iframe, onPageHeight) => {
|
|
148
150
|
}
|
149
151
|
}
|
150
152
|
};
|
151
|
-
var
|
153
|
+
var workbookSelectedNodeListener = (event, iframe, onPageSelectedNode) => {
|
152
154
|
if (event.source === iframe.contentWindow && checkEventOrigin(event.origin)) {
|
153
|
-
if (event.data.type ===
|
155
|
+
if (event.data.type === WorkbookSelectedNodeEventName) {
|
154
156
|
onPageSelectedNode(event.data);
|
155
157
|
}
|
156
158
|
}
|
@@ -225,6 +227,13 @@ var workbookIdOnChangeListener = (event, iframe, onWorkbookIdChange) => {
|
|
225
227
|
}
|
226
228
|
}
|
227
229
|
};
|
230
|
+
var actionOutboundListener = (event, iframe, onActionOutbound) => {
|
231
|
+
if (event.source === iframe.contentWindow && checkEventOrigin(event.origin)) {
|
232
|
+
if (event.data.type === ActionOutboundEventName) {
|
233
|
+
onActionOutbound(event.data);
|
234
|
+
}
|
235
|
+
}
|
236
|
+
};
|
228
237
|
|
229
238
|
// src/mutations.ts
|
230
239
|
var sendIframeMessage = (iframe, message) => {
|
@@ -280,6 +289,7 @@ var workbookSharingLinkUpdate = (iframe, sharingLink, sharingExplorationLink) =>
|
|
280
289
|
};
|
281
290
|
// Annotate the CommonJS export names for ESM import in node:
|
282
291
|
0 && (module.exports = {
|
292
|
+
actionOutboundListener,
|
283
293
|
urlOnChangeListener,
|
284
294
|
workbookBookmarkCreate,
|
285
295
|
workbookBookmarkCreateListener,
|
@@ -297,10 +307,10 @@ var workbookSharingLinkUpdate = (iframe, sharingLink, sharingExplorationLink) =>
|
|
297
307
|
workbookLinkSharingUpdateListener,
|
298
308
|
workbookLoadedListener,
|
299
309
|
workbookPageHeightListener,
|
300
|
-
workbookPageSelectedNodeListener,
|
301
310
|
workbookPivotTableCellSelectListener,
|
302
311
|
workbookPublishedListener,
|
303
312
|
workbookSelectedNodeIdUpdate,
|
313
|
+
workbookSelectedNodeListener,
|
304
314
|
workbookSharingLinkUpdate,
|
305
315
|
workbookTableCellSelectListener,
|
306
316
|
workbookVariableChangeListener,
|
package/dist/index.mjs
CHANGED
@@ -6,7 +6,7 @@ var WorkbookTableCellSelectEventName = "workbook:table:oncellselect";
|
|
6
6
|
var WorkbookPublishedEventName = "workbook:published";
|
7
7
|
var WorkbookFullScreenEventName = "workbook:fullscreen:onchange";
|
8
8
|
var WorkbookPageHeightEventName = "workbook:pageheight:onchange";
|
9
|
-
var
|
9
|
+
var WorkbookSelectedNodeEventName = "workbook:selectednodeid:onchange";
|
10
10
|
var WorkbookPivotTableCellSelectEventName = "workbook:pivottable:oncellselect";
|
11
11
|
var WorkbookChartValueSelectEventName = "workbook:chart:onvalueselect";
|
12
12
|
var WorkbookCurrentVariablesEventName = "workbook:variables:current";
|
@@ -25,6 +25,7 @@ var WorkbookVariablesListEventName = "workbook:variables:list";
|
|
25
25
|
var WorkbookVariablesUpdateEventName = "workbook:variables:update";
|
26
26
|
var WorkbookVariablesCurrentEventName = "workbook:variables:current";
|
27
27
|
var WorkbookSharingLinkUpdateEventName = "workbook:sharinglink:update";
|
28
|
+
var ActionOutboundEventName = "action:outbound";
|
28
29
|
|
29
30
|
// src/wrapper.ts
|
30
31
|
var checkEventOrigin = (url) => {
|
@@ -96,9 +97,9 @@ var workbookPageHeightListener = (event, iframe, onPageHeight) => {
|
|
96
97
|
}
|
97
98
|
}
|
98
99
|
};
|
99
|
-
var
|
100
|
+
var workbookSelectedNodeListener = (event, iframe, onPageSelectedNode) => {
|
100
101
|
if (event.source === iframe.contentWindow && checkEventOrigin(event.origin)) {
|
101
|
-
if (event.data.type ===
|
102
|
+
if (event.data.type === WorkbookSelectedNodeEventName) {
|
102
103
|
onPageSelectedNode(event.data);
|
103
104
|
}
|
104
105
|
}
|
@@ -173,6 +174,13 @@ var workbookIdOnChangeListener = (event, iframe, onWorkbookIdChange) => {
|
|
173
174
|
}
|
174
175
|
}
|
175
176
|
};
|
177
|
+
var actionOutboundListener = (event, iframe, onActionOutbound) => {
|
178
|
+
if (event.source === iframe.contentWindow && checkEventOrigin(event.origin)) {
|
179
|
+
if (event.data.type === ActionOutboundEventName) {
|
180
|
+
onActionOutbound(event.data);
|
181
|
+
}
|
182
|
+
}
|
183
|
+
};
|
176
184
|
|
177
185
|
// src/mutations.ts
|
178
186
|
var sendIframeMessage = (iframe, message) => {
|
@@ -227,6 +235,7 @@ var workbookSharingLinkUpdate = (iframe, sharingLink, sharingExplorationLink) =>
|
|
227
235
|
});
|
228
236
|
};
|
229
237
|
export {
|
238
|
+
actionOutboundListener,
|
230
239
|
urlOnChangeListener,
|
231
240
|
workbookBookmarkCreate,
|
232
241
|
workbookBookmarkCreateListener,
|
@@ -244,10 +253,10 @@ export {
|
|
244
253
|
workbookLinkSharingUpdateListener,
|
245
254
|
workbookLoadedListener,
|
246
255
|
workbookPageHeightListener,
|
247
|
-
workbookPageSelectedNodeListener,
|
248
256
|
workbookPivotTableCellSelectListener,
|
249
257
|
workbookPublishedListener,
|
250
258
|
workbookSelectedNodeIdUpdate,
|
259
|
+
workbookSelectedNodeListener,
|
251
260
|
workbookSharingLinkUpdate,
|
252
261
|
workbookTableCellSelectListener,
|
253
262
|
workbookVariableChangeListener,
|