@sprig-technologies/sprig-browser 2.40.2 → 2.40.4
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/conversational-ui-BuBuXnv4.cjs +1 -0
- package/dist/{conversational-ui-BYWN-x1R.js → conversational-ui-XCbY4udQ.js} +158 -158
- package/dist/{core-Br8FqGd4.cjs → core-BeBP-1Uj.cjs} +2 -2
- package/dist/{core-Cyu7gofl.js → core-DH1nitXA.js} +3 -3
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +1 -0
- package/dist/core.js +2 -2
- package/dist/{getAttributedUrl-C_5gL6aZ.js → getAttributedUrl-CwDSDeGp.js} +3 -3
- package/dist/{getAttributedUrl-CJJ96Ihj.cjs → getAttributedUrl-DxiDPASm.cjs} +1 -1
- package/dist/{index-MWKreg7C.cjs → index-DM14cHwu.cjs} +1 -1
- package/dist/{index-BSk-C5b7.js → index-KB_x0aKi.js} +4 -4
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -2
- package/dist/{metricsReporter-B-oKhuWk.js → metricsReporter-VDxBxz-n.js} +1 -1
- package/dist/{metricsReporter-Dc4CZlRc.cjs → metricsReporter-ZysYMm2J.cjs} +1 -1
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +1 -1
- package/dist/view-CwMhaJ55.cjs +1 -0
- package/dist/{view-BGlLLPXB.js → view-E-Mxwe-D.js} +330 -328
- package/package.json +1 -1
- package/dist/conversational-ui-N_aaTzqd.cjs +0 -1
- package/dist/view-BGzeHt4l.cjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var vt=Object.defineProperty;var ft=(r,t,o)=>t in r?vt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o;var q=(r,t,o)=>ft(r,typeof t!="symbol"?t+"":t,o);const i=require("./metricsReporter-Dc4CZlRc.cjs"),qe=()=>{try{return window.parent.Intercom}catch{return null}},Fe=[Object.freeze(Object.defineProperty({__proto__:null,disable:()=>{const r=qe();r&&(r.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),r.ul_wasVisible&&r("update",{hide_default_launcher:!0}))},enable:()=>{const r=qe();r&&(r.ul_wasVisible&&r("update",{hide_default_launcher:!1}),delete r.ul_wasVisible)}},Symbol.toStringTag,{value:"Module"}))];class Qe{static disable(){Fe.forEach(t=>t.disable())}static enable(){Fe.forEach(t=>t.enable())}}const Ve="ul-view-sdk-script",ht=new Set(["ios","android"]),T="visitors",C="environments";async function D(r,t){var n,a,s;const{shouldDropOnRateLimit:o,...d}=t;d.headers=Object.assign(i.getHttpHeaders(window.UserLeap),d.headers);const e=await i.sprigFetch(r,{...d,shouldDropOnRateLimit:o});if(e.ok){const l=(n=e.headers)==null?void 0:n.get("Authorization"),c=l?l.split(" "):void 0,p=c&&c.length===2?c[1]:void 0,u=(a=e.headers)==null?void 0:a.get("x-ul-visitor-id");if(window.UserLeap.userId&&u===window.UserLeap.visitorId){const y=i.localStorageHelper.getItemObject("sprig.anon.env.vid.map");y&&y[window.UserLeap.envId]===u&&(delete y[window.UserLeap.envId],i.localStorageHelper.setItemObject("sprig.anon.env.vid.map",y))}p&&u&&(u!==window.UserLeap.visitorId||window.UserLeap.token!==p)&&(I("token",p),I("vid",u),i.eventEmitter.emit(i.SprigEvent.VisitorIDUpdated,{visitorId:u}),window.UserLeap.token=p,window.UserLeap.visitorId=u)}return(s=e.json)!=null&&s.logMessage&&console.warn(`[Sprig] ${e.json.logMessage}`),e}function I(r,t){const o=i.localStorageHelper.getItemObject("userleap.ids");let d=o[window.UserLeap.envId];d?d[r]=t:d={[r]:t},o[window.UserLeap.envId]=d,i.localStorageHelper.setItemObject("userleap.ids",o)}function ke(){return window.previewMode?"0":window.UserLeap.visitorId??""}function R(r,t,o){const d=[window.UserLeap._API_URL,"sdk",r];return t&&t.forEach(e=>{d.push(e),e===C?d.push(window.UserLeap.envId):e===T&&d.push(ke())}),o&&d.push(o),d.join("/")}const $=async(r,t,o)=>{var Ce,Pe,He,Me;const{context:d,delay:e,avatars:n,forceBrandedLogo:a,endCard:s,isFeedback:l=!1,heatmap:c,locale:p,layout:u,previewMode:y,productConfig:w,questions:g,responseGroupUid:v,surveyId:m,uuid:f,vid:U,sessionReplay:b,studyType:E,surveyVisitorAttributes:P}=r,h=i.getHttpHeaders(window.UserLeap),H=Q(h),_=pe(h);if(b)if(H)i.eventEmitter.emit(i.SprigEvent.ReplayCapture,{responseGroupUid:v,hasQuestions:!!(g!=null&&g.length),surveyId:m,uploadId:b.uploadId,replayType:b.replayDurationType??"before",seconds:b.replayDurationSeconds,generateVideoUploadUrlPayload:{mediaRecordingUid:i.v4(),mediaType:"screen",questionId:1,responseGroupUid:v,surveyId:m,updatedAt:new Date().toISOString(),visitorId:window.UserLeap.visitorId,isReplay:!0}});else{if(!i.modules.replay)return window.UserLeap.reportError("displayQuestions",new Error("Replay module not registered")),{success:!1,message:"Replay module not registered",surveyState:"no survey"};i.modules.replay.scheduleOrCaptureReplay({responseGroupId:v,surveyId:m,visitorId:U,replayParams:b,completeUploadHeaders:h,apiUrl:window.UserLeap._API_URL,triggerTimestamp:Date.now(),isStandalone:g.length===0})}if(c){if(!i.modules.replay)return window.UserLeap.reportError("displayQuestions",new Error("Replay module not registered")),{success:!1,message:"Replay module not registered",surveyState:"no survey"};const{eventId:L,replayParams:j,responseGroupUid:ge,surveyId:me}=c;await i.modules.replay.initializeReplay({maxReplayDurationSeconds:300,maxInflightRequests:window.UserLeap.maxInflightReplayRequests,teardownAfter:!0,apiUrl:window.UserLeap._API_URL,replaySettings:o}),i.modules.replay.tryReplayAction(()=>{var je;return(je=i.modules.replay)==null?void 0:je.scheduleCapture({apiUrl:window.UserLeap._API_URL,completeUploadHeaders:h,eventId:L,isHeatmap:!0,replayParams:j,responseGroupId:ge,surveyId:me,triggerTimestamp:Date.now(),visitorId:U})},"Error in scheduling/capturing replay")}if(U==null||!(g!=null&&g.length))return i.breadcrumbsLogger.info("CannotDisplaySurvey",{vid:U}),{success:!1,message:"[Sprig] no survey found",surveyState:"no survey"};if(window.UserLeap.container){i.breadcrumbsLogger.info("AlreadyDisplayingSurvey");const L="[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";return console.warn(L),{success:!1,message:L,surveyState:"no survey"}}if(U!==window.UserLeap.visitorId&&f!==window.UserLeap.visitorId&&!window.previewMode){const L="Attempted to display survey to a different visitor";return window.UserLeap.reportError("DisplaySurvey",new Error(L)),{success:!1,message:L,surveyState:"no survey"}}i.breadcrumbsLogger.info("ShowingSurvey",{surveyId:m}),(Ce=i.modules.replay)==null||Ce.RecordSurveyShown({id:m,userAgent:window.navigator.userAgent}),Qe.disable(),i.eventEmitter.emit(i.SprigEvent.SurveyWillPresent,{name:i.SprigEvent.SurveyWillPresent,"survey.id":m,layout:u});let M,O,k,X,Z=document.createElement("div");const xe=L=>{const{"view.version":j}=L;j!==h["x-ul-sdk-version"]&&Xe(),i.eventEmitter.removeListener("verify.view.version",xe)};i.eventEmitter.on("verify.view.version",xe),window.UserLeap.useMobileStyling=_,i.shouldDirectEmbed(h)?(M="ul-direct-embeded-frame",O=document.head,k=window,X=!1,(()=>{const L=i.getHttpHeaders(window.UserLeap),j=Q(L),ge=window.UserLeap.forceDirectEmbed,me=L["userleap-platform"]==="web";return j||ge&&me})()&&(Ye(m,l),Z.id=M,window.UserLeap.container.appendChild(Z),Ze(),i.eventEmitter.emit(i.SprigEvent.SurveyLifeCycle,{state:"presented"}),i.eventEmitter.emit(i.SprigEvent.SurveyPresented,{name:i.SprigEvent.SurveyPresented,"survey.id":m}))):{frameId:M,contentWinDocHead:O,contentWindow:k,hasOverlay:X,iframe:Z}=Lt({productConfig:w,useMobileStyling:_,surveyId:m,isFeedback:l,enableCspTrustedTypes:(Pe=window.UserLeap._config)==null?void 0:Pe.enableCspTrustedTypes}),window.UserLeap.frameId=M;const W={apiURL:window.UserLeap._API_URL,avatars:n,cards:g,configureExitOnOverlayClick:L=>{i.eventEmitter.once(i.SprigEvent.CloseSurveyOnOverlayClick,L)},context:d,endCard:s,envId:window.UserLeap.envId,eventEmitFn:i.eventEmitter.emit.bind(i.eventEmitter),fontFamily:window.UserLeap.fontFamily,fontFamilyURL:window.UserLeap.fontFamilyURL,forceBrandedLogo:a,frame:Z,headers:h,layout:u,locale:p,mobileSDKVersion:window.UserLeap.mobileSDKVersion,previewKey:i.localStorageHelper.getItem("sprig.previewKey"),previewMode:y,productConfig:{framePosition:w==null?void 0:w.framePosition,desktopDisplay:w==null?void 0:w.desktopDisplay,placement:w==null?void 0:w.placement},responseGroupUid:v,startingQuestionIdx:(He=window.UserLeap.config)==null?void 0:He.startingQuestionIdx,studyType:E,styleNonce:window.UserLeap.styleNonce,surveyId:m,tabTitle:document.title,trackPageViewUrl:t,ulEvents:i.EVENTS,upchunkLibraryURL:window.UserLeap.upchunkLibraryURL,useMobileStyling:_,userId:f,viewDocument:k==null?void 0:k.document,viewWindow:k,visitorAttributes:{externalUserId:window.UserLeap.userId,email:window.UserLeap.email},surveyVisitorAttributes:P||{},...window.UserLeap._config};(Me=window.UserLeap._config)!=null&&Me.startingQuestionIdx&&(window.UserLeap._config={...window.UserLeap._config,startingQuestionIdx:null});const yt=(l?window.UserLeap.feedbackCustomStyles:window.UserLeap.customStyles)??w.customStyles;W.customStyles=yt,k&&(k.__cfg=W);const ue=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:W.path,Ae=document.getElementById(Ve);Ae&&Ae.remove();const we=function(){const L=document.createElement("script");return window.UserLeap.isMobileSDK||L.setAttribute("type","module"),window.UserLeap.nonce&&L.setAttribute("nonce",window.UserLeap.nonce),L.id=Ve,L}(),Oe=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};if(W.installationMethod==="web-npm"||W.installationMethod==="web-npm-bundled"){const{default:L}=await Promise.resolve().then(()=>require("./view-BGzeHt4l.cjs")).then(j=>j.view);L.configure(W),X&&window.UserLeap.container&&Oe()}else ue&&(we.src=`${ue}${window.UserLeap.isMobileSDK?"":`?t=${Date.now()}`}`,X&&we.addEventListener("load",()=>{window.UserLeap.container&&Oe()}),k==null||k.addEventListener("error",L=>{L.target instanceof HTMLScriptElement&&L.target.src===ue&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0}));O==null||O.appendChild(we);const Te={success:!0,surveyState:"ready",surveyId:m,responseGroupUid:v};return window.UserLeap.isMobileSDK&&e&&(Te.delay=e),Te};function pe(r){var o;if(window.UserLeap.useMobileStyling!==void 0)return window.UserLeap.useMobileStyling;const t=((o=window.UserLeap.windowDimensions)==null?void 0:o.width)??document.body.clientWidth;return Q(r)||t>10&&t<500}function Q(r){return ht.has(r["userleap-platform"])}const We=new WeakMap,St=(r,t)=>{try{return(d=>{var a,s;const e=We.get(d);if(e)return e;if(!((a=d.trustedTypes)!=null&&a.createPolicy))throw new Error("Trusted types not supported");const n=(s=d.trustedTypes)==null?void 0:s.createPolicy("sprig-sdk",{createHTML:l=>l,createScript:l=>l,createScriptURL:l=>l});return We.set(d,n),n})(t).createHTML(r)}catch(o){return console.warn("Could not create TrustedHTML object",o),r}},ce=(r,t,o=window)=>{var d;return t&&((d=o.trustedTypes)!=null&&d.createPolicy)?St(r,o):r},Re="ul-frame";window.UserLeap&&window.Sprig&&(window.Sprig._gtm?window.Sprig=window.UserLeap:window.UserLeap=window.Sprig),window.UserLeap||(window.UserLeap=window.Sprig),window.Sprig||(window.Sprig=window.UserLeap);const ye="0px",Ye=(r,t,o)=>{window.UserLeap.container=document.createElement("div"),window.UserLeap.container.className="ul-container"+(t?" ul-container-feedback":""),r&&(window.UserLeap.container.dataset.studyId=r.toString());const d=rt();o&&d&&!window.UserLeap.useMobileStyling?d.appendChild(window.UserLeap.container):document.body.appendChild(window.UserLeap.container)},Xe=(r,t)=>{var d;Et();const o=window.UserLeap.container;if(o)try{(d=o.parentNode)==null||d.removeChild(o),window.UserLeap.container=null,I("trackStartUrl",null),i.eventEmitter.emit(i.SprigEvent.SurveyLifeCycle,{state:"dismissed"}),i.eventEmitter.emit(i.SprigEvent.SurveyClosed,{name:i.SprigEvent.SurveyClosed,initiator:r,"survey.id":parseInt(o.dataset.studyId),...t&&{studyType:t}})}catch(e){console.warn(`[Sprig] (ERR-412) Error removing UserLeap container by ${r} `+o),e instanceof Error&&window.UserLeap.reportError("dismissActiveSurvey",e)}},Ze=()=>{i.eventEmitter.once(i.SprigEvent.SurveyWillClose,({initiator:r,studyType:t})=>{i.eventEmitter.removeAllListeners(i.SprigEvent.CloseSurveyOnOverlayClick),Xe(r,t)})},bt=(r,t,o,d)=>{var p,u;const e={position:"fixed",bottom:"0px",right:ye,border:0,backgroundColor:"rgba(0,0,0,0)",zIndex:2147483646,transition:"width 0.2s ease-in-out, height 0.2s ease-in-out",maxWidth:"100%"},n=Object.assign({},t,window.UserLeap),{desktopDisplay:a}=t||{},s=a==="center-modal";let l;s&&(n.framePosition="center");let c=!1;if(o)(p=window.UserLeap.windowDimensions)!=null&&p.width?e.width=`${window.UserLeap.windowDimensions.width}px`:e.width="100%",(u=window.UserLeap.windowDimensions)!=null&&u.height?e.maxHeight=window.UserLeap.windowDimensions.height-20+"px":window.UserLeap.maxHeight?e.maxHeight=window.UserLeap.maxHeight:e.maxHeight=document.body.clientHeight-20+"px",["light","dark"].includes(n.overlayStyleMobile)&&(c=!0);else{e.width="360px",e.maxHeight=window.UserLeap.maxHeight||"66vh";const y=()=>{c=!0,l={margin:"auto",position:"static"}};if(d)s?y():l={position:"relative",height:"300px"};else switch(n.framePosition){case"bottomLeft":l={left:ye};break;case"topLeft":l={left:ye,top:0};break;case"topRight":l={top:0};break;case"center":y()}}return c&&((y,w)=>{const g={position:"fixed",overflow:"auto",top:"0px",left:"0px",display:"none",height:"100%",width:"100%",transition:"background-color 0.3s ease-out",zIndex:2147483646},v=w?y.overlayStyleMobile:y.overlayStyle;g["background-color"]=v==="light"?"rgba(255,255,255, 0.95)":"rgba(0,0,0,0.9)",w||(g.margin="auto"),window.UserLeap.container&&Object.assign(window.UserLeap.container.style,g)})(n,o),Object.assign(r.style,e,l),c},Lt=({productConfig:r,useMobileStyling:t,surveyId:o,isFeedback:d,enableCspTrustedTypes:e})=>{var w,g;const n=Re,a=d&&r.desktopDisplay==="slider";Ye(o,d,a),Ut();const s=document.createElement("iframe");s.id=n,s.setAttribute("title","Sprig User Feedback Dialog");const l=bt(s,r,t,d);Ze();let c=!1;s.setHeight=v=>{parseInt(s.style.height)==v&&c||(c=!0,s.style.height=`${v}px`,i.eventEmitter.emit(i.SprigEvent.SurveyHeight,{name:i.SprigEvent.SurveyHeight,contentFrameHeight:v,"survey.id":o}))};let p=!1;s.setWidth=v=>{parseInt(s.style.width)==v&&p||(p=!0,s.style.width=`${v}px`,i.eventEmitter.emit(i.SprigEvent.SurveyWidth,{name:i.SprigEvent.SurveyWidth,contentFrameWidth:v,"survey.id":o}))},(w=window.UserLeap.container)==null||w.appendChild(s),r&&(t?r.exitOnOverlayClickMobile:r.exitOnOverlayClick)&&window.UserLeap.container&&(window.UserLeap.container.onclick=()=>{i.eventEmitter.emit(i.SprigEvent.CloseSurveyOnOverlayClick)}),i.eventEmitter.emit(i.SprigEvent.SurveyLifeCycle,{state:"presented"}),i.eventEmitter.emit(i.SprigEvent.SurveyPresented,{name:i.SprigEvent.SurveyPresented,"survey.id":o});const u=(g=s.contentWindow)==null?void 0:g.document;if(u&&(u.open("text/html","replace"),u.write(ce("<!doctype html><head></head><body></body></html>",e,s.contentWindow)),u.close(),!t)){const v=u.body;v.style.display="flex",v.style.alignItems="center"}const y=u==null?void 0:u.head;return{frameId:n,contentWinDocHead:y,contentWindow:s.contentWindow,hasOverlay:l,iframe:s}},et={[i.SprigEvent.SurveyFadingOut]:()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{"background-color":"rgba(0,0,0,0)"})}},Ut=()=>{Object.entries(et).forEach(([r,t])=>{i.eventEmitter.on(r,t)})},Et=()=>{Object.entries(et).forEach(([r,t])=>{i.eventEmitter.off(r,t)})},A=r=>!!r&&r.nodeType===Node.ELEMENT_NODE,Be=r=>r instanceof HTMLElement||r instanceof SVGElement,Y=({document:r,elementId:t,styleString:o,nonce:d})=>{const e=r.getElementById(t);if(e)return void(e.textContent=o);const n=r.createElement("style");d&&(n.nonce=d),n.textContent=o,n.id=t,r.head.appendChild(n)},ze=(r,t)=>{const o=t.querySelector(r);if(!A(o))return 0;const d=getComputedStyle(o);return parseFloat(d.paddingLeft)+parseFloat(d.paddingRight)+(parseFloat(d.marginLeft)+parseFloat(d.marginRight))+(parseFloat(d.borderLeftWidth)+parseFloat(d.borderRightWidth))},tt=(r,t,o)=>{const d=r.querySelector(".ul-card__container"),e=r.querySelector(".ul-app");let n=600,a=360;if(A(d)&&A(e)){const s=d.querySelector(".ul-card--matrix_grid"),l=!s&&t&&o;try{l&&(e.style.width="360px"),n=d.scrollHeight,n+=(u=>{const y=u.querySelector(".sprig-question-body"),w=u.querySelector(".ul-card"),g=u.querySelector(".ul-card-main-content"),v=u.querySelector(".ul-footer"),m=u.querySelector(".sprig-container");let f=0;return A(w)&&(f+=w.scrollHeight-w.clientHeight),A(g)&&(f+=g.scrollHeight-g.clientHeight),A(y)&&(f+=y.scrollHeight-y.clientHeight),A(v)&&A(m)&&m.clientHeight===0&&(f+=v.clientHeight),f})(r);const c=getComputedStyle(d),p=parseFloat(c.marginTop)+parseFloat(c.marginBottom);n+=p+(parseFloat(c.borderTopWidth)+parseFloat(c.borderBottomWidth)),s&&(a=s.scrollWidth,a+=ze(".ul-card__container",r),a+=ze(".sprig-question-body",r))}finally{l&&e.style.removeProperty("width")}}return[n+2,a]},rt=()=>S,B=()=>document.getElementById("sprig-feedback-container"),Se=()=>document.getElementById("sprig-feedback-loading-animation"),it=()=>!!document.getElementById(Re);let Ne=!1,S=null,x=null,_e=!1,G=null,F=null;const It=["bottom-left","bottom-right","center-left","center-right"],re=()=>{var t;const r=window.UserLeap.container;return((t=r==null?void 0:r.parentElement)==null?void 0:t.id)==="sprig-feedback-loading-container"},nt=()=>document.getElementById("sprig-feedback-error-container"),ot=()=>{if(!S)return 0;const r=S==null?void 0:S.clientWidth,t=window.getComputedStyle(S);return r+parseInt(t.borderRightWidth||"0")+parseInt(t.borderLeftWidth||"0")},ie=r=>{const t=B();t&&(F!=null&&F.endsWith("right")?t.style.right=`${r}px`:F!=null&&F.endsWith("left")&&(t.style.left=`${r}px`))},ve=()=>{if(S&&(re()||nt())){i.eventEmitter.off(i.SprigEvent.SurveyAppeared,N),be();const r=ot();return ie(-r),!0}return!1},N=()=>{if(!S||!x)return;const r=Se();r&&r.remove(),S.style.height="auto",S.style.width="auto",x.disabled=!1,_e=!1},be=()=>{if(S&&!Se()){const r=(()=>{var o;if(Se())return;const t=document.createElement("div");return t.className="ul-loading-spinner-container",t.id="sprig-feedback-loading-animation",t.role="progressbar",t.setAttribute("aria-live","polite"),t.setAttribute("aria-busy","true"),t.setAttribute("aria-label","Processing..."),t.innerHTML=ce(`
|
|
1
|
+
"use strict";var vt=Object.defineProperty;var ft=(r,t,o)=>t in r?vt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o;var q=(r,t,o)=>ft(r,typeof t!="symbol"?t+"":t,o);const i=require("./metricsReporter-ZysYMm2J.cjs"),qe=()=>{try{return window.parent.Intercom}catch{return null}},Fe=[Object.freeze(Object.defineProperty({__proto__:null,disable:()=>{const r=qe();r&&(r.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),r.ul_wasVisible&&r("update",{hide_default_launcher:!0}))},enable:()=>{const r=qe();r&&(r.ul_wasVisible&&r("update",{hide_default_launcher:!1}),delete r.ul_wasVisible)}},Symbol.toStringTag,{value:"Module"}))];class Qe{static disable(){Fe.forEach(t=>t.disable())}static enable(){Fe.forEach(t=>t.enable())}}const Ve="ul-view-sdk-script",ht=new Set(["ios","android"]),T="visitors",C="environments";async function D(r,t){var n,a,s;const{shouldDropOnRateLimit:o,...d}=t;d.headers=Object.assign(i.getHttpHeaders(window.UserLeap),d.headers);const e=await i.sprigFetch(r,{...d,shouldDropOnRateLimit:o});if(e.ok){const l=(n=e.headers)==null?void 0:n.get("Authorization"),c=l?l.split(" "):void 0,p=c&&c.length===2?c[1]:void 0,u=(a=e.headers)==null?void 0:a.get("x-ul-visitor-id");if(window.UserLeap.userId&&u===window.UserLeap.visitorId){const y=i.localStorageHelper.getItemObject("sprig.anon.env.vid.map");y&&y[window.UserLeap.envId]===u&&(delete y[window.UserLeap.envId],i.localStorageHelper.setItemObject("sprig.anon.env.vid.map",y))}p&&u&&(u!==window.UserLeap.visitorId||window.UserLeap.token!==p)&&(I("token",p),I("vid",u),i.eventEmitter.emit(i.SprigEvent.VisitorIDUpdated,{visitorId:u}),window.UserLeap.token=p,window.UserLeap.visitorId=u)}return(s=e.json)!=null&&s.logMessage&&console.warn(`[Sprig] ${e.json.logMessage}`),e}function I(r,t){const o=i.localStorageHelper.getItemObject("userleap.ids");let d=o[window.UserLeap.envId];d?d[r]=t:d={[r]:t},o[window.UserLeap.envId]=d,i.localStorageHelper.setItemObject("userleap.ids",o)}function ke(){return window.previewMode?"0":window.UserLeap.visitorId??""}function R(r,t,o){const d=[window.UserLeap._API_URL,"sdk",r];return t&&t.forEach(e=>{d.push(e),e===C?d.push(window.UserLeap.envId):e===T&&d.push(ke())}),o&&d.push(o),d.join("/")}const $=async(r,t,o)=>{var Ce,Pe,He,Me;const{context:d,delay:e,avatars:n,forceBrandedLogo:a,endCard:s,isFeedback:l=!1,heatmap:c,locale:p,layout:u,previewMode:y,productConfig:w,questions:g,responseGroupUid:v,surveyId:m,uuid:f,vid:U,sessionReplay:b,studyType:E,surveyVisitorAttributes:P}=r,h=i.getHttpHeaders(window.UserLeap),H=Q(h),_=pe(h);if(b)if(H)i.eventEmitter.emit(i.SprigEvent.ReplayCapture,{responseGroupUid:v,hasQuestions:!!(g!=null&&g.length),surveyId:m,uploadId:b.uploadId,replayType:b.replayDurationType??"before",seconds:b.replayDurationSeconds,generateVideoUploadUrlPayload:{mediaRecordingUid:i.v4(),mediaType:"screen",questionId:1,responseGroupUid:v,surveyId:m,updatedAt:new Date().toISOString(),visitorId:window.UserLeap.visitorId,isReplay:!0}});else{if(!i.modules.replay)return window.UserLeap.reportError("displayQuestions",new Error("Replay module not registered")),{success:!1,message:"Replay module not registered",surveyState:"no survey"};i.modules.replay.scheduleOrCaptureReplay({responseGroupId:v,surveyId:m,visitorId:U,replayParams:b,completeUploadHeaders:h,apiUrl:window.UserLeap._API_URL,triggerTimestamp:Date.now(),isStandalone:g.length===0})}if(c){if(!i.modules.replay)return window.UserLeap.reportError("displayQuestions",new Error("Replay module not registered")),{success:!1,message:"Replay module not registered",surveyState:"no survey"};const{eventId:L,replayParams:j,responseGroupUid:ge,surveyId:me}=c;await i.modules.replay.initializeReplay({maxReplayDurationSeconds:300,maxInflightRequests:window.UserLeap.maxInflightReplayRequests,teardownAfter:!0,apiUrl:window.UserLeap._API_URL,replaySettings:o}),i.modules.replay.tryReplayAction(()=>{var je;return(je=i.modules.replay)==null?void 0:je.scheduleCapture({apiUrl:window.UserLeap._API_URL,completeUploadHeaders:h,eventId:L,isHeatmap:!0,replayParams:j,responseGroupId:ge,surveyId:me,triggerTimestamp:Date.now(),visitorId:U})},"Error in scheduling/capturing replay")}if(U==null||!(g!=null&&g.length))return i.breadcrumbsLogger.info("CannotDisplaySurvey",{vid:U}),{success:!1,message:"[Sprig] no survey found",surveyState:"no survey"};if(window.UserLeap.container){i.breadcrumbsLogger.info("AlreadyDisplayingSurvey");const L="[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";return console.warn(L),{success:!1,message:L,surveyState:"no survey"}}if(U!==window.UserLeap.visitorId&&f!==window.UserLeap.visitorId&&!window.previewMode){const L="Attempted to display survey to a different visitor";return window.UserLeap.reportError("DisplaySurvey",new Error(L)),{success:!1,message:L,surveyState:"no survey"}}i.breadcrumbsLogger.info("ShowingSurvey",{surveyId:m}),(Ce=i.modules.replay)==null||Ce.RecordSurveyShown({id:m,userAgent:window.navigator.userAgent}),Qe.disable(),i.eventEmitter.emit(i.SprigEvent.SurveyWillPresent,{name:i.SprigEvent.SurveyWillPresent,"survey.id":m,layout:u});let M,O,k,X,Z=document.createElement("div");const xe=L=>{const{"view.version":j}=L;j!==h["x-ul-sdk-version"]&&Xe(),i.eventEmitter.removeListener("verify.view.version",xe)};i.eventEmitter.on("verify.view.version",xe),window.UserLeap.useMobileStyling=_,i.shouldDirectEmbed(h)?(M="ul-direct-embeded-frame",O=document.head,k=window,X=!1,(()=>{const L=i.getHttpHeaders(window.UserLeap),j=Q(L),ge=window.UserLeap.forceDirectEmbed,me=L["userleap-platform"]==="web";return j||ge&&me})()&&(Ye(m,l),Z.id=M,window.UserLeap.container.appendChild(Z),Ze(),i.eventEmitter.emit(i.SprigEvent.SurveyLifeCycle,{state:"presented"}),i.eventEmitter.emit(i.SprigEvent.SurveyPresented,{name:i.SprigEvent.SurveyPresented,"survey.id":m}))):{frameId:M,contentWinDocHead:O,contentWindow:k,hasOverlay:X,iframe:Z}=Lt({productConfig:w,useMobileStyling:_,surveyId:m,isFeedback:l,enableCspTrustedTypes:(Pe=window.UserLeap._config)==null?void 0:Pe.enableCspTrustedTypes}),window.UserLeap.frameId=M;const W={apiURL:window.UserLeap._API_URL,avatars:n,cards:g,configureExitOnOverlayClick:L=>{i.eventEmitter.once(i.SprigEvent.CloseSurveyOnOverlayClick,L)},context:d,endCard:s,envId:window.UserLeap.envId,eventEmitFn:i.eventEmitter.emit.bind(i.eventEmitter),fontFamily:window.UserLeap.fontFamily,fontFamilyURL:window.UserLeap.fontFamilyURL,forceBrandedLogo:a,frame:Z,headers:h,layout:u,locale:p,mobileSDKVersion:window.UserLeap.mobileSDKVersion,previewKey:i.localStorageHelper.getItem("sprig.previewKey"),previewMode:y,productConfig:{framePosition:w==null?void 0:w.framePosition,desktopDisplay:w==null?void 0:w.desktopDisplay,placement:w==null?void 0:w.placement},responseGroupUid:v,startingQuestionIdx:(He=window.UserLeap.config)==null?void 0:He.startingQuestionIdx,studyType:E,styleNonce:window.UserLeap.styleNonce,surveyId:m,tabTitle:document.title,trackPageViewUrl:t,ulEvents:i.EVENTS,upchunkLibraryURL:window.UserLeap.upchunkLibraryURL,useMobileStyling:_,userId:f,viewDocument:k==null?void 0:k.document,viewWindow:k,visitorAttributes:{externalUserId:window.UserLeap.userId,email:window.UserLeap.email},surveyVisitorAttributes:P||{},...window.UserLeap._config};(Me=window.UserLeap._config)!=null&&Me.startingQuestionIdx&&(window.UserLeap._config={...window.UserLeap._config,startingQuestionIdx:null});const yt=(l?window.UserLeap.feedbackCustomStyles:window.UserLeap.customStyles)??w.customStyles;W.customStyles=yt,k&&(k.__cfg=W);const ue=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:W.path,Ae=document.getElementById(Ve);Ae&&Ae.remove();const we=function(){const L=document.createElement("script");return window.UserLeap.isMobileSDK||L.setAttribute("type","module"),window.UserLeap.nonce&&L.setAttribute("nonce",window.UserLeap.nonce),L.id=Ve,L}(),Oe=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};if(W.installationMethod==="web-npm"||W.installationMethod==="web-npm-bundled"){const{default:L}=await Promise.resolve().then(()=>require("./view-CwMhaJ55.cjs")).then(j=>j.view);L.configure(W),X&&window.UserLeap.container&&Oe()}else ue&&(we.src=`${ue}${window.UserLeap.isMobileSDK?"":`?t=${Date.now()}`}`,X&&we.addEventListener("load",()=>{window.UserLeap.container&&Oe()}),k==null||k.addEventListener("error",L=>{L.target instanceof HTMLScriptElement&&L.target.src===ue&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0}));O==null||O.appendChild(we);const Te={success:!0,surveyState:"ready",surveyId:m,responseGroupUid:v};return window.UserLeap.isMobileSDK&&e&&(Te.delay=e),Te};function pe(r){var o;if(window.UserLeap.useMobileStyling!==void 0)return window.UserLeap.useMobileStyling;const t=((o=window.UserLeap.windowDimensions)==null?void 0:o.width)??document.body.clientWidth;return Q(r)||t>10&&t<500}function Q(r){return ht.has(r["userleap-platform"])}const We=new WeakMap,St=(r,t)=>{try{return(d=>{var a,s;const e=We.get(d);if(e)return e;if(!((a=d.trustedTypes)!=null&&a.createPolicy))throw new Error("Trusted types not supported");const n=(s=d.trustedTypes)==null?void 0:s.createPolicy("sprig-sdk",{createHTML:l=>l,createScript:l=>l,createScriptURL:l=>l});return We.set(d,n),n})(t).createHTML(r)}catch(o){return console.warn("Could not create TrustedHTML object",o),r}},ce=(r,t,o=window)=>{var d;return t&&((d=o.trustedTypes)!=null&&d.createPolicy)?St(r,o):r},Re="ul-frame";window.UserLeap&&window.Sprig&&(window.Sprig._gtm?window.Sprig=window.UserLeap:window.UserLeap=window.Sprig),window.UserLeap||(window.UserLeap=window.Sprig),window.Sprig||(window.Sprig=window.UserLeap);const ye="0px",Ye=(r,t,o)=>{window.UserLeap.container=document.createElement("div"),window.UserLeap.container.className="ul-container"+(t?" ul-container-feedback":""),r&&(window.UserLeap.container.dataset.studyId=r.toString());const d=rt();o&&d&&!window.UserLeap.useMobileStyling?d.appendChild(window.UserLeap.container):document.body.appendChild(window.UserLeap.container)},Xe=(r,t)=>{var d;Et();const o=window.UserLeap.container;if(o)try{(d=o.parentNode)==null||d.removeChild(o),window.UserLeap.container=null,I("trackStartUrl",null),i.eventEmitter.emit(i.SprigEvent.SurveyLifeCycle,{state:"dismissed"}),i.eventEmitter.emit(i.SprigEvent.SurveyClosed,{name:i.SprigEvent.SurveyClosed,initiator:r,"survey.id":parseInt(o.dataset.studyId),...t&&{studyType:t}})}catch(e){console.warn(`[Sprig] (ERR-412) Error removing UserLeap container by ${r} `+o),e instanceof Error&&window.UserLeap.reportError("dismissActiveSurvey",e)}},Ze=()=>{i.eventEmitter.once(i.SprigEvent.SurveyWillClose,({initiator:r,studyType:t})=>{i.eventEmitter.removeAllListeners(i.SprigEvent.CloseSurveyOnOverlayClick),Xe(r,t)})},bt=(r,t,o,d)=>{var p,u;const e={position:"fixed",bottom:"0px",right:ye,border:0,backgroundColor:"rgba(0,0,0,0)",zIndex:2147483646,transition:"width 0.2s ease-in-out, height 0.2s ease-in-out",maxWidth:"100%"},n=Object.assign({},t,window.UserLeap),{desktopDisplay:a}=t||{},s=a==="center-modal";let l;s&&(n.framePosition="center");let c=!1;if(o)(p=window.UserLeap.windowDimensions)!=null&&p.width?e.width=`${window.UserLeap.windowDimensions.width}px`:e.width="100%",(u=window.UserLeap.windowDimensions)!=null&&u.height?e.maxHeight=window.UserLeap.windowDimensions.height-20+"px":window.UserLeap.maxHeight?e.maxHeight=window.UserLeap.maxHeight:e.maxHeight=document.body.clientHeight-20+"px",["light","dark"].includes(n.overlayStyleMobile)&&(c=!0);else{e.width="360px",e.maxHeight=window.UserLeap.maxHeight||"66vh";const y=()=>{c=!0,l={margin:"auto",position:"static"}};if(d)s?y():l={position:"relative",height:"300px"};else switch(n.framePosition){case"bottomLeft":l={left:ye};break;case"topLeft":l={left:ye,top:0};break;case"topRight":l={top:0};break;case"center":y()}}return c&&((y,w)=>{const g={position:"fixed",overflow:"auto",top:"0px",left:"0px",display:"none",height:"100%",width:"100%",transition:"background-color 0.3s ease-out",zIndex:2147483646},v=w?y.overlayStyleMobile:y.overlayStyle;g["background-color"]=v==="light"?"rgba(255,255,255, 0.95)":"rgba(0,0,0,0.9)",w||(g.margin="auto"),window.UserLeap.container&&Object.assign(window.UserLeap.container.style,g)})(n,o),Object.assign(r.style,e,l),c},Lt=({productConfig:r,useMobileStyling:t,surveyId:o,isFeedback:d,enableCspTrustedTypes:e})=>{var w,g;const n=Re,a=d&&r.desktopDisplay==="slider";Ye(o,d,a),Ut();const s=document.createElement("iframe");s.id=n,s.setAttribute("title","Sprig User Feedback Dialog");const l=bt(s,r,t,d);Ze();let c=!1;s.setHeight=v=>{parseInt(s.style.height)==v&&c||(c=!0,s.style.height=`${v}px`,i.eventEmitter.emit(i.SprigEvent.SurveyHeight,{name:i.SprigEvent.SurveyHeight,contentFrameHeight:v,"survey.id":o}))};let p=!1;s.setWidth=v=>{parseInt(s.style.width)==v&&p||(p=!0,s.style.width=`${v}px`,i.eventEmitter.emit(i.SprigEvent.SurveyWidth,{name:i.SprigEvent.SurveyWidth,contentFrameWidth:v,"survey.id":o}))},(w=window.UserLeap.container)==null||w.appendChild(s),r&&(t?r.exitOnOverlayClickMobile:r.exitOnOverlayClick)&&window.UserLeap.container&&(window.UserLeap.container.onclick=()=>{i.eventEmitter.emit(i.SprigEvent.CloseSurveyOnOverlayClick)}),i.eventEmitter.emit(i.SprigEvent.SurveyLifeCycle,{state:"presented"}),i.eventEmitter.emit(i.SprigEvent.SurveyPresented,{name:i.SprigEvent.SurveyPresented,"survey.id":o});const u=(g=s.contentWindow)==null?void 0:g.document;if(u&&(u.open("text/html","replace"),u.write(ce("<!doctype html><head></head><body></body></html>",e,s.contentWindow)),u.close(),!t)){const v=u.body;v.style.display="flex",v.style.alignItems="center"}const y=u==null?void 0:u.head;return{frameId:n,contentWinDocHead:y,contentWindow:s.contentWindow,hasOverlay:l,iframe:s}},et={[i.SprigEvent.SurveyFadingOut]:()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{"background-color":"rgba(0,0,0,0)"})}},Ut=()=>{Object.entries(et).forEach(([r,t])=>{i.eventEmitter.on(r,t)})},Et=()=>{Object.entries(et).forEach(([r,t])=>{i.eventEmitter.off(r,t)})},A=r=>!!r&&r.nodeType===Node.ELEMENT_NODE,Be=r=>r instanceof HTMLElement||r instanceof SVGElement,Y=({document:r,elementId:t,styleString:o,nonce:d})=>{const e=r.getElementById(t);if(e)return void(e.textContent=o);const n=r.createElement("style");d&&(n.nonce=d),n.textContent=o,n.id=t,r.head.appendChild(n)},ze=(r,t)=>{const o=t.querySelector(r);if(!A(o))return 0;const d=getComputedStyle(o);return parseFloat(d.paddingLeft)+parseFloat(d.paddingRight)+(parseFloat(d.marginLeft)+parseFloat(d.marginRight))+(parseFloat(d.borderLeftWidth)+parseFloat(d.borderRightWidth))},tt=(r,t,o)=>{const d=r.querySelector(".ul-card__container"),e=r.querySelector(".ul-app");let n=600,a=360;if(A(d)&&A(e)){const s=d.querySelector(".ul-card--matrix_grid"),l=!s&&t&&o;try{l&&(e.style.width="360px"),n=d.scrollHeight,n+=(u=>{const y=u.querySelector(".sprig-question-body"),w=u.querySelector(".ul-card"),g=u.querySelector(".ul-card-main-content"),v=u.querySelector(".ul-footer"),m=u.querySelector(".sprig-container");let f=0;return A(w)&&(f+=w.scrollHeight-w.clientHeight),A(g)&&(f+=g.scrollHeight-g.clientHeight),A(y)&&(f+=y.scrollHeight-y.clientHeight),A(v)&&A(m)&&m.clientHeight===0&&(f+=v.clientHeight),f})(r);const c=getComputedStyle(d),p=parseFloat(c.marginTop)+parseFloat(c.marginBottom);n+=p+(parseFloat(c.borderTopWidth)+parseFloat(c.borderBottomWidth)),s&&(a=s.scrollWidth,a+=ze(".ul-card__container",r),a+=ze(".sprig-question-body",r))}finally{l&&e.style.removeProperty("width")}}return[n+2,a]},rt=()=>S,B=()=>document.getElementById("sprig-feedback-container"),Se=()=>document.getElementById("sprig-feedback-loading-animation"),it=()=>!!document.getElementById(Re);let Ne=!1,S=null,x=null,_e=!1,G=null,F=null;const It=["bottom-left","bottom-right","center-left","center-right"],re=()=>{var t;const r=window.UserLeap.container;return((t=r==null?void 0:r.parentElement)==null?void 0:t.id)==="sprig-feedback-loading-container"},nt=()=>document.getElementById("sprig-feedback-error-container"),ot=()=>{if(!S)return 0;const r=S==null?void 0:S.clientWidth,t=window.getComputedStyle(S);return r+parseInt(t.borderRightWidth||"0")+parseInt(t.borderLeftWidth||"0")},ie=r=>{const t=B();t&&(F!=null&&F.endsWith("right")?t.style.right=`${r}px`:F!=null&&F.endsWith("left")&&(t.style.left=`${r}px`))},ve=()=>{if(S&&(re()||nt())){i.eventEmitter.off(i.SprigEvent.SurveyAppeared,N),be();const r=ot();return ie(-r),!0}return!1},N=()=>{if(!S||!x)return;const r=Se();r&&r.remove(),S.style.height="auto",S.style.width="auto",x.disabled=!1,_e=!1},be=()=>{if(S&&!Se()){const r=(()=>{var o;if(Se())return;const t=document.createElement("div");return t.className="ul-loading-spinner-container",t.id="sprig-feedback-loading-animation",t.role="progressbar",t.setAttribute("aria-live","polite"),t.setAttribute("aria-busy","true"),t.setAttribute("aria-label","Processing..."),t.innerHTML=ce(`
|
|
2
2
|
<div class="ul-loading-spinner">
|
|
3
3
|
<div class="first"></div>
|
|
4
4
|
<div class="second"></div>
|
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
<circle cx="20" cy="20" r="14.5" stroke="#B0B5B7" stroke-width="3"/>
|
|
10
10
|
<path d="M20 12L20 21.6" stroke="#B0B5B7" stroke-width="3" stroke-linecap="round"/>
|
|
11
11
|
<circle cx="19.9984" cy="27.6" r="1.6" fill="#B0B5B7"/>
|
|
12
|
-
</svg>`,(o=window.UserLeap._config)==null?void 0:o.enableCspTrustedTypes);const t=document.createElement("h3");return t.className="sprig-feedback-error-text",t.innerText="There was an error while loading the survey",r.appendChild(t),r},Le=new class{constructor(){q(this,"_ldData",{})}getAllLaunchDarklyVariations(){return this._ldData}setLDFlagsVariations(r){try{return!(!r||typeof r!="object"||Array.isArray(r))&&(Object.keys(this._ldData).forEach(t=>{delete this._ldData[t]}),Object.keys(r).forEach(t=>this._ldData[`!launch_darkly_${t}`]=(r[t]??0)+1),!0)}catch(t){return t instanceof Error&&window.UserLeap.reportError("setAllLDFlagsVariations",t),console.warn("[Sprig] An issue had occured when setting LaunchDarkly flags and variations."),!1}}};Object.freeze(Le);const te=new class{constructor(){q(this,"_optimizelyData",{})}setOptimizelyExperiment(r,t=!0){if(!r||typeof r!="object")return!1;const{experiments:o}=r;try{return t&&Object.keys(this._optimizelyData).map(d=>{delete this._optimizelyData[d]}),o&&o.map(d=>{const{id:e,variation:n}=d,a=this.transformExperimentId(e);n&&typeof n=="string"&&(this._optimizelyData[a]=n)}),!0}catch(d){return d instanceof Error&&window.UserLeap.reportError("setOptimizelyExperiment",d),!1}}getAllOptimizelyExperiments(){return this._optimizelyData}getOptimizelyVariationName(r){return this._optimizelyData[this.transformExperimentId(r)]}transformExperimentId(r){return"!optimizely_experiments_"+r}getAndSetWebOptimizelyExperiments(){var r;try{if(window&&window.optimizely&&typeof window.optimizely.get=="function"){const t=(r=window.optimizely.get("state"))==null?void 0:r.getExperimentStates({isActive:!0});if(t){const o=Object.keys(t).map(d=>{var e,n;return(e=t[d].variation)!=null&&e.name?{id:d,variation:(n=t[d].variation)==null?void 0:n.name}:{id:d,variation:"Original"}});return this.setOptimizelyExperiment({experiments:o},!1),!0}return!1}return!1}catch(t){return t instanceof Error&&window.UserLeap.reportError("getAndSetWebOptimizely",t),!1}}};Object.freeze(te);class Rt{constructor(t,o){q(this,"paused");q(this,"queue");q(this,"ul");this.ul=t,this.paused=!1,this.queue=[],this.flush(o)}flush(t){const o=t.length;if(o)for(let d=0;d<o;d++)this.push(t[d])}isPaused(){return this.paused}pause(){this.paused=!0}unpause(){this.paused=!1;const t=this.queue.slice();this.empty(),this.flush(t)}push(t){if(this.paused)this.queue.push(t);else if(t instanceof Function)t();else{const o=Array.prototype.slice.call(t,1),d=t[0],e=this.ul[d];e instanceof Function?e.apply(this.ul,o):d&&console.warn("[Sprig] (ERR-100) No valid UserLeap action called",d)}}perform(t){if(this.paused){let o=()=>{};const d=new Promise(function(e){o=function(){e(t())}});return this.queue.push(o),d}return t()}empty(){this.queue.length=0}}let at,dt;const Ue=r=>{let t=0,o=r.firstElementChild;for(;o;)t+=Ue(o),o.shadowRoot&&(t+=Ue(o.shadowRoot)),o=o.nextElementSibling,t++;return t},Ge=()=>{at.report(Ue(document.body)),dt.report(document.documentElement.innerHTML.toString().length)},Ee=(r,t)=>{const o=performance.now();document.hidden?setTimeout(()=>Ee(r,t),r):setTimeout(()=>{const d=performance.now()-o;t.report(d/1e3),setTimeout(()=>Ee(r,t),r)},0)};let ne,oe,se,ae,Ke,V={};const ee=(r,t=1)=>{const{name:o}=r;V[o]=(V[o]||0)+t},lt=r=>{let t=1;return r.childNodes.forEach(o=>{t+=lt(o)}),t},Je=r=>{let t=0;return r.forEach(o=>{t+=lt(o)}),t},_t=r=>{switch(r.type){case"childList":return ee(ne,Je(r.addedNodes)),void ee(oe,Je(r.removedNodes));case"attributes":return void ee(se);case"characterData":return void ee(ae)}},Dt=r=>r.forEach(_t),xt=()=>{ne.report(V[ne.name]||0),oe.report(V[oe.name]||0),se.report(V[se.name]||0),ae.report(V[ae.name]||0),V={}},At=(r=1e3)=>{ne=i.registerMetric("sdk_mutations_nodes_added"),oe=i.registerMetric("sdk_mutations_nodes_removed"),se=i.registerMetric("sdk_mutations_attributes_changed"),ae=i.registerMetric("sdk_mutations_character_data"),Ke=new MutationObserver(Dt),Ke.observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),setInterval(xt,r)},Ot=({isWeb:r,reportingIntervalSeconds:t,thresholds:o,postMetrics:d})=>{i.registerThresholds(o,(e,n)=>{var a,s;if((a=i.modules.replay)!=null&&a.isReplayRecording()){const l=`Value: ${e} on ${n.metric} violated threshold of ${n.type} ${n.value}`;(s=i.modules.replay)==null||s.disableRecording("Threshold violated",new Error(l),{reportError:!1}),window.UserLeap.reportError("Sdk Performance Metric threshold violated",new Error("Sdk Performance Metric threshold violated"),{metricName:n.metric,type:n.type,value:n.value},{metricName:n.metric}),i.disableThresholdChecking()}}),i.initPerformanceReporting({reportingIntervalSeconds:t,postMetrics:d}),r&&(((e=1e3)=>{const n=i.registerMetric("sdk_event_queue_latency_seconds");Ee(e,n)})(),((e=1e4)=>{at=i.registerMetric("sdk_dom_nodes_count"),dt=i.registerMetric("sdk_page_html_characters"),Ge(),setInterval(Ge,e)})(),At())},Tt="test",Ct=["popState","pushState","replaceState"];let De,K;const de={},z="!email",pt="pageUrl";let fe=window.location.href;function J(r){var s,l;const{pageUrlEvents:t,interactiveEvents:o,dismissOnPageChange:d,platform:e}=window.UserLeap._config;if(e&&e!=="web")return;fe!==window.location.href&&i.breadcrumbsLogger.navigation("LocationChange",{from:fe,to:window.location.href}),fe=window.location.href;const n=wt().trackStartUrl,a=n?String(n):null;t&&mt(window.location.href),o&&(ut(),Pt()),rt()&&(()=>{if(re())return;const c=B();c&&(i.checkUrlStillMatching(G)||(c.remove(),G=null,S=null))})(),i.sessionStorageHelper.getItem("sprig.isCapturingHeatmap")&&((l=(s=i.modules.replay)==null?void 0:s.checkPendingHeatmapsUrl())==null||l.then(c=>{var p;c&&((p=i.modules.replay)==null||p.uploadReadyPendingCaptures(!0))})),!re()&&d&&a&&a!==window.location.href&&r&&Ct.includes(r.type)&&window.UserLeap("dismissActiveSurvey",i.DismissReason.PageChange)}const ct={capture:!0},Pt=()=>{const r=window.UserLeap._config.interactiveEvents.filter(o=>i.checkUrlMatch(o,window.location.href)).map(o=>{const{name:d,properties:e}=o,{selector:n,innerText:a}=e;return n?s=>{if(Be(s.target))try{s.target.closest(n)&&window.UserLeap("track",d)}catch{}return!1}:s=>(Be(s.target)&&s.target.innerText===a&&window.UserLeap("track",d),!1)}),t=o=>r.forEach(d=>d(o));window.UserLeap._config.interactiveEventsHandler=t,window.addEventListener("click",t,ct)},ut=()=>{window.UserLeap._config.interactiveEventsHandler&&window.removeEventListener("click",window.UserLeap._config.interactiveEventsHandler,ct),delete window.UserLeap._config.interactiveEventsHandler};function wt(){const r=i.localStorageHelper.getItemObject("userleap.ids");return r&&r[window.UserLeap.envId]||{}}function gt(){if(window.previewMode)return;const r=i.localStorageHelper.getItemObject("sprig.anon.env.vid.map")||{},t=r[window.UserLeap.envId];window.UserLeap.visitorId=t||i.v4(),i.breadcrumbsLogger.info("NewVid",{vid:window.UserLeap.visitorId}),I("vid",window.UserLeap.visitorId),t||(r[window.UserLeap.envId]=window.UserLeap.visitorId,i.localStorageHelper.setItemObject("sprig.anon.env.vid.map",r)),i.eventEmitter.emit(i.SprigEvent.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId})}function mt(r,t,o,d){var e,n;try{if(r.endsWith("mock_snippet.html"))return;i.breadcrumbsLogger.info("PageView",{url:r});const a=(e=document==null?void 0:document.querySelector('meta[name="description"]'))==null?void 0:e.getAttribute("content");(n=i.modules.replay)==null||n.RecordPageView({...a&&{description:a},url:r,referrer:document.referrer,pageTitle:document.title});const s=window.UserLeap._config.pageUrlEvents;let l=!1;if(s&&s.length)for(let p=0;p<s.length&&(l=i.checkUrlMatch(s[p],r),!l);p++);if(!l)return;window.UserLeap.debugMode&&console.info("[DEBUG] Sprig trackPageView",r);const c={url:r};d&&(c.trackPageView=!0),window.UserLeap._queue.push(["track",pt,t,c,o])}catch(a){a instanceof Error&&(a.stack=r,window.UserLeap.reportError("trackPageView",a)),console.warn("[Sprig] (ERR-428) Failed to track page view",a)}}function Ht(){const r="Backbone"in window&&window.Backbone&&window.Backbone.history?window.Backbone.history:window.history;"pushState"in r&&(r.pushState=(t=>function(...o){const d=t.apply(this,o),e=new Event("pushState");return window.dispatchEvent(e),J(e),d})(r.pushState)),"replaceState"in r&&(r.replaceState=(t=>function(...o){const d=t.apply(this,o),e=new Event("replaceState");return window.dispatchEvent(e),J(e),d})(r.replaceState)),["hashchange","popstate"].forEach(t=>window.addEventListener(t,J,!0))}async function he(r,t){const o=ke();r&&!t&&(window.UserLeap._config.mode=Tt);const d=pe(i.getHttpHeaders(window.UserLeap)),e=await D(function(n){const a=new URL(R("1",[C],"questions"));return Object.entries(n||{}).forEach(([s,l])=>{l&&a.searchParams.append(s,String(l))}),a.toString()}({desktopDisplay:window.UserLeap._config.desktopDisplay,isMobile:d,previewLanguage:window.UserLeap._config.previewLanguage,surveyid:r==null?void 0:r.surveyId,surveytemplateid:r==null?void 0:r.surveyTemplateId,vid:o}),{shouldDropOnRateLimit:!0});if(!e.ok)return e.reportError&&e.error&&(console.warn("[Sprig] (ERR-414) Failed to request questions from the server",e.error),window.UserLeap.reportError("getQuestions",e.error)),{success:!1,surveyState:"no survey"};if(e.json.delay&&await i.delay(e.json.delay),!e.json.isFeedback)return $(e.json,K,De);{const{feedbackLabel:n,productConfig:a,surveyUuid:s,feedbackCustomStyles:l}=e.json,{buttonTheme:c,placement:p,desktopDisplay:u}=a;st({customStyles:l,buttonTheme:c,desktopDisplay:u,eventId:0,feedbackLabel:n,placement:p,surveyUuid:s,surveyId:r==null?void 0:r.surveyId},e.json)}}function Mt(r){if(!r)return;window.UserLeap._config=r,r.mute&&window.UserLeap._queue.pause();const{interactiveEvents:t,pageUrlEvents:o,dismissOnPageChange:d}=r;t&&function(e){let n=e.length;for(;n;){const a=Math.floor(Math.random()*n);n-=1;const s=e[n];e[n]=e[a],e[a]=s}}(t),(t||o||d)&&(Ht(),J())}const jt=function(r){if(!window.UserLeap)return;const t=async(e={})=>{var f,U,b,E,P;const{userId:n,anonymousId:a,metadata:s={},properties:l,showSurveyCallback:c}=e;let{eventName:p}=e;if(window.UserLeap.debugMode&&p!==pt&&console.info("[DEBUG] Sprig track",e),r.mode==="test")return;const u=i.localStorageHelper.getItem("sprig.previewKey")??void 0;if(r.requireUserIdForTracking&&!window.UserLeap.userId&&!n){const h="[Sprig] - Skipping tracking without userId";return console.warn(h),{success:!1,message:h,surveyState:"no survey"}}if(!p||p.trim().length===0){p=p?String(p):"";const h="[Sprig] - Invalid event name "+p;return console.warn(h),{success:!1,message:h,surveyState:"no survey"}}const y=K??window.location.href;s.url||(s.url=y),I("trackStartUrl",y),(U=(f=window.UserLeap)==null?void 0:f._config)!=null&&U.optimizelyEnabled&&(Q(i.getHttpHeaders(window.UserLeap))||te.getAndSetWebOptimizelyExperiments(),s.optimizelyExperiments=Object.assign({},te.getAllOptimizelyExperiments())),(E=(b=window.UserLeap)==null?void 0:b._config)!=null&&E.launchDarklyEnabled&&(s.launchDarklyFlags=Le.getAllLaunchDarklyVariations()),n&&(window.UserLeap.userId=n),a&&(window.UserLeap.partnerAnonymousId=a),l&&(s.eventProperties=l),(P=i.modules.replay)==null||P.RecordEvent({name:p,url:s.url}),i.breadcrumbsLogger.info("TrackEvent",{eventName:p});const w=window.UserLeap.delayingSurvey||it()?await D(R("1",[T],"events/batch"),{body:JSON.stringify({events:[{event:p,metadata:s}],previewKey:u}),method:"POST",shouldDropOnRateLimit:!0}):await D(R("1",[T],"events"),{body:JSON.stringify({event:p,metadata:s,previewKey:u}),method:"POST",shouldDropOnRateLimit:!0});if(!w.ok){const h="[Sprig] (ERR-421) Failed to track event";return w.reportError&&(console.warn(h,w.error),w.error&&window.UserLeap.reportError("track",w.error)),{success:!1,message:h,error:w.error,surveyState:"no survey"}}n&&I("uid",n),a&&I("aid",a);const g=w.json;g.invalidPreviewKey&&i.localStorageHelper.removeItem("sprig.previewKey");const v=s.trackPageView?s.url:void 0;return g!=null&&g.feedbackButton&&st(g.feedbackButton,void 0,v),await async function(h,H){var M,O;let _=!0;return!(H&&((M=h==null?void 0:h.json)!=null&&M.surveyId)&&(window.UserLeap.delayingSurvey=!0,_=await H(h.json.surveyId),window.UserLeap.delayingSurvey=!1,!_))&&((O=h==null?void 0:h.json)!=null&&O.delay&&!window.UserLeap.isMobileSDK&&(window.UserLeap.delayingSurvey=!0,await i.delay(h.json.delay),window.UserLeap.delayingSurvey=!1),_)}(w,c)?function(h){if(!window.UserLeap._config.dismissOnPageChange)return!0;const H=new URL(h),_=new URL(K??window.location.href);return H.hostname===_.hostname&&H.pathname===_.pathname}(y)?$(g,v,De):{success:!1,message:"Study should not be displayed after page navigation",surveyState:"no survey"}:{success:!1,message:"[Sprig] Callback returned false, aborting rendering of survey",surveyState:"no survey"}},o=(e,n)=>{var s;const a=(s=e==null?void 0:e.querySelector(`[id="${Re}"]`))==null?void 0:s.contentDocument;a&&Y({document:a,elementId:"ul-custom-style",styleString:n})},d={displaySurvey:async e=>(console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."),window.UserLeap("dismissActiveSurvey",i.DismissReason.Override),he({surveyId:e},!0)),_previewSurvey(e){window.UserLeap("dismissActiveSurvey",i.DismissReason.Override),he({surveyTemplateId:e},!1)},_reviewSurvey(e){window.UserLeap("dismissActiveSurvey",i.DismissReason.Override),he({surveyId:e},!1)},previewSurvey(e){d._previewSurvey(e)},reviewSurvey(e){d._reviewSurvey(e)},mute(){window.UserLeap._queue.pause()},unmute(){window.UserLeap._queue.unpause()},setVisitorToken(){console.warn("[Sprig] setVisitorToken is deprecated.")},dismissActiveSurvey(e=i.DismissReason.API){window.UserLeap.container&&(e===i.DismissReason.Closed&&window.Sprig.trackHistory&&window.Sprig.trackHistory({event:"closed"}),i.eventEmitter.emit(i.SprigEvent.SurveyCloseRequested,{name:i.SprigEvent.SurveyCloseRequested,initiator:e,"survey.id":parseInt(window.UserLeap.container.dataset.studyId)}),i.eventEmitter.emit(i.SprigEvent.SurveyWillClose,{name:i.SprigEvent.SurveyWillClose,initiator:e,"survey.id":parseInt(window.UserLeap.container.dataset.studyId)}))},async setAttribute(e,n){if(!e||!n&&n!==0&&n!==!1){const a="[Sprig] - Disregarding empty attribute / value provided";return console.warn(a),{success:!1,message:a}}return this.setAttributes({[e]:n})},async setAttributes(e){if(e==null||Object.keys(e).length===0){const n="[Sprig] - Disregarding empty attributes provided";return console.warn(n),{success:!1,message:n}}return this.identifyAndSetAttributes({attributes:e})},async identifyAndSetAttributes(e){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig identifyAndSetAttributes",e),r.mode==="test")return;if(e===null||typeof e!="object"||!(e.userId||e.anonymousId||e.attributes)){const p="[Sprig] - Disregarding empty payload provided";return console.warn(p),{success:!1,message:p}}const{userId:n,anonymousId:a,attributes:s}=e;if(r.requireUserIdForTracking&&!window.UserLeap.userId&&!n){const p="[Sprig] - Skipping tracking without userId";return console.warn(p),{success:!1,message:p}}if(s){s.email&&!s[z]&&(s[z]=s.email,delete s.email);const p=Object.keys(s);for(const u of p)s[u]===de[u]&&delete s[u]}if(!(s&&Object.keys(s).length!==0||n&&window.UserLeap.userId!==n||a&&window.UserLeap.partnerAnonymousId!==a))return{success:!0};const l={};let c;return n&&(l.userId=window.UserLeap.userId=n),a&&(l.partnerAnonymousId=window.UserLeap.partnerAnonymousId=a),s&&Object.keys(s).length>0?(c=await D(R("1",[C,T],"attributes"),{body:JSON.stringify(s),method:"PUT"}),c.ok?Object.assign(de,s):c.reportError&&(console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed",c.error),c.error&&window.UserLeap.reportError("identifyAndSetAttributes",c.error))):c=await D(R("1",[C,T]),{body:JSON.stringify(l),method:"PUT"}),s&&s[z]&&(window.UserLeap.email=s[z]),c.ok&&(n&&I("uid",n),a&&I("aid",a)),{success:!!c.ok}},async removeAttributes(e){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig removeAttributes",e),r.mode==="test")return;if(e==null||e.length===0){const a="[Sprig] - Disregarding empty attributes provided";return console.warn(a),{success:!1,message:a}}if(r.requireUserIdForTracking&&!window.UserLeap.userId){const a="[Sprig] - Skipping tracking without userId";return console.warn(a),{success:!1,message:a}}const n=await D(R("1",[C,T],"attributes"),{body:JSON.stringify({delete:e}),method:"DELETE"});return!n.ok&&n.reportError&&(console.warn("[Sprig] (ERR-433) Remove attributes failed",n.error),n.error&&window.UserLeap.reportError("removeAttributes",n.error)),{success:!!n.ok}},async addSurveyListener(e){i.eventEmitter.on(i.SprigEvent.SurveyLifeCycle,e)},async removeSurveyListener(e){i.eventEmitter.removeListener(i.SprigEvent.SurveyLifeCycle,e)},async addListener(e,n){i.eventEmitter.on(e,n)},async removeListener(e,n){i.eventEmitter.removeListener(e,n)},async removeAllListeners(){i.eventEmitter.removeAllListeners()},setPreviewKey(e){e&&typeof e=="string"&&i.localStorageHelper.isStorageAvailable&&e&&i.localStorageHelper.setItem("sprig.previewKey",e)},async setUserId(e){var s;if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setUserId",e),e==null){const l=`[Sprig] - Invalid userId ${e}`;return console.warn(l),{success:!1,message:l}}if(r.mode==="test"||e===window.UserLeap.userId)return;window.UserLeap.userId=e;const n=window.UserLeap.visitorId,a=await D(R("1",[C,T]),{body:JSON.stringify({userId:e}),method:"PUT"});a.ok?(n!==window.UserLeap.visitorId&&((s=i.modules.replay)==null||s.clearUserReplayData()),I("uid",e)):a.reportError&&(console.warn("[Sprig] (ERR-420) Failed to set user id",a.error),a.error&&window.UserLeap.reportError("setUserId",a.error))},async setPartnerAnonymousId(e){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setPartnerAnonymousId",e),e==null){const n=`[Sprig] - Invalid partnerAnonymousId ${e}`;return console.warn(n),{success:!1,message:n}}return window.UserLeap.partnerAnonymousId=e,I("aid",e),{success:!0}},track:async(e,n,a={},s=void 0)=>t({eventName:e,properties:n,metadata:a,showSurveyCallback:s}),identifyAndTrack:async e=>await t(e),trackPageView(e,n=void 0,a=void 0,s=!0){K=e,mt(e,n,a,s)},applyFeedbackStyles({button:e="",view:n=""}){window.UserLeap.feedbackCustomStyles=n,document.getElementById("sprig-feedback-style")&&Y({document,elementId:"ul-custom-style",styleString:e,nonce:window.UserLeap.styleNonce}),o(document.querySelector(".ul-container-feedback"),n)},applyStyles(e){window.UserLeap.customStyles=e,o(window.UserLeap.container,e)},setWindowDimensions(e,n){var y,w;const a=typeof e=="string"?parseInt(e,10):e,s=typeof n=="string"?parseInt(n,10):n;isNaN(a)||isNaN(s)||(window.UserLeap.windowDimensions={width:a,height:s});const l=i.getHttpHeaders(window.UserLeap),c=pe(l),p=l["userleap-platform"]==="web";if(!window.UserLeap.frameId)return;const u=document.getElementById(window.UserLeap.frameId);u&&(window.UserLeap.useMobileStyling&&((y=window.UserLeap.windowDimensions)!=null&&y.width&&(u.style.width=`${window.UserLeap.windowDimensions.width}px`),(w=window.UserLeap.windowDimensions)!=null&&w.height&&(u.style.maxHeight=window.UserLeap.windowDimensions.height-20+"px"),u.contentDocument&&(u.style.height=String(tt(u.contentDocument,p&&!c,i.shouldDirectEmbed(l))[0])+"px")),i.eventEmitter.emit(i.SprigEvent.SurveyDimensions,{name:i.SprigEvent.SurveyDimensions,contentFrameWidth:u.clientWidth,contentFrameHeight:u.clientHeight,"survey.id":parseInt(window.UserLeap.container.dataset.studyId)}))},logoutUser(){var e;window.UserLeap.debugMode&&console.info("[DEBUG] Sprig logout"),i.breadcrumbsLogger.info("LogOut",{vid:window.UserLeap.visitorId,userId:window.UserLeap.userId}),window.UserLeap.visitorId=null,window.UserLeap.userId=null,window.UserLeap.partnerAnonymousId=null,window.UserLeap.token=null,window.UserLeap.email=null,i.localStorageHelper.removeItem("userleap.ids"),window.UserLeap._queue.isPaused()&&window.UserLeap._queue.empty(),gt(),(e=i.modules.replay)==null||e.clearUserReplayData(),window.UserLeap._queue.unpause()},teardown(){["hashchange","popstate"].forEach(e=>window.removeEventListener(e,J,!0)),window.UserLeap._config.interactiveEvents&&ut(),window.UserLeap("dismissActiveSurvey",i.DismissReason.API),delete window.UserLeap,delete window.Sprig,delete window._Sprig},integrateOptimizely(e,n=!0){var a,s;if((s=(a=window.UserLeap)==null?void 0:a._config)!=null&&s.optimizelyEnabled)try{const l=typeof e=="string"?JSON.parse(e):e;te.setOptimizelyExperiment(l,n)}catch(l){console.warn("[Sprig] Error with integrating Optimizely data"),l instanceof Error&&window.UserLeap.reportError("integrateOptimizely",l)}else console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.")},integrateOptimizelyClient(e){var n,a;if(!((a=(n=window.UserLeap)==null?void 0:n._config)!=null&&a.optimizelyEnabled))return void console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");e.notificationCenter.addNotificationListener("ACTIVATE:experiment, user_id,attributes, variation, event",({experiment:s,variation:l})=>{const c={experiments:[{id:s.id,variation:l.key}]};window.UserLeap("integrateOptimizely",c,!1)})},importLaunchDarklyData(e){var n,a;(a=(n=window.UserLeap)==null?void 0:n._config)!=null&&a.launchDarklyEnabled?Le.setLDFlagsVariations(e):console.warn("[SPRIG] LaunchDarkly integration is currently not enabled for your product.")},setVisitorAttribute:(e,n)=>(console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"),d.setAttribute(e,n)),setEmail:async e=>d.setAttribute(z,e),setVisitorEmail:async e=>(console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"),d.setEmail(e)),_generateVideoUploadUrl:async e=>async function(n){var s;if(!n)return;const a=`${window.UserLeap._API_URL}/2/environments/integrations/upload`;try{const l=await fetch(a,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(l.ok){const c=await l.json();return(s=c==null?void 0:c.upload)==null?void 0:s.url}return null}catch(l){console.warn("[Sprig] Error with generating video upload url"),l instanceof Error&&window.UserLeap.reportError("generateVideoUploadUrl",l)}}(e),_reportMetric(e,n){i.reportAndRegister(e,n)},_completeSessionReplay:async({surveyId:e,responseGroupUuid:n,eventDigest:a})=>{var s;return i.modules.replay?(s=i.modules.replay)==null?void 0:s._completeSessionReplay({surveyId:e,responseGroupUuid:n,eventDigest:a,headers:i.getHttpHeaders(window.UserLeap)}):(window.UserLeap.reportError("_completeSessionReplay",new Error("Replay module not registered")),!1)},pauseReplayRecording(){var e,n,a,s;(n=(e=i.modules.replay)==null?void 0:e.isReplayPaused)!=null&&n.call(e)||((s=(a=i.modules.replay)==null?void 0:a.recordReplayPaused)==null||s.call(a))},resumeReplayRecording(){var e,n,a,s,l,c;(n=(e=i.modules.replay)==null?void 0:e.isReplayPaused)!=null&&n.call(e)&&((s=(a=i.modules.replay)==null?void 0:a.recordReplayResumed)==null||s.call(a),(c=(l=i.modules.replay)==null?void 0:l.recordFullSnapshot)==null||c.call(l))}};Object.assign(window.UserLeap,d)};async function qt(r,t,o={},d={}){const e=window.__cfg&&window.__cfg.mode,n=ke(),a=window.UserLeap.envId,s=window.document.documentElement,l={mode:e,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:s.clientWidth,clientHeight:s.clientHeight,location:K??window.location.href,language:window.navigator.language,...o},c={action:r,breadcrumbs:i.breadcrumbsLogger.breadcrumbs,err:{message:`${t==null?void 0:t.name} - ${t==null?void 0:t.message}`,stack:t==null?void 0:t.stack},meta:l,vid:n,envId:a,...d};(await D(R("1",null,"errors"),{method:"POST",headers:{"x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(c),shouldDropOnRateLimit:!0})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",t)}function Ft(r={}){var d;(d=window.SprigLoggerCallback)==null||d.call(window,"Initializing Sprig");const t=new URLSearchParams(window.location.search).get("sprigPreviewKey")??"";async function o(){var u,y,w,g,v;if(window.UserLeap.loaded)return;if((u=window.SprigLoggerCallback)==null||u.call(window,"Loading Sprig"),window.UserLeap.reportError=qt,window.UserLeap.loaded=!0,window.UserLeap._config=Object.assign({},r,window.UserLeap.config),window.UserLeap.delayingSurvey=!1,window.UserLeap._config&&typeof window.UserLeap._config=="object")for(const m in window.UserLeap._config)window.UserLeap[m]=window.UserLeap._config[m];if(window.Sprig.outstandingTransactionLimit!==void 0&&(r.outstandingTransactionLimit=window.Sprig.outstandingTransactionLimit),!window.UserLeap.envId){if(!window.UserLeap.appId)throw new Error("Missing Environment id");window.UserLeap.envId=window.UserLeap.appId}window.UserLeap.debugMode&&console.info("[DEBUG] Sprig debug mode enabled");const e=wt(),n=window.UserLeap.sampleRate;let a=e.sampled;if(n){if(a===null&&(a=Math.random()<n,I("sampled",a)),!a)return}else a!==null&&I("sampled",null);window.UserLeap._API_URL||(window.UserLeap._API_URL="https://api.sprig.com");const s=[...window.UserLeap._queue];window.UserLeap._queue=new Rt(window.UserLeap,[]),window.UserLeap._queue.pause();for(let m=0;m<s.length;m++)window.UserLeap._queue.push(s[m]);const l=e.token;l?(window.UserLeap.token=l,window.UserLeap.visitorId=e.vid??null,window.UserLeap.userId=e.uid??null,window.UserLeap.partnerAnonymousId=e.aid??null):gt();const c=Q(i.getHttpHeaders(window.UserLeap));(y=window.SprigLoggerCallback)==null||y.call(window,"Sprig fetching config");const p=await async function(m){var E,P;const f=i.getHttpHeaders(window.UserLeap);document.addEventListener("securitypolicyviolation",i.cspViolationHandler);const U=await i.sprigFetch(R("1",[C],"config"),{headers:f});if(document.removeEventListener("securitypolicyviolation",i.cspViolationHandler),!U.ok)return(E=window.SprigLoggerCallback)==null||E.call(window,"Sprig config fetch failed"),U.reportError&&(console.warn("[Sprig] (ERR-422) Failed to load configuration",U.error),U.error&&window.UserLeap.reportError("applyRemoteConfig",U.error)),i.killNetworkRequests("Disabled: failed to fetch configuration"),m;const b=U.json;return b!=null&&b.disabled?((P=window.SprigLoggerCallback)==null||P.call(window,"Sprig config fetch disabled"),i.killNetworkRequests(`Disabled: ${b.disabled}`),{disabled:b.disabled}):Object.assign({},b,m)}(r);if((w=window.SprigLoggerCallback)==null||w.call(window,"Sprig fetched config"),Ot({isWeb:!c,reportingIntervalSeconds:p.metricsReportingEnabled||p.mobileMetricsReportingEnabled?p.metricsReportingIntervalSeconds:0,thresholds:p.metricThresholds,postMetrics:async m=>{var f;await D(R("1",[C],"metrics"),{body:m,method:"POST",headers:{"x-ul-replay-enabled":`${!!((f=i.modules.replay)!=null&&f.isReplayRecording())}`},shouldDropOnRateLimit:!0})}}),!c){const m=p.alwaysOnReplay?{userAgent:window.navigator.userAgent,surveyId:p.alwaysOnReplay.surveyId,responseGroupUuid:p.alwaysOnReplay.responseGroupUuid,sdkVersion:"2.40.2",maxDurationSeconds:p.alwaysOnReplay.maxDurationSeconds}:void 0;await((g=i.modules.replay)==null?void 0:g.initializeReplay({maxReplayDurationSeconds:p.maxReplayDurationSeconds,maxInflightRequests:window.UserLeap.maxInflightReplayRequests??2,replaySettings:p.replaySettings,apiUrl:window.UserLeap._API_URL,alwaysOnConfig:m})),De=p.replaySettings}jt(p),await Mt(p),window.UserLeap._queue.unpause(),(v=window.SprigLoggerCallback)==null||v.call(window,"SdkReady"),i.eventEmitter.emit(i.SprigEvent.SDKReady,{mobileMetricsReportingEnabled:!!p.mobileMetricsReportingEnabled,metricsReportingInterval:p.metricsReportingIntervalSeconds||0,metricsThresholds:p.metricThresholds||[],maxMobileReplayDurationSeconds:p.maxMobileReplayDurationSeconds,mobileReplaySettings:p.mobileReplaySettings}),i.eventEmitter.emit(i.SprigEvent.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId}),i.eventEmitter.on(i.SprigEvent.VisitorIDUpdated,()=>{for(const m in de)delete de[m]})}window.UserLeap.UPDATES=i.EVENTS,window.UserLeap("setPreviewKey",t),document.readyState==="complete"?o():window.attachEvent?window.attachEvent("onload",o):window.addEventListener("load",()=>{o()},!1)}class le{constructor(){q(this,"UPDATES",i.EVENTS)}displaySurvey(t){window.Sprig("displaySurvey",t)}mute(){window.Sprig("mute")}unmute(){window.Sprig("unmute")}dismissActiveSurvey(){window.Sprig("dismissActiveSurvey")}setAttribute(t,o){window.Sprig("setAttribute",t,o)}setAttributes(t){window.Sprig("setAttributes",t)}identifyAndSetAttributes(t){window.Sprig("identifyAndSetAttributes",t)}removeAttributes(t){window.Sprig("removeAttributes",t)}addListener(t,o){window.Sprig("addListener",t,o)}removeListener(t,o){window.Sprig("removeListener",t,o)}removeAllListeners(){window.Sprig("removeAllListeners")}setEmail(t){window.Sprig("setAttribute","!email",t)}setUserId(t){window.Sprig("setUserId",t)}setPartnerAnonymousId(t){window.Sprig("setPartnerAnonymousId",t)}track(t,o={},d={}){window.Sprig("track",t,o,d)}identifyAndTrack(t){window.Sprig("identifyAndTrack",t)}trackPageView(t,o,d){window.Sprig("trackPageView",t,o,d)}applyStyles(t){window.Sprig("applyStyles",t)}setWindowDimensions(t,o){window.Sprig("setWindowDimensions",t,o)}logoutUser(){window.Sprig("logoutUser")}teardown(){window.Sprig("teardown")}pauseReplayRecording(){window.Sprig("pauseReplayRecording")}resumeReplayRecording(){window.Sprig("resumeReplayRecording")}}const Ie={configure:r=>{if(!r.envId&&!r.environmentId)throw new Error("Initialization Error: Sprig configure requires an environmentId");if(r.envId||(r.envId=r.environmentId??""),r.installationMethod="web-npm",window.Sprig)return window.Sprig;window.Sprig=function(){window.Sprig._queue.push(arguments)},Object.getOwnPropertyNames(le.prototype).map(o=>{o!=="constructor"&&(window.Sprig[o]=le.prototype[o])});const t=window.Sprig;return t.appId=r.envId,t._queue=[],window.UserLeap=t,Ft(r),window.Sprig}},Vt={sprig:Ie,SprigAPI:le,configure:Ie.configure};exports.APP_ID="ul-app",exports.ConflictingWidgets=Qe,exports.DEFAULT_BORDER_COLOR="#e6e6e6",exports.DEFAULT_WIDTH_PX=360,exports.EMBED_MOBILE_MAX_WIDTH=1030,exports.ERROR_BORDER_COLOR="#bd282a",exports.SprigAPI=le,exports.calculateFrameDimensions=tt,exports.core=Vt,exports.getHtml=ce,exports.isHTMLElement=A,exports.resetScrollPosition=r=>{const t=r.querySelector(".ul-card__container");t&&(t.scrollTop=0)},exports.setSurveyStyles=Y,exports.sprig=Ie;
|
|
12
|
+
</svg>`,(o=window.UserLeap._config)==null?void 0:o.enableCspTrustedTypes);const t=document.createElement("h3");return t.className="sprig-feedback-error-text",t.innerText="There was an error while loading the survey",r.appendChild(t),r},Le=new class{constructor(){q(this,"_ldData",{})}getAllLaunchDarklyVariations(){return this._ldData}setLDFlagsVariations(r){try{return!(!r||typeof r!="object"||Array.isArray(r))&&(Object.keys(this._ldData).forEach(t=>{delete this._ldData[t]}),Object.keys(r).forEach(t=>this._ldData[`!launch_darkly_${t}`]=(r[t]??0)+1),!0)}catch(t){return t instanceof Error&&window.UserLeap.reportError("setAllLDFlagsVariations",t),console.warn("[Sprig] An issue had occured when setting LaunchDarkly flags and variations."),!1}}};Object.freeze(Le);const te=new class{constructor(){q(this,"_optimizelyData",{})}setOptimizelyExperiment(r,t=!0){if(!r||typeof r!="object")return!1;const{experiments:o}=r;try{return t&&Object.keys(this._optimizelyData).map(d=>{delete this._optimizelyData[d]}),o&&o.map(d=>{const{id:e,variation:n}=d,a=this.transformExperimentId(e);n&&typeof n=="string"&&(this._optimizelyData[a]=n)}),!0}catch(d){return d instanceof Error&&window.UserLeap.reportError("setOptimizelyExperiment",d),!1}}getAllOptimizelyExperiments(){return this._optimizelyData}getOptimizelyVariationName(r){return this._optimizelyData[this.transformExperimentId(r)]}transformExperimentId(r){return"!optimizely_experiments_"+r}getAndSetWebOptimizelyExperiments(){var r;try{if(window&&window.optimizely&&typeof window.optimizely.get=="function"){const t=(r=window.optimizely.get("state"))==null?void 0:r.getExperimentStates({isActive:!0});if(t){const o=Object.keys(t).map(d=>{var e,n;return(e=t[d].variation)!=null&&e.name?{id:d,variation:(n=t[d].variation)==null?void 0:n.name}:{id:d,variation:"Original"}});return this.setOptimizelyExperiment({experiments:o},!1),!0}return!1}return!1}catch(t){return t instanceof Error&&window.UserLeap.reportError("getAndSetWebOptimizely",t),!1}}};Object.freeze(te);class Rt{constructor(t,o){q(this,"paused");q(this,"queue");q(this,"ul");this.ul=t,this.paused=!1,this.queue=[],this.flush(o)}flush(t){const o=t.length;if(o)for(let d=0;d<o;d++)this.push(t[d])}isPaused(){return this.paused}pause(){this.paused=!0}unpause(){this.paused=!1;const t=this.queue.slice();this.empty(),this.flush(t)}push(t){if(this.paused)this.queue.push(t);else if(t instanceof Function)t();else{const o=Array.prototype.slice.call(t,1),d=t[0],e=this.ul[d];e instanceof Function?e.apply(this.ul,o):d&&console.warn("[Sprig] (ERR-100) No valid UserLeap action called",d)}}perform(t){if(this.paused){let o=()=>{};const d=new Promise(function(e){o=function(){e(t())}});return this.queue.push(o),d}return t()}empty(){this.queue.length=0}}let at,dt;const Ue=r=>{let t=0,o=r.firstElementChild;for(;o;)t+=Ue(o),o.shadowRoot&&(t+=Ue(o.shadowRoot)),o=o.nextElementSibling,t++;return t},Ge=()=>{at.report(Ue(document.body)),dt.report(document.documentElement.innerHTML.toString().length)},Ee=(r,t)=>{const o=performance.now();document.hidden?setTimeout(()=>Ee(r,t),r):setTimeout(()=>{const d=performance.now()-o;t.report(d/1e3),setTimeout(()=>Ee(r,t),r)},0)};let ne,oe,se,ae,Ke,V={};const ee=(r,t=1)=>{const{name:o}=r;V[o]=(V[o]||0)+t},lt=r=>{let t=1;return r.childNodes.forEach(o=>{t+=lt(o)}),t},Je=r=>{let t=0;return r.forEach(o=>{t+=lt(o)}),t},_t=r=>{switch(r.type){case"childList":return ee(ne,Je(r.addedNodes)),void ee(oe,Je(r.removedNodes));case"attributes":return void ee(se);case"characterData":return void ee(ae)}},Dt=r=>r.forEach(_t),xt=()=>{ne.report(V[ne.name]||0),oe.report(V[oe.name]||0),se.report(V[se.name]||0),ae.report(V[ae.name]||0),V={}},At=(r=1e3)=>{ne=i.registerMetric("sdk_mutations_nodes_added"),oe=i.registerMetric("sdk_mutations_nodes_removed"),se=i.registerMetric("sdk_mutations_attributes_changed"),ae=i.registerMetric("sdk_mutations_character_data"),Ke=new MutationObserver(Dt),Ke.observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),setInterval(xt,r)},Ot=({isWeb:r,reportingIntervalSeconds:t,thresholds:o,postMetrics:d})=>{i.registerThresholds(o,(e,n)=>{var a,s;if((a=i.modules.replay)!=null&&a.isReplayRecording()){const l=`Value: ${e} on ${n.metric} violated threshold of ${n.type} ${n.value}`;(s=i.modules.replay)==null||s.disableRecording("Threshold violated",new Error(l),{reportError:!1}),window.UserLeap.reportError("Sdk Performance Metric threshold violated",new Error("Sdk Performance Metric threshold violated"),{metricName:n.metric,type:n.type,value:n.value},{metricName:n.metric}),i.disableThresholdChecking()}}),i.initPerformanceReporting({reportingIntervalSeconds:t,postMetrics:d}),r&&(((e=1e3)=>{const n=i.registerMetric("sdk_event_queue_latency_seconds");Ee(e,n)})(),((e=1e4)=>{at=i.registerMetric("sdk_dom_nodes_count"),dt=i.registerMetric("sdk_page_html_characters"),Ge(),setInterval(Ge,e)})(),At())},Tt="test",Ct=["popState","pushState","replaceState"];let De,K;const de={},z="!email",pt="pageUrl";let fe=window.location.href;function J(r){var s,l;const{pageUrlEvents:t,interactiveEvents:o,dismissOnPageChange:d,platform:e}=window.UserLeap._config;if(e&&e!=="web")return;fe!==window.location.href&&i.breadcrumbsLogger.navigation("LocationChange",{from:fe,to:window.location.href}),fe=window.location.href;const n=wt().trackStartUrl,a=n?String(n):null;t&&mt(window.location.href),o&&(ut(),Pt()),rt()&&(()=>{if(re())return;const c=B();c&&(i.checkUrlStillMatching(G)||(c.remove(),G=null,S=null))})(),i.sessionStorageHelper.getItem("sprig.isCapturingHeatmap")&&((l=(s=i.modules.replay)==null?void 0:s.checkPendingHeatmapsUrl())==null||l.then(c=>{var p;c&&((p=i.modules.replay)==null||p.uploadReadyPendingCaptures(!0))})),!re()&&d&&a&&a!==window.location.href&&r&&Ct.includes(r.type)&&window.UserLeap("dismissActiveSurvey",i.DismissReason.PageChange)}const ct={capture:!0},Pt=()=>{const r=window.UserLeap._config.interactiveEvents.filter(o=>i.checkUrlMatch(o,window.location.href)).map(o=>{const{name:d,properties:e}=o,{selector:n,innerText:a}=e;return n?s=>{if(Be(s.target))try{s.target.closest(n)&&window.UserLeap("track",d)}catch{}return!1}:s=>(Be(s.target)&&s.target.innerText===a&&window.UserLeap("track",d),!1)}),t=o=>r.forEach(d=>d(o));window.UserLeap._config.interactiveEventsHandler=t,window.addEventListener("click",t,ct)},ut=()=>{window.UserLeap._config.interactiveEventsHandler&&window.removeEventListener("click",window.UserLeap._config.interactiveEventsHandler,ct),delete window.UserLeap._config.interactiveEventsHandler};function wt(){const r=i.localStorageHelper.getItemObject("userleap.ids");return r&&r[window.UserLeap.envId]||{}}function gt(){if(window.previewMode)return;const r=i.localStorageHelper.getItemObject("sprig.anon.env.vid.map")||{},t=r[window.UserLeap.envId];window.UserLeap.visitorId=t||i.v4(),i.breadcrumbsLogger.info("NewVid",{vid:window.UserLeap.visitorId}),I("vid",window.UserLeap.visitorId),t||(r[window.UserLeap.envId]=window.UserLeap.visitorId,i.localStorageHelper.setItemObject("sprig.anon.env.vid.map",r)),i.eventEmitter.emit(i.SprigEvent.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId})}function mt(r,t,o,d){var e,n;try{if(r.endsWith("mock_snippet.html"))return;i.breadcrumbsLogger.info("PageView",{url:r});const a=(e=document==null?void 0:document.querySelector('meta[name="description"]'))==null?void 0:e.getAttribute("content");(n=i.modules.replay)==null||n.RecordPageView({...a&&{description:a},url:r,referrer:document.referrer,pageTitle:document.title});const s=window.UserLeap._config.pageUrlEvents;let l=!1;if(s&&s.length)for(let p=0;p<s.length&&(l=i.checkUrlMatch(s[p],r),!l);p++);if(!l)return;window.UserLeap.debugMode&&console.info("[DEBUG] Sprig trackPageView",r);const c={url:r};d&&(c.trackPageView=!0),window.UserLeap._queue.push(["track",pt,t,c,o])}catch(a){a instanceof Error&&(a.stack=r,window.UserLeap.reportError("trackPageView",a)),console.warn("[Sprig] (ERR-428) Failed to track page view",a)}}function Ht(){const r="Backbone"in window&&window.Backbone&&window.Backbone.history?window.Backbone.history:window.history;"pushState"in r&&(r.pushState=(t=>function(...o){const d=t.apply(this,o),e=new Event("pushState");return window.dispatchEvent(e),J(e),d})(r.pushState)),"replaceState"in r&&(r.replaceState=(t=>function(...o){const d=t.apply(this,o),e=new Event("replaceState");return window.dispatchEvent(e),J(e),d})(r.replaceState)),["hashchange","popstate"].forEach(t=>window.addEventListener(t,J,!0))}async function he(r,t){const o=ke();r&&!t&&(window.UserLeap._config.mode=Tt);const d=pe(i.getHttpHeaders(window.UserLeap)),e=await D(function(n){const a=new URL(R("1",[C],"questions"));return Object.entries(n||{}).forEach(([s,l])=>{l&&a.searchParams.append(s,String(l))}),a.toString()}({desktopDisplay:window.UserLeap._config.desktopDisplay,isMobile:d,previewLanguage:window.UserLeap._config.previewLanguage,surveyid:r==null?void 0:r.surveyId,surveytemplateid:r==null?void 0:r.surveyTemplateId,vid:o}),{shouldDropOnRateLimit:!0});if(!e.ok)return e.reportError&&e.error&&(console.warn("[Sprig] (ERR-414) Failed to request questions from the server",e.error),window.UserLeap.reportError("getQuestions",e.error)),{success:!1,surveyState:"no survey"};if(e.json.delay&&await i.delay(e.json.delay),!e.json.isFeedback)return $(e.json,K,De);{const{feedbackLabel:n,productConfig:a,surveyUuid:s,feedbackCustomStyles:l}=e.json,{buttonTheme:c,placement:p,desktopDisplay:u}=a;st({customStyles:l,buttonTheme:c,desktopDisplay:u,eventId:0,feedbackLabel:n,placement:p,surveyUuid:s,surveyId:r==null?void 0:r.surveyId},e.json)}}function Mt(r){if(!r)return;window.UserLeap._config=r,r.mute&&window.UserLeap._queue.pause();const{interactiveEvents:t,pageUrlEvents:o,dismissOnPageChange:d}=r;t&&function(e){let n=e.length;for(;n;){const a=Math.floor(Math.random()*n);n-=1;const s=e[n];e[n]=e[a],e[a]=s}}(t),(t||o||d)&&(Ht(),J())}const jt=function(r){if(!window.UserLeap)return;const t=async(e={})=>{var f,U,b,E,P;const{userId:n,anonymousId:a,metadata:s={},properties:l,showSurveyCallback:c}=e;let{eventName:p}=e;if(window.UserLeap.debugMode&&p!==pt&&console.info("[DEBUG] Sprig track",e),r.mode==="test")return;const u=i.localStorageHelper.getItem("sprig.previewKey")??void 0;if(r.requireUserIdForTracking&&!window.UserLeap.userId&&!n){const h="[Sprig] - Skipping tracking without userId";return console.warn(h),{success:!1,message:h,surveyState:"no survey"}}if(!p||p.trim().length===0){p=p?String(p):"";const h="[Sprig] - Invalid event name "+p;return console.warn(h),{success:!1,message:h,surveyState:"no survey"}}const y=K??window.location.href;s.url||(s.url=y),I("trackStartUrl",y),(U=(f=window.UserLeap)==null?void 0:f._config)!=null&&U.optimizelyEnabled&&(Q(i.getHttpHeaders(window.UserLeap))||te.getAndSetWebOptimizelyExperiments(),s.optimizelyExperiments=Object.assign({},te.getAllOptimizelyExperiments())),(E=(b=window.UserLeap)==null?void 0:b._config)!=null&&E.launchDarklyEnabled&&(s.launchDarklyFlags=Le.getAllLaunchDarklyVariations()),n&&(window.UserLeap.userId=n),a&&(window.UserLeap.partnerAnonymousId=a),l&&(s.eventProperties=l),(P=i.modules.replay)==null||P.RecordEvent({name:p,url:s.url}),i.breadcrumbsLogger.info("TrackEvent",{eventName:p});const w=window.UserLeap.delayingSurvey||it()?await D(R("1",[T],"events/batch"),{body:JSON.stringify({events:[{event:p,metadata:s}],previewKey:u}),method:"POST",shouldDropOnRateLimit:!0}):await D(R("1",[T],"events"),{body:JSON.stringify({event:p,metadata:s,previewKey:u}),method:"POST",shouldDropOnRateLimit:!0});if(!w.ok){const h="[Sprig] (ERR-421) Failed to track event";return w.reportError&&(console.warn(h,w.error),w.error&&window.UserLeap.reportError("track",w.error)),{success:!1,message:h,error:w.error,surveyState:"no survey"}}n&&I("uid",n),a&&I("aid",a);const g=w.json;g.invalidPreviewKey&&i.localStorageHelper.removeItem("sprig.previewKey");const v=s.trackPageView?s.url:void 0;return g!=null&&g.feedbackButton&&st(g.feedbackButton,void 0,v),await async function(h,H){var M,O;let _=!0;return!(H&&((M=h==null?void 0:h.json)!=null&&M.surveyId)&&(window.UserLeap.delayingSurvey=!0,_=await H(h.json.surveyId),window.UserLeap.delayingSurvey=!1,!_))&&((O=h==null?void 0:h.json)!=null&&O.delay&&!window.UserLeap.isMobileSDK&&(window.UserLeap.delayingSurvey=!0,await i.delay(h.json.delay),window.UserLeap.delayingSurvey=!1),_)}(w,c)?function(h){if(!window.UserLeap._config.dismissOnPageChange)return!0;const H=new URL(h),_=new URL(K??window.location.href);return H.hostname===_.hostname&&H.pathname===_.pathname}(y)?$(g,v,De):{success:!1,message:"Study should not be displayed after page navigation",surveyState:"no survey"}:{success:!1,message:"[Sprig] Callback returned false, aborting rendering of survey",surveyState:"no survey"}},o=(e,n)=>{var s;const a=(s=e==null?void 0:e.querySelector(`[id="${Re}"]`))==null?void 0:s.contentDocument;a&&Y({document:a,elementId:"ul-custom-style",styleString:n})},d={displaySurvey:async e=>(console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."),window.UserLeap("dismissActiveSurvey",i.DismissReason.Override),he({surveyId:e},!0)),_previewSurvey(e){window.UserLeap("dismissActiveSurvey",i.DismissReason.Override),he({surveyTemplateId:e},!1)},_reviewSurvey(e){window.UserLeap("dismissActiveSurvey",i.DismissReason.Override),he({surveyId:e},!1)},previewSurvey(e){d._previewSurvey(e)},reviewSurvey(e){d._reviewSurvey(e)},mute(){window.UserLeap._queue.pause()},unmute(){window.UserLeap._queue.unpause()},setVisitorToken(){console.warn("[Sprig] setVisitorToken is deprecated.")},dismissActiveSurvey(e=i.DismissReason.API){window.UserLeap.container&&(e===i.DismissReason.Closed&&window.Sprig.trackHistory&&window.Sprig.trackHistory({event:"closed"}),i.eventEmitter.emit(i.SprigEvent.SurveyCloseRequested,{name:i.SprigEvent.SurveyCloseRequested,initiator:e,"survey.id":parseInt(window.UserLeap.container.dataset.studyId)}),i.eventEmitter.emit(i.SprigEvent.SurveyWillClose,{name:i.SprigEvent.SurveyWillClose,initiator:e,"survey.id":parseInt(window.UserLeap.container.dataset.studyId)}))},async setAttribute(e,n){if(!e||!n&&n!==0&&n!==!1){const a="[Sprig] - Disregarding empty attribute / value provided";return console.warn(a),{success:!1,message:a}}return this.setAttributes({[e]:n})},async setAttributes(e){if(e==null||Object.keys(e).length===0){const n="[Sprig] - Disregarding empty attributes provided";return console.warn(n),{success:!1,message:n}}return this.identifyAndSetAttributes({attributes:e})},async identifyAndSetAttributes(e){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig identifyAndSetAttributes",e),r.mode==="test")return;if(e===null||typeof e!="object"||!(e.userId||e.anonymousId||e.attributes)){const p="[Sprig] - Disregarding empty payload provided";return console.warn(p),{success:!1,message:p}}const{userId:n,anonymousId:a,attributes:s}=e;if(r.requireUserIdForTracking&&!window.UserLeap.userId&&!n){const p="[Sprig] - Skipping tracking without userId";return console.warn(p),{success:!1,message:p}}if(s){s.email&&!s[z]&&(s[z]=s.email,delete s.email);const p=Object.keys(s);for(const u of p)s[u]===de[u]&&delete s[u]}if(!(s&&Object.keys(s).length!==0||n&&window.UserLeap.userId!==n||a&&window.UserLeap.partnerAnonymousId!==a))return{success:!0};const l={};let c;return n&&(l.userId=window.UserLeap.userId=n),a&&(l.partnerAnonymousId=window.UserLeap.partnerAnonymousId=a),s&&Object.keys(s).length>0?(c=await D(R("1",[C,T],"attributes"),{body:JSON.stringify(s),method:"PUT"}),c.ok?Object.assign(de,s):c.reportError&&(console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed",c.error),c.error&&window.UserLeap.reportError("identifyAndSetAttributes",c.error))):c=await D(R("1",[C,T]),{body:JSON.stringify(l),method:"PUT"}),s&&s[z]&&(window.UserLeap.email=s[z]),c.ok&&(n&&I("uid",n),a&&I("aid",a)),{success:!!c.ok}},async removeAttributes(e){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig removeAttributes",e),r.mode==="test")return;if(e==null||e.length===0){const a="[Sprig] - Disregarding empty attributes provided";return console.warn(a),{success:!1,message:a}}if(r.requireUserIdForTracking&&!window.UserLeap.userId){const a="[Sprig] - Skipping tracking without userId";return console.warn(a),{success:!1,message:a}}const n=await D(R("1",[C,T],"attributes"),{body:JSON.stringify({delete:e}),method:"DELETE"});return!n.ok&&n.reportError&&(console.warn("[Sprig] (ERR-433) Remove attributes failed",n.error),n.error&&window.UserLeap.reportError("removeAttributes",n.error)),{success:!!n.ok}},async addSurveyListener(e){i.eventEmitter.on(i.SprigEvent.SurveyLifeCycle,e)},async removeSurveyListener(e){i.eventEmitter.removeListener(i.SprigEvent.SurveyLifeCycle,e)},async addListener(e,n){i.eventEmitter.on(e,n)},async removeListener(e,n){i.eventEmitter.removeListener(e,n)},async removeAllListeners(){i.eventEmitter.removeAllListeners()},setPreviewKey(e){e&&typeof e=="string"&&i.localStorageHelper.isStorageAvailable&&e&&i.localStorageHelper.setItem("sprig.previewKey",e)},async setUserId(e){var s;if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setUserId",e),e==null){const l=`[Sprig] - Invalid userId ${e}`;return console.warn(l),{success:!1,message:l}}if(r.mode==="test"||e===window.UserLeap.userId)return;window.UserLeap.userId=e;const n=window.UserLeap.visitorId,a=await D(R("1",[C,T]),{body:JSON.stringify({userId:e}),method:"PUT"});a.ok?(n!==window.UserLeap.visitorId&&((s=i.modules.replay)==null||s.clearUserReplayData()),I("uid",e)):a.reportError&&(console.warn("[Sprig] (ERR-420) Failed to set user id",a.error),a.error&&window.UserLeap.reportError("setUserId",a.error))},async setPartnerAnonymousId(e){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setPartnerAnonymousId",e),e==null){const n=`[Sprig] - Invalid partnerAnonymousId ${e}`;return console.warn(n),{success:!1,message:n}}return window.UserLeap.partnerAnonymousId=e,I("aid",e),{success:!0}},track:async(e,n,a={},s=void 0)=>t({eventName:e,properties:n,metadata:a,showSurveyCallback:s}),identifyAndTrack:async e=>await t(e),trackPageView(e,n=void 0,a=void 0,s=!0){K=e,mt(e,n,a,s)},applyFeedbackStyles({button:e="",view:n=""}){window.UserLeap.feedbackCustomStyles=n,document.getElementById("sprig-feedback-style")&&Y({document,elementId:"ul-custom-style",styleString:e,nonce:window.UserLeap.styleNonce}),o(document.querySelector(".ul-container-feedback"),n)},applyStyles(e){window.UserLeap.customStyles=e,o(window.UserLeap.container,e)},setWindowDimensions(e,n){var y,w;const a=typeof e=="string"?parseInt(e,10):e,s=typeof n=="string"?parseInt(n,10):n;isNaN(a)||isNaN(s)||(window.UserLeap.windowDimensions={width:a,height:s});const l=i.getHttpHeaders(window.UserLeap),c=pe(l),p=l["userleap-platform"]==="web";if(!window.UserLeap.frameId)return;const u=document.getElementById(window.UserLeap.frameId);u&&(window.UserLeap.useMobileStyling&&((y=window.UserLeap.windowDimensions)!=null&&y.width&&(u.style.width=`${window.UserLeap.windowDimensions.width}px`),(w=window.UserLeap.windowDimensions)!=null&&w.height&&(u.style.maxHeight=window.UserLeap.windowDimensions.height-20+"px"),u.contentDocument&&(u.style.height=String(tt(u.contentDocument,p&&!c,i.shouldDirectEmbed(l))[0])+"px")),i.eventEmitter.emit(i.SprigEvent.SurveyDimensions,{name:i.SprigEvent.SurveyDimensions,contentFrameWidth:u.clientWidth,contentFrameHeight:u.clientHeight,"survey.id":parseInt(window.UserLeap.container.dataset.studyId)}))},logoutUser(){var e;window.UserLeap.debugMode&&console.info("[DEBUG] Sprig logout"),i.breadcrumbsLogger.info("LogOut",{vid:window.UserLeap.visitorId,userId:window.UserLeap.userId}),window.UserLeap.visitorId=null,window.UserLeap.userId=null,window.UserLeap.partnerAnonymousId=null,window.UserLeap.token=null,window.UserLeap.email=null,i.localStorageHelper.removeItem("userleap.ids"),window.UserLeap._queue.isPaused()&&window.UserLeap._queue.empty(),gt(),(e=i.modules.replay)==null||e.clearUserReplayData(),window.UserLeap._queue.unpause()},teardown(){["hashchange","popstate"].forEach(e=>window.removeEventListener(e,J,!0)),window.UserLeap._config.interactiveEvents&&ut(),window.UserLeap("dismissActiveSurvey",i.DismissReason.API),delete window.UserLeap,delete window.Sprig,delete window._Sprig},integrateOptimizely(e,n=!0){var a,s;if((s=(a=window.UserLeap)==null?void 0:a._config)!=null&&s.optimizelyEnabled)try{const l=typeof e=="string"?JSON.parse(e):e;te.setOptimizelyExperiment(l,n)}catch(l){console.warn("[Sprig] Error with integrating Optimizely data"),l instanceof Error&&window.UserLeap.reportError("integrateOptimizely",l)}else console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.")},integrateOptimizelyClient(e){var n,a;if(!((a=(n=window.UserLeap)==null?void 0:n._config)!=null&&a.optimizelyEnabled))return void console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");e.notificationCenter.addNotificationListener("ACTIVATE:experiment, user_id,attributes, variation, event",({experiment:s,variation:l})=>{const c={experiments:[{id:s.id,variation:l.key}]};window.UserLeap("integrateOptimizely",c,!1)})},importLaunchDarklyData(e){var n,a;(a=(n=window.UserLeap)==null?void 0:n._config)!=null&&a.launchDarklyEnabled?Le.setLDFlagsVariations(e):console.warn("[SPRIG] LaunchDarkly integration is currently not enabled for your product.")},setVisitorAttribute:(e,n)=>(console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"),d.setAttribute(e,n)),setEmail:async e=>d.setAttribute(z,e),setVisitorEmail:async e=>(console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"),d.setEmail(e)),_generateVideoUploadUrl:async e=>async function(n){var s;if(!n)return;const a=`${window.UserLeap._API_URL}/2/environments/integrations/upload`;try{const l=await fetch(a,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(l.ok){const c=await l.json();return(s=c==null?void 0:c.upload)==null?void 0:s.url}return null}catch(l){console.warn("[Sprig] Error with generating video upload url"),l instanceof Error&&window.UserLeap.reportError("generateVideoUploadUrl",l)}}(e),_reportMetric(e,n){i.reportAndRegister(e,n)},_completeSessionReplay:async({surveyId:e,responseGroupUuid:n,eventDigest:a})=>{var s;return i.modules.replay?(s=i.modules.replay)==null?void 0:s._completeSessionReplay({surveyId:e,responseGroupUuid:n,eventDigest:a,headers:i.getHttpHeaders(window.UserLeap)}):(window.UserLeap.reportError("_completeSessionReplay",new Error("Replay module not registered")),!1)},pauseReplayRecording(){var e,n,a,s;(n=(e=i.modules.replay)==null?void 0:e.isReplayPaused)!=null&&n.call(e)||((s=(a=i.modules.replay)==null?void 0:a.recordReplayPaused)==null||s.call(a))},resumeReplayRecording(){var e,n,a,s,l,c;(n=(e=i.modules.replay)==null?void 0:e.isReplayPaused)!=null&&n.call(e)&&((s=(a=i.modules.replay)==null?void 0:a.recordReplayResumed)==null||s.call(a),(c=(l=i.modules.replay)==null?void 0:l.recordFullSnapshot)==null||c.call(l))}};Object.assign(window.UserLeap,d)};async function qt(r,t,o={},d={}){const e=window.__cfg&&window.__cfg.mode,n=ke(),a=window.UserLeap.envId,s=window.document.documentElement,l={mode:e,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:s.clientWidth,clientHeight:s.clientHeight,location:K??window.location.href,language:window.navigator.language,...o},c={action:r,breadcrumbs:i.breadcrumbsLogger.breadcrumbs,err:{message:`${t==null?void 0:t.name} - ${t==null?void 0:t.message}`,stack:t==null?void 0:t.stack},meta:l,vid:n,envId:a,...d};(await D(R("1",null,"errors"),{method:"POST",headers:{"x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(c),shouldDropOnRateLimit:!0})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",t)}function Ft(r={}){var d;(d=window.SprigLoggerCallback)==null||d.call(window,"Initializing Sprig");const t=new URLSearchParams(window.location.search).get("sprigPreviewKey")??"";async function o(){var u,y,w,g,v;if(window.UserLeap.loaded)return;if((u=window.SprigLoggerCallback)==null||u.call(window,"Loading Sprig"),window.UserLeap.reportError=qt,window.UserLeap.loaded=!0,window.UserLeap._config=Object.assign({},r,window.UserLeap.config),window.UserLeap.delayingSurvey=!1,window.UserLeap._config&&typeof window.UserLeap._config=="object")for(const m in window.UserLeap._config)window.UserLeap[m]=window.UserLeap._config[m];if(window.Sprig.outstandingTransactionLimit!==void 0&&(r.outstandingTransactionLimit=window.Sprig.outstandingTransactionLimit),!window.UserLeap.envId){if(!window.UserLeap.appId)throw new Error("Missing Environment id");window.UserLeap.envId=window.UserLeap.appId}window.UserLeap.debugMode&&console.info("[DEBUG] Sprig debug mode enabled");const e=wt(),n=window.UserLeap.sampleRate;let a=e.sampled;if(n){if(a===null&&(a=Math.random()<n,I("sampled",a)),!a)return}else a!==null&&I("sampled",null);window.UserLeap._API_URL||(window.UserLeap._API_URL="https://api.sprig.com");const s=[...window.UserLeap._queue];window.UserLeap._queue=new Rt(window.UserLeap,[]),window.UserLeap._queue.pause();for(let m=0;m<s.length;m++)window.UserLeap._queue.push(s[m]);const l=e.token;l?(window.UserLeap.token=l,window.UserLeap.visitorId=e.vid??null,window.UserLeap.userId=e.uid??null,window.UserLeap.partnerAnonymousId=e.aid??null):gt();const c=Q(i.getHttpHeaders(window.UserLeap));(y=window.SprigLoggerCallback)==null||y.call(window,"Sprig fetching config");const p=await async function(m){var E,P;const f=i.getHttpHeaders(window.UserLeap);document.addEventListener("securitypolicyviolation",i.cspViolationHandler);const U=await i.sprigFetch(R("1",[C],"config"),{headers:f});if(document.removeEventListener("securitypolicyviolation",i.cspViolationHandler),!U.ok)return(E=window.SprigLoggerCallback)==null||E.call(window,"Sprig config fetch failed"),U.reportError&&(console.warn("[Sprig] (ERR-422) Failed to load configuration",U.error),U.error&&window.UserLeap.reportError("applyRemoteConfig",U.error)),i.killNetworkRequests("Disabled: failed to fetch configuration"),m;const b=U.json;return b!=null&&b.disabled?((P=window.SprigLoggerCallback)==null||P.call(window,"Sprig config fetch disabled"),i.killNetworkRequests(`Disabled: ${b.disabled}`),{disabled:b.disabled}):Object.assign({},b,m)}(r);if((w=window.SprigLoggerCallback)==null||w.call(window,"Sprig fetched config"),Ot({isWeb:!c,reportingIntervalSeconds:p.metricsReportingEnabled||p.mobileMetricsReportingEnabled?p.metricsReportingIntervalSeconds:0,thresholds:p.metricThresholds,postMetrics:async m=>{var f;await D(R("1",[C],"metrics"),{body:m,method:"POST",headers:{"x-ul-replay-enabled":`${!!((f=i.modules.replay)!=null&&f.isReplayRecording())}`},shouldDropOnRateLimit:!0})}}),!c){const m=p.alwaysOnReplay?{userAgent:window.navigator.userAgent,surveyId:p.alwaysOnReplay.surveyId,responseGroupUuid:p.alwaysOnReplay.responseGroupUuid,sdkVersion:"2.40.4",maxDurationSeconds:p.alwaysOnReplay.maxDurationSeconds}:void 0;await((g=i.modules.replay)==null?void 0:g.initializeReplay({maxReplayDurationSeconds:p.maxReplayDurationSeconds,maxInflightRequests:window.UserLeap.maxInflightReplayRequests??2,replaySettings:p.replaySettings,apiUrl:window.UserLeap._API_URL,alwaysOnConfig:m})),De=p.replaySettings}jt(p),await Mt(p),window.UserLeap._queue.unpause(),(v=window.SprigLoggerCallback)==null||v.call(window,"SdkReady"),i.eventEmitter.emit(i.SprigEvent.SDKReady,{mobileMetricsReportingEnabled:!!p.mobileMetricsReportingEnabled,metricsReportingInterval:p.metricsReportingIntervalSeconds||0,metricsThresholds:p.metricThresholds||[],maxMobileReplayDurationSeconds:p.maxMobileReplayDurationSeconds,mobileReplaySettings:p.mobileReplaySettings}),i.eventEmitter.emit(i.SprigEvent.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId}),i.eventEmitter.on(i.SprigEvent.VisitorIDUpdated,()=>{for(const m in de)delete de[m]})}window.UserLeap.UPDATES=i.EVENTS,window.UserLeap("setPreviewKey",t),document.readyState==="complete"?o():window.attachEvent?window.attachEvent("onload",o):window.addEventListener("load",()=>{o()},!1)}class le{constructor(){q(this,"UPDATES",i.EVENTS)}displaySurvey(t){window.Sprig("displaySurvey",t)}mute(){window.Sprig("mute")}unmute(){window.Sprig("unmute")}dismissActiveSurvey(){window.Sprig("dismissActiveSurvey")}setAttribute(t,o){window.Sprig("setAttribute",t,o)}setAttributes(t){window.Sprig("setAttributes",t)}identifyAndSetAttributes(t){window.Sprig("identifyAndSetAttributes",t)}removeAttributes(t){window.Sprig("removeAttributes",t)}addListener(t,o){window.Sprig("addListener",t,o)}removeListener(t,o){window.Sprig("removeListener",t,o)}removeAllListeners(){window.Sprig("removeAllListeners")}setEmail(t){window.Sprig("setAttribute","!email",t)}setUserId(t){window.Sprig("setUserId",t)}setPartnerAnonymousId(t){window.Sprig("setPartnerAnonymousId",t)}track(t,o={},d={}){window.Sprig("track",t,o,d)}identifyAndTrack(t){window.Sprig("identifyAndTrack",t)}trackPageView(t,o,d){window.Sprig("trackPageView",t,o,d)}applyStyles(t){window.Sprig("applyStyles",t)}setWindowDimensions(t,o){window.Sprig("setWindowDimensions",t,o)}logoutUser(){window.Sprig("logoutUser")}teardown(){window.Sprig("teardown")}pauseReplayRecording(){window.Sprig("pauseReplayRecording")}resumeReplayRecording(){window.Sprig("resumeReplayRecording")}}const Ie={configure:r=>{if(!r.envId&&!r.environmentId)throw new Error("Initialization Error: Sprig configure requires an environmentId");if(r.envId||(r.envId=r.environmentId??""),r.installationMethod="web-npm",window.Sprig)return window.Sprig;window.Sprig=function(){window.Sprig._queue.push(arguments)},Object.getOwnPropertyNames(le.prototype).map(o=>{o!=="constructor"&&(window.Sprig[o]=le.prototype[o])});const t=window.Sprig;return t.appId=r.envId,t._queue=[],window.UserLeap=t,Ft(r),window.Sprig}},Vt={sprig:Ie,SprigAPI:le,configure:Ie.configure};exports.APP_ID="ul-app",exports.ConflictingWidgets=Qe,exports.DEFAULT_BORDER_COLOR="#e6e6e6",exports.DEFAULT_WIDTH_PX=360,exports.EMBED_MOBILE_MAX_WIDTH=1030,exports.ERROR_BORDER_COLOR="#bd282a",exports.SprigAPI=le,exports.calculateFrameDimensions=tt,exports.core=Vt,exports.getHtml=ce,exports.isHTMLElement=A,exports.resetScrollPosition=r=>{const t=r.querySelector(".ul-card__container");t&&(t.scrollTop=0)},exports.setSurveyStyles=Y,exports.sprig=Ie;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Dt = Object.defineProperty;
|
|
2
2
|
var At = (r, t, n) => t in r ? Dt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[t] = n;
|
|
3
3
|
var N = (r, t, n) => At(r, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
import { l as R, g as T, s as st, e as w, S as u, v as at, m as I, b as M, h as dt, E as ie, D as P, c as Ot, r as K, i as Ct, j as Tt, k as Pt, n as $e, o as Ge, d as Mt, a as jt, p as lt, q as ct } from "./metricsReporter-
|
|
4
|
+
import { l as R, g as T, s as st, e as w, S as u, v as at, m as I, b as M, h as dt, E as ie, D as P, c as Ot, r as K, i as Ct, j as Tt, k as Pt, n as $e, o as Ge, d as Mt, a as jt, p as lt, q as ct } from "./metricsReporter-VDxBxz-n.js";
|
|
5
5
|
const cr = 360, pr = "ul-app", ur = "#e6e6e6", wr = "#bd282a", gr = 1030, Ke = () => {
|
|
6
6
|
try {
|
|
7
7
|
return window.parent.Intercom;
|
|
@@ -104,7 +104,7 @@ const Z = async (r, t, n) => {
|
|
|
104
104
|
window.UserLeap.container && Object.assign(window.UserLeap.container.style, { display: "flex" });
|
|
105
105
|
};
|
|
106
106
|
if (J.installationMethod === "web-npm" || J.installationMethod === "web-npm-bundled") {
|
|
107
|
-
const { default: S } = await import("./view-
|
|
107
|
+
const { default: S } = await import("./view-E-Mxwe-D.js").then((B) => B.v);
|
|
108
108
|
S.configure(J), oe && window.UserLeap.container && qe();
|
|
109
109
|
} else ve && (he.src = `${ve}${window.UserLeap.isMobileSDK ? "" : `?t=${Date.now()}`}`, oe && he.addEventListener("load", () => {
|
|
110
110
|
window.UserLeap.container && qe();
|
|
@@ -861,7 +861,7 @@ function ar(r = {}) {
|
|
|
861
861
|
var h;
|
|
862
862
|
await O(D("1", [H], "metrics"), { body: m, method: "POST", headers: { "x-ul-replay-enabled": `${!!((h = I.replay) != null && h.isReplayRecording())}` }, shouldDropOnRateLimit: !0 });
|
|
863
863
|
} }), !c) {
|
|
864
|
-
const m = l.alwaysOnReplay ? { userAgent: window.navigator.userAgent, surveyId: l.alwaysOnReplay.surveyId, responseGroupUuid: l.alwaysOnReplay.responseGroupUuid, sdkVersion: "2.40.
|
|
864
|
+
const m = l.alwaysOnReplay ? { userAgent: window.navigator.userAgent, surveyId: l.alwaysOnReplay.surveyId, responseGroupUuid: l.alwaysOnReplay.responseGroupUuid, sdkVersion: "2.40.4", maxDurationSeconds: l.alwaysOnReplay.maxDurationSeconds } : void 0;
|
|
865
865
|
await ((y = I.replay) == null ? void 0 : y.initializeReplay({ maxReplayDurationSeconds: l.maxReplayDurationSeconds, maxInflightRequests: window.UserLeap.maxInflightReplayRequests ?? 2, replaySettings: l.replaySettings, apiUrl: window.UserLeap._API_URL, alwaysOnConfig: m })), Me = l.replaySettings;
|
|
866
866
|
}
|
|
867
867
|
or(l), await nr(l), window.UserLeap._queue.unpause(), (v = window.SprigLoggerCallback) == null || v.call(window, "SdkReady"), w.emit(u.SDKReady, { mobileMetricsReportingEnabled: !!l.mobileMetricsReportingEnabled, metricsReportingInterval: l.metricsReportingIntervalSeconds || 0, metricsThresholds: l.metricThresholds || [], maxMobileReplayDurationSeconds: l.maxMobileReplayDurationSeconds, mobileReplaySettings: l.mobileReplaySettings }), w.emit(u.VisitorIDUpdated, { visitorId: window.UserLeap.visitorId }), w.on(u.VisitorIDUpdated, () => {
|
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("./metricsReporter-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("./metricsReporter-ZysYMm2J.cjs"),e=require("./core-BeBP-1Uj.cjs");exports.DismissReason=i.DismissReason,exports.SprigEvent=i.SprigEvent,exports.SprigAPI=e.SprigAPI,exports.default=e.core,exports.sprig=e.sprig;
|
package/dist/core.d.ts
CHANGED
package/dist/core.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as r, S as e } from "./metricsReporter-
|
|
2
|
-
import { S as o, c as p, s as t } from "./core-
|
|
1
|
+
import { D as r, S as e } from "./metricsReporter-VDxBxz-n.js";
|
|
2
|
+
import { S as o, c as p, s as t } from "./core-DH1nitXA.js";
|
|
3
3
|
export {
|
|
4
4
|
r as DismissReason,
|
|
5
5
|
o as SprigAPI,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { u, c as _, a as F, F as _e, h as ae, p as ne, _ as de, g as Ce, S as Me, b as se, y as Oe, d as Be } from "./view-
|
|
2
|
-
import { g as He, i as Se, E as Ue, a as we } from "./core-
|
|
1
|
+
import { u, c as _, a as F, F as _e, h as ae, p as ne, _ as de, g as Ce, S as Me, b as se, y as Oe, d as Be } from "./view-E-Mxwe-D.js";
|
|
2
|
+
import { g as He, i as Se, E as Ue, a as we } from "./core-DH1nitXA.js";
|
|
3
3
|
import { d as Ne } from "./debounce-CMb8f7wh.js";
|
|
4
|
-
import { v as Ve } from "./metricsReporter-
|
|
4
|
+
import { v as Ve } from "./metricsReporter-VDxBxz-n.js";
|
|
5
5
|
const Fe = (e) => u("button", { ...e, className: _("ul-card-text__button", e.className), id: "ul-card-text__button" }), $e = ({ html: e, ...n }) => {
|
|
6
6
|
const { enableCspTrustedTypes: o } = F((r) => ({ enableCspTrustedTypes: r.enableCspTrustedTypes })), t = _e(() => He(e, o), [o, e]);
|
|
7
7
|
return u("div", { ...n, dangerouslySetInnerHTML: { __html: t } });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const i=require("./view-
|
|
1
|
+
"use strict";const i=require("./view-CwMhaJ55.cjs"),W=require("./core-BeBP-1Uj.cjs"),Le=require("./debounce-DsC7462b.cjs"),_e=require("./metricsReporter-ZysYMm2J.cjs"),le=e=>i.u("button",{...e,className:i.cc("ul-card-text__button",e.className),id:"ul-card-text__button"}),ye=({html:e,...n})=>{const{enableCspTrustedTypes:o}=i.useConfig(r=>({enableCspTrustedTypes:r.enableCspTrustedTypes})),t=i.F(()=>W.getHtml(e,o),[o,e]);return i.u("div",{...n,dangerouslySetInnerHTML:{__html:t}})},ae=()=>{const{viewDocument:e}=i.useConfig(t=>({viewDocument:t.viewDocument})),[n,o]=i.h(!1);return i.p(()=>{const t=e.querySelector(".sprig-question-body"),r=new ResizeObserver(()=>{window.requestAnimationFrame(()=>{o(!!(t&&W.isHTMLElement(t)&&t.scrollHeight>t.offsetHeight))})});return t&&r.observe(t),()=>{t&&r.disconnect()}},[e]),n},de=({plainText:e,richText:n,id:o,className:t,isHeader:r,showAsterisk:l})=>n?i.u(ye,{className:t,html:n,id:o}):e?r?i.u("h1",{className:t,id:o,children:[e,l&&"*"]}):i.u("p",{className:t,id:o,children:e}):null,Pe=()=>i.u("svg",{fill:"none",height:"10",viewBox:"0 0 13 10",width:"13",xmlns:"http://www.w3.org/2000/svg",children:i.u("path",{d:"M11.5 1.5L4.5 8.5L1 5",stroke:"#FFFFFF",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})}),Ee=(e,n)=>{const o=i._(0);return()=>{if(e.current){const t=e.current;t.style.height="1px";const r=t.scrollHeight+(t.offsetHeight-t.clientHeight),l=parseInt(window.getComputedStyle(t).getPropertyValue("max-height")),a=r<=l?r:l;o.current!==a&&requestAnimationFrame(()=>{n()}),o.current=a,t.style.height=`${a}px`}}},ce=({buttonText:e="View Prototype",handleClick:n})=>i.u("button",{className:"prototype-button",onClick:n,children:e},"prototype-btn"),xe=({isSelected:e,id:n,divId:o,themeColor:t,disabled:r=!1})=>i.u("div",{"aria-checked":e,"aria-disabled":r,"aria-labelledby":`label-${n}`,className:"select-checkbox",id:o,role:"checkbox",style:{...e?{backgroundColor:t,borderColor:t,boxShadow:"none"}:{},...r?{opacity:.5}:{}},tabIndex:r?-1:0,children:e&&i.u(i.SvgCheckmark,{})}),Oe=({promptText:e,textValue:n,onTextChange:o,useMobileStyling:t})=>{const r=i._(null),{update:l}=i.useConfig(d=>({update:d.update})),a=Ee(r,()=>l());return i.p(()=>(a(),r.current&&r.current.focus(),()=>{l()}),[]),i.u("textarea",{"aria-label":e,"aria-multiline":"true","aria-placeholder":e,className:i.cc(i.getClasses("choice-text-input",t)),"data-gramm":"false",maxLength:5e3,name:"text",onChange:d=>{a(),d.stopPropagation(),o(d.currentTarget.value)},onClick:d=>{d.stopPropagation()},onKeyPress:d=>{d.stopPropagation()},placeholder:e,ref:r,role:"textbox",rows:1,value:n})},ue="ul-select-style-element",K="ul-select-active-dynamic-style",je="ul-select-error-dynamic-style",Me=(e,n,o)=>{let t=e.getElementById(ue),r=!1;t||(t=e.createElement("style"),r=!0),t.tagName.toLowerCase()==="style"&&(t.id=ue,o&&(t.nonce=o),t.textContent=Be(n),r&&e.head.appendChild(t))},Be=e=>`
|
|
2
2
|
.${K} {
|
|
3
3
|
border-color: ${e};
|
|
4
4
|
}
|