@blackbaud/sky-addin-client
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -373,9 +373,4 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
AddinClient.prototype.checkForHeightChangesOfAddinContent = function () { | ||
var newHeight = document.body.offsetHeight; | ||
if (window.getComputedStyle) { | ||
var style = window.getComputedStyle(document.body); | ||
if (style) { | ||
newHeight += parseInt(style.marginTop, 10) + parseInt(style.marginBottom, 10); | ||
} | ||
} | ||
// after some discussion and experimentation, using offsetHeight appears to be sufficient | ||
var newHeight = document.documentElement.offsetHeight; | ||
if (newHeight !== this.lastPostedIframeHeight) { | ||
@@ -382,0 +377,0 @@ this.lastPostedIframeHeight = newHeight; |
@@ -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))},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(){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.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}}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.body.offsetHeight;if(window.getComputedStyle){var t=window.getComputedStyle(document.body);if(t){e+=parseInt(t.marginTop,10)+parseInt(t.marginBottom,10)}}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,a=o;n<a.length;n++){var i=a[n];var r=i.split("=");if(decodeURIComponent(r[0])===t){return decodeURIComponent(r[1])}}};return e}();t.AddinClient=n}])}); | ||
(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))},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(){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.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}}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}])}); |
@@ -0,1 +1,5 @@ | ||
# 1.0.3 (2018-09-28) | ||
- Bugfix when calculating height of addin. | ||
# 1.0.2 (2018-08-13) | ||
@@ -2,0 +6,0 @@ |
@@ -1,1 +0,1 @@ | ||
{"name":"@blackbaud/sky-addin-client","version":"1.0.2","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.3","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"}} |
@@ -181,3 +181,3 @@ # sky-addin-client | ||
Developers building add-ins in .NET can make use of a Blackbaud-provided library to assist with validating the user identity token. This library is distributed as a NuGet package named `Blackbaud.Addin.TokenAuthentication`. The package wraps up the logic for validating the user identity token JWT, and can be found at https://www.nuget.org/packages/Blackbaud.Addin.tokenAuthentication. | ||
Developers building add-ins in .NET can make use of a Blackbaud-provided library to assist with validating the user identity token. This library is distributed as a NuGet package named `Blackbaud.Addin.TokenAuthentication`. The package wraps up the logic for validating the user identity token JWT, and can be found at https://www.nuget.org/packages/Blackbaud.Addin.TokenAuthentication. | ||
@@ -209,1 +209,3 @@ The following C# code snippet shows how to use the `Blackbaud.Addin.TokenAuthentication` library to validate the raw JWT token value passed in from the add-in client: | ||
Once the token has been validated, the add-in's backend will know the Blackbaud user ID and can determine if a user mapping exists for a user in the add-in's system. If a mapping exists, then the add-in's backend can immediately present the content for the add-in. If no user mapping exists, the add-in can prompt the user to login. | ||
For more information on Blackbaud's SKY Add-in framework, please see https://developer.blackbaud.com/skyapi/docs/addins. |
@@ -264,9 +264,4 @@ "use strict"; | ||
AddinClient.prototype.checkForHeightChangesOfAddinContent = function () { | ||
var newHeight = document.body.offsetHeight; | ||
if (window.getComputedStyle) { | ||
var style = window.getComputedStyle(document.body); | ||
if (style) { | ||
newHeight += parseInt(style.marginTop, 10) + parseInt(style.marginBottom, 10); | ||
} | ||
} | ||
// after some discussion and experimentation, using offsetHeight appears to be sufficient | ||
var newHeight = document.documentElement.offsetHeight; | ||
if (newHeight !== this.lastPostedIframeHeight) { | ||
@@ -273,0 +268,0 @@ this.lastPostedIframeHeight = newHeight; |
Sorry, the diff of this file is not supported yet
210
73101
1134