userflow.js-self-hosted 0.1.1010005 → 0.1.1010063
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FlowApp.js +3 -3
- package/ResourceCenterAssistantChat.js +1 -1
- package/bubble-frame.css +87 -77
- package/flow-condition-types.js +1 -1
- package/hash.txt +1 -1
- package/package.json +1 -1
- package/roots.js +1 -1
- package/ui.js +2 -2
- package/use-selector-element-monitoring.js +3 -3
- package/userflow.js +4 -4
- package/vendor.core-js.js +1 -1
- package/vendor.lodash.js +28 -0
package/FlowApp.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{R as o,r as
|
|
1
|
+
import{R as o,r as d}from"./vendor.react.js";import{E as M,P as B,f as k,V as O,n as de,F as pe,T as x,o as L,p as fe,q as me,M as be,U as Q}from"./userflow.js";import"./vendor.core-js.js";import{l as Ee}from"./vendor.lodash.js";import{u as j}from"./vendor.react-i18next.js";import{B as X,F as ge}from"./FlowChrome.js";import{m as we,d as K,R as he,i as Te,g as ve,c as Se,u as ye,r as ke,e as z,h as De,S as Me}from"./use-selector-element-monitoring.js";import{g as Z,i as J}from"./flow-condition-types.js";import{u as N,i as Re}from"./client-context.js";import{z as Ne,d as Ie,r as Fe}from"./roots.js";import{a as ee,S as Ae}from"./flow-host.styl.js";import{f as Be}from"./vendor.fortawesome.pro-solid-svg-icons.js";import{D as Le,u as Ce}from"./stylesheets.js";import{T as Oe}from"./Trigger.js";import"./vendor.object-assign.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";import"./vendor.babel.runtime.js";import"./vendor.fortawesome.pro-regular-svg-icons.js";import"./use-window-resize.js";import"./vendor.react-dom.js";import"./vendor.scheduler.js";import"./logomark.js";import"./vendor.obj-str.js";import"./vendor.date-fns.js";import"./vendor.i18next.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},s=new Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="e27e4278-d3de-4f78-99f6-4312e11ab6df",e._sentryDebugIdIdentifier="sentry-dbid-e27e4278-d3de-4f78-99f6-4312e11ab6df")}catch{}})();const xe=()=>{const{t:e}=j(),s=N(),{dispatch:t,restart:n}=F(),{session:l,step:p}=D(),a="userflowjs-bubble-button userflowjs-bubble-button--default userflowjs-bubble-menu__item";return o.createElement("div",{role:"dialog","aria-modal":I(p)?"true":void 0,"aria-label":"Guide menu"},o.createElement("div",{className:"userflowjs-bubble-menu__title"},e("menu.title")),o.createElement("button",{className:a,onClick:()=>s.endFlow(l,{endReason:M.USER_CLOSED})},e("menu.close")),l.version.restartEnabled&&o.createElement("button",{className:a,onClick:n},e("menu.restart")),o.createElement("button",{className:a,onClick:()=>t({kind:"showFlow"})},e("menu.back")))};var _=(e=>(e.BOTTOM="BOTTOM",e.TOP="TOP",e))(_||{}),te=(e=>(e.CHAINED_ROUNDED="CHAINED_ROUNDED",e.CHAINED_SQUARED="CHAINED_SQUARED",e.DEFAULT="DEFAULT",e.DOTTED="DOTTED",e.NARROW="NARROW",e.NUMBERED="NUMBERED",e))(te||{});const $=({progress:e,type:s,position:t,totalSteps:n})=>{const{t:l}=j(),p=d.useMemo(()=>parseFloat(e||"0"),[e]),a=d.useMemo(()=>({width:`${p*100}%`}),[p]),c=d.useMemo(()=>s===te.DEFAULT?B.TOP:t,[s,t]),u=c===B.BOTTOM?"userflowjs-bubble-progress--bottom":"",m=d.useMemo(()=>`userflowjs-bubble-progress--${Ee.kebabCase(s||"DEFAULT").toLowerCase()} ${u}`,[s,u]),i=n||0,r=d.useMemo(()=>Math.min(Math.floor(p*i),i),[p,i]);return o.createElement(o.Fragment,null,(s==="CHAINED_ROUNDED"||s==="CHAINED_SQUARED"||s==="DOTTED")&&o.createElement("div",{className:m},Array.from({length:3}).map((E,b)=>o.createElement("div",{key:b,className:`userflowjs-bubble-progress-step ${b<Math.floor(p*3)?"userflowjs-bubble-progress-step_completed":""}`}))),s==="NARROW"&&o.createElement("div",{className:m},o.createElement("div",{className:"linear-progress-bar"},o.createElement("div",{className:"userflowjs-bubble-progress--narrow-fill",style:a}))),s==="NUMBERED"&&o.createElement("div",{className:m},o.createElement("span",{className:"numbered-progress"},l("of",{replace:{range:i,selected:r}}))),!["CHAINED_ROUNDED","CHAINED_SQUARED","DOTTED","NARROW","NUMBERED"].includes(s)&&o.createElement("div",{className:`${m} ${c===B.BOTTOM?"userflowjs-bubble-progress--bottom":""}`},o.createElement("div",{className:"userflowjs-bubble-progress__fill",style:a})))},_e=({theme:e})=>{const s=N(),{session:t,step:n,muted:l,shouldLabelDialog:p}=D(),{version:a}=t,{dispatch:c}=F(),u=a.steps[0],m=u&&u.id===n.id,i=m&&n.progress==="1",r=d.useMemo(()=>n.content&&we(K(n.content),{buttons:n.buttons,questions:n.questions}),[n.content,n.buttons,n.questions]),E=a.steps.filter(v=>v.appearance!==k.HIDDEN),b=E.findIndex(v=>v.id===n.id),w=E.length,h=w>0?((b+1)/w).toString():"0";return o.createElement("div",{key:n.id,role:"alertdialog","aria-modal":I(n)?"true":void 0,"aria-label":p?"Guide":void 0},!i&&e.progressBarPosition==="TOP"&&e.progressBarEnabled&&o.createElement($,{progress:h,type:e.progressBarType,position:n.appearance===k.MODAL?void 0:_.TOP,totalSteps:w}),o.createElement("div",{id:"userflowjs-bubble-content",className:"userflowjs-bubble-content","data-progress-position":e.progressBarPosition,"data-progress-type":e.progressBarType},o.createElement(he,{doc:r,lookupAttribute:Z(t.data),buttons:n.buttons,questions:n.questions})),o.createElement(X,{draftMode:t.draftMode,muted:l,toggleMuted:e.voiceType!==O.NONE?()=>c({kind:"toggleMuted"}):void 0,close:a.closeDisabled?void 0:()=>e.flowXButtonBehavior===de.DISMISS||m?s.endFlow(t,{endReason:M.USER_CLOSED}):c({kind:"showMenu"})}),!i&&e.progressBarPosition==="BOTTOM"&&e.progressBarEnabled&&o.createElement($,{progress:h,type:e.progressBarType,position:_.BOTTOM,totalSteps:w}))};function Pe(e,s){if(!e)return"";typeof e=="string"&&(e=K(e));const t=[],n=/[.!?;,]$/;function l(){const c=(t[t.length-1]||"").trim();c&&!c.match(n)&&t.push(".")}function p(c){if(Te(c)){if(c.text&&!c.silent){const u=c.text.split(`
|
|
2
2
|
`);u.forEach((m,i)=>{t.push(m),i<u.length-1&&(l(),t.push(`
|
|
3
|
-
`))})}return}switch(c.type){case"attribute":{const u=
|
|
3
|
+
`))})}return}switch(c.type){case"attribute":{const u=ve(c,s);u&&t.push(u);break}default:a(c.children),["link"].includes(c.type)||(l(),t.push(`
|
|
4
4
|
|
|
5
|
-
`));break}}function a(c){c.forEach(u=>d(u))}return a(e.children),t.join("").trim().replace(new RegExp(" ","g")," ").replace(new RegExp("\b","g"),"")}const _e=({bubbleFrame:e,theme:s})=>{const t=R(),{dispatch:n}=A(),{muted:l,session:d,step:a}=k(),c=t.getAudio();f.useEffect(()=>{const r=()=>{n({kind:"speechPlaying"})},b=()=>{n({kind:"speechStopped"})};return c.addEventListener("playing",r),c.addEventListener("ended",b),c.addEventListener("pause",b),()=>{c.removeEventListener("playing",r),c.removeEventListener("ended",b),c.removeEventListener("pause",b),c.pause(),c.src="",n({kind:"speechStopped"})}},[n,c]),f.useEffect(()=>{if(t.audioReady)return;const r=e&&Pe(e)?e.contentWindow:null,b=()=>{window.removeEventListener("mousedown",E),r&&r.removeEventListener("mousedown",E)},E=()=>{b(),t.playAudio(null)};return window.addEventListener("mousedown",E),r&&r.addEventListener("mousedown",E),b},[e,t]);const u=f.useRef(d),m=f.useRef(s),i=f.useRef(a);return f.useEffect(()=>{u.current=d,m.current=s,i.current=a},[d,s,a]),f.useEffect(()=>{if(!t.audioReady||l){t.pauseAudio();return}let r=!1;return(async()=>{if(await new Promise(g=>setTimeout(g,1)),r)return;const E=await xe(t,u.current,m.current,i.current);r||E&&t.playAudio(E)})(),()=>{r=!0}},[l,t,a.id,s.voiceType,s.syntheticVoice]),null};async function xe(e,s,t,n){if(t.voiceType===L.SYNTHETIC&&typeof t.syntheticVoice=="string"&&n.content){e.ensureIdentified();const l=X(s.data),d=Oe(n.content,l);return e.getStepSpeech(t.syntheticVoice,d)}else if(t.voiceType===L.MANUAL&&n.speechAsset)return n.speechAsset.assetUrl;return null}function Pe(e){return e.tagName==="IFRAME"}const je="userflowjs-out-of-viewport-pointer--visible",Ue="userflowjs-out-of-viewport-pointer--visible-up",qe="userflowjs-out-of-viewport-pointer--visible-down",He=o.forwardRef((e,s)=>{const t=Z();return o.createElement("div",{ref:s,className:"userflowjs-out-of-viewport-pointer",style:{zIndex:t+2}},o.createElement(Ae,{icon:Me}))});function Ve({subjectPosition:e,pointerRef:s,viewportClipRect:t}){const n=s.current;if(!n)return null;const l=n.getBoundingClientRect(),d=De(Ne());let a=e.direction,c,u;return a==null?null:(a==="down"&&t.bottom<l.height/2?a="up":a==="up"&&t.top>d&&(a="down"),c=e.left+e.width/2-l.width/2,u=a==="down"?t.bottom-l.height:t.top,{direction:a,left:c,top:u})}function $(e,s){const t=e.current;t&&(t.classList.toggle(je,s!=null),s&&(t.style.left=s.left+"px",t.style.top=s.top+"px",t.classList.toggle(Ue,s.direction==="up"),t.classList.toggle(qe,s.direction==="down")))}const We="userflowjs-fixed-widget--visible",$e=({theme:e})=>{const{step:s}=k();return o.createElement(o.Fragment,null,s.beacons.map(t=>o.createElement(ze,{key:t.id,beacon:t,theme:e})))},ze=({beacon:e,theme:s})=>{const{session:t}=k(),n=Z(),l=f.useRef(null),d=f.useRef(null),a=he(e.hiddenCondition),c=f.useMemo(()=>K(e.selector,t.data),[e.selector,t.data]),u=f.useCallback(({targetRect:i,clipEl:r,viewportClipRect:b})=>{const E=Ye({beacon:e,beaconRef:l,clipEl:r,viewportClipRect:b,targetRect:i,theme:s}),g=E&&Ve({subjectPosition:E.pointerSubjectPosition,pointerRef:d,viewportClipRect:b});ve(()=>{z(l,E),$(d,g)})},[e]),m=f.useCallback(()=>{z(l,null),$(d,null)},[]);return Te({selector:a?null:c,targetMoved:u,targetLost:m}),o.createElement(o.Fragment,null,o.createElement("div",{ref:l,className:"userflowjs-beacon userflowjs-beacon--pulse userflowjs-beacon--for-flow userflowjs-fixed-widget",style:{zIndex:n+2}},o.createElement("div",{className:"userflowjs-beacon__ring"}),o.createElement("div",{className:"userflowjs-beacon__ring"})),o.createElement(He,{ref:d}))};function Ye({beacon:e,beaconRef:s,clipEl:t,viewportClipRect:n,targetRect:l,theme:d}){if(!s.current||l.width===0||l.height===0)return null;const c=d.beaconSize,u=d.beaconSize,m=Ie(t);let i=0,r=0;switch(e.placement){case"top-left":case"left":case"bottom-left":i=l.left;break;case"top":case"center":case"bottom":i=l.left+l.width/2;break;default:i=l.left+l.width;break}switch(e.placement){case"left":case"center":case"right":r=l.top+l.height/2;break;case"bottom-left":case"bottom":case"bottom-right":r=l.top+l.height;break;default:r=l.top;break}i-=c/2,r-=u/2,i+=e.offsetX,r+=e.offsetY,i=Math.max(i,m.left-(t===document.documentElement?0:t.scrollLeft)),r=Math.max(r,m.top-(t===document.documentElement?0:t.scrollTop));const b=i+c,E=r+u,g=Math.min(32,.5*u);let h;E<n.top+g?h="up":r>n.bottom-g?h="down":h=null;const v=h==null;return{top:r,right:b,bottom:E,left:i,width:c,height:u,pointerSubjectPosition:{direction:h,left:i,width:c},visible:v}}function z(e,s){const t=e.current;t&&(t.classList.toggle(We,s!=null),s&&(t.style.transform=`translate3d(${s.left}px, ${s.top}px, 0)`,t.style.visibility=s.visible?"visible":"hidden"))}const Ge=()=>{const{t:e}=x(),s=R(),{restart:t}=A(),{session:n,step:l}=k(),d=l.theme||n.version.theme,a=l.selector,c=!a||a.type===ue.AUTO&&!a.autoData,u=()=>s.endFlow(n,{endReason:D.USER_CLOSED});return o.createElement(o.Fragment,null,o.createElement(G,{draftMode:n.draftMode,close:u}),n.draftMode&&c?o.createElement("div",{className:"userflowjs-bubble-content"},o.createElement("div",{className:"userflowjs-bubble-alert p-like"},o.createElement("span",{className:"userflowjs-bubble-alert__label"},"Preview-only tip"),"No tooltip target selected yet. Please go back to the Builder and select a tooltip target in ",o.createElement("b",null,"Step ",l.idx+1)," of"," ",o.createElement("b",null,n.flow.name),".")):n.draftMode&&d.tooltipMissingBehavior===O.END?o.createElement("div",{className:"userflowjs-bubble-content"},o.createElement("div",{className:"userflowjs-bubble-alert p-like"},o.createElement("p",null,o.createElement("span",{className:"userflowjs-bubble-alert__label"},"Preview-only tip"),"The tooltip target element in ",o.createElement("b",null,"Step ",l.idx+1)," of"," ",o.createElement("b",null,n.flow.name)," was not found within"," ",d.tooltipMissingToleranceSeconds," ",parseFloat(d.tooltipMissingToleranceSeconds)===1?"second":"seconds","."),o.createElement("p",null,"For regular users, the flow will auto-dismiss when this happens."),o.createElement("p",null,"If you are on the right page, then try reselecting the element in the Builder."),o.createElement("p",null,"Read more in our"," ",o.createElement("a",{href:"https://userflow.com/docs/trouble/element-not-found",target:"_blank",rel:"noopener noreferrer"},"Element not found guide"),"."))):o.createElement(o.Fragment,null,o.createElement("div",{className:"userflowjs-bubble-content"},n.draftMode&&o.createElement("div",{className:"userflowjs-bubble-alert p-like"},o.createElement("span",{className:"userflowjs-bubble-alert__label"},"Preview-only tip"),"The tooltip target element in ",o.createElement("b",null,"Step ",l.idx+1)," of"," ",o.createElement("b",null,n.flow.name)," was not found on the page. If you are on the right page, then try reselecting the element in the Builder."),o.createElement("p",null,o.createElement("b",null,e("tooltipTargetMissing.line1"))),o.createElement("p",null,e("tooltipTargetMissing.line2"))),o.createElement("div",{className:"userflowjs-bubble-buttons"},o.createElement(V,{appearance:"primary",onClick:t,text:e("menu.restart")}),o.createElement(V,{appearance:"default",onClick:u,text:e("menu.close")}))))},C="flowsMuted",kt=({session:e,checklistSession:s,resourceCenterEmbedsChecklist:t})=>{const n=R(),[l,d]=f.useState(!1),[a,c]=f.useState(null),[u,m]=f.useReducer(Ke,void 0,()=>{const p=e,w=_(p);return{...Xe,session:p,step:w,muted:!!B.getItem(C),autoFocusRequested:te(w)}}),{session:i,step:r,speechPlaying:b,contentType:E}=u,{version:g}=i,h=M(r);let v=0;r.questions.some(p=>p.type===de.NPS)&&(v=420);const T=Fe(r.theme||g.theme),S=f.useMemo(()=>{let p=T.bubbleY;const w=s?.version.theme;return!t&&s&&w&&s.version.checklist?.launcherEnabled&&r.appearance===N.BUBBLE&&w.checklistLauncherPlacement===T.bubblePlacement&&(T.avatarType===pe.NONE||w.checklistLauncherX<T.bubbleX+T.avatarSize)&&(p=Math.max(T.bubbleY,w.checklistLauncherY+w.checklistLauncherHeight+T.bubbleY)),{...T,bubbleWidth:Math.max(T.bubbleWidth,v),bubbleY:p}},[t,s,r.appearance,T,v]);f.useEffect(()=>{i!==e&&m({kind:"updateSession",session:e});const p=w=>{w.session.id===i.id&&m({kind:"goToStep",stepId:w.step.id})};return n.on("gotostep",p),()=>{n.off("gotostep",p)}},[n,i,e]);const se=f.useMemo(()=>({dispatch:m,restart:()=>{n.goToStep(i,ee(i)),m({kind:"showFlow"})}}),[n,m,i]),re=f.useMemo(()=>r.selector&&K(r.selector,i.data),[r.selector,i.data]),le=f.useCallback(()=>{Se(n,i,r.actions)},[n,i,r.actions]);f.useEffect(()=>{u.muted?B.setItem(C,"true"):B.removeItem(C)},[u.muted]);const P=i.locale?i.locale.standardLocaleId:S.languageId;f.useEffect(()=>{ke.changeLanguage(P)},[P]);const[j,ae]=f.useState(!1),ie=f.useCallback(p=>{ae(p),p&&n.send({kind:"ReportTooltipTargetMissing",sessionId:i.id,stepId:r.id}),p&&S.tooltipMissingBehavior===O.END&&!i.draftMode&&n.endFlow(i,{endReason:D.TOOLTIP_TARGET_MISSING})},[n,i,r.id,S.tooltipMissingBehavior]);return f.useEffect(()=>{if(!l||!u.autoFocusRequested)return;!n.originalActiveElement&&n.originalActiveElement!==a?.ownerDocument.defaultView?.frameElement&&(n.originalActiveElement=document.activeElement);let p=a?.querySelector('button:not([tabindex="-1"]):not(.userflowjs-bubble-toolbar-button), [tabindex]:not([tabindex="-1"]):not(.userflowjs-bubble-toolbar-button), input, textarea');if(p&&p.matches(".userflowjs-bubble-buttons button:not(.userflowjs-bubble-button--primary)")){const w=a?.querySelector(".userflowjs-bubble-buttons .userflowjs-bubble-button--primary");w&&(p=w)}p&&typeof p.focus=="function"&&p.focus({preventScroll:!0}),m({kind:"autoFocused"})},[n,a,l,u.autoFocusRequested]),f.useEffect(()=>{const p=a?.ownerDocument.defaultView;if(!p)return;const w=()=>{m({kind:"focusOut"}),delete n.originalActiveElement},y=()=>{m({kind:"focusIn"})};return window.addEventListener("focusin",w),p.addEventListener("focusin",y),()=>{window.removeEventListener("focusin",w),p.removeEventListener("focusin",y)}},[a,n]),f.useEffect(()=>{if(!h||!a)return;const p=a.ownerDocument.defaultView,w=p?p.document:document,y=I=>{if(I.key==="Escape"&&!g.closeDisabled)n.endFlow(i,{endReason:D.USER_CLOSED});else if(I.key==="Tab"){const F=a.querySelectorAll('button:not([tabindex="-1"]), [tabindex]:not([tabindex="-1"]), input, textarea'),U=F[0],q=F[F.length-1],H=w.activeElement;I.shiftKey?H===U&&(I.preventDefault(),q.focus()):H===q&&(I.preventDefault(),U.focus())}};return window.addEventListener("keydown",y),p?.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y),p?.removeEventListener("keydown",y)}},[h,n,i,a,g.closeDisabled]),f.useEffect(()=>{if(u.scrollToTopRequested){if(a?.ownerDocument.defaultView?.frameElement){const p=a?.ownerDocument.body;p&&(p.scrollTop=0)}m({kind:"scrolledToTop"})}},[u.scrollToTopRequested,a]),o.createElement(ne.Provider,{value:se},o.createElement(oe.Provider,{value:u},o.createElement(ye.Provider,{value:i},o.createElement(Re,null,o.createElement(me,{company:i.flow.company,theme:S,position:"fixed",stepKey:r.crossVersionId,stepAppearance:r.appearance,width:r.width,backgroundImageUrl:E==="flow"&&!j&&r.backgroundAsset?r.backgroundAsset.assetUrl:null,tooltipSelector:re,tooltipPlacement:r.tooltipPlacement,backdrop:r.backdrop,tooltipTargetBlocked:r.tooltipTargetBlocked,backdropPadding:r.backdropPadding,onTooltipTargetClick:le,onTooltipTargetMissingChange:ie,onModalBackdropClick:r.appearance===N.MODAL&&S.modalBackdropOnclick===fe.DISMISS&&!g.closeDisabled?()=>n.endFlow(i,{endReason:D.USER_CLOSED}):void 0,speaking:b,minimizeOnAvatarClick:!0,autoHide3pEnabled:!0,onVisibleChange:d,bubbleFrameRootRef:c,rootChildren:p=>o.createElement(Qe,{...p,theme:S})},E==="menu"?o.createElement(Ce,null):j&&S.tooltipMissingBehavior!==O.BUBBLE?o.createElement(Ge,null):o.createElement(Le,{theme:S}))))))},Qe=({visible:e,bubbleFrame:s,theme:t})=>{const n=k(),{step:l}=n,d=n.session.currentStep&&n.session.currentStep.id,[a,c]=f.useState(!1),u=f.useRef(d);return f.useEffect(()=>{e?c(!0):u.current!==d&&c(!1),u.current=d},[d,e]),o.createElement(o.Fragment,null,(e||a)&&n.contentType==="flow"&&o.createElement(o.Fragment,null,o.createElement(_e,{bubbleFrame:s,theme:t}),o.createElement($e,{theme:t})),l.triggers.map(m=>o.createElement(Be,{key:m.id,trigger:m})))},Xe={muted:!1,speechPlaying:!1,contentType:"flow",autoFocusRequested:!1,hasFocus:!1,scrollToTopRequested:!1,shouldLabelDialog:!0};function Ke(e,s){switch(s.kind){case"updateSession":{let t;return s.session.id===e.session.id?t=s.session.version.steps.find(({crossVersionId:n})=>n===e.step.crossVersionId)||_(s.session):t=_(s.session),{...e,session:s.session,step:t}}case"goToStep":{const t=e.session.version.steps.find(n=>n.id===s.stepId);return t?{...e,step:t,contentType:"flow",autoFocusRequested:e.hasFocus||te(t),scrollToTopRequested:!0,shouldLabelDialog:!e.hasFocus}:e}case"toggleMuted":return{...e,muted:!e.muted};case"speechPlaying":return{...e,speechPlaying:!0};case"speechStopped":return{...e,speechPlaying:!1};case"showFlow":return{...e,contentType:"flow",autoFocusRequested:!0,scrollToTopRequested:!0};case"showMenu":return{...e,contentType:"menu",autoFocusRequested:!0,scrollToTopRequested:!0};case"autoFocused":return{...e,autoFocusRequested:!1};case"focusIn":return{...e,hasFocus:!0};case"focusOut":return{...e,hasFocus:!1};case"scrolledToTop":return{...e,scrollToTopRequested:!1}}}function _(e){const{currentStep:s}=e,{steps:t}=e.version;if(s){const n=t.find(({crossVersionId:l})=>l===s.crossVersionId);if(!n)throw new Y("Session points to an unknown step: "+s.crossVersionId);return n}else return ee(e)}function ee(e){const s=e.version.steps[0];if(!s)throw new Y("Session has no current step and its version has no start step");return s}function te(e){return M(e)}function M(e){return e.appearance===N.MODAL||e.appearance===N.BUBBLE&&e.backdrop||e.appearance===N.TOOLTIP&&e.tooltipTargetBlocked}const ne=f.createContext(null),oe=f.createContext(null);function A(){return f.useContext(ne)}function k(){return f.useContext(oe)}export{kt as FlowApp,oe as FlowStateContext,kt as default,Xe as initialFlowState,M as isStepModal,A as useFlowDispatch,k as useFlowState};
|
|
5
|
+
`));break}}function a(c){c.forEach(u=>p(u))}return a(e.children),t.join("").trim().replace(new RegExp(" ","g")," ").replace(new RegExp("\b","g"),"")}const je=({bubbleFrame:e,theme:s})=>{const t=N(),{dispatch:n}=F(),{muted:l,session:p,step:a}=D(),c=t.getAudio();d.useEffect(()=>{const r=()=>{n({kind:"speechPlaying"})},E=()=>{n({kind:"speechStopped"})};return c.addEventListener("playing",r),c.addEventListener("ended",E),c.addEventListener("pause",E),()=>{c.removeEventListener("playing",r),c.removeEventListener("ended",E),c.removeEventListener("pause",E),c.pause(),c.src="",n({kind:"speechStopped"})}},[n,c]),d.useEffect(()=>{if(t.audioReady)return;const r=e&&qe(e)?e.contentWindow:null,E=()=>{window.removeEventListener("mousedown",b),r&&r.removeEventListener("mousedown",b)},b=()=>{E(),t.playAudio(null)};return window.addEventListener("mousedown",b),r&&r.addEventListener("mousedown",b),E},[e,t]);const u=d.useRef(p),m=d.useRef(s),i=d.useRef(a);return d.useEffect(()=>{u.current=p,m.current=s,i.current=a},[p,s,a]),d.useEffect(()=>{if(!t.audioReady||l){t.pauseAudio();return}let r=!1;return(async()=>{if(await new Promise(w=>setTimeout(w,1)),r)return;const b=await Ue(t,u.current,m.current,i.current);r||b&&t.playAudio(b)})(),()=>{r=!0}},[l,t,a.id,s.voiceType,s.syntheticVoice]),null};async function Ue(e,s,t,n){if(t.voiceType===O.SYNTHETIC&&typeof t.syntheticVoice=="string"&&n.content){e.ensureIdentified();const l=Z(s.data),p=Pe(n.content,l);return e.getStepSpeech(t.syntheticVoice,p)}else if(t.voiceType===O.MANUAL&&n.speechAsset)return n.speechAsset.assetUrl;return null}function qe(e){return e.tagName==="IFRAME"}const Ve="userflowjs-out-of-viewport-pointer--visible",He="userflowjs-out-of-viewport-pointer--visible-up",We="userflowjs-out-of-viewport-pointer--visible-down",ze=o.forwardRef((e,s)=>{const t=ee();return o.createElement("div",{ref:s,className:"userflowjs-out-of-viewport-pointer",style:{zIndex:t+2}},o.createElement(Le,{icon:Be}))});function $e({subjectPosition:e,pointerRef:s,viewportClipRect:t}){const n=s.current;if(!n)return null;const l=n.getBoundingClientRect(),p=Ne(Ie());let a=e.direction,c,u;return a==null?null:(a==="down"&&t.bottom<l.height/2?a="up":a==="up"&&t.top>p&&(a="down"),c=e.left+e.width/2-l.width/2,u=a==="down"?t.bottom-l.height:t.top,{direction:a,left:c,top:u})}function Y(e,s){const t=e.current;t&&(t.classList.toggle(Ve,s!=null),s&&(t.style.left=s.left+"px",t.style.top=s.top+"px",t.classList.toggle(He,s.direction==="up"),t.classList.toggle(We,s.direction==="down")))}const Ye="userflowjs-fixed-widget--visible",Ge=({theme:e})=>{const{step:s}=D();return o.createElement(o.Fragment,null,s.beacons.map(t=>o.createElement(Qe,{key:t.id,beacon:t,theme:e})))},Qe=({beacon:e,theme:s})=>{const{session:t}=D(),n=ee(),l=d.useRef(null),p=d.useRef(null),a=Se(e.hiddenCondition),c=d.useMemo(()=>J(e.selector,t.data),[e.selector,t.data]),u=d.useCallback(({targetRect:i,clipEl:r,viewportClipRect:E})=>{const b=Xe({beacon:e,beaconRef:l,clipEl:r,viewportClipRect:E,targetRect:i,theme:s}),w=b&&$e({subjectPosition:b.pointerSubjectPosition,pointerRef:p,viewportClipRect:E});ke(()=>{G(l,b),Y(p,w)})},[e]),m=d.useCallback(()=>{G(l,null),Y(p,null)},[]);return ye({selector:a?null:c,targetMoved:u,targetLost:m}),o.createElement(o.Fragment,null,o.createElement("div",{ref:l,className:"userflowjs-beacon userflowjs-beacon--pulse userflowjs-beacon--for-flow userflowjs-fixed-widget",style:{zIndex:n+2}},o.createElement("div",{className:"userflowjs-beacon__ring"}),o.createElement("div",{className:"userflowjs-beacon__ring"})),o.createElement(ze,{ref:p}))};function Xe({beacon:e,beaconRef:s,clipEl:t,viewportClipRect:n,targetRect:l,theme:p}){if(!s.current||l.width===0||l.height===0)return null;const c=p.beaconSize,u=p.beaconSize,m=Fe(t);let i=0,r=0;switch(e.placement){case"top-left":case"left":case"bottom-left":i=l.left;break;case"top":case"center":case"bottom":i=l.left+l.width/2;break;default:i=l.left+l.width;break}switch(e.placement){case"left":case"center":case"right":r=l.top+l.height/2;break;case"bottom-left":case"bottom":case"bottom-right":r=l.top+l.height;break;default:r=l.top;break}i-=c/2,r-=u/2,i+=e.offsetX,r+=e.offsetY,i=Math.max(i,m.left-(t===document.documentElement?0:t.scrollLeft)),r=Math.max(r,m.top-(t===document.documentElement?0:t.scrollTop));const E=i+c,b=r+u,w=Math.min(32,.5*u);let h;b<n.top+w?h="up":r>n.bottom-w?h="down":h=null;const v=h==null;return{top:r,right:E,bottom:b,left:i,width:c,height:u,pointerSubjectPosition:{direction:h,left:i,width:c},visible:v}}function G(e,s){const t=e.current;t&&(t.classList.toggle(Ye,s!=null),s&&(t.style.transform=`translate3d(${s.left}px, ${s.top}px, 0)`,t.style.visibility=s.visible?"visible":"hidden"))}const Ke=()=>{const{t:e}=j(),s=N(),{restart:t}=F(),{session:n,step:l}=D(),p=l.theme||n.version.theme,a=l.selector,c=!a||a.type===pe.AUTO&&!a.autoData,u=()=>s.endFlow(n,{endReason:M.USER_CLOSED});return o.createElement(o.Fragment,null,o.createElement(X,{draftMode:n.draftMode,close:u}),n.draftMode&&c?o.createElement("div",{className:"userflowjs-bubble-content"},o.createElement("div",{className:"userflowjs-bubble-alert p-like"},o.createElement("span",{className:"userflowjs-bubble-alert__label"},"Preview-only tip"),"No tooltip target selected yet. Please go back to the Builder and select a tooltip target in ",o.createElement("b",null,"Step ",l.idx+1)," of"," ",o.createElement("b",null,n.flow.name),".")):n.draftMode&&p.tooltipMissingBehavior===x.END?o.createElement("div",{className:"userflowjs-bubble-content"},o.createElement("div",{className:"userflowjs-bubble-alert p-like"},o.createElement("p",null,o.createElement("span",{className:"userflowjs-bubble-alert__label"},"Preview-only tip"),"The tooltip target element in ",o.createElement("b",null,"Step ",l.idx+1)," of"," ",o.createElement("b",null,n.flow.name)," was not found within"," ",p.tooltipMissingToleranceSeconds," ",parseFloat(p.tooltipMissingToleranceSeconds)===1?"second":"seconds","."),o.createElement("p",null,"For regular users, the flow will auto-dismiss when this happens."),o.createElement("p",null,"If you are on the right page, then try reselecting the element in the Builder."),o.createElement("p",null,"Read more in our"," ",o.createElement("a",{href:"https://userflow.com/docs/trouble/element-not-found",target:"_blank",rel:"noopener noreferrer"},"Element not found guide"),"."))):o.createElement(o.Fragment,null,o.createElement("div",{className:"userflowjs-bubble-content"},n.draftMode&&o.createElement("div",{className:"userflowjs-bubble-alert p-like"},o.createElement("span",{className:"userflowjs-bubble-alert__label"},"Preview-only tip"),"The tooltip target element in ",o.createElement("b",null,"Step ",l.idx+1)," of"," ",o.createElement("b",null,n.flow.name)," was not found on the page. If you are on the right page, then try reselecting the element in the Builder."),o.createElement("p",null,o.createElement("b",null,e("tooltipTargetMissing.line1"))),o.createElement("p",null,e("tooltipTargetMissing.line2"))),o.createElement("div",{className:"userflowjs-bubble-buttons"},o.createElement(z,{appearance:"primary",onClick:t,text:e("menu.restart")}),o.createElement(z,{appearance:"default",onClick:u,text:e("menu.close")}))))},C="flowsMuted",Nt=({session:e,checklistSession:s,resourceCenterEmbedsChecklist:t})=>{const n=N(),[l,p]=d.useState(!1),[a,c]=d.useState(null),[u,m]=d.useReducer(et,void 0,()=>{const f=e,g=P(f);return{...Je,session:f,step:g,muted:!!L.getItem(C),autoFocusRequested:oe(g)}}),{session:i,step:r,speechPlaying:E,contentType:b}=u,{version:w}=i,h=I(r);let v=0;r.questions.some(f=>f.type===fe.NPS)&&(v=420);const T=Ce(r.theme||w.theme),S=d.useMemo(()=>{let f=T.bubbleY;const g=s?.version.theme;return!t&&s&&g&&s.version.checklist?.launcherEnabled&&r.appearance===k.BUBBLE&&g.checklistLauncherPlacement===T.bubblePlacement&&(T.avatarType===me.NONE||g.checklistLauncherX<T.bubbleX+T.avatarSize)&&(f=Math.max(T.bubbleY,g.checklistLauncherY+g.checklistLauncherHeight+T.bubbleY)),{...T,bubbleWidth:Math.max(T.bubbleWidth,v),bubbleY:f}},[t,s,r.appearance,T,v]);d.useEffect(()=>{i!==e&&m({kind:"updateSession",session:e});const f=g=>{g.session.id===i.id&&m({kind:"goToStep",stepId:g.step.id})};return n.on("gotostep",f),()=>{n.off("gotostep",f)}},[n,i,e]);const le=d.useMemo(()=>({dispatch:m,restart:()=>{n.goToStep(i,ne(i)),m({kind:"showFlow"})}}),[n,m,i]),ae=d.useMemo(()=>r.selector&&J(r.selector,i.data),[r.selector,i.data]),ie=d.useCallback(()=>{De(n,i,r.actions)},[n,i,r.actions]);d.useEffect(()=>{u.muted?L.setItem(C,"true"):L.removeItem(C)},[u.muted]);const U=i.locale?i.locale.standardLocaleId:S.languageId;d.useEffect(()=>{Re.changeLanguage(U)},[U]);const[q,ce]=d.useState(!1),ue=d.useCallback(f=>{ce(f),f&&n.send({kind:"ReportTooltipTargetMissing",sessionId:i.id,stepId:r.id}),f&&S.tooltipMissingBehavior===x.END&&!i.draftMode&&n.endFlow(i,{endReason:M.TOOLTIP_TARGET_MISSING})},[n,i,r.id,S.tooltipMissingBehavior]);return d.useEffect(()=>{if(!l||!u.autoFocusRequested)return;!n.originalActiveElement&&n.originalActiveElement!==a?.ownerDocument.defaultView?.frameElement&&(n.originalActiveElement=document.activeElement);let f=a?.querySelector('button:not([tabindex="-1"]):not(.userflowjs-bubble-toolbar-button), [tabindex]:not([tabindex="-1"]):not(.userflowjs-bubble-toolbar-button), input, textarea');if(f&&f.matches(".userflowjs-bubble-buttons button:not(.userflowjs-bubble-button--primary)")){const g=a?.querySelector(".userflowjs-bubble-buttons .userflowjs-bubble-button--primary");g&&(f=g)}f&&typeof f.focus=="function"&&f.focus({preventScroll:!0}),m({kind:"autoFocused"})},[n,a,l,u.autoFocusRequested]),d.useEffect(()=>{const f=a?.ownerDocument.defaultView;if(!f)return;const g=()=>{m({kind:"focusOut"}),delete n.originalActiveElement},y=()=>{m({kind:"focusIn"})};return window.addEventListener("focusin",g),f.addEventListener("focusin",y),()=>{window.removeEventListener("focusin",g),f.removeEventListener("focusin",y)}},[a,n]),d.useEffect(()=>{if(!h||!a)return;const f=a.ownerDocument.defaultView,g=f?f.document:document,y=R=>{if(R.key==="Escape"&&!w.closeDisabled)n.endFlow(i,{endReason:M.USER_CLOSED});else if(R.key==="Tab"){const A=a.querySelectorAll('button:not([tabindex="-1"]), [tabindex]:not([tabindex="-1"]), input, textarea'),V=A[0],H=A[A.length-1],W=g.activeElement;R.shiftKey?W===V&&(R.preventDefault(),H.focus()):W===H&&(R.preventDefault(),V.focus())}};return window.addEventListener("keydown",y),f?.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y),f?.removeEventListener("keydown",y)}},[h,n,i,a,w.closeDisabled]),d.useEffect(()=>{if(u.scrollToTopRequested){if(a?.ownerDocument.defaultView?.frameElement){const f=a?.ownerDocument.body;f&&(f.scrollTop=0)}m({kind:"scrolledToTop"})}},[u.scrollToTopRequested,a]),o.createElement(se.Provider,{value:le},o.createElement(re.Provider,{value:u},o.createElement(Me.Provider,{value:i},o.createElement(Ae,null,o.createElement(ge,{company:i.flow.company,theme:S,position:"fixed",stepKey:r.crossVersionId,stepAppearance:r.appearance,width:r.width,backgroundImageUrl:b==="flow"&&!q&&r.backgroundAsset?r.backgroundAsset.assetUrl:null,tooltipSelector:ae,tooltipPlacement:r.tooltipPlacement,backdrop:r.backdrop,tooltipTargetBlocked:r.tooltipTargetBlocked,backdropPadding:r.backdropPadding,onTooltipTargetClick:ie,onTooltipTargetMissingChange:ue,onModalBackdropClick:r.appearance===k.MODAL&&S.modalBackdropOnclick===be.DISMISS&&!w.closeDisabled?()=>n.endFlow(i,{endReason:M.USER_CLOSED}):void 0,speaking:E,minimizeOnAvatarClick:!0,autoHide3pEnabled:!0,onVisibleChange:p,bubbleFrameRootRef:c,rootChildren:f=>o.createElement(Ze,{...f,theme:S})},b==="menu"?o.createElement(xe,null):q&&S.tooltipMissingBehavior!==x.BUBBLE?o.createElement(Ke,null):o.createElement(_e,{theme:S}))))))},Ze=({visible:e,bubbleFrame:s,theme:t})=>{const n=D(),{step:l}=n,p=n.session.currentStep&&n.session.currentStep.id,[a,c]=d.useState(!1),u=d.useRef(p);return d.useEffect(()=>{e?c(!0):u.current!==p&&c(!1),u.current=p},[p,e]),o.createElement(o.Fragment,null,(e||a)&&n.contentType==="flow"&&o.createElement(o.Fragment,null,o.createElement(je,{bubbleFrame:s,theme:t}),o.createElement(Ge,{theme:t})),l.triggers.map(m=>o.createElement(Oe,{key:m.id,trigger:m})))},Je={muted:!1,speechPlaying:!1,contentType:"flow",autoFocusRequested:!1,hasFocus:!1,scrollToTopRequested:!1,shouldLabelDialog:!0};function et(e,s){switch(s.kind){case"updateSession":{let t;return s.session.id===e.session.id?t=s.session.version.steps.find(({crossVersionId:n})=>n===e.step.crossVersionId)||P(s.session):t=P(s.session),{...e,session:s.session,step:t}}case"goToStep":{const t=e.session.version.steps.find(n=>n.id===s.stepId);return t?{...e,step:t,contentType:"flow",autoFocusRequested:e.hasFocus||oe(t),scrollToTopRequested:!0,shouldLabelDialog:!e.hasFocus}:e}case"toggleMuted":return{...e,muted:!e.muted};case"speechPlaying":return{...e,speechPlaying:!0};case"speechStopped":return{...e,speechPlaying:!1};case"showFlow":return{...e,contentType:"flow",autoFocusRequested:!0,scrollToTopRequested:!0};case"showMenu":return{...e,contentType:"menu",autoFocusRequested:!0,scrollToTopRequested:!0};case"autoFocused":return{...e,autoFocusRequested:!1};case"focusIn":return{...e,hasFocus:!0};case"focusOut":return{...e,hasFocus:!1};case"scrolledToTop":return{...e,scrollToTopRequested:!1}}}function P(e){const{currentStep:s}=e,{steps:t}=e.version;if(s){const n=t.find(({crossVersionId:l})=>l===s.crossVersionId);if(!n)throw new Q("Session points to an unknown step: "+s.crossVersionId);return n}else return ne(e)}function ne(e){const s=e.version.steps[0];if(!s)throw new Q("Session has no current step and its version has no start step");return s}function oe(e){return I(e)}function I(e){return e.appearance===k.MODAL||e.appearance===k.BUBBLE&&e.backdrop||e.appearance===k.TOOLTIP&&e.tooltipTargetBlocked}const se=d.createContext(null),re=d.createContext(null);function F(){return d.useContext(se)}function D(){return d.useContext(re)}export{Nt as FlowApp,re as FlowStateContext,Nt as default,Je as initialFlowState,I as isStepModal,F as useFlowDispatch,D as useFlowState};
|
|
6
6
|
//# sourceMappingURL=FlowApp.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as u,R as n}from"./vendor.react.js";import{$ as _,a0 as y,u as Y}from"./userflow.js";import{u as Ee}from"./client-context.js";import{D as q,E as Q,F as be,G as P,H as $,I as V,J as X,K as Z}from"./vendor.fortawesome.pro-regular-svg-icons.js";import{p as _e}from"./vendor.dompurify.js";import{m as ke}from"./vendor.marked.js";import{o as F}from"./vendor.obj-str.js";import{A as we,d as Ie,G as Se}from"./ResourceCenterApp.js";import{f as je,R as Ce}from"./use-selector-element-monitoring.js";import{D as W}from"./stylesheets.js";import{U as ae}from"./roots.js";import{r as ee}from"./vendor.react-dom.js";import"./vendor.core-js.js";import{g as Me}from"./flow-condition-types.js";import{u as ve}from"./vendor.react-i18next.js";import"./vendor.object-assign.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";import"./vendor.i18next.js";import"./flow-host.styl.js";import"./use-window-resize.js";import"./logomark.js";import"./ChecklistUI.js";import"./vendor.fortawesome.pro-solid-svg-icons.js";import"./FlowChrome.js";import"./use-element-rect.js";import"./vendor.bignumber.js.js";import"./vendor.scheduler.js";import"./vendor.date-fns.js";import"./vendor.babel.runtime.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="62f47daa-14bf-4a76-95b5-6b0cc0160172",t._sentryDebugIdIdentifier="sentry-dbid-62f47daa-14bf-4a76-95b5-6b0cc0160172")}catch{}})();function Re(t){const e=Intl.Segmenter;return e?/(\p{Emoji_Presentation}|\p{Extended_Pictographic})(\p{Emoji_Modifier_Base}?\p{Emoji_Modifier}?|\uFE0F\u200D(\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?\uFE0F\u200D)*\p{Emoji_Presentation}|\uFE0F\u200D\p{Extended_Pictographic})/u.test(t)&&[...new e().segment(t)].length===1:!1}const te=[];function Ne({assistant:t,lookupAttribute:e,initialConversationId:a,initialHistory:c,initialUserContent:m,onConversationIdChange:f,submitMessage:h,submitRating:l,submitFeedback:g,InsideMessage:r,onContactClick:p,contactButtonText:i}){const[o,d]=u.useState(null),[S,w]=u.useState(()=>c?c.map(s=>({...s,assistantHtml:x(B(s.assistantContent),!1)})):te),[D,M]=u.useState(""),j=u.useRef(null),k=u.useRef(null),b=u.useRef(!0),I=u.useRef(a||null),[ce,le]=u.useState(I.current),H=u.useCallback(s=>{I.current=s,le(s),f&&f(s)},[f]),T=u.useCallback(()=>{o?.focus({preventScroll:!0})},[o]);u.useEffect(()=>{T()},[T]),u.useLayoutEffect(()=>{const s=k.current;s&&(s.scrollTop=Math.ceil(s.scrollHeight-s.clientHeight))},[]);const K=u.useCallback(()=>{const s=k.current;s&&(b.current=!0,typeof s.scrollTo=="function"&&s.scrollTo({top:Math.ceil(s.scrollHeight-s.clientHeight),behavior:"smooth"}))},[]),G=u.useRef(0);u.useLayoutEffect(()=>{const s=k.current;s&&s.scrollHeight!==G.current&&(G.current=s.scrollHeight,b.current&&K())},[S,K]);const N=u.useCallback(()=>{j.current&&j.current()},[]);u.useEffect(()=>()=>{N()},[N]);const O=(s,R)=>{w(C=>C.map(v=>{if(s===v.id){const E=R(v);return{...v,...E}}else return v}))},L=s=>{w(R=>R.map((C,v)=>{if(v===R.length-1){const E=s(C);return{...C,...E}}else return C}))},U=u.useCallback(async s=>{if(s=s.trim(),s==="")return;N(),w(E=>[...E,{id:null,userContent:s,assistantContent:"",assistantHtml:x("","enter"),enterAnimation:!0,sources:[],completed:!1,rating:null,scaleRating:null,scaleMax:null,feedbackSubmitted:!1}]),M(""),K();let R=!1;const C=()=>{R=!0,j.current=null},v=h({conversationId:I.current,userContent:s,callback:E=>{if(R){console.log("Userflow.js AssistantChat got message after being done",E);return}switch(E.kind){case"conversation_created":H(E.conversationId);break;case"message_created":L(()=>({id:E.messageId,warning:E.warning}));break;case"assistant_content_delta":L(A=>{const he=E.delta,z=A.assistantContent+he,ge=B(z),pe=x(ge);return{assistantContent:z,assistantHtml:pe}});break;case"done":C(),L(A=>({assistantHtml:x(A.assistantContent,"exit"),completed:!0,sources:E.sources}));break;case"error":C(),L(A=>({failed:!0,error:E.message,assistantHtml:x(B(A.assistantContent),!1)}));break;default:console.log("Userflow.js AssistantChat got unknown message",E)}}});j.current=()=>{C(),v.abort(),L(E=>({assistantHtml:x(B(E.assistantContent),!1)}))}},[N,K,h,H]),J=u.useRef(!1);u.useEffect(()=>{J.current||(J.current=!0,m&&U(m))},[U,m]);const ie=u.useCallback(()=>{N(),H(null),w(te),T()},[N,T,H]),[ue,fe]=u.useState(!0),de=u.useCallback(()=>{const s=k.current;s&&fe(s.scrollTop===0)},[]),me=u.useCallback(()=>{const s=k.current;s&&(b.current=Math.ceil(s.scrollHeight-s.clientHeight)==Math.ceil(s.scrollTop))},[]);return{assistant:t,lookupAttribute:e,history:S,setInput:d,contentElRef:k,scrolledToTop:ue,userContent:D,setUserContent:M,onSubmitMessage:U,supportsFeedback:!!l&&!!g,onSubmitRating:s=>{if(l){switch(s.ratingMode){case _.LIKE:O(s.messageId,()=>({rating:s.rating}));break;case _.SCALE:O(s.messageId,()=>({scaleRating:s.scaleRating,scaleMax:s.scaleMax}));break;default:throw new ae(s)}l(s)}},onSubmitFeedback:s=>{g&&(O(s.messageId,()=>({feedbackSubmitted:!0})),g(s))},InsideMessage:r,onContactClick:p,contactButtonText:i,reset:ie,onContentScroll:de,onContentWheel:me,conversationId:ce}}const xe=({assistant:t,lookupAttribute:e,history:a,setInput:c,contentElRef:m,scrolledToTop:f,userContent:h,setUserContent:l,onSubmitMessage:g,supportsFeedback:r,onSubmitRating:p,onSubmitFeedback:i,InsideMessage:o,onContactClick:d,contactButtonText:S,reset:w,onContentScroll:D,onContentWheel:M,conversationId:j})=>{const k=a.some(b=>b.completed||b.failed);return n.createElement("div",{className:"userflowjs-assistant-chat"},n.createElement("div",{className:F({"userflowjs-assistant-chat__header":!0,"userflowjs-assistant-chat__header--content-scrolled":!f})}),n.createElement("div",{className:F({"userflowjs-assistant-chat__header":!0,"userflowjs-assistant-chat__header--content-scrolled":!f})},n.createElement(n.Fragment,null,n.createElement("h2",{className:"userflowjs-assistant-chat__title"},t.title),n.createElement("button",{className:"userflowjs-bubble-button userflowjs-bubble-button--default",onClick:w},t.resetText))),n.createElement("div",{ref:m,className:"userflowjs-assistant-chat__content",onScroll:D,onWheel:M},!je(t.intro)&&n.createElement("div",{className:"userflowjs-assistant-chat__intro"},n.createElement(Ce,{doc:t.intro,lookupAttribute:e})),a.map((b,I)=>n.createElement(Le,{key:I,assistant:t,message:b,supportsFeedback:r,onSubmitRating:p,onSubmitFeedback:i,InsideMessage:o,conversationId:j,isLast:I===a.length-1}))),n.createElement("div",{className:"userflowjs-assistant-chat__prompt"},n.createElement(we,{textareaRef:c,placeholder:(a.length===0?t.promptEmptyPlaceholder:t.promptNonemptyPlaceholder)||"",value:h,onChange:l,onSubmit:()=>g(h)})),k&&d&&n.createElement("div",{className:"userflowjs-assistant-chat__contact"},n.createElement("button",{className:"userflowjs-tertiary-button",onClick:()=>d()},S)))},Le=({assistant:t,message:e,supportsFeedback:a,onSubmitRating:c,onSubmitFeedback:m,InsideMessage:f,conversationId:h,isLast:l})=>n.createElement("div",{className:"userflowjs-assistant-chat__message"},f&&n.createElement(f,{message:e}),n.createElement("div",{className:F({"userflowjs-assistant-chat__user-content":!0,"userflowjs-assistant-chat__user-content--enter":!!e.enterAnimation}),"data-assistant-conversation-id":h,"data-assistant-message-id":e.id},n.createElement("div",{style:{whiteSpace:"pre-wrap"}},e.userContent)),e.warning&&n.createElement("div",{className:"userflowjs-assistant-chat__error"},"Warning: ",e.warning),n.createElement("div",{className:"userflowjs-assistant-chat__assistant-content"},n.createElement("div",null,n.createElement(ye,{html:e.assistantHtml})),e.error&&n.createElement("div",{className:"userflowjs-assistant-chat__error"},e.error)),e.sources&&e.sources.length>0&&n.createElement("div",{className:"userflowjs-assistant-chat__sources"},n.createElement("div",{className:"userflowjs-assistant-chat__sources-title"},t.sourcesText),e.sources.map((g,r)=>n.createElement("a",{key:r,className:"userflowjs-assistant-chat__source",href:Ie(g.url),target:"_blank",rel:"noreferrer noopener"},g.title))),a&&e.completed&&e.id&&(t.ratingMode===_.LIKE||t.ratingMode===_.SCALE&&l)&&n.createElement(Ae,{assistant:t,message:e,onSubmitRating:c,onSubmitFeedback:m})),Ae=({assistant:t,message:e,onSubmitRating:a,onSubmitFeedback:c})=>{const m=u.useRef(null),[f,h]=u.useState(""),l=i=>{const o=e.id;o&&(ee.flushSync(()=>{a({ratingMode:_.LIKE,messageId:o,rating:i})}),m.current?.focus({preventScroll:!0}))},g=i=>{const o=e.id;o&&(ee.flushSync(()=>{a({ratingMode:_.SCALE,messageId:o,scaleRating:i,scaleMax:t.scaleMax})}),m.current?.focus({preventScroll:!0}))},r=()=>{e.id&&(c({messageId:e.id,feedback:f.trim()}),h(""))},p=t.ratingMode===_.LIKE?n.createElement("button",{className:"userflowjs-assistant-chat__rating-option",disabled:!0},n.createElement(W,{icon:e.rating==y.DISLIKE?q:Q})):e.scaleRating&&e.scaleMax&&n.createElement("button",{className:F({"userflowjs-assistant-chat__rating-option":!0,"userflowjs-assistant-chat__rating-option--scale":!0}),disabled:!0},oe(t,e.scaleRating,e.scaleMax));return n.createElement("div",{className:`userflowjs-assistant-chat__rating userflowjs-assistant-chat__rating--${t.ratingMode}`},t.ratingMode===_.SCALE&&n.createElement("div",{className:"userflowjs-assistant-chat__rating-question"},t.scaleQuestion),e.feedbackSubmitted?n.createElement("div",{className:"userflowjs-assistant-chat__rating-thanks"},p,n.createElement("div",{className:"userflowjs-assistant-chat__rating-thanks-message"},t.feedbackThanksText)):(t.ratingMode===_.LIKE?e.rating:e.scaleRating)?n.createElement(Se,{textareaRef:m,className:"userflowjs-growing-textarea userflowjs-assistant-chat__feedback-textarea",mirrorClassName:"userflowjs-growing-textarea__mirror",textareaClassName:"userflowjs-textarea",placeholder:(t.ratingMode===_.LIKE?e.rating===y.LIKE?t.feedbackLikePlaceholder:t.feedbackDislikePlaceholder:t.scaleFeedbackPlaceholder)||"",value:f,onChange:h,onKeyDown:i=>{!i.shiftKey&&i.key==="Enter"&&(i.preventDefault(),r())}},p,n.createElement("button",{className:"userflowjs-assistant-chat__feedback-submit",onClick:()=>r()},n.createElement(W,{icon:be}))):n.createElement("div",{className:"userflowjs-assistant-chat__rating-options"},t.ratingMode===_.LIKE?[y.LIKE,y.DISLIKE].map(i=>(!e.rating||e.rating===i)&&n.createElement("button",{key:i,className:"userflowjs-assistant-chat__rating-option",onClick:e.rating?void 0:()=>l(i),disabled:!!e.rating,"data-testid":`assistant-chat-rating-${i}`},n.createElement(W,{icon:i==y.DISLIKE?q:Q}))):Fe(t).map(({value:i,label:o})=>n.createElement("button",{key:i,className:F({"userflowjs-assistant-chat__rating-option":!0,"userflowjs-assistant-chat__rating-option--large-scale":Re(o||"")}),onClick:e.scaleRating?void 0:()=>g(i),disabled:!!e.scaleRating,"data-testid":`assistant-chat-rating-${i}`},o))))};function B(t){let e=t;const a=f=>(f=f.replace(/\s*[*_`]*$/,""),f=f.replace(/(^|\n)\s*(\d+\.?|-|=)$/,""),f);e=a(e),e=e.replace(/\[([^\]\n]*)(\](\([^)\n]*)?)?$/,"$1"),e=a(e);const c=Array.from(e.matchAll(/\n( *)```/g));if(c.length%2===1){const f=c[c.length-1][1];e+=`
|
|
1
|
+
import{r as u,R as n}from"./vendor.react.js";import{a0 as _,a1 as y,u as Y}from"./userflow.js";import{u as Ee}from"./client-context.js";import{D as q,E as Q,F as be,G as P,H as $,I as V,J as X,K as Z}from"./vendor.fortawesome.pro-regular-svg-icons.js";import{p as _e}from"./vendor.dompurify.js";import{m as ke}from"./vendor.marked.js";import{o as F}from"./vendor.obj-str.js";import{A as we,d as Ie,G as Se}from"./ResourceCenterApp.js";import{f as je,R as Ce}from"./use-selector-element-monitoring.js";import{D as W}from"./stylesheets.js";import{U as ae}from"./roots.js";import{r as ee}from"./vendor.react-dom.js";import"./vendor.core-js.js";import{g as Me}from"./flow-condition-types.js";import{u as ve}from"./vendor.react-i18next.js";import"./vendor.object-assign.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";import"./vendor.i18next.js";import"./flow-host.styl.js";import"./use-window-resize.js";import"./logomark.js";import"./ChecklistUI.js";import"./vendor.fortawesome.pro-solid-svg-icons.js";import"./FlowChrome.js";import"./use-element-rect.js";import"./vendor.bignumber.js.js";import"./vendor.scheduler.js";import"./vendor.date-fns.js";import"./vendor.babel.runtime.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="d3f07ad5-cf33-4846-b834-ba6dc9877a6d",t._sentryDebugIdIdentifier="sentry-dbid-d3f07ad5-cf33-4846-b834-ba6dc9877a6d")}catch{}})();function Re(t){const e=Intl.Segmenter;return e?/(\p{Emoji_Presentation}|\p{Extended_Pictographic})(\p{Emoji_Modifier_Base}?\p{Emoji_Modifier}?|\uFE0F\u200D(\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?\uFE0F\u200D)*\p{Emoji_Presentation}|\uFE0F\u200D\p{Extended_Pictographic})/u.test(t)&&[...new e().segment(t)].length===1:!1}const te=[];function Ne({assistant:t,lookupAttribute:e,initialConversationId:a,initialHistory:c,initialUserContent:m,onConversationIdChange:f,submitMessage:h,submitRating:l,submitFeedback:g,InsideMessage:r,onContactClick:p,contactButtonText:i}){const[o,d]=u.useState(null),[S,w]=u.useState(()=>c?c.map(s=>({...s,assistantHtml:x(B(s.assistantContent),!1)})):te),[D,M]=u.useState(""),j=u.useRef(null),k=u.useRef(null),b=u.useRef(!0),I=u.useRef(a||null),[ce,le]=u.useState(I.current),H=u.useCallback(s=>{I.current=s,le(s),f&&f(s)},[f]),T=u.useCallback(()=>{o?.focus({preventScroll:!0})},[o]);u.useEffect(()=>{T()},[T]),u.useLayoutEffect(()=>{const s=k.current;s&&(s.scrollTop=Math.ceil(s.scrollHeight-s.clientHeight))},[]);const K=u.useCallback(()=>{const s=k.current;s&&(b.current=!0,typeof s.scrollTo=="function"&&s.scrollTo({top:Math.ceil(s.scrollHeight-s.clientHeight),behavior:"smooth"}))},[]),G=u.useRef(0);u.useLayoutEffect(()=>{const s=k.current;s&&s.scrollHeight!==G.current&&(G.current=s.scrollHeight,b.current&&K())},[S,K]);const N=u.useCallback(()=>{j.current&&j.current()},[]);u.useEffect(()=>()=>{N()},[N]);const O=(s,R)=>{w(C=>C.map(v=>{if(s===v.id){const E=R(v);return{...v,...E}}else return v}))},L=s=>{w(R=>R.map((C,v)=>{if(v===R.length-1){const E=s(C);return{...C,...E}}else return C}))},U=u.useCallback(async s=>{if(s=s.trim(),s==="")return;N(),w(E=>[...E,{id:null,userContent:s,assistantContent:"",assistantHtml:x("","enter"),enterAnimation:!0,sources:[],completed:!1,rating:null,scaleRating:null,scaleMax:null,feedbackSubmitted:!1}]),M(""),K();let R=!1;const C=()=>{R=!0,j.current=null},v=h({conversationId:I.current,userContent:s,callback:E=>{if(R){console.log("Userflow.js AssistantChat got message after being done",E);return}switch(E.kind){case"conversation_created":H(E.conversationId);break;case"message_created":L(()=>({id:E.messageId,warning:E.warning}));break;case"assistant_content_delta":L(A=>{const he=E.delta,z=A.assistantContent+he,ge=B(z),pe=x(ge);return{assistantContent:z,assistantHtml:pe}});break;case"done":C(),L(A=>({assistantHtml:x(A.assistantContent,"exit"),completed:!0,sources:E.sources}));break;case"error":C(),L(A=>({failed:!0,error:E.message,assistantHtml:x(B(A.assistantContent),!1)}));break;default:console.log("Userflow.js AssistantChat got unknown message",E)}}});j.current=()=>{C(),v.abort(),L(E=>({assistantHtml:x(B(E.assistantContent),!1)}))}},[N,K,h,H]),J=u.useRef(!1);u.useEffect(()=>{J.current||(J.current=!0,m&&U(m))},[U,m]);const ie=u.useCallback(()=>{N(),H(null),w(te),T()},[N,T,H]),[ue,fe]=u.useState(!0),de=u.useCallback(()=>{const s=k.current;s&&fe(s.scrollTop===0)},[]),me=u.useCallback(()=>{const s=k.current;s&&(b.current=Math.ceil(s.scrollHeight-s.clientHeight)==Math.ceil(s.scrollTop))},[]);return{assistant:t,lookupAttribute:e,history:S,setInput:d,contentElRef:k,scrolledToTop:ue,userContent:D,setUserContent:M,onSubmitMessage:U,supportsFeedback:!!l&&!!g,onSubmitRating:s=>{if(l){switch(s.ratingMode){case _.LIKE:O(s.messageId,()=>({rating:s.rating}));break;case _.SCALE:O(s.messageId,()=>({scaleRating:s.scaleRating,scaleMax:s.scaleMax}));break;default:throw new ae(s)}l(s)}},onSubmitFeedback:s=>{g&&(O(s.messageId,()=>({feedbackSubmitted:!0})),g(s))},InsideMessage:r,onContactClick:p,contactButtonText:i,reset:ie,onContentScroll:de,onContentWheel:me,conversationId:ce}}const xe=({assistant:t,lookupAttribute:e,history:a,setInput:c,contentElRef:m,scrolledToTop:f,userContent:h,setUserContent:l,onSubmitMessage:g,supportsFeedback:r,onSubmitRating:p,onSubmitFeedback:i,InsideMessage:o,onContactClick:d,contactButtonText:S,reset:w,onContentScroll:D,onContentWheel:M,conversationId:j})=>{const k=a.some(b=>b.completed||b.failed);return n.createElement("div",{className:"userflowjs-assistant-chat"},n.createElement("div",{className:F({"userflowjs-assistant-chat__header":!0,"userflowjs-assistant-chat__header--content-scrolled":!f})}),n.createElement("div",{className:F({"userflowjs-assistant-chat__header":!0,"userflowjs-assistant-chat__header--content-scrolled":!f})},n.createElement(n.Fragment,null,n.createElement("h2",{className:"userflowjs-assistant-chat__title"},t.title),n.createElement("button",{className:"userflowjs-bubble-button userflowjs-bubble-button--default",onClick:w},t.resetText))),n.createElement("div",{ref:m,className:"userflowjs-assistant-chat__content",onScroll:D,onWheel:M},!je(t.intro)&&n.createElement("div",{className:"userflowjs-assistant-chat__intro"},n.createElement(Ce,{doc:t.intro,lookupAttribute:e})),a.map((b,I)=>n.createElement(Le,{key:I,assistant:t,message:b,supportsFeedback:r,onSubmitRating:p,onSubmitFeedback:i,InsideMessage:o,conversationId:j,isLast:I===a.length-1}))),n.createElement("div",{className:"userflowjs-assistant-chat__prompt"},n.createElement(we,{textareaRef:c,placeholder:(a.length===0?t.promptEmptyPlaceholder:t.promptNonemptyPlaceholder)||"",value:h,onChange:l,onSubmit:()=>g(h)})),k&&d&&n.createElement("div",{className:"userflowjs-assistant-chat__contact"},n.createElement("button",{className:"userflowjs-tertiary-button",onClick:()=>d()},S)))},Le=({assistant:t,message:e,supportsFeedback:a,onSubmitRating:c,onSubmitFeedback:m,InsideMessage:f,conversationId:h,isLast:l})=>n.createElement("div",{className:"userflowjs-assistant-chat__message"},f&&n.createElement(f,{message:e}),n.createElement("div",{className:F({"userflowjs-assistant-chat__user-content":!0,"userflowjs-assistant-chat__user-content--enter":!!e.enterAnimation}),"data-assistant-conversation-id":h,"data-assistant-message-id":e.id},n.createElement("div",{style:{whiteSpace:"pre-wrap"}},e.userContent)),e.warning&&n.createElement("div",{className:"userflowjs-assistant-chat__error"},"Warning: ",e.warning),n.createElement("div",{className:"userflowjs-assistant-chat__assistant-content"},n.createElement("div",null,n.createElement(ye,{html:e.assistantHtml})),e.error&&n.createElement("div",{className:"userflowjs-assistant-chat__error"},e.error)),e.sources&&e.sources.length>0&&n.createElement("div",{className:"userflowjs-assistant-chat__sources"},n.createElement("div",{className:"userflowjs-assistant-chat__sources-title"},t.sourcesText),e.sources.map((g,r)=>n.createElement("a",{key:r,className:"userflowjs-assistant-chat__source",href:Ie(g.url),target:"_blank",rel:"noreferrer noopener"},g.title))),a&&e.completed&&e.id&&(t.ratingMode===_.LIKE||t.ratingMode===_.SCALE&&l)&&n.createElement(Ae,{assistant:t,message:e,onSubmitRating:c,onSubmitFeedback:m})),Ae=({assistant:t,message:e,onSubmitRating:a,onSubmitFeedback:c})=>{const m=u.useRef(null),[f,h]=u.useState(""),l=i=>{const o=e.id;o&&(ee.flushSync(()=>{a({ratingMode:_.LIKE,messageId:o,rating:i})}),m.current?.focus({preventScroll:!0}))},g=i=>{const o=e.id;o&&(ee.flushSync(()=>{a({ratingMode:_.SCALE,messageId:o,scaleRating:i,scaleMax:t.scaleMax})}),m.current?.focus({preventScroll:!0}))},r=()=>{e.id&&(c({messageId:e.id,feedback:f.trim()}),h(""))},p=t.ratingMode===_.LIKE?n.createElement("button",{className:"userflowjs-assistant-chat__rating-option",disabled:!0},n.createElement(W,{icon:e.rating==y.DISLIKE?q:Q})):e.scaleRating&&e.scaleMax&&n.createElement("button",{className:F({"userflowjs-assistant-chat__rating-option":!0,"userflowjs-assistant-chat__rating-option--scale":!0}),disabled:!0},oe(t,e.scaleRating,e.scaleMax));return n.createElement("div",{className:`userflowjs-assistant-chat__rating userflowjs-assistant-chat__rating--${t.ratingMode}`},t.ratingMode===_.SCALE&&n.createElement("div",{className:"userflowjs-assistant-chat__rating-question"},t.scaleQuestion),e.feedbackSubmitted?n.createElement("div",{className:"userflowjs-assistant-chat__rating-thanks"},p,n.createElement("div",{className:"userflowjs-assistant-chat__rating-thanks-message"},t.feedbackThanksText)):(t.ratingMode===_.LIKE?e.rating:e.scaleRating)?n.createElement(Se,{textareaRef:m,className:"userflowjs-growing-textarea userflowjs-assistant-chat__feedback-textarea",mirrorClassName:"userflowjs-growing-textarea__mirror",textareaClassName:"userflowjs-textarea",placeholder:(t.ratingMode===_.LIKE?e.rating===y.LIKE?t.feedbackLikePlaceholder:t.feedbackDislikePlaceholder:t.scaleFeedbackPlaceholder)||"",value:f,onChange:h,onKeyDown:i=>{!i.shiftKey&&i.key==="Enter"&&(i.preventDefault(),r())}},p,n.createElement("button",{className:"userflowjs-assistant-chat__feedback-submit",onClick:()=>r()},n.createElement(W,{icon:be}))):n.createElement("div",{className:"userflowjs-assistant-chat__rating-options"},t.ratingMode===_.LIKE?[y.LIKE,y.DISLIKE].map(i=>(!e.rating||e.rating===i)&&n.createElement("button",{key:i,className:"userflowjs-assistant-chat__rating-option",onClick:e.rating?void 0:()=>l(i),disabled:!!e.rating,"data-testid":`assistant-chat-rating-${i}`},n.createElement(W,{icon:i==y.DISLIKE?q:Q}))):Fe(t).map(({value:i,label:o})=>n.createElement("button",{key:i,className:F({"userflowjs-assistant-chat__rating-option":!0,"userflowjs-assistant-chat__rating-option--large-scale":Re(o||"")}),onClick:e.scaleRating?void 0:()=>g(i),disabled:!!e.scaleRating,"data-testid":`assistant-chat-rating-${i}`},o))))};function B(t){let e=t;const a=f=>(f=f.replace(/\s*[*_`]*$/,""),f=f.replace(/(^|\n)\s*(\d+\.?|-|=)$/,""),f);e=a(e),e=e.replace(/\[([^\]\n]*)(\](\([^)\n]*)?)?$/,"$1"),e=a(e);const c=Array.from(e.matchAll(/\n( *)```/g));if(c.length%2===1){const f=c[c.length-1][1];e+=`
|
|
2
2
|
`+f+"```"}else{let f=0;for(let r=e.length-1;r>=0;r--)if(e[r]===`
|
|
3
3
|
`&&e[r-1]===`
|
|
4
4
|
`){f=r;break}const h=[];let l=!1;const g=r=>r==null||r.match(/\W/);for(let r=f;r<e.length;r++){const p=e[r],i=p+e[r+1],o=i+e[r+2];let d=null;!l&&o==="***"||!l&&o==="___"&&(g(e[r-1])||g(e[r+3]))?d=o:!l&&i==="**"||!l&&i==="__"&&(g(e[r-1])||g(e[r+2]))?d=i:(!l&&p==="*"||!l&&p==="_"&&(g(e[r-1])||g(e[r+1]))||p==="`")&&(d=p),d!=null&&(e.slice(f,r+d.length).match(/\[[^\]\n]*\]\([^)\n]*$/)||(h[h.length-1]===d?(d==="`"&&(l=!1),h.pop()):(d==="`"&&(l=!0),h.push(d))),r+=d.length-1)}e+=h.reverse().join("")}return e}function x(t,e){t=t.trim(),e!==!1&&(t=t.replace(/(\n *```)?$/," {{USERFLOWCHATBRAIN}}$1"));let a=_e.sanitize(ke.parse(t));if(e!==!1){let c="userflowjs-assistant-brain";e&&(c+=` userflowjs-assistant-brain--${e}`),a=a.replace("{{USERFLOWCHATBRAIN}}",`<span class="${c}"><span></span><span></span><span></span><span></span></span>`)}return a=a.replace(/<a href=/g,'<a target="_blank" rel="noopener noreferrer" href='),a}const ye=({html:t})=>u.useMemo(()=>{if(!t)return null;const a=new DOMParser().parseFromString(t,"text/html");return re(a.body)},[t]);function re(t,e){if(t instanceof Element){if(t.tagName==="BODY")return n.createElement(n.Fragment,{key:e},se(t));{if(["script","style"].includes(t.tagName))return null;const a={key:e};for(const c of t.attributes){let m=c.name;m.startsWith("on")||(m==="class"&&(m="className"),a[m]=c.value)}return n.createElement(t.tagName.toLowerCase(),a,se(t))}}else return t instanceof Text?t.textContent:null}function se(t){const e=[];let a=0;for(const c of t.childNodes)e.push(re(c,a)),a++;return e}function Fe(t){let e=[];const a=t.scaleMax||5;for(let c=1;c<=a;c++)e.push({value:c,label:oe(t,c,a)});return e}function oe(t,e,a){if(t.scaleLabels)return t.scaleLabels[e-1]||e;{const c=ne[a]&&ne[a][e];return c?n.createElement(W,{icon:c,size:24}):e}}const ne={2:{1:P,2:$},3:{1:P,2:V,3:$},4:{1:X,2:P,3:$,4:Z},5:{1:X,2:P,3:V,4:$,5:Z}},mt=({block:t,session:e,assistantReply:a,initialUserContent:c,onContactClick:m,contactButtonText:f})=>{const h=t.assistantFlowId,l=Ee(),{t:g}=ve(),r=g("assistant.generic_error"),p=g("assistant.disconnected_error"),i=Ne(u.useMemo(()=>({assistant:a.assistant,lookupAttribute:Me(e.data),initialConversationId:a.conversationId,initialHistory:a.history,initialUserContent:c,onConversationIdChange:o=>{const d="assistantConversationId:"+h;o?Y.setItem(d,o):Y.removeItem(d)},submitMessage:({conversationId:o,userContent:d,callback:S})=>{l.assistantMessageInProgress=!0;const w=l.nextRef();l.send({kind:"SubmitAssistantMessage",ref:w,assistantFlowId:h,conversationId:o,userContent:d},{handlesRejection:!0}).catch(b=>{S({kind:"error",message:b.humanMessage||r})});const M=()=>{l.assistantMessageInProgress=void 0,l.off("private:assistantMessageEvent",j),l.off("private:disconnect",k)},j=b=>{if(b.ref!==w)return;const{event:I}=b;S(I),(I.kind=="done"||I.kind=="error")&&M()},k=()=>{S({kind:"error",message:p}),M()};return l.on("private:assistantMessageEvent",j),l.on("private:disconnect",k),{abort:()=>{l.send({kind:"AbortAssistantMessage"}),M()}}},submitRating:o=>{switch(o.ratingMode){case _.LIKE:l.send({kind:"SubmitAssistantRating",messageId:o.messageId,rating:o.rating});break;case _.SCALE:l.send({kind:"SubmitAssistantScaleRating",messageId:o.messageId,scaleRating:o.scaleRating,scaleMax:o.scaleMax});break;default:throw new ae(o)}},submitFeedback:o=>{l.send({kind:"SubmitAssistantFeedback",messageId:o.messageId,feedback:o.feedback})},onContactClick:m,contactButtonText:f}),[a,h,l,c,e.data,m,f,r,p]));return n.createElement(n.Fragment,null,n.createElement(xe,{...i}))};export{mt as ResourceCenterAssistantChat};
|
package/bubble-frame.css
CHANGED
|
@@ -245,8 +245,11 @@
|
|
|
245
245
|
.userflowjs-theme-root blockquote:not(:last-child),
|
|
246
246
|
.userflowjs-theme-root pre:not(:last-child),
|
|
247
247
|
.userflowjs-theme-root ol:not(:last-child),
|
|
248
|
-
.userflowjs-theme-root ul:not(:last-child)
|
|
249
|
-
|
|
248
|
+
.userflowjs-theme-root ul:not(:last-child) {
|
|
249
|
+
margin-bottom: 1rem;
|
|
250
|
+
}
|
|
251
|
+
.userflowjs-theme-root .userflowjs-bubble-buttons,
|
|
252
|
+
.userflowjs-theme-root:not(:last-child):not(:nth-last-child(2)) {
|
|
250
253
|
margin-bottom: 1rem;
|
|
251
254
|
}
|
|
252
255
|
.userflowjs-theme-root p,
|
|
@@ -411,7 +414,7 @@
|
|
|
411
414
|
height: 1em;
|
|
412
415
|
}
|
|
413
416
|
/* Default progress bar */
|
|
414
|
-
.userflowjs-bubble-progress
|
|
417
|
+
.userflowjs-bubble-progress--default {
|
|
415
418
|
position: absolute;
|
|
416
419
|
top: 0;
|
|
417
420
|
left: 0;
|
|
@@ -419,118 +422,122 @@
|
|
|
419
422
|
height: var(--userflow-progress-bar-height);
|
|
420
423
|
overflow: hidden;
|
|
421
424
|
}
|
|
422
|
-
.userflowjs-bubble-progress
|
|
425
|
+
.userflowjs-bubble-progress--default.userflowjs-bubble-progress--bottom {
|
|
423
426
|
bottom: 0;
|
|
424
427
|
top: auto;
|
|
425
|
-
margin-top: 1rem;
|
|
426
428
|
}
|
|
427
|
-
|
|
428
|
-
|
|
429
|
+
.userflowjs-bubble-progress--default .userflowjs-bubble-progress__fill {
|
|
430
|
+
width: 0%;
|
|
431
|
+
height: 100%;
|
|
432
|
+
background-color: var(--userflow-progress-bar-color);
|
|
433
|
+
transition: width 200ms cubic-bezier(0.25, 0.8, 0.5, 1);
|
|
434
|
+
border-radius: 1px;
|
|
435
|
+
}
|
|
436
|
+
/* Chained Rounded progress bar */
|
|
437
|
+
.userflowjs-bubble-progress--chained-rounded {
|
|
429
438
|
position: relative;
|
|
430
|
-
top: 1px;
|
|
431
|
-
left: 0;
|
|
432
|
-
right: 0;
|
|
433
|
-
margin: 0 auto;
|
|
434
439
|
display: flex;
|
|
435
|
-
align-items: center;
|
|
436
440
|
justify-content: center;
|
|
437
441
|
overflow: hidden;
|
|
442
|
+
transform: translateY(calc(var(--userflow-rounded-progress-bar-height) * -1));
|
|
438
443
|
}
|
|
439
|
-
.userflowjs-bubble-progress-
|
|
440
|
-
|
|
444
|
+
.userflowjs-bubble-progress--chained-rounded.userflowjs-bubble-progress-bottom {
|
|
445
|
+
transform: translateY(calc(var(--userflow-rounded-progress-bar-height) * 1));
|
|
441
446
|
}
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
447
|
+
.userflowjs-bubble-progress--chained-rounded .userflowjs-bubble-progress-step {
|
|
448
|
+
height: var(--userflow-rounded-progress-bar-height);
|
|
449
|
+
width: calc(var(--userflow-rounded-progress-bar-height) * 2);
|
|
450
|
+
border-radius: 8px;
|
|
451
|
+
margin: 0 calc(var(--userflow-rounded-progress-bar-height) / 2);
|
|
452
|
+
transition: background-color 0.3s, border-color 0.3s;
|
|
453
|
+
border: 1px solid var(--userflow-progress-bar-color);
|
|
454
|
+
}
|
|
455
|
+
.userflowjs-bubble-progress--chained-rounded .userflowjs-bubble-progress-step.userflowjs-bubble-progress-step_completed {
|
|
456
|
+
background-color: var(--userflow-progress-bar-color, #00f);
|
|
457
|
+
}
|
|
458
|
+
/* Chained Squared progress bar */
|
|
459
|
+
.userflowjs-bubble-progress--chained-squared {
|
|
460
|
+
position: relative;
|
|
446
461
|
display: flex;
|
|
447
|
-
align-items: center;
|
|
448
462
|
justify-content: center;
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
border: 1px solid var(--userflow-widget-background-color);
|
|
463
|
+
overflow: hidden;
|
|
464
|
+
transform: translateY(calc(var(--userflow-squared-progress-bar-height) * -1));
|
|
452
465
|
}
|
|
453
|
-
.userflowjs-bubble-progress-
|
|
454
|
-
|
|
455
|
-
height: var(--userflow-rounded-progress-bar-height);
|
|
456
|
-
border-radius: 8px;
|
|
466
|
+
.userflowjs-bubble-progress--chained-squared.userflowjs-bubble-progress--bottom {
|
|
467
|
+
transform: translateY(calc(var(--userflow-squared-progress-bar-height) * 1));
|
|
457
468
|
}
|
|
458
|
-
.userflowjs-bubble-progress-
|
|
459
|
-
|
|
469
|
+
.userflowjs-bubble-progress--chained-squared .userflowjs-bubble-progress-step {
|
|
470
|
+
height: var(--userflow-squared-progress-bar-height);
|
|
471
|
+
width: calc(var(--userflow-squared-progress-bar-height) * 3);
|
|
472
|
+
margin: 0 calc(var(--userflow-squared-progress-bar-height) / 2);
|
|
473
|
+
transition: background-color 0.3s, border-color 0.3s;
|
|
474
|
+
border: 1px solid var(--userflow-progress-bar-color);
|
|
460
475
|
}
|
|
461
|
-
.userflowjs-bubble-progress-
|
|
462
|
-
.userflowjs-bubble-progress-CHAINED_SQUARED .rounded.completed {
|
|
476
|
+
.userflowjs-bubble-progress--chained-squared .userflowjs-bubble-progress-step.userflowjs-bubble-progress-step_completed {
|
|
463
477
|
background-color: var(--userflow-progress-bar-color, #00f);
|
|
464
|
-
color: var(--userflow-main-background-color);
|
|
465
|
-
border: 1px solid var(--userflow-widget-background-color);
|
|
466
478
|
}
|
|
467
479
|
/* Dotted progress bar */
|
|
468
|
-
.userflowjs-bubble-progress
|
|
469
|
-
|
|
480
|
+
.userflowjs-bubble-progress--dotted {
|
|
481
|
+
position: relative;
|
|
482
|
+
display: flex;
|
|
483
|
+
justify-content: center;
|
|
484
|
+
overflow: hidden;
|
|
485
|
+
transform: translateY(calc(var(--userflow-dotted-progress-bar-height) * -1));
|
|
486
|
+
}
|
|
487
|
+
.userflowjs-bubble-progress--dotted.userflowjs-bubble-progress--bottom {
|
|
488
|
+
transform: translateY(calc(var(--userflow-dotted-progress-bar-height) * 1));
|
|
489
|
+
}
|
|
490
|
+
.userflowjs-bubble-progress--dotted .userflowjs-bubble-progress-step {
|
|
470
491
|
height: var(--userflow-dotted-progress-bar-height);
|
|
492
|
+
aspect-ratio: 1;
|
|
471
493
|
border-radius: 50%;
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
transition: background-color 0.3s;
|
|
494
|
+
margin: 0 calc(var(--userflow-dotted-progress-bar-height) / 4);
|
|
495
|
+
transition: background-color 0.3s, border-color 0.3s;
|
|
496
|
+
border: 1px solid var(--userflow-progress-bar-color);
|
|
476
497
|
}
|
|
477
|
-
.userflowjs-bubble-progress
|
|
498
|
+
.userflowjs-bubble-progress--dotted .userflowjs-bubble-progress-step.userflowjs-bubble-progress-step_completed {
|
|
478
499
|
background-color: var(--userflow-progress-bar-color, #00f);
|
|
479
500
|
}
|
|
480
501
|
/* Narrow progress bar */
|
|
481
|
-
.userflowjs-bubble-progress
|
|
502
|
+
.userflowjs-bubble-progress--narrow {
|
|
503
|
+
position: relative;
|
|
504
|
+
display: flex;
|
|
505
|
+
justify-content: center;
|
|
506
|
+
overflow: hidden;
|
|
507
|
+
transform: translateY(calc(var(--userflow-narrow-progress-bar-height) * -1));
|
|
508
|
+
}
|
|
509
|
+
.userflowjs-bubble-progress--narrow.userflowjs-bubble-progress--bottom {
|
|
510
|
+
transform: translateY(calc(var(--userflow-narrow-progress-bar-height) * 1));
|
|
511
|
+
}
|
|
512
|
+
.userflowjs-bubble-progress--narrow .linear-progress-bar {
|
|
482
513
|
width: 80px;
|
|
483
514
|
height: var(--userflow-narrow-progress-bar-height, 30px);
|
|
484
|
-
border: 1px solid var(--userflow-
|
|
515
|
+
border: 1px solid var(--userflow-progress-bar-color);
|
|
485
516
|
border-radius: var(--userflow-narrow-progress-bar-border-radius, 5px);
|
|
486
517
|
overflow: hidden;
|
|
487
518
|
position: relative;
|
|
488
|
-
margin-top: 1rem;
|
|
489
519
|
}
|
|
490
|
-
.userflowjs-bubble-progress
|
|
520
|
+
.userflowjs-bubble-progress--narrow .userflowjs-bubble-progress--narrow-fill {
|
|
491
521
|
height: 100%;
|
|
492
522
|
background-color: var(--userflow-progress-bar-color, #00f);
|
|
493
523
|
transition: width 0.3s;
|
|
494
524
|
}
|
|
495
525
|
/* Numbered progress bar */
|
|
496
|
-
.userflowjs-bubble-progress
|
|
497
|
-
|
|
498
|
-
font-weight: bold;
|
|
499
|
-
color: var(--userflow-progress-bar-color, #00f);
|
|
500
|
-
display: flex;
|
|
501
|
-
align-items: center;
|
|
502
|
-
justify-content: center;
|
|
503
|
-
text-align: center;
|
|
504
|
-
margin: 0 auto;
|
|
505
|
-
}
|
|
506
|
-
/* Common styling for progress bar elements */
|
|
507
|
-
.userflowjs-bubble-progress-CHAINED_ROUNDED .rounded,
|
|
508
|
-
.userflowjs-bubble-progress-CHAINED_SQUARED .rounded {
|
|
526
|
+
.userflowjs-bubble-progress--numbered {
|
|
527
|
+
position: relative;
|
|
509
528
|
display: flex;
|
|
510
|
-
align-items: center;
|
|
511
529
|
justify-content: center;
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
border: 1px solid var(--userflow-widget-background-color);
|
|
530
|
+
overflow: hidden;
|
|
531
|
+
transform: translateY(calc(var(--userflow-numbered-progress-bar-height) * -1));
|
|
515
532
|
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
width: calc(var(--userflow-rounded-progress-bar-height) * 2);
|
|
519
|
-
height: var(--userflow-rounded-progress-bar-height);
|
|
520
|
-
margin: 0 calc(var(--userflow-rounded-progress-bar-height) / 2);
|
|
521
|
-
border-radius: 8px;
|
|
533
|
+
.userflowjs-bubble-progress--numbered.userflowjs-bubble-progress--bottom {
|
|
534
|
+
transform: translateY(calc(var(--userflow-numbered-progress-bar-height) * 0.5));
|
|
522
535
|
}
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
}
|
|
529
|
-
.userflowjs-bubble-progress-CHAINED_ROUNDED .rounded.completed,
|
|
530
|
-
.userflowjs-bubble-progress-CHAINED_SQUARED .rounded.completed {
|
|
531
|
-
background-color: var(--userflow-progress-bar-color, #00f);
|
|
532
|
-
color: var(--userflow-main-background-color);
|
|
533
|
-
border: 1px solid var(--userflow-widget-background-color);
|
|
536
|
+
.userflowjs-bubble-progress--numbered .numbered-progress {
|
|
537
|
+
font-size: var(--userflow-numbered-progress-bar-height);
|
|
538
|
+
font-weight: bold;
|
|
539
|
+
color: var(--userflow-progress-bar-color, #00f);
|
|
540
|
+
line-height: 1em;
|
|
534
541
|
}
|
|
535
542
|
.userflowjs-bubble-progress__fill {
|
|
536
543
|
width: 0%;
|
|
@@ -603,6 +610,9 @@
|
|
|
603
610
|
white-space: pre-wrap;
|
|
604
611
|
overflow-wrap: break-word;
|
|
605
612
|
}
|
|
613
|
+
.userflowjs-bubble-content[data-progress-position="TOP"][data-progress-type]:not([data-progress-type="DEFAULT"]):not([data-progress-type="NUMBERED"]) {
|
|
614
|
+
padding-top: 10px;
|
|
615
|
+
}
|
|
606
616
|
.userflowjs-container--card {
|
|
607
617
|
border-radius: calc(var(--userflow-bubble-border-radius) / 2);
|
|
608
618
|
padding: 0.5rem;
|
package/flow-condition-types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{N as c,O as T,P as y,Q as X,W as z,X as L}from"./userflow.js";import"./vendor.core-js.js";import{i as S,a as I,b as Y,p as B,c as j,s as Z}from"./vendor.date-fns.js";import{M as q,o as G,f as x,u as F,v as Q}from"./roots.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1cb5050d-7af5-4be6-a910-c97718127f25",e._sentryDebugIdIdentifier="sentry-dbid-1cb5050d-7af5-4be6-a910-c97718127f25")}catch{}})();const K=/(\\*)\{\{([a-zA-Z0-9_.\\/]+)\}\}/g;function J(e,t){return(e||"").replace(K,(r,n,s)=>{const a=n.length;return a%2===0?"\\".repeat(a/2)+(t(s)||""):"\\".repeat((a-1)/2)+"{{"+s+"}}"})}function ee(e){let t=null;return r=>(t||(t=new Map,e.forEach(({name:n,value:s})=>t.set(n,Array.isArray(s)?s[0]:s))),t.get(r)||null)}function g(e,t){const r=ee(t);return J(e,n=>r(n))}function U(e,t){const r=M(e,t),n=e.nearSelector&&M(e.nearSelector,t);return e===r&&e.nearSelector===n?e:e.nearSelector===n?r:{...r,nearSelector:n}}function M(e,t){if(!e.text)return e;const r=g(e.text,t);return r===e.text?e:{...e,text:r}}function te(e,t){return e.includes.length===0&&e.excludes.length===0?!1:(e.includes.length===0||e.includes.some(r=>{const n=W(r);return n&&t.match(n)}))&&!e.excludes.some(r=>{const n=W(r);return n&&t.match(n)})}function re(e){const t=e.match(/^(([a-z\d]+):\/\/)?([^/?#]+)?(\/[^?#]*)?(\?([^#]*))?(#.*)?$/i);if(!t)return null;const[,,r,n,s,,a,i]=t;return{scheme:r||"",domain:n||"",path:s||"",query:a||"",fragment:i||""}}function W(e){const t=re(e);if(!t)return console.error("Userflow: Invalid URL pattern:",e),null;const{scheme:r,domain:n,path:s,query:a,fragment:i}=t;let l;r?l=O(r):l="[a-z\\d]+";let f;n?f=A(n,"[^/]","."):f="[^/]*";const o="(:\\d+)?";let p;s?p=A(s,"[^?#]","/"):p="/[^?#]*";let E;a?(E="",new URLSearchParams(a).forEach((d,w)=>{let b;d===""?b="=?":d==="*"?b="(=[^&#]*)?":(d=d.split(/\*/g).map($=>encodeURI($)).join("*"),b="="+A(d,"[^#]")),E+="(?=.*[?&]"+O(w)+b+"([&#]|$))"}),E+="\\?[^#]*"):E="(\\?[^#]*)?";let m;return i?m=A(i,".","/"):m="(#.*)?",new RegExp("^"+l+"://"+f+o+p+E+m+"$")}function A(e,t,r){return e=O(e),e=e.replace(/\\\*/g,t+"*"),r&&(e=e.replace(/:[a-zA-Z0-9_]+/g,"[^"+r+"]+")),e}function O(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}const _={[c.ABSOLUTE_EQ]:{compare:({condition:e,value:t})=>{const r=h(t),n=N(e.value,"00:00:00.000"),s=N(e.value,"23:59:59.999");return r!=null&&n!=null&&s!=null&&!S(r,n)&&!I(r,s)}},[c.ABSOLUTE_GT]:{compare:({condition:e,value:t})=>{const r=h(t),n=N(e.value,"23:59:59.999");return r!=null&&n!=null&&I(r,n)}},[c.ABSOLUTE_LT]:{compare:({condition:e,value:t})=>{const r=h(t),n=N(e.value,"00:00:00.000");return r!=null&&n!=null&&S(r,n)}},[c.AND]:{compare:()=>V("AND.compare")},[c.BETWEEN]:{compare:({condition:e,value:t})=>!!t&&!!e.value&&!!e.value2&&parseFloat(v(t))>=parseFloat(e.value)&&parseFloat(v(t))<=parseFloat(e.value2)},[c.CONTAINS]:{compare:({sessionData:e,condition:t,value:r})=>!!r&&v(r).toLowerCase().includes(g(t.value||"",e).toLowerCase())},[c.EMPTY]:{compare:({value:e})=>e==null||e===""||Array.isArray(e)&&e.length===0},[c.ENDS_WITH]:{compare:({sessionData:e,condition:t,value:r})=>!!r&&v(r).toLowerCase().endsWith(g(t.value||"",e).toLowerCase())},[c.EQ]:{compare:({sessionData:e,condition:t,value:r})=>g(t.value||"",e)===v(r)},[c.EXCLUDES_ALL]:{compare:({condition:e,value:t})=>{const r=new Set(D(t));return!(e.values||[]).some(n=>r.has(n))}},[c.EXCLUDES_ANY]:{compare:({condition:e,value:t})=>{const r=new Set(D(t));return!(e.values||[]).every(n=>r.has(n))}},[c.FALSE]:{compare:({value:e})=>v(e).toLowerCase()==="false"},[c.GT]:{compare:({condition:e,value:t})=>!!t&&!!e.value&&parseFloat(v(t))>parseFloat(e.value)},[c.GTE]:{compare:({condition:e,value:t})=>!!t&&!!e.value&&parseFloat(v(t))>=parseFloat(e.value)},[c.INCLUDES_ALL]:{compare:({condition:e,value:t})=>{const r=new Set(D(t));return(e.values||[]).every(n=>r.has(n))}},[c.INCLUDES_ANY]:{compare:({condition:e,value:t})=>{const r=new Set(D(t));return(e.values||[]).some(n=>r.has(n))}},[c.LT]:{compare:({condition:e,value:t})=>!!t&&!!e.value&&parseFloat(v(t))<parseFloat(e.value)},[c.LTE]:{compare:({condition:e,value:t})=>!!t&&!!e.value&&parseFloat(v(t))<=parseFloat(e.value)},[c.NE]:{compare:({sessionData:e,condition:t,value:r})=>g(t.value||"",e)!==v(r)},[c.NOT_CONTAINS]:{compare:({sessionData:e,condition:t,value:r})=>!r||!v(r).toLowerCase().includes(g(t.value||"",e).toLowerCase())},[c.NOT_EMPTY]:{compare:({value:e})=>e!=null&&e!==""&&(!Array.isArray(e)||e.length>0)},[c.NOT_REGEX]:{compare:({condition:e,value:t})=>!P(e,t)},[c.OR]:{compare:()=>V("OR.compare")},[c.REGEX]:{compare:({condition:e,value:t})=>P(e,t)},[c.RELATIVE_EQ]:{compare:({condition:e,value:t})=>{const r=h(t),n=k(e.value);return r==null||n==null?!1:!S(r,n)&&S(r,Y(n,1))}},[c.RELATIVE_GT]:{compare:({condition:e,value:t})=>{const r=h(t),n=k(e.value);return r==null||n==null?!1:I(r,n)}},[c.RELATIVE_LT]:{compare:({condition:e,value:t})=>{const r=h(t),n=k(e.value);return r==null||n==null?!1:S(r,n)}},[c.STARTS_WITH]:{compare:({sessionData:e,condition:t,value:r})=>!!r&&v(r).toLowerCase().startsWith(g(t.value||"",e).toLowerCase())},[c.TRUE]:{compare:({value:e})=>v(e).toLowerCase()==="true"},[c.URL]:{compare:({condition:e,value:t})=>e.urlPattern&&t!=null?te(e.urlPattern,v(t)):!1}};function V(e){throw new Error(`conditionOperators.${e} is not supported`)}function h(e){if(Array.isArray(e)&&(e=e[0]),!e)return null;e.match(/(Z|((\+|-)\d\d:\d\d))$/i)||(e+="Z");const t=B(e);return j(t)?t:null}function N(e,t){if(!e)return null;e+="T"+t+"Z";const r=B(e);return j(r)?r:null}function k(e){if(!e)return null;const t=parseInt(e,10);return isNaN(t)?null:Z(Date.now(),t)}function P(e,t){return e.value?new RegExp(e.value).test(v(t)):!1}function v(e){return Array.isArray(e)?e[0]:e??""}function D(e){return Array.isArray(e)?e:e===""||e==null?[]:[e]}const ne=50,se=1e3;function R(e,t={}){let r,n;const s=()=>{n=void 0,e()},a=()=>{if(window.clearTimeout(r),n==null)n=Date.now();else if(Date.now()-n>se){s();return}r=window.setTimeout(s,ne)},i=o=>{const p=o.target;if(!p||!H(p))return;const E=document.getElementById("userflow-ui");E&&E.contains(p)||a()},l=new q(o=>{ae(o)||a()}),f=G(o=>{l.observe(o,{attributes:!0,subtree:!0,childList:!0,characterData:!0}),o.addEventListener("animationend",i),o.addEventListener("transitionend",i),t.observeInput&&(o.addEventListener("input",a),o.addEventListener("keypress",a),o.addEventListener("change",a))},o=>{o.removeEventListener("animationend",i),o.removeEventListener("transitionend",i),t.observeInput&&(o.removeEventListener("input",a),o.removeEventListener("keypress",a),o.removeEventListener("change",a))});return{disconnect:()=>{window.clearTimeout(r),l.disconnect(),f()}}}function ae(e){const t=document.getElementById("userflow-ui");for(const r of e){const{target:n}=r;if(H(n)&&t&&t.contains(n))return!0}return!1}function H(e){return e.nodeType===Node.ELEMENT_NODE}const C={[T.ALWAYS_TRUE]:{track:({callback:e})=>(e(!0),()=>{})},[T.ATTRIBUTE]:{track:({sessionData:e,condition:t,callback:r})=>{const n=()=>{let a=!1;if(e&&t.operator){const i=e.value.find(o=>o.name===t.attributeName),l=i?i.value:null;a=_[t.operator].compare({sessionData:e.value,condition:t,value:l})}r(a)};n();const s=e.observe(n);return()=>{s()}}},[T.CLAUSE]:{isExpensive:e=>{for(const t of e.conditions){const r=C[t.type];if(r.isExpensive&&r.isExpensive(t))return!0}return!1},track:({sessionData:e,condition:t,flipBackEvents:r,callback:n,description:s})=>{let a,i,l=null;const f=t.conditions.map(m=>{const u=C[m.type];return{condition:m,typeDef:u,expensive:!!u.isExpensive&&u.isExpensive(m),active:!1,isTrue:null}}),o=m=>{for(const u of f){const d=!r||!u.expensive||m;d&&!u.active?(u.active=!0,u.isTrue=!1,u.untrack=u.typeDef.track({sessionData:e,condition:u.condition,flipBackEvents:r,callback:(w,b={})=>{u.isTrue=w,window.clearTimeout(a),b.immediate?p({immediate:!0}):a=window.setTimeout(p,0)},description:s})):!d&&u.active&&(u.untrack&&u.untrack(),u.active=!1,u.isTrue=null,u.untrack=void 0)}},p=(m={})=>{if(f.length===0){E(!1,m);return}let u,d;if(t.operator===c.AND){u=!0,d=!0;for(const w of f)w.isTrue===!1?(u=!1,w.expensive||(d=!1)):u!==!1&&w.isTrue===null&&(u=null)}else{u=!1,d=!0;for(const w of f)w.isTrue===!0?(u=!0,w.expensive||(d=!1)):u!==!0&&w.isTrue===null&&(u=null)}u!==null&&u!==l&&(l=u,E(u,m)),o(d)},E=(m,u)=>{if(!m||t.waitTime==null||t.waitTime=="0")window.clearTimeout(i),i=void 0,n(m,u);else if(!i){const d=parseFloat(t.waitTime)*1e3;i=window.setTimeout(()=>{n(!0,{})},d)}};return o(!1),p(),()=>{window.clearTimeout(a),window.clearTimeout(i);for(const m of f)m.untrack&&m.untrack()}}},[T.ELEMENT]:{isExpensive:()=>!0,track:e=>{const{elementState:t}=e.condition;if(!t)return()=>{};const r=oe(t);switch(r.kind){case"observer":return le(e,r.checkElement);case"event":return ue(e,r.eventName,r.valueWhenOccurred)}}},[T.FILLED_IN_INPUT]:{isExpensive:()=>!0,track:({sessionData:e,condition:t,callback:r})=>{let n=null,s;const a=()=>{if(!t.selector){console.warn("Userflow.js: INPUT_VALUE condition missing selector",t);return}const f=x(U(t.selector,e.value));let o=null;for(const p of f){const E=F(p);if(E){o=E;break}}o?o!=n&&(window.clearTimeout(s),s=window.setTimeout(()=>{r(!0)},1e3)):(r(!1),window.clearTimeout(s)),n=o};a();const i=e.observe(a),{disconnect:l}=R(a,{observeInput:!0});return()=>{i(),l(),window.clearTimeout(s)}}},[T.FLOW]:{track:()=>(console.warn("Userflow.js: Flow conditions do not work client-side"),()=>{})},[T.INPUT_VALUE]:{isExpensive:()=>!0,track:({sessionData:e,condition:t,callback:r})=>{const n=()=>{if(!t.operator){console.warn("Userflow.js: INPUT_VALUE condition missing operator",t);return}if(!t.selector){console.warn("Userflow.js: INPUT_VALUE condition missing selector",t);return}let i=!1;const l=_[t.operator],f=x(U(t.selector,e.value));if(f.length>0)for(const o of f){const p=F(o);if(l.compare({sessionData:e.value,condition:t,value:p})){i=!0;break}}else l.compare({sessionData:e.value,condition:t,value:""})&&(i=!0);r(i)};n();const s=e.observe(n),{disconnect:a}=R(n,{observeInput:!0});return()=>{s(),a()}}},[T.PAGE]:{track:({sessionData:e,condition:t,callback:r})=>{const n=()=>{let l=!1;if(t.operator){const f=y();l=_[t.operator].compare({sessionData:e.value,condition:t,value:f})}r(l)};let s=y();const a=()=>{const l=y();l!==s&&(s=l,n())};X(a),n();const i=e.observe(n);return()=>{i(),z(a)}}},[T.SEGMENT]:{track:({description:e,callback:t})=>(console.error("Userflow.js: Segment conditions are not supported in "+(e||"unknown content item")+"."),t(!1),()=>{})},[T.TIME]:{track:({condition:e,callback:t})=>{let r=null;const n=e.value?new Date(e.value):null,s=e.value2?new Date(e.value2):null,a=()=>{let l=!0;(n&&!isNaN(n.valueOf())&&Date.now()<n.valueOf()||s&&!isNaN(s.valueOf())&&Date.now()>=s.valueOf())&&(l=!1),l!==r&&(r=l,t(l))};a();const i=window.setInterval(a,10*1e3);return()=>{window.clearInterval(i)}}}};function oe(e){switch(e){case L.CLICK:return{kind:"event",eventName:"click",valueWhenOccurred:!0};case L.DISABLED:return{kind:"observer",checkElement:t=>!!t&&t.disabled};case L.MOUSEDOWN:return{kind:"event",eventName:"mousedown",valueWhenOccurred:!0};case L.NOT_CLICK:return{kind:"event",eventName:"click",valueWhenOccurred:!1};case L.NOT_DISABLED:return{kind:"observer",checkElement:t=>!!t&&!t.disabled};case L.NOT_PRESENT:return{kind:"observer",checkElement:t=>!t};case L.PRESENT:return{kind:"observer",checkElement:t=>!!t}}}function le({sessionData:e,condition:t,callback:r},n){const s=()=>{if(!t.elementState){console.warn("Userflow.js: ELEMENT_STATE condition missing elementState",t);return}if(!t.selector){console.warn("Userflow.js: ELEMENT_STATE condition missing selector",t);return}let l=!1;const f=x(U(t.selector,e.value));if(f.length>0){for(const o of f)if(n(o)){l=!0;break}}else n(null)&&(l=!0);r(l)};s();const a=e.observe(s),{disconnect:i}=R(s);return()=>{a(),i()}}function ue({condition:e,flipBackEvents:t,callback:r},n,s){const{selector:a}=e;if(!a)return()=>{};r(!s);const i=o=>{const p=o.target;p&&Q(p,a)&&(t?(r(s,{immediate:!0}),r(!s,{immediate:!0})):r(s))},l={capture:!0},f=G(o=>o.addEventListener(n,i,l),o=>o.removeEventListener(n,i,l));return()=>{f()}}const me=Object.freeze(Object.defineProperty({__proto__:null,conditionTypes:C},Symbol.toStringTag,{value:"Module"}));export{g as a,J as b,C as c,me as f,ee as g,U as i,R as o};
|
|
1
|
+
import{N as c,O as T,Q as y,W as X,X as Y,Y as L}from"./userflow.js";import"./vendor.core-js.js";import{i as S,a as I,b as z,p as P,c as j,s as Z}from"./vendor.date-fns.js";import{M as q,o as G,f as x,u as F,v as Q}from"./roots.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c1f9d0fa-4048-4205-a632-cadb3ebf2661",e._sentryDebugIdIdentifier="sentry-dbid-c1f9d0fa-4048-4205-a632-cadb3ebf2661")}catch{}})();const K=/(\\*)\{\{([a-zA-Z0-9_.\\/]+)\}\}/g;function J(e,t){return(e||"").replace(K,(r,n,s)=>{const a=n.length;return a%2===0?"\\".repeat(a/2)+(t(s)||""):"\\".repeat((a-1)/2)+"{{"+s+"}}"})}function ee(e){let t=null;return r=>(t||(t=new Map,e.forEach(({name:n,value:s})=>t.set(n,Array.isArray(s)?s[0]:s))),t.get(r)||null)}function g(e,t){const r=ee(t);return J(e,n=>r(n))}function U(e,t){const r=M(e,t),n=e.nearSelector&&M(e.nearSelector,t);return e===r&&e.nearSelector===n?e:e.nearSelector===n?r:{...r,nearSelector:n}}function M(e,t){if(!e.text)return e;const r=g(e.text,t);return r===e.text?e:{...e,text:r}}function te(e,t){return e.includes.length===0&&e.excludes.length===0?!1:(e.includes.length===0||e.includes.some(r=>{const n=W(r);return n&&t.match(n)}))&&!e.excludes.some(r=>{const n=W(r);return n&&t.match(n)})}function re(e){const t=e.match(/^(([a-z\d]+):\/\/)?([^/?#]+)?(\/[^?#]*)?(\?([^#]*))?(#.*)?$/i);if(!t)return null;const[,,r,n,s,,a,i]=t;return{scheme:r||"",domain:n||"",path:s||"",query:a||"",fragment:i||""}}function W(e){const t=re(e);if(!t)return console.error("Userflow: Invalid URL pattern:",e),null;const{scheme:r,domain:n,path:s,query:a,fragment:i}=t;let l;r?l=O(r):l="[a-z\\d]+";let f;n?f=A(n,"[^/]","."):f="[^/]*";const o="(:\\d+)?";let p;s?p=A(s,"[^?#]","/"):p="/[^?#]*";let E;a?(E="",new URLSearchParams(a).forEach((d,w)=>{let b;d===""?b="=?":d==="*"?b="(=[^&#]*)?":(d=d.split(/\*/g).map($=>encodeURI($)).join("*"),b="="+A(d,"[^#]")),E+="(?=.*[?&]"+O(w)+b+"([&#]|$))"}),E+="\\?[^#]*"):E="(\\?[^#]*)?";let m;return i?m=A(i,".","/"):m="(#.*)?",new RegExp("^"+l+"://"+f+o+p+E+m+"$")}function A(e,t,r){return e=O(e),e=e.replace(/\\\*/g,t+"*"),r&&(e=e.replace(/:[a-zA-Z0-9_]+/g,"[^"+r+"]+")),e}function O(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}const _={[c.ABSOLUTE_EQ]:{compare:({condition:e,value:t})=>{const r=h(t),n=N(e.value,"00:00:00.000"),s=N(e.value,"23:59:59.999");return r!=null&&n!=null&&s!=null&&!S(r,n)&&!I(r,s)}},[c.ABSOLUTE_GT]:{compare:({condition:e,value:t})=>{const r=h(t),n=N(e.value,"23:59:59.999");return r!=null&&n!=null&&I(r,n)}},[c.ABSOLUTE_LT]:{compare:({condition:e,value:t})=>{const r=h(t),n=N(e.value,"00:00:00.000");return r!=null&&n!=null&&S(r,n)}},[c.AND]:{compare:()=>V("AND.compare")},[c.BETWEEN]:{compare:({condition:e,value:t})=>!!t&&!!e.value&&!!e.value2&&parseFloat(v(t))>=parseFloat(e.value)&&parseFloat(v(t))<=parseFloat(e.value2)},[c.CONTAINS]:{compare:({sessionData:e,condition:t,value:r})=>!!r&&v(r).toLowerCase().includes(g(t.value||"",e).toLowerCase())},[c.EMPTY]:{compare:({value:e})=>e==null||e===""||Array.isArray(e)&&e.length===0},[c.ENDS_WITH]:{compare:({sessionData:e,condition:t,value:r})=>!!r&&v(r).toLowerCase().endsWith(g(t.value||"",e).toLowerCase())},[c.EQ]:{compare:({sessionData:e,condition:t,value:r})=>g(t.value||"",e)===v(r)},[c.EXCLUDES_ALL]:{compare:({condition:e,value:t})=>{const r=new Set(D(t));return!(e.values||[]).some(n=>r.has(n))}},[c.EXCLUDES_ANY]:{compare:({condition:e,value:t})=>{const r=new Set(D(t));return!(e.values||[]).every(n=>r.has(n))}},[c.FALSE]:{compare:({value:e})=>v(e).toLowerCase()==="false"},[c.GT]:{compare:({condition:e,value:t})=>!!t&&!!e.value&&parseFloat(v(t))>parseFloat(e.value)},[c.GTE]:{compare:({condition:e,value:t})=>!!t&&!!e.value&&parseFloat(v(t))>=parseFloat(e.value)},[c.INCLUDES_ALL]:{compare:({condition:e,value:t})=>{const r=new Set(D(t));return(e.values||[]).every(n=>r.has(n))}},[c.INCLUDES_ANY]:{compare:({condition:e,value:t})=>{const r=new Set(D(t));return(e.values||[]).some(n=>r.has(n))}},[c.LT]:{compare:({condition:e,value:t})=>!!t&&!!e.value&&parseFloat(v(t))<parseFloat(e.value)},[c.LTE]:{compare:({condition:e,value:t})=>!!t&&!!e.value&&parseFloat(v(t))<=parseFloat(e.value)},[c.NE]:{compare:({sessionData:e,condition:t,value:r})=>g(t.value||"",e)!==v(r)},[c.NOT_CONTAINS]:{compare:({sessionData:e,condition:t,value:r})=>!r||!v(r).toLowerCase().includes(g(t.value||"",e).toLowerCase())},[c.NOT_EMPTY]:{compare:({value:e})=>e!=null&&e!==""&&(!Array.isArray(e)||e.length>0)},[c.NOT_REGEX]:{compare:({condition:e,value:t})=>!B(e,t)},[c.OR]:{compare:()=>V("OR.compare")},[c.REGEX]:{compare:({condition:e,value:t})=>B(e,t)},[c.RELATIVE_EQ]:{compare:({condition:e,value:t})=>{const r=h(t),n=k(e.value);return r==null||n==null?!1:!S(r,n)&&S(r,z(n,1))}},[c.RELATIVE_GT]:{compare:({condition:e,value:t})=>{const r=h(t),n=k(e.value);return r==null||n==null?!1:I(r,n)}},[c.RELATIVE_LT]:{compare:({condition:e,value:t})=>{const r=h(t),n=k(e.value);return r==null||n==null?!1:S(r,n)}},[c.STARTS_WITH]:{compare:({sessionData:e,condition:t,value:r})=>!!r&&v(r).toLowerCase().startsWith(g(t.value||"",e).toLowerCase())},[c.TRUE]:{compare:({value:e})=>v(e).toLowerCase()==="true"},[c.URL]:{compare:({condition:e,value:t})=>e.urlPattern&&t!=null?te(e.urlPattern,v(t)):!1}};function V(e){throw new Error(`conditionOperators.${e} is not supported`)}function h(e){if(Array.isArray(e)&&(e=e[0]),!e)return null;e.match(/(Z|((\+|-)\d\d:\d\d))$/i)||(e+="Z");const t=P(e);return j(t)?t:null}function N(e,t){if(!e)return null;e+="T"+t+"Z";const r=P(e);return j(r)?r:null}function k(e){if(!e)return null;const t=parseInt(e,10);return isNaN(t)?null:Z(Date.now(),t)}function B(e,t){return e.value?new RegExp(e.value).test(v(t)):!1}function v(e){return Array.isArray(e)?e[0]:e??""}function D(e){return Array.isArray(e)?e:e===""||e==null?[]:[e]}const ne=50,se=1e3;function R(e,t={}){let r,n;const s=()=>{n=void 0,e()},a=()=>{if(window.clearTimeout(r),n==null)n=Date.now();else if(Date.now()-n>se){s();return}r=window.setTimeout(s,ne)},i=o=>{const p=o.target;if(!p||!H(p))return;const E=document.getElementById("userflow-ui");E&&E.contains(p)||a()},l=new q(o=>{ae(o)||a()}),f=G(o=>{l.observe(o,{attributes:!0,subtree:!0,childList:!0,characterData:!0}),o.addEventListener("animationend",i),o.addEventListener("transitionend",i),t.observeInput&&(o.addEventListener("input",a),o.addEventListener("keypress",a),o.addEventListener("change",a))},o=>{o.removeEventListener("animationend",i),o.removeEventListener("transitionend",i),t.observeInput&&(o.removeEventListener("input",a),o.removeEventListener("keypress",a),o.removeEventListener("change",a))});return{disconnect:()=>{window.clearTimeout(r),l.disconnect(),f()}}}function ae(e){const t=document.getElementById("userflow-ui");for(const r of e){const{target:n}=r;if(H(n)&&t&&t.contains(n))return!0}return!1}function H(e){return e.nodeType===Node.ELEMENT_NODE}const C={[T.ALWAYS_TRUE]:{track:({callback:e})=>(e(!0),()=>{})},[T.ATTRIBUTE]:{track:({sessionData:e,condition:t,callback:r})=>{const n=()=>{let a=!1;if(e&&t.operator){const i=e.value.find(o=>o.name===t.attributeName),l=i?i.value:null;a=_[t.operator].compare({sessionData:e.value,condition:t,value:l})}r(a)};n();const s=e.observe(n);return()=>{s()}}},[T.CLAUSE]:{isExpensive:e=>{for(const t of e.conditions){const r=C[t.type];if(r.isExpensive&&r.isExpensive(t))return!0}return!1},track:({sessionData:e,condition:t,flipBackEvents:r,callback:n,description:s})=>{let a,i,l=null;const f=t.conditions.map(m=>{const u=C[m.type];return{condition:m,typeDef:u,expensive:!!u.isExpensive&&u.isExpensive(m),active:!1,isTrue:null}}),o=m=>{for(const u of f){const d=!r||!u.expensive||m;d&&!u.active?(u.active=!0,u.isTrue=!1,u.untrack=u.typeDef.track({sessionData:e,condition:u.condition,flipBackEvents:r,callback:(w,b={})=>{u.isTrue=w,window.clearTimeout(a),b.immediate?p({immediate:!0}):a=window.setTimeout(p,0)},description:s})):!d&&u.active&&(u.untrack&&u.untrack(),u.active=!1,u.isTrue=null,u.untrack=void 0)}},p=(m={})=>{if(f.length===0){E(!1,m);return}let u,d;if(t.operator===c.AND){u=!0,d=!0;for(const w of f)w.isTrue===!1?(u=!1,w.expensive||(d=!1)):u!==!1&&w.isTrue===null&&(u=null)}else{u=!1,d=!0;for(const w of f)w.isTrue===!0?(u=!0,w.expensive||(d=!1)):u!==!0&&w.isTrue===null&&(u=null)}u!==null&&u!==l&&(l=u,E(u,m)),o(d)},E=(m,u)=>{if(!m||t.waitTime==null||t.waitTime=="0")window.clearTimeout(i),i=void 0,n(m,u);else if(!i){const d=parseFloat(t.waitTime)*1e3;i=window.setTimeout(()=>{n(!0,{})},d)}};return o(!1),p(),()=>{window.clearTimeout(a),window.clearTimeout(i);for(const m of f)m.untrack&&m.untrack()}}},[T.ELEMENT]:{isExpensive:()=>!0,track:e=>{const{elementState:t}=e.condition;if(!t)return()=>{};const r=oe(t);switch(r.kind){case"observer":return le(e,r.checkElement);case"event":return ue(e,r.eventName,r.valueWhenOccurred)}}},[T.FILLED_IN_INPUT]:{isExpensive:()=>!0,track:({sessionData:e,condition:t,callback:r})=>{let n=null,s;const a=()=>{if(!t.selector){console.warn("Userflow.js: INPUT_VALUE condition missing selector",t);return}const f=x(U(t.selector,e.value));let o=null;for(const p of f){const E=F(p);if(E){o=E;break}}o?o!=n&&(window.clearTimeout(s),s=window.setTimeout(()=>{r(!0)},1e3)):(r(!1),window.clearTimeout(s)),n=o};a();const i=e.observe(a),{disconnect:l}=R(a,{observeInput:!0});return()=>{i(),l(),window.clearTimeout(s)}}},[T.FLOW]:{track:()=>(console.warn("Userflow.js: Flow conditions do not work client-side"),()=>{})},[T.INPUT_VALUE]:{isExpensive:()=>!0,track:({sessionData:e,condition:t,callback:r})=>{const n=()=>{if(!t.operator){console.warn("Userflow.js: INPUT_VALUE condition missing operator",t);return}if(!t.selector){console.warn("Userflow.js: INPUT_VALUE condition missing selector",t);return}let i=!1;const l=_[t.operator],f=x(U(t.selector,e.value));if(f.length>0)for(const o of f){const p=F(o);if(l.compare({sessionData:e.value,condition:t,value:p})){i=!0;break}}else l.compare({sessionData:e.value,condition:t,value:""})&&(i=!0);r(i)};n();const s=e.observe(n),{disconnect:a}=R(n,{observeInput:!0});return()=>{s(),a()}}},[T.PAGE]:{track:({sessionData:e,condition:t,callback:r})=>{const n=()=>{let l=!1;if(t.operator){const f=y();l=_[t.operator].compare({sessionData:e.value,condition:t,value:f})}r(l)};let s=y();const a=()=>{const l=y();l!==s&&(s=l,n())};X(a),n();const i=e.observe(n);return()=>{i(),Y(a)}}},[T.SEGMENT]:{track:({description:e,callback:t})=>(console.error("Userflow.js: Segment conditions are not supported in "+(e||"unknown content item")+"."),t(!1),()=>{})},[T.TIME]:{track:({condition:e,callback:t})=>{let r=null;const n=e.value?new Date(e.value):null,s=e.value2?new Date(e.value2):null,a=()=>{let l=!0;(n&&!isNaN(n.valueOf())&&Date.now()<n.valueOf()||s&&!isNaN(s.valueOf())&&Date.now()>=s.valueOf())&&(l=!1),l!==r&&(r=l,t(l))};a();const i=window.setInterval(a,10*1e3);return()=>{window.clearInterval(i)}}}};function oe(e){switch(e){case L.CLICK:return{kind:"event",eventName:"click",valueWhenOccurred:!0};case L.DISABLED:return{kind:"observer",checkElement:t=>!!t&&t.disabled};case L.MOUSEDOWN:return{kind:"event",eventName:"mousedown",valueWhenOccurred:!0};case L.NOT_CLICK:return{kind:"event",eventName:"click",valueWhenOccurred:!1};case L.NOT_DISABLED:return{kind:"observer",checkElement:t=>!!t&&!t.disabled};case L.NOT_PRESENT:return{kind:"observer",checkElement:t=>!t};case L.PRESENT:return{kind:"observer",checkElement:t=>!!t}}}function le({sessionData:e,condition:t,callback:r},n){const s=()=>{if(!t.elementState){console.warn("Userflow.js: ELEMENT_STATE condition missing elementState",t);return}if(!t.selector){console.warn("Userflow.js: ELEMENT_STATE condition missing selector",t);return}let l=!1;const f=x(U(t.selector,e.value));if(f.length>0){for(const o of f)if(n(o)){l=!0;break}}else n(null)&&(l=!0);r(l)};s();const a=e.observe(s),{disconnect:i}=R(s);return()=>{a(),i()}}function ue({condition:e,flipBackEvents:t,callback:r},n,s){const{selector:a}=e;if(!a)return()=>{};r(!s);const i=o=>{const p=o.target;p&&Q(p,a)&&(t?(r(s,{immediate:!0}),r(!s,{immediate:!0})):r(s))},l={capture:!0},f=G(o=>o.addEventListener(n,i,l),o=>o.removeEventListener(n,i,l));return()=>{f()}}const me=Object.freeze(Object.defineProperty({__proto__:null,conditionTypes:C},Symbol.toStringTag,{value:"Module"}));export{g as a,J as b,C as c,me as f,ee as g,U as i,R as o};
|
|
2
2
|
//# sourceMappingURL=flow-condition-types.js.map
|
package/hash.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
d5485b60737404bc45b88595afb55db172465967
|