amazon-quicksight-embedding-sdk
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -158,3 +158,4 @@ 'use strict'; | ||
url = options.url, | ||
scrolling = options.scrolling; | ||
scrolling = options.scrolling, | ||
className = options.className; | ||
@@ -165,3 +166,3 @@ if (height === _constants.DASHBOARD_SIZE_OPTIONS.AUTO_FIT) { | ||
var iframe = document.createElement('iframe'); | ||
iframe.className = 'quicksight-embedding-iframe'; | ||
iframe.className = ['quicksight-embedding-iframe', className].join(' ').trim(); | ||
iframe.width = width || '100%'; | ||
@@ -168,0 +169,0 @@ iframe.height = height || '100%'; |
@@ -11,5 +11,7 @@ 'use strict'; | ||
function constructEvent(eventName, payload) { | ||
var validEventNames = new Set(Object.values(_constants.OUT_GOING_POST_MESSAGE_EVENT_NAMES)); | ||
var isValidEventName = Object.keys(_constants.OUT_GOING_POST_MESSAGE_EVENT_NAMES).some(function (k) { | ||
return _constants.OUT_GOING_POST_MESSAGE_EVENT_NAMES[k] === eventName; | ||
}); | ||
if (!validEventNames.has(eventName)) { | ||
if (!isValidEventName) { | ||
throw new Error('Unexpected eventName'); | ||
@@ -16,0 +18,0 @@ } |
@@ -82,3 +82,3 @@ /******/ (function(modules) { // webpackBootstrap | ||
"use strict"; | ||
eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nvar _eventify = __webpack_require__(/*! ./lib/eventify */ \"./dist/lib/eventify.js\");\n\nvar _eventify2 = _interopRequireDefault(_eventify);\n\nvar _constructEvent = __webpack_require__(/*! ./lib/constructEvent */ \"./dist/lib/constructEvent.js\");\n\nvar _constructEvent2 = _interopRequireDefault(_constructEvent);\n\nvar _constants = __webpack_require__(/*! ./lib/constants */ \"./dist/lib/constants.js\");\n\nvar _punycode = __webpack_require__(/*! punycode */ \"./node_modules/node-libs-browser/node_modules/punycode/punycode.js\");\n\nvar _punycode2 = _interopRequireDefault(_punycode);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Embedding options.\n * @typedef {Object} EmbeddingOptions\n * @property {string} url - url of the dashboard to embed\n * @property {HTMLElement | string} container - parent html element or query selector string\n * @property {Function} errorCallback - callback when error occurs\n * @property {Function} loadCallback - callback when visualization data load complete\n * @property {Object} parameters\n * @property {string} width - width of the iframe\n * @property {string} height - height of the iframe\n * @property {string} loadingHeight - when height is set to be \"AutoFit\",\n * loadingHeight is used before actual height is received\n * @property {string} scrolling\n */\n\n/**\n * Embeddable dashboard class.\n * @class\n * @name EmbeddableDashboard\n * @param {EmbeddingOptions} options - options set by customers to embed the dashboard.\n */\n\nvar EmbeddableDashboard = function () {\n\n /* eslint-disable complexity */\n\n function EmbeddableDashboard(options) {\n _classCallCheck(this, EmbeddableDashboard);\n\n if (!options) {\n throw new Error('options is required');\n }\n\n if (!options.url) {\n throw new Error('url is required');\n }\n\n var url = options.url,\n container = options.container,\n parameters = options.parameters,\n errorCallback = options.errorCallback,\n loadCallback = options.loadCallback;\n\n\n this.url = url;\n\n if (container instanceof HTMLElement) {\n this.container = container;\n } else if (typeof container === 'string') {\n this.container = document.querySelector(container);\n }\n\n if (!this.container) {\n throw new Error('can\\'t find valid container');\n }\n\n this.parameters = parameters;\n\n this.iframe = createIframe(options);\n\n (0, _eventify2.default)(this);\n\n if (typeof errorCallback === 'function') {\n this.on(_constants.CLIENT_FACING_EVENT_NAMES.error, errorCallback);\n }\n\n if (typeof loadCallback === 'function') {\n this.on(_constants.CLIENT_FACING_EVENT_NAMES.load, loadCallback);\n }\n\n window.addEventListener('message', function (event) {\n if (!event) {\n return;\n }\n if (event.source === (this.iframe && this.iframe.contentWindow)) {\n var _event$data = event.data,\n eventName = _event$data.eventName,\n payload = _event$data.payload;\n\n this.trigger(_constants.CLIENT_FACING_EVENT_NAMES[eventName], payload);\n if (eventName === _constants.IN_COMING_POST_MESSAGE_EVENT_NAMES.RESIZE_EVENT) {\n var height = options.height;\n\n if (height === _constants.DASHBOARD_SIZE_OPTIONS.AUTO_FIT) {\n this.iframe.height = payload.height;\n }\n }\n }\n }.bind(this), false);\n\n this.getContainer = this.getContainer.bind(this);\n this.getParameters = this.getParameters.bind(this);\n this.getUrl = this.getUrl.bind(this);\n this.setParameters = this.setParameters.bind(this);\n }\n\n _createClass(EmbeddableDashboard, [{\n key: 'getUrl',\n value: function getUrl() {\n return this.url;\n }\n }, {\n key: 'getContainer',\n value: function getContainer() {\n return this.container;\n }\n }, {\n key: 'getParameters',\n value: function getParameters() {\n return this.parameters;\n }\n }, {\n key: 'setParameters',\n value: function setParameters(parameters) {\n var eventName = _constants.OUT_GOING_POST_MESSAGE_EVENT_NAMES.UPDATE_PARAMETER_VALUES;\n var payload = { parameters: parameters };\n var event = (0, _constructEvent2.default)(eventName, payload);\n this.iframe.contentWindow.postMessage(event, this.url);\n }\n }]);\n\n return EmbeddableDashboard;\n}();\n\nfunction createIframe(options) {\n var width = options.width,\n height = options.height;\n var loadingHeight = options.loadingHeight,\n url = options.url,\n scrolling = options.scrolling;\n\n if (height === _constants.DASHBOARD_SIZE_OPTIONS.AUTO_FIT) {\n height = loadingHeight;\n }\n var iframe = document.createElement('iframe');\n iframe.className = 'quicksight-embedding-iframe';\n iframe.width = width || '100%';\n iframe.height = height || '100%';\n iframe.scrolling = scrolling || 'no';\n iframe.onload = sendInitialPostMessage.bind(null, iframe, url);\n iframe.src = getIframeSrc(options);\n return iframe;\n}\n\nfunction getIframeSrc(options) {\n var url = options.url,\n parameters = options.parameters;\n\n var src = url + '&punyCodeEmbedOrigin=' + _punycode2.default.encode(window.location.origin + '/');\n if (parameters) {\n return useParameterValuesInUrl(src, parameters);\n }\n return src;\n}\n\n/**\n * Use parameter values in url.\n * @function\n * @name useParameterValuesInUrl\n * @param {string} url - url of the dashboard to embed.\n * @param {Object} parameters\n */\nfunction useParameterValuesInUrl(url, parameters) {\n var parameterNames = Object.keys(parameters);\n var parameterStrings = parameterNames.map(function (name) {\n var value = parameters[name];\n var values = [].concat(value);\n var encodedName = encodeURIComponent(name);\n return values.map(function (paramValue) {\n return encodeURIComponent(paramValue);\n }).map(function (encodedValue) {\n return 'p.' + encodedName + '=' + encodedValue;\n }).join('&');\n });\n\n return url + '#' + parameterStrings.join('&');\n}\n\nfunction sendInitialPostMessage(iframe, domain) {\n if (iframe.contentWindow === null) {\n setTimeout(sendInitialPostMessage.bind(null, iframe, domain), 100);\n }\n\n var eventName = _constants.OUT_GOING_POST_MESSAGE_EVENT_NAMES.ESTABLISH_MESSAGE_CHANNEL;\n var event = (0, _constructEvent2.default)(eventName);\n // wait until iframe.contentWindow exists and send message to iframe window\n iframe.contentWindow.postMessage(event, domain);\n}\n\nexports.default = EmbeddableDashboard;\n\n//# sourceURL=webpack:///./dist/EmbeddableDashboard.js?"); | ||
eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nvar _eventify = __webpack_require__(/*! ./lib/eventify */ \"./dist/lib/eventify.js\");\n\nvar _eventify2 = _interopRequireDefault(_eventify);\n\nvar _constructEvent = __webpack_require__(/*! ./lib/constructEvent */ \"./dist/lib/constructEvent.js\");\n\nvar _constructEvent2 = _interopRequireDefault(_constructEvent);\n\nvar _constants = __webpack_require__(/*! ./lib/constants */ \"./dist/lib/constants.js\");\n\nvar _punycode = __webpack_require__(/*! punycode */ \"./node_modules/node-libs-browser/node_modules/punycode/punycode.js\");\n\nvar _punycode2 = _interopRequireDefault(_punycode);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Embedding options.\n * @typedef {Object} EmbeddingOptions\n * @property {string} url - url of the dashboard to embed\n * @property {HTMLElement | string} container - parent html element or query selector string\n * @property {Function} errorCallback - callback when error occurs\n * @property {Function} loadCallback - callback when visualization data load complete\n * @property {Object} parameters\n * @property {string} width - width of the iframe\n * @property {string} height - height of the iframe\n * @property {string} loadingHeight - when height is set to be \"AutoFit\",\n * loadingHeight is used before actual height is received\n * @property {string} scrolling\n */\n\n/**\n * Embeddable dashboard class.\n * @class\n * @name EmbeddableDashboard\n * @param {EmbeddingOptions} options - options set by customers to embed the dashboard.\n */\n\nvar EmbeddableDashboard = function () {\n\n /* eslint-disable complexity */\n\n function EmbeddableDashboard(options) {\n _classCallCheck(this, EmbeddableDashboard);\n\n if (!options) {\n throw new Error('options is required');\n }\n\n if (!options.url) {\n throw new Error('url is required');\n }\n\n var url = options.url,\n container = options.container,\n parameters = options.parameters,\n errorCallback = options.errorCallback,\n loadCallback = options.loadCallback;\n\n\n this.url = url;\n\n if (container instanceof HTMLElement) {\n this.container = container;\n } else if (typeof container === 'string') {\n this.container = document.querySelector(container);\n }\n\n if (!this.container) {\n throw new Error('can\\'t find valid container');\n }\n\n this.parameters = parameters;\n\n this.iframe = createIframe(options);\n\n (0, _eventify2.default)(this);\n\n if (typeof errorCallback === 'function') {\n this.on(_constants.CLIENT_FACING_EVENT_NAMES.error, errorCallback);\n }\n\n if (typeof loadCallback === 'function') {\n this.on(_constants.CLIENT_FACING_EVENT_NAMES.load, loadCallback);\n }\n\n window.addEventListener('message', function (event) {\n if (!event) {\n return;\n }\n if (event.source === (this.iframe && this.iframe.contentWindow)) {\n var _event$data = event.data,\n eventName = _event$data.eventName,\n payload = _event$data.payload;\n\n this.trigger(_constants.CLIENT_FACING_EVENT_NAMES[eventName], payload);\n if (eventName === _constants.IN_COMING_POST_MESSAGE_EVENT_NAMES.RESIZE_EVENT) {\n var height = options.height;\n\n if (height === _constants.DASHBOARD_SIZE_OPTIONS.AUTO_FIT) {\n this.iframe.height = payload.height;\n }\n }\n }\n }.bind(this), false);\n\n this.getContainer = this.getContainer.bind(this);\n this.getParameters = this.getParameters.bind(this);\n this.getUrl = this.getUrl.bind(this);\n this.setParameters = this.setParameters.bind(this);\n }\n\n _createClass(EmbeddableDashboard, [{\n key: 'getUrl',\n value: function getUrl() {\n return this.url;\n }\n }, {\n key: 'getContainer',\n value: function getContainer() {\n return this.container;\n }\n }, {\n key: 'getParameters',\n value: function getParameters() {\n return this.parameters;\n }\n }, {\n key: 'setParameters',\n value: function setParameters(parameters) {\n var eventName = _constants.OUT_GOING_POST_MESSAGE_EVENT_NAMES.UPDATE_PARAMETER_VALUES;\n var payload = { parameters: parameters };\n var event = (0, _constructEvent2.default)(eventName, payload);\n this.iframe.contentWindow.postMessage(event, this.url);\n }\n }]);\n\n return EmbeddableDashboard;\n}();\n\nfunction createIframe(options) {\n var width = options.width,\n height = options.height;\n var loadingHeight = options.loadingHeight,\n url = options.url,\n scrolling = options.scrolling,\n className = options.className;\n\n if (height === _constants.DASHBOARD_SIZE_OPTIONS.AUTO_FIT) {\n height = loadingHeight;\n }\n var iframe = document.createElement('iframe');\n iframe.className = ['quicksight-embedding-iframe', className].join(' ').trim();\n iframe.width = width || '100%';\n iframe.height = height || '100%';\n iframe.scrolling = scrolling || 'no';\n iframe.onload = sendInitialPostMessage.bind(null, iframe, url);\n iframe.src = getIframeSrc(options);\n return iframe;\n}\n\nfunction getIframeSrc(options) {\n var url = options.url,\n parameters = options.parameters;\n\n var src = url + '&punyCodeEmbedOrigin=' + _punycode2.default.encode(window.location.origin + '/');\n if (parameters) {\n return useParameterValuesInUrl(src, parameters);\n }\n return src;\n}\n\n/**\n * Use parameter values in url.\n * @function\n * @name useParameterValuesInUrl\n * @param {string} url - url of the dashboard to embed.\n * @param {Object} parameters\n */\nfunction useParameterValuesInUrl(url, parameters) {\n var parameterNames = Object.keys(parameters);\n var parameterStrings = parameterNames.map(function (name) {\n var value = parameters[name];\n var values = [].concat(value);\n var encodedName = encodeURIComponent(name);\n return values.map(function (paramValue) {\n return encodeURIComponent(paramValue);\n }).map(function (encodedValue) {\n return 'p.' + encodedName + '=' + encodedValue;\n }).join('&');\n });\n\n return url + '#' + parameterStrings.join('&');\n}\n\nfunction sendInitialPostMessage(iframe, domain) {\n if (iframe.contentWindow === null) {\n setTimeout(sendInitialPostMessage.bind(null, iframe, domain), 100);\n }\n\n var eventName = _constants.OUT_GOING_POST_MESSAGE_EVENT_NAMES.ESTABLISH_MESSAGE_CHANNEL;\n var event = (0, _constructEvent2.default)(eventName);\n // wait until iframe.contentWindow exists and send message to iframe window\n iframe.contentWindow.postMessage(event, domain);\n}\n\nexports.default = EmbeddableDashboard;\n\n//# sourceURL=webpack:///./dist/EmbeddableDashboard.js?"); | ||
@@ -142,3 +142,3 @@ /***/ }), | ||
"use strict"; | ||
eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = constructEvent;\n\nvar _constants = __webpack_require__(/*! ./constants */ \"./dist/lib/constants.js\");\n\nfunction constructEvent(eventName, payload) {\n var validEventNames = new Set(Object.values(_constants.OUT_GOING_POST_MESSAGE_EVENT_NAMES));\n\n if (!validEventNames.has(eventName)) {\n throw new Error('Unexpected eventName');\n }\n\n return {\n eventName: eventName,\n clientType: 'EMBEDDING',\n payload: payload\n };\n}\n// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n//# sourceURL=webpack:///./dist/lib/constructEvent.js?"); | ||
eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = constructEvent;\n\nvar _constants = __webpack_require__(/*! ./constants */ \"./dist/lib/constants.js\");\n\nfunction constructEvent(eventName, payload) {\n var isValidEventName = Object.keys(_constants.OUT_GOING_POST_MESSAGE_EVENT_NAMES).some(function (k) {\n return _constants.OUT_GOING_POST_MESSAGE_EVENT_NAMES[k] === eventName;\n });\n\n if (!isValidEventName) {\n throw new Error('Unexpected eventName');\n }\n\n return {\n eventName: eventName,\n clientType: 'EMBEDDING',\n payload: payload\n };\n}\n// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n//# sourceURL=webpack:///./dist/lib/constructEvent.js?"); | ||
@@ -145,0 +145,0 @@ /***/ }), |
@@ -1,1 +0,1 @@ | ||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=9)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.OUT_GOING_POST_MESSAGE_EVENT_NAMES={ESTABLISH_MESSAGE_CHANNEL:"establishMessageChannel",UPDATE_PARAMETER_VALUES:"updateParameterValues"},t.IN_COMING_POST_MESSAGE_EVENT_NAMES={LOAD:"load",ERROR:"error",RESIZE_EVENT:"RESIZE_EVENT",SHOW_MODAL_EVENT:"SHOW_MODAL_EVENT"},t.CLIENT_FACING_EVENT_NAMES={load:"load",error:"error",RESIZE_EVENT:"resize",SHOW_MODAL_EVENT:"SHOW_MODAL_EVENT"},t.DASHBOARD_SIZE_OPTIONS={AUTO_FIT:"AutoFit"}},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){(function(e,r){var o;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(i){"object"==typeof t&&t&&t.nodeType,"object"==typeof e&&e&&e.nodeType;var u="object"==typeof r&&r;u.global!==u&&u.window!==u&&u.self;var a,c=2147483647,f=36,l=1,s=26,d=38,E=700,h=72,_=128,p="-",v=/^xn--/,S=/[^\x20-\x7E]/,g=/[\x2E\u3002\uFF0E\uFF61]/g,A={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},N=f-l,O=Math.floor,T=String.fromCharCode;function b(e){throw new RangeError(A[e])}function m(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function w(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+m((e=e.replace(g,".")).split("."),t).join(".")}function M(e){for(var t,n,r=[],o=0,i=e.length;o<i;)(t=e.charCodeAt(o++))>=55296&&t<=56319&&o<i?56320==(64512&(n=e.charCodeAt(o++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),o--):r.push(t);return r}function y(e){return m(e,function(e){var t="";return e>65535&&(t+=T((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=T(e)}).join("")}function I(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:f}function C(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function P(e,t,n){var r=0;for(e=n?O(e/E):e>>1,e+=O(e/t);e>N*s>>1;r+=f)e=O(e/N);return O(r+(N+1)*e/(e+d))}function j(e){var t,n,r,o,i,u,a,d,E,v,S=[],g=e.length,A=0,N=_,T=h;for((n=e.lastIndexOf(p))<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&b("not-basic"),S.push(e.charCodeAt(r));for(o=n>0?n+1:0;o<g;){for(i=A,u=1,a=f;o>=g&&b("invalid-input"),((d=I(e.charCodeAt(o++)))>=f||d>O((c-A)/u))&&b("overflow"),A+=d*u,!(d<(E=a<=T?l:a>=T+s?s:a-T));a+=f)u>O(c/(v=f-E))&&b("overflow"),u*=v;T=P(A-i,t=S.length+1,0==i),O(A/t)>c-N&&b("overflow"),N+=O(A/t),A%=t,S.splice(A++,0,N)}return y(S)}function G(e){var t,n,r,o,i,u,a,d,E,v,S,g,A,N,m,w=[];for(g=(e=M(e)).length,t=_,n=0,i=h,u=0;u<g;++u)(S=e[u])<128&&w.push(T(S));for(r=o=w.length,o&&w.push(p);r<g;){for(a=c,u=0;u<g;++u)(S=e[u])>=t&&S<a&&(a=S);for(a-t>O((c-n)/(A=r+1))&&b("overflow"),n+=(a-t)*A,t=a,u=0;u<g;++u)if((S=e[u])<t&&++n>c&&b("overflow"),S==t){for(d=n,E=f;!(d<(v=E<=i?l:E>=i+s?s:E-i));E+=f)m=d-v,N=f-v,w.push(T(C(v+m%N,0))),d=O(m/N);w.push(T(C(d,0))),i=P(n,A,r==o),n=0,++r}++n,++t}return w.join("")}a={version:"1.4.1",ucs2:{decode:M,encode:y},decode:j,encode:G,toASCII:function(e){return w(e,function(e){return S.test(e)?"xn--"+G(e):e})},toUnicode:function(e){return w(e,function(e){return v.test(e)?j(e.slice(4).toLowerCase()):e})}},void 0===(o=function(){return a}.call(t,n,t,e))||(e.exports=o)}()}).call(this,n(2)(e),n(1))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(!new Set(Object.values(r.OUT_GOING_POST_MESSAGE_EVENT_NAMES)).has(e))throw new Error("Unexpected eventName");return{eventName:e,clientType:"EMBEDDING",payload:t}};var r=n(0)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){e||(e={});!function(e){["on","trigger","off"].forEach(function(t){if(t in e)throw new Error("Cannot eventify object that has `"+t+"()` method on it")})}(e);var t=new Map;return e.on=function(e,n){var r=t.get(e);r||(r=new Set,t.set(e,r)),r.add(n)},e.off=function(n,r){if(!r)return t.delete(n),e;var o=t.get(n);return o?(o.delete(r),e):e},e.trigger=function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];var i=t.get(e);i&&i.forEach(function(e){return e.apply(null,r)})},e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=c(n(5)),i=c(n(4)),u=n(0),a=c(n(3));function c(e){return e&&e.__esModule?e:{default:e}}var f=function(){function e(t){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!t)throw new Error("options is required");if(!t.url)throw new Error("url is required");var n=t.url,r=t.container,c=t.parameters,f=t.errorCallback,l=t.loadCallback;if(this.url=n,r instanceof HTMLElement?this.container=r:"string"==typeof r&&(this.container=document.querySelector(r)),!this.container)throw new Error("can't find valid container");this.parameters=c,this.iframe=function(e){var t=e.width,n=e.height,r=e.loadingHeight,o=e.url,c=e.scrolling;n===u.DASHBOARD_SIZE_OPTIONS.AUTO_FIT&&(n=r);var f=document.createElement("iframe");return f.className="quicksight-embedding-iframe",f.width=t||"100%",f.height=n||"100%",f.scrolling=c||"no",f.onload=function e(t,n){null===t.contentWindow&&setTimeout(e.bind(null,t,n),100);var r=u.OUT_GOING_POST_MESSAGE_EVENT_NAMES.ESTABLISH_MESSAGE_CHANNEL,o=(0,i.default)(r);t.contentWindow.postMessage(o,n)}.bind(null,f,o),f.src=function(e){var t=e.url,n=e.parameters,r=t+"&punyCodeEmbedOrigin="+a.default.encode(window.location.origin+"/");return n?function(e,t){var n=Object.keys(t).map(function(e){var n=t[e],r=[].concat(n),o=encodeURIComponent(e);return r.map(function(e){return encodeURIComponent(e)}).map(function(e){return"p."+o+"="+e}).join("&")});return e+"#"+n.join("&")}(r,n):r}(e),f}(t),(0,o.default)(this),"function"==typeof f&&this.on(u.CLIENT_FACING_EVENT_NAMES.error,f),"function"==typeof l&&this.on(u.CLIENT_FACING_EVENT_NAMES.load,l),window.addEventListener("message",function(e){if(e&&e.source===(this.iframe&&this.iframe.contentWindow)){var n=e.data,r=n.eventName,o=n.payload;if(this.trigger(u.CLIENT_FACING_EVENT_NAMES[r],o),r===u.IN_COMING_POST_MESSAGE_EVENT_NAMES.RESIZE_EVENT)t.height===u.DASHBOARD_SIZE_OPTIONS.AUTO_FIT&&(this.iframe.height=o.height)}}.bind(this),!1),this.getContainer=this.getContainer.bind(this),this.getParameters=this.getParameters.bind(this),this.getUrl=this.getUrl.bind(this),this.setParameters=this.setParameters.bind(this)}return r(e,[{key:"getUrl",value:function(){return this.url}},{key:"getContainer",value:function(){return this.container}},{key:"getParameters",value:function(){return this.parameters}},{key:"setParameters",value:function(e){var t=u.OUT_GOING_POST_MESSAGE_EVENT_NAMES.UPDATE_PARAMETER_VALUES,n={parameters:e},r=(0,i.default)(t,n);this.iframe.contentWindow.postMessage(r,this.url)}}]),e}();t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(n(6));t.default=function(e){var t=new r.default(e),n=t.getContainer();return setTimeout(function(e,t){if(!e)throw new Error("iFrame is required");if(!t)throw new Error("container of iFrame is required");t.appendChild(e)}.bind(null,t.iframe,n),0),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.embedDashboard=void 0;var r=function(e){return e&&e.__esModule?e:{default:e}}(n(7));t.embedDashboard=r.default},function(e,t,n){(function(t){e.exports=t.QuickSightEmbedding=n(8)}).call(this,n(1))}]); | ||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=9)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.OUT_GOING_POST_MESSAGE_EVENT_NAMES={ESTABLISH_MESSAGE_CHANNEL:"establishMessageChannel",UPDATE_PARAMETER_VALUES:"updateParameterValues"},t.IN_COMING_POST_MESSAGE_EVENT_NAMES={LOAD:"load",ERROR:"error",RESIZE_EVENT:"RESIZE_EVENT",SHOW_MODAL_EVENT:"SHOW_MODAL_EVENT"},t.CLIENT_FACING_EVENT_NAMES={load:"load",error:"error",RESIZE_EVENT:"resize",SHOW_MODAL_EVENT:"SHOW_MODAL_EVENT"},t.DASHBOARD_SIZE_OPTIONS={AUTO_FIT:"AutoFit"}},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){(function(e,r){var o;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(i){"object"==typeof t&&t&&t.nodeType,"object"==typeof e&&e&&e.nodeType;var u="object"==typeof r&&r;u.global!==u&&u.window!==u&&u.self;var a,c=2147483647,f=36,l=1,s=26,d=38,E=700,h=72,_=128,p="-",v=/^xn--/,S=/[^\x20-\x7E]/,N=/[\x2E\u3002\uFF0E\uFF61]/g,g={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},O=f-l,A=Math.floor,T=String.fromCharCode;function m(e){throw new RangeError(g[e])}function b(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function w(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+b((e=e.replace(N,".")).split("."),t).join(".")}function M(e){for(var t,n,r=[],o=0,i=e.length;o<i;)(t=e.charCodeAt(o++))>=55296&&t<=56319&&o<i?56320==(64512&(n=e.charCodeAt(o++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),o--):r.push(t);return r}function y(e){return b(e,function(e){var t="";return e>65535&&(t+=T((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=T(e)}).join("")}function I(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:f}function P(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function C(e,t,n){var r=0;for(e=n?A(e/E):e>>1,e+=A(e/t);e>O*s>>1;r+=f)e=A(e/O);return A(r+(O+1)*e/(e+d))}function G(e){var t,n,r,o,i,u,a,d,E,v,S=[],N=e.length,g=0,O=_,T=h;for((n=e.lastIndexOf(p))<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&m("not-basic"),S.push(e.charCodeAt(r));for(o=n>0?n+1:0;o<N;){for(i=g,u=1,a=f;o>=N&&m("invalid-input"),((d=I(e.charCodeAt(o++)))>=f||d>A((c-g)/u))&&m("overflow"),g+=d*u,!(d<(E=a<=T?l:a>=T+s?s:a-T));a+=f)u>A(c/(v=f-E))&&m("overflow"),u*=v;T=C(g-i,t=S.length+1,0==i),A(g/t)>c-O&&m("overflow"),O+=A(g/t),g%=t,S.splice(g++,0,O)}return y(S)}function j(e){var t,n,r,o,i,u,a,d,E,v,S,N,g,O,b,w=[];for(N=(e=M(e)).length,t=_,n=0,i=h,u=0;u<N;++u)(S=e[u])<128&&w.push(T(S));for(r=o=w.length,o&&w.push(p);r<N;){for(a=c,u=0;u<N;++u)(S=e[u])>=t&&S<a&&(a=S);for(a-t>A((c-n)/(g=r+1))&&m("overflow"),n+=(a-t)*g,t=a,u=0;u<N;++u)if((S=e[u])<t&&++n>c&&m("overflow"),S==t){for(d=n,E=f;!(d<(v=E<=i?l:E>=i+s?s:E-i));E+=f)b=d-v,O=f-v,w.push(T(P(v+b%O,0))),d=A(b/O);w.push(T(P(d,0))),i=C(n,g,r==o),n=0,++r}++n,++t}return w.join("")}a={version:"1.4.1",ucs2:{decode:M,encode:y},decode:G,encode:j,toASCII:function(e){return w(e,function(e){return S.test(e)?"xn--"+j(e):e})},toUnicode:function(e){return w(e,function(e){return v.test(e)?G(e.slice(4).toLowerCase()):e})}},void 0===(o=function(){return a}.call(t,n,t,e))||(e.exports=o)}()}).call(this,n(2)(e),n(1))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(!Object.keys(r.OUT_GOING_POST_MESSAGE_EVENT_NAMES).some(function(t){return r.OUT_GOING_POST_MESSAGE_EVENT_NAMES[t]===e}))throw new Error("Unexpected eventName");return{eventName:e,clientType:"EMBEDDING",payload:t}};var r=n(0)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){e||(e={});!function(e){["on","trigger","off"].forEach(function(t){if(t in e)throw new Error("Cannot eventify object that has `"+t+"()` method on it")})}(e);var t=new Map;return e.on=function(e,n){var r=t.get(e);r||(r=new Set,t.set(e,r)),r.add(n)},e.off=function(n,r){if(!r)return t.delete(n),e;var o=t.get(n);return o?(o.delete(r),e):e},e.trigger=function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];var i=t.get(e);i&&i.forEach(function(e){return e.apply(null,r)})},e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=c(n(5)),i=c(n(4)),u=n(0),a=c(n(3));function c(e){return e&&e.__esModule?e:{default:e}}var f=function(){function e(t){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!t)throw new Error("options is required");if(!t.url)throw new Error("url is required");var n=t.url,r=t.container,c=t.parameters,f=t.errorCallback,l=t.loadCallback;if(this.url=n,r instanceof HTMLElement?this.container=r:"string"==typeof r&&(this.container=document.querySelector(r)),!this.container)throw new Error("can't find valid container");this.parameters=c,this.iframe=function(e){var t=e.width,n=e.height,r=e.loadingHeight,o=e.url,c=e.scrolling,f=e.className;n===u.DASHBOARD_SIZE_OPTIONS.AUTO_FIT&&(n=r);var l=document.createElement("iframe");return l.className=["quicksight-embedding-iframe",f].join(" ").trim(),l.width=t||"100%",l.height=n||"100%",l.scrolling=c||"no",l.onload=function e(t,n){null===t.contentWindow&&setTimeout(e.bind(null,t,n),100);var r=u.OUT_GOING_POST_MESSAGE_EVENT_NAMES.ESTABLISH_MESSAGE_CHANNEL,o=(0,i.default)(r);t.contentWindow.postMessage(o,n)}.bind(null,l,o),l.src=function(e){var t=e.url,n=e.parameters,r=t+"&punyCodeEmbedOrigin="+a.default.encode(window.location.origin+"/");return n?function(e,t){var n=Object.keys(t).map(function(e){var n=t[e],r=[].concat(n),o=encodeURIComponent(e);return r.map(function(e){return encodeURIComponent(e)}).map(function(e){return"p."+o+"="+e}).join("&")});return e+"#"+n.join("&")}(r,n):r}(e),l}(t),(0,o.default)(this),"function"==typeof f&&this.on(u.CLIENT_FACING_EVENT_NAMES.error,f),"function"==typeof l&&this.on(u.CLIENT_FACING_EVENT_NAMES.load,l),window.addEventListener("message",function(e){if(e&&e.source===(this.iframe&&this.iframe.contentWindow)){var n=e.data,r=n.eventName,o=n.payload;if(this.trigger(u.CLIENT_FACING_EVENT_NAMES[r],o),r===u.IN_COMING_POST_MESSAGE_EVENT_NAMES.RESIZE_EVENT)t.height===u.DASHBOARD_SIZE_OPTIONS.AUTO_FIT&&(this.iframe.height=o.height)}}.bind(this),!1),this.getContainer=this.getContainer.bind(this),this.getParameters=this.getParameters.bind(this),this.getUrl=this.getUrl.bind(this),this.setParameters=this.setParameters.bind(this)}return r(e,[{key:"getUrl",value:function(){return this.url}},{key:"getContainer",value:function(){return this.container}},{key:"getParameters",value:function(){return this.parameters}},{key:"setParameters",value:function(e){var t=u.OUT_GOING_POST_MESSAGE_EVENT_NAMES.UPDATE_PARAMETER_VALUES,n={parameters:e},r=(0,i.default)(t,n);this.iframe.contentWindow.postMessage(r,this.url)}}]),e}();t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(n(6));t.default=function(e){var t=new r.default(e),n=t.getContainer();return setTimeout(function(e,t){if(!e)throw new Error("iFrame is required");if(!t)throw new Error("container of iFrame is required");t.appendChild(e)}.bind(null,t.iframe,n),0),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.embedDashboard=void 0;var r=function(e){return e&&e.__esModule?e:{default:e}}(n(7));t.embedDashboard=r.default},function(e,t,n){(function(t){e.exports=t.QuickSightEmbedding=n(8)}).call(this,n(1))}]); |
{ | ||
"name": "amazon-quicksight-embedding-sdk", | ||
"description": "JS SDK for embedding Amazon QuickSight", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"main": "dist/index.js", | ||
@@ -24,8 +24,3 @@ "homepage": "https://github.com/awslabs/amazon-quicksight-embedding-sdk", | ||
}, | ||
"licenses": [ | ||
{ | ||
"type": "Apache 2.0", | ||
"url": "https://github.com/awslabs/amazon-quicksight-embedding-sdk/blob/master/LICENSE" | ||
} | ||
], | ||
"license": "Apache-2.0", | ||
"devDependencies": { | ||
@@ -46,3 +41,3 @@ "babel-cli": "^6.6.5", | ||
"webpack": "^4.1.1", | ||
"webpack-cli": "^2.1.3" | ||
"webpack-cli": "^3.3.6" | ||
}, | ||
@@ -49,0 +44,0 @@ "scripts": { |
@@ -13,18 +13,29 @@ # Amazon QuickSight Embedding SDK | ||
- Option 1: Use the Amazon QuickSight Embedding SDK in the browser: | ||
```html | ||
<script src="https://unpkg.com/amazon-quicksight-embedding-sdk@1.0.5/dist/quicksight-embedding-js-sdk.min.js"></script> | ||
``` | ||
<script src="https://unpkg.com/amazon-quicksight-embedding-sdk@1.0.3/dist/quicksight-embedding-js-sdk.min.js" /> | ||
``` | ||
- Option 2: Install and use the QuickSight Embedding SDK in Node.js: | ||
``` | ||
```shell | ||
npm install amazon-quicksight-embedding-sdk | ||
``` | ||
``` | ||
```javascript | ||
var QuickSightEmbedding = require("amazon-quicksight-embedding-sdk"); | ||
``` | ||
You can also use ES6 import syntax in place of require: | ||
```javascript | ||
import { embedDashboard } from 'amazon-quicksight-embedding-sdk'; | ||
const dashboard = embedDashboard(options); | ||
``` | ||
Alternatively, if you need to load the entire module: | ||
```javascript | ||
import * as QuicksightEmbedding from 'amazon-quicksight-embedding-sdk'; | ||
const dashboard = QuickSightEmbedding.embedDashboard(options); | ||
``` | ||
### Step 2: Configure the dashboard to embed | ||
Set up the dashboard so you can embed it. | ||
``` | ||
```javascript | ||
var options = { | ||
@@ -52,7 +63,7 @@ url: "https://us-east-1.quicksight.aws.amazon.com/sn/dashboards/dashboardId?isauthcode=true&identityprovider=quicksight&code=authcode", | ||
- Option 1: It can be an HTMLElement: | ||
``` | ||
```javascript | ||
container: document.getElementById("dashboardContainer"), | ||
``` | ||
- Option 2: Or, it can be a query selector string: | ||
``` | ||
```javascript | ||
container: "#dashboardContainer", | ||
@@ -72,3 +83,3 @@ ``` | ||
You can set `width` and `height` for the iFrame that holds your dashboard. Both of these default to 100%. You can set them to be fixed values: | ||
``` | ||
```javascript | ||
height: "700px", | ||
@@ -79,3 +90,3 @@ width: "1000px" | ||
Or, relative values: | ||
``` | ||
```javascript | ||
height: "80%", | ||
@@ -89,3 +100,3 @@ width: "60%" | ||
You can also choose to set height to be `AutoFit` to make the iFrame fit your dashboard height. Use `loadingHeight` to specify the height you'd like to use before actual dashboard height is known: | ||
``` | ||
```javascript | ||
height: "AutoFit", | ||
@@ -97,3 +108,3 @@ loadingHeight: '700px', | ||
if the dashboard content is larger than the screen. To solve the issue, you can add the following code to auto-scroll the focus to the modal. | ||
``` | ||
```javascript | ||
dashboard.on("SHOW_MODAL_EVENT", () => { | ||
@@ -105,6 +116,10 @@ window.scrollTo({ | ||
``` | ||
#### ClassName element (optional) | ||
The `className` element lets you add additional class names to the iFrame that holds your dashboard. | ||
### Step 3: Embed the dashboard | ||
Embed the dashboard by calling: | ||
``` | ||
```javascript | ||
var dashboard = QuickSightEmbedding.embedDashboard(options); | ||
@@ -120,3 +135,3 @@ ``` | ||
- Use options: | ||
``` | ||
```javascript | ||
loadCallback: yourLoadCallback, | ||
@@ -126,3 +141,3 @@ ``` | ||
- Or, register the "load" event on the returned dashboard object: | ||
``` | ||
```javascript | ||
dashboard.on("load", yourLoadCallback); | ||
@@ -137,3 +152,3 @@ ``` | ||
- Use options: | ||
``` | ||
```javascript | ||
errorCallback: yourErrorCallback, | ||
@@ -143,3 +158,3 @@ ``` | ||
- Or, register the "error" event on the returned dashboard object: | ||
``` | ||
```javascript | ||
dashboard.on("error", yourErrorCallback); | ||
@@ -160,7 +175,12 @@ ``` | ||
You can build your own UI to trigger this, so that viewers of the embedded dashboard can control the dashboard from your app page. | ||
``` | ||
```javascript | ||
dashboard.setParameters({country: "China", states: ["Zhejiang", "Jiangsu"]}); | ||
``` | ||
To reset a parameter so that it includes all values, you can pass the string `"[ALL]"`. | ||
```javascript | ||
dashboard.setParameters({country: "China", states: "[ALL]" }); | ||
``` | ||
## Troubleshooting | ||
@@ -178,3 +198,3 @@ 1. Make sure the url you provide in options is not encoded. Don't encode the url as it changes the authcode in the url and breaks the url. Also check that the url responded from server side is not encoded. | ||
<title>Basic Embed</title> | ||
<script src="https://unpkg.com/amazon-quicksight-embedding-sdk@1.0.3/dist/quicksight-embedding-js-sdk.min.js" /> | ||
<script src="https://unpkg.com/amazon-quicksight-embedding-sdk@1.0.5/dist/quicksight-embedding-js-sdk.min.js"></script> | ||
<script type="text/javascript"> | ||
@@ -229,4 +249,9 @@ var dashboard | ||
## Change Log | ||
**1.0.5** | ||
* Fixed compatibility with IE 11 when updating parameter values. | ||
* Improved README. | ||
**1.0.4** | ||
* Add SHOW_MODAL_EVENT to notify modal is shown in Dashboard | ||
* Added SHOW_MODAL_EVENT to notify modal is shown in Dashboard. | ||
@@ -233,0 +258,0 @@ **1.0.3:** |
@@ -134,3 +134,3 @@ // @flow | ||
let {width, height} = options; | ||
const {loadingHeight, url, scrolling} = options; | ||
const {loadingHeight, url, scrolling, className} = options; | ||
if (height === DASHBOARD_SIZE_OPTIONS.AUTO_FIT) { | ||
@@ -140,3 +140,3 @@ height = loadingHeight; | ||
const iframe = document.createElement('iframe'); | ||
iframe.className = 'quicksight-embedding-iframe'; | ||
iframe.className = ['quicksight-embedding-iframe', className].join(' ').trim(); | ||
iframe.width = width || '100%'; | ||
@@ -191,2 +191,2 @@ iframe.height = height || '100%'; | ||
export default EmbeddableDashboard; | ||
export default EmbeddableDashboard; |
@@ -8,5 +8,7 @@ // @flow | ||
export default function constructEvent(eventName: string, payload?: Object): Object { | ||
const validEventNames = new Set(Object.values(OUT_GOING_POST_MESSAGE_EVENT_NAMES)); | ||
const isValidEventName = Object | ||
.keys(OUT_GOING_POST_MESSAGE_EVENT_NAMES) | ||
.some(k => OUT_GOING_POST_MESSAGE_EVENT_NAMES[k] === eventName); | ||
if (!validEventNames.has(eventName)) { | ||
if (!isValidEventName) { | ||
throw new Error('Unexpected eventName'); | ||
@@ -20,2 +22,2 @@ } | ||
}; | ||
} | ||
} |
@@ -14,3 +14,4 @@ // @flow | ||
loadingHeight: ?string, | ||
scrolling: ?string | ||
scrolling: ?string, | ||
className: ?string, | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
111244
904
256