@pendo/agent 2.324.0 → 2.326.0

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,4 +1,4 @@
1
1
  /*
2
2
  @license https://agent.pendo.io/licenses
3
3
  */
4
- !function(){"use strict";class L{constructor(e,t){this.path=e,this.handler=t}}class G{routes={};addRoute(e,t){this.routes[e]||(this.routes[e]=[]),this.routes[e].unshift(new L(e,t))}removeRoute(e){this.routes[e].shift()}lookupRouteProvider(){return e=>this.routes[e]?this.routes[e][0].handler:undefined}}const u=(...e)=>s=>{return[].concat(e).reduce((e,t,i,n)=>{e=t(e,s);return e||n.splice(i,n.length-i),e},s)};let W=0;const i=(e,t,i)=>{if(!e||"string"!=typeof t)return i;let n=e;for(const s of t.split(".")){if(null==n)return i;n=n[s]}return n===undefined?i:n};const t=(t,i)=>{if(t&&i)if(Array.isArray(t))for(let e=0;e<t.length;e++)i(t[e],e,t);else if("object"==typeof t)for(const e in t)t.hasOwnProperty(e)&&i(t[e],e,t);return t},h=e=>"function"==typeof e,O=e=>!(null==e),d=()=>Date.now();class e{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 i(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 a={padding:"0 !important",margin:"0 !important","box-sizing":"border-box !important",border:"none !important",display:"block !important",visibility:"visible !important"},c=2147483647,p={WINDOW_MARGIN:10,HEADER_HEIGHT:50,TOP:100,LEFT:100,HEIGHT:700,WIDTH:500,MIN_HEIGHT:500,MIN_WIDTH:500};const{MIN_HEIGHT:g,MIN_WIDTH:l,WINDOW_MARGIN:f}=p;function s(t,i,n,s,o){let r=0,a=0,d=0,c=0;function u(e){e.preventDefault(),i.css({visibility:"hidden"}),t.releasePointerCapture(e.pointerId),t.removeEventListener("pointermove",h),o()}function h(e){-1!==e.button||0===e.buttons?u(e):(e.preventDefault(),d=r-e.clientX,c=a-e.clientY,r=e.clientX,a=e.clientY,s(d,c))}t.addEventListener("pointerdown",function(e){0===e.button&&(e.preventDefault(),i.css({visibility:"visible"}),r=e.clientX,a=e.clientY,t.setPointerCapture(e.pointerId),t.addEventListener("pointermove",h),n())}),t.addEventListener("pointerup",u),t.addEventListener("pointerout",u)}function U(e,t){const i=e.handle[0],n=e.container[0];s(i,e.blockout,function(){i.style.cursor="grabbing"},function(e,t){n.style.left=m(n,e)+"px",n.style.top=v(n,t)+"px"},function(){i.style.cursor="grab",t()})}function m(e,t){t=e.offsetLeft-t,e=window.innerWidth-e.offsetWidth-f;return t<f||e<f?f:e<t?e:t}function v(e,t){t=e.offsetTop-t,e=window.innerHeight-e.offsetHeight-f;return t<f||e<f?f:e<t?e:t}function _(e,t){var i=e.resizeHandle[0];const n=e.container[0];s(i,e.blockout,()=>{},function(e,t){n.style.width=b(n,e)+"px",n.style.height=w(n,t)+"px"},t)}function b(e,t){t=e.offsetWidth-t,e=window.innerWidth-e.offsetLeft-f;return e<t?e:t<l?l:t}function w(e,t){t=e.offsetHeight-t,e=window.innerHeight-e.offsetTop-f;return e<t?e:t<g?g:t}class F extends e{type="frame";destination=window.parent||window.top;origin=/^https?:/.test(window.location.protocol)?window.location.origin:"*";constructor(n,e){super(n,e);const{pendo:s,PluginAPI:o}=n;e=this.getConfig("containerId","pendo-client-app");this.container=s.dom(`<div id="${e}" class="pendo-ignore">`).css({...a,height:n.state.height,width:n.state.width,"z-index":c-1,"background-color":"#FFFFFF",position:"fixed","box-shadow":"rgb(136, 136, 136) 0px 0px 20px 0px",overflow:"hidden"}),this.handle=s.dom('<div id="pendo-app-draggable-handle">').css({...a,"z-index":c,height:p.HEADER_HEIGHT,width:"calc(100% - 100px)",position:"absolute",cursor:"grab"}).on("dblclick",()=>{n.state.minimized||(this.container.css({height:p.HEIGHT,width:p.WIDTH,transition:"all 250ms linear"}),setTimeout(()=>{this.container&&(this.container.css({transition:"none"}),this.saveSize())},250))}).appendTo(this.container),this.resizeHandle=s.dom('<div id="pendo-app-resize-handle">').css({...a,"z-index":c,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=s.dom('<iframe id="pendo-agent-application" src="about:blank">').css({...a,height:"100%",width:"100%"}).on("load",()=>{if(o.ConfigReader.get("inlineStyleNonce")){const i=this.frame[0].contentDocument.createElement.bind(this.frame[0].contentDocument);this.frame[0].contentDocument.createElement=(e,...t)=>{t=i(e,...t);return"style"===e&&(e=o.ConfigReader.get("inlineStyleNonce"))&&t.setAttribute("nonce",e),t}}var e,t=document.createElement("script");t.src=((e=s)&&e.trustedTypesPolicy?e.trustedTypesPolicy:{createScriptURL(e){return e}}).createScriptURL(o.getAssetUrl(n.assetName)),this.frame[0].contentDocument.body.appendChild(t),this.frame[0].contentWindow.ignoreIframeMonitor=!0,this.triggerOpened()}).appendTo(this.container),this.blockout=s.dom('<div id="pendo-app-dragging-blockout">').css({"z-index":c-2,position:"absolute",height:"100%",width:"100%",top:0,left:0,visibility:"hidden"}).appendTo(s.dom.getBody()),this.elements=[this.container,this.blockout],this.positionFrame=e=>{var{left:t,top:i,height:n}=e,{minimized:e,width:s}=e,t=t||p.LEFT,i=i||p.TOP,n=e?p.HEADER_HEIGHT:n;t=m({offsetLeft:t,offsetWidth:s},0),i=v({offsetTop:i,offsetHeight:n},0),this.container.css({left:t,top:i,height:n}),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),U(this,this.savePosition),_(this,this.saveSize),window.addEventListener("resize",r),this.listeners=[["resize",r]];const t=s._.throttle(()=>{return e=this.container[0],0<(t=e.offsetLeft+e.offsetWidth+f-window.innerWidth)&&(e.style.left=m(e,t)+"px",e.offsetWidth>l)&&(e.style.width=b(e,t)+"px"),void(0<(t=e.offsetTop+e.offsetHeight+f-window.innerHeight)&&(e.style.top=v(e,t)+"px",e.offsetHeight>g)&&(e.style.height=w(e,t)+"px"));var e,t},10),i=s._.debounce(()=>{this.savePosition(),this.saveSize()},1e3);function r(){t(),i()}}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 y="promise";function T(e,t,i){this.name=e,this.type=t,this.data=i}T.prototype.toString=function(){return`Message.${this.type} - `+this.name};const $=(e,t,i)=>{e=new T(e,t,i);return t===y&&(e.requestId=""+(W+=1)),e},C=e=>{try{var{name:t,type:i,isResponse:n,data:s,requestId:o,sender:r}=e.data||{},a=new T(t,i,O(s)?JSON.parse(s):undefined);return a.requestId=o,a.sender=r,a.destination=e.source,a.isResponse=n,a}catch(d){return!1}},q=e=>{var t=((e,t)=>{if(!e||"object"!=typeof e)return{};var i=Array.isArray(t)?t:[t],n={};for(const s in e)e.hasOwnProperty(s)&&!i.includes(s)&&(n[s]=e[s]);return n})(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},n=e=>(e.isResponse=!0,e),o="disconnected",P={lastMessageReceivedAt:0,currentConnectionQuality:o,changeCallbacks:{},evalCallbacks:{}},r=e=>{e!==P.currentConnectionQuality&&(P.currentConnectionQuality=e,t(P.changeCallbacks,e=>{e(P.currentConnectionQuality)}))},B=()=>{var e;0===P.lastMessageReceivedAt?r(o):((e=d()-P.lastMessageReceivedAt)<1e4?r("connected"):1e4<e&&(3e4<e?r("dead_connection"):r(o)),t(P.evalCallbacks,e=>{e(P.currentConnectionQuality)}))};let I;let R=0;const j=()=>{P.currentConnectionQuality=o,P.lastMessageReceivedAt=0},E={appName:undefined,connectionName:undefined,frameId:undefined,pendingRequests:{},topics:{},senderIds:{},originProvider:undefined,destinationProvider:undefined},S=()=>""+E.appName+E.connectionName+`(${E.frameId})`,H=e=>{e.sender||(e.sender=S());var t=e.destination||E.destinationProvider(),i=q(e),n=Q(e.sender),s=K(e.sender);n||s?n?n.postMessage(i):t.postMessage(i,E.originProvider()):(s=new MessageChannel,ee(s.port1,e.sender),t.postMessage(i,E.originProvider(),[s.port2]))},D=(s,o,r=1e3)=>new Promise((e,t)=>{const i=$(s,y,o),n=setTimeout(()=>{t(s+" timeout"),A(i),ie(i)},r);X(i,()=>clearTimeout(n),e,t),H(i)}),z=e=>{var t;return E.senderIds[e]||(t=e,E.senderIds[t])||(E.senderIds[t]={port:undefined,hasTriedToUpgradeToMessageChannel:!1}),E.senderIds[e]},Q=e=>z(e).port,K=e=>z(e).hasTriedToUpgradeToMessageChannel,X=(e,t,i,n)=>{E.pendingRequests[e.requestId]={message:e,clearTimeoutfn:t,resolve:i,reject:n}};const A=e=>{var t=e["requestId"];return E.pendingRequests[t].clearTimeoutfn(),delete E.pendingRequests[t],e};const k="message::ping";var Y;const J=u(e=>{var t=E.pendingRequests[e.requestId];return t&&(t.resolve(e.data),A(e)),e},t=>{var e=E.topics[t.name];return e&&e.forEach(e=>e(t.data)),t},t=>{var e;return t&&!t.isResponse&&(t.name===k?H(n(t)):(e=E.routeHandlerLookup(t.name))?e(t,e=>{t.data=e,H(n(t))}):console.log(S(),"No route handler for "+t.name,t)),t},(Y=()=>{var e;e=d(),P.lastMessageReceivedAt=e},(e,...t)=>(Y(e,...t),e))),V=e=>("*"===E.originProvider()||e.origin===E.originProvider())&&e,Z=e=>{var t=i(e,"data.sender");return!(!t||"string"!=typeof t||!t.includes(E.appName))&&e},ee=(e,t)=>{t=z(t);t.port=e,t.hasTriedToUpgradeToMessageChannel=!0,t.port.onmessage=u(C,J)},te=(e,t)=>{return!z(e.sender).hasTriedToUpgradeToMessageChannel&&t.ports&&t.ports[0]&&ee(t.ports[0],e.sender),e},ie=e=>{e=e.sender;(e=z(e)).port=undefined,e.hasTriedToUpgradeToMessageChannel=!1};let N=()=>{};const ne=()=>{N(),N=()=>{},I&&I(),j()},se=((n,s)=>{let o,r=0,a;return function(...e){var t=d(),i=s-(t-r);return i<=0||s<i?(o&&(clearTimeout(o),o=null),r=t,a=n.apply(this,e)):!o&&0<s&&(o=setTimeout(()=>{r=d(),o=null,a=n.apply(this,e)},i)),a}})(e=>{"connected"!==e&&E.usePingAutoReconnect&&D(k)["catch"](()=>{})},1e3),oe=(e,t,i,n,s,o=!1,r)=>{if(window.addEventListener){E.appName=e,E.frameId=t,E.routeHandlerLookup=i,E.usePingAutoReconnect=o,E.connectionName=r||"",E.originProvider=n||(()=>window.location.origin||"*"),E.destinationProvider=s||(()=>window.parent||window.top);{const d=setInterval(B,100);I=()=>clearInterval(d)}e=se;if(h(e)){const c=R++;P.evalCallbacks[c]=e}const a=u(V,Z,C,te,J);window.addEventListener("message",a),N=()=>window.removeEventListener("message",a)}},re=e=>{if(h(e)){const t=R++;P.changeCallbacks[t]=e}};class ae extends e{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(),s=this.app,o=1e3,new Promise((e,t)=>{const i=d(),n=()=>{s.getConnectionStatus()?e():d()-i>o?t():setTimeout(n,50)};n()});var s,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`),D("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 de=()=>({});class ce{defaultState={containerType:"frame",minimized:!1,height:p.HEIGHT,width:p.WIDTH,left:p.LEFT,top:p.TOP};state={};containerClosedCallbacks=[];container=null;isConnected=!1;constructor(e,t,i,n,s,o=de,r=de){this.appName=e,this.assetName=t,this.assetStorageKey=i,this.connectionName=n,this.frameConfigProvider=o,this.windowConfigProvider=r,s&&Object.assign(this.defaultState,s),this.router=new G}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(),this.start()}prepContainer(){this.container="window"===this.state.containerType?new ae(this,this.windowConfigProvider()):new F(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=this.PluginAPI.agentStorage.read(this.assetStorageKey);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,this.state)}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"];oe(this.appName,e,this.router.lookupRouteProvider(),this.container.getOriginProvider(),this.container.getDestinationProvider(),!0,this.connectionName),re(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"),ne()}}const ue=()=>{try{return performance.getEntries()}catch(e){return[{failedGetEntries:!0,message:e.message,stack:e.stack}]}};class he extends ce{constructor(){super("Debugger","pendo.debugger.min.js","debug-enabled","AgentPlugin",null,()=>({containerId:"pendo-client-debugger"}),()=>({title:"Pendo Debugger"}))}initialize(s,o){o.restartDebugger=this.start.bind(this),super.init(s,o),this.router.addRoute("debugger::connect",(e,t)=>{var i;t({config:o.ConfigReader.audit(),env:{apiKey:(i=s).apiKey,environment:i.debugging.isStagingServer()?"staging":"production",device:i.debugging.isMobileUserAgent()?"mobile":"desktop",browserCookies:window.navigator.cookieEnabled,guideStatus:i.areGuidesDisabled()?"off":i.areGuidesDelayed()?"delayed":"on",foundShadowRoot:!!(i=i.debugging.observer.shadowDom).foundShadowRoots||(i.findShadowRoots(document,Infinity,()=>{}),i.foundShadowRoots)},container:this.state,events:o.store.state["debugger"].eventsCaptured,timeOrigin:performance.timeOrigin})}),this.router.addRoute("debugger::stop",()=>{s.disableDebugging()}),this.router.addRoute("debugger::showGuideById",(e,t)=>{t(s.showGuideById(e.data))}),this.router.addRoute("debugger::toggleGuideLoop",e=>{e.data?s.startGuides():s.stopGuides()}),this.router.addRoute("debugger::tombstoneGuide",e=>{e=s.findGuideById(e.data);o.Tombstone.addGuide(e)}),this.router.addRoute("debugger::openGuidePage",e=>{e=e.data,n=s,t=o.hosts.SERVER;var t,i,n=(i=n.findGuideById(e))&&n._.get(i,"attributes.resourceCenter")?i.attributes.resourceCenter.isTopLevel?`${t}/resource-center/${i.id}/draft`:(n=n.BuildingBlocks.BuildingBlockResourceCenter.getResourceCenter())&&n.id?`${t}/resource-center/${n.id}/module/`+i.id:"":t+"/guides/"+e;n&&window.open(n,"_blank")}),this.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,i,n)=>i===n.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)}}),this.router.addRoute("debugger::sync",(e,i)=>{const t=o.store.subscribe((e,t)=>{"debugger/eventsCaptured"===e.type&&i({action:"events/eventsCaptured",data:t["debugger"].eventsCaptured})}),n=setInterval(()=>{i({action:"agent/sync",data:o.store.state}),i({action:"environment/validateEnvironment",data:s.validateEnvironment(!0)}),i({action:"performance/sync",data:ue()})},500);this.events.on("unmounted",()=>{clearInterval(n),t()})}),this.router.addRoute("debugger::enableEventLogging",({data:e})=>{this.setProperties({enableEventLogging:e}),o.store.dispatch("debugger/enableEventLogging",e)}),this.router.addRoute("debugger::clearEventsCaptured",()=>{o.store.dispatch("debugger/clearEventsCaptured")}),this.router.addRoute("debugger::checkGuideEligibility",({data:e},t)=>{o.store.dispatch("debugger/checkGuideEligibility",{guideId:e,response:t})}),this.router.addRoute("debugger::testSelector",({data:e},t)=>{o.store.dispatch("debugger/testSelector",{selector:e,response:t})})}teardown(){super.stop(),this.setProperties({enabled:!1,containerType:"frame"})}}var x=new he,pe={initialize(e,t){x.initialize(e,t);const i=e.disableDebugging;e.disableDebugging=()=>{x.teardown(),i(),e.disableDebugging=i}},teardown(){x.teardown()}},ge=document.getElementById("pendo-debugger-plugin");let M="pendo";ge&&(M=ge.getAttribute("data-pendo-global-key")||"pendo"),window[M].addExtension&&window[M].addExtension({name:"Debugger",version:"1.0.0",type:"agent",use:"plugin",uri:pe})}();
4
+ !function(){"use strict";class L{constructor(e,t){this.path=e,this.handler=t}}class G{routes={};addRoute(e,t){this.routes[e]||(this.routes[e]=[]),this.routes[e].unshift(new L(e,t))}removeRoute(e){this.routes[e].shift()}lookupRouteProvider(){return e=>this.routes[e]?this.routes[e][0].handler:undefined}}const u=(...e)=>s=>{return[].concat(e).reduce((e,t,i,n)=>{e=t(e,s);return e||n.splice(i,n.length-i),e},s)};let W=0;const i=(e,t,i)=>{if(!e||"string"!=typeof t)return i;let n=e;for(const s of t.split(".")){if(null==n)return i;n=n[s]}return n===undefined?i:n};const t=(t,i)=>{if(t&&i)if(Array.isArray(t))for(let e=0;e<t.length;e++)i(t[e],e,t);else if("object"==typeof t)for(const e in t)t.hasOwnProperty(e)&&i(t[e],e,t);return t},h=e=>"function"==typeof e,O=e=>!(null==e),d=()=>Date.now();class e{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 i(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 a={padding:"0 !important",margin:"0 !important","box-sizing":"border-box !important",border:"none !important",display:"block !important",visibility:"visible !important"},c=2147483647,p={WINDOW_MARGIN:10,HEADER_HEIGHT:50,TOP:100,LEFT:100,HEIGHT:700,WIDTH:500,MIN_HEIGHT:500,MIN_WIDTH:500};const{MIN_HEIGHT:g,MIN_WIDTH:l,WINDOW_MARGIN:f}=p;function s(t,i,n,s,o){let r=0,a=0,d=0,c=0;function u(e){e.preventDefault(),i.css({visibility:"hidden"}),t.releasePointerCapture(e.pointerId),t.removeEventListener("pointermove",h),o()}function h(e){-1!==e.button||0===e.buttons?u(e):(e.preventDefault(),d=r-e.clientX,c=a-e.clientY,r=e.clientX,a=e.clientY,s(d,c))}t.addEventListener("pointerdown",function(e){0===e.button&&(e.preventDefault(),i.css({visibility:"visible"}),r=e.clientX,a=e.clientY,t.setPointerCapture(e.pointerId),t.addEventListener("pointermove",h),n())}),t.addEventListener("pointerup",u),t.addEventListener("pointerout",u)}function U(e,t){const i=e.handle[0],n=e.container[0];s(i,e.blockout,function(){i.style.cursor="grabbing"},function(e,t){n.style.left=m(n,e)+"px",n.style.top=v(n,t)+"px"},function(){i.style.cursor="grab",t()})}function m(e,t){t=e.offsetLeft-t,e=window.innerWidth-e.offsetWidth-f;return t<f||e<f?f:e<t?e:t}function v(e,t){t=e.offsetTop-t,e=window.innerHeight-e.offsetHeight-f;return t<f||e<f?f:e<t?e:t}function _(e,t){var i=e.resizeHandle[0];const n=e.container[0];s(i,e.blockout,()=>{},function(e,t){n.style.width=b(n,e)+"px",n.style.height=w(n,t)+"px"},t)}function b(e,t){t=e.offsetWidth-t,e=window.innerWidth-e.offsetLeft-f;return e<t?e:t<l?l:t}function w(e,t){t=e.offsetHeight-t,e=window.innerHeight-e.offsetTop-f;return e<t?e:t<g?g:t}class F extends e{type="frame";destination=window.parent||window.top;origin=/^https?:/.test(window.location.protocol)?window.location.origin:"*";constructor(n,e){super(n,e);const{pendo:s,PluginAPI:o}=n;e=this.getConfig("containerId","pendo-client-app");this.container=s.dom(`<div id="${e}" class="pendo-ignore">`).css({...a,height:n.state.height,width:n.state.width,"z-index":c-1,"background-color":"#FFFFFF",position:"fixed","box-shadow":"rgb(136, 136, 136) 0px 0px 20px 0px",overflow:"hidden"}),this.handle=s.dom('<div id="pendo-app-draggable-handle">').css({...a,"z-index":c,height:p.HEADER_HEIGHT,width:"calc(100% - 100px)",position:"absolute",cursor:"grab"}).on("dblclick",()=>{n.state.minimized||(this.container.css({height:p.HEIGHT,width:p.WIDTH,transition:"all 250ms linear"}),setTimeout(()=>{this.container&&(this.container.css({transition:"none"}),this.saveSize())},250))}).appendTo(this.container),this.resizeHandle=s.dom('<div id="pendo-app-resize-handle">').css({...a,"z-index":c,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=s.dom('<iframe id="pendo-agent-application" src="about:blank">').css({...a,height:"100%",width:"100%"}).on("load",()=>{if(o.ConfigReader.get("inlineStyleNonce")){const i=this.frame[0].contentDocument.createElement.bind(this.frame[0].contentDocument);this.frame[0].contentDocument.createElement=(e,...t)=>{t=i(e,...t);return"style"===e&&(e=o.ConfigReader.get("inlineStyleNonce"))&&t.setAttribute("nonce",e),t}}var e,t=document.createElement("script");t.src=((e=s)&&e.trustedTypesPolicy?e.trustedTypesPolicy:{createScriptURL(e){return e}}).createScriptURL(o.hosts.getAssetUrl(n.assetName)),this.frame[0].contentDocument.body.appendChild(t),this.frame[0].contentWindow.ignoreIframeMonitor=!0,this.triggerOpened()}).appendTo(this.container),this.blockout=s.dom('<div id="pendo-app-dragging-blockout">').css({"z-index":c-2,position:"absolute",height:"100%",width:"100%",top:0,left:0,visibility:"hidden"}).appendTo(s.dom.getBody()),this.elements=[this.container,this.blockout],this.positionFrame=e=>{var{left:t,top:i,height:n}=e,{minimized:e,width:s}=e,t=t||p.LEFT,i=i||p.TOP,n=e?p.HEADER_HEIGHT:n;t=m({offsetLeft:t,offsetWidth:s},0),i=v({offsetTop:i,offsetHeight:n},0),this.container.css({left:t,top:i,height:n}),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),U(this,this.savePosition),_(this,this.saveSize),window.addEventListener("resize",r),this.listeners=[["resize",r]];const t=s._.throttle(()=>{return e=this.container[0],0<(t=e.offsetLeft+e.offsetWidth+f-window.innerWidth)&&(e.style.left=m(e,t)+"px",e.offsetWidth>l)&&(e.style.width=b(e,t)+"px"),void(0<(t=e.offsetTop+e.offsetHeight+f-window.innerHeight)&&(e.style.top=v(e,t)+"px",e.offsetHeight>g)&&(e.style.height=w(e,t)+"px"));var e,t},10),i=s._.debounce(()=>{this.savePosition(),this.saveSize()},1e3);function r(){t(),i()}}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 y="promise";function T(e,t,i){this.name=e,this.type=t,this.data=i}T.prototype.toString=function(){return`Message.${this.type} - `+this.name};const $=(e,t,i)=>{e=new T(e,t,i);return t===y&&(e.requestId=""+(W+=1)),e},C=e=>{try{var{name:t,type:i,isResponse:n,data:s,requestId:o,sender:r}=e.data||{},a=new T(t,i,O(s)?JSON.parse(s):undefined);return a.requestId=o,a.sender=r,a.destination=e.source,a.isResponse=n,a}catch(d){return!1}},q=e=>{var t=((e,t)=>{if(!e||"object"!=typeof e)return{};var i=Array.isArray(t)?t:[t],n={};for(const s in e)e.hasOwnProperty(s)&&!i.includes(s)&&(n[s]=e[s]);return n})(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},n=e=>(e.isResponse=!0,e),o="disconnected",P={lastMessageReceivedAt:0,currentConnectionQuality:o,changeCallbacks:{},evalCallbacks:{}},r=e=>{e!==P.currentConnectionQuality&&(P.currentConnectionQuality=e,t(P.changeCallbacks,e=>{e(P.currentConnectionQuality)}))},B=()=>{var e;0===P.lastMessageReceivedAt?r(o):((e=d()-P.lastMessageReceivedAt)<1e4?r("connected"):1e4<e&&(3e4<e?r("dead_connection"):r(o)),t(P.evalCallbacks,e=>{e(P.currentConnectionQuality)}))};let I;let R=0;const j=()=>{P.currentConnectionQuality=o,P.lastMessageReceivedAt=0},E={appName:undefined,connectionName:undefined,frameId:undefined,pendingRequests:{},topics:{},senderIds:{},originProvider:undefined,destinationProvider:undefined},S=()=>""+E.appName+E.connectionName+`(${E.frameId})`,H=e=>{e.sender||(e.sender=S());var t=e.destination||E.destinationProvider(),i=q(e),n=Q(e.sender),s=K(e.sender);n||s?n?n.postMessage(i):t.postMessage(i,E.originProvider()):(s=new MessageChannel,ee(s.port1,e.sender),t.postMessage(i,E.originProvider(),[s.port2]))},D=(s,o,r=1e3)=>new Promise((e,t)=>{const i=$(s,y,o),n=setTimeout(()=>{t(s+" timeout"),A(i),ie(i)},r);X(i,()=>clearTimeout(n),e,t),H(i)}),z=e=>{var t;return E.senderIds[e]||(t=e,E.senderIds[t])||(E.senderIds[t]={port:undefined,hasTriedToUpgradeToMessageChannel:!1}),E.senderIds[e]},Q=e=>z(e).port,K=e=>z(e).hasTriedToUpgradeToMessageChannel,X=(e,t,i,n)=>{E.pendingRequests[e.requestId]={message:e,clearTimeoutfn:t,resolve:i,reject:n}};const A=e=>{var t=e["requestId"];return E.pendingRequests[t].clearTimeoutfn(),delete E.pendingRequests[t],e};const k="message::ping";var Y;const J=u(e=>{var t=E.pendingRequests[e.requestId];return t&&(t.resolve(e.data),A(e)),e},t=>{var e=E.topics[t.name];return e&&e.forEach(e=>e(t.data)),t},t=>{var e;return t&&!t.isResponse&&(t.name===k?H(n(t)):(e=E.routeHandlerLookup(t.name))?e(t,e=>{t.data=e,H(n(t))}):console.log(S(),"No route handler for "+t.name,t)),t},(Y=()=>{var e;e=d(),P.lastMessageReceivedAt=e},(e,...t)=>(Y(e,...t),e))),V=e=>("*"===E.originProvider()||e.origin===E.originProvider())&&e,Z=e=>{var t=i(e,"data.sender");return!(!t||"string"!=typeof t||!t.includes(E.appName))&&e},ee=(e,t)=>{t=z(t);t.port=e,t.hasTriedToUpgradeToMessageChannel=!0,t.port.onmessage=u(C,J)},te=(e,t)=>{return!z(e.sender).hasTriedToUpgradeToMessageChannel&&t.ports&&t.ports[0]&&ee(t.ports[0],e.sender),e},ie=e=>{e=e.sender;(e=z(e)).port=undefined,e.hasTriedToUpgradeToMessageChannel=!1};let N=()=>{};const ne=()=>{N(),N=()=>{},I&&I(),j()},se=((n,s)=>{let o,r=0,a;return function(...e){var t=d(),i=s-(t-r);return i<=0||s<i?(o&&(clearTimeout(o),o=null),r=t,a=n.apply(this,e)):!o&&0<s&&(o=setTimeout(()=>{r=d(),o=null,a=n.apply(this,e)},i)),a}})(e=>{"connected"!==e&&E.usePingAutoReconnect&&D(k)["catch"](()=>{})},1e3),oe=(e,t,i,n,s,o=!1,r)=>{if(window.addEventListener){E.appName=e,E.frameId=t,E.routeHandlerLookup=i,E.usePingAutoReconnect=o,E.connectionName=r||"",E.originProvider=n||(()=>window.location.origin||"*"),E.destinationProvider=s||(()=>window.parent||window.top);{const d=setInterval(B,100);I=()=>clearInterval(d)}e=se;if(h(e)){const c=R++;P.evalCallbacks[c]=e}const a=u(V,Z,C,te,J);window.addEventListener("message",a),N=()=>window.removeEventListener("message",a)}},re=e=>{if(h(e)){const t=R++;P.changeCallbacks[t]=e}};class ae extends e{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(),s=this.app,o=1e3,new Promise((e,t)=>{const i=d(),n=()=>{s.getConnectionStatus()?e():d()-i>o?t():setTimeout(n,50)};n()});var s,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`),D("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.hosts.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 de=()=>({});class ce{defaultState={containerType:"frame",minimized:!1,height:p.HEIGHT,width:p.WIDTH,left:p.LEFT,top:p.TOP};state={};containerClosedCallbacks=[];container=null;isConnected=!1;constructor(e,t,i,n,s,o=de,r=de){this.appName=e,this.assetName=t,this.assetStorageKey=i,this.connectionName=n,this.frameConfigProvider=o,this.windowConfigProvider=r,s&&Object.assign(this.defaultState,s),this.router=new G}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(),this.start()}prepContainer(){this.container="window"===this.state.containerType?new ae(this,this.windowConfigProvider()):new F(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=this.PluginAPI.agentStorage.read(this.assetStorageKey);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,this.state)}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"];oe(this.appName,e,this.router.lookupRouteProvider(),this.container.getOriginProvider(),this.container.getDestinationProvider(),!0,this.connectionName),re(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"),ne()}}const ue=()=>{try{return performance.getEntries()}catch(e){return[{failedGetEntries:!0,message:e.message,stack:e.stack}]}};class he extends ce{constructor(){super("Debugger","pendo.debugger.min.js","debug-enabled","AgentPlugin",null,()=>({containerId:"pendo-client-debugger"}),()=>({title:"Pendo Debugger"}))}initialize(s,o){o.restartDebugger=this.start.bind(this),super.init(s,o),this.router.addRoute("debugger::connect",(e,t)=>{var i;t({config:o.ConfigReader.audit(),env:{apiKey:(i=s).apiKey,environment:i.debugging.isStagingServer()?"staging":"production",device:i.debugging.isMobileUserAgent()?"mobile":"desktop",browserCookies:window.navigator.cookieEnabled,guideStatus:i.areGuidesDisabled()?"off":i.areGuidesDelayed()?"delayed":"on",foundShadowRoot:!!(i=i.debugging.observer.shadowDom).foundShadowRoots||(i.findShadowRoots(document,Infinity,()=>{}),i.foundShadowRoots)},container:this.state,events:o.store.state["debugger"].eventsCaptured,timeOrigin:performance.timeOrigin})}),this.router.addRoute("debugger::stop",()=>{s.disableDebugging()}),this.router.addRoute("debugger::showGuideById",(e,t)=>{t(s.showGuideById(e.data))}),this.router.addRoute("debugger::toggleGuideLoop",e=>{e.data?s.startGuides():s.stopGuides()}),this.router.addRoute("debugger::tombstoneGuide",e=>{e=s.findGuideById(e.data);o.Tombstone.addGuide(e)}),this.router.addRoute("debugger::openGuidePage",e=>{e=e.data,n=s,t=o.hosts.SERVER;var t,i,n=(i=n.findGuideById(e))&&n._.get(i,"attributes.resourceCenter")?i.attributes.resourceCenter.isTopLevel?`${t}/resource-center/${i.id}/draft`:(n=n.BuildingBlocks.BuildingBlockResourceCenter.getResourceCenter())&&n.id?`${t}/resource-center/${n.id}/module/`+i.id:"":t+"/guides/"+e;n&&window.open(n,"_blank")}),this.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,i,n)=>i===n.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)}}),this.router.addRoute("debugger::sync",(e,i)=>{const t=o.store.subscribe((e,t)=>{"debugger/eventsCaptured"===e.type&&i({action:"events/eventsCaptured",data:t["debugger"].eventsCaptured})}),n=setInterval(()=>{i({action:"agent/sync",data:o.store.state}),i({action:"environment/validateEnvironment",data:s.validateEnvironment(!0)}),i({action:"performance/sync",data:ue()})},500);this.events.on("unmounted",()=>{clearInterval(n),t()})}),this.router.addRoute("debugger::enableEventLogging",({data:e})=>{this.setProperties({enableEventLogging:e}),o.store.dispatch("debugger/enableEventLogging",e)}),this.router.addRoute("debugger::clearEventsCaptured",()=>{o.store.dispatch("debugger/clearEventsCaptured")}),this.router.addRoute("debugger::checkGuideEligibility",({data:e},t)=>{o.store.dispatch("debugger/checkGuideEligibility",{guideId:e,response:t})}),this.router.addRoute("debugger::testSelector",({data:e},t)=>{o.store.dispatch("debugger/testSelector",{selector:e,response:t})})}teardown(){super.stop(),this.setProperties({enabled:!1,containerType:"frame"})}}var x=new he,pe={initialize(e,t){x.initialize(e,t);const i=e.disableDebugging;e.disableDebugging=()=>{x.teardown(),i(),e.disableDebugging=i}},teardown(){x.teardown()}},ge=document.getElementById("pendo-debugger-plugin");let M="pendo";ge&&(M=ge.getAttribute("data-pendo-global-key")||"pendo"),window[M].addExtension&&window[M].addExtension({name:"Debugger",version:"1.0.0",type:"agent",use:"plugin",uri:pe})}();
package/dist/dom.esm.js CHANGED
@@ -6776,6 +6776,18 @@ var ConfigReader = (function () {
6776
6776
  * @type {boolean}
6777
6777
  */
6778
6778
  addOption('disablePrefetch', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
6779
+ /**
6780
+ * Visitors will be tracked under a single anonymized visitor id. Disables
6781
+ * cookies, localStorage, click tracking, and metadata. Only displays guides
6782
+ * that have been configured explicitly to show to this visitor.
6783
+ *
6784
+ * @access public
6785
+ * @category Config/Guides
6786
+ * @name doNotTrackGuides
6787
+ * @default false
6788
+ * @type {boolean}
6789
+ */
6790
+ addOption('doNotTrackGuides', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
6779
6791
  /**
6780
6792
  * If `true`, the web SDK will listen for `alt+shift+8` on the keyboard and try to launch the designer (). The
6781
6793
  * keyboard shortcut requires the guide launch modal of Engage to be open in another tab showing the shortcut.
@@ -7484,7 +7496,7 @@ function applyMatrix2dRect(matrix2d, rect) {
7484
7496
  return transformedRect;
7485
7497
  }
7486
7498
 
7487
- var VERSION = '2.324.0_';
7499
+ var VERSION = '2.326.0_';
7488
7500
 
7489
7501
  var decodeURIComponent = _.isFunction(window.decodeURIComponent) ? window.decodeURIComponent : _.identity;
7490
7502
 
@@ -7857,7 +7869,6 @@ var agentStorage = (function () {
7857
7869
  var key = !isPlain ? getPendoCookieKey(name, cookieSuffix) : name;
7858
7870
  if (storageIsDisabled()) {
7859
7871
  delete inMemoryStorage[key];
7860
- return;
7861
7872
  }
7862
7873
  if (shouldUseLocalStorage(keyLocalStorageOnly)) {
7863
7874
  if (storageAvailable('localStorage')) {
@@ -7877,6 +7888,13 @@ var agentStorage = (function () {
7877
7888
  }
7878
7889
  delete inMemoryStorage[key];
7879
7890
  }
7891
+ function clearAll() {
7892
+ _.each(registry.keys, function (config, name) {
7893
+ if (config.type === 'local') {
7894
+ clear(name);
7895
+ }
7896
+ });
7897
+ }
7880
7898
  var wrappedPendoSessionStorage = _.extend({}, pendoSessionStorage$1);
7881
7899
  wrappedPendoSessionStorage.setItem = wrapStorageWriteMethod(wrappedPendoSessionStorage.setItem, 'hasSession');
7882
7900
  var wrappedPendoLocalStorage = _.extend({}, pendoLocalStorage);
@@ -7886,6 +7904,7 @@ var agentStorage = (function () {
7886
7904
  read: read,
7887
7905
  write: wrapStorageWriteMethod(write, 'hasLocal'),
7888
7906
  clear: clear,
7907
+ clearAll: clearAll,
7889
7908
  registry: registry,
7890
7909
  getLocal: function () { return wrappedPendoLocalStorage; },
7891
7910
  getSession: function () { return wrappedPendoSessionStorage; }
@@ -8385,6 +8404,7 @@ Eventable.clear = function (events) {
8385
8404
  new EventType('eventCaptured', [DEBUG]),
8386
8405
  new EventType('error', [DEBUG, LIFECYCLE]),
8387
8406
  new EventType('onClickCaptured', [DEBUG]),
8407
+ new EventType('onEventCaptured', [DEBUG]),
8388
8408
  new EventType('urlChanged', [LIFECYCLE]),
8389
8409
  new EventType('leaderChanged', [LIFECYCLE, FRAMES]),
8390
8410
  new EventType('transmit:locked', [LIFECYCLE]),
@@ -9470,8 +9490,15 @@ function scrollElementIntoParentRect(element, scrollParent) {
9470
9490
  clientRect.left += diff;
9471
9491
  clientRect.right += diff;
9472
9492
  }
9473
- if (_.isFunction(scrollParent.scrollBy)) {
9474
- scrollParent.scrollBy(xScrollAmount, yScrollAmount);
9493
+ var isScrollByAFunction = _.isFunction(scrollParent.scrollBy);
9494
+ var isScrollByNative = isScrollByAFunction && isNativeCode(scrollParent.scrollBy);
9495
+ if (isScrollByAFunction) {
9496
+ if (isScrollByNative) {
9497
+ scrollParent.scrollBy(xScrollAmount, yScrollAmount);
9498
+ }
9499
+ else {
9500
+ scrollParent.scrollTo(scrollParent.scrollX + xScrollAmount, scrollParent.scrollY + yScrollAmount);
9501
+ }
9475
9502
  }
9476
9503
  else {
9477
9504
  scrollParent.scrollTop += yScrollAmount;
@@ -3367,6 +3367,18 @@ var ConfigReader = (function () {
3367
3367
  * @type {boolean}
3368
3368
  */
3369
3369
  addOption('disablePrefetch', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
3370
+ /**
3371
+ * Visitors will be tracked under a single anonymized visitor id. Disables
3372
+ * cookies, localStorage, click tracking, and metadata. Only displays guides
3373
+ * that have been configured explicitly to show to this visitor.
3374
+ *
3375
+ * @access public
3376
+ * @category Config/Guides
3377
+ * @name doNotTrackGuides
3378
+ * @default false
3379
+ * @type {boolean}
3380
+ */
3381
+ addOption('doNotTrackGuides', [SNIPPET_SRC, PENDO_CONFIG_SRC]);
3370
3382
  /**
3371
3383
  * If `true`, the web SDK will listen for `alt+shift+8` on the keyboard and try to launch the designer (). The
3372
3384
  * keyboard shortcut requires the guide launch modal of Engage to be open in another tab showing the shortcut.
@@ -3967,8 +3979,8 @@ let SERVER = '';
3967
3979
  let ASSET_HOST = '';
3968
3980
  let ASSET_PATH = '';
3969
3981
  let DESIGNER_SERVER = '';
3970
- let VERSION = '2.324.0_';
3971
- let PACKAGE_VERSION = '2.324.0';
3982
+ let VERSION = '2.326.0_';
3983
+ let PACKAGE_VERSION = '2.326.0';
3972
3984
  let LOADER = 'xhr';
3973
3985
  /* eslint-enable web-sdk-eslint-rules/no-gulp-env-references */
3974
3986
  /**
@@ -4806,7 +4818,6 @@ var agentStorage = (function () {
4806
4818
  var key = !isPlain ? getPendoCookieKey(name, cookieSuffix) : name;
4807
4819
  if (storageIsDisabled()) {
4808
4820
  delete inMemoryStorage[key];
4809
- return;
4810
4821
  }
4811
4822
  if (shouldUseLocalStorage(keyLocalStorageOnly)) {
4812
4823
  if (storageAvailable('localStorage')) {
@@ -4826,6 +4837,13 @@ var agentStorage = (function () {
4826
4837
  }
4827
4838
  delete inMemoryStorage[key];
4828
4839
  }
4840
+ function clearAll() {
4841
+ _.each(registry.keys, (config, name) => {
4842
+ if (config.type === 'local') {
4843
+ clear(name);
4844
+ }
4845
+ });
4846
+ }
4829
4847
  const wrappedPendoSessionStorage = _.extend({}, pendoSessionStorage$2);
4830
4848
  wrappedPendoSessionStorage.setItem = wrapStorageWriteMethod(wrappedPendoSessionStorage.setItem, 'hasSession');
4831
4849
  const wrappedPendoLocalStorage = _.extend({}, pendoLocalStorage$4);
@@ -4835,6 +4853,7 @@ var agentStorage = (function () {
4835
4853
  read,
4836
4854
  write: wrapStorageWriteMethod(write, 'hasLocal'),
4837
4855
  clear,
4856
+ clearAll,
4838
4857
  registry,
4839
4858
  getLocal: () => wrappedPendoLocalStorage,
4840
4859
  getSession: () => wrappedPendoSessionStorage
@@ -5675,6 +5694,7 @@ var Events = (function () {
5675
5694
  new EventType('eventCaptured', [DEBUG]),
5676
5695
  new EventType('error', [DEBUG, LIFECYCLE]),
5677
5696
  new EventType('onClickCaptured', [DEBUG]),
5697
+ new EventType('onEventCaptured', [DEBUG]),
5678
5698
  new EventType('urlChanged', [LIFECYCLE]),
5679
5699
  new EventType('leaderChanged', [LIFECYCLE, FRAMES]),
5680
5700
  new EventType('transmit:locked', [LIFECYCLE]),
@@ -10957,8 +10977,15 @@ function scrollElementIntoParentRect(element, scrollParent) {
10957
10977
  clientRect.left += diff;
10958
10978
  clientRect.right += diff;
10959
10979
  }
10960
- if (_.isFunction(scrollParent.scrollBy)) {
10961
- scrollParent.scrollBy(xScrollAmount, yScrollAmount);
10980
+ const isScrollByAFunction = _.isFunction(scrollParent.scrollBy);
10981
+ const isScrollByNative = isScrollByAFunction && isNativeCode(scrollParent.scrollBy);
10982
+ if (isScrollByAFunction) {
10983
+ if (isScrollByNative) {
10984
+ scrollParent.scrollBy(xScrollAmount, yScrollAmount);
10985
+ }
10986
+ else {
10987
+ scrollParent.scrollTo(scrollParent.scrollX + xScrollAmount, scrollParent.scrollY + yScrollAmount);
10988
+ }
10962
10989
  }
10963
10990
  else {
10964
10991
  scrollParent.scrollTop += yScrollAmount;
@@ -13838,6 +13865,7 @@ const internalEvents = {
13838
13865
  guidesFailed: 1,
13839
13866
  guidesLoaded: 1,
13840
13867
  onClickCaptured: 1,
13868
+ onEventCaptured: 1,
13841
13869
  segmentFlagsUpdated: 1,
13842
13870
  segmentFlagsReady: 1,
13843
13871
  segmentFlagsError: 1
@@ -13851,6 +13879,7 @@ const browserEvents = {
13851
13879
  const supportedPublicEvents = [
13852
13880
  'ready',
13853
13881
  'onClickCaptured',
13882
+ 'onEventCaptured',
13854
13883
  'deliverablesLoaded',
13855
13884
  'guidesFailed',
13856
13885
  'guidesLoaded',
@@ -21659,11 +21688,7 @@ var handle_event = function (evt) {
21659
21688
  }
21660
21689
  if (data.ignore)
21661
21690
  return;
21662
- let eventProperties;
21663
- if (type === 'click') {
21664
- eventProperties = getClickEventProperties(target);
21665
- }
21666
- collectEvent(type, { target: data }, undefined, undefined, eventProperties, evt);
21691
+ collectEvent(type, { target: data }, undefined, undefined, undefined, evt);
21667
21692
  Events.trigger('appUsage', data, evt);
21668
21693
  }
21669
21694
  catch (e) {
@@ -21673,33 +21698,6 @@ var handle_event = function (evt) {
21673
21698
  performanceMonitor.stopTimer(EVENT_CAPTURED_TIMER);
21674
21699
  }
21675
21700
  };
21676
- function getClickEventProperties(target) {
21677
- const eventPropertyHandler = getEventPropertyHandler(target);
21678
- Events.onClickCaptured.trigger(eventPropertyHandler);
21679
- const eventProperties = eventPropertyHandler.getEventProperties();
21680
- // create event expects undefined
21681
- if (_.isEmpty(eventProperties)) {
21682
- return;
21683
- }
21684
- return eventProperties;
21685
- }
21686
- function getEventPropertyHandler(target) {
21687
- const eventProperties = {};
21688
- return {
21689
- getEventProperties() {
21690
- return eventProperties;
21691
- },
21692
- addEventProperty(key, value) {
21693
- if (_.isString(key) && !_.isUndefined(value)) {
21694
- eventProperties[key] = value;
21695
- }
21696
- else {
21697
- log.error('Failed to add click event property');
21698
- }
21699
- },
21700
- target
21701
- };
21702
- }
21703
21701
  /*
21704
21702
  * Adds listeners to the DOM for user events
21705
21703
  * like click and focus.
@@ -28424,7 +28422,6 @@ const PluginAPI = {
28424
28422
  frames: {
28425
28423
  getChannel: () => channel
28426
28424
  },
28427
- getAssetUrl,
28428
28425
  getEventable: () => Eventable.call({}),
28429
28426
  getScreenPosition,
28430
28427
  GlobalRuntime: {
@@ -28446,6 +28443,9 @@ const PluginAPI = {
28446
28443
  getElementForGuideStep
28447
28444
  },
28448
28445
  hosts: {
28446
+ getAssetHost,
28447
+ getAssetUrl,
28448
+ getDataHost,
28449
28449
  SERVER
28450
28450
  },
28451
28451
  NodeSerializer,
@@ -28959,6 +28959,13 @@ function registerEventHandlers({ events = [] }) {
28959
28959
  }
28960
28960
  });
28961
28961
  }
28962
+ function applyDoNotTrackConfigOverrides(options) {
28963
+ options.excludeNonGuideAnalytics = true;
28964
+ options.disableCookies = true;
28965
+ options.visitor = { id: 'cookieless_visitor' };
28966
+ delete options.account;
28967
+ delete options.parentAccount;
28968
+ }
28962
28969
  // ----------------------------------------------------------------------------------
28963
28970
  let initializeCounter = 0;
28964
28971
  const initializeImmediately = 'initializeImmediately';
@@ -29036,6 +29043,11 @@ function initialize(options) {
29036
29043
  });
29037
29044
  }
29038
29045
  store.dispatch('location/init', options.location || {});
29046
+ const doNotTrackGuides = 'doNotTrackGuides';
29047
+ const isDoNotTrackGuides = _.get(options, doNotTrackGuides) || ConfigReader.get(doNotTrackGuides);
29048
+ if (isDoNotTrackGuides) {
29049
+ applyDoNotTrackConfigOverrides(options);
29050
+ }
29039
29051
  // Save the options somewhere
29040
29052
  ConfigReader.setLocalConfig(options);
29041
29053
  initDataHost();
@@ -29154,6 +29166,9 @@ function initialize(options) {
29154
29166
  initializeCounter++;
29155
29167
  announceFrameToDesignerPlugin();
29156
29168
  flushCallQueue();
29169
+ if (isDoNotTrackGuides) {
29170
+ agentStorage.clearAll();
29171
+ }
29157
29172
  }
29158
29173
  catch (e) {
29159
29174
  log.critical('An exception occurred during pendo.initialize.', e);
@@ -40646,6 +40661,69 @@ class WebAnalytics {
40646
40661
  }
40647
40662
  var WebAnalytics$1 = new WebAnalytics();
40648
40663
 
40664
+ function mergeEventProperties(capturedEvent, properties) {
40665
+ if (_.isEmpty(properties)) {
40666
+ return;
40667
+ }
40668
+ capturedEvent.eventProperties = _.extend({}, capturedEvent.eventProperties, properties);
40669
+ }
40670
+ function collectClickCapturedProperties(target) {
40671
+ const clickPropertyHandler = getEventPropertyHandler({ target });
40672
+ Events.onClickCaptured.trigger(clickPropertyHandler);
40673
+ return clickPropertyHandler.getEventProperties();
40674
+ }
40675
+ function collectEventCapturedProperties(target, capturedEvent) {
40676
+ const eventPropertyHandler = getEventPropertyHandler({ event: capturedEvent, target });
40677
+ Events.onEventCaptured.trigger(eventPropertyHandler);
40678
+ return eventPropertyHandler.getEventProperties();
40679
+ }
40680
+ function getEventPropertyHandler(obj) {
40681
+ const eventProperties = {};
40682
+ return _.extend({
40683
+ getEventProperties() {
40684
+ return eventProperties;
40685
+ },
40686
+ addEventProperty(key, value) {
40687
+ if (_.isString(key) && !_.isUndefined(value)) {
40688
+ eventProperties[key] = value;
40689
+ }
40690
+ else {
40691
+ log.error('Failed to add click event property');
40692
+ }
40693
+ }
40694
+ }, obj);
40695
+ }
40696
+ class EventCaptured {
40697
+ constructor() {
40698
+ this.name = 'EventCaptured';
40699
+ }
40700
+ initialize(pendo, PluginAPI) {
40701
+ this.api = PluginAPI;
40702
+ this.pendo = pendo;
40703
+ this.subscriptions = [
40704
+ this.api.attachEvent(this.api.Events, 'eventCaptured', _.bind(this.eventCaptured, this))
40705
+ ];
40706
+ }
40707
+ teardown() {
40708
+ _.each(this.subscriptions, function (unsubscribe) {
40709
+ unsubscribe();
40710
+ });
40711
+ this.subscriptions.length = 0;
40712
+ }
40713
+ eventCaptured(event) {
40714
+ if (!event || !event.data || !event.data.length)
40715
+ return;
40716
+ const capturedEvent = event.data[0];
40717
+ const context = event.data[1];
40718
+ const target = context && context.target;
40719
+ if (capturedEvent.type === 'click') {
40720
+ mergeEventProperties(capturedEvent, collectClickCapturedProperties(target));
40721
+ }
40722
+ mergeEventProperties(capturedEvent, collectEventCapturedProperties(target, capturedEvent));
40723
+ }
40724
+ }
40725
+ var eventCapturedPlugin = new EventCaptured();
40726
+
40649
40727
  function registerBuiltInPlugins() {
40650
40728
  registerPlugin(ActionAutomation);
40651
40729
  registerPlugin(Branding);
@@ -40666,6 +40744,7 @@ function registerBuiltInPlugins() {
40666
40744
  registerPlugin(SessionManager$1);
40667
40745
  registerPlugin(StepTimeoutMonitor);
40668
40746
  registerPlugin(WebAnalytics$1);
40747
+ registerPlugin(eventCapturedPlugin);
40669
40748
  }
40670
40749
 
40671
40750
  /*
@@ -41507,12 +41586,26 @@ const RequiredQuestions = {
41507
41586
  guideMarkdownUtil.removeMarkdownSyntax(item, requiredSyntax, '', pendo);
41508
41587
  });
41509
41588
  });
41510
- if (pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}] p`).length !== 0 || pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}] li`).length !== 0) {
41511
- pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}] p`).append(requiredElement);
41512
- pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}] li`).append(requiredElement);
41513
- }
41514
- else {
41515
- pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}]`).append(requiredElement);
41589
+ const pollTextSelector = `.bb-text[data-pendo-poll-id=${dataPendoPollId}]`;
41590
+ const pollParagraphSelector = `${pollTextSelector} p`;
41591
+ const pollListItemSelector = `${pollTextSelector} li`;
41592
+ const pollIndicatorSelector = `${pollTextSelector} ._pendo-required-indicator`;
41593
+ pendo._.each(pendo.dom(`${pollParagraphSelector}, ${pollListItemSelector}`), (el) => {
41594
+ pendo._.each(el.childNodes, (node) => {
41595
+ if (node.nodeType === 3 && node.nodeValue.indexOf(requiredSyntax) !== -1) {
41596
+ node.nodeValue = node.nodeValue.split(requiredSyntax).join('');
41597
+ }
41598
+ });
41599
+ });
41600
+ const hasIndicator = pendo.dom(pollIndicatorSelector).length !== 0;
41601
+ if (!hasIndicator) {
41602
+ if (pendo.dom(pollParagraphSelector).length !== 0 || pendo.dom(pollListItemSelector).length !== 0) {
41603
+ pendo.dom(pollParagraphSelector).append(requiredElement);
41604
+ pendo.dom(pollListItemSelector).append(requiredElement);
41605
+ }
41606
+ else {
41607
+ pendo.dom(pollTextSelector).append(requiredElement);
41608
+ }
41516
41609
  }
41517
41610
  if (pendo._.contains(requiredQuestions, dataPendoPollId)) {
41518
41611
  let questionIndex = requiredQuestions.indexOf(dataPendoPollId);
@@ -50760,12 +50853,12 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
50760
50853
  }
50761
50854
  }
50762
50855
 
50763
- const ONE_HUNDRED_MB_IN_BYTES = 100 * 1024 * 1024;
50856
+ var ONE_HUNDRED_MB_IN_BYTES = 100 * 1024 * 1024;
50764
50857
  function matchHostedResources(recordingEvent, stringifiedRecordingPayload) {
50765
- const fontURLRegex = /https:\/\/[^"\\\s]+?\.(woff2?|ttf|otf|eot)(\?[^"\\\s]*)?\b/g;
50766
- const matches = stringifiedRecordingPayload.match(fontURLRegex);
50858
+ var fontURLRegex = /https:\/\/[^"\\\s]+?\.(woff2?|ttf|otf|eot)(\?[^"\\\s]*)?\b/g;
50859
+ var matches = stringifiedRecordingPayload.match(fontURLRegex);
50767
50860
  // de-duplicate matches
50768
- const hostedResources = matches ? Array.from(new Set(matches)) : [];
50861
+ var hostedResources = matches ? Array.from(new Set(matches)) : [];
50769
50862
  return {
50770
50863
  type: 'recording',
50771
50864
  visitorId: recordingEvent.visitorId,
@@ -50780,7 +50873,7 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
50780
50873
  recordingPayloadMetadata: [],
50781
50874
  sequence: 0,
50782
50875
  recordingPayloadCount: 0,
50783
- hostedResources
50876
+ hostedResources: hostedResources
50784
50877
  };
50785
50878
  }
50786
50879
  // keep in mind changes here may need addressing in the extension worker proxy as well
@@ -50788,69 +50881,69 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
50788
50881
  try {
50789
50882
  if (e.data.type === 'init' && e.data.lockID) {
50790
50883
  if (navigator.locks) {
50791
- navigator.locks.request(e.data.lockID, () => {
50884
+ navigator.locks.request(e.data.lockID, function () {
50792
50885
  postMessage({ ready: true });
50793
50886
  // This unresolved promise keeps the lock held with the worker until the worker is
50794
50887
  // terminated at which point the lock is released.
50795
- return new Promise$2(() => { });
50888
+ return new Promise$2(function () { });
50796
50889
  });
50797
50890
  }
50798
50891
  return;
50799
50892
  }
50800
50893
  if (e.data.url && e.data.payload) {
50801
- let { url, payload, shouldCacheResources } = e.data;
50894
+ var _a = e.data, url = _a.url, payload = _a.payload, shouldCacheResources = _a.shouldCacheResources;
50802
50895
  if (Object.keys(payload).length === 0) {
50803
50896
  postMessage({
50804
50897
  type: 'emptyPayload'
50805
50898
  });
50806
50899
  }
50807
- const { sequence } = payload;
50808
- const stringifiedRecordingPayload = JSON.stringify(payload.recordingPayload);
50900
+ var sequence_1 = payload.sequence;
50901
+ var stringifiedRecordingPayload = JSON.stringify(payload.recordingPayload);
50809
50902
  // calculate and post back the recording payload size before the payload is compressed
50810
- const recordingPayloadSize = new TextEncoder().encode(stringifiedRecordingPayload).length;
50811
- const exceedsPayloadSizeLimit = recordingPayloadSize >= ONE_HUNDRED_MB_IN_BYTES;
50903
+ var recordingPayloadSize = new TextEncoder().encode(stringifiedRecordingPayload).length;
50904
+ var exceedsPayloadSizeLimit = recordingPayloadSize >= ONE_HUNDRED_MB_IN_BYTES;
50812
50905
  postMessage({
50813
50906
  type: 'recordingPayloadSize',
50814
- recordingPayloadSize,
50815
- exceedsPayloadSizeLimit
50907
+ recordingPayloadSize: recordingPayloadSize,
50908
+ exceedsPayloadSizeLimit: exceedsPayloadSizeLimit
50816
50909
  });
50817
50910
  // don't attempt to send the payload if it exceeds the allowed limit
50818
50911
  if (exceedsPayloadSizeLimit)
50819
50912
  return;
50820
50913
  if (shouldCacheResources) {
50821
- const hostedResourcesEvent = matchHostedResources(payload, stringifiedRecordingPayload);
50914
+ var hostedResourcesEvent = matchHostedResources(payload, stringifiedRecordingPayload);
50822
50915
  if (hostedResourcesEvent.hostedResources.length) {
50823
50916
  postMessage({
50824
50917
  type: 'hostedResources',
50825
- hostedResourcesEvent
50918
+ hostedResourcesEvent: hostedResourcesEvent
50826
50919
  });
50827
50920
  }
50828
50921
  }
50829
50922
  payload.recordingSize = recordingPayloadSize;
50830
- const body = compress(payload, 'binary');
50923
+ var body = compress(payload, 'binary');
50831
50924
  // we want to calculate ct (current time) as close as we can to the actual POST request
50832
50925
  // so that it's as accurate as possible
50833
- url = `${url}&ct=${new Date().getTime()}`;
50926
+ url = "".concat(url, "&ct=").concat(new Date().getTime());
50834
50927
  fetch(url, {
50835
50928
  method: 'POST',
50836
- body
50929
+ body: body
50837
50930
  }).then(function (response) {
50838
50931
  if (response.status < 200 || response.status >= 300) {
50839
50932
  postMessage({
50840
- error: new Error(`received status code ${response.status}: ${response.statusText}`),
50933
+ error: new Error("received status code ".concat(response.status, ": ").concat(response.statusText)),
50841
50934
  status: response.status,
50842
- sequence
50935
+ sequence: sequence_1
50843
50936
  });
50844
50937
  }
50845
50938
  else {
50846
50939
  postMessage({
50847
- sequence
50940
+ sequence: sequence_1
50848
50941
  });
50849
50942
  }
50850
- }).catch(function (e) {
50943
+ })["catch"](function (e) {
50851
50944
  postMessage({
50852
50945
  error: e,
50853
- sequence
50946
+ sequence: sequence_1
50854
50947
  });
50855
50948
  });
50856
50949
  }