userflow.js-self-hosted 0.1.1024968 → 0.1.1024973

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/FlowApp.js CHANGED
@@ -1,4 +1,4 @@
1
- import{R as o,r as u}from"./vendor.react.js";import{E as M,a3 as D,a4 as ie,p as T,a5 as ce,a6 as x,r as ue,a7 as O,X as A,j as de,b as pe,a8 as fe}from"./userflow.js";import{k as me}from"./vendor.lodash.js";import"./vendor.object-assign.js";import{u as j}from"./vendor.react-i18next.js";import{B as X,F as be}from"./FlowChrome.js";import{m as Ee,d as K,R as ge,i as we,g as he,b as ve,c as z,h as Te,S as Se}from"./TreeDoc.js";import{g as Q,b as Z}from"./flow-condition-types.js";import{u as F,i as ye}from"./client-context.js";import{u as ke,r as Be}from"./use-selector-element-monitoring.js";import{C as Me,k as De,r as Fe}from"./roots.js";import{a as J,S as Le}from"./flow-host.styl.js";import{r as Ie}from"./vendor.fortawesome.pro-solid-svg-icons.js";import{D as Re,a as Ne}from"./stylesheets.js";import{T as Ce}from"./Trigger.js";import{f as _,a as Ae}from"./steps.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";import"./vendor.babel.runtime.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-window-resize.js";import"./logomark.js";import"./vendor.obj-str.js";import"./use-confetti.js";import"./vendor.canvas-confetti.js";import"./vendor.date-fns.js";import"./vendor.i18next.js";(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]="f38d79ef-be8a-4e96-8c16-f91640795782",e._sentryDebugIdIdentifier="sentry-dbid-f38d79ef-be8a-4e96-8c16-f91640795782")}catch{}})();const Pe=()=>{const{t:e}=j(),s=F(),{dispatch:t,restart:n}=R(),{session:i,step:f}=B(),l="userflowjs-bubble-button userflowjs-bubble-button--default userflowjs-bubble-menu__item";return o.createElement("div",{role:"dialog","aria-modal":I(f)?"true":void 0,"aria-label":"Guide menu"},o.createElement("div",{className:"userflowjs-bubble-menu__title"},e("menu.title")),o.createElement("button",{className:l,onClick:()=>s.endFlow(i,{endReason:M.USER_CLOSED})},e("menu.close")),i.version.restartEnabled&&o.createElement("button",{className:l,onClick:n},e("menu.restart")),o.createElement("button",{className:l,onClick:()=>t({kind:"showFlow"})},e("menu.back")))},Y=({progress:e,type:s,position:t,totalSteps:n})=>{const{t:i}=j(),f=u.useMemo(()=>parseFloat(e||"0"),[e]),l=u.useMemo(()=>({width:`${f*100}%`}),[f]),c=u.useMemo(()=>s===ie.DEFAULT?D.TOP:t,[s,t]),d=c===D.BOTTOM?"userflowjs-bubble-progress--bottom":"",m=u.useMemo(()=>`userflowjs-bubble-progress--${me(s||"DEFAULT").toLowerCase()} ${d}`,[s,d]),a=n||0,r=u.useMemo(()=>Math.min(Math.floor(f*a),a),[f,a]);return o.createElement(o.Fragment,null,(s==="CHAINED_ROUNDED"||s==="CHAINED_SQUARED"||s==="DOTTED")&&o.createElement("div",{className:m},Array.from({length:3}).map((g,E)=>o.createElement("div",{key:E,className:`userflowjs-bubble-progress-step ${E<Math.floor(f*3)?"userflowjs-bubble-progress-step_completed":""}`}))),s==="NARROW"&&o.createElement("div",{className:m},o.createElement("div",{className:"linear-progress-bar"},o.createElement("div",{className:"userflowjs-bubble-progress--narrow-fill",style:l}))),s==="NUMBERED"&&o.createElement("div",{className:m},o.createElement("span",{className:"numbered-progress"},i("of",{replace:{range:a,selected:r}}))),!["CHAINED_ROUNDED","CHAINED_SQUARED","DOTTED","NARROW","NUMBERED"].includes(s)&&o.createElement("div",{className:`${m} ${c===D.BOTTOM?"userflowjs-bubble-progress--bottom":""}`},o.createElement("div",{className:"userflowjs-bubble-progress__fill",style:l})))},xe=({theme:e})=>{const s=F(),{session:t,step:n,muted:i,shouldLabelDialog:f}=B(),{version:l}=t,{dispatch:c}=R(),d=l.steps[0],m=d&&d.id===n.id,a=m&&n.progress==="1",r=u.useMemo(()=>n.content&&Ee(K(n.content),{buttons:n.buttons,questions:n.questions}),[n.content,n.buttons,n.questions]),g=l.steps.filter(S=>S.appearance!==T.HIDDEN),E=g.findIndex(S=>S.id===n.id),w=g.length,h=w>0?((E+1)/w).toString():"0";return o.createElement("div",{key:n.id,role:"alertdialog","aria-modal":I(n)?"true":void 0,"aria-label":f?"Guide":void 0},!a&&e.progressBarPosition==="TOP"&&e.progressBarEnabled&&o.createElement(Y,{progress:h,type:e.progressBarType,position:n.appearance===T.MODAL?void 0:D.TOP,totalSteps:w}),o.createElement("div",{id:"userflowjs-bubble-content",className:"userflowjs-bubble-content","data-progress-position":e.progressBarPosition,"data-progress-type":e.progressBarType},o.createElement(ge,{doc:r,lookupAttribute:Q(t.data),buttons:n.buttons,questions:n.questions})),o.createElement(X,{draftMode:t.draftMode,muted:i,toggleMuted:e.voiceType!==x.NONE?()=>c({kind:"toggleMuted"}):void 0,close:l.closeDisabled?void 0:()=>e.flowXButtonBehavior===ce.DISMISS||m?s.endFlow(t,{endReason:M.USER_CLOSED}):c({kind:"showMenu"})}),!a&&e.progressBarPosition==="BOTTOM"&&e.progressBarEnabled&&o.createElement(Y,{progress:h,type:e.progressBarType,position:D.BOTTOM,totalSteps:w}))};function Oe(e,s){if(!e)return"";typeof e=="string"&&(e=K(e));const t=[],n=/[.!?;,]$/;function i(){const c=(t[t.length-1]||"").trim();c&&!c.match(n)&&t.push(".")}function f(c){if(we(c)){if(c.text&&!c.silent){const d=c.text.split(`
1
+ import{R as o,r as u}from"./vendor.react.js";import{E as M,a3 as D,a4 as ie,p as T,a5 as ce,a6 as x,r as ue,a7 as O,X as A,j as de,b as pe,a8 as fe}from"./userflow.js";import{k as me}from"./vendor.lodash.js";import"./vendor.object-assign.js";import{u as j}from"./vendor.react-i18next.js";import{B as X,F as be}from"./FlowChrome.js";import{m as Ee,d as K,R as ge,i as we,g as he,b as ve,c as z,h as Te,S as Se}from"./TreeDoc.js";import{g as Q,b as Z}from"./flow-condition-types.js";import{u as F,i as ye}from"./client-context.js";import{u as ke,r as Be}from"./use-selector-element-monitoring.js";import{C as Me,k as De,r as Fe}from"./roots.js";import{a as J,S as Le}from"./flow-host.styl.js";import{r as Ie}from"./vendor.fortawesome.pro-solid-svg-icons.js";import{D as Re,a as Ne}from"./stylesheets.js";import{T as Ce}from"./Trigger.js";import{f as _,a as Ae}from"./steps.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";import"./vendor.babel.runtime.js";import"./vendor.fortawesome.pro-regular-svg-icons.js";import"./Frame.js";import"./vendor.react-dom.js";import"./vendor.scheduler.js";import"./vendor.obj-str.js";import"./iframe-reset.styl.js";import"./use-window-resize.js";import"./logomark.js";import"./use-confetti.js";import"./vendor.canvas-confetti.js";import"./vendor.date-fns.js";import"./vendor.i18next.js";(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]="804d44eb-eee3-4042-a8b6-00ef59ed2d42",e._sentryDebugIdIdentifier="sentry-dbid-804d44eb-eee3-4042-a8b6-00ef59ed2d42")}catch{}})();const Pe=()=>{const{t:e}=j(),s=F(),{dispatch:t,restart:n}=R(),{session:i,step:f}=B(),l="userflowjs-bubble-button userflowjs-bubble-button--default userflowjs-bubble-menu__item";return o.createElement("div",{role:"dialog","aria-modal":I(f)?"true":void 0,"aria-label":"Guide menu"},o.createElement("div",{className:"userflowjs-bubble-menu__title"},e("menu.title")),o.createElement("button",{className:l,onClick:()=>s.endFlow(i,{endReason:M.USER_CLOSED})},e("menu.close")),i.version.restartEnabled&&o.createElement("button",{className:l,onClick:n},e("menu.restart")),o.createElement("button",{className:l,onClick:()=>t({kind:"showFlow"})},e("menu.back")))},Y=({progress:e,type:s,position:t,totalSteps:n})=>{const{t:i}=j(),f=u.useMemo(()=>parseFloat(e||"0"),[e]),l=u.useMemo(()=>({width:`${f*100}%`}),[f]),c=u.useMemo(()=>s===ie.DEFAULT?D.TOP:t,[s,t]),d=c===D.BOTTOM?"userflowjs-bubble-progress--bottom":"",m=u.useMemo(()=>`userflowjs-bubble-progress--${me(s||"DEFAULT").toLowerCase()} ${d}`,[s,d]),a=n||0,r=u.useMemo(()=>Math.min(Math.floor(f*a),a),[f,a]);return o.createElement(o.Fragment,null,(s==="CHAINED_ROUNDED"||s==="CHAINED_SQUARED"||s==="DOTTED")&&o.createElement("div",{className:m},Array.from({length:3}).map((g,E)=>o.createElement("div",{key:E,className:`userflowjs-bubble-progress-step ${E<Math.floor(f*3)?"userflowjs-bubble-progress-step_completed":""}`}))),s==="NARROW"&&o.createElement("div",{className:m},o.createElement("div",{className:"linear-progress-bar"},o.createElement("div",{className:"userflowjs-bubble-progress--narrow-fill",style:l}))),s==="NUMBERED"&&o.createElement("div",{className:m},o.createElement("span",{className:"numbered-progress"},i("of",{replace:{range:a,selected:r}}))),!["CHAINED_ROUNDED","CHAINED_SQUARED","DOTTED","NARROW","NUMBERED"].includes(s)&&o.createElement("div",{className:`${m} ${c===D.BOTTOM?"userflowjs-bubble-progress--bottom":""}`},o.createElement("div",{className:"userflowjs-bubble-progress__fill",style:l})))},xe=({theme:e})=>{const s=F(),{session:t,step:n,muted:i,shouldLabelDialog:f}=B(),{version:l}=t,{dispatch:c}=R(),d=l.steps[0],m=d&&d.id===n.id,a=m&&n.progress==="1",r=u.useMemo(()=>n.content&&Ee(K(n.content),{buttons:n.buttons,questions:n.questions}),[n.content,n.buttons,n.questions]),g=l.steps.filter(S=>S.appearance!==T.HIDDEN),E=g.findIndex(S=>S.id===n.id),w=g.length,h=w>0?((E+1)/w).toString():"0";return o.createElement("div",{key:n.id,role:"alertdialog","aria-modal":I(n)?"true":void 0,"aria-label":f?"Guide":void 0},!a&&e.progressBarPosition==="TOP"&&e.progressBarEnabled&&o.createElement(Y,{progress:h,type:e.progressBarType,position:n.appearance===T.MODAL?void 0:D.TOP,totalSteps:w}),o.createElement("div",{id:"userflowjs-bubble-content",className:"userflowjs-bubble-content","data-progress-position":e.progressBarPosition,"data-progress-type":e.progressBarType},o.createElement(ge,{doc:r,lookupAttribute:Q(t.data),buttons:n.buttons,questions:n.questions})),o.createElement(X,{draftMode:t.draftMode,muted:i,toggleMuted:e.voiceType!==x.NONE?()=>c({kind:"toggleMuted"}):void 0,close:l.closeDisabled?void 0:()=>e.flowXButtonBehavior===ce.DISMISS||m?s.endFlow(t,{endReason:M.USER_CLOSED}):c({kind:"showMenu"})}),!a&&e.progressBarPosition==="BOTTOM"&&e.progressBarEnabled&&o.createElement(Y,{progress:h,type:e.progressBarType,position:D.BOTTOM,totalSteps:w}))};function Oe(e,s){if(!e)return"";typeof e=="string"&&(e=K(e));const t=[],n=/[.!?;,]$/;function i(){const c=(t[t.length-1]||"").trim();c&&!c.match(n)&&t.push(".")}function f(c){if(we(c)){if(c.text&&!c.silent){const d=c.text.split(`
2
2
  `);d.forEach((m,a)=>{t.push(m),a<d.length-1&&(i(),t.push(`
3
3
  `))})}return}if(c.type==="attribute"){const d=he(c,s);d&&t.push(d)}else l(c.children),["link"].includes(c.type)||(i(),t.push(`
4
4
 
package/Frame.js CHANGED
@@ -1,2 +1,2 @@
1
- import{r as y,R as p}from"./vendor.react.js";import{r as R}from"./vendor.react-dom.js";import{g as S,u as k,c as x,d as F}from"./stylesheets.js";import{i as W}from"./iframe-reset.styl.js";import{i as L,a as _}from"./client-context.js";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]="0207aec0-77bd-4ec7-8aff-f32b403569e6",n._sentryDebugIdIdentifier="sentry-dbid-0207aec0-77bd-4ec7-8aff-f32b403569e6")}catch{}})();const B=({testId:n,className:d,style:u,elRef:a,stylesheet:i,theme:t,onStylesheetsLoad:c,noIframe:o,noScroll:l,ariaHidden:b,title:I,children:E})=>{o=o||!1;const[s,w]=y.useState(null),g=t&&"userflowjs-theme-root",v=t&&S(t),{loaded:f}=k(s,o?null:W),{loaded:e}=k(s,i,t),{loaded:r}=x(s,t),m=t&&F(t),{loaded:D}=k(s,m,t,{uninstallOnUnmount:!0});return y.useEffect(()=>{c&&f&&e&&r&&D&&c(!0)},[c,f,e,r,D]),o?p.createElement(U,{testId:n,className:d,style:u,rootClassName:g,rootStyle:v,elRef:a,onWinReady:w,noScroll:l,ariaHidden:b},E):p.createElement(h,{testId:n,className:d,style:u,rootClassName:g,rootStyle:v,elRef:a,onWinReady:w,noScroll:l,ariaHidden:b,title:I},E)},h=({testId:n,className:d,style:u,rootClassName:a,rootStyle:i,elRef:t,onWinReady:c,noScroll:o,ariaHidden:l,title:b,children:I})=>{const E=_(),[s,w]=y.useState(null);y.useLayoutEffect(()=>{if(!s)return;const{documentElement:f,body:e}=s.document;f.dir=L.dir();const r=a&&a.split(" ");if(r&&e.classList.add(...r),i)for(const m in i)e.style.setProperty(m,i[m]);return e.style.overflow=o?"hidden":"",()=>{r&&e.classList.remove(...r)}},[s,a,i,o]);const g=E?.logrocketAppId;y.useRef(!1),y.useEffect(()=>{},[s,g]);const v={bis_size:"{}"};return p.createElement("iframe",{ref:f=>{if(!f)return;t&&(t.current=f);const e=f.contentWindow;if(!e||e===s)return;const r=m=>{w(m),c(m)};e.document.readyState==="complete"?r(e):e.addEventListener("load",()=>{r(e)})},"data-testid":n,"aria-hidden":l?"true":void 0,title:b,tabIndex:l?-1:void 0,className:d,style:{...u,border:"none"},...v},s&&R.createPortal(I,s.document.body))},U=({testId:n,className:d,style:u,rootClassName:a,rootStyle:i,elRef:t,onWinReady:c,ariaHidden:o,children:l})=>(y.useEffect(()=>{c(window)},[c]),p.createElement("div",{ref:t,"data-testid":n,"aria-hidden":o?"true":void 0,tabIndex:o?-1:void 0,dir:L.dir(),className:d,style:u},p.createElement("div",{className:a,style:i},l)));export{B as F};
1
+ import{r as y,R as p}from"./vendor.react.js";import{r as L}from"./vendor.react-dom.js";import{o as R}from"./vendor.obj-str.js";import{g as x,u as S,c as F,d as W}from"./stylesheets.js";import{i as _}from"./iframe-reset.styl.js";import{i as D,a as h}from"./client-context.js";import"./vendor.object-assign.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},o=new Error().stack;o&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[o]="2d101374-7ead-44e1-ae91-cd97006acd02",r._sentryDebugIdIdentifier="sentry-dbid-2d101374-7ead-44e1-ae91-cd97006acd02")}catch{}})();const q=({testId:r,className:o,style:l,elRef:a,stylesheet:i,theme:t,onStylesheetsLoad:c,noIframe:n,noScroll:f,ariaHidden:b,title:I,children:w})=>{n=n||!1;const[s,E]=y.useState(null),v=t&&"userflowjs-theme-root",g=t&&x(t),{loaded:u}=S(s,n?null:_),{loaded:e}=S(s,i,t),{loaded:d}=F(s,t),m=t&&W(t),{loaded:k}=S(s,m,t,{uninstallOnUnmount:!0});return y.useEffect(()=>{c&&u&&e&&d&&k&&c(!0)},[c,u,e,d,k]),n?p.createElement(j,{testId:r,className:o,style:l,rootClassName:v,rootStyle:g,elRef:a,onWinReady:E,noScroll:f,ariaHidden:b},w):p.createElement(U,{testId:r,className:o,style:l,rootClassName:v,rootStyle:g,elRef:a,onWinReady:E,noScroll:f,ariaHidden:b,title:I},w)},U=({testId:r,className:o,style:l,rootClassName:a,rootStyle:i,elRef:t,onWinReady:c,noScroll:n,ariaHidden:f,title:b,children:I})=>{const w=h(),[s,E]=y.useState(null);y.useLayoutEffect(()=>{if(!s)return;const{documentElement:u,body:e}=s.document;u.dir=D.dir();const d=a&&a.split(" ");if(d&&e.classList.add(...d),i)for(const m in i)e.style.setProperty(m,i[m]);return e.style.overflow=n?"hidden":"",()=>{d&&e.classList.remove(...d)}},[s,a,i,n]);const v=w?.logrocketAppId;y.useRef(!1),y.useEffect(()=>{},[s,v]);const g={bis_size:"{}"};return p.createElement("iframe",{ref:u=>{if(!u)return;t&&(t.current=u);const e=u.contentWindow;if(!e||e===s)return;const d=m=>{E(m),c(m)};e.document.readyState==="complete"?d(e):e.addEventListener("load",()=>{d(e)})},"data-testid":r,"aria-hidden":f?"true":void 0,title:b,tabIndex:f?-1:void 0,className:o,style:{...l,border:"none"},...g},s&&L.createPortal(I,s.document.body))},j=({testId:r,className:o,style:l,rootClassName:a,rootStyle:i,elRef:t,onWinReady:c,ariaHidden:n,children:f})=>(y.useEffect(()=>{c(window)},[c]),p.createElement("div",{ref:t,"data-testid":r,"aria-hidden":n?"true":void 0,tabIndex:n?-1:void 0,dir:D.dir(),className:R({"userflowjs-div-frame":!0,[o||""]:!!o}),style:l},p.createElement("div",{className:a,style:i},f)));export{q as F};
2
2
  //# sourceMappingURL=Frame.js.map
@@ -1,2 +1,2 @@
1
- import{r as E,R as e}from"./vendor.react.js";import{R,K as C,p as N,M as g}from"./userflow.js";import{u as b}from"./client-context.js";import{u as S}from"./use-selector-element-monitoring.js";import{a as h,D as k}from"./stylesheets.js";import{L as I,m as w,f as M}from"./ResourceCenterApp.js";import{s as L}from"./resource-center-route.js";import{S as x,R as j}from"./TreeDoc.js";import{g as D}from"./flow-condition-types.js";import{a0 as P}from"./vendor.fortawesome.pro-regular-svg-icons.js";import{F as O,B as U}from"./FlowChrome.js";import{a as B}from"./AnnouncementEngagement.js";import"./vendor.object-assign.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";import"./vendor.i18next.js";import"./vendor.babel.runtime.js";import"./vendor.react-i18next.js";import"./roots.js";import"./vendor.fortawesome.pro-solid-svg-icons.js";import"./flow-host.styl.js";import"./Frame.js";import"./vendor.react-dom.js";import"./vendor.scheduler.js";import"./iframe-reset.styl.js";import"./vendor.obj-str.js";import"./use-window-resize.js";import"./logomark.js";import"./ChecklistUI.js";import"./vendor.memoize-one.js";import"./vendor.bignumber.js.js";import"./use-element-rect.js";import"./vendor.date-fns.js";import"./use-confetti.js";import"./vendor.canvas-confetti.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[t]="f8ad60d9-9b99-4d30-9504-3f5b338019df",o._sentryDebugIdIdentifier="sentry-dbid-f8ad60d9-9b99-4d30-9504-3f5b338019df")}catch{}})();const Te=({session:o,isOpen:t,flowSession:s,resourceCenterLauncherHidden:u})=>{const l=b(),n=o.version.resourceCenter,i=h(o.version.theme),[r,m]=E.useState(null),c=()=>{l.toggleResourceCenter()},v=f=>{m(f)},T=()=>{m(null)},p=n.launcherType===R.CUSTOM&&u!==!0;S({selector:p?n.launcherTargetSelector:null,targetMoved:v,targetLost:T,onTargetClick:c});const a=E.useMemo(()=>n.blocks.find(f=>f.type===C.ANNOUNCEMENTS),[n]),y=p&&!t&&!s&&a&&a.unreadAnnouncementCount>0&&r,d=E.useMemo(()=>a?.popoutAnnouncement,[a]),A=p&&!t&&!s&&d&&r;return e.createElement(x.Provider,{value:o},y&&e.createElement(I,{theme:i,count:a.unreadAnnouncementCount,onClick:c,style:{position:"fixed",top:`${r.targetRect.top}px`,left:`${r.targetRect.left}px`,transform:"translate(-50%, -50%)",zIndex:999999}}),A&&a&&e.createElement($,{session:o,announcement:d,targetParams:r,onDismiss:()=>{w(l,d)},onOpen:c}))},_=320,$=({session:o,announcement:t,targetParams:s,onOpen:u})=>{const l=b(),n=h(t.theme),i=()=>{w(l,t)},r=()=>{i(),u();const m=L({kind:"announcementShow",block:o.version.resourceCenter.blocks.find(c=>c.type===C.ANNOUNCEMENTS),announcementId:t.id});m?g.setItem(`resourceCenterRoute:v1:${o.id}`,m):g.removeItem(`resourceCenterRoute:v1:${o.id}`)};return e.createElement(O,{company:o.flow.company,theme:n,position:"fixed",stepAppearance:N.TOOLTIP,width:_,tooltipSelector:s.targetEl,tooltipPlacement:null,isModalAnnouncement:!0},e.createElement(U,{close:i}),e.createElement("div",{className:"userflowjs-bubble-content"},e.createElement("div",null,e.createElement("h2",{className:"userflowjs-announcement-title"},e.createElement("span",{className:"userflowjs-unread-dot"}),e.createElement("span",null,t.title)),e.createElement("div",{className:"userflowjs-announcement-time"},e.createElement("div",{className:"userflowjs-announcement-time-text"},M(t.time))),e.createElement("div",{className:"userflowjs-announcement-content"},e.createElement(j,{doc:t.content,buttons:t.buttons,lookupAttribute:D(t.data)})),e.createElement(B,{announcement:t,onMoreClick:r},e.createElement("div",{className:"userflowjs-announcement-more"},e.createElement("button",{className:"userflowjs-tertiary-button",onClick:r},e.createElement("div",null,t.moreButtonText||"Read more"),e.createElement("span",{className:"userflowjs-rtl-mirrored"},e.createElement(k,{icon:P}))))))))};export{Te as ResourceCenterLauncherHandler,Te as default};
1
+ import{r as E,R as e}from"./vendor.react.js";import{R,K as C,p as N,M as g}from"./userflow.js";import{u as h}from"./client-context.js";import{u as S}from"./use-selector-element-monitoring.js";import{a as w,D as k}from"./stylesheets.js";import{L as I,m as b,f as M}from"./ResourceCenterApp.js";import{s as L}from"./resource-center-route.js";import{S as x,R as j}from"./TreeDoc.js";import{g as D}from"./flow-condition-types.js";import{a0 as P}from"./vendor.fortawesome.pro-regular-svg-icons.js";import{F as O,B as U}from"./FlowChrome.js";import{a as B}from"./AnnouncementEngagement.js";import"./vendor.object-assign.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";import"./vendor.i18next.js";import"./vendor.babel.runtime.js";import"./vendor.react-i18next.js";import"./roots.js";import"./vendor.fortawesome.pro-solid-svg-icons.js";import"./flow-host.styl.js";import"./Frame.js";import"./vendor.react-dom.js";import"./vendor.scheduler.js";import"./vendor.obj-str.js";import"./iframe-reset.styl.js";import"./use-window-resize.js";import"./logomark.js";import"./ChecklistUI.js";import"./vendor.memoize-one.js";import"./vendor.bignumber.js.js";import"./use-element-rect.js";import"./vendor.date-fns.js";import"./use-confetti.js";import"./vendor.canvas-confetti.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[t]="08a713fd-79c7-4180-a03e-06d306009341",o._sentryDebugIdIdentifier="sentry-dbid-08a713fd-79c7-4180-a03e-06d306009341")}catch{}})();const Te=({session:o,isOpen:t,flowSession:s,resourceCenterLauncherHidden:u})=>{const l=h(),n=o.version.resourceCenter,i=w(o.version.theme),[r,m]=E.useState(null),c=()=>{l.toggleResourceCenter()},v=f=>{m(f)},T=()=>{m(null)},p=n.launcherType===R.CUSTOM&&u!==!0;S({selector:p?n.launcherTargetSelector:null,targetMoved:v,targetLost:T,onTargetClick:c});const a=E.useMemo(()=>n.blocks.find(f=>f.type===C.ANNOUNCEMENTS),[n]),y=p&&!t&&!s&&a&&a.unreadAnnouncementCount>0&&r,d=E.useMemo(()=>a?.popoutAnnouncement,[a]),A=p&&!t&&!s&&d&&r;return e.createElement(x.Provider,{value:o},y&&e.createElement(I,{theme:i,count:a.unreadAnnouncementCount,onClick:c,style:{position:"fixed",top:`${r.targetRect.top}px`,left:`${r.targetRect.left}px`,transform:"translate(-50%, -50%)",zIndex:999999}}),A&&a&&e.createElement($,{session:o,announcement:d,targetParams:r,onDismiss:()=>{b(l,d)},onOpen:c}))},_=320,$=({session:o,announcement:t,targetParams:s,onOpen:u})=>{const l=h(),n=w(t.theme),i=()=>{b(l,t)},r=()=>{i(),u();const m=L({kind:"announcementShow",block:o.version.resourceCenter.blocks.find(c=>c.type===C.ANNOUNCEMENTS),announcementId:t.id});m?g.setItem(`resourceCenterRoute:v1:${o.id}`,m):g.removeItem(`resourceCenterRoute:v1:${o.id}`)};return e.createElement(O,{company:o.flow.company,theme:n,position:"fixed",stepAppearance:N.TOOLTIP,width:_,tooltipSelector:s.targetEl,tooltipPlacement:null,isModalAnnouncement:!0},e.createElement(U,{close:i}),e.createElement("div",{className:"userflowjs-bubble-content"},e.createElement("div",null,e.createElement("h2",{className:"userflowjs-announcement-title"},e.createElement("span",{className:"userflowjs-unread-dot"}),e.createElement("span",null,t.title)),e.createElement("div",{className:"userflowjs-announcement-time"},e.createElement("div",{className:"userflowjs-announcement-time-text"},M(t.time))),e.createElement("div",{className:"userflowjs-announcement-content"},e.createElement(j,{doc:t.content,buttons:t.buttons,lookupAttribute:D(t.data)})),e.createElement(B,{announcement:t,onMoreClick:r},e.createElement("div",{className:"userflowjs-announcement-more"},e.createElement("button",{className:"userflowjs-tertiary-button",onClick:r},e.createElement("div",null,t.moreButtonText||"Read more"),e.createElement("span",{className:"userflowjs-rtl-mirrored"},e.createElement(k,{icon:P}))))))))};export{Te as ResourceCenterLauncherHandler,Te as default};
2
2
  //# sourceMappingURL=ResourceCenterLauncherHandler.js.map
package/SitePage.js CHANGED
@@ -1,2 +1,2 @@
1
- import{R as e,r as h}from"./vendor.react.js";import{u as A,i as L,U as W}from"./client-context.js";import{r as Y}from"./vendor.react-dom.js";import{L as k,B as O}from"./vendor.react-router-dom.js";import{A as z,a as G,u as T,b as Q,S as _}from"./AnnouncementEngagement.js";import{D as I,u as S,a as $,g as q}from"./stylesheets.js";import{i as J}from"./iframe-reset.styl.js";import{S as X,u as E,R as N}from"./TreeDoc.js";import{g as C}from"./flow-condition-types.js";import{f as Z,a as ee,b as D}from"./vendor.fortawesome.pro-regular-svg-icons.js";import{f as te}from"./vendor.fortawesome.pro-solid-svg-icons.js";import{d as oe}from"./userflow.js";import{P as ne}from"./Popover.js";import{o as se}from"./vendor.obj-str.js";import{m as re}from"./vendor.memoize-one.js";import"./vendor.object-assign.js";import{u as ie}from"./react-hooks.js";import{S as le,a as H,u as P,b as R,d as B}from"./vendor.react-router.js";import{u as V}from"./vendor.react-i18next.js";import"./vendor.i18next.js";import"./vendor.babel.runtime.js";import"./vendor.scheduler.js";import"./vendor.history.js";import"./vendor.resolve-pathname.js";import"./vendor.value-equal.js";import"./vendor.tiny-invariant.js";import"./vendor.prop-types.js";import"./use-confetti.js";import"./vendor.canvas-confetti.js";import"./roots.js";import"./vendor.date-fns.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";import"./vendor.lodash.js";import"./vendor.mini-create-react-context.js";import"./vendor.path-to-regexp.js";import"./vendor.react-is.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[t]="5861803d-7a84-4f2b-a656-a3ccdad198cf",o._sentryDebugIdIdentifier="sentry-dbid-5861803d-7a84-4f2b-a656-a3ccdad198cf")}catch{}})();const ae=new URL("popover.css",import.meta.url).href,ce=new URL("site.css",import.meta.url).href;class F extends e.PureComponent{constructor(){super(...arguments),this.rootRef=e.createRef(),this.isScrollingIntoView=!1,this.state={highlightedIdx:this.props.disableAutoHighlight?-1:0},this.onKeyDown=t=>{const{highlightedIdx:n}=this.state,{items:r}=this.props,s=()=>{t.stopPropagation(),t.preventDefault()};switch(t.key){case"ArrowUp":s(),n>0?this.setHighlighted(n-1):n===-1&&this.setHighlighted(r.length-1);break;case"ArrowDown":s(),n<r.length-1?this.setHighlighted(n+1):n===-1&&this.setHighlighted(0);break;case"Enter":s(),this.selectItem(r[n]);break}},this.selectItem=t=>{this.props.onSelect(t)},this.onItemHover=t=>{this.isScrollingIntoView||(this.setState({highlightedIdx:t}),this.props.onItemHighlighted?.(this.props.items[t]))},this.onMouseLeave=()=>{const{clearHoverOnMouseLeave:t,selectedItem:n,items:r}=this.props;if(t)if(n){const s=r.findIndex(l=>l===n);this.setState({highlightedIdx:s})}else this.setState({highlightedIdx:-1})},this.memoizedStyle=re(t=>t==null?{}:{maxHeight:t,overflowY:"auto"})}componentDidMount(){this.props.autoFocus&&this.rootRef.current.focus({preventScroll:!0}),this.props.forwardedRef&&this.rootRef.current&&(typeof this.props.forwardedRef=="function"?this.props.forwardedRef(this.rootRef.current):this.props.forwardedRef.current=this.rootRef.current)}render(){const t=this.state,{selectedItem:n,clearHoverOnMouseLeave:r,items:s,getItemGroup:l}=this.props;let a=null;const m=s.reduce((i,c,f)=>{const u=l?l(c):null;return u&&u!==a&&i.push(e.createElement("div",{key:`group-${u}-${f}`,className:"key-nav-list__group-header"},u)),a=u,i.push(e.createElement(me,{key:f,item:c,idx:f,className:se({"key-nav-list__item":!0,"key-nav-list__item--highlighted":f===t.highlightedIdx,"key-nav-list__item--selected":c===n}),renderContent:this.props.children,onClick:this.selectItem,onHover:this.onItemHover})),i},[]);return e.createElement("div",{ref:this.rootRef,className:"key-nav-list",style:this.memoizedStyle(this.props.maxHeight),onKeyDown:this.onKeyDown,onMouseLeave:r?this.onMouseLeave:void 0,tabIndex:0},m)}scrollHighlightedItemIntoView(){const t=this.rootRef.current,n=t.querySelector(".key-nav-list__item--highlighted");if(n){this.isScrollingIntoView=!0,window.clearTimeout(this.isScrollingIntoViewTimeout),this.isScrollingIntoViewTimeout=window.setTimeout(()=>this.isScrollingIntoView=!1,250);const r=t.getBoundingClientRect(),s=n.getBoundingClientRect();s.top<r.top?t.scrollTop+=s.top-r.top:s.bottom>r.bottom&&(t.scrollTop+=s.bottom-r.bottom)}}setHighlighted(t){this.setState({highlightedIdx:t},this.scrollHighlightedItemIntoView),this.props.onItemHighlighted?.(this.props.items[t])}}class me extends e.PureComponent{constructor(){super(...arguments),this.onClick=()=>this.props.onClick(this.props.item),this.onHover=()=>this.props.onHover(this.props.idx)}render(){const{props:t}=this;return e.createElement("div",{className:t.className,onClick:this.onClick,onMouseMove:this.onHover},t.renderContent(t.item,t.idx))}}e.forwardRef((o,t)=>e.createElement(F,{...o,forwardedRef:t}));function ue({testid:o,buttonText:t,value:n,onChange:r,options:s,renderOption:l,disabled:a,buttonStyle:m,htmlAttributes:i,comparator:c,showCheckIcon:f=!0}){const u=h.useRef(null),[p,g]=h.useState(!1),w=()=>{g(!1),u.current&&u.current.focus()},v=({key:d})=>{if(d.length===1){d=d.toLowerCase();for(const y of s){const x=l(y);if(typeof x=="string"&&x.toLowerCase().startsWith(d)){r(y);return}}}};return e.createElement(e.Fragment,null,e.createElement("button",{ref:u,"data-testid":o,type:"button",className:`btn btn-dynamic-icon ${m||"btn--plain-blue"} btn--sm ${p&&!a?"btn--popover-open":""}`,onClick:()=>g(!p),disabled:a,onKeyDown:v,...i},t||l(n),e.createElement(I,{icon:Z})),p&&!a&&u.current&&e.createElement(ne,{target:u.current,matchMinWidth:!0,onDismiss:w},e.createElement(F,{items:s,onSelect:d=>{w(),r(d)},autoFocus:!0},d=>e.createElement("div",{className:"d-flex"},f&&e.createElement("div",{className:"mr-8",style:(c?c(d,n):d===n)?void 0:{visibility:"hidden"}},e.createElement(I,{icon:ee})),l(d)))))}function de(o){const t=o?new Date(o):new Date;let n=new Intl.DateTimeFormat(L.language,{weekday:"long",day:"numeric",month:"short",year:t.getFullYear()===new Date().getFullYear()?void 0:"numeric"}).format(t);return n.substring(0,1).toUpperCase()+n.substring(1)}class tt{constructor(t,n){this.client=t,this.selector=n}mount(){if(this.container)throw new Error("SiteRoute has already been mounted");const t=document.querySelector(this.selector);if(!t)throw new Error(`SitePage: No element found for selector ${this.selector}`);this.container=t,Y.render(e.createElement(O,null,e.createElement(W.Provider,{value:this.client},e.createElement(fe,null))),this.container)}}const fe=()=>{const o=A();S(window,J),S(window,ae);const{loaded:t}=S(window,ce),[n,r]=h.useState(null),[s,l]=h.useState(void 0),a=n?.locale.standardLocaleId||n?.version.theme.languageId;return h.useEffect(()=>{a&&L.changeLanguage(a)},[a]),h.useEffect(()=>{const m=i=>{oe("Received site session",i),r(i)};return o.on("private:siteSession",m),()=>{o.off("private:siteSession",m)}},[o]),!n||!t?null:e.createElement(X.Provider,{value:n},e.createElement(z,{key:n.locale.standardLocaleId},e.createElement(le,null,e.createElement(H,{exact:!0,path:"/:locale/:announcementId"},e.createElement(M,null,e.createElement(pe,{key:n.locale.standardLocaleId}))),e.createElement(H,{path:"/:locale"},e.createElement(M,null,e.createElement(he,{key:n.locale.standardLocaleId,listScrollTop:s,onSaveScrollPosition:()=>{l(window.scrollY)}}))))))},M=({children:o})=>{const t=E(),n=$(t.version.theme),r=t.version.theme.siteLogoAsset?.assetUrl,s=t.version.site,l=b();if(!s)return null;const{headerText:a,headerDescription:m,logoUrl:i}=s;return e.createElement("div",{style:q(n),className:"userflow-site__announcements"},l?e.createElement("div",{className:"text-bolder userflow-site-preview-banner"},"PREVIEW"):null,e.createElement(we,{headerText:a,headerDescription:m,companyLogoSrc:r,logoUrl:i,localeDropdown:e.createElement(ge,null)}),o)},he=({listScrollTop:o,onSaveScrollPosition:t})=>{const{t:n}=V(),r=E(),{announcements:s,loading:l,loadingMore:a,error:m,truncated:i,loadMore:c,submitReaction:f,submitComment:u}=T(),p=h.useRef(!1);return h.useLayoutEffect(()=>{o!=null&&window.scrollTo(0,o)},[o]),h.useEffect(()=>{if(l||a||i)return;const g=()=>{if(p.current)return;const w=window.scrollY,v=window.innerHeight;document.documentElement.scrollHeight-(w+v)<=400&&(p.current=!0,c().finally(()=>{p.current=!1}))};return window.addEventListener("scroll",g),()=>window.removeEventListener("scroll",g)},[i,l,a,c]),m?e.createElement("div",{className:"userflow-site__announcement-content"},"Failed in loading announcements"):l?e.createElement("div",{className:"userflow-site__announcement-content"},e.createElement(_,{center:!0,fadeIn:!0})):e.createElement("div",{className:"userflow-site__announcement-content"},s.length>0?e.createElement("div",{className:"userflow-site__announcement-list"},s.map(g=>e.createElement(U,{expanded:!1,key:g.id,announcement:g,enableTitleLinks:r.version.site?.enableTitleLinks,onReactionChange:f,onCommentSubmit:u,onSaveScrollPosition:t})),a?e.createElement(_,{center:!0,fadeIn:!0}):null):null,s.length===0?e.createElement("h3",{className:"userflow-site-empty-state text-extra-bold"},L.exists("resource_center.no_announcements",{fallbackLng:[]})?n("resource_center.no_announcements"):n("resource_center.no_results_found")):null)},U=({announcement:o,expanded:t=!1,enableTitleLinks:n,onReactionChange:r,onCommentSubmit:s,onSaveScrollPosition:l})=>{const a=P(),m=j(),i=A(),c=E(),f=$(c.version.theme),u=b(),p=h.useRef(null),g=n&&!!m,w=ie(p,{once:!0,rootMargin:"100px",disabled:o.seen===!0}),v=K(`/${m}/${u?o.id:o.permalink}`);h.useEffect(()=>{w&&o.seen===!1&&i.send({kind:"MarkAnnouncementSeen",announcementId:o.id,versionId:o.versionId},{batch:!0})},[w,o,i]);const d=()=>{m&&(l?.(),a.push(v))};return e.createElement("div",{ref:p,className:"userflow-site__card"},e.createElement("div",null,e.createElement("span",{className:"text-small text-secondary"},de(o.time)),e.createElement("div",null,g?e.createElement(k,{to:v,className:"h2-like text-extra-bold"},o.title):e.createElement("h2",{className:"h2-like text-extra-bold"},o.title))),e.createElement(N,{doc:o.content,buttons:o.buttons,lookupAttribute:C(o.data)}),o.moreEnabled&&t?e.createElement(N,{doc:o.moreContent,buttons:o.moreButtons,lookupAttribute:C(o.data)}):null,e.createElement(G,{announcement:t?{...o,moreEnabled:!1}:o,confettiColors:f.confettiColors,onReactionChange:r,onCommentSubmit:s,onMoreClick:t?void 0:d},!t&&o.moreEnabled&&e.createElement("div",{className:"userflowjs-announcement-more--modal"},e.createElement("button",{className:"userflowjs-tertiary-button",onClick:d},o.moreButtonText||"Read more",e.createElement("span",{className:"userflowjs-rtl-mirrored userflowjs-tertiary-button__icon"},e.createElement(I,{icon:te}))))))},pe=()=>{const o=E(),{announcementId:t}=R(),{submitReaction:n,submitComment:r}=T(),s=b(),l=j(),a=K(`/${l}`),{t:m}=V(),{loading:i,data:c,error:f}=Q({message:{kind:"GetAnnouncement",announcementId:t,permalink:!s},skip:!t});return i?e.createElement(_,{center:!0,fadeIn:!0}):f||!c?.announcement?e.createElement("div",{className:"userflow-site__announcement-content"},e.createElement("div",{className:"d-flex gap-16 flex-column mt-24"},e.createElement(k,{to:a,className:"userflow-site-link-button userflow-site-home-back-button"},e.createElement(I,{icon:D}),o.version.site?.homeButtonText||"All Announcements"),e.createElement("div",{className:"userflow-site__card userflow-site__card--not-found"},e.createElement("h3",{className:"userflow-site__announcement-not-found text-extra-bold"},m("site.page_not_found"))))):e.createElement("div",{className:"userflow-site__announcement-content"},c?.announcement&&e.createElement("div",{className:"d-flex gap-16 flex-column mt-24"},e.createElement(k,{to:a,className:"userflow-site-link-button userflow-site-home-back-button"},e.createElement(I,{icon:D}),o.version.site?.homeButtonText||"All Announcements"),e.createElement(U,{expanded:!0,announcement:c.announcement,onReactionChange:n,onCommentSubmit:r})))},ge=()=>{const o=P(),t=E(),n=b(),r=B(),{announcementId:s}=R();if(t?.kind!=="site"||n)return null;const l=t.locales.find(i=>i.code===t.locale.standardLocaleId);if(t.locales.length===1&&t.locales[0].code===t.locale.standardLocaleId||t.locales.length===0||!l)return null;const m=i=>{const c=s?`/${i.code}/${s}`:`/${i.code}`;o.push(n?`${c}${r.search}`:c)};return e.createElement(ue,{buttonStyle:"userflow-site-locale-dropdown",value:l,options:t.locales,onChange:m,comparator:(i,c)=>i.code===c.code,renderOption:i=>i.name})},we=({companyLogoSrc:o,headerText:t,headerDescription:n,logoUrl:r,localeDropdown:s})=>e.createElement(e.Fragment,null,e.createElement("div",{className:"userflow-site-header-wrapper"},e.createElement("div",{className:"d-flex justify-space-between align-items-center userflow-site-logo-wrapper"},e.createElement("div",null,o?e.createElement(e.Fragment,null,r?e.createElement("a",{href:r,target:"_blank",rel:"noopener noreferrer"},e.createElement("img",{src:o,className:"userflow-site-logo"})):e.createElement("img",{src:o,className:"userflow-site-logo"})):null),s),e.createElement("div",{className:"userflow-site__announcements-heading"},e.createElement("h1",{className:"text-bold"},t),e.createElement("p",null,n)))),b=()=>E().draftMode,j=()=>{const o=E(),t=b(),{locale:n}=R();return t?n:n??o.locale.standardLocaleId},K=o=>{const t=b(),n=B();return t?`${o}${n.search}`:o};export{fe as SiteAnnouncementsWrapper,M as SiteContentWrapper,we as SiteHeader,U as SiteListItem,tt as SitePage};
1
+ import{R as e,r as h}from"./vendor.react.js";import{u as A,i as L,U as W}from"./client-context.js";import{r as Y}from"./vendor.react-dom.js";import{L as k,B as O}from"./vendor.react-router-dom.js";import{A as z,a as G,u as T,b as Q,S as _}from"./AnnouncementEngagement.js";import{D as I,u as S,a as $,g as q}from"./stylesheets.js";import{i as J}from"./iframe-reset.styl.js";import{S as X,u as E,R as N}from"./TreeDoc.js";import{g as C}from"./flow-condition-types.js";import{f as Z,a as ee,b as D}from"./vendor.fortawesome.pro-regular-svg-icons.js";import{f as te}from"./vendor.fortawesome.pro-solid-svg-icons.js";import{d as oe}from"./userflow.js";import{P as ne}from"./Popover.js";import{o as se}from"./vendor.obj-str.js";import{m as re}from"./vendor.memoize-one.js";import"./vendor.object-assign.js";import{u as ie}from"./react-hooks.js";import{S as le,a as H,u as P,b as R,d as B}from"./vendor.react-router.js";import{u as V}from"./vendor.react-i18next.js";import"./vendor.i18next.js";import"./vendor.babel.runtime.js";import"./vendor.scheduler.js";import"./vendor.history.js";import"./vendor.resolve-pathname.js";import"./vendor.value-equal.js";import"./vendor.tiny-invariant.js";import"./vendor.prop-types.js";import"./use-confetti.js";import"./vendor.canvas-confetti.js";import"./roots.js";import"./vendor.date-fns.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";import"./vendor.lodash.js";import"./vendor.mini-create-react-context.js";import"./vendor.path-to-regexp.js";import"./vendor.react-is.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[t]="80bead2a-4958-45fd-95ee-632c5471b585",o._sentryDebugIdIdentifier="sentry-dbid-80bead2a-4958-45fd-95ee-632c5471b585")}catch{}})();const ae=new URL("popover.css",import.meta.url).href,ce=new URL("site.css",import.meta.url).href;class F extends e.PureComponent{constructor(){super(...arguments),this.rootRef=e.createRef(),this.isScrollingIntoView=!1,this.state={highlightedIdx:this.props.disableAutoHighlight?-1:0},this.onKeyDown=t=>{const{highlightedIdx:n}=this.state,{items:r}=this.props,s=()=>{t.stopPropagation(),t.preventDefault()};switch(t.key){case"ArrowUp":s(),n>0?this.setHighlighted(n-1):n===-1&&this.setHighlighted(r.length-1);break;case"ArrowDown":s(),n<r.length-1?this.setHighlighted(n+1):n===-1&&this.setHighlighted(0);break;case"Enter":s(),this.selectItem(r[n]);break}},this.selectItem=t=>{this.props.onSelect(t)},this.onItemHover=t=>{this.isScrollingIntoView||(this.setState({highlightedIdx:t}),this.props.onItemHighlighted?.(this.props.items[t]))},this.onMouseLeave=()=>{const{clearHoverOnMouseLeave:t,selectedItem:n,items:r}=this.props;if(t)if(n){const s=r.findIndex(l=>l===n);this.setState({highlightedIdx:s})}else this.setState({highlightedIdx:-1})},this.memoizedStyle=re(t=>t==null?{}:{maxHeight:t,overflowY:"auto"})}componentDidMount(){this.props.autoFocus&&this.rootRef.current.focus({preventScroll:!0}),this.props.forwardedRef&&this.rootRef.current&&(typeof this.props.forwardedRef=="function"?this.props.forwardedRef(this.rootRef.current):this.props.forwardedRef.current=this.rootRef.current)}render(){const t=this.state,{selectedItem:n,clearHoverOnMouseLeave:r,items:s,getItemGroup:l}=this.props;let a=null;const m=s.reduce((i,c,f)=>{const u=l?l(c):null;return u&&u!==a&&i.push(e.createElement("div",{key:`group-${u}-${f}`,className:"key-nav-list__group-header"},u)),a=u,i.push(e.createElement(me,{key:f,item:c,idx:f,className:se({"key-nav-list__item":!0,"key-nav-list__item--highlighted":f===t.highlightedIdx,"key-nav-list__item--selected":c===n}),renderContent:this.props.children,onClick:this.selectItem,onHover:this.onItemHover})),i},[]);return e.createElement("div",{ref:this.rootRef,className:"key-nav-list",style:this.memoizedStyle(this.props.maxHeight),onKeyDown:this.onKeyDown,onMouseLeave:r?this.onMouseLeave:void 0,tabIndex:0},m)}scrollHighlightedItemIntoView(){const t=this.rootRef.current,n=t.querySelector(".key-nav-list__item--highlighted");if(n){this.isScrollingIntoView=!0,window.clearTimeout(this.isScrollingIntoViewTimeout),this.isScrollingIntoViewTimeout=window.setTimeout(()=>this.isScrollingIntoView=!1,250);const r=t.getBoundingClientRect(),s=n.getBoundingClientRect();s.top<r.top?t.scrollTop+=s.top-r.top:s.bottom>r.bottom&&(t.scrollTop+=s.bottom-r.bottom)}}setHighlighted(t){this.setState({highlightedIdx:t},this.scrollHighlightedItemIntoView),this.props.onItemHighlighted?.(this.props.items[t])}}class me extends e.PureComponent{constructor(){super(...arguments),this.onClick=()=>this.props.onClick(this.props.item),this.onHover=()=>this.props.onHover(this.props.idx)}render(){const{props:t}=this;return e.createElement("div",{className:t.className,onClick:this.onClick,onMouseMove:this.onHover},t.renderContent(t.item,t.idx))}}e.forwardRef((o,t)=>e.createElement(F,{...o,forwardedRef:t}));function ue({testid:o,buttonText:t,value:n,onChange:r,options:s,renderOption:l,disabled:a,buttonStyle:m,htmlAttributes:i,comparator:c,showCheckIcon:f=!0}){const u=h.useRef(null),[p,g]=h.useState(!1),w=()=>{g(!1),u.current&&u.current.focus()},v=({key:d})=>{if(d.length===1){d=d.toLowerCase();for(const y of s){const x=l(y);if(typeof x=="string"&&x.toLowerCase().startsWith(d)){r(y);return}}}};return e.createElement(e.Fragment,null,e.createElement("button",{ref:u,"data-testid":o,type:"button",className:`btn btn-dynamic-icon ${m||"btn--plain-blue"} btn--sm ${p&&!a?"btn--popover-open":""}`,onClick:()=>g(!p),disabled:a,onKeyDown:v,...i},t||l(n),e.createElement(I,{icon:Z})),p&&!a&&u.current&&e.createElement(ne,{target:u.current,matchMinWidth:!0,onDismiss:w},e.createElement(F,{items:s,onSelect:d=>{w(),r(d)},autoFocus:!0},d=>e.createElement("div",{className:"d-flex"},f&&e.createElement("div",{className:"mr-8",style:(c?c(d,n):d===n)?void 0:{visibility:"hidden"}},e.createElement(I,{icon:ee})),l(d)))))}function de(o){const t=o?new Date(o):new Date;let n=new Intl.DateTimeFormat(L.language,{weekday:"long",day:"numeric",month:"short",year:t.getFullYear()===new Date().getFullYear()?void 0:"numeric"}).format(t);return n.substring(0,1).toUpperCase()+n.substring(1)}class tt{constructor(t,n){this.client=t,this.selector=n}mount(){if(this.container)throw new Error("SiteRoute has already been mounted");const t=document.querySelector(this.selector);if(!t)throw new Error(`SitePage: No element found for selector ${this.selector}`);this.container=t,Y.render(e.createElement(O,null,e.createElement(W.Provider,{value:this.client},e.createElement(fe,null))),this.container)}}const fe=()=>{const o=A();S(window,J),S(window,ae);const{loaded:t}=S(window,ce),[n,r]=h.useState(null),[s,l]=h.useState(void 0),a=n?.locale.standardLocaleId||n?.version.theme.languageId;return h.useEffect(()=>{a&&L.changeLanguage(a)},[a]),h.useEffect(()=>{const m=i=>{oe("Received site session",i),r(i)};return o.on("private:siteSession",m),()=>{o.off("private:siteSession",m)}},[o]),!n||!t?null:e.createElement(X.Provider,{value:n},e.createElement(z,{key:n.locale.standardLocaleId},e.createElement(le,null,e.createElement(H,{exact:!0,path:"/:locale/:announcementId"},e.createElement(M,null,e.createElement(pe,{key:n.locale.standardLocaleId}))),e.createElement(H,{path:"/:locale"},e.createElement(M,null,e.createElement(he,{key:n.locale.standardLocaleId,listScrollTop:s,onSaveScrollPosition:()=>{l(window.scrollY)}}))))))},M=({children:o})=>{const t=E(),n=$(t.version.theme),r=t.version.theme.siteLogoAsset?.assetUrl,s=t.version.site,l=b();if(!s)return null;const{headerText:a,headerDescription:m,logoUrl:i}=s;return e.createElement("div",{style:q(n),className:"userflow-site__announcements"},l?e.createElement("div",{className:"text-bolder userflow-site-preview-banner"},"PREVIEW"):null,e.createElement(we,{headerText:a,headerDescription:m,companyLogoSrc:r,logoUrl:i,localeDropdown:e.createElement(ge,null)}),o)},he=({listScrollTop:o,onSaveScrollPosition:t})=>{const{t:n}=V(),r=E(),{announcements:s,loading:l,loadingMore:a,error:m,truncated:i,loadMore:c,submitReaction:f,submitComment:u}=T(),p=h.useRef(!1);return h.useLayoutEffect(()=>{o!=null&&window.scrollTo(0,o)},[o]),h.useEffect(()=>{if(l||a||i)return;const g=()=>{if(p.current)return;const w=window.scrollY,v=window.innerHeight;document.documentElement.scrollHeight-(w+v)<=400&&(p.current=!0,c().finally(()=>{p.current=!1}))};return window.addEventListener("scroll",g),()=>window.removeEventListener("scroll",g)},[i,l,a,c]),m?e.createElement("div",{className:"userflow-site__announcement-content"},"Failed in loading announcements"):l?e.createElement("div",{className:"userflow-site__announcement-content"},e.createElement(_,{center:!0,fadeIn:!0})):e.createElement("div",{className:"userflow-site__announcement-content"},s.length>0?e.createElement("div",{className:"userflow-site__announcement-list"},s.map(g=>e.createElement(U,{expanded:!1,key:g.id,announcement:g,enableTitleLinks:r.version.site?.enableTitleLinks,onReactionChange:f,onCommentSubmit:u,onSaveScrollPosition:t})),a?e.createElement(_,{center:!0,fadeIn:!0}):null):null,s.length===0?e.createElement("h3",{className:"userflow-site-empty-state text-extra-bold"},L.exists("resource_center.no_announcements",{fallbackLng:[]})?n("resource_center.no_announcements"):n("resource_center.no_results_found")):null)},U=({announcement:o,expanded:t=!1,enableTitleLinks:n,onReactionChange:r,onCommentSubmit:s,onSaveScrollPosition:l})=>{const a=P(),m=j(),i=A(),c=E(),f=$(c.version.theme),u=b(),p=h.useRef(null),g=n&&!!m,w=ie(p,{once:!0,rootMargin:"100px",disabled:o.seen===!0}),v=K(`/${m}/${u?o.id:o.permalink}`);h.useEffect(()=>{w&&o.seen===!1&&i.send({kind:"MarkAnnouncementSeen",announcementId:o.id,versionId:o.versionId},{batch:!0})},[w,o,i]);const d=()=>{m&&(l?.(),a.push(v))};return e.createElement("div",{ref:p,className:"userflow-site__card"},e.createElement("div",null,e.createElement("span",{className:"text-small text-secondary"},de(o.time)),e.createElement("div",null,g?e.createElement(k,{to:v,className:"h2-like text-extra-bold"},o.title):e.createElement("h2",{className:"h2-like text-extra-bold"},o.title))),e.createElement(N,{doc:o.content,buttons:o.buttons,lookupAttribute:C(o.data)}),o.moreEnabled&&t?e.createElement(N,{doc:o.moreContent,buttons:o.moreButtons,lookupAttribute:C(o.data)}):null,e.createElement(G,{announcement:t?{...o,moreEnabled:!1}:o,confettiColors:f.confettiColors,onReactionChange:r,onCommentSubmit:s,onMoreClick:t?void 0:d},!t&&o.moreEnabled&&e.createElement("div",{className:"userflowjs-announcement-more--modal"},e.createElement("button",{className:"userflowjs-tertiary-button",onClick:d},o.moreButtonText||"Read more",e.createElement("span",{className:"userflowjs-rtl-mirrored userflowjs-tertiary-button__icon"},e.createElement(I,{icon:te}))))))},pe=()=>{const o=E(),{announcementId:t}=R(),{submitReaction:n,submitComment:r}=T(),s=b(),l=j(),a=K(`/${l}`),{t:m}=V(),{loading:i,data:c,error:f}=Q({message:{kind:"GetAnnouncement",announcementId:t,permalink:!s},skip:!t});return i?e.createElement(_,{center:!0,fadeIn:!0}):f||!c?.announcement?e.createElement("div",{className:"userflow-site__announcement-content"},e.createElement("div",{className:"d-flex gap-16 flex-column mt-24"},e.createElement(k,{to:a,className:"userflow-site-link-button userflow-site-home-back-button"},e.createElement(I,{icon:D}),o.version.site?.homeButtonText||"All Announcements"),e.createElement("div",{className:"userflow-site__card userflow-site__card--not-found"},e.createElement("h3",{className:"userflow-site__announcement-not-found text-extra-bold"},m("site.page_not_found"))))):e.createElement("div",{className:"userflow-site__announcement-content"},c?.announcement&&e.createElement("div",{className:"d-flex gap-16 flex-column mt-24"},e.createElement(k,{to:a,className:"userflow-site-link-button userflow-site-home-back-button"},e.createElement(I,{icon:D}),o.version.site?.homeButtonText||"All Announcements"),e.createElement(U,{expanded:!0,announcement:c.announcement,onReactionChange:n,onCommentSubmit:r})))},ge=()=>{const o=P(),t=E(),n=b(),r=B(),{announcementId:s}=R();if(t?.kind!=="site"||n)return null;const l=t.locales.find(i=>i.code===t.locale.standardLocaleId);if(t.locales.length===1&&t.locales[0].code===t.locale.standardLocaleId||t.locales.length===0||!l)return null;const m=i=>{const c=s?`/${i.code}/${s}`:`/${i.code}`;o.push(n?`${c}${r.search}`:c)};return e.createElement(ue,{buttonStyle:"userflow-site-locale-dropdown",value:l,options:t.locales,onChange:m,comparator:(i,c)=>i.code===c.code,renderOption:i=>i.name})},we=({companyLogoSrc:o,headerText:t,headerDescription:n,logoUrl:r,localeDropdown:s})=>e.createElement(e.Fragment,null,e.createElement("div",{className:"userflow-site-header-wrapper"},e.createElement("div",{className:"d-flex justify-space-between align-items-center userflow-site-logo-wrapper"},e.createElement("div",null,o?e.createElement(e.Fragment,null,r?e.createElement("a",{href:r,target:"_blank",rel:"noopener noreferrer"},e.createElement("img",{src:o,className:"userflow-site-logo"})):e.createElement("img",{src:o,className:"userflow-site-logo"})):null),s),e.createElement("div",{className:"userflow-site__announcements-heading"},e.createElement("h1",{className:"text-bold"},t),e.createElement("p",null,n)))),b=()=>E().draftMode,j=()=>{const o=E(),t=b(),{locale:n}=R();return t?n:n??o.locale.standardLocaleId},K=o=>{const t=b(),n=B();return t?`${o}${n.search}`:o};export{fe as SiteAnnouncementsWrapper,M as SiteContentWrapper,we as SiteHeader,U as SiteListItem,tt as SitePage};
2
2
  //# sourceMappingURL=SitePage.js.map
@@ -1,2 +1,2 @@
1
- import{r,R as t}from"./vendor.react.js";import{u as g}from"./client-context.js";import{B as b}from"./BuilderBar.js";import{a6 as w}from"./vendor.fortawesome.pro-regular-svg-icons.js";import{D as E}from"./stylesheets.js";import{P as y}from"./Popover.js";import"./vendor.object-assign.js";import"./vendor.i18next.js";import"./vendor.babel.runtime.js";import"./vendor.react-i18next.js";import"./Frame.js";import"./vendor.react-dom.js";import"./vendor.scheduler.js";import"./iframe-reset.styl.js";import"./logomark.js";import"./vendor.obj-str.js";import"./vendor.fortawesome.pro-light-svg-icons.js";import"./userflow.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";import"./use-window-resize.js";import"./vendor.fortawesome.pro-solid-svg-icons.js";import"./flow-condition-types.js";import"./vendor.date-fns.js";import"./roots.js";(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[e]="245b9ad3-2ed2-48da-8151-3797829b2ad1",i._sentryDebugIdIdentifier="sentry-dbid-245b9ad3-2ed2-48da-8151-3797829b2ad1")}catch{}})();const v=250,C=250;let I=0;class T{constructor(){this.currentId=null,this.subscribers=new Set}showDelayed(e){window.clearTimeout(this.changeTimeout),this.currentId?this.updateCurrentId(e):this.changeTimeout=window.setTimeout(()=>{this.updateCurrentId(e)},v)}hideDelayed(e){window.clearTimeout(this.changeTimeout),e===this.currentId&&(this.changeTimeout=window.setTimeout(()=>{this.updateCurrentId(null)},C))}hide(e){window.clearTimeout(this.changeTimeout),e===this.currentId&&this.updateCurrentId(null)}updateCurrentId(e){this.currentId=e,this.subscribers.forEach(n=>n(e))}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}}const S=r.createContext(new T),D=i=>{const e=r.useRef(null),[n]=r.useState(()=>++I),o=r.useContext(S),[m,p]=r.useState(o.currentId);r.useEffect(()=>o.subscribe(p),[o]);const{tip:s,maxWidth:f,children:d,Tag:a,placement:h="top",...c}=i,l=a||"div";let u=null;return m===n&&e.current&&(u=t.createElement(y,{className:"tooltipped__popover",target:e.current,placement:h,horizontalAlign:"center",verticalAlign:"center",onMouseEnter:()=>o.hide(n),document:e.current.ownerDocument||void 0},t.createElement("div",{style:{maxWidth:f||300}},typeof s=="function"?s():s))),t.createElement(t.Fragment,null,t.createElement(l,{ref:e,...c,onMouseEnter:s?()=>o.showDelayed(n):void 0,onMouseLeave:s?()=>o.hideDelayed(n):void 0,onMouseDown:s?()=>o.hide(n):void 0},d),u)},Z=({token:i})=>{const e=g(),[n,o]=r.useState("notIdentified"),[m,p]=r.useState(null),[s,f]=r.useState(null);let d=r.useRef(!1);r.useEffect(()=>()=>{d.current&&(d.current=!1,e.send({kind:"TestStartConditionCancel"}))},[e]);const a=r.useCallback(()=>{e.setSessionStorageState(c=>({...c,activeApp:null,testStartConditionToken:void 0}))},[e]);r.useEffect(()=>{let c=!1;return e.onceIdentified(async()=>{o("loading"),d.current=!0;let l;try{l=await e.send({kind:"TestStartCondition",token:i},{handlesRejection:!0})}catch(u){if(c)return;o("error"),f(u.humanMessage||"Sorry, something went wrong. Please try again or contact Userflow.");return}c||(p(l),o("loaded"),e.on("private:testStartConditionSuccess",a))}),()=>{c=!0,e.off("private:testStartConditionSuccess",a)}},[e,i,a]);const h=r.useCallback(async()=>{a(),e.getTargetEnv().postBuilderMessage({kind:"userflow:activateBuilder"})},[e,a]);return t.createElement(b,{buttons:t.createElement("button",{className:"btn btn--default",onClick:()=>h()},"Back to Builder")},t.createElement("div",null,t.createElement("div",{className:"label"},"Testing: ",m?.flowName||"..."),n==="notIdentified"?t.createElement("div",null,"Waiting for your app to identify user..."):n==="loading"?t.createElement("div",null,"Loading..."):n==="error"?t.createElement("div",{className:"error"},s):t.createElement("div",{className:"error"},t.createElement("span",{className:"error-text-with-icon"},"Auto-start condition not triggered yet...","",t.createElement(D,{tip:"Auto-start conditions debugging guide",placement:"right"},t.createElement("a",{href:"https://docs.userflow.com/docs/trouble/using-the-debugger",target:"_blank",rel:"noopener noreferrer",className:"error-icon-link"},t.createElement(E,{icon:w,size:12})))))))};export{Z as StartConditionTestingApp,Z as default};
1
+ import{r,R as t}from"./vendor.react.js";import{u as g}from"./client-context.js";import{B as b}from"./BuilderBar.js";import{a6 as w}from"./vendor.fortawesome.pro-regular-svg-icons.js";import{D as E}from"./stylesheets.js";import{P as y}from"./Popover.js";import"./vendor.object-assign.js";import"./vendor.i18next.js";import"./vendor.babel.runtime.js";import"./vendor.react-i18next.js";import"./Frame.js";import"./vendor.react-dom.js";import"./vendor.scheduler.js";import"./vendor.obj-str.js";import"./iframe-reset.styl.js";import"./logomark.js";import"./vendor.fortawesome.pro-light-svg-icons.js";import"./userflow.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";import"./use-window-resize.js";import"./vendor.fortawesome.pro-solid-svg-icons.js";import"./flow-condition-types.js";import"./vendor.date-fns.js";import"./roots.js";(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[e]="52bfd343-b41c-48a0-a602-74891fe3e57d",i._sentryDebugIdIdentifier="sentry-dbid-52bfd343-b41c-48a0-a602-74891fe3e57d")}catch{}})();const v=250,C=250;let I=0;class T{constructor(){this.currentId=null,this.subscribers=new Set}showDelayed(e){window.clearTimeout(this.changeTimeout),this.currentId?this.updateCurrentId(e):this.changeTimeout=window.setTimeout(()=>{this.updateCurrentId(e)},v)}hideDelayed(e){window.clearTimeout(this.changeTimeout),e===this.currentId&&(this.changeTimeout=window.setTimeout(()=>{this.updateCurrentId(null)},C))}hide(e){window.clearTimeout(this.changeTimeout),e===this.currentId&&this.updateCurrentId(null)}updateCurrentId(e){this.currentId=e,this.subscribers.forEach(n=>n(e))}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}}const S=r.createContext(new T),D=i=>{const e=r.useRef(null),[n]=r.useState(()=>++I),o=r.useContext(S),[m,p]=r.useState(o.currentId);r.useEffect(()=>o.subscribe(p),[o]);const{tip:s,maxWidth:f,children:l,Tag:a,placement:h="top",...c}=i,u=a||"div";let d=null;return m===n&&e.current&&(d=t.createElement(y,{className:"tooltipped__popover",target:e.current,placement:h,horizontalAlign:"center",verticalAlign:"center",onMouseEnter:()=>o.hide(n),document:e.current.ownerDocument||void 0},t.createElement("div",{style:{maxWidth:f||300}},typeof s=="function"?s():s))),t.createElement(t.Fragment,null,t.createElement(u,{ref:e,...c,onMouseEnter:s?()=>o.showDelayed(n):void 0,onMouseLeave:s?()=>o.hideDelayed(n):void 0,onMouseDown:s?()=>o.hide(n):void 0},l),d)},Z=({token:i})=>{const e=g(),[n,o]=r.useState("notIdentified"),[m,p]=r.useState(null),[s,f]=r.useState(null);let l=r.useRef(!1);r.useEffect(()=>()=>{l.current&&(l.current=!1,e.send({kind:"TestStartConditionCancel"}))},[e]);const a=r.useCallback(()=>{e.setSessionStorageState(c=>({...c,activeApp:null,testStartConditionToken:void 0}))},[e]);r.useEffect(()=>{let c=!1;return e.onceIdentified(async()=>{o("loading"),l.current=!0;let u;try{u=await e.send({kind:"TestStartCondition",token:i},{handlesRejection:!0})}catch(d){if(c)return;o("error"),f(d.humanMessage||"Sorry, something went wrong. Please try again or contact Userflow.");return}c||(p(u),o("loaded"),e.on("private:testStartConditionSuccess",a))}),()=>{c=!0,e.off("private:testStartConditionSuccess",a)}},[e,i,a]);const h=r.useCallback(async()=>{a(),e.getTargetEnv().postBuilderMessage({kind:"userflow:activateBuilder"})},[e,a]);return t.createElement(b,{buttons:t.createElement("button",{className:"btn btn--default",onClick:()=>h()},"Back to Builder")},t.createElement("div",null,t.createElement("div",{className:"label"},"Testing: ",m?.flowName||"..."),n==="notIdentified"?t.createElement("div",null,"Waiting for your app to identify user..."):n==="loading"?t.createElement("div",null,"Loading..."):n==="error"?t.createElement("div",{className:"error"},s):t.createElement("div",{className:"error"},t.createElement("span",{className:"error-text-with-icon"},"Auto-start condition not triggered yet...","",t.createElement(D,{tip:"Auto-start conditions debugging guide",placement:"right"},t.createElement("a",{href:"https://docs.userflow.com/docs/trouble/using-the-debugger",target:"_blank",rel:"noopener noreferrer",className:"error-icon-link"},t.createElement(E,{icon:w,size:12})))))))};export{Z as StartConditionTestingApp,Z as default};
2
2
  //# sourceMappingURL=StartConditionTestingApp.js.map
@@ -1,2 +1,2 @@
1
- import{r as c,R as r}from"./vendor.react.js";import{u as y}from"./client-context.js";import{B as T}from"./BuilderBar.js";import{c as E}from"./flow-condition-types.js";import{S as I}from"./userflow.js";import"./vendor.object-assign.js";import"./vendor.i18next.js";import"./vendor.babel.runtime.js";import"./vendor.react-i18next.js";import"./Frame.js";import"./vendor.react-dom.js";import"./vendor.scheduler.js";import"./stylesheets.js";import"./vendor.fortawesome.pro-regular-svg-icons.js";import"./vendor.fortawesome.pro-solid-svg-icons.js";import"./iframe-reset.styl.js";import"./logomark.js";import"./vendor.obj-str.js";import"./vendor.fortawesome.pro-light-svg-icons.js";import"./use-window-resize.js";import"./vendor.date-fns.js";import"./roots.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:{},e=new Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="d1c02668-18c9-4740-a65c-b8d5d8a0e0bd",t._sentryDebugIdIdentifier="sentry-dbid-d1c02668-18c9-4740-a65c-b8d5d8a0e0bd")}catch{}})();const P=({state:t})=>{const e=y(),[o,d]=c.useState("notIdentified");c.useEffect(()=>{let n=!1,i,a;function k(){i=()=>{e.off("private:identified",i),g()},e.isIdentified()?i():e.on("private:identified",i)}const g=async()=>{d("trackerLoading");const{tracker:l}=await e.send({kind:"GetTrackerForTesting",token:t.token});if(n)return;const{condition:f}=l,b=E[f.type];let m=!1;a=b.track({sessionData:new I(l.data),condition:f,flipBackEvents:!0,callback:p=>{const v=m;m=p,!v&&p&&e.setSessionStorageState(s=>({...s,trackerTesting:{...s.trackerTesting,events:s.trackerTesting.events+1}}))}}),d("trackerLoaded")};return k(),()=>{n=!0,i&&e.off("private:identified",i),a&&a()}},[e,t.token]);const u=c.useCallback(async()=>{e.setSessionStorageState(n=>({...n,activeApp:null,trackerTesting:null})),e.getTargetEnv().postBuilderMessage({kind:"userflow:testTrackerClosed"})},[e]);return r.createElement(T,{buttons:r.createElement("button",{className:"btn btn--default",onClick:()=>u()},"Back to Builder")},r.createElement("div",null,r.createElement("div",{className:"label"},"Testing tracker: ",t.trackerName),o==="notIdentified"?r.createElement("div",null,"Waiting for your app to identify user..."):o==="trackerLoading"?r.createElement("div",null,"Loading tracker..."):t.events===0?r.createElement("div",{className:"error"},"Not tracked yet"):r.createElement("div",{className:"success"},"Tracked ",t.events," time",t.events===1?"":"s")))};export{P as TrackerTestingApp,P as default};
1
+ import{r as c,R as r}from"./vendor.react.js";import{u as y}from"./client-context.js";import{B as T}from"./BuilderBar.js";import{c as E}from"./flow-condition-types.js";import{S as I}from"./userflow.js";import"./vendor.object-assign.js";import"./vendor.i18next.js";import"./vendor.babel.runtime.js";import"./vendor.react-i18next.js";import"./Frame.js";import"./vendor.react-dom.js";import"./vendor.scheduler.js";import"./vendor.obj-str.js";import"./stylesheets.js";import"./vendor.fortawesome.pro-regular-svg-icons.js";import"./vendor.fortawesome.pro-solid-svg-icons.js";import"./iframe-reset.styl.js";import"./logomark.js";import"./vendor.fortawesome.pro-light-svg-icons.js";import"./use-window-resize.js";import"./vendor.date-fns.js";import"./roots.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:{},e=new Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="1aca3a9e-7116-45c4-a889-3cac3bed41f1",t._sentryDebugIdIdentifier="sentry-dbid-1aca3a9e-7116-45c4-a889-3cac3bed41f1")}catch{}})();const P=({state:t})=>{const e=y(),[a,d]=c.useState("notIdentified");c.useEffect(()=>{let n=!1,i,o;function k(){i=()=>{e.off("private:identified",i),g()},e.isIdentified()?i():e.on("private:identified",i)}const g=async()=>{d("trackerLoading");const{tracker:l}=await e.send({kind:"GetTrackerForTesting",token:t.token});if(n)return;const{condition:f}=l,v=E[f.type];let m=!1;o=v.track({sessionData:new I(l.data),condition:f,flipBackEvents:!0,callback:p=>{const b=m;m=p,!b&&p&&e.setSessionStorageState(s=>({...s,trackerTesting:{...s.trackerTesting,events:s.trackerTesting.events+1}}))}}),d("trackerLoaded")};return k(),()=>{n=!0,i&&e.off("private:identified",i),o&&o()}},[e,t.token]);const u=c.useCallback(async()=>{e.setSessionStorageState(n=>({...n,activeApp:null,trackerTesting:null})),e.getTargetEnv().postBuilderMessage({kind:"userflow:testTrackerClosed"})},[e]);return r.createElement(T,{buttons:r.createElement("button",{className:"btn btn--default",onClick:()=>u()},"Back to Builder")},r.createElement("div",null,r.createElement("div",{className:"label"},"Testing tracker: ",t.trackerName),a==="notIdentified"?r.createElement("div",null,"Waiting for your app to identify user..."):a==="trackerLoading"?r.createElement("div",null,"Loading tracker..."):t.events===0?r.createElement("div",{className:"error"},"Not tracked yet"):r.createElement("div",{className:"success"},"Tracked ",t.events," time",t.events===1?"":"s")))};export{P as TrackerTestingApp,P as default};
2
2
  //# sourceMappingURL=TrackerTestingApp.js.map
package/hash.txt CHANGED
@@ -1 +1 @@
1
- 5b9dccc735466e7c82c8f110c8bea41b8295cc95
1
+ 19b88bb3e063750469926e8d51edb6133218296f
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "userflow.js-self-hosted",
3
- "version": "0.1.1024968",
3
+ "version": "0.1.1024973",
4
4
  "description": "Self-hosted version of Userflow.js",
5
5
  "main": "userflow.js"
6
6
  }
package/site.css CHANGED
@@ -9,7 +9,6 @@ input,
9
9
  textarea,
10
10
  select {
11
11
  font-family: "uf-figtree", sans-serif;
12
- font-feature-settings: 'tnum', 'ss01', 'ss02';
13
12
  font-size: 1rem;
14
13
  -webkit-font-smoothing: antialiased;
15
14
  }
package/ui.js CHANGED
@@ -1,3 +1,3 @@
1
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","logomark.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","use-confetti.js","vendor.canvas-confetti.js","TreeDoc.js","Trigger.js","steps.js","WorkflowApp.js","resource-center-route.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,25]))),Q=e.lazy(()=>o(()=>import("./SmartFlowRecordingApp.js"),__vite__mapDeps([26,1,2,4,9,10,11,12,14,15,16,17,18,19,20,6,7,8,21,22,5,23,24,25,13]))),X=e.lazy(()=>o(()=>import("./FlowApp.js"),__vite__mapDeps([27,1,2,6,7,8,28,12,11,29,19,18,20,21,22,5,9,10,15,16,17,23,30,31,13,24,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,38,30,29,15,16,17,23,31,13,24,32,33]))),Z=e.lazy(()=>o(()=>import("./ChecklistApp.js"),__vite__mapDeps([39,1,2,6,7,8,29,19,18,20,21,22,11,5,9,10,12,15,16,17,23,30,31,13,24,4,32,33,40,34]))),ee=e.lazy(j),te=e.lazy(()=>o(()=>import("./EmbedApp.js"),__vite__mapDeps([41,1,2,6,7,8,9,10,11,12,4,18,19,20,21,22,5,34,30,31,16,17,15,23,42,13,40]))),ne=e.lazy(q),se=e.lazy(()=>o(()=>import("./ResourceCenterLauncherHandler.js"),__vite__mapDeps([43,1,2,6,7,8,9,10,11,12,31,21,22,5,18,19,20,44,30,34,4,15,16,17,23,13,24,40,29,32,33,45,46,47,42,38]))),oe=e.lazy(()=>o(()=>import("./LauncherApp.js"),__vite__mapDeps([48,1,2,6,7,8,31,21,22,11,5,34,18,19,20,9,10,12,4,30,29,15,16,17,23,13,24,32,33,35]))),re=e.lazy(()=>o(()=>import("./NotificationsApp.js"),__vite__mapDeps([49,1,2,9,10,11,12,30,6,7,8,18,19,20,21,22,5]))),ie=e.lazy(()=>o(()=>import("./TrackerTestingApp.js"),__vite__mapDeps([50,1,2,9,10,11,12,14,15,16,17,18,19,20,6,7,8,21,22,5,23,24,4,25,13]))),ae=e.lazy(()=>o(()=>import("./StartConditionTestingApp.js"),__vite__mapDeps([51,1,2,9,10,11,12,14,15,16,17,18,19,20,6,7,8,21,22,5,23,24,4,25,13,52]))),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};
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,25]))),Q=e.lazy(()=>o(()=>import("./SmartFlowRecordingApp.js"),__vite__mapDeps([26,1,2,4,9,10,11,12,14,15,16,17,18,19,20,6,7,8,21,22,5,23,24,25,13]))),X=e.lazy(()=>o(()=>import("./FlowApp.js"),__vite__mapDeps([27,1,2,6,7,8,28,12,11,29,19,18,20,21,22,5,9,10,15,16,17,4,23,30,31,13,24,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,38,30,29,15,16,17,23,31,13,24,32,33]))),Z=e.lazy(()=>o(()=>import("./ChecklistApp.js"),__vite__mapDeps([39,1,2,6,7,8,29,19,18,20,21,22,11,5,9,10,12,15,16,17,4,23,30,31,13,24,32,33,40,34]))),ee=e.lazy(j),te=e.lazy(()=>o(()=>import("./EmbedApp.js"),__vite__mapDeps([41,1,2,6,7,8,9,10,11,12,4,18,19,20,21,22,5,34,30,31,16,17,15,23,42,13,40]))),ne=e.lazy(q),se=e.lazy(()=>o(()=>import("./ResourceCenterLauncherHandler.js"),__vite__mapDeps([43,1,2,6,7,8,9,10,11,12,31,21,22,5,18,19,20,44,30,34,4,15,16,17,23,13,24,40,29,32,33,45,46,47,42,38]))),oe=e.lazy(()=>o(()=>import("./LauncherApp.js"),__vite__mapDeps([48,1,2,6,7,8,31,21,22,11,5,34,18,19,20,9,10,12,4,30,29,15,16,17,23,13,24,32,33,35]))),re=e.lazy(()=>o(()=>import("./NotificationsApp.js"),__vite__mapDeps([49,1,2,9,10,11,12,30,6,7,8,18,19,20,21,22,5]))),ie=e.lazy(()=>o(()=>import("./TrackerTestingApp.js"),__vite__mapDeps([50,1,2,9,10,11,12,14,15,16,17,4,18,19,20,6,7,8,21,22,5,23,24,25,13]))),ae=e.lazy(()=>o(()=>import("./StartConditionTestingApp.js"),__vite__mapDeps([51,1,2,9,10,11,12,14,15,16,17,4,18,19,20,6,7,8,21,22,5,23,24,25,13,52]))),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,7 +1,7 @@
1
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","resource-center-route.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
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
3
  Returned URL: `+e+`
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="1024968",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?`
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="1024973",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?`
5
5
  Details:
6
6
  `+i.details.map(r=>(r.path?`${r.path}: `:"")+r.message):""))})}async startImplicitTracking(){await I(()=>import("./implicit-tracking.js"),__vite__mapDeps([49,11,2,34,33])).then(t=>{this.implicitTracking=new t.ImplicitTracking(this),this.implicitTracking.start()}).catch(t=>o(`Implicit tracking failed to load ${t}`))}makeChannelJoinPayload(){let t;d.getItem(w)&&(t=new URL(m()).searchParams.get("announcement_id")||void 0);const n=this.buildClientContext();this.clientContext=n;const i={protocolVersion:2,userflowClientBuild:N,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:d.getItem("previewFlowId"),announcementPreviewId:t,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()},ot)}hasDraftSession(){return!!this.flowSession?.draftMode||!!this.checklistSession?.draftMode||!!this.bannerSession?.draftMode||!!this.resourceCenterSession?.draftMode||this.launcherSessions.some(t=>t.draftMode)}async send(t,{batch:s,endBatch:n,handlesRejection:i}={}){return(!this.inBatch||!["ToggleClientCondition","UpdateClientContext"].includes(t.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(t,{handlesRejection:i})}clearInitialMessagesQueue(t){if(this.initialMessagesQueue.length===0)return;const s=t.includes("cff_disable_page_views")===!0,n=t.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(t,{handlesRejection:s}={}){return typeof this.featureFlags>"u"?new Promise((n,i)=>{this.initialMessagesQueue.push({message:t,resolve:n,reject:i,handlesRejection:s})}):new Promise((n,i)=>{this._sendToChannel(t,n,i,{handlesRejection:s})})}_sendToChannel(t,s,n,{handlesRejection:i}={}){if(!this.channel){const u=`Userflow.js: send() should not be called if channel is not set. Message kind=${t.kind}`;if(i)throw Error(u);console.log(u,`
7
7
  Client message:`,t);return}o(`push ${t.kind} message`,t);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 ${t.kind} got phx_error`;this._socketStatus==="connected"&&console.log(c,`
@@ -14,5 +14,5 @@ Error:`,u),i&&n(new h(c,u.code,u.message))})}endBatch(){this.inBatch=!1,this.sen
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(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,15,12,13,14,9,10,11,20,22,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};
18
18
  //# sourceMappingURL=userflow.js.map
@@ -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]="21dbfe06-63a7-4f1b-9fea-424fb9c955c9",e._sentryDebugIdIdentifier="sentry-dbid-21dbfe06-63a7-4f1b-9fea-424fb9c955c9")}catch{}})();var p=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};p.SENTRY_RELEASE={id:"56868d6d3c89b594c8550222db0dd0959a914d55"};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 i,b;function j(){if(b)return i;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 d={},r=0;r<10;r++)d["_"+String.fromCharCode(r)]=r;var a=Object.getOwnPropertyNames(d).map(function(n){return d[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 i=g()?Object.assign:function(t,d){for(var r,a=c(t),o,n=1;n<arguments.length;n++){r=Object(arguments[n]);for(var l in r)s.call(r,l)&&(a[l]=r[l]);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},i}export{y as c,w as g,j as r};
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]="f2bb07f7-8678-44e5-a9f1-b0b59716da36",e._sentryDebugIdIdentifier="sentry-dbid-f2bb07f7-8678-44e5-a9f1-b0b59716da36")}catch{}})();var p=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};p.SENTRY_RELEASE={id:"c64f5632773eb81a6d370c390b69266f86dc5b3e"};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 b,u;function j(){if(u)return b;u=1;var e=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,d=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 b=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++)d.call(r,o[f])&&(a[o[f]]=r[o[f]])}}return a},b}export{y as c,w as g,j as r};
2
2
  //# sourceMappingURL=vendor.object-assign.js.map