@blackbaud/sky-addin-client
Advanced tools
Comparing version 1.0.14 to 1.0.15
@@ -1,687 +0,1 @@ | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
if(typeof exports === 'object' && typeof module === 'object') | ||
module.exports = factory(); | ||
else if(typeof define === 'function' && define.amd) | ||
define([], factory); | ||
else if(typeof exports === 'object') | ||
exports["BBSkyAddinClient"] = factory(); | ||
else | ||
root["BBSkyAddinClient"] = factory(); | ||
})(this, function() { | ||
return /******/ (function(modules) { // webpackBootstrap | ||
/******/ // The module cache | ||
/******/ var installedModules = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ | ||
/******/ // Check if module is in cache | ||
/******/ if(installedModules[moduleId]) { | ||
/******/ return installedModules[moduleId].exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = installedModules[moduleId] = { | ||
/******/ i: moduleId, | ||
/******/ l: false, | ||
/******/ exports: {} | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Flag the module as loaded | ||
/******/ module.l = true; | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/******/ | ||
/******/ // expose the modules object (__webpack_modules__) | ||
/******/ __webpack_require__.m = modules; | ||
/******/ | ||
/******/ // expose the module cache | ||
/******/ __webpack_require__.c = installedModules; | ||
/******/ | ||
/******/ // identity function for calling harmony imports with the correct context | ||
/******/ __webpack_require__.i = function(value) { return value; }; | ||
/******/ | ||
/******/ // define getter function for harmony exports | ||
/******/ __webpack_require__.d = function(exports, name, getter) { | ||
/******/ if(!__webpack_require__.o(exports, name)) { | ||
/******/ Object.defineProperty(exports, name, { | ||
/******/ configurable: false, | ||
/******/ enumerable: true, | ||
/******/ get: getter | ||
/******/ }); | ||
/******/ } | ||
/******/ }; | ||
/******/ | ||
/******/ // getDefaultExport function for compatibility with non-harmony modules | ||
/******/ __webpack_require__.n = function(module) { | ||
/******/ var getter = module && module.__esModule ? | ||
/******/ function getDefault() { return module['default']; } : | ||
/******/ function getModuleExports() { return module; }; | ||
/******/ __webpack_require__.d(getter, 'a', getter); | ||
/******/ return getter; | ||
/******/ }; | ||
/******/ | ||
/******/ // Object.prototype.hasOwnProperty.call | ||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; | ||
/******/ | ||
/******/ // __webpack_public_path__ | ||
/******/ __webpack_require__.p = ""; | ||
/******/ | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 1); | ||
/******/ }) | ||
/************************************************************************/ | ||
/******/ ([ | ||
/* 0 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(__webpack_require__(2)); | ||
__export(__webpack_require__(8)); | ||
/***/ }), | ||
/* 1 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(__webpack_require__(0)); | ||
/***/ }), | ||
/* 2 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* Collection of regexs for our whitelist of host origins. | ||
*/ | ||
var allowedOrigins = [ | ||
/^https\:\/\/[\w\-\.]+\.blackbaud\.com$/, | ||
/^https\:\/\/[\w\-\.]+\.blackbaud\-dev\.com$/, | ||
/^http\:\/\/[\w\-\.]+\.blackbaud\-dev\.com$/, | ||
/^https\:\/\/[\w\-\.]+\.blackbaudhosting\.com$/, | ||
/^https\:\/\/[\w\-\.]+\.bbcloudservices\.com$/, | ||
/^https\:\/\/localhost\:[0-9]+$/ | ||
]; | ||
/** | ||
* Client for interacting with the parent page hosting the add-in. | ||
*/ | ||
var AddinClient = (function () { | ||
function AddinClient(args) { | ||
var _this = this; | ||
this.args = args; | ||
/** | ||
* Tracks pending request to reeceive an auth-token from the host. | ||
*/ | ||
this.authTokenRequests = []; | ||
/** | ||
* Counter to provide unique ids for each auth token request. | ||
*/ | ||
this.lastAuthTokenRequestId = 0; | ||
/** | ||
* Tracks modal add-ins that have been launched from this add-in. | ||
*/ | ||
this.modalRequests = []; | ||
/** | ||
* Counter to provide unique ids for each modal request. | ||
*/ | ||
this.lastModalRequestId = 0; | ||
this.windowMessageHandler = function (event) { | ||
_this.handleMessage(event); | ||
}; | ||
// Listen to messages from the host page. | ||
window.addEventListener('message', this.windowMessageHandler); | ||
// Inform the host page that the add-in is loaded and listening for messages. | ||
this.raiseAddinReadyMessage(); | ||
} | ||
/* istanbul ignore next */ | ||
/** | ||
* @returns {string} Returns the current query string path for the window, prefixed with ?. | ||
*/ | ||
AddinClient.getQueryString = function () { | ||
return window.location.search; | ||
}; | ||
/** | ||
* Cleans up the AddinClient, releasing all resources. | ||
*/ | ||
AddinClient.prototype.destroy = function () { | ||
window.removeEventListener('message', this.windowMessageHandler); | ||
if (this.heightChangeIntervalId) { | ||
clearInterval(this.heightChangeIntervalId); | ||
} | ||
}; | ||
/** | ||
* Requests the host page to navigate. | ||
* @param args Arguments describing the navigation request. | ||
*/ | ||
AddinClient.prototype.navigate = function (args) { | ||
this.postMessageToHostPage({ | ||
message: { | ||
url: args.url | ||
}, | ||
messageType: 'navigate' | ||
}); | ||
}; | ||
/** | ||
* Requests an authentication token for the current user. | ||
* @deprecated Use getUserIdentityToken() instead. | ||
* @returns {Promise<any>} Returns a promise which will resolve with the token value. | ||
*/ | ||
AddinClient.prototype.getAuthToken = function () { | ||
return this.getUserIdentityToken(); | ||
}; | ||
/** | ||
* Requests a user identity token for the current user. | ||
* @returns {Promise<any>} Returns a promise which will resolve with the token value. | ||
*/ | ||
AddinClient.prototype.getUserIdentityToken = function () { | ||
var _this = this; | ||
return new Promise(function (resolve, reject) { | ||
var authTokenRequestId = ++_this.lastAuthTokenRequestId; | ||
_this.authTokenRequests[authTokenRequestId] = { | ||
reject: reject, | ||
resolve: resolve | ||
}; | ||
_this.postMessageToHostPage({ | ||
message: { | ||
authTokenRequestId: authTokenRequestId | ||
}, | ||
messageType: 'get-auth-token' | ||
}); | ||
}); | ||
}; | ||
/** | ||
* Requests the host page to launch a modal add-in. | ||
* @param args Arguments for launching the modal. | ||
* @returns {Promise<any>} Returns a promise that will be resolved when the modal add-in is closed. | ||
* Promise will resolve with context data passed by from the modal add-in's closeModal call. | ||
*/ | ||
AddinClient.prototype.showModal = function (args) { | ||
var _this = this; | ||
return { | ||
modalClosed: new Promise(function (resolve, reject) { | ||
var modalRequestId = ++_this.lastModalRequestId; | ||
_this.modalRequests[modalRequestId] = { | ||
reject: reject, | ||
resolve: resolve | ||
}; | ||
_this.postMessageToHostPage({ | ||
message: { | ||
args: args, | ||
modalRequestId: modalRequestId | ||
}, | ||
messageType: 'show-modal' | ||
}); | ||
}) | ||
}; | ||
}; | ||
/** | ||
* Informs the host to close this modal add-in. | ||
* Should only be used from within the modal add-in and not the parent add-in. | ||
* @param args Arguments to provide a context object back to the parent add-in. | ||
*/ | ||
AddinClient.prototype.closeModal = function (args) { | ||
this.postMessageToHostPage({ | ||
message: args, | ||
messageType: 'close-modal' | ||
}); | ||
}; | ||
/** | ||
* Informs the host to open the help tab with the specified help key. | ||
* @param args Arguments for launching the help tab. | ||
*/ | ||
AddinClient.prototype.openHelp = function (args) { | ||
this.postMessageToHostPage({ | ||
message: { | ||
helpKey: args.helpKey | ||
}, | ||
messageType: 'open-help' | ||
}); | ||
}; | ||
/** | ||
* Informs the host to show a toast message. | ||
* @param args Arguments for showing a toast. | ||
*/ | ||
AddinClient.prototype.showToast = function (args) { | ||
this.postMessageToHostPage({ | ||
message: args, | ||
messageType: 'show-toast' | ||
}); | ||
}; | ||
/** | ||
* Requests the host page to launch a flyout add-in. | ||
* @param args Arguments for launching the flyout. | ||
* @returns {Promise<any>} Returns a promise that will be resolved when the flyout add-in is closed. | ||
*/ | ||
AddinClient.prototype.showFlyout = function (args) { | ||
var _this = this; | ||
return { | ||
flyoutClosed: new Promise(function (resolve, reject) { | ||
// assign default values if not specified, | ||
// consistent with SKY UX flyout defaults | ||
args.defaultWidth = args.defaultWidth || 500; | ||
args.maxWidth = args.maxWidth || args.defaultWidth; | ||
args.minWidth = args.minWidth || 320; | ||
_this.flyoutRequest = { | ||
reject: reject, | ||
resolve: resolve | ||
}; | ||
_this.postMessageToHostPage({ | ||
message: args, | ||
messageType: 'show-flyout' | ||
}); | ||
}) | ||
}; | ||
}; | ||
/** | ||
* Requests the host page to close the flyout add-in. | ||
*/ | ||
AddinClient.prototype.closeFlyout = function () { | ||
this.postMessageToHostPage({ | ||
messageType: 'close-flyout' | ||
}); | ||
}; | ||
/** | ||
* Requests the host page to show a confirm dialog. | ||
* @param args Arguments for showing a confirm dialog. | ||
* @returns {Promise<string>} Returns a promise that will resolve with the | ||
* confirm action when the dialog is closed. | ||
*/ | ||
AddinClient.prototype.showConfirm = function (args) { | ||
var _this = this; | ||
return new Promise(function (resolve, reject) { | ||
_this.confirmRequest = { | ||
reject: reject, | ||
resolve: resolve | ||
}; | ||
_this.postMessageToHostPage({ | ||
message: args, | ||
messageType: 'show-confirm' | ||
}); | ||
}); | ||
}; | ||
/** | ||
* Informs the host to show an error dialog. | ||
* @param args Arguments for showing an error dialog. | ||
*/ | ||
AddinClient.prototype.showError = function (args) { | ||
this.postMessageToHostPage({ | ||
message: args, | ||
messageType: 'show-error' | ||
}); | ||
}; | ||
/** | ||
* Post a message to the host page informing it that the add-in is | ||
* now started and listening for messages from the host. | ||
*/ | ||
AddinClient.prototype.raiseAddinReadyMessage = function () { | ||
// No sensitive data should be provided with this message! This is the initial | ||
// message posted to the host page to establish whether the host origin is a | ||
// trusted origin and therefore will post to any host, trusted or untrusted. | ||
// The host should respond with a host-ready message which will include the origin | ||
// and will be validated against a whitelist of allowed origins so that subsequent | ||
// messages can be posted only to that trusted origin. | ||
this.postMessageToHostPage({ | ||
messageType: 'ready' | ||
}, '*'); | ||
}; | ||
/** | ||
* Handles the modal-closed message from the host. | ||
* This is emitted to add-ins which have previously launched a modal, which is now | ||
* closing. | ||
* @param message The message data, which includes a context object from the closing modal, which should be passed | ||
* to the calling modal in the showModal promise. | ||
*/ | ||
AddinClient.prototype.handleModalClosedMessage = function (message) { | ||
var modalRequests = this.modalRequests; | ||
var modalRequestId = message.modalRequestId; | ||
var modalRequest = modalRequests[modalRequestId]; | ||
modalRequest.resolve(message.context); | ||
modalRequests[modalRequestId] = undefined; | ||
}; | ||
/** | ||
* Handles host message responses to a get-auth-token request. | ||
* @param data The message. | ||
*/ | ||
AddinClient.prototype.handleAuthTokenMessage = function (data) { | ||
var authTokenRequests = this.authTokenRequests; | ||
var authTokenRequestId = data.message.authTokenRequestId; | ||
var authTokenRequest = authTokenRequests[authTokenRequestId]; | ||
/* tslint:disable-next-line switch-default */ | ||
switch (data.messageType) { | ||
case 'auth-token': | ||
var authToken = data.message.authToken; | ||
authTokenRequest.resolve(authToken); | ||
break; | ||
case 'auth-token-fail': | ||
authTokenRequest.reject(data.message.reason); | ||
break; | ||
} | ||
authTokenRequests[authTokenRequestId] = undefined; | ||
}; | ||
/** | ||
* Handles message events received from the add-in host page. | ||
* @param event The event posted from the host. | ||
*/ | ||
AddinClient.prototype.handleMessage = function (event) { | ||
var _this = this; | ||
var data = event.data; | ||
if (data && data.source === 'bb-addin-host') { | ||
if (data.messageType === 'host-ready') { | ||
// The 'host-ready' message is the only message that's not validated against | ||
// the host origin since that is what's being established in the message. | ||
// This MUST be the first message posted by the host page or all further | ||
// communications with the host page will be blocked. | ||
this.setKnownAllowedHostOrigin(event.origin); | ||
this.trackHeightChangesOfAddinContent(); | ||
// Pass key data to the add-in for it to initiailze. | ||
this.args.callbacks.init({ | ||
context: data.message.context, | ||
envId: data.message.envId, | ||
ready: function (args) { | ||
// Do an immediate height check since the add-in may render something | ||
// due to the context provided. No need to wait a full second to reflect. | ||
_this.checkForHeightChangesOfAddinContent(); | ||
_this.postMessageToHostPage({ | ||
message: args, | ||
messageType: 'addin-ready' | ||
}); | ||
} | ||
}); | ||
} | ||
else if (this.isFromValidOrigin(event)) { | ||
/* tslint:disable-next-line switch-default */ | ||
switch (data.messageType) { | ||
case 'auth-token': | ||
case 'auth-token-fail': | ||
this.handleAuthTokenMessage(data); | ||
break; | ||
case 'modal-closed': | ||
this.handleModalClosedMessage(data.message); | ||
break; | ||
case 'button-click': | ||
if (this.args.callbacks.buttonClick) { | ||
this.args.callbacks.buttonClick(); | ||
} | ||
break; | ||
case 'confirm-closed': | ||
if (this.confirmRequest) { | ||
this.confirmRequest.resolve(data.message.reason); | ||
this.confirmRequest = undefined; | ||
} | ||
break; | ||
case 'flyout-closed': | ||
if (this.flyoutRequest) { | ||
this.flyoutRequest.resolve(); | ||
this.flyoutRequest = undefined; | ||
} | ||
break; | ||
case 'flyout-next-click': | ||
if (this.args.callbacks.flyoutNextClick) { | ||
this.args.callbacks.flyoutNextClick(); | ||
} | ||
break; | ||
case 'flyout-previous-click': | ||
if (this.args.callbacks.flyoutPreviousClick) { | ||
this.args.callbacks.flyoutPreviousClick(); | ||
} | ||
break; | ||
case 'help-click': | ||
if (this.args.callbacks.helpClick) { | ||
this.args.callbacks.helpClick(); | ||
} | ||
break; | ||
case 'settings-click': | ||
if (this.args.callbacks.settingsClick) { | ||
this.args.callbacks.settingsClick(); | ||
} | ||
break; | ||
} | ||
} | ||
else { | ||
this.warnInvalidOrigin(); | ||
} | ||
} | ||
}; | ||
/** | ||
* Validates and registers a value as the origin of the parent page hosting the add-in. | ||
* If the provided origin matches against our trusted whitelist, then it will be saved. | ||
* Post messages will implicitly go to this origin and received messages will be filtered | ||
* to just messages from this origin. | ||
* @param hostOrigin | ||
*/ | ||
AddinClient.prototype.setKnownAllowedHostOrigin = function (hostOrigin) { | ||
for (var _i = 0, allowedOrigins_1 = allowedOrigins; _i < allowedOrigins_1.length; _i++) { | ||
var allowedOrigin = allowedOrigins_1[_i]; | ||
if (allowedOrigin.test(hostOrigin)) { | ||
this.trustedOrigin = hostOrigin; | ||
return; | ||
} | ||
} | ||
}; | ||
/** | ||
* Checks if the height of the iFrame has changed since it was last | ||
* posted to the host page (or if it hasn't been posted yet) and initiates | ||
* a new post if so. | ||
*/ | ||
AddinClient.prototype.checkForHeightChangesOfAddinContent = function () { | ||
// after some discussion and experimentation, using offsetHeight appears to be sufficient | ||
var newHeight = document.documentElement.offsetHeight; | ||
if (newHeight !== this.lastPostedIframeHeight) { | ||
this.lastPostedIframeHeight = newHeight; | ||
this.postMessageToHostPage({ | ||
message: { | ||
height: newHeight + 'px' | ||
}, | ||
messageType: 'height-change' | ||
}); | ||
} | ||
}; | ||
/** | ||
* Starts a timeout interval to watch for height changes | ||
* of the iframe content. | ||
*/ | ||
AddinClient.prototype.trackHeightChangesOfAddinContent = function () { | ||
var _this = this; | ||
this.heightChangeIntervalId = setInterval(function () { | ||
_this.checkForHeightChangesOfAddinContent(); | ||
}, 1000); | ||
}; | ||
/** | ||
* Posts a message to the parent window. | ||
* @param message The message content to post. | ||
* @param targetOrigin Optional. If provided, then the message will be posted to this origin. | ||
* If not, then it will post to the pre-determined host page origin. | ||
*/ | ||
AddinClient.prototype.postMessageToHostPage = function (message, targetOrigin) { | ||
message.source = 'bb-addin-client'; | ||
message.addinId = this.getQueryVariable('addinId'); | ||
targetOrigin = targetOrigin || this.trustedOrigin; | ||
if (targetOrigin) { | ||
window.parent.postMessage(message, targetOrigin); | ||
} | ||
else { | ||
this.warnInvalidOrigin(); | ||
} | ||
}; | ||
/** | ||
* Checks whether a MessageEvent is from the execetd host origin. | ||
* @param event | ||
*/ | ||
AddinClient.prototype.isFromValidOrigin = function (event) { | ||
return event.origin === this.trustedOrigin; | ||
}; | ||
/** | ||
* Log that a message was received with an invalid origin. | ||
*/ | ||
AddinClient.prototype.warnInvalidOrigin = function () { | ||
console.warn('The origin is not trusted because the host-ready message has not been ' + | ||
'sent or because the host origin is not a whitelisted origin.'); | ||
}; | ||
/** | ||
* Reads a query string value from the current window location. | ||
* @param variable Name of the query string parameter to ready. | ||
* @returns The value of the query string parameter. | ||
*/ | ||
AddinClient.prototype.getQueryVariable = function (variable) { | ||
var query = AddinClient.getQueryString().substring(1); | ||
var vars = query.split('&'); | ||
for (var _i = 0, vars_1 = vars; _i < vars_1.length; _i++) { | ||
var v = vars_1[_i]; | ||
var pair = v.split('='); | ||
if (decodeURIComponent(pair[0]) === variable) { | ||
return decodeURIComponent(pair[1]); | ||
} | ||
} | ||
}; | ||
return AddinClient; | ||
}()); | ||
exports.AddinClient = AddinClient; | ||
/***/ }), | ||
/* 3 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
* Defines the style of the button | ||
*/ | ||
var AddinButtonStyle; | ||
(function (AddinButtonStyle) { | ||
// No style (default) | ||
AddinButtonStyle[AddinButtonStyle["None"] = 0] = "None"; | ||
// The button represents an "add" operation | ||
AddinButtonStyle[AddinButtonStyle["Add"] = 1] = "Add"; | ||
// The button represents an "edit" operation | ||
AddinButtonStyle[AddinButtonStyle["Edit"] = 2] = "Edit"; | ||
// The button represents a "delete" operation | ||
AddinButtonStyle[AddinButtonStyle["Delete"] = 3] = "Delete"; | ||
})(AddinButtonStyle = exports.AddinButtonStyle || (exports.AddinButtonStyle = {})); | ||
/***/ }), | ||
/* 4 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* Defines the style of a confirm dialog button. | ||
*/ | ||
var AddinConfirmButtonStyle; | ||
(function (AddinConfirmButtonStyle) { | ||
// The button represents a "secondary" action (default) | ||
AddinConfirmButtonStyle[AddinConfirmButtonStyle["Default"] = 0] = "Default"; | ||
// The button represents a "primary" action | ||
AddinConfirmButtonStyle[AddinConfirmButtonStyle["Primary"] = 1] = "Primary"; | ||
// The button represents a "link" action, often used | ||
// to trigger an action to cancel/close a confirm dialog | ||
AddinConfirmButtonStyle[AddinConfirmButtonStyle["Link"] = 2] = "Link"; | ||
})(AddinConfirmButtonStyle = exports.AddinConfirmButtonStyle || (exports.AddinConfirmButtonStyle = {})); | ||
/***/ }), | ||
/* 5 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
* Defines the style of the tab summary | ||
*/ | ||
var AddinTabSummaryStyle; | ||
(function (AddinTabSummaryStyle) { | ||
// No style (default) | ||
AddinTabSummaryStyle[AddinTabSummaryStyle["None"] = 0] = "None"; | ||
// Show summary text next to the tab caption (the value shown will be the 'summary' property) | ||
AddinTabSummaryStyle[AddinTabSummaryStyle["Text"] = 1] = "Text"; | ||
})(AddinTabSummaryStyle = exports.AddinTabSummaryStyle || (exports.AddinTabSummaryStyle = {})); | ||
/***/ }), | ||
/* 6 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
* Defines the style of the tile summary | ||
*/ | ||
var AddinTileSummaryStyle; | ||
(function (AddinTileSummaryStyle) { | ||
// No style (default) | ||
AddinTileSummaryStyle[AddinTileSummaryStyle["None"] = 0] = "None"; | ||
// Show a text summary for the tile (the value to show will be the 'summary' property) | ||
AddinTileSummaryStyle[AddinTileSummaryStyle["Text"] = 1] = "Text"; | ||
// Show a check summary for the tile (the check will show based on the 'checked' property) | ||
AddinTileSummaryStyle[AddinTileSummaryStyle["Check"] = 2] = "Check"; | ||
})(AddinTileSummaryStyle = exports.AddinTileSummaryStyle || (exports.AddinTileSummaryStyle = {})); | ||
/***/ }), | ||
/* 7 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
* Defines the style of the toast | ||
*/ | ||
var AddinToastStyle; | ||
(function (AddinToastStyle) { | ||
// The toast style for a critical error | ||
AddinToastStyle[AddinToastStyle["Danger"] = 0] = "Danger"; | ||
// The toast style for informational purposes (default) | ||
AddinToastStyle[AddinToastStyle["Info"] = 1] = "Info"; | ||
// The toast style for a successful operation | ||
AddinToastStyle[AddinToastStyle["Success"] = 2] = "Success"; | ||
// The toast style for a non-critical error | ||
AddinToastStyle[AddinToastStyle["Warning"] = 3] = "Warning"; | ||
})(AddinToastStyle = exports.AddinToastStyle || (exports.AddinToastStyle = {})); | ||
/***/ }), | ||
/* 8 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(__webpack_require__(3)); | ||
__export(__webpack_require__(4)); | ||
__export(__webpack_require__(5)); | ||
__export(__webpack_require__(6)); | ||
__export(__webpack_require__(7)); | ||
/***/ }) | ||
/******/ ]); | ||
}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.BBSkyAddinClient=t():e.BBSkyAddinClient=t()}(window,(function(){return function(e){var t={};function s(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,s),n.l=!0,n.exports}return s.m=e,s.c=t,s.d=function(e,t,o){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(s.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)s.d(o,n,function(t){return e[t]}.bind(null,n));return o},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=0)}([function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var s in e)t.hasOwnProperty(s)||(t[s]=e[s])}(s(1))},function(e,t,s){"use strict";function o(e){for(var s in e)t.hasOwnProperty(s)||(t[s]=e[s])}Object.defineProperty(t,"__esModule",{value:!0}),o(s(2)),o(s(3))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=[/^https\:\/\/[\w\-\.]+\.blackbaud\.com$/,/^https\:\/\/[\w\-\.]+\.blackbaud\-dev\.com$/,/^http\:\/\/[\w\-\.]+\.blackbaud\-dev\.com$/,/^https\:\/\/[\w\-\.]+\.blackbaudhosting\.com$/,/^https\:\/\/[\w\-\.]+\.bbcloudservices\.com$/,/^https\:\/\/localhost\:[0-9]+$/],n=function(){function e(e){var t=this;this.args=e,this.authTokenRequests=[],this.lastAuthTokenRequestId=0,this.modalRequests=[],this.lastModalRequestId=0,this.windowMessageHandler=function(e){t.handleMessage(e)},window.addEventListener("message",this.windowMessageHandler),this.raiseAddinReadyMessage()}return e.getQueryString=function(){return window.location.search},e.prototype.destroy=function(){window.removeEventListener("message",this.windowMessageHandler),this.heightChangeIntervalId&&clearInterval(this.heightChangeIntervalId)},e.prototype.navigate=function(e){this.postMessageToHostPage({message:{url:e.url},messageType:"navigate"})},e.prototype.getAuthToken=function(){return this.getUserIdentityToken()},e.prototype.getUserIdentityToken=function(){var e=this;return new Promise((function(t,s){var o=++e.lastAuthTokenRequestId;e.authTokenRequests[o]={reject:s,resolve:t},e.postMessageToHostPage({message:{authTokenRequestId:o},messageType:"get-auth-token"})}))},e.prototype.showModal=function(e){var t=this;return{modalClosed:new Promise((function(s,o){var n=++t.lastModalRequestId;t.modalRequests[n]={reject:o,resolve:s},t.postMessageToHostPage({message:{args:e,modalRequestId:n},messageType:"show-modal"})}))}},e.prototype.closeModal=function(e){this.postMessageToHostPage({message:e,messageType:"close-modal"})},e.prototype.openHelp=function(e){this.postMessageToHostPage({message:{helpKey:e.helpKey},messageType:"open-help"})},e.prototype.showToast=function(e){this.postMessageToHostPage({message:e,messageType:"show-toast"})},e.prototype.showFlyout=function(e){var t=this;return{flyoutClosed:new Promise((function(s,o){e.defaultWidth=e.defaultWidth||500,e.maxWidth=e.maxWidth||e.defaultWidth,e.minWidth=e.minWidth||320,t.flyoutRequest={reject:o,resolve:s},t.postMessageToHostPage({message:e,messageType:"show-flyout"})}))}},e.prototype.closeFlyout=function(){this.postMessageToHostPage({messageType:"close-flyout"})},e.prototype.showConfirm=function(e){var t=this;return new Promise((function(s,o){t.confirmRequest={reject:o,resolve:s},t.postMessageToHostPage({message:e,messageType:"show-confirm"})}))},e.prototype.showError=function(e){this.postMessageToHostPage({message:e,messageType:"show-error"})},e.prototype.raiseAddinReadyMessage=function(){this.postMessageToHostPage({messageType:"ready"},"*")},e.prototype.handleModalClosedMessage=function(e){var t=this.modalRequests,s=e.modalRequestId;t[s].resolve(e.context),t[s]=void 0},e.prototype.handleAuthTokenMessage=function(e){var t=this.authTokenRequests,s=e.message.authTokenRequestId,o=t[s];switch(e.messageType){case"auth-token":var n=e.message.authToken;o.resolve(n);break;case"auth-token-fail":o.reject(e.message.reason)}t[s]=void 0},e.prototype.handleMessage=function(e){var t=this,s=e.data;if(s&&"bb-addin-host"===s.source)if("host-ready"===s.messageType)this.setKnownAllowedHostOrigin(e.origin),this.trackHeightChangesOfAddinContent(),this.args.callbacks.init({context:s.message.context,envId:s.message.envId,ready:function(e){t.checkForHeightChangesOfAddinContent(),t.postMessageToHostPage({message:e,messageType:"addin-ready"})}});else if(this.isFromValidOrigin(e))switch(s.messageType){case"auth-token":case"auth-token-fail":this.handleAuthTokenMessage(s);break;case"modal-closed":this.handleModalClosedMessage(s.message);break;case"button-click":this.args.callbacks.buttonClick&&this.args.callbacks.buttonClick();break;case"confirm-closed":this.confirmRequest&&(this.confirmRequest.resolve(s.message.reason),this.confirmRequest=void 0);break;case"flyout-closed":this.flyoutRequest&&(this.flyoutRequest.resolve(),this.flyoutRequest=void 0);break;case"flyout-next-click":this.args.callbacks.flyoutNextClick&&this.args.callbacks.flyoutNextClick();break;case"flyout-previous-click":this.args.callbacks.flyoutPreviousClick&&this.args.callbacks.flyoutPreviousClick();break;case"help-click":this.args.callbacks.helpClick&&this.args.callbacks.helpClick();break;case"settings-click":this.args.callbacks.settingsClick&&this.args.callbacks.settingsClick()}else this.warnInvalidOrigin()},e.prototype.setKnownAllowedHostOrigin=function(e){for(var t=0,s=o;t<s.length;t++){if(s[t].test(e))return void(this.trustedOrigin=e)}},e.prototype.checkForHeightChangesOfAddinContent=function(){var e=document.documentElement.offsetHeight;e!==this.lastPostedIframeHeight&&(this.lastPostedIframeHeight=e,this.postMessageToHostPage({message:{height:e+"px"},messageType:"height-change"}))},e.prototype.trackHeightChangesOfAddinContent=function(){var e=this;this.heightChangeIntervalId=setInterval((function(){e.checkForHeightChangesOfAddinContent()}),1e3)},e.prototype.postMessageToHostPage=function(e,t){e.source="bb-addin-client",e.addinId=this.getQueryVariable("addinId"),(t=t||this.trustedOrigin)?window.parent.postMessage(e,t):this.warnInvalidOrigin()},e.prototype.isFromValidOrigin=function(e){return e.origin===this.trustedOrigin},e.prototype.warnInvalidOrigin=function(){console.warn("The origin is not trusted because the host-ready message has not been sent or because the host origin is not a whitelisted origin.")},e.prototype.getQueryVariable=function(t){for(var s=0,o=e.getQueryString().substring(1).split("&");s<o.length;s++){var n=o[s].split("=");if(decodeURIComponent(n[0])===t)return decodeURIComponent(n[1])}},e}();t.AddinClient=n},function(e,t,s){"use strict";function o(e){for(var s in e)t.hasOwnProperty(s)||(t[s]=e[s])}Object.defineProperty(t,"__esModule",{value:!0}),o(s(4)),o(s(5)),o(s(6)),o(s(7)),o(s(8))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.None=0]="None",e[e.Add=1]="Add",e[e.Edit=2]="Edit",e[e.Delete=3]="Delete"}(t.AddinButtonStyle||(t.AddinButtonStyle={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.Default=0]="Default",e[e.Primary=1]="Primary",e[e.Link=2]="Link"}(t.AddinConfirmButtonStyle||(t.AddinConfirmButtonStyle={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.None=0]="None",e[e.Text=1]="Text"}(t.AddinTabSummaryStyle||(t.AddinTabSummaryStyle={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.None=0]="None",e[e.Text=1]="Text",e[e.Check=2]="Check"}(t.AddinTileSummaryStyle||(t.AddinTileSummaryStyle={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.Danger=0]="Danger",e[e.Info=1]="Info",e[e.Success=2]="Success",e[e.Warning=3]="Warning"}(t.AddinToastStyle||(t.AddinToastStyle={}))}])})); |
@@ -1,1 +0,1 @@ | ||
(function e(t,s){if(typeof exports==="object"&&typeof module==="object")module.exports=s();else if(typeof define==="function"&&define.amd)define([],s);else if(typeof exports==="object")exports["BBSkyAddinClient"]=s();else t["BBSkyAddinClient"]=s()})(this,function(){return function(e){var t={};function s(o){if(t[o]){return t[o].exports}var n=t[o]={i:o,l:false,exports:{}};e[o].call(n.exports,n,n.exports,s);n.l=true;return n.exports}s.m=e;s.c=t;s.i=function(e){return e};s.d=function(e,t,o){if(!s.o(e,t)){Object.defineProperty(e,t,{configurable:false,enumerable:true,get:o})}};s.n=function(e){var t=e&&e.__esModule?function t(){return e["default"]}:function t(){return e};s.d(t,"a",t);return t};s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};s.p="";return s(s.s=1)}([function(e,t,s){"use strict";function o(e){for(var s in e)if(!t.hasOwnProperty(s))t[s]=e[s]}Object.defineProperty(t,"__esModule",{value:true});o(s(2));o(s(8))},function(e,t,s){"use strict";function o(e){for(var s in e)if(!t.hasOwnProperty(s))t[s]=e[s]}Object.defineProperty(t,"__esModule",{value:true});o(s(0))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:true});var o=[/^https\:\/\/[\w\-\.]+\.blackbaud\.com$/,/^https\:\/\/[\w\-\.]+\.blackbaud\-dev\.com$/,/^http\:\/\/[\w\-\.]+\.blackbaud\-dev\.com$/,/^https\:\/\/[\w\-\.]+\.blackbaudhosting\.com$/,/^https\:\/\/[\w\-\.]+\.bbcloudservices\.com$/,/^https\:\/\/localhost\:[0-9]+$/];var n=function(){function e(e){var t=this;this.args=e;this.authTokenRequests=[];this.lastAuthTokenRequestId=0;this.modalRequests=[];this.lastModalRequestId=0;this.windowMessageHandler=function(e){t.handleMessage(e)};window.addEventListener("message",this.windowMessageHandler);this.raiseAddinReadyMessage()}e.getQueryString=function(){return window.location.search};e.prototype.destroy=function(){window.removeEventListener("message",this.windowMessageHandler);if(this.heightChangeIntervalId){clearInterval(this.heightChangeIntervalId)}};e.prototype.navigate=function(e){this.postMessageToHostPage({message:{url:e.url},messageType:"navigate"})};e.prototype.getAuthToken=function(){return this.getUserIdentityToken()};e.prototype.getUserIdentityToken=function(){var e=this;return new Promise(function(t,s){var o=++e.lastAuthTokenRequestId;e.authTokenRequests[o]={reject:s,resolve:t};e.postMessageToHostPage({message:{authTokenRequestId:o},messageType:"get-auth-token"})})};e.prototype.showModal=function(e){var t=this;return{modalClosed:new Promise(function(s,o){var n=++t.lastModalRequestId;t.modalRequests[n]={reject:o,resolve:s};t.postMessageToHostPage({message:{args:e,modalRequestId:n},messageType:"show-modal"})})}};e.prototype.closeModal=function(e){this.postMessageToHostPage({message:e,messageType:"close-modal"})};e.prototype.openHelp=function(e){this.postMessageToHostPage({message:{helpKey:e.helpKey},messageType:"open-help"})};e.prototype.showToast=function(e){this.postMessageToHostPage({message:e,messageType:"show-toast"})};e.prototype.showFlyout=function(e){var t=this;return{flyoutClosed:new Promise(function(s,o){e.defaultWidth=e.defaultWidth||500;e.maxWidth=e.maxWidth||e.defaultWidth;e.minWidth=e.minWidth||320;t.flyoutRequest={reject:o,resolve:s};t.postMessageToHostPage({message:e,messageType:"show-flyout"})})}};e.prototype.closeFlyout=function(){this.postMessageToHostPage({messageType:"close-flyout"})};e.prototype.showConfirm=function(e){var t=this;return new Promise(function(s,o){t.confirmRequest={reject:o,resolve:s};t.postMessageToHostPage({message:e,messageType:"show-confirm"})})};e.prototype.showError=function(e){this.postMessageToHostPage({message:e,messageType:"show-error"})};e.prototype.raiseAddinReadyMessage=function(){this.postMessageToHostPage({messageType:"ready"},"*")};e.prototype.handleModalClosedMessage=function(e){var t=this.modalRequests;var s=e.modalRequestId;var o=t[s];o.resolve(e.context);t[s]=undefined};e.prototype.handleAuthTokenMessage=function(e){var t=this.authTokenRequests;var s=e.message.authTokenRequestId;var o=t[s];switch(e.messageType){case"auth-token":var n=e.message.authToken;o.resolve(n);break;case"auth-token-fail":o.reject(e.message.reason);break}t[s]=undefined};e.prototype.handleMessage=function(e){var t=this;var s=e.data;if(s&&s.source==="bb-addin-host"){if(s.messageType==="host-ready"){this.setKnownAllowedHostOrigin(e.origin);this.trackHeightChangesOfAddinContent();this.args.callbacks.init({context:s.message.context,envId:s.message.envId,ready:function(e){t.checkForHeightChangesOfAddinContent();t.postMessageToHostPage({message:e,messageType:"addin-ready"})}})}else if(this.isFromValidOrigin(e)){switch(s.messageType){case"auth-token":case"auth-token-fail":this.handleAuthTokenMessage(s);break;case"modal-closed":this.handleModalClosedMessage(s.message);break;case"button-click":if(this.args.callbacks.buttonClick){this.args.callbacks.buttonClick()}break;case"confirm-closed":if(this.confirmRequest){this.confirmRequest.resolve(s.message.reason);this.confirmRequest=undefined}break;case"flyout-closed":if(this.flyoutRequest){this.flyoutRequest.resolve();this.flyoutRequest=undefined}break;case"flyout-next-click":if(this.args.callbacks.flyoutNextClick){this.args.callbacks.flyoutNextClick()}break;case"flyout-previous-click":if(this.args.callbacks.flyoutPreviousClick){this.args.callbacks.flyoutPreviousClick()}break;case"help-click":if(this.args.callbacks.helpClick){this.args.callbacks.helpClick()}break;case"settings-click":if(this.args.callbacks.settingsClick){this.args.callbacks.settingsClick()}break}}else{this.warnInvalidOrigin()}}};e.prototype.setKnownAllowedHostOrigin=function(e){for(var t=0,s=o;t<s.length;t++){var n=s[t];if(n.test(e)){this.trustedOrigin=e;return}}};e.prototype.checkForHeightChangesOfAddinContent=function(){var e=document.documentElement.offsetHeight;if(e!==this.lastPostedIframeHeight){this.lastPostedIframeHeight=e;this.postMessageToHostPage({message:{height:e+"px"},messageType:"height-change"})}};e.prototype.trackHeightChangesOfAddinContent=function(){var e=this;this.heightChangeIntervalId=setInterval(function(){e.checkForHeightChangesOfAddinContent()},1e3)};e.prototype.postMessageToHostPage=function(e,t){e.source="bb-addin-client";e.addinId=this.getQueryVariable("addinId");t=t||this.trustedOrigin;if(t){window.parent.postMessage(e,t)}else{this.warnInvalidOrigin()}};e.prototype.isFromValidOrigin=function(e){return e.origin===this.trustedOrigin};e.prototype.warnInvalidOrigin=function(){console.warn("The origin is not trusted because the host-ready message has not been "+"sent or because the host origin is not a whitelisted origin.")};e.prototype.getQueryVariable=function(t){var s=e.getQueryString().substring(1);var o=s.split("&");for(var n=0,i=o;n<i.length;n++){var a=i[n];var r=a.split("=");if(decodeURIComponent(r[0])===t){return decodeURIComponent(r[1])}}};return e}();t.AddinClient=n},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:true});var o;(function(e){e[e["None"]=0]="None";e[e["Add"]=1]="Add";e[e["Edit"]=2]="Edit";e[e["Delete"]=3]="Delete"})(o=t.AddinButtonStyle||(t.AddinButtonStyle={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:true});var o;(function(e){e[e["Default"]=0]="Default";e[e["Primary"]=1]="Primary";e[e["Link"]=2]="Link"})(o=t.AddinConfirmButtonStyle||(t.AddinConfirmButtonStyle={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:true});var o;(function(e){e[e["None"]=0]="None";e[e["Text"]=1]="Text"})(o=t.AddinTabSummaryStyle||(t.AddinTabSummaryStyle={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:true});var o;(function(e){e[e["None"]=0]="None";e[e["Text"]=1]="Text";e[e["Check"]=2]="Check"})(o=t.AddinTileSummaryStyle||(t.AddinTileSummaryStyle={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:true});var o;(function(e){e[e["Danger"]=0]="Danger";e[e["Info"]=1]="Info";e[e["Success"]=2]="Success";e[e["Warning"]=3]="Warning"})(o=t.AddinToastStyle||(t.AddinToastStyle={}))},function(e,t,s){"use strict";function o(e){for(var s in e)if(!t.hasOwnProperty(s))t[s]=e[s]}Object.defineProperty(t,"__esModule",{value:true});o(s(3));o(s(4));o(s(5));o(s(6));o(s(7))}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.BBSkyAddinClient=t():e.BBSkyAddinClient=t()}(window,function(){return function(s){var o={};function n(e){if(o[e])return o[e].exports;var t=o[e]={i:e,l:!1,exports:{}};return s[e].call(t.exports,t,t.exports,n),t.l=!0,t.exports}return n.m=s,n.c=o,n.d=function(e,t,s){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},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(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(s,o,function(e){return t[e]}.bind(null,o));return s},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=0)}([function(e,s,t){"use strict";Object.defineProperty(s,"__esModule",{value:!0}),function(e){for(var t in e)s.hasOwnProperty(t)||(s[t]=e[t])}(t(1))},function(e,s,t){"use strict";function o(e){for(var t in e)s.hasOwnProperty(t)||(s[t]=e[t])}Object.defineProperty(s,"__esModule",{value:!0}),o(t(2)),o(t(3))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=[/^https\:\/\/[\w\-\.]+\.blackbaud\.com$/,/^https\:\/\/[\w\-\.]+\.blackbaud\-dev\.com$/,/^http\:\/\/[\w\-\.]+\.blackbaud\-dev\.com$/,/^https\:\/\/[\w\-\.]+\.blackbaudhosting\.com$/,/^https\:\/\/[\w\-\.]+\.bbcloudservices\.com$/,/^https\:\/\/localhost\:[0-9]+$/],n=function(){function n(e){var t=this;this.args=e,this.authTokenRequests=[],this.lastAuthTokenRequestId=0,this.modalRequests=[],this.lastModalRequestId=0,this.windowMessageHandler=function(e){t.handleMessage(e)},window.addEventListener("message",this.windowMessageHandler),this.raiseAddinReadyMessage()}return n.getQueryString=function(){return window.location.search},n.prototype.destroy=function(){window.removeEventListener("message",this.windowMessageHandler),this.heightChangeIntervalId&&clearInterval(this.heightChangeIntervalId)},n.prototype.navigate=function(e){this.postMessageToHostPage({message:{url:e.url},messageType:"navigate"})},n.prototype.getAuthToken=function(){return this.getUserIdentityToken()},n.prototype.getUserIdentityToken=function(){var o=this;return new Promise(function(e,t){var s=++o.lastAuthTokenRequestId;o.authTokenRequests[s]={reject:t,resolve:e},o.postMessageToHostPage({message:{authTokenRequestId:s},messageType:"get-auth-token"})})},n.prototype.showModal=function(o){var n=this;return{modalClosed:new Promise(function(e,t){var s=++n.lastModalRequestId;n.modalRequests[s]={reject:t,resolve:e},n.postMessageToHostPage({message:{args:o,modalRequestId:s},messageType:"show-modal"})})}},n.prototype.closeModal=function(e){this.postMessageToHostPage({message:e,messageType:"close-modal"})},n.prototype.openHelp=function(e){this.postMessageToHostPage({message:{helpKey:e.helpKey},messageType:"open-help"})},n.prototype.showToast=function(e){this.postMessageToHostPage({message:e,messageType:"show-toast"})},n.prototype.showFlyout=function(s){var o=this;return{flyoutClosed:new Promise(function(e,t){s.defaultWidth=s.defaultWidth||500,s.maxWidth=s.maxWidth||s.defaultWidth,s.minWidth=s.minWidth||320,o.flyoutRequest={reject:t,resolve:e},o.postMessageToHostPage({message:s,messageType:"show-flyout"})})}},n.prototype.closeFlyout=function(){this.postMessageToHostPage({messageType:"close-flyout"})},n.prototype.showConfirm=function(s){var o=this;return new Promise(function(e,t){o.confirmRequest={reject:t,resolve:e},o.postMessageToHostPage({message:s,messageType:"show-confirm"})})},n.prototype.showError=function(e){this.postMessageToHostPage({message:e,messageType:"show-error"})},n.prototype.raiseAddinReadyMessage=function(){this.postMessageToHostPage({messageType:"ready"},"*")},n.prototype.handleModalClosedMessage=function(e){var t=this.modalRequests,s=e.modalRequestId;t[s].resolve(e.context),t[s]=void 0},n.prototype.handleAuthTokenMessage=function(e){var t=this.authTokenRequests,s=e.message.authTokenRequestId,o=t[s];switch(e.messageType){case"auth-token":var n=e.message.authToken;o.resolve(n);break;case"auth-token-fail":o.reject(e.message.reason)}t[s]=void 0},n.prototype.handleMessage=function(e){var t=this,s=e.data;if(s&&"bb-addin-host"===s.source)if("host-ready"===s.messageType)this.setKnownAllowedHostOrigin(e.origin),this.trackHeightChangesOfAddinContent(),this.args.callbacks.init({context:s.message.context,envId:s.message.envId,ready:function(e){t.checkForHeightChangesOfAddinContent(),t.postMessageToHostPage({message:e,messageType:"addin-ready"})}});else if(this.isFromValidOrigin(e))switch(s.messageType){case"auth-token":case"auth-token-fail":this.handleAuthTokenMessage(s);break;case"modal-closed":this.handleModalClosedMessage(s.message);break;case"button-click":this.args.callbacks.buttonClick&&this.args.callbacks.buttonClick();break;case"confirm-closed":this.confirmRequest&&(this.confirmRequest.resolve(s.message.reason),this.confirmRequest=void 0);break;case"flyout-closed":this.flyoutRequest&&(this.flyoutRequest.resolve(),this.flyoutRequest=void 0);break;case"flyout-next-click":this.args.callbacks.flyoutNextClick&&this.args.callbacks.flyoutNextClick();break;case"flyout-previous-click":this.args.callbacks.flyoutPreviousClick&&this.args.callbacks.flyoutPreviousClick();break;case"help-click":this.args.callbacks.helpClick&&this.args.callbacks.helpClick();break;case"settings-click":this.args.callbacks.settingsClick&&this.args.callbacks.settingsClick()}else this.warnInvalidOrigin()},n.prototype.setKnownAllowedHostOrigin=function(e){for(var t=0,s=o;t<s.length;t++){if(s[t].test(e))return void(this.trustedOrigin=e)}},n.prototype.checkForHeightChangesOfAddinContent=function(){var e=document.documentElement.offsetHeight;e!==this.lastPostedIframeHeight&&(this.lastPostedIframeHeight=e,this.postMessageToHostPage({message:{height:e+"px"},messageType:"height-change"}))},n.prototype.trackHeightChangesOfAddinContent=function(){var e=this;this.heightChangeIntervalId=setInterval(function(){e.checkForHeightChangesOfAddinContent()},1e3)},n.prototype.postMessageToHostPage=function(e,t){e.source="bb-addin-client",e.addinId=this.getQueryVariable("addinId"),(t=t||this.trustedOrigin)?window.parent.postMessage(e,t):this.warnInvalidOrigin()},n.prototype.isFromValidOrigin=function(e){return e.origin===this.trustedOrigin},n.prototype.warnInvalidOrigin=function(){console.warn("The origin is not trusted because the host-ready message has not been sent or because the host origin is not a whitelisted origin.")},n.prototype.getQueryVariable=function(e){for(var t=0,s=n.getQueryString().substring(1).split("&");t<s.length;t++){var o=s[t].split("=");if(decodeURIComponent(o[0])===e)return decodeURIComponent(o[1])}},n}();t.AddinClient=n},function(e,s,t){"use strict";function o(e){for(var t in e)s.hasOwnProperty(t)||(s[t]=e[t])}Object.defineProperty(s,"__esModule",{value:!0}),o(t(4)),o(t(5)),o(t(6)),o(t(7)),o(t(8))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.None=0]="None",e[e.Add=1]="Add",e[e.Edit=2]="Edit",e[e.Delete=3]="Delete"}(t.AddinButtonStyle||(t.AddinButtonStyle={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.Default=0]="Default",e[e.Primary=1]="Primary",e[e.Link=2]="Link"}(t.AddinConfirmButtonStyle||(t.AddinConfirmButtonStyle={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.None=0]="None",e[e.Text=1]="Text"}(t.AddinTabSummaryStyle||(t.AddinTabSummaryStyle={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.None=0]="None",e[e.Text=1]="Text",e[e.Check=2]="Check"}(t.AddinTileSummaryStyle||(t.AddinTileSummaryStyle={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.Danger=0]="Danger",e[e.Info=1]="Info",e[e.Success=2]="Success",e[e.Warning=3]="Warning"}(t.AddinToastStyle||(t.AddinToastStyle={}))}])}); |
@@ -1,3 +0,7 @@ | ||
# 1.0.14 (2020-3-4) | ||
# 1.0.15 (2020-04-02) | ||
- Updated `devDependencies` and instructions for consuming from CDN. | ||
# 1.0.14 (2020-03-04) | ||
- Added `AddinModalConfig` with optional `fullPage` property (Default: false) to indicate if a modal add-in will be | ||
@@ -4,0 +8,0 @@ displayed full page. |
export * from './src/addin'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -1,1 +0,70 @@ | ||
{"name":"@blackbaud/sky-addin-client","version":"1.0.14","description":"SKY add-in client","main":"dist/bundles/sky-addin-client.umd.js","module":"index.js","scripts":{"ci":"npm run test:ci && npm run build","test":"npm run lint && npm run test:unit","test:ci":"npm run test:unit:ci","test:unit":"npm run test:unit:base -- config/karma/local.karma.conf.js","test:unit:ci":"npm run test:unit:base -- config/karma/ci.karma.conf.js","test:unit:base":"node --max-old-space-size=4096 node_modules/karma/bin/karma start","pretest":"npm run lint","compress":"npm run uglifyjs -- dist/bundles/sky-addin-client.umd.js -m -o dist/bundles/sky-addin-client.umd.min.js","build":"npm run rimraf dist && npm run tsc && npm run webpack -- --config config/webpack/webpack.prod.config.js && npm run compress","watch":"npm run test:unit -- --auto-watch --no-single-run","lint":"tslint 'src/**/*.ts'","rimraf":"rimraf","tsc":"tsc","uglifyjs":"uglifyjs","webpack":"webpack"},"repository":{"type":"git","url":"git+https://github.com/blackbaud/sky-addin-client.git"},"author":"Blackbaud, Inc.","license":"MIT","bugs":{"url":"https://github.com/blackbaudsky-addin-client/issues"},"homepage":"https://github.com/blackbaud/sky-addin-client#readme","devDependencies":{"@types/core-js":"0.9.41","@types/jasmine":"2.5.47","@types/jasmine-ajax":"3.1.36","@types/webpack":"2.2.15","core-js":"2.4.1","fs-extra":"3.0.1","istanbul":"0.4.5","istanbul-instrumenter-loader":"0.2.0","jasmine":"2.6.0","jasmine-ajax":"3.3.1","karma":"4.0.1","karma-browserstack-launcher":"1.4.0","karma-chrome-launcher":"2.1.1","karma-coverage":"1.1.2","karma-firefox-launcher":"1.0.1","karma-jasmine":"1.1.0","karma-mocha-reporter":"2.2.3","karma-sourcemap-loader":"0.3.7","karma-webpack":"3.0.5","raw-loader":"0.5.1","remap-istanbul":"0.9.5","rimraf":"2.6.1","source-map-inline-loader":"github:blackbaud-bobbyearl/source-map-inline-loader","ts-loader":"2.0.3","tslint":"5.2.0","tslint-loader":"3.5.3","typescript":"2.3.2","uglify-js":"3.0.15","webpack":"2.5.1"}} | ||
{ | ||
"name": "@blackbaud/sky-addin-client", | ||
"version": "1.0.15", | ||
"description": "SKY add-in client", | ||
"main": "dist/bundles/sky-addin-client.umd.js", | ||
"module": "index.js", | ||
"scripts": { | ||
"ci": "npm run test:ci \u0026\u0026 npm run build", | ||
"test": "npm run lint \u0026\u0026 npm run test:unit", | ||
"test:ci": "npm run test:unit:ci", | ||
"test:unit": "npm run test:unit:base -- config/karma/local.karma.conf.js", | ||
"test:unit:ci": "npm run test:unit:base -- config/karma/ci.karma.conf.js", | ||
"test:unit:base": "node --max-old-space-size=4096 node_modules/karma/bin/karma start", | ||
"pretest": "npm run lint", | ||
"compress": "npm run uglifyjs -- dist/bundles/sky-addin-client.umd.js -m -o dist/bundles/sky-addin-client.umd.min.js", | ||
"build": "npm run rimraf dist \u0026\u0026 npm run tsc \u0026\u0026 npm run webpack -- --config config/webpack/webpack.prod.config.js \u0026\u0026 npm run compress", | ||
"watch": "npm run test:unit -- --auto-watch --no-single-run", | ||
"lint": "tslint \u0027src/**/*.ts\u0027", | ||
"rimraf": "rimraf", | ||
"tsc": "tsc", | ||
"uglifyjs": "uglifyjs", | ||
"webpack": "webpack" | ||
}, | ||
"pipelineSettings": { | ||
"publishToCDN": true, | ||
"publishToNPM": true | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/blackbaud/sky-addin-client.git" | ||
}, | ||
"author": "Blackbaud, Inc.", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/blackbaudsky-addin-client/issues" | ||
}, | ||
"homepage": "https://github.com/blackbaud/sky-addin-client#readme", | ||
"devDependencies": { | ||
"@types/core-js": "2.5.3", | ||
"@types/jasmine": "3.5.10", | ||
"@types/jasmine-ajax": "3.3.0", | ||
"@types/webpack": "4.41.10", | ||
"core-js": "3.6.4", | ||
"fs-extra": "9.0.0", | ||
"istanbul": "0.4.5", | ||
"istanbul-instrumenter-loader": "3.0.1", | ||
"jasmine": "3.5.0", | ||
"jasmine-ajax": "4.0.0", | ||
"karma": "4.4.1", | ||
"karma-browserstack-launcher": "1.5.1", | ||
"karma-chrome-launcher": "3.1.0", | ||
"karma-coverage": "2.0.1", | ||
"karma-firefox-launcher": "1.3.0", | ||
"karma-jasmine": "3.1.1", | ||
"karma-mocha-reporter": "2.2.5", | ||
"karma-sourcemap-loader": "0.3.7", | ||
"karma-webpack": "4.0.2", | ||
"raw-loader": "4.0.0", | ||
"remap-istanbul": "0.13.0", | ||
"rimraf": "3.0.2", | ||
"source-map-inline-loader": "github:blackbaud-bobbyearl/source-map-inline-loader", | ||
"ts-loader": "6.2.2", | ||
"tslint": "6.1.0", | ||
"tslint-loader": "3.5.4", | ||
"typescript": "3.8.3", | ||
"uglify-js": "3.8.1", | ||
"webpack": "4.42.1", | ||
"webpack-cli": "3.3.11" | ||
} | ||
} |
@@ -28,4 +28,13 @@ # sky-addin-client | ||
If you are not using a module loader at all, then you can load the `dist/bundles/sky-addin-client.umd.js` file onto your page via a `<script>` element or concatenated with the rest of your page's JavaScript, and access it via the global `BBSkyAddinClient` variable: | ||
If you're not using a module loader or prefer to reference the file via CDN, you can load the file onto your page via `<script>` tag. | ||
If using NPM, add a reference to `dist/bundles/sky-addin-client.umd.js` or concatenate that file with the rest of your page's JavaScript. | ||
If using the SKY UX CDN, add a reference to `https://sky.blackbaudcdn.net/static/sky-addin-client/[VERSION]/auth-client.global.min.js`, where `[VERSION]` is the version you'd like to use. Starting with version `1.0.15`, All versions published to NPM are also available through the CDN. You can also reference the latest major version. Example versions: | ||
- `https://sky.blackbaudcdn.net/static/sky-addin-client/1.0.15/sky-addin-client.global.min.js` | ||
- `https://sky.blackbaudcdn.net/static/sky-addin-client/1/sky-addin-client.global.min.js` | ||
You can now access it via the global `BBSkyAddinClient` variable: | ||
```js | ||
@@ -36,2 +45,3 @@ // BBSkyAddinClient is global here. | ||
## Usage | ||
@@ -38,0 +48,0 @@ |
@@ -60,3 +60,3 @@ import { AddinClientArgs } from './client-interfaces/addin-client-args'; | ||
*/ | ||
private static getQueryString(); | ||
private static getQueryString; | ||
constructor(args: AddinClientArgs); | ||
@@ -132,3 +132,3 @@ /** | ||
*/ | ||
private raiseAddinReadyMessage(); | ||
private raiseAddinReadyMessage; | ||
/** | ||
@@ -141,3 +141,3 @@ * Handles the modal-closed message from the host. | ||
*/ | ||
private handleModalClosedMessage(message); | ||
private handleModalClosedMessage; | ||
/** | ||
@@ -147,3 +147,3 @@ * Handles host message responses to a get-auth-token request. | ||
*/ | ||
private handleAuthTokenMessage(data); | ||
private handleAuthTokenMessage; | ||
/** | ||
@@ -153,3 +153,3 @@ * Handles message events received from the add-in host page. | ||
*/ | ||
private handleMessage(event); | ||
private handleMessage; | ||
/** | ||
@@ -162,3 +162,3 @@ * Validates and registers a value as the origin of the parent page hosting the add-in. | ||
*/ | ||
private setKnownAllowedHostOrigin(hostOrigin); | ||
private setKnownAllowedHostOrigin; | ||
/** | ||
@@ -169,3 +169,3 @@ * Checks if the height of the iFrame has changed since it was last | ||
*/ | ||
private checkForHeightChangesOfAddinContent(); | ||
private checkForHeightChangesOfAddinContent; | ||
/** | ||
@@ -175,3 +175,3 @@ * Starts a timeout interval to watch for height changes | ||
*/ | ||
private trackHeightChangesOfAddinContent(); | ||
private trackHeightChangesOfAddinContent; | ||
/** | ||
@@ -183,3 +183,3 @@ * Posts a message to the parent window. | ||
*/ | ||
private postMessageToHostPage(message, targetOrigin?); | ||
private postMessageToHostPage; | ||
/** | ||
@@ -189,7 +189,7 @@ * Checks whether a MessageEvent is from the execetd host origin. | ||
*/ | ||
private isFromValidOrigin(event); | ||
private isFromValidOrigin; | ||
/** | ||
* Log that a message was received with an invalid origin. | ||
*/ | ||
private warnInvalidOrigin(); | ||
private warnInvalidOrigin; | ||
/** | ||
@@ -200,3 +200,3 @@ * Reads a query string value from the current window location. | ||
*/ | ||
private getQueryVariable(variable); | ||
private getQueryVariable; | ||
} |
@@ -17,3 +17,3 @@ "use strict"; | ||
*/ | ||
var AddinClient = (function () { | ||
var AddinClient = /** @class */ (function () { | ||
function AddinClient(args) { | ||
@@ -20,0 +20,0 @@ var _this = this; |
@@ -0,0 +0,0 @@ import { AddinButtonStyle } from './addin-button-style'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=addin-button-config.js.map |
@@ -5,3 +5,3 @@ export declare enum AddinButtonStyle { | ||
Edit = 2, | ||
Delete = 3, | ||
Delete = 3 | ||
} |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { AddinClientCallbacks } from './addin-client-callbacks'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=addin-client-args.js.map |
@@ -0,0 +0,0 @@ import { AddinClientInitArgs } from './addin-client-init-args'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=addin-client-callbacks.js.map |
@@ -0,0 +0,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=addin-client-close-modal-args.js.map |
@@ -0,0 +0,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=addin-client-flyout-permalink.js.map |
@@ -0,0 +0,0 @@ import { AddinClientReadyArgs } from './addin-client-ready-args'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=addin-client-init-args.js.map |
@@ -0,0 +0,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=addin-client-navigate-args.js.map |
@@ -0,0 +0,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=addin-client-open-help-args.js.map |
@@ -0,0 +0,0 @@ import { AddinButtonConfig } from './addin-button-config'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=addin-client-ready-args.js.map |
@@ -0,0 +0,0 @@ import { AddinButtonStyle } from './addin-button-style'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=addin-client-ready-button-config.js.map |
@@ -0,0 +0,0 @@ import { AddinConfirmButton } from './addin-confirm-button'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=addin-client-show-confirm-args.js.map |
@@ -0,0 +0,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=addin-client-show-error-args.js.map |
@@ -0,0 +0,0 @@ import { AddinClientFlyoutPermalink } from './addin-client-flyout-permalink'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=addin-client-show-flyout-args.js.map |
@@ -0,0 +0,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=addin-client-show-flyout-result.js.map |
@@ -0,0 +0,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=addin-client-show-modal-args.js.map |
@@ -0,0 +0,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=addin-client-show-modal-result.js.map |
@@ -0,0 +0,0 @@ import { AddinToastStyle } from './addin-toast-style'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=addin-client-show-toast-args.js.map |
@@ -7,3 +7,3 @@ /** | ||
Primary = 1, | ||
Link = 2, | ||
Link = 2 | ||
} |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { AddinConfirmButtonStyle } from './addin-confirm-button-style'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=addin-confirm-button.js.map |
@@ -0,0 +0,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=addin-modal-config.js.map |
export declare enum AddinTabSummaryStyle { | ||
None = 0, | ||
Text = 1, | ||
Text = 1 | ||
} |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { AddinTileSummaryStyle } from './addin-tile-summary-style'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=addin-tile-config.js.map |
export declare enum AddinTileSummaryStyle { | ||
None = 0, | ||
Text = 1, | ||
Check = 2, | ||
Check = 2 | ||
} |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -5,3 +5,3 @@ export declare enum AddinToastStyle { | ||
Success = 2, | ||
Warning = 3, | ||
Warning = 3 | ||
} |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ export * from './addin-button-config'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { AddinHostMessage } from './addin-host-message'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=addin-host-message-event-data.js.map |
@@ -0,0 +0,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=addin-host-message.js.map |
export * from './addin-host-message-event-data'; | ||
export * from './addin-host-message'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=index.js.map |
export * from './addin-client'; | ||
export * from './client-interfaces'; | ||
export * from './host-interfaces'; |
@@ -0,0 +0,0 @@ "use strict"; |
Sorry, the diff of this file is not supported yet
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
376
105864
30
1244