userflow.js-self-hosted 0.0.2000002 → 0.0.2000003
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/BuilderBar.js +1 -1
- package/FlowChrome.js +1 -1
- package/README.md +90 -0
- package/ResourceCenterApp.js +1 -1
- package/logomark.js +1 -1
- package/package.json +1 -1
- package/userflow.js +1 -1
- package/logomark.d9cf252a.svg +0 -4
- package/resource-center-logomark.05363402.svg +0 -4
package/BuilderBar.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./vendor.react.js";import{u as t,F as r,
|
|
1
|
+
import{r as e}from"./vendor.react.js";import{u as t,F as r,L as s}from"./logomark.js";import{o}from"./vendor.obj-str.js";import{f as a,a as n}from"./vendor.fortawesome.pro-light-svg-icons.js";import{v as l}from"./userflow.js";import{a as m}from"./stylesheets.js";import{D as i}from"./DynamicIcon.js";var u=new URL("builder-ui-host.css",import.meta.url).href,c=new URL("builder-ui-frame.css",import.meta.url).href;const f=e.forwardRef((({onReadyChange:f,children:d,buttons:p},b)=>{const{loaded:v}=m(window,u),[h,E]=e.useState(!1),g=v&&h,y=e.useRef(!1);e.useEffect((()=>{g&&!y.current&&f&&(y.current=!0,f(!0))}),[g,f]);const j=e.useRef(null),[w,R]=e.useState(null),[k,N]=e.useState((()=>"top"===l.getItem("builderBarPos")?"top":"bottom")),L=e.useCallback((e=>{N(e),l.setItem("builderBarPos",e)}),[]),C=e.useRef(0),I=e.useCallback((()=>{const e=j.current;if(!e||!w||!g)return;const t=w.clientHeight;t!==C.current&&(C.current=t,e.style.setProperty("height",t+"px","important"))}),[g,w]);return e.useLayoutEffect((()=>{I()})),t(I),e.useImperativeHandle(b,(()=>({getFrame:()=>j.current,getRootEl:()=>w})),[w]),e.createElement(e.Fragment,null,e.createElement(r,{className:o({"userflowjs-builder-bar":!0,"userflowjs-builder-bar--top":"top"===k}),style:{visibility:g?void 0:"hidden",animation:g?void 0:"none"},elRef:j,stylesheetUrl:c,onStylesheetsLoad:E},g&&e.createElement("div",{className:"root",ref:R},e.createElement("div",{className:"logomark"},e.createElement(s,null)),e.createElement("div",{className:"main"},d),e.createElement("div",{className:"buttons"},p,e.createElement("button",{key:k,className:"btn btn--square btn--plain-on-dark",onClick:()=>L("top"===k?"bottom":"top")},e.createElement(i,{icon:"top"===k?a:n,size:20}))))))}));export{f as B};
|
package/FlowChrome.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t}from"./vendor.react.js";import{u as e,F as o,S as a}from"./logomark.js";import{c as l,x as r,A as i,b as n,y as s,B as c,z as u}from"./userflow.js";import{f as d,b as p}from"./BubbleToolbar.js";import{o as m}from"./vendor.obj-str.js";import{n as f,h as b,p as h,q as g,r as w,f as T,d as E,g as v,b as M,s as L,M as y,l as k}from"./flow-condition-types.js";import{a as R,g as j}from"./stylesheets.js";import{e as B}from"./Icons.js";import{u as O}from"./vendor.react-i18next.js";var P=new URL("avatar-frame.css",import.meta.url).href;let x=!1;const I=[];let N,_=[];function H(t){_.push(t)}function C(){I.forEach((t=>t())),_.length>0&&(_.forEach((t=>t())),_=[]),S()}function S(){x&&(N=window.requestAnimationFrame(C))}function D(){}function U({selector:e,targetMoved:o,targetLost:a,onTargetClick:l,onTargetMouseEnter:r,onTargetMouseLeave:i}){const n=t.useRef(o),s=t.useRef(a),c=t.useRef(l),u=t.useRef(r),d=t.useRef(i);t.useLayoutEffect((()=>{n.current=o,s.current=a,c.current=l,u.current=r,d.current=i})),t.useLayoutEffect((()=>{let t=null,o=null,a=null,l=!1;const r=()=>{t=null,o=null,a=null,s.current()};if(!e)return void r();const i=()=>{if(!a||!t)return;const e=w(t);var l,i;o&&(i=e,(l=o).left===i.left&&l.top===i.top&&l.width===i.width&&l.height===i.height)||(o=e,0===e.width&&0===e.height?r():n.current({targetEl:t,targetRect:o,clipEl:a,viewportClipRect:F(a)}))};let p=!1;const m=()=>{var t;p||(p=!0,t=i,I.push(t),1===I.length&&(x=!0,S(),window.addEventListener("scroll",D)))},T=()=>{p&&(p=!1,function(t){const e=I.indexOf(t);e>=0&&(I.splice(e,1),0===I.length&&(x=!1,window.cancelAnimationFrame(N),window.removeEventListener("scroll",D)))}(i))},E=()=>{c.current&&c.current()},v=()=>{u.current&&u.current()},M=()=>{d.current&&d.current()},L=()=>{const o=t;t=b(e)?e:h(e),l&&t===o||(o&&(o.removeEventListener("click",E),o.removeEventListener("mouseenter",v),o.removeEventListener("mouseleave",M)),t?(m(),t.addEventListener("click",E),t.addEventListener("mouseenter",v),t.addEventListener("mouseleave",M),a=g(t)):(T(),r())),l=!0};L();const y=f(L);return()=>{y.disconnect(),T(),t&&(t.removeEventListener("click",E),t.removeEventListener("mouseenter",v),t.removeEventListener("mouseleave",M))}}),[e])}function F(t){T();const e=E(v()),o=E(M());if(t&&t!==document.documentElement){const a=w(t);return{top:Math.max(0,a.top),right:Math.min(o,a.right),bottom:Math.min(e,a.bottom),left:Math.max(0,a.left)}}return{top:0,right:o,bottom:e,left:0}}const A=({company:f,theme:h,position:w,absoluteWidth:x,absoluteHeight:I,stepKey:N,stepAppearance:_,width:H,backgroundImageUrl:C,tooltipSelector:S,allowMissingTooltipTarget:D,tooltipPlacement:F,backdrop:A,tooltipTargetBlocked:K,backdropPadding:q,zIndex:Y,onTooltipTargetClick:X,onTooltipTargetMissingChange:J,onModalBackdropClick:Q,onVisibleChange:Z,speaking:tt,noIframe:et,MadeWithUserflow:ot,minimizeOnAvatarClick:at,autoHide3pEnabled:lt,bubbleFrameRootRef:rt,frameWrapperHtmlAttributes:it,rootChildren:nt,children:st})=>{const ct=w||"absolute",ut=F||null,dt=q||"0",pt=ot||z,mt=B(),ft="fixed"===ct?null!=Y?Y:mt+1:1,bt=ft-1,{i18n:ht}=O(),gt=ht.dir(),wt=t.useRef(null),Tt=t.useRef(null),Et=t.useRef(null),[vt,Mt]=t.useState(null),Lt=t.useRef(null),yt=t.useRef(null),kt=t.useRef(null),Rt=t.useRef(null),jt=t.useRef(null),Bt=t.useRef(null),Ot=t.useRef(null),Pt=t.useRef(null),xt=t.useRef(null);t.useLayoutEffect((()=>{const t=wt.current.style;t.animation="none",t.visibility="hidden",t.position="absolute",t.top="-99999px",t.left="-99999px"}),[]);const{loaded:It}=R(window,d,h),[Nt,_t]=t.useState(!1),[Ht,Ct]=t.useState(!1),St=It&&Nt&&Ht;let[Dt,Ut]=t.useState(!1);_!==r.BUBBLE&&(at=!1,Dt=!1),t.useEffect((()=>{Ut(!1)}),[N]);const Ft=t.useRef({appearance:null,width:null,theme:h,bubbleFrameHeight:0,backdrop:!1,backdropPadding:"0",prevTooltipTargetParams:null,tooltipTargetParams:null,desiredTooltipPlacement:null,tooltipPlacement:null,lastReportedTooltipTargetMissing:!1,tooltipTargetMissing:!1,tooltipTargetMissingTimeout:void 0,stepKeyScrolledIntoView:void 0,targetScrolledIntoView:null}),[At,Wt]=t.useState(null),zt=null!=At&&St;t.useEffect((()=>{Z&&Z(zt)}),[Z,zt]);const Vt=t.useCallback((t=>{Ft.current.lastReportedTooltipTargetMissing!==t&&(Ft.current.lastReportedTooltipTargetMissing=t,J&&J(t))}),[J]),Gt=t.useCallback((({forceAppearanceLayout:t,forceUpdatePosition:e}={})=>{const o=wt.current,a=Tt.current,n=Et.current,d=yt.current,p=Lt.current,m=kt.current,f=Rt.current,b=jt.current,w=Bt.current,y=Ot.current,R=Pt.current,j=xt.current;if(!(o&&a&&n&&vt&&d&&p&&m&&f&&b&&w&&y&&R&&j))return;if(!St)return;const B=Ft.current,{tooltipTargetParams:O}=B;T();let P=_,C=!1;P!==r.TOOLTIP||D||O||(B.tooltipTargetMissing?(P=r.BUBBLE,C=!0):P=null);const S=P!==B.appearance,U=H!==B.width;if((t||S||U||h!==B.theme||A!=B.backdrop||dt!=B.backdropPadding||ut!==B.desiredTooltipPlacement)&&(B.appearance=P,B.width=H,B.theme=h,B.backdrop=A,B.backdropPadding=dt,B.desiredTooltipPlacement=ut,e=!0,function({layoutState:{appearance:t,theme:e,backdrop:o,tooltipTargetMissing:a},width:l,position:n,absoluteWidth:c,root:u,bubble:d,bubbleFrameRoot:p,avatar:m,avatarNotch:f,modalBackdrop:b,dir:h}){const g="absolute"===n?c||1024:E(M()),{avatarSize:w,bubblePlacement:T}=e;let v=e.bubbleWidth,L=null,y=null,k="userflowjs-bubble-frame-root",R="hidden",j=null,B=null,O=null,P=null,x="userflowjs-bubble__avatar-notch",I="hidden",N=null,_=null,H=null,C=null,S="userflowjs-modal-backdrop";(t===r.MODAL||!a&&t===r.BUBBLE&&o)&&(S+=" userflowjs-modal-backdrop--visible");switch(t){case r.BUBBLE:if(e.avatarType!==i.NONE){R="",I="",T===s.TOP_LEFT||T===s.TOP_CENTER||T===s.TOP_RIGHT?(L=w+20,j=0,N=-40,x+=" userflowjs-bubble__avatar-notch--top"):(y=w+20,O=0,H=-40,x+=" userflowjs-bubble__avatar-notch--bottom");const t=T===s.TOP_LEFT||T===s.TOP_CENTER||T===s.BOTTOM_LEFT||T===s.BOTTOM_CENTER||T===s.CENTER;"ltr"===h&&t||"rtl"===h&&!t?(P=0,C=w,x+=" userflowjs-bubble__avatar-notch--left"):(B=0,_=w,x+=" userflowjs-bubble__avatar-notch--right")}break;case r.MODAL:v=e.modalWidth,k+=" userflowjs-bubble-frame-root--appearance-modal",e.avatarType!==i.NONE&&(R="",P=`calc(50% - ${w/2}px)`,j=-w/2);break;case r.TOOLTIP:v=e.tooltipWidth}null!=l&&(v=l);v=Math.min(v,g),u.classList.toggle("userflowjs-flow-chrome--position-absolute","absolute"===n),u.classList.toggle("userflowjs-flow-chrome--position-relative","relative"===n),u.classList.toggle("userflowjs-flow-chrome--position-fixed","fixed"===n),u.classList.toggle("userflowjs-flow-chrome--appearance-modal",t===r.MODAL);const D=null!=t&&t!==r.HIDDEN;u.style.position="",u.style.top="",u.style.left="",u.style.visibility=D?"":"hidden",u.style.animation=D?"":"none",V(d,"width",E(v)),V(d,"padding-top",L),V(d,"padding-bottom",y),p.className=k,V(m,"width",E(e.avatarSize)),V(m,"height",E(e.avatarSize)),m.style.visibility=R,V(m,"top",j),V(m,"right",B),V(m,"bottom",O),V(m,"left",P),f.className=x,f.style.visibility=I,V(f,"top",N),V(f,"right",_),V(f,"bottom",H),V(f,"left",C),b.className=S}({layoutState:B,width:H,position:ct,absoluteWidth:x,root:o,bubble:a,bubbleFrameRoot:vt,avatar:d,avatarNotch:p,modalBackdrop:j,dir:gt})),!et){const t=vt.offsetHeight,o=v()-2*(M()<800?0:16)-(P===r.BUBBLE&&h.avatarType!==i.NONE?20+h.avatarSize:0),a=Math.min(t,o);if(P&&a!==B.bubbleFrameHeight){if(B.bubbleFrameHeight=a,V(n,"height",E(a)),L(n)&&n.contentDocument){n.contentDocument.documentElement.style.overflowY=t<=o?"hidden":"scroll"}e=!0}}if(e&&P){let t=S;if(P===r.TOOLTIP){(B.tooltipTargetParams&&B.tooltipTargetParams.targetEl)!==(B.prevTooltipTargetParams&&B.prevTooltipTargetParams.targetEl)&&(t=!0)}B.prevTooltipTargetParams=B.tooltipTargetParams,function({layoutState:t,animateIn:e,position:o,absoluteWidth:a,absoluteHeight:l,desiredTooltipPlacement:i,root:n,bubble:d,tooltipNotch:p,tooltipBackdrop:m,tooltipBlockTop:f,tooltipBlockRight:b,tooltipBlockBottom:h,tooltipBlockLeft:g,dir:w}){const{appearance:T,theme:L,tooltipTargetParams:y,backdrop:R,backdropPadding:j}=t,{bubblePlacement:B}=L,O=16,P=L.tooltipNotchSize,x=10,{width:I,height:N}=d.getBoundingClientRect(),_="absolute"===o?a||1024:E(M()),H="absolute"===o?l||768:E(v());let C=0,S=0,D="userflowjs-bubble__tooltip-notch",U="hidden",F=null,A=null,W=null,z=null,K="userflowjs-tooltip-backdrop",q=null,Y=null,X=null,J=null,Q=null,Z=null,tt=null,et=null,ot="userflowjs-tooltip-block userflowjs-tooltip-block--top",at=null,lt=null,rt="userflowjs-tooltip-block userflowjs-tooltip-block--right",it=null,nt=null,st="userflowjs-tooltip-block userflowjs-tooltip-block--bottom",ct=null,ut=null,dt="userflowjs-tooltip-block userflowjs-tooltip-block--left",pt=null,mt=null;switch(T){case r.BUBBLE:C=B===s.TOP_LEFT||B===s.BOTTOM_LEFT?L.bubbleX:B===s.TOP_CENTER||B===s.CENTER||B===s.BOTTOM_CENTER?(_-I)/2:_-I-L.bubbleX,S=B===s.TOP_LEFT||B===s.TOP_CENTER||B===s.TOP_RIGHT?L.bubbleY:B===s.CENTER?(H-N)/2:H-N-L.bubbleY,"rtl"===w&&(C=_-C-I),C=Math.max(0,Math.min(_-I,C)),S=Math.max(0,Math.min(H-N,S));break;case r.MODAL:C=O+(_-2*O-I)/2,S=O+(H-2*O-N)/2;break;case r.TOOLTIP:{let e;if(y){let{targetRect:a,viewportClipRect:l}=y;if("absolute"===o){const t=n.offsetParent.getBoundingClientRect();l={top:0,right:_,bottom:H,left:0},a={top:a.top-t.top,right:a.right-t.left,bottom:a.bottom-t.top,left:a.left-t.left,width:a.width,height:a.height}}let r=0;if(R){const{paddingTop:t,paddingRight:e,paddingBottom:o,paddingLeft:l}=function(t){if(!t||"0"===t)return{paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0};const e=t.trim().split(" ");if(1===e.length){const t=$(e[0]);return{paddingTop:t,paddingRight:t,paddingBottom:t,paddingLeft:t}}if(2===e.length){const t=$(e[0]),o=$(e[1]);return{paddingTop:t,paddingRight:o,paddingBottom:t,paddingLeft:o}}return{paddingTop:$(e[0]),paddingRight:$(e[1]),paddingBottom:$(e[2]),paddingLeft:$(e[3])}}(j);a={top:a.top-t,right:a.right+e,bottom:a.bottom+o,left:a.left-l,width:a.width+l+e,height:a.height+t+o},r=Math.min(t,e,o,l)}const s=a,d=L.backdropHighlightType==c.OUTSIDE?L.backdropHighlightSpread:0;if(R&&d&&(a={top:a.top-d,right:a.right+d,bottom:a.bottom+d,left:a.left-d,width:a.width+2*d,height:a.height+2*d}),e=function({targetRect:t,bubbleWidth:e,bubbleHeight:o,containerWidth:a,containerHeight:l,viewportClipRect:r,tooltipNotchSize:i,currentTooltipPlacement:n,desiredTooltipPlacement:s}){if(t.bottom<=r.top)return o+i<=l-r.top?u.BELOW:u.ABOVE;if(t.top>=r.bottom)return o+i<=r.bottom?u.ABOVE:u.BELOW;if(t.right<=r.left)return e+i<=a-r.left?u.RIGHT:u.LEFT;if(t.left>=r.right)return e+i<=r.right?u.LEFT:u.RIGHT;const c=n=>{const s=t.left+t.width/2,c=s>=r.left&&s<=r.right,d=t.top+t.height/2,p=d>=r.top&&d<=r.bottom;switch(n){case u.BELOW:return l-t.bottom>o+i&&c;case u.ABOVE:return t.top>o+i&&c;case u.RIGHT:return a-t.right>e+i&&p;case u.LEFT:return t.left>e+i&&p}};if(s&&c(s))return s;if(n&&c(n))return n;const d=[{placement:u.BELOW,dist:t.top},{placement:u.ABOVE,dist:l-t.bottom},{placement:u.RIGHT,dist:t.left},{placement:u.LEFT,dist:a-t.right}];d.sort(((t,e)=>t.dist-e.dist));for(const{placement:u}of d)if(c(u))return u;return u.BELOW}({targetRect:a,bubbleWidth:I,bubbleHeight:N,containerWidth:_,containerHeight:H,viewportClipRect:l,tooltipNotchSize:P,currentTooltipPlacement:t.tooltipPlacement,desiredTooltipPlacement:i}),e===u.BELOW||e===u.ABOVE?(C=a.left+a.width/2-I/2,C=Math.max(O,Math.min(_-I-O,C)),z=Math.max(x,Math.min(I-x-2*P,a.left+a.width/2-P-C)),e===u.BELOW?F=2*-P:W=2*-P):e===u.RIGHT?(C=a.right+P,C=Math.max(C,l.left+P),C=Math.min(C,l.right+P),C=Math.max(C,P),C=Math.min(C,_-I)):(C=a.left-P-I,C=Math.max(C,l.left-I-P),C=Math.min(C,l.right-I-P),C=Math.max(C,0),C=Math.min(C,_-I-P)),e===u.LEFT||e===u.RIGHT?(S=a.top+a.height/2-N/2,S=Math.max(O,Math.min(H-N-O,S)),F=Math.max(x,Math.min(N-x-2*P,a.top+a.height/2-P-S)),e===u.LEFT?A=2*-P:z=2*-P):e===u.BELOW?(S=a.bottom+P,S=Math.max(S,l.top+P),S=Math.min(S,l.bottom+P),S=Math.max(S,P),S=Math.min(S,H-N)):(S=a.top-P-N,S=Math.max(S,l.top-N-P),S=Math.min(S,l.bottom-N-P),S=Math.max(S,0),S=Math.min(S,H-N-P)),R){const t=window.getComputedStyle(y.targetEl);q=Math.max(0,s.top),Y=Math.max(0,_-s.right),X=Math.max(0,H-s.bottom),J=Math.max(0,s.left),Q=Math.max(0,k(t.borderTopLeftRadius)+r),Z=Math.max(0,k(t.borderTopRightRadius)+r),tt=Math.max(0,k(t.borderBottomRightRadius)+r),et=Math.max(0,k(t.borderBottomLeftRadius)+r),at=Math.max(0,s.right),lt=Math.max(0,s.top),it=Math.max(0,s.right),nt=Math.max(0,s.bottom),ct=Math.max(0,s.left),ut=Math.max(0,s.bottom),pt=Math.max(0,s.left),mt=Math.max(0,s.top)}}else e=i||u.BELOW,e!==u.BELOW&&e!==u.ABOVE||(z=I/2-P,e===u.BELOW?F=2*-P:W=2*-P),e!==u.LEFT&&e!==u.RIGHT||(F=N/2-P,e===u.LEFT?A=2*-P:z=2*-P);t.tooltipPlacement=e,D+=` userflowjs-bubble__tooltip-notch--${e.toLowerCase()}`,U="",R&&(K+=" userflowjs-tooltip-backdrop--visible",ot+=" userflowjs-tooltip-block--visible",rt+=" userflowjs-tooltip-block--visible",st+=" userflowjs-tooltip-block--visible",dt+=" userflowjs-tooltip-block--visible");break}}d.style.transition="";let ft=C,bt=S;if(e&&(d.style.opacity="0",T===r.TOOLTIP)){const e=24;switch(t.tooltipPlacement){case u.BELOW:S+=e;break;case u.ABOVE:S-=e;break;case u.RIGHT:C+=e;break;case u.LEFT:C-=e}}"relative"!==o&&G(d,C,S);if(p.className=D,p.style.visibility=U,V(p,"top",F),V(p,"right",A),V(p,"bottom",W),V(p,"left",z),m.className=K,V(m,"top",q),V(m,"right",Y),V(m,"bottom",X),V(m,"left",J),V(m,"border-top-left-radius",Q),V(m,"border-top-right-radius",Z),V(m,"border-bottom-right-radius",tt),V(m,"border-bottom-left-radius",et),f.className=ot,V(f,"width",at),V(f,"height",lt),b.className=rt,V(b,"left",it),V(b,"height",nt),h.className=st,V(h,"left",ct),V(h,"top",ut),g.className=dt,V(g,"width",pt),V(g,"top",mt),e){d.offsetWidth;const t="opacity 250ms linear";T===r.TOOLTIP?d.style.transition=`${t}, transform 500ms cubic-bezier(0.25, 0.8, 0.5, 1)`:d.style.transition=t,d.style.opacity="1","relative"!==o&&G(d,ft,bt)}}({layoutState:B,animateIn:t,position:ct,absoluteWidth:x,absoluteHeight:I,desiredTooltipPlacement:ut,root:o,bubble:a,tooltipNotch:m,tooltipBackdrop:f,tooltipBlockTop:b,tooltipBlockRight:w,tooltipBlockBottom:y,tooltipBlockLeft:R,dir:gt})}if(P===r.TOOLTIP){const t=O&&O.targetEl;t&&B.stepKeyScrolledIntoView!==N&&B.targetScrolledIntoView!==t&&(B.stepKeyScrolledIntoView=N,B.targetScrolledIntoView=t,function(t){if(l.customScrollIntoView)return void l.customScrollIntoView(t);const{scrollPadding:e}=l;if(e&&g(t)===document.scrollingElement){const o=e.top||0,a=e.right||0,l=e.bottom||0,r=e.left||0;let i=0,n=0;const s=t.getBoundingClientRect(),c=M(),u=v();if(s.top<o?i=s.top-o:s.bottom>u-l&&(i=s.bottom-u+l),s.left<r?n=s.left-r:s.right>c-a&&(n=s.right-c+a),0!=i||0!=n)return void window.scrollBy({top:i,left:n,behavior:"smooth"})}try{t.scrollIntoView({behavior:"smooth",block:"nearest"})}catch(o){console.warn("Userflow.js: scrollIntoView error (falling back to no options).",o),t.scrollIntoView()}}(t))}else B.stepKeyScrolledIntoView=void 0,B.targetScrolledIntoView=null;Vt(C),Wt(P)}),[St,vt,N,_,H,h,ct,x,I,D,ut,A,dt,et,Vt,gt]),$t=t.useRef(Gt);$t.current=Gt;const Kt=t.useRef(!1);t.useEffect((()=>{const t=()=>{Kt.current=!0};return window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)}),[]);const qt=()=>{window.clearTimeout(Ft.current.tooltipTargetMissingTimeout),Ft.current.tooltipTargetMissingTimeout=void 0};t.useEffect((()=>qt),[]);const Yt=t.useCallback((()=>{const t=Ft.current;if(t.tooltipTargetParams=null,D||(t.tooltipPlacement=null),_!==r.TOOLTIP)return qt(),void(t.tooltipTargetMissing=!1);if(!D&&!t.tooltipTargetMissingTimeout){t.tooltipTargetMissing=!1;const e=!S||b(S)||S.type!==n.AUTO||S.autoData?1e3*parseFloat(h.tooltipMissingToleranceSeconds):1;t.tooltipTargetMissingTimeout=window.setTimeout((()=>{if(!Kt.current){if(S&&!b(S)){let t=S.autoData;if(S.autoData)try{t=JSON.parse(S.autoData)}catch(e){}console.warn("Userflow.js: Tooltip target not found on page.\n",{type:S.type,autoData:t,excludeText:S.excludeText,precision:S.precision,text:S.text,css:S.css})}qt(),t.tooltipTargetMissing=!0,$t.current()}}),e)}$t.current()}),[_,D,S,h.tooltipMissingToleranceSeconds]),Xt=t.useCallback((t=>{const e=Ft.current;qt(),e.tooltipTargetParams&&e.tooltipTargetParams.targetEl!==t.targetEl&&(e.tooltipPlacement=null),e.tooltipTargetParams=t,Gt({forceUpdatePosition:!0})}),[Gt]);U({selector:_===r.TOOLTIP&&S||null,targetMoved:Xt,targetLost:Yt,onTargetClick:X});const Jt=t.useCallback((()=>Gt({forceAppearanceLayout:!0})),[Gt]);e(Jt),t.useEffect((()=>{if(!vt||et||"function"!=typeof y)return;let t;const e=new y((()=>{t||(t=window.requestAnimationFrame((()=>{t=void 0,$t.current()})))}));return e.observe(vt,{childList:!0,attributes:!0,subtree:!0}),()=>{e.disconnect(),t&&window.cancelAnimationFrame(t)}}),[vt,et]),t.useLayoutEffect((()=>{$t.current()})),t.useLayoutEffect((()=>{"absolute"===ct&&Gt({forceAppearanceLayout:!0})}),[ct,x,I]);const Qt=t=>{t.preventDefault(),t.stopPropagation()};return function(e,o){const a=window.Intercom;t.useEffect((()=>{if(o&&e.autoHideIntercom&&"function"==typeof a&&!l.autoHide3pDisabled){try{a("update",{hide_default_launcher:!0})}catch(t){console.warn("Userflow.js: Error when hiding Intercom launcher",t)}return()=>{if(!l.autoHide3pDisabled)try{a("update",{hide_default_launcher:!1})}catch(t){console.warn("Userflow.js: Error when unhiding Intercom launcher",t)}}}}),[a,e.autoHideIntercom,o]);const r=window.$crisp;t.useEffect((()=>{if(o&&e.autoHideCrisp&&r&&!l.autoHide3pDisabled){try{r.push(["do","chat:hide"])}catch(t){console.warn("Userflow.js: Error when hiding Crisp Chat",t)}return()=>{if(!l.autoHide3pDisabled)try{r.push(["do","chat:show"])}catch(t){console.warn("Userflow.js: Error when unhiding Crisp Chat",t)}}}}),[r,e.autoHideCrisp,o]);const i=window.HubSpotConversations;t.useEffect((()=>{if(o&&e.autoHideHubspot&&i&&!l.autoHide3pDisabled){try{i.widget.remove()}catch(t){console.warn("Userflow.js: Error when hiding HubSpot Chat",t)}return()=>{if(!l.autoHide3pDisabled)try{i.widget.load()}catch(t){console.warn("Userflow.js: Error when unhiding HubSpot Chat",t)}}}}),[i,e.autoHideHubspot,o]);const n=window.drift;t.useEffect((()=>{if(o&&e.autoHideDrift&&n&&!l.autoHide3pDisabled){try{n.api.widget.hide()}catch(t){console.warn("Userflow.js: Error when hiding Drift Chat",t)}return()=>{if(!l.autoHide3pDisabled)try{n.api.widget.show()}catch(t){console.warn("Userflow.js: Error when unhiding Drift Chat",t)}}}}),[n,e.autoHideDrift,o])}(h,!!lt&&At===r.BUBBLE),t.createElement("div",{ref:wt,"data-testid":"flow-chrome",className:"userflowjs-flow-chrome userflowjs-theme-root",style:j(h),dir:gt},t.createElement("div",{className:"userflowjs-bubble",ref:Tt,style:{zIndex:ft}},t.createElement("div",{className:m({"userflowjs-bubble-outline":!0,[`userflowjs-bubble-outline--bubble-placement-${(h.bubblePlacement||"").toLowerCase().replace(/_/,"-")}`]:!0,"userflowjs-bubble-outline--minimizable":!!at,"userflowjs-bubble-outline--minimized":Dt})},t.createElement("div",{className:"userflowjs-bubble__frame-wrapper",...it},t.createElement(o,{className:"userflowjs-bubble__frame",elRef:Et,stylesheetUrl:p,theme:h,onStylesheetsLoad:_t,noIframe:et},t.createElement("div",{className:"userflowjs-bubble-frame-root",dir:gt,ref:t=>{rt&&rt(t),Mt(t)},style:C?{backgroundImage:`url("${encodeURI(C)}")`}:void 0},st,f.flowBranding&&t.createElement("div",{className:"userflowjs-bubble-made-with-userflow"},t.createElement("div",{className:"userflowjs-bubble-made-with-userflow__absolute"},t.createElement(pt,{company:f},t.createElement(a,null),t.createElement("div",null,"Made with Userflow"))))))),t.createElement("div",{ref:Lt,className:"userflowjs-bubble__avatar-notch"})),t.createElement(o,{className:m({"userflowjs-bubble__avatar":!0,"userflowjs-bubble__avatar--minimizable":!!at,"userflowjs-bubble__avatar--speaking":!!tt}),elRef:yt,stylesheetUrl:P,theme:h,onStylesheetsLoad:Ct,noIframe:et,ariaHidden:!0},t.createElement("div",{className:m({"userflowjs-avatar-frame-root":!0,"userflowjs-avatar-frame-root--minimizable":!!at}),onClick:at?()=>Ut((t=>!t)):void 0},t.createElement(W,{theme:h}))),t.createElement("div",{ref:kt,className:"userflowjs-bubble__tooltip-notch"})),t.createElement("div",{ref:Rt,className:"userflowjs-tooltip-backdrop",onMouseDown:Qt,style:{zIndex:bt,pointerEvents:K?void 0:"none"}}),t.createElement("div",{ref:jt,className:"userflowjs-tooltip-block",onMouseDown:Qt,style:{zIndex:bt}}),t.createElement("div",{ref:Bt,className:"userflowjs-tooltip-block",onMouseDown:Qt,style:{zIndex:bt}}),t.createElement("div",{ref:Ot,className:"userflowjs-tooltip-block",onMouseDown:Qt,style:{zIndex:bt}}),t.createElement("div",{ref:Pt,className:"userflowjs-tooltip-block",onMouseDown:Qt,style:{zIndex:bt}}),t.createElement("div",{ref:xt,className:"userflowjs-modal-backdrop",onMouseDown:Qt,onClick:Q,style:{zIndex:bt}}),nt&&nt({visible:zt,bubbleFrame:Et.current}))},W=({theme:e})=>{const o="https://js.userflow.com/cartoon-avatars-no-bg/";let a;return a=e.avatarType===i.ASSET&&e.avatarAsset?e.avatarAsset.assetUrl:e.avatarType===i.CARTOON&&e.avatarName?o+e.avatarName+".svg?3":e.avatarType===i.URL&&e.avatarUrl?e.avatarUrl:o+"none.svg",t.createElement("img",{src:a,alt:""})},z=({company:e,children:o})=>t.createElement("a",{href:"https://userflow.com/?utm_source=made-with-userflow&utm_medium=link&utm_campaign=made-with-userflow-"+e.slug,target:"_blank",rel:"noopener noreferrer"},o);function V(t,e,o){null==o?t.style.removeProperty(e):t.style.setProperty(e,"number"==typeof o?o+"px":o,"important")}function G(t,e,o){e=Math.round(e),o=Math.round(o),t.style.transform=`translate3d(${e}px, ${o}px, 0px)`}function $(t){const e=parseInt(t,10);return isNaN(e)?0:e}export{A as F,H as r,U as u};
|
|
1
|
+
import{r as t}from"./vendor.react.js";import{u as e,F as o,L as a}from"./logomark.js";import{c as l,x as r,A as i,b as n,y as s,B as c,z as u}from"./userflow.js";import{f as d,b as p}from"./BubbleToolbar.js";import{o as m}from"./vendor.obj-str.js";import{n as f,h as b,p as h,q as g,r as w,f as T,d as E,g as v,b as M,s as L,M as y,l as k}from"./flow-condition-types.js";import{a as R,g as j}from"./stylesheets.js";import{e as B}from"./Icons.js";import{u as O}from"./vendor.react-i18next.js";var P=new URL("avatar-frame.css",import.meta.url).href;let x=!1;const I=[];let N,_=[];function H(t){_.push(t)}function C(){I.forEach((t=>t())),_.length>0&&(_.forEach((t=>t())),_=[]),S()}function S(){x&&(N=window.requestAnimationFrame(C))}function D(){}function U({selector:e,targetMoved:o,targetLost:a,onTargetClick:l,onTargetMouseEnter:r,onTargetMouseLeave:i}){const n=t.useRef(o),s=t.useRef(a),c=t.useRef(l),u=t.useRef(r),d=t.useRef(i);t.useLayoutEffect((()=>{n.current=o,s.current=a,c.current=l,u.current=r,d.current=i})),t.useLayoutEffect((()=>{let t=null,o=null,a=null,l=!1;const r=()=>{t=null,o=null,a=null,s.current()};if(!e)return void r();const i=()=>{if(!a||!t)return;const e=w(t);var l,i;o&&(i=e,(l=o).left===i.left&&l.top===i.top&&l.width===i.width&&l.height===i.height)||(o=e,0===e.width&&0===e.height?r():n.current({targetEl:t,targetRect:o,clipEl:a,viewportClipRect:F(a)}))};let p=!1;const m=()=>{var t;p||(p=!0,t=i,I.push(t),1===I.length&&(x=!0,S(),window.addEventListener("scroll",D)))},T=()=>{p&&(p=!1,function(t){const e=I.indexOf(t);e>=0&&(I.splice(e,1),0===I.length&&(x=!1,window.cancelAnimationFrame(N),window.removeEventListener("scroll",D)))}(i))},E=()=>{c.current&&c.current()},v=()=>{u.current&&u.current()},M=()=>{d.current&&d.current()},L=()=>{const o=t;t=b(e)?e:h(e),l&&t===o||(o&&(o.removeEventListener("click",E),o.removeEventListener("mouseenter",v),o.removeEventListener("mouseleave",M)),t?(m(),t.addEventListener("click",E),t.addEventListener("mouseenter",v),t.addEventListener("mouseleave",M),a=g(t)):(T(),r())),l=!0};L();const y=f(L);return()=>{y.disconnect(),T(),t&&(t.removeEventListener("click",E),t.removeEventListener("mouseenter",v),t.removeEventListener("mouseleave",M))}}),[e])}function F(t){T();const e=E(v()),o=E(M());if(t&&t!==document.documentElement){const a=w(t);return{top:Math.max(0,a.top),right:Math.min(o,a.right),bottom:Math.min(e,a.bottom),left:Math.max(0,a.left)}}return{top:0,right:o,bottom:e,left:0}}const A=({company:f,theme:h,position:w,absoluteWidth:x,absoluteHeight:I,stepKey:N,stepAppearance:_,width:H,backgroundImageUrl:C,tooltipSelector:S,allowMissingTooltipTarget:D,tooltipPlacement:F,backdrop:A,tooltipTargetBlocked:K,backdropPadding:q,zIndex:Y,onTooltipTargetClick:X,onTooltipTargetMissingChange:J,onModalBackdropClick:Q,onVisibleChange:Z,speaking:tt,noIframe:et,MadeWithUserflow:ot,minimizeOnAvatarClick:at,autoHide3pEnabled:lt,bubbleFrameRootRef:rt,frameWrapperHtmlAttributes:it,rootChildren:nt,children:st})=>{const ct=w||"absolute",ut=F||null,dt=q||"0",pt=ot||z,mt=B(),ft="fixed"===ct?null!=Y?Y:mt+1:1,bt=ft-1,{i18n:ht}=O(),gt=ht.dir(),wt=t.useRef(null),Tt=t.useRef(null),Et=t.useRef(null),[vt,Mt]=t.useState(null),Lt=t.useRef(null),yt=t.useRef(null),kt=t.useRef(null),Rt=t.useRef(null),jt=t.useRef(null),Bt=t.useRef(null),Ot=t.useRef(null),Pt=t.useRef(null),xt=t.useRef(null);t.useLayoutEffect((()=>{const t=wt.current.style;t.animation="none",t.visibility="hidden",t.position="absolute",t.top="-99999px",t.left="-99999px"}),[]);const{loaded:It}=R(window,d,h),[Nt,_t]=t.useState(!1),[Ht,Ct]=t.useState(!1),St=It&&Nt&&Ht;let[Dt,Ut]=t.useState(!1);_!==r.BUBBLE&&(at=!1,Dt=!1),t.useEffect((()=>{Ut(!1)}),[N]);const Ft=t.useRef({appearance:null,width:null,theme:h,bubbleFrameHeight:0,backdrop:!1,backdropPadding:"0",prevTooltipTargetParams:null,tooltipTargetParams:null,desiredTooltipPlacement:null,tooltipPlacement:null,lastReportedTooltipTargetMissing:!1,tooltipTargetMissing:!1,tooltipTargetMissingTimeout:void 0,stepKeyScrolledIntoView:void 0,targetScrolledIntoView:null}),[At,Wt]=t.useState(null),zt=null!=At&&St;t.useEffect((()=>{Z&&Z(zt)}),[Z,zt]);const Vt=t.useCallback((t=>{Ft.current.lastReportedTooltipTargetMissing!==t&&(Ft.current.lastReportedTooltipTargetMissing=t,J&&J(t))}),[J]),Gt=t.useCallback((({forceAppearanceLayout:t,forceUpdatePosition:e}={})=>{const o=wt.current,a=Tt.current,n=Et.current,d=yt.current,p=Lt.current,m=kt.current,f=Rt.current,b=jt.current,w=Bt.current,y=Ot.current,R=Pt.current,j=xt.current;if(!(o&&a&&n&&vt&&d&&p&&m&&f&&b&&w&&y&&R&&j))return;if(!St)return;const B=Ft.current,{tooltipTargetParams:O}=B;T();let P=_,C=!1;P!==r.TOOLTIP||D||O||(B.tooltipTargetMissing?(P=r.BUBBLE,C=!0):P=null);const S=P!==B.appearance,U=H!==B.width;if((t||S||U||h!==B.theme||A!=B.backdrop||dt!=B.backdropPadding||ut!==B.desiredTooltipPlacement)&&(B.appearance=P,B.width=H,B.theme=h,B.backdrop=A,B.backdropPadding=dt,B.desiredTooltipPlacement=ut,e=!0,function({layoutState:{appearance:t,theme:e,backdrop:o,tooltipTargetMissing:a},width:l,position:n,absoluteWidth:c,root:u,bubble:d,bubbleFrameRoot:p,avatar:m,avatarNotch:f,modalBackdrop:b,dir:h}){const g="absolute"===n?c||1024:E(M()),{avatarSize:w,bubblePlacement:T}=e;let v=e.bubbleWidth,L=null,y=null,k="userflowjs-bubble-frame-root",R="hidden",j=null,B=null,O=null,P=null,x="userflowjs-bubble__avatar-notch",I="hidden",N=null,_=null,H=null,C=null,S="userflowjs-modal-backdrop";(t===r.MODAL||!a&&t===r.BUBBLE&&o)&&(S+=" userflowjs-modal-backdrop--visible");switch(t){case r.BUBBLE:if(e.avatarType!==i.NONE){R="",I="",T===s.TOP_LEFT||T===s.TOP_CENTER||T===s.TOP_RIGHT?(L=w+20,j=0,N=-40,x+=" userflowjs-bubble__avatar-notch--top"):(y=w+20,O=0,H=-40,x+=" userflowjs-bubble__avatar-notch--bottom");const t=T===s.TOP_LEFT||T===s.TOP_CENTER||T===s.BOTTOM_LEFT||T===s.BOTTOM_CENTER||T===s.CENTER;"ltr"===h&&t||"rtl"===h&&!t?(P=0,C=w,x+=" userflowjs-bubble__avatar-notch--left"):(B=0,_=w,x+=" userflowjs-bubble__avatar-notch--right")}break;case r.MODAL:v=e.modalWidth,k+=" userflowjs-bubble-frame-root--appearance-modal",e.avatarType!==i.NONE&&(R="",P=`calc(50% - ${w/2}px)`,j=-w/2);break;case r.TOOLTIP:v=e.tooltipWidth}null!=l&&(v=l);v=Math.min(v,g),u.classList.toggle("userflowjs-flow-chrome--position-absolute","absolute"===n),u.classList.toggle("userflowjs-flow-chrome--position-relative","relative"===n),u.classList.toggle("userflowjs-flow-chrome--position-fixed","fixed"===n),u.classList.toggle("userflowjs-flow-chrome--appearance-modal",t===r.MODAL);const D=null!=t&&t!==r.HIDDEN;u.style.position="",u.style.top="",u.style.left="",u.style.visibility=D?"":"hidden",u.style.animation=D?"":"none",V(d,"width",E(v)),V(d,"padding-top",L),V(d,"padding-bottom",y),p.className=k,V(m,"width",E(e.avatarSize)),V(m,"height",E(e.avatarSize)),m.style.visibility=R,V(m,"top",j),V(m,"right",B),V(m,"bottom",O),V(m,"left",P),f.className=x,f.style.visibility=I,V(f,"top",N),V(f,"right",_),V(f,"bottom",H),V(f,"left",C),b.className=S}({layoutState:B,width:H,position:ct,absoluteWidth:x,root:o,bubble:a,bubbleFrameRoot:vt,avatar:d,avatarNotch:p,modalBackdrop:j,dir:gt})),!et){const t=vt.offsetHeight,o=v()-2*(M()<800?0:16)-(P===r.BUBBLE&&h.avatarType!==i.NONE?20+h.avatarSize:0),a=Math.min(t,o);if(P&&a!==B.bubbleFrameHeight){if(B.bubbleFrameHeight=a,V(n,"height",E(a)),L(n)&&n.contentDocument){n.contentDocument.documentElement.style.overflowY=t<=o?"hidden":"scroll"}e=!0}}if(e&&P){let t=S;if(P===r.TOOLTIP){(B.tooltipTargetParams&&B.tooltipTargetParams.targetEl)!==(B.prevTooltipTargetParams&&B.prevTooltipTargetParams.targetEl)&&(t=!0)}B.prevTooltipTargetParams=B.tooltipTargetParams,function({layoutState:t,animateIn:e,position:o,absoluteWidth:a,absoluteHeight:l,desiredTooltipPlacement:i,root:n,bubble:d,tooltipNotch:p,tooltipBackdrop:m,tooltipBlockTop:f,tooltipBlockRight:b,tooltipBlockBottom:h,tooltipBlockLeft:g,dir:w}){const{appearance:T,theme:L,tooltipTargetParams:y,backdrop:R,backdropPadding:j}=t,{bubblePlacement:B}=L,O=16,P=L.tooltipNotchSize,x=10,{width:I,height:N}=d.getBoundingClientRect(),_="absolute"===o?a||1024:E(M()),H="absolute"===o?l||768:E(v());let C=0,S=0,D="userflowjs-bubble__tooltip-notch",U="hidden",F=null,A=null,W=null,z=null,K="userflowjs-tooltip-backdrop",q=null,Y=null,X=null,J=null,Q=null,Z=null,tt=null,et=null,ot="userflowjs-tooltip-block userflowjs-tooltip-block--top",at=null,lt=null,rt="userflowjs-tooltip-block userflowjs-tooltip-block--right",it=null,nt=null,st="userflowjs-tooltip-block userflowjs-tooltip-block--bottom",ct=null,ut=null,dt="userflowjs-tooltip-block userflowjs-tooltip-block--left",pt=null,mt=null;switch(T){case r.BUBBLE:C=B===s.TOP_LEFT||B===s.BOTTOM_LEFT?L.bubbleX:B===s.TOP_CENTER||B===s.CENTER||B===s.BOTTOM_CENTER?(_-I)/2:_-I-L.bubbleX,S=B===s.TOP_LEFT||B===s.TOP_CENTER||B===s.TOP_RIGHT?L.bubbleY:B===s.CENTER?(H-N)/2:H-N-L.bubbleY,"rtl"===w&&(C=_-C-I),C=Math.max(0,Math.min(_-I,C)),S=Math.max(0,Math.min(H-N,S));break;case r.MODAL:C=O+(_-2*O-I)/2,S=O+(H-2*O-N)/2;break;case r.TOOLTIP:{let e;if(y){let{targetRect:a,viewportClipRect:l}=y;if("absolute"===o){const t=n.offsetParent.getBoundingClientRect();l={top:0,right:_,bottom:H,left:0},a={top:a.top-t.top,right:a.right-t.left,bottom:a.bottom-t.top,left:a.left-t.left,width:a.width,height:a.height}}let r=0;if(R){const{paddingTop:t,paddingRight:e,paddingBottom:o,paddingLeft:l}=function(t){if(!t||"0"===t)return{paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0};const e=t.trim().split(" ");if(1===e.length){const t=$(e[0]);return{paddingTop:t,paddingRight:t,paddingBottom:t,paddingLeft:t}}if(2===e.length){const t=$(e[0]),o=$(e[1]);return{paddingTop:t,paddingRight:o,paddingBottom:t,paddingLeft:o}}return{paddingTop:$(e[0]),paddingRight:$(e[1]),paddingBottom:$(e[2]),paddingLeft:$(e[3])}}(j);a={top:a.top-t,right:a.right+e,bottom:a.bottom+o,left:a.left-l,width:a.width+l+e,height:a.height+t+o},r=Math.min(t,e,o,l)}const s=a,d=L.backdropHighlightType==c.OUTSIDE?L.backdropHighlightSpread:0;if(R&&d&&(a={top:a.top-d,right:a.right+d,bottom:a.bottom+d,left:a.left-d,width:a.width+2*d,height:a.height+2*d}),e=function({targetRect:t,bubbleWidth:e,bubbleHeight:o,containerWidth:a,containerHeight:l,viewportClipRect:r,tooltipNotchSize:i,currentTooltipPlacement:n,desiredTooltipPlacement:s}){if(t.bottom<=r.top)return o+i<=l-r.top?u.BELOW:u.ABOVE;if(t.top>=r.bottom)return o+i<=r.bottom?u.ABOVE:u.BELOW;if(t.right<=r.left)return e+i<=a-r.left?u.RIGHT:u.LEFT;if(t.left>=r.right)return e+i<=r.right?u.LEFT:u.RIGHT;const c=n=>{const s=t.left+t.width/2,c=s>=r.left&&s<=r.right,d=t.top+t.height/2,p=d>=r.top&&d<=r.bottom;switch(n){case u.BELOW:return l-t.bottom>o+i&&c;case u.ABOVE:return t.top>o+i&&c;case u.RIGHT:return a-t.right>e+i&&p;case u.LEFT:return t.left>e+i&&p}};if(s&&c(s))return s;if(n&&c(n))return n;const d=[{placement:u.BELOW,dist:t.top},{placement:u.ABOVE,dist:l-t.bottom},{placement:u.RIGHT,dist:t.left},{placement:u.LEFT,dist:a-t.right}];d.sort(((t,e)=>t.dist-e.dist));for(const{placement:u}of d)if(c(u))return u;return u.BELOW}({targetRect:a,bubbleWidth:I,bubbleHeight:N,containerWidth:_,containerHeight:H,viewportClipRect:l,tooltipNotchSize:P,currentTooltipPlacement:t.tooltipPlacement,desiredTooltipPlacement:i}),e===u.BELOW||e===u.ABOVE?(C=a.left+a.width/2-I/2,C=Math.max(O,Math.min(_-I-O,C)),z=Math.max(x,Math.min(I-x-2*P,a.left+a.width/2-P-C)),e===u.BELOW?F=2*-P:W=2*-P):e===u.RIGHT?(C=a.right+P,C=Math.max(C,l.left+P),C=Math.min(C,l.right+P),C=Math.max(C,P),C=Math.min(C,_-I)):(C=a.left-P-I,C=Math.max(C,l.left-I-P),C=Math.min(C,l.right-I-P),C=Math.max(C,0),C=Math.min(C,_-I-P)),e===u.LEFT||e===u.RIGHT?(S=a.top+a.height/2-N/2,S=Math.max(O,Math.min(H-N-O,S)),F=Math.max(x,Math.min(N-x-2*P,a.top+a.height/2-P-S)),e===u.LEFT?A=2*-P:z=2*-P):e===u.BELOW?(S=a.bottom+P,S=Math.max(S,l.top+P),S=Math.min(S,l.bottom+P),S=Math.max(S,P),S=Math.min(S,H-N)):(S=a.top-P-N,S=Math.max(S,l.top-N-P),S=Math.min(S,l.bottom-N-P),S=Math.max(S,0),S=Math.min(S,H-N-P)),R){const t=window.getComputedStyle(y.targetEl);q=Math.max(0,s.top),Y=Math.max(0,_-s.right),X=Math.max(0,H-s.bottom),J=Math.max(0,s.left),Q=Math.max(0,k(t.borderTopLeftRadius)+r),Z=Math.max(0,k(t.borderTopRightRadius)+r),tt=Math.max(0,k(t.borderBottomRightRadius)+r),et=Math.max(0,k(t.borderBottomLeftRadius)+r),at=Math.max(0,s.right),lt=Math.max(0,s.top),it=Math.max(0,s.right),nt=Math.max(0,s.bottom),ct=Math.max(0,s.left),ut=Math.max(0,s.bottom),pt=Math.max(0,s.left),mt=Math.max(0,s.top)}}else e=i||u.BELOW,e!==u.BELOW&&e!==u.ABOVE||(z=I/2-P,e===u.BELOW?F=2*-P:W=2*-P),e!==u.LEFT&&e!==u.RIGHT||(F=N/2-P,e===u.LEFT?A=2*-P:z=2*-P);t.tooltipPlacement=e,D+=` userflowjs-bubble__tooltip-notch--${e.toLowerCase()}`,U="",R&&(K+=" userflowjs-tooltip-backdrop--visible",ot+=" userflowjs-tooltip-block--visible",rt+=" userflowjs-tooltip-block--visible",st+=" userflowjs-tooltip-block--visible",dt+=" userflowjs-tooltip-block--visible");break}}d.style.transition="";let ft=C,bt=S;if(e&&(d.style.opacity="0",T===r.TOOLTIP)){const e=24;switch(t.tooltipPlacement){case u.BELOW:S+=e;break;case u.ABOVE:S-=e;break;case u.RIGHT:C+=e;break;case u.LEFT:C-=e}}"relative"!==o&&G(d,C,S);if(p.className=D,p.style.visibility=U,V(p,"top",F),V(p,"right",A),V(p,"bottom",W),V(p,"left",z),m.className=K,V(m,"top",q),V(m,"right",Y),V(m,"bottom",X),V(m,"left",J),V(m,"border-top-left-radius",Q),V(m,"border-top-right-radius",Z),V(m,"border-bottom-right-radius",tt),V(m,"border-bottom-left-radius",et),f.className=ot,V(f,"width",at),V(f,"height",lt),b.className=rt,V(b,"left",it),V(b,"height",nt),h.className=st,V(h,"left",ct),V(h,"top",ut),g.className=dt,V(g,"width",pt),V(g,"top",mt),e){d.offsetWidth;const t="opacity 250ms linear";T===r.TOOLTIP?d.style.transition=`${t}, transform 500ms cubic-bezier(0.25, 0.8, 0.5, 1)`:d.style.transition=t,d.style.opacity="1","relative"!==o&&G(d,ft,bt)}}({layoutState:B,animateIn:t,position:ct,absoluteWidth:x,absoluteHeight:I,desiredTooltipPlacement:ut,root:o,bubble:a,tooltipNotch:m,tooltipBackdrop:f,tooltipBlockTop:b,tooltipBlockRight:w,tooltipBlockBottom:y,tooltipBlockLeft:R,dir:gt})}if(P===r.TOOLTIP){const t=O&&O.targetEl;t&&B.stepKeyScrolledIntoView!==N&&B.targetScrolledIntoView!==t&&(B.stepKeyScrolledIntoView=N,B.targetScrolledIntoView=t,function(t){if(l.customScrollIntoView)return void l.customScrollIntoView(t);const{scrollPadding:e}=l;if(e&&g(t)===document.scrollingElement){const o=e.top||0,a=e.right||0,l=e.bottom||0,r=e.left||0;let i=0,n=0;const s=t.getBoundingClientRect(),c=M(),u=v();if(s.top<o?i=s.top-o:s.bottom>u-l&&(i=s.bottom-u+l),s.left<r?n=s.left-r:s.right>c-a&&(n=s.right-c+a),0!=i||0!=n)return void window.scrollBy({top:i,left:n,behavior:"smooth"})}try{t.scrollIntoView({behavior:"smooth",block:"nearest"})}catch(o){console.warn("Userflow.js: scrollIntoView error (falling back to no options).",o),t.scrollIntoView()}}(t))}else B.stepKeyScrolledIntoView=void 0,B.targetScrolledIntoView=null;Vt(C),Wt(P)}),[St,vt,N,_,H,h,ct,x,I,D,ut,A,dt,et,Vt,gt]),$t=t.useRef(Gt);$t.current=Gt;const Kt=t.useRef(!1);t.useEffect((()=>{const t=()=>{Kt.current=!0};return window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)}),[]);const qt=()=>{window.clearTimeout(Ft.current.tooltipTargetMissingTimeout),Ft.current.tooltipTargetMissingTimeout=void 0};t.useEffect((()=>qt),[]);const Yt=t.useCallback((()=>{const t=Ft.current;if(t.tooltipTargetParams=null,D||(t.tooltipPlacement=null),_!==r.TOOLTIP)return qt(),void(t.tooltipTargetMissing=!1);if(!D&&!t.tooltipTargetMissingTimeout){t.tooltipTargetMissing=!1;const e=!S||b(S)||S.type!==n.AUTO||S.autoData?1e3*parseFloat(h.tooltipMissingToleranceSeconds):1;t.tooltipTargetMissingTimeout=window.setTimeout((()=>{if(!Kt.current){if(S&&!b(S)){let t=S.autoData;if(S.autoData)try{t=JSON.parse(S.autoData)}catch(e){}console.warn("Userflow.js: Tooltip target not found on page.\n",{type:S.type,autoData:t,excludeText:S.excludeText,precision:S.precision,text:S.text,css:S.css})}qt(),t.tooltipTargetMissing=!0,$t.current()}}),e)}$t.current()}),[_,D,S,h.tooltipMissingToleranceSeconds]),Xt=t.useCallback((t=>{const e=Ft.current;qt(),e.tooltipTargetParams&&e.tooltipTargetParams.targetEl!==t.targetEl&&(e.tooltipPlacement=null),e.tooltipTargetParams=t,Gt({forceUpdatePosition:!0})}),[Gt]);U({selector:_===r.TOOLTIP&&S||null,targetMoved:Xt,targetLost:Yt,onTargetClick:X});const Jt=t.useCallback((()=>Gt({forceAppearanceLayout:!0})),[Gt]);e(Jt),t.useEffect((()=>{if(!vt||et||"function"!=typeof y)return;let t;const e=new y((()=>{t||(t=window.requestAnimationFrame((()=>{t=void 0,$t.current()})))}));return e.observe(vt,{childList:!0,attributes:!0,subtree:!0}),()=>{e.disconnect(),t&&window.cancelAnimationFrame(t)}}),[vt,et]),t.useLayoutEffect((()=>{$t.current()})),t.useLayoutEffect((()=>{"absolute"===ct&&Gt({forceAppearanceLayout:!0})}),[ct,x,I]);const Qt=t=>{t.preventDefault(),t.stopPropagation()};return function(e,o){const a=window.Intercom;t.useEffect((()=>{if(o&&e.autoHideIntercom&&"function"==typeof a&&!l.autoHide3pDisabled){try{a("update",{hide_default_launcher:!0})}catch(t){console.warn("Userflow.js: Error when hiding Intercom launcher",t)}return()=>{if(!l.autoHide3pDisabled)try{a("update",{hide_default_launcher:!1})}catch(t){console.warn("Userflow.js: Error when unhiding Intercom launcher",t)}}}}),[a,e.autoHideIntercom,o]);const r=window.$crisp;t.useEffect((()=>{if(o&&e.autoHideCrisp&&r&&!l.autoHide3pDisabled){try{r.push(["do","chat:hide"])}catch(t){console.warn("Userflow.js: Error when hiding Crisp Chat",t)}return()=>{if(!l.autoHide3pDisabled)try{r.push(["do","chat:show"])}catch(t){console.warn("Userflow.js: Error when unhiding Crisp Chat",t)}}}}),[r,e.autoHideCrisp,o]);const i=window.HubSpotConversations;t.useEffect((()=>{if(o&&e.autoHideHubspot&&i&&!l.autoHide3pDisabled){try{i.widget.remove()}catch(t){console.warn("Userflow.js: Error when hiding HubSpot Chat",t)}return()=>{if(!l.autoHide3pDisabled)try{i.widget.load()}catch(t){console.warn("Userflow.js: Error when unhiding HubSpot Chat",t)}}}}),[i,e.autoHideHubspot,o]);const n=window.drift;t.useEffect((()=>{if(o&&e.autoHideDrift&&n&&!l.autoHide3pDisabled){try{n.api.widget.hide()}catch(t){console.warn("Userflow.js: Error when hiding Drift Chat",t)}return()=>{if(!l.autoHide3pDisabled)try{n.api.widget.show()}catch(t){console.warn("Userflow.js: Error when unhiding Drift Chat",t)}}}}),[n,e.autoHideDrift,o])}(h,!!lt&&At===r.BUBBLE),t.createElement("div",{ref:wt,"data-testid":"flow-chrome",className:"userflowjs-flow-chrome userflowjs-theme-root",style:j(h),dir:gt},t.createElement("div",{className:"userflowjs-bubble",ref:Tt,style:{zIndex:ft}},t.createElement("div",{className:m({"userflowjs-bubble-outline":!0,[`userflowjs-bubble-outline--bubble-placement-${(h.bubblePlacement||"").toLowerCase().replace(/_/,"-")}`]:!0,"userflowjs-bubble-outline--minimizable":!!at,"userflowjs-bubble-outline--minimized":Dt})},t.createElement("div",{className:"userflowjs-bubble__frame-wrapper",...it},t.createElement(o,{className:"userflowjs-bubble__frame",elRef:Et,stylesheetUrl:p,theme:h,onStylesheetsLoad:_t,noIframe:et},t.createElement("div",{className:"userflowjs-bubble-frame-root",dir:gt,ref:t=>{rt&&rt(t),Mt(t)},style:C?{backgroundImage:`url("${encodeURI(C)}")`}:void 0},st,f.flowBranding&&t.createElement("div",{className:"userflowjs-bubble-made-with-userflow"},t.createElement("div",{className:"userflowjs-bubble-made-with-userflow__absolute"},t.createElement(pt,{company:f},t.createElement(a,null),t.createElement("div",null,"Made with Userflow"))))))),t.createElement("div",{ref:Lt,className:"userflowjs-bubble__avatar-notch"})),t.createElement(o,{className:m({"userflowjs-bubble__avatar":!0,"userflowjs-bubble__avatar--minimizable":!!at,"userflowjs-bubble__avatar--speaking":!!tt}),elRef:yt,stylesheetUrl:P,theme:h,onStylesheetsLoad:Ct,noIframe:et,ariaHidden:!0},t.createElement("div",{className:m({"userflowjs-avatar-frame-root":!0,"userflowjs-avatar-frame-root--minimizable":!!at}),onClick:at?()=>Ut((t=>!t)):void 0},t.createElement(W,{theme:h}))),t.createElement("div",{ref:kt,className:"userflowjs-bubble__tooltip-notch"})),t.createElement("div",{ref:Rt,className:"userflowjs-tooltip-backdrop",onMouseDown:Qt,style:{zIndex:bt,pointerEvents:K?void 0:"none"}}),t.createElement("div",{ref:jt,className:"userflowjs-tooltip-block",onMouseDown:Qt,style:{zIndex:bt}}),t.createElement("div",{ref:Bt,className:"userflowjs-tooltip-block",onMouseDown:Qt,style:{zIndex:bt}}),t.createElement("div",{ref:Ot,className:"userflowjs-tooltip-block",onMouseDown:Qt,style:{zIndex:bt}}),t.createElement("div",{ref:Pt,className:"userflowjs-tooltip-block",onMouseDown:Qt,style:{zIndex:bt}}),t.createElement("div",{ref:xt,className:"userflowjs-modal-backdrop",onMouseDown:Qt,onClick:Q,style:{zIndex:bt}}),nt&&nt({visible:zt,bubbleFrame:Et.current}))},W=({theme:e})=>{const o="https://js.userflow.com/cartoon-avatars-no-bg/";let a;return a=e.avatarType===i.ASSET&&e.avatarAsset?e.avatarAsset.assetUrl:e.avatarType===i.CARTOON&&e.avatarName?o+e.avatarName+".svg?3":e.avatarType===i.URL&&e.avatarUrl?e.avatarUrl:o+"none.svg",t.createElement("img",{src:a,alt:""})},z=({company:e,children:o})=>t.createElement("a",{href:"https://userflow.com/?utm_source=made-with-userflow&utm_medium=link&utm_campaign=made-with-userflow-"+e.slug,target:"_blank",rel:"noopener noreferrer"},o);function V(t,e,o){null==o?t.style.removeProperty(e):t.style.setProperty(e,"number"==typeof o?o+"px":o,"important")}function G(t,e,o){e=Math.round(e),o=Math.round(o),t.style.transform=`translate3d(${e}px, ${o}px, 0px)`}function $(t){const e=parseInt(t,10);return isNaN(e)?0:e}export{A as F,H as r,U as u};
|
package/README.md
CHANGED
|
@@ -1,3 +1,93 @@
|
|
|
1
1
|
# Self-hosted Userflow.js
|
|
2
2
|
|
|
3
3
|
**IMPORTANT: This is a WIP! Unless you've been explicitly told by Userflow to use this package, you should use our CDN-hosted version instead. See https://userflow.com/install**
|
|
4
|
+
|
|
5
|
+
Userflow.js is hosted on Userflow's CDN (running on Cloudflare). We always recommend using the official Userflow.js CDN, unless you have very specific requirements as detailed in this document. [See Userflow.js installation via CDN](https://userflow.com/install)
|
|
6
|
+
|
|
7
|
+
This package allows you to self-host Userflow.js. This may be required in cases such as:
|
|
8
|
+
|
|
9
|
+
- Chrome Extensions using manifest v3, which does not allow for loading remote JavaScript code.
|
|
10
|
+
- When Userflow.js is deployed on customers' machines running behind a firewall. In this case, you're also responsible for proxying requests to Userflow's backend, which is not detailed in this document.
|
|
11
|
+
|
|
12
|
+
## Backwards compatibility
|
|
13
|
+
|
|
14
|
+
Userflow.js connects to Userflow's backend and communicates about flows and user activity. When you use our official CDN, you're always guaranteed to run on the latest Userflow.js version. We occasionally, but rarely, introduce backwards incompatible changes between old Userflow.js versions and the currently deployed Userflow backend. We strive to keep old Userflow.js clients (browsers that have not refreshed in days, for example) working for at least 2 weeks. But this is not a strict guarantee - there could be very rare cases, where outdated and unsupported clients are rejected sooner.
|
|
15
|
+
|
|
16
|
+
If you choose to self-host, your Userflow.js version may run behind what the Userflow backend is designed to work with. It is therefore your responsibility to periodically upgrade to the latest `userflow.js-self-hosted` package version.
|
|
17
|
+
|
|
18
|
+
The consequence of an outdated and unsupported Userflow.js client version connecting to the Userflow backend, would simply be that no Userflow content will show, and calls to `userflow.identify()`, `userflow.start()` etc. will fail.
|
|
19
|
+
|
|
20
|
+
Contact Userflow if you require a more tightly controlled service agreement with explicit backwards compatibility guarantees.
|
|
21
|
+
|
|
22
|
+
## Versioning
|
|
23
|
+
|
|
24
|
+
`userflow.js-self-hosted` uses [Semantic Versioning](https://semver.org/), where versions are on the format `1.0.<USERFLOW_BUILD>`, where `<USERFLOW_BUILD>` is a Userflow-internal build number (always incrementing). Example: `1.0.1002407`. As long as the major version is `1`, you can expect no changes in how to consume the package. If we one day change the structure of the package, requiring you to do some work, it'll be under a new major version, e.g. `2.0.<USERFLOW_BUILD>`. This means it should always be safe and maintenance-free for you to upgrade to the latest patch version.
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
Install from npm:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
npm install userflow.js-self-hosted
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The package contains ES modules and a few CSS files. The entrypoint is `./userflow.js`, whose default export is the `userflow` object - the one you call `userflow.init()` etc. on.
|
|
35
|
+
|
|
36
|
+
From your own code, you can import `./userflow.js` via a dynamic `import()` call. Then grab the `default` export from that. Example:
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
const {default: userflow} = await import(
|
|
40
|
+
'path/to/userflow.js-self-hosted/userflow.js'
|
|
41
|
+
)
|
|
42
|
+
userflow.init('<TOKEN>')
|
|
43
|
+
// userflow.identify(...) etc.
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
It'll automatically and lazily figure out how to import further modules from the same location as `./userflow.js` was loaded from. For example, it won't load the resource center code if you're not using it. It'll also load CSS files from the same location. It never touches the official CDN at js.userflow.com (except if you use our default avatar SVGs).
|
|
47
|
+
|
|
48
|
+
You may also be able to use a bundler, such as Webpack, to transform the code into whatever format you want.
|
|
49
|
+
|
|
50
|
+
### Usage in Chrome Extensions
|
|
51
|
+
|
|
52
|
+
Here's a super simple Chrome Extension which installs Userflow.js on myapp.com. It assumes that you've already installed `userflow.js-self-hosted` as an npm package.
|
|
53
|
+
|
|
54
|
+
`manifest.json`:
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"manifest_version": 3,
|
|
59
|
+
"name": "Demo",
|
|
60
|
+
"description": "Just a demo of using Userflow.js in manifest v3",
|
|
61
|
+
"version": "0.1.0",
|
|
62
|
+
"content_scripts": [
|
|
63
|
+
{
|
|
64
|
+
"matches": ["https://myapp.com/*"],
|
|
65
|
+
"js": ["content-script.js"]
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"web_accessible_resources": [
|
|
69
|
+
{
|
|
70
|
+
"matches": ["<all_urls>"],
|
|
71
|
+
"resources": ["node_modules/userflow.js-self-hosted/*"]
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
`content-script.js`:
|
|
78
|
+
|
|
79
|
+
```js
|
|
80
|
+
;(async () => {
|
|
81
|
+
const {default: userflow} = await import(
|
|
82
|
+
chrome.runtime.getURL('node_modules/userflow.js-self-hosted/userflow.js')
|
|
83
|
+
)
|
|
84
|
+
userflow.init('<TOKEN>')
|
|
85
|
+
// userflow.identify(...) etc.
|
|
86
|
+
})()
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Since `./userflow.js` is an ES module (so are all other `.js` files in the package), and Chrome extensions don't use ES modules themselves directly, you have to include it in your content script via this dynamic `import()` call. It's important to add the `userflow.js-self-hosted` package's path under `web_accessible_resources` in your `manifest.json`.
|
|
90
|
+
|
|
91
|
+
## Userflow.js documentation
|
|
92
|
+
|
|
93
|
+
- [Userflow.js Reference](https://userflow.com/docs/userflow-js)
|
package/ResourceCenterApp.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./vendor.react.js";import{h as t,C as r,i as s,c as o,j as n,k as c,E as l,l as a,m as i,S as u}from"./userflow.js";import{u as d,i as m}from"./client-context.js";import{u as f,w,C as h}from"./Icons.js";import{b as E,h as b,B as p,R as k,a as v,s as g,f as j}from"./BubbleToolbar.js";import{M as C,g as S,a as y}from"./flow-condition-types.js";import{u as N,a as _,g as x}from"./stylesheets.js";import{u as I,F as T,S as R}from"./logomark.js";import{o as L}from"./vendor.obj-str.js";import{D as B}from"./DynamicIcon.js";import{f as H,C as M}from"./ChecklistUI.js";import{f as W,a as F,b as P,c as $,d as A,e as z,g as O,h as U,i as q}from"./vendor.fortawesome.pro-regular-svg-icons.js";import{u as D}from"./vendor.react-i18next.js";import"./vendor.object-assign.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";import"./vendor.i18next.js";import"./vendor.fortawesome.react-fontawesome.js";import"./vendor.fortawesome.fontawesome-svg-core.js";import"./vendor.prop-types.js";import"./vendor.fortawesome.pro-solid-svg-icons.js";import"./vendor.date-fns.js";import"./vendor.react-dom.js";import"./vendor.scheduler.js";import"./vendor.babel.runtime.js";function K(e){return e!==t.ACTION&&e!==t.CONTACT&&e!==t.FLOWS&&e!==t.KNOWLEDGE_BASE&&e!==t.SUBPAGE}const Q=window,V={[r.CRISP]:{configure:({onShow:e,onHide:t})=>{Q.$crisp||(Q.$crisp=[]),Q.$crisp.push(["do","chat:hide"]);let r=!1,s=!1;const o=()=>{r||s?(Q.$crisp.push(["do","chat:show"]),e()):(Q.$crisp.push(["do","chat:hide"]),t())},n=()=>{r=!0,o()};Q.$crisp.push(["on","chat:opened",n]);const c=()=>{r=!1,o()};Q.$crisp.push(["on","chat:closed",c]);const l=()=>{s=!0,o()};Q.$crisp.push(["on","message:received",l]);const a=window.setInterval((()=>{const e=(()=>{const e=document.getElementById("crisp-chatbox");if(!e||"block"!==window.getComputedStyle(e).display)return!1;const t=e.querySelector('[data-id="new_messages"]');return!(!t||"block"!==window.getComputedStyle(t).display)})();e!==s&&(s=e,o())}),200);return()=>{Q.$crisp.push(["off","chat:opened",n]),Q.$crisp.push(["off","chat:closed",c]),Q.$crisp.push(["off","message:received",l]),window.clearInterval(a)}},show:()=>{Q.$crisp.push(["do","chat:show"]),Q.$crisp.push(["do","chat:open"])},hide:()=>{Q.$crisp.push(["do","chat:hide"]),Q.$crisp.push(["do","chat:close"])}},[r.CUSTOM]:{configure:()=>()=>{},show:({block:e})=>{try{new Function('"use strict";\n'+e.chatCode)()}catch(t){console.error(`Userflow.js: Showing custom chat provider failed. Code: ${e.chatCode}`,t)}},hide:()=>{}},[r.FRESHCHAT]:{configure:({onShow:e,onHide:t})=>{if(!Q.fcWidget)throw new Error("Freshchat is not installed");let r=!1,s=!1;const o=()=>{r||s?e():t()},n=()=>{r=!0,o()};Q.fcWidget.on("widget:opened",n);const c=()=>{r=!1,o()};Q.fcWidget.on("widget:closed",c);const l=()=>{const e=!!document.querySelector("#fc_frame.h-open-notify");e!==s&&(s=e,o())},a=window.setInterval(l,200);return Q.fcWidget.on("unreadCount:notify",l),()=>{Q.fcWidget.off("widget:opened",n),Q.fcWidget.off("widget:closed",c),Q.fcWidget.off("unreadCount:notify",l),window.clearInterval(a)}},show:()=>{Q.fcWidget.open()},hide:()=>{Q.fcWidget.close()}},[r.HELPSCOUT]:{configure:({onShow:e,onHide:t})=>{if(!Q.Beacon)throw new Error("Help Scout is not installed");Z();let r=!1,s=!1;const o=()=>{r||s?(G(),e()):(Z(),t())},n=()=>{r=!0,o()};Q.Beacon("on","open",n),Q.Beacon("info")?.status.isOpened&&n();const c=()=>{r=!1,o()};Q.Beacon("on","close",c);const l=window.setInterval((()=>{const e=!!document.querySelector(".BeaconNotificationsFrame");e!==s&&(s=e,o())}),200);return()=>{Q.Beacon("off","open",n),Q.Beacon("off","close",c),window.clearInterval(l)}},show:()=>{G(),Q.Beacon("open")},hide:()=>{Z(),Q.Beacon("close")}},[r.HUBSPOT]:{configure:({onShow:e,onHide:t})=>{const r=()=>{const r=document.getElementById("hubspot-messages-iframe-container");if(!Q.HubSpotConversations||!r)return;window.clearInterval(o),Y?J():X();let n=!1,c=!1;const l=()=>{n||c?(J(),e()):(X(),t())},a=()=>{const e=!!document.querySelector("#hubspot-messages-iframe-container .shadow-container.active");e!==n&&(n=e,l())},i=new C(a);i.observe(r,{attributes:!0,subtree:!0,attributeFilter:["class"]}),a();const u=({unreadCount:e})=>{const t=e>0;t!==c&&(c=t,l())};Q.HubSpotConversations.on("unreadConversationCountChanged",u),s=()=>{i.disconnect(),Q.HubSpotConversations.off("unreadConversationCountChanged",u)}};let s=()=>{window.clearInterval(o)};const o=window.setInterval(r,100);return r(),()=>{s()}},show:()=>{J(),Q.HubSpotConversations.widget.open()},hide:()=>{X(),Q.HubSpotConversations.widget.close()}},[r.INTERCOM]:{configure:({onShow:e,onHide:t})=>{if(!Q.Intercom)throw new Error("Intercom is not installed");return oe(),function(){if(ee)return;ee=!0;let e=!1,t=!1;const r=()=>{se();for(const e of te)e()},s=()=>{oe();for(const e of re)e()},o=()=>{e||t?r():s()};Q.Intercom("onShow",(()=>{e=!0,o()})),Q.Intercom("onHide",(()=>{e=!1,o()}));const n=()=>{const e=!!document.querySelector('iframe[name="intercom-borderless-frame"], iframe[name="intercom-notifications-frame"]');t!==e&&(t=e,o())};Q.Intercom("onUnreadCountChange",(()=>{n()})),window.setInterval(n,200)}(),te.add(e),re.add(t),()=>{te.delete(e),re.delete(t)}},show:()=>{se(),Q.Intercom("show")},hide:()=>{oe(),Q.Intercom("hide")}},[r.ZENDESK]:{configure:({onShow:e,onHide:t})=>{if(!Q.zE)throw new Error("Zendesk is not installed");!function(){if(ne)return;ne=!0,Q.zE("webWidget:on","open",(()=>{for(const e of ce)e()})),Q.zE("webWidget:on","close",(()=>{for(const e of le)e()})),Q.zE("webWidget:on","chat:unreadMessages",(e=>{for(const t of ae)t(e)}))}(),Q.zE("webWidget","hide"),Q.zE("webWidget","close");let r=!1,s=!1;const o=()=>{r||s?(Q.zE("webWidget","show"),e()):(Q.zE("webWidget","hide"),t())},n=()=>{r=!0,s=!1,o()};ce.add(n);const c=()=>{r=!1,s=!1,o()};le.add(c);const l=e=>{const t=e>0;t!==s&&(s=t,o())};return ae.add(l),()=>{ce.delete(n),le.delete(c),ae.delete(l)}},show:()=>{Q.zE("webWidget","show"),Q.zE("webWidget","open")},hide:()=>{Q.zE("webWidget","hide"),Q.zE("webWidget","close")}},[r.ZENDESK_MESSENGER]:{configure:({onShow:e,onHide:t})=>{if(!Q.zE)throw new Error("Zendesk is not installed");let r=!1;const s=window.setInterval((()=>{const s=(()=>{const e=document.querySelector('iframe[title="Messaging window"]');return!!e?.parentElement&&"0px"!==window.getComputedStyle(e.parentElement).height})();s!==r&&(r=s,r?e():t())}),200);return()=>{window.clearInterval(s)}},show:()=>{Q.zE("messenger","open")},hide:()=>{Q.zE("messenger","close")}}};function G(){Q.Beacon("config",{display:{style:"icon"}})}function Z(){Q.Beacon("config",{display:{style:"manual"}})}let Y=!1;function J(){Y=!0;document.getElementById("hubspot-messages-iframe-container")?.style.setProperty("visibility","visible","important")}function X(){Y=!1;document.getElementById("hubspot-messages-iframe-container")?.style.setProperty("visibility","hidden","important")}let ee=!1,te=new Set,re=new Set;function se(){Q.Intercom("update",{hide_default_launcher:!1,vertical_padding:20})}function oe(){Q.Intercom("update",{hide_default_launcher:!0,vertical_padding:100})}let ne=!1,ce=new Set,le=new Set,ae=new Set;function ie(){return e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100"},e.createElement("path",{fill:"currentColor",d:"M24.049 79.74h36.003c8.185 0 15.985-6.621 17.43-14.814l6.091-34.556h3.997c8.149 0 13.645 6.63 12.2 14.815l-7.051 40C91.274 93.363 83.474 100 75.288 100h-40c-8.185 0-13.645-6.667-12.2-14.815l.96-5.444z"}),e.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M12.437 69.63h40c8.148 0 15.978-6.637 17.422-14.815l7.052-40C78.355 6.63 72.896 0 64.711 0h-40C16.533 0 8.726 6.63 7.281 14.815l-7.052 40C-1.215 62.963 4.252 69.63 12.437 69.63zm33.628-33.798c3.756-2.064 8.725-4.795 9.907-11.844C57.385 15.458 50.065 8.983 42.168 9c-7.452 0-12.771 3.195-17.508 8.892-.858 1.034-.884 2.45-.053 3.212l3.472 3.196c.847.767 2.25.589 3.176-.406 2.842-3.068 4.869-4.83 8.51-4.83 2.864 0 6.077 1.934 5.59 4.847-.37 2.223-2.292 3.334-5.4 5.001l-.28.151c-3.582 1.92-8.134 4.362-9.124 10.247l-.16.956c-.055.28-.05.571.014.85.065.278.188.538.362.76.173.222.391.4.639.522.247.121.518.183.79.18h6.744a2.709 2.709 0 001.712-.688c.481-.426.81-1.01.934-1.657l.095-.556c.266-1.582 2.101-2.59 4.384-3.845zM32.837 59c3.552 0 6.955-3.034 7.58-6.769.63-3.729-1.742-6.763-5.293-6.763-3.552 0-6.934 3.028-7.58 6.763C26.9 55.966 29.286 59 32.837 59z"}))}const ue=()=>{const t=12;return e.createElement("div",{className:"userflowjs-spinner"},e.createElement("svg",{viewBox:"0 0 24 24",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},e.createElement("circle",{className:"userflowjs-spinner__bg",fill:"none",cx:t,cy:t,r:10,style:{strokeWidth:"4px"}}),e.createElement("circle",{className:"userflowjs-spinner__fill",fill:"none",cx:t,cy:t,r:10,transform:"translate(12, 12) rotate(-90) translate(-12, -12)",style:{strokeWidth:"4px",strokeDasharray:20*Math.PI*.25+"px, 1000"}})))};function de(t){const r=d(),[s,o]=e.useState(!0),[n,c]=e.useState(!1),[l,a]=e.useState(null),[i,u]=e.useState(null),[m,f]=e.useState(null),w=e.useRef(0),h=e.useRef(null),E=e.useRef((()=>{}));return e.useEffect((()=>{const e=JSON.stringify(t);if(e===h.current)return;h.current=e;const s=++w.current;let n,l;let i=!1;E.current=async(e,t)=>{if(!i){i=!0,c(!0);try{const o=e(n,l);l=o;const u=await r.send(o,{handlesRejection:!0});if(s!==w.current)return;n=t(n,u),a(n),f(null)}catch(o){if(s!==w.current)return;f(o)}finally{i=!1,c(!1)}}},(async()=>{o(!0);try{l=t;const e=await r.send(t,{handlesRejection:!0});if(s!==w.current)return;n=e,a(n),u(t),f(null)}catch(e){if(s!==w.current)return;f(e)}finally{o(!1)}})()}),[r,t]),{loading:s,loadingMore:n,data:l,messageForData:i,error:m,loadMore:E.current}}function me(t,r){const[s,o]=e.useState(t),n=e.useRef(void 0),c=e.useCallback((e=>{window.clearTimeout(n.current),o(e),r(e)}),[r]),l=e.useCallback((e=>{window.clearTimeout(n.current),o(e),n.current=window.setTimeout((()=>{r(e)}),200)}),[r]);return e.useEffect((()=>()=>{window.clearTimeout(n.current)}),[]),[s,l,c]}const fe=({session:a,isOpen:i,flowSession:u,checklistSession:b})=>{const p=d(),{t:k}=D(),{company:v}=a.flow,{version:g}=a,y=g.resourceCenter,M=N(g.theme),A=a.locale?a.locale.standardLocaleId:a.version.theme.languageId;e.useEffect((()=>{m.changeLanguage(A)}),[A]);const{loaded:z}=_(window,j,M),[O,U]=e.useState(!1),q=z&&O,[Q,G]=e.useState(S()),Z=e.useCallback((()=>{G(S())}),[]);I(Z);const{zIndex:Y,bringToFront:J}=f(),X=e.useRef(null),[ee,te]=e.useState(null),[re,se]=e.useState(null),[oe,ne]=e.useState(null),ce=e.useRef(null),[le,ae]=e.useState(null),[ue,de]=e.useState(null),[me,fe]=e.useState(null),[Ee,be]=e.useState(0),[je,Ce]=e.useState(0),ye=e.useCallback((()=>{re&&be(re.offsetWidth),Ce((oe?.offsetHeight||0)+(le?.offsetHeight||0)+(ue?.offsetHeight||0)+(me?.offsetHeight||0))}),[re,oe,le,ue,me]);e.useLayoutEffect((()=>{if(!ee||"function"!=typeof C)return;const e=new C((()=>{ye()}));return e.observe(ee,{childList:!0,attributes:!0,subtree:!0}),()=>{e.disconnect()}}),[ee,ye]),e.useLayoutEffect((()=>{ye()}));const[xe,Ie]=e.useState(!1),Te=e.useRef(),Re=e.useCallback((()=>{Ie(!0),window.clearTimeout(Te.current),Te.current=window.setTimeout((()=>{Ie(!1)}),M.resourceCenterTransitionDuration)}),[M.resourceCenterTransitionDuration]);e.useEffect((()=>()=>{window.clearTimeout(Te.current)}),[]);const Le=e.useCallback((()=>{J(),Re(),p.openResourceCenter()}),[J,p,Re]),Be=e.useCallback((()=>{Re(),p.closeResourceCenter()}),[p,Re]),[He,Me]=e.useState(!1);e.useEffect((()=>{if(He){if(i){const e='button:not([tabindex="-1"]), [tabindex]:not([tabindex="-1"]), input, textarea';let t=le?.querySelector(e)||oe?.querySelector(e);if(t){const e=t.closest&&t.closest(".userflowjs-resource-center-checklist")||null;e?H(e):t.focus({preventScroll:!0})}}else re?.focus({preventScroll:!0});Me(!1)}}),[He,i,le,oe,re]),e.useEffect((()=>{const e=ee?.ownerDocument.defaultView;if(!i||!e)return;const t=e=>{"Escape"===e.key&&(Be(),Me(!0))};return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)}),[i,ee,Me,Be]);const[We,Fe]=e.useState(null),Pe=e.useCallback(((e,t)=>{Fe(e),0===t?.detail&&Me(!0)}),[]);e.useEffect((()=>{i||Pe(null)}),[i,Pe]);const $e=e.useMemo((()=>y.blocks.filter((e=>!(e.type===t.CHECKLIST&&!b)&&(!e.hiddenWhenFlowsActive||!e.hiddenWhenFlowsActive.some((e=>e===u?.flow.id||e===b?.flow.id)))))),[y,u,b]),Ae=e.useMemo((()=>we($e)),[$e]),ze=e.useMemo((()=>b&&y.blocks.some((e=>e.type===t.CHECKLIST))?s(b):0),[y,b]),Oe=e.useMemo((()=>y.blocks.find((e=>e.type===t.CONTACT&&e.chatEnabled&&e.chatProvider))),[y]),[Ue,qe]=e.useState(!1),De=e.useCallback((()=>{p.closeResourceCenter(),Oe&&Oe.chatProvider!==r.CUSTOM&&qe(!0)}),[p,Oe]),Ke=e.useCallback((()=>{qe(!1)}),[]),Qe=e.useCallback((()=>{if(Oe)try{V[Oe.chatProvider].hide({block:Oe}),Ke()}catch(e){console.error(`Userflow.js: Error when hiding ${Oe.chatProvider}:`,e)}}),[Oe,Ke]);e.useEffect((()=>{if(!Oe)return;o.autoHide3pDisabled=!0;const e=V[Oe.chatProvider];try{const t=e.configure({block:Oe,onShow:De,onHide:Ke});return()=>{t()}}catch(t){return void console.error(`Userflow.js: Error when configuring ${Oe.chatProvider}:`,t)}}),[Oe,De,Ke]),e.useEffect((()=>{i&&Qe()}),[Qe,i]);const Ve=!!We&&("search"===We.kind||"flows"===We.kind||"knowledgeBase"===We.kind),Ge={zIndex:null!=M.resourceCenterZIndex?M.resourceCenterZIndex:i?Y:w(h),width:i?void 0:Ee+"px",height:i?Math.min(Ve?540:je,Q-2*M.resourceCenterPaddingY)+"px":void 0,position:q?void 0:"absolute",visibility:q&&!Ue?void 0:"hidden"},Ze=M.resourceCenterDisplayChecklistProgress&&b&&ze>0?e.createElement("div",{"data-testid":"resource-center-launcher-badge",className:"userflowjs-resource-center-launcher-badge"},ze,e.createElement("div",{className:"userflowjs-a11y-only"},"uncompleted tasks")):null;let Ye="",Je="";return M.resourceCenterLauncherTextMode===n.CHECKLIST_OVERRIDE&&b&&ze>0?Ye=b.version.checklist?.launcherText||"Get Started":M.resourceCenterLauncherTextMode!==n.NONE&&(Je=y.buttonText),e.createElement("div",{"data-testid":"resource-center-app",className:"userflowjs-resource-center userflowjs-theme-root",style:x(M),dir:m.dir()},e.createElement(T,{elRef:X,className:L({"userflowjs-resource-center-frame":!0,"userflowjs-resource-center-frame--fixed":!0,[`userflowjs-resource-center-frame--placement-${M.resourceCenterPlacement.toLowerCase().replace(/_/g,"-")}`]:!0,"userflowjs-resource-center-frame--animating":xe,"userflowjs-resource-center-frame--open":i,"userflowjs-resource-center-frame--closed":!i}),style:{...Ge},stylesheetUrl:E,theme:M,onStylesheetsLoad:U},q&&e.createElement(e.Fragment,null,e.createElement("div",{ref:te,className:L({"userflowjs-resource-center-frame-root":!0,[`userflowjs-resource-center-frame-root--placement-${M.resourceCenterPlacement.toLowerCase().replace(/_/g,"-")}`]:!0,"userflowjs-resource-center-frame-root--animating":xe,"userflowjs-resource-center-frame-root--open":i,"userflowjs-resource-center-frame-root--closed":!i}),dir:m.dir(),role:i?"dialog":void 0,"aria-label":i?y.headerText:void 0},e.createElement("div",{className:"userflowjs-resource-center-launcher-container"},e.createElement("button",{ref:se,className:"userflowjs-resource-center-launcher-button",onClick:e=>{Le(),0===e.detail&&Me(!0)},"aria-label":`Open ${y.headerText}`},Ze,Ye&&e.createElement("div",{"data-testid":"resource-center-launcher-text",className:"userflowjs-resource-center-launcher-text"},Ye),(Ze||Ye)&&e.createElement("div",{className:"userflowjs-resource-center-launcher-divider"}),Je&&e.createElement("div",{"data-testid":"resource-center-launcher-text",className:"userflowjs-resource-center-launcher-text"},Je),e.createElement("div",{className:"userflowjs-resource-center-launcher-icon"},M.resourceCenterLauncherIconType===c.PLAINTEXT?"?":e.createElement(ie,null)))),e.createElement("div",{ref:ce,className:"userflowjs-resource-center-body"},e.createElement("div",{ref:ae,className:L({"userflowjs-resource-center-body-content":!0,"userflowjs-resource-center-body-content--same-background":M.sameBackground,"userflowjs-resource-center-body-content--with-made-with-userflow":v.resourceCenterBranding})},i&&e.createElement(e.Fragment,null,We?"search"===We.kind?e.createElement(pe,{session:a,navigate:Pe}):"email"===We.kind?e.createElement(ke,{block:We.block,session:a}):"phone"===We.kind?e.createElement(ve,{block:We.block,session:a}):"flows"===We.kind?e.createElement(ge,{block:We.block,initialQ:We.initialQ,session:a,navigate:Pe}):"knowledgeBase"===We.kind?e.createElement(Se,{block:We.block,initialQ:We.initialQ,session:a,bodyRef:ce}):"subpage"===We.kind?e.createElement(Ne,{block:We.block,session:a}):null:e.createElement(e.Fragment,null,$e.map(((t,r)=>{const s=he[t.type],o=$e[r+1];return s?e.createElement(e.Fragment,{key:t.id},e.createElement(s.View,{session:a,flowSession:u,checklistSession:b,block:t,navigate:Pe,onChatShow:De}),o&&(n=t.type,c=o.type,K(n)||K(c))&&e.createElement("div",{className:"userflowjs-resource-center-divider"})):null;var n,c})))))),v.resourceCenterBranding&&e.createElement("div",{className:"userflowjs-resource-center-made-with-userflow"},e.createElement("div",{className:"userflowjs-resource-center-made-with-userflow-content",ref:de},e.createElement("a",{href:"https://userflow.com/?utm_source=made-with-userflow&utm_medium=link&utm_campaign=made-with-userflow-"+v.slug+"&utm_content=resource-center",target:"_blank",rel:"noopener noreferrer"},e.createElement(R,null),e.createElement("div",null,"Made with Userflow")))),a.draftMode&&e.createElement("div",{className:"userflowjs-resource-center-preview"},e.createElement("div",{ref:fe,className:"userflowjs-resource-center-preview-content"},e.createElement("div",{className:"userflowjs-resource-center-preview-text"},"Preview"),e.createElement("button",{className:"userflowjs-resource-center-preview-button",onClick:()=>{p.endFlow(a,{endReason:l.USER_CLOSED})}},e.createElement(B,{icon:W})))),e.createElement("div",{className:"userflowjs-resource-center-header"},e.createElement("div",{ref:ne,className:"userflowjs-resource-center-header-content"},null==We?e.createElement("div",{className:"userflowjs-resource-center-header-text"},y.headerText):e.createElement("button",{className:"userflowjs-resource-center-icon-button",onClick:e=>Pe(null,e)},e.createElement("div",{className:"userflowjs-rtl-mirrored"},e.createElement(B,{icon:F})),e.createElement("div",{className:"userflowjs-resource-center-icon-button__text"},k("resource_center.back"))),e.createElement("div",{className:"flex-1"}),Ae.length>0&&e.createElement("button",{className:"userflowjs-resource-center-icon-button",onClick:()=>{let e={kind:"search"};if(1===Ae.length){const t=Ae[0],r=he[t.type];r.routeTo&&(e=r.routeTo({block:t}))}"search"===We?.kind?Pe(null):(_e(p,a,null,"Search icon"),Pe(e))},"aria-label":"Search"},e.createElement(B,{icon:P})),e.createElement("button",{className:"userflowjs-resource-center-icon-button userflowjs-resource-center-close-button",onClick:e=>{Be(),0===e.detail&&Me(!0)},"aria-label":`Close ${y.headerText}`},e.createElement(B,{icon:$}))))))))};function we(e){return e.filter((e=>{const t=he[e.type];return t.isSearchable?t.isSearchable(e):!!t.search}))}const he={[t.ACTION]:{View:t=>{const{block:r,session:s,flowSession:o,checklistSession:n}=t,c=d(),[l,i]=e.useState(!1),u=o?.id,m=n?.id;return e.useEffect((()=>{i(!1)}),[u,m]),e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:l?void 0:()=>{_e(c,s,r);const e=r.actions.find((e=>e.type===a.START_FLOW));if(e){e.otherFlow?.id!==n?.flow.id&&i(!0)}else c.closeResourceCenter();b(c,s,r.actions)},disabled:l},e.createElement(Ee,{...t}),e.createElement(be,{...t}),l&&e.createElement(ue,null))}},[t.CHECKLIST]:{View:({checklistSession:t})=>e.createElement("div",{"data-testid":"resource-center-checklist",className:"userflowjs-resource-center-checklist"},e.createElement(M,{session:t}),e.createElement(p,{draftMode:!!t.draftMode&&"CHECKLIST PREVIEW"}))},[t.CONTACT]:{View:t=>{const{block:r,session:s,navigate:o,onChatShow:n}=t,c=d(),l=[];return r.emailEnabled&&l.push({icon:O,label:"Email",isRoute:!0,onClick:e=>{_e(c,s,r,"Email"),o({kind:"email",block:r},e)}}),r.phoneEnabled&&l.push({icon:U,label:"Phone",isRoute:!0,onClick:e=>{_e(c,s,r,"Phone"),o({kind:"phone",block:r},e)}}),r.chatEnabled&&l.push({icon:q,label:"Live-chat",isRoute:!1,onClick:()=>{if(_e(c,s,r,"Chat"),r.chatProvider){const t=V[r.chatProvider];try{t.show({block:r})}catch(e){console.error(`Userflow.js: Error when showing ${r.chatProvider}:`,e)}n()}else s.draftMode&&window.alert("You have not selected a chat provider. Go to the resource center builder in Userflow. Click the Contact block. Pick a chat provider in the side panel.")}}),e.createElement("div",{className:L({"userflowjs-resource-center-block":!0,"userflowjs-resource-center-block--clickable":1===l.length}),onClick:1===l.length?l[0].onClick:void 0},1===l.length&&e.createElement("div",{className:"userflowjs-resource-center-block-icon"},e.createElement(B,{icon:l[0].icon})),e.createElement(be,{...t}),l.length>1&&l.map((({icon:t,label:r,onClick:s},o)=>e.createElement("button",{key:o,className:"userflowjs-resource-center-icon-button",onClick:s,"aria-label":r},e.createElement(B,{icon:t})))),1===l.length&&l[0].isRoute&&e.createElement("div",{className:"userflowjs-resource-center-block-nav-icon"},e.createElement(B,{icon:A})))}},[t.FLOWS]:{View:t=>{const{block:r,session:s,navigate:o}=t,n=d();return e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:e=>{_e(n,s,r),o({kind:"flows",block:r},e)}},e.createElement(Ee,{...t}),e.createElement(be,{...t}),e.createElement("div",{className:"userflowjs-resource-center-block-nav-icon"},e.createElement(B,{icon:A})))},routeTo:({block:e,initialQ:t})=>({kind:"flows",block:e,initialQ:t}),isSearchable:e=>!!e.searchEnabled,search:async({client:e,session:t,block:r,q:s})=>{const{flows:o}=await e.send({kind:"ListResourceCenterBlockFlows",sessionId:t.id,blockCvid:r.cvid},{handlesRejection:!0}),n=je(o,s),c=n.slice(0,5);return{block:r,truncated:c.length===n.length,results:c.map((e=>({kind:"flow",flow:e})))}}},[t.KNOWLEDGE_BASE]:{View:t=>{const{block:r,session:s,navigate:o}=t,n=d();return e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:e=>{_e(n,s,r),o({kind:"knowledgeBase",block:r},e)}},e.createElement(Ee,{...t}),e.createElement(be,{...t}),e.createElement("div",{className:"userflowjs-resource-center-block-nav-icon"},e.createElement(B,{icon:A})))},routeTo:({block:e,initialQ:t})=>({kind:"knowledgeBase",block:e,initialQ:t}),search:async({client:e,session:t,block:r,q:s})=>{const{truncated:o,articles:n}=await e.send({kind:"SearchKnowledgeBase",sessionId:t.id,blockCvid:r.cvid,q:s,offset:0,limit:5},{handlesRejection:!0});return{block:r,truncated:o,results:n.map((e=>({kind:"article",article:e})))}}},[t.MESSAGE]:{View:({block:t,session:r})=>e.createElement("div",{className:"userflowjs-resource-center-block"},e.createElement("div",{className:"userflowjs-resource-center-block-text userflowjs-bubble-content"},e.createElement(k,{doc:t.content,lookupAttribute:y(r.data)})))},[t.SUBPAGE]:{View:t=>{const{block:r,session:s,navigate:o}=t,n=d();return e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:e=>{_e(n,s,r),o({kind:"subpage",block:r},e)}},e.createElement(Ee,{...t}),e.createElement(be,{...t}),e.createElement("div",{className:"userflowjs-resource-center-block-nav-icon"},e.createElement(B,{icon:A})))}}},Ee=({block:t})=>t.icon?e.createElement("div",{className:"userflowjs-resource-center-block-icon"},e.createElement(B,{icon:t.icon,size:16})):null,be=({block:t,session:r})=>e.createElement("div",{className:"userflowjs-resource-center-block-text"},e.createElement(v,{doc:t.name,lookupAttribute:y(r.data)})),pe=({session:t,navigate:r})=>{const s=d(),o=t.version.resourceCenter.blocks,n=we(o),{t:c}=D(),l=e.useRef(null),[a,i]=e.useState(""),[u,m]=me(a,i),[f,w]=e.useState(null);return e.useEffect((()=>{if(""===a.trim())return void w(null);let e=!1;return(async()=>{w(null);const r=await Promise.all(o.map((async e=>{const{search:r}=he[e.type];if(!r)return null;try{return await r({client:s,session:t,block:e,q:a})}catch(o){return console.error(`Userflow.js: Global search failed for ${e.type} block=`,e,"error=",o),null}})));e||w(r.filter((e=>null!=e&&e.results.length>0)))})(),()=>{e=!0}}),[s,t,o,a]),e.useEffect((()=>{l.current?.focus({preventScroll:!0})}),[]),e.createElement(e.Fragment,null,e.createElement("div",{className:"userflowjs-resource-center-list-route-search"},e.createElement("input",{ref:l,className:"userflowjs-text-input",type:"text",value:u,onChange:e=>m(e.target.value),placeholder:c("resource_center.search_placeholder")})),""===a.trim()?e.createElement("div",{"data-testid":"resource-center-empty-query",className:"userflowjs-resource-center-list-route-error"},c("resource_center.search_in")," ",n.map(((r,s)=>e.createElement(e.Fragment,{key:r.cvid},s>0&&(s===n.length-1?` ${c("and")} `:", "),e.createElement("b",null,e.createElement(v,{doc:r.name,lookupAttribute:y(t.data)}))))),"."):f?0===f.length?e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},c("resource_center.no_results_found")):f.map((({block:o,truncated:n,results:l},i)=>{const u=he[o.type],d=u.routeTo&&u.routeTo({block:o,initialQ:a});return e.createElement(e.Fragment,{key:o.cvid},i>0&&e.createElement("div",{className:"userflowjs-resource-center-divider"}),e.createElement("div",{className:"userflowjs-resource-center-label"},e.createElement(v,{doc:o.name,lookupAttribute:y(t.data)})),l.map(((s,n)=>"flow"===s.kind?e.createElement(Ce,{key:s.flow.id,block:o,session:t,flow:s.flow,navigate:r}):"article"===s.kind?e.createElement(ye,{key:n,block:o,session:t,article:s.article}):null)),!n&&d&&e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:e=>{_e(s,t,o),r(d,e)}},e.createElement("div",{className:"userflowjs-resource-center-block-text"},c("more"),":"," ",e.createElement(v,{doc:o.name,lookupAttribute:y(t.data)})),e.createElement("div",{className:"userflowjs-resource-center-block-nav-icon"},e.createElement(B,{icon:A}))))})):e.createElement("div",{className:"userflowjs-resource-center-list-route-spinner"},e.createElement(ue,null)))},ke=({block:t,session:r})=>e.createElement("div",{className:"userflowjs-resource-center-content-route userflowjs-bubble-content"},e.createElement(k,{doc:t.emailContent,lookupAttribute:y(r.data)})),ve=({block:t,session:r})=>e.createElement("div",{className:"userflowjs-resource-center-content-route userflowjs-bubble-content"},e.createElement(k,{doc:t.phoneContent,lookupAttribute:y(r.data)})),ge=({block:t,initialQ:r,session:s,navigate:o})=>{const{t:n}=D(),c=e.useRef(null),[l,a]=e.useState(r||""),[i,u]=me(l,a),{data:d,error:m}=de({kind:"ListResourceCenterBlockFlows",sessionId:s.id,blockCvid:t.cvid}),f=d?.flows,w=e.useMemo((()=>f?je(f,l):null),[f,l]);return e.useEffect((()=>{c.current?.focus({preventScroll:!0})}),[]),e.createElement(e.Fragment,null,e.createElement("div",{className:"userflowjs-resource-center-list-route-header"},e.createElement("div",{className:"userflowjs-resource-center-list-route-title"},e.createElement(v,{doc:t.name,lookupAttribute:y(s.data)}))),t.searchEnabled&&e.createElement("div",{className:"userflowjs-resource-center-list-route-search"},e.createElement("input",{ref:c,className:"userflowjs-text-input",type:"text",value:i,onChange:e=>u(e.target.value),placeholder:n("resource_center.search_placeholder")})),m?e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},n("resource_center.generic_error")):w?0===w.length?e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},n("resource_center.no_results_found")):w.map((r=>e.createElement(Ce,{key:r.id,block:t,session:s,flow:r,navigate:o}))):e.createElement("div",{className:"userflowjs-resource-center-list-route-spinner"},e.createElement(ue,null)))};function je(e,t){const r=t.toLowerCase().trim();return""===r?e:e.filter((e=>e.name.toLowerCase().includes(r)))}const Ce=({block:t,session:r,flow:s,navigate:o})=>{const n=d(),[c,l]=e.useState(!1);return e.useEffect((()=>{if(!c||s.type!==i.CHECKLIST)return;const e=()=>{n.checklistSession?.flow.id===s.id&&(t(),o(null))},t=()=>{n.off("checklistChanged",e)};return n.on("checklistChanged",e),t}),[n,c,s.type,s.id,o]),e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:()=>{_e(n,r,t,s.name),n.startFlow({flowId:s.id,startReason:u.RESOURCE_CENTER,replaceCurrent:!0}),l(!0)},disabled:c},e.createElement("div",{className:"userflowjs-resource-center-block-icon"},e.createElement(B,{icon:s.type===i.CHECKLIST?"regular/tasks":"regular/shoe-prints",size:16})),e.createElement("div",{className:"userflowjs-resource-center-block-text"},s.name),c&&e.createElement(ue,null))},Se=({block:t,initialQ:r,session:s,bodyRef:o})=>{const{t:n}=D(),c=e.useRef(null),[l,a]=e.useState(r||""),[i,u]=me(l,a),{loading:d,loadingMore:m,data:f,messageForData:w,error:h,loadMore:E}=de({kind:"SearchKnowledgeBase",sessionId:s.id,blockCvid:t.cvid,q:l,offset:0}),b=f?.truncated,p=e.useCallback((()=>{E(((e,t)=>({...t,offset:e.articles.length})),((e,t)=>({...t,articles:[...e.articles,...t.articles]})))}),[E]);e.useEffect((()=>{const e=o.current;if(!e||d||m||b)return;const t=()=>{e.scrollHeight-e.clientHeight-e.scrollTop>400||p()};return e.addEventListener("scroll",t),()=>{e.removeEventListener("scroll",t)}}),[o,d,m,b,p]),e.useEffect((()=>{c.current?.focus({preventScroll:!0})}),[]);let k=t.knowledgeBaseUrl||"";return k.match(/^https?:\/\//)||(k=`http://${k}`),e.createElement(e.Fragment,null,e.createElement("div",{className:"userflowjs-resource-center-list-route-header"},e.createElement("div",{className:"userflowjs-resource-center-list-route-title"},e.createElement(v,{doc:t.name,lookupAttribute:y(s.data)})),e.createElement("a",{className:"userflowjs-resource-center-icon-button",href:k,target:"_blank",rel:"noopener noreferrer"},e.createElement(B,{icon:z}))),e.createElement("div",{className:"userflowjs-resource-center-list-route-search"},e.createElement("input",{ref:c,className:"userflowjs-text-input",type:"text",value:i,onChange:e=>u(e.target.value),placeholder:n("resource_center.search_placeholder")})),h?e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},"quota_exceeded"===h.code?"Sorry, this company has reached its max number of searches. Consider asking Userflow to be moved to a dedicated search engine for a higher quota.":n("resource_center.generic_error")):d||!f?e.createElement("div",{className:"userflowjs-resource-center-list-route-spinner"},e.createElement(ue,null)):0===f.articles.length?""===w?.q?null:e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},n("resource_center.no_results_found")):e.createElement(e.Fragment,null,""===w?.q&&e.createElement("div",{className:"userflowjs-resource-center-label"},n("resource_center.suggested_articles")),f.articles.map(((r,o)=>e.createElement(ye,{key:o,block:t,session:s,article:r}))),m&&e.createElement("div",{className:"userflowjs-resource-center-list-route-spinner"},e.createElement(ue,null))))},ye=({block:t,article:r,session:s})=>{const o=d();return e.createElement("a",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:()=>{_e(o,s,t,r.title)},href:r.url,target:"_blank",rel:"noopener noreferrer"},e.createElement("div",{className:"userflowjs-resource-center-block-icon"},e.createElement(B,{icon:"regular/file-alt",size:16})),e.createElement("div",{className:"userflowjs-resource-center-block-text"},e.createElement("span",{dangerouslySetInnerHTML:{__html:r.htmlTitle}}),e.createElement("div",{className:"userflowjs-resource-center-block-subtext",dangerouslySetInnerHTML:{__html:r.htmlSnippet}})))},Ne=({block:t,session:r})=>e.createElement("div",{className:"userflowjs-resource-center-content-route userflowjs-bubble-content"},e.createElement(k,{doc:t.content,lookupAttribute:y(r.data)}));function _e(e,t,r,s){e.send({kind:"ClickResourceCenter",sessionId:t.id,description:r?g(r.name,{lookupAttribute:y(t.data)})+(s?` - ${s}`:""):s},{batch:!0})}export default fe;export{fe as ResourceCenterApp};
|
|
1
|
+
import{r as e}from"./vendor.react.js";import{h as t,C as r,i as s,c as o,j as n,k as c,E as l,l as a,m as i,S as u}from"./userflow.js";import{u as d,i as m}from"./client-context.js";import{u as f,w,C as h}from"./Icons.js";import{b as E,h as b,B as p,R as k,a as v,s as g,f as j}from"./BubbleToolbar.js";import{M as C,g as S,a as y}from"./flow-condition-types.js";import{u as N,a as _,g as x}from"./stylesheets.js";import{u as I,F as T,L as R}from"./logomark.js";import{o as L}from"./vendor.obj-str.js";import{D as B}from"./DynamicIcon.js";import{f as H,C as M}from"./ChecklistUI.js";import{f as W,a as F,b as P,c as $,d as A,e as O,g as z,h as U,i as q}from"./vendor.fortawesome.pro-regular-svg-icons.js";import{u as D}from"./vendor.react-i18next.js";import"./vendor.object-assign.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";import"./vendor.i18next.js";import"./vendor.fortawesome.react-fontawesome.js";import"./vendor.fortawesome.fontawesome-svg-core.js";import"./vendor.prop-types.js";import"./vendor.fortawesome.pro-solid-svg-icons.js";import"./vendor.date-fns.js";import"./vendor.react-dom.js";import"./vendor.scheduler.js";import"./vendor.babel.runtime.js";function K(e){return e!==t.ACTION&&e!==t.CONTACT&&e!==t.FLOWS&&e!==t.KNOWLEDGE_BASE&&e!==t.SUBPAGE}const Q=window,V={[r.CRISP]:{configure:({onShow:e,onHide:t})=>{Q.$crisp||(Q.$crisp=[]),Q.$crisp.push(["do","chat:hide"]);let r=!1,s=!1;const o=()=>{r||s?(Q.$crisp.push(["do","chat:show"]),e()):(Q.$crisp.push(["do","chat:hide"]),t())},n=()=>{r=!0,o()};Q.$crisp.push(["on","chat:opened",n]);const c=()=>{r=!1,o()};Q.$crisp.push(["on","chat:closed",c]);const l=()=>{s=!0,o()};Q.$crisp.push(["on","message:received",l]);const a=window.setInterval((()=>{const e=(()=>{const e=document.getElementById("crisp-chatbox");if(!e||"block"!==window.getComputedStyle(e).display)return!1;const t=e.querySelector('[data-id="new_messages"]');return!(!t||"block"!==window.getComputedStyle(t).display)})();e!==s&&(s=e,o())}),200);return()=>{Q.$crisp.push(["off","chat:opened",n]),Q.$crisp.push(["off","chat:closed",c]),Q.$crisp.push(["off","message:received",l]),window.clearInterval(a)}},show:()=>{Q.$crisp.push(["do","chat:show"]),Q.$crisp.push(["do","chat:open"])},hide:()=>{Q.$crisp.push(["do","chat:hide"]),Q.$crisp.push(["do","chat:close"])}},[r.CUSTOM]:{configure:()=>()=>{},show:({block:e})=>{try{new Function('"use strict";\n'+e.chatCode)()}catch(t){console.error(`Userflow.js: Showing custom chat provider failed. Code: ${e.chatCode}`,t)}},hide:()=>{}},[r.FRESHCHAT]:{configure:({onShow:e,onHide:t})=>{if(!Q.fcWidget)throw new Error("Freshchat is not installed");let r=!1,s=!1;const o=()=>{r||s?e():t()},n=()=>{r=!0,o()};Q.fcWidget.on("widget:opened",n);const c=()=>{r=!1,o()};Q.fcWidget.on("widget:closed",c);const l=()=>{const e=!!document.querySelector("#fc_frame.h-open-notify");e!==s&&(s=e,o())},a=window.setInterval(l,200);return Q.fcWidget.on("unreadCount:notify",l),()=>{Q.fcWidget.off("widget:opened",n),Q.fcWidget.off("widget:closed",c),Q.fcWidget.off("unreadCount:notify",l),window.clearInterval(a)}},show:()=>{Q.fcWidget.open()},hide:()=>{Q.fcWidget.close()}},[r.HELPSCOUT]:{configure:({onShow:e,onHide:t})=>{if(!Q.Beacon)throw new Error("Help Scout is not installed");Z();let r=!1,s=!1;const o=()=>{r||s?(G(),e()):(Z(),t())},n=()=>{r=!0,o()};Q.Beacon("on","open",n),Q.Beacon("info")?.status.isOpened&&n();const c=()=>{r=!1,o()};Q.Beacon("on","close",c);const l=window.setInterval((()=>{const e=!!document.querySelector(".BeaconNotificationsFrame");e!==s&&(s=e,o())}),200);return()=>{Q.Beacon("off","open",n),Q.Beacon("off","close",c),window.clearInterval(l)}},show:()=>{G(),Q.Beacon("open")},hide:()=>{Z(),Q.Beacon("close")}},[r.HUBSPOT]:{configure:({onShow:e,onHide:t})=>{const r=()=>{const r=document.getElementById("hubspot-messages-iframe-container");if(!Q.HubSpotConversations||!r)return;window.clearInterval(o),Y?J():X();let n=!1,c=!1;const l=()=>{n||c?(J(),e()):(X(),t())},a=()=>{const e=!!document.querySelector("#hubspot-messages-iframe-container .shadow-container.active");e!==n&&(n=e,l())},i=new C(a);i.observe(r,{attributes:!0,subtree:!0,attributeFilter:["class"]}),a();const u=({unreadCount:e})=>{const t=e>0;t!==c&&(c=t,l())};Q.HubSpotConversations.on("unreadConversationCountChanged",u),s=()=>{i.disconnect(),Q.HubSpotConversations.off("unreadConversationCountChanged",u)}};let s=()=>{window.clearInterval(o)};const o=window.setInterval(r,100);return r(),()=>{s()}},show:()=>{J(),Q.HubSpotConversations.widget.open()},hide:()=>{X(),Q.HubSpotConversations.widget.close()}},[r.INTERCOM]:{configure:({onShow:e,onHide:t})=>{if(!Q.Intercom)throw new Error("Intercom is not installed");return oe(),function(){if(ee)return;ee=!0;let e=!1,t=!1;const r=()=>{se();for(const e of te)e()},s=()=>{oe();for(const e of re)e()},o=()=>{e||t?r():s()};Q.Intercom("onShow",(()=>{e=!0,o()})),Q.Intercom("onHide",(()=>{e=!1,o()}));const n=()=>{const e=!!document.querySelector('iframe[name="intercom-borderless-frame"], iframe[name="intercom-notifications-frame"]');t!==e&&(t=e,o())};Q.Intercom("onUnreadCountChange",(()=>{n()})),window.setInterval(n,200)}(),te.add(e),re.add(t),()=>{te.delete(e),re.delete(t)}},show:()=>{se(),Q.Intercom("show")},hide:()=>{oe(),Q.Intercom("hide")}},[r.ZENDESK]:{configure:({onShow:e,onHide:t})=>{if(!Q.zE)throw new Error("Zendesk is not installed");!function(){if(ne)return;ne=!0,Q.zE("webWidget:on","open",(()=>{for(const e of ce)e()})),Q.zE("webWidget:on","close",(()=>{for(const e of le)e()})),Q.zE("webWidget:on","chat:unreadMessages",(e=>{for(const t of ae)t(e)}))}(),Q.zE("webWidget","hide"),Q.zE("webWidget","close");let r=!1,s=!1;const o=()=>{r||s?(Q.zE("webWidget","show"),e()):(Q.zE("webWidget","hide"),t())},n=()=>{r=!0,s=!1,o()};ce.add(n);const c=()=>{r=!1,s=!1,o()};le.add(c);const l=e=>{const t=e>0;t!==s&&(s=t,o())};return ae.add(l),()=>{ce.delete(n),le.delete(c),ae.delete(l)}},show:()=>{Q.zE("webWidget","show"),Q.zE("webWidget","open")},hide:()=>{Q.zE("webWidget","hide"),Q.zE("webWidget","close")}},[r.ZENDESK_MESSENGER]:{configure:({onShow:e,onHide:t})=>{if(!Q.zE)throw new Error("Zendesk is not installed");let r=!1;const s=window.setInterval((()=>{const s=(()=>{const e=document.querySelector('iframe[title="Messaging window"]');return!!e?.parentElement&&"0px"!==window.getComputedStyle(e.parentElement).height})();s!==r&&(r=s,r?e():t())}),200);return()=>{window.clearInterval(s)}},show:()=>{Q.zE("messenger","open")},hide:()=>{Q.zE("messenger","close")}}};function G(){Q.Beacon("config",{display:{style:"icon"}})}function Z(){Q.Beacon("config",{display:{style:"manual"}})}let Y=!1;function J(){Y=!0;document.getElementById("hubspot-messages-iframe-container")?.style.setProperty("visibility","visible","important")}function X(){Y=!1;document.getElementById("hubspot-messages-iframe-container")?.style.setProperty("visibility","hidden","important")}let ee=!1,te=new Set,re=new Set;function se(){Q.Intercom("update",{hide_default_launcher:!1,vertical_padding:20})}function oe(){Q.Intercom("update",{hide_default_launcher:!0,vertical_padding:100})}let ne=!1,ce=new Set,le=new Set,ae=new Set;function ie(){return(ie=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e}).apply(this,arguments)}var ue=({styles:t={},...r})=>e.createElement("svg",ie({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100"},r),e.createElement("path",{fill:"currentColor",d:"M24.049 79.74h36.003c8.185 0 15.985-6.621 17.43-14.814l6.091-34.556h3.997c8.149 0 13.645 6.63 12.2 14.815l-7.051 40C91.274 93.363 83.474 100 75.288 100h-40c-8.185 0-13.645-6.667-12.2-14.815l.96-5.444z"}),e.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M12.437 69.63h40c8.148 0 15.978-6.637 17.422-14.815l7.052-40C78.355 6.63 72.896 0 64.711 0h-40C16.533 0 8.726 6.63 7.281 14.815l-7.052 40C-1.215 62.963 4.252 69.63 12.437 69.63zm33.628-33.798c3.756-2.064 8.725-4.795 9.907-11.844C57.385 15.458 50.065 8.983 42.168 9c-7.452 0-12.771 3.195-17.508 8.892-.858 1.034-.884 2.45-.053 3.212l3.472 3.196c.847.767 2.25.589 3.176-.406 2.842-3.068 4.869-4.83 8.51-4.83 2.864 0 6.077 1.934 5.59 4.847-.37 2.223-2.292 3.334-5.4 5.001l-.28.151c-3.582 1.92-8.134 4.362-9.124 10.247l-.16.956c-.055.28-.05.571.014.85.065.278.188.538.362.76.173.222.391.4.639.522.247.121.518.183.79.18h6.744a2.709 2.709 0 001.712-.688c.481-.426.81-1.01.934-1.657l.095-.556c.266-1.582 2.101-2.59 4.384-3.845zM32.837 59c3.552 0 6.955-3.034 7.58-6.769.63-3.729-1.742-6.763-5.293-6.763-3.552 0-6.934 3.028-7.58 6.763C26.9 55.966 29.286 59 32.837 59z"}));const de=()=>{const t=12;return e.createElement("div",{className:"userflowjs-spinner"},e.createElement("svg",{viewBox:"0 0 24 24",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},e.createElement("circle",{className:"userflowjs-spinner__bg",fill:"none",cx:t,cy:t,r:10,style:{strokeWidth:"4px"}}),e.createElement("circle",{className:"userflowjs-spinner__fill",fill:"none",cx:t,cy:t,r:10,transform:"translate(12, 12) rotate(-90) translate(-12, -12)",style:{strokeWidth:"4px",strokeDasharray:20*Math.PI*.25+"px, 1000"}})))};function me(t){const r=d(),[s,o]=e.useState(!0),[n,c]=e.useState(!1),[l,a]=e.useState(null),[i,u]=e.useState(null),[m,f]=e.useState(null),w=e.useRef(0),h=e.useRef(null),E=e.useRef((()=>{}));return e.useEffect((()=>{const e=JSON.stringify(t);if(e===h.current)return;h.current=e;const s=++w.current;let n,l;let i=!1;E.current=async(e,t)=>{if(!i){i=!0,c(!0);try{const o=e(n,l);l=o;const u=await r.send(o,{handlesRejection:!0});if(s!==w.current)return;n=t(n,u),a(n),f(null)}catch(o){if(s!==w.current)return;f(o)}finally{i=!1,c(!1)}}},(async()=>{o(!0);try{l=t;const e=await r.send(t,{handlesRejection:!0});if(s!==w.current)return;n=e,a(n),u(t),f(null)}catch(e){if(s!==w.current)return;f(e)}finally{o(!1)}})()}),[r,t]),{loading:s,loadingMore:n,data:l,messageForData:i,error:m,loadMore:E.current}}function fe(t,r){const[s,o]=e.useState(t),n=e.useRef(void 0),c=e.useCallback((e=>{window.clearTimeout(n.current),o(e),r(e)}),[r]),l=e.useCallback((e=>{window.clearTimeout(n.current),o(e),n.current=window.setTimeout((()=>{r(e)}),200)}),[r]);return e.useEffect((()=>()=>{window.clearTimeout(n.current)}),[]),[s,l,c]}const we=({session:a,isOpen:i,flowSession:u,checklistSession:b})=>{const p=d(),{t:k}=D(),{company:v}=a.flow,{version:g}=a,y=g.resourceCenter,M=N(g.theme),A=a.locale?a.locale.standardLocaleId:a.version.theme.languageId;e.useEffect((()=>{m.changeLanguage(A)}),[A]);const{loaded:O}=_(window,j,M),[z,U]=e.useState(!1),q=O&&z,[Q,G]=e.useState(S()),Z=e.useCallback((()=>{G(S())}),[]);I(Z);const{zIndex:Y,bringToFront:J}=f(),X=e.useRef(null),[ee,te]=e.useState(null),[re,se]=e.useState(null),[oe,ne]=e.useState(null),ce=e.useRef(null),[le,ae]=e.useState(null),[ie,de]=e.useState(null),[me,fe]=e.useState(null),[we,be]=e.useState(0),[pe,Ce]=e.useState(0),Se=e.useCallback((()=>{re&&be(re.offsetWidth),Ce((oe?.offsetHeight||0)+(le?.offsetHeight||0)+(ie?.offsetHeight||0)+(me?.offsetHeight||0))}),[re,oe,le,ie,me]);e.useLayoutEffect((()=>{if(!ee||"function"!=typeof C)return;const e=new C((()=>{Se()}));return e.observe(ee,{childList:!0,attributes:!0,subtree:!0}),()=>{e.disconnect()}}),[ee,Se]),e.useLayoutEffect((()=>{Se()}));const[Ne,Ie]=e.useState(!1),Te=e.useRef(),Re=e.useCallback((()=>{Ie(!0),window.clearTimeout(Te.current),Te.current=window.setTimeout((()=>{Ie(!1)}),M.resourceCenterTransitionDuration)}),[M.resourceCenterTransitionDuration]);e.useEffect((()=>()=>{window.clearTimeout(Te.current)}),[]);const Le=e.useCallback((()=>{J(),Re(),p.openResourceCenter()}),[J,p,Re]),Be=e.useCallback((()=>{Re(),p.closeResourceCenter()}),[p,Re]),[He,Me]=e.useState(!1);e.useEffect((()=>{if(He){if(i){const e='button:not([tabindex="-1"]), [tabindex]:not([tabindex="-1"]), input, textarea';let t=le?.querySelector(e)||oe?.querySelector(e);if(t){const e=t.closest&&t.closest(".userflowjs-resource-center-checklist")||null;e?H(e):t.focus({preventScroll:!0})}}else re?.focus({preventScroll:!0});Me(!1)}}),[He,i,le,oe,re]),e.useEffect((()=>{const e=ee?.ownerDocument.defaultView;if(!i||!e)return;const t=e=>{"Escape"===e.key&&(Be(),Me(!0))};return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)}),[i,ee,Me,Be]);const[We,Fe]=e.useState(null),Pe=e.useCallback(((e,t)=>{Fe(e),0===t?.detail&&Me(!0)}),[]);e.useEffect((()=>{i||Pe(null)}),[i,Pe]);const $e=e.useMemo((()=>y.blocks.filter((e=>!(e.type===t.CHECKLIST&&!b)&&(!e.hiddenWhenFlowsActive||!e.hiddenWhenFlowsActive.some((e=>e===u?.flow.id||e===b?.flow.id)))))),[y,u,b]),Ae=e.useMemo((()=>he($e)),[$e]),Oe=e.useMemo((()=>b&&y.blocks.some((e=>e.type===t.CHECKLIST))?s(b):0),[y,b]),ze=e.useMemo((()=>y.blocks.find((e=>e.type===t.CONTACT&&e.chatEnabled&&e.chatProvider))),[y]),[Ue,qe]=e.useState(!1),De=e.useCallback((()=>{p.closeResourceCenter(),ze&&ze.chatProvider!==r.CUSTOM&&qe(!0)}),[p,ze]),Ke=e.useCallback((()=>{qe(!1)}),[]),Qe=e.useCallback((()=>{if(ze)try{V[ze.chatProvider].hide({block:ze}),Ke()}catch(e){console.error(`Userflow.js: Error when hiding ${ze.chatProvider}:`,e)}}),[ze,Ke]);e.useEffect((()=>{if(!ze)return;o.autoHide3pDisabled=!0;const e=V[ze.chatProvider];try{const t=e.configure({block:ze,onShow:De,onHide:Ke});return()=>{t()}}catch(t){return void console.error(`Userflow.js: Error when configuring ${ze.chatProvider}:`,t)}}),[ze,De,Ke]),e.useEffect((()=>{i&&Qe()}),[Qe,i]);const Ve=!!We&&("search"===We.kind||"flows"===We.kind||"knowledgeBase"===We.kind),Ge={zIndex:null!=M.resourceCenterZIndex?M.resourceCenterZIndex:i?Y:w(h),width:i?void 0:we+"px",height:i?Math.min(Ve?540:pe,Q-2*M.resourceCenterPaddingY)+"px":void 0,position:q?void 0:"absolute",visibility:q&&!Ue?void 0:"hidden"},Ze=M.resourceCenterDisplayChecklistProgress&&b&&Oe>0?e.createElement("div",{"data-testid":"resource-center-launcher-badge",className:"userflowjs-resource-center-launcher-badge"},Oe,e.createElement("div",{className:"userflowjs-a11y-only"},"uncompleted tasks")):null;let Ye="",Je="";return M.resourceCenterLauncherTextMode===n.CHECKLIST_OVERRIDE&&b&&Oe>0?Ye=b.version.checklist?.launcherText||"Get Started":M.resourceCenterLauncherTextMode!==n.NONE&&(Je=y.buttonText),e.createElement("div",{"data-testid":"resource-center-app",className:"userflowjs-resource-center userflowjs-theme-root",style:x(M),dir:m.dir()},e.createElement(T,{elRef:X,className:L({"userflowjs-resource-center-frame":!0,"userflowjs-resource-center-frame--fixed":!0,[`userflowjs-resource-center-frame--placement-${M.resourceCenterPlacement.toLowerCase().replace(/_/g,"-")}`]:!0,"userflowjs-resource-center-frame--animating":Ne,"userflowjs-resource-center-frame--open":i,"userflowjs-resource-center-frame--closed":!i}),style:{...Ge},stylesheetUrl:E,theme:M,onStylesheetsLoad:U},q&&e.createElement(e.Fragment,null,e.createElement("div",{ref:te,className:L({"userflowjs-resource-center-frame-root":!0,[`userflowjs-resource-center-frame-root--placement-${M.resourceCenterPlacement.toLowerCase().replace(/_/g,"-")}`]:!0,"userflowjs-resource-center-frame-root--animating":Ne,"userflowjs-resource-center-frame-root--open":i,"userflowjs-resource-center-frame-root--closed":!i}),dir:m.dir(),role:i?"dialog":void 0,"aria-label":i?y.headerText:void 0},e.createElement("div",{className:"userflowjs-resource-center-launcher-container"},e.createElement("button",{ref:se,className:"userflowjs-resource-center-launcher-button",onClick:e=>{Le(),0===e.detail&&Me(!0)},"aria-label":`Open ${y.headerText}`},Ze,Ye&&e.createElement("div",{"data-testid":"resource-center-launcher-text",className:"userflowjs-resource-center-launcher-text"},Ye),(Ze||Ye)&&e.createElement("div",{className:"userflowjs-resource-center-launcher-divider"}),Je&&e.createElement("div",{"data-testid":"resource-center-launcher-text",className:"userflowjs-resource-center-launcher-text"},Je),e.createElement("div",{className:"userflowjs-resource-center-launcher-icon"},M.resourceCenterLauncherIconType===c.PLAINTEXT?"?":e.createElement(ue,null)))),e.createElement("div",{ref:ce,className:"userflowjs-resource-center-body"},e.createElement("div",{ref:ae,className:L({"userflowjs-resource-center-body-content":!0,"userflowjs-resource-center-body-content--same-background":M.sameBackground,"userflowjs-resource-center-body-content--with-made-with-userflow":v.resourceCenterBranding})},i&&e.createElement(e.Fragment,null,We?"search"===We.kind?e.createElement(ke,{session:a,navigate:Pe}):"email"===We.kind?e.createElement(ve,{block:We.block,session:a}):"phone"===We.kind?e.createElement(ge,{block:We.block,session:a}):"flows"===We.kind?e.createElement(je,{block:We.block,initialQ:We.initialQ,session:a,navigate:Pe}):"knowledgeBase"===We.kind?e.createElement(ye,{block:We.block,initialQ:We.initialQ,session:a,bodyRef:ce}):"subpage"===We.kind?e.createElement(_e,{block:We.block,session:a}):null:e.createElement(e.Fragment,null,$e.map(((t,r)=>{const s=Ee[t.type],o=$e[r+1];return s?e.createElement(e.Fragment,{key:t.id},e.createElement(s.View,{session:a,flowSession:u,checklistSession:b,block:t,navigate:Pe,onChatShow:De}),o&&(n=t.type,c=o.type,K(n)||K(c))&&e.createElement("div",{className:"userflowjs-resource-center-divider"})):null;var n,c})))))),v.resourceCenterBranding&&e.createElement("div",{className:"userflowjs-resource-center-made-with-userflow"},e.createElement("div",{className:"userflowjs-resource-center-made-with-userflow-content",ref:de},e.createElement("a",{href:"https://userflow.com/?utm_source=made-with-userflow&utm_medium=link&utm_campaign=made-with-userflow-"+v.slug+"&utm_content=resource-center",target:"_blank",rel:"noopener noreferrer"},e.createElement(R,null),e.createElement("div",null,"Made with Userflow")))),a.draftMode&&e.createElement("div",{className:"userflowjs-resource-center-preview"},e.createElement("div",{ref:fe,className:"userflowjs-resource-center-preview-content"},e.createElement("div",{className:"userflowjs-resource-center-preview-text"},"Preview"),e.createElement("button",{className:"userflowjs-resource-center-preview-button",onClick:()=>{p.endFlow(a,{endReason:l.USER_CLOSED})}},e.createElement(B,{icon:W})))),e.createElement("div",{className:"userflowjs-resource-center-header"},e.createElement("div",{ref:ne,className:"userflowjs-resource-center-header-content"},null==We?e.createElement("div",{className:"userflowjs-resource-center-header-text"},y.headerText):e.createElement("button",{className:"userflowjs-resource-center-icon-button",onClick:e=>Pe(null,e)},e.createElement("div",{className:"userflowjs-rtl-mirrored"},e.createElement(B,{icon:F})),e.createElement("div",{className:"userflowjs-resource-center-icon-button__text"},k("resource_center.back"))),e.createElement("div",{className:"flex-1"}),Ae.length>0&&e.createElement("button",{className:"userflowjs-resource-center-icon-button",onClick:()=>{let e={kind:"search"};if(1===Ae.length){const t=Ae[0],r=Ee[t.type];r.routeTo&&(e=r.routeTo({block:t}))}"search"===We?.kind?Pe(null):(xe(p,a,null,"Search icon"),Pe(e))},"aria-label":"Search"},e.createElement(B,{icon:P})),e.createElement("button",{className:"userflowjs-resource-center-icon-button userflowjs-resource-center-close-button",onClick:e=>{Be(),0===e.detail&&Me(!0)},"aria-label":`Close ${y.headerText}`},e.createElement(B,{icon:$}))))))))};function he(e){return e.filter((e=>{const t=Ee[e.type];return t.isSearchable?t.isSearchable(e):!!t.search}))}const Ee={[t.ACTION]:{View:t=>{const{block:r,session:s,flowSession:o,checklistSession:n}=t,c=d(),[l,i]=e.useState(!1),u=o?.id,m=n?.id;return e.useEffect((()=>{i(!1)}),[u,m]),e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:l?void 0:()=>{xe(c,s,r);const e=r.actions.find((e=>e.type===a.START_FLOW));if(e){e.otherFlow?.id!==n?.flow.id&&i(!0)}else c.closeResourceCenter();b(c,s,r.actions)},disabled:l},e.createElement(be,{...t}),e.createElement(pe,{...t}),l&&e.createElement(de,null))}},[t.CHECKLIST]:{View:({checklistSession:t})=>e.createElement("div",{"data-testid":"resource-center-checklist",className:"userflowjs-resource-center-checklist"},e.createElement(M,{session:t}),e.createElement(p,{draftMode:!!t.draftMode&&"CHECKLIST PREVIEW"}))},[t.CONTACT]:{View:t=>{const{block:r,session:s,navigate:o,onChatShow:n}=t,c=d(),l=[];return r.emailEnabled&&l.push({icon:z,label:"Email",isRoute:!0,onClick:e=>{xe(c,s,r,"Email"),o({kind:"email",block:r},e)}}),r.phoneEnabled&&l.push({icon:U,label:"Phone",isRoute:!0,onClick:e=>{xe(c,s,r,"Phone"),o({kind:"phone",block:r},e)}}),r.chatEnabled&&l.push({icon:q,label:"Live-chat",isRoute:!1,onClick:()=>{if(xe(c,s,r,"Chat"),r.chatProvider){const t=V[r.chatProvider];try{t.show({block:r})}catch(e){console.error(`Userflow.js: Error when showing ${r.chatProvider}:`,e)}n()}else s.draftMode&&window.alert("You have not selected a chat provider. Go to the resource center builder in Userflow. Click the Contact block. Pick a chat provider in the side panel.")}}),e.createElement("div",{className:L({"userflowjs-resource-center-block":!0,"userflowjs-resource-center-block--clickable":1===l.length}),onClick:1===l.length?l[0].onClick:void 0},1===l.length&&e.createElement("div",{className:"userflowjs-resource-center-block-icon"},e.createElement(B,{icon:l[0].icon})),e.createElement(pe,{...t}),l.length>1&&l.map((({icon:t,label:r,onClick:s},o)=>e.createElement("button",{key:o,className:"userflowjs-resource-center-icon-button",onClick:s,"aria-label":r},e.createElement(B,{icon:t})))),1===l.length&&l[0].isRoute&&e.createElement("div",{className:"userflowjs-resource-center-block-nav-icon"},e.createElement(B,{icon:A})))}},[t.FLOWS]:{View:t=>{const{block:r,session:s,navigate:o}=t,n=d();return e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:e=>{xe(n,s,r),o({kind:"flows",block:r},e)}},e.createElement(be,{...t}),e.createElement(pe,{...t}),e.createElement("div",{className:"userflowjs-resource-center-block-nav-icon"},e.createElement(B,{icon:A})))},routeTo:({block:e,initialQ:t})=>({kind:"flows",block:e,initialQ:t}),isSearchable:e=>!!e.searchEnabled,search:async({client:e,session:t,block:r,q:s})=>{const{flows:o}=await e.send({kind:"ListResourceCenterBlockFlows",sessionId:t.id,blockCvid:r.cvid},{handlesRejection:!0}),n=Ce(o,s),c=n.slice(0,5);return{block:r,truncated:c.length===n.length,results:c.map((e=>({kind:"flow",flow:e})))}}},[t.KNOWLEDGE_BASE]:{View:t=>{const{block:r,session:s,navigate:o}=t,n=d();return e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:e=>{xe(n,s,r),o({kind:"knowledgeBase",block:r},e)}},e.createElement(be,{...t}),e.createElement(pe,{...t}),e.createElement("div",{className:"userflowjs-resource-center-block-nav-icon"},e.createElement(B,{icon:A})))},routeTo:({block:e,initialQ:t})=>({kind:"knowledgeBase",block:e,initialQ:t}),search:async({client:e,session:t,block:r,q:s})=>{const{truncated:o,articles:n}=await e.send({kind:"SearchKnowledgeBase",sessionId:t.id,blockCvid:r.cvid,q:s,offset:0,limit:5},{handlesRejection:!0});return{block:r,truncated:o,results:n.map((e=>({kind:"article",article:e})))}}},[t.MESSAGE]:{View:({block:t,session:r})=>e.createElement("div",{className:"userflowjs-resource-center-block"},e.createElement("div",{className:"userflowjs-resource-center-block-text userflowjs-bubble-content"},e.createElement(k,{doc:t.content,lookupAttribute:y(r.data)})))},[t.SUBPAGE]:{View:t=>{const{block:r,session:s,navigate:o}=t,n=d();return e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:e=>{xe(n,s,r),o({kind:"subpage",block:r},e)}},e.createElement(be,{...t}),e.createElement(pe,{...t}),e.createElement("div",{className:"userflowjs-resource-center-block-nav-icon"},e.createElement(B,{icon:A})))}}},be=({block:t})=>t.icon?e.createElement("div",{className:"userflowjs-resource-center-block-icon"},e.createElement(B,{icon:t.icon,size:16})):null,pe=({block:t,session:r})=>e.createElement("div",{className:"userflowjs-resource-center-block-text"},e.createElement(v,{doc:t.name,lookupAttribute:y(r.data)})),ke=({session:t,navigate:r})=>{const s=d(),o=t.version.resourceCenter.blocks,n=he(o),{t:c}=D(),l=e.useRef(null),[a,i]=e.useState(""),[u,m]=fe(a,i),[f,w]=e.useState(null);return e.useEffect((()=>{if(""===a.trim())return void w(null);let e=!1;return(async()=>{w(null);const r=await Promise.all(o.map((async e=>{const{search:r}=Ee[e.type];if(!r)return null;try{return await r({client:s,session:t,block:e,q:a})}catch(o){return console.error(`Userflow.js: Global search failed for ${e.type} block=`,e,"error=",o),null}})));e||w(r.filter((e=>null!=e&&e.results.length>0)))})(),()=>{e=!0}}),[s,t,o,a]),e.useEffect((()=>{l.current?.focus({preventScroll:!0})}),[]),e.createElement(e.Fragment,null,e.createElement("div",{className:"userflowjs-resource-center-list-route-search"},e.createElement("input",{ref:l,className:"userflowjs-text-input",type:"text",value:u,onChange:e=>m(e.target.value),placeholder:c("resource_center.search_placeholder")})),""===a.trim()?e.createElement("div",{"data-testid":"resource-center-empty-query",className:"userflowjs-resource-center-list-route-error"},c("resource_center.search_in")," ",n.map(((r,s)=>e.createElement(e.Fragment,{key:r.cvid},s>0&&(s===n.length-1?` ${c("and")} `:", "),e.createElement("b",null,e.createElement(v,{doc:r.name,lookupAttribute:y(t.data)}))))),"."):f?0===f.length?e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},c("resource_center.no_results_found")):f.map((({block:o,truncated:n,results:l},i)=>{const u=Ee[o.type],d=u.routeTo&&u.routeTo({block:o,initialQ:a});return e.createElement(e.Fragment,{key:o.cvid},i>0&&e.createElement("div",{className:"userflowjs-resource-center-divider"}),e.createElement("div",{className:"userflowjs-resource-center-label"},e.createElement(v,{doc:o.name,lookupAttribute:y(t.data)})),l.map(((s,n)=>"flow"===s.kind?e.createElement(Se,{key:s.flow.id,block:o,session:t,flow:s.flow,navigate:r}):"article"===s.kind?e.createElement(Ne,{key:n,block:o,session:t,article:s.article}):null)),!n&&d&&e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:e=>{xe(s,t,o),r(d,e)}},e.createElement("div",{className:"userflowjs-resource-center-block-text"},c("more"),":"," ",e.createElement(v,{doc:o.name,lookupAttribute:y(t.data)})),e.createElement("div",{className:"userflowjs-resource-center-block-nav-icon"},e.createElement(B,{icon:A}))))})):e.createElement("div",{className:"userflowjs-resource-center-list-route-spinner"},e.createElement(de,null)))},ve=({block:t,session:r})=>e.createElement("div",{className:"userflowjs-resource-center-content-route userflowjs-bubble-content"},e.createElement(k,{doc:t.emailContent,lookupAttribute:y(r.data)})),ge=({block:t,session:r})=>e.createElement("div",{className:"userflowjs-resource-center-content-route userflowjs-bubble-content"},e.createElement(k,{doc:t.phoneContent,lookupAttribute:y(r.data)})),je=({block:t,initialQ:r,session:s,navigate:o})=>{const{t:n}=D(),c=e.useRef(null),[l,a]=e.useState(r||""),[i,u]=fe(l,a),{data:d,error:m}=me({kind:"ListResourceCenterBlockFlows",sessionId:s.id,blockCvid:t.cvid}),f=d?.flows,w=e.useMemo((()=>f?Ce(f,l):null),[f,l]);return e.useEffect((()=>{c.current?.focus({preventScroll:!0})}),[]),e.createElement(e.Fragment,null,e.createElement("div",{className:"userflowjs-resource-center-list-route-header"},e.createElement("div",{className:"userflowjs-resource-center-list-route-title"},e.createElement(v,{doc:t.name,lookupAttribute:y(s.data)}))),t.searchEnabled&&e.createElement("div",{className:"userflowjs-resource-center-list-route-search"},e.createElement("input",{ref:c,className:"userflowjs-text-input",type:"text",value:i,onChange:e=>u(e.target.value),placeholder:n("resource_center.search_placeholder")})),m?e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},n("resource_center.generic_error")):w?0===w.length?e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},n("resource_center.no_results_found")):w.map((r=>e.createElement(Se,{key:r.id,block:t,session:s,flow:r,navigate:o}))):e.createElement("div",{className:"userflowjs-resource-center-list-route-spinner"},e.createElement(de,null)))};function Ce(e,t){const r=t.toLowerCase().trim();return""===r?e:e.filter((e=>e.name.toLowerCase().includes(r)))}const Se=({block:t,session:r,flow:s,navigate:o})=>{const n=d(),[c,l]=e.useState(!1);return e.useEffect((()=>{if(!c||s.type!==i.CHECKLIST)return;const e=()=>{n.checklistSession?.flow.id===s.id&&(t(),o(null))},t=()=>{n.off("checklistChanged",e)};return n.on("checklistChanged",e),t}),[n,c,s.type,s.id,o]),e.createElement("button",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:()=>{xe(n,r,t,s.name),n.startFlow({flowId:s.id,startReason:u.RESOURCE_CENTER,replaceCurrent:!0}),l(!0)},disabled:c},e.createElement("div",{className:"userflowjs-resource-center-block-icon"},e.createElement(B,{icon:s.type===i.CHECKLIST?"regular/tasks":"regular/shoe-prints",size:16})),e.createElement("div",{className:"userflowjs-resource-center-block-text"},s.name),c&&e.createElement(de,null))},ye=({block:t,initialQ:r,session:s,bodyRef:o})=>{const{t:n}=D(),c=e.useRef(null),[l,a]=e.useState(r||""),[i,u]=fe(l,a),{loading:d,loadingMore:m,data:f,messageForData:w,error:h,loadMore:E}=me({kind:"SearchKnowledgeBase",sessionId:s.id,blockCvid:t.cvid,q:l,offset:0}),b=f?.truncated,p=e.useCallback((()=>{E(((e,t)=>({...t,offset:e.articles.length})),((e,t)=>({...t,articles:[...e.articles,...t.articles]})))}),[E]);e.useEffect((()=>{const e=o.current;if(!e||d||m||b)return;const t=()=>{e.scrollHeight-e.clientHeight-e.scrollTop>400||p()};return e.addEventListener("scroll",t),()=>{e.removeEventListener("scroll",t)}}),[o,d,m,b,p]),e.useEffect((()=>{c.current?.focus({preventScroll:!0})}),[]);let k=t.knowledgeBaseUrl||"";return k.match(/^https?:\/\//)||(k=`http://${k}`),e.createElement(e.Fragment,null,e.createElement("div",{className:"userflowjs-resource-center-list-route-header"},e.createElement("div",{className:"userflowjs-resource-center-list-route-title"},e.createElement(v,{doc:t.name,lookupAttribute:y(s.data)})),e.createElement("a",{className:"userflowjs-resource-center-icon-button",href:k,target:"_blank",rel:"noopener noreferrer"},e.createElement(B,{icon:O}))),e.createElement("div",{className:"userflowjs-resource-center-list-route-search"},e.createElement("input",{ref:c,className:"userflowjs-text-input",type:"text",value:i,onChange:e=>u(e.target.value),placeholder:n("resource_center.search_placeholder")})),h?e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},"quota_exceeded"===h.code?"Sorry, this company has reached its max number of searches. Consider asking Userflow to be moved to a dedicated search engine for a higher quota.":n("resource_center.generic_error")):d||!f?e.createElement("div",{className:"userflowjs-resource-center-list-route-spinner"},e.createElement(de,null)):0===f.articles.length?""===w?.q?null:e.createElement("div",{className:"userflowjs-resource-center-list-route-error"},n("resource_center.no_results_found")):e.createElement(e.Fragment,null,""===w?.q&&e.createElement("div",{className:"userflowjs-resource-center-label"},n("resource_center.suggested_articles")),f.articles.map(((r,o)=>e.createElement(Ne,{key:o,block:t,session:s,article:r}))),m&&e.createElement("div",{className:"userflowjs-resource-center-list-route-spinner"},e.createElement(de,null))))},Ne=({block:t,article:r,session:s})=>{const o=d();return e.createElement("a",{className:"userflowjs-resource-center-block userflowjs-resource-center-block--clickable",onClick:()=>{xe(o,s,t,r.title)},href:r.url,target:"_blank",rel:"noopener noreferrer"},e.createElement("div",{className:"userflowjs-resource-center-block-icon"},e.createElement(B,{icon:"regular/file-alt",size:16})),e.createElement("div",{className:"userflowjs-resource-center-block-text"},e.createElement("span",{dangerouslySetInnerHTML:{__html:r.htmlTitle}}),e.createElement("div",{className:"userflowjs-resource-center-block-subtext",dangerouslySetInnerHTML:{__html:r.htmlSnippet}})))},_e=({block:t,session:r})=>e.createElement("div",{className:"userflowjs-resource-center-content-route userflowjs-bubble-content"},e.createElement(k,{doc:t.content,lookupAttribute:y(r.data)}));function xe(e,t,r,s){e.send({kind:"ClickResourceCenter",sessionId:t.id,description:r?g(r.name,{lookupAttribute:y(t.data)})+(s?` - ${s}`:""):s},{batch:!0})}export default we;export{we as ResourceCenterApp};
|
package/logomark.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./vendor.react.js";import{r as t}from"./vendor.react-dom.js";import{g as s,a,c as r}from"./stylesheets.js";var n=new URL("iframe-reset.css",import.meta.url).href;const o=({testId:t,className:o,style:
|
|
1
|
+
import{r as e}from"./vendor.react.js";import{r as t}from"./vendor.react-dom.js";import{g as s,a,c as r}from"./stylesheets.js";var n=new URL("iframe-reset.css",import.meta.url).href;const o=({testId:t,className:o,style:d,elRef:c,stylesheetUrl:m,theme:f,onStylesheetsLoad:u,noIframe:h,ariaHidden:y,children:w})=>{h=h||!1;const[v,p]=e.useState(null),E=f&&"userflowjs-theme-root",N=f&&s(f),{loaded:L}=a(v,h?null:n),{loaded:R}=a(v,m,f),{loaded:C}=r(v,f),I=f?.cssVersion?`https://cdn.userflow.com/themes/${f.id}/stylesheets/${f.cssVersion}/custom.css`:null,{loaded:S}=a(v,I,f);return e.useEffect((()=>{u&&L&&R&&C&&S&&u(!0)}),[u,L,R,C,S]),h?e.createElement(i,{testId:t,className:o,style:d,rootClassName:E,rootStyle:N,elRef:c,onWinReady:p,ariaHidden:y},w):e.createElement(l,{testId:t,className:o,style:d,rootClassName:E,rootStyle:N,elRef:c,onWinReady:p,ariaHidden:y},w)},l=({testId:s,className:a,style:r,rootClassName:n,rootStyle:o,elRef:l,onWinReady:i,ariaHidden:d,children:c})=>{const[m,f]=e.useState(null);e.useLayoutEffect((()=>{if(!m)return;const{body:e}=m.document,t=n&&n.split(" ");if(t&&e.classList.add(...t),o)for(const s in o)e.style.setProperty(s,o[s]);return()=>{t&&e.classList.remove(...t)}}),[m,n,o]);return e.createElement("iframe",{ref:e=>{if(!e)return;l&&(l.current=e);const t=e.contentWindow;if(t===m)return;const s=e=>{f(e),i(e)};"complete"===t.document.readyState?s(t):t.addEventListener("load",(()=>{s(t)}))},"data-testid":s,role:"presentation","aria-hidden":d?"true":void 0,tabIndex:d?-1:void 0,className:a,style:r,frameBorder:0,bis_size:"{}"},m&&t.createPortal(c,m.document.body))},i=({testId:t,className:s,style:a,rootClassName:r,rootStyle:n,elRef:o,onWinReady:l,ariaHidden:i,children:d})=>(e.useEffect((()=>{l(window)}),[l]),e.createElement("div",{ref:o,"data-testid":t,"aria-hidden":i?"true":void 0,tabIndex:i?-1:void 0,className:s+(r?` ${r}`:""),style:{...n,...a}},d));function d(t){e.useLayoutEffect((()=>{let e;const s=()=>{window.cancelAnimationFrame(e),e=window.requestAnimationFrame(t)};return window.addEventListener("resize",s),()=>{window.removeEventListener("resize",s),window.cancelAnimationFrame(e)}}),[t])}function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e}).apply(this,arguments)}var m=({styles:t={},...s})=>e.createElement("svg",c({xmlns:"http://www.w3.org/2000/svg",width:"100",height:"100",fill:"none",viewBox:"0 0 100 100"},s),e.createElement("path",{fill:"#5488F0",d:"M87.668 30.37h-4.004l-6.097 34.57c-1.442 8.18-9.26 14.82-17.45 14.82h-36.09l-.951 5.43C21.624 93.37 27.08 100 35.289 100h40.045c8.19 0 16.018-6.63 17.45-14.81l7.008-40c1.531-8.18-3.935-14.82-12.124-14.82z"}),e.createElement("path",{fill:"#00E673",d:"M61.539 30.37l-1.652 9.37c-1.762 10-11.293 18-21.244 18h-8.159c-10.011 0-16.628-8.09-14.877-18l3.314-18.77h9.42l-3.313 18.77a6.992 6.992 0 001.405 6.088 7.006 7.006 0 005.713 2.542h8.16a10.77 10.77 0 006.58-2.553 10.748 10.748 0 003.58-6.077l2.483-14.07a5.849 5.849 0 015.537-4.7h17.43l1.08-6.15C78.448 6.63 72.992 0 64.783 0H24.738C16.548 0 8.72 6.63 7.288 14.82l-7.008 40C-1.16 63 4.285 69.63 12.494 69.63h40.045c8.199 0 16.018-6.63 17.45-14.81l4.314-24.45H61.54z"}));export{o as F,m as L,d as u};
|
package/package.json
CHANGED
package/userflow.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as e}from"./vendor.phoenix.js";import{v as t}from"./vendor.uuid.js";let s;const i={},n=function(e,t){if(!t)return e();if(void 0===s){const e=document.createElement("link").relList;s=e&&e.supports&&e.supports("modulepreload")?"modulepreload":"preload"}return Promise.all(t.map((e=>{if(e in i)return;i[e]=!0;const t=e.endsWith(".css"),n=t?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${e}"]${n}`))return;const o=document.createElement("link");return o.rel=t?"stylesheet":s,t||(o.as="script",o.crossOrigin=""),o.href=e,document.head.appendChild(o),t?new Promise(((e,t)=>{o.addEventListener("load",e),o.addEventListener("error",t)})):void 0}))).then((()=>e()))};class o extends Error{constructor(e,t){super(e),Object.setPrototypeOf(this,o.prototype),this.name="UserflowError",this.code=t}}class r{constructor(e){this.type=e,this.testState={}}formatKey(e){return`userflow:${e}`}getItem(e){return e=this.formatKey(e),"undefined"==typeof window?null:window[this.type].getItem(e)}setItem(e,t){e=this.formatKey(e),"undefined"!=typeof window&&window[this.type].setItem(e,t)}removeItem(e){if(e=this.formatKey(e),"undefined"!=typeof window)return window[this.type].removeItem(e)}clear(){if("undefined"!=typeof window)return window[this.type].clear()}}const a=new r("localStorage"),c=new r("sessionStorage");function l(e){window.location.href=e}function d(){return window.location.href}var h,u,f;function E(e,t,{toOrigin:s}={}){e.postMessage(t,s||"*")}function T(e,{fromWindow:t,fromOrigin:s}={}){const i=i=>{if(!i.isTrusted)return;if(t&&t!==i.source)return;if(s&&i.origin!==s)return;const o=i.data;o&&"object"==typeof o&&"string"==typeof o.kind&&o.kind.startsWith("userflow:")&&!0===e(o)&&n()};window.addEventListener("message",i);const n=()=>window.removeEventListener("message",i);return n}(h||(h={})).INPUT="INPUT",(f=u||(u={})).AUTO="AUTO",f.MANUAL="MANUAL";const w=new Set;let S=!1;function p(e){return function(){if(S)return;S=!0;const{history:e}=window,t=t=>{const s=e[t];e[t]=(...t)=>{s.apply(e,t),C()}};t("pushState"),t("replaceState"),window.addEventListener("popstate",(()=>{C()}))}(),w.add(e),()=>{g(e)}}function g(e){w.delete(e)}function C(){w.forEach((e=>e()))}class m{destroy(){this.unregisterOnMessage&&this.unregisterOnMessage()}postBuilderMessage(e){E(window.opener,e,{toOrigin:"https://userflow.com"})}onBuilderMessage(e){return this.unregisterOnMessage=T(e,{fromOrigin:"https://userflow.com"}),!1}async captureScreenshot(e,t,s,i){E(window,{kind:"userflow:crxScreenshot",x:e,y:t,width:s,height:i,devicePixelRatio:window.devicePixelRatio});var n;return(await(n=e=>"userflow:crxScreenshotResult"===e.kind?e:null,new Promise((e=>{T((t=>{const s=n(t);return!!s&&(e(s),!0)}))})))).imageDataUrl}}var I,k,U,A,L,y,R,O,v,N,_,b,D,F,M,P,B,x,H,G,W,$,V,j,K,z,Y,J,X,Q,Z,q,ee,te,se,ie,ne,oe,re,ae,ce,le,de,he,ue,fe,Ee,Te,we,Se,pe,ge,Ce,me,Ie,ke,Ue,Ae,Le,ye,Re,Oe,ve,Ne,_e,be,De,Fe,Me,Pe;(k=I||(I={})).ACTION="ACTION",k.LAUNCHER_DEACTIVATED="LAUNCHER_DEACTIVATED",k.REPLACED="REPLACED",k.SNOOZED="SNOOZED",k.TOOLTIP_TARGET_MISSING="TOOLTIP_TARGET_MISSING",k.USERFLOWJS="USERFLOWJS",k.USER_CLOSED="USER_CLOSED",(A=U||(U={})).SECOND="SECOND",A.MINUTE="MINUTE",A.HOUR="HOUR",A.DAY="DAY",(y=L||(L={})).ACTION="ACTION",y.DRAFT="DRAFT",y.LINK="LINK",y.LAUNCHER_SEEN="LAUNCHER_SEEN",y.RESOURCE_CENTER="RESOURCE_CENTER",y.USERFLOWJS="USERFLOWJS",(O=R||(R={})).STRING="STRING",O.BOOLEAN="BOOLEAN",O.NUMBER="NUMBER",O.DATETIME="DATETIME",O.LIST="LIST",(N=v||(v={})).FLOW="FLOW",N.CHECKLIST="CHECKLIST",N.LAUNCHER="LAUNCHER",N.RESOURCE_CENTER="RESOURCE_CENTER",(b=_||(_={})).ALWAYS_TRUE="ALWAYS_TRUE",b.ATTRIBUTE="ATTRIBUTE",b.CLAUSE="CLAUSE",b.ELEMENT="ELEMENT",b.FILLED_IN_INPUT="FILLED_IN_INPUT",b.FLOW="FLOW",b.INPUT_VALUE="INPUT_VALUE",b.PAGE="PAGE",b.TIME="TIME",function(e){e.AUTO="AUTO",e.MANUAL="MANUAL"}(D||(D={})),(F||(F={})).INPUT="INPUT",(P=M||(M={})).ABSOLUTE_EQ="ABSOLUTE_EQ",P.ABSOLUTE_GT="ABSOLUTE_GT",P.ABSOLUTE_LT="ABSOLUTE_LT",P.AND="AND",P.CONTAINS="CONTAINS",P.EMPTY="EMPTY",P.ENDS_WITH="ENDS_WITH",P.EQ="EQ",P.EXCLUDES_ALL="EXCLUDES_ALL",P.EXCLUDES_ANY="EXCLUDES_ANY",P.FALSE="FALSE",P.GT="GT",P.INCLUDES_ALL="INCLUDES_ALL",P.INCLUDES_ANY="INCLUDES_ANY",P.LT="LT",P.NE="NE",P.NOT_CONTAINS="NOT_CONTAINS",P.NOT_EMPTY="NOT_EMPTY",P.NOT_REGEX="NOT_REGEX",P.OR="OR",P.REGEX="REGEX",P.RELATIVE_EQ="RELATIVE_EQ",P.RELATIVE_GT="RELATIVE_GT",P.RELATIVE_LT="RELATIVE_LT",P.STARTS_WITH="STARTS_WITH",P.TRUE="TRUE",P.URL="URL",(x=B||(B={})).CLICK="CLICK",x.DISABLED="DISABLED",x.MOUSEDOWN="MOUSEDOWN",x.NOT_CLICK="NOT_CLICK",x.NOT_DISABLED="NOT_DISABLED",x.NOT_PRESENT="NOT_PRESENT",x.PRESENT="PRESENT",(G=H||(H={})).ASSET="ASSET",G.CARTOON="CARTOON",G.NONE="NONE",G.URL="URL",($=W||(W={})).INSIDE="INSIDE",$.OUTSIDE="OUTSIDE",(j=V||(V={})).TOP_LEFT="TOP_LEFT",j.TOP_CENTER="TOP_CENTER",j.TOP_RIGHT="TOP_RIGHT",j.BOTTOM_RIGHT="BOTTOM_RIGHT",j.BOTTOM_CENTER="BOTTOM_CENTER",j.BOTTOM_LEFT="BOTTOM_LEFT",j.CENTER="CENTER",(z=K||(K={})).GOOGLE="GOOGLE",z.STANDARD="STANDARD",(J=Y||(Y={})).DISMISS_FIRST_MENU_AFTER="DISMISS_FIRST_MENU_AFTER",J.DISMISS="DISMISS",(Q=X||(X={})).DISMISS="DISMISS",Q.NONE="NONE",(q=Z||(Z={})).DEFAULT="DEFAULT",q.PLAINTEXT="PLAINTEXT",(te=ee||(ee={})).CHECKLIST_OVERRIDE="CHECKLIST_OVERRIDE",te.RESOURCE_CENTER_ONLY="RESOURCE_CENTER_ONLY",te.NONE="NONE",(ie=se||(se={})).BUBBLE="BUBBLE",ie.END="END",ie.ERROR="ERROR",ie.FLAG="FLAG",(oe=ne||(ne={})).MANUAL="MANUAL",oe.NONE="NONE",oe.SYNTHETIC="SYNTHETIC",(ae=re||(re={})).BUBBLE="BUBBLE",ae.HIDDEN="HIDDEN",ae.MODAL="MODAL",ae.TOOLTIP="TOOLTIP",(le=ce||(ce={})).ABOVE="ABOVE",le.BELOW="BELOW",le.LEFT="LEFT",le.RIGHT="RIGHT",(he=de||(de={})).CLOSE_FLOW="CLOSE_FLOW",he.EVAL_JS="EVAL_JS",he.GO_TO_STEP="GO_TO_STEP",he.NAVIGATE="NAVIGATE",he.SNOOZE="SNOOZE",he.START_FLOW="START_FLOW",(fe=ue||(ue={})).NEW_TAB="NEW_TAB",fe.SAME_TAB="SAME_TAB",(Te=Ee||(Ee={})).MULTILINE_TEXT="MULTILINE_TEXT",Te.MULTIPLE_CHOICE="MULTIPLE_CHOICE",Te.NPS="NPS",Te.SCALE="SCALE",Te.STARS="STARS",Te.TEXT="TEXT",(Se=we||(we={})).ACTION="ACTION",Se.CHECKLIST="CHECKLIST",Se.CONTACT="CONTACT",Se.FLOWS="FLOWS",Se.KNOWLEDGE_BASE="KNOWLEDGE_BASE",Se.MESSAGE="MESSAGE",Se.SUBPAGE="SUBPAGE",(ge=pe||(pe={})).CRISP="CRISP",ge.CUSTOM="CUSTOM",ge.FRESHCHAT="FRESHCHAT",ge.HELPSCOUT="HELPSCOUT",ge.HUBSPOT="HUBSPOT",ge.INTERCOM="INTERCOM",ge.ZENDESK="ZENDESK",ge.ZENDESK_MESSENGER="ZENDESK_MESSENGER",(me=Ce||(Ce={})).LAUNCHER_CLICK="LAUNCHER_CLICK",me.LAUNCHER_HOVER="LAUNCHER_HOVER",me.TARGET_CLICK="TARGET_CLICK",me.TARGET_HOVER="TARGET_HOVER",me.LAUNCHER_TARGET_CLICK="LAUNCHER_TARGET_CLICK",me.LAUNCHER_TARGET_HOVER="LAUNCHER_TARGET_HOVER",(ke=Ie||(Ie={})).ACTIVATE="ACTIVATE",ke.DEACTIVATE="DEACTIVATE",ke.NEVER="NEVER",(Ae=Ue||(Ue={})).AUTO="AUTO",Ae.TOP="TOP",Ae.RIGHT="RIGHT",Ae.BOTTOM="BOTTOM",Ae.LEFT="LEFT",(ye=Le||(Le={})).START="START",ye.CENTER="CENTER",ye.END="END",(Oe=Re||(Re={})).PERCENT="PERCENT",Oe.PX="PX",(Ne=ve||(ve={})).BEACON="BEACON",Ne.BUTTON="BUTTON",Ne.HIDDEN="HIDDEN",Ne.ICON="ICON",(be=_e||(_e={})).LAUNCHER="LAUNCHER",be.TARGET="TARGET",(Fe=De||(De={})).ACTIVE="ACTIVE",Fe.COMPLETED="COMPLETED",Fe.ENDED="ENDED",Fe.NOT_SEEN="NOT_SEEN",(Pe=Me||(Me={})).HIGHLIGHT="HIGHLIGHT",Pe.MODAL="MODAL",Pe.HIGHLIGHT_MODAL="HIGHLIGHT_MODAL";const Be={customInputs:[],customNavigate:null,urlFilter: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-")]};function xe(e){return Array.isArray(e)||(e=e?[e]:[]),e=e.map((e=>"string"==typeof e?new RegExp(e):e))}function He(e,t){return e.every((e=>"function"==typeof e?e(t):!(e instanceof RegExp)||e.test(t)))}function Ge(){let e=d();if(Be.urlFilter){if(e=Be.urlFilter(e),"string"!=typeof e)throw new o("Userflow.js: URL filter returned non-string value. Please check your userflow.setUrlFilter() implementation.");try{new URL(e)}catch(t){throw new o("Userflow.js: URL filter returned an invalid URL. Please check your userflow.setUrlFilter() implementation.\nReturned URL: "+e+"\nError message: "+t.message)}}return e}const We=(localStorage.getItem("debug")||"").split(",").some((e=>"*"===e||e.startsWith("userflow:*"))),$e=je("log");let Ve;function je(e){return function(t,...s){if(We){const i=performance.now(),n=Ve?Math.round(i-Ve):0;Ve=i,console[e](`%cuserflow %c${t} %c+${n}ms`,"color:#4579E4;","","color:#4579E4;",...s)}}}$e.group=je("group"),$e.groupCollapsed=je("groupCollapsed"),$e.groupEnd=function(){We&&console.groupEnd()};const Ke=()=>n((()=>import("./ResourceCenterApp.js")),[new URL("ResourceCenterApp.js",import.meta.url).toString(),new URL("vendor.react.js",import.meta.url).toString(),new URL("vendor.object-assign.js",import.meta.url).toString(),new URL("client-context.js",import.meta.url).toString(),new URL("vendor.i18next.js",import.meta.url).toString(),new URL("vendor.react-i18next.js",import.meta.url).toString(),new URL("vendor.babel.runtime.js",import.meta.url).toString(),new URL("Icons.js",import.meta.url).toString(),new URL("BubbleToolbar.js",import.meta.url).toString(),new URL("flow-condition-types.js",import.meta.url).toString(),new URL("vendor.date-fns.js",import.meta.url).toString(),new URL("stylesheets.js",import.meta.url).toString(),new URL("vendor.obj-str.js",import.meta.url).toString(),new URL("vendor.fortawesome.react-fontawesome.js",import.meta.url).toString(),new URL("vendor.fortawesome.fontawesome-svg-core.js",import.meta.url).toString(),new URL("vendor.prop-types.js",import.meta.url).toString(),new URL("vendor.fortawesome.pro-solid-svg-icons.js",import.meta.url).toString(),new URL("logomark.js",import.meta.url).toString(),new URL("vendor.react-dom.js",import.meta.url).toString(),new URL("vendor.scheduler.js",import.meta.url).toString(),new URL("DynamicIcon.js",import.meta.url).toString(),new URL("vendor.fortawesome.pro-regular-svg-icons.js",import.meta.url).toString(),new URL("ChecklistUI.js",import.meta.url).toString(),new URL("vendor.phoenix.js",import.meta.url).toString(),new URL("vendor.uuid.js",import.meta.url).toString()]);function ze(e){const t=e.version.checklist.tasks.length;return Math.max(0,t-e.taskCompletions.length)}class Ye{constructor(e){this.observers=new Set,this._value=e}get value(){return this._value}update(e){if(e!==this._value){this._value=e;for(const e of this.observers)e()}}observe(e){return this.observers.add(e),()=>this.observers.delete(e)}}const Je=import.meta.url;class Xe{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.featureFlags=new Set,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.resourceCenterSession=null,this.resourceCenterOpen=!1,this.resourceCenterLauncherHidden=!1,this.launcherSessions=[],this.activeLauncherFlowId=null,this.notifications=[],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.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.onBuilderMessage=e=>(this.handleBuilderMessage(e),!1),this.handleBuilderMessage=async e=>{$e(`builder ${e.kind} message received`,e);const t="idempotencyKey"in e&&"string"==typeof e.idempotencyKey?e.idempotencyKey:null;if(t&&this.idempotencyKeysSeen.has(t))return;const s=()=>{t&&this.idempotencyKeysSeen.add(t)};switch(e.kind){case"userflow:selectElement":return s(),this.getTargetEnv().postBuilderMessage({kind:"userflow:selectElementAck",idempotencyKey:e.idempotencyKey}),void this.setSessionStorageState((t=>({...t,activeApp:"elementSelection",elementSelection:{mode:"select",elementType:e.elementType}})));case"userflow:selectElementCancel":return void this.setSessionStorageState((e=>({...e,activeApp:null,elementSelection:null})));case"userflow:startFlowWithToken":return s(),this.getTargetEnv().postBuilderMessage({kind:"userflow:startFlowWithTokenAck",idempotencyKey:e.idempotencyKey}),e.testUser?this.identifyTestUser(e.testUser):this.resetTestUser(),void this.onceIdentified((()=>{if(this.startFlowWithToken(e.token),e.isResourceCenter){const t=()=>{const s=this.resourceCenterSession;s&&s.draftMode&&s.flow.id===e.flowId&&(this.openResourceCenter(),this.off("resourceCenterChanged",t))};this.on("resourceCenterChanged",t),t()}}));case"userflow:testTracker":return s(),this.getTargetEnv().postBuilderMessage({kind:"userflow:testTrackerAck",idempotencyKey:e.idempotencyKey}),e.testUser?this.identifyTestUser(e.testUser):this.resetTestUser(),void this.setSessionStorageState((t=>({...t,activeApp:"trackerTesting",trackerTesting:{trackerName:e.trackerName,token:e.token,events:0}})));case"userflow:testTrackerCancel":return void this.setSessionStorageState((e=>({...e,activeApp:null,trackerTesting:null})))}},this.onUrlChange=()=>{this.externalId&&(window.clearTimeout(this.flushUrlChangeTimeout),this.flushUrlChangeTimeout=window.setTimeout((()=>this.flushUrlChange()),50))},this.onUserActivity=()=>this.ensureConnected(),$e("constructor, build=2000002"),p(this.onUrlChange),this.setTargetEnv(new m),this.checkTestUserAtBoot(),this.toggleUI()}get socketStatus(){return this._socketStatus}destroy(){$e("destroy"),this.reset(),g(this.onUrlChange),this.destroyTargetEnv()}setTargetEnv(e){this.destroyTargetEnv(),this.targetEnv=e,e.onBuilderMessage(this.onBuilderMessage)}destroyTargetEnv(){this.targetEnv&&(this.targetEnv.destroy(),this.targetEnv=null)}getTargetEnv(){if(!this.targetEnv)throw new o("Userflow.js: Cannot call getTargetEnv when protocol is not set");return this.targetEnv}setSessionStorageState(e){const t=e(this.getSessionStorageState());c.setItem("userflowClientState",JSON.stringify(t)),this.sessionStorageState=t,this.toggleUI()}getSessionStorageState(){let e=this.sessionStorageState;if(!e){const s=c.getItem("userflowClientState");if(s)try{e=JSON.parse(s)}catch(t){console.error("Userflow.js: Parse ElementSelectionState error:",t)}e||(e={testUser:null,activeApp:null,elementSelection:null,trackerTesting:null})}return e}checkTestUserAtBoot(){const e=this.getSessionStorageState().testUser;e&&($e("checkTestUserAtBoot identifying test user"),this.identifyTestUser(e))}async identifyTestUser(e){this.setSessionStorageState((t=>({...t,testUser:e}))),this.reset(),this.init(e.clientToken),this.testUserIdentified=!0,this.externalId=e.id;const t=[this.identify(e.id,{name:e.name,email:e.email,signed_up_at:{set_once:(new Date).toISOString(),data_type:"datetime"}},{signature:e.signature})],{group:s}=e;s&&(this.groupId=s.id,t.push(this.group(s.id,{name:s.name},{signature:s.signature}))),await Promise.all(t)}resetTestUser(){this.setSessionStorageState((e=>({...e,testUser:null})))}init(e){if($e("init",e),!e)throw new o("userflow.init() was called but missing Userflow.js Token");this.clientToken!==e&&(this.testUserIdentified?$e("init() ignoring new token since a test user has been identified"):(this.clientToken&&($e("init() resetting due to new client token"),this.reset()),this.clientToken=e))}ensureInit(){if(!this.clientToken)throw new o("You must call userflow.init() first")}ensureIdentified(){if(this.ensureInit(),!this.externalId)throw new o("You must call userflow.identify() first");return this.externalId}ensureGroup(){if(this.ensureIdentified(),!this.groupId)throw new o("You must call userflow.group() first");return this.groupId}ensureConnected(){if(!this.clientToken||!this.externalId)return;if(this.debounceInactiveDisconnect(),this.socket)return;this._socketStatus="connecting",$e("connecting to socket");let t="e.userflow.com";"js.getuserflow.com"===new URL(Je).hostname&&"e.userflow.com"===t&&(t="e.getuserflow.com");const s="wss://"+t+"/end-users/"+this.clientToken+"/socket";this.socket=new e(s,{reconnectAfterMs:e=>[100,500,1e3,5e3][e-1]||1e4,timeout:2e4}),this.socket.connect(),this.socket.onOpen((()=>{$e("socket opened")})),this.socket.onError((e=>{console.log("Userflow.js socket error",e),this.reportCspIssue()})),this.channel=this.socket.channel(`end_users:${this.externalId}`,(()=>this.makeChannelJoinPayload())),this.channel.join().receive("ok",(e=>{this.featureFlags=new Set(e.featureFlags),$e("channel joined"),"connected"!==this._socketStatus&&(this._socketStatus="connected")})).receive("error",(e=>{["company_closed","invalid_client_token","invalid_user_external_id","incorrect_user_signature","rate_limit_exceeded","user_signature_required"].includes(e.code)?(console.error(`Userflow.js resetting due to: [${e.code}] ${e.message}`),this.reset(),this.clientToken=null):"invalid_protocol_version"===e.code?(console.error(`Userflow.js destroying due to: [${e.code}] ${e.message}`),this.destroy()):console.log("Userflow.js channel join error",e)})),this.channel.on("server_message",(e=>this.handleServerMessage(e))),this.channel.on("server_error",(e=>{console.log(`Userflow.js server error (${e.code}): ${e.message}`+(e.details&&e.details.length>0?"\nDetails:\n"+e.details.map((e=>(e.path?`${e.path}: `:"")+e.message)):""))}))}makeChannelJoinPayload(){const e=this.buildClientContext();this.clientContext=e;const t={protocolVersion:2,userflowClientBuild:"2000002",signature:this.signature,groupExternalId:this.groupId,groupSignature:this.groupSignature,flowSessionId:this.flowSession?.id||null,checklistSessionId:this.checklistSession?.id||null,resourceCenterSessionId:this.resourceCenterSession?.id||null,launchers:this.launcherSessions.map((e=>({flowId:e.flow.id}))),trackers:Array.from(this.trackers.values()).map((e=>({flowId:e.tracker.flowId}))),hasDraftSession:this.hasDraftSession(),clientConditions:Array.from(this.clientConditions.values()).map((e=>({conditionId:e.condition.id,isTrue:e.isTrue}))),clientContext:e};return $e("channel join payload",t),t}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((()=>{this.hasDraftSession()?this.debounceInactiveDisconnect():($e("disconnecting from socket due to inactivity"),this.disconnect())}),3e5)}hasDraftSession(){return!!this.flowSession?.draftMode||!!this.checklistSession?.draftMode||!!this.resourceCenterSession?.draftMode||this.launcherSessions.some((e=>e.draftMode))}async send(e,{batch:t,handlesRejection:s}={}){return this.inBatch&&["ToggleClientCondition","UpdateClientContext"].includes(e.kind)||this.checkPushRateLimit(),this.ensureConnected(),t&&!this.inBatch&&(this.inBatch=!0,this.sendRaw({kind:"BeginBatch"})),this.inBatch&&(window.clearTimeout(this.endBatchTimeout),this.endBatchTimeout=window.setTimeout((()=>{this.inBatch=!1,this.sendRaw({kind:"EndBatch"})}),50)),this.sendRaw(e,{handlesRejection:s})}async sendRaw(e,{handlesRejection:t}={}){return new Promise(((s,i)=>{if(!this.channel)throw Error("Userflow.js: send() should not be called if channel is not set");$e(`push ${e.kind} message`,e);const n=this.clientClock,r=()=>{this.serverClock=n,this.channel?.off("phx_error",a)},a=this.channel.on("phx_error",(s=>{r();const n="Userflow.js send got phx_error";console.log(n,"\nClient message:",e,"\nError:",s),t&&i(new o(n))}));this.channel.push("client_message",e).receive("ok",(e=>{r(),s(e)})).receive("error",(t=>{r();const s=`Userflow.js error reply (${t.code}): ${t.message}`;console.log(s,"\nClient message:",e,"\nError:",t),i(new o(s,t.code))}))}))}checkPushRateLimit(){const e=Date.now();if(this.pushRateLimitMinuteExpires<e&&(this.pushRateLimitMinute=0,this.pushRateLimitMinuteExpires=e+6e4),this.pushRateLimitMinute>=100)throw new o("This Userflow.js client has reached a maximum of 100 operations in the last 1 minute. This is usually due to one of the following:\n\n - Excessive calls to Userflow.js. Check if any of userflow.track(), userflow.identify(), userflow.updateUser() or similar are called repeatedly.\n - The URL changing too frequently. Look into https://userflow.com/docs/userflow-js#seturlfilter and filter out the changing part of the URL.\n - The user legitimately being very active, in which case you can just ignore this error.\n \n If in doubt, reach out to us at support@userflow.com.");this.pushRateLimitMinute++}handleServerMessage(e){$e(`received ${e.kind} message`,e);const{serverClock:t,flowSession:s,flowSessionClock:i,checklistSession:n,checklistSessionClock:o,resourceCenterSession:r}=this;switch(e.kind){case"CheckSessionsAck":case"ServerDebug":return;case"AddLauncher":{const{session:t}=e,s=this.launcherSessions.findIndex((e=>e.flow.id===t.flow.id));return this.launcherSessions=-1===s?[...this.launcherSessions,t]:[...this.launcherSessions.slice(0,s),t,...this.launcherSessions.slice(s+1)],void this.toggleUI()}case"AddTracker":return void this.addTracker(e.tracker);case"CancelConditionWaitTimer":return window.clearTimeout(this.conditionWaitTimers.get(e.conditionId)),void this.conditionWaitTimers.delete(e.conditionId);case"ChecklistTaskCompleted":return void this.unackedTasks.add(e.taskCvid);case"ForceGoToStep":return i>t?void $e(`ignoring ${e.kind} message due to stale clock flowSessionClock=${i} > serverClock=${t}`):void(s?.id===e.sessionId&&this.emit("gotostep",{session:s,step:{id:e.stepId}}));case"RemoveLauncher":return void(this.removeLauncher(e.flowId)&&this.toggleUI());case"RemoveTracker":return void this.removeTracker(e.flowId);case"SetChecklistSession":return void(o<=t||n?.id===e.session.id?(this.setChecklistSession(e.session,t),this.toggleUI()):$e(`ignoring ${e.kind} message due to stale clock checklistSessionClock=${o} > serverClock=${t}`));case"SetFlowSession":return void(i<=t||s?.id===e.session.id?(this.setFlowSession(e.session,t),this.toggleUI()):$e(`ignoring ${e.kind} message due to stale clock flowSessionClock=${i} > serverClock=${t}`));case"SetResourceCenterSession":return this.setResourceCenterSession(e.session),void this.toggleUI();case"StartConditionWaitTimer":if(!this.conditionWaitTimers.has(e.conditionId)){const t=window.setTimeout((()=>{this.conditionWaitTimers.delete(e.conditionId),this.send({kind:"FireConditionWaitTimer",conditionId:e.conditionId},{batch:!0})}),1e3*parseFloat(e.waitTime));this.conditionWaitTimers.set(e.conditionId,t)}return;case"TrackClientCondition":return void this.trackClientCondition(e.condition);case"UnsetChecklistSession":return o>t?void $e(`ignoring ${e.kind} message due to stale clock checklistSessionClock=${o} > serverClock=${t}`):void(n?.id===e.sessionId&&(this.setChecklistSession(null,t),this.toggleUI()));case"UnsetFlowSession":return i>t?void $e(`ignoring ${e.kind} message due to stale clock flowSessionClock=${i} > serverClock=${t}`):void(s?.id===e.sessionId&&(this.setFlowSession(null,t),this.toggleUI()));case"UnsetResourceCenterSession":return void(r?.id===e.sessionId&&(this.setResourceCenterSession(null),this.toggleUI()));case"UntrackClientCondition":return void this.untrackClientCondition(e.conditionId);default:return void console.warn("Userflow.js: Received unknown message",e)}}async identify(e,t={},{signature:s}={}){if($e("identify",e),this.ensureInit(),this.testUserIdentified&&e!==this.externalId)$e("identify() ignored since a test user has been identified");else{if("number"==typeof e)e=String(e);else if(!e||"string"!=typeof e)throw new o(`userflow.identify: First argument must be a non-empty string representing the user's ID in your database. Value received: ${JSON.stringify(e)}`);this.externalId&&e!==this.externalId&&($e("identify resetting due to new externalId"),this.reset()),this.externalId=e,this.signature=s||null,this.observeUserActivity(),await Promise.all([this.send({kind:"UpsertUser",attributes:this.normalizeAttributes(t)},{batch:!0}),this.onFirstIdentify()]),this.emit("private:identified")}}async identifyAnonymous(e={},s={}){const i="anonymousId";let n=a.getItem(i);n||(n="anon-"+t(),a.setItem(i,n)),await this.identify(n,e,s)}async updateUser(e={},t={}){$e("updateUser"),this.ensureIdentified(),await this.send({kind:"UpsertUser",attributes:this.normalizeAttributes(e)},{batch:!0})}async group(e,t={},{signature:s,membership:i}={}){if($e("group",e),this.ensureIdentified(),this.testUserIdentified&&e!==this.groupId)$e("group() ignored since a test user has been identified");else{if("number"==typeof e)e=String(e);else if(!e||"string"!=typeof e)throw new o(`userflow.group: First argument must be a non-empty string representing the group's ID in your database. Value received: ${JSON.stringify(e)}`);this.groupId=e,this.groupSignature=s||null,await this.send({kind:"UpsertGroup",groupExternalId:e,groupSignature:this.groupSignature,groupAttributes:this.normalizeAttributes(t),membershipAttributes:this.normalizeAttributes(i)},{batch:!0})}}async updateGroup(e={},t={}){$e("updateGroup");const s=this.ensureGroup();await this.send({kind:"UpsertGroup",groupExternalId:s,groupSignature:this.groupSignature,membershipAttributes:this.normalizeAttributes(t.membership),groupAttributes:this.normalizeAttributes(e)},{batch:!0})}normalizeAttributes(e){if(null==e)return{};if("object"!=typeof e)throw new o("Userflow: 'attributes' must be an object.");const t={};for(const s in e){if(!e.hasOwnProperty(s))continue;if("traits"===s){const i=e[s];Object.assign(t,this.extractLegacyTraits(i));continue}let i=e[s];if("string"==typeof i||"number"==typeof i||"boolean"==typeof i||null==i||Array.isArray(i))t[s]=this.normalizeAttributeLiteralOrList(s,i);else{if("object"!=typeof i||null==i)throw new o(`Userflow: Invalid value for '${s}' attribute.`);if("set"in i)t[s]={set:this.normalizeAttributeLiteralOrList(s,i.set),dataType:this.normalizeDataType(s,i.data_type||i.dataType)};else if("set_once"in i||"setOnce"in i)t[s]={setOnce:this.normalizeAttributeLiteralOrList(s,i.set_once||i.setOnce),dataType:this.normalizeDataType(s,i.data_type||i.dataType)};else if("add"in i){const e=i.add;if("string"!=typeof e&&"number"!=typeof e)throw new o(`Userflow: Invalid 'add' value for '${s}' attribute. Must be a number or string.`);t[s]={add:e}}else if("subtract"in i){const e=i.subtract;if("string"!=typeof e&&"number"!=typeof e)throw new o(`Userflow: Invalid 'subtract' value for '${s}' attribute. Must be a number or string.`);t[s]={subtract:e}}else if("append"in i)t[s]={append:this.normalizeAttributeLiteralOrList(s,i.append)};else if("prepend"in i)t[s]={prepend:this.normalizeAttributeLiteralOrList(s,i.prepend)};else{if(!("remove"in i))throw new o(`Userflow: Invalid value for '${s}' attribute.`);t[s]={remove:this.normalizeAttributeLiteralOrList(s,i.remove)}}}}return t}normalizeAttributeLiteralOrList(e,t){return Array.isArray(t)?t.map((t=>this.normalizeAttributeLiteral(e,t))):this.normalizeAttributeLiteral(e,t)}normalizeAttributeLiteral(e,t){if(null==t)return null;if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return t;throw new o(`Userflow: Invalid value for '${e}' attribute.`)}normalizeDataType(e,t){if(!t)return null;switch(t){case"string":return R.STRING;case"number":return R.NUMBER;case"boolean":return R.BOOLEAN;case"datetime":return R.DATETIME}throw new o(`Userflow: Invalid data_type for '${e}' attribute.`)}extractLegacyTraits(e){if(!e)return{};if(!Array.isArray(e)){const t=[];for(const s in e)e.hasOwnProperty(s)&&t.push({name:s,value:e[s]});e=t}return e.reduce(((e,{name:t,value:s,dataType:i})=>{if("string"!=typeof t||t.length>100||!t.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:",t),e;if("string"==typeof s);else if("boolean"==typeof s)i||(i="boolean"),s=s?"true":"false";else{if("number"!=typeof s)return this.warn(`userflow.identify: The value of trait '${t}' is invalid (must be a string, a boolean or a number). The trait will be ignored. Value was:`,s),e;i||(i=Number.isInteger(s)?"integer":"decimal"),s=String(s)}let n=null;if(i)switch(i){case"string":n=R.STRING;break;case"boolean":n=R.BOOLEAN;break;case"integer":case"decimal":n=R.NUMBER;break;case"datetime":n=R.DATETIME;break;default:return this.warn(`userflow.identify: The data type of trait '${t}' is invalid (must be a 'string', 'boolean', 'integer', 'decimal' or 'datetime'). The trait will be ignored. Data type was:`,i),e}return e[t]={set:s,dataType:n},e}),{})}async track(e,t={},{userOnly:s}={}){$e(`track '${e}'`,t),this.ensureIdentified(),await this.send({kind:"TrackEvent",userOnly:!!s,name:e,attributes:this.normalizeEventAttributes(t)},{batch:!0})}normalizeEventAttributes(e){const t=this.normalizeAttributes(e);for(const s in t){if(!t.hasOwnProperty(s))continue;const e=t[s];if(null!=e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e&&!Array.isArray(e)&&!("set"in e))throw new o(`Userflow: Invalid value for '${s}' attribute. Event attributes only support literal values, list values and 'set' changes.`)}return t}onFirstIdentify(){this.onFirstIdentifyRun||(this.onFirstIdentifyRun=!0,this.onFirstIdentifyTimeout=window.setTimeout((()=>{this.trackPageViewed(),this.firstIdentifyCallback?(this.firstIdentifyCallback(),this.firstIdentifyCallback=null):this.checkUrlForStartFlow()}),0))}onceIdentified(e){this.isIdentified()?e():this.firstIdentifyCallback=e}checkUrlForStartFlow(){const e=new URL(d()),t=e.searchParams.get("userflow")||e.searchParams.get("studio1_flow")||e.searchParams.get("studio1_walkthrough");t&&($e(`url contained flow ${t}`),this.startFlow({flowId:t,startReason:L.LINK,batch:!0}),e.searchParams.delete("userflow"),e.searchParams.delete("studio1_flow"),e.searchParams.delete("studio1_walkthrough"),window.history.replaceState({},"",e.toString()),this.clientContext=this.buildClientContext(),this.pushUpdateClientContext())}flushUrlChange(){const e=this.buildClientContext();this.clientContext&&e.pageUrl===this.clientContext.pageUrl||(this.clientContext=e,this.pushUpdateClientContext(),this.trackPageViewed(),this.checkUrlForStartFlow())}async trackPageViewed(){this.pageTrackingDisabled||this.track("page_viewed",{})}buildClientContext(){return{pageUrl:Ge(),viewportWidth:window.innerWidth,viewportHeight:window.innerHeight}}pushUpdateClientContext(){this.send({kind:"UpdateClientContext",clientContext:this.clientContext},{batch:!0})}ackCompletedTask(e){this.unackedTasks.delete(e)}taskIsUnacked(e){return this.unackedTasks.has(e)}isIdentified(){return null!=this.externalId}on(e,t){let s=this.listeners.get(e);s||(s=new Set,this.listeners.set(e,s)),s.add(t)}off(e,t){const s=this.listeners.get(e);s&&s.delete(t)}emit(e,...t){const s=this.listeners.get(e);if(s){Array.from(s).forEach((e=>e(...t)))}}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(){$e("reset"),this.externalId=null,this.groupId=null,this.sessionStorageState=null,this.setFlowSession(null,0),this.setChecklistSession(null,0),this.setResourceCenterSession(null),this.launcherSessions=[],this.activeLauncherFlowId=null,this.notifications=[],this.unackedTasks=new Set,this.onFirstIdentifyRun=!1,window.clearTimeout(this.onFirstIdentifyTimeout),this.onFirstIdentifyTimeout=void 0,this.clientContext=null,this.unobserveUserActivity(),window.clearTimeout(this.flushUrlChangeTimeout),this.flushUrlChangeTimeout=void 0,this.clientConditions.forEach(((e,t)=>{this.untrackClientCondition(t)})),this.firstIdentifyCallback=null,this.testUserIdentified=!1,a.removeItem("anonymousId"),this.unmountUI(),this.disconnect(),this.inBatch=!1,window.clearTimeout(this.endBatchTimeout),this.endBatchTimeout=void 0,this.clientClock=1,this.serverClock=1}async startFlow({flowId:e,stepCvid:t,startReason:s,once:i,batch:n,replaceCurrent:o}){if(this.ensureIdentified(),o&&this.flowSession&&this.endFlow(this.flowSession,{endReason:I.REPLACED,batch:!0}),$e(`startFlow ${e}`,{startReason:s}),this.checklistSession?.flow.id===e)return $e("startFlow matches current checklist, so showing it instead"),void this.showChecklist();const r={kind:"StartFlow",flowId:e,stepCvid:t,startReason:s,once:!!i};await this.send(r,{batch:n})}async startFlowWithToken(e){this.ensureIdentified(),$e("startFlowWithToken",{token:e}),await this.send({kind:"StartFlowWithToken",token:e},{batch:!0})}optimisticClockUIUpdate(e){this.clientClock++,e(),this.toggleUI()}async showChecklist(){this.resourceCenterEmbedsChecklist()?this.openResourceCenter():(this.unmarkExpandPending(),this.checklistSession&&!this.checklistExpanded&&(this.ensureIdentified(),this.checklistExpanded=!0,this.toggleUI(),c.setItem(`checklistExpanded:${this.checklistSession.id}`,"1"),await this.send({kind:"ShowChecklist",sessionId:this.checklistSession.id},{batch:!0})))}async hideChecklist(){this.resourceCenterEmbedsChecklist()?this.closeResourceCenter():this.checklistSession&&this.checklistExpanded&&(this.ensureIdentified(),this.checklistExpanded=!1,this.toggleUI(),c.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"),c.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"),c.removeItem(`resourceCenterOpen:${this.resourceCenterSession.id}`),await this.send({kind:"CloseResourceCenter",sessionId:this.resourceCenterSession.id},{batch:!0}))}toggleResourceCenter(){this.resourceCenterOpen?this.closeResourceCenter():this.openResourceCenter()}setResourceCenterLauncherHidden(e){this.resourceCenterLauncherHidden=e,this.toggleUI()}getResourceCenterState(){if(!this.resourceCenterSession)return null;const e=this.resourceCenterEmbedsChecklist(),{checklistSession:t}=this;return{isOpen:this.resourceCenterOpen,hasChecklist:e,uncompletedChecklistTaskCount:e&&t?ze(t):0}}resourceCenterEmbedsChecklist(){const e=this.resourceCenterSession;return!!e&&!!e.version.resourceCenter?.blocks.some((e=>e.type===we.CHECKLIST))}async endFlow(e,{endReason:t,batch:s}){this.ensureIdentified(),this.optimisticClockUIUpdate((()=>{const{clientClock:t}=this;this.flowSession?.id===e.id&&this.setFlowSession(null,t),this.checklistSession?.id===e.id&&this.setChecklistSession(null,t),this.resourceCenterSession?.id===e.id&&this.setResourceCenterSession(null)}));const{flow:i}=e,n={id:i.id,type:i.type.toLowerCase()};i.type===v.CHECKLIST?this.emit("checklistEnded",{checklist:n,endReason:t}):i.type===v.FLOW&&this.emit("flowEnded",{flow:n,endReason:t});const o={kind:"EndFlow",sessionId:e.id,endReason:t};await this.send(o,{batch:s})}async goToStep(e,t){$e("goToStep",e.id,t.name||t.id),this.ensureIdentified();const s=this.send({kind:"GoToStep",sessionId:e.id,stepId:t.id});this.emit("gotostep",{session:e,step:t}),await s}async endAllFlows(){$e("endAllFlows"),this.optimisticClockUIUpdate((()=>{const{clientClock:e}=this;this.setFlowSession(null,e),this.setChecklistSession(null,e)})),await this.send({kind:"EndAllFlows"})}async endChecklist(){$e("endChecklist");const e=this.checklistSession||this.flowSession;e?.flow.type===v.CHECKLIST&&this.endFlow(e,{endReason:I.USERFLOWJS})}setFlowSession(e,t=this.clientClock){const s=this.flowSession;this.flowSession=e,this.flowSessionClock=t,e&&!s&&(this.hideChecklist(),this.closeResourceCenter()),null==e&&this.originalActiveElement&&("function"==typeof this.originalActiveElement.focus&&this.originalActiveElement.focus(),this.originalActiveElement=void 0)}setChecklistSession(e,t=this.clientClock){const s=this.checklistSession;this.checklistSession=e,this.checklistSessionClock=t,null===e&&(this.checklistExpanded=!1,this.checklistExpandPending=!1),e&&e.id!==s?.id&&(this.checklistExpanded=!!c.getItem(`checklistExpanded:${e.id}`),e.expandPending&&(this.checklistExpandPending=!0)),this.emit("checklistChanged"),this.emit("resourceCenterChanged")}setResourceCenterSession(e){const t=this.resourceCenterSession;this.resourceCenterSession=e,null===e&&(this.resourceCenterOpen=!1),t&&t.id!==e?.id&&c.removeItem(`resourceCenterOpen:${t.id}`),e&&e.id!==t?.id&&(this.resourceCenterOpen=!!c.getItem(`resourceCenterOpen:${e.id}`)),this.emit("resourceCenterChanged")}launcherSeen(e){this.send({kind:"StartFlow",flowId:e,startReason:L.LAUNCHER_SEEN,once:!1})}activateLauncher(e){const t=this.activeLauncherFlowId&&this.launcherSessions.find((e=>e.flow.id===this.activeLauncherFlowId));t&&this.deactivateLauncher(t),this.activeLauncherFlowId=e.flow.id,this.toggleUI(),this.send({kind:"ActivateLauncher",flowId:e.flow.id})}deactivateLauncher(e){const{launcher:t}=e.version;e.flow.id===this.activeLauncherFlowId&&(t?.dismissOn===Ie.DEACTIVATE?this.dismissLauncher(e,{endReason:I.LAUNCHER_DEACTIVATED}):(this.activeLauncherFlowId=null,this.toggleUI()))}dismissLauncher(e,{endReason:t}){const s=e.flow.id;this.removeLauncher(s),this.toggleUI(),this.send({kind:"DismissLauncher",flowId:s,endReason:t})}removeLauncher(e){const t=this.launcherSessions.findIndex((t=>t.flow.id===e));return-1!==t&&(this.launcherSessions=[...this.launcherSessions.slice(0,t),...this.launcherSessions.slice(t+1)],e===this.activeLauncherFlowId&&(this.activeLauncherFlowId=null),!0)}async toggleUI(){this.flowSession||!this.checklistExpandPending&&!this.checklistSession?.version.checklist?.tasks.some((e=>this.taskIsUnacked(e.cvid)))||this.showChecklist(),this.emit("uistatechange"),this.shouldBeMounted()?await this.mountUI():this.unmountUI()}shouldBeMounted(){if(this.uiDisabled)return!1;return!!this.getSessionStorageState().activeApp||!!this.flowSession||!!this.checklistSession&&(this.checklistExpanded||!!this.checklistSession?.version.checklist?.launcherEnabled)||!!this.resourceCenterSession&&(this.resourceCenterOpen||!this.resourceCenterLauncherHidden)||this.launcherSessions.length>0||this.notifications.length>0}async mountUI(){if(!this.ui){const e=await this.createUI();this.shouldBeMounted()&&!this.ui&&($e("mount UI"),this.ui=e,this.ui.mount())}}unmountUI(){this.ui&&($e("unmount UI"),this.ui.unmount(),this.ui=null)}remount(){this.unmountUI(),this.toggleUI()}async createUI(){try{const e=n((()=>import("./ui.js")),[new URL("ui.js",import.meta.url).toString(),new URL("vendor.react.js",import.meta.url).toString(),new URL("vendor.object-assign.js",import.meta.url).toString(),new URL("vendor.react-dom.js",import.meta.url).toString(),new URL("vendor.scheduler.js",import.meta.url).toString(),new URL("client-context.js",import.meta.url).toString(),new URL("vendor.i18next.js",import.meta.url).toString(),new URL("vendor.react-i18next.js",import.meta.url).toString(),new URL("vendor.babel.runtime.js",import.meta.url).toString(),new URL("vendor.phoenix.js",import.meta.url).toString(),new URL("vendor.uuid.js",import.meta.url).toString()]);this.resourceCenterSession&&Ke();const{RealUI:t}=await e;return new t(this)}catch(e){throw this.reportCspIssue(),e}}async trackClientCondition(e){if(this.clientConditions.has(e.id))return;$e("track client condition",e),this.clientConditions.set(e.id,{condition:e,isTrue:null});const{conditionTypes:t}=await n((()=>import("./flow-condition-types.js").then((function(e){return e.t}))),[new URL("flow-condition-types.js",import.meta.url).toString(),new URL("vendor.date-fns.js",import.meta.url).toString()]),s=t[e.type],i=this.clientConditions.get(e.id);i&&(i.untrack=s.track({sessionData:new Ye([]),condition:e,callback:t=>{i.isTrue!==t&&($e("client condition truthiness changed",t,i.condition),i.isTrue=t,this.send({kind:"ToggleClientCondition",conditionId:e.id,isTrue:t},{batch:!0}))}}))}untrackClientCondition(e){const t=this.clientConditions.get(e);t&&($e("untrack client condition",t.condition),t.untrack&&t.untrack(),this.clientConditions.delete(e))}async addTracker(e){let t=this.trackers.get(e.flowId);t?t.tracker=e:this.trackers.set(e.flowId,{tracker:e,isTrue:!1});const{conditionTypes:s}=await n((()=>import("./flow-condition-types.js").then((function(e){return e.t}))),[new URL("flow-condition-types.js",import.meta.url).toString(),new URL("vendor.date-fns.js",import.meta.url).toString()]),i=this.trackers.get(e.flowId);if(!i)return;const{tracker:o}=i,{condition:r}=o,a=s[r.type];i.untrack&&i.untrack(),i.untrack=a.track({sessionData:new Ye(o.data),condition:r,flipBackEvents:!0,callback:e=>{const t=i.isTrue;i.isTrue=e,!t&&e&&this.send({kind:"TrackTrackerEvent",token:o.token},{batch:!0})}}),this.emit("private:trackerStarted")}removeTracker(e){const t=this.trackers.get(e);t&&(t.untrack&&t.untrack(),this.trackers.delete(e),this.emit("private:trackerStopped"))}reportCspIssue(){const e=this.getSessionStorageState();!this.testUserIdentified&&!e.activeApp||this.cspIssueReported||(this.cspIssueReported=!0,$e("csp issue detected"),E(window,{kind:"userflow:crxCspIssueDetected"}))}getAudio(){return this.audio||(this.audio=new Audio),this.audio}playAudio(e){if(document.hidden)return;const t=this.getAudio();e&&(t.src=e);const s=t.play();this.audioReady=!0,s&&s.catch((e=>{e.name}))}pauseAudio(){const e=this.audio;e&&!e.paused&&e.pause()}async getStepSpeech(e,t){return(await this.send({kind:"GetStepSpeechV2",syntheticVoice:e,text:t})).url}featureFlagEnabled(e){return this.featureFlags.has(e)}showNotification(e,t,s){const i={id:++this.notificationIdCounter,label:e,message:t,type:s};this.notifications=[...this.notifications,i],this.toggleUI()}dismissNotification(e){this.notifications=this.notifications.filter((t=>t.id!==e)),this.toggleUI()}warn(...e){console.warn(...e)}}if(void 0===window.userflow||window.userflow._stubbed){const e=Object.assign(window.userflow||{},function(){const e=new Xe;return{_stubbed:!1,init(t){e.init(t)},identify:(t,s={},i={})=>e.identify(t,s,i),identifyAnonymous:(t={},s={})=>e.identifyAnonymous(t,s),isIdentified:()=>e.isIdentified(),updateUser:(t,s={})=>e.updateUser(t,s),group:(t,s={},i={})=>e.group(t,s,i),updateGroup:(t,s={})=>e.updateGroup(t,s),track:(t,s={},i={})=>e.track(t,s,i),start:(t,{once:s}={})=>e.startFlow({flowId:t,startReason:L.USERFLOWJS,once:s}),startFlow:e=>(console.warn("Userflow.js: userflow.startFlow() has been deprecated. Use userflow.start() instead."),window.userflow.start(e)),startWalk:e=>(console.warn("Userflow.js: userflow.startWalk() has been deprecated. Use userflow.start() instead."),window.userflow.start(e)),endAll:()=>e.endAllFlows(),endChecklist:()=>e.endChecklist(),endAllFlows:()=>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:()=>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(e){console.warn("Userflow.js: userflow.setCustomInputSelector() has been deprecated. Use userflow.registerCustomInput() instead. See docs: https://userflow.com/docs/userflow-js"),e&&Be.customInputs.push({cssSelector:e})},registerCustomInput(e,t){Be.customInputs.push({cssSelector:e,getValue:t})},setCustomNavigate(e){Be.customNavigate=e},setUrlFilter(e){Be.urlFilter=e},setInferenceAttributeNames(e){Be.inferenceAttributeNames=e},setInferenceAttributeFilter(e,t){Be.inferenceAttributeFilters[e]=xe(t)},setInferenceClassNameFilter(e){Be.inferenceClassNameFilters=xe(e)},setScrollPadding(e){Be.scrollPadding=e},setCustomScrollIntoView(e){Be.customScrollIntoView=e},prepareAudio(){e.playAudio(null)},setShadowDomEnabled(e){console.warn("Userflow.js: userflow.setShadowDomEnabled() has been deprecated. Please remove this call from your Userflow.js snippet. Shadow DOM is supported by default now.")},setPageTrackingDisabled(t){e.pageTrackingDisabled=t},_setTargetEnv(t){e.setTargetEnv(t)}}}());window.userflow=e,window.studio1=e,function(){const e=window.userflow,t=window.USERFLOWJS_QUEUE;if(delete window.USERFLOWJS_QUEUE,!t||0===t.length)return;$e(`processing ${t.length} items in the queue`);for(const[s,i,n]of t){if("function"!=typeof e[s]){console.error(`Userflow.js: Invalid method '${s}' in queue`);continue}const t=e[s](...n);i&&t&&"function"==typeof t.then&&t.then(i.resolve,i.reject)}$e("queue processed")}()}export{H as A,W as B,pe as C,Ce as D,I as E,M as F,Ue as G,_e as H,Le as I,Re as J,ve as L,X as M,Ke as R,L as S,se as T,o as U,ne as V,n as _,F as a,D as b,Be as c,$e as d,_ as e,B as f,Ge as g,we as h,ze as i,ee as j,Z as k,de as l,v as m,ue as n,p as o,Ee as p,Ye as q,K as r,l as s,He as t,g as u,a as v,Y as w,re as x,V as y,ce as z};export default window.userflow;
|
|
1
|
+
import{S as e}from"./vendor.phoenix.js";import{v as t}from"./vendor.uuid.js";let s;const i={},n=function(e,t){if(!t)return e();if(void 0===s){const e=document.createElement("link").relList;s=e&&e.supports&&e.supports("modulepreload")?"modulepreload":"preload"}return Promise.all(t.map((e=>{if(e in i)return;i[e]=!0;const t=e.endsWith(".css"),n=t?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${e}"]${n}`))return;const o=document.createElement("link");return o.rel=t?"stylesheet":s,t||(o.as="script",o.crossOrigin=""),o.href=e,document.head.appendChild(o),t?new Promise(((e,t)=>{o.addEventListener("load",e),o.addEventListener("error",t)})):void 0}))).then((()=>e()))};class o extends Error{constructor(e,t){super(e),Object.setPrototypeOf(this,o.prototype),this.name="UserflowError",this.code=t}}class r{constructor(e){this.type=e,this.testState={}}formatKey(e){return`userflow:${e}`}getItem(e){return e=this.formatKey(e),"undefined"==typeof window?null:window[this.type].getItem(e)}setItem(e,t){e=this.formatKey(e),"undefined"!=typeof window&&window[this.type].setItem(e,t)}removeItem(e){if(e=this.formatKey(e),"undefined"!=typeof window)return window[this.type].removeItem(e)}clear(){if("undefined"!=typeof window)return window[this.type].clear()}}const a=new r("localStorage"),c=new r("sessionStorage");function l(e){window.location.href=e}function d(){return window.location.href}var h,u,f;function E(e,t,{toOrigin:s}={}){e.postMessage(t,s||"*")}function T(e,{fromWindow:t,fromOrigin:s}={}){const i=i=>{if(!i.isTrusted)return;if(t&&t!==i.source)return;if(s&&i.origin!==s)return;const o=i.data;o&&"object"==typeof o&&"string"==typeof o.kind&&o.kind.startsWith("userflow:")&&!0===e(o)&&n()};window.addEventListener("message",i);const n=()=>window.removeEventListener("message",i);return n}(h||(h={})).INPUT="INPUT",(f=u||(u={})).AUTO="AUTO",f.MANUAL="MANUAL";const w=new Set;let S=!1;function p(e){return function(){if(S)return;S=!0;const{history:e}=window,t=t=>{const s=e[t];e[t]=(...t)=>{s.apply(e,t),C()}};t("pushState"),t("replaceState"),window.addEventListener("popstate",(()=>{C()}))}(),w.add(e),()=>{g(e)}}function g(e){w.delete(e)}function C(){w.forEach((e=>e()))}class m{destroy(){this.unregisterOnMessage&&this.unregisterOnMessage()}postBuilderMessage(e){E(window.opener,e,{toOrigin:"https://userflow.com"})}onBuilderMessage(e){return this.unregisterOnMessage=T(e,{fromOrigin:"https://userflow.com"}),!1}async captureScreenshot(e,t,s,i){E(window,{kind:"userflow:crxScreenshot",x:e,y:t,width:s,height:i,devicePixelRatio:window.devicePixelRatio});var n;return(await(n=e=>"userflow:crxScreenshotResult"===e.kind?e:null,new Promise((e=>{T((t=>{const s=n(t);return!!s&&(e(s),!0)}))})))).imageDataUrl}}var I,k,U,A,L,y,R,O,v,N,_,b,D,F,M,P,B,x,H,G,W,$,V,j,K,z,Y,J,X,Q,Z,q,ee,te,se,ie,ne,oe,re,ae,ce,le,de,he,ue,fe,Ee,Te,we,Se,pe,ge,Ce,me,Ie,ke,Ue,Ae,Le,ye,Re,Oe,ve,Ne,_e,be,De,Fe,Me,Pe;(k=I||(I={})).ACTION="ACTION",k.LAUNCHER_DEACTIVATED="LAUNCHER_DEACTIVATED",k.REPLACED="REPLACED",k.SNOOZED="SNOOZED",k.TOOLTIP_TARGET_MISSING="TOOLTIP_TARGET_MISSING",k.USERFLOWJS="USERFLOWJS",k.USER_CLOSED="USER_CLOSED",(A=U||(U={})).SECOND="SECOND",A.MINUTE="MINUTE",A.HOUR="HOUR",A.DAY="DAY",(y=L||(L={})).ACTION="ACTION",y.DRAFT="DRAFT",y.LINK="LINK",y.LAUNCHER_SEEN="LAUNCHER_SEEN",y.RESOURCE_CENTER="RESOURCE_CENTER",y.USERFLOWJS="USERFLOWJS",(O=R||(R={})).STRING="STRING",O.BOOLEAN="BOOLEAN",O.NUMBER="NUMBER",O.DATETIME="DATETIME",O.LIST="LIST",(N=v||(v={})).FLOW="FLOW",N.CHECKLIST="CHECKLIST",N.LAUNCHER="LAUNCHER",N.RESOURCE_CENTER="RESOURCE_CENTER",(b=_||(_={})).ALWAYS_TRUE="ALWAYS_TRUE",b.ATTRIBUTE="ATTRIBUTE",b.CLAUSE="CLAUSE",b.ELEMENT="ELEMENT",b.FILLED_IN_INPUT="FILLED_IN_INPUT",b.FLOW="FLOW",b.INPUT_VALUE="INPUT_VALUE",b.PAGE="PAGE",b.TIME="TIME",function(e){e.AUTO="AUTO",e.MANUAL="MANUAL"}(D||(D={})),(F||(F={})).INPUT="INPUT",(P=M||(M={})).ABSOLUTE_EQ="ABSOLUTE_EQ",P.ABSOLUTE_GT="ABSOLUTE_GT",P.ABSOLUTE_LT="ABSOLUTE_LT",P.AND="AND",P.CONTAINS="CONTAINS",P.EMPTY="EMPTY",P.ENDS_WITH="ENDS_WITH",P.EQ="EQ",P.EXCLUDES_ALL="EXCLUDES_ALL",P.EXCLUDES_ANY="EXCLUDES_ANY",P.FALSE="FALSE",P.GT="GT",P.INCLUDES_ALL="INCLUDES_ALL",P.INCLUDES_ANY="INCLUDES_ANY",P.LT="LT",P.NE="NE",P.NOT_CONTAINS="NOT_CONTAINS",P.NOT_EMPTY="NOT_EMPTY",P.NOT_REGEX="NOT_REGEX",P.OR="OR",P.REGEX="REGEX",P.RELATIVE_EQ="RELATIVE_EQ",P.RELATIVE_GT="RELATIVE_GT",P.RELATIVE_LT="RELATIVE_LT",P.STARTS_WITH="STARTS_WITH",P.TRUE="TRUE",P.URL="URL",(x=B||(B={})).CLICK="CLICK",x.DISABLED="DISABLED",x.MOUSEDOWN="MOUSEDOWN",x.NOT_CLICK="NOT_CLICK",x.NOT_DISABLED="NOT_DISABLED",x.NOT_PRESENT="NOT_PRESENT",x.PRESENT="PRESENT",(G=H||(H={})).ASSET="ASSET",G.CARTOON="CARTOON",G.NONE="NONE",G.URL="URL",($=W||(W={})).INSIDE="INSIDE",$.OUTSIDE="OUTSIDE",(j=V||(V={})).TOP_LEFT="TOP_LEFT",j.TOP_CENTER="TOP_CENTER",j.TOP_RIGHT="TOP_RIGHT",j.BOTTOM_RIGHT="BOTTOM_RIGHT",j.BOTTOM_CENTER="BOTTOM_CENTER",j.BOTTOM_LEFT="BOTTOM_LEFT",j.CENTER="CENTER",(z=K||(K={})).GOOGLE="GOOGLE",z.STANDARD="STANDARD",(J=Y||(Y={})).DISMISS_FIRST_MENU_AFTER="DISMISS_FIRST_MENU_AFTER",J.DISMISS="DISMISS",(Q=X||(X={})).DISMISS="DISMISS",Q.NONE="NONE",(q=Z||(Z={})).DEFAULT="DEFAULT",q.PLAINTEXT="PLAINTEXT",(te=ee||(ee={})).CHECKLIST_OVERRIDE="CHECKLIST_OVERRIDE",te.RESOURCE_CENTER_ONLY="RESOURCE_CENTER_ONLY",te.NONE="NONE",(ie=se||(se={})).BUBBLE="BUBBLE",ie.END="END",ie.ERROR="ERROR",ie.FLAG="FLAG",(oe=ne||(ne={})).MANUAL="MANUAL",oe.NONE="NONE",oe.SYNTHETIC="SYNTHETIC",(ae=re||(re={})).BUBBLE="BUBBLE",ae.HIDDEN="HIDDEN",ae.MODAL="MODAL",ae.TOOLTIP="TOOLTIP",(le=ce||(ce={})).ABOVE="ABOVE",le.BELOW="BELOW",le.LEFT="LEFT",le.RIGHT="RIGHT",(he=de||(de={})).CLOSE_FLOW="CLOSE_FLOW",he.EVAL_JS="EVAL_JS",he.GO_TO_STEP="GO_TO_STEP",he.NAVIGATE="NAVIGATE",he.SNOOZE="SNOOZE",he.START_FLOW="START_FLOW",(fe=ue||(ue={})).NEW_TAB="NEW_TAB",fe.SAME_TAB="SAME_TAB",(Te=Ee||(Ee={})).MULTILINE_TEXT="MULTILINE_TEXT",Te.MULTIPLE_CHOICE="MULTIPLE_CHOICE",Te.NPS="NPS",Te.SCALE="SCALE",Te.STARS="STARS",Te.TEXT="TEXT",(Se=we||(we={})).ACTION="ACTION",Se.CHECKLIST="CHECKLIST",Se.CONTACT="CONTACT",Se.FLOWS="FLOWS",Se.KNOWLEDGE_BASE="KNOWLEDGE_BASE",Se.MESSAGE="MESSAGE",Se.SUBPAGE="SUBPAGE",(ge=pe||(pe={})).CRISP="CRISP",ge.CUSTOM="CUSTOM",ge.FRESHCHAT="FRESHCHAT",ge.HELPSCOUT="HELPSCOUT",ge.HUBSPOT="HUBSPOT",ge.INTERCOM="INTERCOM",ge.ZENDESK="ZENDESK",ge.ZENDESK_MESSENGER="ZENDESK_MESSENGER",(me=Ce||(Ce={})).LAUNCHER_CLICK="LAUNCHER_CLICK",me.LAUNCHER_HOVER="LAUNCHER_HOVER",me.TARGET_CLICK="TARGET_CLICK",me.TARGET_HOVER="TARGET_HOVER",me.LAUNCHER_TARGET_CLICK="LAUNCHER_TARGET_CLICK",me.LAUNCHER_TARGET_HOVER="LAUNCHER_TARGET_HOVER",(ke=Ie||(Ie={})).ACTIVATE="ACTIVATE",ke.DEACTIVATE="DEACTIVATE",ke.NEVER="NEVER",(Ae=Ue||(Ue={})).AUTO="AUTO",Ae.TOP="TOP",Ae.RIGHT="RIGHT",Ae.BOTTOM="BOTTOM",Ae.LEFT="LEFT",(ye=Le||(Le={})).START="START",ye.CENTER="CENTER",ye.END="END",(Oe=Re||(Re={})).PERCENT="PERCENT",Oe.PX="PX",(Ne=ve||(ve={})).BEACON="BEACON",Ne.BUTTON="BUTTON",Ne.HIDDEN="HIDDEN",Ne.ICON="ICON",(be=_e||(_e={})).LAUNCHER="LAUNCHER",be.TARGET="TARGET",(Fe=De||(De={})).ACTIVE="ACTIVE",Fe.COMPLETED="COMPLETED",Fe.ENDED="ENDED",Fe.NOT_SEEN="NOT_SEEN",(Pe=Me||(Me={})).HIGHLIGHT="HIGHLIGHT",Pe.MODAL="MODAL",Pe.HIGHLIGHT_MODAL="HIGHLIGHT_MODAL";const Be={customInputs:[],customNavigate:null,urlFilter: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-")]};function xe(e){return Array.isArray(e)||(e=e?[e]:[]),e=e.map((e=>"string"==typeof e?new RegExp(e):e))}function He(e,t){return e.every((e=>"function"==typeof e?e(t):!(e instanceof RegExp)||e.test(t)))}function Ge(){let e=d();if(Be.urlFilter){if(e=Be.urlFilter(e),"string"!=typeof e)throw new o("Userflow.js: URL filter returned non-string value. Please check your userflow.setUrlFilter() implementation.");try{new URL(e)}catch(t){throw new o("Userflow.js: URL filter returned an invalid URL. Please check your userflow.setUrlFilter() implementation.\nReturned URL: "+e+"\nError message: "+t.message)}}return e}const We=(localStorage.getItem("debug")||"").split(",").some((e=>"*"===e||e.startsWith("userflow:*"))),$e=je("log");let Ve;function je(e){return function(t,...s){if(We){const i=performance.now(),n=Ve?Math.round(i-Ve):0;Ve=i,console[e](`%cuserflow %c${t} %c+${n}ms`,"color:#4579E4;","","color:#4579E4;",...s)}}}$e.group=je("group"),$e.groupCollapsed=je("groupCollapsed"),$e.groupEnd=function(){We&&console.groupEnd()};const Ke=()=>n((()=>import("./ResourceCenterApp.js")),[new URL("ResourceCenterApp.js",import.meta.url).toString(),new URL("vendor.react.js",import.meta.url).toString(),new URL("vendor.object-assign.js",import.meta.url).toString(),new URL("client-context.js",import.meta.url).toString(),new URL("vendor.i18next.js",import.meta.url).toString(),new URL("vendor.react-i18next.js",import.meta.url).toString(),new URL("vendor.babel.runtime.js",import.meta.url).toString(),new URL("Icons.js",import.meta.url).toString(),new URL("BubbleToolbar.js",import.meta.url).toString(),new URL("flow-condition-types.js",import.meta.url).toString(),new URL("vendor.date-fns.js",import.meta.url).toString(),new URL("stylesheets.js",import.meta.url).toString(),new URL("vendor.obj-str.js",import.meta.url).toString(),new URL("vendor.fortawesome.react-fontawesome.js",import.meta.url).toString(),new URL("vendor.fortawesome.fontawesome-svg-core.js",import.meta.url).toString(),new URL("vendor.prop-types.js",import.meta.url).toString(),new URL("vendor.fortawesome.pro-solid-svg-icons.js",import.meta.url).toString(),new URL("logomark.js",import.meta.url).toString(),new URL("vendor.react-dom.js",import.meta.url).toString(),new URL("vendor.scheduler.js",import.meta.url).toString(),new URL("DynamicIcon.js",import.meta.url).toString(),new URL("vendor.fortawesome.pro-regular-svg-icons.js",import.meta.url).toString(),new URL("ChecklistUI.js",import.meta.url).toString(),new URL("vendor.phoenix.js",import.meta.url).toString(),new URL("vendor.uuid.js",import.meta.url).toString()]);function ze(e){const t=e.version.checklist.tasks.length;return Math.max(0,t-e.taskCompletions.length)}class Ye{constructor(e){this.observers=new Set,this._value=e}get value(){return this._value}update(e){if(e!==this._value){this._value=e;for(const e of this.observers)e()}}observe(e){return this.observers.add(e),()=>this.observers.delete(e)}}const Je=import.meta.url;class Xe{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.featureFlags=new Set,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.resourceCenterSession=null,this.resourceCenterOpen=!1,this.resourceCenterLauncherHidden=!1,this.launcherSessions=[],this.activeLauncherFlowId=null,this.notifications=[],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.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.onBuilderMessage=e=>(this.handleBuilderMessage(e),!1),this.handleBuilderMessage=async e=>{$e(`builder ${e.kind} message received`,e);const t="idempotencyKey"in e&&"string"==typeof e.idempotencyKey?e.idempotencyKey:null;if(t&&this.idempotencyKeysSeen.has(t))return;const s=()=>{t&&this.idempotencyKeysSeen.add(t)};switch(e.kind){case"userflow:selectElement":return s(),this.getTargetEnv().postBuilderMessage({kind:"userflow:selectElementAck",idempotencyKey:e.idempotencyKey}),void this.setSessionStorageState((t=>({...t,activeApp:"elementSelection",elementSelection:{mode:"select",elementType:e.elementType}})));case"userflow:selectElementCancel":return void this.setSessionStorageState((e=>({...e,activeApp:null,elementSelection:null})));case"userflow:startFlowWithToken":return s(),this.getTargetEnv().postBuilderMessage({kind:"userflow:startFlowWithTokenAck",idempotencyKey:e.idempotencyKey}),e.testUser?this.identifyTestUser(e.testUser):this.resetTestUser(),void this.onceIdentified((()=>{if(this.startFlowWithToken(e.token),e.isResourceCenter){const t=()=>{const s=this.resourceCenterSession;s&&s.draftMode&&s.flow.id===e.flowId&&(this.openResourceCenter(),this.off("resourceCenterChanged",t))};this.on("resourceCenterChanged",t),t()}}));case"userflow:testTracker":return s(),this.getTargetEnv().postBuilderMessage({kind:"userflow:testTrackerAck",idempotencyKey:e.idempotencyKey}),e.testUser?this.identifyTestUser(e.testUser):this.resetTestUser(),void this.setSessionStorageState((t=>({...t,activeApp:"trackerTesting",trackerTesting:{trackerName:e.trackerName,token:e.token,events:0}})));case"userflow:testTrackerCancel":return void this.setSessionStorageState((e=>({...e,activeApp:null,trackerTesting:null})))}},this.onUrlChange=()=>{this.externalId&&(window.clearTimeout(this.flushUrlChangeTimeout),this.flushUrlChangeTimeout=window.setTimeout((()=>this.flushUrlChange()),50))},this.onUserActivity=()=>this.ensureConnected(),$e("constructor, build=2000003"),p(this.onUrlChange),this.setTargetEnv(new m),this.checkTestUserAtBoot(),this.toggleUI()}get socketStatus(){return this._socketStatus}destroy(){$e("destroy"),this.reset(),g(this.onUrlChange),this.destroyTargetEnv()}setTargetEnv(e){this.destroyTargetEnv(),this.targetEnv=e,e.onBuilderMessage(this.onBuilderMessage)}destroyTargetEnv(){this.targetEnv&&(this.targetEnv.destroy(),this.targetEnv=null)}getTargetEnv(){if(!this.targetEnv)throw new o("Userflow.js: Cannot call getTargetEnv when protocol is not set");return this.targetEnv}setSessionStorageState(e){const t=e(this.getSessionStorageState());c.setItem("userflowClientState",JSON.stringify(t)),this.sessionStorageState=t,this.toggleUI()}getSessionStorageState(){let e=this.sessionStorageState;if(!e){const s=c.getItem("userflowClientState");if(s)try{e=JSON.parse(s)}catch(t){console.error("Userflow.js: Parse ElementSelectionState error:",t)}e||(e={testUser:null,activeApp:null,elementSelection:null,trackerTesting:null})}return e}checkTestUserAtBoot(){const e=this.getSessionStorageState().testUser;e&&($e("checkTestUserAtBoot identifying test user"),this.identifyTestUser(e))}async identifyTestUser(e){this.setSessionStorageState((t=>({...t,testUser:e}))),this.reset(),this.init(e.clientToken),this.testUserIdentified=!0,this.externalId=e.id;const t=[this.identify(e.id,{name:e.name,email:e.email,signed_up_at:{set_once:(new Date).toISOString(),data_type:"datetime"}},{signature:e.signature})],{group:s}=e;s&&(this.groupId=s.id,t.push(this.group(s.id,{name:s.name},{signature:s.signature}))),await Promise.all(t)}resetTestUser(){this.setSessionStorageState((e=>({...e,testUser:null})))}init(e){if($e("init",e),!e)throw new o("userflow.init() was called but missing Userflow.js Token");this.clientToken!==e&&(this.testUserIdentified?$e("init() ignoring new token since a test user has been identified"):(this.clientToken&&($e("init() resetting due to new client token"),this.reset()),this.clientToken=e))}ensureInit(){if(!this.clientToken)throw new o("You must call userflow.init() first")}ensureIdentified(){if(this.ensureInit(),!this.externalId)throw new o("You must call userflow.identify() first");return this.externalId}ensureGroup(){if(this.ensureIdentified(),!this.groupId)throw new o("You must call userflow.group() first");return this.groupId}ensureConnected(){if(!this.clientToken||!this.externalId)return;if(this.debounceInactiveDisconnect(),this.socket)return;this._socketStatus="connecting",$e("connecting to socket");let t="e.userflow.com";"js.getuserflow.com"===new URL(Je).hostname&&"e.userflow.com"===t&&(t="e.getuserflow.com");const s="wss://"+t+"/end-users/"+this.clientToken+"/socket";this.socket=new e(s,{reconnectAfterMs:e=>[100,500,1e3,5e3][e-1]||1e4,timeout:2e4}),this.socket.connect(),this.socket.onOpen((()=>{$e("socket opened")})),this.socket.onError((e=>{console.log("Userflow.js socket error",e),this.reportCspIssue()})),this.channel=this.socket.channel(`end_users:${this.externalId}`,(()=>this.makeChannelJoinPayload())),this.channel.join().receive("ok",(e=>{this.featureFlags=new Set(e.featureFlags),$e("channel joined"),"connected"!==this._socketStatus&&(this._socketStatus="connected")})).receive("error",(e=>{["company_closed","invalid_client_token","invalid_user_external_id","incorrect_user_signature","rate_limit_exceeded","user_signature_required"].includes(e.code)?(console.error(`Userflow.js resetting due to: [${e.code}] ${e.message}`),this.reset(),this.clientToken=null):"invalid_protocol_version"===e.code?(console.error(`Userflow.js destroying due to: [${e.code}] ${e.message}`),this.destroy()):console.log("Userflow.js channel join error",e)})),this.channel.on("server_message",(e=>this.handleServerMessage(e))),this.channel.on("server_error",(e=>{console.log(`Userflow.js server error (${e.code}): ${e.message}`+(e.details&&e.details.length>0?"\nDetails:\n"+e.details.map((e=>(e.path?`${e.path}: `:"")+e.message)):""))}))}makeChannelJoinPayload(){const e=this.buildClientContext();this.clientContext=e;const t={protocolVersion:2,userflowClientBuild:"2000003",signature:this.signature,groupExternalId:this.groupId,groupSignature:this.groupSignature,flowSessionId:this.flowSession?.id||null,checklistSessionId:this.checklistSession?.id||null,resourceCenterSessionId:this.resourceCenterSession?.id||null,launchers:this.launcherSessions.map((e=>({flowId:e.flow.id}))),trackers:Array.from(this.trackers.values()).map((e=>({flowId:e.tracker.flowId}))),hasDraftSession:this.hasDraftSession(),clientConditions:Array.from(this.clientConditions.values()).map((e=>({conditionId:e.condition.id,isTrue:e.isTrue}))),clientContext:e};return $e("channel join payload",t),t}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((()=>{this.hasDraftSession()?this.debounceInactiveDisconnect():($e("disconnecting from socket due to inactivity"),this.disconnect())}),3e5)}hasDraftSession(){return!!this.flowSession?.draftMode||!!this.checklistSession?.draftMode||!!this.resourceCenterSession?.draftMode||this.launcherSessions.some((e=>e.draftMode))}async send(e,{batch:t,handlesRejection:s}={}){return this.inBatch&&["ToggleClientCondition","UpdateClientContext"].includes(e.kind)||this.checkPushRateLimit(),this.ensureConnected(),t&&!this.inBatch&&(this.inBatch=!0,this.sendRaw({kind:"BeginBatch"})),this.inBatch&&(window.clearTimeout(this.endBatchTimeout),this.endBatchTimeout=window.setTimeout((()=>{this.inBatch=!1,this.sendRaw({kind:"EndBatch"})}),50)),this.sendRaw(e,{handlesRejection:s})}async sendRaw(e,{handlesRejection:t}={}){return new Promise(((s,i)=>{if(!this.channel)throw Error("Userflow.js: send() should not be called if channel is not set");$e(`push ${e.kind} message`,e);const n=this.clientClock,r=()=>{this.serverClock=n,this.channel?.off("phx_error",a)},a=this.channel.on("phx_error",(s=>{r();const n="Userflow.js send got phx_error";console.log(n,"\nClient message:",e,"\nError:",s),t&&i(new o(n))}));this.channel.push("client_message",e).receive("ok",(e=>{r(),s(e)})).receive("error",(t=>{r();const s=`Userflow.js error reply (${t.code}): ${t.message}`;console.log(s,"\nClient message:",e,"\nError:",t),i(new o(s,t.code))}))}))}checkPushRateLimit(){const e=Date.now();if(this.pushRateLimitMinuteExpires<e&&(this.pushRateLimitMinute=0,this.pushRateLimitMinuteExpires=e+6e4),this.pushRateLimitMinute>=100)throw new o("This Userflow.js client has reached a maximum of 100 operations in the last 1 minute. This is usually due to one of the following:\n\n - Excessive calls to Userflow.js. Check if any of userflow.track(), userflow.identify(), userflow.updateUser() or similar are called repeatedly.\n - The URL changing too frequently. Look into https://userflow.com/docs/userflow-js#seturlfilter and filter out the changing part of the URL.\n - The user legitimately being very active, in which case you can just ignore this error.\n \n If in doubt, reach out to us at support@userflow.com.");this.pushRateLimitMinute++}handleServerMessage(e){$e(`received ${e.kind} message`,e);const{serverClock:t,flowSession:s,flowSessionClock:i,checklistSession:n,checklistSessionClock:o,resourceCenterSession:r}=this;switch(e.kind){case"CheckSessionsAck":case"ServerDebug":return;case"AddLauncher":{const{session:t}=e,s=this.launcherSessions.findIndex((e=>e.flow.id===t.flow.id));return this.launcherSessions=-1===s?[...this.launcherSessions,t]:[...this.launcherSessions.slice(0,s),t,...this.launcherSessions.slice(s+1)],void this.toggleUI()}case"AddTracker":return void this.addTracker(e.tracker);case"CancelConditionWaitTimer":return window.clearTimeout(this.conditionWaitTimers.get(e.conditionId)),void this.conditionWaitTimers.delete(e.conditionId);case"ChecklistTaskCompleted":return void this.unackedTasks.add(e.taskCvid);case"ForceGoToStep":return i>t?void $e(`ignoring ${e.kind} message due to stale clock flowSessionClock=${i} > serverClock=${t}`):void(s?.id===e.sessionId&&this.emit("gotostep",{session:s,step:{id:e.stepId}}));case"RemoveLauncher":return void(this.removeLauncher(e.flowId)&&this.toggleUI());case"RemoveTracker":return void this.removeTracker(e.flowId);case"SetChecklistSession":return void(o<=t||n?.id===e.session.id?(this.setChecklistSession(e.session,t),this.toggleUI()):$e(`ignoring ${e.kind} message due to stale clock checklistSessionClock=${o} > serverClock=${t}`));case"SetFlowSession":return void(i<=t||s?.id===e.session.id?(this.setFlowSession(e.session,t),this.toggleUI()):$e(`ignoring ${e.kind} message due to stale clock flowSessionClock=${i} > serverClock=${t}`));case"SetResourceCenterSession":return this.setResourceCenterSession(e.session),void this.toggleUI();case"StartConditionWaitTimer":if(!this.conditionWaitTimers.has(e.conditionId)){const t=window.setTimeout((()=>{this.conditionWaitTimers.delete(e.conditionId),this.send({kind:"FireConditionWaitTimer",conditionId:e.conditionId},{batch:!0})}),1e3*parseFloat(e.waitTime));this.conditionWaitTimers.set(e.conditionId,t)}return;case"TrackClientCondition":return void this.trackClientCondition(e.condition);case"UnsetChecklistSession":return o>t?void $e(`ignoring ${e.kind} message due to stale clock checklistSessionClock=${o} > serverClock=${t}`):void(n?.id===e.sessionId&&(this.setChecklistSession(null,t),this.toggleUI()));case"UnsetFlowSession":return i>t?void $e(`ignoring ${e.kind} message due to stale clock flowSessionClock=${i} > serverClock=${t}`):void(s?.id===e.sessionId&&(this.setFlowSession(null,t),this.toggleUI()));case"UnsetResourceCenterSession":return void(r?.id===e.sessionId&&(this.setResourceCenterSession(null),this.toggleUI()));case"UntrackClientCondition":return void this.untrackClientCondition(e.conditionId);default:return void console.warn("Userflow.js: Received unknown message",e)}}async identify(e,t={},{signature:s}={}){if($e("identify",e),this.ensureInit(),this.testUserIdentified&&e!==this.externalId)$e("identify() ignored since a test user has been identified");else{if("number"==typeof e)e=String(e);else if(!e||"string"!=typeof e)throw new o(`userflow.identify: First argument must be a non-empty string representing the user's ID in your database. Value received: ${JSON.stringify(e)}`);this.externalId&&e!==this.externalId&&($e("identify resetting due to new externalId"),this.reset()),this.externalId=e,this.signature=s||null,this.observeUserActivity(),await Promise.all([this.send({kind:"UpsertUser",attributes:this.normalizeAttributes(t)},{batch:!0}),this.onFirstIdentify()]),this.emit("private:identified")}}async identifyAnonymous(e={},s={}){const i="anonymousId";let n=a.getItem(i);n||(n="anon-"+t(),a.setItem(i,n)),await this.identify(n,e,s)}async updateUser(e={},t={}){$e("updateUser"),this.ensureIdentified(),await this.send({kind:"UpsertUser",attributes:this.normalizeAttributes(e)},{batch:!0})}async group(e,t={},{signature:s,membership:i}={}){if($e("group",e),this.ensureIdentified(),this.testUserIdentified&&e!==this.groupId)$e("group() ignored since a test user has been identified");else{if("number"==typeof e)e=String(e);else if(!e||"string"!=typeof e)throw new o(`userflow.group: First argument must be a non-empty string representing the group's ID in your database. Value received: ${JSON.stringify(e)}`);this.groupId=e,this.groupSignature=s||null,await this.send({kind:"UpsertGroup",groupExternalId:e,groupSignature:this.groupSignature,groupAttributes:this.normalizeAttributes(t),membershipAttributes:this.normalizeAttributes(i)},{batch:!0})}}async updateGroup(e={},t={}){$e("updateGroup");const s=this.ensureGroup();await this.send({kind:"UpsertGroup",groupExternalId:s,groupSignature:this.groupSignature,membershipAttributes:this.normalizeAttributes(t.membership),groupAttributes:this.normalizeAttributes(e)},{batch:!0})}normalizeAttributes(e){if(null==e)return{};if("object"!=typeof e)throw new o("Userflow: 'attributes' must be an object.");const t={};for(const s in e){if(!e.hasOwnProperty(s))continue;if("traits"===s){const i=e[s];Object.assign(t,this.extractLegacyTraits(i));continue}let i=e[s];if("string"==typeof i||"number"==typeof i||"boolean"==typeof i||null==i||Array.isArray(i))t[s]=this.normalizeAttributeLiteralOrList(s,i);else{if("object"!=typeof i||null==i)throw new o(`Userflow: Invalid value for '${s}' attribute.`);if("set"in i)t[s]={set:this.normalizeAttributeLiteralOrList(s,i.set),dataType:this.normalizeDataType(s,i.data_type||i.dataType)};else if("set_once"in i||"setOnce"in i)t[s]={setOnce:this.normalizeAttributeLiteralOrList(s,i.set_once||i.setOnce),dataType:this.normalizeDataType(s,i.data_type||i.dataType)};else if("add"in i){const e=i.add;if("string"!=typeof e&&"number"!=typeof e)throw new o(`Userflow: Invalid 'add' value for '${s}' attribute. Must be a number or string.`);t[s]={add:e}}else if("subtract"in i){const e=i.subtract;if("string"!=typeof e&&"number"!=typeof e)throw new o(`Userflow: Invalid 'subtract' value for '${s}' attribute. Must be a number or string.`);t[s]={subtract:e}}else if("append"in i)t[s]={append:this.normalizeAttributeLiteralOrList(s,i.append)};else if("prepend"in i)t[s]={prepend:this.normalizeAttributeLiteralOrList(s,i.prepend)};else{if(!("remove"in i))throw new o(`Userflow: Invalid value for '${s}' attribute.`);t[s]={remove:this.normalizeAttributeLiteralOrList(s,i.remove)}}}}return t}normalizeAttributeLiteralOrList(e,t){return Array.isArray(t)?t.map((t=>this.normalizeAttributeLiteral(e,t))):this.normalizeAttributeLiteral(e,t)}normalizeAttributeLiteral(e,t){if(null==t)return null;if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return t;throw new o(`Userflow: Invalid value for '${e}' attribute.`)}normalizeDataType(e,t){if(!t)return null;switch(t){case"string":return R.STRING;case"number":return R.NUMBER;case"boolean":return R.BOOLEAN;case"datetime":return R.DATETIME}throw new o(`Userflow: Invalid data_type for '${e}' attribute.`)}extractLegacyTraits(e){if(!e)return{};if(!Array.isArray(e)){const t=[];for(const s in e)e.hasOwnProperty(s)&&t.push({name:s,value:e[s]});e=t}return e.reduce(((e,{name:t,value:s,dataType:i})=>{if("string"!=typeof t||t.length>100||!t.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:",t),e;if("string"==typeof s);else if("boolean"==typeof s)i||(i="boolean"),s=s?"true":"false";else{if("number"!=typeof s)return this.warn(`userflow.identify: The value of trait '${t}' is invalid (must be a string, a boolean or a number). The trait will be ignored. Value was:`,s),e;i||(i=Number.isInteger(s)?"integer":"decimal"),s=String(s)}let n=null;if(i)switch(i){case"string":n=R.STRING;break;case"boolean":n=R.BOOLEAN;break;case"integer":case"decimal":n=R.NUMBER;break;case"datetime":n=R.DATETIME;break;default:return this.warn(`userflow.identify: The data type of trait '${t}' is invalid (must be a 'string', 'boolean', 'integer', 'decimal' or 'datetime'). The trait will be ignored. Data type was:`,i),e}return e[t]={set:s,dataType:n},e}),{})}async track(e,t={},{userOnly:s}={}){$e(`track '${e}'`,t),this.ensureIdentified(),await this.send({kind:"TrackEvent",userOnly:!!s,name:e,attributes:this.normalizeEventAttributes(t)},{batch:!0})}normalizeEventAttributes(e){const t=this.normalizeAttributes(e);for(const s in t){if(!t.hasOwnProperty(s))continue;const e=t[s];if(null!=e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e&&!Array.isArray(e)&&!("set"in e))throw new o(`Userflow: Invalid value for '${s}' attribute. Event attributes only support literal values, list values and 'set' changes.`)}return t}onFirstIdentify(){this.onFirstIdentifyRun||(this.onFirstIdentifyRun=!0,this.onFirstIdentifyTimeout=window.setTimeout((()=>{this.trackPageViewed(),this.firstIdentifyCallback?(this.firstIdentifyCallback(),this.firstIdentifyCallback=null):this.checkUrlForStartFlow()}),0))}onceIdentified(e){this.isIdentified()?e():this.firstIdentifyCallback=e}checkUrlForStartFlow(){const e=new URL(d()),t=e.searchParams.get("userflow")||e.searchParams.get("studio1_flow")||e.searchParams.get("studio1_walkthrough");t&&($e(`url contained flow ${t}`),this.startFlow({flowId:t,startReason:L.LINK,batch:!0}),e.searchParams.delete("userflow"),e.searchParams.delete("studio1_flow"),e.searchParams.delete("studio1_walkthrough"),window.history.replaceState({},"",e.toString()),this.clientContext=this.buildClientContext(),this.pushUpdateClientContext())}flushUrlChange(){const e=this.buildClientContext();this.clientContext&&e.pageUrl===this.clientContext.pageUrl||(this.clientContext=e,this.pushUpdateClientContext(),this.trackPageViewed(),this.checkUrlForStartFlow())}async trackPageViewed(){this.pageTrackingDisabled||this.track("page_viewed",{})}buildClientContext(){return{pageUrl:Ge(),viewportWidth:window.innerWidth,viewportHeight:window.innerHeight}}pushUpdateClientContext(){this.send({kind:"UpdateClientContext",clientContext:this.clientContext},{batch:!0})}ackCompletedTask(e){this.unackedTasks.delete(e)}taskIsUnacked(e){return this.unackedTasks.has(e)}isIdentified(){return null!=this.externalId}on(e,t){let s=this.listeners.get(e);s||(s=new Set,this.listeners.set(e,s)),s.add(t)}off(e,t){const s=this.listeners.get(e);s&&s.delete(t)}emit(e,...t){const s=this.listeners.get(e);if(s){Array.from(s).forEach((e=>e(...t)))}}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(){$e("reset"),this.externalId=null,this.groupId=null,this.sessionStorageState=null,this.setFlowSession(null,0),this.setChecklistSession(null,0),this.setResourceCenterSession(null),this.launcherSessions=[],this.activeLauncherFlowId=null,this.notifications=[],this.unackedTasks=new Set,this.onFirstIdentifyRun=!1,window.clearTimeout(this.onFirstIdentifyTimeout),this.onFirstIdentifyTimeout=void 0,this.clientContext=null,this.unobserveUserActivity(),window.clearTimeout(this.flushUrlChangeTimeout),this.flushUrlChangeTimeout=void 0,this.clientConditions.forEach(((e,t)=>{this.untrackClientCondition(t)})),this.firstIdentifyCallback=null,this.testUserIdentified=!1,a.removeItem("anonymousId"),this.unmountUI(),this.disconnect(),this.inBatch=!1,window.clearTimeout(this.endBatchTimeout),this.endBatchTimeout=void 0,this.clientClock=1,this.serverClock=1}async startFlow({flowId:e,stepCvid:t,startReason:s,once:i,batch:n,replaceCurrent:o}){if(this.ensureIdentified(),o&&this.flowSession&&this.endFlow(this.flowSession,{endReason:I.REPLACED,batch:!0}),$e(`startFlow ${e}`,{startReason:s}),this.checklistSession?.flow.id===e)return $e("startFlow matches current checklist, so showing it instead"),void this.showChecklist();const r={kind:"StartFlow",flowId:e,stepCvid:t,startReason:s,once:!!i};await this.send(r,{batch:n})}async startFlowWithToken(e){this.ensureIdentified(),$e("startFlowWithToken",{token:e}),await this.send({kind:"StartFlowWithToken",token:e},{batch:!0})}optimisticClockUIUpdate(e){this.clientClock++,e(),this.toggleUI()}async showChecklist(){this.resourceCenterEmbedsChecklist()?this.openResourceCenter():(this.unmarkExpandPending(),this.checklistSession&&!this.checklistExpanded&&(this.ensureIdentified(),this.checklistExpanded=!0,this.toggleUI(),c.setItem(`checklistExpanded:${this.checklistSession.id}`,"1"),await this.send({kind:"ShowChecklist",sessionId:this.checklistSession.id},{batch:!0})))}async hideChecklist(){this.resourceCenterEmbedsChecklist()?this.closeResourceCenter():this.checklistSession&&this.checklistExpanded&&(this.ensureIdentified(),this.checklistExpanded=!1,this.toggleUI(),c.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"),c.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"),c.removeItem(`resourceCenterOpen:${this.resourceCenterSession.id}`),await this.send({kind:"CloseResourceCenter",sessionId:this.resourceCenterSession.id},{batch:!0}))}toggleResourceCenter(){this.resourceCenterOpen?this.closeResourceCenter():this.openResourceCenter()}setResourceCenterLauncherHidden(e){this.resourceCenterLauncherHidden=e,this.toggleUI()}getResourceCenterState(){if(!this.resourceCenterSession)return null;const e=this.resourceCenterEmbedsChecklist(),{checklistSession:t}=this;return{isOpen:this.resourceCenterOpen,hasChecklist:e,uncompletedChecklistTaskCount:e&&t?ze(t):0}}resourceCenterEmbedsChecklist(){const e=this.resourceCenterSession;return!!e&&!!e.version.resourceCenter?.blocks.some((e=>e.type===we.CHECKLIST))}async endFlow(e,{endReason:t,batch:s}){this.ensureIdentified(),this.optimisticClockUIUpdate((()=>{const{clientClock:t}=this;this.flowSession?.id===e.id&&this.setFlowSession(null,t),this.checklistSession?.id===e.id&&this.setChecklistSession(null,t),this.resourceCenterSession?.id===e.id&&this.setResourceCenterSession(null)}));const{flow:i}=e,n={id:i.id,type:i.type.toLowerCase()};i.type===v.CHECKLIST?this.emit("checklistEnded",{checklist:n,endReason:t}):i.type===v.FLOW&&this.emit("flowEnded",{flow:n,endReason:t});const o={kind:"EndFlow",sessionId:e.id,endReason:t};await this.send(o,{batch:s})}async goToStep(e,t){$e("goToStep",e.id,t.name||t.id),this.ensureIdentified();const s=this.send({kind:"GoToStep",sessionId:e.id,stepId:t.id});this.emit("gotostep",{session:e,step:t}),await s}async endAllFlows(){$e("endAllFlows"),this.optimisticClockUIUpdate((()=>{const{clientClock:e}=this;this.setFlowSession(null,e),this.setChecklistSession(null,e)})),await this.send({kind:"EndAllFlows"})}async endChecklist(){$e("endChecklist");const e=this.checklistSession||this.flowSession;e?.flow.type===v.CHECKLIST&&this.endFlow(e,{endReason:I.USERFLOWJS})}setFlowSession(e,t=this.clientClock){const s=this.flowSession;this.flowSession=e,this.flowSessionClock=t,e&&!s&&(this.hideChecklist(),this.closeResourceCenter()),null==e&&this.originalActiveElement&&("function"==typeof this.originalActiveElement.focus&&this.originalActiveElement.focus(),this.originalActiveElement=void 0)}setChecklistSession(e,t=this.clientClock){const s=this.checklistSession;this.checklistSession=e,this.checklistSessionClock=t,null===e&&(this.checklistExpanded=!1,this.checklistExpandPending=!1),e&&e.id!==s?.id&&(this.checklistExpanded=!!c.getItem(`checklistExpanded:${e.id}`),e.expandPending&&(this.checklistExpandPending=!0)),this.emit("checklistChanged"),this.emit("resourceCenterChanged")}setResourceCenterSession(e){const t=this.resourceCenterSession;this.resourceCenterSession=e,null===e&&(this.resourceCenterOpen=!1),t&&t.id!==e?.id&&c.removeItem(`resourceCenterOpen:${t.id}`),e&&e.id!==t?.id&&(this.resourceCenterOpen=!!c.getItem(`resourceCenterOpen:${e.id}`)),this.emit("resourceCenterChanged")}launcherSeen(e){this.send({kind:"StartFlow",flowId:e,startReason:L.LAUNCHER_SEEN,once:!1})}activateLauncher(e){const t=this.activeLauncherFlowId&&this.launcherSessions.find((e=>e.flow.id===this.activeLauncherFlowId));t&&this.deactivateLauncher(t),this.activeLauncherFlowId=e.flow.id,this.toggleUI(),this.send({kind:"ActivateLauncher",flowId:e.flow.id})}deactivateLauncher(e){const{launcher:t}=e.version;e.flow.id===this.activeLauncherFlowId&&(t?.dismissOn===Ie.DEACTIVATE?this.dismissLauncher(e,{endReason:I.LAUNCHER_DEACTIVATED}):(this.activeLauncherFlowId=null,this.toggleUI()))}dismissLauncher(e,{endReason:t}){const s=e.flow.id;this.removeLauncher(s),this.toggleUI(),this.send({kind:"DismissLauncher",flowId:s,endReason:t})}removeLauncher(e){const t=this.launcherSessions.findIndex((t=>t.flow.id===e));return-1!==t&&(this.launcherSessions=[...this.launcherSessions.slice(0,t),...this.launcherSessions.slice(t+1)],e===this.activeLauncherFlowId&&(this.activeLauncherFlowId=null),!0)}async toggleUI(){this.flowSession||!this.checklistExpandPending&&!this.checklistSession?.version.checklist?.tasks.some((e=>this.taskIsUnacked(e.cvid)))||this.showChecklist(),this.emit("uistatechange"),this.shouldBeMounted()?await this.mountUI():this.unmountUI()}shouldBeMounted(){if(this.uiDisabled)return!1;return!!this.getSessionStorageState().activeApp||!!this.flowSession||!!this.checklistSession&&(this.checklistExpanded||!!this.checklistSession?.version.checklist?.launcherEnabled)||!!this.resourceCenterSession&&(this.resourceCenterOpen||!this.resourceCenterLauncherHidden)||this.launcherSessions.length>0||this.notifications.length>0}async mountUI(){if(!this.ui){const e=await this.createUI();this.shouldBeMounted()&&!this.ui&&($e("mount UI"),this.ui=e,this.ui.mount())}}unmountUI(){this.ui&&($e("unmount UI"),this.ui.unmount(),this.ui=null)}remount(){this.unmountUI(),this.toggleUI()}async createUI(){try{const e=n((()=>import("./ui.js")),[new URL("ui.js",import.meta.url).toString(),new URL("vendor.react.js",import.meta.url).toString(),new URL("vendor.object-assign.js",import.meta.url).toString(),new URL("vendor.react-dom.js",import.meta.url).toString(),new URL("vendor.scheduler.js",import.meta.url).toString(),new URL("client-context.js",import.meta.url).toString(),new URL("vendor.i18next.js",import.meta.url).toString(),new URL("vendor.react-i18next.js",import.meta.url).toString(),new URL("vendor.babel.runtime.js",import.meta.url).toString(),new URL("vendor.phoenix.js",import.meta.url).toString(),new URL("vendor.uuid.js",import.meta.url).toString()]);this.resourceCenterSession&&Ke();const{RealUI:t}=await e;return new t(this)}catch(e){throw this.reportCspIssue(),e}}async trackClientCondition(e){if(this.clientConditions.has(e.id))return;$e("track client condition",e),this.clientConditions.set(e.id,{condition:e,isTrue:null});const{conditionTypes:t}=await n((()=>import("./flow-condition-types.js").then((function(e){return e.t}))),[new URL("flow-condition-types.js",import.meta.url).toString(),new URL("vendor.date-fns.js",import.meta.url).toString()]),s=t[e.type],i=this.clientConditions.get(e.id);i&&(i.untrack=s.track({sessionData:new Ye([]),condition:e,callback:t=>{i.isTrue!==t&&($e("client condition truthiness changed",t,i.condition),i.isTrue=t,this.send({kind:"ToggleClientCondition",conditionId:e.id,isTrue:t},{batch:!0}))}}))}untrackClientCondition(e){const t=this.clientConditions.get(e);t&&($e("untrack client condition",t.condition),t.untrack&&t.untrack(),this.clientConditions.delete(e))}async addTracker(e){let t=this.trackers.get(e.flowId);t?t.tracker=e:this.trackers.set(e.flowId,{tracker:e,isTrue:!1});const{conditionTypes:s}=await n((()=>import("./flow-condition-types.js").then((function(e){return e.t}))),[new URL("flow-condition-types.js",import.meta.url).toString(),new URL("vendor.date-fns.js",import.meta.url).toString()]),i=this.trackers.get(e.flowId);if(!i)return;const{tracker:o}=i,{condition:r}=o,a=s[r.type];i.untrack&&i.untrack(),i.untrack=a.track({sessionData:new Ye(o.data),condition:r,flipBackEvents:!0,callback:e=>{const t=i.isTrue;i.isTrue=e,!t&&e&&this.send({kind:"TrackTrackerEvent",token:o.token},{batch:!0})}}),this.emit("private:trackerStarted")}removeTracker(e){const t=this.trackers.get(e);t&&(t.untrack&&t.untrack(),this.trackers.delete(e),this.emit("private:trackerStopped"))}reportCspIssue(){const e=this.getSessionStorageState();!this.testUserIdentified&&!e.activeApp||this.cspIssueReported||(this.cspIssueReported=!0,$e("csp issue detected"),E(window,{kind:"userflow:crxCspIssueDetected"}))}getAudio(){return this.audio||(this.audio=new Audio),this.audio}playAudio(e){if(document.hidden)return;const t=this.getAudio();e&&(t.src=e);const s=t.play();this.audioReady=!0,s&&s.catch((e=>{e.name}))}pauseAudio(){const e=this.audio;e&&!e.paused&&e.pause()}async getStepSpeech(e,t){return(await this.send({kind:"GetStepSpeechV2",syntheticVoice:e,text:t})).url}featureFlagEnabled(e){return this.featureFlags.has(e)}showNotification(e,t,s){const i={id:++this.notificationIdCounter,label:e,message:t,type:s};this.notifications=[...this.notifications,i],this.toggleUI()}dismissNotification(e){this.notifications=this.notifications.filter((t=>t.id!==e)),this.toggleUI()}warn(...e){console.warn(...e)}}if(void 0===window.userflow||window.userflow._stubbed){const e=Object.assign(window.userflow||{},function(){const e=new Xe;return{_stubbed:!1,init(t){e.init(t)},identify:(t,s={},i={})=>e.identify(t,s,i),identifyAnonymous:(t={},s={})=>e.identifyAnonymous(t,s),isIdentified:()=>e.isIdentified(),updateUser:(t,s={})=>e.updateUser(t,s),group:(t,s={},i={})=>e.group(t,s,i),updateGroup:(t,s={})=>e.updateGroup(t,s),track:(t,s={},i={})=>e.track(t,s,i),start:(t,{once:s}={})=>e.startFlow({flowId:t,startReason:L.USERFLOWJS,once:s}),startFlow:e=>(console.warn("Userflow.js: userflow.startFlow() has been deprecated. Use userflow.start() instead."),window.userflow.start(e)),startWalk:e=>(console.warn("Userflow.js: userflow.startWalk() has been deprecated. Use userflow.start() instead."),window.userflow.start(e)),endAll:()=>e.endAllFlows(),endChecklist:()=>e.endChecklist(),endAllFlows:()=>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:()=>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(e){console.warn("Userflow.js: userflow.setCustomInputSelector() has been deprecated. Use userflow.registerCustomInput() instead. See docs: https://userflow.com/docs/userflow-js"),e&&Be.customInputs.push({cssSelector:e})},registerCustomInput(e,t){Be.customInputs.push({cssSelector:e,getValue:t})},setCustomNavigate(e){Be.customNavigate=e},setUrlFilter(e){Be.urlFilter=e},setInferenceAttributeNames(e){Be.inferenceAttributeNames=e},setInferenceAttributeFilter(e,t){Be.inferenceAttributeFilters[e]=xe(t)},setInferenceClassNameFilter(e){Be.inferenceClassNameFilters=xe(e)},setScrollPadding(e){Be.scrollPadding=e},setCustomScrollIntoView(e){Be.customScrollIntoView=e},prepareAudio(){e.playAudio(null)},setShadowDomEnabled(e){console.warn("Userflow.js: userflow.setShadowDomEnabled() has been deprecated. Please remove this call from your Userflow.js snippet. Shadow DOM is supported by default now.")},setPageTrackingDisabled(t){e.pageTrackingDisabled=t},_setTargetEnv(t){e.setTargetEnv(t)}}}());window.userflow=e,window.studio1=e,function(){const e=window.userflow,t=window.USERFLOWJS_QUEUE;if(delete window.USERFLOWJS_QUEUE,!t||0===t.length)return;$e(`processing ${t.length} items in the queue`);for(const[s,i,n]of t){if("function"!=typeof e[s]){console.error(`Userflow.js: Invalid method '${s}' in queue`);continue}const t=e[s](...n);i&&t&&"function"==typeof t.then&&t.then(i.resolve,i.reject)}$e("queue processed")}()}export{H as A,W as B,pe as C,Ce as D,I as E,M as F,Ue as G,_e as H,Le as I,Re as J,ve as L,X as M,Ke as R,L as S,se as T,o as U,ne as V,n as _,F as a,D as b,Be as c,$e as d,_ as e,B as f,Ge as g,we as h,ze as i,ee as j,Z as k,de as l,v as m,ue as n,p as o,Ee as p,Ye as q,K as r,l as s,He as t,g as u,a as v,Y as w,re as x,V as y,ce as z};export default window.userflow;
|
package/logomark.d9cf252a.svg
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" fill="none" viewBox="0 0 100 100">
|
|
2
|
-
<path fill="#5488F0" d="M87.668 30.37h-4.004l-6.097 34.57c-1.442 8.18-9.26 14.82-17.45 14.82h-36.09l-.951 5.43C21.624 93.37 27.08 100 35.289 100h40.045c8.19 0 16.018-6.63 17.45-14.81l7.008-40c1.531-8.18-3.935-14.82-12.124-14.82Z"/>
|
|
3
|
-
<path fill="#00E673" d="m61.539 30.37-1.652 9.37c-1.762 10-11.293 18-21.244 18h-8.159c-10.011 0-16.628-8.09-14.877-18l3.314-18.77h9.42l-3.313 18.77a6.992 6.992 0 0 0 1.405 6.088 7.006 7.006 0 0 0 5.713 2.542h8.16a10.77 10.77 0 0 0 6.58-2.553 10.748 10.748 0 0 0 3.58-6.077l2.483-14.07a5.849 5.849 0 0 1 5.537-4.7h17.43l1.08-6.15C78.448 6.63 72.992 0 64.783 0H24.738C16.548 0 8.72 6.63 7.288 14.82l-7.008 40C-1.16 63 4.285 69.63 12.494 69.63h40.045c8.199 0 16.018-6.63 17.45-14.81l4.314-24.45H61.54Z"/>
|
|
4
|
-
</svg>
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
|
|
2
|
-
<path fill="currentColor" d="M24.049 79.74h36.003c8.185 0 15.985-6.621 17.43-14.814l6.091-34.556h3.997c8.149 0 13.645 6.63 12.2 14.815l-7.051 40C91.274 93.363 83.474 100 75.288 100h-40c-8.185 0-13.645-6.667-12.2-14.815l.96-5.444Z" />
|
|
3
|
-
<path fill="currentColor" fill-rule="evenodd" d="M12.437 69.63h40c8.148 0 15.978-6.637 17.422-14.815l7.052-40C78.355 6.63 72.896 0 64.711 0h-40C16.533 0 8.726 6.63 7.281 14.815l-7.052 40C-1.215 62.963 4.252 69.63 12.437 69.63Zm33.628-33.798c3.756-2.064 8.725-4.795 9.907-11.844C57.385 15.458 50.065 8.983 42.168 9c-7.452 0-12.771 3.195-17.508 8.892-.858 1.034-.884 2.45-.053 3.212l3.472 3.196c.847.767 2.25.589 3.176-.406 2.842-3.068 4.869-4.83 8.51-4.83 2.864 0 6.077 1.934 5.59 4.847-.37 2.223-2.292 3.334-5.4 5.001l-.28.151c-3.582 1.92-8.134 4.362-9.124 10.247l-.16.956c-.055.28-.05.571.014.85.065.278.188.538.362.76.173.222.391.4.639.522.247.121.518.183.79.18h6.744a2.709 2.709 0 0 0 1.712-.688c.481-.426.81-1.01.934-1.657l.095-.556c.266-1.582 2.101-2.59 4.384-3.845ZM32.837 59c3.552 0 6.955-3.034 7.58-6.769.63-3.729-1.742-6.763-5.293-6.763-3.552 0-6.934 3.028-7.58 6.763C26.9 55.966 29.286 59 32.837 59Z" />
|
|
4
|
-
</svg>
|