hellosign-embedded
Advanced tools
Comparing version 1.7.0 to 1.7.1
{ | ||
"name": "hellosign-embedded", | ||
"version": "1.7.0", | ||
"version": "1.7.1", | ||
"description": "Embed HelloSign signature requests and templates from within your web application.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/HelloFax/hellosign-embedded", |
@@ -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.7.0",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,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:{CS_CZ:"cs-CZ",DA_DK:"da-DK",DE_DE:"de-DE",EN_GB:"en-GB",EN_US:"en-US",ES_LA:"es-LA",ES_ES:"es-ES",ES_MX:"es-MX",FR_FR:"fr-FR",ID_ID:"id-ID",IT_IT:"it-IT",JA_JP:"ja-JP",KO_KR:"ko-KR",MS_MY:"ms-MY",NB_NO:"nb-NO",NL_NL:"nl-NL",PL_PL:"pl-PL",PT_BR:"pt-BR",RU_RU:"ru-RU",SV_SE:"sv-SE",TH_TH:"th-TH",UK_UA:"uk-UA",ZH_CN:"zh-CN",ZH_TW:"zh-TW",init:function(){return this.supportedCultures=[this.CS_CZ,this.DA_DK,this.DE_DE,this.EN_GB,this.EN_US,this.ES_LA,this.ES_ES,this.ES_MX,this.FR_FR,this.ID_ID,this.IT_IT,this.JA_JP,this.KO_KR,this.MS_MY,this.NB_NO,this.NL_NL,this.PL_PL,this.PT_BR,this.RU_RU,this.SV_SE,this.TH_TH,this.UK_UA,this.ZH_CN,this.ZH_TW],this}}.init(),isDebugEnabled:window.isDebugEnabled,EVENT_SIGNED:"signature_request_signed",EVENT_DECLINED:"signature_request_declined",EVENT_CANCELED:"signature_request_canceled",EVENT_REASSIGNED:"signature_request_reassigned",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.healthCheckTimeoutMs=e.healthCheckTimeoutMs,!a)throw new TypeError("Must provide arguments to open()");if(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.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"}for(var _ in 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||(window.onresize=v),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.iframe.setAttribute("height",b.heightRaw),-1===a.indexOf("embeddedSign")&&(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 y=this[_];if(y)for(var I in w[_])try{y.style[I]=w[_][I]}catch(e){h(e)}}if(this.cancelButton&&(this.isFF||this.isOpera)){var T=this.cancelButton.getAttribute("style");T+=T?"; ":"",T+="background-image: "+w.cancelButton["background-image"]+"; ",T+="background-position: "+w.cancelButton["background-position"]+";",this.cancelButton.setAttribute("style",T)}this.isInPage||this.isMobile||v(),this.isMobile&&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){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&&r({event:c.EVENT_CANCELED});else if("decline"==i.data)c.close(),r({event:c.EVENT_DECLINED});else if("reassign"==i.data)r({event:c.EVENT_REASSIGNED});else if("user-done"==i.data)c.close();else if("string"==typeof i.data&&0===i.data.indexOf("hello:")){var h=i.data.split(":")[1];s.send("helloback:"+h,a,l)}else if(r&&i.data&&"string"==typeof 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&&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:Math.min(this.DEFAULT_WIDTH,t*this.IFRAME_WIDTH_RATIO)+"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:t+"px",heightString:"100%"}:{widthString:i+"px",heightString:"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,"<")).replace(/>/g,">");var t=document.createElement("div");t.innerHTML=e;var i=t.innerText;e=i||e.replace(/\&\;/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.7.1",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,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:{CS_CZ:"cs-CZ",DA_DK:"da-DK",DE_DE:"de-DE",EN_GB:"en-GB",EN_US:"en-US",ES_LA:"es-LA",ES_ES:"es-ES",ES_MX:"es-MX",FR_FR:"fr-FR",ID_ID:"id-ID",IT_IT:"it-IT",JA_JP:"ja-JP",KO_KR:"ko-KR",MS_MY:"ms-MY",NB_NO:"nb-NO",NL_NL:"nl-NL",PL_PL:"pl-PL",PT_BR:"pt-BR",RU_RU:"ru-RU",SV_SE:"sv-SE",TH_TH:"th-TH",UK_UA:"uk-UA",ZH_CN:"zh-CN",ZH_TW:"zh-TW",init:function(){return this.supportedCultures=[this.CS_CZ,this.DA_DK,this.DE_DE,this.EN_GB,this.EN_US,this.ES_LA,this.ES_ES,this.ES_MX,this.FR_FR,this.ID_ID,this.IT_IT,this.JA_JP,this.KO_KR,this.MS_MY,this.NB_NO,this.NL_NL,this.PL_PL,this.PT_BR,this.RU_RU,this.SV_SE,this.TH_TH,this.UK_UA,this.ZH_CN,this.ZH_TW],this}}.init(),isDebugEnabled:window.isDebugEnabled,EVENT_SIGNED:"signature_request_signed",EVENT_DECLINED:"signature_request_declined",EVENT_CANCELED:"signature_request_canceled",EVENT_REASSIGNED:"signature_request_reassigned",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.healthCheckTimeoutMs=e.healthCheckTimeoutMs,!a)throw new TypeError("Must provide arguments to open()");if(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,u=d.replace("_","-");if(-1===this.inArray(u,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="+u,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 p,f,m,g,b=(a+="&js_version="+this.VERSION).replace(/([^:]+:\/\/[^\/]+).*/,"$1"),w=this.getWindowDimensions(e.height),v={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:w.top,left:w.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}},E=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.isInPage)v.wrapper.width="100%",v.wrapper.height=w.heightString,v.iframe.width="100%",v.iframe.height=w.heightString,v.iframe.border="none",v.iframe["box-shadow"]="none",v.cancelButton.display="none",this.isMobile&&(v.iframe.width="1px",v.iframe["min-width"]="100%");else if(this.isMobile){var _=this.getMobileDimensions();v.wrapper.position="absolute",v.wrapper.top="0",v.wrapper.left="0",v.wrapper.width=_.widthString,v.wrapper.height=_.heightString,v.iframe.position="absolute",v.iframe.top=0,v.iframe.left=0,v.iframe.width=_.widthString,v.iframe.height=_.heightString,v.iframe.border="none",v.iframe["box-shadow"]="none",v.cancelButton.display="none"}for(var y in 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||(window.onresize=E),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.iframe.setAttribute("height",w.heightRaw),-1===a.indexOf("embeddedSign")&&(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))),v){var I=this[y];if(I)for(var T in v[y])try{I.style[T]=v[y][T]}catch(e){h(e)}}if(this.cancelButton&&(this.isFF||this.isOpera)){var S=this.cancelButton.getAttribute("style");S+=S?"; ":"",S+="background-image: "+v.cancelButton["background-image"]+"; ",S+="background-position: "+v.cancelButton["background-position"]+";",this.cancelButton.setAttribute("style",S)}this.isInPage||this.isMobile||E(),this.isMobile&&window===window.top&&l.set(),this.isMobile&&!this.isInPage&&(this.fixIframe=(p=function(){window.scrollTo(0,0)},f=1e3,function(){var e=this,t=arguments,i=m&&!g;clearTimeout(g),g=setTimeout(function(){g=null,m||p.apply(e,t)},f),i&&p.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){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&&r({event:c.EVENT_CANCELED});else if("decline"==i.data)c.close(),r({event:c.EVENT_DECLINED});else if("reassign"==i.data)r({event:c.EVENT_REASSIGNED});else if("user-done"==i.data)c.close();else if("string"==typeof i.data&&0===i.data.indexOf("hello:")){var h=i.data.split(":")[1];s.send("helloback:"+h,a,l)}else if(r&&i.data&&"string"==typeof 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)}},b)},close:function(){if(this.isMobile&&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:Math.min(this.DEFAULT_WIDTH,t*this.IFRAME_WIDTH_RATIO)+"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:t+"px",heightString:"100%"}:{widthString:i+"px",heightString:"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,"<")).replace(/>/g,">");var t=document.createElement("div");t.innerHTML=e;var i=t.innerText;e=i||e.replace(/\&\;/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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
163063
969