diff --git a/CHANGELOG.md b/CHANGELOG.md index e3db70f..713c1cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## [0.0.23] + +### Added +- `setLoadingStatus` method to set loading status, param string + ## [0.0.22] ### Added diff --git a/README.md b/README.md index 644b002..76776fa 100644 --- a/README.md +++ b/README.md @@ -269,6 +269,9 @@ addon.saveData({ preferredCurrencies: ['CAD', 'USD', 'GBP', 'MXN'] }).then(funct }); ``` +#### addon.setLoadingStatus(status) +This method sets the loading status, sets the status string - shows the loader, sets an empty string - hides the loader. + #### addon.printPage() This method triggers `window.print()` from dashboard itself. diff --git a/dist/addon-container.es5.js b/dist/addon-container.es5.js index fa8c6cb..2f0b1eb 100644 --- a/dist/addon-container.es5.js +++ b/dist/addon-container.es5.js @@ -73,7 +73,7 @@ var AddonContainer = function (_EventEmitter) { } }); - ['saveData', 'request', 'addTransaction', 'editTransaction', 'addInstitution', 'addInvestment', 'editInstitution', 'editAsset', 'editLiability', 'deleteInstitution', 'deleteAsset', 'deleteLiability', 'downloadDocument', 'upgradePremium', 'getSharings', 'switchUser', 'printPage'].forEach(function (event) { + ['saveData', 'request', 'addTransaction', 'editTransaction', 'addInstitution', 'addInvestment', 'editInstitution', 'editAsset', 'editLiability', 'deleteInstitution', 'deleteAsset', 'deleteLiability', 'downloadDocument', 'upgradePremium', 'getSharings', 'switchUser', 'printPage', 'setLoadingStatus'].forEach(function (event) { _this.channel.bind(event, function (tx, data) { var eventName = event; var eventData = data; diff --git a/dist/addon-container.es5.min.js b/dist/addon-container.es5.min.js index 00b3027..018ca00 100644 --- a/dist/addon-container.es5.min.js +++ b/dist/addon-container.es5.min.js @@ -1,4 +1,4 @@ -var AddonContainer;!function(){var e={669:function(e,t,n){"use strict";var o=u(n(218)),i=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};l(this,t);var n=f(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));if(n.options=e,!e.iframe)throw new Error("Iframe not defined");return(0,c.iframeResizer)({checkOrigin:!0,heightCalculationMethod:window.ieVersion<=10?"max":"lowestElement",resizeFrom:"child",resizedCallback:function(e){n.emit("iframeResized",e)}},e.iframe),n.channel=r.default.build({window:e.iframe.contentWindow,origin:e.origin||"*",scope:e.id||e.iframe.contentWindow.location.origin,postMessageObserver:function(e,t){n.emit("postMessage",e,t)},gotMessageObserver:function(e,t){n.emit("gotMessage",e,t)}}),["saveData","request","addTransaction","editTransaction","addInstitution","addInvestment","editInstitution","editAsset","editLiability","deleteInstitution","deleteAsset","deleteLiability","downloadDocument","upgradePremium","getSharings","switchUser","printPage"].forEach((function(e){n.channel.bind(e,(function(t,o){var i=e,r=o;t.delayReturn(!0);var a=function(e,n){return e?t.error(e):t.complete(n)};n.emit(i,r||a,r?a:void 0)}))})),n.channel.call({method:"init",params:e.options,success:function(e){n.emit("init",e)}}),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"trigger",value:function(e,t){var n=this,o={eventName:e};return t&&(o.eventData=t),new s.Promise((function(e,t){n.channel.call({method:"_event",params:o,success:e,error:t})}))}},{key:"update",value:function(e){var t=this;return new s.Promise((function(n,i){if(!(0,o.default)(e))throw new Error("Data must be an object");t.channel.call({method:"update",params:e,success:n,error:i})}))}},{key:"reload",value:function(){var e=this;return new s.Promise((function(t,n){e.channel.call({method:"reload",success:t,error:n})}))}},{key:"destroy",value:function(){this.channel.destroy()}}]),t}(a.default);e.exports=d},702:function(e,t,n){ +var AddonContainer;!function(){var e={669:function(e,t,n){"use strict";var o=u(n(218)),i=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};l(this,t);var n=f(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));if(n.options=e,!e.iframe)throw new Error("Iframe not defined");return(0,c.iframeResizer)({checkOrigin:!0,heightCalculationMethod:window.ieVersion<=10?"max":"lowestElement",resizeFrom:"child",resizedCallback:function(e){n.emit("iframeResized",e)}},e.iframe),n.channel=r.default.build({window:e.iframe.contentWindow,origin:e.origin||"*",scope:e.id||e.iframe.contentWindow.location.origin,postMessageObserver:function(e,t){n.emit("postMessage",e,t)},gotMessageObserver:function(e,t){n.emit("gotMessage",e,t)}}),["saveData","request","addTransaction","editTransaction","addInstitution","addInvestment","editInstitution","editAsset","editLiability","deleteInstitution","deleteAsset","deleteLiability","downloadDocument","upgradePremium","getSharings","switchUser","printPage","setLoadingStatus"].forEach((function(e){n.channel.bind(e,(function(t,o){var i=e,r=o;t.delayReturn(!0);var a=function(e,n){return e?t.error(e):t.complete(n)};n.emit(i,r||a,r?a:void 0)}))})),n.channel.call({method:"init",params:e.options,success:function(e){n.emit("init",e)}}),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),i(t,[{key:"trigger",value:function(e,t){var n=this,o={eventName:e};return t&&(o.eventData=t),new s.Promise((function(e,t){n.channel.call({method:"_event",params:o,success:e,error:t})}))}},{key:"update",value:function(e){var t=this;return new s.Promise((function(n,i){if(!(0,o.default)(e))throw new Error("Data must be an object");t.channel.call({method:"update",params:e,success:n,error:i})}))}},{key:"reload",value:function(){var e=this;return new s.Promise((function(t,n){e.channel.call({method:"reload",success:t,error:n})}))}},{key:"destroy",value:function(){this.channel.destroy()}}]),t}(a.default);e.exports=d},702:function(e,t,n){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) @@ -6,5 +6,5 @@ var AddonContainer;!function(){var e={669:function(e,t,n){"use strict";var o=u(n * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE * @version v4.2.8+1e68dce6 */ -e.exports=function(){"use strict";function e(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)}function t(e){return"function"==typeof e}var o=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},i=0,r=void 0,a=void 0,s=function(e,t){b[i]=e,b[i+1]=t,2===(i+=2)&&(a?a(k):_())};function c(e){a=e}function u(e){s=e}var l="undefined"!=typeof window?window:void 0,f=l||{},d=f.MutationObserver||f.WebKitMutationObserver,m="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),h="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){return function(){return process.nextTick(k)}}function g(){return void 0!==r?function(){r(k)}:y()}function v(){var e=0,t=new d(k),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}function w(){var e=new MessageChannel;return e.port1.onmessage=k,function(){return e.port2.postMessage(0)}}function y(){var e=setTimeout;return function(){return e(k,1)}}var b=new Array(1e3);function k(){for(var e=0;eW?(a&&(clearTimeout(a),a=null),s=e,r=n.apply(o,i),a||(o=i=null)):a||(a=setTimeout(c,t)),r});$(window,"message",Te),"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}function $(e,t,n){"addEventListener"in window?e.addEventListener(t,n,!1):"attachEvent"in window&&e.attachEvent("on"+t,n)}function ee(e,t,n){"removeEventListener"in window?e.removeEventListener(t,n,!1):"detachEvent"in window&&e.detachEvent("on"+t,n)}function te(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ne(e){return S+"["+C+"] "+e}function oe(e){x&&"object"==typeof window.console&&console.log(ne(e))}function ie(e){"object"==typeof window.console&&console.warn(ne(e))}function re(){var e;!function(){function e(e){return"true"===e}var n=_.substr(I).split(":");C=n[0],f=t!==n[1]?Number(n[1]):f,p=t!==n[2]?e(n[2]):p,x=t!==n[3]?e(n[3]):x,T=t!==n[4]?Number(n[4]):T,u=t!==n[6]?e(n[6]):u,d=n[7],k=t!==n[8]?n[8]:k,l=n[9],h=n[10],P=t!==n[11]?Number(n[11]):P,E.enable=t!==n[12]&&e(n[12]),N=t!==n[13]?n[13]:N,D=t!==n[14]?n[14]:D}(),oe("Initialising iFrame ("+location.href+")"),function(){function e(){var e=window.iFrameResizer;oe("Reading data from page: "+JSON.stringify(e)),J="messageCallback"in e?e.messageCallback:J,V="readyCallback"in e?e.readyCallback:V,R="targetOrigin"in e?e.targetOrigin:R,k="heightCalculationMethod"in e?e.heightCalculationMethod:k,D="widthCalculationMethod"in e?e.widthCalculationMethod:D}function t(e,t){return"function"==typeof e&&(oe("Setup custom "+t+"CalcMethod"),Y[t]=e,e="custom"),e}"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),k=t(k,"height"),D=t(D,"width"));oe("TargetOrigin for parent set to: "+R)}(),function(){t===d&&(d=f+"px");ae("margin",function(e,t){-1!==t.indexOf("-")&&(ie("Negative CSS value ignored for "+e),t="");return t}("margin",d))}(),ae("background",l),ae("padding",h),(e=document.createElement("div")).style.clear="both",e.style.display="block",document.body.appendChild(e),le(),fe(),document.documentElement.style.height="",document.body.style.height="",oe('HTML & body height set to "auto"'),oe("Enable public methods"),B.parentIFrame={autoResize:function(e){return!0===e&&!1===u?(u=!0,de()):!1===e&&!0===u&&(u=!1,me()),u},close:function(){Ee(0,0,"close"),oe("Disable outgoing messages"),z=!1,oe("Remove event listener: Message"),ee(window,"message",Te),!0===u&&me()},getId:function(){return C},getPageInfo:function(e){"function"==typeof e?(U=e,Ee(0,0,"pageInfo")):(U=function(){},Ee(0,0,"pageInfoStop"))},moveToAnchor:function(e){E.findTarget(e)},reset:function(){_e("parentIFrame.reset")},scrollTo:function(e,t){Ee(t,e,"scrollTo")},scrollToOffset:function(e,t){Ee(t,e,"scrollToOffset")},sendMessage:function(e,t){Ee(0,0,"message",JSON.stringify(e),t)},setHeightCalculationMethod:function(e){k=e,le()},setWidthCalculationMethod:function(e){D=e,fe()},setTargetOrigin:function(e){oe("Set targetOrigin: "+e),R=e},size:function(e,t){be("size","parentIFrame.size("+(e||"")+(t?","+t:"")+")",e,t)}},de(),E=function(){function e(){return{x:window.pageXOffset!==t?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==t?window.pageYOffset:document.documentElement.scrollTop}}function n(t){var n=t.getBoundingClientRect(),o=e();return{x:parseInt(n.left,10)+parseInt(o.x,10),y:parseInt(n.top,10)+parseInt(o.y,10)}}function o(e){function o(e){var t=n(e);oe("Moving to in page link (#"+i+") at x: "+t.x+" y: "+t.y),Ee(t.y,t.x,"scrollToOffset")}var i=e.split("#")[1]||e,r=decodeURIComponent(i),a=document.getElementById(r)||document.getElementsByName(r)[0];t!==a?o(a):(oe("In page link (#"+i+") not found in iFrame, so sending to parent"),Ee(0,0,"inPageLink","#"+i))}function i(){""!==location.hash&&"#"!==location.hash&&o(location.href)}function r(){function e(e){function t(e){e.preventDefault(),o(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&$(e,"click",t)}Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),e)}function a(){$(window,"hashchange",i)}function s(){setTimeout(i,v)}function c(){Array.prototype.forEach&&document.querySelectorAll?(oe("Setting up location.hash handlers"),r(),a(),s()):ie("In page linking not fully supported in this browser! (See README.md for IE8 workaround)")}E.enable?c():oe("In page linking not enabled");return{findTarget:o}}(),be("init","Init message from host page"),V()}function ae(e,n){t!==n&&""!==n&&"null"!==n&&(document.body.style[e]=n,oe("Body "+e+' set to "'+n+'"'))}function se(e){var t={add:function(t){function n(){be(e.eventName,e.eventType)}X[t]=n,$(window,t,n)},remove:function(e){var t=X[e];delete X[e],ee(window,e,t)}};e.eventNames&&Array.prototype.map?(e.eventName=e.eventNames[0],e.eventNames.map(t[e.method])):t[e.method](e.eventName),oe(te(e.method)+" event listener: "+e.eventType)}function ce(e){se({method:e,eventType:"Animation Start",eventNames:["animationstart","webkitAnimationStart"]}),se({method:e,eventType:"Animation Iteration",eventNames:["animationiteration","webkitAnimationIteration"]}),se({method:e,eventType:"Animation End",eventNames:["animationend","webkitAnimationEnd"]}),se({method:e,eventType:"Input",eventName:"input"}),se({method:e,eventType:"Mouse Up",eventName:"mouseup"}),se({method:e,eventType:"Mouse Down",eventName:"mousedown"}),se({method:e,eventType:"Orientation Change",eventName:"orientationchange"}),se({method:e,eventType:"Print",eventName:["afterprint","beforeprint"]}),se({method:e,eventType:"Ready State Change",eventName:"readystatechange"}),se({method:e,eventType:"Touch Start",eventName:"touchstart"}),se({method:e,eventType:"Touch End",eventName:"touchend"}),se({method:e,eventType:"Touch Cancel",eventName:"touchcancel"}),se({method:e,eventType:"Transition Start",eventNames:["transitionstart","webkitTransitionStart","MSTransitionStart","oTransitionStart","otransitionstart"]}),se({method:e,eventType:"Transition Iteration",eventNames:["transitioniteration","webkitTransitionIteration","MSTransitionIteration","oTransitionIteration","otransitioniteration"]}),se({method:e,eventType:"Transition End",eventNames:["transitionend","webkitTransitionEnd","MSTransitionEnd","oTransitionEnd","otransitionend"]}),"child"===N&&se({method:e,eventType:"IFrame Resized",eventName:"resize"})}function ue(e,t,n,o){return t!==e&&(e in n||(ie(e+" is not a valid option for "+o+"CalculationMethod."),e=t),oe(o+' calculation method set to "'+e+'"')),e}function le(){k=ue(k,b,Q,"height")}function fe(){D=ue(D,q,G,"width")}function de(){var e;!0===u?(ce("add"),e=0>T,window.MutationObserver||window.WebKitMutationObserver?e?he():m=function(){function e(e){function t(e){!1===e.complete&&(oe("Attach listeners to "+e.src),e.addEventListener("load",r,!1),e.addEventListener("error",a,!1),u.push(e))}"attributes"===e.type&&"src"===e.attributeName?t(e.target):"childList"===e.type&&Array.prototype.forEach.call(e.target.querySelectorAll("img"),t)}function n(e){u.splice(u.indexOf(e),1)}function o(e){oe("Remove listeners from "+e.src),e.removeEventListener("load",r,!1),e.removeEventListener("error",a,!1),n(e)}function i(e,n,i){o(e.target),be(n,i+": "+e.target.src,t,t)}function r(e){i(e,"imageLoad","Image loaded")}function a(e){i(e,"imageLoadFailed","Image load failed")}function s(t){be("mutationObserver","mutationObserver: "+t[0].target+" "+t[0].type),t.forEach(e)}function c(){var e=document.querySelector("body"),t={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0};return f=new l(s),oe("Create body MutationObserver"),f.observe(e,t),f}var u=[],l=window.MutationObserver||window.WebKitMutationObserver,f=c();return{disconnect:function(){"disconnect"in f&&(oe("Disconnect body MutationObserver"),f.disconnect(),u.forEach(o))}}}():(oe("MutationObserver not supported in this browser!"),he())):oe("Auto Resize disabled")}function me(){ce("remove"),null!==m&&m.disconnect(),clearInterval(M)}function he(){0!==T&&(oe("setInterval: "+T+"ms"),M=setInterval((function(){be("interval","setInterval: "+T)}),Math.abs(T)))}function pe(e,t){var n=0;return t=t||document.body,n="defaultView"in document&&"getComputedStyle"in document.defaultView?null!==(n=document.defaultView.getComputedStyle(t,null))?n[e]:0:function(e){if(/^\d+(px)?$/i.test(e))return parseInt(e,10);var n=t.style.left,o=t.runtimeStyle.left;return t.runtimeStyle.left=t.currentStyle.left,t.style.left=e||0,e=t.style.pixelLeft,t.style.left=n,t.runtimeStyle.left=o,e}(t.currentStyle[e]),parseInt(n,10)}function ge(e,t){for(var n=t.length,o=0,i=0,r=te(e),a=K(),s=0;si&&(i=o);return a=K()-a,oe("Parsed "+n+" HTML elements"),oe("Element position calculated in "+a+"ms"),function(e){e>W/2&&oe("Event throttle increased to "+(W=2*e)+"ms")}(a),i}function ve(e){return[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll()]}function we(e,t){var n=document.querySelectorAll("["+t+"]");return 0===n.length&&(ie("No tagged elements ("+t+") found on page"),document.querySelectorAll("body *")),ge(e,n)}function ye(){return document.querySelectorAll("body *")}function be(e,t,n,o){j&&e in g?oe("Trigger event cancelled: "+e):(e in{reset:1,resetPage:1,init:1}||oe("Trigger event: "+t),Z(e,t,n,o))}function ke(){j||(j=!0,oe("Trigger event lock on")),clearTimeout(L),L=setTimeout((function(){j=!1,oe("Trigger event lock off"),oe("--")}),v)}function Oe(e){y=Q[k](),H=G[D](),Ee(y,H,e)}function _e(e){var t=k;k=b,oe("Reset trigger event: "+e),ke(),Oe("reset"),k=t}function Ee(e,n,o,i,r){var a;!0===z&&(t===r?r=R:oe("Message targetOrigin: "+r),oe("Sending message to host page ("+(a=C+":"+e+":"+n+":"+o+(t!==i?":"+i:""))+")"),F.postMessage(S+a,r))}function Te(t){var n={init:function(){"interactive"===document.readyState||"complete"===document.readyState?(_=t.data,F=t.source,re(),w=!1,setTimeout((function(){O=!1}),v)):(oe("Waiting for page ready"),$(window,"readystatechange",n.initFromParent))},reset:function(){O?oe("Page reset ignored by init"):(oe("Page size reset by host page"),Oe("resetPage"))},resize:function(){be("resizeParent","Parent window requested size check")},moveToAnchor:function(){E.findTarget(i())},inPageLink:function(){this.moveToAnchor()},pageInfo:function(){var e=i();oe("PageInfoFromParent called from parent: "+e),U(JSON.parse(e)),oe(" --")},message:function(){var e=i();oe("MessageCallback called from parent: "+e),J(JSON.parse(e)),oe(" --")}};function o(){return t.data.split("]")[1].split(":")[0]}function i(){return t.data.substr(t.data.indexOf(":")+1)}function r(){return t.data.split(":")[2]in{true:1,false:1}}function a(){var i=o();i in n?n[i]():!e.exports&&"iFrameResize"in window||r()||ie("Unexpected message ("+t.data+")")}S===(""+t.data).substr(0,I)&&(!1===w?a():r()?n.init():oe('Ignored message of type "'+o()+'". Received before initialization.'))}}()},28:function(e,t){var n,o,i;!function(r){"use strict";if("undefined"!=typeof window){var a,s=0,c=!1,u=!1,l="message".length,f="[iFrameSizer]",d=f.length,m=null,h=window.requestAnimationFrame,p={max:1,scroll:1,bodyScroll:1,documentElementScroll:1},g={},v=null,w={autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",closedCallback:function(){},initCallback:function(){},messageCallback:function(){T("MessageCallback function not defined")},resizedCallback:function(){},scrollCallback:function(){return!0}};window.jQuery&&((a=window.jQuery).fn?a.fn.iFrameResize||(a.fn.iFrameResize=function(e){return this.filter("iframe").each((function(t,n){L(n,e)})).end()}):E("","Unable to bind to jQuery, it is not fully loaded.")),o=[],(i="function"==typeof(n=function(){function e(e,n){n&&(function(){if(!n.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==n.tagName.toUpperCase())throw new TypeError("Expected