userflow.js-self-hosted 0.1.1026519 → 0.1.1026521
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/BannerApp.js +1 -1
- package/BuilderBar.js +1 -1
- package/ChecklistApp.js +1 -1
- package/ChecklistUI.js +1 -1
- package/ElementSelectionApp.js +1 -1
- package/EmbedApp.js +1 -1
- package/FlowApp.js +2 -2
- package/FlowChrome.js +2 -2
- package/LauncherApp.js +1 -1
- package/ResourceCenterApp.js +4 -4
- package/ResourceCenterAssistantChat.js +2 -2
- package/ResourceCenterLauncherHandler.js +1 -1
- package/SmartFlowRecordingApp.js +1 -1
- package/StartConditionTestingApp.js +1 -1
- package/TrackerTestingApp.js +1 -1
- package/WorkflowApp.js +2 -2
- package/hash.txt +1 -1
- package/package.json +1 -1
- package/ui.js +2 -2
- package/userflow.js +11 -11
- package/vendor.object-assign.js +1 -1
- package/resource-center-route.js +0 -2
package/WorkflowApp.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{R as i,r as E}from"./vendor.react.js";import{d as S,
|
|
1
|
+
import{R as i,r as E}from"./vendor.react.js";import{d as S,ab as A,E as y,ac as I,g as T,f as j,K as D,O as $,N as z,U as G,S as J,r as K,p as q}from"./userflow.js";import{f as M}from"./steps.js";import{u as _}from"./client-context.js";import{g as N,m as R}from"./roots.js";import{s as O,n as X,h as Y,c as Z}from"./TreeDoc.js";import{g as x,o as Q,c as ee}from"./flow-condition-types.js";import"./vendor.object-assign.js";import{u as te,a as ne}from"./stylesheets.js";import{S as oe}from"./flow-host.styl.js";import{B as re,F as se}from"./FlowChrome.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";import"./vendor.i18next.js";import"./vendor.babel.runtime.js";import"./vendor.react-i18next.js";import"./vendor.obj-str.js";import"./vendor.fortawesome.pro-solid-svg-icons.js";import"./vendor.date-fns.js";import"./vendor.fortawesome.pro-regular-svg-icons.js";import"./Frame.js";import"./vendor.react-dom.js";import"./vendor.scheduler.js";import"./iframe-reset.styl.js";import"./use-selector-element-monitoring.js";import"./use-window-resize.js";import"./logomark.js";import"./use-confetti.js";import"./vendor.canvas-confetti.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="5b0f0155-a0c4-4c47-b349-c2a93efeb4a2",e._sentryDebugIdIdentifier="sentry-dbid-5b0f0155-a0c4-4c47-b349-c2a93efeb4a2")}catch{}})();const ie=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value")?.set,le=Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,"value")?.set,ae=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value")?.set;function ce(e){return e instanceof HTMLTextAreaElement?le:e instanceof HTMLSelectElement?ae:ie}function ue(e,t){return e.style.setProperty("--userflow-workflow-glow-color",t),e.classList.add("userflow-workflow-input-glow"),()=>H(e)}function H(e){e.classList.remove("userflow-workflow-input-glow"),e.style.removeProperty("--userflow-workflow-glow-color")}function fe(e,t){const n=ce(e);n?n.call(e,t):e.value=t,e.dispatchEvent(new Event("input",{bubbles:!0})),e instanceof HTMLSelectElement&&e.dispatchEvent(new Event("change",{bubbles:!0}))}const P=3e4,de=100;function pe(e,t){return new Promise(n=>{let o=!1;const r=()=>{o||(o=!0,e.off("private:assistantChatReady",r),window.clearTimeout(s),n())};e.on("private:assistantChatReady",r);const s=window.setTimeout(r,t)})}function me(e,t,n){return new Promise(o=>{if(e.resourceCenterSession){o(e.resourceCenterSession);return}const r=l=>{e.off("private:resourceCenterSession",r),window.clearTimeout(s),o(l)};e.on("private:resourceCenterSession",r);const s=window.setTimeout(()=>r(null),n)})}function b(e){const t=Number(e.stepTimeoutSeconds);return t>0?t*1e3:P}async function W(e,t,n=()=>!1){const o=Date.now()+t;for(;!n();){if(await e())return!0;if(Date.now()>=o)return!1;await new Promise(r=>window.setTimeout(r,de))}return!1}async function U(e,t,n=P,o){let r=null;return await W(async()=>{const s=R(e);for(const l of t)if(s instanceof l)return r=s,!0;return!1},n,o),r}class C extends Error{}class v extends Error{}class B extends Error{}const we={[I.CLICK]:{execute:async(e,t,n,o)=>{if(!e.selector)return;const r=await U(e.selector,[HTMLElement],b(t),o.isCanceled);if(!r)throw new C;r.click()},verify:async()=>!0},[I.FILL]:{execute:async(e,t,n,o)=>{if(!e.selector)return;const r=await U(e.selector,[HTMLInputElement,HTMLTextAreaElement,HTMLSelectElement],b(t),o.isCanceled);if(!r)throw new C;if(o.isCanceled())return;const s=ue(r,t.version.theme.brandBackgroundColor);if(o.isCanceled()){s();return}const l=await me(n,t.draftMode,b(t));if(o.isCanceled()){s();return}if(!l)throw s(),new v;const c=l.version.resourceCenter?.blocks.filter(a=>a.type===D.ASSISTANT),u=c?.[0];if(!u)throw console.error("Userflow.js: No assistant block configured in the resource center."),s(),new v;c&&c.length>1&&console.warn(`Userflow.js: Multiple assistant blocks found in the resource center.
|
|
2
2
|
|
|
3
|
-
Using ${u.name} for communication`);const p={kind:"assistant",block:u},w=pe(n,
|
|
3
|
+
Using ${u.name} for communication`);const p={kind:"assistant",block:u},w=pe(n,b(t)),f=$(p);if(f&&z.setItem(`resourceCenterRoute:v1:${l.id}`,f),await n.openResourceCenter(),o.isCanceled()){s();return}if(n.emit("private:resourceCenterNavigate",p),await w,o.isCanceled()){s();return}n.emit("private:workflowFillStep",{stepId:e.id,workflowSessionId:t.id});try{await new Promise((a,d)=>{let m=N(r),g,L;const k=()=>{window.clearTimeout(L),window.clearTimeout(g),V()},F=()=>{const h=N(r);h?h!==m&&(window.clearTimeout(g),g=window.setTimeout(()=>{k(),a()},1e3)):window.clearTimeout(g),m=h},{disconnect:V}=Q(F,{observeInput:!0});L=window.setTimeout(()=>{k(),d(new B)},b(t)),F(),o.onCancel(()=>{k(),d(new G("Userflow.js: Fill step canceled."))})})}finally{s()}},verify:async()=>!0},[I.NAVIGATE]:{execute:async(e,t)=>{if(!e.url)return;const n=O(e.url,{lookupAttribute:x(t.data)}),o=new URL(n,T()).toString();if(T()!==o){if(e.navigateTarget===j.NEW_TAB){window.open(n);return}X(n)}},verify:async(e,t)=>{if(!e.url)return!1;const n=O(e.url,{lookupAttribute:x(t.data)});return T()===new URL(n,T()).toString()}}};function Ee(e){const{step:t,workflowSessionData:n,client:o,onSuccess:r,onElementMissing:s}=e;let l=!1,c;const u={isCanceled:()=>l,onCancel:f=>{l?f():c=f}},p=()=>{l||(l=!0,c?.())};async function w(){const f=we[t.type];try{if(S("executing workflow-step",t),await f.execute(t,n,o,u),l)return;S("verifying workflow-step",t);const a=await W(()=>f.verify(t,n),b(n),u.isCanceled);if(S(`workflow-step verified ${a}`,t),l)return;if(!a)throw new v;r()}catch(a){if(l)return;a instanceof C?(o.send({kind:"ReportWorkflowElementMissing",sessionId:n.id,stepId:t.id}),s()):a instanceof B?(o.send({kind:"ReportWorkflowTimedOut",sessionId:n.id,stepId:t.id,errorReason:A.USER_INPUT_TIMEOUT}),o.endFlow(n,{endReason:y.USERFLOWJS})):a instanceof v?(o.send({kind:"ReportWorkflowTimedOut",sessionId:n.id,stepId:t.id,errorReason:A.STEP_TIMEOUT}),o.endFlow(n,{endReason:y.USERFLOWJS})):console.warn(a)}}return{cancel:p,start:w}}function be(e,t,n){const o=new J(t.data),r=[];for(const s of e){const{condition:l}=s;if(!l)continue;let c=!1;const p=ee[l.type].track({condition:s.condition,sessionData:o,callback:w=>{w&&!c&&(c=!0,Y(n,t,s.actions))}});r.push(p)}return()=>r.forEach(s=>s())}const ge=new URL("workflow.css",import.meta.url).href,Te=({session:e,step:t})=>{const n=_(),o=t.selector,r=!o||o.type===K.AUTO&&!o.autoData,s=u=>{u.stopPropagation(),n.endFlow(e,{endReason:y.USER_CLOSED})},l=Number(e.stepTimeoutSeconds),c=t.name||`Step ${t.idx+1}`;return i.createElement(i.Fragment,null,i.createElement(re,{draftMode:e.draftMode,close:s}),e.draftMode&&r?i.createElement("div",{className:"userflowjs-bubble-content"},i.createElement("div",{className:"userflowjs-bubble-alert p-like"},i.createElement("span",{className:"userflowjs-bubble-alert__label"},"Preview-only tip"),"No element target selected yet. Please go back to the Builder and select a target element in ",i.createElement("b",null,c)," of"," ",i.createElement("b",null,e.flow.name),".")):e.draftMode?i.createElement("div",{className:"userflowjs-bubble-content"},i.createElement("div",{className:"userflowjs-bubble-alert p-like"},i.createElement("p",null,i.createElement("span",{className:"userflowjs-bubble-alert__label"},"Preview-only tip"),"The target element for ",i.createElement("b",null,c)," of"," ",i.createElement("b",null,e.flow.name)," was not found within ",l," ",l===1?"second":"seconds","."),i.createElement("p",null,"For regular users, the action flow will auto-dismiss when this happens."),i.createElement("p",null,"If you are on the right page, then try reselecting the element in the Builder."),i.createElement("p",null,"Read more in our"," ",i.createElement("a",{href:"https://userflow.com/docs/trouble/element-not-found",target:"_blank",rel:"noopener noreferrer"},"Element not found guide"),"."))):i.createElement(i.Fragment,null,i.createElement("div",{className:"userflowjs-bubble-content"},i.createElement("p",null,i.createElement("b",null,"A required element could not be found.")),i.createElement("p",null,"Please try again or close this action flow.")),i.createElement("div",{className:"userflowjs-bubble-buttons"},i.createElement(Z,{appearance:"default",onClick:s,text:"Close"}))))},Xe=({session:e})=>{const t=_();te(window,ge);const[n,o]=E.useReducer(Se,void 0,()=>({session:e,step:M(e)})),{session:r,step:s}=n,l=ne(r.version.theme),[c,u]=E.useState(!1),p=E.useRef(c);p.current=c;const w=E.useCallback(()=>{if(s.selector){const a=R(s.selector);a instanceof HTMLElement&&H(a)}},[s]);E.useEffect(()=>{r!==e&&o({kind:"updateSession",session:e});const a=d=>{d.session.id===r.id&&!p.current&&(o({kind:"goToStep",stepId:d.step.id}),S("workflow-step moving to",d.step))};return t.on("gotostep",a),()=>{t.off("gotostep",a)}},[t,r,e]),E.useEffect(()=>{const a=d=>{if(!s.selector)return;const m=R(s.selector);(m instanceof HTMLInputElement||m instanceof HTMLTextAreaElement||m instanceof HTMLSelectElement)&&fe(m,d.value)};return t.on("private:workflowFillStepValue",a),()=>{t.off("private:workflowFillStepValue",a)}},[t,s]);const f=s.id;return E.useEffect(()=>{u(!1);let a;const{cancel:d,start:m}=Ee({step:s,workflowSessionData:r,client:t,onSuccess:()=>{a=be(s.triggers,r,t)},onElementMissing:()=>{if(!r.draftMode){t.endFlow(r,{endReason:y.ELEMENT_MISSING});return}u(!0)}});return m(),()=>{d(),a?.(),w()}},[t,f,r.draftMode]),c?i.createElement(oe,null,i.createElement(se,{company:r.flow.company,theme:l,position:"fixed",stepAppearance:q.BUBBLE},i.createElement(Te,{session:r,step:s}))):null};function Se(e,t){switch(t.kind){case"updateSession":{let n;return t.session.id===e.session.id?n=t.session.version.workflowSteps.find(({crossVersionId:o})=>o===e.step.crossVersionId)||M(t.session):n=M(t.session),{...e,session:t.session,step:n}}case"goToStep":{const n=e.session.version.workflowSteps.find(o=>o.id===t.stepId);return n?{...e,step:n}:e}}}export{Xe as WorkflowApp,Xe as default};
|
|
4
4
|
//# sourceMappingURL=WorkflowApp.js.map
|
package/hash.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
c3125b3bcefe6f65de274ee419a33624b77ed6b1
|
package/package.json
CHANGED
package/ui.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["ElementSelectionApp.js","vendor.react.js","vendor.object-assign.js","vendor.is-hotkey.js","vendor.obj-str.js","roots.js","userflow.js","vendor.phoenix.js","vendor.uuid.js","client-context.js","vendor.i18next.js","vendor.babel.runtime.js","vendor.react-i18next.js","use-window-resize.js","BuilderBar.js","Frame.js","vendor.react-dom.js","vendor.scheduler.js","stylesheets.js","vendor.fortawesome.pro-regular-svg-icons.js","vendor.fortawesome.pro-solid-svg-icons.js","flow-condition-types.js","vendor.date-fns.js","iframe-reset.styl.js","
|
|
2
|
-
import{r as s,R as e}from"./vendor.react.js";import{r as C}from"./vendor.react-dom.js";import{u as N,i as $,U as W}from"./client-context.js";import{R as J,_ as o,I as j,J as q,U as G}from"./userflow.js";import"./vendor.object-assign.js";import{I as K}from"./vendor.react-i18next.js";import"./vendor.scheduler.js";import"./vendor.i18next.js";import"./vendor.babel.runtime.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},n=new Error().stack;n&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[n]="35de5746-3a44-48ae-a5a8-d7c68fabdc7a",t._sentryDebugIdIdentifier="sentry-dbid-35de5746-3a44-48ae-a5a8-d7c68fabdc7a")}catch{}})();const M=e.lazy(()=>o(()=>import("./ElementSelectionApp.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["ElementSelectionApp.js","vendor.react.js","vendor.object-assign.js","vendor.is-hotkey.js","vendor.obj-str.js","roots.js","userflow.js","vendor.phoenix.js","vendor.uuid.js","client-context.js","vendor.i18next.js","vendor.babel.runtime.js","vendor.react-i18next.js","use-window-resize.js","BuilderBar.js","Frame.js","vendor.react-dom.js","vendor.scheduler.js","stylesheets.js","vendor.fortawesome.pro-regular-svg-icons.js","vendor.fortawesome.pro-solid-svg-icons.js","flow-condition-types.js","vendor.date-fns.js","iframe-reset.styl.js","vendor.fortawesome.pro-light-svg-icons.js","SmartFlowRecordingApp.js","FlowApp.js","vendor.lodash.js","FlowChrome.js","flow-host.styl.js","use-selector-element-monitoring.js","logomark.js","use-confetti.js","vendor.canvas-confetti.js","TreeDoc.js","Trigger.js","steps.js","WorkflowApp.js","ChecklistApp.js","ChecklistUI.js","EmbedApp.js","use-element-rect.js","ResourceCenterLauncherHandler.js","ResourceCenterApp.js","AnnouncementEngagement.js","vendor.memoize-one.js","vendor.bignumber.js.js","LauncherApp.js","NotificationsApp.js","TrackerTestingApp.js","StartConditionTestingApp.js","Popover.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as s,R as e}from"./vendor.react.js";import{r as C}from"./vendor.react-dom.js";import{u as N,i as $,U as W}from"./client-context.js";import{R as J,_ as o,I as j,J as q,U as G}from"./userflow.js";import"./vendor.object-assign.js";import{I as K}from"./vendor.react-i18next.js";import"./vendor.scheduler.js";import"./vendor.i18next.js";import"./vendor.babel.runtime.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},n=new Error().stack;n&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[n]="35de5746-3a44-48ae-a5a8-d7c68fabdc7a",t._sentryDebugIdIdentifier="sentry-dbid-35de5746-3a44-48ae-a5a8-d7c68fabdc7a")}catch{}})();const M=e.lazy(()=>o(()=>import("./ElementSelectionApp.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]))),Q=e.lazy(()=>o(()=>import("./SmartFlowRecordingApp.js"),__vite__mapDeps([25,1,2,4,9,10,11,12,14,15,16,17,18,19,20,6,7,8,21,22,5,23,24,13]))),X=e.lazy(()=>o(()=>import("./FlowApp.js"),__vite__mapDeps([26,1,2,6,7,8,27,12,11,28,19,18,20,21,22,5,9,10,15,16,17,23,29,30,13,31,4,32,33,34,35,36]))),Y=e.lazy(()=>o(()=>import("./WorkflowApp.js"),__vite__mapDeps([37,1,2,6,7,8,36,9,10,11,12,5,34,21,22,18,19,20,4,29,28,15,16,17,23,30,13,31,32,33]))),Z=e.lazy(()=>o(()=>import("./ChecklistApp.js"),__vite__mapDeps([38,1,2,6,7,8,28,19,18,20,21,22,11,5,9,10,12,15,16,17,23,29,30,13,31,4,32,33,39,34]))),ee=e.lazy(j),te=e.lazy(()=>o(()=>import("./EmbedApp.js"),__vite__mapDeps([40,1,2,6,7,8,9,10,11,12,4,18,19,20,21,22,5,34,29,30,16,17,15,23,41,13,39]))),ne=e.lazy(q),se=e.lazy(()=>o(()=>import("./ResourceCenterLauncherHandler.js"),__vite__mapDeps([42,1,2,6,7,8,9,10,11,12,30,21,22,5,18,19,20,43,29,34,4,15,16,17,23,13,31,39,28,32,33,44,45,46,41]))),oe=e.lazy(()=>o(()=>import("./LauncherApp.js"),__vite__mapDeps([47,1,2,6,7,8,30,21,22,11,5,34,18,19,20,9,10,12,4,29,28,15,16,17,23,13,31,32,33,35]))),re=e.lazy(()=>o(()=>import("./NotificationsApp.js"),__vite__mapDeps([48,1,2,9,10,11,12,29,6,7,8,18,19,20,21,22,5]))),ie=e.lazy(()=>o(()=>import("./TrackerTestingApp.js"),__vite__mapDeps([49,1,2,9,10,11,12,14,15,16,17,18,19,20,6,7,8,21,22,5,23,4,24,13]))),ae=e.lazy(()=>o(()=>import("./StartConditionTestingApp.js"),__vite__mapDeps([50,1,2,9,10,11,12,14,15,16,17,18,19,20,6,7,8,21,22,5,23,4,24,13,51]))),ce=()=>{const t=N(),[n,p]=s.useState(t.getSessionStorageState()),[a,S]=s.useState(()=>m()?null:t.flowSession),[l,w]=s.useState(t.workflowSession),[i,v]=s.useState(t.checklistSession),[E,A]=s.useState(t.checklistExpanded),[u,g]=s.useState(t.bannerSession),[c,L]=s.useState(t.resourceCenterSession),[f,R]=s.useState(t.resourceCenterOpen),[d,I]=s.useState(t.resourceCenterLauncherHidden),[h,T]=s.useState(t.resourceCenterEmbedsChecklist()),[D,O]=s.useState(t.embedChecklistSessions()),[P,z]=s.useState(t.launcherSessions),[F,V]=s.useState(t.activeLauncherFlowId),[_,x]=s.useState(t.notifications),[U,H]=s.useState(t.embedSessions);s.useEffect(()=>{const r=()=>{p(t.getSessionStorageState()),S(B=>m()&&t.flowSession?.id!==B?.id?null:t.flowSession),v(t.checklistSession),A(t.checklistExpanded),g(t.bannerSession),L(t.resourceCenterSession),R(t.resourceCenterOpen),I(t.resourceCenterLauncherHidden),T(t.resourceCenterEmbedsChecklist()),O(t.embedChecklistSessions()),z(t.launcherSessions),V(t.activeLauncherFlowId),x(t.notifications),H(t.embedSessions),w(t.workflowSession)};t.on("uistatechange",r);const y=()=>{m()||S(t.flowSession)};return document.addEventListener("visibilitychange",y),()=>{t.off("uistatechange",r),document.removeEventListener("visibilitychange",y)}},[t]);const b=!n.activeApp&&!!a,k=c?.version.resourceCenter?.launcherType;return s.useLayoutEffect(()=>{if(b)return t.emit("flowvisibilitychange",!0),()=>{t.emit("flowvisibilitychange",!1)}},[t,b]),n.activeApp==="elementSelection"&&n.elementSelection?e.createElement(e.Suspense,{fallback:null},e.createElement(M,{state:n.elementSelection})):n.activeApp==="trackerTesting"&&n.trackerTesting?e.createElement(e.Suspense,{fallback:null},e.createElement(ie,{state:n.trackerTesting})):n.activeApp==="smartFlowRecording"&&n.smartFlowRecording?e.createElement(e.Suspense,{fallback:null},e.createElement(Q,{state:n.smartFlowRecording})):e.createElement(e.Fragment,null,l&&e.createElement(e.Suspense,{fallback:null},e.createElement(Y,{key:l.id,session:l})),a&&e.createElement(e.Suspense,{fallback:null},e.createElement(X,{key:a.id,session:a,checklistSession:i,resourceCenterEmbedsChecklist:h})),i&&!h&&!D&&(E||i.version.checklist?.launcherEnabled)&&e.createElement(e.Suspense,{fallback:null},e.createElement(Z,{key:i.id,session:i,checklistExpanded:E})),u&&e.createElement(e.Suspense,{fallback:null},e.createElement(ee,{key:u.id,session:u})),c&&e.createElement(e.Fragment,null,e.createElement(e.Suspense,{fallback:null},e.createElement(ne,{key:`${c.id}-${d}-${k}`,session:c,isOpen:f,flowSession:a,checklistSession:i,resourceCenterLauncherHidden:d})),k!==J.DEFAULT&&e.createElement(e.Suspense,{fallback:null},e.createElement(se,{session:c,isOpen:f,flowSession:a,resourceCenterLauncherHidden:d}))),e.createElement(e.Suspense,{fallback:null},P.map(r=>e.createElement(oe,{key:r.flow.id,session:r,active:r.flow.id===F}))),_.length>0&&e.createElement(e.Suspense,{fallback:null},e.createElement(re,{notifications:_})),n.activeApp==="startConditionTesting"&&n.testStartConditionToken&&e.createElement(e.Suspense,{fallback:null},e.createElement(ae,{token:n.testStartConditionToken})),U.map(r=>e.createElement(e.Suspense,{key:r.id,fallback:null},e.createElement(te,{session:r,checklistSession:i,type:"embed"}))))};function m(){return document.visibilityState==="hidden"}const le=({client:t})=>e.createElement(K,{i18n:$},e.createElement(W.Provider,{value:t},e.createElement(ce,null)));class ye{constructor(n){this.client=n}mount(){if(this.container)throw new G("UI has already been mounted");this.container=document.createElement("div"),this.container.id="userflow-ui",document.body.appendChild(this.container),C.render(e.createElement(le,{client:this.client}),this.container)}unmount(){this.container&&(C.unmountComponentAtNode(this.container),document.body.contains(this.container)&&document.body.removeChild(this.container),delete this.container)}}export{ye as RealUI};
|
|
3
3
|
//# sourceMappingURL=ui.js.map
|
package/userflow.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["ResourceCenterApp.js","vendor.react.js","vendor.object-assign.js","client-context.js","vendor.i18next.js","vendor.babel.runtime.js","vendor.react-i18next.js","flow-host.styl.js","TreeDoc.js","flow-condition-types.js","vendor.date-fns.js","roots.js","stylesheets.js","vendor.fortawesome.pro-regular-svg-icons.js","vendor.fortawesome.pro-solid-svg-icons.js","vendor.obj-str.js","use-selector-element-monitoring.js","Frame.js","vendor.react-dom.js","vendor.scheduler.js","iframe-reset.styl.js","use-window-resize.js","logomark.js","ChecklistUI.js","FlowChrome.js","use-confetti.js","vendor.canvas-confetti.js","AnnouncementEngagement.js","vendor.memoize-one.js","vendor.bignumber.js.js","use-element-rect.js","
|
|
2
|
-
import"./vendor.object-assign.js";import{S as J}from"./vendor.phoenix.js";import{v as b}from"./vendor.uuid.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="36fa7c4f-8d7f-48bc-8bfa-a0f5d0770ceb",e._sentryDebugIdIdentifier="sentry-dbid-36fa7c4f-8d7f-48bc-8bfa-a0f5d0770ceb")}catch{}})();const Q="modulepreload",X=function(e){return new URL("./",import.meta.url).toString()+e},D={},I=function(t,s,n){let i=Promise.resolve();if(s&&s.length>0){let u=function(c){return Promise.all(c.map(E=>Promise.resolve(E).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=a?.nonce||a?.getAttribute("nonce");i=u(s.map(c=>{if(c=X(c),c in D)return;D[c]=!0;const E=c.endsWith(".css"),g=E?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${g}`))return;const T=document.createElement("link");if(T.rel=E?"stylesheet":Q,E||(T.as="script"),T.crossOrigin="",T.href=c,l&&T.setAttribute("nonce",l),document.head.appendChild(T),E)return new Promise((Y,z)=>{T.addEventListener("load",Y),T.addEventListener("error",()=>z(new Error(`Unable to preload CSS for ${c}`)))})}))}function r(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return i.then(a=>{for(const l of a||[])l.status==="rejected"&&r(l.reason);return t().catch(r)})};class h extends Error{constructor(t,s,n){super(t),Object.setPrototypeOf(this,h.prototype),this.name="UserflowError",this.code=s,this.humanMessage=n}}class G{constructor(t){this.type=t,this.testState={}}formatKey(t){return`userflow:${t}`}isSupported(){if(typeof window>"u")return!1;try{return window[this.type]!=null}catch{return!1}}getItem(t){return t=this.formatKey(t),this.isSupported()?window[this.type].getItem(t):null}setItem(t,s){t=this.formatKey(t);{if(!this.isSupported())return;window[this.type].setItem(t,s)}}removeItem(t){return t=this.formatKey(t),this.isSupported()?window[this.type].removeItem(t):void 0}clear(){return this.isSupported()?window[this.type].clear():void 0}}const C=new G("localStorage"),d=new G("sessionStorage");function ft(e){window.location.href=e}function m(){return window.location.href}function A(e){window.postMessage(e,window.origin)}function x(e){const t=n=>{if(n.source!==window||n.origin!==window.origin)return;const i=n.data;!i||typeof i!="object"||typeof i.kind!="string"||!i.kind.startsWith("userflow:")||e(i)===!0&&s()};window.addEventListener("message",t);const s=()=>window.removeEventListener("message",t);return s}function Z(e){return new Promise(t=>{x(s=>{const n=e(s);return n?(t(n),!0):!1})})}const v=new Set;let y=!1;function q(e){return ee(),v.add(e),()=>{F(e)}}function F(e){v.delete(e)}function k(){v.forEach(e=>e())}function ee(){if(y)return;y=!0;const{history:e}=window,t=s=>{const n=e[s];e[s]=(...i)=>{const r=n.apply(e,i);return k(),r}};window.__userflowStatePatched?(window.addEventListener("userflow:pushstate",()=>{k()}),window.addEventListener("userflow:replacestate",()=>{k()})):(t("pushState"),t("replaceState")),window.addEventListener("popstate",()=>{k()})}class te{destroy(){this.unregisterOnMessage&&this.unregisterOnMessage()}postBuilderMessage(t){A({kind:"userflow:crxSendProxyMessage",direction:"targetToBuilder",message:t})}onBuilderMessage(t){return this.unregisterOnMessage=x(t),!1}async captureScreenshot(t,s,n,i){return A({kind:"userflow:crxScreenshot",x:t,y:s,width:n,height:i,devicePixelRatio:window.devicePixelRatio}),(await Z(a=>a.kind==="userflow:crxScreenshotResult"?a:null)).imageDataUrl}}var U=(e=>(e.ACTION="ACTION",e.ELEMENT_MISSING="ELEMENT_MISSING",e.LAUNCHER_DEACTIVATED="LAUNCHER_DEACTIVATED",e.WORKFLOW_TIMED_OUT="WORKFLOW_TIMED_OUT",e.REPLACED="REPLACED",e.SNOOZED="SNOOZED",e.TOOLTIP_TARGET_MISSING="TOOLTIP_TARGET_MISSING",e.USERFLOWJS="USERFLOWJS",e.USER_CLOSED="USER_CLOSED",e))(U||{}),se=(e=>(e.POSITIVE="POSITIVE",e.NEUTRAL="NEUTRAL",e.NEGATIVE="NEGATIVE",e))(se||{}),ie=(e=>(e.USER_INPUT_TIMEOUT="USER_INPUT_TIMEOUT",e.STEP_TIMEOUT="STEP_TIMEOUT",e))(ie||{}),ne=(e=>(e.SECOND="SECOND",e.MINUTE="MINUTE",e.HOUR="HOUR",e.DAY="DAY",e))(ne||{}),p=(e=>(e.ACTION="ACTION",e.DRAFT="DRAFT",e.LINK="LINK",e.LAUNCHER_SEEN="LAUNCHER_SEEN",e.RESOURCE_CENTER="RESOURCE_CENTER",e.USERFLOWJS="USERFLOWJS",e.ASSISTANT="ASSISTANT",e))(p||{}),re=(e=>(e.LIKE="LIKE",e.DISLIKE="DISLIKE",e))(re||{}),S=(e=>(e.STRING="STRING",e.BOOLEAN="BOOLEAN",e.NUMBER="NUMBER",e.DATETIME="DATETIME",e.LIST="LIST",e.RANDOM_AB="RANDOM_AB",e.RANDOM_NUMBER="RANDOM_NUMBER",e.CHECKLIST_TASK="CHECKLIST_TASK",e.FLOW="FLOW",e.FLOW_SESSION="FLOW_SESSION",e.FLOW_STEP="FLOW_STEP",e.FLOW_VERSION="FLOW_VERSION",e))(S||{}),L=(e=>(e.FLOW="FLOW",e.BANNER="BANNER",e.EMBED="EMBED",e.CHECKLIST="CHECKLIST",e.LAUNCHER="LAUNCHER",e.RESOURCE_CENTER="RESOURCE_CENTER",e.SITE="SITE",e.WORKFLOW="WORKFLOW",e))(L||{}),oe=(e=>(e.ALWAYS_TRUE="ALWAYS_TRUE",e.ATTRIBUTE="ATTRIBUTE",e.CHECKLIST_TASK_CLICKED="CHECKLIST_TASK_CLICKED",e.CLAUSE="CLAUSE",e.ELEMENT="ELEMENT",e.EVENT="EVENT",e.FILLED_IN_INPUT="FILLED_IN_INPUT",e.FLOW="FLOW",e.INPUT_VALUE="INPUT_VALUE",e.PAGE="PAGE",e.SEGMENT="SEGMENT",e.TIME="TIME",e))(oe||{}),ae=(e=>(e.AUTO="AUTO",e.MANUAL="MANUAL",e))(ae||{}),ce=(e=>(e.INPUT="INPUT",e))(ce||{}),le=(e=>(e.ABSOLUTE_EQ="ABSOLUTE_EQ",e.ABSOLUTE_GT="ABSOLUTE_GT",e.ABSOLUTE_LT="ABSOLUTE_LT",e.AND="AND",e.BETWEEN="BETWEEN",e.CONTAINS="CONTAINS",e.EMPTY="EMPTY",e.ENDS_WITH="ENDS_WITH",e.EQ="EQ",e.EXCLUDES_ALL="EXCLUDES_ALL",e.EXCLUDES_ANY="EXCLUDES_ANY",e.FALSE="FALSE",e.GT="GT",e.GTE="GTE",e.INCLUDES_ALL="INCLUDES_ALL",e.INCLUDES_ANY="INCLUDES_ANY",e.LT="LT",e.LTE="LTE",e.NE="NE",e.NOT_CONTAINS="NOT_CONTAINS",e.NOT_EMPTY="NOT_EMPTY",e.NOT_REGEX="NOT_REGEX",e.OR="OR",e.REGEX="REGEX",e.RELATIVE_EQ="RELATIVE_EQ",e.RELATIVE_GT="RELATIVE_GT",e.RELATIVE_LT="RELATIVE_LT",e.STARTS_WITH="STARTS_WITH",e.TRUE="TRUE",e.URL="URL",e))(le||{}),ue=(e=>(e.CLICK="CLICK",e.DISABLED="DISABLED",e.MOUSEDOWN="MOUSEDOWN",e.NOT_CLICK="NOT_CLICK",e.NOT_DISABLED="NOT_DISABLED",e.NOT_PRESENT="NOT_PRESENT",e.PRESENT="PRESENT",e))(ue||{}),he=(e=>(e.END_USER="END_USER",e.GROUP="GROUP",e))(he||{}),de=(e=>(e.BETWEEN="BETWEEN",e.EQ="EQ",e.GTE="GTE",e.LTE="LTE",e))(de||{}),fe=(e=>(e.ANY="ANY",e.RELATIVE_BETWEEN="RELATIVE_BETWEEN",e.RELATIVE_GT="RELATIVE_GT",e.RELATIVE_LT="RELATIVE_LT",e))(fe||{}),Ee=(e=>(e.CURRENT_USER="CURRENT_USER",e.CURRENT_USER_CURRENT_GROUP="CURRENT_USER_CURRENT_GROUP",e.CURRENT_GROUP="CURRENT_GROUP",e))(Ee||{}),Se=(e=>(e.ASSET="ASSET",e.CARTOON="CARTOON",e.NONE="NONE",e.URL="URL",e))(Se||{}),Te=(e=>(e.INSIDE="INSIDE",e.OUTSIDE="OUTSIDE",e))(Te||{}),Ie=(e=>(e.TOP_LEFT="TOP_LEFT",e.TOP_CENTER="TOP_CENTER",e.TOP_RIGHT="TOP_RIGHT",e.BOTTOM_RIGHT="BOTTOM_RIGHT",e.BOTTOM_CENTER="BOTTOM_CENTER",e.BOTTOM_LEFT="BOTTOM_LEFT",e.CENTER="CENTER",e))(Ie||{}),ge=(e=>(e.GOOGLE="GOOGLE",e.STANDARD="STANDARD",e))(ge||{}),we=(e=>(e.DISMISS_FIRST_MENU_AFTER="DISMISS_FIRST_MENU_AFTER",e.DISMISS="DISMISS",e))(we||{}),Ce=(e=>(e.DISMISS="DISMISS",e.NONE="NONE",e))(Ce||{}),ke=(e=>(e.DEFAULT="DEFAULT",e.NARROW="NARROW",e.CHAINED_SQUARED="CHAINED_SQUARED",e.CHAINED_ROUNDED="CHAINED_ROUNDED",e.DOTTED="DOTTED",e.NUMBERED="NUMBERED",e))(ke||{}),me=(e=>(e.TOP="TOP",e.BOTTOM="BOTTOM",e))(me||{}),Ue=(e=>(e.DEFAULT="DEFAULT",e.PLAINTEXT="PLAINTEXT",e.CUSTOM="CUSTOM",e))(Ue||{}),Le=(e=>(e.CHECKLIST_OVERRIDE="CHECKLIST_OVERRIDE",e.RESOURCE_CENTER_ONLY="RESOURCE_CENTER_ONLY",e.NONE="NONE",e))(Le||{}),pe=(e=>(e.BUBBLE="BUBBLE",e.END="END",e.ERROR="ERROR",e.FLAG="FLAG",e))(pe||{}),_e=(e=>(e.MANUAL="MANUAL",e.NONE="NONE",e.SYNTHETIC="SYNTHETIC",e))(_e||{}),Ne=(e=>(e.BUBBLE="BUBBLE",e.HIDDEN="HIDDEN",e.MODAL="MODAL",e.TOOLTIP="TOOLTIP",e))(Ne||{}),Ae=(e=>(e.ABOVE="ABOVE",e.BELOW="BELOW",e.LEFT="LEFT",e.RIGHT="RIGHT",e))(Ae||{}),Re=(e=>(e.CLOSE_FLOW="CLOSE_FLOW",e.EVAL_JS="EVAL_JS",e.GO_TO_STEP="GO_TO_STEP",e.NAVIGATE="NAVIGATE",e.SET_ATTRIBUTE="SET_ATTRIBUTE",e.SNOOZE="SNOOZE",e.START_FLOW="START_FLOW",e.TRACK_BUTTON_EVENT="TRACK_BUTTON_EVENT",e))(Re||{}),ve=(e=>(e.NEW_TAB="NEW_TAB",e.SAME_TAB="SAME_TAB",e))(ve||{}),Oe=(e=>(e.SET="SET",e.SET_DATETIME="SET_DATETIME",e.SET_DATETIME_ONCE="SET_DATETIME_ONCE",e.SET_ONCE="SET_ONCE",e.ADD="ADD",e.SUBTRACT="SUBTRACT",e.APPEND="APPEND",e.PREPEND="PREPEND",e.REMOVE="REMOVE",e.UNSET="UNSET",e))(Oe||{}),be=(e=>(e.MULTILINE_TEXT="MULTILINE_TEXT",e.MULTIPLE_CHOICE="MULTIPLE_CHOICE",e.NPS="NPS",e.SCALE="SCALE",e.STARS="STARS",e.TEXT="TEXT",e))(be||{}),De=(e=>(e.CLICK="CLICK",e.FILL="FILL",e.NAVIGATE="NAVIGATE",e))(De||{}),R=(e=>(e.ACTION="ACTION",e.ANNOUNCEMENTS="ANNOUNCEMENTS",e.ASSISTANT="ASSISTANT",e.CHECKLIST="CHECKLIST",e.CONTACT="CONTACT",e.DIVIDER="DIVIDER",e.FLOWS="FLOWS",e.KNOWLEDGE_BASE="KNOWLEDGE_BASE",e.MESSAGE="MESSAGE",e.SUBPAGE="SUBPAGE",e))(R||{}),ye=(e=>(e.CRISP="CRISP",e.CUSTOM="CUSTOM",e.FRESHCHAT="FRESHCHAT",e.HELPSCOUT="HELPSCOUT",e.HUBSPOT="HUBSPOT",e.INTERCOM="INTERCOM",e.ZENDESK="ZENDESK",e.ZENDESK_MESSENGER="ZENDESK_MESSENGER",e))(ye||{}),Me=(e=>(e.BUTTON="BUTTON",e.INPUT="INPUT",e))(Me||{}),Pe=(e=>(e.EMAIL="EMAIL",e.PHONE="PHONE",e.CHAT="CHAT",e))(Pe||{}),Be=(e=>(e.SILENT="SILENT",e.BADGE="BADGE",e.POPOUT="POPOUT",e.MODAL="MODAL",e.TOAST="TOAST",e))(Be||{}),He=(e=>(e.DEFAULT="DEFAULT",e.CUSTOM="CUSTOM",e.NONE="NONE",e))(He||{}),We=(e=>(e.LAUNCHER_CLICK="LAUNCHER_CLICK",e.LAUNCHER_HOVER="LAUNCHER_HOVER",e.TARGET_CLICK="TARGET_CLICK",e.TARGET_HOVER="TARGET_HOVER",e.LAUNCHER_TARGET_CLICK="LAUNCHER_TARGET_CLICK",e.LAUNCHER_TARGET_HOVER="LAUNCHER_TARGET_HOVER",e))(We||{}),V=(e=>(e.ACTIVATE="ACTIVATE",e.DEACTIVATE="DEACTIVATE",e.NEVER="NEVER",e))(V||{}),Ge=(e=>(e.AUTO="AUTO",e.TOP="TOP",e.RIGHT="RIGHT",e.BOTTOM="BOTTOM",e.LEFT="LEFT",e))(Ge||{}),xe=(e=>(e.START="START",e.CENTER="CENTER",e.END="END",e))(xe||{}),Fe=(e=>(e.PERCENT="PERCENT",e.PX="PX",e))(Fe||{}),Ve=(e=>(e.BEACON="BEACON",e.BUTTON="BUTTON",e.HIDDEN="HIDDEN",e.ICON="ICON",e))(Ve||{}),Ke=(e=>(e.LAUNCHER="LAUNCHER",e.TARGET="TARGET",e))(Ke||{}),$e=(e=>(e.BODY_FIRST="BODY_FIRST",e.BODY_LAST="BODY_LAST",e.ELEMENT_FIRST="ELEMENT_FIRST",e.ELEMENT_LAST="ELEMENT_LAST",e.ELEMENT_BEFORE="ELEMENT_BEFORE",e.ELEMENT_AFTER="ELEMENT_AFTER",e))($e||{}),je=(e=>(e.BODY_FIRST="BODY_FIRST",e.BODY_LAST="BODY_LAST",e.ELEMENT_FIRST="ELEMENT_FIRST",e.ELEMENT_LAST="ELEMENT_LAST",e.ELEMENT_BEFORE="ELEMENT_BEFORE",e.ELEMENT_AFTER="ELEMENT_AFTER",e))(je||{}),K=(e=>(e.CHECKLIST="CHECKLIST",e))(K||{}),Ye=(e=>(e.INITIAL="INITIAL",e.FOLLOWUP="FOLLOWUP",e))(Ye||{}),ze=(e=>(e.FLOW="FLOW",e.WORKFLOW="WORKFLOW",e))(ze||{}),Je=(e=>(e.HIDE="HIDE",e.OTHERS="OTHERS",e))(Je||{}),Qe=(e=>(e.ALWAYS="ALWAYS",e.MULTIPLE="MULTIPLE",e.NEVER="NEVER",e.ONCE="ONCE",e.ONCE_PER_GROUP="ONCE_PER_GROUP",e))(Qe||{}),Xe=(e=>(e.NONE="NONE",e.PENDING_SCHEDULE="PENDING_SCHEDULE",e.SCHEDULED="SCHEDULED",e.FIRED="FIRED",e))(Xe||{}),Ze=(e=>(e.NONE="NONE",e.LIKE="LIKE",e.SCALE="SCALE",e))(Ze||{}),qe=(e=>(e.HIDE="HIDE",e.BLOCK="BLOCK",e.OTHERS="OTHERS",e))(qe||{});function et(){return{customInputs:[],customNavigate:null,urlFilter:null,linkUrlDecorator:null,customScrollIntoView:null,scrollPadding:null,inferenceAttributeNames:["data-for","data-id","data-testid","data-test-id","for","id","name","placeholder","role"],inferenceAttributeFilters:{id:[e=>!e.match(/\d$/)],"data-id":[e=>!e.match(/\d$/)]},inferenceClassNameFilters:[e=>!e.startsWith("css-")],baseZIndex:1234500,evalJsDisabled:!1}}const f=et();function M(e){return Array.isArray(e)||(e=e?[e]:[]),e=e.map(t=>typeof t=="string"?new RegExp(t):t),e}function Et(e,t){return e.every(s=>typeof s=="function"?s(t):s instanceof RegExp?s.test(t):!0)}function tt(){let e=m();if(f.urlFilter){if(e=f.urlFilter(e),typeof e!="string")throw new h("Userflow.js: URL filter returned non-string value. Please check your userflow.setUrlFilter() implementation.");try{new URL(e)}catch(t){throw new h(`Userflow.js: URL filter returned an invalid URL. Please check your userflow.setUrlFilter() implementation.
|
|
3
|
-
Returned URL: `+
|
|
4
|
-
Error message: `+t.message)}}return e}let $="";try{$=localStorage.getItem("debug")||""}catch{}const j=$.split(",").some(e=>e==="*"||e.startsWith("userflow:*")),o=O("log");o.group=O("group");o.groupCollapsed=O("groupCollapsed");o.groupEnd=function(){j&&console.groupEnd()};let _;function O(e){return function(t,...s){if(j){const n=performance.now(),i=_?Math.round(n-_):0;_=n,console[e](`%cuserflow %c${t} %c+${i}ms`,"color:#1a57e6;","","color:#1a57e6;",...s)}}}const st=()=>I(()=>import("./ResourceCenterApp.js").then(e=>e.R),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]));function it(e){const s=e.version.checklist.tasks.length;return Math.max(0,s-e.taskCompletions.length)}class P{constructor(t){this.observers=new Set,this._value=t}get value(){return this._value}update(t){if(t!==this._value){this._value=t;for(const s of this.observers)s()}}observe(t){return this.observers.add(t),()=>this.observers.delete(t)}}const B=["page:before-change","page:change","turbo:before-cache","turbo:load","turbo:visit","turbolinks:before-cache","turbolinks:load","turbolinks:visit","livewire:navigated","livewire:navigating","livewire:update"],nt=()=>I(()=>import("./BannerApp.js"),__vite__mapDeps([32,1,2,3,4,5,6,15,12,13,14,9,10,11,8,7,16,18,19,17,20,30,21,33,34])),N="1026519",rt=import.meta.url,H=50,ot=300*1e3,W="userflowClientState",w="userflowClientSiteId";class at{constructor(){this.clientToken=null,this.externalId=null,this.signature=null,this.groupId=null,this.groupSignature=null,this._socketStatus="disconnected",this.socket=null,this.channel=null,this.logrocketAppId=null,this.debounceInactiveDisconnectTimeout=void 0,this.inBatch=!1,this.endBatchTimeout=void 0,this.pushRateLimitMinute=0,this.pushRateLimitMinuteExpires=0,this.clientClock=1,this.serverClock=1,this.flowSession=null,this.flowSessionClock=0,this.checklistSession=null,this.checklistExpanded=!1,this.checklistExpandPending=!1,this.checklistSessionClock=0,this.bannerSession=null,this.resourceCenterSession=null,this.resourceCenterOpen=!1,this.resourceCenterLauncherHidden=null,this.siteSession=null,this.launcherSessions=[],this.activeLauncherFlowId=null,this.notifications=[],this.embedSessions=[],this.workflowSession=null,this.notificationIdCounter=0,this.sessionStorageState=null,this.clientContext=null,this.flushUrlChangeTimeout=void 0,this.onFirstIdentifyRun=!1,this.onFirstIdentifyTimeout=void 0,this.firstIdentifyCallback=null,this.ui=null,this.debuggerUI=null,this.debuggerMountInProgress=!1,this.unackedTasks=new Set,this.clientConditions=new Map,this.trackers=new Map,this.conditionWaitTimers=new Map,this.listeners=new Map,this.targetEnv=null,this.idempotencyKeysSeen=new Set,this.testUserIdentified=!1,this.cspIssueReported=!1,this.uiDisabled=!1,this.audio=null,this.audioReady=!1,this.pageTrackingDisabled=!1,this.refCounter=1,this.implicitTracking=null,this.initialMessagesQueue=[],this.onBuilderMessage=t=>(this.handleBuilderMessage(t),!1),this.handleBuilderMessage=async t=>{o(`builder ${t.kind} message received`,t);const s="idempotencyKey"in t&&typeof t.idempotencyKey=="string"?t.idempotencyKey:null;if(s&&this.idempotencyKeysSeen.has(s))return;const n=()=>{s&&this.idempotencyKeysSeen.add(s)};switch(t.kind){case"userflow:selectElement":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:selectElementAck",idempotencyKey:t.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0,activeApp:"elementSelection",elementSelection:{mode:"select",elementType:t.elementType}}));return}case"userflow:selectElementCancel":{this.setSessionStorageState(i=>({...i,activeApp:null,elementSelection:null}));return}case"userflow:startFlowWithToken":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:startFlowWithTokenAck",idempotencyKey:t.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0,activeApp:null,testStartConditionToken:void 0})),d.setItem("previewFlowId",t.flowId),t.testUser?this.identifyTestUser(t.testUser):this.resetTestUser(),t.testStartCondition?this.setSessionStorageState(i=>({...i,activeApp:"startConditionTesting",testStartConditionToken:t.token})):this.onceIdentified(()=>{if(this.startFlowWithToken(t.token),t.isResourceCenter){const i=()=>{const r=this.resourceCenterSession;r&&r.draftMode&&r.flow.id===t.flowId&&(this.openResourceCenter(),this.off("resourceCenterChanged",i))};this.on("resourceCenterChanged",i),i()}});return}case"userflow:testTracker":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:testTrackerAck",idempotencyKey:t.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0})),t.testUser?this.identifyTestUser(t.testUser):this.resetTestUser(),this.setSessionStorageState(i=>({...i,activeApp:"trackerTesting",trackerTesting:{trackerName:t.trackerName,token:t.token,events:0}}));return}case"userflow:testTrackerCancel":{this.setSessionStorageState(i=>({...i,activeApp:null,trackerTesting:null}));return}case"userflow:startSmartFlow":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:startSmartFlowAck",idempotencyKey:t.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0,activeApp:"smartFlowRecording",smartFlowRecording:{sessionId:t.sessionId,isRecording:!0,startUrl:t.startUrl||null}}));return}case"userflow:smartFlowCancel":{this.setSessionStorageState(i=>({...i,activeApp:null,smartFlowRecording:null}));return}case"userflow:smartFlowStartOverAck":return;case"userflow:smartFlowComplete":{this.setSessionStorageState(i=>({...i,activeApp:null,smartFlowRecording:null}));return}}},this.onUrlChange=()=>{this.externalId&&(window.clearTimeout(this.flushUrlChangeTimeout),this.flushUrlChangeTimeout=window.setTimeout(()=>this.flushUrlChange(),H))},this.onUserActivity=()=>this.ensureConnected(),this.mountSitePage=async(t,s)=>{d.setItem(w,s),o("mounting site page"),this.setResourceCenterLauncherHidden(!0);try{const{SitePage:n}=await I(async()=>{const{SitePage:r}=await import("./SitePage.js");return{SitePage:r}},__vite__mapDeps([35,1,2,3,4,5,6,18,19,36,37,38,39,40,41,42,43,44,45,27,15,12,13,14,9,10,11,25,26,20,8,46,28,47,48,33,34]));new n(this,t).mount(),o("site page mounted")}catch(n){console.error("Userflow: Failed to mount site page",n)}},this.remountIfNecessary=()=>{!this.ui?.container||document.contains(this.ui.container)||(o("remounting UI because container was missing"),this.remount())},o("constructor, build="+N),q(this.onUrlChange),this.setTargetEnv(new te),this.checkTestUserAtBoot(),this.toggleUI(),this.checkDebuggerSession();for(const t of B)document.addEventListener(t,this.remountIfNecessary)}get socketStatus(){return this._socketStatus}destroy(){o("destroy"),this.reset(),F(this.onUrlChange),this.destroyTargetEnv();for(const t of B)document.removeEventListener(t,this.remountIfNecessary)}setTargetEnv(t){this.destroyTargetEnv(),this.targetEnv=t,t.onBuilderMessage(this.onBuilderMessage)}destroyTargetEnv(){this.targetEnv&&(this.targetEnv.destroy(),this.targetEnv=null)}getTargetEnv(){if(!this.targetEnv)throw new h("Userflow.js: Cannot call getTargetEnv when protocol is not set");return this.targetEnv}setSessionStorageState(t){const s=t(this.getSessionStorageState());d.setItem(W,JSON.stringify(s)),this.sessionStorageState=s,this.toggleUI()}getSessionStorageState(){let t=this.sessionStorageState;if(!t){const s=d.getItem(W);if(s)try{t=JSON.parse(s)}catch(n){console.error("Userflow.js: Parse ElementSelectionState error:",n)}t||(t={testUser:null,activeApp:null,elementSelection:null,trackerTesting:null}),this.sessionStorageState=t}return t}checkTestUserAtBoot(){const t=this.getSessionStorageState().testUser;t&&(o("checkTestUserAtBoot identifying test user"),this.identifyTestUser(t))}async identifyTestUser(t){this.setSessionStorageState(i=>({...i,testUser:t})),this.reset(),this.init(t.clientToken),this.testUserIdentified=!0,this.externalId=t.id;const s=[this.identify(t.id,{name:t.name,email:t.email,signed_up_at:{set_once:new Date().toISOString(),data_type:"datetime"}},{signature:t.signature})],{group:n}=t;n&&(this.groupId=n.id,s.push(this.group(n.id,{name:n.name},{signature:n.signature}))),await Promise.all(s)}resetTestUser(){this.setSessionStorageState(t=>({...t,testUser:null}))}init(t){if(o("init",t),!t)throw new h("userflow.init() was called but missing Userflow.js Token");if(this.clientToken!==t){if(this.testUserIdentified){o("init() ignoring new token since a test user has been identified");return}this.clientToken&&(o("init() resetting due to new client token"),this.reset()),this.clientToken=t,this.emit("private:initialised")}}ensureInit(){if(!this.clientToken)throw new h("You must call userflow.init() first")}ensureIdentified(){if(this.ensureInit(),!this.externalId)throw new h("You must call userflow.identify() first");return this.externalId}ensureGroup(){if(this.ensureIdentified(),!this.groupId)throw new h("You must call userflow.group() first");return this.groupId}ensureConnected(){if(!this.clientToken||!this.externalId||(this.debounceInactiveDisconnect(),this.socket))return;this._socketStatus="connecting",o("connecting to socket");const t=/^ct_eu\d+_.+$/.test(this.clientToken)?"e.eu.":"e.";let s=f.serverEndpoint||t+"userflow.com";new URL(rt).hostname==="js.getuserflow.com"&&s==="e.userflow.com"&&(s="e.getuserflow.com");const n="wss://"+s+"/end-users/"+this.clientToken+"/socket";this.socket=new J(n,{reconnectAfterMs:i=>[100,500,1e3,5e3][i-1]||1e4,timeout:20*1e3}),this.socket.connect(),this.socket.onOpen(()=>{o("socket opened")}),this.socket.onClose(()=>{this.emit("private:disconnect")}),this.socket.onError(i=>{console.log("Userflow.js socket error",i),this.reportCspIssue()}),this.channel=this.socket.channel(`end_users:${this.externalId}`,()=>this.makeChannelJoinPayload()),this.channel.join().receive("ok",i=>{typeof this.featureFlags>"u"&&this.clearInitialMessagesQueue(i.featureFlags),this.logrocketAppId=i.logrocketAppId,this.featureFlags=new Set(i.featureFlags),o("channel joined"),this._socketStatus!=="connected"&&(this._socketStatus="connected"),this.featureFlagEnabled("cff_implicit_events")===!0&&!this.implicitTracking&&this.startImplicitTracking(),!this.featureFlagEnabled("cff_implicit_events")&&this.implicitTracking&&(this.implicitTracking.stop(),this.implicitTracking=null)}).receive("error",i=>{["company_closed","invalid_client_token","invalid_user_external_id","incorrect_user_signature","rate_limit_exceeded","user_signature_required"].includes(i.code)?(console.error(`Userflow.js resetting due to: [${i.code}] ${i.message}`),this.reset(),this.clientToken=null):i.code==="invalid_protocol_version"?(console.error(`Userflow.js destroying due to: [${i.code}] ${i.message}`),this.destroy()):console.log("Userflow.js channel join error",i)}),this.channel.on("server_message",i=>this.handleServerMessage(i)),this.channel.on("server_error",i=>{console.log(`Userflow.js server error (${i.code}): ${i.message}`+(i.details&&i.details.length>0?`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["ResourceCenterApp.js","vendor.react.js","vendor.object-assign.js","client-context.js","vendor.i18next.js","vendor.babel.runtime.js","vendor.react-i18next.js","flow-host.styl.js","TreeDoc.js","flow-condition-types.js","vendor.date-fns.js","roots.js","stylesheets.js","vendor.fortawesome.pro-regular-svg-icons.js","vendor.fortawesome.pro-solid-svg-icons.js","vendor.obj-str.js","use-selector-element-monitoring.js","Frame.js","vendor.react-dom.js","vendor.scheduler.js","iframe-reset.styl.js","use-window-resize.js","logomark.js","ChecklistUI.js","FlowChrome.js","use-confetti.js","vendor.canvas-confetti.js","AnnouncementEngagement.js","vendor.memoize-one.js","vendor.bignumber.js.js","use-element-rect.js","BannerApp.js","vendor.phoenix.js","vendor.uuid.js","SitePage.js","vendor.react-router-dom.js","vendor.react-router.js","vendor.prop-types.js","vendor.history.js","vendor.resolve-pathname.js","vendor.value-equal.js","vendor.tiny-invariant.js","vendor.mini-create-react-context.js","vendor.path-to-regexp.js","vendor.react-is.js","Popover.js","react-hooks.js","vendor.lodash.js","implicit-tracking.js","DebuggerUI.js","ui.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import"./vendor.object-assign.js";import{S as J}from"./vendor.phoenix.js";import{v as b}from"./vendor.uuid.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="2f9be05c-f03f-4fe9-a1da-83f442473746",t._sentryDebugIdIdentifier="sentry-dbid-2f9be05c-f03f-4fe9-a1da-83f442473746")}catch{}})();const Q="modulepreload",X=function(t){return new URL("./",import.meta.url).toString()+t},D={},I=function(e,s,n){let i=Promise.resolve();if(s&&s.length>0){let u=function(c){return Promise.all(c.map(E=>Promise.resolve(E).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=a?.nonce||a?.getAttribute("nonce");i=u(s.map(c=>{if(c=X(c),c in D)return;D[c]=!0;const E=c.endsWith(".css"),g=E?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${g}`))return;const T=document.createElement("link");if(T.rel=E?"stylesheet":Q,E||(T.as="script"),T.crossOrigin="",T.href=c,l&&T.setAttribute("nonce",l),document.head.appendChild(T),E)return new Promise((Y,z)=>{T.addEventListener("load",Y),T.addEventListener("error",()=>z(new Error(`Unable to preload CSS for ${c}`)))})}))}function r(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return i.then(a=>{for(const l of a||[])l.status==="rejected"&&r(l.reason);return e().catch(r)})};class d extends Error{constructor(e,s,n){super(e),Object.setPrototypeOf(this,d.prototype),this.name="UserflowError",this.code=s,this.humanMessage=n}}class G{constructor(e){this.type=e,this.testState={}}formatKey(e){return`userflow:${e}`}isSupported(){if(typeof window>"u")return!1;try{return window[this.type]!=null}catch{return!1}}getItem(e){return e=this.formatKey(e),this.isSupported()?window[this.type].getItem(e):null}setItem(e,s){e=this.formatKey(e);{if(!this.isSupported())return;window[this.type].setItem(e,s)}}removeItem(e){return e=this.formatKey(e),this.isSupported()?window[this.type].removeItem(e):void 0}clear(){return this.isSupported()?window[this.type].clear():void 0}}const C=new G("localStorage"),h=new G("sessionStorage");function Et(t){window.location.href=t}function U(){return window.location.href}function A(t){window.postMessage(t,window.origin)}function x(t){const e=n=>{if(n.source!==window||n.origin!==window.origin)return;const i=n.data;!i||typeof i!="object"||typeof i.kind!="string"||!i.kind.startsWith("userflow:")||t(i)===!0&&s()};window.addEventListener("message",e);const s=()=>window.removeEventListener("message",e);return s}function Z(t){return new Promise(e=>{x(s=>{const n=t(s);return n?(e(n),!0):!1})})}const R=new Set;let y=!1;function q(t){return ee(),R.add(t),()=>{F(t)}}function F(t){R.delete(t)}function m(){R.forEach(t=>t())}function ee(){if(y)return;y=!0;const{history:t}=window,e=s=>{const n=t[s];t[s]=(...i)=>{const r=n.apply(t,i);return m(),r}};window.__userflowStatePatched?(window.addEventListener("userflow:pushstate",()=>{m()}),window.addEventListener("userflow:replacestate",()=>{m()})):(e("pushState"),e("replaceState")),window.addEventListener("popstate",()=>{m()})}class te{destroy(){this.unregisterOnMessage&&this.unregisterOnMessage()}postBuilderMessage(e){A({kind:"userflow:crxSendProxyMessage",direction:"targetToBuilder",message:e})}onBuilderMessage(e){return this.unregisterOnMessage=x(e),!1}async captureScreenshot(e,s,n,i){return A({kind:"userflow:crxScreenshot",x:e,y:s,width:n,height:i,devicePixelRatio:window.devicePixelRatio}),(await Z(a=>a.kind==="userflow:crxScreenshotResult"?a:null)).imageDataUrl}}var k=(t=>(t.ACTION="ACTION",t.ELEMENT_MISSING="ELEMENT_MISSING",t.LAUNCHER_DEACTIVATED="LAUNCHER_DEACTIVATED",t.WORKFLOW_TIMED_OUT="WORKFLOW_TIMED_OUT",t.REPLACED="REPLACED",t.SNOOZED="SNOOZED",t.TOOLTIP_TARGET_MISSING="TOOLTIP_TARGET_MISSING",t.USERFLOWJS="USERFLOWJS",t.USER_CLOSED="USER_CLOSED",t))(k||{}),se=(t=>(t.POSITIVE="POSITIVE",t.NEUTRAL="NEUTRAL",t.NEGATIVE="NEGATIVE",t))(se||{}),ie=(t=>(t.USER_INPUT_TIMEOUT="USER_INPUT_TIMEOUT",t.STEP_TIMEOUT="STEP_TIMEOUT",t))(ie||{}),ne=(t=>(t.SECOND="SECOND",t.MINUTE="MINUTE",t.HOUR="HOUR",t.DAY="DAY",t))(ne||{}),N=(t=>(t.ACTION="ACTION",t.DRAFT="DRAFT",t.LINK="LINK",t.LAUNCHER_SEEN="LAUNCHER_SEEN",t.RESOURCE_CENTER="RESOURCE_CENTER",t.USERFLOWJS="USERFLOWJS",t.ASSISTANT="ASSISTANT",t))(N||{}),re=(t=>(t.LIKE="LIKE",t.DISLIKE="DISLIKE",t))(re||{}),S=(t=>(t.STRING="STRING",t.BOOLEAN="BOOLEAN",t.NUMBER="NUMBER",t.DATETIME="DATETIME",t.LIST="LIST",t.RANDOM_AB="RANDOM_AB",t.RANDOM_NUMBER="RANDOM_NUMBER",t.CHECKLIST_TASK="CHECKLIST_TASK",t.FLOW="FLOW",t.FLOW_SESSION="FLOW_SESSION",t.FLOW_STEP="FLOW_STEP",t.FLOW_VERSION="FLOW_VERSION",t))(S||{}),L=(t=>(t.FLOW="FLOW",t.BANNER="BANNER",t.EMBED="EMBED",t.CHECKLIST="CHECKLIST",t.LAUNCHER="LAUNCHER",t.RESOURCE_CENTER="RESOURCE_CENTER",t.SITE="SITE",t.WORKFLOW="WORKFLOW",t))(L||{}),oe=(t=>(t.ALWAYS_TRUE="ALWAYS_TRUE",t.ATTRIBUTE="ATTRIBUTE",t.CHECKLIST_TASK_CLICKED="CHECKLIST_TASK_CLICKED",t.CLAUSE="CLAUSE",t.ELEMENT="ELEMENT",t.EVENT="EVENT",t.FILLED_IN_INPUT="FILLED_IN_INPUT",t.FLOW="FLOW",t.INPUT_VALUE="INPUT_VALUE",t.PAGE="PAGE",t.SEGMENT="SEGMENT",t.TIME="TIME",t))(oe||{}),ae=(t=>(t.AUTO="AUTO",t.MANUAL="MANUAL",t))(ae||{}),ce=(t=>(t.INPUT="INPUT",t))(ce||{}),le=(t=>(t.ABSOLUTE_EQ="ABSOLUTE_EQ",t.ABSOLUTE_GT="ABSOLUTE_GT",t.ABSOLUTE_LT="ABSOLUTE_LT",t.AND="AND",t.BETWEEN="BETWEEN",t.CONTAINS="CONTAINS",t.EMPTY="EMPTY",t.ENDS_WITH="ENDS_WITH",t.EQ="EQ",t.EXCLUDES_ALL="EXCLUDES_ALL",t.EXCLUDES_ANY="EXCLUDES_ANY",t.FALSE="FALSE",t.GT="GT",t.GTE="GTE",t.INCLUDES_ALL="INCLUDES_ALL",t.INCLUDES_ANY="INCLUDES_ANY",t.LT="LT",t.LTE="LTE",t.NE="NE",t.NOT_CONTAINS="NOT_CONTAINS",t.NOT_EMPTY="NOT_EMPTY",t.NOT_REGEX="NOT_REGEX",t.OR="OR",t.REGEX="REGEX",t.RELATIVE_EQ="RELATIVE_EQ",t.RELATIVE_GT="RELATIVE_GT",t.RELATIVE_LT="RELATIVE_LT",t.STARTS_WITH="STARTS_WITH",t.TRUE="TRUE",t.URL="URL",t))(le||{}),ue=(t=>(t.CLICK="CLICK",t.DISABLED="DISABLED",t.MOUSEDOWN="MOUSEDOWN",t.NOT_CLICK="NOT_CLICK",t.NOT_DISABLED="NOT_DISABLED",t.NOT_PRESENT="NOT_PRESENT",t.PRESENT="PRESENT",t))(ue||{}),he=(t=>(t.END_USER="END_USER",t.GROUP="GROUP",t))(he||{}),de=(t=>(t.BETWEEN="BETWEEN",t.EQ="EQ",t.GTE="GTE",t.LTE="LTE",t))(de||{}),fe=(t=>(t.ANY="ANY",t.RELATIVE_BETWEEN="RELATIVE_BETWEEN",t.RELATIVE_GT="RELATIVE_GT",t.RELATIVE_LT="RELATIVE_LT",t))(fe||{}),Ee=(t=>(t.CURRENT_USER="CURRENT_USER",t.CURRENT_USER_CURRENT_GROUP="CURRENT_USER_CURRENT_GROUP",t.CURRENT_GROUP="CURRENT_GROUP",t))(Ee||{}),Se=(t=>(t.ASSET="ASSET",t.CARTOON="CARTOON",t.NONE="NONE",t.URL="URL",t))(Se||{}),Te=(t=>(t.INSIDE="INSIDE",t.OUTSIDE="OUTSIDE",t))(Te||{}),Ie=(t=>(t.TOP_LEFT="TOP_LEFT",t.TOP_CENTER="TOP_CENTER",t.TOP_RIGHT="TOP_RIGHT",t.BOTTOM_RIGHT="BOTTOM_RIGHT",t.BOTTOM_CENTER="BOTTOM_CENTER",t.BOTTOM_LEFT="BOTTOM_LEFT",t.CENTER="CENTER",t))(Ie||{}),ge=(t=>(t.GOOGLE="GOOGLE",t.STANDARD="STANDARD",t))(ge||{}),we=(t=>(t.DISMISS_FIRST_MENU_AFTER="DISMISS_FIRST_MENU_AFTER",t.DISMISS="DISMISS",t))(we||{}),ke=(t=>(t.DISMISS="DISMISS",t.NONE="NONE",t))(ke||{}),Ce=(t=>(t.DEFAULT="DEFAULT",t.NARROW="NARROW",t.CHAINED_SQUARED="CHAINED_SQUARED",t.CHAINED_ROUNDED="CHAINED_ROUNDED",t.DOTTED="DOTTED",t.NUMBERED="NUMBERED",t))(Ce||{}),me=(t=>(t.TOP="TOP",t.BOTTOM="BOTTOM",t))(me||{}),Ue=(t=>(t.DEFAULT="DEFAULT",t.PLAINTEXT="PLAINTEXT",t.CUSTOM="CUSTOM",t))(Ue||{}),Le=(t=>(t.CHECKLIST_OVERRIDE="CHECKLIST_OVERRIDE",t.RESOURCE_CENTER_ONLY="RESOURCE_CENTER_ONLY",t.NONE="NONE",t))(Le||{}),pe=(t=>(t.BUBBLE="BUBBLE",t.END="END",t.ERROR="ERROR",t.FLAG="FLAG",t))(pe||{}),Ne=(t=>(t.MANUAL="MANUAL",t.NONE="NONE",t.SYNTHETIC="SYNTHETIC",t))(Ne||{}),_e=(t=>(t.BUBBLE="BUBBLE",t.HIDDEN="HIDDEN",t.MODAL="MODAL",t.TOOLTIP="TOOLTIP",t))(_e||{}),ve=(t=>(t.ABOVE="ABOVE",t.BELOW="BELOW",t.LEFT="LEFT",t.RIGHT="RIGHT",t))(ve||{}),Ae=(t=>(t.CLOSE_FLOW="CLOSE_FLOW",t.EVAL_JS="EVAL_JS",t.GO_TO_STEP="GO_TO_STEP",t.NAVIGATE="NAVIGATE",t.SET_ATTRIBUTE="SET_ATTRIBUTE",t.SNOOZE="SNOOZE",t.START_FLOW="START_FLOW",t.TRACK_BUTTON_EVENT="TRACK_BUTTON_EVENT",t))(Ae||{}),Re=(t=>(t.NEW_TAB="NEW_TAB",t.SAME_TAB="SAME_TAB",t))(Re||{}),Oe=(t=>(t.SET="SET",t.SET_DATETIME="SET_DATETIME",t.SET_DATETIME_ONCE="SET_DATETIME_ONCE",t.SET_ONCE="SET_ONCE",t.ADD="ADD",t.SUBTRACT="SUBTRACT",t.APPEND="APPEND",t.PREPEND="PREPEND",t.REMOVE="REMOVE",t.UNSET="UNSET",t))(Oe||{}),be=(t=>(t.MULTILINE_TEXT="MULTILINE_TEXT",t.MULTIPLE_CHOICE="MULTIPLE_CHOICE",t.NPS="NPS",t.SCALE="SCALE",t.STARS="STARS",t.TEXT="TEXT",t))(be||{}),De=(t=>(t.CLICK="CLICK",t.FILL="FILL",t.NAVIGATE="NAVIGATE",t))(De||{}),p=(t=>(t.ACTION="ACTION",t.ANNOUNCEMENTS="ANNOUNCEMENTS",t.ASSISTANT="ASSISTANT",t.CHECKLIST="CHECKLIST",t.CONTACT="CONTACT",t.DIVIDER="DIVIDER",t.FLOWS="FLOWS",t.KNOWLEDGE_BASE="KNOWLEDGE_BASE",t.MESSAGE="MESSAGE",t.SUBPAGE="SUBPAGE",t))(p||{}),ye=(t=>(t.CRISP="CRISP",t.CUSTOM="CUSTOM",t.FRESHCHAT="FRESHCHAT",t.HELPSCOUT="HELPSCOUT",t.HUBSPOT="HUBSPOT",t.INTERCOM="INTERCOM",t.ZENDESK="ZENDESK",t.ZENDESK_MESSENGER="ZENDESK_MESSENGER",t))(ye||{}),Me=(t=>(t.BUTTON="BUTTON",t.INPUT="INPUT",t))(Me||{}),Pe=(t=>(t.EMAIL="EMAIL",t.PHONE="PHONE",t.CHAT="CHAT",t))(Pe||{}),Be=(t=>(t.SILENT="SILENT",t.BADGE="BADGE",t.POPOUT="POPOUT",t.MODAL="MODAL",t.TOAST="TOAST",t))(Be||{}),He=(t=>(t.DEFAULT="DEFAULT",t.CUSTOM="CUSTOM",t.NONE="NONE",t))(He||{}),We=(t=>(t.LAUNCHER_CLICK="LAUNCHER_CLICK",t.LAUNCHER_HOVER="LAUNCHER_HOVER",t.TARGET_CLICK="TARGET_CLICK",t.TARGET_HOVER="TARGET_HOVER",t.LAUNCHER_TARGET_CLICK="LAUNCHER_TARGET_CLICK",t.LAUNCHER_TARGET_HOVER="LAUNCHER_TARGET_HOVER",t))(We||{}),V=(t=>(t.ACTIVATE="ACTIVATE",t.DEACTIVATE="DEACTIVATE",t.NEVER="NEVER",t))(V||{}),Ge=(t=>(t.AUTO="AUTO",t.TOP="TOP",t.RIGHT="RIGHT",t.BOTTOM="BOTTOM",t.LEFT="LEFT",t))(Ge||{}),xe=(t=>(t.START="START",t.CENTER="CENTER",t.END="END",t))(xe||{}),Fe=(t=>(t.PERCENT="PERCENT",t.PX="PX",t))(Fe||{}),Ve=(t=>(t.BEACON="BEACON",t.BUTTON="BUTTON",t.HIDDEN="HIDDEN",t.ICON="ICON",t))(Ve||{}),Ke=(t=>(t.LAUNCHER="LAUNCHER",t.TARGET="TARGET",t))(Ke||{}),$e=(t=>(t.BODY_FIRST="BODY_FIRST",t.BODY_LAST="BODY_LAST",t.ELEMENT_FIRST="ELEMENT_FIRST",t.ELEMENT_LAST="ELEMENT_LAST",t.ELEMENT_BEFORE="ELEMENT_BEFORE",t.ELEMENT_AFTER="ELEMENT_AFTER",t))($e||{}),je=(t=>(t.BODY_FIRST="BODY_FIRST",t.BODY_LAST="BODY_LAST",t.ELEMENT_FIRST="ELEMENT_FIRST",t.ELEMENT_LAST="ELEMENT_LAST",t.ELEMENT_BEFORE="ELEMENT_BEFORE",t.ELEMENT_AFTER="ELEMENT_AFTER",t))(je||{}),K=(t=>(t.CHECKLIST="CHECKLIST",t))(K||{}),Ye=(t=>(t.INITIAL="INITIAL",t.FOLLOWUP="FOLLOWUP",t))(Ye||{}),ze=(t=>(t.FLOW="FLOW",t.WORKFLOW="WORKFLOW",t))(ze||{}),Je=(t=>(t.HIDE="HIDE",t.OTHERS="OTHERS",t))(Je||{}),Qe=(t=>(t.ALWAYS="ALWAYS",t.MULTIPLE="MULTIPLE",t.NEVER="NEVER",t.ONCE="ONCE",t.ONCE_PER_GROUP="ONCE_PER_GROUP",t))(Qe||{}),Xe=(t=>(t.NONE="NONE",t.PENDING_SCHEDULE="PENDING_SCHEDULE",t.SCHEDULED="SCHEDULED",t.FIRED="FIRED",t))(Xe||{}),Ze=(t=>(t.NONE="NONE",t.LIKE="LIKE",t.SCALE="SCALE",t))(Ze||{}),qe=(t=>(t.HIDE="HIDE",t.BLOCK="BLOCK",t.OTHERS="OTHERS",t))(qe||{});function et(){return{customInputs:[],customNavigate:null,urlFilter:null,linkUrlDecorator:null,customScrollIntoView:null,scrollPadding:null,inferenceAttributeNames:["data-for","data-id","data-testid","data-test-id","for","id","name","placeholder","role"],inferenceAttributeFilters:{id:[t=>!t.match(/\d$/)],"data-id":[t=>!t.match(/\d$/)]},inferenceClassNameFilters:[t=>!t.startsWith("css-")],baseZIndex:1234500,evalJsDisabled:!1}}const f=et();function M(t){return Array.isArray(t)||(t=t?[t]:[]),t=t.map(e=>typeof e=="string"?new RegExp(e):e),t}function St(t,e){return t.every(s=>typeof s=="function"?s(e):s instanceof RegExp?s.test(e):!0)}function tt(){let t=U();if(f.urlFilter){if(t=f.urlFilter(t),typeof t!="string")throw new d("Userflow.js: URL filter returned non-string value. Please check your userflow.setUrlFilter() implementation.");try{new URL(t)}catch(e){throw new d(`Userflow.js: URL filter returned an invalid URL. Please check your userflow.setUrlFilter() implementation.
|
|
3
|
+
Returned URL: `+t+`
|
|
4
|
+
Error message: `+e.message)}}return t}let $="";try{$=localStorage.getItem("debug")||""}catch{}const j=$.split(",").some(t=>t==="*"||t.startsWith("userflow:*")),o=O("log");o.group=O("group");o.groupCollapsed=O("groupCollapsed");o.groupEnd=function(){j&&console.groupEnd()};let _;function O(t){return function(e,...s){if(j){const n=performance.now(),i=_?Math.round(n-_):0;_=n,console[t](`%cuserflow %c${e} %c+${i}ms`,"color:#1a57e6;","","color:#1a57e6;",...s)}}}const st=()=>I(()=>import("./ResourceCenterApp.js").then(t=>t.R),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]));function it(t){const s=t.version.checklist.tasks.length;return Math.max(0,s-t.taskCompletions.length)}class P{constructor(e){this.observers=new Set,this._value=e}get value(){return this._value}update(e){if(e!==this._value){this._value=e;for(const s of this.observers)s()}}observe(e){return this.observers.add(e),()=>this.observers.delete(e)}}const B=["page:before-change","page:change","turbo:before-cache","turbo:load","turbo:visit","turbolinks:before-cache","turbolinks:load","turbolinks:visit","livewire:navigated","livewire:navigating","livewire:update"],nt=()=>I(()=>import("./BannerApp.js"),__vite__mapDeps([31,1,2,3,4,5,6,15,12,13,14,9,10,11,8,7,16,18,19,17,20,30,21,32,33]));function rt(t){if(!t)return null;let e;"block"in t&&t.block!=null&&(e=t.block.cvid);const s={kind:t.kind,blockCvid:e};return t.kind==="announcementShow"&&(s.announcementId=t.announcementId),JSON.stringify(s)}function Tt(t,e){if(!e)return null;const s=JSON.parse(e);let n;if(s.blockCvid&&(n=t.version.resourceCenter?.blocks.find(r=>r.cvid===s.blockCvid)),!n&&s.kind!=="search")return null;const i={kind:s.kind,block:n};return i.kind==="announcementShow"&&(i.announcementId=s.announcementId),i}const v="1026521",ot=import.meta.url,H=50,at=300*1e3,W="userflowClientState",w="userflowClientSiteId";class ct{constructor(){this.clientToken=null,this.externalId=null,this.signature=null,this.groupId=null,this.groupSignature=null,this._socketStatus="disconnected",this.socket=null,this.channel=null,this.logrocketAppId=null,this.debounceInactiveDisconnectTimeout=void 0,this.inBatch=!1,this.endBatchTimeout=void 0,this.pushRateLimitMinute=0,this.pushRateLimitMinuteExpires=0,this.clientClock=1,this.serverClock=1,this.flowSession=null,this.flowSessionClock=0,this.checklistSession=null,this.checklistExpanded=!1,this.checklistExpandPending=!1,this.checklistSessionClock=0,this.bannerSession=null,this.resourceCenterSession=null,this.resourceCenterOpen=!1,this.resourceCenterLauncherHidden=null,this.siteSession=null,this.launcherSessions=[],this.activeLauncherFlowId=null,this.notifications=[],this.embedSessions=[],this.workflowSession=null,this.notificationIdCounter=0,this.sessionStorageState=null,this.clientContext=null,this.flushUrlChangeTimeout=void 0,this.onFirstIdentifyRun=!1,this.onFirstIdentifyTimeout=void 0,this.firstIdentifyCallback=null,this.ui=null,this.debuggerUI=null,this.debuggerMountInProgress=!1,this.unackedTasks=new Set,this.clientConditions=new Map,this.trackers=new Map,this.conditionWaitTimers=new Map,this.listeners=new Map,this.targetEnv=null,this.idempotencyKeysSeen=new Set,this.testUserIdentified=!1,this.cspIssueReported=!1,this.uiDisabled=!1,this.audio=null,this.audioReady=!1,this.pageTrackingDisabled=!1,this.refCounter=1,this.implicitTracking=null,this.initialMessagesQueue=[],this.onBuilderMessage=e=>(this.handleBuilderMessage(e),!1),this.handleBuilderMessage=async e=>{o(`builder ${e.kind} message received`,e);const s="idempotencyKey"in e&&typeof e.idempotencyKey=="string"?e.idempotencyKey:null;if(s&&this.idempotencyKeysSeen.has(s))return;const n=()=>{s&&this.idempotencyKeysSeen.add(s)};switch(e.kind){case"userflow:selectElement":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:selectElementAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0,activeApp:"elementSelection",elementSelection:{mode:"select",elementType:e.elementType}}));return}case"userflow:selectElementCancel":{this.setSessionStorageState(i=>({...i,activeApp:null,elementSelection:null}));return}case"userflow:startFlowWithToken":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:startFlowWithTokenAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(r=>({...r,isTargetTab:!0,activeApp:null,testStartConditionToken:void 0})),h.setItem("previewFlowId",e.flowId);const i=h.getItem("assistantPreviewId");i&&h.removeItem("assistantConversationId:"+i),e.assistantPreviewId?(h.setItem("assistantPreviewId",e.assistantPreviewId),h.removeItem("assistantConversationId:"+e.assistantPreviewId)):h.removeItem("assistantPreviewId"),(i||e.assistantPreviewId)&&this.emit("private:assistantPreviewChanged"),e.testUser?this.identifyTestUser(e.testUser):this.resetTestUser(),e.testStartCondition?this.setSessionStorageState(r=>({...r,activeApp:"startConditionTesting",testStartConditionToken:e.token})):this.onceIdentified(()=>{if(e.assistantPreviewId&&this.workflowSession&&this.endFlow(this.workflowSession,{endReason:k.REPLACED}),this.startFlowWithToken(e.token),e.isResourceCenter){const r=()=>{const a=this.resourceCenterSession;a&&a.draftMode&&a.flow.id===e.flowId&&(e.assistantPreviewId&&this.navigateToAssistantChat(a),this.openResourceCenter(),this.off("resourceCenterChanged",r))};this.on("resourceCenterChanged",r),r()}});return}case"userflow:testTracker":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:testTrackerAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0})),e.testUser?this.identifyTestUser(e.testUser):this.resetTestUser(),this.setSessionStorageState(i=>({...i,activeApp:"trackerTesting",trackerTesting:{trackerName:e.trackerName,token:e.token,events:0}}));return}case"userflow:testTrackerCancel":{this.setSessionStorageState(i=>({...i,activeApp:null,trackerTesting:null}));return}case"userflow:startSmartFlow":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:startSmartFlowAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0,activeApp:"smartFlowRecording",smartFlowRecording:{sessionId:e.sessionId,isRecording:!0,startUrl:e.startUrl||null}}));return}case"userflow:smartFlowCancel":{this.setSessionStorageState(i=>({...i,activeApp:null,smartFlowRecording:null}));return}case"userflow:smartFlowStartOverAck":return;case"userflow:smartFlowComplete":{this.setSessionStorageState(i=>({...i,activeApp:null,smartFlowRecording:null}));return}}},this.onUrlChange=()=>{this.externalId&&(window.clearTimeout(this.flushUrlChangeTimeout),this.flushUrlChangeTimeout=window.setTimeout(()=>this.flushUrlChange(),H))},this.onUserActivity=()=>this.ensureConnected(),this.mountSitePage=async(e,s)=>{h.setItem(w,s),o("mounting site page"),this.setResourceCenterLauncherHidden(!0);try{const{SitePage:n}=await I(async()=>{const{SitePage:r}=await import("./SitePage.js");return{SitePage:r}},__vite__mapDeps([34,1,2,3,4,5,6,18,19,35,36,37,38,39,40,41,42,43,44,27,15,12,13,14,9,10,11,25,26,20,8,45,28,46,47,32,33]));new n(this,e).mount(),o("site page mounted")}catch(n){console.error("Userflow: Failed to mount site page",n)}},this.remountIfNecessary=()=>{!this.ui?.container||document.contains(this.ui.container)||(o("remounting UI because container was missing"),this.remount())},o("constructor, build="+v),q(this.onUrlChange),this.setTargetEnv(new te),this.checkTestUserAtBoot(),this.toggleUI(),this.checkDebuggerSession();for(const e of B)document.addEventListener(e,this.remountIfNecessary)}get socketStatus(){return this._socketStatus}destroy(){o("destroy"),this.reset(),F(this.onUrlChange),this.destroyTargetEnv();for(const e of B)document.removeEventListener(e,this.remountIfNecessary)}setTargetEnv(e){this.destroyTargetEnv(),this.targetEnv=e,e.onBuilderMessage(this.onBuilderMessage)}destroyTargetEnv(){this.targetEnv&&(this.targetEnv.destroy(),this.targetEnv=null)}getTargetEnv(){if(!this.targetEnv)throw new d("Userflow.js: Cannot call getTargetEnv when protocol is not set");return this.targetEnv}setSessionStorageState(e){const s=e(this.getSessionStorageState());h.setItem(W,JSON.stringify(s)),this.sessionStorageState=s,this.toggleUI()}getSessionStorageState(){let e=this.sessionStorageState;if(!e){const s=h.getItem(W);if(s)try{e=JSON.parse(s)}catch(n){console.error("Userflow.js: Parse ElementSelectionState error:",n)}e||(e={testUser:null,activeApp:null,elementSelection:null,trackerTesting:null}),this.sessionStorageState=e}return e}checkTestUserAtBoot(){const e=this.getSessionStorageState().testUser;e&&(o("checkTestUserAtBoot identifying test user"),this.identifyTestUser(e))}async identifyTestUser(e){this.setSessionStorageState(i=>({...i,testUser:e})),this.reset(),this.init(e.clientToken),this.testUserIdentified=!0,this.externalId=e.id;const s=[this.identify(e.id,{name:e.name,email:e.email,signed_up_at:{set_once:new Date().toISOString(),data_type:"datetime"}},{signature:e.signature})],{group:n}=e;n&&(this.groupId=n.id,s.push(this.group(n.id,{name:n.name},{signature:n.signature}))),await Promise.all(s)}resetTestUser(){this.setSessionStorageState(e=>({...e,testUser:null}))}init(e){if(o("init",e),!e)throw new d("userflow.init() was called but missing Userflow.js Token");if(this.clientToken!==e){if(this.testUserIdentified){o("init() ignoring new token since a test user has been identified");return}this.clientToken&&(o("init() resetting due to new client token"),this.reset()),this.clientToken=e,this.emit("private:initialised")}}ensureInit(){if(!this.clientToken)throw new d("You must call userflow.init() first")}ensureIdentified(){if(this.ensureInit(),!this.externalId)throw new d("You must call userflow.identify() first");return this.externalId}ensureGroup(){if(this.ensureIdentified(),!this.groupId)throw new d("You must call userflow.group() first");return this.groupId}ensureConnected(){if(!this.clientToken||!this.externalId||(this.debounceInactiveDisconnect(),this.socket))return;this._socketStatus="connecting",o("connecting to socket");const e=/^ct_eu\d+_.+$/.test(this.clientToken)?"e.eu.":"e.";let s=f.serverEndpoint||e+"userflow.com";new URL(ot).hostname==="js.getuserflow.com"&&s==="e.userflow.com"&&(s="e.getuserflow.com");const n="wss://"+s+"/end-users/"+this.clientToken+"/socket";this.socket=new J(n,{reconnectAfterMs:i=>[100,500,1e3,5e3][i-1]||1e4,timeout:20*1e3}),this.socket.connect(),this.socket.onOpen(()=>{o("socket opened")}),this.socket.onClose(()=>{this.emit("private:disconnect")}),this.socket.onError(i=>{console.log("Userflow.js socket error",i),this.reportCspIssue()}),this.channel=this.socket.channel(`end_users:${this.externalId}`,()=>this.makeChannelJoinPayload()),this.channel.join().receive("ok",i=>{typeof this.featureFlags>"u"&&this.clearInitialMessagesQueue(i.featureFlags),this.logrocketAppId=i.logrocketAppId,this.featureFlags=new Set(i.featureFlags),o("channel joined"),this._socketStatus!=="connected"&&(this._socketStatus="connected"),this.featureFlagEnabled("cff_implicit_events")===!0&&!this.implicitTracking&&this.startImplicitTracking(),!this.featureFlagEnabled("cff_implicit_events")&&this.implicitTracking&&(this.implicitTracking.stop(),this.implicitTracking=null)}).receive("error",i=>{["company_closed","invalid_client_token","invalid_user_external_id","incorrect_user_signature","rate_limit_exceeded","user_signature_required"].includes(i.code)?(console.error(`Userflow.js resetting due to: [${i.code}] ${i.message}`),this.reset(),this.clientToken=null):i.code==="invalid_protocol_version"?(console.error(`Userflow.js destroying due to: [${i.code}] ${i.message}`),this.destroy()):console.log("Userflow.js channel join error",i)}),this.channel.on("server_message",i=>this.handleServerMessage(i)),this.channel.on("server_error",i=>{console.log(`Userflow.js server error (${i.code}): ${i.message}`+(i.details&&i.details.length>0?`
|
|
5
5
|
Details:
|
|
6
|
-
`+i.details.map(r=>(r.path?`${r.path}: `:"")+r.message):""))})}async startImplicitTracking(){await I(()=>import("./implicit-tracking.js"),__vite__mapDeps([
|
|
7
|
-
Client message:`,
|
|
8
|
-
Client message:`,
|
|
9
|
-
Error:`,u),i&&n(new
|
|
10
|
-
Client message:`,
|
|
11
|
-
Error:`,u),i&&n(new
|
|
6
|
+
`+i.details.map(r=>(r.path?`${r.path}: `:"")+r.message):""))})}async startImplicitTracking(){await I(()=>import("./implicit-tracking.js"),__vite__mapDeps([48,11,2,33,32])).then(e=>{this.implicitTracking=new e.ImplicitTracking(this),this.implicitTracking.start()}).catch(e=>o(`Implicit tracking failed to load ${e}`))}makeChannelJoinPayload(){let e;h.getItem(w)&&(e=new URL(U()).searchParams.get("announcement_id")||void 0);const n=this.buildClientContext();this.clientContext=n;const i={protocolVersion:2,userflowClientBuild:v,signature:this.signature,groupExternalId:this.groupId,groupSignature:this.groupSignature,flowSessionId:this.flowSession?.id||null,checklistSessionId:this.checklistSession?.id||null,bannerSessionId:this.bannerSession?.id||null,resourceCenterSessionId:this.resourceCenterSession?.id||null,siteSessionId:this.siteSession?.id||null,launchers:this.launcherSessions.map(r=>({flowId:r.flow.id})),trackers:Array.from(this.trackers.values()).map(r=>({flowId:r.tracker.flowId})),hasDraftSession:this.hasDraftSession(),clientConditions:Array.from(this.clientConditions.values()).map(r=>({conditionId:r.condition.id,isTrue:r.isTrue})),previewFlowId:h.getItem("previewFlowId"),assistantPreviewId:h.getItem("assistantPreviewId"),announcementPreviewId:e,clientContext:n};return o("channel join payload",i),i}disconnect(){window.clearTimeout(this.debounceInactiveDisconnectTimeout),this.socket&&this.socket.disconnect(),this._socketStatus="disconnected",this.socket=null,this.channel=null}debounceInactiveDisconnect(){window.clearTimeout(this.debounceInactiveDisconnectTimeout),this.debounceInactiveDisconnectTimeout=window.setTimeout(()=>{if(this.hasDraftSession()||this.assistantMessageInProgress){this.debounceInactiveDisconnect();return}o("disconnecting from socket due to inactivity"),this.disconnect()},at)}hasDraftSession(){return!!this.flowSession?.draftMode||!!this.checklistSession?.draftMode||!!this.bannerSession?.draftMode||!!this.resourceCenterSession?.draftMode||this.launcherSessions.some(e=>e.draftMode)}async send(e,{batch:s,endBatch:n,handlesRejection:i}={}){return(!this.inBatch||!["ToggleClientCondition","UpdateClientContext"].includes(e.kind))&&this.checkPushRateLimit(),this.ensureConnected(),s&&!this.inBatch&&(this.inBatch=!0,this.sendRaw({kind:"BeginBatch"})),this.inBatch&&(window.clearTimeout(this.endBatchTimeout),n?this.endBatch():this.endBatchTimeout=window.setTimeout(()=>{this.endBatch()},H)),this.sendRaw(e,{handlesRejection:i})}clearInitialMessagesQueue(e){if(this.initialMessagesQueue.length===0)return;const s=e.includes("cff_disable_page_views")===!0,n=e.includes("cff_implicit_events")===!1;for(const i of this.initialMessagesQueue){const{message:r,handlesRejection:a,resolve:l,reject:u}=i;if(n&&r.kind==="TrackRawEvent"){l("skipped due to disabled implicit events");continue}if(s&&(r.kind==="TrackEvent"&&r.name==="page_viewed"||r.kind==="TrackRawEvent"&&r.name==="page_viewed")){l("skipped due to disabled page views tracking");continue}this._sendToChannel(r,l,u,{handlesRejection:a})}this.initialMessagesQueue=[]}async sendRaw(e,{handlesRejection:s}={}){return typeof this.featureFlags>"u"?new Promise((n,i)=>{this.initialMessagesQueue.push({message:e,resolve:n,reject:i,handlesRejection:s})}):new Promise((n,i)=>{this._sendToChannel(e,n,i,{handlesRejection:s})})}_sendToChannel(e,s,n,{handlesRejection:i}={}){if(!this.channel){const u=`Userflow.js: send() should not be called if channel is not set. Message kind=${e.kind}`;if(i)throw Error(u);console.log(u,`
|
|
7
|
+
Client message:`,e);return}o(`push ${e.kind} message`,e);const r=this.clientClock,a=()=>{this.serverClock=r,this.channel?.off("phx_error",l)},l=this.channel.on("phx_error",u=>{a();const c=`Userflow.js send ${e.kind} got phx_error`;this._socketStatus==="connected"&&console.log(c,`
|
|
8
|
+
Client message:`,e,`
|
|
9
|
+
Error:`,u),i&&n(new d(c))});this.channel.push("client_message",e).receive("ok",u=>{a(),s(u)}).receive("error",u=>{a();const c=`Userflow.js error reply (${u.code}): ${u.message}`;console.log(c,`
|
|
10
|
+
Client message:`,e,`
|
|
11
|
+
Error:`,u),i&&n(new d(c,u.code,u.message))})}endBatch(){this.inBatch=!1,this.sendRaw({kind:"EndBatch"})}checkPushRateLimit(){const e=this.featureFlagEnabled("cff_implicit_events")===!0?200:100,s=Date.now();if(this.pushRateLimitMinuteExpires<s&&(this.pushRateLimitMinute=0,this.pushRateLimitMinuteExpires=s+60*1e3),this.pushRateLimitMinute>=e)throw new d(`This Userflow.js client has reached a maximum of ${e} operations in the last 1 minute. This is usually due to one of the following:
|
|
12
12
|
|
|
13
13
|
- Excessive calls to Userflow.js. Check if any of userflow.track(), userflow.identify(), userflow.updateUser() or similar are called repeatedly.
|
|
14
14
|
- The URL changing too frequently. Look into https://userflow.com/docs/userflow-js#seturlfilter and filter out the changing part of the URL.
|
|
15
15
|
- The user legitimately being very active, in which case you can just ignore this error.
|
|
16
16
|
|
|
17
|
-
If in doubt, reach out to us at support@userflow.com.`);this.pushRateLimitMinute++}handleServerMessage(t){o(`received ${t.kind} message`,t);const{serverClock:s,flowSession:n,flowSessionClock:i,checklistSession:r,checklistSessionClock:a,bannerSession:l,resourceCenterSession:u}=this;switch(t.kind){case"CheckSessionsAck":this.emit("private:checkSessionsAck");return;case"ServerDebug":return;case"AddLauncher":{const{session:c}=t,E=this.launcherSessions.findIndex(g=>g.flow.id===c.flow.id);E===-1?this.launcherSessions=[...this.launcherSessions,c]:this.launcherSessions=[...this.launcherSessions.slice(0,E),c,...this.launcherSessions.slice(E+1)],this.toggleUI();return}case"AddTracker":{this.addTracker(t.tracker);return}case"AssistantMessageEventWrapper":{this.emit("private:assistantMessageEvent",t);return}case"CancelConditionWaitTimer":window.clearTimeout(this.conditionWaitTimers.get(t.conditionId)),this.conditionWaitTimers.delete(t.conditionId);return;case"ChecklistTaskCompleted":this.unackedTasks.add(t.taskCvid);return;case"ForceGoToStep":if(i>s){o(`ignoring ${t.kind} message due to stale clock flowSessionClock=${i} > serverClock=${s}`);return}n?.id===t.sessionId&&this.emit("gotostep",{session:n,step:{id:t.stepId}});return;case"RemoveLauncher":this.removeLauncher(t.flowId)&&this.toggleUI();return;case"RemoveTracker":{this.removeTracker(t.flowId);return}case"SetBannerSession":this.setBannerSession(t.session),this.toggleUI();return;case"SetChecklistSession":a<=s||r?.id===t.session.id?(this.setChecklistSession(t.session,s),this.toggleUI()):o(`ignoring ${t.kind} message due to stale clock checklistSessionClock=${a} > serverClock=${s}`);return;case"SetFlowSession":i<=s||n?.id===t.session.id?(this.setFlowSession(t.session,s),this.emit("private:setFlowSession",t.session.version.id),this.toggleUI()):o(`ignoring ${t.kind} message due to stale clock flowSessionClock=${i} > serverClock=${s}`);return;case"SetResourceCenterSession":this.emit("private:resourceCenterSession",t.session),this.setResourceCenterSession(t.session),this.toggleUI();return;case"StartConditionWaitTimer":{if(!this.conditionWaitTimers.has(t.conditionId)){const c=window.setTimeout(()=>{this.conditionWaitTimers.delete(t.conditionId),this.send({kind:"FireConditionWaitTimer",conditionId:t.conditionId},{batch:!0})},parseFloat(t.waitTime)*1e3);this.conditionWaitTimers.set(t.conditionId,c)}return}case"TestStartConditionSuccess":this.emit("private:testStartConditionSuccess");return;case"TrackClientCondition":this.trackClientCondition(t.condition);return;case"UnsetBannerSession":l?.id===t.sessionId&&(this.setBannerSession(null),this.toggleUI());return;case"UnsetChecklistSession":if(a>s){o(`ignoring ${t.kind} message due to stale clock checklistSessionClock=${a} > serverClock=${s}`);return}r?.id===t.sessionId&&(this.setChecklistSession(null,s),this.toggleUI());return;case"UnsetFlowSession":if(i>s){o(`ignoring ${t.kind} message due to stale clock flowSessionClock=${i} > serverClock=${s}`);return}n?.id===t.sessionId&&(this.setFlowSession(null,s),this.toggleUI());return;case"UnsetResourceCenterSession":u?.id===t.sessionId&&(this.setResourceCenterSession(null),this.toggleUI());return;case"UntrackClientCondition":this.untrackClientCondition(t.conditionId);return;case"AddEmbed":{const c=this.embedSessions?.findIndex(E=>E.flow.id===t.session.flow.id);c!==void 0&&c>=0?this.embedSessions=[...this.embedSessions?.slice(0,c)||[],t.session,...this.embedSessions?.slice(c+1)||[]]:this.embedSessions=[...this.embedSessions||[],t.session],this.emit("uistatechange");break}case"RemoveEmbed":{this.embedSessions=(this.embedSessions||[]).filter(c=>c.flow.id!==t.flowId),this.emit("uistatechange");break}case"SetSiteSession":{this.siteSession=t.session,this.emit("private:siteSession",t.session);break}case"UnsetSiteSession":{this.siteSession=null,d.removeItem(w),this.emit("private:unsetSiteSession");break}case"SetWorkflowSession":{this.setWorkFlowSession(t.session),this.toggleUI();break}case"UnsetWorkflowSession":{this.setWorkFlowSession(null),this.toggleUI();break}case"WorkflowFillStepValue":{this.emit("private:workflowFillStepValue",t);break}default:console.warn("Userflow.js: Received unknown message",t);return}}async identify(t,s={},{signature:n}={}){if(o("identify",t),this.ensureInit(),this.testUserIdentified&&t!==this.externalId){o("identify() ignored since a test user has been identified");return}if(typeof t=="number")t=String(t);else if(!t||typeof t!="string")throw new h(`userflow.identify: First argument must be a non-empty string representing the user's ID in your database. Value received: ${JSON.stringify(t)}`);this.externalId&&t!==this.externalId&&(o("identify resetting due to new externalId"),this.reset()),this.externalId=t,this.signature=n||null,this.observeUserActivity(),await Promise.all([this.send({kind:"UpsertUser",attributes:this.normalizeAttributes(s)},{batch:!0}),this.onFirstIdentify()]),this.emit("private:identified")}async identifyAnonymous(t={},s={}){if(!C.isSupported())throw new h("userflow.identifyAnonymous() is not supported when localStorage access is denied.");const n="anonymousId";let i=C.getItem(n);i||(i="anon-"+b(),C.setItem(n,i)),await this.identify(i,t,s)}getInitToken(){return this.clientToken}getIdentifiedUser(){return{externalId:this.externalId}}async updateUser(t={},s={}){o("updateUser"),this.ensureIdentified(),await this.send({kind:"UpsertUser",attributes:this.normalizeAttributes(t)},{batch:!0})}async group(t,s={},{signature:n,membership:i}={}){if(o("group",t),this.ensureIdentified(),this.testUserIdentified&&t!==this.groupId){o("group() ignored since a test user has been identified");return}if(typeof t=="number")t=String(t);else if(!t||typeof t!="string")throw new h(`userflow.group: First argument must be a non-empty string representing the group's ID in your database. Value received: ${JSON.stringify(t)}`);this.groupId=t,this.groupSignature=n||null,await this.send({kind:"UpsertGroup",groupExternalId:t,groupSignature:this.groupSignature,groupAttributes:this.normalizeAttributes(s),membershipAttributes:this.normalizeAttributes(i)},{batch:!0})}async updateGroup(t={},s={}){o("updateGroup");const n=this.ensureGroup();await this.send({kind:"UpsertGroup",groupExternalId:n,groupSignature:this.groupSignature,membershipAttributes:this.normalizeAttributes(s.membership),groupAttributes:this.normalizeAttributes(t)},{batch:!0})}normalizeAttributes(t){if(t==null)return{};if(typeof t!="object")throw new h("Userflow: 'attributes' must be an object.");const s={};for(const n in t){if(!t.hasOwnProperty(n))continue;if(n==="traits"){const r=t[n];Object.assign(s,this.extractLegacyTraits(r));continue}let i=t[n];if(typeof i=="string"||typeof i=="number"||typeof i=="boolean"||i==null||Array.isArray(i))s[n]=this.normalizeAttributeLiteralOrList(n,i);else{if(typeof i!="object"||i==null)throw new h(`Userflow: Invalid value for '${n}' attribute.`);if("set"in i)s[n]={set:this.normalizeAttributeLiteralOrList(n,i.set),dataType:this.normalizeDataType(n,i.data_type||i.dataType)};else if("set_once"in i||"setOnce"in i)s[n]={setOnce:this.normalizeAttributeLiteralOrList(n,i.set_once??i.setOnce),dataType:this.normalizeDataType(n,i.data_type||i.dataType)};else if("add"in i){const r=i.add;if(typeof r!="string"&&typeof r!="number")throw new h(`Userflow: Invalid 'add' value for '${n}' attribute. Must be a number or string.`);s[n]={add:r}}else if("subtract"in i){const r=i.subtract;if(typeof r!="string"&&typeof r!="number")throw new h(`Userflow: Invalid 'subtract' value for '${n}' attribute. Must be a number or string.`);s[n]={subtract:r}}else if("append"in i)s[n]={append:this.normalizeAttributeLiteralOrList(n,i.append)};else if("prepend"in i)s[n]={prepend:this.normalizeAttributeLiteralOrList(n,i.prepend)};else if("remove"in i)s[n]={remove:this.normalizeAttributeLiteralOrList(n,i.remove)};else throw new h(`Userflow: Invalid value for '${n}' attribute.`)}}return s}normalizeAttributeLiteralOrList(t,s){return Array.isArray(s)?s.map(n=>this.normalizeAttributeLiteral(t,n)):this.normalizeAttributeLiteral(t,s)}normalizeAttributeLiteral(t,s){if(s==null)return null;if(typeof s=="string"||typeof s=="number"||typeof s=="boolean")return s;throw new h(`Userflow: Invalid value for '${t}' attribute.`)}normalizeDataType(t,s){if(!s)return null;switch(s){case"string":return S.STRING;case"number":return S.NUMBER;case"boolean":return S.BOOLEAN;case"datetime":return S.DATETIME}throw new h(`Userflow: Invalid data_type for '${t}' attribute.`)}extractLegacyTraits(t){if(!t)return{};if(!Array.isArray(t)){const s=[];for(const n in t)t.hasOwnProperty(n)&&s.push({name:n,value:t[n]});t=s}return t.reduce((s,{name:n,value:i,dataType:r})=>{if(typeof n!="string"||n.length>100||!n.match(/^[a-z0-9_]+$/))return this.warn("Userflow.identify: Invalid trait name (must be string, no more than 100 characters, and only consist of a-z, 0-9 and underscores). The trait will be ignored. Name was:",n),s;if(typeof i!="string")if(typeof i=="boolean")r||(r="boolean"),i=i?"true":"false";else if(typeof i=="number")r||(r=Number.isInteger(i)?"integer":"decimal"),i=String(i);else return this.warn(`userflow.identify: The value of trait '${n}' is invalid (must be a string, a boolean or a number). The trait will be ignored. Value was:`,i),s;let a=null;if(r)switch(r){case"string":a=S.STRING;break;case"boolean":a=S.BOOLEAN;break;case"integer":a=S.NUMBER;break;case"decimal":a=S.NUMBER;break;case"datetime":a=S.DATETIME;break;default:return this.warn(`userflow.identify: The data type of trait '${n}' is invalid (must be a 'string', 'boolean', 'integer', 'decimal' or 'datetime'). The trait will be ignored. Data type was:`,r),s}return s[n]={set:i,dataType:a},s},{})}async track(t,s={},{userOnly:n}={}){o(`track '${t}'`,s),this.ensureIdentified(),await this.send({kind:"TrackEvent",userOnly:!!n,name:t,attributes:this.normalizeEventAttributes(s)},{batch:!0})}async trackRawEvent(t){const{name:s,attributes:n}=t;o(`track raw event '${s}'`,n),this.ensureIdentified(),await this.send({kind:"TrackRawEvent",name:s,attributes:this.normalizeEventAttributes(n)})}normalizeEventAttributes(t){const s=this.normalizeAttributes(t);for(const n in s){if(!s.hasOwnProperty(n))continue;const i=s[n];if(!(i==null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||Array.isArray(i)||"set"in i))throw new h(`Userflow: Invalid value for '${n}' attribute. Event attributes only support literal values, list values and 'set' changes.`)}return s}onFirstIdentify(){this.onFirstIdentifyRun||(this.onFirstIdentifyRun=!0,this.onFirstIdentifyTimeout=window.setTimeout(()=>{this.trackPageViewed(),this.firstIdentifyCallback?(this.firstIdentifyCallback(),this.firstIdentifyCallback=null):this.checkUrlForStartFlow()},0))}onceIdentified(t){this.isIdentified()?t():this.firstIdentifyCallback=t}checkUrlForStartFlow(){const t=new URL(m()),s=t.searchParams.get("userflow")||t.searchParams.get("studio1_flow")||t.searchParams.get("studio1_walkthrough");s&&(o(`url contained flow ${s}`),this.startFlow({flowId:s,startReason:p.LINK,batch:!0}),t.searchParams.delete("userflow"),t.searchParams.delete("studio1_flow"),t.searchParams.delete("studio1_walkthrough"),window.history.replaceState({},"",t.toString()),this.clientContext=this.buildClientContext(),this.pushUpdateClientContext())}flushUrlChange(){const t=this.buildClientContext();(!this.clientContext||t.pageUrl!==this.clientContext.pageUrl)&&(this.clientContext=t,this.pushUpdateClientContext(),this.trackPageViewed(),this.checkUrlForStartFlow())}async trackPageViewed(){this.featureFlags&&this.featureFlagEnabled("cff_disable_page_views")===!0||(this.pageTrackingDisabled||this.track("page_viewed",{}),this.trackRawPageViewed())}async trackRawPageViewed(){this.featureFlags&&(this.featureFlagEnabled("cff_implicit_events")===!1||this.featureFlagEnabled("cff_disable_page_views")===!0)||this.trackRawEvent({name:"page_viewed",attributes:{id:b(),page_title:document.title,...this.buildClientContext()}})}buildClientContext(){let t=null;const s=d.getItem(w);if(s){const i=new URL(m()).pathname.match(/^\/([^/]+)\/?(?:\/([^/]+)\/?)?$/);i&&(t=i[1])}return{pageUrl:tt(),viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,...s&&{siteId:s},...t&&{localeCode:t}}}pushUpdateClientContext(){this.send({kind:"UpdateClientContext",clientContext:this.clientContext},{batch:!0})}ackCompletedTask(t){this.unackedTasks.delete(t)}taskIsUnacked(t){return this.unackedTasks.has(t)}isIdentified(){return this.externalId!=null}on(t,s){let n=this.listeners.get(t);n||(n=new Set,this.listeners.set(t,n)),n.add(s)}off(t,s){const n=this.listeners.get(t);n&&n.delete(s)}emit(t,...s){const n=this.listeners.get(t);n&&Array.from(n).forEach(r=>r(...s))}observeUserActivity(){document.addEventListener("mouseover",this.onUserActivity),document.addEventListener("pointerdown",this.onUserActivity),document.addEventListener("keydown",this.onUserActivity)}unobserveUserActivity(){document.removeEventListener("mouseover",this.onUserActivity),document.removeEventListener("pointerdown",this.onUserActivity),document.removeEventListener("keydown",this.onUserActivity)}reset(){o("reset"),this.externalId=null,this.groupId=null,this.sessionStorageState=null,this.setFlowSession(null,0),this.setChecklistSession(null,0),this.setBannerSession(null),this.setResourceCenterSession(null),this.resourceCenterLauncherHidden=null,this.launcherSessions=[],this.activeLauncherFlowId=null,this.notifications=[],this.unackedTasks=new Set,this.onFirstIdentifyRun=!1,window.clearTimeout(this.onFirstIdentifyTimeout),this.onFirstIdentifyTimeout=void 0,this.clientContext=null,this.unobserveUserActivity(),window.clearTimeout(this.flushUrlChangeTimeout),this.flushUrlChangeTimeout=void 0,this.clientConditions.forEach((t,s)=>{this.untrackClientCondition(s)}),this.firstIdentifyCallback=null,this.testUserIdentified=!1,C.removeItem("anonymousId"),this.unmountUI(),this.disconnect(),this.inBatch=!1,window.clearTimeout(this.endBatchTimeout),this.endBatchTimeout=void 0,this.clientClock=1,this.serverClock=1,this.titleMonitored=void 0,this.titleObserver&&(this.titleObserver.disconnect(),this.titleObserver=void 0)}async startFlow({flowId:t,stepCvid:s,startReason:n,once:i,batch:r,replaceCurrent:a}){if(this.ensureIdentified(),a&&this.flowSession&&this.endFlow(this.flowSession,{endReason:U.REPLACED,batch:!0}),o(`startFlow ${t}`,{startReason:n}),this.checklistSession?.flow.id===t){o("startFlow matches current checklist, so showing it instead"),this.showChecklist();return}const l={kind:"StartFlow",flowId:t,stepCvid:s,startReason:n,once:!!i};await this.send(l,{batch:r})}async trackButtonEvent(t,s,n,i){const r={kind:"TrackButtonEvent",eventName:t,stepCvid:n,sessionId:i,token:s};await this.send(r,{batch:!0})}async startFlowWithToken(t){this.ensureIdentified(),o("startFlowWithToken",{token:t}),await this.send({kind:"StartFlowWithToken",token:t},{batch:!0})}optimisticClockUIUpdate(t){this.clientClock++,t(),this.toggleUI()}async showChecklist(){if(this.resourceCenterEmbedsChecklist()&&!this.embedChecklistSessions()){this.openResourceCenter();return}this.embedChecklistSessions()||(this.unmarkExpandPending(),!(!this.checklistSession||this.checklistExpanded)&&(this.ensureIdentified(),this.checklistExpanded=!0,this.toggleUI(),d.setItem(`checklistExpanded:${this.checklistSession.id}`,"1"),await this.send({kind:"ShowChecklist",sessionId:this.checklistSession.id},{batch:!0})))}async hideChecklist(){if(this.resourceCenterEmbedsChecklist()){this.closeResourceCenter();return}!this.checklistSession||!this.checklistExpanded||(this.ensureIdentified(),this.checklistExpanded=!1,this.toggleUI(),d.removeItem(`checklistExpanded:${this.checklistSession.id}`),await this.send({kind:"HideChecklist",sessionId:this.checklistSession.id},{batch:!0}))}async unmarkExpandPending(){!this.checklistSession||!this.checklistExpandPending||(this.checklistExpandPending=!1,await this.send({kind:"UnmarkExpandPending",sessionId:this.checklistSession.id},{batch:!0}))}async openResourceCenter(){this.resourceCenterEmbedsChecklist()&&this.unmarkExpandPending(),!(!this.resourceCenterSession||this.resourceCenterOpen)&&(this.ensureIdentified(),this.resourceCenterOpen=!0,this.toggleUI(),this.emit("resourceCenterChanged"),d.setItem(`resourceCenterOpen:${this.resourceCenterSession.id}`,"1"),await this.send({kind:"OpenResourceCenter",sessionId:this.resourceCenterSession.id},{batch:!0}))}async closeResourceCenter(){!this.resourceCenterSession||!this.resourceCenterOpen||(this.ensureIdentified(),this.resourceCenterOpen=!1,this.toggleUI(),this.emit("resourceCenterChanged"),d.removeItem(`resourceCenterOpen:${this.resourceCenterSession.id}`),await this.send({kind:"CloseResourceCenter",sessionId:this.resourceCenterSession.id},{batch:!0}))}toggleResourceCenter(){this.resourceCenterOpen?this.closeResourceCenter():this.openResourceCenter()}setResourceCenterLauncherHidden(t){this.resourceCenterLauncherHidden=t,this.toggleUI()}getResourceCenterState(){if(!this.resourceCenterSession)return null;const t=this.resourceCenterEmbedsChecklist(),{checklistSession:s}=this,n=this.resourceCenterSession.version.resourceCenter?.blocks.find(i=>i.type===R.ANNOUNCEMENTS);return{isOpen:this.resourceCenterOpen,hasChecklist:t,uncompletedChecklistTaskCount:t&&s?it(s):0,unreadAnnouncementCount:n?.unreadAnnouncementCount||0}}resourceCenterEmbedsChecklist(){const t=this.resourceCenterSession;return!!t&&!!t.version.resourceCenter?.blocks.some(s=>s.type===R.CHECKLIST)}embedChecklistSessions(){return this.embedSessions.some(t=>!!t.version.embed?.blocks?.some(s=>s.type===K.CHECKLIST))}async endFlow(t,{endReason:s,batch:n}){this.ensureIdentified(),this.optimisticClockUIUpdate(()=>{const{clientClock:l}=this;this.flowSession?.id===t.id&&this.setFlowSession(null,l),this.checklistSession?.id===t.id&&this.setChecklistSession(null,l),this.bannerSession?.id===t.id&&this.setBannerSession(null),this.resourceCenterSession?.id===t.id&&this.setResourceCenterSession(null),this.workflowSession?.id===t.id&&this.setWorkFlowSession(null)});const{flow:i}=t,r={id:i.id,type:i.type.toLowerCase()};i.type===L.CHECKLIST?this.emit("checklistEnded",{checklist:r,endReason:s}):i.type===L.FLOW&&this.emit("flowEnded",{flow:r,endReason:s});const a={kind:"EndFlow",sessionId:t.id,endReason:s};await this.send(a,{batch:n})}async goToStep(t,s){o("goToStep",t.id,s.name||s.id),this.ensureIdentified();const n=this.send({kind:"GoToStep",sessionId:t.id,stepId:s.id});t.currentStep=s,this.emit("gotostep",{session:t,step:s}),await n}async endAllFlows(){o("endAllFlows"),this.optimisticClockUIUpdate(()=>{const{clientClock:t}=this;this.setFlowSession(null,t),this.setChecklistSession(null,t)}),await this.send({kind:"EndAllFlows"})}async endChecklist(){o("endChecklist");const t=this.checklistSession||this.flowSession;t?.flow.type===L.CHECKLIST&&this.endFlow(t,{endReason:U.USERFLOWJS})}setFlowSession(t,s=this.clientClock){const n=this.flowSession;this.flowSession=t,this.flowSessionClock=s,t&&!n&&(this.hideChecklist(),this.closeResourceCenter()),t==null&&this.originalActiveElement&&(typeof this.originalActiveElement.focus=="function"&&this.originalActiveElement.focus(),this.originalActiveElement=void 0)}setWorkFlowSession(t){this.workflowSession=t}setChecklistSession(t,s=this.clientClock){const n=this.checklistSession;this.checklistSession=t,this.checklistSessionClock=s,t===null&&(this.checklistExpanded=!1,this.checklistExpandPending=!1),t&&t.id!==n?.id&&(this.checklistExpanded=!!d.getItem(`checklistExpanded:${t.id}`),t.expandPending&&(this.checklistExpandPending=!0)),this.emit("checklistChanged"),this.emit("resourceCenterChanged")}setBannerSession(t){this.bannerSession=t}setResourceCenterSession(t){const s=this.resourceCenterSession;t=typeof t=="function"?t(this.resourceCenterSession):t,this.resourceCenterSession=t,t===null&&(this.resourceCenterOpen=!1),s&&s.id!==t?.id&&d.removeItem(`resourceCenterOpen:${s.id}`),t&&t.id!==s?.id&&(this.resourceCenterOpen=!!d.getItem(`resourceCenterOpen:${t.id}`)),this.emit("resourceCenterChanged")}launcherSeen(t){this.send({kind:"StartFlow",flowId:t,startReason:p.LAUNCHER_SEEN,once:!1})}activateLauncher(t){const s=this.activeLauncherFlowId&&this.launcherSessions.find(n=>n.flow.id===this.activeLauncherFlowId);s&&this.deactivateLauncher(s),this.activeLauncherFlowId=t.flow.id,this.toggleUI(),this.send({kind:"ActivateLauncher",flowId:t.flow.id})}deactivateLauncher(t){const{launcher:s}=t.version;t.flow.id===this.activeLauncherFlowId&&(s?.dismissOn===V.DEACTIVATE?this.dismissLauncher(t,{endReason:U.LAUNCHER_DEACTIVATED}):(this.activeLauncherFlowId=null,this.toggleUI()))}dismissLauncher(t,{endReason:s}){const n=t.flow.id;this.removeLauncher(n),this.toggleUI(),this.send({kind:"DismissLauncher",flowId:n,endReason:s})}removeLauncher(t){const s=this.launcherSessions.findIndex(n=>n.flow.id===t);return s===-1?!1:(this.launcherSessions=[...this.launcherSessions.slice(0,s),...this.launcherSessions.slice(s+1)],t===this.activeLauncherFlowId&&(this.activeLauncherFlowId=null),!0)}async toggleUI(){const t=this.getSessionStorageState();!this.flowSession&&!this.workflowSession&&(this.checklistExpandPending||this.checklistSession?.version.checklist?.tasks.some(s=>this.taskIsUnacked(s.cvid)))&&this.showChecklist(),t.isTargetTab&&this.monitorTitle(),this.emit("uistatechange"),this.shouldBeMounted()?await this.mountUI():this.unmountUI()}shouldBeMounted(){return this.uiDisabled||this.siteSession?.id||d.getItem(w)?!1:!!this.getSessionStorageState().activeApp||!!this.flowSession||!!this.workflowSession||!!this.checklistSession&&(this.checklistExpanded||!!this.checklistSession?.version.checklist?.launcherEnabled)||!!this.bannerSession||!!this.resourceCenterSession||this.launcherSessions.length>0||this.notifications.length>0}async mountUI(){if(!this.ui){const t=await this.createUI();this.shouldBeMounted()&&!this.ui&&(o("mount UI"),this.ui=t,this.ui.mount())}}unmountUI(){this.ui&&(o("unmount UI"),this.ui.unmount(),this.ui=null)}checkDebuggerSession(){if(this.debuggerUI)return;const t=this.sessionStorageState?.debuggerApp;t&&t?.x&&t?.y&&this.mountDebugger()}async mountDebugger(){if(!this.debuggerMountInProgress){if(this.debuggerUI){this.debuggerUI.unmount();return}this.debuggerMountInProgress=!0;try{const{DebuggerUI:t}=await I(async()=>{const{DebuggerUI:s}=await import("./DebuggerUI.js");return{DebuggerUI:s}},__vite__mapDeps([50,1,2,18,19,3,4,5,6,17,12,13,14,9,10,11,20,22,15,48,47,46,28,33,34]));this.debuggerUI=new t(this,N),this.debuggerUI.mount()}catch(t){console.error("Userflow: Failed to mount debugger UI",t)}finally{this.debuggerMountInProgress=!1}}}unMountDebugger(){this.debuggerUI=null}remount(){this.unmountUI(),this.toggleUI()}async createUI(){try{const t=I(()=>import("./ui.js"),__vite__mapDeps([51,1,2,18,19,3,4,5,6,33,34]));this.bannerSession&&nt(),this.resourceCenterSession&&st();const{RealUI:s}=await t;return new s(this)}catch(t){throw this.reportCspIssue(),t}}async trackClientCondition(t){if(this.clientConditions.has(t.id))return;o("track client condition",t),this.clientConditions.set(t.id,{condition:t,isTrue:null});const{conditionTypes:s}=await I(async()=>{const{conditionTypes:r}=await import("./flow-condition-types.js").then(a=>a.f);return{conditionTypes:r}},__vite__mapDeps([9,2,10,5,11])),n=s[t.type],i=this.clientConditions.get(t.id);i&&(i.untrack=n.track({sessionData:new P([]),condition:t,callback:r=>{i.isTrue!==r&&(o("client condition truthiness changed",r,i.condition),i.isTrue=r,this.send({kind:"ToggleClientCondition",conditionId:t.id,isTrue:r},{batch:!0}))}}))}untrackClientCondition(t){const s=this.clientConditions.get(t);s&&(o("untrack client condition",s.condition),s.untrack&&s.untrack(),this.clientConditions.delete(t))}async addTracker(t){let s=this.trackers.get(t.flowId);s?s.tracker=t:this.trackers.set(t.flowId,{tracker:t,isTrue:!1});const{conditionTypes:n}=await I(async()=>{const{conditionTypes:u}=await import("./flow-condition-types.js").then(c=>c.f);return{conditionTypes:u}},__vite__mapDeps([9,2,10,5,11])),i=this.trackers.get(t.flowId);if(!i)return;const{tracker:r}=i,{condition:a}=r,l=n[a.type];i.untrack&&i.untrack(),i.untrack=l.track({sessionData:new P(r.data),condition:a,flipBackEvents:!0,callback:u=>{const c=i.isTrue;i.isTrue=u,!c&&u&&this.send({kind:"TrackTrackerEvent",token:r.token},{batch:!0})},description:`event tracker ${r.flowId}`}),this.emit("private:trackerStarted")}removeTracker(t){const s=this.trackers.get(t);s&&(s.untrack&&s.untrack(),this.trackers.delete(t),this.emit("private:trackerStopped"))}monitorTitle(){if(this.titleMonitored)return;this.titleMonitored=!0,this.fixTitle();const t=document.querySelector("title");if(t){const s=new MutationObserver(()=>{this.fixTitle()});s.observe(t,{childList:!0}),this.titleObserver=s}}fixTitle(){const t=document.title,n="[Userflow Preview] "+t.replace(/\[Userflow Preview\]\s*/g,"");t!==n&&(document.title=n)}reportCspIssue(){const t=this.getSessionStorageState();(this.testUserIdentified||t.activeApp)&&!this.cspIssueReported&&(this.cspIssueReported=!0,o("csp issue detected"),A({kind:"userflow:crxCspIssueDetected"}))}getAudio(){return this.audio||(this.audio=new Audio),this.audio}playAudio(t){if(document.hidden)return;const s=this.getAudio();t&&(s.src=t);const n=s.play();this.audioReady=!0,n&&n.catch(i=>{i.name})}pauseAudio(){const t=this.audio;t&&!t.paused&&t.pause()}async getStepSpeech(t,s){return(await this.send({kind:"GetStepSpeechV2",syntheticVoice:t,text:s})).url}featureFlagEnabled(t){return this.featureFlags?this.featureFlags.has(t):!1}showNotification(t,s,n){const r={id:++this.notificationIdCounter,label:t,message:s,type:n};this.notifications=[...this.notifications,r],this.toggleUI()}dismissNotification(t){this.notifications=this.notifications.filter(s=>s.id!==t),this.toggleUI()}warn(...t){console.warn(...t)}nextRef(){return this.refCounter++}}if(typeof window.userflow>"u"||window.userflow._stubbed){const e=Object.assign(window.userflow||{},ct());window.userflow=e,window.studio1=e,lt()}function ct(){const e=new at;return{_stubbed:!1,init(t){e.init(t)},identify(t,s={},n={}){return e.identify(t,s,n)},identifyAnonymous(t={},s={}){return e.identifyAnonymous(t,s)},isIdentified(){return e.isIdentified()},updateUser(t,s={}){return e.updateUser(t,s)},group(t,s={},n={}){return e.group(t,s,n)},updateGroup(t,s={}){return e.updateGroup(t,s)},track(t,s={},n={}){return e.track(t,s,n)},start(t,{once:s}={}){return e.startFlow({flowId:t,startReason:p.USERFLOWJS,once:s})},startFlow(t){return console.warn("Userflow.js: userflow.startFlow() has been deprecated. Use userflow.start() instead."),window.userflow.start(t)},startWalk(t){return console.warn("Userflow.js: userflow.startWalk() has been deprecated. Use userflow.start() instead."),window.userflow.start(t)},endAll(){return e.endAllFlows()},endChecklist(){return e.endChecklist()},endAllFlows(){"Userflow.js: userflow.endAllFlows() has been deprecated. Use userflow.endAll() instead.";return window.userflow.endAll()},async endFlow(){console.warn("Userflow.js: userflow.endFlow() has been deprecated and no longer has any effect.")},async endWalk(){console.warn("Userflow.js: userflow.endWalk() has been deprecated and no longer has any effect.")},openResourceCenter(){e.openResourceCenter()},closeResourceCenter(){e.closeResourceCenter()},toggleResourceCenter(){e.toggleResourceCenter()},setResourceCenterLauncherHidden(t){e.setResourceCenterLauncherHidden(t)},getResourceCenterState(){return e.getResourceCenterState()},setWalkPosition(){console.warn("Userflow.js: userflow.setWalkPosition() has been deprecated and no longer has any effect.")},reset(){e.reset()},remount(){e.remount()},on(t,s){e.on(t,s)},off(t,s){e.off(t,s)},setCustomInputSelector(t){console.warn("Userflow.js: userflow.setCustomInputSelector() has been deprecated. Use userflow.registerCustomInput() instead. See docs: https://userflow.com/docs/userflow-js"),t&&f.customInputs.push({cssSelector:t})},registerCustomInput(t,s){f.customInputs.push({cssSelector:t,getValue:s})},setCustomNavigate(t){f.customNavigate=t},setUrlFilter(t){f.urlFilter=t},setLinkUrlDecorator(t){f.linkUrlDecorator=t,e.emit("uistatechange")},setInferenceAttributeNames(t){f.inferenceAttributeNames=t},setInferenceAttributeFilter(t,s){f.inferenceAttributeFilters[t]=M(s)},setInferenceClassNameFilter(t){f.inferenceClassNameFilters=M(t)},setScrollPadding(t){f.scrollPadding=t},setCustomScrollIntoView(t){f.customScrollIntoView=t},prepareAudio(){e.playAudio(null)},setShadowDomEnabled(t){console.warn("Userflow.js: userflow.setShadowDomEnabled() has been deprecated. Please remove this call from your Userflow.js snippet. Shadow DOM is supported by default now.")},setPageTrackingDisabled(t){e.pageTrackingDisabled=t},setBaseZIndex(t){f.baseZIndex=t},setServerEndpoint(t){f.serverEndpoint=t},disableEvalJs(){f.evalJsDisabled=!0},_setTargetEnv(t){e.setTargetEnv(t)},debugger(){return e.mountDebugger()},mountSitePage(t,s){return e.mountSitePage(t,s)}}}function lt(){const e=window.userflow,t=window.USERFLOWJS_QUEUE;if(delete window.USERFLOWJS_QUEUE,!(!t||t.length===0)){o(`processing ${t.length} items in the queue`);for(const[s,n,i]of t){if(typeof e[s]!="function"){console.error(`Userflow.js: Invalid method '${s}' in queue`);continue}const r=e[s](...i);n&&r&&typeof r.then=="function"&&r.then(n.resolve,n.reject)}o("queue processed")}}var St=window.userflow;export{$e as $,Be as A,Te as B,S as C,Qe as D,U as E,ge as F,Ee as G,he as H,nt as I,st as J,R as K,ye as L,d as M,it as N,Le as O,Ue as P,Me as Q,He as R,P as S,Pe as T,h as U,qe as V,Xe as W,C as X,Ie as Y,Ae as Z,I as _,se as a,A as a0,x as a1,Z as a2,me as a3,ke as a4,we as a5,_e as a6,pe as a7,Ce as a8,ie as a9,De as aa,je as ab,Ve as ac,We as ad,Ge as ae,Ke as af,xe as ag,Fe as ah,Ye as ai,Ze as aj,Je as ak,ze as al,re as am,Se as b,f as c,o as d,St as default,Re as e,ve as f,m as g,p as h,Oe as i,be as j,le as k,oe as l,tt as m,ue as n,q as o,Ne as p,ce as q,ae as r,ft as s,Et as t,F as u,B as v,ne as w,de as x,fe as y,L as z};
|
|
17
|
+
If in doubt, reach out to us at support@userflow.com.`);this.pushRateLimitMinute++}handleServerMessage(e){o(`received ${e.kind} message`,e);const{serverClock:s,flowSession:n,flowSessionClock:i,checklistSession:r,checklistSessionClock:a,bannerSession:l,resourceCenterSession:u}=this;switch(e.kind){case"CheckSessionsAck":this.emit("private:checkSessionsAck");return;case"ServerDebug":return;case"AddLauncher":{const{session:c}=e,E=this.launcherSessions.findIndex(g=>g.flow.id===c.flow.id);E===-1?this.launcherSessions=[...this.launcherSessions,c]:this.launcherSessions=[...this.launcherSessions.slice(0,E),c,...this.launcherSessions.slice(E+1)],this.toggleUI();return}case"AddTracker":{this.addTracker(e.tracker);return}case"AssistantMessageEventWrapper":{this.emit("private:assistantMessageEvent",e);return}case"CancelConditionWaitTimer":window.clearTimeout(this.conditionWaitTimers.get(e.conditionId)),this.conditionWaitTimers.delete(e.conditionId);return;case"ChecklistTaskCompleted":this.unackedTasks.add(e.taskCvid);return;case"ForceGoToStep":if(i>s){o(`ignoring ${e.kind} message due to stale clock flowSessionClock=${i} > serverClock=${s}`);return}n?.id===e.sessionId&&this.emit("gotostep",{session:n,step:{id:e.stepId}});return;case"RemoveLauncher":this.removeLauncher(e.flowId)&&this.toggleUI();return;case"RemoveTracker":{this.removeTracker(e.flowId);return}case"SetBannerSession":this.setBannerSession(e.session),this.toggleUI();return;case"SetChecklistSession":a<=s||r?.id===e.session.id?(this.setChecklistSession(e.session,s),this.toggleUI()):o(`ignoring ${e.kind} message due to stale clock checklistSessionClock=${a} > serverClock=${s}`);return;case"SetFlowSession":i<=s||n?.id===e.session.id?(this.setFlowSession(e.session,s),this.emit("private:setFlowSession",e.session.version.id),this.toggleUI()):o(`ignoring ${e.kind} message due to stale clock flowSessionClock=${i} > serverClock=${s}`);return;case"SetResourceCenterSession":this.emit("private:resourceCenterSession",e.session),this.setResourceCenterSession(e.session),this.toggleUI();return;case"StartConditionWaitTimer":{if(!this.conditionWaitTimers.has(e.conditionId)){const c=window.setTimeout(()=>{this.conditionWaitTimers.delete(e.conditionId),this.send({kind:"FireConditionWaitTimer",conditionId:e.conditionId},{batch:!0})},parseFloat(e.waitTime)*1e3);this.conditionWaitTimers.set(e.conditionId,c)}return}case"TestStartConditionSuccess":this.emit("private:testStartConditionSuccess");return;case"TrackClientCondition":this.trackClientCondition(e.condition);return;case"UnsetBannerSession":l?.id===e.sessionId&&(this.setBannerSession(null),this.toggleUI());return;case"UnsetChecklistSession":if(a>s){o(`ignoring ${e.kind} message due to stale clock checklistSessionClock=${a} > serverClock=${s}`);return}r?.id===e.sessionId&&(this.setChecklistSession(null,s),this.toggleUI());return;case"UnsetFlowSession":if(i>s){o(`ignoring ${e.kind} message due to stale clock flowSessionClock=${i} > serverClock=${s}`);return}n?.id===e.sessionId&&(this.setFlowSession(null,s),this.toggleUI());return;case"UnsetResourceCenterSession":u?.id===e.sessionId&&(this.setResourceCenterSession(null),this.toggleUI());return;case"UntrackClientCondition":this.untrackClientCondition(e.conditionId);return;case"AddEmbed":{const c=this.embedSessions?.findIndex(E=>E.flow.id===e.session.flow.id);c!==void 0&&c>=0?this.embedSessions=[...this.embedSessions?.slice(0,c)||[],e.session,...this.embedSessions?.slice(c+1)||[]]:this.embedSessions=[...this.embedSessions||[],e.session],this.emit("uistatechange");break}case"RemoveEmbed":{this.embedSessions=(this.embedSessions||[]).filter(c=>c.flow.id!==e.flowId),this.emit("uistatechange");break}case"SetSiteSession":{this.siteSession=e.session,this.emit("private:siteSession",e.session);break}case"UnsetSiteSession":{this.siteSession=null,h.removeItem(w),this.emit("private:unsetSiteSession");break}case"SetWorkflowSession":{this.setWorkFlowSession(e.session),this.toggleUI();break}case"UnsetWorkflowSession":{this.setWorkFlowSession(null),this.toggleUI();break}case"WorkflowFillStepValue":{this.emit("private:workflowFillStepValue",e);break}default:console.warn("Userflow.js: Received unknown message",e);return}}async identify(e,s={},{signature:n}={}){if(o("identify",e),this.ensureInit(),this.testUserIdentified&&e!==this.externalId){o("identify() ignored since a test user has been identified");return}if(typeof e=="number")e=String(e);else if(!e||typeof e!="string")throw new d(`userflow.identify: First argument must be a non-empty string representing the user's ID in your database. Value received: ${JSON.stringify(e)}`);this.externalId&&e!==this.externalId&&(o("identify resetting due to new externalId"),this.reset()),this.externalId=e,this.signature=n||null,this.observeUserActivity(),await Promise.all([this.send({kind:"UpsertUser",attributes:this.normalizeAttributes(s)},{batch:!0}),this.onFirstIdentify()]),this.emit("private:identified")}async identifyAnonymous(e={},s={}){if(!C.isSupported())throw new d("userflow.identifyAnonymous() is not supported when localStorage access is denied.");const n="anonymousId";let i=C.getItem(n);i||(i="anon-"+b(),C.setItem(n,i)),await this.identify(i,e,s)}getInitToken(){return this.clientToken}getIdentifiedUser(){return{externalId:this.externalId}}async updateUser(e={},s={}){o("updateUser"),this.ensureIdentified(),await this.send({kind:"UpsertUser",attributes:this.normalizeAttributes(e)},{batch:!0})}async group(e,s={},{signature:n,membership:i}={}){if(o("group",e),this.ensureIdentified(),this.testUserIdentified&&e!==this.groupId){o("group() ignored since a test user has been identified");return}if(typeof e=="number")e=String(e);else if(!e||typeof e!="string")throw new d(`userflow.group: First argument must be a non-empty string representing the group's ID in your database. Value received: ${JSON.stringify(e)}`);this.groupId=e,this.groupSignature=n||null,await this.send({kind:"UpsertGroup",groupExternalId:e,groupSignature:this.groupSignature,groupAttributes:this.normalizeAttributes(s),membershipAttributes:this.normalizeAttributes(i)},{batch:!0})}async updateGroup(e={},s={}){o("updateGroup");const n=this.ensureGroup();await this.send({kind:"UpsertGroup",groupExternalId:n,groupSignature:this.groupSignature,membershipAttributes:this.normalizeAttributes(s.membership),groupAttributes:this.normalizeAttributes(e)},{batch:!0})}normalizeAttributes(e){if(e==null)return{};if(typeof e!="object")throw new d("Userflow: 'attributes' must be an object.");const s={};for(const n in e){if(!e.hasOwnProperty(n))continue;if(n==="traits"){const r=e[n];Object.assign(s,this.extractLegacyTraits(r));continue}let i=e[n];if(typeof i=="string"||typeof i=="number"||typeof i=="boolean"||i==null||Array.isArray(i))s[n]=this.normalizeAttributeLiteralOrList(n,i);else{if(typeof i!="object"||i==null)throw new d(`Userflow: Invalid value for '${n}' attribute.`);if("set"in i)s[n]={set:this.normalizeAttributeLiteralOrList(n,i.set),dataType:this.normalizeDataType(n,i.data_type||i.dataType)};else if("set_once"in i||"setOnce"in i)s[n]={setOnce:this.normalizeAttributeLiteralOrList(n,i.set_once??i.setOnce),dataType:this.normalizeDataType(n,i.data_type||i.dataType)};else if("add"in i){const r=i.add;if(typeof r!="string"&&typeof r!="number")throw new d(`Userflow: Invalid 'add' value for '${n}' attribute. Must be a number or string.`);s[n]={add:r}}else if("subtract"in i){const r=i.subtract;if(typeof r!="string"&&typeof r!="number")throw new d(`Userflow: Invalid 'subtract' value for '${n}' attribute. Must be a number or string.`);s[n]={subtract:r}}else if("append"in i)s[n]={append:this.normalizeAttributeLiteralOrList(n,i.append)};else if("prepend"in i)s[n]={prepend:this.normalizeAttributeLiteralOrList(n,i.prepend)};else if("remove"in i)s[n]={remove:this.normalizeAttributeLiteralOrList(n,i.remove)};else throw new d(`Userflow: Invalid value for '${n}' attribute.`)}}return s}normalizeAttributeLiteralOrList(e,s){return Array.isArray(s)?s.map(n=>this.normalizeAttributeLiteral(e,n)):this.normalizeAttributeLiteral(e,s)}normalizeAttributeLiteral(e,s){if(s==null)return null;if(typeof s=="string"||typeof s=="number"||typeof s=="boolean")return s;throw new d(`Userflow: Invalid value for '${e}' attribute.`)}normalizeDataType(e,s){if(!s)return null;switch(s){case"string":return S.STRING;case"number":return S.NUMBER;case"boolean":return S.BOOLEAN;case"datetime":return S.DATETIME}throw new d(`Userflow: Invalid data_type for '${e}' attribute.`)}extractLegacyTraits(e){if(!e)return{};if(!Array.isArray(e)){const s=[];for(const n in e)e.hasOwnProperty(n)&&s.push({name:n,value:e[n]});e=s}return e.reduce((s,{name:n,value:i,dataType:r})=>{if(typeof n!="string"||n.length>100||!n.match(/^[a-z0-9_]+$/))return this.warn("Userflow.identify: Invalid trait name (must be string, no more than 100 characters, and only consist of a-z, 0-9 and underscores). The trait will be ignored. Name was:",n),s;if(typeof i!="string")if(typeof i=="boolean")r||(r="boolean"),i=i?"true":"false";else if(typeof i=="number")r||(r=Number.isInteger(i)?"integer":"decimal"),i=String(i);else return this.warn(`userflow.identify: The value of trait '${n}' is invalid (must be a string, a boolean or a number). The trait will be ignored. Value was:`,i),s;let a=null;if(r)switch(r){case"string":a=S.STRING;break;case"boolean":a=S.BOOLEAN;break;case"integer":a=S.NUMBER;break;case"decimal":a=S.NUMBER;break;case"datetime":a=S.DATETIME;break;default:return this.warn(`userflow.identify: The data type of trait '${n}' is invalid (must be a 'string', 'boolean', 'integer', 'decimal' or 'datetime'). The trait will be ignored. Data type was:`,r),s}return s[n]={set:i,dataType:a},s},{})}async track(e,s={},{userOnly:n}={}){o(`track '${e}'`,s),this.ensureIdentified(),await this.send({kind:"TrackEvent",userOnly:!!n,name:e,attributes:this.normalizeEventAttributes(s)},{batch:!0})}async trackRawEvent(e){const{name:s,attributes:n}=e;o(`track raw event '${s}'`,n),this.ensureIdentified(),await this.send({kind:"TrackRawEvent",name:s,attributes:this.normalizeEventAttributes(n)})}normalizeEventAttributes(e){const s=this.normalizeAttributes(e);for(const n in s){if(!s.hasOwnProperty(n))continue;const i=s[n];if(!(i==null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||Array.isArray(i)||"set"in i))throw new d(`Userflow: Invalid value for '${n}' attribute. Event attributes only support literal values, list values and 'set' changes.`)}return s}onFirstIdentify(){this.onFirstIdentifyRun||(this.onFirstIdentifyRun=!0,this.onFirstIdentifyTimeout=window.setTimeout(()=>{this.trackPageViewed(),this.firstIdentifyCallback?(this.firstIdentifyCallback(),this.firstIdentifyCallback=null):this.checkUrlForStartFlow()},0))}onceIdentified(e){this.isIdentified()?e():this.firstIdentifyCallback=e}checkUrlForStartFlow(){const e=new URL(U()),s=e.searchParams.get("userflow")||e.searchParams.get("studio1_flow")||e.searchParams.get("studio1_walkthrough");s&&(o(`url contained flow ${s}`),this.startFlow({flowId:s,startReason:N.LINK,batch:!0}),e.searchParams.delete("userflow"),e.searchParams.delete("studio1_flow"),e.searchParams.delete("studio1_walkthrough"),window.history.replaceState({},"",e.toString()),this.clientContext=this.buildClientContext(),this.pushUpdateClientContext())}flushUrlChange(){const e=this.buildClientContext();(!this.clientContext||e.pageUrl!==this.clientContext.pageUrl)&&(this.clientContext=e,this.pushUpdateClientContext(),this.trackPageViewed(),this.checkUrlForStartFlow())}async trackPageViewed(){this.featureFlags&&this.featureFlagEnabled("cff_disable_page_views")===!0||(this.pageTrackingDisabled||this.track("page_viewed",{}),this.trackRawPageViewed())}async trackRawPageViewed(){this.featureFlags&&(this.featureFlagEnabled("cff_implicit_events")===!1||this.featureFlagEnabled("cff_disable_page_views")===!0)||this.trackRawEvent({name:"page_viewed",attributes:{id:b(),page_title:document.title,...this.buildClientContext()}})}buildClientContext(){let e=null;const s=h.getItem(w);if(s){const i=new URL(U()).pathname.match(/^\/([^/]+)\/?(?:\/([^/]+)\/?)?$/);i&&(e=i[1])}return{pageUrl:tt(),viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,...s&&{siteId:s},...e&&{localeCode:e}}}pushUpdateClientContext(){this.send({kind:"UpdateClientContext",clientContext:this.clientContext},{batch:!0})}ackCompletedTask(e){this.unackedTasks.delete(e)}taskIsUnacked(e){return this.unackedTasks.has(e)}isIdentified(){return this.externalId!=null}on(e,s){let n=this.listeners.get(e);n||(n=new Set,this.listeners.set(e,n)),n.add(s)}off(e,s){const n=this.listeners.get(e);n&&n.delete(s)}emit(e,...s){const n=this.listeners.get(e);n&&Array.from(n).forEach(r=>r(...s))}observeUserActivity(){document.addEventListener("mouseover",this.onUserActivity),document.addEventListener("pointerdown",this.onUserActivity),document.addEventListener("keydown",this.onUserActivity)}unobserveUserActivity(){document.removeEventListener("mouseover",this.onUserActivity),document.removeEventListener("pointerdown",this.onUserActivity),document.removeEventListener("keydown",this.onUserActivity)}reset(){o("reset"),this.externalId=null,this.groupId=null,this.sessionStorageState=null,this.setFlowSession(null,0),this.setChecklistSession(null,0),this.setBannerSession(null),this.setResourceCenterSession(null),this.resourceCenterLauncherHidden=null,this.launcherSessions=[],this.activeLauncherFlowId=null,this.notifications=[],this.unackedTasks=new Set,this.onFirstIdentifyRun=!1,window.clearTimeout(this.onFirstIdentifyTimeout),this.onFirstIdentifyTimeout=void 0,this.clientContext=null,this.unobserveUserActivity(),window.clearTimeout(this.flushUrlChangeTimeout),this.flushUrlChangeTimeout=void 0,this.clientConditions.forEach((e,s)=>{this.untrackClientCondition(s)}),this.firstIdentifyCallback=null,this.testUserIdentified=!1,C.removeItem("anonymousId"),this.unmountUI(),this.disconnect(),this.inBatch=!1,window.clearTimeout(this.endBatchTimeout),this.endBatchTimeout=void 0,this.clientClock=1,this.serverClock=1,this.titleMonitored=void 0,this.titleObserver&&(this.titleObserver.disconnect(),this.titleObserver=void 0)}async startFlow({flowId:e,stepCvid:s,startReason:n,once:i,batch:r,replaceCurrent:a}){if(this.ensureIdentified(),a&&this.flowSession&&this.endFlow(this.flowSession,{endReason:k.REPLACED,batch:!0}),o(`startFlow ${e}`,{startReason:n}),this.checklistSession?.flow.id===e){o("startFlow matches current checklist, so showing it instead"),this.showChecklist();return}const l={kind:"StartFlow",flowId:e,stepCvid:s,startReason:n,once:!!i};await this.send(l,{batch:r})}async trackButtonEvent(e,s,n,i){const r={kind:"TrackButtonEvent",eventName:e,stepCvid:n,sessionId:i,token:s};await this.send(r,{batch:!0})}async startFlowWithToken(e){this.ensureIdentified(),o("startFlowWithToken",{token:e}),await this.send({kind:"StartFlowWithToken",token:e},{batch:!0})}optimisticClockUIUpdate(e){this.clientClock++,e(),this.toggleUI()}async showChecklist(){if(this.resourceCenterEmbedsChecklist()&&!this.embedChecklistSessions()){this.openResourceCenter();return}this.embedChecklistSessions()||(this.unmarkExpandPending(),!(!this.checklistSession||this.checklistExpanded)&&(this.ensureIdentified(),this.checklistExpanded=!0,this.toggleUI(),h.setItem(`checklistExpanded:${this.checklistSession.id}`,"1"),await this.send({kind:"ShowChecklist",sessionId:this.checklistSession.id},{batch:!0})))}async hideChecklist(){if(this.resourceCenterEmbedsChecklist()){this.closeResourceCenter();return}!this.checklistSession||!this.checklistExpanded||(this.ensureIdentified(),this.checklistExpanded=!1,this.toggleUI(),h.removeItem(`checklistExpanded:${this.checklistSession.id}`),await this.send({kind:"HideChecklist",sessionId:this.checklistSession.id},{batch:!0}))}async unmarkExpandPending(){!this.checklistSession||!this.checklistExpandPending||(this.checklistExpandPending=!1,await this.send({kind:"UnmarkExpandPending",sessionId:this.checklistSession.id},{batch:!0}))}async openResourceCenter(){this.resourceCenterEmbedsChecklist()&&this.unmarkExpandPending(),!(!this.resourceCenterSession||this.resourceCenterOpen)&&(this.ensureIdentified(),this.resourceCenterOpen=!0,this.toggleUI(),this.emit("resourceCenterChanged"),h.setItem(`resourceCenterOpen:${this.resourceCenterSession.id}`,"1"),await this.send({kind:"OpenResourceCenter",sessionId:this.resourceCenterSession.id},{batch:!0}))}navigateToAssistantChat(e){const s=e.version.resourceCenter?.blocks.find(r=>r.type===p.ASSISTANT);if(!s)return;const n={kind:"assistant",block:s},i=rt(n);i&&h.setItem(`resourceCenterRoute:v1:${e.id}`,i),this.emit("private:resourceCenterNavigate",n)}async closeResourceCenter(){!this.resourceCenterSession||!this.resourceCenterOpen||(this.ensureIdentified(),this.resourceCenterOpen=!1,this.toggleUI(),this.emit("resourceCenterChanged"),h.removeItem(`resourceCenterOpen:${this.resourceCenterSession.id}`),await this.send({kind:"CloseResourceCenter",sessionId:this.resourceCenterSession.id},{batch:!0}))}toggleResourceCenter(){this.resourceCenterOpen?this.closeResourceCenter():this.openResourceCenter()}setResourceCenterLauncherHidden(e){this.resourceCenterLauncherHidden=e,this.toggleUI()}getResourceCenterState(){if(!this.resourceCenterSession)return null;const e=this.resourceCenterEmbedsChecklist(),{checklistSession:s}=this,n=this.resourceCenterSession.version.resourceCenter?.blocks.find(i=>i.type===p.ANNOUNCEMENTS);return{isOpen:this.resourceCenterOpen,hasChecklist:e,uncompletedChecklistTaskCount:e&&s?it(s):0,unreadAnnouncementCount:n?.unreadAnnouncementCount||0}}resourceCenterEmbedsChecklist(){const e=this.resourceCenterSession;return!!e&&!!e.version.resourceCenter?.blocks.some(s=>s.type===p.CHECKLIST)}embedChecklistSessions(){return this.embedSessions.some(e=>!!e.version.embed?.blocks?.some(s=>s.type===K.CHECKLIST))}async endFlow(e,{endReason:s,batch:n}){this.ensureIdentified(),this.optimisticClockUIUpdate(()=>{const{clientClock:l}=this;this.flowSession?.id===e.id&&this.setFlowSession(null,l),this.checklistSession?.id===e.id&&this.setChecklistSession(null,l),this.bannerSession?.id===e.id&&this.setBannerSession(null),this.resourceCenterSession?.id===e.id&&this.setResourceCenterSession(null),this.workflowSession?.id===e.id&&this.setWorkFlowSession(null)});const{flow:i}=e,r={id:i.id,type:i.type.toLowerCase()};i.type===L.CHECKLIST?this.emit("checklistEnded",{checklist:r,endReason:s}):i.type===L.FLOW&&this.emit("flowEnded",{flow:r,endReason:s});const a={kind:"EndFlow",sessionId:e.id,endReason:s};await this.send(a,{batch:n})}async goToStep(e,s){o("goToStep",e.id,s.name||s.id),this.ensureIdentified();const n=this.send({kind:"GoToStep",sessionId:e.id,stepId:s.id});e.currentStep=s,this.emit("gotostep",{session:e,step:s}),await n}async endAllFlows(){o("endAllFlows"),this.optimisticClockUIUpdate(()=>{const{clientClock:e}=this;this.setFlowSession(null,e),this.setChecklistSession(null,e)}),await this.send({kind:"EndAllFlows"})}async endChecklist(){o("endChecklist");const e=this.checklistSession||this.flowSession;e?.flow.type===L.CHECKLIST&&this.endFlow(e,{endReason:k.USERFLOWJS})}setFlowSession(e,s=this.clientClock){const n=this.flowSession;this.flowSession=e,this.flowSessionClock=s,e&&!n&&(this.hideChecklist(),this.closeResourceCenter()),e==null&&this.originalActiveElement&&(typeof this.originalActiveElement.focus=="function"&&this.originalActiveElement.focus(),this.originalActiveElement=void 0)}setWorkFlowSession(e){this.workflowSession=e}setChecklistSession(e,s=this.clientClock){const n=this.checklistSession;this.checklistSession=e,this.checklistSessionClock=s,e===null&&(this.checklistExpanded=!1,this.checklistExpandPending=!1),e&&e.id!==n?.id&&(this.checklistExpanded=!!h.getItem(`checklistExpanded:${e.id}`),e.expandPending&&(this.checklistExpandPending=!0)),this.emit("checklistChanged"),this.emit("resourceCenterChanged")}setBannerSession(e){this.bannerSession=e}setResourceCenterSession(e){const s=this.resourceCenterSession;e=typeof e=="function"?e(this.resourceCenterSession):e,this.resourceCenterSession=e,e===null&&(this.resourceCenterOpen=!1),s&&s.id!==e?.id&&h.removeItem(`resourceCenterOpen:${s.id}`),e&&e.id!==s?.id&&(this.resourceCenterOpen=!!h.getItem(`resourceCenterOpen:${e.id}`)),this.emit("resourceCenterChanged")}launcherSeen(e){this.send({kind:"StartFlow",flowId:e,startReason:N.LAUNCHER_SEEN,once:!1})}activateLauncher(e){const s=this.activeLauncherFlowId&&this.launcherSessions.find(n=>n.flow.id===this.activeLauncherFlowId);s&&this.deactivateLauncher(s),this.activeLauncherFlowId=e.flow.id,this.toggleUI(),this.send({kind:"ActivateLauncher",flowId:e.flow.id})}deactivateLauncher(e){const{launcher:s}=e.version;e.flow.id===this.activeLauncherFlowId&&(s?.dismissOn===V.DEACTIVATE?this.dismissLauncher(e,{endReason:k.LAUNCHER_DEACTIVATED}):(this.activeLauncherFlowId=null,this.toggleUI()))}dismissLauncher(e,{endReason:s}){const n=e.flow.id;this.removeLauncher(n),this.toggleUI(),this.send({kind:"DismissLauncher",flowId:n,endReason:s})}removeLauncher(e){const s=this.launcherSessions.findIndex(n=>n.flow.id===e);return s===-1?!1:(this.launcherSessions=[...this.launcherSessions.slice(0,s),...this.launcherSessions.slice(s+1)],e===this.activeLauncherFlowId&&(this.activeLauncherFlowId=null),!0)}async toggleUI(){const e=this.getSessionStorageState();!this.flowSession&&!this.workflowSession&&(this.checklistExpandPending||this.checklistSession?.version.checklist?.tasks.some(s=>this.taskIsUnacked(s.cvid)))&&this.showChecklist(),e.isTargetTab&&this.monitorTitle(),this.emit("uistatechange"),this.shouldBeMounted()?await this.mountUI():this.unmountUI()}shouldBeMounted(){return this.uiDisabled||this.siteSession?.id||h.getItem(w)?!1:!!this.getSessionStorageState().activeApp||!!this.flowSession||!!this.workflowSession||!!this.checklistSession&&(this.checklistExpanded||!!this.checklistSession?.version.checklist?.launcherEnabled)||!!this.bannerSession||!!this.resourceCenterSession||this.launcherSessions.length>0||this.notifications.length>0}async mountUI(){if(!this.ui){const e=await this.createUI();this.shouldBeMounted()&&!this.ui&&(o("mount UI"),this.ui=e,this.ui.mount())}}unmountUI(){this.ui&&(o("unmount UI"),this.ui.unmount(),this.ui=null)}checkDebuggerSession(){if(this.debuggerUI)return;const e=this.sessionStorageState?.debuggerApp;e&&e?.x&&e?.y&&this.mountDebugger()}async mountDebugger(){if(!this.debuggerMountInProgress){if(this.debuggerUI){this.debuggerUI.unmount();return}this.debuggerMountInProgress=!0;try{const{DebuggerUI:e}=await I(async()=>{const{DebuggerUI:s}=await import("./DebuggerUI.js");return{DebuggerUI:s}},__vite__mapDeps([49,1,2,18,19,3,4,5,6,17,12,13,14,9,10,11,20,22,15,47,46,45,28,32,33]));this.debuggerUI=new e(this,v),this.debuggerUI.mount()}catch(e){console.error("Userflow: Failed to mount debugger UI",e)}finally{this.debuggerMountInProgress=!1}}}unMountDebugger(){this.debuggerUI=null}remount(){this.unmountUI(),this.toggleUI()}async createUI(){try{const e=I(()=>import("./ui.js"),__vite__mapDeps([50,1,2,18,19,3,4,5,6,32,33]));this.bannerSession&&nt(),this.resourceCenterSession&&st();const{RealUI:s}=await e;return new s(this)}catch(e){throw this.reportCspIssue(),e}}async trackClientCondition(e){if(this.clientConditions.has(e.id))return;o("track client condition",e),this.clientConditions.set(e.id,{condition:e,isTrue:null});const{conditionTypes:s}=await I(async()=>{const{conditionTypes:r}=await import("./flow-condition-types.js").then(a=>a.f);return{conditionTypes:r}},__vite__mapDeps([9,2,10,5,11])),n=s[e.type],i=this.clientConditions.get(e.id);i&&(i.untrack=n.track({sessionData:new P([]),condition:e,callback:r=>{i.isTrue!==r&&(o("client condition truthiness changed",r,i.condition),i.isTrue=r,this.send({kind:"ToggleClientCondition",conditionId:e.id,isTrue:r},{batch:!0}))}}))}untrackClientCondition(e){const s=this.clientConditions.get(e);s&&(o("untrack client condition",s.condition),s.untrack&&s.untrack(),this.clientConditions.delete(e))}async addTracker(e){let s=this.trackers.get(e.flowId);s?s.tracker=e:this.trackers.set(e.flowId,{tracker:e,isTrue:!1});const{conditionTypes:n}=await I(async()=>{const{conditionTypes:u}=await import("./flow-condition-types.js").then(c=>c.f);return{conditionTypes:u}},__vite__mapDeps([9,2,10,5,11])),i=this.trackers.get(e.flowId);if(!i)return;const{tracker:r}=i,{condition:a}=r,l=n[a.type];i.untrack&&i.untrack(),i.untrack=l.track({sessionData:new P(r.data),condition:a,flipBackEvents:!0,callback:u=>{const c=i.isTrue;i.isTrue=u,!c&&u&&this.send({kind:"TrackTrackerEvent",token:r.token},{batch:!0})},description:`event tracker ${r.flowId}`}),this.emit("private:trackerStarted")}removeTracker(e){const s=this.trackers.get(e);s&&(s.untrack&&s.untrack(),this.trackers.delete(e),this.emit("private:trackerStopped"))}monitorTitle(){if(this.titleMonitored)return;this.titleMonitored=!0,this.fixTitle();const e=document.querySelector("title");if(e){const s=new MutationObserver(()=>{this.fixTitle()});s.observe(e,{childList:!0}),this.titleObserver=s}}fixTitle(){const e=document.title,n="[Userflow Preview] "+e.replace(/\[Userflow Preview\]\s*/g,"");e!==n&&(document.title=n)}reportCspIssue(){const e=this.getSessionStorageState();(this.testUserIdentified||e.activeApp)&&!this.cspIssueReported&&(this.cspIssueReported=!0,o("csp issue detected"),A({kind:"userflow:crxCspIssueDetected"}))}getAudio(){return this.audio||(this.audio=new Audio),this.audio}playAudio(e){if(document.hidden)return;const s=this.getAudio();e&&(s.src=e);const n=s.play();this.audioReady=!0,n&&n.catch(i=>{i.name})}pauseAudio(){const e=this.audio;e&&!e.paused&&e.pause()}async getStepSpeech(e,s){return(await this.send({kind:"GetStepSpeechV2",syntheticVoice:e,text:s})).url}featureFlagEnabled(e){return this.featureFlags?this.featureFlags.has(e):!1}showNotification(e,s,n){const r={id:++this.notificationIdCounter,label:e,message:s,type:n};this.notifications=[...this.notifications,r],this.toggleUI()}dismissNotification(e){this.notifications=this.notifications.filter(s=>s.id!==e),this.toggleUI()}warn(...e){console.warn(...e)}nextRef(){return this.refCounter++}}if(typeof window.userflow>"u"||window.userflow._stubbed){const t=Object.assign(window.userflow||{},lt());window.userflow=t,window.studio1=t,ut()}function lt(){const t=new ct;return{_stubbed:!1,init(e){t.init(e)},identify(e,s={},n={}){return t.identify(e,s,n)},identifyAnonymous(e={},s={}){return t.identifyAnonymous(e,s)},isIdentified(){return t.isIdentified()},updateUser(e,s={}){return t.updateUser(e,s)},group(e,s={},n={}){return t.group(e,s,n)},updateGroup(e,s={}){return t.updateGroup(e,s)},track(e,s={},n={}){return t.track(e,s,n)},start(e,{once:s}={}){return t.startFlow({flowId:e,startReason:N.USERFLOWJS,once:s})},startFlow(e){return console.warn("Userflow.js: userflow.startFlow() has been deprecated. Use userflow.start() instead."),window.userflow.start(e)},startWalk(e){return console.warn("Userflow.js: userflow.startWalk() has been deprecated. Use userflow.start() instead."),window.userflow.start(e)},endAll(){return t.endAllFlows()},endChecklist(){return t.endChecklist()},endAllFlows(){"Userflow.js: userflow.endAllFlows() has been deprecated. Use userflow.endAll() instead.";return window.userflow.endAll()},async endFlow(){console.warn("Userflow.js: userflow.endFlow() has been deprecated and no longer has any effect.")},async endWalk(){console.warn("Userflow.js: userflow.endWalk() has been deprecated and no longer has any effect.")},openResourceCenter(){t.openResourceCenter()},closeResourceCenter(){t.closeResourceCenter()},toggleResourceCenter(){t.toggleResourceCenter()},setResourceCenterLauncherHidden(e){t.setResourceCenterLauncherHidden(e)},getResourceCenterState(){return t.getResourceCenterState()},setWalkPosition(){console.warn("Userflow.js: userflow.setWalkPosition() has been deprecated and no longer has any effect.")},reset(){t.reset()},remount(){t.remount()},on(e,s){t.on(e,s)},off(e,s){t.off(e,s)},setCustomInputSelector(e){console.warn("Userflow.js: userflow.setCustomInputSelector() has been deprecated. Use userflow.registerCustomInput() instead. See docs: https://userflow.com/docs/userflow-js"),e&&f.customInputs.push({cssSelector:e})},registerCustomInput(e,s){f.customInputs.push({cssSelector:e,getValue:s})},setCustomNavigate(e){f.customNavigate=e},setUrlFilter(e){f.urlFilter=e},setLinkUrlDecorator(e){f.linkUrlDecorator=e,t.emit("uistatechange")},setInferenceAttributeNames(e){f.inferenceAttributeNames=e},setInferenceAttributeFilter(e,s){f.inferenceAttributeFilters[e]=M(s)},setInferenceClassNameFilter(e){f.inferenceClassNameFilters=M(e)},setScrollPadding(e){f.scrollPadding=e},setCustomScrollIntoView(e){f.customScrollIntoView=e},prepareAudio(){t.playAudio(null)},setShadowDomEnabled(e){console.warn("Userflow.js: userflow.setShadowDomEnabled() has been deprecated. Please remove this call from your Userflow.js snippet. Shadow DOM is supported by default now.")},setPageTrackingDisabled(e){t.pageTrackingDisabled=e},setBaseZIndex(e){f.baseZIndex=e},setServerEndpoint(e){f.serverEndpoint=e},disableEvalJs(){f.evalJsDisabled=!0},_setTargetEnv(e){t.setTargetEnv(e)},debugger(){return t.mountDebugger()},mountSitePage(e,s){return t.mountSitePage(e,s)}}}function ut(){const t=window.userflow,e=window.USERFLOWJS_QUEUE;if(delete window.USERFLOWJS_QUEUE,!(!e||e.length===0)){o(`processing ${e.length} items in the queue`);for(const[s,n,i]of e){if(typeof t[s]!="function"){console.error(`Userflow.js: Invalid method '${s}' in queue`);continue}const r=t[s](...i);n&&r&&typeof r.then=="function"&&r.then(n.resolve,n.reject)}o("queue processed")}}var It=window.userflow;export{Ie as $,Be as A,Te as B,S as C,Qe as D,k as E,ge as F,Ee as G,he as H,nt as I,st as J,p as K,ye as L,Tt as M,h as N,rt as O,it as P,Le as Q,He as R,P as S,Ue as T,d as U,Me as V,Xe as W,Pe as X,qe as Y,C as Z,I as _,se as a,ve as a0,$e as a1,A as a2,x as a3,Z as a4,me as a5,Ce as a6,we as a7,Ne as a8,pe as a9,ke as aa,ie as ab,De as ac,je as ad,Ve as ae,We as af,Ge as ag,Ke as ah,xe as ai,Fe as aj,Ye as ak,Ze as al,Je as am,ze as an,re as ao,Se as b,f as c,o as d,It as default,Ae as e,Re as f,U as g,N as h,Oe as i,be as j,le as k,oe as l,tt as m,ue as n,q as o,_e as p,ce as q,ae as r,Et as s,St as t,F as u,B as v,ne as w,de as x,fe as y,L as z};
|
|
18
18
|
//# sourceMappingURL=userflow.js.map
|
package/vendor.object-assign.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},s=new Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="
|
|
1
|
+
(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},s=new Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="e6b93513-65ea-4a7e-8935-fb1232d96b49",e._sentryDebugIdIdentifier="sentry-dbid-e6b93513-65ea-4a7e-8935-fb1232d96b49")}catch{}})();var p=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};p.SENTRY_RELEASE={id:"9ae5d46b76ccab69a826adb5074737629e6eef87"};var y=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function w(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var d,b;function j(){if(b)return d;b=1;var e=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;function c(t){if(t==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function g(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de",Object.getOwnPropertyNames(t)[0]==="5")return!1;for(var l={},r=0;r<10;r++)l["_"+String.fromCharCode(r)]=r;var a=Object.getOwnPropertyNames(l).map(function(n){return l[n]});if(a.join("")!=="0123456789")return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(n){o[n]=n}),Object.keys(Object.assign({},o)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return d=g()?Object.assign:function(t,l){for(var r,a=c(t),o,n=1;n<arguments.length;n++){r=Object(arguments[n]);for(var i in r)s.call(r,i)&&(a[i]=r[i]);if(e){o=e(r);for(var f=0;f<o.length;f++)u.call(r,o[f])&&(a[o[f]]=r[o[f]])}}return a},d}export{y as c,w as g,j as r};
|
|
2
2
|
//# sourceMappingURL=vendor.object-assign.js.map
|
package/resource-center-route.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./vendor.object-assign.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},d=new Error().stack;d&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[d]="b5122eb4-bda5-44bd-af6e-d57ef1d2a112",n._sentryDebugIdIdentifier="sentry-dbid-b5122eb4-bda5-44bd-af6e-d57ef1d2a112")}catch{}})();function c(n){if(!n)return null;let d;"block"in n&&n.block!=null&&(d=n.block.cvid);const e={kind:n.kind,blockCvid:d};return n.kind==="announcementShow"&&(e.announcementId=n.announcementId),JSON.stringify(e)}function r(n,d){if(!d)return null;const e=JSON.parse(d);let i;if(e.blockCvid&&(i=n.version.resourceCenter?.blocks.find(o=>o.cvid===e.blockCvid)),!i&&e.kind!=="search")return null;const t={kind:e.kind,block:i};return t.kind==="announcementShow"&&(t.announcementId=e.announcementId),t}export{r as d,c as s};
|
|
2
|
-
//# sourceMappingURL=resource-center-route.js.map
|