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

@transferwise/approve-api-action-helpers

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@transferwise/approve-api-action-helpers - npm Package Compare versions

Comparing version 0.9.1 to 0.9.2

3

CHANGELOG.md

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

# v0.9.2
## Update dependencies
# v0.9.1

@@ -2,0 +5,0 @@ ## Update dependencies

4

dist/main.js

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

/* Version: 0.9.1 - July 20, 2021 09:32:30 */
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).twApproveApiActionHelpers={})}(this,(function(e){"use strict";function n(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function t(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?n(Object(i),!0).forEach((function(n){o(e,n,i[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(i,n))}))}return e}function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function r(e,n){return(r=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e})(e,n)}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function c(e,n,t){return(c=a()?Reflect.construct:function(e,n,t){var o=[null];o.push.apply(o,n);var i=new(Function.bind.apply(e,o));return t&&r(i,t.prototype),i}).apply(null,arguments)}function u(e){var n="function"==typeof Map?new Map:void 0;return(u=function(e){if(null===e||(t=e,-1===Function.toString.call(t).indexOf("[native code]")))return e;var t;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,o)}function o(){return c(e,arguments,i(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),r(o,e)})(e)}function s(e,n){return!n||"object"!=typeof n&&"function"!=typeof n?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):n}var d=function(e){!function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),n&&r(e,n)}(c,e);var n,t,o=(n=c,t=a(),function(){var e,o=i(n);if(t){var r=i(this).constructor;e=Reflect.construct(o,arguments,r)}else e=o.apply(this,arguments);return s(this,e)});function c(e){var n;return function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,c),(n=o.call(this,e.statusText)).name="HTTPError",n.response=e,n}return c}(u(Error));function l(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return fetch(e,t(t({},n),{},{headers:t(t({},{"Content-Type":"application/json"}),n.headers)})).then((function(e){if(!e.ok)throw new d(e);return e}))}var f={},m={exports:{}};!function(e){!function(n){if("undefined"!=typeof window){var t,o=0,i=!1,r=!1,a="message".length,c="[iFrameSizer]",u=c.length,s=null,d=window.requestAnimationFrame,l={max:1,scroll:1,bodyScroll:1,documentElementScroll:1},f={},m=null,p={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,mouseEvents:!0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClose:function(){return!0},onClosed:function(){},onInit:function(){},onMessage:function(){T("onMessage function not defined")},onMouseEnter:function(){},onMouseLeave:function(){},onResized:function(){},onScroll:function(){return!0}},h={};window.jQuery&&((t=window.jQuery).fn?t.fn.iFrameResize||(t.fn.iFrameResize=function(e){return this.filter("iframe").each((function(n,t){L(t,e)})).end()}):E("","Unable to bind to jQuery, it is not fully loaded.")),e.exports=D(),window.iFrameResize=window.iFrameResize||D()}function g(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function w(e,n,t){e.addEventListener(n,t,!1)}function v(e,n,t){e.removeEventListener(n,t,!1)}function b(e){return c+"["+function(e){var n="Host page: "+e;return window.top!==window.self&&(n=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+e:"Nested host page: "+e),n}(e)+"]"}function y(e){return f[e]?f[e].log:i}function O(e,n){M("log",e,n,y(e))}function E(e,n){M("info",e,n,y(e))}function T(e,n){M("warn",e,n,!0)}function M(e,n,t,o){!0===o&&"object"==typeof window.console&&console[e](b(n),t)}function x(e){function n(){i("Height"),i("Width"),F((function(){N(U),C(B),b("onResized",U)}),U,"init")}function t(e){return"border-box"!==e.boxSizing?0:(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}function o(e){return"border-box"!==e.boxSizing?0:(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}function i(e){var n=Number(f[B]["max"+e]),t=Number(f[B]["min"+e]),o=e.toLowerCase(),i=Number(U[o]);O(B,"Checking "+o+" is in range "+t+"-"+n),i<t&&(i=t,O(B,"Set "+o+" to min value")),i>n&&(i=n,O(B,"Set "+o+" to max value")),U[o]=""+i}function r(e){return H.substr(H.indexOf(":")+a+e)}function d(e,n){var t,o,i;t=function(){var t,o;A("Send Page Info","pageInfo:"+(t=document.body.getBoundingClientRect(),o=U.iframe.getBoundingClientRect(),JSON.stringify({iframeHeight:o.height,iframeWidth:o.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(o.top-t.top,10),offsetLeft:parseInt(o.left-t.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})),e,n)},o=32,h[i=n]||(h[i]=setTimeout((function(){h[i]=null,t()}),o))}function l(e){var n=e.getBoundingClientRect();return S(B),{x:Math.floor(Number(n.left)+Number(s.x)),y:Math.floor(Number(n.top)+Number(s.y))}}function m(e){var n=e?l(U.iframe):{x:0,y:0},t={x:Number(U.width)+n.x,y:Number(U.height)+n.y};O(B,"Reposition requested from iFrame (offset x:"+n.x+" y:"+n.y+")"),window.top!==window.self?window.parentIFrame?window.parentIFrame["scrollTo"+(e?"Offset":"")](t.x,t.y):T(B,"Unable to scroll to requested position, window.parentIFrame not found"):(s=t,p(),O(B,"--"))}function p(){!1!==b("onScroll",s)?C(B):P()}function g(e){var n={};if(0===Number(U.width)&&0===Number(U.height)){var t=r(9).split(":");n={x:t[1],y:t[0]}}else n={x:U.width,y:U.height};b(e,{iframe:U.iframe,screenX:Number(n.x),screenY:Number(n.y),type:U.type})}function b(e,n){return I(B,e,n)}var y,M,x,k,L,W,H=e.data,U={},B=null;"[iFrameResizerChild]Ready"===H?function(){for(var e in f)A("iFrame requested init",j(e),f[e].iframe,e)}():c===(""+H).substr(0,u)&&H.substr(u).split(":")[0]in f?(x=H.substr(u).split(":"),k=x[1]?parseInt(x[1],10):0,L=f[x[0]]&&f[x[0]].iframe,W=getComputedStyle(L),U={iframe:L,id:x[0],height:k+t(W)+o(W),width:x[2],type:x[3]},B=U.id,f[B]&&(f[B].loaded=!0),(M=U.type in{true:1,false:1,undefined:1})&&O(B,"Ignoring init message from meta parent page"),!M&&function(e){var n=!0;return f[e]||(n=!1,T(U.type+" No settings for "+e+". Message was: "+H)),n}(B)&&(O(B,"Received: "+H),y=!0,null===U.iframe&&(T(B,"IFrame ("+U.id+") not found"),y=!1),y&&function(){var n,t=e.origin,o=f[B]&&f[B].checkOrigin;if(o&&""+t!="null"&&!(o.constructor===Array?function(){var e=0,n=!1;for(O(B,"Checking connection is from allowed list of origins: "+o);e<o.length;e++)if(o[e]===t){n=!0;break}return n}():(n=f[B]&&f[B].remoteHost,O(B,"Checking connection is from: "+n),t===n)))throw new Error("Unexpected message received from: "+t+" for "+U.iframe.id+". Message was: "+e.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}()&&function(){switch(f[B]&&f[B].firstRun&&f[B]&&(f[B].firstRun=!1),U.type){case"close":R(U.iframe);break;case"message":a=r(6),O(B,"onMessage passed: {iframe: "+U.iframe.id+", message: "+a+"}"),b("onMessage",{iframe:U.iframe,message:JSON.parse(a)}),O(B,"--");break;case"mouseenter":g("onMouseEnter");break;case"mouseleave":g("onMouseLeave");break;case"autoResize":f[B].autoResize=JSON.parse(r(9));break;case"scrollTo":m(!1);break;case"scrollToOffset":m(!0);break;case"pageInfo":d(f[B]&&f[B].iframe,B),function(){function e(e,o){function i(){f[t]?d(f[t].iframe,t):n()}["scroll","resize"].forEach((function(n){O(t,e+n+" listener for sendPageInfo"),o(window,n,i)}))}function n(){e("Remove ",v)}var t=B;e("Add ",w),f[t]&&(f[t].stopPageInfo=n)}();break;case"pageInfoStop":f[B]&&f[B].stopPageInfo&&(f[B].stopPageInfo(),delete f[B].stopPageInfo);break;case"inPageLink":t=r(9).split("#")[1]||"",o=decodeURIComponent(t),(i=document.getElementById(o)||document.getElementsByName(o)[0])?(e=l(i),O(B,"Moving to in page link (#"+t+") at x: "+e.x+" y: "+e.y),s={x:e.x,y:e.y},p(),O(B,"--")):window.top!==window.self?window.parentIFrame?window.parentIFrame.moveToAnchor(t):O(B,"In page link #"+t+" not found and window.parentIFrame not found"):O(B,"In page link #"+t+" not found");break;case"reset":z(U);break;case"init":n(),b("onInit",U.iframe);break;default:0===Number(U.width)&&0===Number(U.height)?T("Unsupported message received ("+U.type+"), this is likely due to the iframe containing a later version of iframe-resizer than the parent page"):n()}var e,t,o,i,a}())):E(B,"Ignored: "+H)}function I(e,n,t){var o=null,i=null;if(f[e]){if("function"!=typeof(o=f[e][n]))throw new TypeError(n+" on iFrame["+e+"] is not a function");i=o(t)}return i}function k(e){var n=e.id;delete f[n]}function R(e){var n=e.id;if(!1!==I(n,"onClose",n)){O(n,"Removing iFrame: "+n);try{e.parentNode&&e.parentNode.removeChild(e)}catch(e){T(e)}I(n,"onClosed",n),O(n,"--"),k(e)}else O(n,"Close iframe cancelled by onClose event")}function S(e){null===s&&O(e,"Get page position: "+(s={x:window.pageXOffset!==n?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==n?window.pageYOffset:document.documentElement.scrollTop}).x+","+s.y)}function C(e){null!==s&&(window.scrollTo(s.x,s.y),O(e,"Set page position: "+s.x+","+s.y),P())}function P(){s=null}function z(e){O(e.id,"Size reset requested by "+("init"===e.type?"host page":"iFrame")),S(e.id),F((function(){N(e),A("reset","reset",e.iframe,e.id)}),e,"reset")}function N(e){function n(n){r||"0"!==e[n]||(r=!0,O(o,"Hidden iFrame detected, creating visibility listener"),function(){function e(){function e(e){function n(n){return"0px"===(f[e]&&f[e].iframe.style[n])}function t(e){return null!==e.offsetParent}f[e]&&t(f[e].iframe)&&(n("height")||n("width"))&&A("Visibility change","resize",f[e].iframe,e)}Object.keys(f).forEach((function(n){e(n)}))}function n(n){O("window","Mutation observed: "+n[0].target+" "+n[0].type),W(e,16)}function t(){var e=document.querySelector("body"),t={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0};new o(n).observe(e,t)}var o=g();o&&t()}())}function t(t){!function(n){e.id?(e.iframe.style[n]=e[n]+"px",O(e.id,"IFrame ("+o+") "+n+" set to "+e[n]+"px")):O("undefined","messageData id not set")}(t),n(t)}var o=e.iframe.id;f[o]&&(f[o].sizeHeight&&t("height"),f[o].sizeWidth&&t("width"))}function F(e,n,t){t!==n.type&&d&&!window.jasmine?(O(n.id,"Requesting animation frame"),d(e)):e()}function A(e,n,t,o,i){var r,a=!1;o=o||t.id,f[o]&&(t&&"contentWindow"in t&&null!==t.contentWindow?(r=f[o]&&f[o].targetOrigin,O(o,"["+e+"] Sending msg to iframe["+o+"] ("+n+") targetOrigin: "+r),t.contentWindow.postMessage(c+n,r)):T(o,"["+e+"] IFrame("+o+") not found"),i&&f[o]&&f[o].warningTimeout&&(f[o].msgTimeout=setTimeout((function(){!f[o]||f[o].loaded||a||(a=!0,T(o,"IFrame has not responded within "+f[o].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))}),f[o].warningTimeout)))}function j(e){return e+":"+f[e].bodyMarginV1+":"+f[e].sizeWidth+":"+f[e].log+":"+f[e].interval+":"+f[e].enablePublicMethods+":"+f[e].autoResize+":"+f[e].bodyMargin+":"+f[e].heightCalculationMethod+":"+f[e].bodyBackground+":"+f[e].bodyPadding+":"+f[e].tolerance+":"+f[e].inPageLinks+":"+f[e].resizeFrom+":"+f[e].widthCalculationMethod+":"+f[e].mouseEvents}function L(e,t){function r(e){var n=e.split("Callback");if(2===n.length){var t="on"+n[0].charAt(0).toUpperCase()+n[0].slice(1);this[t]=this[e],delete this[e],T(u,"Deprecated: '"+e+"' has been renamed '"+t+"'. The old method will be removed in the next major version.")}}var a,c,u=function(n){var r;return""===n&&(e.id=(r=t&&t.id||p.id+o++,null!==document.getElementById(r)&&(r+=o++),n=r),i=(t||{}).log,O(n,"Added missing iframe ID: "+n+" ("+e.src+")")),n}(e.id);u in f&&"iFrameResizer"in e?T(u,"Ignored iFrame, already setup."):(!function(n){var t;n=n||{},f[u]={firstRun:!0,iframe:e,remoteHost:e.src&&e.src.split("/").slice(0,3).join("/")},function(e){if("object"!=typeof e)throw new TypeError("Options is not an object")}(n),Object.keys(n).forEach(r,n),function(e){for(var n in p)Object.prototype.hasOwnProperty.call(p,n)&&(f[u][n]=Object.prototype.hasOwnProperty.call(e,n)?e[n]:p[n])}(n),f[u]&&(f[u].targetOrigin=!0===f[u].checkOrigin?""===(t=f[u].remoteHost)||null!==t.match(/^(about:blank|javascript:|file:\/\/)/)?"*":t:"*")}(t),function(){switch(O(u,"IFrame scrolling "+(f[u]&&f[u].scrolling?"enabled":"disabled")+" for "+u),e.style.overflow=!1===(f[u]&&f[u].scrolling)?"hidden":"auto",f[u]&&f[u].scrolling){case"omit":break;case!0:e.scrolling="yes";break;case!1:e.scrolling="no";break;default:e.scrolling=f[u]?f[u].scrolling:"no"}}(),function(){function n(n){var t=f[u][n];1/0!==t&&0!==t&&(e.style[n]="number"==typeof t?t+"px":t,O(u,"Set "+n+" = "+e.style[n]))}function t(e){if(f[u]["min"+e]>f[u]["max"+e])throw new Error("Value for min"+e+" can not be greater than max"+e)}t("Height"),t("Width"),n("maxHeight"),n("minHeight"),n("maxWidth"),n("minWidth")}(),"number"!=typeof(f[u]&&f[u].bodyMargin)&&"0"!==(f[u]&&f[u].bodyMargin)||(f[u].bodyMarginV1=f[u].bodyMargin,f[u].bodyMargin=f[u].bodyMargin+"px"),a=j(u),(c=g())&&function(n){e.parentNode&&new n((function(n){n.forEach((function(n){Array.prototype.slice.call(n.removedNodes).forEach((function(n){n===e&&R(e)}))}))})).observe(e.parentNode,{childList:!0})}(c),w(e,"load",(function(){var t,o;A("iFrame.onload",a,e,n,!0),t=f[u]&&f[u].firstRun,o=f[u]&&f[u].heightCalculationMethod in l,!t&&o&&z({iframe:e,height:0,width:0,type:"init"})})),A("init",a,e,n,!0),f[u]&&(f[u].iframe.iFrameResizer={close:R.bind(null,f[u].iframe),removeListeners:k.bind(null,f[u].iframe),resize:A.bind(null,"Window resize","resize",f[u].iframe),moveToAnchor:function(e){A("Move to anchor","moveToAnchor:"+e,f[u].iframe,u)},sendMessage:function(e){A("Send Message","message:"+(e=JSON.stringify(e)),f[u].iframe,u)}}))}function W(e,n){null===m&&(m=setTimeout((function(){m=null,e()}),n))}function H(){"hidden"!==document.visibilityState&&(O("document","Trigger event: Visiblity change"),W((function(){U("Tab Visable","resize")}),16))}function U(e,n){Object.keys(f).forEach((function(t){(function(e){return f[e]&&"parent"===f[e].resizeFrom&&f[e].autoResize&&!f[e].firstRun})(t)&&A(e,n,f[t].iframe,t)}))}function B(){w(window,"message",x),w(window,"resize",(function(){var e;O("window","Trigger event: "+(e="resize")),W((function(){U("Window "+e,"resize")}),16)})),w(document,"visibilitychange",H),w(document,"-webkit-visibilitychange",H)}function D(){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 <IFRAME> tag, found <"+n.tagName+">")}(),L(n,e),t.push(n))}var t;return function(){var e,n=["moz","webkit","o","ms"];for(e=0;e<n.length&&!d;e+=1)d=window[n[e]+"RequestAnimationFrame"];d?d=d.bind(window):O("setup","RequestAnimationFrame not supported")}(),B(),function(o,i){switch(t=[],function(e){e&&e.enablePublicMethods&&T("enablePublicMethods option has been removed, public methods are now always available in the iFrame")}(o),typeof i){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(i||"iframe"),e.bind(n,o));break;case"object":e(o,i);break;default:throw new TypeError("Unexpected data type ("+typeof i+")")}return t}}}()}(m);var p={exports:{}};!function(e){!function(n){if("undefined"!=typeof window){var t=!0,o="",i=0,r="",a=null,c="",u=!1,s={resize:1,click:1},d=128,l=!0,f=1,m="bodyOffset",p=m,h=!0,g="",w={},v=32,b=null,y=!1,O=!1,E="[iFrameSizer]",T=E.length,M="",x={max:1,min:1,bodyScroll:1,documentElementScroll:1},I="child",k=window.parent,R="*",S=0,C=!1,P=null,z=16,N=1,F="scroll",A=F,j=window,L=function(){re("onMessage function not defined")},W=function(){},H=function(){},U={height:function(){return re("Custom height calculation function not defined"),document.documentElement.offsetHeight},width:function(){return re("Custom width calculation function not defined"),document.body.scrollWidth}},B={},D=!1;try{var q=Object.create({},{passive:{get:function(){D=!0}}});window.addEventListener("test",ee,q),window.removeEventListener("test",ee,q)}catch(e){}var V,X,_,J,Y,Q,K,G={bodyOffset:function(){return document.body.offsetHeight+ge("marginTop")+ge("marginBottom")},offset:function(){return G.bodyOffset()},bodyScroll:function(){return document.body.scrollHeight},custom:function(){return U.height()},documentElementOffset:function(){return document.documentElement.offsetHeight},documentElementScroll:function(){return document.documentElement.scrollHeight},max:function(){return Math.max.apply(null,ve(G))},min:function(){return Math.min.apply(null,ve(G))},grow:function(){return G.max()},lowestElement:function(){return Math.max(G.bodyOffset()||G.documentElementOffset(),we("bottom",ye()))},taggedElement:function(){return be("bottom","data-iframe-height")}},Z={bodyScroll:function(){return document.body.scrollWidth},bodyOffset:function(){return document.body.offsetWidth},custom:function(){return U.width()},documentElementScroll:function(){return document.documentElement.scrollWidth},documentElementOffset:function(){return document.documentElement.offsetWidth},scroll:function(){return Math.max(Z.bodyScroll(),Z.documentElementScroll())},max:function(){return Math.max.apply(null,ve(Z))},min:function(){return Math.min.apply(null,ve(Z))},rightMostElement:function(){return we("right",ye())},taggedElement:function(){return be("right","data-iframe-width")}},$=(V=Oe,Y=null,Q=0,K=function(){Q=Date.now(),Y=null,J=V.apply(X,_),Y||(X=_=null)},function(){var e=Date.now();Q||(Q=e);var n=z-(e-Q);return X=this,_=arguments,n<=0||n>z?(Y&&(clearTimeout(Y),Y=null),Q=e,J=V.apply(X,_),Y||(X=_=null)):Y||(Y=setTimeout(K,n)),J});ne(window,"message",(function(n){var t={init:function(){g=n.data,k=n.source,ae(),l=!1,setTimeout((function(){h=!1}),d)},reset:function(){h?ie("Page reset ignored by init"):(ie("Page size reset by host page"),Me("resetPage"))},resize:function(){Ee("resizeParent","Parent window requested size check")},moveToAnchor:function(){w.findTarget(i())},inPageLink:function(){this.moveToAnchor()},pageInfo:function(){var e=i();ie("PageInfoFromParent called from parent: "+e),H(JSON.parse(e)),ie(" --")},message:function(){var e=i();ie("onMessage called from parent: "+e),L(JSON.parse(e)),ie(" --")}};function o(){return n.data.split("]")[1].split(":")[0]}function i(){return n.data.substr(n.data.indexOf(":")+1)}function r(){return n.data.split(":")[2]in{true:1,false:1}}function a(){var i=o();i in t?t[i]():!e.exports&&"iFrameResize"in window||"jQuery"in window&&"iFrameResize"in window.jQuery.prototype||r()||re("Unexpected message ("+n.data+")")}E===(""+n.data).substr(0,T)&&(!1===l?a():r()?t.init():ie('Ignored message of type "'+o()+'". Received before initialization.'))})),ne(window,"readystatechange",ke),ke()}function ee(){}function ne(e,n,t,o){e.addEventListener(n,t,!!D&&(o||{}))}function te(e){return e.charAt(0).toUpperCase()+e.slice(1)}function oe(e){return E+"["+M+"] "+e}function ie(e){y&&"object"==typeof window.console&&console.log(oe(e))}function re(e){"object"==typeof window.console&&console.warn(oe(e))}function ae(){var e;!function(){function e(e){return"true"===e}var a=g.substr(T).split(":");M=a[0],i=n!==a[1]?Number(a[1]):i,u=n!==a[2]?e(a[2]):u,y=n!==a[3]?e(a[3]):y,v=n!==a[4]?Number(a[4]):v,t=n!==a[6]?e(a[6]):t,r=a[7],p=n!==a[8]?a[8]:p,o=a[9],c=a[10],S=n!==a[11]?Number(a[11]):S,w.enable=n!==a[12]&&e(a[12]),I=n!==a[13]?a[13]:I,A=n!==a[14]?a[14]:A,O=n!==a[15]?Boolean(a[15]):O}(),ie("Initialising iFrame ("+window.location.href+")"),function(){function e(){var e=window.iFrameResizer;ie("Reading data from page: "+JSON.stringify(e)),Object.keys(e).forEach(ce,e),L="onMessage"in e?e.onMessage:L,W="onReady"in e?e.onReady:W,R="targetOrigin"in e?e.targetOrigin:R,p="heightCalculationMethod"in e?e.heightCalculationMethod:p,A="widthCalculationMethod"in e?e.widthCalculationMethod:A}function n(e,n){return"function"==typeof e&&(ie("Setup custom "+n+"CalcMethod"),U[n]=e,e="custom"),e}"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),p=n(p,"height"),A=n(A,"width"));ie("TargetOrigin for parent set to: "+R)}(),function(){n===r&&(r=i+"px");ue("margin",function(e,n){-1!==n.indexOf("-")&&(re("Negative CSS value ignored for "+e),n="");return n}("margin",r))}(),ue("background",o),ue("padding",c),(e=document.createElement("div")).style.clear="both",e.style.display="block",e.style.height="0",document.body.appendChild(e),fe(),me(),document.documentElement.style.height="",document.body.style.height="",ie('HTML & body height set to "auto"'),ie("Enable public methods"),j.parentIFrame={autoResize:function(e){return!0===e&&!1===t?(t=!0,pe()):!1===e&&!0===t&&(t=!1,de("remove"),null!==a&&a.disconnect(),clearInterval(b)),Ie(0,0,"autoResize",JSON.stringify(t)),t},close:function(){Ie(0,0,"close")},getId:function(){return M},getPageInfo:function(e){"function"==typeof e?(H=e,Ie(0,0,"pageInfo")):(H=function(){},Ie(0,0,"pageInfoStop"))},moveToAnchor:function(e){w.findTarget(e)},reset:function(){xe("parentIFrame.reset")},scrollTo:function(e,n){Ie(n,e,"scrollTo")},scrollToOffset:function(e,n){Ie(n,e,"scrollToOffset")},sendMessage:function(e,n){Ie(0,0,"message",JSON.stringify(e),n)},setHeightCalculationMethod:function(e){p=e,fe()},setWidthCalculationMethod:function(e){A=e,me()},setTargetOrigin:function(e){ie("Set targetOrigin: "+e),R=e},size:function(e,n){Ee("size","parentIFrame.size("+(e||"")+(n?","+n:"")+")",e,n)}},function(){if(!0!==O)return;function e(e){Ie(0,0,e.type,e.screenY+":"+e.screenX)}function n(n,t){ie("Add event listener: "+t),ne(window.document,n,e)}n("mouseenter","Mouse Enter"),n("mouseleave","Mouse Leave")}(),pe(),w=function(){function e(){return{x:window.pageXOffset!==n?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==n?window.pageYOffset:document.documentElement.scrollTop}}function t(n){var t=n.getBoundingClientRect(),o=e();return{x:parseInt(t.left,10)+parseInt(o.x,10),y:parseInt(t.top,10)+parseInt(o.y,10)}}function o(e){function o(e){var n=t(e);ie("Moving to in page link (#"+i+") at x: "+n.x+" y: "+n.y),Ie(n.y,n.x,"scrollToOffset")}var i=e.split("#")[1]||e,r=decodeURIComponent(i),a=document.getElementById(r)||document.getElementsByName(r)[0];n!==a?o(a):(ie("In page link (#"+i+") not found in iFrame, so sending to parent"),Ie(0,0,"inPageLink","#"+i))}function i(){var e=window.location.hash,n=window.location.href;""!==e&&"#"!==e&&o(n)}function r(){function e(e){function n(e){e.preventDefault(),o(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&ne(e,"click",n)}Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),e)}function a(){ne(window,"hashchange",i)}function c(){setTimeout(i,d)}function u(){Array.prototype.forEach&&document.querySelectorAll?(ie("Setting up location.hash handlers"),r(),a(),c()):re("In page linking not fully supported in this browser! (See README.md for IE8 workaround)")}w.enable?u():ie("In page linking not enabled");return{findTarget:o}}(),Ee("init","Init message from host page"),W()}function ce(e){var n=e.split("Callback");if(2===n.length){var t="on"+n[0].charAt(0).toUpperCase()+n[0].slice(1);this[t]=this[e],delete this[e],re("Deprecated: '"+e+"' has been renamed '"+t+"'. The old method will be removed in the next major version.")}}function ue(e,t){n!==t&&""!==t&&"null"!==t&&(document.body.style[e]=t,ie("Body "+e+' set to "'+t+'"'))}function se(e){var n={add:function(n){function t(){Ee(e.eventName,e.eventType)}B[n]=t,ne(window,n,t,{passive:!0})},remove:function(e){var n,t,o,i=B[e];delete B[e],n=window,t=e,o=i,n.removeEventListener(t,o,!1)}};e.eventNames&&Array.prototype.map?(e.eventName=e.eventNames[0],e.eventNames.map(n[e.method])):n[e.method](e.eventName),ie(te(e.method)+" event listener: "+e.eventType)}function de(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"===I&&se({method:e,eventType:"IFrame Resized",eventName:"resize"})}function le(e,n,t,o){return n!==e&&(e in t||(re(e+" is not a valid option for "+o+"CalculationMethod."),e=n),ie(o+' calculation method set to "'+e+'"')),e}function fe(){p=le(p,m,G,"height")}function me(){A=le(A,F,Z,"width")}function pe(){var e;!0===t?(de("add"),e=0>v,window.MutationObserver||window.WebKitMutationObserver?e?he():a=function(){function e(e){function n(e){!1===e.complete&&(ie("Attach listeners to "+e.src),e.addEventListener("load",i,!1),e.addEventListener("error",r,!1),u.push(e))}"attributes"===e.type&&"src"===e.attributeName?n(e.target):"childList"===e.type&&Array.prototype.forEach.call(e.target.querySelectorAll("img"),n)}function n(e){u.splice(u.indexOf(e),1)}function t(e){ie("Remove listeners from "+e.src),e.removeEventListener("load",i,!1),e.removeEventListener("error",r,!1),n(e)}function o(e,n,o){t(e.target),Ee(n,o+": "+e.target.src)}function i(e){o(e,"imageLoad","Image loaded")}function r(e){o(e,"imageLoadFailed","Image load failed")}function a(n){Ee("mutationObserver","mutationObserver: "+n[0].target+" "+n[0].type),n.forEach(e)}function c(){var e=document.querySelector("body"),n={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0};return d=new s(a),ie("Create body MutationObserver"),d.observe(e,n),d}var u=[],s=window.MutationObserver||window.WebKitMutationObserver,d=c();return{disconnect:function(){"disconnect"in d&&(ie("Disconnect body MutationObserver"),d.disconnect(),u.forEach(t))}}}():(ie("MutationObserver not supported in this browser!"),he())):ie("Auto Resize disabled")}function he(){0!==v&&(ie("setInterval: "+v+"ms"),b=setInterval((function(){Ee("interval","setInterval: "+v)}),Math.abs(v)))}function ge(e,n){var t=0;return n=n||document.body,t=null!==(t=document.defaultView.getComputedStyle(n,null))?t[e]:0,parseInt(t,10)}function we(e,n){for(var t=n.length,o=0,i=0,r=te(e),a=Date.now(),c=0;c<t;c++)(o=n[c].getBoundingClientRect()[e]+ge("margin"+r,n[c]))>i&&(i=o);return a=Date.now()-a,ie("Parsed "+t+" HTML elements"),ie("Element position calculated in "+a+"ms"),function(e){e>z/2&&ie("Event throttle increased to "+(z=2*e)+"ms")}(a),i}function ve(e){return[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll()]}function be(e,n){var t=document.querySelectorAll("["+n+"]");return 0===t.length&&(re("No tagged elements ("+n+") found on page"),document.querySelectorAll("body *")),we(e,t)}function ye(){return document.querySelectorAll("body *")}function Oe(e,t,o,i){var r,a;!function(){function e(e,n){return!(Math.abs(e-n)<=S)}return r=n!==o?o:G[p](),a=n!==i?i:Z[A](),e(f,r)||u&&e(N,a)}()&&"init"!==e?!(e in{init:1,interval:1,size:1})&&(p in x||u&&A in x)?xe(t):e in{interval:1}||ie("No change in size detected"):(Te(),Ie(f=r,N=a,e))}function Ee(e,n,t,o){C&&e in s?ie("Trigger event cancelled: "+e):(e in{reset:1,resetPage:1,init:1}||ie("Trigger event: "+n),"init"===e?Oe(e,n,t,o):$(e,n,t,o))}function Te(){C||(C=!0,ie("Trigger event lock on")),clearTimeout(P),P=setTimeout((function(){C=!1,ie("Trigger event lock off"),ie("--")}),d)}function Me(e){f=G[p](),N=Z[A](),Ie(f,N,e)}function xe(e){var n=p;p=m,ie("Reset trigger event: "+e),Te(),Me("reset"),p=n}function Ie(e,t,o,i,r){var a;n===r?r=R:ie("Message targetOrigin: "+r),ie("Sending message to host page ("+(a=M+":"+e+":"+t+":"+o+(n!==i?":"+i:""))+")"),k.postMessage(E+a,r)}function ke(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}}()}(p);var h=m.exports;f.iframeResize=h,f.iframeResizer=h,f.iframeResizerContentWindow=p.exports;var g=f,w="tw-approve-api-action-success",v="tw-approve-api-action-failed",b="tw-approve-api-action-closed",y=function(e){var n=e.target,t=e.token,o=e.approvalPageUrl,i=e.flow,r=document.createElement("form"),a=document.createElement("input"),c=document.createElement("input"),u=document.createElement("input"),s=document.createElement("input");return r.style.display="none",n&&(r.target=n),r.method="POST",r.action=o,a.value=t,a.name="ott",r.appendChild(a),c.value="0.9.1",c.name="libVersion",r.appendChild(c),u.value=window.location.hostname,u.name="parentHostname",r.appendChild(u),s.value=i,s.name="flow",r.appendChild(s),r};var O;var E={IFRAME:"iframe",TAB:"tab",POPUP:"popup"},T={PRODUCTION:"production",SANDBOX:"sandbox"},M=(o(O={},E.IFRAME,(function(e){var n,t,o=e.token,i=e.approvalPageUrl,r=e.resolve,a=e.reject;document.getElementById("tw-approve-api-action-styles")||(n=document.head,(t=document.createElement("style")).id="tw-approve-api-action-styles",t.appendChild(document.createTextNode("\n .tw-approval-modal-overlay {\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n height: 100%;\n width: 100%;\n background: rgba(55,81,126,0);\n transition: background-color .35s cubic-bezier(0,.94,.62,1);\n z-index: 1050;\n }\n .tw-approval-modal-overlay--open {\n background: rgba(55,81,126,0.8);\n }\n .tw-approval-modal-wrapper {\n height: 100%;\n width: 100vw;\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 16px;\n }\n .tw-approval-modal {\n display: flex;\n max-height: 100%;\n width: 540px;\n background-color: #fff;\n border-radius: 3px;\n box-shadow: 0 5px 15px rgba(0,0,0,.2);\n overflow: auto;\n }\n .tw-approval-modal iframe {\n width: 100%;\n height: 520px;\n transition: height 0.1s ease-in-out;\n }\n")),n.appendChild(t));var c=document.createElement("div");c.id="tw-approval-modal-overlay",c.classList.add("tw-approval-modal-overlay");var u=document.createElement("div");u.classList.add("tw-approval-modal-wrapper"),c.appendChild(u);var s=document.createElement("div");s.classList.add("tw-approval-modal"),u.appendChild(s);var d=document.createElement("iframe");d.name="tw-approve-api-action",d.style.border="0",s.appendChild(d);var l=y({token:o,approvalPageUrl:i,flow:"iframe"});s.appendChild(l),document.body.appendChild(c),g.iframeResize({checkOrigin:!1,minHeight:400},d),c.classList.add("tw-approval-modal-overlay--open"),l.setAttribute("target","tw-approve-api-action"),l.submit();var f=function(e){switch(e.data){case w:return m(),void r();case v:return m(),void a();case b:m()}},m=function(){d.src="about:blank";var e=document.getElementById("tw-approval-modal-overlay");e.parentNode.removeChild(e),window.removeEventListener("message",f)};c.addEventListener("click",m,{once:!0}),window.addEventListener("message",f)})),o(O,E.TAB,(function(e){var n=e.token,t=e.approvalPageUrl,o=e.resolve,i=e.reject,r="tw-approve-api-action",a=y({target:r,token:n,approvalPageUrl:t,flow:"tab"});document.body.appendChild(a);var c=window.open(t,r);a.submit();var u=function(e){switch(e.data){case w:return s(),void o();case v:return s(),void i();case b:s()}},s=function(){c.close(),window.removeEventListener("message",u)};window.addEventListener("message",u)})),o(O,E.POPUP,(function(e){var n=e.token,t=e.approvalPageUrl,o=e.resolve,i=e.reject,r="tw-approve-api-action",a=y({target:r,token:n,approvalPageUrl:t,flow:"popup"});document.body.appendChild(a);var c=function(){var e=void 0!==window.screenLeft?window.screenLeft:window.screenX,n=void 0!==window.screenTop?window.screenTop:window.screenY,t=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,o=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,i=t/window.screen.availWidth;return{width:580/i,height:600/i,top:(o-600)/2/i+n,left:(t-580)/2/i+e}}(),u=c.width,s=c.height,d=c.top,l=c.left,f=window.open(t,r,"resizable,scrollbars,status,location,width=".concat(u,",height=").concat(s,",top=").concat(d,",left=").concat(l));a.submit(),f.focus&&f.focus();var m=function(e){switch(e.data){case w:return p(),void o();case v:return p(),void i();case b:p()}},p=function(){f.close(),window.removeEventListener("message",m)};window.addEventListener("message",m)})),O),x=function(e){return e===T.SANDBOX?"https://sandbox.transferwise.tech/approve-api-action/":"https://wise.com/approve-api-action/"};function I(e){var n=e.token,t=e.flow,o=void 0===t?E.IFRAME:t,i=e.mode,r=void 0===i?T.PRODUCTION:i,a=e.approvalPageUrl;return new Promise((function(e,t){var i={token:n,approvalPageUrl:a||x(r),resolve:e,reject:t};M[o](i)}))}function k(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){};e()}function R(e){if(!e||!e.response)return!1;var n=S(e.response),t=e.response.status;return(403===t||400===t)&&n}function S(e){return e&&e.headers&&e.headers.get?e.headers.get("X-2FA-APPROVAL"):null}e.Flow=E,e.Mode=T,e.create=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(n){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return l(n,o).then((function(e){return{response:e,metadata:{scaRequired:!1}}})).catch((function(i){if(R(i)){var r=S(i.response);return k(e.onSCARequired),I({token:r,flow:e.flow,mode:e.mode,approvalPageUrl:e.approvalPageUrl}).then((function(){k(e.onSCACompleted);var i=t(t({},o.headers||{}),{},{"X-2FA-APPROVAL":r});return l(n,t(t({},o),{},{headers:i})).then((function(e){return{response:e,metadata:{scaRequired:!0}}}))}))}throw i})).then((function(e){return o&&o.withMetadata?e:e.response}))}},e.runFlow=I,Object.defineProperty(e,"__esModule",{value:!0})}));
/* Version: 0.9.2 - December 21, 2021 07:30:26 */
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).twApproveApiActionHelpers={})}(this,(function(e){"use strict";function n(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function t(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?n(Object(o),!0).forEach((function(n){i(e,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(o,n))}))}return e}function o(e,n){for(var t=0;t<n.length;t++){var o=n[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,n){return(a=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e})(e,n)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function u(e,n,t){return(u=c()?Reflect.construct:function(e,n,t){var o=[null];o.push.apply(o,n);var i=new(Function.bind.apply(e,o));return t&&a(i,t.prototype),i}).apply(null,arguments)}function s(e){var n="function"==typeof Map?new Map:void 0;return(s=function(e){if(null===e||(t=e,-1===Function.toString.call(t).indexOf("[native code]")))return e;var t;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,o)}function o(){return u(e,arguments,r(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),a(o,e)})(e)}function d(e,n){if(n&&("object"==typeof n||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}var l="tw-approve-api-action-success",f="tw-approve-api-action-failed",m="tw-approve-api-action-closed",p={},h={exports:{}};!function(e){!function(n){if("undefined"!=typeof window){var t,o=0,i=!1,r=!1,a="message".length,c="[iFrameSizer]",u=c.length,s=null,d=window.requestAnimationFrame,l={max:1,scroll:1,bodyScroll:1,documentElementScroll:1},f={},m=null,p={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,mouseEvents:!0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClose:function(){return!0},onClosed:function(){},onInit:function(){},onMessage:function(){T("onMessage function not defined")},onMouseEnter:function(){},onMouseLeave:function(){},onResized:function(){},onScroll:function(){return!0}},h={};window.jQuery&&((t=window.jQuery).fn?t.fn.iFrameResize||(t.fn.iFrameResize=function(e){return this.filter("iframe").each((function(n,t){L(t,e)})).end()}):E("","Unable to bind to jQuery, it is not fully loaded.")),e.exports=D(),window.iFrameResize=window.iFrameResize||D()}function g(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function w(e,n,t){e.addEventListener(n,t,!1)}function v(e,n,t){e.removeEventListener(n,t,!1)}function b(e){return c+"["+function(e){var n="Host page: "+e;return window.top!==window.self&&(n=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+e:"Nested host page: "+e),n}(e)+"]"}function y(e){return f[e]?f[e].log:i}function O(e,n){M("log",e,n,y(e))}function E(e,n){M("info",e,n,y(e))}function T(e,n){M("warn",e,n,!0)}function M(e,n,t,o){!0===o&&"object"==typeof window.console&&console[e](b(n),t)}function x(e){function n(){i("Height"),i("Width"),F((function(){N(U),P(B),b("onResized",U)}),U,"init")}function t(e){return"border-box"!==e.boxSizing?0:(e.paddingTop?parseInt(e.paddingTop,10):0)+(e.paddingBottom?parseInt(e.paddingBottom,10):0)}function o(e){return"border-box"!==e.boxSizing?0:(e.borderTopWidth?parseInt(e.borderTopWidth,10):0)+(e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0)}function i(e){var n=Number(f[B]["max"+e]),t=Number(f[B]["min"+e]),o=e.toLowerCase(),i=Number(U[o]);O(B,"Checking "+o+" is in range "+t+"-"+n),i<t&&(i=t,O(B,"Set "+o+" to min value")),i>n&&(i=n,O(B,"Set "+o+" to max value")),U[o]=""+i}function r(e){return H.substr(H.indexOf(":")+a+e)}function d(e,n){var t,o,i;t=function(){var t,o;A("Send Page Info","pageInfo:"+(t=document.body.getBoundingClientRect(),o=U.iframe.getBoundingClientRect(),JSON.stringify({iframeHeight:o.height,iframeWidth:o.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(o.top-t.top,10),offsetLeft:parseInt(o.left-t.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})),e,n)},o=32,h[i=n]||(h[i]=setTimeout((function(){h[i]=null,t()}),o))}function l(e){var n=e.getBoundingClientRect();return S(B),{x:Math.floor(Number(n.left)+Number(s.x)),y:Math.floor(Number(n.top)+Number(s.y))}}function m(e){var n=e?l(U.iframe):{x:0,y:0},t={x:Number(U.width)+n.x,y:Number(U.height)+n.y};O(B,"Reposition requested from iFrame (offset x:"+n.x+" y:"+n.y+")"),window.top!==window.self?window.parentIFrame?window.parentIFrame["scrollTo"+(e?"Offset":"")](t.x,t.y):T(B,"Unable to scroll to requested position, window.parentIFrame not found"):(s=t,p(),O(B,"--"))}function p(){!1!==b("onScroll",s)?P(B):C()}function g(e){var n={};if(0===Number(U.width)&&0===Number(U.height)){var t=r(9).split(":");n={x:t[1],y:t[0]}}else n={x:U.width,y:U.height};b(e,{iframe:U.iframe,screenX:Number(n.x),screenY:Number(n.y),type:U.type})}function b(e,n){return I(B,e,n)}var y,M,x,k,L,W,H=e.data,U={},B=null;"[iFrameResizerChild]Ready"===H?function(){for(var e in f)A("iFrame requested init",j(e),f[e].iframe,e)}():c===(""+H).substr(0,u)&&H.substr(u).split(":")[0]in f?(x=H.substr(u).split(":"),k=x[1]?parseInt(x[1],10):0,L=f[x[0]]&&f[x[0]].iframe,W=getComputedStyle(L),U={iframe:L,id:x[0],height:k+t(W)+o(W),width:x[2],type:x[3]},B=U.id,f[B]&&(f[B].loaded=!0),(M=U.type in{true:1,false:1,undefined:1})&&O(B,"Ignoring init message from meta parent page"),!M&&function(e){var n=!0;return f[e]||(n=!1,T(U.type+" No settings for "+e+". Message was: "+H)),n}(B)&&(O(B,"Received: "+H),y=!0,null===U.iframe&&(T(B,"IFrame ("+U.id+") not found"),y=!1),y&&function(){var n,t=e.origin,o=f[B]&&f[B].checkOrigin;if(o&&""+t!="null"&&!(o.constructor===Array?function(){var e=0,n=!1;for(O(B,"Checking connection is from allowed list of origins: "+o);e<o.length;e++)if(o[e]===t){n=!0;break}return n}():(n=f[B]&&f[B].remoteHost,O(B,"Checking connection is from: "+n),t===n)))throw new Error("Unexpected message received from: "+t+" for "+U.iframe.id+". Message was: "+e.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}()&&function(){switch(f[B]&&f[B].firstRun&&f[B]&&(f[B].firstRun=!1),U.type){case"close":R(U.iframe);break;case"message":a=r(6),O(B,"onMessage passed: {iframe: "+U.iframe.id+", message: "+a+"}"),b("onMessage",{iframe:U.iframe,message:JSON.parse(a)}),O(B,"--");break;case"mouseenter":g("onMouseEnter");break;case"mouseleave":g("onMouseLeave");break;case"autoResize":f[B].autoResize=JSON.parse(r(9));break;case"scrollTo":m(!1);break;case"scrollToOffset":m(!0);break;case"pageInfo":d(f[B]&&f[B].iframe,B),function(){function e(e,o){function i(){f[t]?d(f[t].iframe,t):n()}["scroll","resize"].forEach((function(n){O(t,e+n+" listener for sendPageInfo"),o(window,n,i)}))}function n(){e("Remove ",v)}var t=B;e("Add ",w),f[t]&&(f[t].stopPageInfo=n)}();break;case"pageInfoStop":f[B]&&f[B].stopPageInfo&&(f[B].stopPageInfo(),delete f[B].stopPageInfo);break;case"inPageLink":t=r(9).split("#")[1]||"",o=decodeURIComponent(t),(i=document.getElementById(o)||document.getElementsByName(o)[0])?(e=l(i),O(B,"Moving to in page link (#"+t+") at x: "+e.x+" y: "+e.y),s={x:e.x,y:e.y},p(),O(B,"--")):window.top!==window.self?window.parentIFrame?window.parentIFrame.moveToAnchor(t):O(B,"In page link #"+t+" not found and window.parentIFrame not found"):O(B,"In page link #"+t+" not found");break;case"reset":z(U);break;case"init":n(),b("onInit",U.iframe);break;default:0===Number(U.width)&&0===Number(U.height)?T("Unsupported message received ("+U.type+"), this is likely due to the iframe containing a later version of iframe-resizer than the parent page"):n()}var e,t,o,i,a}())):E(B,"Ignored: "+H)}function I(e,n,t){var o=null,i=null;if(f[e]){if("function"!=typeof(o=f[e][n]))throw new TypeError(n+" on iFrame["+e+"] is not a function");i=o(t)}return i}function k(e){var n=e.id;delete f[n]}function R(e){var n=e.id;if(!1!==I(n,"onClose",n)){O(n,"Removing iFrame: "+n);try{e.parentNode&&e.parentNode.removeChild(e)}catch(e){T(e)}I(n,"onClosed",n),O(n,"--"),k(e)}else O(n,"Close iframe cancelled by onClose event")}function S(e){null===s&&O(e,"Get page position: "+(s={x:window.pageXOffset!==n?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==n?window.pageYOffset:document.documentElement.scrollTop}).x+","+s.y)}function P(e){null!==s&&(window.scrollTo(s.x,s.y),O(e,"Set page position: "+s.x+","+s.y),C())}function C(){s=null}function z(e){O(e.id,"Size reset requested by "+("init"===e.type?"host page":"iFrame")),S(e.id),F((function(){N(e),A("reset","reset",e.iframe,e.id)}),e,"reset")}function N(e){function n(n){r||"0"!==e[n]||(r=!0,O(o,"Hidden iFrame detected, creating visibility listener"),function(){function e(){function e(e){function n(n){return"0px"===(f[e]&&f[e].iframe.style[n])}function t(e){return null!==e.offsetParent}f[e]&&t(f[e].iframe)&&(n("height")||n("width"))&&A("Visibility change","resize",f[e].iframe,e)}Object.keys(f).forEach((function(n){e(n)}))}function n(n){O("window","Mutation observed: "+n[0].target+" "+n[0].type),W(e,16)}function t(){var e=document.querySelector("body"),t={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0};new o(n).observe(e,t)}var o=g();o&&t()}())}function t(t){!function(n){e.id?(e.iframe.style[n]=e[n]+"px",O(e.id,"IFrame ("+o+") "+n+" set to "+e[n]+"px")):O("undefined","messageData id not set")}(t),n(t)}var o=e.iframe.id;f[o]&&(f[o].sizeHeight&&t("height"),f[o].sizeWidth&&t("width"))}function F(e,n,t){t!==n.type&&d&&!window.jasmine?(O(n.id,"Requesting animation frame"),d(e)):e()}function A(e,n,t,o,i){var r,a=!1;o=o||t.id,f[o]&&(t&&"contentWindow"in t&&null!==t.contentWindow?(r=f[o]&&f[o].targetOrigin,O(o,"["+e+"] Sending msg to iframe["+o+"] ("+n+") targetOrigin: "+r),t.contentWindow.postMessage(c+n,r)):T(o,"["+e+"] IFrame("+o+") not found"),i&&f[o]&&f[o].warningTimeout&&(f[o].msgTimeout=setTimeout((function(){!f[o]||f[o].loaded||a||(a=!0,T(o,"IFrame has not responded within "+f[o].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))}),f[o].warningTimeout)))}function j(e){return e+":"+f[e].bodyMarginV1+":"+f[e].sizeWidth+":"+f[e].log+":"+f[e].interval+":"+f[e].enablePublicMethods+":"+f[e].autoResize+":"+f[e].bodyMargin+":"+f[e].heightCalculationMethod+":"+f[e].bodyBackground+":"+f[e].bodyPadding+":"+f[e].tolerance+":"+f[e].inPageLinks+":"+f[e].resizeFrom+":"+f[e].widthCalculationMethod+":"+f[e].mouseEvents}function L(e,t){function r(e){var n=e.split("Callback");if(2===n.length){var t="on"+n[0].charAt(0).toUpperCase()+n[0].slice(1);this[t]=this[e],delete this[e],T(u,"Deprecated: '"+e+"' has been renamed '"+t+"'. The old method will be removed in the next major version.")}}var a,c,u=function(n){var r;return""===n&&(e.id=(r=t&&t.id||p.id+o++,null!==document.getElementById(r)&&(r+=o++),n=r),i=(t||{}).log,O(n,"Added missing iframe ID: "+n+" ("+e.src+")")),n}(e.id);u in f&&"iFrameResizer"in e?T(u,"Ignored iFrame, already setup."):(!function(n){var t;n=n||{},f[u]={firstRun:!0,iframe:e,remoteHost:e.src&&e.src.split("/").slice(0,3).join("/")},function(e){if("object"!=typeof e)throw new TypeError("Options is not an object")}(n),Object.keys(n).forEach(r,n),function(e){for(var n in p)Object.prototype.hasOwnProperty.call(p,n)&&(f[u][n]=Object.prototype.hasOwnProperty.call(e,n)?e[n]:p[n])}(n),f[u]&&(f[u].targetOrigin=!0===f[u].checkOrigin?""===(t=f[u].remoteHost)||null!==t.match(/^(about:blank|javascript:|file:\/\/)/)?"*":t:"*")}(t),function(){switch(O(u,"IFrame scrolling "+(f[u]&&f[u].scrolling?"enabled":"disabled")+" for "+u),e.style.overflow=!1===(f[u]&&f[u].scrolling)?"hidden":"auto",f[u]&&f[u].scrolling){case"omit":break;case!0:e.scrolling="yes";break;case!1:e.scrolling="no";break;default:e.scrolling=f[u]?f[u].scrolling:"no"}}(),function(){function n(n){var t=f[u][n];1/0!==t&&0!==t&&(e.style[n]="number"==typeof t?t+"px":t,O(u,"Set "+n+" = "+e.style[n]))}function t(e){if(f[u]["min"+e]>f[u]["max"+e])throw new Error("Value for min"+e+" can not be greater than max"+e)}t("Height"),t("Width"),n("maxHeight"),n("minHeight"),n("maxWidth"),n("minWidth")}(),"number"!=typeof(f[u]&&f[u].bodyMargin)&&"0"!==(f[u]&&f[u].bodyMargin)||(f[u].bodyMarginV1=f[u].bodyMargin,f[u].bodyMargin=f[u].bodyMargin+"px"),a=j(u),(c=g())&&function(n){e.parentNode&&new n((function(n){n.forEach((function(n){Array.prototype.slice.call(n.removedNodes).forEach((function(n){n===e&&R(e)}))}))})).observe(e.parentNode,{childList:!0})}(c),w(e,"load",(function(){var t,o;A("iFrame.onload",a,e,n,!0),t=f[u]&&f[u].firstRun,o=f[u]&&f[u].heightCalculationMethod in l,!t&&o&&z({iframe:e,height:0,width:0,type:"init"})})),A("init",a,e,n,!0),f[u]&&(f[u].iframe.iFrameResizer={close:R.bind(null,f[u].iframe),removeListeners:k.bind(null,f[u].iframe),resize:A.bind(null,"Window resize","resize",f[u].iframe),moveToAnchor:function(e){A("Move to anchor","moveToAnchor:"+e,f[u].iframe,u)},sendMessage:function(e){A("Send Message","message:"+(e=JSON.stringify(e)),f[u].iframe,u)}}))}function W(e,n){null===m&&(m=setTimeout((function(){m=null,e()}),n))}function H(){"hidden"!==document.visibilityState&&(O("document","Trigger event: Visiblity change"),W((function(){U("Tab Visable","resize")}),16))}function U(e,n){Object.keys(f).forEach((function(t){(function(e){return f[e]&&"parent"===f[e].resizeFrom&&f[e].autoResize&&!f[e].firstRun})(t)&&A(e,n,f[t].iframe,t)}))}function B(){w(window,"message",x),w(window,"resize",(function(){var e;O("window","Trigger event: "+(e="resize")),W((function(){U("Window "+e,"resize")}),16)})),w(document,"visibilitychange",H),w(document,"-webkit-visibilitychange",H)}function D(){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 <IFRAME> tag, found <"+n.tagName+">")}(),L(n,e),t.push(n))}var t;return function(){var e,n=["moz","webkit","o","ms"];for(e=0;e<n.length&&!d;e+=1)d=window[n[e]+"RequestAnimationFrame"];d?d=d.bind(window):O("setup","RequestAnimationFrame not supported")}(),B(),function(o,i){switch(t=[],function(e){e&&e.enablePublicMethods&&T("enablePublicMethods option has been removed, public methods are now always available in the iFrame")}(o),typeof i){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(i||"iframe"),e.bind(n,o));break;case"object":e(o,i);break;default:throw new TypeError("Unexpected data type ("+typeof i+")")}return t}}}()}(h);var g={exports:{}};!function(e){!function(n){if("undefined"!=typeof window){var t=!0,o="",i=0,r="",a=null,c="",u=!1,s={resize:1,click:1},d=128,l=!0,f=1,m="bodyOffset",p=m,h=!0,g="",w={},v=32,b=null,y=!1,O=!1,E="[iFrameSizer]",T=E.length,M="",x={max:1,min:1,bodyScroll:1,documentElementScroll:1},I="child",k=window.parent,R="*",S=0,P=!1,C=null,z=16,N=1,F="scroll",A=F,j=window,L=function(){re("onMessage function not defined")},W=function(){},H=function(){},U={height:function(){return re("Custom height calculation function not defined"),document.documentElement.offsetHeight},width:function(){return re("Custom width calculation function not defined"),document.body.scrollWidth}},B={},D=!1;try{var q=Object.create({},{passive:{get:function(){D=!0}}});window.addEventListener("test",ee,q),window.removeEventListener("test",ee,q)}catch(e){}var V,X,_,J,Y,Q,K,G={bodyOffset:function(){return document.body.offsetHeight+ge("marginTop")+ge("marginBottom")},offset:function(){return G.bodyOffset()},bodyScroll:function(){return document.body.scrollHeight},custom:function(){return U.height()},documentElementOffset:function(){return document.documentElement.offsetHeight},documentElementScroll:function(){return document.documentElement.scrollHeight},max:function(){return Math.max.apply(null,ve(G))},min:function(){return Math.min.apply(null,ve(G))},grow:function(){return G.max()},lowestElement:function(){return Math.max(G.bodyOffset()||G.documentElementOffset(),we("bottom",ye()))},taggedElement:function(){return be("bottom","data-iframe-height")}},Z={bodyScroll:function(){return document.body.scrollWidth},bodyOffset:function(){return document.body.offsetWidth},custom:function(){return U.width()},documentElementScroll:function(){return document.documentElement.scrollWidth},documentElementOffset:function(){return document.documentElement.offsetWidth},scroll:function(){return Math.max(Z.bodyScroll(),Z.documentElementScroll())},max:function(){return Math.max.apply(null,ve(Z))},min:function(){return Math.min.apply(null,ve(Z))},rightMostElement:function(){return we("right",ye())},taggedElement:function(){return be("right","data-iframe-width")}},$=(V=Oe,Y=null,Q=0,K=function(){Q=Date.now(),Y=null,J=V.apply(X,_),Y||(X=_=null)},function(){var e=Date.now();Q||(Q=e);var n=z-(e-Q);return X=this,_=arguments,n<=0||n>z?(Y&&(clearTimeout(Y),Y=null),Q=e,J=V.apply(X,_),Y||(X=_=null)):Y||(Y=setTimeout(K,n)),J});ne(window,"message",(function(n){var t={init:function(){g=n.data,k=n.source,ae(),l=!1,setTimeout((function(){h=!1}),d)},reset:function(){h?ie("Page reset ignored by init"):(ie("Page size reset by host page"),Me("resetPage"))},resize:function(){Ee("resizeParent","Parent window requested size check")},moveToAnchor:function(){w.findTarget(i())},inPageLink:function(){this.moveToAnchor()},pageInfo:function(){var e=i();ie("PageInfoFromParent called from parent: "+e),H(JSON.parse(e)),ie(" --")},message:function(){var e=i();ie("onMessage called from parent: "+e),L(JSON.parse(e)),ie(" --")}};function o(){return n.data.split("]")[1].split(":")[0]}function i(){return n.data.substr(n.data.indexOf(":")+1)}function r(){return n.data.split(":")[2]in{true:1,false:1}}function a(){var i=o();i in t?t[i]():!e.exports&&"iFrameResize"in window||"jQuery"in window&&"iFrameResize"in window.jQuery.prototype||r()||re("Unexpected message ("+n.data+")")}E===(""+n.data).substr(0,T)&&(!1===l?a():r()?t.init():ie('Ignored message of type "'+o()+'". Received before initialization.'))})),ne(window,"readystatechange",ke),ke()}function ee(){}function ne(e,n,t,o){e.addEventListener(n,t,!!D&&(o||{}))}function te(e){return e.charAt(0).toUpperCase()+e.slice(1)}function oe(e){return E+"["+M+"] "+e}function ie(e){y&&"object"==typeof window.console&&console.log(oe(e))}function re(e){"object"==typeof window.console&&console.warn(oe(e))}function ae(){var e;!function(){function e(e){return"true"===e}var a=g.substr(T).split(":");M=a[0],i=n!==a[1]?Number(a[1]):i,u=n!==a[2]?e(a[2]):u,y=n!==a[3]?e(a[3]):y,v=n!==a[4]?Number(a[4]):v,t=n!==a[6]?e(a[6]):t,r=a[7],p=n!==a[8]?a[8]:p,o=a[9],c=a[10],S=n!==a[11]?Number(a[11]):S,w.enable=n!==a[12]&&e(a[12]),I=n!==a[13]?a[13]:I,A=n!==a[14]?a[14]:A,O=n!==a[15]?Boolean(a[15]):O}(),ie("Initialising iFrame ("+window.location.href+")"),function(){function e(){var e=window.iFrameResizer;ie("Reading data from page: "+JSON.stringify(e)),Object.keys(e).forEach(ce,e),L="onMessage"in e?e.onMessage:L,W="onReady"in e?e.onReady:W,R="targetOrigin"in e?e.targetOrigin:R,p="heightCalculationMethod"in e?e.heightCalculationMethod:p,A="widthCalculationMethod"in e?e.widthCalculationMethod:A}function n(e,n){return"function"==typeof e&&(ie("Setup custom "+n+"CalcMethod"),U[n]=e,e="custom"),e}"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(e(),p=n(p,"height"),A=n(A,"width"));ie("TargetOrigin for parent set to: "+R)}(),function(){n===r&&(r=i+"px");ue("margin",function(e,n){-1!==n.indexOf("-")&&(re("Negative CSS value ignored for "+e),n="");return n}("margin",r))}(),ue("background",o),ue("padding",c),(e=document.createElement("div")).style.clear="both",e.style.display="block",e.style.height="0",document.body.appendChild(e),fe(),me(),document.documentElement.style.height="",document.body.style.height="",ie('HTML & body height set to "auto"'),ie("Enable public methods"),j.parentIFrame={autoResize:function(e){return!0===e&&!1===t?(t=!0,pe()):!1===e&&!0===t&&(t=!1,de("remove"),null!==a&&a.disconnect(),clearInterval(b)),Ie(0,0,"autoResize",JSON.stringify(t)),t},close:function(){Ie(0,0,"close")},getId:function(){return M},getPageInfo:function(e){"function"==typeof e?(H=e,Ie(0,0,"pageInfo")):(H=function(){},Ie(0,0,"pageInfoStop"))},moveToAnchor:function(e){w.findTarget(e)},reset:function(){xe("parentIFrame.reset")},scrollTo:function(e,n){Ie(n,e,"scrollTo")},scrollToOffset:function(e,n){Ie(n,e,"scrollToOffset")},sendMessage:function(e,n){Ie(0,0,"message",JSON.stringify(e),n)},setHeightCalculationMethod:function(e){p=e,fe()},setWidthCalculationMethod:function(e){A=e,me()},setTargetOrigin:function(e){ie("Set targetOrigin: "+e),R=e},size:function(e,n){Ee("size","parentIFrame.size("+(e||"")+(n?","+n:"")+")",e,n)}},function(){if(!0!==O)return;function e(e){Ie(0,0,e.type,e.screenY+":"+e.screenX)}function n(n,t){ie("Add event listener: "+t),ne(window.document,n,e)}n("mouseenter","Mouse Enter"),n("mouseleave","Mouse Leave")}(),pe(),w=function(){function e(){return{x:window.pageXOffset!==n?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==n?window.pageYOffset:document.documentElement.scrollTop}}function t(n){var t=n.getBoundingClientRect(),o=e();return{x:parseInt(t.left,10)+parseInt(o.x,10),y:parseInt(t.top,10)+parseInt(o.y,10)}}function o(e){function o(e){var n=t(e);ie("Moving to in page link (#"+i+") at x: "+n.x+" y: "+n.y),Ie(n.y,n.x,"scrollToOffset")}var i=e.split("#")[1]||e,r=decodeURIComponent(i),a=document.getElementById(r)||document.getElementsByName(r)[0];n!==a?o(a):(ie("In page link (#"+i+") not found in iFrame, so sending to parent"),Ie(0,0,"inPageLink","#"+i))}function i(){var e=window.location.hash,n=window.location.href;""!==e&&"#"!==e&&o(n)}function r(){function e(e){function n(e){e.preventDefault(),o(this.getAttribute("href"))}"#"!==e.getAttribute("href")&&ne(e,"click",n)}Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),e)}function a(){ne(window,"hashchange",i)}function c(){setTimeout(i,d)}function u(){Array.prototype.forEach&&document.querySelectorAll?(ie("Setting up location.hash handlers"),r(),a(),c()):re("In page linking not fully supported in this browser! (See README.md for IE8 workaround)")}w.enable?u():ie("In page linking not enabled");return{findTarget:o}}(),Ee("init","Init message from host page"),W()}function ce(e){var n=e.split("Callback");if(2===n.length){var t="on"+n[0].charAt(0).toUpperCase()+n[0].slice(1);this[t]=this[e],delete this[e],re("Deprecated: '"+e+"' has been renamed '"+t+"'. The old method will be removed in the next major version.")}}function ue(e,t){n!==t&&""!==t&&"null"!==t&&(document.body.style[e]=t,ie("Body "+e+' set to "'+t+'"'))}function se(e){var n={add:function(n){function t(){Ee(e.eventName,e.eventType)}B[n]=t,ne(window,n,t,{passive:!0})},remove:function(e){var n,t,o,i=B[e];delete B[e],n=window,t=e,o=i,n.removeEventListener(t,o,!1)}};e.eventNames&&Array.prototype.map?(e.eventName=e.eventNames[0],e.eventNames.map(n[e.method])):n[e.method](e.eventName),ie(te(e.method)+" event listener: "+e.eventType)}function de(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"===I&&se({method:e,eventType:"IFrame Resized",eventName:"resize"})}function le(e,n,t,o){return n!==e&&(e in t||(re(e+" is not a valid option for "+o+"CalculationMethod."),e=n),ie(o+' calculation method set to "'+e+'"')),e}function fe(){p=le(p,m,G,"height")}function me(){A=le(A,F,Z,"width")}function pe(){var e;!0===t?(de("add"),e=0>v,window.MutationObserver||window.WebKitMutationObserver?e?he():a=function(){function e(e){function n(e){!1===e.complete&&(ie("Attach listeners to "+e.src),e.addEventListener("load",i,!1),e.addEventListener("error",r,!1),u.push(e))}"attributes"===e.type&&"src"===e.attributeName?n(e.target):"childList"===e.type&&Array.prototype.forEach.call(e.target.querySelectorAll("img"),n)}function n(e){u.splice(u.indexOf(e),1)}function t(e){ie("Remove listeners from "+e.src),e.removeEventListener("load",i,!1),e.removeEventListener("error",r,!1),n(e)}function o(e,n,o){t(e.target),Ee(n,o+": "+e.target.src)}function i(e){o(e,"imageLoad","Image loaded")}function r(e){o(e,"imageLoadFailed","Image load failed")}function a(n){Ee("mutationObserver","mutationObserver: "+n[0].target+" "+n[0].type),n.forEach(e)}function c(){var e=document.querySelector("body"),n={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0};return d=new s(a),ie("Create body MutationObserver"),d.observe(e,n),d}var u=[],s=window.MutationObserver||window.WebKitMutationObserver,d=c();return{disconnect:function(){"disconnect"in d&&(ie("Disconnect body MutationObserver"),d.disconnect(),u.forEach(t))}}}():(ie("MutationObserver not supported in this browser!"),he())):ie("Auto Resize disabled")}function he(){0!==v&&(ie("setInterval: "+v+"ms"),b=setInterval((function(){Ee("interval","setInterval: "+v)}),Math.abs(v)))}function ge(e,n){var t=0;return n=n||document.body,t=null!==(t=document.defaultView.getComputedStyle(n,null))?t[e]:0,parseInt(t,10)}function we(e,n){for(var t=n.length,o=0,i=0,r=te(e),a=Date.now(),c=0;c<t;c++)(o=n[c].getBoundingClientRect()[e]+ge("margin"+r,n[c]))>i&&(i=o);return a=Date.now()-a,ie("Parsed "+t+" HTML elements"),ie("Element position calculated in "+a+"ms"),function(e){e>z/2&&ie("Event throttle increased to "+(z=2*e)+"ms")}(a),i}function ve(e){return[e.bodyOffset(),e.bodyScroll(),e.documentElementOffset(),e.documentElementScroll()]}function be(e,n){var t=document.querySelectorAll("["+n+"]");return 0===t.length&&(re("No tagged elements ("+n+") found on page"),document.querySelectorAll("body *")),we(e,t)}function ye(){return document.querySelectorAll("body *")}function Oe(e,t,o,i){var r,a;!function(){function e(e,n){return!(Math.abs(e-n)<=S)}return r=n!==o?o:G[p](),a=n!==i?i:Z[A](),e(f,r)||u&&e(N,a)}()&&"init"!==e?!(e in{init:1,interval:1,size:1})&&(p in x||u&&A in x)?xe(t):e in{interval:1}||ie("No change in size detected"):(Te(),Ie(f=r,N=a,e))}function Ee(e,n,t,o){P&&e in s?ie("Trigger event cancelled: "+e):(e in{reset:1,resetPage:1,init:1}||ie("Trigger event: "+n),"init"===e?Oe(e,n,t,o):$(e,n,t,o))}function Te(){P||(P=!0,ie("Trigger event lock on")),clearTimeout(C),C=setTimeout((function(){P=!1,ie("Trigger event lock off"),ie("--")}),d)}function Me(e){f=G[p](),N=Z[A](),Ie(f,N,e)}function xe(e){var n=p;p=m,ie("Reset trigger event: "+e),Te(),Me("reset"),p=n}function Ie(e,t,o,i,r){var a;n===r?r=R:ie("Message targetOrigin: "+r),ie("Sending message to host page ("+(a=M+":"+e+":"+t+":"+o+(n!==i?":"+i:""))+")"),k.postMessage(E+a,r)}function ke(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}}()}(g);var w=h.exports;p.iframeResize=w,p.iframeResizer=w,p.iframeResizerContentWindow=g.exports;var v=p,b=function(e){var n=e.target,t=e.token,o=e.approvalPageUrl,i=e.flow,r=document.createElement("form"),a=document.createElement("input"),c=document.createElement("input"),u=document.createElement("input"),s=document.createElement("input");return r.style.display="none",n&&(r.target=n),r.method="POST",r.action=o,a.value=t,a.name="ott",r.appendChild(a),c.value="0.9.2",c.name="libVersion",r.appendChild(c),u.value=window.location.hostname,u.name="parentHostname",r.appendChild(u),s.value=i,s.name="flow",r.appendChild(s),r};var y;var O={IFRAME:"iframe",TAB:"tab",POPUP:"popup"},E={PRODUCTION:"production",SANDBOX:"sandbox"},T=(i(y={},O.IFRAME,(function(e){var n,t,o=e.token,i=e.approvalPageUrl,r=e.resolve,a=e.reject;document.getElementById("tw-approve-api-action-styles")||(n=document.head,(t=document.createElement("style")).id="tw-approve-api-action-styles",t.appendChild(document.createTextNode("\n .tw-approval-modal-overlay {\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n height: 100%;\n width: 100%;\n background: rgba(55,81,126,0);\n transition: background-color .35s cubic-bezier(0,.94,.62,1);\n z-index: 1050;\n }\n .tw-approval-modal-overlay--open {\n background: rgba(55,81,126,0.8);\n }\n .tw-approval-modal-wrapper {\n height: 100%;\n width: 100vw;\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 16px;\n }\n .tw-approval-modal {\n display: flex;\n max-height: 100%;\n width: 540px;\n background-color: #fff;\n border-radius: 3px;\n box-shadow: 0 5px 15px rgba(0,0,0,.2);\n overflow: auto;\n }\n .tw-approval-modal iframe {\n width: 100%;\n height: 520px;\n transition: height 0.1s ease-in-out;\n }\n")),n.appendChild(t));var c=document.createElement("div");c.id="tw-approval-modal-overlay",c.classList.add("tw-approval-modal-overlay");var u=document.createElement("div");u.classList.add("tw-approval-modal-wrapper"),c.appendChild(u);var s=document.createElement("div");s.classList.add("tw-approval-modal"),u.appendChild(s);var d=document.createElement("iframe");d.name="tw-approve-api-action",d.style.border="0",s.appendChild(d);var p=b({token:o,approvalPageUrl:i,flow:"iframe"});s.appendChild(p),document.body.appendChild(c),v.iframeResize({checkOrigin:!1,minHeight:400},d),c.classList.add("tw-approval-modal-overlay--open"),p.setAttribute("target","tw-approve-api-action"),p.submit();var h=function(e){switch(e.data){case l:return g(),void r();case f:return g(),void a();case m:g()}},g=function(){d.src="about:blank";var e=document.getElementById("tw-approval-modal-overlay");e.parentNode.removeChild(e),window.removeEventListener("message",h)};c.addEventListener("click",g,{once:!0}),window.addEventListener("message",h)})),i(y,O.TAB,(function(e){var n=e.token,t=e.approvalPageUrl,o=e.resolve,i=e.reject,r="tw-approve-api-action",a=b({target:r,token:n,approvalPageUrl:t,flow:"tab"});document.body.appendChild(a);var c=window.open(t,r);a.submit();var u=function(e){switch(e.data){case l:return s(),void o();case f:return s(),void i();case m:s()}},s=function(){c.close(),window.removeEventListener("message",u)};window.addEventListener("message",u)})),i(y,O.POPUP,(function(e){var n=e.token,t=e.approvalPageUrl,o=e.resolve,i=e.reject,r="tw-approve-api-action",a=b({target:r,token:n,approvalPageUrl:t,flow:"popup"});document.body.appendChild(a);var c=function(){var e=void 0!==window.screenLeft?window.screenLeft:window.screenX,n=void 0!==window.screenTop?window.screenTop:window.screenY,t=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,o=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,i=t/window.screen.availWidth;return{width:580/i,height:600/i,top:(o-600)/2/i+n,left:(t-580)/2/i+e}}(),u=c.width,s=c.height,d=c.top,p=c.left,h=window.open(t,r,"resizable,scrollbars,status,location,width=".concat(u,",height=").concat(s,",top=").concat(d,",left=").concat(p));a.submit(),h.focus&&h.focus();var g=function(e){switch(e.data){case l:return w(),void o();case f:return w(),void i();case m:w()}},w=function(){h.close(),window.removeEventListener("message",g)};window.addEventListener("message",g)})),y),M=function(e){return e===E.SANDBOX?"https://sandbox.transferwise.tech/approve-api-action/":"https://wise.com/approve-api-action/"};function x(e){var n=e.token,t=e.flow,o=void 0===t?O.IFRAME:t,i=e.mode,r=void 0===i?E.PRODUCTION:i,a=e.approvalPageUrl;return new Promise((function(e,t){var i={token:n,approvalPageUrl:a||M(r),resolve:e,reject:t};T[o](i)}))}var I=function(e){!function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");Object.defineProperty(e,"prototype",{value:Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),writable:!1}),n&&a(e,n)}(f,e);var n,t,i,u,s,l=(n=f,t=c(),function(){var e,o=r(n);if(t){var i=r(this).constructor;e=Reflect.construct(o,arguments,i)}else e=o.apply(this,arguments);return d(this,e)});function f(e){var n;return function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,f),(n=l.call(this,e.statusText)).name="HTTPError",n.response=e,n}return i=f,u&&o(i.prototype,u),s&&o(i,s),Object.defineProperty(i,"prototype",{writable:!1}),i}(s(Error));function k(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return fetch(e,t(t({},n),{},{headers:t(t({},{"Content-Type":"application/json"}),n.headers)})).then((function(e){if(!e.ok)throw new I(e);return e}))}function R(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){};e()}function S(e){if(!e||!e.response)return!1;var n=P(e.response),t=e.response.status;return(403===t||400===t)&&n}function P(e){return e&&e.headers&&e.headers.get?e.headers.get("X-2FA-APPROVAL"):null}e.Flow=O,e.Mode=E,e.create=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(n){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return k(n,o).then((function(e){return{response:e,metadata:{scaRequired:!1}}})).catch((function(i){if(S(i)){var r=P(i.response);return R(e.onSCARequired),x({token:r,flow:e.flow,mode:e.mode,approvalPageUrl:e.approvalPageUrl}).then((function(){R(e.onSCACompleted);var i=t(t({},o.headers||{}),{},{"X-2FA-APPROVAL":r});return k(n,t(t({},o),{},{headers:i})).then((function(e){return{response:e,metadata:{scaRequired:!0}}}))}))}throw i})).then((function(e){return o&&o.withMetadata?e:e.response}))}},e.runFlow=x,Object.defineProperty(e,"__esModule",{value:!0})}));
{
"name": "@transferwise/approve-api-action-helpers",
"version": "0.9.1",
"version": "0.9.2",
"description": "An http client that handles SCA required requests gracefully",

@@ -33,32 +33,42 @@ "main": "dist/main.js",

"devDependencies": {
"@babel/core": "^7.14.6",
"@babel/preset-env": "^7.14.7",
"@babel/core": "^7.16.5",
"@babel/preset-env": "^7.16.5",
"@next/eslint-plugin-next": "^12.0.7",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^19.0.1",
"@rollup/plugin-node-resolve": "^13.0.2",
"@transferwise/eslint-config": "^6.2.0",
"@transferwise/eslint-plugin": "^0.1.1",
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-node-resolve": "^13.1.1",
"@transferwise/eslint-config": "^7.4.2",
"@transferwise/eslint-plugin": "^0.2.1",
"@typescript-eslint/eslint-plugin": "^5.7.0",
"babel-eslint": "^10.0.2",
"babel-jest": "^27.0.6",
"babel-loader": "^8.2.2",
"core-js": "^3.15.2",
"es-check": "^5.2.4",
"eslint": "^7.31.0",
"babel-jest": "^27.4.5",
"babel-loader": "^8.2.3",
"core-js": "^3.20.0",
"es-check": "^6.1.1",
"eslint": "^8.5.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-fp": "^2.3.0",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jest": "^25.3.0",
"eslint-plugin-jest-dom": "^3.9.2",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.27.1",
"eslint-plugin-react-hooks": "^4.3.0",
"eslint-plugin-sonarjs": "^0.11.0",
"eslint-plugin-testing-library": "^5.0.1",
"eslint-plugin-unicorn": "^39.0.0",
"file-loader": "^6.2.0",
"husky": "^7.0.1",
"husky": "^7.0.4",
"iframe-resizer": "^4.3.2",
"jest": "^27.0.6",
"jest": "^27.4.5",
"jest-fetch-mock": "^3.0.3",
"lint-staged": "^11.0.1",
"prettier": "^2.3.2",
"rollup": "^2.53.2",
"lint-staged": "^12.1.3",
"prettier": "^2.5.1",
"rollup": "^2.61.1",
"rollup-plugin-babel-minify": "^10.0.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-version-injector": "^1.3.3"
"rollup-plugin-version-injector": "^1.3.3",
"typescript": "^4.5.4"
},

@@ -65,0 +75,0 @@ "lint-staged": {

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

import { APPROVAL_PAGE_URL_PRODUCTION, APPROVAL_PAGE_URL_SANDBOX } from './config';
import { iframeFlow } from './iframeFlow';
import { popupFlow } from './popupFlow';
import { tabFlow } from './tabFlow';
import { popupFlow } from './popupFlow';
import { APPROVAL_PAGE_URL_PRODUCTION, APPROVAL_PAGE_URL_SANDBOX } from './config';

@@ -6,0 +6,0 @@ export const Flow = {

/* eslint-disable fp/no-mutation */
/* eslint-disable unicorn/prefer-dom-node-append */
export const createForm = ({ target, token, approvalPageUrl, flow }) => {
const form = document.createElement('form');
const ottInput = document.createElement('input');
const libVersionInput = document.createElement('input');
const libraryVersionInput = document.createElement('input');
const parentHostnameInput = document.createElement('input');

@@ -17,5 +18,5 @@ const flowInput = document.createElement('input');

form.appendChild(ottInput);
libVersionInput.value = '[VI]{version}[/VI]'; // rollup injects version from package.json
libVersionInput.name = 'libVersion';
form.appendChild(libVersionInput);
libraryVersionInput.value = '[VI]{version}[/VI]'; // rollup injects version from package.json
libraryVersionInput.name = 'libVersion';
form.appendChild(libraryVersionInput);
parentHostnameInput.value = window.location.hostname;

@@ -22,0 +23,0 @@ parentHostnameInput.name = 'parentHostname';

@@ -7,2 +7,3 @@ import { http } from './http';

const resJson = jest.fn(() => 'parsed json');
// eslint-disable-next-line jest/prefer-lowercase-title
describe('HTTP Client', () => {

@@ -19,2 +20,3 @@ beforeEach(() => {

// eslint-disable-next-line jest/no-standalone-expect
expect(fetch).not.toHaveBeenCalled();

@@ -62,5 +64,5 @@ });

}),
).rejects.toThrowError();
).rejects.toThrow(); // eslint-disable-line jest/require-to-throw-message
});
});
});
/* eslint-disable fp/no-mutation */
// eslint-disable-next-line import/no-extraneous-dependencies
/* eslint-disable unicorn/prefer-dom-node-append */
import { iframeResize } from 'iframe-resizer';
import { MESSAGE_SUCCESS, MESSAGE_FAILED, MESSAGE_CLOSED } from './config';

@@ -56,2 +57,3 @@ import { createForm } from './createForm';

export function iframeFlow({ token, approvalPageUrl, resolve, reject }) {
// eslint-disable-next-line unicorn/prefer-query-selector
if (!document.getElementById('tw-approve-api-action-styles')) {

@@ -62,2 +64,3 @@ addStylesheet();

const overlay = document.createElement('div');
// eslint-disable-next-line sonarjs/no-duplicate-string
overlay.id = 'tw-approval-modal-overlay';

@@ -109,3 +112,5 @@ overlay.classList.add('tw-approval-modal-overlay');

iframe.src = 'about:blank';
// eslint-disable-next-line unicorn/prefer-query-selector
const overlayElement = document.getElementById('tw-approval-modal-overlay');
// eslint-disable-next-line unicorn/prefer-dom-node-remove
overlayElement.parentNode.removeChild(overlayElement);

@@ -112,0 +117,0 @@ window.removeEventListener('message', handleEvents);

@@ -20,9 +20,9 @@ /* eslint-disable fp/no-mutation */

// cleanup JSDOM document, because jest doesn't do it after each run. https://stackoverflow.com/a/50800473
document.getElementsByTagName('html')[0].innerHTML = '';
document.querySelectorAll('html')[0].innerHTML = '';
});
it('adds stylesheet', () => {
expect(document.getElementById('tw-approve-api-action-styles')).toBeFalsy();
expect(document.querySelector('#tw-approve-api-action-styles')).toBeFalsy();
iframeFlow({ token: 'a1b2' });
expect(document.getElementById('tw-approve-api-action-styles')).toBeTruthy();
expect(document.querySelector('#tw-approve-api-action-styles')).toBeTruthy();
});

@@ -45,4 +45,5 @@

expect(form.action).toBe('https://a.a/');
// eslint-disable-next-line jest/prefer-called-with
expect(submit).toHaveBeenCalled();
});
});

@@ -41,2 +41,3 @@ /* eslint-disable fp/no-mutation */

const form = createForm({ target: name, token, approvalPageUrl, flow: 'popup' });
// eslint-disable-next-line unicorn/prefer-dom-node-append
document.body.appendChild(form);

@@ -43,0 +44,0 @@

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

import { runFlow } from './authenticationFlow';
import { http } from './http';
import { runFlow } from './authenticationFlow';

@@ -39,4 +39,4 @@ export function create(config = {}) {

function callback(func = () => {}) {
func();
function callback(function_ = () => {}) {
function_();
}

@@ -43,0 +43,0 @@

/* eslint-disable fp/no-mutation */
import { Flow, Mode, runFlow } from './authenticationFlow';
import { http } from './http';
import { Flow, Mode, runFlow } from './authenticationFlow';
import { create } from './request';

@@ -9,2 +9,3 @@

// eslint-disable-next-line jest/prefer-lowercase-title
describe('SCA request wrapper', () => {

@@ -24,3 +25,3 @@ let request;

expect(http).toHaveBeenCalledWith('https://example.com', params);
expect(response).toEqual({ response: true });
expect(response).toStrictEqual({ response: true });
});

@@ -35,2 +36,3 @@

} catch (error) {
// eslint-disable-next-line jest/no-conditional-expect
expect(error.response.test).toBe(true);

@@ -88,3 +90,3 @@ }

);
expect(result).toEqual({ secondCall: true });
expect(result).toStrictEqual({ secondCall: true });
});

@@ -97,2 +99,3 @@

await request('https://example.com');
// eslint-disable-next-line jest/prefer-called-with
expect(onSCARequired).toHaveBeenCalled();

@@ -106,2 +109,3 @@ });

await request('https://example.com');
// eslint-disable-next-line jest/prefer-called-with
expect(onSCACompleted).toHaveBeenCalled();

@@ -117,3 +121,3 @@ });

const response = await request('https://example.com', params);
expect(response).toEqual({
expect(response).toStrictEqual({
metadata: { scaRequired: false },

@@ -125,2 +129,3 @@ response: { response: true },

it('returns that sca was triggered for requests where sca was used', async () => {
// eslint-disable-next-line sonarjs/no-identical-functions
http.mockImplementation(() =>

@@ -137,3 +142,3 @@ Promise.reject({

const response = await request('https://example.com', params);
expect(response).toEqual({
expect(response).toStrictEqual({
metadata: { scaRequired: true },

@@ -145,7 +150,7 @@ response: { secondCall: true },

function fakeHeaders(obj) {
function fakeHeaders(object) {
return {
get: (key) => obj[key],
get: (key) => object[key],
};
}
});

@@ -9,2 +9,3 @@ /* eslint-disable fp/no-mutation */

const form = createForm({ target: name, token, approvalPageUrl, flow: 'tab' });
// eslint-disable-next-line unicorn/prefer-dom-node-append
document.body.appendChild(form);

@@ -11,0 +12,0 @@

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

/* eslint-disable fp/no-mutation */
import { tabFlow } from './tabFlow';

@@ -10,3 +9,3 @@

describe('Tab flow', () => {
describe('tab flow', () => {
let submit;

@@ -17,2 +16,3 @@

window.HTMLFormElement.prototype.submit = submit;
// eslint-disable-next-line jest/prefer-spy-on
global.open = jest.fn();

@@ -32,4 +32,5 @@ });

expect(form.action).toBe('https://a.a/');
// eslint-disable-next-line jest/prefer-called-with
expect(submit).toHaveBeenCalled();
});
});
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