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
10
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.17.1 to 1.18.0

7

CHANGELOG.md

@@ -0,1 +1,8 @@

**1.18.0**
* Initial release of Q search bar embedding support
* Added new set of options for QSearchBar
**1.17.2**
* Upgrading dependency packages
**1.17.1**

@@ -2,0 +9,0 @@ * Minor bug fixes

22

dist/embed.js

@@ -7,2 +7,3 @@ "use strict";

exports.embedDashboard = embedDashboard;
exports.embedQSearchBar = embedQSearchBar;
exports.embedSession = embedSession;

@@ -16,5 +17,8 @@

// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
/**

@@ -42,3 +46,17 @@ * Embed a dashboard.

}
/**
* Embed Q search bar.
* @function
* @name embedQSearchBar
* @param {EmbeddingOptions} options - options set by customers to embed the Q search bar.
*/
function embedQSearchBar(options) {
var embeddedQSearchBar = new _EmbeddableObject["default"](_objectSpread(_objectSpread({}, options || {}), {}, {
isQEmbedded: true
}));
return embedObject(embeddedQSearchBar);
}
function embedObject(embeddableObject) {

@@ -45,0 +63,0 @@ var container = embeddableObject.getContainer();

2

dist/EmbeddableDashboard.js

@@ -30,3 +30,3 @@ "use strict";

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }

@@ -33,0 +33,0 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

@@ -45,2 +45,13 @@ "use strict";

/**
* Q SearchBar embedding options.
* @typedef {Object} QSearchBarOptions
* @property {Function} expandCallback - callback when Q search bar is expanded
* @property {Function} collapseCallback - callback when Q search bar is collapsed
* @property {boolean} iconDisabled - disable Q icon in search bar (only for single topic set)
* @property {boolean} topicNameDisabled - disable topic name in search bar (only for single topic set)
* @property {string} themeId - themeId to apply to search bar (theme must be shared with user)
* @property {boolean} allowTopicSelection - allow user to change selected topic (only when initialTopicId is set from API)
*/
/**
* Embeddable Object class.

@@ -52,2 +63,4 @@ * @class

var EmbeddableObject = /*#__PURE__*/function () {
// Q specific members
/* eslint-disable complexity */

@@ -72,3 +85,4 @@ function EmbeddableObject(options) {

parametersChangeCallback = options.parametersChangeCallback,
selectedSheetChangeCallback = options.selectedSheetChangeCallback;
selectedSheetChangeCallback = options.selectedSheetChangeCallback,
isQEmbedded = options.isQEmbedded;
this.url = url;

@@ -116,2 +130,17 @@

}.bind(this), false);
if (isQEmbedded) {
this.qBarOpen = false;
this.isQEmbedded = isQEmbedded;
this.qOptions = options.qSearchBarOptions;
window.addEventListener('click', function (event) {
var isClickInside = this.container ? this.container.contains(event.target) : true;
if (!isClickInside) {
var hideQBarEvent = (0, _constructEvent["default"])(_constants.OUT_GOING_POST_MESSAGE_EVENT_NAMES.HIDE_Q_BAR, {});
this.iframe.contentWindow.postMessage(hideQBarEvent, this.url);
}
}.bind(this), false);
}
this.getContainer = this.getContainer.bind(this);

@@ -176,2 +205,35 @@ this.getParameters = this.getParameters.bind(this);

}, {
key: "handleShowQ",
value: function handleShowQ(payload) {
if (this.qOptions && this.qOptions.expandCallback && typeof this.qOptions.expandCallback === 'function' && !this.qBarOpen) {
this.qOptions.expandCallback();
}
if (payload && payload.height) {
this.iframe.height = payload.height;
}
this.qBarOpen = true;
}
}, {
key: "handleHideQ",
value: function handleHideQ(payload) {
if (this.qOptions && this.qOptions.collapseCallback && typeof this.qOptions.collapseCallback === 'function' && this.qBarOpen) {
this.qOptions.collapseCallback();
}
if (payload && payload.height) {
this.iframe.height = payload.height;
}
this.qBarOpen = false;
}
}, {
key: "handleResizeQ",
value: function handleResizeQ(payload) {
if (payload && payload.height) {
this.iframe.height = payload.height;
}
}
}, {
key: "handleMessageEvent",

@@ -190,2 +252,8 @@ value: function handleMessageEvent(event, options) {

}
} else if (eventName === _constants.CLIENT_FACING_EVENT_NAMES.SHOW_Q_BAR) {
this.handleShowQ(payload);
} else if (eventName === _constants.CLIENT_FACING_EVENT_NAMES.HIDE_Q_BAR) {
this.handleHideQ(payload);
} else if (eventName === _constants.CLIENT_FACING_EVENT_NAMES.RESIZE_Q_BAR) {
this.handleResizeQ(payload);
}

@@ -235,3 +303,4 @@ }

var width = options.width,
height = options.height;
height = options.height,
isQEmbedded = options.isQEmbedded;
var loadingHeight = options.loadingHeight,

@@ -255,2 +324,7 @@ url = options.url,

iframe.style.padding = '0px';
if (isQEmbedded) {
iframe.setAttribute('allowtransparency', 'true');
}
return iframe;

@@ -269,3 +343,5 @@ }

sheetTabsDisabled = options.sheetTabsDisabled,
undoRedoDisabled = options.undoRedoDisabled;
undoRedoDisabled = options.undoRedoDisabled,
isQEmbedded = options.isQEmbedded,
qSearchBarOptions = options.qSearchBarOptions;

@@ -308,2 +384,20 @@ var src = url + '&punyCodeEmbedOrigin=' + _punycode["default"].encode(window.location.origin + '/');

if (isQEmbedded && qSearchBarOptions) {
if (qSearchBarOptions.iconDisabled !== undefined) {
src = src + '&qBarIconDisabled=' + String(qSearchBarOptions.iconDisabled);
}
if (qSearchBarOptions.topicNameDisabled !== undefined) {
src = src + '&qBarTopicNameDisabled=' + String(qSearchBarOptions.topicNameDisabled);
}
if (qSearchBarOptions.themeId) {
src = src + '&themeId=' + qSearchBarOptions.themeId;
}
if (qSearchBarOptions.allowTopicSelection !== undefined) {
src = src + '&allowTopicSelection=' + String(qSearchBarOptions.allowTopicSelection);
}
}
return src;

@@ -310,0 +404,0 @@ }

@@ -12,2 +12,8 @@ "use strict";

});
Object.defineProperty(exports, "embedQSearchBar", {
enumerable: true,
get: function get() {
return _embed.embedQSearchBar;
}
});
Object.defineProperty(exports, "embedSession", {

@@ -14,0 +20,0 @@ enumerable: true,

@@ -6,3 +6,3 @@ "use strict";

});
exports.DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS = exports.DASHBOARD_SIZE_OPTIONS = exports.CLIENT_FACING_EVENT_NAMES = exports.IN_COMING_POST_MESSAGE_EVENT_NAMES = exports.OUT_GOING_POST_MESSAGE_EVENT_NAMES = void 0;
exports.OUT_GOING_POST_MESSAGE_EVENT_NAMES = exports.IN_COMING_POST_MESSAGE_EVENT_NAMES = exports.DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS = exports.DASHBOARD_SIZE_OPTIONS = exports.CLIENT_FACING_EVENT_NAMES = void 0;
// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.

@@ -18,3 +18,4 @@ // SPDX-License-Identifier: Apache-2.0

GET_SHEETS: 'getSheets',
PRINT: 'initiatePrint'
PRINT: 'initiatePrint',
HIDE_Q_BAR: 'hideQSearchBar'
};

@@ -38,3 +39,6 @@ exports.OUT_GOING_POST_MESSAGE_EVENT_NAMES = OUT_GOING_POST_MESSAGE_EVENT_NAMES;

GET_ACTIVE_PARAMETER_VALUES: 'GET_ACTIVE_PARAMETER_VALUES',
GET_SHEETS: 'GET_SHEETS'
GET_SHEETS: 'GET_SHEETS',
SHOW_Q_BAR: 'showQSearchBar',
HIDE_Q_BAR: 'hideQSearchBar',
RESIZE_Q_BAR: 'resizeQSearchBar'
};

@@ -41,0 +45,0 @@ exports.CLIENT_FACING_EVENT_NAMES = CLIENT_FACING_EVENT_NAMES;

@@ -18,3 +18,3 @@ /******/ (() => { // webpackBootstrap

}));
exports.default = void 0;
exports["default"] = void 0;

@@ -41,3 +41,3 @@ var _constructEvent = _interopRequireDefault(__webpack_require__(/*! ./lib/constructEvent */ "./dist/lib/constructEvent.js"));

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }

@@ -112,3 +112,3 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

var _default = EmbeddableDashboard;
exports.default = _default;
exports["default"] = _default;

@@ -129,3 +129,3 @@ /***/ }),

}));
exports.default = void 0;
exports["default"] = void 0;

@@ -169,2 +169,13 @@ var _eventify = _interopRequireDefault(__webpack_require__(/*! ./lib/eventify */ "./dist/lib/eventify.js"));

/**
* Q SearchBar embedding options.
* @typedef {Object} QSearchBarOptions
* @property {Function} expandCallback - callback when Q search bar is expanded
* @property {Function} collapseCallback - callback when Q search bar is collapsed
* @property {boolean} iconDisabled - disable Q icon in search bar (only for single topic set)
* @property {boolean} topicNameDisabled - disable topic name in search bar (only for single topic set)
* @property {string} themeId - themeId to apply to search bar (theme must be shared with user)
* @property {boolean} allowTopicSelection - allow user to change selected topic (only when initialTopicId is set from API)
*/
/**
* Embeddable Object class.

@@ -176,2 +187,4 @@ * @class

var EmbeddableObject = /*#__PURE__*/function () {
// Q specific members
/* eslint-disable complexity */

@@ -196,3 +209,4 @@ function EmbeddableObject(options) {

parametersChangeCallback = options.parametersChangeCallback,
selectedSheetChangeCallback = options.selectedSheetChangeCallback;
selectedSheetChangeCallback = options.selectedSheetChangeCallback,
isQEmbedded = options.isQEmbedded;
this.url = url;

@@ -240,2 +254,17 @@

}.bind(this), false);
if (isQEmbedded) {
this.qBarOpen = false;
this.isQEmbedded = isQEmbedded;
this.qOptions = options.qSearchBarOptions;
window.addEventListener('click', function (event) {
var isClickInside = this.container ? this.container.contains(event.target) : true;
if (!isClickInside) {
var hideQBarEvent = (0, _constructEvent["default"])(_constants.OUT_GOING_POST_MESSAGE_EVENT_NAMES.HIDE_Q_BAR, {});
this.iframe.contentWindow.postMessage(hideQBarEvent, this.url);
}
}.bind(this), false);
}
this.getContainer = this.getContainer.bind(this);

@@ -300,2 +329,35 @@ this.getParameters = this.getParameters.bind(this);

}, {
key: "handleShowQ",
value: function handleShowQ(payload) {
if (this.qOptions && this.qOptions.expandCallback && typeof this.qOptions.expandCallback === 'function' && !this.qBarOpen) {
this.qOptions.expandCallback();
}
if (payload && payload.height) {
this.iframe.height = payload.height;
}
this.qBarOpen = true;
}
}, {
key: "handleHideQ",
value: function handleHideQ(payload) {
if (this.qOptions && this.qOptions.collapseCallback && typeof this.qOptions.collapseCallback === 'function' && this.qBarOpen) {
this.qOptions.collapseCallback();
}
if (payload && payload.height) {
this.iframe.height = payload.height;
}
this.qBarOpen = false;
}
}, {
key: "handleResizeQ",
value: function handleResizeQ(payload) {
if (payload && payload.height) {
this.iframe.height = payload.height;
}
}
}, {
key: "handleMessageEvent",

@@ -314,2 +376,8 @@ value: function handleMessageEvent(event, options) {

}
} else if (eventName === _constants.CLIENT_FACING_EVENT_NAMES.SHOW_Q_BAR) {
this.handleShowQ(payload);
} else if (eventName === _constants.CLIENT_FACING_EVENT_NAMES.HIDE_Q_BAR) {
this.handleHideQ(payload);
} else if (eventName === _constants.CLIENT_FACING_EVENT_NAMES.RESIZE_Q_BAR) {
this.handleResizeQ(payload);
}

@@ -359,3 +427,4 @@ }

var width = options.width,
height = options.height;
height = options.height,
isQEmbedded = options.isQEmbedded;
var loadingHeight = options.loadingHeight,

@@ -379,2 +448,7 @@ url = options.url,

iframe.style.padding = '0px';
if (isQEmbedded) {
iframe.setAttribute('allowtransparency', 'true');
}
return iframe;

@@ -393,3 +467,5 @@ }

sheetTabsDisabled = options.sheetTabsDisabled,
undoRedoDisabled = options.undoRedoDisabled;
undoRedoDisabled = options.undoRedoDisabled,
isQEmbedded = options.isQEmbedded,
qSearchBarOptions = options.qSearchBarOptions;

@@ -432,2 +508,20 @@ var src = url + '&punyCodeEmbedOrigin=' + _punycode["default"].encode(window.location.origin + '/');

if (isQEmbedded && qSearchBarOptions) {
if (qSearchBarOptions.iconDisabled !== undefined) {
src = src + '&qBarIconDisabled=' + String(qSearchBarOptions.iconDisabled);
}
if (qSearchBarOptions.topicNameDisabled !== undefined) {
src = src + '&qBarTopicNameDisabled=' + String(qSearchBarOptions.topicNameDisabled);
}
if (qSearchBarOptions.themeId) {
src = src + '&themeId=' + qSearchBarOptions.themeId;
}
if (qSearchBarOptions.allowTopicSelection !== undefined) {
src = src + '&allowTopicSelection=' + String(qSearchBarOptions.allowTopicSelection);
}
}
return src;

@@ -472,3 +566,3 @@ }

var _default = EmbeddableObject;
exports.default = _default;
exports["default"] = _default;

@@ -490,2 +584,3 @@ /***/ }),

exports.embedDashboard = embedDashboard;
exports.embedQSearchBar = embedQSearchBar;
exports.embedSession = embedSession;

@@ -499,5 +594,8 @@

// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
/**

@@ -525,3 +623,17 @@ * Embed a dashboard.

}
/**
* Embed Q search bar.
* @function
* @name embedQSearchBar
* @param {EmbeddingOptions} options - options set by customers to embed the Q search bar.
*/
function embedQSearchBar(options) {
var embeddedQSearchBar = new _EmbeddableObject["default"](_objectSpread(_objectSpread({}, options || {}), {}, {
isQEmbedded: true
}));
return embedObject(embeddedQSearchBar);
}
function embedObject(embeddableObject) {

@@ -574,2 +686,8 @@ var container = embeddableObject.getContainer();

}));
Object.defineProperty(exports, "embedQSearchBar", ({
enumerable: true,
get: function get() {
return _embed.embedQSearchBar;
}
}));
Object.defineProperty(exports, "embedSession", ({

@@ -598,3 +716,3 @@ enumerable: true,

}));
exports.DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS = exports.DASHBOARD_SIZE_OPTIONS = exports.CLIENT_FACING_EVENT_NAMES = exports.IN_COMING_POST_MESSAGE_EVENT_NAMES = exports.OUT_GOING_POST_MESSAGE_EVENT_NAMES = void 0;
exports.OUT_GOING_POST_MESSAGE_EVENT_NAMES = exports.IN_COMING_POST_MESSAGE_EVENT_NAMES = exports.DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS = exports.DASHBOARD_SIZE_OPTIONS = exports.CLIENT_FACING_EVENT_NAMES = void 0;
// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.

@@ -610,3 +728,4 @@ // SPDX-License-Identifier: Apache-2.0

GET_SHEETS: 'getSheets',
PRINT: 'initiatePrint'
PRINT: 'initiatePrint',
HIDE_Q_BAR: 'hideQSearchBar'
};

@@ -630,3 +749,6 @@ exports.OUT_GOING_POST_MESSAGE_EVENT_NAMES = OUT_GOING_POST_MESSAGE_EVENT_NAMES;

GET_ACTIVE_PARAMETER_VALUES: 'GET_ACTIVE_PARAMETER_VALUES',
GET_SHEETS: 'GET_SHEETS'
GET_SHEETS: 'GET_SHEETS',
SHOW_Q_BAR: 'showQSearchBar',
HIDE_Q_BAR: 'hideQSearchBar',
RESIZE_Q_BAR: 'resizeQSearchBar'
};

@@ -658,3 +780,3 @@ exports.CLIENT_FACING_EVENT_NAMES = CLIENT_FACING_EVENT_NAMES;

}));
exports.default = constructEvent;
exports["default"] = constructEvent;

@@ -695,3 +817,3 @@ var _constants = __webpack_require__(/*! ./constants */ "./dist/lib/constants.js");

}));
exports.default = eventify;
exports["default"] = eventify;

@@ -698,0 +820,0 @@ // Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.

@@ -1,2 +0,2 @@

(()=>{var e={712:(e,t,n)=>{"use strict";function r(e){return(r="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)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=s(n(812)),i=s(n(430)),a=n(593);function s(e){return e&&e.__esModule?e:{default:e}}function u(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 E(e,t){return!t||"object"!==r(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 c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var f=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)}(f,e);var t,n,r,i,s=(r=f,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=c(r);if(i){var n=c(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return E(this,e)});function f(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,f),s.call(this,e)}return t=f,(n=[{key:"navigateToDashboard",value:function(e){if(!e.dashboardId)throw new Error("dashboardId is required");var t=a.OUT_GOING_POST_MESSAGE_EVENT_NAMES.NAVIGATE_TO_DASHBOARD,n=e,r=(0,o.default)(t,n);this.iframe.contentWindow.postMessage(r,this.url)}},{key:"navigateToSheet",value:function(e){var t=a.OUT_GOING_POST_MESSAGE_EVENT_NAMES.NAVIGATE_TO_SHEET,n={sheetId:e},r=(0,o.default)(t,n);this.iframe.contentWindow.postMessage(r,this.url)}},{key:"initiatePrint",value:function(){var e=a.OUT_GOING_POST_MESSAGE_EVENT_NAMES.PRINT,t=(0,o.default)(e,{});this.iframe.contentWindow.postMessage(t,this.url)}}])&&u(t.prototype,n),f}(i.default);t.default=f},430:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=s(n(884)),o=s(n(812)),i=n(593),a=s(n(689));function s(e){return e&&e.__esModule?e:{default:e}}function u(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){if(null!==e.contentWindow){var n=i.OUT_GOING_POST_MESSAGE_EVENT_NAMES.ESTABLISH_MESSAGE_CHANNEL,r=(0,o.default)(n);e.contentWindow.postMessage(r,t)}else setTimeout(l.bind(null,e,t),100)}var E=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,o=t.container,s=t.parameters,u=t.defaultEmbeddingVisualType,E=t.errorCallback,c=t.loadCallback,f=t.parametersChangeCallback,d=t.selectedSheetChangeCallback;if(this.url=n,o instanceof HTMLElement?this.container=o:"string"==typeof o&&(this.container=document.querySelector(o)),!this.container)throw new Error("can't find valid container");this.parameters=s,this.defaultEmbeddingVisualType=u,this.iframe=function(e){var t=e.width,n=e.height,r=e.loadingHeight,o=e.url,s=e.scrolling,u=e.className;n===i.DASHBOARD_SIZE_OPTIONS.AUTO_FIT&&(n=r);var E=document.createElement("iframe");return E.className=["quicksight-embedding-iframe",u].join(" ").trim(),E.width=t||"100%",E.height=n||"100%",E.scrolling=s||"no",E.onload=l.bind(null,E,o),E.src=function(e){var t=e.url,n=e.parameters,r=e.locale,o=e.footerPaddingEnabled,i=e.iframeResizeOnSheetChange,s=e.printEnabled,u=e.resetDisabled,l=e.sheetId,E=e.sheetTabsDisabled,c=e.undoRedoDisabled,f=t+"&punyCodeEmbedOrigin="+a.default.encode(window.location.origin+"/");return f=f+"&printEnabled="+String(!!s),r&&(f=f+"&locale="+r),E&&(f=f+"&sheetTabsDisabled="+String(E)),l&&(f=f+"&sheetId="+l),o&&(f=f+"&footerPaddingEnabled="+String(o)),c&&(f=f+"&undoRedoDisabled="+String(c)),u&&(f=f+"&resetDisabled="+String(u)),i&&(f=f+"&resizeOnSheetChange="+String(i)),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.".concat(o,"=").concat(e)})).join("&")}));return"".concat(e,"#").concat(n.join("&"))}(f,n):f}(e),E.style.border="0px",E.style.padding="0px",E}(t),(0,r.default)(this),"function"==typeof E&&this.on(i.CLIENT_FACING_EVENT_NAMES.error,E),"function"==typeof c&&this.on(i.CLIENT_FACING_EVENT_NAMES.load,c),"function"==typeof f&&this.on(i.CLIENT_FACING_EVENT_NAMES.parametersChange,f),"function"==typeof d&&this.on(i.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;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(i.CLIENT_FACING_EVENT_NAMES.GET_ACTIVE_PARAMETER_VALUES,this.getActiveParametersCallback),this.getActiveParametersCallback=e,this.on(i.CLIENT_FACING_EVENT_NAMES.GET_ACTIVE_PARAMETER_VALUES,e);var t=(0,o.default)(i.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(i.CLIENT_FACING_EVENT_NAMES.GET_SHEETS,this.getSheetsCallback),this.getSheetsCallback=e,this.on(i.CLIENT_FACING_EVENT_NAMES.GET_SHEETS,e);var t=(0,o.default)(i.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,o=n.payload;this.trigger(i.CLIENT_FACING_EVENT_NAMES[r],o),r===i.IN_COMING_POST_MESSAGE_EVENT_NAMES.RESIZE_EVENT&&t.height===i.DASHBOARD_SIZE_OPTIONS.AUTO_FIT&&(this.iframe.height=o.height)}},{key:"getDefaultEmbeddingVisualType",value:function(){return this.defaultEmbeddingVisualType}},{key:"setParameters",value:function(e){var t=i.OUT_GOING_POST_MESSAGE_EVENT_NAMES.UPDATE_PARAMETER_VALUES,n={parameters:e},r=(0,o.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=i.OUT_GOING_POST_MESSAGE_EVENT_NAMES.DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS;null!=e&&e in i.DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS||(e=i.DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS.AUTO_GRAPH);var n={defaultEmbeddingVisualType:e};return(0,o.default)(t,n)}}])&&u(t.prototype,n),e}();t.default=E},729:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.embedDashboard=function(e){return a(new o.default(e))},t.embedSession=function(e){return a(new r.default(e))};var r=i(n(430)),o=i(n(712));function i(e){return e&&e.__esModule?e:{default:e}}function a(e){var t=e.getContainer();return setTimeout(s.bind(null,e.iframe,t),0),e}function s(e,t){if(!e)throw new Error("iFrame is required");if(!t)throw new Error("container of iFrame is required");t.appendChild(e)}},590:(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(729)},593:(e,t)=>{"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"}},812:(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(593)},884:(e,t)=>{"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=new 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}},539:(e,t,n)=>{var r=n(590),o=n(672);void 0===o.QuickSightEmbedding&&(o.QuickSightEmbedding=r),e.exports=r},672:(e,t,n)=>{"use strict";e.exports=function(){if("object"==typeof globalThis)return globalThis;var e;try{e=this||new Function("return this")()}catch(e){if("object"==typeof window)return window;if("object"==typeof self)return self;if(void 0!==n.g)return n.g}return e}()},689:(e,t,n)=>{"use strict";n.r(t),n.d(t,{ucs2decode:()=>d,ucs2encode:()=>_,decode:()=>S,encode:()=>A,toASCII:()=>g,toUnicode:()=>p,default:()=>N});const r=2147483647,o=36,i=/^xn--/,a=/[^\0-\x7E]/,s=/[\x2E\u3002\uFF0E\uFF61]/g,u={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},l=Math.floor,E=String.fromCharCode;function c(e){throw new RangeError(u[e])}function f(e,t){const n=e.split("@");let r="";n.length>1&&(r=n[0]+"@",e=n[1]);const o=function(e,t){const n=[];let r=e.length;for(;r--;)n[r]=t(e[r]);return n}((e=e.replace(s,".")).split("."),t).join(".");return r+o}function d(e){const t=[];let n=0;const r=e.length;for(;n<r;){const o=e.charCodeAt(n++);if(o>=55296&&o<=56319&&n<r){const r=e.charCodeAt(n++);56320==(64512&r)?t.push(((1023&o)<<10)+(1023&r)+65536):(t.push(o),n--)}else t.push(o)}return t}const _=e=>String.fromCodePoint(...e),h=function(e,t){return e+22+75*(e<26)-((0!=t)<<5)},T=function(e,t,n){let r=0;for(e=n?l(e/700):e>>1,e+=l(e/t);e>455;r+=o)e=l(e/35);return l(r+36*e/(e+38))},S=function(e){const t=[],n=e.length;let i=0,a=128,s=72,u=e.lastIndexOf("-");u<0&&(u=0);for(let n=0;n<u;++n)e.charCodeAt(n)>=128&&c("not-basic"),t.push(e.charCodeAt(n));for(let f=u>0?u+1:0;f<n;){let u=i;for(let t=1,a=o;;a+=o){f>=n&&c("invalid-input");const u=(E=e.charCodeAt(f++))-48<10?E-22:E-65<26?E-65:E-97<26?E-97:o;(u>=o||u>l((r-i)/t))&&c("overflow"),i+=u*t;const d=a<=s?1:a>=s+26?26:a-s;if(u<d)break;const _=o-d;t>l(r/_)&&c("overflow"),t*=_}const d=t.length+1;s=T(i-u,d,0==u),l(i/d)>r-a&&c("overflow"),a+=l(i/d),i%=d,t.splice(i++,0,a)}var E;return String.fromCodePoint(...t)},A=function(e){const t=[];let n=(e=d(e)).length,i=128,a=0,s=72;for(const n of e)n<128&&t.push(E(n));let u=t.length,f=u;for(u&&t.push("-");f<n;){let n=r;for(const t of e)t>=i&&t<n&&(n=t);const d=f+1;n-i>l((r-a)/d)&&c("overflow"),a+=(n-i)*d,i=n;for(const n of e)if(n<i&&++a>r&&c("overflow"),n==i){let e=a;for(let n=o;;n+=o){const r=n<=s?1:n>=s+26?26:n-s;if(e<r)break;const i=e-r,a=o-r;t.push(E(h(r+i%a,0))),e=l(i/a)}t.push(E(h(e,0))),s=T(a,d,f==u),a=0,++f}++a,++i}return t.join("")},p=function(e){return f(e,(function(e){return i.test(e)?S(e.slice(4).toLowerCase()):e}))},g=function(e){return f(e,(function(e){return a.test(e)?"xn--"+A(e):e}))},N={version:"2.1.0",ucs2:{decode:d,encode:_},decode:S,encode:A,toASCII:g,toUnicode:p}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n(539)})();
(()=>{var e={712:(e,t,n)=>{"use strict";function r(e){return r="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},r(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=s(n(812)),o=s(n(430)),a=n(593);function s(e){return e&&e.__esModule?e:{default:e}}function u(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 c(e,t){return c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},c(e,t)}function l(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function E(e){return E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},E(e)}var f=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&&c(e,t)}(f,e);var t,n,r,o,s=(r=f,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=E(r);if(o){var n=E(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return l(this,e)});function f(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,f),s.call(this,e)}return t=f,(n=[{key:"navigateToDashboard",value:function(e){if(!e.dashboardId)throw new Error("dashboardId is required");var t=a.OUT_GOING_POST_MESSAGE_EVENT_NAMES.NAVIGATE_TO_DASHBOARD,n=e,r=(0,i.default)(t,n);this.iframe.contentWindow.postMessage(r,this.url)}},{key:"navigateToSheet",value:function(e){var t=a.OUT_GOING_POST_MESSAGE_EVENT_NAMES.NAVIGATE_TO_SHEET,n={sheetId:e},r=(0,i.default)(t,n);this.iframe.contentWindow.postMessage(r,this.url)}},{key:"initiatePrint",value:function(){var e=a.OUT_GOING_POST_MESSAGE_EVENT_NAMES.PRINT,t=(0,i.default)(e,{});this.iframe.contentWindow.postMessage(t,this.url)}}])&&u(t.prototype,n),f}(o.default);t.default=f},430:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=s(n(884)),i=s(n(812)),o=n(593),a=s(n(689));function s(e){return e&&e.__esModule?e:{default:e}}function u(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 c(e,t){if(null!==e.contentWindow){var n=o.OUT_GOING_POST_MESSAGE_EVENT_NAMES.ESTABLISH_MESSAGE_CHANNEL,r=(0,i.default)(n);e.contentWindow.postMessage(r,t)}else setTimeout(c.bind(null,e,t),100)}var l=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,s=t.container,u=t.parameters,l=t.defaultEmbeddingVisualType,E=t.errorCallback,f=t.loadCallback,d=t.parametersChangeCallback,h=t.selectedSheetChangeCallback,_=t.isQEmbedded;if(this.url=n,s instanceof HTMLElement?this.container=s:"string"==typeof s&&(this.container=document.querySelector(s)),!this.container)throw new Error("can't find valid container");this.parameters=u,this.defaultEmbeddingVisualType=l,this.iframe=function(e){var t=e.width,n=e.height,r=e.isQEmbedded,i=e.loadingHeight,s=e.url,u=e.scrolling,l=e.className;n===o.DASHBOARD_SIZE_OPTIONS.AUTO_FIT&&(n=i);var E=document.createElement("iframe");return E.className=["quicksight-embedding-iframe",l].join(" ").trim(),E.width=t||"100%",E.height=n||"100%",E.scrolling=u||"no",E.onload=c.bind(null,E,s),E.src=function(e){var t=e.url,n=e.parameters,r=e.locale,i=e.footerPaddingEnabled,o=e.iframeResizeOnSheetChange,s=e.printEnabled,u=e.resetDisabled,c=e.sheetId,l=e.sheetTabsDisabled,E=e.undoRedoDisabled,f=e.isQEmbedded,d=e.qSearchBarOptions,h=t+"&punyCodeEmbedOrigin="+a.default.encode(window.location.origin+"/");return h=h+"&printEnabled="+String(!!s),r&&(h=h+"&locale="+r),l&&(h=h+"&sheetTabsDisabled="+String(l)),c&&(h=h+"&sheetId="+c),i&&(h=h+"&footerPaddingEnabled="+String(i)),E&&(h=h+"&undoRedoDisabled="+String(E)),u&&(h=h+"&resetDisabled="+String(u)),o&&(h=h+"&resizeOnSheetChange="+String(o)),n?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("&"))}(h,n):(f&&d&&(void 0!==d.iconDisabled&&(h=h+"&qBarIconDisabled="+String(d.iconDisabled)),void 0!==d.topicNameDisabled&&(h=h+"&qBarTopicNameDisabled="+String(d.topicNameDisabled)),d.themeId&&(h=h+"&themeId="+d.themeId),void 0!==d.allowTopicSelection&&(h=h+"&allowTopicSelection="+String(d.allowTopicSelection))),h)}(e),E.style.border="0px",E.style.padding="0px",r&&E.setAttribute("allowtransparency","true"),E}(t),(0,r.default)(this),"function"==typeof E&&this.on(o.CLIENT_FACING_EVENT_NAMES.error,E),"function"==typeof f&&this.on(o.CLIENT_FACING_EVENT_NAMES.load,f),"function"==typeof d&&this.on(o.CLIENT_FACING_EVENT_NAMES.parametersChange,d),"function"==typeof h&&this.on(o.CLIENT_FACING_EVENT_NAMES.selectedSheetChange,h),window.addEventListener("message",function(e){e&&e.source===(this.iframe&&this.iframe.contentWindow)&&this.handleMessageEvent(e,t)}.bind(this),!1),_&&(this.qBarOpen=!1,this.isQEmbedded=_,this.qOptions=t.qSearchBarOptions,window.addEventListener("click",function(e){if(this.container&&!this.container.contains(e.target)){var t=(0,i.default)(o.OUT_GOING_POST_MESSAGE_EVENT_NAMES.HIDE_Q_BAR,{});this.iframe.contentWindow.postMessage(t,this.url)}}.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;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:"handleShowQ",value:function(e){this.qOptions&&this.qOptions.expandCallback&&"function"==typeof this.qOptions.expandCallback&&!this.qBarOpen&&this.qOptions.expandCallback(),e&&e.height&&(this.iframe.height=e.height),this.qBarOpen=!0}},{key:"handleHideQ",value:function(e){this.qOptions&&this.qOptions.collapseCallback&&"function"==typeof this.qOptions.collapseCallback&&this.qBarOpen&&this.qOptions.collapseCallback(),e&&e.height&&(this.iframe.height=e.height),this.qBarOpen=!1}},{key:"handleResizeQ",value:function(e){e&&e.height&&(this.iframe.height=e.height)}},{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):r===o.CLIENT_FACING_EVENT_NAMES.SHOW_Q_BAR?this.handleShowQ(i):r===o.CLIENT_FACING_EVENT_NAMES.HIDE_Q_BAR?this.handleHideQ(i):r===o.CLIENT_FACING_EVENT_NAMES.RESIZE_Q_BAR&&this.handleResizeQ(i)}},{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)}}])&&u(t.prototype,n),e}();t.default=l},729:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.embedDashboard=function(e){return c(new i.default(e))},t.embedQSearchBar=function(e){return c(new r.default(s(s({},e||{}),{},{isQEmbedded:!0})))},t.embedSession=function(e){return c(new r.default(e))};var r=o(n(430)),i=o(n(712));function o(e){return e&&e.__esModule?e:{default:e}}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){u(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){var t=e.getContainer();return setTimeout(l.bind(null,e.iframe,t),0),e}function l(e,t){if(!e)throw new Error("iFrame is required");if(!t)throw new Error("container of iFrame is required");t.appendChild(e)}},590:(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,"embedQSearchBar",{enumerable:!0,get:function(){return r.embedQSearchBar}}),Object.defineProperty(t,"embedSession",{enumerable:!0,get:function(){return r.embedSession}});var r=n(729)},593:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OUT_GOING_POST_MESSAGE_EVENT_NAMES=t.IN_COMING_POST_MESSAGE_EVENT_NAMES=t.DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS=t.DASHBOARD_SIZE_OPTIONS=t.CLIENT_FACING_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",HIDE_Q_BAR:"hideQSearchBar"},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",SHOW_Q_BAR:"showQSearchBar",HIDE_Q_BAR:"hideQSearchBar",RESIZE_Q_BAR:"resizeQSearchBar"},t.DASHBOARD_SIZE_OPTIONS={AUTO_FIT:"AutoFit"},t.DEFAULT_EMBEDDING_VISUAL_TYPE_OPTIONS={AUTO_GRAPH:"AUTO_GRAPH",TABLE:"TABLE"}},812:(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(593)},884:(e,t)=>{"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);return i?(i.delete(r),e):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}},539:(e,t,n)=>{var r=n(590),i=n(672);void 0===i.QuickSightEmbedding&&(i.QuickSightEmbedding=r),e.exports=r},672:(e,t,n)=>{"use strict";e.exports=function(){if("object"==typeof globalThis)return globalThis;var e;try{e=this||new Function("return this")()}catch(e){if("object"==typeof window)return window;if("object"==typeof self)return self;if(void 0!==n.g)return n.g}return e}()},689:(e,t,n)=>{"use strict";n.r(t),n.d(t,{ucs2decode:()=>d,ucs2encode:()=>h,decode:()=>T,encode:()=>p,toASCII:()=>A,toUnicode:()=>b,default:()=>g});const r=2147483647,i=36,o=/^xn--/,a=/[^\0-\x7E]/,s=/[\x2E\u3002\uFF0E\uFF61]/g,u={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},c=Math.floor,l=String.fromCharCode;function E(e){throw new RangeError(u[e])}function f(e,t){const n=e.split("@");let r="";n.length>1&&(r=n[0]+"@",e=n[1]);const i=function(e,t){const n=[];let r=e.length;for(;r--;)n[r]=t(e[r]);return n}((e=e.replace(s,".")).split("."),t).join(".");return r+i}function d(e){const t=[];let n=0;const r=e.length;for(;n<r;){const i=e.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){const r=e.charCodeAt(n++);56320==(64512&r)?t.push(((1023&i)<<10)+(1023&r)+65536):(t.push(i),n--)}else t.push(i)}return t}const h=e=>String.fromCodePoint(...e),_=function(e,t){return e+22+75*(e<26)-((0!=t)<<5)},S=function(e,t,n){let r=0;for(e=n?c(e/700):e>>1,e+=c(e/t);e>455;r+=i)e=c(e/35);return c(r+36*e/(e+38))},T=function(e){const t=[],n=e.length;let o=0,a=128,s=72,u=e.lastIndexOf("-");u<0&&(u=0);for(let n=0;n<u;++n)e.charCodeAt(n)>=128&&E("not-basic"),t.push(e.charCodeAt(n));for(let f=u>0?u+1:0;f<n;){let u=o;for(let t=1,a=i;;a+=i){f>=n&&E("invalid-input");const u=(l=e.charCodeAt(f++))-48<10?l-22:l-65<26?l-65:l-97<26?l-97:i;(u>=i||u>c((r-o)/t))&&E("overflow"),o+=u*t;const d=a<=s?1:a>=s+26?26:a-s;if(u<d)break;const h=i-d;t>c(r/h)&&E("overflow"),t*=h}const d=t.length+1;s=S(o-u,d,0==u),c(o/d)>r-a&&E("overflow"),a+=c(o/d),o%=d,t.splice(o++,0,a)}var l;return String.fromCodePoint(...t)},p=function(e){const t=[];let n=(e=d(e)).length,o=128,a=0,s=72;for(const n of e)n<128&&t.push(l(n));let u=t.length,f=u;for(u&&t.push("-");f<n;){let n=r;for(const t of e)t>=o&&t<n&&(n=t);const d=f+1;n-o>c((r-a)/d)&&E("overflow"),a+=(n-o)*d,o=n;for(const n of e)if(n<o&&++a>r&&E("overflow"),n==o){let e=a;for(let n=i;;n+=i){const r=n<=s?1:n>=s+26?26:n-s;if(e<r)break;const o=e-r,a=i-r;t.push(l(_(r+o%a,0))),e=c(o/a)}t.push(l(_(e,0))),s=S(a,d,f==u),a=0,++f}++a,++o}return t.join("")},b=function(e){return f(e,(function(e){return o.test(e)?T(e.slice(4).toLowerCase()):e}))},A=function(e){return f(e,(function(e){return a.test(e)?"xn--"+p(e):e}))},g={version:"2.1.0",ucs2:{decode:d,encode:h},decode:T,encode:p,toASCII:A,toUnicode:b}}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n(539)})();
//# sourceMappingURL=quicksight-embedding-js-sdk.min.js.map
{
"name": "amazon-quicksight-embedding-sdk",
"description": "JS SDK for embedding Amazon QuickSight",
"version": "1.17.1",
"version": "1.18.0",
"main": "dist/index.js",

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

"devDependencies": {
"@babel/cli": "^7.14.5",
"@babel/core": "^7.14.6",
"@babel/preset-env": "^7.14.7",
"@babel/cli": "^7.15.7",
"@babel/core": "^7.15.5",
"@babel/preset-env": "^7.15.6",
"@babel/preset-flow": "^7.14.5",
"@babel/register": "^7.14.5",
"@babel/register": "^7.15.3",
"babel-eslint": "^10.1.0",

@@ -40,3 +40,3 @@ "chai": "^4.3.4",

"jsdom-global": "^3.0.2",
"mocha": "^9.0.2",
"mocha": "^9.1.3",
"sinon": "^11.1.1",

@@ -43,0 +43,0 @@ "webpack": "^5.37.1",

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

## Usage
Amazon QuickSight offers two different embedded experiences with options for branding, user isolation with namespaces, and custom UI permissions:
Amazon QuickSight offers three different embedded experiences with options for branding, user isolation with namespaces, and custom UI permissions:

@@ -16,6 +16,10 @@ * Embedded authoring portals provide the QuickSight authoring experience

* Embedded Q Search Bar provides the [QuickSight Q](https://aws.amazon.com/quicksight/q/) search bar experience
To get started with an embedded Q search bar, you need to create topics and also make sure that the users have the necessary permissions. For more information, see [Embedding Amazon QuickSight Q Search Bar](https://docs.aws.amazon.com/en_us/quicksight/latest/user/embedding-q-search-bar.html) in the Amazon QuickSight User Guide. After Q is ready, follow the procedure to embed your Amazon QuickSight Q search bar in this [example](#example):
### Setup differences between embedded QuickSight experiences: dashboards and portals
The process to set up QuickSight embedding is similar in both cases. The differences between setting up the two embedded experiences are as follows:
1. You use a different SDK object for each embedded QuickSight experience. You use `embedDashboard` to embed a dashboard, and you use `embedSession` to embed an authoring portal.
1. You use a different SDK object for each embedded QuickSight experience. You use `embedDashboard` to embed a dashboard, `embedQSearchBar` to embed the Q search bar, and you use `embedSession` to embed an authoring portal.
2. You use a different API for each embedded experience. For more information, see [QuickSight Embedding APIs](https://docs.aws.amazon.com/en_us/quicksight/latest/APIReference/embedding-quicksight.html)

@@ -33,3 +37,3 @@ 3. Different options are supported for each embedded experience.

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

@@ -72,2 +76,16 @@ *OR*

#### For the embedded Q search bar experience
You can also use ES6 import syntax in place of require:
```javascript
import { embedQSearchBar } from 'amazon-quicksight-embedding-sdk';
const session = embedQSearchBar(options);
```
Alternatively, if you need to load the entire module:
```javascript
import * as QuickSightEmbedding from 'amazon-quicksight-embedding-sdk';
const session = QuickSightEmbedding.embedQSearchBar(options);
```
### Step 2: Configure embedding

@@ -185,2 +203,4 @@ Set up the embedded QuickSight console options.

Note for Q search bar embedding, you'll likely want to use this to give the iframe a `position: absolute` so that when expanded it does not shift the contents of your application. If elements in your application are appearing in front of the Q search bar, you can provide the iframe with a higher z-index as well.
#### Locale element (optional)

@@ -239,2 +259,32 @@ You can set locale for the embedded QuickSight session:

### Q Search Bar options
The `qSearchBarOptions` object is to specify Q specific options when embedding:
```javascript
var qSearchBarOptions = {
expandCallback: () => {},
collapseCallback: () => {},
iconDisabled: false,
topicNameDisabled: false,
themeId: 'theme12345',
allowTopicSelection: true
};
```
#### ExpandCallback (optional)
The `expandCallback` in `qSearchBarOptions` can be used to specify behavior for your application when the Q search bar is expanded (clicked into).
#### CollapseCallback (optional)
The `collapseCallback` in `qSearchBarOptions` can be used to specify behavior for your application when the Q search bar is collapsed (clicked out of).
#### IconDisabled (optional)
The `iconDisabled` element in `qSearchBarOptions` can be used to customize whether or not the QuickSight Q icon appears in the embedded search bar. The default value is `false`.
#### TopicNameDisabled (optional)
The `topicNameDisabled` element in `qSearchBarOptions` can be used to customize whether or not the QuickSight Q Topic name appears in the embedded search bar. The default value is `false`.
#### ThemeId (optional)
The `themeId` element in `qSearchBarOptions` can be used to set a content theme for the embedded search bar. Note that the embedded QuickSight user, or the group or namespace they belong to, must have permissions on this theme. The default theme is the default QuickSight theme seen in the console application.
#### AllowTopicSelection (optional)
The `allowTopicSelection` element in `qSearchBarOptions` can be used to customize whether or not the embedded user can change the selected topic for the Q search bar. Note that this can only be set to false if the `initialTopicId` was specified in the embedding API; for more information, see [QuickSight Embedding APIs](https://docs.aws.amazon.com/en_us/quicksight/latest/APIReference/embedding-quicksight.html). The default value is `true`.
### Step 3: Create the QuickSight session object

@@ -417,2 +467,5 @@

2. Some browsers (e.g. mobile safari) have default setting to "Always Block Cookies". Change the setting to either "Allow form Websites I Visit" or "Always Allow".
3. Q search bar troubleshooting:
* Shifting page contents in unwanted way - try giving the embedding container and the iframe class a style with position absolute.
* Clicking on some parts of your application does not close the Q search bar - use the `expandCallback` and `collapseCallback` to create a backdrop/element on the page that's always clickable so that the document listener can properly close the search bar.

@@ -428,3 +481,3 @@

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

@@ -487,3 +540,3 @@ var dashboard

<title>QuickSight Console Embedding</title>
<script src="https://unpkg.com/amazon-quicksight-embedding-sdk@1.17.1/dist/quicksight-embedding-js-sdk.min.js"></script>
<script src="https://unpkg.com/amazon-quicksight-embedding-sdk@1.18.0/dist/quicksight-embedding-js-sdk.min.js"></script>
<script type="text/javascript">

@@ -536,2 +589,58 @@ var session

### QuickSight Q search bar embedding
```html
<!DOCTYPE html>
<html>
<head>
<title>QuickSight Q Search Bar Embedding</title>
<script src="https://unpkg.com/amazon-quicksight-embedding-sdk@1.18.0/dist/quicksight-embedding-js-sdk.min.js"></script>
<script type="text/javascript">
var session
function onError(payload) {
console.log("Do something when the session fails loading");
}
function onExpand() {
console.log("Do something when the Q search bar opens");
}
function onCollapse() {
console.log("Do something when the Q search bar closes");
}
function embedQSearchBar() {
var containerDiv = document.getElementById("embeddingContainer");
var options = {
url: "https://us-east-1.quicksight.aws.amazon.com/sn/dashboards/dashboardId?isauthcode=true&identityprovider=quicksight&code=authcode", // replace this dummy url with the one generated via embedding API
container: containerDiv,
width: "1000px",
locale: "en-US",
qSearchBarOptions: {
expandCallback: onExpand,
collapseCallback: onCollapse,
iconDisabled: false,
topicNameDisabled: false,
themeId: 'theme12345',
allowTopicSelection: true
}
};
session = QuickSightEmbedding.embedQSearchBar(options);
session.on("error", onError);
}
function onCountryChange(obj) {
session.setParameters({country: obj.value});
}
</script>
</head>
<body onload="embedQSearchBar()">
<div id="embeddingContainer"></div>
</body>
</html>
```
## License

@@ -543,2 +652,2 @@ Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.

💭 [Give us feedback on your QuickSight embedding experience!](https://amazonmr.au1.qualtrics.com/jfe/form/SV_82jpzFSMLDBH1K6)
💭 [Give us feedback on your QuickSight embedding experience!](https://amazonmr.au1.qualtrics.com/jfe/form/SV_82jpzFSMLDBH1K6)

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

/**
* Embed Q search bar.
* @function
* @name embedQSearchBar
* @param {EmbeddingOptions} options - options set by customers to embed the Q search bar.
*/
function embedQSearchBar(options: EmbeddingOptions): EmbeddableObject {
const embeddedQSearchBar = new EmbeddableObject({
...(options || {}),
isQEmbedded: true
});
return embedObject(embeddedQSearchBar);
}
function embedObject(embeddableObject: EmbeddableObject) {

@@ -60,3 +74,3 @@ const container = embeddableObject.getContainer();

export {
embedDashboard, embedSession
embedDashboard, embedSession, embedQSearchBar
};

@@ -7,3 +7,3 @@ // @flow

import constructEvent from './lib/constructEvent';
import type {EmbeddingOptions} from './lib/types';
import type {EmbeddingOptions, QSearchBarOptions} from './lib/types';
import {

@@ -14,3 +14,3 @@ CLIENT_FACING_EVENT_NAMES,

IN_COMING_POST_MESSAGE_EVENT_NAMES,
OUT_GOING_POST_MESSAGE_EVENT_NAMES,
OUT_GOING_POST_MESSAGE_EVENT_NAMES
} from './lib/constants';

@@ -40,2 +40,13 @@ import punycode from 'punycode';

/**
* Q SearchBar embedding options.
* @typedef {Object} QSearchBarOptions
* @property {Function} expandCallback - callback when Q search bar is expanded
* @property {Function} collapseCallback - callback when Q search bar is collapsed
* @property {boolean} iconDisabled - disable Q icon in search bar (only for single topic set)
* @property {boolean} topicNameDisabled - disable topic name in search bar (only for single topic set)
* @property {string} themeId - themeId to apply to search bar (theme must be shared with user)
* @property {boolean} allowTopicSelection - allow user to change selected topic (only when initialTopicId is set from API)
*/
/**
* Embeddable Object class.

@@ -58,2 +69,7 @@ * @class

// Q specific members
qBarOpen: ?boolean;
isQEmbedded: ?boolean;
qOptions: ?QSearchBarOptions;
/* eslint-disable complexity */

@@ -77,3 +93,4 @@ constructor(options: EmbeddingOptions) {

parametersChangeCallback,
selectedSheetChangeCallback
selectedSheetChangeCallback,
isQEmbedded
} = options;

@@ -125,2 +142,16 @@

if (isQEmbedded) {
this.qBarOpen = false;
this.isQEmbedded = isQEmbedded;
this.qOptions = options.qSearchBarOptions;
window.addEventListener('click', (function(event) {
const isClickInside = this.container ? this.container.contains(event.target) : true;
if (!isClickInside) {
const hideQBarEvent = constructEvent(OUT_GOING_POST_MESSAGE_EVENT_NAMES.HIDE_Q_BAR, {});
this.iframe.contentWindow.postMessage(hideQBarEvent, this.url);
}
}).bind(this), false);
}
(this: any).getContainer = this.getContainer.bind(this);

@@ -177,2 +208,38 @@ (this: any).getParameters = this.getParameters.bind(this);

handleShowQ(payload: Object) {
if (this.qOptions && this.qOptions.expandCallback
&& typeof this.qOptions.expandCallback === 'function'
&& !this.qBarOpen
) {
this.qOptions.expandCallback();
}
if (payload && payload.height) {
this.iframe.height = payload.height;
}
this.qBarOpen = true;
}
handleHideQ(payload: Object) {
if (this.qOptions && this.qOptions.collapseCallback
&& typeof this.qOptions.collapseCallback === 'function'
&& this.qBarOpen
) {
this.qOptions.collapseCallback();
}
if (payload && payload.height) {
this.iframe.height = payload.height;
}
this.qBarOpen = false;
}
handleResizeQ(payload: Object) {
if (payload && payload.height) {
this.iframe.height = payload.height;
}
}
handleMessageEvent(event: Object, options: EmbeddingOptions): void {

@@ -186,2 +253,8 @@ const {eventName, payload} = event.data;

}
} else if (eventName === CLIENT_FACING_EVENT_NAMES.SHOW_Q_BAR) {
this.handleShowQ(payload);
} else if (eventName === CLIENT_FACING_EVENT_NAMES.HIDE_Q_BAR) {
this.handleHideQ(payload);
} else if (eventName === CLIENT_FACING_EVENT_NAMES.RESIZE_Q_BAR) {
this.handleResizeQ(payload);
}

@@ -219,3 +292,3 @@ }

function createIframe(options: EmbeddingOptions): HTMLIFrameElement {
let {width, height} = options;
let {width, height, isQEmbedded} = options;
const {loadingHeight, url, scrolling, className} = options;

@@ -234,2 +307,5 @@ if (height === DASHBOARD_SIZE_OPTIONS.AUTO_FIT) {

iframe.style.padding = '0px';
if (isQEmbedded) {
iframe.setAttribute('allowtransparency', 'true');
}
return iframe;

@@ -250,2 +326,4 @@ }

undoRedoDisabled,
isQEmbedded,
qSearchBarOptions
} = options;

@@ -288,2 +366,20 @@ let src = url + '&punyCodeEmbedOrigin=' + punycode.encode(window.location.origin + '/');

if (isQEmbedded && qSearchBarOptions) {
if (qSearchBarOptions.iconDisabled !== undefined) {
src = src + '&qBarIconDisabled=' + String(qSearchBarOptions.iconDisabled);
}
if (qSearchBarOptions.topicNameDisabled !== undefined) {
src = src + '&qBarTopicNameDisabled=' + String(qSearchBarOptions.topicNameDisabled);
}
if (qSearchBarOptions.themeId) {
src = src + '&themeId=' + qSearchBarOptions.themeId;
}
if (qSearchBarOptions.allowTopicSelection !== undefined) {
src = src + '&allowTopicSelection=' + String(qSearchBarOptions.allowTopicSelection);
}
}
return src;

@@ -290,0 +386,0 @@ }

@@ -5,6 +5,6 @@ // @flow

import {embedDashboard, embedSession} from './embed';
import {embedDashboard, embedSession, embedQSearchBar} from './embed';
export {
embedDashboard, embedSession
embedDashboard, embedSession, embedQSearchBar
};

@@ -13,3 +13,4 @@ // @flow

GET_SHEETS: 'getSheets',
PRINT: 'initiatePrint'
PRINT: 'initiatePrint',
HIDE_Q_BAR: 'hideQSearchBar'
};

@@ -33,3 +34,6 @@

GET_ACTIVE_PARAMETER_VALUES: 'GET_ACTIVE_PARAMETER_VALUES',
GET_SHEETS: 'GET_SHEETS'
GET_SHEETS: 'GET_SHEETS',
SHOW_Q_BAR: 'showQSearchBar',
HIDE_Q_BAR: 'hideQSearchBar',
RESIZE_Q_BAR: 'resizeQSearchBar'
};

@@ -44,2 +48,2 @@

TABLE: 'TABLE',
};
};

@@ -27,3 +27,14 @@ // @flow

undoRedoDisabled: ?boolean,
resetDisabled: ?boolean
};
resetDisabled: ?boolean,
isQEmbedded: ?boolean,
qSearchBarOptions: ?QSearchBarOptions
};
export type QSearchBarOptions = {
expandCallback: ?Function,
collapseCallback: ?Function,
iconDisabled: ?boolean,
topicNameDisabled: ?boolean,
themeId: ?string,
allowTopicSelection: ?boolean
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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