amazon-quicksight-embedding-sdk
Advanced tools
Comparing version 1.0.15 to 1.0.16
@@ -0,1 +1,4 @@ | ||
**1.0.16** | ||
* Adding undoRedoDisabled and resetDisabled flags to JS SDK | ||
**1.0.15** | ||
@@ -2,0 +5,0 @@ * Adding more locales list supported by QuickSight to README |
@@ -258,4 +258,6 @@ "use strict"; | ||
printEnabled = options.printEnabled, | ||
resetDisabled = options.resetDisabled, | ||
sheetId = options.sheetId, | ||
sheetTabsDisabled = options.sheetTabsDisabled; | ||
sheetTabsDisabled = options.sheetTabsDisabled, | ||
undoRedoDisabled = options.undoRedoDisabled; | ||
@@ -282,2 +284,10 @@ var src = url + '&punyCodeEmbedOrigin=' + _punycode["default"].encode(window.location.origin + '/'); | ||
if (undoRedoDisabled) { | ||
src = src + '&undoRedoDisabled=' + String(undoRedoDisabled); | ||
} | ||
if (resetDisabled) { | ||
src = src + '&resetDisabled=' + String(resetDisabled); | ||
} | ||
if (iframeResizeOnSheetChange) { | ||
@@ -284,0 +294,0 @@ src = src + '&resizeOnSheetChange=' + String(iframeResizeOnSheetChange); |
@@ -109,3 +109,3 @@ /******/ (function(modules) { // webpackBootstrap | ||
"use strict"; | ||
eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nvar _eventify = _interopRequireDefault(__webpack_require__(/*! ./lib/eventify */ \"./dist/lib/eventify.js\"));\n\nvar _constructEvent = _interopRequireDefault(__webpack_require__(/*! ./lib/constructEvent */ \"./dist/lib/constructEvent.js\"));\n\nvar _constants = __webpack_require__(/*! ./lib/constants */ \"./dist/lib/constants.js\");\n\nvar _punycode = _interopRequireDefault(__webpack_require__(/*! punycode */ \"./node_modules/node-libs-browser/node_modules/punycode/punycode.js\"));\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\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n/**\n * Embedding options.\n * @typedef {Object} EmbeddingOptions\n * @property {string} url - url of the session or 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 {Function} parametersChangeCallback - callback when parameters change occurs\n * @property {Function} getActiveParametersCallback - callback to get active parameter values\n * @property {Function} getSheetsCallback - callback to get sheet details\n * @property {Function} selectedSheetChangeCallback - callback when current sheet is changed\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 Object class.\n * @class\n * @name EmbeddableObject\n * @param {EmbeddingOptions} options - options set by customers to embed the session or dashboard.\n */\nvar EmbeddableObject = /*#__PURE__*/function () {\n /* eslint-disable complexity */\n function EmbeddableObject(options) {\n _classCallCheck(this, EmbeddableObject);\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 defaultEmbeddingVisualType = options.defaultEmbeddingVisualType,\n errorCallback = options.errorCallback,\n loadCallback = options.loadCallback,\n parametersChangeCallback = options.parametersChangeCallback,\n selectedSheetChangeCallback = options.selectedSheetChangeCallback;\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 this.defaultEmbeddingVisualType = defaultEmbeddingVisualType;\n this.iframe = createIframe(options);\n (0, _eventify[\"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 if (typeof parametersChangeCallback === 'function') {\n this.on(_constants.CLIENT_FACING_EVENT_NAMES.parametersChange, parametersChangeCallback);\n }\n\n if (typeof selectedSheetChangeCallback === 'function') {\n this.on(_constants.CLIENT_FACING_EVENT_NAMES.selectedSheetChange, selectedSheetChangeCallback);\n }\n\n window.addEventListener('message', function (event) {\n if (!event) {\n return;\n }\n\n if (event.source === (this.iframe && this.iframe.contentWindow)) {\n this.handleMessageEvent(event, options);\n }\n }.bind(this), false);\n this.getContainer = this.getContainer.bind(this);\n this.getParameters = this.getParameters.bind(this);\n this.getActiveParameterValues = this.getActiveParameterValues.bind(this);\n this.getSheets = this.getSheets.bind(this);\n this.getDefaultEmbeddingVisualType = this.getDefaultEmbeddingVisualType.bind(this);\n this.getUrl = this.getUrl.bind(this);\n this.handleMessageEvent = this.handleMessageEvent.bind(this);\n this.setParameters = this.setParameters.bind(this);\n this.setDefaultEmbeddingVisualType = this.setDefaultEmbeddingVisualType.bind(this);\n }\n\n _createClass(EmbeddableObject, [{\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: \"getActiveParameterValues\",\n value: function getActiveParameterValues(callback) {\n if (typeof callback !== 'function') {\n return;\n }\n\n if (this.getActiveParametersCallback) {\n this.off(_constants.CLIENT_FACING_EVENT_NAMES.GET_ACTIVE_PARAMETER_VALUES, this.getActiveParametersCallback);\n }\n\n this.getActiveParametersCallback = callback;\n this.on(_constants.CLIENT_FACING_EVENT_NAMES.GET_ACTIVE_PARAMETER_VALUES, callback);\n var event = (0, _constructEvent[\"default\"])(_constants.OUT_GOING_POST_MESSAGE_EVENT_NAMES.GET_ACTIVE_PARAMETER_VALUES, {});\n this.iframe.contentWindow.postMessage(event, this.url);\n }\n }, {\n key: \"getSheets\",\n value: function getSheets(callback) {\n if (typeof callback !== 'function') {\n return;\n }\n\n if (this.getSheetsCallback) {\n this.off(_constants.CLIENT_FACING_EVENT_NAMES.GET_SHEETS, this.getSheetsCallback);\n }\n\n this.getSheetsCallback = callback;\n this.on(_constants.CLIENT_FACING_EVENT_NAMES.GET_SHEETS, callback);\n var event = (0, _constructEvent[\"default\"])(_constants.OUT_GOING_POST_MESSAGE_EVENT_NAMES.GET_SHEETS, {});\n this.iframe.contentWindow.postMessage(event, this.url);\n }\n }, {\n key: \"handleMessageEvent\",\n value: function handleMessageEvent(event, options) {\n var _event$data = event.data,\n eventName = _event$data.eventName,\n payload = _event$data.payload;\n this.trigger(_constants.CLIENT_FACING_EVENT_NAMES[eventName], payload);\n\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 }, {\n key: \"getDefaultEmbeddingVisualType\",\n value: function getDefaultEmbeddingVisualType() {\n return this.defaultEmbeddingVisualType;\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 = {\n parameters: parameters\n };\n var event = (0, _constructEvent[\"default\"])(eventName, payload);\n this.iframe.contentWindow.postMessage(event, this.url);\n }\n }, {\n key: \"setDefaultEmbeddingVisualType\",\n value: function setDefaultEmbeddingVisualType(defaultEmbeddingVisualType) {\n var event = this.generateDefaultEmbeddingVisualTypeEvent(defaultEmbeddingVisualType);\n this.iframe.contentWindow.postMessage(event, this.url);\n }\n }, {\n key: \"generateDefaultEmbeddingVisualTypeEvent\",\n value: function generateDefaultEmbeddingVisualTypeEvent(defaultEmbeddingVisualType) {\n var eventName = _constants.OUT_GOING_POST_MESSAGE_EVENT_NAMES.DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS;\n\n if (defaultEmbeddingVisualType == null || !(defaultEmbeddingVisualType in _constants.DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS)) {\n defaultEmbeddingVisualType = _constants.DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS.AUTO_GRAPH;\n }\n\n var payload = {\n defaultEmbeddingVisualType: defaultEmbeddingVisualType\n };\n return (0, _constructEvent[\"default\"])(eventName, payload);\n }\n }]);\n\n return EmbeddableObject;\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\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 footerPaddingEnabled = options.footerPaddingEnabled,\n iframeResizeOnSheetChange = options.iframeResizeOnSheetChange,\n printEnabled = options.printEnabled,\n sheetId = options.sheetId,\n sheetTabsDisabled = options.sheetTabsDisabled;\n\n var src = url + '&punyCodeEmbedOrigin=' + _punycode[\"default\"].encode(window.location.origin + '/');\n\n src = src + '&printEnabled=' + String(!!printEnabled);\n\n if (locale) {\n src = src + '&locale=' + locale;\n }\n\n if (sheetTabsDisabled) {\n src = src + '&sheetTabsDisabled=' + String(sheetTabsDisabled);\n }\n\n if (sheetId) {\n src = src + '&sheetId=' + sheetId;\n }\n\n if (footerPaddingEnabled) {\n src = src + '&footerPaddingEnabled=' + String(footerPaddingEnabled);\n }\n\n if (iframeResizeOnSheetChange) {\n src = src + '&resizeOnSheetChange=' + String(iframeResizeOnSheetChange);\n }\n\n if (parameters) {\n return useParameterValuesInUrl(src, parameters);\n }\n\n return src;\n}\n/**\n * Use parameter values in url.\n * @function\n * @name useParameterValuesInUrl\n * @param {string} url - url of the session or dashboard to embed.\n * @param {Object} parameters\n */\n\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.\".concat(encodedName, \"=\").concat(encodedValue);\n }).join('&');\n });\n return \"\".concat(url, \"#\").concat(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, _constructEvent[\"default\"])(eventName); // wait until iframe.contentWindow exists and send message to iframe window\n\n iframe.contentWindow.postMessage(event, domain);\n}\n\nvar _default = EmbeddableObject;\nexports[\"default\"] = _default;\n\n//# sourceURL=webpack:///./dist/EmbeddableObject.js?"); | ||
eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nvar _eventify = _interopRequireDefault(__webpack_require__(/*! ./lib/eventify */ \"./dist/lib/eventify.js\"));\n\nvar _constructEvent = _interopRequireDefault(__webpack_require__(/*! ./lib/constructEvent */ \"./dist/lib/constructEvent.js\"));\n\nvar _constants = __webpack_require__(/*! ./lib/constants */ \"./dist/lib/constants.js\");\n\nvar _punycode = _interopRequireDefault(__webpack_require__(/*! punycode */ \"./node_modules/node-libs-browser/node_modules/punycode/punycode.js\"));\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\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n/**\n * Embedding options.\n * @typedef {Object} EmbeddingOptions\n * @property {string} url - url of the session or 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 {Function} parametersChangeCallback - callback when parameters change occurs\n * @property {Function} getActiveParametersCallback - callback to get active parameter values\n * @property {Function} getSheetsCallback - callback to get sheet details\n * @property {Function} selectedSheetChangeCallback - callback when current sheet is changed\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 Object class.\n * @class\n * @name EmbeddableObject\n * @param {EmbeddingOptions} options - options set by customers to embed the session or dashboard.\n */\nvar EmbeddableObject = /*#__PURE__*/function () {\n /* eslint-disable complexity */\n function EmbeddableObject(options) {\n _classCallCheck(this, EmbeddableObject);\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 defaultEmbeddingVisualType = options.defaultEmbeddingVisualType,\n errorCallback = options.errorCallback,\n loadCallback = options.loadCallback,\n parametersChangeCallback = options.parametersChangeCallback,\n selectedSheetChangeCallback = options.selectedSheetChangeCallback;\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 this.defaultEmbeddingVisualType = defaultEmbeddingVisualType;\n this.iframe = createIframe(options);\n (0, _eventify[\"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 if (typeof parametersChangeCallback === 'function') {\n this.on(_constants.CLIENT_FACING_EVENT_NAMES.parametersChange, parametersChangeCallback);\n }\n\n if (typeof selectedSheetChangeCallback === 'function') {\n this.on(_constants.CLIENT_FACING_EVENT_NAMES.selectedSheetChange, selectedSheetChangeCallback);\n }\n\n window.addEventListener('message', function (event) {\n if (!event) {\n return;\n }\n\n if (event.source === (this.iframe && this.iframe.contentWindow)) {\n this.handleMessageEvent(event, options);\n }\n }.bind(this), false);\n this.getContainer = this.getContainer.bind(this);\n this.getParameters = this.getParameters.bind(this);\n this.getActiveParameterValues = this.getActiveParameterValues.bind(this);\n this.getSheets = this.getSheets.bind(this);\n this.getDefaultEmbeddingVisualType = this.getDefaultEmbeddingVisualType.bind(this);\n this.getUrl = this.getUrl.bind(this);\n this.handleMessageEvent = this.handleMessageEvent.bind(this);\n this.setParameters = this.setParameters.bind(this);\n this.setDefaultEmbeddingVisualType = this.setDefaultEmbeddingVisualType.bind(this);\n }\n\n _createClass(EmbeddableObject, [{\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: \"getActiveParameterValues\",\n value: function getActiveParameterValues(callback) {\n if (typeof callback !== 'function') {\n return;\n }\n\n if (this.getActiveParametersCallback) {\n this.off(_constants.CLIENT_FACING_EVENT_NAMES.GET_ACTIVE_PARAMETER_VALUES, this.getActiveParametersCallback);\n }\n\n this.getActiveParametersCallback = callback;\n this.on(_constants.CLIENT_FACING_EVENT_NAMES.GET_ACTIVE_PARAMETER_VALUES, callback);\n var event = (0, _constructEvent[\"default\"])(_constants.OUT_GOING_POST_MESSAGE_EVENT_NAMES.GET_ACTIVE_PARAMETER_VALUES, {});\n this.iframe.contentWindow.postMessage(event, this.url);\n }\n }, {\n key: \"getSheets\",\n value: function getSheets(callback) {\n if (typeof callback !== 'function') {\n return;\n }\n\n if (this.getSheetsCallback) {\n this.off(_constants.CLIENT_FACING_EVENT_NAMES.GET_SHEETS, this.getSheetsCallback);\n }\n\n this.getSheetsCallback = callback;\n this.on(_constants.CLIENT_FACING_EVENT_NAMES.GET_SHEETS, callback);\n var event = (0, _constructEvent[\"default\"])(_constants.OUT_GOING_POST_MESSAGE_EVENT_NAMES.GET_SHEETS, {});\n this.iframe.contentWindow.postMessage(event, this.url);\n }\n }, {\n key: \"handleMessageEvent\",\n value: function handleMessageEvent(event, options) {\n var _event$data = event.data,\n eventName = _event$data.eventName,\n payload = _event$data.payload;\n this.trigger(_constants.CLIENT_FACING_EVENT_NAMES[eventName], payload);\n\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 }, {\n key: \"getDefaultEmbeddingVisualType\",\n value: function getDefaultEmbeddingVisualType() {\n return this.defaultEmbeddingVisualType;\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 = {\n parameters: parameters\n };\n var event = (0, _constructEvent[\"default\"])(eventName, payload);\n this.iframe.contentWindow.postMessage(event, this.url);\n }\n }, {\n key: \"setDefaultEmbeddingVisualType\",\n value: function setDefaultEmbeddingVisualType(defaultEmbeddingVisualType) {\n var event = this.generateDefaultEmbeddingVisualTypeEvent(defaultEmbeddingVisualType);\n this.iframe.contentWindow.postMessage(event, this.url);\n }\n }, {\n key: \"generateDefaultEmbeddingVisualTypeEvent\",\n value: function generateDefaultEmbeddingVisualTypeEvent(defaultEmbeddingVisualType) {\n var eventName = _constants.OUT_GOING_POST_MESSAGE_EVENT_NAMES.DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS;\n\n if (defaultEmbeddingVisualType == null || !(defaultEmbeddingVisualType in _constants.DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS)) {\n defaultEmbeddingVisualType = _constants.DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS.AUTO_GRAPH;\n }\n\n var payload = {\n defaultEmbeddingVisualType: defaultEmbeddingVisualType\n };\n return (0, _constructEvent[\"default\"])(eventName, payload);\n }\n }]);\n\n return EmbeddableObject;\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\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 footerPaddingEnabled = options.footerPaddingEnabled,\n iframeResizeOnSheetChange = options.iframeResizeOnSheetChange,\n printEnabled = options.printEnabled,\n resetDisabled = options.resetDisabled,\n sheetId = options.sheetId,\n sheetTabsDisabled = options.sheetTabsDisabled,\n undoRedoDisabled = options.undoRedoDisabled;\n\n var src = url + '&punyCodeEmbedOrigin=' + _punycode[\"default\"].encode(window.location.origin + '/');\n\n src = src + '&printEnabled=' + String(!!printEnabled);\n\n if (locale) {\n src = src + '&locale=' + locale;\n }\n\n if (sheetTabsDisabled) {\n src = src + '&sheetTabsDisabled=' + String(sheetTabsDisabled);\n }\n\n if (sheetId) {\n src = src + '&sheetId=' + sheetId;\n }\n\n if (footerPaddingEnabled) {\n src = src + '&footerPaddingEnabled=' + String(footerPaddingEnabled);\n }\n\n if (undoRedoDisabled) {\n src = src + '&undoRedoDisabled=' + String(undoRedoDisabled);\n }\n\n if (resetDisabled) {\n src = src + '&resetDisabled=' + String(resetDisabled);\n }\n\n if (iframeResizeOnSheetChange) {\n src = src + '&resizeOnSheetChange=' + String(iframeResizeOnSheetChange);\n }\n\n if (parameters) {\n return useParameterValuesInUrl(src, parameters);\n }\n\n return src;\n}\n/**\n * Use parameter values in url.\n * @function\n * @name useParameterValuesInUrl\n * @param {string} url - url of the session or dashboard to embed.\n * @param {Object} parameters\n */\n\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.\".concat(encodedName, \"=\").concat(encodedValue);\n }).join('&');\n });\n return \"\".concat(url, \"#\").concat(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, _constructEvent[\"default\"])(eventName); // wait until iframe.contentWindow exists and send message to iframe window\n\n iframe.contentWindow.postMessage(event, domain);\n}\n\nvar _default = EmbeddableObject;\nexports[\"default\"] = _default;\n\n//# sourceURL=webpack:///./dist/EmbeddableObject.js?"); | ||
@@ -112,0 +112,0 @@ /***/ }), |
@@ -1,1 +0,1 @@ | ||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},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=4)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS=t.DASHBOARD_SIZE_OPTIONS=t.CLIENT_FACING_EVENT_NAMES=t.IN_COMING_POST_MESSAGE_EVENT_NAMES=t.OUT_GOING_POST_MESSAGE_EVENT_NAMES=void 0;t.OUT_GOING_POST_MESSAGE_EVENT_NAMES={ESTABLISH_MESSAGE_CHANNEL:"establishMessageChannel",UPDATE_PARAMETER_VALUES:"updateParameterValues",DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS:"updateDefaultEmbeddingVisualType",NAVIGATE_TO_DASHBOARD:"navigateToDashboard",GET_ACTIVE_PARAMETER_VALUES:"getActiveParameterValues",NAVIGATE_TO_SHEET:"navigateToSheet",GET_SHEETS:"getSheets",PRINT:"initiatePrint"};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",parametersChange:"parametersChange",selectedSheetChange:"selectedSheetChange",RESIZE_EVENT:"resize",SHOW_MODAL_EVENT:"SHOW_MODAL_EVENT",GET_ACTIVE_PARAMETER_VALUES:"GET_ACTIVE_PARAMETER_VALUES",GET_SHEETS:"GET_SHEETS"};t.DASHBOARD_SIZE_OPTIONS={AUTO_FIT:"AutoFit"};t.DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS={AUTO_GRAPH:"AUTO_GRAPH",TABLE:"TABLE"}},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=u(n(7)),i=u(n(3)),o=n(0),a=u(n(8));function u(e){return e&&e.__esModule?e:{default:e}}function s(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)}}function l(e,t){null===e.contentWindow&&setTimeout(l.bind(null,e,t),100);var n=o.OUT_GOING_POST_MESSAGE_EVENT_NAMES.ESTABLISH_MESSAGE_CHANNEL,r=(0,i.default)(n);e.contentWindow.postMessage(r,t)}var c=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,i=t.container,u=t.parameters,s=t.defaultEmbeddingVisualType,c=t.errorCallback,f=t.loadCallback,E=t.parametersChangeCallback,d=t.selectedSheetChangeCallback;if(this.url=n,i instanceof HTMLElement?this.container=i:"string"==typeof i&&(this.container=document.querySelector(i)),!this.container)throw new Error("can't find valid container");this.parameters=u,this.defaultEmbeddingVisualType=s,this.iframe=function(e){var t=e.width,n=e.height,r=e.loadingHeight,i=e.url,u=e.scrolling,s=e.className;n===o.DASHBOARD_SIZE_OPTIONS.AUTO_FIT&&(n=r);var c=document.createElement("iframe");return c.className=["quicksight-embedding-iframe",s].join(" ").trim(),c.width=t||"100%",c.height=n||"100%",c.scrolling=u||"no",c.onload=l.bind(null,c,i),c.src=function(e){var t=e.url,n=e.parameters,r=e.locale,i=e.footerPaddingEnabled,o=e.iframeResizeOnSheetChange,u=e.printEnabled,s=e.sheetId,l=e.sheetTabsDisabled,c=t+"&punyCodeEmbedOrigin="+a.default.encode(window.location.origin+"/");c=c+"&printEnabled="+String(!!u),r&&(c=c+"&locale="+r);l&&(c=c+"&sheetTabsDisabled="+String(l));s&&(c=c+"&sheetId="+s);i&&(c=c+"&footerPaddingEnabled="+String(i));o&&(c=c+"&resizeOnSheetChange="+String(o));if(n)return function(e,t){var n=Object.keys(t).map((function(e){var n=t[e],r=[].concat(n),i=encodeURIComponent(e);return r.map((function(e){return encodeURIComponent(e)})).map((function(e){return"p.".concat(i,"=").concat(e)})).join("&")}));return"".concat(e,"#").concat(n.join("&"))}(c,n);return c}(e),c.style.border="0px",c.style.padding="0px",c}(t),(0,r.default)(this),"function"==typeof c&&this.on(o.CLIENT_FACING_EVENT_NAMES.error,c),"function"==typeof f&&this.on(o.CLIENT_FACING_EVENT_NAMES.load,f),"function"==typeof E&&this.on(o.CLIENT_FACING_EVENT_NAMES.parametersChange,E),"function"==typeof d&&this.on(o.CLIENT_FACING_EVENT_NAMES.selectedSheetChange,d),window.addEventListener("message",function(e){e&&e.source===(this.iframe&&this.iframe.contentWindow)&&this.handleMessageEvent(e,t)}.bind(this),!1),this.getContainer=this.getContainer.bind(this),this.getParameters=this.getParameters.bind(this),this.getActiveParameterValues=this.getActiveParameterValues.bind(this),this.getSheets=this.getSheets.bind(this),this.getDefaultEmbeddingVisualType=this.getDefaultEmbeddingVisualType.bind(this),this.getUrl=this.getUrl.bind(this),this.handleMessageEvent=this.handleMessageEvent.bind(this),this.setParameters=this.setParameters.bind(this),this.setDefaultEmbeddingVisualType=this.setDefaultEmbeddingVisualType.bind(this)}var t,n,u;return t=e,(n=[{key:"getUrl",value:function(){return this.url}},{key:"getContainer",value:function(){return this.container}},{key:"getParameters",value:function(){return this.parameters}},{key:"getActiveParameterValues",value:function(e){if("function"==typeof e){this.getActiveParametersCallback&&this.off(o.CLIENT_FACING_EVENT_NAMES.GET_ACTIVE_PARAMETER_VALUES,this.getActiveParametersCallback),this.getActiveParametersCallback=e,this.on(o.CLIENT_FACING_EVENT_NAMES.GET_ACTIVE_PARAMETER_VALUES,e);var t=(0,i.default)(o.OUT_GOING_POST_MESSAGE_EVENT_NAMES.GET_ACTIVE_PARAMETER_VALUES,{});this.iframe.contentWindow.postMessage(t,this.url)}}},{key:"getSheets",value:function(e){if("function"==typeof e){this.getSheetsCallback&&this.off(o.CLIENT_FACING_EVENT_NAMES.GET_SHEETS,this.getSheetsCallback),this.getSheetsCallback=e,this.on(o.CLIENT_FACING_EVENT_NAMES.GET_SHEETS,e);var t=(0,i.default)(o.OUT_GOING_POST_MESSAGE_EVENT_NAMES.GET_SHEETS,{});this.iframe.contentWindow.postMessage(t,this.url)}}},{key:"handleMessageEvent",value:function(e,t){var n=e.data,r=n.eventName,i=n.payload;this.trigger(o.CLIENT_FACING_EVENT_NAMES[r],i),r===o.IN_COMING_POST_MESSAGE_EVENT_NAMES.RESIZE_EVENT&&t.height===o.DASHBOARD_SIZE_OPTIONS.AUTO_FIT&&(this.iframe.height=i.height)}},{key:"getDefaultEmbeddingVisualType",value:function(){return this.defaultEmbeddingVisualType}},{key:"setParameters",value:function(e){var t=o.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)}},{key:"setDefaultEmbeddingVisualType",value:function(e){var t=this.generateDefaultEmbeddingVisualTypeEvent(e);this.iframe.contentWindow.postMessage(t,this.url)}},{key:"generateDefaultEmbeddingVisualTypeEvent",value:function(e){var t=o.OUT_GOING_POST_MESSAGE_EVENT_NAMES.DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS;null!=e&&e in o.DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS||(e=o.DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS.AUTO_GRAPH);var n={defaultEmbeddingVisualType:e};return(0,i.default)(t,n)}}])&&s(t.prototype,n),u&&s(t,u),e}();t.default=c},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){(function(t){e.exports=t.QuickSightEmbedding=n(5)}).call(this,n(1))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"embedDashboard",{enumerable:!0,get:function(){return r.embedDashboard}}),Object.defineProperty(t,"embedSession",{enumerable:!0,get:function(){return r.embedSession}});var r=n(6)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.embedDashboard=function(e){return a(new i.default(e))},t.embedSession=function(e){return a(new r.default(e))};var r=o(n(2)),i=o(n(10));function o(e){return e&&e.__esModule?e:{default:e}}function a(e){var t=e.getContainer();return setTimeout(u.bind(null,e.iframe,t),0),e}function u(e,t){if(!e)throw new Error("iFrame is required");if(!t)throw new Error("container of iFrame is required");t.appendChild(e)}},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 i=t.get(n);if(!i)return e;return i.delete(r),e},e.trigger=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];var o=t.get(e);o&&o.forEach((function(e){return e.apply(null,r)}))},e}},function(e,t,n){(function(e,r){var i;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(o){t&&t.nodeType,e&&e.nodeType;var a="object"==typeof r&&r;a.global!==a&&a.window!==a&&a.self;var u,s=2147483647,l=/^xn--/,c=/[^\x20-\x7E]/,f=/[\x2E\u3002\uFF0E\uFF61]/g,E={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},d=Math.floor,_=String.fromCharCode;function h(e){throw new RangeError(E[e])}function T(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function S(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+T((e=e.replace(f,".")).split("."),t).join(".")}function p(e){for(var t,n,r=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(n=e.charCodeAt(i++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),i--):r.push(t);return r}function A(e){return T(e,(function(e){var t="";return e>65535&&(t+=_((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=_(e)})).join("")}function g(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function N(e,t,n){var r=0;for(e=n?d(e/700):e>>1,e+=d(e/t);e>455;r+=36)e=d(e/35);return d(r+36*e/(e+38))}function b(e){var t,n,r,i,o,a,u,l,c,f,E,_=[],T=e.length,S=0,p=128,g=72;for((n=e.lastIndexOf("-"))<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&h("not-basic"),_.push(e.charCodeAt(r));for(i=n>0?n+1:0;i<T;){for(o=S,a=1,u=36;i>=T&&h("invalid-input"),((l=(E=e.charCodeAt(i++))-48<10?E-22:E-65<26?E-65:E-97<26?E-97:36)>=36||l>d((s-S)/a))&&h("overflow"),S+=l*a,!(l<(c=u<=g?1:u>=g+26?26:u-g));u+=36)a>d(s/(f=36-c))&&h("overflow"),a*=f;g=N(S-o,t=_.length+1,0==o),d(S/t)>s-p&&h("overflow"),p+=d(S/t),S%=t,_.splice(S++,0,p)}return A(_)}function O(e){var t,n,r,i,o,a,u,l,c,f,E,T,S,A,b,O=[];for(T=(e=p(e)).length,t=128,n=0,o=72,a=0;a<T;++a)(E=e[a])<128&&O.push(_(E));for(r=i=O.length,i&&O.push("-");r<T;){for(u=s,a=0;a<T;++a)(E=e[a])>=t&&E<u&&(u=E);for(u-t>d((s-n)/(S=r+1))&&h("overflow"),n+=(u-t)*S,t=u,a=0;a<T;++a)if((E=e[a])<t&&++n>s&&h("overflow"),E==t){for(l=n,c=36;!(l<(f=c<=o?1:c>=o+26?26:c-o));c+=36)b=l-f,A=36-f,O.push(_(g(f+b%A,0))),l=d(b/A);O.push(_(g(l,0))),o=N(n,S,r==i),n=0,++r}++n,++t}return O.join("")}u={version:"1.4.1",ucs2:{decode:p,encode:A},decode:b,encode:O,toASCII:function(e){return S(e,(function(e){return c.test(e)?"xn--"+O(e):e}))},toUnicode:function(e){return S(e,(function(e){return l.test(e)?b(e.slice(4).toLowerCase()):e}))}},void 0===(i=function(){return u}.call(t,n,t,e))||(e.exports=i)}()}).call(this,n(9)(e),n(1))},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){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=a(n(3)),i=a(n(2)),o=n(0);function a(e){return e&&e.__esModule?e:{default:e}}function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(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)}}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=E(e);if(t){var i=E(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return f(this,n)}}function f(e,t){return!t||"object"!==u(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var d=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}(u,e);var t,n,i,a=c(u);function u(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),a.call(this,e)}return t=u,(n=[{key:"navigateToDashboard",value:function(e){if(!e.dashboardId)throw new Error("dashboardId is required");var t=o.OUT_GOING_POST_MESSAGE_EVENT_NAMES.NAVIGATE_TO_DASHBOARD,n=e,i=(0,r.default)(t,n);this.iframe.contentWindow.postMessage(i,this.url)}},{key:"navigateToSheet",value:function(e){var t=o.OUT_GOING_POST_MESSAGE_EVENT_NAMES.NAVIGATE_TO_SHEET,n={sheetId:e},i=(0,r.default)(t,n);this.iframe.contentWindow.postMessage(i,this.url)}},{key:"initiatePrint",value:function(){var e=o.OUT_GOING_POST_MESSAGE_EVENT_NAMES.PRINT,t=(0,r.default)(e,{});this.iframe.contentWindow.postMessage(t,this.url)}}])&&s(t.prototype,n),i&&s(t,i),u}(i.default);t.default=d}]); | ||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},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=4)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS=t.DASHBOARD_SIZE_OPTIONS=t.CLIENT_FACING_EVENT_NAMES=t.IN_COMING_POST_MESSAGE_EVENT_NAMES=t.OUT_GOING_POST_MESSAGE_EVENT_NAMES=void 0;t.OUT_GOING_POST_MESSAGE_EVENT_NAMES={ESTABLISH_MESSAGE_CHANNEL:"establishMessageChannel",UPDATE_PARAMETER_VALUES:"updateParameterValues",DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS:"updateDefaultEmbeddingVisualType",NAVIGATE_TO_DASHBOARD:"navigateToDashboard",GET_ACTIVE_PARAMETER_VALUES:"getActiveParameterValues",NAVIGATE_TO_SHEET:"navigateToSheet",GET_SHEETS:"getSheets",PRINT:"initiatePrint"};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",parametersChange:"parametersChange",selectedSheetChange:"selectedSheetChange",RESIZE_EVENT:"resize",SHOW_MODAL_EVENT:"SHOW_MODAL_EVENT",GET_ACTIVE_PARAMETER_VALUES:"GET_ACTIVE_PARAMETER_VALUES",GET_SHEETS:"GET_SHEETS"};t.DASHBOARD_SIZE_OPTIONS={AUTO_FIT:"AutoFit"};t.DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS={AUTO_GRAPH:"AUTO_GRAPH",TABLE:"TABLE"}},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=u(n(7)),i=u(n(3)),o=n(0),a=u(n(8));function u(e){return e&&e.__esModule?e:{default:e}}function s(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)}}function l(e,t){null===e.contentWindow&&setTimeout(l.bind(null,e,t),100);var n=o.OUT_GOING_POST_MESSAGE_EVENT_NAMES.ESTABLISH_MESSAGE_CHANNEL,r=(0,i.default)(n);e.contentWindow.postMessage(r,t)}var c=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,i=t.container,u=t.parameters,s=t.defaultEmbeddingVisualType,c=t.errorCallback,f=t.loadCallback,E=t.parametersChangeCallback,d=t.selectedSheetChangeCallback;if(this.url=n,i instanceof HTMLElement?this.container=i:"string"==typeof i&&(this.container=document.querySelector(i)),!this.container)throw new Error("can't find valid container");this.parameters=u,this.defaultEmbeddingVisualType=s,this.iframe=function(e){var t=e.width,n=e.height,r=e.loadingHeight,i=e.url,u=e.scrolling,s=e.className;n===o.DASHBOARD_SIZE_OPTIONS.AUTO_FIT&&(n=r);var c=document.createElement("iframe");return c.className=["quicksight-embedding-iframe",s].join(" ").trim(),c.width=t||"100%",c.height=n||"100%",c.scrolling=u||"no",c.onload=l.bind(null,c,i),c.src=function(e){var t=e.url,n=e.parameters,r=e.locale,i=e.footerPaddingEnabled,o=e.iframeResizeOnSheetChange,u=e.printEnabled,s=e.resetDisabled,l=e.sheetId,c=e.sheetTabsDisabled,f=e.undoRedoDisabled,E=t+"&punyCodeEmbedOrigin="+a.default.encode(window.location.origin+"/");E=E+"&printEnabled="+String(!!u),r&&(E=E+"&locale="+r);c&&(E=E+"&sheetTabsDisabled="+String(c));l&&(E=E+"&sheetId="+l);i&&(E=E+"&footerPaddingEnabled="+String(i));f&&(E=E+"&undoRedoDisabled="+String(f));s&&(E=E+"&resetDisabled="+String(s));o&&(E=E+"&resizeOnSheetChange="+String(o));if(n)return function(e,t){var n=Object.keys(t).map((function(e){var n=t[e],r=[].concat(n),i=encodeURIComponent(e);return r.map((function(e){return encodeURIComponent(e)})).map((function(e){return"p.".concat(i,"=").concat(e)})).join("&")}));return"".concat(e,"#").concat(n.join("&"))}(E,n);return E}(e),c.style.border="0px",c.style.padding="0px",c}(t),(0,r.default)(this),"function"==typeof c&&this.on(o.CLIENT_FACING_EVENT_NAMES.error,c),"function"==typeof f&&this.on(o.CLIENT_FACING_EVENT_NAMES.load,f),"function"==typeof E&&this.on(o.CLIENT_FACING_EVENT_NAMES.parametersChange,E),"function"==typeof d&&this.on(o.CLIENT_FACING_EVENT_NAMES.selectedSheetChange,d),window.addEventListener("message",function(e){e&&e.source===(this.iframe&&this.iframe.contentWindow)&&this.handleMessageEvent(e,t)}.bind(this),!1),this.getContainer=this.getContainer.bind(this),this.getParameters=this.getParameters.bind(this),this.getActiveParameterValues=this.getActiveParameterValues.bind(this),this.getSheets=this.getSheets.bind(this),this.getDefaultEmbeddingVisualType=this.getDefaultEmbeddingVisualType.bind(this),this.getUrl=this.getUrl.bind(this),this.handleMessageEvent=this.handleMessageEvent.bind(this),this.setParameters=this.setParameters.bind(this),this.setDefaultEmbeddingVisualType=this.setDefaultEmbeddingVisualType.bind(this)}var t,n,u;return t=e,(n=[{key:"getUrl",value:function(){return this.url}},{key:"getContainer",value:function(){return this.container}},{key:"getParameters",value:function(){return this.parameters}},{key:"getActiveParameterValues",value:function(e){if("function"==typeof e){this.getActiveParametersCallback&&this.off(o.CLIENT_FACING_EVENT_NAMES.GET_ACTIVE_PARAMETER_VALUES,this.getActiveParametersCallback),this.getActiveParametersCallback=e,this.on(o.CLIENT_FACING_EVENT_NAMES.GET_ACTIVE_PARAMETER_VALUES,e);var t=(0,i.default)(o.OUT_GOING_POST_MESSAGE_EVENT_NAMES.GET_ACTIVE_PARAMETER_VALUES,{});this.iframe.contentWindow.postMessage(t,this.url)}}},{key:"getSheets",value:function(e){if("function"==typeof e){this.getSheetsCallback&&this.off(o.CLIENT_FACING_EVENT_NAMES.GET_SHEETS,this.getSheetsCallback),this.getSheetsCallback=e,this.on(o.CLIENT_FACING_EVENT_NAMES.GET_SHEETS,e);var t=(0,i.default)(o.OUT_GOING_POST_MESSAGE_EVENT_NAMES.GET_SHEETS,{});this.iframe.contentWindow.postMessage(t,this.url)}}},{key:"handleMessageEvent",value:function(e,t){var n=e.data,r=n.eventName,i=n.payload;this.trigger(o.CLIENT_FACING_EVENT_NAMES[r],i),r===o.IN_COMING_POST_MESSAGE_EVENT_NAMES.RESIZE_EVENT&&t.height===o.DASHBOARD_SIZE_OPTIONS.AUTO_FIT&&(this.iframe.height=i.height)}},{key:"getDefaultEmbeddingVisualType",value:function(){return this.defaultEmbeddingVisualType}},{key:"setParameters",value:function(e){var t=o.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)}},{key:"setDefaultEmbeddingVisualType",value:function(e){var t=this.generateDefaultEmbeddingVisualTypeEvent(e);this.iframe.contentWindow.postMessage(t,this.url)}},{key:"generateDefaultEmbeddingVisualTypeEvent",value:function(e){var t=o.OUT_GOING_POST_MESSAGE_EVENT_NAMES.DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS;null!=e&&e in o.DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS||(e=o.DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS.AUTO_GRAPH);var n={defaultEmbeddingVisualType:e};return(0,i.default)(t,n)}}])&&s(t.prototype,n),u&&s(t,u),e}();t.default=c},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){(function(t){e.exports=t.QuickSightEmbedding=n(5)}).call(this,n(1))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"embedDashboard",{enumerable:!0,get:function(){return r.embedDashboard}}),Object.defineProperty(t,"embedSession",{enumerable:!0,get:function(){return r.embedSession}});var r=n(6)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.embedDashboard=function(e){return a(new i.default(e))},t.embedSession=function(e){return a(new r.default(e))};var r=o(n(2)),i=o(n(10));function o(e){return e&&e.__esModule?e:{default:e}}function a(e){var t=e.getContainer();return setTimeout(u.bind(null,e.iframe,t),0),e}function u(e,t){if(!e)throw new Error("iFrame is required");if(!t)throw new Error("container of iFrame is required");t.appendChild(e)}},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 i=t.get(n);if(!i)return e;return i.delete(r),e},e.trigger=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];var o=t.get(e);o&&o.forEach((function(e){return e.apply(null,r)}))},e}},function(e,t,n){(function(e,r){var i;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(o){t&&t.nodeType,e&&e.nodeType;var a="object"==typeof r&&r;a.global!==a&&a.window!==a&&a.self;var u,s=2147483647,l=/^xn--/,c=/[^\x20-\x7E]/,f=/[\x2E\u3002\uFF0E\uFF61]/g,E={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},d=Math.floor,_=String.fromCharCode;function h(e){throw new RangeError(E[e])}function T(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function S(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+T((e=e.replace(f,".")).split("."),t).join(".")}function p(e){for(var t,n,r=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(n=e.charCodeAt(i++)))?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),i--):r.push(t);return r}function A(e){return T(e,(function(e){var t="";return e>65535&&(t+=_((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=_(e)})).join("")}function g(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function b(e,t,n){var r=0;for(e=n?d(e/700):e>>1,e+=d(e/t);e>455;r+=36)e=d(e/35);return d(r+36*e/(e+38))}function N(e){var t,n,r,i,o,a,u,l,c,f,E,_=[],T=e.length,S=0,p=128,g=72;for((n=e.lastIndexOf("-"))<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&h("not-basic"),_.push(e.charCodeAt(r));for(i=n>0?n+1:0;i<T;){for(o=S,a=1,u=36;i>=T&&h("invalid-input"),((l=(E=e.charCodeAt(i++))-48<10?E-22:E-65<26?E-65:E-97<26?E-97:36)>=36||l>d((s-S)/a))&&h("overflow"),S+=l*a,!(l<(c=u<=g?1:u>=g+26?26:u-g));u+=36)a>d(s/(f=36-c))&&h("overflow"),a*=f;g=b(S-o,t=_.length+1,0==o),d(S/t)>s-p&&h("overflow"),p+=d(S/t),S%=t,_.splice(S++,0,p)}return A(_)}function O(e){var t,n,r,i,o,a,u,l,c,f,E,T,S,A,N,O=[];for(T=(e=p(e)).length,t=128,n=0,o=72,a=0;a<T;++a)(E=e[a])<128&&O.push(_(E));for(r=i=O.length,i&&O.push("-");r<T;){for(u=s,a=0;a<T;++a)(E=e[a])>=t&&E<u&&(u=E);for(u-t>d((s-n)/(S=r+1))&&h("overflow"),n+=(u-t)*S,t=u,a=0;a<T;++a)if((E=e[a])<t&&++n>s&&h("overflow"),E==t){for(l=n,c=36;!(l<(f=c<=o?1:c>=o+26?26:c-o));c+=36)N=l-f,A=36-f,O.push(_(g(f+N%A,0))),l=d(N/A);O.push(_(g(l,0))),o=b(n,S,r==i),n=0,++r}++n,++t}return O.join("")}u={version:"1.4.1",ucs2:{decode:p,encode:A},decode:N,encode:O,toASCII:function(e){return S(e,(function(e){return c.test(e)?"xn--"+O(e):e}))},toUnicode:function(e){return S(e,(function(e){return l.test(e)?N(e.slice(4).toLowerCase()):e}))}},void 0===(i=function(){return u}.call(t,n,t,e))||(e.exports=i)}()}).call(this,n(9)(e),n(1))},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){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=a(n(3)),i=a(n(2)),o=n(0);function a(e){return e&&e.__esModule?e:{default:e}}function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(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)}}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=E(e);if(t){var i=E(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return f(this,n)}}function f(e,t){return!t||"object"!==u(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var d=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}(u,e);var t,n,i,a=c(u);function u(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),a.call(this,e)}return t=u,(n=[{key:"navigateToDashboard",value:function(e){if(!e.dashboardId)throw new Error("dashboardId is required");var t=o.OUT_GOING_POST_MESSAGE_EVENT_NAMES.NAVIGATE_TO_DASHBOARD,n=e,i=(0,r.default)(t,n);this.iframe.contentWindow.postMessage(i,this.url)}},{key:"navigateToSheet",value:function(e){var t=o.OUT_GOING_POST_MESSAGE_EVENT_NAMES.NAVIGATE_TO_SHEET,n={sheetId:e},i=(0,r.default)(t,n);this.iframe.contentWindow.postMessage(i,this.url)}},{key:"initiatePrint",value:function(){var e=o.OUT_GOING_POST_MESSAGE_EVENT_NAMES.PRINT,t=(0,r.default)(e,{});this.iframe.contentWindow.postMessage(t,this.url)}}])&&s(t.prototype,n),i&&s(t,i),u}(i.default);t.default=d}]); |
{ | ||
"name": "amazon-quicksight-embedding-sdk", | ||
"description": "JS SDK for embedding Amazon QuickSight", | ||
"version": "1.0.15", | ||
"version": "1.0.16", | ||
"main": "dist/index.js", | ||
@@ -26,3 +26,3 @@ "homepage": "https://github.com/awslabs/amazon-quicksight-embedding-sdk", | ||
"devDependencies": { | ||
"@babel/cli": "^7.8.4", | ||
"@babel/cli": "^7.14.5", | ||
"@babel/core": "^7.9.6", | ||
@@ -29,0 +29,0 @@ "@babel/preset-env": "^7.9.6", |
@@ -31,3 +31,3 @@ # Amazon QuickSight Embedding SDK | ||
```html | ||
<script src="https://unpkg.com/amazon-quicksight-embedding-sdk@1.0.15/dist/quicksight-embedding-js-sdk.min.js"></script> | ||
<script src="https://unpkg.com/amazon-quicksight-embedding-sdk@1.0.16/dist/quicksight-embedding-js-sdk.min.js"></script> | ||
``` | ||
@@ -92,2 +92,4 @@ *OR* | ||
printEnabled: false, // use this option to enable or disable print option for dashboard embedding | ||
undoRedoDisabled: false, // set this option to true to disable undo and redo buttons for dashboard embedding | ||
resetDisabled: false, // set this option to true to disable reset button for dashboard embedding | ||
defaultEmbeddingVisualType: TABLE // this option only applies to experience embedding and will not be used for dashboard embedding | ||
@@ -224,2 +226,8 @@ }; | ||
#### UndoRedoDisabled element (optional) | ||
The `undoRedoDisabled` element can be used to disable undo and redo buttons for dashboard embedding. If this option is set to `true`, the undo redo buttons will not be shown. The default value is `false`. | ||
#### ResetDisabled element (optional) | ||
The `resetDisabled` element can be used to disable reset button for dashboard embedding. If this option is set to `true`, the reset button will not be shown. The default value is `false`. | ||
#### SheetTabsDisabled element (optional) | ||
@@ -416,3 +424,3 @@ **This is currently only supported for dashboard embedding.** | ||
<title>Basic Embed</title> | ||
<script src="https://unpkg.com/amazon-quicksight-embedding-sdk@1.0.15/dist/quicksight-embedding-js-sdk.min.js"></script> | ||
<script src="https://unpkg.com/amazon-quicksight-embedding-sdk@1.0.16/dist/quicksight-embedding-js-sdk.min.js"></script> | ||
<script type="text/javascript"> | ||
@@ -475,3 +483,3 @@ var dashboard | ||
<title>QuickSight Console Embedding</title> | ||
<script src="https://unpkg.com/amazon-quicksight-embedding-sdk@1.0.15/dist/quicksight-embedding-js-sdk.min.js"></script> | ||
<script src="https://unpkg.com/amazon-quicksight-embedding-sdk@1.0.16/dist/quicksight-embedding-js-sdk.min.js"></script> | ||
<script type="text/javascript"> | ||
@@ -478,0 +486,0 @@ var session |
@@ -236,4 +236,6 @@ // @flow | ||
printEnabled, | ||
resetDisabled, | ||
sheetId, | ||
sheetTabsDisabled, | ||
undoRedoDisabled, | ||
} = options; | ||
@@ -260,2 +262,10 @@ let src = url + '&punyCodeEmbedOrigin=' + punycode.encode(window.location.origin + '/'); | ||
if (undoRedoDisabled) { | ||
src = src + '&undoRedoDisabled=' + String(undoRedoDisabled); | ||
} | ||
if (resetDisabled) { | ||
src = src + '&resetDisabled=' + String(resetDisabled); | ||
} | ||
if (iframeResizeOnSheetChange) { | ||
@@ -262,0 +272,0 @@ src = src + '&resizeOnSheetChange=' + String(iframeResizeOnSheetChange); |
@@ -24,3 +24,5 @@ // @flow | ||
locale: ?string, | ||
footerPaddingEnabled: ?boolean | ||
footerPaddingEnabled: ?boolean, | ||
undoRedoDisabled: ?boolean, | ||
resetDisabled: ?boolean | ||
}; |
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
164979
1382
533
31