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.1 to 1.0.2

9

dist/EmbeddableDashboard.js

@@ -174,5 +174,10 @@ 'use strict';

var parameterStrings = parameterNames.map(function (name) {
var value = parameters[name];
var values = [].concat(value);
var encodedName = encodeURIComponent(name);
var encodedValue = encodeURIComponent(parameters[name]);
return 'p.' + encodedName + '=' + encodedValue;
return values.map(function (paramValue) {
return encodeURIComponent(paramValue);
}).map(function (encodedValue) {
return 'p.' + encodedName + '=' + encodedValue;
}).join('&');
});

@@ -179,0 +184,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} 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.IN_GOING_POST_MESSAGE_EVENT_NAMES.ERROR, errorCallback);\n }\n\n if (typeof loadCallback === 'function') {\n this.on(_constants.IN_GOING_POST_MESSAGE_EVENT_NAMES.LOAD, loadCallback);\n }\n\n window.addEventListener('message', function (event) {\n if (event.source === (this.iframe && this.iframe.contentWindow)) {\n this.trigger(event.data.eventName, event.data.payload);\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 url = options.url,\n scrolling = options.scrolling;\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 encodedName = encodeURIComponent(name);\n var encodedValue = encodeURIComponent(parameters[name]);\n return 'p.' + encodedName + '=' + encodedValue;\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} 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.IN_GOING_POST_MESSAGE_EVENT_NAMES.ERROR, errorCallback);\n }\n\n if (typeof loadCallback === 'function') {\n this.on(_constants.IN_GOING_POST_MESSAGE_EVENT_NAMES.LOAD, loadCallback);\n }\n\n window.addEventListener('message', function (event) {\n if (event.source === (this.iframe && this.iframe.contentWindow)) {\n this.trigger(event.data.eventName, event.data.payload);\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 url = options.url,\n scrolling = options.scrolling;\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?");

@@ -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_GOING_POST_MESSAGE_EVENT_NAMES={LOAD:"load",ERROR:"error"}},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,h=700,p=72,E=128,v="-",_=/^xn--/,g=/[^\x20-\x7E]/,b=/[\x2E\u3002\uFF0E\uFF61]/g,w={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},m=f-l,S=Math.floor,y=String.fromCharCode;function O(e){throw new RangeError(w[e])}function A(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function M(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+A((e=e.replace(b,".")).split("."),t).join(".")}function N(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 P(e){return A(e,function(e){var t="";return e>65535&&(t+=y((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=y(e)}).join("")}function T(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 G(e,t,n){var r=0;for(e=n?S(e/h):e>>1,e+=S(e/t);e>m*s>>1;r+=f)e=S(e/m);return S(r+(m+1)*e/(e+d))}function j(e){var t,n,r,o,i,u,a,d,h,_,g=[],b=e.length,w=0,m=E,y=p;for((n=e.lastIndexOf(v))<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&O("not-basic"),g.push(e.charCodeAt(r));for(o=n>0?n+1:0;o<b;){for(i=w,u=1,a=f;o>=b&&O("invalid-input"),((d=T(e.charCodeAt(o++)))>=f||d>S((c-w)/u))&&O("overflow"),w+=d*u,!(d<(h=a<=y?l:a>=y+s?s:a-y));a+=f)u>S(c/(_=f-h))&&O("overflow"),u*=_;y=G(w-i,t=g.length+1,0==i),S(w/t)>c-m&&O("overflow"),m+=S(w/t),w%=t,g.splice(w++,0,m)}return P(g)}function I(e){var t,n,r,o,i,u,a,d,h,_,g,b,w,m,A,M=[];for(b=(e=N(e)).length,t=E,n=0,i=p,u=0;u<b;++u)(g=e[u])<128&&M.push(y(g));for(r=o=M.length,o&&M.push(v);r<b;){for(a=c,u=0;u<b;++u)(g=e[u])>=t&&g<a&&(a=g);for(a-t>S((c-n)/(w=r+1))&&O("overflow"),n+=(a-t)*w,t=a,u=0;u<b;++u)if((g=e[u])<t&&++n>c&&O("overflow"),g==t){for(d=n,h=f;!(d<(_=h<=i?l:h>=i+s?s:h-i));h+=f)A=d-_,m=f-_,M.push(y(C(_+A%m,0))),d=S(A/m);M.push(y(C(d,0))),i=G(n,w,r==o),n=0,++r}++n,++t}return M.join("")}a={version:"1.4.1",ucs2:{decode:N,encode:P},decode:j,encode:I,toASCII:function(e){return M(e,function(e){return g.test(e)?"xn--"+I(e):e})},toUnicode:function(e){return M(e,function(e){return _.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.url,o=e.scrolling,c=document.createElement("iframe");return c.className="quicksight-embedding-iframe",c.width=t||"100%",c.height=n||"100%",c.scrolling=o||"no",c.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,c,r),c.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=encodeURIComponent(e),r=encodeURIComponent(t[e]);return"p."+n+"="+r});return e+"#"+n.join("&")}(r,n):r}(e),c}(t),(0,o.default)(this),"function"==typeof f&&this.on(u.IN_GOING_POST_MESSAGE_EVENT_NAMES.ERROR,f),"function"==typeof l&&this.on(u.IN_GOING_POST_MESSAGE_EVENT_NAMES.LOAD,l),window.addEventListener("message",function(e){e.source===(this.iframe&&this.iframe.contentWindow)&&this.trigger(e.data.eventName,e.data.payload)}.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_GOING_POST_MESSAGE_EVENT_NAMES={LOAD:"load",ERROR:"error"}},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,h=700,p=72,E=128,v="-",_=/^xn--/,g=/[^\x20-\x7E]/,b=/[\x2E\u3002\uFF0E\uFF61]/g,w={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},m=f-l,S=Math.floor,y=String.fromCharCode;function O(e){throw new RangeError(w[e])}function A(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function M(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+A((e=e.replace(b,".")).split("."),t).join(".")}function N(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 P(e){return A(e,function(e){var t="";return e>65535&&(t+=y((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=y(e)}).join("")}function T(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:f}function j(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function C(e,t,n){var r=0;for(e=n?S(e/h):e>>1,e+=S(e/t);e>m*s>>1;r+=f)e=S(e/m);return S(r+(m+1)*e/(e+d))}function G(e){var t,n,r,o,i,u,a,d,h,_,g=[],b=e.length,w=0,m=E,y=p;for((n=e.lastIndexOf(v))<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&O("not-basic"),g.push(e.charCodeAt(r));for(o=n>0?n+1:0;o<b;){for(i=w,u=1,a=f;o>=b&&O("invalid-input"),((d=T(e.charCodeAt(o++)))>=f||d>S((c-w)/u))&&O("overflow"),w+=d*u,!(d<(h=a<=y?l:a>=y+s?s:a-y));a+=f)u>S(c/(_=f-h))&&O("overflow"),u*=_;y=C(w-i,t=g.length+1,0==i),S(w/t)>c-m&&O("overflow"),m+=S(w/t),w%=t,g.splice(w++,0,m)}return P(g)}function I(e){var t,n,r,o,i,u,a,d,h,_,g,b,w,m,A,M=[];for(b=(e=N(e)).length,t=E,n=0,i=p,u=0;u<b;++u)(g=e[u])<128&&M.push(y(g));for(r=o=M.length,o&&M.push(v);r<b;){for(a=c,u=0;u<b;++u)(g=e[u])>=t&&g<a&&(a=g);for(a-t>S((c-n)/(w=r+1))&&O("overflow"),n+=(a-t)*w,t=a,u=0;u<b;++u)if((g=e[u])<t&&++n>c&&O("overflow"),g==t){for(d=n,h=f;!(d<(_=h<=i?l:h>=i+s?s:h-i));h+=f)A=d-_,m=f-_,M.push(y(j(_+A%m,0))),d=S(A/m);M.push(y(j(d,0))),i=C(n,w,r==o),n=0,++r}++n,++t}return M.join("")}a={version:"1.4.1",ucs2:{decode:N,encode:P},decode:G,encode:I,toASCII:function(e){return M(e,function(e){return g.test(e)?"xn--"+I(e):e})},toUnicode:function(e){return M(e,function(e){return _.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(!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.url,o=e.scrolling,c=document.createElement("iframe");return c.className="quicksight-embedding-iframe",c.width=t||"100%",c.height=n||"100%",c.scrolling=o||"no",c.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,c,r),c.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),c}(t),(0,o.default)(this),"function"==typeof f&&this.on(u.IN_GOING_POST_MESSAGE_EVENT_NAMES.ERROR,f),"function"==typeof l&&this.on(u.IN_GOING_POST_MESSAGE_EVENT_NAMES.LOAD,l),window.addEventListener("message",function(e){e.source===(this.iframe&&this.iframe.contentWindow)&&this.trigger(e.data.eventName,e.data.payload)}.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.1",
"version": "1.0.2",
"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

```
<script src="https://unpkg.com/amazon-quicksight-embedding-sdk@1.0.1/dist/quicksight-embedding-js-sdk.min.js />
<script src="https://unpkg.com/amazon-quicksight-embedding-sdk@1.0.2/dist/quicksight-embedding-js-sdk.min.js" />
```

@@ -20,6 +20,6 @@

```
npm install amazon-quicksight-embedding-sdk
npm install quicksight-embedding-sdk
```
```
var QuickSightEmbedding = require("amazon-quicksight-embedding-sdk");
var QuickSightEmbedding = require("quicksight-embedding-sdk");
```

@@ -36,2 +36,6 @@

country: "United States"
states: [
"California",
"Washington"
]
},

@@ -58,6 +62,6 @@ scrolling: "no",

####Parameters element (optional)
The `parameters` element is an object that contains key:value pairs for parameters names:values. It allows you
to set initial parameter values for your dashboard. For more information about parameters in Amazon QuickSight, see
https://docs.aws.amazon.com/quicksight/latest/user/parameters-in-quicksight.html
#### Parameters element (optional)
The `parameters` element is an object that contains key:value pairs for parameters names:values.
It allows you to set initial parameter values for your dashboard. Pass an array as value for multi-value parameters.
For more information about parameters in Amazon QuickSight, see https://docs.aws.amazon.com/quicksight/latest/user/parameters-in-quicksight.html

@@ -131,6 +135,6 @@ ####Scrolling element (optional)

### Step 6: Update parameter values (optional)
Use `dashboard.setParameters()` to update parameter values. You can build your own UI to trigger this, so that viewers of the embedded dashboard
can control the dashboard from your app page.
Use `dashboard.setParameters()` to update parameter values. Pass an array as value for multi-value parameters.
You can build your own UI to trigger this, so that viewers of the embedded dashboard can control the dashboard from your app page.
```
dashboard.setParameters({country: "Canada"});
dashboard.setParameters({country: "China", states: ["Zhejiang", "Jiangsu"]});
```

@@ -145,3 +149,3 @@

<title>Basic Embed</title>
<script src="https://unpkg.com/amazon-quicksight-embedding-sdk@1.0.1/dist/quicksight-embedding-js-sdk.min.js />
<script src="https://unpkg.com/amazon-quicksight-embedding-sdk@1.0.2/dist/quicksight-embedding-js-sdk.min.js" />
<script type="text/javascript">

@@ -148,0 +152,0 @@ var dashboard

@@ -146,5 +146,8 @@ // @flow

const parameterStrings = parameterNames.map(name => {
const value = parameters[name];
const values = [].concat(value);
const encodedName = encodeURIComponent(name);
const encodedValue = encodeURIComponent(parameters[name]);
return `p.${encodedName}=${encodedValue}`;
return values.map(paramValue => encodeURIComponent(paramValue))
.map(encodedValue => `p.${encodedName}=${encodedValue}`)
.join('&');
});

@@ -151,0 +154,0 @@

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