Created
September 20, 2017 16:55
-
-
Save haikyuu/fdeff7e0e885a8af7d911beab47aebd1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var airbrake = new airbrakeJs.Client({ | |
projectId: 157180, | |
projectKey: 'b4831e7abc62eceb3f0e49a822e0daa3' | |
}); | |
airbrake.addFilter(function (notice) { | |
notice.context.environment = 'production'; | |
return notice; | |
}); | |
var HelloSign = | |
/******/ (function(modules) { // webpackBootstrap | |
/******/ // The module cache | |
/******/ var installedModules = {}; | |
/******/ // The require function | |
/******/ function __webpack_require__(moduleId) { | |
/******/ // Check if module is in cache | |
/******/ if(installedModules[moduleId]) | |
/******/ return installedModules[moduleId].exports; | |
/******/ // Create a new module (and put it into the cache) | |
/******/ var module = installedModules[moduleId] = { | |
/******/ exports: {}, | |
/******/ id: moduleId, | |
/******/ loaded: false | |
/******/ }; | |
/******/ // Execute the module function | |
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | |
/******/ // Flag the module as loaded | |
/******/ module.loaded = true; | |
/******/ // Return the exports of the module | |
/******/ return module.exports; | |
/******/ } | |
/******/ // expose the modules object (__webpack_modules__) | |
/******/ __webpack_require__.m = modules; | |
/******/ // expose the module cache | |
/******/ __webpack_require__.c = installedModules; | |
/******/ // __webpack_public_path__ | |
/******/ __webpack_require__.p = ""; | |
/******/ // Load entry module and return exports | |
/******/ return __webpack_require__(0); | |
/******/ }) | |
/************************************************************************/ | |
/******/ ([ | |
/* 0 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
!function(){function e(e){void 0!==e&&(window.console&&console.log?airbreak.notify(e):alert(e))}function i(e){d.isDebugEnabled&&void 0!==e&&window.console&&console.log&&airbreak.notify(e)}function t(){return o()?window.pageXOffset:r()?document.documentElement.scrollLeft:document.body.scrollLeft}function n(){return o()?window.pageYOffset:r()?document.documentElement.scrollTop:document.body.scrollTop}function r(){return"CSS1Compat"===(document.compatMode||"")}function o(){return void 0!==window.pageXOffset}var a=function(){var e={};window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi,function(i,t,n){e[t]=n});return e}();window.isDebugEnabled=!!a.debug&&"true"===a.debug;var s=navigator.userAgent.toLowerCase(),l={cacheBust:0,lastHash:0,intervalId:0,rmCallback:null,defaultDelay:500,hasPostMessage:void 0!==window.postMessage,_serializeMessageValue:function(e){return"object"==typeof e&&(e=JSON.stringify(e)),encodeURIComponent(e)},send:function(e,t,n){i("XWM Send: Sending Message."),i(" targetUrl: "+t);var r=l;if(t){if("string"!=typeof e){var o=[];for(var a in e)o.push(a+"="+this._serializeMessageValue(e[a]));e=o.join("&")}if(i(" message: "+e),r.hasPostMessage)n=n||parent,n.postMessage(e,t.replace(/([^:]+:\/\/[^\/]+).*/,"$1"));else if(t){var s=(new Date).getTime(),h=++r.cacheBust,d=document.getElementById(n);d?d.setAttribute("src",t.replace(/#.*$/,"")+"#"+s+h+"&"+e):parent.location=t.replace(/#.*$/,"")+"#"+s+h+"&"+e}i("XWM Send: Message sent.")}},receive:function(t,n,r){"function"!=typeof t&&e("callback must be a function"),"string"!=typeof n&&e("sourceOrigin must be a string"),i("XWM Receive: Initialize receiver."),i(" callback: "+(t.name?t.name:"Anonymous function")),i(" sourceOrigin: "+n);var o=l;o.hasPostMessage?(t&&(o.rmCallback&&(window.addEventListener?window.removeEventListener("message",o.rmCallback,!1):window.detachEvent("onmessage",o.rmCallback)),o.rmCallback=function(e){if(e.origin!==n){if(!new RegExp("[/|.]"+n+"$","i").test(e.origin))return!1}i("XWM Receive: Message received!"),i(" data: "+e.data),i(" sourceOrigin: "+n),t(e)}),window.addEventListener?window.addEventListener("message",o.rmCallback,!1):window.attachEvent("onmessage",o.rmCallback)):(i("XWM Receive: Starting poll..."),o.intervalId&&(clearInterval(o.intervalId),o.intervalId=null),void 0===r&&(r=o.defaultDelay),t&&(r=void 0!==r?r:200,o.intervalId=setInterval(function(){var e=document.location.hash,r=/^#?\d+&/;if(e!==o.lastHash&&r.test(e)){o.lastHash=e;var a=e.replace(r,"");i("XWM Receive: Message received!"),i(" data: "+a),i(" sourceOrigin: "+n),t({data:a})}},r)))}},h={savedViewportContent:"",set:function(){i("Optimizing viewport meta tag for mobile"),this.savedViewportContent=this._getElement().getAttribute("content");var e=this._explodePairs(this.savedViewportContent);e.width="device-width",e["maximum-scale"]="1.0",e["user-scalable"]="no",this._getElement().setAttribute("content",this._joinPairs(e))},restore:function(){i("Restoring viewport meta tag"),this._getElement().setAttribute("content",this.savedViewportContent)},_getElement:function(){var e=document.querySelector("meta[name=viewport]");return e||(e=document.createElement("meta"),e.setAttribute("name","viewport"),e.setAttribute("content","initial-scale=1.0"),document.head.appendChild(e)),e},_joinPairs:function(e){var i=[];for(var t in e)i.push(t+"="+e[t]);return i.join(", ")},_explodePairs:function(e){var i=e.split(","),t={};return i.forEach(function(e){e=e.trim();var i=e.split("=");t[i[0]]=i[1]}),t}},d={VERSION:__webpack_require__(1).version,DEFAULT_UX_VERSION:1,IFRAME_WIDTH_RATIO:.8,DEFAULT_WIDTH:900,DEFAULT_HEIGHT:900,MIN_HEIGHT:480,wrapper:null,iframe:null,overlay:null,cancelButton:null,clientId:null,isOldIE:/msie (8|7|6|5)/gi.test(s),isFF:/firefox/gi.test(s),isOpera:/opera/gi.test(s),isMobile:/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(s),baseUrl:"https://www.hellosign.com",cdnBaseUrl:"https://s3.amazonaws.com/cdn.hellofax.com",XWM:l,CULTURES:{EN_US:"en_US",FR_FR:"fr_FR",DE_DE:"de_DE",SV_SE:"sv_SE",ZH_CN:"zh_CN",DA_DK:"da_DK",NL_NL:"nl_NL",ES_ES:"es_ES",ES_MX:"es_MX",init:function(){return this.supportedCultures=[this.EN_US,this.FR_FR,this.DE_DE,this.SV_SE,this.ZH_CN,this.DA_DK,this.NL_NL,this.ES_ES,this.ES_MX],this}}.init(),isDebugEnabled:window.isDebugEnabled,EVENT_SIGNED:"signature_request_signed",EVENT_DECLINED:"signature_request_declined",EVENT_CANCELED:"signature_request_canceled",EVENT_SENT:"signature_request_sent",EVENT_TEMPLATE_CREATED:"template_created",EVENT_ERROR:"error",init:function(e){this.clientId=e},open:function(e){var t=this,n=this.safeUrl(e.redirectUrl),r=e.messageListener,o=this.safeUrl(e.url);if(this.uxVersion=e.uxVersion||this.DEFAULT_UX_VERSION,this.isDefaultUX=this.uxVersion===this.DEFAULT_UX_VERSION,this.healthCheckTimeoutMs=e.healthCheckTimeoutMs,this.uxVersion&&(o+=(o.indexOf("?")>0?"&":"?")+"ux_version="+this.uxVersion),void 0!==e.debug&&(this.isDebugEnabled=!0===e.debug||"true"==e.debug),void 0!==e.skipDomainVerification&&(this.skipDomainVerification=!0===e.skipDomainVerification||"true"==e.skipDomainVerification),void 0!==e.hideHeader&&(this.hideHeader=!0===e.hideHeader||"true"==e.hideHeader),"object"==typeof e.whiteLabelingOptions?(this.whiteLabelingOptions=JSON.stringify(e.whiteLabelingOptions),this.whiteLabelingOptions=this.whiteLabelingOptions.replace(/#/g,"")):void 0!==e.whiteLabelingOptions&&i("Invalid white labeling options supplied, option will be ignored: "+e.whiteLabelingOptions),this.isInPage=void 0!==e.container,this.container=e.container||document.body,this.isInPage&&void 0!==e.height&&(isNaN(parseInt(e.height,10))||e.height<=0))throw new Error("Invalid iFrame height ("+e.height+") it must be a valid positive number");if(i("Opening HelloSign embedded iFrame with the following params:"),i(e),!o)throw new Error("No url specified");var a=void 0===e.userCulture?this.CULTURES.EN_US:e.userCulture;if(-1===this.inArray(a,this.CULTURES.supportedCultures))throw new Error("Invalid userCulture specified: "+a);o+=o.indexOf("?")>0?"&":"?",n&&(o+="redirect_url="+encodeURIComponent(n)+"&"),o+="parent_url="+encodeURIComponent(document.location.href.replace(/\?.*/,""))+"&",o+=!0===this.skipDomainVerification?"skip_domain_verification=1&":"",o+="client_id="+this.clientId+"&",o+=void 0!==e.requester?"requester="+encodeURIComponent(e.requester)+"&":"",o+="user_culture="+a,this.isDebugEnabled&&(o+="&debug=true"),this.hideHeader&&(o+="&hideHeader=true"),this.whiteLabelingOptions&&(o+="&white_labeling_options="+encodeURI(this.whiteLabelingOptions)),o+="&js_version="+this.VERSION;var s=o.replace(/([^:]+:\/\/[^\/]+).*/,"$1"),c=this.getWindowDimensions(e.height),u={overlay:{position:"fixed",top:"0px",left:"0px",bottom:"0px",right:"0px","z-index":9997,display:"block","background-color":"#222",opacity:.4,"-khtml-opacity":.4,"-moz-opacity":.4,filter:"alpha(opacity=40)","-ms-filter":"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)"},wrapper:this.isInPage?{}:{position:"absolute",top:c.top,left:c.left,"z-index":9998},iframe:this.isInPage?{}:{border:"1px solid #505050","box-shadow":"0px 2px 18px 2px #666","background-color":"#FFF","z-index":9998},cancelButton:{position:"absolute",top:"-13px",right:"-13px",width:"30px",height:"30px","background-image":"url("+this.cdnBaseUrl+"/css/fancybox/fancybox.png)","background-position":"-40px 0px",cursor:"pointer","z-index":9999}},p=function(){if(t.iframe){var e={};e=t.isMobile?t.getMobileDimensions():t.getWindowDimensions(),t.wrapper.style.top=e.top,t.wrapper.style.left=e.left,t.wrapper.style.width=e.widthString,t.iframe.style.height=e.heightString,t.iframe.style.width=e.widthString}};if(this.uxVersion>1)if(this.isInPage)u.wrapper.width="100%",u.wrapper.height=c.heightString,u.iframe.width="100%",u.iframe.height=c.heightString,u.iframe.border="none",u.iframe["box-shadow"]="none",u.cancelButton.display="none",this.isMobile&&(u.iframe.width="1px",u.iframe["min-width"]="100%");else if(this.isMobile){var f=this.getMobileDimensions();u.wrapper.position="absolute",u.wrapper.top="0",u.wrapper.left="0",u.wrapper.width=f.widthString,u.wrapper.height=f.heightString,u.iframe.position="absolute",u.iframe.top=0,u.iframe.left=0,u.iframe.width=f.widthString,u.iframe.height=f.heightString,u.iframe.border="none",u.iframe["box-shadow"]="none",u.cancelButton.display="none"}if(this.isInPage||(this.overlay||(this.overlay=document.createElement("div"),this.overlay.setAttribute("id","hsEmbeddedOverlay"),document.body.appendChild(this.overlay)),this.overlay.setAttribute("style","display: block;")),this.wrapper||(this.wrapper=document.createElement("div"),this.wrapper.setAttribute("id","hsEmbeddedWrapper"),this.isMobile&&window.scrollTo(0,0),this.container.appendChild(this.wrapper)),!this.isInPage)if(this.isMobile&&this.isDefaultUX){var m=document.body.clientWidth/window.innerWidth,g=function(){var e=document.body.clientWidth/window.innerWidth;m!==e&&(m=e,p())};window.onscroll=g}else window.onresize=p;this.iframe||(this.iframe=document.createElement("iframe"),this.iframe.setAttribute("id","hsEmbeddedFrame"),this.wrapper.appendChild(this.iframe)),this.iframe.setAttribute("src",o),this.iframe.setAttribute("scrolling","no"),this.iframe.setAttribute("frameborder","0"),this.isDefaultUX&&this.iframe.setAttribute("width",this.DEFAULT_WIDTH),this.iframe.setAttribute("height",c.heightRaw),(-1===o.indexOf("embeddedSign")||null!=e.uxVersion&&e.uxVersion<2)&&(this.isInPage||!0!==e.allowCancel&&void 0!==e.allowCancel||this.cancelButton?!e.allowCancel&&this.cancelButton&&this.wrapper.removeChild(this.cancelButton):(this.cancelButton=document.createElement("a"),this.cancelButton.setAttribute("id","hsEmbeddedCancel"),this.cancelButton.setAttribute("href","javascript:;"),this.cancelButton.onclick=function(){d.close(),r&&(i("Reporting cancelation"),r({event:d.EVENT_CANCELED}))},this.wrapper.appendChild(this.cancelButton)));for(var w in u){var v=this[w];if(v)for(var b in u[w])try{v.style[b]=u[w][b]}catch(e){i(e)}}if(this.cancelButton&&(this.isFF||this.isOpera)){var E=this.cancelButton.getAttribute("style");E+=E?"; ":"",E+="background-image: "+u.cancelButton["background-image"]+"; ",E+="background-position: "+u.cancelButton["background-position"]+";",this.cancelButton.setAttribute("style",E)}this.isInPage||this.isMobile&&!this.isDefaultUX||p(),this.isMobile&&!this.isDefaultUX&&window===window.top&&h.set(),this.isMobile&&!this.isInPage&&(this.fixIframe=function(){window.scrollTo(0,0)},this.fixIframe(),window.addEventListener("scroll",this.fixIframe)),this.healthCheckTimeoutMs&&(this._healthCheckTimeoutHandle=setTimeout(function(){var e="Signer page failed to initialize within "+t.healthCheckTimeoutMs+" milliseconds.";t.reportError(e,document.location.href),t.close()},this.healthCheckTimeoutMs)),l.receive(function(i){var n=i.source||"hsEmbeddedFrame";if("initialize"===i.data&&e.uxVersion>1)t.healthCheckTimeoutMs&&clearTimeout(t._healthCheckTimeoutHandle),l.send(JSON.stringify({type:"embeddedConfig",payload:e}),i.origin,n);else if("close"==i.data)d.close(),r&&e.uxVersion>1&&r({event:d.EVENT_CANCELED});else if("decline"==i.data)d.close(),r({event:d.EVENT_DECLINED});else if("user-done"==i.data)d.close();else if(0===i.data.indexOf("hello:")){var a=i.data.split(":"),s=a[1];l.send("helloback:"+s,o,n)}else if(r&&i.data){for(var h,c={},u=i.data.split("&"),p=0;p<u.length;p++)h=u[p].split("="),2===h.length&&(c[h[0]]=function(e){var i=e;try{if("object"==typeof(i=JSON.parse(e)))for(var t in i)i[t]=parseJson(i[t])}catch(e){}return i}(decodeURIComponent(h[1])));r(c)}},s)},close:function(){if(this.isMobile&&!this.isDefaultUX&&window===window.top&&h.restore(),i("Closing HelloSign embedded iFrame"),this.iframe){this.cancelButton&&(this.wrapper.removeChild(this.cancelButton),this.cancelButton=null),this._fadeOutIFrame()}this.isMobile&&window.removeEventListener("scroll",this.fixIframe)},_fadeOutIFrame:function(e){var i=this;if(i.iframe){if(e?e-=.1:e=1,i.iframe.style.opacity=e,i.iframe.style.filter="alpha(opacity="+parseInt(100*e,10)+")",e<=0)return i.iframe.style.opacity=0,i.iframe.style.filter="alpha(opacity=0)",i.iframe.style.display="none",clearTimeout(t),i.overlay&&i.container.removeChild(i.overlay),i.container.removeChild(i.wrapper),i.wrapper.removeChild(i.iframe),i.overlay=null,i.iframe=null,i.wrapper=null,!1;var t=setTimeout(function(e){return function(){i._fadeOutIFrame(e)}}(e),10)}},reportError:function(e,i){l.send({event:d.EVENT_ERROR,description:e},i)},ensureParentDomain:function(t,n,r,o,a){if(window.top==window)return void a(!0);if("string"!=typeof r)return void e("Token not supplied by HelloSign. Please contact support.");if("function"!=typeof a)return void e("Callback not supplied by HelloSign. Please contact support.");if(!0===o){var s="Domain verification has been skipped. Before requesting approval for your app, please be sure to test domain verification by setting skipDomainVerification to false.";i(s),alert(s),a(!0)}else l.receive(function(e){if(0===e.data.indexOf("helloback:")){var i=e.data.split(":"),t=i[1]==r;a(t)}},t);l.send("hello:"+r,n)},getWindowDimensions:function(e){var i,r,o=t(),a=n();this.isOldIE?(i=document.body.clientWidth,r=document.body.clientHeight):(i=window.innerWidth,r=window.innerHeight);var s=this.isInPage&&e?e:Math.max(this.MIN_HEIGHT,r-60);return{widthString:(this.uxVersion>1?Math.min(this.DEFAULT_WIDTH,i*this.IFRAME_WIDTH_RATIO):this.DEFAULT_WIDTH)+"px",heightString:s+"px",heightRaw:s,scrollX:o,scrollY:a,top:Math.max(0,a+parseInt((r-s)/2,10))+"px",left:Math.max(0,parseInt((i-this.DEFAULT_WIDTH)/2,10))+"px"}},getMobileDimensions:function(){var e,i=screen.width,t=(screen.height,window.innerWidth);return e=window.innerHeight>t?{widthString:this.isDefaultUX?"100vw":i+"px",heightString:this.isDefaultUX?"100vh":"100%"}:{widthString:t+"px",heightString:this.isDefaultUX?"100vh":"100%"},e.top="0",e.left="0",e},inArray:function(e,i){if(this.hasJQuery)return $.inArray(e,i);if(i)for(var t=0;t<i.length;t++)if(i[t]==e)return t;return-1},safeUrl:function(e){if(e)try{e=e.replace(/</g,"<"),e=e.replace(/>/g,">");var t=document.createElement("div");t.innerHTML=e;var n=t.innerText;e=n||e.replace(/\&\;/g,"&")}catch(e){i("Could not decode url: "+e)}return e}};module.exports=d}(); | |
/***/ }), | |
/* 1 */ | |
/***/ (function(module, exports) { | |
module.exports = {"name":"hellosign-embedded","version":"1.2.9","description":"A JavaScript library required for embedding HelloSign features into your webapp. For more information, see our API documentation at https://www.hellosign.com/api/documentation.","main":"src/embedded.js","scripts":{"test":"mocha tests/module.js","start":"scripts/start.sh"},"repository":{"type":"git","url":"git+https://github.com/HelloFax/hellosign-embedded.git"},"author":"HelloSign <[email protected]> (http://hellosign.com)","license":"ISC","bugs":{"url":"https://github.com/HelloFax/hellosign-embedded/issues"},"homepage":"https://github.com/HelloFax/hellosign-embedded#readme","devDependencies":{"chai":"^3.5.0","jsdom":"8.4.0","jsdom-global":"1.7.0","json-loader":"^0.5.4","mocha":"^2.4.5","uglify-loader":"^1.3.0","webpack":"^1.13.0"}} | |
/***/ }) | |
/******/ ]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment