@sprig-technologies/sprig-browser 2.40.4 → 2.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/conversational-ui-BhbQgh6X.cjs +1 -0
- package/dist/conversational-ui-DlnwFL72.js +593 -0
- package/dist/{core-DH1nitXA.js → core-CRJIQvxS.js} +3 -3
- package/dist/{core-BeBP-1Uj.cjs → core-DY4ohxcP.cjs} +2 -2
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +63 -5
- package/dist/core.js +2 -2
- package/dist/{getAttributedUrl-CwDSDeGp.js → getAttributedUrl-CVKJ3sRY.js} +14 -7
- package/dist/{getAttributedUrl-DxiDPASm.cjs → getAttributedUrl-DxxH9aNE.cjs} +2 -2
- package/dist/index-CA0jioLg.cjs +1 -0
- package/dist/index-Dj3ZmhVC.js +749 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +63 -5
- package/dist/index.js +2 -2
- package/dist/{metricsReporter-ZysYMm2J.cjs → metricsReporter-Dq2lxT-9.cjs} +1 -1
- package/dist/{metricsReporter-VDxBxz-n.js → metricsReporter-uLWRAnwI.js} +1 -1
- package/dist/replay.cjs +1 -1
- package/dist/replay.js +1 -1
- package/dist/view-Bt__MdRk.js +1722 -0
- package/dist/view-KypSYKm-.cjs +1 -0
- package/package.json +1 -1
- package/dist/conversational-ui-BuBuXnv4.cjs +0 -1
- package/dist/conversational-ui-XCbY4udQ.js +0 -579
- package/dist/index-DM14cHwu.cjs +0 -1
- package/dist/index-KB_x0aKi.js +0 -695
- package/dist/view-CwMhaJ55.cjs +0 -1
- package/dist/view-E-Mxwe-D.js +0 -1505
|
@@ -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-uLWRAnwI.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-Bt__MdRk.js").then((B) => B.z);
|
|
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.
|
|
864
|
+
const m = l.alwaysOnReplay ? { userAgent: window.navigator.userAgent, surveyId: l.alwaysOnReplay.surveyId, responseGroupUuid: l.alwaysOnReplay.responseGroupUuid, sdkVersion: "2.41.0", 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, () => {
|
|
@@ -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-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(`
|
|
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-Dq2lxT-9.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-KypSYKm-.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.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;
|
|
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.41.0",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;
|
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-Dq2lxT-9.cjs"),e=require("./core-DY4ohxcP.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
|
@@ -1012,18 +1012,56 @@ interface PassthroughData {
|
|
|
1012
1012
|
type MultiChoiceSecondaryValueType = Record<string, {
|
|
1013
1013
|
userText: string;
|
|
1014
1014
|
}> | null;
|
|
1015
|
+
declare const enum MaxDiffChoice {
|
|
1016
|
+
RIGHT = "right",
|
|
1017
|
+
LEFT = "left"
|
|
1018
|
+
}
|
|
1019
|
+
type MaxDiffValueType = {
|
|
1020
|
+
id: number;
|
|
1021
|
+
option: string;
|
|
1022
|
+
selected: MaxDiffChoice | null;
|
|
1023
|
+
};
|
|
1024
|
+
type MaxDiffResponseType = Array<Array<MaxDiffValueType>>;
|
|
1015
1025
|
interface RecordedTaskResponseValueType {
|
|
1016
1026
|
mediaRecordingUids?: string[] | null;
|
|
1017
1027
|
taskDurationMillisecond?: number;
|
|
1018
1028
|
taskStatus: TaskStatus;
|
|
1019
1029
|
}
|
|
1030
|
+
type TextUrlPromptResponse = undefined | {
|
|
1031
|
+
skipped?: true;
|
|
1032
|
+
};
|
|
1033
|
+
type ConsentLegalResponse = {
|
|
1034
|
+
submitted: true;
|
|
1035
|
+
} | null;
|
|
1036
|
+
type RecordedTaskResponse = {
|
|
1037
|
+
mediaRecordingUids: string[];
|
|
1038
|
+
taskDurationMillisecond: number;
|
|
1039
|
+
taskStatus: TaskStatus;
|
|
1040
|
+
};
|
|
1041
|
+
type LikertResponse = number | null;
|
|
1042
|
+
type OpenTextResponse = string;
|
|
1043
|
+
type AiDynamicFollowUpResponse = string;
|
|
1044
|
+
type MultiChoiceresponse = string | undefined;
|
|
1045
|
+
type MultiSelectResponse = string[];
|
|
1046
|
+
type MatrixResponse = {
|
|
1047
|
+
[rowId: number]: string | null;
|
|
1048
|
+
};
|
|
1049
|
+
type NpsResponse = number | null;
|
|
1050
|
+
type RankOrderResponse = {
|
|
1051
|
+
[optionId: string]: number | null;
|
|
1052
|
+
};
|
|
1053
|
+
type VideoVoiceResponse = {
|
|
1054
|
+
mediaRecordingUid: string;
|
|
1055
|
+
};
|
|
1056
|
+
type CardResponse = TextUrlPromptResponse | ConsentLegalResponse | RecordedTaskResponse | LikertResponse | OpenTextResponse | AiDynamicFollowUpResponse | MultiChoiceresponse | MultiSelectResponse | MatrixResponse | NpsResponse | RankOrderResponse | MaxDiffResponseType | VideoVoiceResponse;
|
|
1057
|
+
|
|
1020
1058
|
declare const BOOLEAN_OPERATOR: {
|
|
1021
1059
|
readonly And: 1;
|
|
1022
1060
|
readonly Or: 2;
|
|
1023
1061
|
};
|
|
1024
1062
|
type BooleanOperator = (typeof BOOLEAN_OPERATOR)[keyof typeof BOOLEAN_OPERATOR];
|
|
1025
1063
|
|
|
1026
|
-
type CardType = "consentlegal" | "likert" | "matrix" | "maxdiff" | "multiplechoice" | "multipleselect" | "nps" | "open" | "rankorder" | "recordedtask" | "texturlprompt" | "thanks" | "uploading" | "videovoice";
|
|
1064
|
+
type CardType = "aidynamicfollowup" | "consentlegal" | "likert" | "matrix" | "maxdiff" | "multiplechoice" | "multipleselect" | "nps" | "open" | "rankorder" | "recordedtask" | "texturlprompt" | "thanks" | "uploading" | "videovoice";
|
|
1027
1065
|
type ConceptUrl = string | null;
|
|
1028
1066
|
type GroupType = "page";
|
|
1029
1067
|
interface BaseCard {
|
|
@@ -1032,9 +1070,11 @@ interface BaseCard {
|
|
|
1032
1070
|
updatedAt: string;
|
|
1033
1071
|
value?: unknown;
|
|
1034
1072
|
type: CardType;
|
|
1035
|
-
groupId?: number;
|
|
1073
|
+
groupId?: number | null;
|
|
1036
1074
|
secondaryValue?: MultiChoiceSecondaryValueType | null;
|
|
1037
1075
|
groupType?: GroupType;
|
|
1076
|
+
childId?: number | null;
|
|
1077
|
+
parentId?: number | null;
|
|
1038
1078
|
}
|
|
1039
1079
|
type Comparator = "answered" | "contains" | "notcontains" | "list_dni" | "eq" | "given_up" | "gt" | "gte" | "lt" | "lte" | "list_all" | "list_alo" | "list_exact" | "neq" | "partial" | "skipped";
|
|
1040
1080
|
type Randomize = "none" | "all";
|
|
@@ -1052,7 +1092,7 @@ type GroupRoutingOption = {
|
|
|
1052
1092
|
};
|
|
1053
1093
|
type RoutingGroupOption = {
|
|
1054
1094
|
comparator: Comparator;
|
|
1055
|
-
questionIndex: number;
|
|
1095
|
+
questionIndex: number | string;
|
|
1056
1096
|
value: number | string | string[] | {
|
|
1057
1097
|
skipped: true;
|
|
1058
1098
|
} | null | undefined;
|
|
@@ -1220,6 +1260,19 @@ interface OpenTextCard extends BaseCard {
|
|
|
1220
1260
|
};
|
|
1221
1261
|
type: "open";
|
|
1222
1262
|
}
|
|
1263
|
+
/**
|
|
1264
|
+
* DynamicQuestionCard loading:
|
|
1265
|
+
* - `true` — DQ network request inflight
|
|
1266
|
+
* - `false` - successful DQ network request
|
|
1267
|
+
* - `undefined` - network call not yet triggered
|
|
1268
|
+
* - `null` - unsuccessful DQ network call
|
|
1269
|
+
*/
|
|
1270
|
+
interface DynamicQuestionCard extends BaseCard {
|
|
1271
|
+
props: OpenTextCard["props"] & {
|
|
1272
|
+
loading?: boolean | null;
|
|
1273
|
+
};
|
|
1274
|
+
type: "aidynamicfollowup";
|
|
1275
|
+
}
|
|
1223
1276
|
interface MultipleChoiceOption {
|
|
1224
1277
|
createdAt: string;
|
|
1225
1278
|
deletedAt: null;
|
|
@@ -1402,7 +1455,7 @@ interface VideoVoiceCard extends BaseCard {
|
|
|
1402
1455
|
};
|
|
1403
1456
|
type: "videovoice";
|
|
1404
1457
|
}
|
|
1405
|
-
type Card = TextUrlPromptCard | ConsentLegalCard | RecordedTaskCard | LikertCard | OpenTextCard | MatrixCard | MaxDiffType | MultipleChoiceSingleSelectCard | MultipleChoiceMultiSelectCard | NPSCard | RankOrderType | VideoVoiceCard;
|
|
1458
|
+
type Card = TextUrlPromptCard | ConsentLegalCard | DynamicQuestionCard | RecordedTaskCard | LikertCard | OpenTextCard | MatrixCard | MaxDiffType | MultipleChoiceSingleSelectCard | MultipleChoiceMultiSelectCard | NPSCard | RankOrderType | VideoVoiceCard;
|
|
1406
1459
|
|
|
1407
1460
|
type InteractiveMatchType = "exactly" | "legacy";
|
|
1408
1461
|
type PageUrlMatchType = "contains" | "exactly" | "legacy" | "notContains" | "regex" | "startsWith";
|
|
@@ -1703,7 +1756,8 @@ interface AppProductConfig {
|
|
|
1703
1756
|
}
|
|
1704
1757
|
interface Config extends MobileReplayConfig {
|
|
1705
1758
|
addResponseGroupMeta?: () => Promise<JSONObject>;
|
|
1706
|
-
allResponses:
|
|
1759
|
+
allResponses: CardResponse[];
|
|
1760
|
+
allResponsesRaw: Record<string | number, string>;
|
|
1707
1761
|
answers?: Answer[];
|
|
1708
1762
|
apiURL: string;
|
|
1709
1763
|
avatars: Avatars;
|
|
@@ -1720,6 +1774,10 @@ interface Config extends MobileReplayConfig {
|
|
|
1720
1774
|
outcome: string;
|
|
1721
1775
|
};
|
|
1722
1776
|
};
|
|
1777
|
+
createDynamicQuestion: (s: {
|
|
1778
|
+
parentQuestionId: number;
|
|
1779
|
+
parentResponseConfig?: Config["allResponsesRaw"];
|
|
1780
|
+
}) => void;
|
|
1723
1781
|
customMetadata?: Record<string, unknown>;
|
|
1724
1782
|
customStyles?: string;
|
|
1725
1783
|
dismissOnPageChange: boolean;
|
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-uLWRAnwI.js";
|
|
2
|
+
import { S as o, c as p, s as t } from "./core-CRJIQvxS.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-Bt__MdRk.js";
|
|
2
|
+
import { g as He, i as Se, E as Ue, a as we } from "./core-CRJIQvxS.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-uLWRAnwI.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 } });
|
|
@@ -1001,6 +1001,12 @@ const A = async ({ event: e, apiBase: n, headers: o, visitorId: t, envId: r, met
|
|
|
1001
1001
|
return o.includes(me) && (o = o.replace(me, "")), o ? `https://image.mux.com/${o}/thumbnail.jpg?time=0` : null;
|
|
1002
1002
|
}, x = { UPLOAD_STARTED: "upload.started", UPLOAD_PROGRESS: "upload.progress", UPLOAD_FINISHED: "upload.finished", DELETE: "delete", ERROR: "error", MEDIA_TYPE: "media.type", PERMISSION_DENIED: "permission_denied", OTHER: "other", UPLOAD_ID: "upload.id", UPLOAD_PROGRESS_PCT: "upload.progress.pct", MEDIA_RECORDING_UID: "media.recording.uid", MEDIA_TYPE_VIDEO: "video", MEDIA_TYPE_AUDIO: "audio" }, R = { PlaybackRateMenuButton: "Speed", PlayToggle: "Play", FullscreenToggle: "Expand", TurnOnCamera: "Turn on", TurnOffCamera: "Turn off", DeleteButton: "Delete", RecordButton: "Record", StopButton: "Stop", PauseButton: "Pause" };
|
|
1003
1003
|
var Xe = ((e) => (e.CONTINUE = "CONTINUE", e.EXTERNAL = "EXTERNAL", e.NO_BUTTON = "NO_BUTTON", e))(Xe || {}), en = ((e) => (e.Unlimited = "Unlimited", e.Maximum = "Maximum", e.Range = "Range", e))(en || {});
|
|
1004
|
+
function fn(e) {
|
|
1005
|
+
const n = e.props;
|
|
1006
|
+
if (n === null || typeof n != "object") return !1;
|
|
1007
|
+
const o = Reflect.get(n, "properties");
|
|
1008
|
+
return typeof o == "object" && o !== null && "required" in o;
|
|
1009
|
+
}
|
|
1004
1010
|
const nn = ({ options: e, selectItem: n, selectedOptions: o, showCheckbox: t, disabledOptions: r, dropdownFooter: s }) => {
|
|
1005
1011
|
const { themeColor: l } = F((a) => ({ doc: a.viewDocument, themeColor: a.border }));
|
|
1006
1012
|
return u("div", { className: "select-list", children: [e.map((a) => {
|
|
@@ -1009,7 +1015,7 @@ const nn = ({ options: e, selectItem: n, selectedOptions: o, showCheckbox: t, di
|
|
|
1009
1015
|
}, role: "option", style: { ...r != null && r.includes(a) ? { opacity: 0.5, cursor: "not-allowed" } : {} }, children: [t && u(xe, { divId: (i = a.id, `checkbox-div-${i}`), id: a.id, isSelected: o.includes(a), themeColor: l }), a.label] }, a.id);
|
|
1010
1016
|
var i;
|
|
1011
1017
|
}), s] });
|
|
1012
|
-
},
|
|
1018
|
+
}, Cn = ({ isMultiSelect: e = !1, multiselectText: n = "choices selected", onChange: o, options: t, placeholderText: r, value: s, disabledOptions: l = [], dropdownFooter: a }) => {
|
|
1013
1019
|
const [i, c] = ae(!1), { viewDocument: m, update: I, isConversationalUI: b } = F((v) => ({ viewDocument: v.viewDocument, update: v.update, isConversationalUI: v.isConversationalUI })), L = () => {
|
|
1014
1020
|
c(!i);
|
|
1015
1021
|
};
|
|
@@ -1048,7 +1054,7 @@ const nn = ({ options: e, selectItem: n, selectedOptions: o, showCheckbox: t, di
|
|
|
1048
1054
|
});
|
|
1049
1055
|
(j = v.optionProperties) != null && j.noneOfTheAbove && !h ? o([v]) : e ? o(h ? s.filter((C) => C.id !== v.id) : f ? [v] : [...s, v]) : h || o([v]), e || L();
|
|
1050
1056
|
}, showCheckbox: e })] });
|
|
1051
|
-
}, on = { "{{user_id}}": "externalUserId", "{{email}}": "email" },
|
|
1057
|
+
}, on = { "{{user_id}}": "externalUserId", "{{email}}": "email" }, wn = (e = void 0, n = {}) => {
|
|
1052
1058
|
if (!e) return e;
|
|
1053
1059
|
const o = ["http:", "https:", "itms-apps:", "market:"], t = ((l) => /^[a-zA-Z][a-zA-Z0-9+\-.]*:\/\//.test(l) ? l : `http://${l}`)(e);
|
|
1054
1060
|
if (!t) return;
|
|
@@ -1081,12 +1087,13 @@ export {
|
|
|
1081
1087
|
Xe as P,
|
|
1082
1088
|
vn as Q,
|
|
1083
1089
|
x as R,
|
|
1084
|
-
|
|
1090
|
+
Cn as S,
|
|
1085
1091
|
un as a,
|
|
1086
1092
|
en as b,
|
|
1087
1093
|
an as c,
|
|
1088
1094
|
mn as d,
|
|
1089
|
-
|
|
1095
|
+
fn as e,
|
|
1096
|
+
wn as g,
|
|
1090
1097
|
bn as p,
|
|
1091
1098
|
gn as s,
|
|
1092
1099
|
ze as u,
|