@thoughtspot/ts-chart-sdk 0.0.1-alpha.9 → 0.0.2-alpha.2
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.
- package/lib/main/custom-chart-context.d.ts +8 -1
- package/lib/main/custom-chart-context.d.ts.map +1 -1
- package/lib/main/custom-chart-context.js +29 -32
- package/lib/main/custom-chart-context.js.map +1 -1
- package/lib/main/custom-chart-context.spec.js +107 -260
- package/lib/main/custom-chart-context.spec.js.map +1 -1
- package/lib/main/post-message-event-bridge.d.ts +3 -3
- package/lib/main/post-message-event-bridge.d.ts.map +1 -1
- package/lib/main/post-message-event-bridge.js +24 -36
- package/lib/main/post-message-event-bridge.js.map +1 -1
- package/lib/main/post-message-event-bridge.spec.js +0 -2
- package/lib/main/post-message-event-bridge.spec.js.map +1 -1
- package/lib/main/util.d.ts +2 -0
- package/lib/main/util.d.ts.map +1 -0
- package/lib/main/util.js +9 -0
- package/lib/main/util.js.map +1 -0
- package/lib/react/use-custom-chart-context.spec.js +74 -119
- package/lib/react/use-custom-chart-context.spec.js.map +1 -1
- package/lib/types/common.types.d.ts +1 -0
- package/lib/types/common.types.d.ts.map +1 -1
- package/lib/types/ts-to-chart-event.types.d.ts +3 -0
- package/lib/types/ts-to-chart-event.types.d.ts.map +1 -1
- package/lib/types/ts-to-chart-event.types.js.map +1 -1
- package/package.json +5 -4
- package/src/main/custom-chart-context.spec.ts +116 -269
- package/src/main/custom-chart-context.ts +49 -38
- package/src/main/post-message-event-bridge.spec.ts +0 -3
- package/src/main/post-message-event-bridge.ts +36 -62
- package/src/main/util.ts +11 -0
- package/src/react/use-custom-chart-context.spec.tsx +84 -120
- package/src/types/common.types.ts +1 -1
- package/src/types/ts-to-chart-event.types.ts +14 -0
- package/cjs/index.d.ts +0 -9
- package/cjs/index.d.ts.map +0 -1
- package/cjs/index.js +0 -25
- package/cjs/index.js.map +0 -1
- package/cjs/main/custom-chart-context.d.ts +0 -47
- package/cjs/main/custom-chart-context.d.ts.map +0 -1
- package/cjs/main/custom-chart-context.js +0 -326
- package/cjs/main/custom-chart-context.js.map +0 -1
- package/cjs/main/custom-chart-context.spec.d.ts +0 -2
- package/cjs/main/custom-chart-context.spec.d.ts.map +0 -1
- package/cjs/main/custom-chart-context.spec.js +0 -699
- package/cjs/main/custom-chart-context.spec.js.map +0 -1
- package/cjs/main/post-message-event-bridge.d.ts +0 -6
- package/cjs/main/post-message-event-bridge.d.ts.map +0 -1
- package/cjs/main/post-message-event-bridge.js +0 -46
- package/cjs/main/post-message-event-bridge.js.map +0 -1
- package/cjs/main/post-message-event-bridge.spec.d.ts +0 -2
- package/cjs/main/post-message-event-bridge.spec.d.ts.map +0 -1
- package/cjs/main/post-message-event-bridge.spec.js +0 -124
- package/cjs/main/post-message-event-bridge.spec.js.map +0 -1
- package/cjs/react/custom-chart-context-service.d.ts +0 -33
- package/cjs/react/custom-chart-context-service.d.ts.map +0 -1
- package/cjs/react/custom-chart-context-service.js +0 -118
- package/cjs/react/custom-chart-context-service.js.map +0 -1
- package/cjs/react/custom-chart.context.d.ts +0 -26
- package/cjs/react/custom-chart.context.d.ts.map +0 -1
- package/cjs/react/custom-chart.context.js +0 -105
- package/cjs/react/custom-chart.context.js.map +0 -1
- package/cjs/react/custom-chart.spec.d.ts +0 -2
- package/cjs/react/custom-chart.spec.d.ts.map +0 -1
- package/cjs/react/custom-chart.spec.js +0 -72
- package/cjs/react/custom-chart.spec.js.map +0 -1
- package/cjs/react/mocks/custom-chart-context-mock.d.ts +0 -3
- package/cjs/react/mocks/custom-chart-context-mock.d.ts.map +0 -1
- package/cjs/react/mocks/custom-chart-context-mock.js +0 -100
- package/cjs/react/mocks/custom-chart-context-mock.js.map +0 -1
- package/cjs/react/use-custom-chart-context.d.ts +0 -4
- package/cjs/react/use-custom-chart-context.d.ts.map +0 -1
- package/cjs/react/use-custom-chart-context.js +0 -95
- package/cjs/react/use-custom-chart-context.js.map +0 -1
- package/cjs/react/use-custom-chart-context.spec.d.ts +0 -2
- package/cjs/react/use-custom-chart-context.spec.d.ts.map +0 -1
- package/cjs/react/use-custom-chart-context.spec.js +0 -391
- package/cjs/react/use-custom-chart-context.spec.js.map +0 -1
- package/cjs/react/use-custom-chart-context.util.d.ts +0 -6
- package/cjs/react/use-custom-chart-context.util.d.ts.map +0 -1
- package/cjs/react/use-custom-chart-context.util.js +0 -60
- package/cjs/react/use-custom-chart-context.util.js.map +0 -1
- package/cjs/react/use-custom-chart-types.d.ts +0 -23
- package/cjs/react/use-custom-chart-types.d.ts.map +0 -1
- package/cjs/react/use-custom-chart-types.js +0 -3
- package/cjs/react/use-custom-chart-types.js.map +0 -1
- package/cjs/test/test-utils.d.ts +0 -7
- package/cjs/test/test-utils.d.ts.map +0 -1
- package/cjs/test/test-utils.js +0 -14
- package/cjs/test/test-utils.js.map +0 -1
- package/cjs/types/answer-column.types.d.ts +0 -69
- package/cjs/types/answer-column.types.d.ts.map +0 -1
- package/cjs/types/answer-column.types.js +0 -59
- package/cjs/types/answer-column.types.js.map +0 -1
- package/cjs/types/chart-to-ts-event.types.d.ts +0 -98
- package/cjs/types/chart-to-ts-event.types.d.ts.map +0 -1
- package/cjs/types/chart-to-ts-event.types.js +0 -32
- package/cjs/types/chart-to-ts-event.types.js.map +0 -1
- package/cjs/types/common.types.d.ts +0 -51
- package/cjs/types/common.types.d.ts.map +0 -1
- package/cjs/types/common.types.js +0 -3
- package/cjs/types/common.types.js.map +0 -1
- package/cjs/types/configurator.types.d.ts +0 -15
- package/cjs/types/configurator.types.d.ts.map +0 -1
- package/cjs/types/configurator.types.js +0 -3
- package/cjs/types/configurator.types.js.map +0 -1
- package/cjs/types/ts-to-chart-event.types.d.ts +0 -91
- package/cjs/types/ts-to-chart-event.types.d.ts.map +0 -1
- package/cjs/types/ts-to-chart-event.types.js +0 -18
- package/cjs/types/ts-to-chart-event.types.js.map +0 -1
- package/cjs/types/visual-prop.types.d.ts +0 -73
- package/cjs/types/visual-prop.types.d.ts.map +0 -1
- package/cjs/types/visual-prop.types.js +0 -3
- package/cjs/types/visual-prop.types.js.map +0 -1
- package/dist/ts-chart-sdk.d.ts +0 -312
- package/lib/dist/ts-chart-sdk.d.ts +0 -312
- package/lib/react/custom-chart-context-service.d.ts +0 -33
- package/lib/react/custom-chart-context-service.d.ts.map +0 -1
- package/lib/react/custom-chart-context-service.js +0 -91
- package/lib/react/custom-chart-context-service.js.map +0 -1
- package/lib/react/custom-chart.context.d.ts +0 -26
- package/lib/react/custom-chart.context.d.ts.map +0 -1
- package/lib/react/custom-chart.context.js +0 -78
- package/lib/react/custom-chart.context.js.map +0 -1
- package/lib/react/custom-chart.spec.d.ts +0 -2
- package/lib/react/custom-chart.spec.d.ts.map +0 -1
- package/lib/react/custom-chart.spec.js +0 -67
- package/lib/react/custom-chart.spec.js.map +0 -1
|
@@ -43,9 +43,16 @@ import {
|
|
|
43
43
|
VisualPropsValidateEventPayload,
|
|
44
44
|
} from '../types/ts-to-chart-event.types';
|
|
45
45
|
import { VisualPropEditorDefinition } from '../types/visual-prop.types';
|
|
46
|
-
import
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
import {
|
|
47
|
+
globalThis,
|
|
48
|
+
initMessageListener,
|
|
49
|
+
postMessageToHostApp,
|
|
50
|
+
} from './post-message-event-bridge';
|
|
51
|
+
|
|
52
|
+
export type AllowedConfigurations = {
|
|
53
|
+
allowColumnNumberFormatting: boolean;
|
|
54
|
+
allowColumnConditionalFormatting: boolean;
|
|
55
|
+
};
|
|
49
56
|
|
|
50
57
|
export type CustomChartContextProps = {
|
|
51
58
|
/**
|
|
@@ -63,7 +70,10 @@ export type CustomChartContextProps = {
|
|
|
63
70
|
* @returns {@link Array<Query>}
|
|
64
71
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
65
72
|
*/
|
|
66
|
-
getQueriesFromChartConfig: (
|
|
73
|
+
getQueriesFromChartConfig: (
|
|
74
|
+
chartConfig: ChartConfig[],
|
|
75
|
+
chartModel: ChartModel,
|
|
76
|
+
) => Query[];
|
|
67
77
|
/**
|
|
68
78
|
* Main Render function that will render the chart based on the chart context provided
|
|
69
79
|
*
|
|
@@ -118,6 +128,9 @@ export type CustomChartContextProps = {
|
|
|
118
128
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
119
129
|
*/
|
|
120
130
|
visualPropEditorDefinition?: VisualPropEditorDefinition;
|
|
131
|
+
|
|
132
|
+
// Whether user wants thoughtspot default number and conditional formatting
|
|
133
|
+
allowedConfigurations?: AllowedConfigurations;
|
|
121
134
|
};
|
|
122
135
|
|
|
123
136
|
/**
|
|
@@ -127,6 +140,10 @@ const DEFAULT_CHART_CONTEXT_PROPS: Partial<CustomChartContextProps> = {
|
|
|
127
140
|
validateConfig: () => ({ isValid: true }),
|
|
128
141
|
validateVisualProps: () => ({ isValid: true }),
|
|
129
142
|
chartConfigEditorDefinition: undefined,
|
|
143
|
+
allowedConfigurations: {
|
|
144
|
+
allowColumnNumberFormatting: false,
|
|
145
|
+
allowColumnConditionalFormatting: false,
|
|
146
|
+
},
|
|
130
147
|
};
|
|
131
148
|
|
|
132
149
|
export class CustomChartContext {
|
|
@@ -141,6 +158,8 @@ export class CustomChartContext {
|
|
|
141
158
|
*/
|
|
142
159
|
private componentId = '';
|
|
143
160
|
|
|
161
|
+
private removeListener: () => void = _.noop;
|
|
162
|
+
|
|
144
163
|
/**
|
|
145
164
|
* host app url
|
|
146
165
|
*
|
|
@@ -217,6 +236,8 @@ export class CustomChartContext {
|
|
|
217
236
|
*/
|
|
218
237
|
private axisMenuActionHandler: AxisMenuActionHandler = {};
|
|
219
238
|
|
|
239
|
+
public containerEl: HTMLElement | null = null;
|
|
240
|
+
|
|
220
241
|
/**
|
|
221
242
|
* Constructor to only accept context props as payload
|
|
222
243
|
*
|
|
@@ -305,8 +326,8 @@ export class CustomChartContext {
|
|
|
305
326
|
* @version SDK: 0.1 | ThoughtSpot:
|
|
306
327
|
*/
|
|
307
328
|
public destroy() {
|
|
308
|
-
|
|
309
|
-
isInitialized = false;
|
|
329
|
+
this.removeListener();
|
|
330
|
+
globalThis.isInitialized = false;
|
|
310
331
|
}
|
|
311
332
|
|
|
312
333
|
/**
|
|
@@ -429,7 +450,7 @@ export class CustomChartContext {
|
|
|
429
450
|
eventType: T,
|
|
430
451
|
...eventPayload: ChartToTSEventsPayloadMap[T]
|
|
431
452
|
): Promise<any> {
|
|
432
|
-
if (!isInitialized) {
|
|
453
|
+
if (!globalThis.isInitialized) {
|
|
433
454
|
console.log(
|
|
434
455
|
'Chart Context: not initialized the context, something went wrong',
|
|
435
456
|
);
|
|
@@ -439,7 +460,7 @@ export class CustomChartContext {
|
|
|
439
460
|
eventType,
|
|
440
461
|
eventPayload,
|
|
441
462
|
);
|
|
442
|
-
return
|
|
463
|
+
return postMessageToHostApp(
|
|
443
464
|
this.componentId,
|
|
444
465
|
this.hostUrl,
|
|
445
466
|
processedPayload?.[0] ?? null,
|
|
@@ -452,13 +473,13 @@ export class CustomChartContext {
|
|
|
452
473
|
* Process all the functions via the eventProcess callback
|
|
453
474
|
*/
|
|
454
475
|
private registerEventProcessor = () => {
|
|
455
|
-
if (isInitialized) {
|
|
476
|
+
if (globalThis.isInitialized) {
|
|
456
477
|
console.error(
|
|
457
478
|
'The context is already initialized. you cannot have multiple contexts',
|
|
458
479
|
);
|
|
459
480
|
throw new Error(ErrorType.MultipleContextsNotSupported);
|
|
460
481
|
}
|
|
461
|
-
|
|
482
|
+
this.removeListener = initMessageListener(this.eventProcessor);
|
|
462
483
|
|
|
463
484
|
this.registerEvents();
|
|
464
485
|
};
|
|
@@ -468,29 +489,13 @@ export class CustomChartContext {
|
|
|
468
489
|
*
|
|
469
490
|
* @param event : Message Event Object
|
|
470
491
|
*/
|
|
471
|
-
private eventProcessor = (
|
|
472
|
-
|
|
473
|
-
return;
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
console.log(
|
|
477
|
-
'Chart Context: message received:',
|
|
478
|
-
event.data.eventType,
|
|
479
|
-
event.data,
|
|
480
|
-
);
|
|
492
|
+
private eventProcessor = (data: any) => {
|
|
493
|
+
console.log('Chart Context: message received:', data.eventType, data);
|
|
481
494
|
|
|
482
|
-
const messageResponse = this.executeEventListenerCBs(
|
|
495
|
+
const messageResponse = this.executeEventListenerCBs(data);
|
|
483
496
|
|
|
484
497
|
// respond back to parent to confirm/ack the receipt
|
|
485
|
-
|
|
486
|
-
if (!_.isNil(messageResponse)) {
|
|
487
|
-
event.ports[0].postMessage({
|
|
488
|
-
...(messageResponse as any),
|
|
489
|
-
});
|
|
490
|
-
} else {
|
|
491
|
-
event.ports[0].postMessage({});
|
|
492
|
-
}
|
|
493
|
-
}
|
|
498
|
+
return messageResponse;
|
|
494
499
|
};
|
|
495
500
|
|
|
496
501
|
/**
|
|
@@ -570,6 +575,7 @@ export class CustomChartContext {
|
|
|
570
575
|
const queries =
|
|
571
576
|
this.chartContextProps.getQueriesFromChartConfig(
|
|
572
577
|
payload.config,
|
|
578
|
+
this.chartModel,
|
|
573
579
|
);
|
|
574
580
|
return {
|
|
575
581
|
queries,
|
|
@@ -743,13 +749,16 @@ export class CustomChartContext {
|
|
|
743
749
|
this.hostUrl = payload.hostUrl;
|
|
744
750
|
this.chartModel = payload.chartModel;
|
|
745
751
|
this.appConfig = payload.appConfig ?? {};
|
|
752
|
+
this.containerEl = payload.containerElSelector
|
|
753
|
+
? document.querySelector(payload.containerElSelector)
|
|
754
|
+
: null;
|
|
746
755
|
|
|
747
756
|
return this.publishChartContextPropsToHost();
|
|
748
757
|
};
|
|
749
758
|
|
|
750
759
|
private initializationComplete = (): void => {
|
|
751
760
|
// context is now initialized
|
|
752
|
-
isInitialized = true;
|
|
761
|
+
globalThis.isInitialized = true;
|
|
753
762
|
|
|
754
763
|
// TODO: following can be done behind a promise
|
|
755
764
|
this.triggerInitResolve();
|
|
@@ -783,6 +792,8 @@ export class CustomChartContext {
|
|
|
783
792
|
this.chartContextProps.chartConfigEditorDefinition,
|
|
784
793
|
visualPropEditorDefinition:
|
|
785
794
|
this.chartContextProps.visualPropEditorDefinition,
|
|
795
|
+
allowedConfigurations:
|
|
796
|
+
this.chartContextProps.allowedConfigurations,
|
|
786
797
|
};
|
|
787
798
|
};
|
|
788
799
|
|
|
@@ -792,12 +803,12 @@ export class CustomChartContext {
|
|
|
792
803
|
* @param event : Message Event Object
|
|
793
804
|
* @returns response to be sent back to the message sender (host)
|
|
794
805
|
*/
|
|
795
|
-
private executeEventListenerCBs = (
|
|
806
|
+
private executeEventListenerCBs = (data: any): any => {
|
|
796
807
|
// do basic sanity
|
|
797
|
-
const payload =
|
|
808
|
+
const payload = data.payload;
|
|
798
809
|
let response;
|
|
799
|
-
if (_.isArray(this.eventListeners[
|
|
800
|
-
this.eventListeners[
|
|
810
|
+
if (_.isArray(this.eventListeners[data.eventType])) {
|
|
811
|
+
this.eventListeners[data.eventType].forEach((callback) => {
|
|
801
812
|
// this is a problem today if we have multiple callbacks
|
|
802
813
|
// registered. only the last response will be sent back to the
|
|
803
814
|
// server
|
|
@@ -806,15 +817,15 @@ export class CustomChartContext {
|
|
|
806
817
|
} else {
|
|
807
818
|
response = {
|
|
808
819
|
hasError: true,
|
|
809
|
-
error: `Event type not recognised or processed: ${
|
|
820
|
+
error: `Event type not recognised or processed: ${data.eventType}`,
|
|
810
821
|
};
|
|
811
822
|
}
|
|
812
823
|
|
|
813
824
|
console.log(
|
|
814
825
|
'ChartContext: Response:',
|
|
815
|
-
|
|
826
|
+
data.eventType,
|
|
816
827
|
response,
|
|
817
|
-
this.eventListeners[
|
|
828
|
+
this.eventListeners[data.eventType]?.length,
|
|
818
829
|
);
|
|
819
830
|
return response;
|
|
820
831
|
};
|
|
@@ -66,7 +66,6 @@ describe('postMessageToHostApp', () => {
|
|
|
66
66
|
);
|
|
67
67
|
|
|
68
68
|
// Verify that the MessageChannel was used correctly
|
|
69
|
-
expect(channel.port1.close).toHaveBeenCalled();
|
|
70
69
|
expect(messageChannelMock.MessageChannel).toHaveBeenCalled();
|
|
71
70
|
});
|
|
72
71
|
|
|
@@ -121,8 +120,6 @@ describe('postMessageToHostApp', () => {
|
|
|
121
120
|
[channel.port2],
|
|
122
121
|
);
|
|
123
122
|
|
|
124
|
-
// Verify that the MessageChannel was used correctly
|
|
125
|
-
expect(channel.port1.close).toHaveBeenCalled();
|
|
126
123
|
expect(messageChannelMock.MessageChannel).toHaveBeenCalled();
|
|
127
124
|
});
|
|
128
125
|
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
+
import { onMessage, sendMessage } from 'promise-postmessage';
|
|
1
2
|
import { ChartToTSEvent } from '../types/chart-to-ts-event.types';
|
|
3
|
+
import { timeout } from './util';
|
|
2
4
|
|
|
3
5
|
const TIMEOUT_THRESHOLD = 30000; // 30sec
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
window.addEventListener('message', handleMessageEvent);
|
|
12
|
-
};
|
|
7
|
+
const elSelector = new URL(import.meta.url).searchParams.get('elSelector');
|
|
8
|
+
const target =
|
|
9
|
+
(elSelector && (document.querySelector(elSelector) as HTMLElement)) ||
|
|
10
|
+
window.parent;
|
|
11
|
+
|
|
12
|
+
const globalThis = (target === window.parent ? window : target) as any;
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* method to listen to messages using postMessage from the parent.
|
|
16
16
|
*
|
|
17
17
|
* @param {any} handleMessageEvent
|
|
18
18
|
*/
|
|
19
|
-
const
|
|
20
|
-
|
|
19
|
+
const init = (handleMessageEvent: (data: any) => Promise<any> | any) => {
|
|
20
|
+
return onMessage(handleMessageEvent, target, 'child');
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
/**
|
|
@@ -28,61 +28,35 @@ const destroy = (handleMessageEvent: any) => {
|
|
|
28
28
|
* @param {ChartToTSEvent} eventType type of the event
|
|
29
29
|
* @returns Promise
|
|
30
30
|
*/
|
|
31
|
-
const postMessageToHostApp = (
|
|
31
|
+
const postMessageToHostApp = async (
|
|
32
32
|
componentId: string,
|
|
33
33
|
hostUrl: string,
|
|
34
34
|
eventPayload: any,
|
|
35
35
|
eventType: ChartToTSEvent,
|
|
36
|
-
): Promise<any> =>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
reject(error);
|
|
45
|
-
} else {
|
|
46
|
-
console.log('ChartContext: message success:', res.data);
|
|
47
|
-
resolve(res.data);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
setTimeout(() => {
|
|
52
|
-
reject(
|
|
53
|
-
new Error(
|
|
54
|
-
`ChartContext: postMessage operation timed out. ${eventType}`,
|
|
55
|
-
eventPayload,
|
|
56
|
-
),
|
|
57
|
-
);
|
|
58
|
-
}, TIMEOUT_THRESHOLD);
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
window.parent.window.postMessage(
|
|
62
|
-
{
|
|
63
|
-
componentId,
|
|
64
|
-
payload: {
|
|
65
|
-
...eventPayload,
|
|
66
|
-
},
|
|
67
|
-
eventType,
|
|
68
|
-
source: 'ts-chart-sdk',
|
|
36
|
+
): Promise<any> => {
|
|
37
|
+
const resp = await timeout(
|
|
38
|
+
sendMessage(
|
|
39
|
+
target,
|
|
40
|
+
{
|
|
41
|
+
componentId,
|
|
42
|
+
payload: {
|
|
43
|
+
...eventPayload,
|
|
69
44
|
},
|
|
70
|
-
hostUrl,
|
|
71
|
-
[channel.port2],
|
|
72
|
-
);
|
|
73
|
-
} catch (err) {
|
|
74
|
-
console.error(
|
|
75
|
-
'ChartContext: error in emitting event:',
|
|
76
|
-
err,
|
|
77
45
|
eventType,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
46
|
+
source: 'ts-chart-sdk',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
origin: hostUrl,
|
|
50
|
+
endpoint: 'child',
|
|
51
|
+
},
|
|
52
|
+
),
|
|
53
|
+
TIMEOUT_THRESHOLD,
|
|
54
|
+
'ChartContext: postMessage operation timed out.',
|
|
55
|
+
);
|
|
56
|
+
if (resp.hasError) {
|
|
57
|
+
throw new Error(resp.error);
|
|
58
|
+
}
|
|
59
|
+
return resp;
|
|
88
60
|
};
|
|
61
|
+
|
|
62
|
+
export { init as initMessageListener, postMessageToHostApp, globalThis };
|
package/src/main/util.ts
ADDED