Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

amazon-quicksight-embedding-sdk

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amazon-quicksight-embedding-sdk - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

12

dist/EmbeddableDashboard.js

@@ -42,2 +42,3 @@ 'use strict';

* @property {string} scrolling
* @property {string} locale
*/

@@ -172,2 +173,4 @@

iframe.src = getIframeSrc(options);
iframe.style.border = '0px';
iframe.style.padding = '0px';
return iframe;

@@ -178,8 +181,15 @@ }

var url = options.url,
parameters = options.parameters;
parameters = options.parameters,
locale = options.locale;
var src = url + '&punyCodeEmbedOrigin=' + _punycode2.default.encode(window.location.origin + '/');
if (locale) {
src = src + '&locale=' + locale;
}
if (parameters) {
return useParameterValuesInUrl(src, parameters);
}
return src;

@@ -186,0 +196,0 @@ }

2

dist/quicksight-embedding-js-sdk.js

@@ -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 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?");
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 * @property {string} locale\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 iframe.style.border = '0px';\n iframe.style.padding = '0px';\n return iframe;\n}\n\nfunction getIframeSrc(options) {\n var url = options.url,\n parameters = options.parameters,\n locale = options.locale;\n\n var src = url + '&punyCodeEmbedOrigin=' + _punycode2.default.encode(window.location.origin + '/');\n\n if (locale) {\n src = src + '&locale=' + locale;\n }\n\n if (parameters) {\n return useParameterValuesInUrl(src, parameters);\n }\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?");

@@ -85,0 +85,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]/,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))}]);
!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,N={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(N[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(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 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=[],g=e.length,N=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<g;){for(i=N,u=1,a=f;o>=g&&m("invalid-input"),((d=I(e.charCodeAt(o++)))>=f||d>A((c-N)/u))&&m("overflow"),N+=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(N-i,t=S.length+1,0==i),A(N/t)>c-O&&m("overflow"),O+=A(N/t),N%=t,S.splice(N++,0,O)}return y(S)}function j(e){var t,n,r,o,i,u,a,d,E,v,S,g,N,O,b,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>A((c-n)/(N=r+1))&&m("overflow"),n+=(a-t)*N,t=a,u=0;u<g;++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,N,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=e.locale,o=t+"&punyCodeEmbedOrigin="+a.default.encode(window.location.origin+"/");return r&&(o=o+"&locale="+r),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("&")}(o,n):o}(e),l.style.border="0px",l.style.padding="0px",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.5",
"version": "1.0.6",
"main": "dist/index.js",

@@ -6,0 +6,0 @@ "homepage": "https://github.com/awslabs/amazon-quicksight-embedding-sdk",

@@ -14,3 +14,3 @@ # Amazon QuickSight Embedding SDK

```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.6/dist/quicksight-embedding-js-sdk.min.js"></script>
```

@@ -53,3 +53,4 @@

height: "700px",
width: "1000px"
width: "1000px",
locale: "en-US"
};

@@ -100,3 +101,3 @@ ```

height: "AutoFit",
loadingHeight: '700px',
loadingHeight: "700px",
```

@@ -115,4 +116,42 @@

#### ClassName element (optional)
The `className` element lets you add additional class names to the iFrame that holds your dashboard.
You can customize style of the iFrame that holds your dashboard by one of the followings:
- Option 1: Use the "quicksight-embedding-iframe" class we predefined for you:
```
quicksight-embedding-iframe {
margin: 5px;
}
```
- Option 2: Or, create your own class and pass in through `className` element:
```
your-own-class {
margin: 5px;
}
```
```javascript
className: "your-own-class",
```
We've overridden border and padding of the iFrame to be 0px, as setting border and padding on the iFrame might cause unexpected issues.
If you have to set border and padding on the embedded dashboard, set it on the container div that contains the iFrame.
#### Locale element (optional)
You can set locale for the embedded dashboard:
```javascript
locale: "en-US",
```
Available locale options are:
```
en-US (English),
de-DE (Deutsch),
ja-JP (日本語),
es-ES (Español),
fr-FR (Français),
it-IT (Italiano),
pt-BR (Português),
ko-KR (한국어),
zh-CN (中文 (简体)),
zh-TW (中文 (繁體))
```
### Step 3: Embed the dashboard

@@ -169,3 +208,3 @@

```javascript
dashboard.setParameters({country: "China", states: ["Zhejiang", "Jiangsu"]});
dashboard.setParameters({country: "United States", states: ["California", "Washington"]});
```

@@ -175,3 +214,3 @@

```javascript
dashboard.setParameters({country: "China", states: "[ALL]" });
dashboard.setParameters({country: "United States", states: "[ALL]" });
```

@@ -192,3 +231,3 @@

<title>Basic Embed</title>
<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.6/dist/quicksight-embedding-js-sdk.min.js"></script>
<script type="text/javascript">

@@ -214,3 +253,4 @@ var dashboard

height: "700px",
width: "1000px"
width: "1000px",
locale: "en-US"
};

@@ -245,2 +285,5 @@ dashboard = QuickSightEmbedding.embedDashboard(options);

**1.0.6**
* Supported setting locale.
**1.0.5**

@@ -254,3 +297,3 @@ * Fixed compatibility with IE 11 when updating parameter values.

**1.0.3:**
* Added "AutoFit" as an new height option.
* Added "AutoFit" as a new height option.

@@ -257,0 +300,0 @@ **1.0.2:**

@@ -29,2 +29,3 @@ // @flow

* @property {string} scrolling
* @property {string} locale
*/

@@ -146,2 +147,4 @@

iframe.src = getIframeSrc(options);
iframe.style.border = '0px';
iframe.style.padding = '0px';
return iframe;

@@ -151,7 +154,13 @@ }

function getIframeSrc(options): string {
const {url, parameters} = options;
const {url, parameters, locale} = options;
let src = url + '&punyCodeEmbedOrigin=' + punycode.encode(window.location.origin + '/');
if (locale) {
src = src + '&locale=' + locale;
}
if (parameters) {
return useParameterValuesInUrl(src, parameters);
}
return src;

@@ -158,0 +167,0 @@ }

@@ -28,1 +28,2 @@ // @flow

};

@@ -16,2 +16,3 @@ // @flow

className: ?string,
locale: ?string
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc