@thoughtspot/visual-embed-sdk 1.12.0-alpha.1 → 1.12.0-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/dist/src/errors.d.ts +1 -0
- package/dist/tsembed.es.js +8 -1
- package/dist/tsembed.js +8 -1
- package/lib/package.json +1 -1
- package/lib/src/errors.d.ts +1 -0
- package/lib/src/errors.js +1 -0
- package/lib/src/errors.js.map +1 -1
- package/lib/src/utils/processTrigger.js +7 -0
- package/lib/src/utils/processTrigger.js.map +1 -1
- package/package.json +1 -1
- package/src/errors.ts +1 -0
- package/src/utils/processTrigger.ts +9 -0
package/dist/src/errors.d.ts
CHANGED
package/dist/tsembed.es.js
CHANGED
|
@@ -745,6 +745,7 @@ var OperationType;
|
|
|
745
745
|
const ERROR_MESSAGE = {
|
|
746
746
|
INVALID_THOUGHTSPOT_HOST: 'Error parsing ThoughtSpot host. Please provide a valid URL.',
|
|
747
747
|
LIVEBOARD_VIZ_ID_VALIDATION: 'Please provide either liveboardId or pinboardId',
|
|
748
|
+
TRIGGER_TIMED_OUT: 'Trigger timedout in getting response',
|
|
748
749
|
};
|
|
749
750
|
|
|
750
751
|
/**
|
|
@@ -7736,6 +7737,7 @@ function postIframeMessage(iFrame, message, thoughtSpotHost, channel) {
|
|
|
7736
7737
|
channel === null || channel === void 0 ? void 0 : channel.port2,
|
|
7737
7738
|
]);
|
|
7738
7739
|
}
|
|
7740
|
+
const TRIGGER_TIMEOUT = 30000;
|
|
7739
7741
|
function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
7740
7742
|
return new Promise((res, rej) => {
|
|
7741
7743
|
if (messageType === HostEvent.Reload) {
|
|
@@ -7752,11 +7754,16 @@ function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
7752
7754
|
res(responseData);
|
|
7753
7755
|
}
|
|
7754
7756
|
};
|
|
7757
|
+
// Close the messageChannel and resolve the promise if timeout.
|
|
7758
|
+
setTimeout(() => {
|
|
7759
|
+
channel.port1.close();
|
|
7760
|
+
res(new Error(ERROR_MESSAGE.TRIGGER_TIMED_OUT));
|
|
7761
|
+
}, TRIGGER_TIMEOUT);
|
|
7755
7762
|
return postIframeMessage(iFrame, { type: messageType, data }, thoughtSpotHost, channel);
|
|
7756
7763
|
});
|
|
7757
7764
|
}
|
|
7758
7765
|
|
|
7759
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.12.0-alpha.
|
|
7766
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.12.0-alpha.2";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**"];var exports={".":"./lib/src/index.js","./react":"./lib/src/react/index.js"};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs && npx istanbul-merge --out ./coverage/coverage.json ./coverage/docs/coverage-final.json ./coverage/sdk/coverage-final.json && npx istanbul report --include ./coverage/coverage.json --dir ./coverage lcov",posttest:"cat ./coverage/sdk/lcov.info | coveralls",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run build","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",eventemitter3:"^4.0.7","mixpanel-browser":"^2.45.0"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","dts-bundle":"0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.1.0","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"4.1.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^4.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-neo-theme":"^1.1.0","typedoc-plugin-toc-group":"0.0.5",typescript:"^4.1.0","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports,scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
|
|
7760
7767
|
|
|
7761
7768
|
/**
|
|
7762
7769
|
* Copyright (c) 2022
|
package/dist/tsembed.js
CHANGED
|
@@ -714,6 +714,7 @@
|
|
|
714
714
|
const ERROR_MESSAGE = {
|
|
715
715
|
INVALID_THOUGHTSPOT_HOST: 'Error parsing ThoughtSpot host. Please provide a valid URL.',
|
|
716
716
|
LIVEBOARD_VIZ_ID_VALIDATION: 'Please provide either liveboardId or pinboardId',
|
|
717
|
+
TRIGGER_TIMED_OUT: 'Trigger timedout in getting response',
|
|
717
718
|
};
|
|
718
719
|
|
|
719
720
|
/**
|
|
@@ -7703,6 +7704,7 @@
|
|
|
7703
7704
|
channel === null || channel === void 0 ? void 0 : channel.port2,
|
|
7704
7705
|
]);
|
|
7705
7706
|
}
|
|
7707
|
+
const TRIGGER_TIMEOUT = 30000;
|
|
7706
7708
|
function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
7707
7709
|
return new Promise((res, rej) => {
|
|
7708
7710
|
if (messageType === exports.HostEvent.Reload) {
|
|
@@ -7719,11 +7721,16 @@
|
|
|
7719
7721
|
res(responseData);
|
|
7720
7722
|
}
|
|
7721
7723
|
};
|
|
7724
|
+
// Close the messageChannel and resolve the promise if timeout.
|
|
7725
|
+
setTimeout(() => {
|
|
7726
|
+
channel.port1.close();
|
|
7727
|
+
res(new Error(ERROR_MESSAGE.TRIGGER_TIMED_OUT));
|
|
7728
|
+
}, TRIGGER_TIMEOUT);
|
|
7722
7729
|
return postIframeMessage(iFrame, { type: messageType, data }, thoughtSpotHost, channel);
|
|
7723
7730
|
});
|
|
7724
7731
|
}
|
|
7725
7732
|
|
|
7726
|
-
var name="@thoughtspot/visual-embed-sdk";var version="1.12.0-alpha.
|
|
7733
|
+
var name="@thoughtspot/visual-embed-sdk";var version="1.12.0-alpha.2";var description="ThoughtSpot Embed SDK";var module="lib/src/index.js";var main="dist/tsembed.js";var types="lib/src/index.d.ts";var files=["dist/**","lib/**","src/**"];var exports$1={".":"./lib/src/index.js","./react":"./lib/src/react/index.js"};var scripts={lint:"eslint 'src/**'","lint:fix":"eslint 'src/**/*.*' --fix",tsc:"tsc -p . --incremental false",start:"gatsby develop","build:gatsby":"npm run clean:gatsby && gatsby build --prefix-paths","build:gatsby:noprefix":"npm run clean:gatsby && gatsby build","serve:gatsby":"gatsby serve","clean:gatsby":"gatsby clean","build-and-publish":"npm run build:gatsby && npm run publish","bundle-dts":"dts-bundle --name @thoughtspot/visual-embed-sdk --out visual-embed-sdk.d.ts --main lib/src/index.d.ts",build:"rollup -c",watch:"rollup -cw","docs-cmd":"node scripts/gatsby-commands.js",docgen:"typedoc --tsconfig tsconfig.json --theme typedoc-theme","test-sdk":"jest -c jest.config.sdk.js","test-docs":"jest -c jest.config.docs.js",test:"npm run test-sdk && npm run test-docs && npx istanbul-merge --out ./coverage/coverage.json ./coverage/docs/coverage-final.json ./coverage/sdk/coverage-final.json && npx istanbul report --include ./coverage/coverage.json --dir ./coverage lcov",posttest:"cat ./coverage/sdk/lcov.info | coveralls",prepublishOnly:"npm run test; npm run tsc; npm run bundle-dts; npm run build","publish-dev":"npm publish --tag dev","publish-prod":"npm publish --tag latest"};var peerDependencies={react:"> 16.8.0","react-dom":"> 16.8.0"};var dependencies={algoliasearch:"^4.10.5",classnames:"^2.3.1",eventemitter3:"^4.0.7","mixpanel-browser":"^2.45.0"};var devDependencies={"@mdx-js/mdx":"^1.6.22","@mdx-js/react":"^1.6.22","@react-icons/all-files":"^4.1.0","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^11.2.1","@testing-library/dom":"^7.31.0","@testing-library/jest-dom":"^5.14.1","@testing-library/react":"^11.2.7","@testing-library/user-event":"^13.1.8","@types/jest":"^22.2.3","@types/mixpanel-browser":"^2.35.6","@types/react-test-renderer":"^17.0.1","@typescript-eslint/eslint-plugin":"^4.6.0","@typescript-eslint/parser":"^4.6.0",asciidoctor:"^2.2.1","babel-jest":"^26.6.3","babel-preset-gatsby":"^1.10.0","command-line-args":"^5.1.1",coveralls:"^3.1.0","dts-bundle":"0.7.3",eslint:"^7.12.1","eslint-config-airbnb-base":"^14.2.0","eslint-config-prettier":"^6.15.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-import":"^2.22.1","eslint-plugin-prettier":"^3.1.4","eslint-plugin-react-hooks":"^4.2.0","fs-extra":"^10.0.0",gatsby:"3.1.0","gatsby-plugin-algolia":"^0.22.2","gatsby-plugin-catch-links":"^3.1.0","gatsby-plugin-env-variables":"^2.1.0","gatsby-plugin-intl":"^0.3.3","gatsby-plugin-manifest":"^3.2.0","gatsby-plugin-output":"^0.1.3","gatsby-plugin-sass":"4.1.0","gatsby-plugin-sitemap":"^4.10.0","gatsby-source-filesystem":"3.1.0","gatsby-transformer-asciidoc":"2.1.0","gatsby-transformer-rehype":"2.0.0","gh-pages":"^3.1.0","highlight.js":"^10.6.0","html-to-text":"^8.0.0","identity-obj-proxy":"^3.0.0","istanbul-merge":"^1.1.1",jest:"^26.6.3","jest-puppeteer":"^4.4.0",jsdom:"^17.0.0","node-sass":"^4.0.0",prettier:"2.1.2",puppeteer:"^7.0.1",react:"^16.14.0","react-dom":"^16.14.0","react-resizable":"^1.11.0","react-resize-detector":"^6.6.0","react-test-renderer":"^17.0.2","react-use-flexsearch":"^0.1.1",rollup:"2.30.0","rollup-plugin-typescript2":"0.27.3","ts-jest":"^26.5.5","ts-loader":"8.0.4",typedoc:"0.21.6","typedoc-neo-theme":"^1.1.0","typedoc-plugin-toc-group":"0.0.5",typescript:"^4.1.0","url-search-params-polyfill":"^8.1.0",util:"^0.12.4"};var author="ThoughtSpot";var email="support@thoughtspot.com";var license="ThoughtSpot Development Tools End User License Agreement";var directories={lib:"lib"};var repository={type:"git",url:"git+https://github.com/thoughtspot/visual-embed-sdk.git"};var publishConfig={registry:"https://registry.npmjs.org"};var keywords=["thoughtspot","everywhere","embed","sdk","analytics"];var bugs={url:"https://github.com/thoughtspot/visual-embed-sdk/issues"};var homepage="https://github.com/thoughtspot/visual-embed-sdk#readme";var globals={window:{}};var pkgInfo = {name:name,version:version,description:description,module:module,main:main,types:types,files:files,exports:exports$1,scripts:scripts,peerDependencies:peerDependencies,dependencies:dependencies,devDependencies:devDependencies,author:author,email:email,license:license,directories:directories,repository:repository,publishConfig:publishConfig,keywords:keywords,bugs:bugs,homepage:homepage,globals:globals};
|
|
7727
7734
|
|
|
7728
7735
|
/**
|
|
7729
7736
|
* Copyright (c) 2022
|
package/lib/package.json
CHANGED
package/lib/src/errors.d.ts
CHANGED
package/lib/src/errors.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export const ERROR_MESSAGE = {
|
|
2
2
|
INVALID_THOUGHTSPOT_HOST: 'Error parsing ThoughtSpot host. Please provide a valid URL.',
|
|
3
3
|
LIVEBOARD_VIZ_ID_VALIDATION: 'Please provide either liveboardId or pinboardId',
|
|
4
|
+
TRIGGER_TIMED_OUT: 'Trigger timedout in getting response',
|
|
4
5
|
};
|
|
5
6
|
//# sourceMappingURL=errors.js.map
|
package/lib/src/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG;IACzB,wBAAwB,EACpB,6DAA6D;IACjE,2BAA2B,EACvB,iDAAiD;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG;IACzB,wBAAwB,EACpB,6DAA6D;IACjE,2BAA2B,EACvB,iDAAiD;IACrD,iBAAiB,EAAE,sCAAsC;CAC5D,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ERROR_MESSAGE } from '../errors';
|
|
1
2
|
import { HostEvent } from '../types';
|
|
2
3
|
/**
|
|
3
4
|
* Reloads the ThoughtSpot iframe.
|
|
@@ -16,6 +17,7 @@ function postIframeMessage(iFrame, message, thoughtSpotHost, channel) {
|
|
|
16
17
|
channel === null || channel === void 0 ? void 0 : channel.port2,
|
|
17
18
|
]);
|
|
18
19
|
}
|
|
20
|
+
const TRIGGER_TIMEOUT = 30000;
|
|
19
21
|
export function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
20
22
|
return new Promise((res, rej) => {
|
|
21
23
|
if (messageType === HostEvent.Reload) {
|
|
@@ -32,6 +34,11 @@ export function processTrigger(iFrame, messageType, thoughtSpotHost, data) {
|
|
|
32
34
|
res(responseData);
|
|
33
35
|
}
|
|
34
36
|
};
|
|
37
|
+
// Close the messageChannel and resolve the promise if timeout.
|
|
38
|
+
setTimeout(() => {
|
|
39
|
+
channel.port1.close();
|
|
40
|
+
res(new Error(ERROR_MESSAGE.TRIGGER_TIMED_OUT));
|
|
41
|
+
}, TRIGGER_TIMEOUT);
|
|
35
42
|
return postIframeMessage(iFrame, { type: messageType, data }, thoughtSpotHost, channel);
|
|
36
43
|
});
|
|
37
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processTrigger.js","sourceRoot":"","sources":["../../../src/utils/processTrigger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC;;GAEG;AACH,SAAS,MAAM,CAAC,MAAyB;IACrC,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;IACpC,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC;IACjC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,SAAS,iBAAiB,CACtB,MAAyB,EACzB,OAAuC,EACvC,eAAuB,EACvB,OAAwB;IAExB,OAAO,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,OAAO,EAAE,eAAe,EAAE;QAC9D,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK;KACjB,CAAC,CAAC;AACP,CAAC;AAED,MAAM,UAAU,cAAc,CAC1B,MAAyB,EACzB,WAAsB,EACtB,eAAuB,EACvB,IAAS;IAET,OAAO,IAAI,OAAO,CAAM,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACjC,IAAI,WAAW,KAAK,SAAS,CAAC,MAAM,EAAE;YAClC,MAAM,CAAC,MAAM,CAAC,CAAC;YACf,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC;SACpB;QACD,MAAM,OAAO,GAAG,IAAI,cAAc,EAAE,CAAC;QACrC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE;YACjD,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACtB,IAAI,YAAY,CAAC,KAAK,EAAE;gBACpB,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;aAC3B;iBAAM;gBACH,GAAG,CAAC,YAAY,CAAC,CAAC;aACrB;QACL,CAAC,CAAC;QAEF,OAAO,iBAAiB,CACpB,MAAM,EACN,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,EAC3B,eAAe,EACf,OAAO,CACV,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
1
|
+
{"version":3,"file":"processTrigger.js","sourceRoot":"","sources":["../../../src/utils/processTrigger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC;;GAEG;AACH,SAAS,MAAM,CAAC,MAAyB;IACrC,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;IACpC,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC;IACjC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,SAAS,iBAAiB,CACtB,MAAyB,EACzB,OAAuC,EACvC,eAAuB,EACvB,OAAwB;IAExB,OAAO,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,OAAO,EAAE,eAAe,EAAE;QAC9D,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK;KACjB,CAAC,CAAC;AACP,CAAC;AAED,MAAM,eAAe,GAAG,KAAK,CAAC;AAE9B,MAAM,UAAU,cAAc,CAC1B,MAAyB,EACzB,WAAsB,EACtB,eAAuB,EACvB,IAAS;IAET,OAAO,IAAI,OAAO,CAAM,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACjC,IAAI,WAAW,KAAK,SAAS,CAAC,MAAM,EAAE;YAClC,MAAM,CAAC,MAAM,CAAC,CAAC;YACf,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC;SACpB;QACD,MAAM,OAAO,GAAG,IAAI,cAAc,EAAE,CAAC;QACrC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE;YACjD,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACtB,IAAI,YAAY,CAAC,KAAK,EAAE;gBACpB,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;aAC3B;iBAAM;gBACH,GAAG,CAAC,YAAY,CAAC,CAAC;aACrB;QACL,CAAC,CAAC;QAEF,+DAA+D;QAC/D,UAAU,CAAC,GAAG,EAAE;YACZ,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACtB,GAAG,CAAC,IAAI,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC,CAAC;QACpD,CAAC,EAAE,eAAe,CAAC,CAAC;QAEpB,OAAO,iBAAiB,CACpB,MAAM,EACN,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,EAC3B,eAAe,EACf,OAAO,CACV,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/package.json
CHANGED
package/src/errors.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ERROR_MESSAGE } from '../errors';
|
|
1
2
|
import { HostEvent } from '../types';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -24,6 +25,8 @@ function postIframeMessage(
|
|
|
24
25
|
]);
|
|
25
26
|
}
|
|
26
27
|
|
|
28
|
+
const TRIGGER_TIMEOUT = 30000;
|
|
29
|
+
|
|
27
30
|
export function processTrigger(
|
|
28
31
|
iFrame: HTMLIFrameElement,
|
|
29
32
|
messageType: HostEvent,
|
|
@@ -45,6 +48,12 @@ export function processTrigger(
|
|
|
45
48
|
}
|
|
46
49
|
};
|
|
47
50
|
|
|
51
|
+
// Close the messageChannel and resolve the promise if timeout.
|
|
52
|
+
setTimeout(() => {
|
|
53
|
+
channel.port1.close();
|
|
54
|
+
res(new Error(ERROR_MESSAGE.TRIGGER_TIMED_OUT));
|
|
55
|
+
}, TRIGGER_TIMEOUT);
|
|
56
|
+
|
|
48
57
|
return postIframeMessage(
|
|
49
58
|
iFrame,
|
|
50
59
|
{ type: messageType, data },
|