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

@blackbaud/sky-addin-client

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blackbaud/sky-addin-client - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

2

bundles/sky-addin-client.umd.js

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

!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]+)?$/,/^https\:\/\/secure[2|3|8]\.convio\.net$/,/^https\:\/\/testweb\.convio\.com$/,/^https\:\/\/[\w\-\.]+\.conviocloud\.com$/,/^https\:\/\/[\w\-\.]+\.blackbaudcloud\.com$/],n=function(){function e(e){var t=this;this.args=e,this.authTokenRequests=[],this.lastAuthTokenRequestId=0,this.modalRequests=[],this.lastModalRequestId=0,this.registeredAddinEvents={},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.showWait=function(){this.postMessageToHostPage({messageType:"show-wait"})},e.prototype.hideWait=function(){this.postMessageToHostPage({messageType:"hide-wait"})},e.prototype.addEventHandler=function(e,t){this.registeredAddinEvents[e]=t},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"update-context":this.args.callbacks.updateContext&&this.args.callbacks.updateContext(s.message);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();break;case"host-event":this.processHostEvent(s.message)}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.processHostEvent=function(e){var t=this,s=e.context,o=this.registeredAddinEvents[s.type];(o?this.isBlockingEventType(s.type)?new Promise((function(e){o(s.context,(function(){e()}))})):new Promise((function(e){o(s.context),e()})):Promise.resolve()).then((function(){return t.postEventReceivedMessage(e.eventRequestId)}))},e.prototype.isBlockingEventType=function(e){switch(e){case"form-save":case"form-cancel":return!0}return!1},e.prototype.postEventReceivedMessage=function(e){this.postMessageToHostPage({message:{eventRequestId:e},messageType:"event-received"})},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={}))}])}));
!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]+)?$/,/^https\:\/\/secure[2|3|8]\.convio\.net$/,/^https\:\/\/testweb\.convio\.com$/,/^https\:\/\/[\w\-\.]+\.conviocloud\.com$/,/^https\:\/\/[\w\-\.]+\.blackbaudcloud\.com$/],n=function(){function e(e){var t=this;this.args=e,this.authTokenRequests=[],this.lastAuthTokenRequestId=0,this.modalRequests=[],this.lastModalRequestId=0,this.registeredAddinEvents={},this.sentEvents={},this.pendingSentEvents={},this.eventRequestId=0,this.supportedEventTypes=[],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.showWait=function(){this.postMessageToHostPage({messageType:"show-wait"})},e.prototype.hideWait=function(){this.postMessageToHostPage({messageType:"hide-wait"})},e.prototype.addEventHandler=function(e,t){this.registeredAddinEvents[e]=t},e.prototype.sendEvent=function(e){var t=this;return new Promise((function(s,o){var n=e.type;t.supportedEventTypes.includes(n)||o("Event type not supported");var i=t.pendingSentEvents[n];i&&(clearTimeout(i.timeoutId),i.reject("Event cancelled"));var a=setTimeout((function(){delete t.pendingSentEvents[n],t.postMessageToHostPage({message:{event:e,eventRequestId:t.eventRequestId},messageType:"client-event"}),t.sentEvents[t.eventRequestId]=s,t.eventRequestId++}),200);t.pendingSentEvents[n]={reject:o,timeoutId:a}}))},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.supportedEventTypes=s.message.supportedEventTypes,this.args.callbacks.init({context:s.message.context,envId:s.message.envId,ready:function(e){t.checkForHeightChangesOfAddinContent(),t.postMessageToHostPage({message:e,messageType:"addin-ready"})},supportedEventTypes:s.message.supportedEventTypes});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"update-context":this.args.callbacks.updateContext&&this.args.callbacks.updateContext(s.message);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();break;case"host-event":this.processHostEvent(s.message);break;case"event-received":this.resolveClientEvent(s.message)}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.processHostEvent=function(e){var t=this,s=e.context,o=this.registeredAddinEvents[s.type];(o?this.isBlockingEventType(s.type)?new Promise((function(e){o(s.context,(function(){e()}))})):new Promise((function(e){o(s.context),e()})):Promise.resolve()).then((function(){return t.postEventReceivedMessage(e.eventRequestId)}))},e.prototype.isBlockingEventType=function(e){switch(e){case"form-save":case"form-cancel":return!0}return!1},e.prototype.postEventReceivedMessage=function(e){this.postMessageToHostPage({message:{eventRequestId:e},messageType:"event-received"})},e.prototype.resolveClientEvent=function(e){var t=e.eventRequestId,s=this.sentEvents[t];s&&(s(),delete this.sentEvents[t])},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){"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]+)?$/,/^https\:\/\/secure[2|3|8]\.convio\.net$/,/^https\:\/\/testweb\.convio\.com$/,/^https\:\/\/[\w\-\.]+\.conviocloud\.com$/,/^https\:\/\/[\w\-\.]+\.blackbaudcloud\.com$/],n=function(){function n(e){var t=this;this.args=e,this.authTokenRequests=[],this.lastAuthTokenRequestId=0,this.modalRequests=[],this.lastModalRequestId=0,this.registeredAddinEvents={},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.showWait=function(){this.postMessageToHostPage({messageType:"show-wait"})},n.prototype.hideWait=function(){this.postMessageToHostPage({messageType:"hide-wait"})},n.prototype.addEventHandler=function(e,t){this.registeredAddinEvents[e]=t},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"update-context":this.args.callbacks.updateContext&&this.args.callbacks.updateContext(s.message);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();break;case"host-event":this.processHostEvent(s.message)}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.processHostEvent=function(e){var t=this,s=e.context,o=this.registeredAddinEvents[s.type];(o?this.isBlockingEventType(s.type)?new Promise(function(e){o(s.context,function(){e()})}):new Promise(function(e){o(s.context),e()}):Promise.resolve()).then(function(){return t.postEventReceivedMessage(e.eventRequestId)})},n.prototype.isBlockingEventType=function(e){switch(e){case"form-save":case"form-cancel":return!0}return!1},n.prototype.postEventReceivedMessage=function(e){this.postMessageToHostPage({message:{eventRequestId:e},messageType:"event-received"})},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={}))}])});
!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]+)?$/,/^https\:\/\/secure[2|3|8]\.convio\.net$/,/^https\:\/\/testweb\.convio\.com$/,/^https\:\/\/[\w\-\.]+\.conviocloud\.com$/,/^https\:\/\/[\w\-\.]+\.blackbaudcloud\.com$/],n=function(){function n(e){var t=this;this.args=e,this.authTokenRequests=[],this.lastAuthTokenRequestId=0,this.modalRequests=[],this.lastModalRequestId=0,this.registeredAddinEvents={},this.sentEvents={},this.pendingSentEvents={},this.eventRequestId=0,this.supportedEventTypes=[],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.showWait=function(){this.postMessageToHostPage({messageType:"show-wait"})},n.prototype.hideWait=function(){this.postMessageToHostPage({messageType:"hide-wait"})},n.prototype.addEventHandler=function(e,t){this.registeredAddinEvents[e]=t},n.prototype.sendEvent=function(i){var a=this;return new Promise(function(e,t){var s=i.type;a.supportedEventTypes.includes(s)||t("Event type not supported");var o=a.pendingSentEvents[s];o&&(clearTimeout(o.timeoutId),o.reject("Event cancelled"));var n=setTimeout(function(){delete a.pendingSentEvents[s],a.postMessageToHostPage({message:{event:i,eventRequestId:a.eventRequestId},messageType:"client-event"}),a.sentEvents[a.eventRequestId]=e,a.eventRequestId++},200);a.pendingSentEvents[s]={reject:t,timeoutId:n}})},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.supportedEventTypes=s.message.supportedEventTypes,this.args.callbacks.init({context:s.message.context,envId:s.message.envId,ready:function(e){t.checkForHeightChangesOfAddinContent(),t.postMessageToHostPage({message:e,messageType:"addin-ready"})},supportedEventTypes:s.message.supportedEventTypes});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"update-context":this.args.callbacks.updateContext&&this.args.callbacks.updateContext(s.message);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();break;case"host-event":this.processHostEvent(s.message);break;case"event-received":this.resolveClientEvent(s.message)}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.processHostEvent=function(e){var t=this,s=e.context,o=this.registeredAddinEvents[s.type];(o?this.isBlockingEventType(s.type)?new Promise(function(e){o(s.context,function(){e()})}):new Promise(function(e){o(s.context),e()}):Promise.resolve()).then(function(){return t.postEventReceivedMessage(e.eventRequestId)})},n.prototype.isBlockingEventType=function(e){switch(e){case"form-save":case"form-cancel":return!0}return!1},n.prototype.postEventReceivedMessage=function(e){this.postMessageToHostPage({message:{eventRequestId:e},messageType:"event-received"})},n.prototype.resolveClientEvent=function(e){var t=e.eventRequestId,s=this.sentEvents[t];s&&(s(),delete this.sentEvents[t])},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={}))}])});

@@ -0,1 +1,4 @@

# 1.1.1 (2021-06-01)
- Add support for sending custom events to the add-in host page.
# 1.1.0 (2020-11-19)

@@ -2,0 +5,0 @@ - Deprecate help widget related functionality.

{
"name": "@blackbaud/sky-addin-client",
"version": "1.1.0",
"version": "1.1.1",
"description": "SKY add-in client",

@@ -5,0 +5,0 @@ "main": "dist/bundles/sky-addin-client.umd.js",

@@ -53,2 +53,3 @@ # sky-addin-client

- `context` - Additional context of the host page, which will vary for different extension points.
- `supportedEventTypes` - The supported event types that are handled by the host page.
- `ready` - A callback to inform the add-in client that the add-in is initialized and ready to be shown.

@@ -159,2 +160,55 @@

#### Entry form add-ins
For entry form add-ins, the URL for the add-in will be rendered in a visible iframe on the entry form, where you can render any custom content. The iframe will initially be hidden until an initialize protocol is completed between the host and the add-in.
The host page will handle rendering the container around the add-in iframe. When calling the `ready` callback, the `title` field will indicate the title for the vertical tab in the form. Initially, the vertical tab will be hidden, and will only show on the form if `showUI` is set to `true` in the callback. You can set it to `false` to indicate that the tab and add-in content should not be shown, based on the user's privileges or whether a user interface is appropriate for your use case.
Entry form add-ins support specific form events that may occur when user interaction causes form data to change, or when a form is saved or canceled. To handle form events, call the `addEventHandler` method on the `AddinClient` class, passing the event type and callback function to be invoked when the event occurs:
```js
var client = new AddinClient({
callbacks: {
init: (args) => {
args.ready({
showUI: true,
title: 'Custom entry form tab'
});
}
}
});
// To handle add-in events, call the addEventHandler method
client.addEventHandler({
eventType: 'form-data-update',
callback: function (context) {
// get updated data from context object
}
});
```
Entry forms may also support the `form-save` and `form-cancel` event types. These event types allow the add-in client to perform an asynchronous task (e.g. call a backend service) while the form is closing. The callback's `done()` function MUST be called to allow the form to close.
```js
var client = new AddinClient({
callbacks: {
init: (args) => {
args.ready({
showUI: true,
title: 'Custom entry form tab'
});
}
}
});
// To handle add-in events, call the addEventHandler method
client.addEventHandler({
eventType: 'form-save',
callback: function (context, done) {
// handle the save event, asynchronously
done(); // When done, call the done function (tells the entry form it's OK to close)
}
});
```
#### Showing a modal

@@ -327,2 +381,40 @@ Add-ins are capable of launching a "modal" user experience to show more details or gather additional input from the user. The modal will be rendered in a separate full-screen iframe to maximize the available real estate (meaning, it will not be scoped to the bounds of the add-in's iframe).

#### Sending custom events to the host page
**Blackbaud Internal Only**
An add-in can send a custom event to the host page, as long as the host supports the event type.
Before sending an event to the host page, you must register for `init` and check the `supportedEventTypes`
property to determine what event types the host page will handle.
```js
var supportedEventTypes;
var client = new AddinClient({
callbacks: {
init: (args) => {
supportedEventTypes = args.supportedEventTypes;
args.ready({
showUI: true
});
}
}
});
// Before sending event, check to make sure the event is supported by the host page
if (supportedEventTypes.includes('my-event-type')) {
// To send add-in events to the host, call the sendEvent method
client.sendEvent({
type: 'my-event-type',
context: { /* context object to pass to host page */ }
}).then(() => {
// host page received the event
}).catch((err) => {
// an error occurred while attempting to send the event
});
}
```
To determine the add-in extension points that support custom events,
please see https://developer.blackbaud.com/skyapi/docs/addins/concepts/extension-points.
## Authentication

@@ -329,0 +421,0 @@ SKY add-ins support a single-sign-on (SSO) mechanism that can be used to correlate the Blackbaud user with a user in the add-in's native system.

import { AddinClientArgs } from './client-interfaces/addin-client-args';
import { AddinClientCloseModalArgs } from './client-interfaces/addin-client-close-modal-args';
import { AddinClientEventArgs } from './client-interfaces/addin-client-event-args';
import { AddinClientNavigateArgs } from './client-interfaces/addin-client-navigate-args';

@@ -75,2 +76,25 @@ import { AddinClientOpenHelpArgs } from './client-interfaces/addin-client-open-help-args';

/**
* Stores the add-in events that have been sent to the host page.
* Key - the event request ID.
* Value - The Promise resolve function to be executed when the event is received by the host.
*/
private sentEvents;
/**
* Stores the pending add-in events that are queued to be sent to the host page after 200
* milliseconds have expired.
* Key - the event type.
* Value - The Promise reject function to be executed if the event fails to be sent to the host page.
*/
private pendingSentEvents;
/**
* The event request ID counter.
* The ID is incremented and assigned to each event that is sent.
*/
private eventRequestId;
/**
* An array of event types that are supported by the host page.
* The add-in client will throw an error if an event is attempted but not one the supported types.
*/
private supportedEventTypes;
/**
* @returns {string} Returns the current query string path for the window, prefixed with ?.

@@ -160,2 +184,11 @@ */

/**
* Sends an event to be handled by the host page.
* Supported for Blackbaud internal only
* @returns {Promise<void>} Returns a Promise which will resolve when the add-in host page receives the message, or
* rejects if a subsequent event occurs, for the same event type, within 200 milliseconds.
* The Promise also rejects if an event type is not one of the supported types from the host page.
* @see AddinClientInitArgs#supportedEventTypes
*/
sendEvent(args: AddinClientEventArgs): Promise<void>;
/**
* Post a message to the host page informing it that the add-in is

@@ -222,4 +255,13 @@ * now started and listening for messages from the host.

private isBlockingEventType;
/**
* Posts a message to the host page to indicate that a certain event has been received.
* @param eventRequestId The ID of the event request that was received.
*/
private postEventReceivedMessage;
/**
* Attemps to resolve the Promise for a client event that has been received by the host page.
* @param message Message data that includes the ID of the event that was received.
*/
private resolveClientEvent;
/**
* Checks whether a MessageEvent is from the execetd host origin.

@@ -226,0 +268,0 @@ * @param event

@@ -47,2 +47,25 @@ "use strict";

this.registeredAddinEvents = {};
/**
* Stores the add-in events that have been sent to the host page.
* Key - the event request ID.
* Value - The Promise resolve function to be executed when the event is received by the host.
*/
this.sentEvents = {};
/**
* Stores the pending add-in events that are queued to be sent to the host page after 200
* milliseconds have expired.
* Key - the event type.
* Value - The Promise reject function to be executed if the event fails to be sent to the host page.
*/
this.pendingSentEvents = {};
/**
* The event request ID counter.
* The ID is incremented and assigned to each event that is sent.
*/
this.eventRequestId = 0;
/**
* An array of event types that are supported by the host page.
* The add-in client will throw an error if an event is attempted but not one the supported types.
*/
this.supportedEventTypes = [];
this.windowMessageHandler = function (event) {

@@ -257,2 +280,41 @@ _this.handleMessage(event);

/**
* Sends an event to be handled by the host page.
* Supported for Blackbaud internal only
* @returns {Promise<void>} Returns a Promise which will resolve when the add-in host page receives the message, or
* rejects if a subsequent event occurs, for the same event type, within 200 milliseconds.
* The Promise also rejects if an event type is not one of the supported types from the host page.
* @see AddinClientInitArgs#supportedEventTypes
*/
AddinClient.prototype.sendEvent = function (args) {
var _this = this;
return new Promise(function (resolve, reject) {
var eventType = args.type;
if (!_this.supportedEventTypes.includes(eventType)) {
reject('Event type not supported');
}
var pendingEvent = _this.pendingSentEvents[eventType];
if (pendingEvent) {
// cancel and reject pending event
clearTimeout(pendingEvent.timeoutId);
pendingEvent.reject('Event cancelled');
}
var timeoutId = setTimeout(function () {
delete _this.pendingSentEvents[eventType];
_this.postMessageToHostPage({
message: {
event: args,
eventRequestId: _this.eventRequestId
},
messageType: 'client-event'
});
_this.sentEvents[_this.eventRequestId] = resolve;
_this.eventRequestId++;
}, 200);
_this.pendingSentEvents[eventType] = {
reject: reject,
timeoutId: timeoutId
};
});
};
/**
* Post a message to the host page informing it that the add-in is

@@ -321,2 +383,4 @@ * now started and listening for messages from the host.

this.trackHeightChangesOfAddinContent();
// set the supported event types
this.supportedEventTypes = data.message.supportedEventTypes;
// Pass key data to the add-in for it to initiailze.

@@ -334,3 +398,4 @@ this.args.callbacks.init({

});
}
},
supportedEventTypes: data.message.supportedEventTypes
});

@@ -394,2 +459,5 @@ }

break;
case 'event-received':
this.resolveClientEvent(data.message);
break;
}

@@ -508,2 +576,6 @@ }

};
/**
* Posts a message to the host page to indicate that a certain event has been received.
* @param eventRequestId The ID of the event request that was received.
*/
AddinClient.prototype.postEventReceivedMessage = function (eventRequestId) {

@@ -518,2 +590,14 @@ this.postMessageToHostPage({

/**
* Attemps to resolve the Promise for a client event that has been received by the host page.
* @param message Message data that includes the ID of the event that was received.
*/
AddinClient.prototype.resolveClientEvent = function (message) {
var requestId = message.eventRequestId;
var promiseResolve = this.sentEvents[requestId];
if (promiseResolve) {
promiseResolve();
delete this.sentEvents[requestId];
}
};
/**
* Checks whether a MessageEvent is from the execetd host origin.

@@ -520,0 +604,0 @@ * @param event

@@ -15,2 +15,6 @@ import { AddinClientReadyArgs } from './addin-client-ready-args';

/**
* Event types that are supported by the host page.
*/
supportedEventTypes?: string[];
/**
* Call to inform the add-in client that the add-in is initialized and ready to be shown.

@@ -17,0 +21,0 @@ * @param args Arguments describing how the add-in should render.

@@ -35,2 +35,6 @@ /**

reason?: string;
/**
* Event types that are supported by the host page.
*/
supportedEventTypes?: string[];
}

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