@blackbaud/sky-addin-client
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -213,3 +213,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
* Requests the host page to launch a modal add-in. | ||
* @param args Arguments for launcing the modal. | ||
* @param args Arguments for launching the modal. | ||
* @returns {Promise<any>} Returns a promise that will be resolved when the modal add-in is closed. | ||
@@ -260,2 +260,6 @@ * Promise will resolve with context data passed by from the modal add-in's closeModal call. | ||
}; | ||
/** | ||
* Informs the host to show a toast message. | ||
* @param args Arguments for showing a toast. | ||
*/ | ||
AddinClient.prototype.showToast = function (args) { | ||
@@ -268,2 +272,17 @@ this.postMessageToHostPage({ | ||
/** | ||
* Requests the host page to launch a flyout add-in. | ||
* @param args Arguments for launching the flyout. | ||
*/ | ||
AddinClient.prototype.showFlyout = function (args) { | ||
// 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.postMessageToHostPage({ | ||
message: args, | ||
messageType: 'show-flyout' | ||
}); | ||
}; | ||
/** | ||
* Post a message to the host page informing it that the add-in is | ||
@@ -362,2 +381,12 @@ * now started and listening for messages from the host. | ||
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': | ||
@@ -364,0 +393,0 @@ if (this.args.callbacks.helpClick) { |
@@ -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(n){if(t[n]){return t[n].exports}var o=t[n]={i:n,l:false,exports:{}};e[n].call(o.exports,o,o.exports,s);o.l=true;return o.exports}s.m=e;s.c=t;s.i=function(e){return e};s.d=function(e,t,n){if(!s.o(e,t)){Object.defineProperty(e,t,{configurable:false,enumerable:true,get:n})}};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 n(e){for(var s in e)if(!t.hasOwnProperty(s))t[s]=e[s]}Object.defineProperty(t,"__esModule",{value:true});n(s(2));n(s(7))},function(e,t,s){"use strict";function n(e){for(var s in e)if(!t.hasOwnProperty(s))t[s]=e[s]}Object.defineProperty(t,"__esModule",{value:true});n(s(0))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:true});var n=[/^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 o=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 n=++e.lastAuthTokenRequestId;e.authTokenRequests[n]={reject:s,resolve:t};e.postMessageToHostPage({message:{authTokenRequestId:n},messageType:"get-auth-token"})})};e.prototype.showModal=function(e){var t=this;return{modalClosed:new Promise(function(s,n){var o=++t.lastModalRequestId;t.modalRequests[o]={reject:n,resolve:s};t.postMessageToHostPage({message:{args:e,modalRequestId:o},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.raiseAddinReadyMessage=function(){this.postMessageToHostPage({messageType:"ready"},"*")};e.prototype.handleModalClosedMessage=function(e){var t=this.modalRequests;var s=e.modalRequestId;var n=t[s];n.resolve(e.context);t[s]=undefined};e.prototype.handleAuthTokenMessage=function(e){var t=this.authTokenRequests;var s=e.message.authTokenRequestId;var n=t[s];switch(e.messageType){case"auth-token":var o=e.message.authToken;n.resolve(o);break;case"auth-token-fail":n.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"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=n;t<s.length;t++){var o=s[t];if(o.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 n=s.split("&");for(var o=0,a=n;o<a.length;o++){var i=a[o];var r=i.split("=");if(decodeURIComponent(r[0])===t){return decodeURIComponent(r[1])}}};return e}();t.AddinClient=o},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:true});var n;(function(e){e[e["None"]=0]="None";e[e["Add"]=1]="Add";e[e["Edit"]=2]="Edit";e[e["Delete"]=3]="Delete"})(n=t.AddinButtonStyle||(t.AddinButtonStyle={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:true});var n;(function(e){e[e["None"]=0]="None";e[e["Text"]=1]="Text"})(n=t.AddinTabSummaryStyle||(t.AddinTabSummaryStyle={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:true});var n;(function(e){e[e["None"]=0]="None";e[e["Text"]=1]="Text";e[e["Check"]=2]="Check"})(n=t.AddinTileSummaryStyle||(t.AddinTileSummaryStyle={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:true});var n;(function(e){e[e["Danger"]=0]="Danger";e[e["Info"]=1]="Info";e[e["Success"]=2]="Success";e[e["Warning"]=3]="Warning"})(n=t.AddinToastStyle||(t.AddinToastStyle={}))},function(e,t,s){"use strict";function n(e){for(var s in e)if(!t.hasOwnProperty(s))t[s]=e[s]}Object.defineProperty(t,"__esModule",{value:true});n(s(3));n(s(4));n(s(5));n(s(6))}])}); | ||
(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(n){if(t[n]){return t[n].exports}var o=t[n]={i:n,l:false,exports:{}};e[n].call(o.exports,o,o.exports,s);o.l=true;return o.exports}s.m=e;s.c=t;s.i=function(e){return e};s.d=function(e,t,n){if(!s.o(e,t)){Object.defineProperty(e,t,{configurable:false,enumerable:true,get:n})}};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 n(e){for(var s in e)if(!t.hasOwnProperty(s))t[s]=e[s]}Object.defineProperty(t,"__esModule",{value:true});n(s(2));n(s(7))},function(e,t,s){"use strict";function n(e){for(var s in e)if(!t.hasOwnProperty(s))t[s]=e[s]}Object.defineProperty(t,"__esModule",{value:true});n(s(0))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:true});var n=[/^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 o=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 n=++e.lastAuthTokenRequestId;e.authTokenRequests[n]={reject:s,resolve:t};e.postMessageToHostPage({message:{authTokenRequestId:n},messageType:"get-auth-token"})})};e.prototype.showModal=function(e){var t=this;return{modalClosed:new Promise(function(s,n){var o=++t.lastModalRequestId;t.modalRequests[o]={reject:n,resolve:s};t.postMessageToHostPage({message:{args:e,modalRequestId:o},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){e.defaultWidth=e.defaultWidth||500;e.maxWidth=e.maxWidth||e.defaultWidth;e.minWidth=e.minWidth||320;this.postMessageToHostPage({message:e,messageType:"show-flyout"})};e.prototype.raiseAddinReadyMessage=function(){this.postMessageToHostPage({messageType:"ready"},"*")};e.prototype.handleModalClosedMessage=function(e){var t=this.modalRequests;var s=e.modalRequestId;var n=t[s];n.resolve(e.context);t[s]=undefined};e.prototype.handleAuthTokenMessage=function(e){var t=this.authTokenRequests;var s=e.message.authTokenRequestId;var n=t[s];switch(e.messageType){case"auth-token":var o=e.message.authToken;n.resolve(o);break;case"auth-token-fail":n.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"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=n;t<s.length;t++){var o=s[t];if(o.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 n=s.split("&");for(var o=0,a=n;o<a.length;o++){var i=a[o];var r=i.split("=");if(decodeURIComponent(r[0])===t){return decodeURIComponent(r[1])}}};return e}();t.AddinClient=o},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:true});var n;(function(e){e[e["None"]=0]="None";e[e["Add"]=1]="Add";e[e["Edit"]=2]="Edit";e[e["Delete"]=3]="Delete"})(n=t.AddinButtonStyle||(t.AddinButtonStyle={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:true});var n;(function(e){e[e["None"]=0]="None";e[e["Text"]=1]="Text"})(n=t.AddinTabSummaryStyle||(t.AddinTabSummaryStyle={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:true});var n;(function(e){e[e["None"]=0]="None";e[e["Text"]=1]="Text";e[e["Check"]=2]="Check"})(n=t.AddinTileSummaryStyle||(t.AddinTileSummaryStyle={}))},function(e,t,s){"use strict";Object.defineProperty(t,"__esModule",{value:true});var n;(function(e){e[e["Danger"]=0]="Danger";e[e["Info"]=1]="Info";e[e["Success"]=2]="Success";e[e["Warning"]=3]="Warning"})(n=t.AddinToastStyle||(t.AddinToastStyle={}))},function(e,t,s){"use strict";function n(e){for(var s in e)if(!t.hasOwnProperty(s))t[s]=e[s]}Object.defineProperty(t,"__esModule",{value:true});n(s(3));n(s(4));n(s(5));n(s(6))}])}); |
@@ -0,4 +1,8 @@ | ||
# 1.0.10 (2019-04-16) | ||
- Added a `showFlyout` method to allow developers to display supplementary information in a flyout panel. | ||
# 1.0.9 (2019-03-01) | ||
- Added a `showToast` callback to allow developers to show a toast with a provided message and toast style. | ||
- Added a `showToast` method to allow developers to show a toast with a provided message and toast style. | ||
@@ -14,3 +18,3 @@ # 1.0.8 (2019-02-13) | ||
- Added `helpClick` and `settingsClick` callbacks to allow developers to take action when the tile help and settings | ||
- Added `helpClick` and `settingsClick` callbacks to allow developers to take action when the tile help and settings | ||
icons (respectfully) are clicked. | ||
@@ -22,4 +26,4 @@ | ||
- Added button config options to support Button Add-ins. This allows developers to provide `style` metadata - | ||
essentially, the button's intent as it relates to CRUD operations (add, edit, delete). We will add more "styles" as | ||
- Added button config options to support Button Add-ins. This allows developers to provide `style` metadata - | ||
essentially, the button's intent as it relates to CRUD operations (add, edit, delete). We will add more "styles" as | ||
requested. | ||
@@ -26,0 +30,0 @@ |
@@ -1,1 +0,1 @@ | ||
{"name":"@blackbaud/sky-addin-client","version":"1.0.9","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.1.0","jasmine":"2.6.0","jasmine-ajax":"3.3.1","karma":"1.7.0","karma-browserstack-launcher":"1.2.0","karma-chrome-launcher":"2.1.1","karma-coverage":"1.1.1","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":"2.0.3","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.10","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"}} |
@@ -227,2 +227,21 @@ # sky-addin-client | ||
#### Showing a flyout | ||
Add-ins are capable of launching a "flyout" user experience to display additional information. | ||
To launch a flyout, call the `showFlyout` function on the client, passing the URL for the flyout and any context data needed by the flyout: | ||
```js | ||
// Parent add-in launching a flyout | ||
var client = new AddinClient({...}); | ||
client.showFlyout({ | ||
url: '<flyout-addin-url>', | ||
context: { /* arbitrary context object to pass to flyout */ } | ||
}); | ||
``` | ||
##### Flyout add-in | ||
The host page will launch an iframe for the URL provided, and load it as an add-in the same way it does for other types of add-ins. The flyout page must also pull in the SKY Add-in Client Library and make use of the `AddinClient`. | ||
As with a typical add-in, the flyout add-in should register for the `init` callback and will receive `envId` in the arguments. The `context` field for arguments will match the context object passed into the `showFlyout` call from the parent add-in. Note that this is crossing iframes so the object has been serialized and deserialized. It can be used for passing data but not functions. | ||
## Authentication | ||
@@ -229,0 +248,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. |
@@ -5,2 +5,3 @@ import { AddinClientArgs } from './client-interfaces/addin-client-args'; | ||
import { AddinClientOpenHelpArgs } from './client-interfaces/addin-client-open-help-args'; | ||
import { AddinClientShowFlyoutArgs } from './client-interfaces/addin-client-show-flyout-args'; | ||
import { AddinClientShowModalArgs } from './client-interfaces/addin-client-show-modal-args'; | ||
@@ -73,3 +74,3 @@ import { AddinClientShowModalResult } from './client-interfaces/addin-client-show-modal-result'; | ||
* Requests the host page to launch a modal add-in. | ||
* @param args Arguments for launcing the modal. | ||
* @param args Arguments for launching the modal. | ||
* @returns {Promise<any>} Returns a promise that will be resolved when the modal add-in is closed. | ||
@@ -90,4 +91,13 @@ * Promise will resolve with context data passed by from the modal add-in's closeModal call. | ||
openHelp(args: AddinClientOpenHelpArgs): void; | ||
/** | ||
* Informs the host to show a toast message. | ||
* @param args Arguments for showing a toast. | ||
*/ | ||
showToast(args: AddinClientShowToastArgs): void; | ||
/** | ||
* Requests the host page to launch a flyout add-in. | ||
* @param args Arguments for launching the flyout. | ||
*/ | ||
showFlyout(args: AddinClientShowFlyoutArgs): void; | ||
/** | ||
* Post a message to the host page informing it that the add-in is | ||
@@ -94,0 +104,0 @@ * now started and listening for messages from the host. |
@@ -103,3 +103,3 @@ "use strict"; | ||
* Requests the host page to launch a modal add-in. | ||
* @param args Arguments for launcing the modal. | ||
* @param args Arguments for launching the modal. | ||
* @returns {Promise<any>} Returns a promise that will be resolved when the modal add-in is closed. | ||
@@ -150,2 +150,6 @@ * Promise will resolve with context data passed by from the modal add-in's closeModal call. | ||
}; | ||
/** | ||
* Informs the host to show a toast message. | ||
* @param args Arguments for showing a toast. | ||
*/ | ||
AddinClient.prototype.showToast = function (args) { | ||
@@ -158,2 +162,17 @@ this.postMessageToHostPage({ | ||
/** | ||
* Requests the host page to launch a flyout add-in. | ||
* @param args Arguments for launching the flyout. | ||
*/ | ||
AddinClient.prototype.showFlyout = function (args) { | ||
// 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.postMessageToHostPage({ | ||
message: args, | ||
messageType: 'show-flyout' | ||
}); | ||
}; | ||
/** | ||
* Post a message to the host page informing it that the add-in is | ||
@@ -252,2 +271,12 @@ * now started and listening for messages from the host. | ||
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': | ||
@@ -254,0 +283,0 @@ if (this.args.callbacks.helpClick) { |
@@ -15,2 +15,10 @@ import { AddinClientInitArgs } from './addin-client-init-args'; | ||
/** | ||
* Callback raised for flyout add-ins indicating that the next button was clicked. | ||
*/ | ||
flyoutNextClick?: () => void; | ||
/** | ||
* Callback raised for flyout add-ins indicating that the previous button was clicked. | ||
*/ | ||
flyoutPreviousClick?: () => void; | ||
/** | ||
* Callback raised for tile add-ins indicating that the help button was clicked. | ||
@@ -17,0 +25,0 @@ */ |
@@ -6,2 +6,3 @@ export * from './addin-button-config'; | ||
export * from './addin-client-close-modal-args'; | ||
export * from './addin-client-flyout-permalink'; | ||
export * from './addin-client-init-args'; | ||
@@ -12,2 +13,3 @@ export * from './addin-client-navigate-args'; | ||
export * from './addin-client-ready-button-config'; | ||
export * from './addin-client-show-flyout-args'; | ||
export * from './addin-client-show-modal-args'; | ||
@@ -14,0 +16,0 @@ export * from './addin-client-show-modal-result'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
101729
83
1595
300