@viibe/impulse-integration-js 2.4.1 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1727957274813" clover="3.2.0">
3
- <project timestamp="1727957274813" name="All files">
2
+ <coverage generated="1727958043332" clover="3.2.0">
3
+ <project timestamp="1727958043332" name="All files">
4
4
  <metrics statements="1" coveredstatements="1" conditionals="115" coveredconditionals="41" methods="31" coveredmethods="14" elements="147" coveredelements="56" complexity="0" loc="1" ncloc="1" packages="1" files="1" classes="1"/>
5
5
  <file name="index.js" path="/home/charlesdemee/Documents/CODE/viibe-impulse/impulse-integration-js/dist/index.js">
6
6
  <metrics statements="1" coveredstatements="1" conditionals="115" coveredconditionals="41" methods="31" coveredmethods="14"/>
@@ -101,7 +101,7 @@
101
101
  <div class='footer quiet pad2 space-top1 center small'>
102
102
  Code coverage generated by
103
103
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
104
- at Thu Oct 03 2024 14:07:54 GMT+0200 (Central European Summer Time)
104
+ at Thu Oct 03 2024 14:20:43 GMT+0200 (Central European Summer Time)
105
105
  </div>
106
106
  <script src="prettify.js"></script>
107
107
  <script>
@@ -63,14 +63,14 @@
63
63
  </div>
64
64
  <div class='status-line medium'></div>
65
65
  <pre><table class="coverage">
66
- <tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">9x</span></td><td class="text"><pre class="prettyprint lang-js">(()=&gt;{var t={579:t=&gt;{function n(t,n){<span class="missing-if-branch" title="if path not taken" >I</span>if(!(t instanceof n))<span class="cstat-no" title="statement not covered" >throw new TypeError("Cannot call a class as a function")}</span>function e(t,n){for(var e=0;e&lt;n.length;e++){var o=n[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&amp;&amp;(o.writable=!0),Object.defineProperty(t,o.key,o)}}function o(t,n,o){return n&amp;&amp;e(t.prototype,n),o&amp;&amp;<span class="branch-1 cbranch-no" title="branch not covered" >e(t,o),</span>t}function i(t){return <span class="fstat-no" title="function not covered" >fu</span>nction(n){<span class="cstat-no" title="statement not covered" >return Boolean(n.isTrusted&amp;&amp;0===n.origin.indexOf(t))}</span>}function <span class="fstat-no" title="function not covered" >a(</span>t){var n=<span class="cstat-no" title="statement not covered" >new URL(t),</span>e=<span class="cstat-no" title="statement not covered" >"".concat(n.protocol,"//").concat(n.host),</span>o=<span class="cstat-no" title="statement not covered" >window.screen.width/2-240,</span>a=<span class="cstat-no" title="statement not covered" >window.screen.height/2-300,</span>r=<span class="cstat-no" title="statement not covered" >["toolbar=no","location=no","directories=no","status=no","menubar=no","scrollbars=no","resizable=no","copyhistory=no","width=".concat(480),"height=".concat(600),"top=".concat(a),"left=".concat(o)];<span class="cstat-no" title="statement not covered" ></span>return new Promise((<span class="fstat-no" title="function not covered" >fu</span>nction(n,o){var a=<span class="cstat-no" title="statement not covered" >window.open(t,"Authorization",r.join(", "));<span class="cstat-no" title="statement not covered" ></span>a||o("Failed to open window");v</span>ar c=<span class="cstat-no" title="statement not covered" >setInterval((<span class="fstat-no" title="function not covered" >fu</span>nction(){<span class="cstat-no" title="statement not covered" >a.closed&amp;&amp;(s(),o("User closed window"))}</span>),100);</span>function <span class="fstat-no" title="function not covered" >s(</span>){<span class="cstat-no" title="statement not covered" >window.removeEventListener("message",u),clearInterval(c)}</span>function <span class="fstat-no" title="function not covered" >u(</span>t){<span class="cstat-no" title="statement not covered" >if(!i(e)(t))<span class="cstat-no" title="statement not covered" >return null;<span class="cstat-no" title="statement not covered" >i</span></span>f(t.data.token&amp;&amp;(s(),n(t.data.token)),t.data.error&amp;&amp;(s(),o(t.data.error)),t.data&amp;&amp;t.data.event&amp;&amp;t.data.payload)<span class="cstat-no" title="statement not covered" >switch(t.data.event){case"authentication:success":<span class="cstat-no" title="statement not covered" >return s(),n(t.data);c</span>ase"authentication:failure":<span class="cstat-no" title="statement not covered" >return s(),o(t.data)}<span class="cstat-no" title="statement not covered" ></span>r</span></span>eturn null}<span class="cstat-no" title="statement not covered" ></span>window.addEventListener("message",u)}</span>))}</span>var r=function(){function <span class="fstat-no" title="function not covered" >t(</span>){var e=<span class="cstat-no" title="statement not covered" >arguments.length&gt;0&amp;&amp;void 0!==arguments[0]?arguments[0]:"auth.viibe.pro";<span class="cstat-no" title="statement not covered" ></span>n(this,t),this.host=e}</span>return o(t,[{key:"loginZendesk",value:<span class="fstat-no" title="function not covered" >fu</span>nction(t){var n=<span class="cstat-no" title="statement not covered" >document.location.origin;<span class="cstat-no" title="statement not covered" ></span>return a("https://".concat(this.host,"/auth/zendesk/login?subdomain=").concat(t,"&amp;origin=").concat(n))}</span>}]),t}(),c=function(){function t(e){n(this,t),this.handlers=[],this.host=e.host,this.origin=/^localhost/.test(this.host)?"http://".concat(this.host):"https://".concat(this.host),this.apiOrigin=/^localhost/.test(this.host)?"http://".concat(this.host):"https://api-".concat(this.host),this.source=e.source,this.isViibeEvent=i(this.origin),window.addEventListener("message",this.onMessage.bind(this))}return o(t,[{key:"createNotificationIframe",value:function(){if(!this.host)throw new Error("fillHost");if(!this.source)throw new Error("fillSource");var t=document.createElement("iframe");return t.name="viibe-".concat(Math.floor(1e4*Math.random())),t.style="border: 0;width: 0;",t.src="".concat(this.origin,"/integration/features/notifications"),t}},{key:"createCallIframe",value:function(){var t=this,n=arguments.length&gt;0&amp;&amp;<span class="branch-1 cbranch-no" title="branch not covered" >void 0!==arguments[0]?<span class="branch-0 cbranch-no" title="branch not covered" ></span>arguments[0]:</span>{};if(!this.host)throw new Error("fillHost");if(!this.source)throw new Error("fillSource");var e=this.generateIframeSrc(n),o=document.createElement("iframe");return o.name="viibe-".concat(Math.floor(1e4*Math.random())),o.style="border: 0;width: calc(100% - 1rem);margin: 0.5rem;",o.src=e,o.allow="geolocation;autoplay;microphone;camera;midi;encrypted-media;clipboard-write;",this.on(o,"document",(<span class="fstat-no" title="function not covered" >fu</span>nction(n){<span class="cstat-no" title="statement not covered" >return t.onDocument(n)}</span>)),o}},{key:"generateIframeSrc",value:function(){var t=arguments.length&gt;0&amp;&amp;void 0!==arguments[0]?arguments[0]:<span class="branch-1 cbranch-no" title="branch not covered" >{},</span>n=t.clipboard,e=void 0!==n&amp;&amp;<span class="branch-1 cbranch-no" title="branch not covered" >n,</span>o=t.components,i=t.links,a=t.o2m,r=void 0!==a&amp;&amp;<span class="branch-1 cbranch-no" title="branch not covered" >a,</span>c=t.ticket,s=t.locale,u=t.standalone,l=t.suggestions,h=t.token,d="".concat(this.origin,"/integration/features/ticket"),f=new URLSearchParams({origin:document.location.origin,resize:"true",source:this.source});<span class="missing-if-branch" title="if path not taken" >I</span>if(c&amp;&amp;<span class="branch-1 cbranch-no" title="branch not covered" >c.title&amp;</span>&amp;<span class="branch-2 cbranch-no" title="branch not covered" >f.set("title",c.title),</span>c&amp;&amp;<span class="branch-1 cbranch-no" title="branch not covered" >c.integration)</span>{<span class="cstat-no" title="statement not covered" >f.set("thirdPartyId",c.integration.id);v</span>ar v=<span class="cstat-no" title="statement not covered" >(c.integration.customData||{}).entUuid;<span class="cstat-no" title="statement not covered" ></span>v&amp;&amp;f.set("entUuid",v)}<span class="missing-if-branch" title="if path not taken" >I</span></span>if(i){var m=<span class="cstat-no" title="statement not covered" >i instanceof Array?i.map((<span class="fstat-no" title="function not covered" >fu</span>nction(t){<span class="cstat-no" title="statement not covered" >return"".concat(t.category,":").concat(t.value)}</span>)).join(","):String(i);<span class="cstat-no" title="statement not covered" ></span>f.set("links",m)}<span class="missing-if-branch" title="if path not taken" >I</span></span>if(l){var w=<span class="cstat-no" title="statement not covered" >l instanceof Array?l.map((<span class="fstat-no" title="function not covered" >fu</span>nction(t){var n=<span class="cstat-no" title="statement not covered" >t.category,</span>e=<span class="cstat-no" title="statement not covered" >t.value,</span>o=<span class="cstat-no" title="statement not covered" >t.description,</span>i=<span class="cstat-no" title="statement not covered" >"".concat(n,":").concat(e);<span class="cstat-no" title="statement not covered" ></span>return o&amp;&amp;(i+=":".concat(o)),i}</span>)).join(","):String(l);<span class="cstat-no" title="statement not covered" ></span>f.set("suggestions",w)}<span class="missing-if-branch" title="if path not taken" >I</span></span>if(h&amp;&amp;<span class="branch-1 cbranch-no" title="branch not covered" >t.set("token",h),</span>s&amp;&amp;<span class="branch-1 cbranch-no" title="branch not covered" >f.set("locale",s),</span>o){var p=<span class="cstat-no" title="statement not covered" >o instanceof Array?o.join(","):String(o);<span class="cstat-no" title="statement not covered" ></span>f.set("components",p)}</span>return u&amp;&amp;<span class="branch-1 cbranch-no" title="branch not covered" >f.set("standalone",Boolean(u)),</span>f.set("clipboard",Boolean(e)),f.set("o2m",Boolean(r)),d+"?".concat(f)}},{key:"dispatch",value:<span class="fstat-no" title="function not covered" >fu</span>nction(t,n,e,o){<span class="cstat-no" title="statement not covered" >return this.handlers.filter((<span class="fstat-no" title="function not covered" >fu</span>nction(n){<span class="cstat-no" title="statement not covered" >return n.eventName===t&amp;&amp;(!n.windowName||n.windowName===o)}</span>)).map((<span class="fstat-no" title="function not covered" >fu</span>nction(t){<span class="cstat-no" title="statement not covered" >return t.func(n,e)}</span>))}</span>},{key:"onMessage",value:<span class="fstat-no" title="function not covered" >fu</span>nction(t){<span class="cstat-no" title="statement not covered" >return this.isViibeEvent(t)?t.data&amp;&amp;t.data.event?this.dispatch(t.data.event,t.data.payload,t,t.data.windowName):t.data&amp;&amp;t.data.token?this.dispatch("authentication:token",t.data.token,t):t.data&amp;&amp;t.data.error?this.dispatch("authentication:error",t.data.error,t):null:null}</span>},{key:"on",value:function(t,n,e){"string"==typeof t&amp;&amp;<span class="branch-1 cbranch-no" title="branch not covered" >"function"==typeof n&amp;</span>&amp;<span class="branch-2 cbranch-no" title="branch not covered" >void 0===e&amp;</span>&amp;(<span class="branch-3 cbranch-no" title="branch not covered" >e=n,n=t,t=null)</span>;var o={eventName:n,func:e,windowName:t?t.name:<span class="branch-1 cbranch-no" title="branch not covered" >null}</span>;this.handlers.push(o)}},{key:"onDocument",value:<span class="fstat-no" title="function not covered" >fu</span>nction(t){<span class="cstat-no" title="statement not covered" >window.open(t.signed_url,"_blank")}</span>},{key:"authenticate",value:<span class="fstat-no" title="function not covered" >fu</span>nction(t){var n=<span class="cstat-no" title="statement not covered" >document.location,</span>e=<span class="cstat-no" title="statement not covered" >n.protocol,</span>o=<span class="cstat-no" title="statement not covered" >n.host;<span class="cstat-no" title="statement not covered" ></span>return a("".concat(e,"//api-").concat(o,"/auth/login/").concat(t,"?origin=").concat(origin))}</span>}]),t}();c.Auth=r,"undefined"!=typeof window&amp;&amp;(window.Viibe=c),t.exports=c}},n={},e=function e(o){var i=n[o];<span class="missing-if-branch" title="if path not taken" >I</span>if(void 0!==i)<span class="cstat-no" title="statement not covered" >return i.exports;v</span>ar a=n[o]={exports:{}};return t[o](a,a.exports,e),a.exports}(579);module.exports=e})();</pre></td></tr></table></pre>
66
+ <tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">9x</span></td><td class="text"><pre class="prettyprint lang-js">(()=&gt;{var t={579:t=&gt;{function n(t,n){<span class="missing-if-branch" title="if path not taken" >I</span>if(!(t instanceof n))<span class="cstat-no" title="statement not covered" >throw new TypeError("Cannot call a class as a function")}</span>function e(t,n){for(var e=0;e&lt;n.length;e++){var o=n[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&amp;&amp;(o.writable=!0),Object.defineProperty(t,o.key,o)}}function o(t,n,o){return n&amp;&amp;e(t.prototype,n),o&amp;&amp;<span class="branch-1 cbranch-no" title="branch not covered" >e(t,o),</span>t}function i(t){return <span class="fstat-no" title="function not covered" >fu</span>nction(n){<span class="cstat-no" title="statement not covered" >return Boolean(n.isTrusted&amp;&amp;0===n.origin.indexOf(t))}</span>}function <span class="fstat-no" title="function not covered" >a(</span>t){var n=<span class="cstat-no" title="statement not covered" >new URL(t),</span>e=<span class="cstat-no" title="statement not covered" >"".concat(n.protocol,"//").concat(n.host),</span>o=<span class="cstat-no" title="statement not covered" >window.screen.width/2-240,</span>a=<span class="cstat-no" title="statement not covered" >window.screen.height/2-300,</span>r=<span class="cstat-no" title="statement not covered" >["toolbar=no","location=no","directories=no","status=no","menubar=no","scrollbars=no","resizable=no","copyhistory=no","width=".concat(480),"height=".concat(600),"top=".concat(a),"left=".concat(o)];<span class="cstat-no" title="statement not covered" ></span>return new Promise((<span class="fstat-no" title="function not covered" >fu</span>nction(n,o){var a=<span class="cstat-no" title="statement not covered" >window.open(t,"Authorization",r.join(", "));<span class="cstat-no" title="statement not covered" ></span>a||o("Failed to open window");v</span>ar c=<span class="cstat-no" title="statement not covered" >setInterval((<span class="fstat-no" title="function not covered" >fu</span>nction(){<span class="cstat-no" title="statement not covered" >a.closed&amp;&amp;(s(),o("User closed window"))}</span>),100);</span>function <span class="fstat-no" title="function not covered" >s(</span>){<span class="cstat-no" title="statement not covered" >window.removeEventListener("message",u),clearInterval(c)}</span>function <span class="fstat-no" title="function not covered" >u(</span>t){<span class="cstat-no" title="statement not covered" >if(!i(e)(t))<span class="cstat-no" title="statement not covered" >return null;<span class="cstat-no" title="statement not covered" >i</span></span>f(t.data.token&amp;&amp;(s(),n(t.data.token)),t.data.error&amp;&amp;(s(),o(t.data.error)),t.data&amp;&amp;t.data.event&amp;&amp;t.data.payload)<span class="cstat-no" title="statement not covered" >switch(t.data.event){case"authentication:success":<span class="cstat-no" title="statement not covered" >return s(),n(t.data);c</span>ase"authentication:failure":<span class="cstat-no" title="statement not covered" >return s(),o(t.data)}<span class="cstat-no" title="statement not covered" ></span>r</span></span>eturn null}<span class="cstat-no" title="statement not covered" ></span>window.addEventListener("message",u)}</span>))}</span>var r=function(){function <span class="fstat-no" title="function not covered" >t(</span>){var e=<span class="cstat-no" title="statement not covered" >arguments.length&gt;0&amp;&amp;void 0!==arguments[0]?arguments[0]:"auth.viibe.pro";<span class="cstat-no" title="statement not covered" ></span>n(this,t),this.host=e}</span>return o(t,[{key:"loginZendesk",value:<span class="fstat-no" title="function not covered" >fu</span>nction(t){var n=<span class="cstat-no" title="statement not covered" >document.location.origin;<span class="cstat-no" title="statement not covered" ></span>return a("https://".concat(this.host,"/auth/zendesk/login?subdomain=").concat(t,"&amp;origin=").concat(n))}</span>}]),t}(),c=function(){function t(e){n(this,t),this.handlers=[],this.host=e.host,this.origin=/^localhost/.test(this.host)?"http://".concat(this.host):"https://".concat(this.host),this.apiOrigin=/^localhost/.test(this.host)?"http://".concat(this.host):"https://api-".concat(this.host),this.source=e.source,this.isViibeEvent=i(this.origin),window.addEventListener("message",this.onMessage.bind(this))}return o(t,[{key:"createNotificationIframe",value:function(){if(!this.host)throw new Error("fillHost");if(!this.source)throw new Error("fillSource");var t=document.createElement("iframe");return t.name="viibe-".concat(Math.floor(1e4*Math.random())),t.style="border: 0;width: 0;",t.src="".concat(this.origin,"/integration/features/notifications"),t}},{key:"createCallIframe",value:function(){var t=this,n=arguments.length&gt;0&amp;&amp;<span class="branch-1 cbranch-no" title="branch not covered" >void 0!==arguments[0]?<span class="branch-0 cbranch-no" title="branch not covered" ></span>arguments[0]:</span>{};if(!this.host)throw new Error("fillHost");if(!this.source)throw new Error("fillSource");var e=this.generateIframeSrc(n),o=document.createElement("iframe");return o.name="viibe-".concat(Math.floor(1e4*Math.random())),o.style="border: 0;width: calc(100% - 1rem);margin: 0.5rem;",o.src=e,o.allow="geolocation;autoplay;microphone;camera;midi;encrypted-media;clipboard-write;",this.on(o,"document",(<span class="fstat-no" title="function not covered" >fu</span>nction(n){<span class="cstat-no" title="statement not covered" >return t.onDocument(n)}</span>)),o}},{key:"generateIframeSrc",value:function(){var t=arguments.length&gt;0&amp;&amp;void 0!==arguments[0]?arguments[0]:<span class="branch-1 cbranch-no" title="branch not covered" >{},</span>n=t.clipboard,e=void 0!==n&amp;&amp;<span class="branch-1 cbranch-no" title="branch not covered" >n,</span>o=t.components,i=t.links,a=t.o2m,r=void 0!==a&amp;&amp;<span class="branch-1 cbranch-no" title="branch not covered" >a,</span>c=t.ticket,s=t.locale,u=t.standalone,l=t.suggestions,h=t.token,d="".concat(this.origin,"/integration/features/ticket"),f=new URLSearchParams({origin:document.location.origin,resize:"true",source:this.source});<span class="missing-if-branch" title="if path not taken" >I</span>if(c&amp;&amp;<span class="branch-1 cbranch-no" title="branch not covered" >c.title&amp;</span>&amp;<span class="branch-2 cbranch-no" title="branch not covered" >f.set("title",c.title),</span>c&amp;&amp;<span class="branch-1 cbranch-no" title="branch not covered" >c.integration)</span>{<span class="cstat-no" title="statement not covered" >f.set("thirdPartyId",c.integration.id);v</span>ar v=<span class="cstat-no" title="statement not covered" >(c.integration.customData||{}).entUuid;<span class="cstat-no" title="statement not covered" ></span>v&amp;&amp;f.set("entUuid",v)}<span class="missing-if-branch" title="if path not taken" >I</span></span>if(i){var m=<span class="cstat-no" title="statement not covered" >i instanceof Array?i.map((<span class="fstat-no" title="function not covered" >fu</span>nction(t){<span class="cstat-no" title="statement not covered" >return"".concat(t.category,":").concat(t.value)}</span>)).join(","):String(i);<span class="cstat-no" title="statement not covered" ></span>f.set("links",m)}<span class="missing-if-branch" title="if path not taken" >I</span></span>if(l){var w=<span class="cstat-no" title="statement not covered" >l instanceof Array?l.map((<span class="fstat-no" title="function not covered" >fu</span>nction(t){var n=<span class="cstat-no" title="statement not covered" >t.category,</span>e=<span class="cstat-no" title="statement not covered" >t.value,</span>o=<span class="cstat-no" title="statement not covered" >t.description,</span>i=<span class="cstat-no" title="statement not covered" >"".concat(n,":").concat(e);<span class="cstat-no" title="statement not covered" ></span>return o&amp;&amp;(i+=":".concat(o)),i}</span>)).join(","):String(l);<span class="cstat-no" title="statement not covered" ></span>f.set("suggestions",w)}<span class="missing-if-branch" title="if path not taken" >I</span></span>if(h&amp;&amp;<span class="branch-1 cbranch-no" title="branch not covered" >f.set("token",h),</span>s&amp;&amp;<span class="branch-1 cbranch-no" title="branch not covered" >f.set("locale",s),</span>o){var p=<span class="cstat-no" title="statement not covered" >o instanceof Array?o.join(","):String(o);<span class="cstat-no" title="statement not covered" ></span>f.set("components",p)}</span>return u&amp;&amp;<span class="branch-1 cbranch-no" title="branch not covered" >f.set("standalone",Boolean(u)),</span>f.set("clipboard",Boolean(e)),f.set("o2m",Boolean(r)),d+"?".concat(f)}},{key:"dispatch",value:<span class="fstat-no" title="function not covered" >fu</span>nction(t,n,e,o){<span class="cstat-no" title="statement not covered" >return this.handlers.filter((<span class="fstat-no" title="function not covered" >fu</span>nction(n){<span class="cstat-no" title="statement not covered" >return n.eventName===t&amp;&amp;(!n.windowName||n.windowName===o)}</span>)).map((<span class="fstat-no" title="function not covered" >fu</span>nction(t){<span class="cstat-no" title="statement not covered" >return t.func(n,e)}</span>))}</span>},{key:"onMessage",value:<span class="fstat-no" title="function not covered" >fu</span>nction(t){<span class="cstat-no" title="statement not covered" >return this.isViibeEvent(t)?t.data&amp;&amp;t.data.event?this.dispatch(t.data.event,t.data.payload,t,t.data.windowName):t.data&amp;&amp;t.data.token?this.dispatch("authentication:token",t.data.token,t):t.data&amp;&amp;t.data.error?this.dispatch("authentication:error",t.data.error,t):null:null}</span>},{key:"on",value:function(t,n,e){"string"==typeof t&amp;&amp;<span class="branch-1 cbranch-no" title="branch not covered" >"function"==typeof n&amp;</span>&amp;<span class="branch-2 cbranch-no" title="branch not covered" >void 0===e&amp;</span>&amp;(<span class="branch-3 cbranch-no" title="branch not covered" >e=n,n=t,t=null)</span>;var o={eventName:n,func:e,windowName:t?t.name:<span class="branch-1 cbranch-no" title="branch not covered" >null}</span>;this.handlers.push(o)}},{key:"onDocument",value:<span class="fstat-no" title="function not covered" >fu</span>nction(t){<span class="cstat-no" title="statement not covered" >window.open(t.signed_url,"_blank")}</span>},{key:"authenticate",value:<span class="fstat-no" title="function not covered" >fu</span>nction(t){var n=<span class="cstat-no" title="statement not covered" >document.location,</span>e=<span class="cstat-no" title="statement not covered" >n.protocol,</span>o=<span class="cstat-no" title="statement not covered" >n.host;<span class="cstat-no" title="statement not covered" ></span>return a("".concat(e,"//api-").concat(o,"/auth/login/").concat(t,"?origin=").concat(origin))}</span>}]),t}();c.Auth=r,"undefined"!=typeof window&amp;&amp;(window.Viibe=c),t.exports=c}},n={},e=function e(o){var i=n[o];<span class="missing-if-branch" title="if path not taken" >I</span>if(void 0!==i)<span class="cstat-no" title="statement not covered" >return i.exports;v</span>ar a=n[o]={exports:{}};return t[o](a,a.exports,e),a.exports}(579);module.exports=e})();</pre></td></tr></table></pre>
67
67
 
68
68
  <div class='push'></div><!-- for sticky footer -->
69
69
  </div><!-- /wrapper -->
70
70
  <div class='footer quiet pad2 space-top1 center small'>
71
71
  Code coverage generated by
72
72
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
73
- at Thu Oct 03 2024 14:07:54 GMT+0200 (Central European Summer Time)
73
+ at Thu Oct 03 2024 14:20:43 GMT+0200 (Central European Summer Time)
74
74
  </div>
75
75
  <script src="prettify.js"></script>
76
76
  <script>
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- (()=>{var t={579:t=>{function n(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function e(t,n){for(var e=0;e<n.length;e++){var o=n[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function o(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}function i(t){return function(n){return Boolean(n.isTrusted&&0===n.origin.indexOf(t))}}function a(t){var n=new URL(t),e="".concat(n.protocol,"//").concat(n.host),o=window.screen.width/2-240,a=window.screen.height/2-300,r=["toolbar=no","location=no","directories=no","status=no","menubar=no","scrollbars=no","resizable=no","copyhistory=no","width=".concat(480),"height=".concat(600),"top=".concat(a),"left=".concat(o)];return new Promise((function(n,o){var a=window.open(t,"Authorization",r.join(", "));a||o("Failed to open window");var c=setInterval((function(){a.closed&&(s(),o("User closed window"))}),100);function s(){window.removeEventListener("message",u),clearInterval(c)}function u(t){if(!i(e)(t))return null;if(t.data.token&&(s(),n(t.data.token)),t.data.error&&(s(),o(t.data.error)),t.data&&t.data.event&&t.data.payload)switch(t.data.event){case"authentication:success":return s(),n(t.data);case"authentication:failure":return s(),o(t.data)}return null}window.addEventListener("message",u)}))}var r=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"auth.viibe.pro";n(this,t),this.host=e}return o(t,[{key:"loginZendesk",value:function(t){var n=document.location.origin;return a("https://".concat(this.host,"/auth/zendesk/login?subdomain=").concat(t,"&origin=").concat(n))}}]),t}(),c=function(){function t(e){n(this,t),this.handlers=[],this.host=e.host,this.origin=/^localhost/.test(this.host)?"http://".concat(this.host):"https://".concat(this.host),this.apiOrigin=/^localhost/.test(this.host)?"http://".concat(this.host):"https://api-".concat(this.host),this.source=e.source,this.isViibeEvent=i(this.origin),window.addEventListener("message",this.onMessage.bind(this))}return o(t,[{key:"createNotificationIframe",value:function(){if(!this.host)throw new Error("fillHost");if(!this.source)throw new Error("fillSource");var t=document.createElement("iframe");return t.name="viibe-".concat(Math.floor(1e4*Math.random())),t.style="border: 0;width: 0;",t.src="".concat(this.origin,"/integration/features/notifications"),t}},{key:"createCallIframe",value:function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.host)throw new Error("fillHost");if(!this.source)throw new Error("fillSource");var e=this.generateIframeSrc(n),o=document.createElement("iframe");return o.name="viibe-".concat(Math.floor(1e4*Math.random())),o.style="border: 0;width: calc(100% - 1rem);margin: 0.5rem;",o.src=e,o.allow="geolocation;autoplay;microphone;camera;midi;encrypted-media;clipboard-write;",this.on(o,"document",(function(n){return t.onDocument(n)})),o}},{key:"generateIframeSrc",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.clipboard,e=void 0!==n&&n,o=t.components,i=t.links,a=t.o2m,r=void 0!==a&&a,c=t.ticket,s=t.locale,u=t.standalone,l=t.suggestions,h=t.token,d="".concat(this.origin,"/integration/features/ticket"),f=new URLSearchParams({origin:document.location.origin,resize:"true",source:this.source});if(c&&c.title&&f.set("title",c.title),c&&c.integration){f.set("thirdPartyId",c.integration.id);var v=(c.integration.customData||{}).entUuid;v&&f.set("entUuid",v)}if(i){var m=i instanceof Array?i.map((function(t){return"".concat(t.category,":").concat(t.value)})).join(","):String(i);f.set("links",m)}if(l){var w=l instanceof Array?l.map((function(t){var n=t.category,e=t.value,o=t.description,i="".concat(n,":").concat(e);return o&&(i+=":".concat(o)),i})).join(","):String(l);f.set("suggestions",w)}if(h&&t.set("token",h),s&&f.set("locale",s),o){var p=o instanceof Array?o.join(","):String(o);f.set("components",p)}return u&&f.set("standalone",Boolean(u)),f.set("clipboard",Boolean(e)),f.set("o2m",Boolean(r)),d+"?".concat(f)}},{key:"dispatch",value:function(t,n,e,o){return this.handlers.filter((function(n){return n.eventName===t&&(!n.windowName||n.windowName===o)})).map((function(t){return t.func(n,e)}))}},{key:"onMessage",value:function(t){return this.isViibeEvent(t)?t.data&&t.data.event?this.dispatch(t.data.event,t.data.payload,t,t.data.windowName):t.data&&t.data.token?this.dispatch("authentication:token",t.data.token,t):t.data&&t.data.error?this.dispatch("authentication:error",t.data.error,t):null:null}},{key:"on",value:function(t,n,e){"string"==typeof t&&"function"==typeof n&&void 0===e&&(e=n,n=t,t=null);var o={eventName:n,func:e,windowName:t?t.name:null};this.handlers.push(o)}},{key:"onDocument",value:function(t){window.open(t.signed_url,"_blank")}},{key:"authenticate",value:function(t){var n=document.location,e=n.protocol,o=n.host;return a("".concat(e,"//api-").concat(o,"/auth/login/").concat(t,"?origin=").concat(origin))}}]),t}();c.Auth=r,"undefined"!=typeof window&&(window.Viibe=c),t.exports=c}},n={},e=function e(o){var i=n[o];if(void 0!==i)return i.exports;var a=n[o]={exports:{}};return t[o](a,a.exports,e),a.exports}(579);module.exports=e})();
1
+ (()=>{var t={579:t=>{function n(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function e(t,n){for(var e=0;e<n.length;e++){var o=n[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function o(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}function i(t){return function(n){return Boolean(n.isTrusted&&0===n.origin.indexOf(t))}}function a(t){var n=new URL(t),e="".concat(n.protocol,"//").concat(n.host),o=window.screen.width/2-240,a=window.screen.height/2-300,r=["toolbar=no","location=no","directories=no","status=no","menubar=no","scrollbars=no","resizable=no","copyhistory=no","width=".concat(480),"height=".concat(600),"top=".concat(a),"left=".concat(o)];return new Promise((function(n,o){var a=window.open(t,"Authorization",r.join(", "));a||o("Failed to open window");var c=setInterval((function(){a.closed&&(s(),o("User closed window"))}),100);function s(){window.removeEventListener("message",u),clearInterval(c)}function u(t){if(!i(e)(t))return null;if(t.data.token&&(s(),n(t.data.token)),t.data.error&&(s(),o(t.data.error)),t.data&&t.data.event&&t.data.payload)switch(t.data.event){case"authentication:success":return s(),n(t.data);case"authentication:failure":return s(),o(t.data)}return null}window.addEventListener("message",u)}))}var r=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"auth.viibe.pro";n(this,t),this.host=e}return o(t,[{key:"loginZendesk",value:function(t){var n=document.location.origin;return a("https://".concat(this.host,"/auth/zendesk/login?subdomain=").concat(t,"&origin=").concat(n))}}]),t}(),c=function(){function t(e){n(this,t),this.handlers=[],this.host=e.host,this.origin=/^localhost/.test(this.host)?"http://".concat(this.host):"https://".concat(this.host),this.apiOrigin=/^localhost/.test(this.host)?"http://".concat(this.host):"https://api-".concat(this.host),this.source=e.source,this.isViibeEvent=i(this.origin),window.addEventListener("message",this.onMessage.bind(this))}return o(t,[{key:"createNotificationIframe",value:function(){if(!this.host)throw new Error("fillHost");if(!this.source)throw new Error("fillSource");var t=document.createElement("iframe");return t.name="viibe-".concat(Math.floor(1e4*Math.random())),t.style="border: 0;width: 0;",t.src="".concat(this.origin,"/integration/features/notifications"),t}},{key:"createCallIframe",value:function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.host)throw new Error("fillHost");if(!this.source)throw new Error("fillSource");var e=this.generateIframeSrc(n),o=document.createElement("iframe");return o.name="viibe-".concat(Math.floor(1e4*Math.random())),o.style="border: 0;width: calc(100% - 1rem);margin: 0.5rem;",o.src=e,o.allow="geolocation;autoplay;microphone;camera;midi;encrypted-media;clipboard-write;",this.on(o,"document",(function(n){return t.onDocument(n)})),o}},{key:"generateIframeSrc",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.clipboard,e=void 0!==n&&n,o=t.components,i=t.links,a=t.o2m,r=void 0!==a&&a,c=t.ticket,s=t.locale,u=t.standalone,l=t.suggestions,h=t.token,d="".concat(this.origin,"/integration/features/ticket"),f=new URLSearchParams({origin:document.location.origin,resize:"true",source:this.source});if(c&&c.title&&f.set("title",c.title),c&&c.integration){f.set("thirdPartyId",c.integration.id);var v=(c.integration.customData||{}).entUuid;v&&f.set("entUuid",v)}if(i){var m=i instanceof Array?i.map((function(t){return"".concat(t.category,":").concat(t.value)})).join(","):String(i);f.set("links",m)}if(l){var w=l instanceof Array?l.map((function(t){var n=t.category,e=t.value,o=t.description,i="".concat(n,":").concat(e);return o&&(i+=":".concat(o)),i})).join(","):String(l);f.set("suggestions",w)}if(h&&f.set("token",h),s&&f.set("locale",s),o){var p=o instanceof Array?o.join(","):String(o);f.set("components",p)}return u&&f.set("standalone",Boolean(u)),f.set("clipboard",Boolean(e)),f.set("o2m",Boolean(r)),d+"?".concat(f)}},{key:"dispatch",value:function(t,n,e,o){return this.handlers.filter((function(n){return n.eventName===t&&(!n.windowName||n.windowName===o)})).map((function(t){return t.func(n,e)}))}},{key:"onMessage",value:function(t){return this.isViibeEvent(t)?t.data&&t.data.event?this.dispatch(t.data.event,t.data.payload,t,t.data.windowName):t.data&&t.data.token?this.dispatch("authentication:token",t.data.token,t):t.data&&t.data.error?this.dispatch("authentication:error",t.data.error,t):null:null}},{key:"on",value:function(t,n,e){"string"==typeof t&&"function"==typeof n&&void 0===e&&(e=n,n=t,t=null);var o={eventName:n,func:e,windowName:t?t.name:null};this.handlers.push(o)}},{key:"onDocument",value:function(t){window.open(t.signed_url,"_blank")}},{key:"authenticate",value:function(t){var n=document.location,e=n.protocol,o=n.host;return a("".concat(e,"//api-").concat(o,"/auth/login/").concat(t,"?origin=").concat(origin))}}]),t}();c.Auth=r,"undefined"!=typeof window&&(window.Viibe=c),t.exports=c}},n={},e=function e(o){var i=n[o];if(void 0!==i)return i.exports;var a=n[o]={exports:{}};return t[o](a,a.exports,e),a.exports}(579);module.exports=e})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viibe/impulse-integration-js",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "engines": {
5
5
  "node": ">= 10.0.0"
6
6
  },
package/src/index.js CHANGED
@@ -248,7 +248,7 @@ class Viibe {
248
248
  }
249
249
 
250
250
  if (token) {
251
- params.set('token', token);
251
+ urlParams.set('token', token);
252
252
  }
253
253
 
254
254
  if (locale) {