Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update version #107

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@thoughtspot/ts-chart-sdk",
"private": false,
"version": "1.3.0-rc.2",
"version": "1.2.6",
"module": "lib/index",
"main": "lib/index",
"types": "lib/index",
Expand Down
12 changes: 2 additions & 10 deletions src/main/custom-chart-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -736,17 +736,9 @@ export class CustomChartContext {
* @param event : Message Event Object
*/
private eventProcessor = (data: any) => {
let eventData = data;
if (typeof data === 'string') {
eventData = JSON.parse(data);
}
logger.log(
'Chart Context: message received:',
eventData.eventType,
eventData,
);
logger.log('Chart Context: message received:', data.eventType, data);

const messageResponse = this.executeEventListenerCBs(eventData);
const messageResponse = this.executeEventListenerCBs(data);

// respond back to parent to confirm/ack the receipt
return messageResponse || {};
Expand Down
16 changes: 8 additions & 8 deletions src/main/post-message-event-bridge.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ describe('postMessageToHostApp', () => {
// Verify that the postMessage function was called with the correct
// arguments
expect(mockPostMessage).toHaveBeenCalledWith(
JSON.stringify({
{
componentId,
payload: eventPayload,
eventType,
source: 'ts-chart-sdk',
}),
},
hostUrl,
[channel.port2],
);
Expand Down Expand Up @@ -110,12 +110,12 @@ describe('postMessageToHostApp', () => {
// Verify that the postMessage function was called with the correct
// arguments
expect(mockPostMessage).toHaveBeenCalledWith(
JSON.stringify({
{
componentId,
payload: eventPayload,
eventType,
source: 'ts-chart-sdk',
}),
},
hostUrl,
[channel.port2],
);
Expand Down Expand Up @@ -154,12 +154,12 @@ describe('postMessageToHostApp', () => {
);

expect(mockPostMessage).toHaveBeenCalledWith(
JSON.stringify({
{
componentId,
payload: eventPayload,
eventType,
source: 'ts-chart-sdk',
}),
},
hostUrl,
expect.any(Array),
);
Expand Down Expand Up @@ -201,12 +201,12 @@ describe('postMessageToHostApp', () => {
await expect(promise).rejects.toThrow('Some postMessage error');

expect(mockPostMessage).toHaveBeenCalledWith(
JSON.stringify({
{
componentId,
payload: eventPayload,
eventType,
source: 'ts-chart-sdk',
}),
},
hostUrl,
expect.any(Array),
);
Expand Down
4 changes: 2 additions & 2 deletions src/main/post-message-event-bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ const postMessageToHostApp = async (
const resp = await timeout(
sendMessage(
target,
JSON.stringify({
{
componentId,
payload: {
...eventPayload,
},
eventType,
source: 'ts-chart-sdk',
}),
},
{
origin: hostUrl,
endpoint: 'child',
Expand Down
Loading