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

hellosign-embedded

Package Overview
Dependencies
Maintainers
1
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hellosign-embedded - npm Package Compare versions

Comparing version 1.4.3 to 1.5.0-0

3

package.json
{
"name": "hellosign-embedded",
"version": "1.4.3",
"version": "1.5.0-0",
"description": "Embed HelloSign signature requests and templates from within your web application.",

@@ -12,3 +12,2 @@ "homepage": "https://github.com/HelloFax/hellosign-embedded",

"prerelease": "node scripts/pre-release.js",
"prepublishOnly": "npm install && npm run build && npm run prerelease",
"setup": "npm install && npm run build && npm run setup --prefix=demo",

@@ -15,0 +14,0 @@ "test": "mocha test"

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.HelloSign=t():e.HelloSign=t()}(window,function(){return function(e){var t={};function i(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},i.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=1)}([function(e){e.exports={name:"hellosign-embedded",version:"1.4.3",description:"Embed HelloSign signature requests and templates from within your web application.",homepage:"https://github.com/HelloFax/hellosign-embedded",main:"index.js",license:"ISC",scripts:{build:"webpack",demo:"npm run build && npm start --prefix=demo",prerelease:"node scripts/pre-release.js",prepublishOnly:"npm install && npm run build && npm run prerelease",setup:"npm install && npm run build && npm run setup --prefix=demo",test:"mocha test"},repository:{type:"git",url:"https://github.com/HelloFax/hellosign-embedded.git"},author:{name:"HelloSign",email:"api@hellosign.com",url:"https://hellosign.com"},devDependencies:{"@babel/core":"^7.0.0-beta.42","@babel/plugin-proposal-object-rest-spread":"^7.0.0-beta.42","@babel/plugin-transform-object-assign":"^7.0.0-beta.42","@babel/preset-env":"^7.0.0-beta.42","babel-loader":"^8.0.0-beta.2",chai:"^4.1.2",jsdom:"^11.6.2","jsdom-global":"^3.0.2",mocha:"^5.0.4",webpack:"^4.2.0","webpack-cli":"^2.0.13"},files:["umd","index.js"]}},function(e,t,i){"use strict";function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(){var t,r=(t={},window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi,function(e,i,n){t[i]=n}),t);window.isDebugEnabled=!!r.debug&&"true"===r.debug;var s=navigator.userAgent.toLowerCase(),a={cacheBust:0,lastHash:0,intervalId:0,rmCallback:null,defaultDelay:500,hasPostMessage:void 0!==window.postMessage,_serializeMessageValue:function(e){return"object"===o(e)&&(e=JSON.stringify(e)),encodeURIComponent(e)},send:function(e,t,i){h("XWM Send: Sending Message."),h(" targetUrl: "+t);var n=a;if(t){if("string"!=typeof e){var o=[];for(var r in e)o.push(r+"="+this._serializeMessageValue(e[r]));e=o.join("&")}if(h(" message: "+e),n.hasPostMessage)(i=i||parent).postMessage(e,t.replace(/([^:]+:\/\/[^\/]+).*/,"$1"));else if(t){var s=(new Date).getTime(),l=++n.cacheBust,c=document.getElementById(i);c?c.setAttribute("src",t.replace(/#.*$/,"")+"#"+s+l+"&"+e):parent.location=t.replace(/#.*$/,"")+"#"+s+l+"&"+e}h("XWM Send: Message sent.")}},receive:function(e,t,i){"function"!=typeof e&&d("callback must be a function"),"string"!=typeof t&&d("sourceOrigin must be a string"),h("XWM Receive: Initialize receiver."),h(" callback: "+(e.name?e.name:"Anonymous function")),h(" sourceOrigin: "+t);var n=a;n.hasPostMessage?(e&&(n.rmCallback&&(window.addEventListener?window.removeEventListener("message",n.rmCallback,!1):window.detachEvent("onmessage",n.rmCallback)),n.rmCallback=function(i){if(i.origin!==t&&!new RegExp("[/|.]"+t+"$","i").test(i.origin))return!1;h("XWM Receive: Message received!"),h(" data: "+i.data),h(" sourceOrigin: "+t),e(i)}),window.addEventListener?window.addEventListener("message",n.rmCallback,!1):window.attachEvent("onmessage",n.rmCallback)):(h("XWM Receive: Starting poll..."),n.intervalId&&(clearInterval(n.intervalId),n.intervalId=null),void 0===i&&(i=n.defaultDelay),e&&(i=void 0!==i?i:200,n.intervalId=setInterval(function(){var i=document.location.hash,o=/^#?\d+&/;if(i!==n.lastHash&&o.test(i)){n.lastHash=i;var r=i.replace(o,"");h("XWM Receive: Message received!"),h(" data: "+r),h(" sourceOrigin: "+t),e({data:r})}},i)))}},l={savedViewportContent:"",set:function(){h("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(){h("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")).setAttribute("name","viewport"),e.setAttribute("content","initial-scale=1.0"),document.head.appendChild(e)),e},_joinPairs:function(e){var t=[];for(var i in e)t.push(i+"="+e[i]);return t.join(", ")},_explodePairs:function(e){var t={};return e.split(",").forEach(function(e){var i=(e=e.trim()).split("=");t[i[0]]=i[1]}),t}},c={VERSION:i(0).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:a,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",PT_BR:"pt_BR",PL_PL:"pl_PL",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.PT_BR,this.PL_PL],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,i=this.safeUrl(e.redirectUrl),r=e.messageListener,s=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&&(s+=(s.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"===o(e.whiteLabelingOptions)?(this.whiteLabelingOptions=JSON.stringify(e.whiteLabelingOptions),this.whiteLabelingOptions=this.whiteLabelingOptions.replace(/#/g,"")):void 0!==e.whiteLabelingOptions&&h("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(h("Opening HelloSign embedded iFrame with the following params:"),h(e),!s)throw new Error("No url specified");var d=void 0===e.userCulture?this.CULTURES.EN_US:e.userCulture;if(-1===this.inArray(d,this.CULTURES.supportedCultures))throw new Error("Invalid userCulture specified: "+d);s+=s.indexOf("?")>0?"&":"?",i&&(s+="redirect_url="+encodeURIComponent(i)+"&"),s+="parent_url="+encodeURIComponent(document.location.href.replace(/\?.*/,""))+"&",s+=!0===this.skipDomainVerification?"skip_domain_verification=1&":"",s+="client_id="+this.clientId+"&",s+=void 0!==e.requester?"requester="+encodeURIComponent(e.requester)+"&":"",s+="user_culture="+d,this.isDebugEnabled&&(s+="&debug=true"),this.hideHeader&&(s+="&hideHeader=true"),this.whiteLabelingOptions&&(s+="&white_labeling_options="+encodeURI(this.whiteLabelingOptions));var u,p,f,m,g=(s+="&js_version="+this.VERSION).replace(/([^:]+:\/\/[^\/]+).*/,"$1"),b=this.getWindowDimensions(e.height),w={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:b.top,left:b.left,"z-index":9998},iframe:this.isInPage?{}:{margin:"1px","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}},v=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)w.wrapper.width="100%",w.wrapper.height=b.heightString,w.iframe.width="100%",w.iframe.height=b.heightString,w.iframe.border="none",w.iframe["box-shadow"]="none",w.cancelButton.display="none",this.isMobile&&(w.iframe.width="1px",w.iframe["min-width"]="100%");else if(this.isMobile){var E=this.getMobileDimensions();w.wrapper.position="absolute",w.wrapper.top="0",w.wrapper.left="0",w.wrapper.width=E.widthString,w.wrapper.height=E.heightString,w.iframe.position="absolute",w.iframe.top=0,w.iframe.left=0,w.iframe.width=E.widthString,w.iframe.height=E.heightString,w.iframe.border="none",w.iframe["box-shadow"]="none",w.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 y=document.body.clientWidth/window.innerWidth;window.onscroll=function(){var e=document.body.clientWidth/window.innerWidth;y!==e&&(y=e,v())}}else window.onresize=v;for(var _ in this.iframe||(this.iframe=document.createElement("iframe"),this.iframe.setAttribute("id","hsEmbeddedFrame"),this.wrapper.appendChild(this.iframe)),this.iframe.setAttribute("src",s),this.iframe.setAttribute("scrolling","no"),this.iframe.setAttribute("frameborder","0"),this.isDefaultUX&&this.iframe.setAttribute("width",this.DEFAULT_WIDTH),this.iframe.setAttribute("height",b.heightRaw),(-1===s.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(){c.close(),r&&(h("Reporting cancelation"),r({event:c.EVENT_CANCELED}))},this.wrapper.appendChild(this.cancelButton))),w){var x=this[_];if(x)for(var I in w[_])try{x.style[I]=w[_][I]}catch(e){h(e)}}if(this.cancelButton&&(this.isFF||this.isOpera)){var D=this.cancelButton.getAttribute("style");D+=D?"; ":"",D+="background-image: "+w.cancelButton["background-image"]+"; ",D+="background-position: "+w.cancelButton["background-position"]+";",this.cancelButton.setAttribute("style",D)}this.isInPage||this.isMobile&&!this.isDefaultUX||v(),this.isMobile&&!this.isDefaultUX&&window===window.top&&l.set(),this.isMobile&&!this.isInPage&&(this.fixIframe=(u=function(){window.scrollTo(0,0)},p=1e3,function(){var e=this,t=arguments,i=f&&!m;clearTimeout(m),m=setTimeout(function(){m=null,f||u.apply(e,t)},p),i&&u.apply(e,t)}),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)),a.receive(function(i){var l=i.source||"hsEmbeddedFrame";if("initialize"===i.data&&e.uxVersion>1){t.healthCheckTimeoutMs&&clearTimeout(t._healthCheckTimeoutHandle);var d=n({},e);delete d.container,a.send(JSON.stringify({type:"embeddedConfig",payload:d}),i.origin,l)}else if("close"==i.data)c.close(),r&&e.uxVersion>1&&r({event:c.EVENT_CANCELED});else if("decline"==i.data)c.close(),r({event:c.EVENT_DECLINED});else if("user-done"==i.data)c.close();else if(0===i.data.indexOf("hello:")){var h=i.data.split(":")[1];a.send("helloback:"+h,s,l)}else if(r&&i.data){for(var u,p={},f=i.data.split("&"),m=function(e){var t=e;try{if("object"===o(t=JSON.parse(e)))for(var i in t)t[i]=parseJson(t[i])}catch(e){}return t},g=0;g<f.length;g++)2===(u=f[g].split("=")).length&&(p[u[0]]=m(decodeURIComponent(u[1])));r(p)}},g)},close:function(){if(this.isMobile&&!this.isDefaultUX&&window===window.top&&l.restore(),h("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 t=this;if(t.iframe){if(e?e-=.1:e=1,t.iframe.style.opacity=e,t.iframe.style.filter="alpha(opacity="+parseInt(100*e,10)+")",e<=0)return t.iframe.style.opacity=0,t.iframe.style.filter="alpha(opacity=0)",t.iframe.style.display="none",clearTimeout(i),t.overlay&&t.container.removeChild(t.overlay),t.container.removeChild(t.wrapper),t.wrapper.removeChild(t.iframe),t.overlay=null,t.iframe=null,t.wrapper=null,!1;var i=setTimeout(function(e){return function(){t._fadeOutIFrame(e)}}(e),10)}},reportError:function(e,t){a.send({event:c.EVENT_ERROR,description:e},t)},ensureParentDomain:function(e,t,i,n,o){if(window.top!=window)if("string"==typeof i)if("function"==typeof o){if(!0===n){var r="Domain verification has been skipped. Before requesting approval for your app, please be sure to test domain verification by setting skipDomainVerification to false.";h(r),alert(r),o(!0)}else a.receive(function(e){if(0===e.data.indexOf("helloback:")){var t=e.data.split(":")[1]==i;o(t)}},e);a.send("hello:"+i,t)}else d("Callback not supplied by HelloSign. Please contact support.");else d("Token not supplied by HelloSign. Please contact support.");else o(!0)},getWindowDimensions:function(e){var t,i,n=p()?window.pageXOffset:u()?document.documentElement.scrollLeft:document.body.scrollLeft,o=p()?window.pageYOffset:u()?document.documentElement.scrollTop:document.body.scrollTop;this.isOldIE?(t=document.body.clientWidth,i=document.body.clientHeight):(t=window.innerWidth,i=window.innerHeight);var r=this.isInPage&&e?e:Math.max(this.MIN_HEIGHT,i-60);return{widthString:(this.uxVersion>1?Math.min(this.DEFAULT_WIDTH,t*this.IFRAME_WIDTH_RATIO):this.DEFAULT_WIDTH)+"px",heightString:r+"px",heightRaw:r,scrollX:n,scrollY:o,top:Math.max(0,o+parseInt((i-r)/2,10))+"px",left:Math.max(0,parseInt((t-this.DEFAULT_WIDTH)/2,10))+"px"}},getMobileDimensions:function(){var e,t=screen.width,i=(screen.height,window.innerWidth);return(e=window.innerHeight>i?{widthString:this.isDefaultUX?"100vw":t+"px",heightString:this.isDefaultUX?"100vh":"100%"}:{widthString:i+"px",heightString:this.isDefaultUX?"100vh":"100%"}).top="0",e.left="0",e},inArray:function(e,t){if(this.hasJQuery)return $.inArray(e,t);if(t)for(var i=0;i<t.length;i++)if(t[i]==e)return i;return-1},safeUrl:function(e){if(e)try{e=(e=e.replace(/</g,"&lt;")).replace(/>/g,"&gt;");var t=document.createElement("div");t.innerHTML=e;var i=t.innerText;e=i||e.replace(/\&amp\;/g,"&")}catch(e){h("Could not decode url: "+e)}return e}};function d(e){void 0!==e&&(window.console&&console.log?console.log(e):alert(e))}function h(e){c.isDebugEnabled&&void 0!==e&&window.console&&console.log&&console.log(e)}function u(){return"CSS1Compat"===(document.compatMode||"")}function p(){return void 0!==window.pageXOffset}window.HelloSign=c,e.exports=c}()}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.HelloSign=t():e.HelloSign=t()}(window,function(){return function(e){var t={};function i(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},i.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=1)}([function(e){e.exports={name:"hellosign-embedded",version:"1.4.3",description:"Embed HelloSign signature requests and templates from within your web application.",homepage:"https://github.com/HelloFax/hellosign-embedded",main:"index.js",license:"ISC",scripts:{build:"webpack",demo:"npm run build && npm start --prefix=demo",prerelease:"node scripts/pre-release.js",setup:"npm install && npm run build && npm run setup --prefix=demo",test:"mocha test"},repository:{type:"git",url:"https://github.com/HelloFax/hellosign-embedded.git"},author:{name:"HelloSign",email:"api@hellosign.com",url:"https://hellosign.com"},devDependencies:{"@babel/core":"^7.0.0-beta.42","@babel/plugin-proposal-object-rest-spread":"^7.0.0-beta.42","@babel/plugin-transform-object-assign":"^7.0.0-beta.42","@babel/preset-env":"^7.0.0-beta.42","babel-loader":"^8.0.0-beta.2",chai:"^4.1.2",jsdom:"^11.6.2","jsdom-global":"^3.0.2",mocha:"^5.0.4",webpack:"^4.2.0","webpack-cli":"^2.0.13"},files:["umd","index.js"]}},function(e,t,i){"use strict";function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(){var t,r=(t={},window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi,function(e,i,n){t[i]=n}),t);window.isDebugEnabled=!!r.debug&&"true"===r.debug;var a=navigator.userAgent.toLowerCase(),s={cacheBust:0,lastHash:0,intervalId:0,rmCallback:null,defaultDelay:500,hasPostMessage:void 0!==window.postMessage,_serializeMessageValue:function(e){return"object"===o(e)&&(e=JSON.stringify(e)),encodeURIComponent(e)},send:function(e,t,i){h("XWM Send: Sending Message."),h(" targetUrl: "+t);var n=s;if(t){if("string"!=typeof e){var o=[];for(var r in e)o.push(r+"="+this._serializeMessageValue(e[r]));e=o.join("&")}if(h(" message: "+e),n.hasPostMessage)(i=i||parent).postMessage(e,t.replace(/([^:]+:\/\/[^\/]+).*/,"$1"));else if(t){var a=(new Date).getTime(),l=++n.cacheBust,c=document.getElementById(i);c?c.setAttribute("src",t.replace(/#.*$/,"")+"#"+a+l+"&"+e):parent.location=t.replace(/#.*$/,"")+"#"+a+l+"&"+e}h("XWM Send: Message sent.")}},receive:function(e,t,i){"function"!=typeof e&&d("callback must be a function"),"string"!=typeof t&&d("sourceOrigin must be a string"),h("XWM Receive: Initialize receiver."),h(" callback: "+(e.name?e.name:"Anonymous function")),h(" sourceOrigin: "+t);var n=s;n.hasPostMessage?(e&&(n.rmCallback&&(window.addEventListener?window.removeEventListener("message",n.rmCallback,!1):window.detachEvent("onmessage",n.rmCallback)),n.rmCallback=function(i){if(i.origin!==t&&!new RegExp("[/|.]"+t+"$","i").test(i.origin))return!1;h("XWM Receive: Message received!"),h(" data: "+i.data),h(" sourceOrigin: "+t),e(i)}),window.addEventListener?window.addEventListener("message",n.rmCallback,!1):window.attachEvent("onmessage",n.rmCallback)):(h("XWM Receive: Starting poll..."),n.intervalId&&(clearInterval(n.intervalId),n.intervalId=null),void 0===i&&(i=n.defaultDelay),e&&(i=void 0!==i?i:200,n.intervalId=setInterval(function(){var i=document.location.hash,o=/^#?\d+&/;if(i!==n.lastHash&&o.test(i)){n.lastHash=i;var r=i.replace(o,"");h("XWM Receive: Message received!"),h(" data: "+r),h(" sourceOrigin: "+t),e({data:r})}},i)))}},l={savedViewportContent:"",set:function(){h("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(){h("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")).setAttribute("name","viewport"),e.setAttribute("content","initial-scale=1.0"),document.head.appendChild(e)),e},_joinPairs:function(e){var t=[];for(var i in e)t.push(i+"="+e[i]);return t.join(", ")},_explodePairs:function(e){var t={};return e.split(",").forEach(function(e){var i=(e=e.trim()).split("=");t[i[0]]=i[1]}),t}},c={VERSION:i(0).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(a),isFF:/firefox/gi.test(a),isOpera:/opera/gi.test(a),isMobile:/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(a),baseUrl:"https://www.hellosign.com",cdnBaseUrl:"https://s3.amazonaws.com/cdn.hellofax.com",XWM:s,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",PT_BR:"pt_BR",PL_PL:"pl_PL",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.PT_BR,this.PL_PL],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,i=this.safeUrl(e.redirectUrl),r=e.messageListener,a=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&&(a+=(a.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),void 0!==e.finalButtonText&&(this.finalButtonText=e.finalButtonText),"object"===o(e.whiteLabelingOptions)?(this.whiteLabelingOptions=JSON.stringify(e.whiteLabelingOptions),this.whiteLabelingOptions=this.whiteLabelingOptions.replace(/#/g,"")):void 0!==e.whiteLabelingOptions&&h("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(h("Opening HelloSign embedded iFrame with the following params:"),h(e),!a)throw new Error("No url specified");var d=void 0===e.userCulture?this.CULTURES.EN_US:e.userCulture;if(-1===this.inArray(d,this.CULTURES.supportedCultures))throw new Error("Invalid userCulture specified: "+d);a+=a.indexOf("?")>0?"&":"?",i&&(a+="redirect_url="+encodeURIComponent(i)+"&"),a+="parent_url="+encodeURIComponent(document.location.href.replace(/\?.*/,""))+"&",a+=!0===this.skipDomainVerification?"skip_domain_verification=1&":"",a+="client_id="+this.clientId+"&",a+=void 0!==e.requester?"requester="+encodeURIComponent(e.requester)+"&":"",a+="user_culture="+d,this.isDebugEnabled&&(a+="&debug=true"),this.hideHeader&&(a+="&hideHeader=true"),this.whiteLabelingOptions&&(a+="&white_labeling_options="+encodeURI(this.whiteLabelingOptions)),this.finalButtonText&&(a+="&final_button_text="+this.finalButtonText);var u,p,f,m,g=(a+="&js_version="+this.VERSION).replace(/([^:]+:\/\/[^\/]+).*/,"$1"),b=this.getWindowDimensions(e.height),w={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:b.top,left:b.left,"z-index":9998},iframe:this.isInPage?{}:{margin:"1px","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}},v=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)w.wrapper.width="100%",w.wrapper.height=b.heightString,w.iframe.width="100%",w.iframe.height=b.heightString,w.iframe.border="none",w.iframe["box-shadow"]="none",w.cancelButton.display="none",this.isMobile&&(w.iframe.width="1px",w.iframe["min-width"]="100%");else if(this.isMobile){var E=this.getMobileDimensions();w.wrapper.position="absolute",w.wrapper.top="0",w.wrapper.left="0",w.wrapper.width=E.widthString,w.wrapper.height=E.heightString,w.iframe.position="absolute",w.iframe.top=0,w.iframe.left=0,w.iframe.width=E.widthString,w.iframe.height=E.heightString,w.iframe.border="none",w.iframe["box-shadow"]="none",w.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 y=document.body.clientWidth/window.innerWidth;window.onscroll=function(){var e=document.body.clientWidth/window.innerWidth;y!==e&&(y=e,v())}}else window.onresize=v;for(var _ in this.iframe||(this.iframe=document.createElement("iframe"),this.iframe.setAttribute("id","hsEmbeddedFrame"),this.wrapper.appendChild(this.iframe)),this.iframe.setAttribute("src",a),this.iframe.setAttribute("scrolling","no"),this.iframe.setAttribute("frameborder","0"),this.isDefaultUX&&this.iframe.setAttribute("width",this.DEFAULT_WIDTH),this.iframe.setAttribute("height",b.heightRaw),(-1===a.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(){c.close(),r&&(h("Reporting cancelation"),r({event:c.EVENT_CANCELED}))},this.wrapper.appendChild(this.cancelButton))),w){var x=this[_];if(x)for(var I in w[_])try{x.style[I]=w[_][I]}catch(e){h(e)}}if(this.cancelButton&&(this.isFF||this.isOpera)){var D=this.cancelButton.getAttribute("style");D+=D?"; ":"",D+="background-image: "+w.cancelButton["background-image"]+"; ",D+="background-position: "+w.cancelButton["background-position"]+";",this.cancelButton.setAttribute("style",D)}this.isInPage||this.isMobile&&!this.isDefaultUX||v(),this.isMobile&&!this.isDefaultUX&&window===window.top&&l.set(),this.isMobile&&!this.isInPage&&(this.fixIframe=(u=function(){window.scrollTo(0,0)},p=1e3,function(){var e=this,t=arguments,i=f&&!m;clearTimeout(m),m=setTimeout(function(){m=null,f||u.apply(e,t)},p),i&&u.apply(e,t)}),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)),s.receive(function(i){var l=i.source||"hsEmbeddedFrame";if("initialize"===i.data&&e.uxVersion>1){t.healthCheckTimeoutMs&&clearTimeout(t._healthCheckTimeoutHandle);var d=n({},e);delete d.container,s.send(JSON.stringify({type:"embeddedConfig",payload:d}),i.origin,l)}else if("close"==i.data)c.close(),r&&e.uxVersion>1&&r({event:c.EVENT_CANCELED});else if("decline"==i.data)c.close(),r({event:c.EVENT_DECLINED});else if("user-done"==i.data)c.close();else if(0===i.data.indexOf("hello:")){var h=i.data.split(":")[1];s.send("helloback:"+h,a,l)}else if(r&&i.data){for(var u,p={},f=i.data.split("&"),m=function(e){var t=e;try{if("object"===o(t=JSON.parse(e)))for(var i in t)t[i]=parseJson(t[i])}catch(e){}return t},g=0;g<f.length;g++)2===(u=f[g].split("=")).length&&(p[u[0]]=m(decodeURIComponent(u[1])));r(p)}},g)},close:function(){if(this.isMobile&&!this.isDefaultUX&&window===window.top&&l.restore(),h("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 t=this;if(t.iframe){if(e?e-=.1:e=1,t.iframe.style.opacity=e,t.iframe.style.filter="alpha(opacity="+parseInt(100*e,10)+")",e<=0)return t.iframe.style.opacity=0,t.iframe.style.filter="alpha(opacity=0)",t.iframe.style.display="none",clearTimeout(i),t.overlay&&t.container.removeChild(t.overlay),t.container.removeChild(t.wrapper),t.wrapper.removeChild(t.iframe),t.overlay=null,t.iframe=null,t.wrapper=null,!1;var i=setTimeout(function(e){return function(){t._fadeOutIFrame(e)}}(e),10)}},reportError:function(e,t){s.send({event:c.EVENT_ERROR,description:e},t)},ensureParentDomain:function(e,t,i,n,o){if(window.top!=window)if("string"==typeof i)if("function"==typeof o){if(!0===n){var r="Domain verification has been skipped. Before requesting approval for your app, please be sure to test domain verification by setting skipDomainVerification to false.";h(r),alert(r),o(!0)}else s.receive(function(e){if(0===e.data.indexOf("helloback:")){var t=e.data.split(":")[1]==i;o(t)}},e);s.send("hello:"+i,t)}else d("Callback not supplied by HelloSign. Please contact support.");else d("Token not supplied by HelloSign. Please contact support.");else o(!0)},getWindowDimensions:function(e){var t,i,n=p()?window.pageXOffset:u()?document.documentElement.scrollLeft:document.body.scrollLeft,o=p()?window.pageYOffset:u()?document.documentElement.scrollTop:document.body.scrollTop;this.isOldIE?(t=document.body.clientWidth,i=document.body.clientHeight):(t=window.innerWidth,i=window.innerHeight);var r=this.isInPage&&e?e:Math.max(this.MIN_HEIGHT,i-60);return{widthString:(this.uxVersion>1?Math.min(this.DEFAULT_WIDTH,t*this.IFRAME_WIDTH_RATIO):this.DEFAULT_WIDTH)+"px",heightString:r+"px",heightRaw:r,scrollX:n,scrollY:o,top:Math.max(0,o+parseInt((i-r)/2,10))+"px",left:Math.max(0,parseInt((t-this.DEFAULT_WIDTH)/2,10))+"px"}},getMobileDimensions:function(){var e,t=screen.width,i=(screen.height,window.innerWidth);return(e=window.innerHeight>i?{widthString:this.isDefaultUX?"100vw":t+"px",heightString:this.isDefaultUX?"100vh":"100%"}:{widthString:i+"px",heightString:this.isDefaultUX?"100vh":"100%"}).top="0",e.left="0",e},inArray:function(e,t){if(this.hasJQuery)return $.inArray(e,t);if(t)for(var i=0;i<t.length;i++)if(t[i]==e)return i;return-1},safeUrl:function(e){if(e)try{e=(e=e.replace(/</g,"&lt;")).replace(/>/g,"&gt;");var t=document.createElement("div");t.innerHTML=e;var i=t.innerText;e=i||e.replace(/\&amp\;/g,"&")}catch(e){h("Could not decode url: "+e)}return e}};function d(e){void 0!==e&&(window.console&&console.log?console.log(e):alert(e))}function h(e){c.isDebugEnabled&&void 0!==e&&window.console&&console.log&&console.log(e)}function u(){return"CSS1Compat"===(document.compatMode||"")}function p(){return void 0!==window.pageXOffset}window.HelloSign=c,e.exports=c}()}])});

Sorry, the diff of this file is too big to display

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