@pendo/agent 2.284.0 → 2.285.1
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.
- package/dist/debugger-plugin.min.js +4 -1
- package/dist/dom.esm.js +9 -19
- package/dist/pendo.debugger.min.js +17 -50
- package/dist/pendo.module.js +395 -120
- package/dist/pendo.module.min.js +10 -10
- package/dist/pendo.preview.min.js +8 -44
- package/dist/replay.worker.min.js +3 -3
- package/package.json +1 -1
|
@@ -1 +1,4 @@
|
|
|
1
|
-
!function(){"use strict";class e{constructor(e,t){this.path=e,this.handler=t}}class t{routes={};addRoute(t,n){this.routes[t]||(this.routes[t]=[]),this.routes[t].unshift(new e(t,n))}removeRoute(e){this.routes[e].shift()}lookupRouteProvider(){return e=>this.routes[e]?this.routes[e][0].handler:void 0}}var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var o=Array.isArray,r="object"==typeof n&&n&&n.Object===Object&&n,s="object"==typeof self&&self&&self.Object===Object&&self,a=r||s||Function("return this")(),d=a.Symbol,c=d,u=Object.prototype,l=u.hasOwnProperty,p=u.toString,h=c?c.toStringTag:void 0;var g=function(e){var t=l.call(e,h),n=e[h];try{e[h]=void 0;var i=!0}catch(e){}var o=p.call(e);return i&&(t?e[h]=n:delete e[h]),o},f=Object.prototype.toString;var v=g,b=function(e){return f.call(e)},y=d?d.toStringTag:void 0;var m=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":y&&y in Object(e)?v(e):b(e)};var w=m,_=function(e){return null!=e&&"object"==typeof e};var T=function(e){return"symbol"==typeof e||_(e)&&"[object Symbol]"==w(e)},P=o,C=T,I=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,E=/^\w*$/;var R=function(e,t){if(P(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!C(e))||(E.test(e)||!I.test(e)||null!=t&&e in Object(t))};var S=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},z=m,O=S;var N,A=function(e){if(!O(e))return!1;var t=z(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},H=a["__core-js_shared__"],$=(N=/[^.]+$/.exec(H&&H.keys&&H.keys.IE_PROTO||""))?"Symbol(src)_1."+N:"";var D=function(e){return!!$&&$ in e},x=Function.prototype.toString;var j=A,k=D,M=S,L=function(e){if(null!=e){try{return x.call(e)}catch(e){}try{return e+""}catch(e){}}return""},G=/^\[object .+?Constructor\]$/,W=Function.prototype,F=Object.prototype,U=W.toString,q=F.hasOwnProperty,B=RegExp("^"+U.call(q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Q=function(e){return!(!M(e)||k(e))&&(j(e)?B:G).test(L(e))},K=function(e,t){return null==e?void 0:e[t]};var J=function(e,t){var n=K(e,t);return Q(n)?n:void 0},X=J(Object,"create"),Y=X;var V=function(){this.__data__=Y?Y(null):{},this.size=0};var Z=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ee=X,te=Object.prototype.hasOwnProperty;var ne=function(e){var t=this.__data__;if(ee){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return te.call(t,e)?t[e]:void 0},ie=X,oe=Object.prototype.hasOwnProperty;var re=X;var se=V,ae=Z,de=ne,ce=function(e){var t=this.__data__;return ie?void 0!==t[e]:oe.call(t,e)},ue=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=re&&void 0===t?"__lodash_hash_undefined__":t,this};function le(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}le.prototype.clear=se,le.prototype.delete=ae,le.prototype.get=de,le.prototype.has=ce,le.prototype.set=ue;var pe=le;var he=function(){this.__data__=[],this.size=0};var ge=function(e,t){return e===t||e!=e&&t!=t};var fe=function(e,t){for(var n=e.length;n--;)if(ge(e[n][0],t))return n;return-1},ve=fe,be=Array.prototype.splice;var ye=fe;var me=fe;var we=fe;var _e=he,Te=function(e){var t=this.__data__,n=ve(t,e);return!(n<0)&&(n==t.length-1?t.pop():be.call(t,n,1),--this.size,!0)},Pe=function(e){var t=this.__data__,n=ye(t,e);return n<0?void 0:t[n][1]},Ce=function(e){return me(this.__data__,e)>-1},Ie=function(e,t){var n=this.__data__,i=we(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};function Ee(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}Ee.prototype.clear=_e,Ee.prototype.delete=Te,Ee.prototype.get=Pe,Ee.prototype.has=Ce,Ee.prototype.set=Ie;var Re=Ee,Se=J(a,"Map"),ze=pe,Oe=Re,Ne=Se;var Ae=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var He=function(e,t){var n=e.__data__;return Ae(t)?n["string"==typeof t?"string":"hash"]:n.map},$e=He;var De=He;var xe=He;var je=He;var ke=function(){this.size=0,this.__data__={hash:new ze,map:new(Ne||Oe),string:new ze}},Me=function(e){var t=$e(this,e).delete(e);return this.size-=t?1:0,t},Le=function(e){return De(this,e).get(e)},Ge=function(e){return xe(this,e).has(e)},We=function(e,t){var n=je(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};function Fe(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}Fe.prototype.clear=ke,Fe.prototype.delete=Me,Fe.prototype.get=Le,Fe.prototype.has=Ge,Fe.prototype.set=We;var Ue=Fe;function qe(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var i=arguments,o=t?t.apply(this,i):i[0],r=n.cache;if(r.has(o))return r.get(o);var s=e.apply(this,i);return n.cache=r.set(o,s)||r,s};return n.cache=new(qe.Cache||Ue),n}qe.Cache=Ue;var Be=qe;var Qe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ke=/\\(\\)?/g,Je=function(e){var t=Be(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Qe,(function(e,n,i,o){t.push(i?o.replace(Ke,"$1"):n||e)})),t}));var Xe=function(e,t){for(var n=-1,i=null==e?0:e.length,o=Array(i);++n<i;)o[n]=t(e[n],n,e);return o},Ye=o,Ve=T,Ze=d?d.prototype:void 0,et=Ze?Ze.toString:void 0;var tt=function e(t){if("string"==typeof t)return t;if(Ye(t))return Xe(t,e)+"";if(Ve(t))return et?et.call(t):"";var n=t+"";return"0"==n&&1/t==-Infinity?"-0":n},nt=tt;var it=o,ot=R,rt=Je,st=function(e){return null==e?"":nt(e)};var at=T;var dt=function(e,t){return it(e)?e:ot(e,t)?[e]:rt(st(e))},ct=function(e){if("string"==typeof e||at(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var ut=function(e,t){for(var n=0,i=(t=dt(t,e)).length;null!=e&&n<i;)e=e[ct(t[n++])];return n&&n==i?e:void 0};var lt=i((function(e,t,n){var i=null==e?void 0:ut(e,t);return void 0===i?n:i}));class pt{app=null;router=null;destination=window.parent||window.top;origin="*";constructor(e,t={}){this.app=e,this.router=e.router,this.config=t,this.events=e.PluginAPI.getEventable()}getConfig(e,t){return lt(this.config,e,t)}getDestinationProvider(){return()=>this.destination}getOriginProvider(){return()=>this.origin}triggerOpened(){this.events.trigger("opened",{containerType:this.type})}triggerClosed(){this.events.trigger("closed",{containerType:this.type})}}var ht={padding:"0 !important",margin:"0 !important","box-sizing":"border-box !important",border:"none !important",display:"block !important",visibility:"visible !important"},gt=2147483647,ft={WINDOW_MARGIN:10,HEADER_HEIGHT:50,TOP:100,LEFT:100,HEIGHT:700,WIDTH:500,MIN_HEIGHT:500,MIN_WIDTH:500};const{MIN_HEIGHT:vt,MIN_WIDTH:bt,WINDOW_MARGIN:yt}=ft;function mt(e,t,n,i,o){let r=0,s=0,a=0,d=0;function c(n){n.preventDefault(),t.css({visibility:"hidden"}),e.releasePointerCapture(n.pointerId),e.removeEventListener("pointermove",u),o()}function u(e){-1===e.button&&0!==e.buttons?(e.preventDefault(),a=r-e.clientX,d=s-e.clientY,r=e.clientX,s=e.clientY,i(a,d)):c(e)}e.addEventListener("pointerdown",(function(i){if(0!==i.button)return;i.preventDefault(),t.css({visibility:"visible"}),r=i.clientX,s=i.clientY,e.setPointerCapture(i.pointerId),e.addEventListener("pointermove",u),n()})),e.addEventListener("pointerup",c),e.addEventListener("pointerout",c)}function wt(e,t){const n=e.offsetLeft-t,i=window.innerWidth-e.offsetWidth-yt;return n<yt||i<yt?yt:n>i?i:n}function _t(e,t){const n=e.offsetTop-t,i=window.innerHeight-e.offsetHeight-yt;return n<yt||i<yt?yt:n>i?i:n}function Tt(e,t){const n=e.offsetWidth-t,i=window.innerWidth-e.offsetLeft-yt;return n>i?i:n<bt?bt:n}function Pt(e,t){const n=e.offsetHeight-t,i=window.innerHeight-e.offsetTop-yt;return n>i?i:n<vt?vt:n}class Ct extends pt{type="frame";destination=window.parent||window.top;origin=window.location.origin;constructor(e,t){super(e,t);const{pendo:n,PluginAPI:i}=e,o=this.getConfig("containerId","pendo-client-app");this.container=n.dom(`<div id="${o}" class="pendo-ignore">`).css({...ht,height:e.state.height,width:e.state.width,"z-index":gt-1,"background-color":"#FFFFFF",position:"fixed","box-shadow":"rgb(136, 136, 136) 0px 0px 20px 0px",overflow:"hidden"}),this.handle=n.dom('<div id="pendo-app-draggable-handle">').css({...ht,"z-index":gt,height:ft.HEADER_HEIGHT,width:"calc(100% - 100px)",position:"absolute",cursor:"grab"}).on("dblclick",(()=>{e.state.minimized||(this.container.css({height:ft.HEIGHT,width:ft.WIDTH,transition:"all 250ms linear"}),setTimeout((()=>{this.container&&(this.container.css({transition:"none"}),this.saveSize())}),250))})).appendTo(this.container),this.resizeHandle=n.dom('<div id="pendo-app-resize-handle">').css({...ht,"z-index":gt,visibility:this.app.state.minimized?"hidden":"visible",height:0,width:0,"border-left":"10px solid transparent","border-bottom":"10px solid rgb(136, 136, 136)",cursor:"nwse-resize",position:"absolute",bottom:0,right:0}).appendTo(this.container),this.frame=n.dom('<iframe id="pendo-agent-application" src="about:blank">').css({...ht,height:"100%",width:"100%"}).on("load",(()=>{if(i.ConfigReader.get("inlineStyleNonce")){const e=this.frame[0].contentDocument.createElement.bind(this.frame[0].contentDocument);this.frame[0].contentDocument.createElement=(t,...n)=>{const o=e(t,...n);if("style"===t){const e=i.ConfigReader.get("inlineStyleNonce");e&&o.setAttribute("nonce",e)}return o}}const t=document.createElement("script");var o;t.src=(o=n,o&&o.trustedTypesPolicy?o.trustedTypesPolicy:{createScriptURL:e=>e}).createScriptURL(i.getAssetUrl(e.assetName)),this.frame[0].contentDocument.body.appendChild(t),this.frame[0].contentWindow.ignoreIframeMonitor=!0,this.triggerOpened()})).appendTo(this.container),this.blockout=n.dom('<div id="pendo-app-dragging-blockout">').css({"z-index":gt-2,position:"absolute",height:"100%",width:"100%",top:0,left:0,visibility:"hidden"}).appendTo(n.dom.getBody()),this.elements=[this.container,this.blockout],this.positionFrame=e=>{let{left:t,top:n,height:i}=e;const{minimized:o,width:r}=e;t=t||ft.LEFT,n=n||ft.TOP,i=o?ft.HEADER_HEIGHT:i,t=wt({offsetLeft:t,offsetWidth:r},0),n=_t({offsetTop:n,offsetHeight:i},0),this.container.css({left:t,top:n,height:i}),this.savePosition()},this.saveSize=()=>{const{offsetHeight:e,offsetWidth:t}=this.container[0];e&&t&&this.app.setProperties({height:e,width:t})},this.savePosition=()=>{const{offsetLeft:e,offsetTop:t}=this.container[0];e&&t&&this.app.setProperties({left:e,top:t})},this.toggleMinimize=()=>{this.app.setProperties({minimized:!this.app.state.minimized}),this.resizeHandle.css({visibility:this.app.state.minimized?"hidden":"visible"}),this.positionFrame(this.app.state)},this.positionFrame(this.app.state),function(e,t){const n=e.handle[0],i=e.container[0];mt(n,e.blockout,(function(){n.style.cursor="grabbing"}),(function(e,t){i.style.left=`${wt(i,e)}px`,i.style.top=`${_t(i,t)}px`}),(function(){n.style.cursor="grab",t()}))}(this,this.savePosition),function(e,t){const n=e.resizeHandle[0],i=e.container[0];mt(n,e.blockout,(()=>{}),(function(e,t){i.style.width=`${Tt(i,e)}px`,i.style.height=`${Pt(i,t)}px`}),t)}(this,this.saveSize),window.addEventListener("resize",a),this.listeners=[["resize",a]];const r=n._.throttle((()=>function(e){const t=e.offsetLeft+e.offsetWidth+yt-window.innerWidth;t>0&&(e.style.left=`${wt(e,t)}px`,e.offsetWidth>bt&&(e.style.width=`${Tt(e,t)}px`));const n=e.offsetTop+e.offsetHeight+yt-window.innerHeight;n>0&&(e.style.top=`${_t(e,n)}px`,e.offsetHeight>vt&&(e.style.height=`${Pt(e,n)}px`))}(this.container[0])),10),s=n._.debounce((()=>{this.savePosition(),this.saveSize()}),1e3);function a(){r(),s()}}open(){return this.router.addRoute("app::toggleMinimize",this.toggleMinimize),this.container.appendTo(this.app.pendo.dom.getBody()),Promise.resolve()}close(){this.router.removeRoute("app::toggleMinimize"),this.listeners.forEach((([e,t])=>window.removeEventListener(e,t))),this.elements.forEach((e=>e.remove())),this.triggerClosed()}}const It=(...e)=>t=>[].concat(e).reduce(((e,n,i,o)=>{const r=n(e,t);return r||o.splice(i,o.length-i),r}),t);let Et=0;const Rt=(e,t)=>{if(!e||!t)return e;if(Array.isArray(e))for(let n=0;n<e.length;n++)t(e[n],n,e);else if("object"==typeof e)for(const n in e)e.hasOwnProperty(n)&&t(e[n],n,e);return e},St=e=>"function"==typeof e,zt="promise";function Ot(e,t,n){this.name=e,this.type=t,this.data=n}Ot.prototype.toString=function(){return`Message.${this.type} - ${this.name}`};const Nt=(e,t,n)=>{const i=new Ot(e,t,n);return t===zt&&(i.requestId=((e="")=>(Et+=1,e+Et))()),i},At=e=>{try{const{name:t,type:n,isResponse:i,data:o,requestId:r,sender:s}=e.data||{},a=new Ot(t,n,null!=o?JSON.parse(o):void 0);return a.requestId=r,a.sender=s,a.destination=e.source,a.isResponse=i,a}catch(e){return!1}},Ht=e=>{const t=((e,t)=>{if(!e||"object"!=typeof e)return{};const n=Array.isArray(t)?t:[t],i={};for(const t in e)e.hasOwnProperty(t)&&!n.includes(t)&&(i[t]=e[t]);return i})(e,["destination","toString","data"]);return t.data=JSON.stringify(e.data,((e,t)=>"function"==typeof t||t instanceof RegExp?t.toString?t.toString():void 0:t)),t},$t=e=>(e.isResponse=!0,e),Dt="disconnected",xt={lastMessageReceivedAt:0,currentConnectionQuality:Dt,changeCallbacks:{},evalCallbacks:{}},jt=e=>{e!==xt.currentConnectionQuality&&(xt.currentConnectionQuality=e,Rt(xt.changeCallbacks,(e=>{e(xt.currentConnectionQuality)})))},kt=()=>{if(0===xt.lastMessageReceivedAt)return void jt(Dt);const e=Date.now()-xt.lastMessageReceivedAt;e<1e4?jt("connected"):(e=>e>1e4)(e)&&((e=>e>3e4)(e)?jt("dead_connection"):jt(Dt)),Rt(xt.evalCallbacks,(e=>{e(xt.currentConnectionQuality)}))};let Mt;let Lt=0;const Gt=()=>{xt.currentConnectionQuality=Dt,xt.lastMessageReceivedAt=0},Wt={appName:void 0,connectionName:void 0,frameId:void 0,pendingRequests:{},topics:{},senderIds:{},originProvider:void 0,destinationProvider:void 0},Ft=()=>`${Wt.appName}${Wt.connectionName}(${Wt.frameId})`,Ut=e=>{e.sender||(e.sender=Ft());const t=e.destination||Wt.destinationProvider(),n=Ht(e),i=Qt(e.sender),o=Kt(e.sender);if(i||o)i?i.postMessage(n):t.postMessage(n,Wt.originProvider());else{const i=new MessageChannel;nn(i.port1,e.sender),t.postMessage(n,Wt.originProvider(),[i.port2])}},qt=(e,t,n=1e3)=>new Promise(((i,o)=>{const r=Nt(e,zt,t),s=setTimeout((()=>{o(`${e} timeout`),Xt(r),rn(r)}),n);Jt(r,(()=>clearTimeout(s)),i,o),Ut(r)})),Bt=e=>(Wt.senderIds[e]||(e=>{Wt.senderIds[e]||(Wt.senderIds[e]={port:void 0,hasTriedToUpgradeToMessageChannel:!1})})(e),Wt.senderIds[e]),Qt=e=>Bt(e).port,Kt=e=>Bt(e).hasTriedToUpgradeToMessageChannel,Jt=(e,t,n,i)=>{Wt.pendingRequests[e.requestId]={message:e,clearTimeoutfn:t,resolve:n,reject:i}},Xt=e=>{const{requestId:t}=e;return Wt.pendingRequests[t].clearTimeoutfn(),delete Wt.pendingRequests[t],e},Yt="message::ping",Vt=It((e=>{const t=Wt.pendingRequests[e.requestId];return t&&(t.resolve(e.data),Xt(e)),e}),(e=>{const t=Wt.topics[e.name];return t&&t.forEach((t=>t(e.data))),e}),(e=>{if(!e)return e;if(e.isResponse)return e;if(e.name===Yt)return Ut($t(e)),e;const t=Wt.routeHandlerLookup(e.name);if(t){const n=t=>{e.data=t,Ut($t(e))};t(e,n)}else console.log(Ft(),`No route handler for ${e.name}`,e);return e}),(Zt=()=>{((e=Date.now())=>{xt.lastMessageReceivedAt=e})()},(e,...t)=>(Zt(e,...t),e)));var Zt;const en=e=>("*"===Wt.originProvider()||e.origin===Wt.originProvider())&&e,tn=e=>{const t=((e,t,n)=>{if(!e||"string"!=typeof t)return n;const i=t.split(".");let o=e;for(const e of i){if(null==o)return n;o=o[e]}return void 0===o?n:o})(e,"data.sender");return!(!t||"string"!=typeof t)&&(!!t.includes(Wt.appName)&&e)},nn=(e,t)=>{const n=Bt(t);n.port=e,n.hasTriedToUpgradeToMessageChannel=!0,n.port.onmessage=It(At,Vt)},on=(e,t)=>(!Bt(e.sender).hasTriedToUpgradeToMessageChannel&&t.ports&&t.ports[0]&&nn(t.ports[0],e.sender),e),rn=e=>{(e=>{const t=Bt(e);t.port=void 0,t.hasTriedToUpgradeToMessageChannel=!1})(e.sender)};let sn=()=>{};const an=()=>{sn(),sn=()=>{},Mt&&Mt(),Gt()},dn=((e,t=0)=>{let n,i,o=0;return function(...r){const s=Date.now(),a=t-(s-o);return a<=0||a>t?(n&&(clearTimeout(n),n=null),o=s,i=e.apply(this,r)):!n&&t>0&&(n=setTimeout((()=>{o=Date.now(),n=null,i=e.apply(this,r)}),a)),i}})((e=>{"connected"!==e&&Wt.usePingAutoReconnect&&qt(Yt).catch((()=>{console.log("message::ping timedout")}))}),1e3),cn=(e,t,n,i,o,r=!1,s)=>{if(!window.addEventListener)return;Wt.appName=e,Wt.frameId=t,Wt.routeHandlerLookup=n,Wt.usePingAutoReconnect=r,Wt.connectionName=s||"",Wt.originProvider=i||(()=>window.location.origin||"*"),Wt.destinationProvider=o||(()=>window.parent||window.top),((e={})=>{const t=setInterval(kt,100);Mt=()=>clearInterval(t)})(),(e=>{if(!St(e))return;const t=Lt++;xt.evalCallbacks[t]=e})(dn);const a=It(en,tn,At,on,Vt);window.addEventListener("message",a),sn=()=>window.removeEventListener("message",a)},un=e=>{(e=>{if(!St(e))return;const t=Lt++;xt.changeCallbacks[t]=e})(e)};function ln(){return(new Date).getTime()}class pn extends pt{type="window";testUrl="";realUrl=void 0;getTitle(){return this.getConfig("title",this.getName())}getName(){return this.getConfig("name","Agent_Application")}open(){return this.router.addRoute("app::windowClosed",(()=>{this.app.setProperties({containerType:"frame"}),this.app.stop()})),this.testConnection().then((()=>{this.triggerOpened()})).catch((()=>{return this.createWindow(),e=this.app,t=1e3,new Promise(((n,i)=>{const o=ln(),r=()=>{e.getConnectionStatus()?n():ln()-o>t?i():setTimeout(r,50)};r()}));var e,t}))}testConnection(){return this.destination=window.open(this.testUrl,this.getName(),`width=${this.app.state.width},height=${this.app.state.height},resizable=yes,scrollbars=yes,status=yes,location=no`),qt("app::reconnect")}createWindow(){this.realUrl&&(this.destination=window.open(this.realUrl,this.getName(),`width=${this.app.state.width},height=${this.app.state.height},resizable=yes,scrollbars=yes,status=yes,location=no`));const e=document.createElement("script");e.src=this.app.PluginAPI.getAssetUrl(this.app.assetName),this.destination.document.body.appendChild(e),this.destination.document.title=this.getTitle()}close(){this.router.removeRoute("app::windowClosed"),this.destination.close(),this.triggerClosed()}}const hn=()=>({});class gn{defaultState={containerType:"frame",minimized:!1,height:500,width:500,left:100,top:100};state={};containerClosedCallbacks=[];container=null;isConnected=!1;constructor(e,n,i,o,r,s=hn,a=hn){this.appName=e,this.assetName=n,this.assetStorageKey=i,this.connectionName=o,this.frameConfigProvider=s,this.windowConfigProvider=a,r&&Object.assign(this.defaultState,r),this.router=new t}init(e,t){this.pendo=e,this.PluginAPI=t,this.events=t.getEventable(),this.router.addRoute("app::ping",((e,t)=>{t()})),this.router.addRoute("app::setProperties",(({data:e})=>{this.setProperties(e)})),this.router.addRoute("app::toggleContainer",(()=>{this.setProperties({minimized:!1}),this.toggleContainerType()})),this.router.addRoute("app::windowClosed",(()=>{})),this.loadState(),this.prepContainer()}prepContainer(){this.container="window"===this.state.containerType?new pn(this,this.windowConfigProvider()):new Ct(this,this.frameConfigProvider())}setConnectionStatus(e){this.isConnected="connected"===e}getConnectionStatus(){return this.isConnected}setProperties(e){Object.assign(this.state,e),this.writeState()}getDefaultState(){return this.defaultState||{}}loadState(){try{const e=JSON.parse(this.PluginAPI.agentStorage.read(this.assetStorageKey,!0));this.state=Object.assign({},this.getDefaultState(),this.state,e)}catch(e){this.PluginAPI.log.error(e),this.state=Object.assign({},this.getDefaultState(),this.state)}}writeState(){this.PluginAPI.agentStorage.write(this.assetStorageKey,JSON.stringify(this.state),null,!0)}toggleContainerType(){const e="frame"===this.state.containerType?"window":"frame";this.setProperties({containerType:e}),this.stop(),this.start()}start(){this.container||this.prepContainer();const{frameId:e}=this.PluginAPI.EventTracer.addTracerIds({});cn(this.appName,e,this.router.lookupRouteProvider(),this.container.getOriginProvider(),this.container.getDestinationProvider(),!0,this.connectionName),un((e=>{this.setConnectionStatus(e)})),this.container.open().then((()=>{this.events.trigger("mounted")})).catch((()=>{"window"===this.state.containerType?(this.setProperties({containerType:"frame"}),this.prepContainer(),this.start()):(this.PluginAPI.log(`Failed to start ${this.appName} in either window or frame.`),this.stop())}))}stop(){this.container.close(),this.container=null,this.events.trigger("unmounted"),an()}}const fn=e=>({apiKey:e.apiKey,environment:e.debugging.isStagingServer()?"staging":"production",device:e.debugging.isMobileUserAgent()?"mobile":"desktop",browserCookies:window.navigator.cookieEnabled,guideStatus:e.areGuidesDisabled()?"disabled":e.debugging.areGuidesDelayed()?"delayed":"enabled"}),vn=function(){const e={height:ft.HEIGHT,width:ft.WIDTH};let t,n;const i=new gn("Debugger","pendo.debugger.min.js","debug-enabled","AgentPlugin",e,(()=>({containerId:"pendo-client-debugger"})),(()=>({title:"Pendo Debugger"}))),o={app:i,init(e,o){t=e,n=o,n.restartDebugger=this.start,i.init(t,n),i.router.addRoute("debugger::connect",((e,o)=>{o({config:n.ConfigReader.audit(),env:fn(t),container:i.state,events:n.store.state.debugger.eventsCaptured})})),i.router.addRoute("debugger::stop",(()=>{t.disableDebugging()})),i.router.addRoute("debugger::showGuideById",((e,n)=>{n(t.showGuideById(e.data))})),i.router.addRoute("debugger::toggleGuideLoop",(e=>{e.data?t.startGuides():t.stopGuides()})),i.router.addRoute("debugger::tombstoneGuide",(e=>{const i=t.findGuideById(e.data);n.Tombstone.addGuide(i)})),i.router.addRoute("debugger::openGuidePage",(e=>{const i=((e,t,n)=>{const i=t.findGuideById(e);if(!i||!t._.get(i,"attributes.resourceCenter"))return`${n}/guides/${e}`;if(i.attributes.resourceCenter.isTopLevel)return`${n}/resource-center/${i.id}/draft`;const o=t.BuildingBlocks.BuildingBlockResourceCenter.getResourceCenter();return o&&o.id?`${n}/resource-center/${o.id}/module/${i.id}`:""})(e.data,t,n.hosts.SERVER);i&&window.open(i,"_blank")})),i.router.addRoute("debugger::restore",(({data:e})=>{(e=>{if(!e||!e.length)return;const t=document.createElement("iframe");t.sandbox="allow-same-origin",t.src="about:blank",t.hidden=!0,document.body.appendChild(t),t.contentWindow.ignoreIframeMonitor=!0,e.forEach((e=>{e.id.split(".").reduce(((e,t,n,i)=>n===i.length-1?(e.destination[t]=e.source[t],e.destination[t]):(e.destination=e.destination[t],e.source=e.source[t],e)),{destination:window,source:t.contentWindow})})),document.body.removeChild(t)})(e)})),i.router.addRoute("debugger::findShadowRoot",((e,t)=>{t((()=>{let e,t=!1,n=0;const i=document.createNodeIterator(document.body,NodeFilter.SHOW_ELEMENT);if(!i||!i.nextNode)return!0;for(;n<1e4&&!t;)n++,e=i.nextNode(),e&&e.shadowRoot&&(t=!0);return t})())})),i.router.addRoute("debugger::sync",((e,o)=>{const r=n.store.subscribe(((e,t)=>{"debugger/eventsCaptured"===e.type&&o({action:"events/eventsCaptured",data:t.debugger.eventsCaptured})})),s=setInterval((()=>{o({action:"agent/sync",data:n.store.state}),o({action:"environment/validateEnvironment",data:t.validateEnvironment(!0)})}),500);i.events.on("unmounted",(()=>{clearInterval(s),r()}))})),i.router.addRoute("debugger::enableEventLogging",(({data:e})=>{i.setProperties({enableEventLogging:e}),n.store.dispatch("debugger/enableEventLogging",e)})),i.router.addRoute("debugger::clearEventsCaptured",(()=>{n.store.dispatch("debugger/clearEventsCaptured")})),i.router.addRoute("debugger::checkGuideEligibility",(({data:e},t)=>{n.store.dispatch("debugger/checkGuideEligibility",{guideId:e,response:t})}))},start(){i.start()},stop(){i.stop(),i.setProperties({enabled:!1,containerType:"frame"})}};return o}();const bn={initialize:function(e,t){vn.init(e,t),vn.start();const n=e.disableDebugging;e.disableDebugging=()=>{vn.stop(),n()}},teardown:function(){vn.stop()}},yn=document.getElementById("pendo-debugger-plugin");let mn="pendo";yn&&(mn=yn.getAttribute("data-pendo-global-key")||"pendo"),window[mn].addExtension&&window[mn].addExtension({name:"Debugger",version:"1.0.0",type:"agent",use:"plugin",uri:bn})}();
|
|
1
|
+
/*
|
|
2
|
+
@license https://agent.pendo.io/licenses
|
|
3
|
+
*/
|
|
4
|
+
!function(){"use strict";class j{constructor(e,t){this.path=e,this.handler=t}}class k{routes={};addRoute(e,t){this.routes[e]||(this.routes[e]=[]),this.routes[e].unshift(new j(e,t))}removeRoute(e){this.routes[e].shift()}lookupRouteProvider(){return e=>this.routes[e]?this.routes[e][0].handler:undefined}}var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function M(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e["default"]:e}var t=Array.isArray,e="object"==typeof e&&e&&e.Object===Object&&e,n="object"==typeof self&&self&&self.Object===Object&&self,e=e||n||Function("return this")(),n=e.Symbol,i=Object.prototype,L=i.hasOwnProperty,G=i.toString,s=n?n.toStringTag:undefined;var W=Object.prototype.toString;var $=function(e){var t=L.call(e,s),n=e[s];try{e[s]=undefined;var i=!0}catch(o){}var r=G.call(e);return i&&(t?e[s]=n:delete e[s]),r},F=function(e){return W.call(e)},U=n?n.toStringTag:undefined;i=function(e){return null==e?e===undefined?"[object Undefined]":"[object Null]":(U&&U in Object(e)?$:F)(e)};var q=i,B=function(e){return null!=e&&"object"==typeof e};var r=function(e){return"symbol"==typeof e||B(e)&&"[object Symbol]"==q(e)},Q=t,K=r,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,X=/^\w*$/;var Y=function(e,t){var n;return!Q(e)&&(!("number"!=(n=typeof e)&&"symbol"!=n&&"boolean"!=n&&null!=e&&!K(e))||X.test(e)||!J.test(e)||null!=t&&e in Object(t))};var o=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},V=i,Z=o;var i=function(e){return!!Z(e)&&("[object Function]"==(e=V(e))||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e)},a=e["__core-js_shared__"],ee=(a=/[^.]+$/.exec(a&&a.keys&&a.keys.IE_PROTO||""))?"Symbol(src)_1."+a:"";var te=Function.prototype.toString;var ne=i,ie=function(e){return!!ee&&ee in e},re=o,oe=function(e){if(null!=e){try{return te.call(e)}catch(t){}try{return e+""}catch(t){}}return""},se=/^\[object .+?Constructor\]$/,a=Function.prototype,i=Object.prototype,o=a.toString,a=i.hasOwnProperty,ae=RegExp("^"+o.call(a).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var de=function(e){return!(!re(e)||ie(e))&&(ne(e)?ae:se).test(oe(e))},ue=function(e,t){return null==e?undefined:e[t]};var i=function(e,t){return e=ue(e,t),de(e)?e:undefined},a=i(Object,"create"),ce=a;var le=a,pe=Object.prototype.hasOwnProperty;var he=a,ge=Object.prototype.hasOwnProperty;var fe=a;var o=function(e){return e=this.has(e)&&delete this.__data__[e],this.size-=e?1:0,e},a=function(e){var t,n=this.__data__;return le?"__lodash_hash_undefined__"===(t=n[e])?undefined:t:pe.call(n,e)?n[e]:undefined},d=function(e){var t=this.__data__;return he?t[e]!==undefined:ge.call(t,e)},u=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=fe&&t===undefined?"__lodash_hash_undefined__":t,this};function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}c.prototype.clear=function(){this.__data__=ce?ce(null):{},this.size=0},c.prototype["delete"]=o,c.prototype.get=a,c.prototype.has=d,c.prototype.set=u;o=c;var ve=function(e,t){return e===t||e!=e&&t!=t};var a=function(e,t){for(var n=e.length;n--;)if(ve(e[n][0],t))return n;return-1},be=a,me=Array.prototype.splice;var ye=a;var we=a;var _e=a;var d=function(e){var t=this.__data__;return!((e=be(t,e))<0||(e==t.length-1?t.pop():me.call(t,e,1),--this.size,0))},u=function(e){var t=this.__data__;return(e=ye(t,e))<0?undefined:t[e][1]},a=function(e){return-1<we(this.__data__,e)},l=function(e,t){var n=this.__data__,i=_e(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};function p(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}p.prototype.clear=function(){this.__data__=[],this.size=0},p.prototype["delete"]=d,p.prototype.get=u,p.prototype.has=a,p.prototype.set=l;var d=p,u=i(e,"Map"),Te=o,Pe=d,Ce=u;var Ie=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var a=function(e,t){return e=e.__data__,Ie(t)?e["string"==typeof t?"string":"hash"]:e.map},Ee=a;var Re=a;var Se=a;var ze=a;l=function(e){return e=Ee(this,e)["delete"](e),this.size-=e?1:0,e},e=function(e){return Re(this,e).get(e)},i=function(e){return Se(this,e).has(e)},o=function(e,t){var n=ze(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};function h(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}h.prototype.clear=function(){this.size=0,this.__data__={hash:new Te,map:new(Ce||Pe),string:new Te}},h.prototype["delete"]=l,h.prototype.get=e,h.prototype.has=i,h.prototype.set=o;var Oe=h;function g(i,r){if("function"!=typeof i||null!=r&&"function"!=typeof r)throw new TypeError("Expected a function");var o=function(){var e=arguments,t=r?r.apply(this,e):e[0],n=o.cache;return n.has(t)?n.get(t):(e=i.apply(this,e),o.cache=n.set(t,e)||n,e)};return o.cache=new(g.Cache||Oe),o}g.Cache=Oe;var Ne=g;var Ae=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,He=/\\(\\)?/g,d=function(e){var t=(e=Ne(e,function(e){return 500===t.size&&t.clear(),e})).cache;return e}(function(e){var r=[];return 46===e.charCodeAt(0)&&r.push(""),e.replace(Ae,function(e,t,n,i){r.push(n?i.replace(He,"$1"):t||e)}),r});var De=function(e,t){for(var n=-1,i=null==e?0:e.length,r=Array(i);++n<i;)r[n]=t(e[n],n,e);return r},xe=t,je=r,u=n?n.prototype:undefined,ke=u?u.toString:undefined;var Me=function x(e){var t;return"string"==typeof e?e:xe(e)?De(e,x)+"":je(e)?ke?ke.call(e):"":"0"==(t=e+"")&&1/e==-1/0?"-0":t};var Le=t,Ge=Y,We=d,$e=function(e){return null==e?"":Me(e)};var Fe=r;var Ue=function(e,t){return Le(e)?e:Ge(e,t)?[e]:We($e(e))},qe=function(e){var t;return"string"==typeof e||Fe(e)?e:"0"==(t=e+"")&&1/e==-1/0?"-0":t};var Be=function(e,t){for(var n=0,i=(t=Ue(t,e)).length;null!=e&&n<i;)e=e[qe(t[n++])];return n&&n==i?e:undefined};var Qe=M(function(e,t,n){return(e=null==e?undefined:Be(e,t))===undefined?n:e});class Ke{app=null;router=null;destination=window.parent||window.top;origin="*";constructor(e,t={}){this.app=e,this.router=e.router,this.config=t,this.events=e.PluginAPI.getEventable()}getConfig(e,t){return Qe(this.config,e,t)}getDestinationProvider(){return()=>this.destination}getOriginProvider(){return()=>this.origin}triggerOpened(){this.events.trigger("opened",{containerType:this.type})}triggerClosed(){this.events.trigger("closed",{containerType:this.type})}}var f={padding:"0 !important",margin:"0 !important","box-sizing":"border-box !important",border:"none !important",display:"block !important",visibility:"visible !important"},v=2147483647,b={WINDOW_MARGIN:10,HEADER_HEIGHT:50,TOP:100,LEFT:100,HEIGHT:700,WIDTH:500,MIN_HEIGHT:500,MIN_WIDTH:500};const{MIN_HEIGHT:m,MIN_WIDTH:y,WINDOW_MARGIN:w}=b;function Je(t,n,i,r,o){let s=0,a=0,d=0,u=0;function c(e){e.preventDefault(),n.css({visibility:"hidden"}),t.releasePointerCapture(e.pointerId),t.removeEventListener("pointermove",l),o()}function l(e){-1!==e.button||0===e.buttons?c(e):(e.preventDefault(),d=s-e.clientX,u=a-e.clientY,s=e.clientX,a=e.clientY,r(d,u))}t.addEventListener("pointerdown",function(e){0===e.button&&(e.preventDefault(),n.css({visibility:"visible"}),s=e.clientX,a=e.clientY,t.setPointerCapture(e.pointerId),t.addEventListener("pointermove",l),i())}),t.addEventListener("pointerup",c),t.addEventListener("pointerout",c)}function Xe(e,t){const n=e.handle[0],i=e.container[0];Je(n,e.blockout,function(){n.style.cursor="grabbing"},function(e,t){i.style.left=_(i,e)+"px",i.style.top=T(i,t)+"px"},function(){n.style.cursor="grab",t()})}function _(e,t){t=e.offsetLeft-t,e=window.innerWidth-e.offsetWidth-w;return t<w||e<w?w:e<t?e:t}function T(e,t){t=e.offsetTop-t,e=window.innerHeight-e.offsetHeight-w;return t<w||e<w?w:e<t?e:t}function Ye(e,t){var n=e.resizeHandle[0];const i=e.container[0];Je(n,e.blockout,()=>{},function(e,t){i.style.width=Ve(i,e)+"px",i.style.height=Ze(i,t)+"px"},t)}function Ve(e,t){t=e.offsetWidth-t,e=window.innerWidth-e.offsetLeft-w;return e<t?e:t<y?y:t}function Ze(e,t){t=e.offsetHeight-t,e=window.innerHeight-e.offsetTop-w;return e<t?e:t<m?m:t}class et extends Ke{type="frame";destination=window.parent||window.top;origin=window.location.origin;constructor(i,e){super(i,e);const{pendo:r,PluginAPI:o}=i;e=this.getConfig("containerId","pendo-client-app");this.container=r.dom(`<div id="${e}" class="pendo-ignore">`).css({...f,height:i.state.height,width:i.state.width,"z-index":v-1,"background-color":"#FFFFFF",position:"fixed","box-shadow":"rgb(136, 136, 136) 0px 0px 20px 0px",overflow:"hidden"}),this.handle=r.dom('<div id="pendo-app-draggable-handle">').css({...f,"z-index":v,height:b.HEADER_HEIGHT,width:"calc(100% - 100px)",position:"absolute",cursor:"grab"}).on("dblclick",()=>{i.state.minimized||(this.container.css({height:b.HEIGHT,width:b.WIDTH,transition:"all 250ms linear"}),setTimeout(()=>{this.container&&(this.container.css({transition:"none"}),this.saveSize())},250))}).appendTo(this.container),this.resizeHandle=r.dom('<div id="pendo-app-resize-handle">').css({...f,"z-index":v,visibility:this.app.state.minimized?"hidden":"visible",height:0,width:0,"border-left":"10px solid transparent","border-bottom":"10px solid rgb(136, 136, 136)",cursor:"nwse-resize",position:"absolute",bottom:0,right:0}).appendTo(this.container),this.frame=r.dom('<iframe id="pendo-agent-application" src="about:blank">').css({...f,height:"100%",width:"100%"}).on("load",()=>{if(o.ConfigReader.get("inlineStyleNonce")){const n=this.frame[0].contentDocument.createElement.bind(this.frame[0].contentDocument);this.frame[0].contentDocument.createElement=(e,...t)=>{t=n(e,...t);return"style"===e&&(e=o.ConfigReader.get("inlineStyleNonce"))&&t.setAttribute("nonce",e),t}}var e,t=document.createElement("script");t.src=((e=r)&&e.trustedTypesPolicy?e.trustedTypesPolicy:{createScriptURL(e){return e}}).createScriptURL(o.getAssetUrl(i.assetName)),this.frame[0].contentDocument.body.appendChild(t),this.frame[0].contentWindow.ignoreIframeMonitor=!0,this.triggerOpened()}).appendTo(this.container),this.blockout=r.dom('<div id="pendo-app-dragging-blockout">').css({"z-index":v-2,position:"absolute",height:"100%",width:"100%",top:0,left:0,visibility:"hidden"}).appendTo(r.dom.getBody()),this.elements=[this.container,this.blockout],this.positionFrame=e=>{var{left:t,top:n,height:i}=e,{minimized:e,width:r}=e,t=t||b.LEFT,n=n||b.TOP,i=e?b.HEADER_HEIGHT:i;t=_({offsetLeft:t,offsetWidth:r},0),n=T({offsetTop:n,offsetHeight:i},0),this.container.css({left:t,top:n,height:i}),this.savePosition()},this.saveSize=()=>{var{offsetHeight:e,offsetWidth:t}=this.container[0];e&&t&&this.app.setProperties({height:e,width:t})},this.savePosition=()=>{var{offsetLeft:e,offsetTop:t}=this.container[0];e&&t&&this.app.setProperties({left:e,top:t})},this.toggleMinimize=()=>{this.app.setProperties({minimized:!this.app.state.minimized}),this.resizeHandle.css({visibility:this.app.state.minimized?"hidden":"visible"}),this.positionFrame(this.app.state)},this.positionFrame(this.app.state),Xe(this,this.savePosition),Ye(this,this.saveSize),window.addEventListener("resize",s),this.listeners=[["resize",s]];const t=r._.throttle(()=>{return e=this.container[0],0<(t=e.offsetLeft+e.offsetWidth+w-window.innerWidth)&&(e.style.left=_(e,t)+"px",e.offsetWidth>y)&&(e.style.width=Ve(e,t)+"px"),void(0<(t=e.offsetTop+e.offsetHeight+w-window.innerHeight)&&(e.style.top=T(e,t)+"px",e.offsetHeight>m)&&(e.style.height=Ze(e,t)+"px"));var e,t},10),n=r._.debounce(()=>{this.savePosition(),this.saveSize()},1e3);function s(){t(),n()}}open(){return this.router.addRoute("app::toggleMinimize",this.toggleMinimize),this.container.appendTo(this.app.pendo.dom.getBody()),Promise.resolve()}close(){this.router.removeRoute("app::toggleMinimize"),this.listeners.forEach(([e,t])=>window.removeEventListener(e,t)),this.elements.forEach(e=>e.remove()),this.triggerClosed()}}const P=(...e)=>r=>{return[].concat(e).reduce((e,t,n,i)=>{e=t(e,r);return e||i.splice(n,i.length-n),e},r)};let tt=0;const nt=(e,t,n)=>{if(!e||"string"!=typeof t)return n;let i=e;for(const r of t.split(".")){if(null==i)return n;i=i[r]}return i===undefined?n:i};const it=(t,n)=>{if(t&&n)if(Array.isArray(t))for(let e=0;e<t.length;e++)n(t[e],e,t);else if("object"==typeof t)for(const e in t)t.hasOwnProperty(e)&&n(t[e],e,t);return t},rt=e=>"function"==typeof e,ot=e=>!(null==e),st="promise";function C(e,t,n){this.name=e,this.type=t,this.data=n}C.prototype.toString=function(){return`Message.${this.type} - `+this.name};const at=(e,t,n)=>{e=new C(e,t,n);return t===st&&(e.requestId=""+(tt+=1)),e},dt=e=>{try{var{name:t,type:n,isResponse:i,data:r,requestId:o,sender:s}=e.data||{},a=new C(t,n,ot(r)?JSON.parse(r):undefined);return a.requestId=o,a.sender=s,a.destination=e.source,a.isResponse=i,a}catch(d){return!1}},ut=e=>{var t=((e,t)=>{if(!e||"object"!=typeof e)return{};var n=Array.isArray(t)?t:[t],i={};for(const r in e)e.hasOwnProperty(r)&&!n.includes(r)&&(i[r]=e[r]);return i})(e,["destination","toString","data"]);return t.data=JSON.stringify(e.data,(e,t)=>"function"==typeof t||t instanceof RegExp?t.toString?t.toString():undefined:t),t},ct=e=>(e.isResponse=!0,e),I="disconnected",E={lastMessageReceivedAt:0,currentConnectionQuality:I,changeCallbacks:{},evalCallbacks:{}},R=e=>{e!==E.currentConnectionQuality&&(E.currentConnectionQuality=e,it(E.changeCallbacks,e=>{e(E.currentConnectionQuality)}))},lt=()=>{var e;0===E.lastMessageReceivedAt?R(I):((e=Date.now()-E.lastMessageReceivedAt)<1e4?R("connected"):1e4<e&&(3e4<e?R("dead_connection"):R(I)),it(E.evalCallbacks,e=>{e(E.currentConnectionQuality)}))};let S;let pt=0;const ht=()=>{E.currentConnectionQuality=I,E.lastMessageReceivedAt=0},z={appName:undefined,connectionName:undefined,frameId:undefined,pendingRequests:{},topics:{},senderIds:{},originProvider:undefined,destinationProvider:undefined},gt=()=>""+z.appName+z.connectionName+`(${z.frameId})`,O=e=>{e.sender||(e.sender=gt());var t=e.destination||z.destinationProvider(),n=ut(e),i=vt(e.sender),r=bt(e.sender);i||r?i?i.postMessage(n):t.postMessage(n,z.originProvider()):(r=new MessageChannel,It(r.port1,e.sender),t.postMessage(n,z.originProvider(),[r.port2]))},ft=(r,o,s=1e3)=>new Promise((e,t)=>{const n=at(r,st,o),i=setTimeout(()=>{t(r+" timeout"),yt(n),Rt(n)},s);mt(n,()=>clearTimeout(i),e,t),O(n)}),N=e=>{var t;return z.senderIds[e]||(t=e,z.senderIds[t])||(z.senderIds[t]={port:undefined,hasTriedToUpgradeToMessageChannel:!1}),z.senderIds[e]},vt=e=>N(e).port,bt=e=>N(e).hasTriedToUpgradeToMessageChannel,mt=(e,t,n,i)=>{z.pendingRequests[e.requestId]={message:e,clearTimeoutfn:t,resolve:n,reject:i}};const yt=e=>{var t=e["requestId"];return z.pendingRequests[t].clearTimeoutfn(),delete z.pendingRequests[t],e};const wt="message::ping";var _t;const Tt=P(e=>{var t=z.pendingRequests[e.requestId];return t&&(t.resolve(e.data),yt(e)),e},t=>{var e=z.topics[t.name];return e&&e.forEach(e=>e(t.data)),t},t=>{var e;return t&&!t.isResponse&&(t.name===wt?O(ct(t)):(e=z.routeHandlerLookup(t.name))?e(t,e=>{t.data=e,O(ct(t))}):console.log(gt(),"No route handler for "+t.name,t)),t},(_t=()=>{var e;e=Date.now(),E.lastMessageReceivedAt=e},(e,...t)=>(_t(e,...t),e))),Pt=e=>("*"===z.originProvider()||e.origin===z.originProvider())&&e,Ct=e=>{var t=nt(e,"data.sender");return!(!t||"string"!=typeof t||!t.includes(z.appName))&&e},It=(e,t)=>{t=N(t);t.port=e,t.hasTriedToUpgradeToMessageChannel=!0,t.port.onmessage=P(dt,Tt)},Et=(e,t)=>{return!N(e.sender).hasTriedToUpgradeToMessageChannel&&t.ports&&t.ports[0]&&It(t.ports[0],e.sender),e},Rt=e=>{e=e.sender;(e=N(e)).port=undefined,e.hasTriedToUpgradeToMessageChannel=!1};let A=()=>{};const St=()=>{A(),A=()=>{},S&&S(),ht()},zt=((i,r)=>{let o,s=0,a;return function(...e){var t=Date.now(),n=r-(t-s);return n<=0||r<n?(o&&(clearTimeout(o),o=null),s=t,a=i.apply(this,e)):!o&&0<r&&(o=setTimeout(()=>{s=Date.now(),o=null,a=i.apply(this,e)},n)),a}})(e=>{"connected"!==e&&z.usePingAutoReconnect&&ft(wt)["catch"](()=>{console.log("message::ping timedout")})},1e3),Ot=(e,t,n,i,r,o=!1,s)=>{if(window.addEventListener){z.appName=e,z.frameId=t,z.routeHandlerLookup=n,z.usePingAutoReconnect=o,z.connectionName=s||"",z.originProvider=i||(()=>window.location.origin||"*"),z.destinationProvider=r||(()=>window.parent||window.top);{const d=setInterval(lt,100);S=()=>clearInterval(d)}e=zt;if(rt(e)){const u=pt++;E.evalCallbacks[u]=e}const a=P(Pt,Ct,dt,Et,Tt);window.addEventListener("message",a),A=()=>window.removeEventListener("message",a)}},Nt=e=>{if(rt(e)){const t=pt++;E.changeCallbacks[t]=e}};function At(){return(new Date).getTime()}class Ht extends Ke{type="window";testUrl="";realUrl=undefined;getTitle(){return this.getConfig("title",this.getName())}getName(){return this.getConfig("name","Agent_Application")}open(){return this.router.addRoute("app::windowClosed",()=>{this.app.setProperties({containerType:"frame"}),this.app.stop()}),this.testConnection().then(()=>{this.triggerOpened()})["catch"](()=>{return this.createWindow(),r=this.app,o=1e3,new Promise((e,t)=>{const n=At(),i=()=>{r.getConnectionStatus()?e():At()-n>o?t():setTimeout(i,50)};i()});var r,o})}testConnection(){return this.destination=window.open(this.testUrl,this.getName(),`width=${this.app.state.width},height=${this.app.state.height},resizable=yes,scrollbars=yes,status=yes,location=no`),ft("app::reconnect")}createWindow(){this.realUrl&&(this.destination=window.open(this.realUrl,this.getName(),`width=${this.app.state.width},height=${this.app.state.height},resizable=yes,scrollbars=yes,status=yes,location=no`));var e=document.createElement("script");e.src=this.app.PluginAPI.getAssetUrl(this.app.assetName),this.destination.document.body.appendChild(e),this.destination.document.title=this.getTitle()}close(){this.router.removeRoute("app::windowClosed"),this.destination.close(),this.triggerClosed()}}const Dt=()=>({});class xt{defaultState={containerType:"frame",minimized:!1,height:500,width:500,left:100,top:100};state={};containerClosedCallbacks=[];container=null;isConnected=!1;constructor(e,t,n,i,r,o=Dt,s=Dt){this.appName=e,this.assetName=t,this.assetStorageKey=n,this.connectionName=i,this.frameConfigProvider=o,this.windowConfigProvider=s,r&&Object.assign(this.defaultState,r),this.router=new k}init(e,t){this.pendo=e,this.PluginAPI=t,this.events=t.getEventable(),this.router.addRoute("app::ping",(e,t)=>{t()}),this.router.addRoute("app::setProperties",({data:e})=>{this.setProperties(e)}),this.router.addRoute("app::toggleContainer",()=>{this.setProperties({minimized:!1}),this.toggleContainerType()}),this.router.addRoute("app::windowClosed",()=>{}),this.loadState(),this.prepContainer()}prepContainer(){this.container="window"===this.state.containerType?new Ht(this,this.windowConfigProvider()):new et(this,this.frameConfigProvider())}setConnectionStatus(e){this.isConnected="connected"===e}getConnectionStatus(){return this.isConnected}setProperties(e){Object.assign(this.state,e),this.writeState()}getDefaultState(){return this.defaultState||{}}loadState(){try{var e=JSON.parse(this.PluginAPI.agentStorage.read(this.assetStorageKey,!0));this.state=Object.assign({},this.getDefaultState(),this.state,e)}catch(t){this.PluginAPI.log.error(t),this.state=Object.assign({},this.getDefaultState(),this.state)}}writeState(){this.PluginAPI.agentStorage.write(this.assetStorageKey,JSON.stringify(this.state),null,!0)}toggleContainerType(){var e="frame"===this.state.containerType?"window":"frame";this.setProperties({containerType:e}),this.stop(),this.start()}start(){this.container||this.prepContainer();var e=this.PluginAPI.EventTracer.addTracerIds({})["frameId"];Ot(this.appName,e,this.router.lookupRouteProvider(),this.container.getOriginProvider(),this.container.getDestinationProvider(),!0,this.connectionName),Nt(e=>{this.setConnectionStatus(e)}),this.container.open().then(()=>{this.events.trigger("mounted")})["catch"](()=>{"window"===this.state.containerType?(this.setProperties({containerType:"frame"}),this.prepContainer(),this.start()):(this.PluginAPI.log(`Failed to start ${this.appName} in either window or frame.`),this.stop())})}stop(){this.container.close(),this.container=null,this.events.trigger("unmounted"),St()}}const H=function(){var e={height:b.HEIGHT,width:b.WIDTH};let r,o;const s=new xt("Debugger","pendo.debugger.min.js","debug-enabled","AgentPlugin",e,()=>({containerId:"pendo-client-debugger"}),()=>({title:"Pendo Debugger"}));return{app:s,init(e,t){r=e,(o=t).restartDebugger=this.start,s.init(r,o),s.router.addRoute("debugger::connect",(e,t)=>{var n;t({config:o.ConfigReader.audit(),env:{apiKey:(n=r).apiKey,environment:n.debugging.isStagingServer()?"staging":"production",device:n.debugging.isMobileUserAgent()?"mobile":"desktop",browserCookies:window.navigator.cookieEnabled,guideStatus:n.areGuidesDisabled()?"disabled":n.debugging.areGuidesDelayed()?"delayed":"enabled"},container:s.state,events:o.store.state["debugger"].eventsCaptured})}),s.router.addRoute("debugger::stop",()=>{r.disableDebugging()}),s.router.addRoute("debugger::showGuideById",(e,t)=>{t(r.showGuideById(e.data))}),s.router.addRoute("debugger::toggleGuideLoop",e=>{e.data?r.startGuides():r.stopGuides()}),s.router.addRoute("debugger::tombstoneGuide",e=>{e=r.findGuideById(e.data);o.Tombstone.addGuide(e)}),s.router.addRoute("debugger::openGuidePage",e=>{e=e.data,i=r,t=o.hosts.SERVER;var t,n,i=(n=i.findGuideById(e))&&i._.get(n,"attributes.resourceCenter")?n.attributes.resourceCenter.isTopLevel?`${t}/resource-center/${n.id}/draft`:(i=i.BuildingBlocks.BuildingBlockResourceCenter.getResourceCenter())&&i.id?`${t}/resource-center/${i.id}/module/`+n.id:"":t+"/guides/"+e;i&&window.open(i,"_blank")}),s.router.addRoute("debugger::restore",({data:e})=>{if(e&&e.length){const t=document.createElement("iframe");t.sandbox="allow-same-origin",t.src="about:blank",t.hidden=!0,document.body.appendChild(t),t.contentWindow.ignoreIframeMonitor=!0,e.forEach(e=>{e.id.split(".").reduce((e,t,n,i)=>n===i.length-1?(e.destination[t]=e.source[t],e.destination[t]):(e.destination=e.destination[t],e.source=e.source[t],e),{destination:window,source:t.contentWindow})}),document.body.removeChild(t)}}),s.router.addRoute("debugger::findShadowRoot",(e,t)=>{t((()=>{let e=!1,t=0;var n,i=document.createNodeIterator(document.body,NodeFilter.SHOW_ELEMENT);if(!i||!i.nextNode)return!0;for(;t<1e4&&!e;)t++,(n=i.nextNode())&&n.shadowRoot&&(e=!0);return e})())}),s.router.addRoute("debugger::sync",(e,n)=>{const t=o.store.subscribe((e,t)=>{"debugger/eventsCaptured"===e.type&&n({action:"events/eventsCaptured",data:t["debugger"].eventsCaptured})}),i=setInterval(()=>{n({action:"agent/sync",data:o.store.state}),n({action:"environment/validateEnvironment",data:r.validateEnvironment(!0)})},500);s.events.on("unmounted",()=>{clearInterval(i),t()})}),s.router.addRoute("debugger::enableEventLogging",({data:e})=>{s.setProperties({enableEventLogging:e}),o.store.dispatch("debugger/enableEventLogging",e)}),s.router.addRoute("debugger::clearEventsCaptured",()=>{o.store.dispatch("debugger/clearEventsCaptured")}),s.router.addRoute("debugger::checkGuideEligibility",({data:e},t)=>{o.store.dispatch("debugger/checkGuideEligibility",{guideId:e,response:t})})},start(){s.start()},stop(){s.stop(),s.setProperties({enabled:!1,containerType:"frame"})}}}();a={initialize:function(e,t){H.init(e,t),H.start();const n=e.disableDebugging;e.disableDebugging=()=>{H.stop(),n()}},teardown:function(){H.stop()}},l=document.getElementById("pendo-debugger-plugin");let D="pendo";l&&(D=l.getAttribute("data-pendo-global-key")||"pendo"),window[D].addExtension&&window[D].addExtension({name:"Debugger",version:"1.0.0",type:"agent",use:"plugin",uri:a})}();
|
package/dist/dom.esm.js
CHANGED
|
@@ -6058,15 +6058,6 @@ var _pendoConfig = {};
|
|
|
6058
6058
|
function getPendoConfig() {
|
|
6059
6059
|
return _pendoConfig;
|
|
6060
6060
|
}
|
|
6061
|
-
function getPendoConfigFromEnclosingScope() {
|
|
6062
|
-
if (typeof PendoConfig === 'undefined')
|
|
6063
|
-
return {};
|
|
6064
|
-
return PendoConfig;
|
|
6065
|
-
}
|
|
6066
|
-
function getPendoConfigValue(key) {
|
|
6067
|
-
var config = getPendoConfig();
|
|
6068
|
-
return config[key];
|
|
6069
|
-
}
|
|
6070
6061
|
|
|
6071
6062
|
function deepCopy(obj) {
|
|
6072
6063
|
if (_.isFunction(obj) || _.isRegExp(obj)) {
|
|
@@ -7024,6 +7015,9 @@ function getInstallType() {
|
|
|
7024
7015
|
var installType = ConfigReader.get('installType');
|
|
7025
7016
|
return installType || NATIVE_INSTALL_TYPE;
|
|
7026
7017
|
}
|
|
7018
|
+
function isExtensionAgent() {
|
|
7019
|
+
return getInstallType() === EXTENSION_INSTALL_TYPE;
|
|
7020
|
+
}
|
|
7027
7021
|
|
|
7028
7022
|
function isNativeCode(fn) { return /native/.test(fn); }
|
|
7029
7023
|
|
|
@@ -7101,6 +7095,7 @@ if (bodyStyle) {
|
|
|
7101
7095
|
animations = _.isString(pdocument.body.style.webkitAnimation);
|
|
7102
7096
|
}
|
|
7103
7097
|
}
|
|
7098
|
+
var isChromeExtension = window.chrome && window.chrome.runtime && window.chrome.runtime.id;
|
|
7104
7099
|
// Android has history.pushState, but it does not update location correctly
|
|
7105
7100
|
// so let's not use the history API at all.
|
|
7106
7101
|
// http://code.google.com/p/android/issues/detail?id=17471
|
|
@@ -7114,15 +7109,13 @@ var shouldWrapNativeHistory = _.memoize(function shouldWrapNativeHistory() {
|
|
|
7114
7109
|
var historyDescriptors = window.history && _.isFunction(Object.getOwnPropertyDescriptors) && Object.getOwnPropertyDescriptors(window.history);
|
|
7115
7110
|
var isHistoryWriteable = historyDescriptors && _.get(historyDescriptors, 'pushState.writable', true) && _.get(historyDescriptors, 'replaceState.writable', true);
|
|
7116
7111
|
var hasAndroidSupport = !(android < 4);
|
|
7117
|
-
|
|
7118
|
-
return !!(hasNativeHistory && !isHistoryFrozen && isHistoryWriteable && hasAndroidSupport && !boxee && !isExtension);
|
|
7112
|
+
return !!(hasNativeHistory && !isHistoryFrozen && isHistoryWriteable && hasAndroidSupport && !boxee && !isExtensionAgent());
|
|
7119
7113
|
});
|
|
7120
7114
|
function shouldWrapHashChange() {
|
|
7121
7115
|
var hasNativeHashChange = 'onhashchange' in window;
|
|
7122
7116
|
// IE8 compatible mode lies
|
|
7123
7117
|
var hasSupportedDocMode = (!documentMode || documentMode > 7);
|
|
7124
|
-
|
|
7125
|
-
return !!(hasNativeHashChange && hasSupportedDocMode && !isExtension);
|
|
7118
|
+
return !!(hasNativeHashChange && hasSupportedDocMode && !isExtensionAgent());
|
|
7126
7119
|
}
|
|
7127
7120
|
function isMobileUserAgent() {
|
|
7128
7121
|
return (/Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i).test(getUA());
|
|
@@ -7156,7 +7149,8 @@ var sniffer = {
|
|
|
7156
7149
|
addEventListener: _.isFunction(window.addEventListener),
|
|
7157
7150
|
MutationObserver: isNativeCode(window.MutationObserver),
|
|
7158
7151
|
isMinimumIEVersion: isMinimumIEVersion,
|
|
7159
|
-
isMobileUserAgent: _.memoize(isMobileUserAgent)
|
|
7152
|
+
isMobileUserAgent: _.memoize(isMobileUserAgent),
|
|
7153
|
+
isChromeExtension: isChromeExtension
|
|
7160
7154
|
};
|
|
7161
7155
|
|
|
7162
7156
|
// other node types can be read about here:
|
|
@@ -7295,11 +7289,7 @@ function getScreenPosition(element) {
|
|
|
7295
7289
|
};
|
|
7296
7290
|
}
|
|
7297
7291
|
|
|
7298
|
-
var VERSION = '2.
|
|
7299
|
-
function isExtensionAgent() {
|
|
7300
|
-
var installType = getPendoConfigValue('installType') || getPendoConfigFromEnclosingScope().installType;
|
|
7301
|
-
return installType === EXTENSION_INSTALL_TYPE;
|
|
7302
|
-
}
|
|
7292
|
+
var VERSION = '2.285.1_';
|
|
7303
7293
|
|
|
7304
7294
|
var decodeURIComponent = _.isFunction(window.decodeURIComponent) ? window.decodeURIComponent : _.identity;
|
|
7305
7295
|
|