@frigade/react 2.6.6 → 2.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1991,6 +1991,7 @@ declare function useUser(): {
|
|
|
1991
1991
|
userId: string;
|
|
1992
1992
|
addProperties: (properties: Record<string, unknown>) => Promise<void>;
|
|
1993
1993
|
track: (eventName: string, properties?: Record<string, unknown>) => Promise<void>;
|
|
1994
|
+
isLoading: boolean;
|
|
1994
1995
|
};
|
|
1995
1996
|
|
|
1996
1997
|
declare function useGroup(): {
|
|
@@ -1998,6 +1999,7 @@ declare function useGroup(): {
|
|
|
1998
1999
|
setGroupId: (groupId: string, properties?: Record<string, unknown>) => Promise<void>;
|
|
1999
2000
|
addProperties: (properties: Record<string, unknown>) => Promise<void>;
|
|
2000
2001
|
track: (eventName: string, properties?: Record<string, unknown>) => Promise<void>;
|
|
2002
|
+
isLoading: boolean;
|
|
2001
2003
|
};
|
|
2002
2004
|
|
|
2003
2005
|
export { Announcement, AnnouncementProps, Banner, BannerProps, BaseField, Box, BoxProps, Button, ButtonProps, Card, CardHeaderProps, CardProps, index$2 as Checklist, CollapsibleProps, CollapsibleStepProps, Collection, Dialog, DialogProps, DismissHandler, FieldTypes, Flex, Flow, FlowChildrenProps, FlowConfig, FlowHandlerProp, FlowHandlerProps, FlowProps, FlowPropsWithoutChildren, Form, FormFieldData, FormFieldProps, FormProps, Hint, Image, Label, Media, index$1 as Progress, ProgressBadge, ProgressBadgeProps, Provider, ProviderProps, RadioField, SelectField, Spotlight, StepHandler, StepHandlerProp, StepHandlerProps, index as Survey, Text, TextField, TextProps, TextareaField, Theme, Tokens, Tooltip, TooltipProps, Tour, TourProps, Video, themeVariables, tokens, useBoundingClientRect, useFlow, useFlowHandlers, useFrigade, useGroup, useStepHandlers, useUser };
|
package/dist/index.js
CHANGED
|
@@ -64,7 +64,7 @@ var dt=Object.defineProperty,un=Object.defineProperties;var mn=Object.getOwnProp
|
|
|
64
64
|
to {
|
|
65
65
|
opacity: 1;
|
|
66
66
|
}
|
|
67
|
-
`;function go(F){var C=F,{align:e,alignOffset:o,autoScroll:t,defaultOpen:r,dismissible:n,flow:i,handleDismiss:l,modal:s,onPrimary:d,onSecondary:u,part:m,side:f,sideOffset:x,spotlight:v,step:S}=C,P=g(C,["align","alignOffset","autoScroll","defaultOpen","dismissible","flow","handleDismiss","modal","onPrimary","onSecondary","part","side","sideOffset","spotlight","step"]);var re,J,U,Q,ee;let{handlePrimary:B,handleSecondary:E}=ge(S,{onPrimary:d,onSecondary:u}),{videoProps:h,otherProps:k}=pe(P),w=(J=(re=S.primaryButton)==null?void 0:re.title)!=null?J:S.primaryButtonTitle,D=(Q=(U=S.secondaryButton)==null?void 0:U.title)!=null?Q:S.secondaryButtonTitle,H=!!S.$state.blocked;return jsx(Jo,p(a({align:e,alignOffset:o,anchor:S.selector,autoScroll:t,"data-step-id":S.id,defaultOpen:r,modal:s,part:m,side:f,sideOffset:x,spotlight:v},k),{children:jsxs(b,{animation:`${$a} 300ms ease-out`,boxShadow:"md",maxWidth:"min(360px, calc(100vw - 25px))",children:[jsx(b.Media,a({aspectRatio:"2",borderRadius:"md md 0 0",borderWidth:"0",margin:"-5 -5 0",objectFit:"cover",overflowClipMargin:"unset",src:(ee=S.videoUri)!=null?ee:S.imageUri,transform:"translate3d(0, 0, 1px)",type:S.videoUri?"video":"image"},h)),jsx(b.Header,{css:{".fr-dismiss":{position:"absolute",right:"12px",top:"12px"}},dismissible:n,handleDismiss:l,subtitle:S.subtitle,title:S.title}),jsxs(b.Footer,{children:[i.getNumberOfAvailableSteps()>1&&jsx(Oe,{current:i.getCurrentStepOrder()+1,marginRight:"auto",total:i.getNumberOfAvailableSteps()}),jsx(b.Secondary,{disabled:H,onClick:E,title:D}),jsx(b.Primary,{disabled:H,onClick:B,title:w})]})]})}))}function Lr(n){var i=n,{children:e,container:o,flowId:t}=i,r=g(i,["children","container","flowId"]);return jsx(wr,{container:o,children:jsx(y,p(a({"data-flow-id":t,part:"tour"},r),{children:e}))})}function yo(r){var n=r,{as:e,flowId:o}=n,t=g(n,["as","flowId"]);let{onDismiss:i,onPrimary:l,onSecondary:s}=t;return jsx(z,p(a({as:null,flowId:o},t),{children:({flow:d,handleDismiss:u,parentProps:m,step:f})=>{var ee;let Q=m.containerProps,{align:x="after",alignOffset:v=0,autoScroll:S=!1,container:P="body",defaultOpen:F,modal:C,part:B,sequential:E=!0,side:h="bottom",sideOffset:k=0,spotlight:w,zIndex:D=9999}=Q,H=g(Q,["align","alignOffset","autoScroll","container","defaultOpen","modal","part","sequential","side","sideOffset","spotlight","zIndex"]),{dismissible:re}=m,J=a({align:x,alignOffset:v,autoScroll:S,dismissible:re,flow:d,handleDismiss:u,modal:C,onPrimary:l,onSecondary:s,part:B,side:h,sideOffset:k,spotlight:w,step:f,zIndex:D},(ee=f.props)!=null?ee:{});if(E)return jsx(Lr,p(a({as:e,container:P,flowId:o,part:"tour",zIndex:D},H),{children:jsx(go,a({defaultOpen:F!=null?F:!0},J),f.id)}));let U=Array.from(d.steps.values()).filter(_=>{let{blocked:q,completed:j,skipped:oe,visible:W}=_.$state;return !q&&!j&&!oe&&W}).map(_=>{var te,ce,se,xe;function q(le){return A(this,null,function*(){return (yield i==null?void 0:i(d,le))===!1?(le.preventDefault(),!1):(_.skip(),!0)})}let j=w&&_.id===f.id,oe=(ce=(te=_.props)==null?void 0:te.zIndex)!=null?ce:D,W=a({align:x,alignOffset:v,dismissible:re,flow:d,handleDismiss:q,onPrimary:l,onSecondary:s,part:B,side:h,sideOffset:k,spotlight:w,zIndex:oe},(se=_.props)!=null?se:{});return jsx(go,a({css:{"&:has([aria-expanded=true])":{zIndex:Number(oe)+2},".fr-overlay":{zIndex:Number(oe)+1},".fr-progress-fraction":{display:"none"}},defaultOpen:(xe=F||j)!=null?xe:!1,step:_},W),`${_.id}-${j}`)});return jsx(Lr,p(a({as:e,container:P,flowId:o,part:"tour",zIndex:D},H),{children:U}))}}))}var xo="useSyncExternalStore"in Do?Do.useSyncExternalStore:Nr.useSyncExternalStore;function ho(){let{frigade:e}=useContext($),[,o]=useState(!1),t,r=useCallback(l=>{e==null||e.getCollections().then(()=>{l();});let s=()=>{clearTimeout(t),t=setTimeout(()=>{o(d=>!d),l();},0);};return e==null||e.onStateChange(s),()=>{e==null||e.removeStateChangeHandler(s);}},[]),n=()=>{let l;try{l=e==null?void 0:e.getCollectionsSync();}catch(s){}return l};return {collections:xo(r,n,n)}}function bo(e){var s,d,u,m;let{frigade:o}=useContext($),{collections:t}=ho(),r=t==null?void 0:t.get(e),i=(m=((u=(d=(s=t==null?void 0:t.get(e))==null?void 0:s.flows)==null?void 0:d.filter(f=>f.visible).map(f=>p(a({},f),{flow:o==null?void 0:o.getFlowSync(f.flowId)})))!=null?u:[]).find(({flow:f})=>f.isVisible))==null?void 0:m.flowId,{flow:l}=Te(i);return useEffect(()=>{o==null||o.registerCollection(e);},[e]),{collection:r,currentFlow:l}}function Zo(n){var i=n,{collectionId:e,part:o,variables:t={}}=i,r=g(i,["collectionId","part","variables"]);var u,m,f;let l={ANNOUNCEMENT:Yo,BANNER:Io,CARD:b,CHECKLIST:no,EMBEDDED_TIP:b,FORM:Me,NPS_SURVEY:Ke,SURVEY:Ke,TOUR:yo},{currentFlow:s}=bo(e),d=(m=l[(u=s==null?void 0:s.rawData)==null?void 0:u.flowType])!=null?m:null;return s==null||d==null?null:((f=s==null?void 0:s.rawData)==null?void 0:f.flowType)===FlowType.FORM?jsx(y,p(a({part:["collection",o],"data-collection-id":e},r),{children:jsx(Me,{flowId:s.id,as:V,variables:t},s.id)})):jsx(y,p(a({part:["collection",o],"data-collection-id":e},r),{children:jsx(d,{flowId:s.id,variables:t},s.id)}))}function _r(){var t,r;let{collections:e}=ho(),o=(r=Array.from((t=e==null?void 0:e.entries())!=null?t:[]).find(n=>n[1].collectionType==="DEFAULT"))==null?void 0:r[0];return bo(o),o==null?null:jsx(Zo,{as:null,collectionId:o})}var $=createContext({apiKey:"",currentModal:null,setCurrentModal:()=>{},navigate:()=>{},hasInitialized:!1,registerComponent:()=>{},unregisterComponent:()=>{},variables:{}});var be=(e,o="log")=>{let t=`__frigade_logged_${e}`;globalThis[t]||(globalThis[t]=!0,console[o](e));};function Qo(){let e=useContext($);(!e||!e.frigade)&&be("useFrigade() must be used in a child of the Frigade Provider","error");let{frigade:o}=e;return {frigade:o,isLoading:!(o!=null&&o.isReady())}}function zr(){let{frigade:e}=Qo();return useEffect(()=>{A(this,null,function*(){(yield e.getFlows()).forEach(t=>{t.steps.forEach(r=>{if(r.imageUri){let n=new Image;n.src=r.imageUri;}});});});},[]),null}var Ur="2.6.6";function Jr(l){var s=l,{children:e,css:o={},defaultCollection:t=!0,navigate:r,theme:n}=s,i=g(s,["children","css","defaultCollection","navigate","theme"]);let d=n?To(n):{},u=useRef(new Map),m=useRef(),[f,x]=useState(!1),[v,S]=useState(null),P=useMemo(()=>(x(!1),m.current=void 0,new Frigade(i.apiKey,{apiKey:i.apiKey,apiUrl:i.apiUrl,userId:i.userId,groupId:i.groupId,userProperties:i.userProperties,groupProperties:i.groupProperties,generateGuestId:i.generateGuestId,syncOnWindowUpdates:i.syncOnWindowUpdates,__readOnly:i.__readOnly,__flowStateOverrides:i.__flowStateOverrides,__platformVersion:Ur,__platformName:"React"})),[i.userId,i.groupId,i.apiKey]);useEffect(()=>{if(i.__flowStateOverrides){let h=P.getConfig();h.__flowStateOverrides=i.__flowStateOverrides,P.reload(h);}},[i.__flowStateOverrides]);function F(){let h=[...u.current.entries()].map(([k,w])=>[k,w.callback]);P.batchRegister(h),x(!0);}function C(h,k){if(m.current&&clearTimeout(m.current),f){u.current.has(h)?P.getFlow(h).then(w=>k(w.isVisible)):(P.getFlow(h).then(w=>w.register(k)),u.current.set(h,{callback:k}));return}u.current.has(h)||u.current.set(h,{callback:k}),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>F(),0);}function B(h){u.current.has(h)&&P.getFlow(h).then(k=>{u.current.delete(h),k==null||k.unregister();});}let E=r!=null?r:(h,k="_self")=>{window.open(h,k);};return useEffect(()=>()=>{P.destroy();},[]),jsxs($.Provider,{value:p(a({currentModal:v,setCurrentModal:S,navigate:E},i),{frigade:P,registerComponent:C,unregisterComponent:B,hasInitialized:f,variables:i.variables||{}}),children:[jsx(Global,{styles:{":root":a(a(a({},ko),d),o)}}),jsxs(ThemeProvider,{theme:O,children:[t&&jsx(_r,{}),e]}),i.preloadImages!==!1&&jsx(zr,{})]})}function Te(e,o){let t=useContext($);(!t||!t.frigade)&&be(`useFlow('${e}') must be used in a child of the Frigade Provider`,"error");let{frigade:r,variables:n}=t!=null?t:{},[,i]=useState(!1),l=useCallback(d=>{r==null||r.getFlow(e).then(()=>{d();});let u=m=>{m.id===e&&setTimeout(()=>{i(f=>!f),d();},0);};return r==null||r.onStateChange(u),()=>{r==null||r.removeStateChangeHandler(u);}},[e,r]),s=xo(l,()=>r==null?void 0:r.getFlowSync(e),()=>r==null?void 0:r.getFlowSync(e));return useEffect(()=>{s==null||s.applyVariables(a(a({},n),o==null?void 0:o.variables));},[o==null?void 0:o.variables,e,n]),{flow:s,isLoading:r!=null&&r.hasFailedToLoad()?!1:!s}}function ot(e,{onComplete:o,onDismiss:t}={}){let r=useRef(null);return useEffect(()=>{if(e==null)return;function n(){return A(this,null,function*(){e.isCompleted&&r.current===!1&&(r.current=!0,yield o==null?void 0:o(e));})}return n(),r.current=e==null?void 0:e.isCompleted,()=>{n();}},[e==null?void 0:e.isCompleted]),{handleDismiss:useCallback(n=>A(this,null,function*(){if((yield t==null?void 0:t(e,n))===!1)return n.preventDefault(),!1;e.skip();}),[e])}}function Yr(e,o=!0){let{currentModal:t,setCurrentModal:r}=useContext($),n=useCallback(l=>{o&&(e!=null&&e.isVisible)&&r(l);},[o,e==null?void 0:e.isVisible]),i=useCallback(()=>{e!=null&&t===(e==null?void 0:e.id)&&r(null);},[t,e==null?void 0:e.id]);return useEffect(()=>(e!=null&&t===null&&e.isVisible&&n(e.id),i),[t,e==null?void 0:e.id,e==null?void 0:e.isVisible]),useEffect(()=>{e!=null&&(!o||!e.isVisible)&&i();},[e==null?void 0:e.isVisible,o]),e==null?{hasModalCollision:!1}:!o||!e.isVisible?{hasModalCollision:!1}:t===e.id?{hasModalCollision:!1}:t===null?{hasModalCollision:!1}:{hasModalCollision:!0}}function rt(e){return typeof e=="function"&&e.displayName==="Dialog"}function z(u){var m=u,{as:e,children:o,flowId:t,onComplete:r,onDismiss:n,onPrimary:i,onSecondary:l,variables:s}=m,d=g(m,["as","children","flowId","onComplete","onDismiss","onPrimary","onSecondary","variables"]);var U,Q,ee,q;let{flow:f}=Te(t,{variables:s}),x=f==null?void 0:f.getCurrentStep(),v=(U=x==null?void 0:x.props)!=null?U:{},{otherProps:S}=pe(v),_=a(a(a({},d),(Q=f==null?void 0:f.props)!=null?Q:{}),((ee=f==null?void 0:f.rawData)==null?void 0:ee.flowType)===FlowType.CHECKLIST?{}:S),{dismissible:P=!!rt(e),forceMount:F=!1}=_,C=g(_,["dismissible","forceMount"]),{handleDismiss:B}=ot(f,{onComplete:r,onDismiss:n}),{handlePrimary:E,handleSecondary:h}=ge(x,{onPrimary:i,onSecondary:l}),k=(C==null?void 0:C.modal)||rt(e)||[FlowType.ANNOUNCEMENT,FlowType.TOUR].includes((q=f==null?void 0:f.rawData)==null?void 0:q.flowType),{hasModalCollision:w}=Yr(f,k);function D(j){if(P===!1){j.preventDefault();return}typeof d.onEscapeKeyDown=="function"&&d.onEscapeKeyDown(j),j.defaultPrevented||B(j);}let H=F&&((f==null?void 0:f.isCompleted)||(f==null?void 0:f.isSkipped));if(!f||(!f.isVisible||w)&&!H)return null;(H||!f.isCompleted&&!f.isSkipped)&&(x==null||x.start());let re=e===null?Fragment$1:e!=null?e:y,J=p(a({},C),{"data-flow-id":f.id});return rt(e)&&(J.onEscapeKeyDown=D),jsx(re,p(a({},e===null?{}:J),{children:o({flow:f,handleDismiss:B,handlePrimary:E,handleSecondary:h,parentProps:{dismissible:P,flowId:t,variables:s,containerProps:J},step:x})}))}function en(t){var r=t,{part:e}=r,o=g(r,["part"]);return jsx(z,p(a({as:b,gap:5,borderColor:"neutral.border",borderStyle:"solid",borderWidth:"md",part:["card",e]},o),{children:({handleDismiss:n,handlePrimary:i,handleSecondary:l,parentProps:{dismissible:s},step:d})=>{var x,v,S,P,F,C;let u=(v=(x=d.primaryButton)==null?void 0:x.title)!=null?v:d.primaryButtonTitle,m=(P=(S=d.secondaryButton)==null?void 0:S.title)!=null?P:d.secondaryButtonTitle,{videoProps:f}=pe((F=d.props)!=null?F:{});return jsxs(Fragment,{children:[jsx(b.Header,{dismissible:s,handleDismiss:n,subtitle:d.subtitle,title:d.title}),jsx(b.Media,a({src:(C=d.videoUri)!=null?C:d.imageUri,type:d.videoUri?"video":"image",css:{objectFit:"contain",width:"100%"}},f)),jsxs(R.Row,{gap:3,justifyContent:"flex-end",part:"card-footer",children:[jsx(b.Secondary,{title:m,onClick:l}),jsx(b.Primary,{title:u,onClick:i})]})]})}}))}function Co(r){var n=r,{part:e,src:o}=n,t=g(n,["part","src"]);return jsx(y,a({as:"img",maxWidth:"unset",part:["image",e],src:o},t))}function ps(e){var o,t,r,n,i;return e.includes("youtube")?`https://www.youtube.com/embed/${(o=e.split("v=")[1])==null?void 0:o.split("&")[0]}`:e.includes("youtu.be")?`https://www.youtube.com/embed/${(t=e.split("youtu.be/")[1])==null?void 0:t.split("&")[0]}`:e.includes("vimeo")?`https://player.vimeo.com/video/${(r=e.split("vimeo.com/")[1])==null?void 0:r.split("&")[0]}`:e.includes("wistia")?`https://fast.wistia.net/embed/iframe/${(n=e.split("wistia.com/medias/")[1])==null?void 0:n.split("&")[0]}`:e.includes("loom")?`https://loom.com/embed/${(i=e.split("loom.com/share/")[1])==null?void 0:i.split("&")[0]}?hideEmbedTopBar=true&hide_title=true&hide_share=true&hide_owner=true`:null}function So(S){var P=S,{autoPlay:e,controls:o,controlsList:t,crossOrigin:r,disablePictureInPicture:n,disableRemotePlayback:i,loop:l,muted:s,playsInline:d,poster:u,preload:m,part:f,src:x}=P,v=g(P,["autoPlay","controls","controlsList","crossOrigin","disablePictureInPicture","disableRemotePlayback","loop","muted","playsInline","poster","preload","part","src"]);let F=ps(x);return F?jsx(y,a({allow:"accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture",allowFullScreen:!0,as:"iframe",backgroundColor:"neutral.100",borderWidth:"0",part:["video",f],src:F},v)):x!=null&&x.endsWith(".mp4")?jsx(y,a({as:"video",part:["video",f],src:x,autoPlay:e,controls:o!=null?o:!0,controlsList:t,crossOrigin:r,disablePictureInPicture:n,disableRemotePlayback:i,loop:l,muted:s!=null?s:e,playsInline:d,poster:u,preload:m},v)):(console.error(`Could not map videoUri ${x} to a known provider (Youtube, Vimeo, Wistia, Loom) or valid mp4 file.`),null)}function Pe(r){var n=r,{src:e,type:o}=n,t=g(n,["src","type"]);return jsx(o==="video"?So:Co,a({src:e},t))}var b=Do.forwardRef((i,n)=>{var l=i,{children:e,flowId:o,part:t}=l,r=g(l,["children","flowId","part"]);var d;if(o!=null)return jsx(en,a({flowId:o},r));let s=(d=r.as)!=null?d:R.Column;return jsx(s,p(a({backgroundColor:"neutral.background",borderColor:"neutral.border",borderStyle:"solid",borderRadius:"md",borderWidth:"0",gap:5,p:5,part:["card",t]},r),{ref:n,children:e}))});b.Dismiss=e=>jsx(I.Plain,p(a({"aria-label":"Dismiss",part:"dismiss",padding:0},e),{children:jsx(Be,{height:"20",fill:"currentColor"})}));b.Footer=r=>{var n=r,{children:e,part:o}=n,t=g(n,["children","part"]);return jsx(R.Row,p(a({alignItems:"center",gap:3,justifyContent:"flex-end",part:["card-footer",o]},t),{children:e}))};b.Header=l=>{var s=l,{dismissible:e,handleDismiss:o,part:t,subtitle:r,title:n}=s,i=g(s,["dismissible","handleDismiss","part","subtitle","title"]);return !e&&(n==null||(n==null?void 0:n.length)===0)&&(r==null||(r==null?void 0:r.length)===0)?null:jsxs(R.Row,p(a({alignItems:"flex-start",flexWrap:"wrap",gap:1,part:["card-header",t]},i),{children:[jsx(b.Title,{maxWidth:"calc(100% - 32px)",children:n}),e&&jsx(b.Dismiss,{onClick:o,marginLeft:"auto"}),jsx(b.Subtitle,{color:"neutral.400",flexBasis:"100%",children:r})]}))};b.Media=t=>{var r=t,{src:e}=r,o=g(r,["src"]);return e==null||(e==null?void 0:e.length)===0?null:jsx(Pe,a({borderRadius:"md",src:e},o))};b.Primary=r=>{var n=r,{onClick:e,title:o}=n,t=g(n,["onClick","title"]);return o==null||(o==null?void 0:o.length)===0?null:jsx(I.Primary,a({title:o,onClick:e},t))};b.Secondary=r=>{var n=r,{onClick:e,title:o}=n,t=g(n,["onClick","title"]);return o==null||(o==null?void 0:o.length)===0?null:jsx(I.Secondary,a({title:o,onClick:e},t))};b.Subtitle=r=>{var n=r,{children:e,part:o}=n,t=g(n,["children","part"]);return e==null?null:jsx(T.Body2,p(a({display:"block",color:"neutral.400",part:["subtitle",o]},t),{children:e}))};b.Title=r=>{var n=r,{children:e,part:o}=n,t=g(n,["children","part"]);return e==null?null:jsx(T.H4,p(a({display:"block",part:["title",o]},t),{children:e}))};var wo={content:["onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onPointerDownOutside","onInteractOutside"],root:["defaultOpen","modal","onOpenChange","open"]};function rn(e){let o=Object.fromEntries(wo.content.map(n=>[n,e[n]]).filter(n=>n[1]!==void 0)),t=Object.fromEntries(wo.root.map(n=>[n,e[n]]).filter(n=>n[1]!==void 0)),r={};for(let n of Object.keys(e))!wo.content.some(i=>i===n)&&!wo.root.some(i=>i===n)&&(r[n]=e[n]);return {contentProps:o,otherProps:r,rootProps:t}}var ms=keyframes`
|
|
67
|
+
`;function go(F){var C=F,{align:e,alignOffset:o,autoScroll:t,defaultOpen:r,dismissible:n,flow:i,handleDismiss:l,modal:s,onPrimary:d,onSecondary:u,part:m,side:f,sideOffset:x,spotlight:v,step:S}=C,P=g(C,["align","alignOffset","autoScroll","defaultOpen","dismissible","flow","handleDismiss","modal","onPrimary","onSecondary","part","side","sideOffset","spotlight","step"]);var re,J,U,Q,ee;let{handlePrimary:B,handleSecondary:E}=ge(S,{onPrimary:d,onSecondary:u}),{videoProps:h,otherProps:k}=pe(P),w=(J=(re=S.primaryButton)==null?void 0:re.title)!=null?J:S.primaryButtonTitle,D=(Q=(U=S.secondaryButton)==null?void 0:U.title)!=null?Q:S.secondaryButtonTitle,H=!!S.$state.blocked;return jsx(Jo,p(a({align:e,alignOffset:o,anchor:S.selector,autoScroll:t,"data-step-id":S.id,defaultOpen:r,modal:s,part:m,side:f,sideOffset:x,spotlight:v},k),{children:jsxs(b,{animation:`${$a} 300ms ease-out`,boxShadow:"md",maxWidth:"min(360px, calc(100vw - 25px))",children:[jsx(b.Media,a({aspectRatio:"2",borderRadius:"md md 0 0",borderWidth:"0",margin:"-5 -5 0",objectFit:"cover",overflowClipMargin:"unset",src:(ee=S.videoUri)!=null?ee:S.imageUri,transform:"translate3d(0, 0, 1px)",type:S.videoUri?"video":"image"},h)),jsx(b.Header,{css:{".fr-dismiss":{position:"absolute",right:"12px",top:"12px"}},dismissible:n,handleDismiss:l,subtitle:S.subtitle,title:S.title}),jsxs(b.Footer,{children:[i.getNumberOfAvailableSteps()>1&&jsx(Oe,{current:i.getCurrentStepOrder()+1,marginRight:"auto",total:i.getNumberOfAvailableSteps()}),jsx(b.Secondary,{disabled:H,onClick:E,title:D}),jsx(b.Primary,{disabled:H,onClick:B,title:w})]})]})}))}function Lr(n){var i=n,{children:e,container:o,flowId:t}=i,r=g(i,["children","container","flowId"]);return jsx(wr,{container:o,children:jsx(y,p(a({"data-flow-id":t,part:"tour"},r),{children:e}))})}function yo(r){var n=r,{as:e,flowId:o}=n,t=g(n,["as","flowId"]);let{onDismiss:i,onPrimary:l,onSecondary:s}=t;return jsx(z,p(a({as:null,flowId:o},t),{children:({flow:d,handleDismiss:u,parentProps:m,step:f})=>{var ee;let Q=m.containerProps,{align:x="after",alignOffset:v=0,autoScroll:S=!1,container:P="body",defaultOpen:F,modal:C,part:B,sequential:E=!0,side:h="bottom",sideOffset:k=0,spotlight:w,zIndex:D=9999}=Q,H=g(Q,["align","alignOffset","autoScroll","container","defaultOpen","modal","part","sequential","side","sideOffset","spotlight","zIndex"]),{dismissible:re}=m,J=a({align:x,alignOffset:v,autoScroll:S,dismissible:re,flow:d,handleDismiss:u,modal:C,onPrimary:l,onSecondary:s,part:B,side:h,sideOffset:k,spotlight:w,step:f,zIndex:D},(ee=f.props)!=null?ee:{});if(E)return jsx(Lr,p(a({as:e,container:P,flowId:o,part:"tour",zIndex:D},H),{children:jsx(go,a({defaultOpen:F!=null?F:!0},J),f.id)}));let U=Array.from(d.steps.values()).filter(_=>{let{blocked:q,completed:j,skipped:oe,visible:W}=_.$state;return !q&&!j&&!oe&&W}).map(_=>{var te,ce,se,xe;function q(le){return A(this,null,function*(){return (yield i==null?void 0:i(d,le))===!1?(le.preventDefault(),!1):(_.skip(),!0)})}let j=w&&_.id===f.id,oe=(ce=(te=_.props)==null?void 0:te.zIndex)!=null?ce:D,W=a({align:x,alignOffset:v,dismissible:re,flow:d,handleDismiss:q,onPrimary:l,onSecondary:s,part:B,side:h,sideOffset:k,spotlight:w,zIndex:oe},(se=_.props)!=null?se:{});return jsx(go,a({css:{"&:has([aria-expanded=true])":{zIndex:Number(oe)+2},".fr-overlay":{zIndex:Number(oe)+1},".fr-progress-fraction":{display:"none"}},defaultOpen:(xe=F||j)!=null?xe:!1,step:_},W),`${_.id}-${j}`)});return jsx(Lr,p(a({as:e,container:P,flowId:o,part:"tour",zIndex:D},H),{children:U}))}}))}var xo="useSyncExternalStore"in Do?Do.useSyncExternalStore:Nr.useSyncExternalStore;function ho(){let{frigade:e}=useContext($),[,o]=useState(!1),t,r=useCallback(l=>{e==null||e.getCollections().then(()=>{l();});let s=()=>{clearTimeout(t),t=setTimeout(()=>{o(d=>!d),l();},0);};return e==null||e.onStateChange(s),()=>{e==null||e.removeStateChangeHandler(s);}},[]),n=()=>{let l;try{l=e==null?void 0:e.getCollectionsSync();}catch(s){}return l};return {collections:xo(r,n,n)}}function bo(e){var s,d,u,m;let{frigade:o}=useContext($),{collections:t}=ho(),r=t==null?void 0:t.get(e),i=(m=((u=(d=(s=t==null?void 0:t.get(e))==null?void 0:s.flows)==null?void 0:d.filter(f=>f.visible).map(f=>p(a({},f),{flow:o==null?void 0:o.getFlowSync(f.flowId)})))!=null?u:[]).find(({flow:f})=>f.isVisible))==null?void 0:m.flowId,{flow:l}=Te(i);return useEffect(()=>{o==null||o.registerCollection(e);},[e]),{collection:r,currentFlow:l}}function Zo(n){var i=n,{collectionId:e,part:o,variables:t={}}=i,r=g(i,["collectionId","part","variables"]);var u,m,f;let l={ANNOUNCEMENT:Yo,BANNER:Io,CARD:b,CHECKLIST:no,EMBEDDED_TIP:b,FORM:Me,NPS_SURVEY:Ke,SURVEY:Ke,TOUR:yo},{currentFlow:s}=bo(e),d=(m=l[(u=s==null?void 0:s.rawData)==null?void 0:u.flowType])!=null?m:null;return s==null||d==null?null:((f=s==null?void 0:s.rawData)==null?void 0:f.flowType)===FlowType.FORM?jsx(y,p(a({part:["collection",o],"data-collection-id":e},r),{children:jsx(Me,{flowId:s.id,as:V,variables:t},s.id)})):jsx(y,p(a({part:["collection",o],"data-collection-id":e},r),{children:jsx(d,{flowId:s.id,variables:t},s.id)}))}function _r(){var t,r;let{collections:e}=ho(),o=(r=Array.from((t=e==null?void 0:e.entries())!=null?t:[]).find(n=>n[1].collectionType==="DEFAULT"))==null?void 0:r[0];return bo(o),o==null?null:jsx(Zo,{as:null,collectionId:o})}var $=createContext({apiKey:"",currentModal:null,setCurrentModal:()=>{},navigate:()=>{},hasInitialized:!1,registerComponent:()=>{},unregisterComponent:()=>{},variables:{}});var be=(e,o="log")=>{let t=`__frigade_logged_${e}`;globalThis[t]||(globalThis[t]=!0,console[o](e));};function Qo(){let e=useContext($);(!e||!e.frigade)&&be("useFrigade() must be used in a child of the Frigade Provider","warn");let{frigade:o}=e;return {frigade:o,isLoading:!(o!=null&&o.isReady())}}function zr(){let{frigade:e}=Qo();return useEffect(()=>{A(this,null,function*(){(yield e.getFlows()).forEach(t=>{t.steps.forEach(r=>{if(r.imageUri){let n=new Image;n.src=r.imageUri;}});});});},[]),null}var Ur="2.6.7";function Jr(l){var s=l,{children:e,css:o={},defaultCollection:t=!0,navigate:r,theme:n}=s,i=g(s,["children","css","defaultCollection","navigate","theme"]);let d=n?To(n):{},u=useRef(new Map),m=useRef(),[f,x]=useState(!1),[v,S]=useState(null),P=useMemo(()=>(x(!1),m.current=void 0,new Frigade(i.apiKey,{apiKey:i.apiKey,apiUrl:i.apiUrl,userId:i.userId,groupId:i.groupId,userProperties:i.userProperties,groupProperties:i.groupProperties,generateGuestId:i.generateGuestId,syncOnWindowUpdates:i.syncOnWindowUpdates,__readOnly:i.__readOnly,__flowStateOverrides:i.__flowStateOverrides,__platformVersion:Ur,__platformName:"React"})),[i.userId,i.groupId,i.apiKey]);useEffect(()=>{if(i.__flowStateOverrides){let h=P.getConfig();h.__flowStateOverrides=i.__flowStateOverrides,P.reload(h);}},[i.__flowStateOverrides]);function F(){let h=[...u.current.entries()].map(([k,w])=>[k,w.callback]);P.batchRegister(h),x(!0);}function C(h,k){if(m.current&&clearTimeout(m.current),f){u.current.has(h)?P.getFlow(h).then(w=>k(w.isVisible)):(P.getFlow(h).then(w=>w.register(k)),u.current.set(h,{callback:k}));return}u.current.has(h)||u.current.set(h,{callback:k}),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>F(),0);}function B(h){u.current.has(h)&&P.getFlow(h).then(k=>{u.current.delete(h),k==null||k.unregister();});}let E=r!=null?r:(h,k="_self")=>{window.open(h,k);};return useEffect(()=>()=>{P.destroy();},[]),jsxs($.Provider,{value:p(a({currentModal:v,setCurrentModal:S,navigate:E},i),{frigade:P,registerComponent:C,unregisterComponent:B,hasInitialized:f,variables:i.variables||{}}),children:[jsx(Global,{styles:{":root":a(a(a({},ko),d),o)}}),jsxs(ThemeProvider,{theme:O,children:[t&&jsx(_r,{}),e]}),i.preloadImages!==!1&&jsx(zr,{})]})}function Te(e,o){let t=useContext($);(!t||!t.frigade)&&be(`useFlow('${e}') must be used in a child of the Frigade Provider`,"warn");let{frigade:r,variables:n}=t!=null?t:{},[,i]=useState(!1),l=useCallback(d=>{r==null||r.getFlow(e).then(()=>{d();});let u=m=>{m.id===e&&setTimeout(()=>{i(f=>!f),d();},0);};return r==null||r.onStateChange(u),()=>{r==null||r.removeStateChangeHandler(u);}},[e,r]),s=xo(l,()=>r==null?void 0:r.getFlowSync(e),()=>r==null?void 0:r.getFlowSync(e));return useEffect(()=>{s==null||s.applyVariables(a(a({},n),o==null?void 0:o.variables));},[o==null?void 0:o.variables,e,n]),{flow:s,isLoading:r!=null&&r.hasFailedToLoad()?!1:!s}}function ot(e,{onComplete:o,onDismiss:t}={}){let r=useRef(null);return useEffect(()=>{if(e==null)return;function n(){return A(this,null,function*(){e.isCompleted&&r.current===!1&&(r.current=!0,yield o==null?void 0:o(e));})}return n(),r.current=e==null?void 0:e.isCompleted,()=>{n();}},[e==null?void 0:e.isCompleted]),{handleDismiss:useCallback(n=>A(this,null,function*(){if((yield t==null?void 0:t(e,n))===!1)return n.preventDefault(),!1;e.skip();}),[e])}}function Yr(e,o=!0){let{currentModal:t,setCurrentModal:r}=useContext($),n=useCallback(l=>{o&&(e!=null&&e.isVisible)&&r(l);},[o,e==null?void 0:e.isVisible]),i=useCallback(()=>{e!=null&&t===(e==null?void 0:e.id)&&r(null);},[t,e==null?void 0:e.id]);return useEffect(()=>(e!=null&&t===null&&e.isVisible&&n(e.id),i),[t,e==null?void 0:e.id,e==null?void 0:e.isVisible]),useEffect(()=>{e!=null&&(!o||!e.isVisible)&&i();},[e==null?void 0:e.isVisible,o]),e==null?{hasModalCollision:!1}:!o||!e.isVisible?{hasModalCollision:!1}:t===e.id?{hasModalCollision:!1}:t===null?{hasModalCollision:!1}:{hasModalCollision:!0}}function rt(e){return typeof e=="function"&&e.displayName==="Dialog"}function z(u){var m=u,{as:e,children:o,flowId:t,onComplete:r,onDismiss:n,onPrimary:i,onSecondary:l,variables:s}=m,d=g(m,["as","children","flowId","onComplete","onDismiss","onPrimary","onSecondary","variables"]);var U,Q,ee,q;let{flow:f}=Te(t,{variables:s}),x=f==null?void 0:f.getCurrentStep(),v=(U=x==null?void 0:x.props)!=null?U:{},{otherProps:S}=pe(v),_=a(a(a({},d),(Q=f==null?void 0:f.props)!=null?Q:{}),((ee=f==null?void 0:f.rawData)==null?void 0:ee.flowType)===FlowType.CHECKLIST?{}:S),{dismissible:P=!!rt(e),forceMount:F=!1}=_,C=g(_,["dismissible","forceMount"]),{handleDismiss:B}=ot(f,{onComplete:r,onDismiss:n}),{handlePrimary:E,handleSecondary:h}=ge(x,{onPrimary:i,onSecondary:l}),k=(C==null?void 0:C.modal)||rt(e)||[FlowType.ANNOUNCEMENT,FlowType.TOUR].includes((q=f==null?void 0:f.rawData)==null?void 0:q.flowType),{hasModalCollision:w}=Yr(f,k);function D(j){if(P===!1){j.preventDefault();return}typeof d.onEscapeKeyDown=="function"&&d.onEscapeKeyDown(j),j.defaultPrevented||B(j);}let H=F&&((f==null?void 0:f.isCompleted)||(f==null?void 0:f.isSkipped));if(!f||(!f.isVisible||w)&&!H)return null;(H||!f.isCompleted&&!f.isSkipped)&&(x==null||x.start());let re=e===null?Fragment$1:e!=null?e:y,J=p(a({},C),{"data-flow-id":f.id});return rt(e)&&(J.onEscapeKeyDown=D),jsx(re,p(a({},e===null?{}:J),{children:o({flow:f,handleDismiss:B,handlePrimary:E,handleSecondary:h,parentProps:{dismissible:P,flowId:t,variables:s,containerProps:J},step:x})}))}function en(t){var r=t,{part:e}=r,o=g(r,["part"]);return jsx(z,p(a({as:b,gap:5,borderColor:"neutral.border",borderStyle:"solid",borderWidth:"md",part:["card",e]},o),{children:({handleDismiss:n,handlePrimary:i,handleSecondary:l,parentProps:{dismissible:s},step:d})=>{var x,v,S,P,F,C;let u=(v=(x=d.primaryButton)==null?void 0:x.title)!=null?v:d.primaryButtonTitle,m=(P=(S=d.secondaryButton)==null?void 0:S.title)!=null?P:d.secondaryButtonTitle,{videoProps:f}=pe((F=d.props)!=null?F:{});return jsxs(Fragment,{children:[jsx(b.Header,{dismissible:s,handleDismiss:n,subtitle:d.subtitle,title:d.title}),jsx(b.Media,a({src:(C=d.videoUri)!=null?C:d.imageUri,type:d.videoUri?"video":"image",css:{objectFit:"contain",width:"100%"}},f)),jsxs(R.Row,{gap:3,justifyContent:"flex-end",part:"card-footer",children:[jsx(b.Secondary,{title:m,onClick:l}),jsx(b.Primary,{title:u,onClick:i})]})]})}}))}function Co(r){var n=r,{part:e,src:o}=n,t=g(n,["part","src"]);return jsx(y,a({as:"img",maxWidth:"unset",part:["image",e],src:o},t))}function ps(e){var o,t,r,n,i;return e.includes("youtube")?`https://www.youtube.com/embed/${(o=e.split("v=")[1])==null?void 0:o.split("&")[0]}`:e.includes("youtu.be")?`https://www.youtube.com/embed/${(t=e.split("youtu.be/")[1])==null?void 0:t.split("&")[0]}`:e.includes("vimeo")?`https://player.vimeo.com/video/${(r=e.split("vimeo.com/")[1])==null?void 0:r.split("&")[0]}`:e.includes("wistia")?`https://fast.wistia.net/embed/iframe/${(n=e.split("wistia.com/medias/")[1])==null?void 0:n.split("&")[0]}`:e.includes("loom")?`https://loom.com/embed/${(i=e.split("loom.com/share/")[1])==null?void 0:i.split("&")[0]}?hideEmbedTopBar=true&hide_title=true&hide_share=true&hide_owner=true`:null}function So(S){var P=S,{autoPlay:e,controls:o,controlsList:t,crossOrigin:r,disablePictureInPicture:n,disableRemotePlayback:i,loop:l,muted:s,playsInline:d,poster:u,preload:m,part:f,src:x}=P,v=g(P,["autoPlay","controls","controlsList","crossOrigin","disablePictureInPicture","disableRemotePlayback","loop","muted","playsInline","poster","preload","part","src"]);let F=ps(x);return F?jsx(y,a({allow:"accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture",allowFullScreen:!0,as:"iframe",backgroundColor:"neutral.100",borderWidth:"0",part:["video",f],src:F},v)):x!=null&&x.endsWith(".mp4")?jsx(y,a({as:"video",part:["video",f],src:x,autoPlay:e,controls:o!=null?o:!0,controlsList:t,crossOrigin:r,disablePictureInPicture:n,disableRemotePlayback:i,loop:l,muted:s!=null?s:e,playsInline:d,poster:u,preload:m},v)):(console.error(`Could not map videoUri ${x} to a known provider (Youtube, Vimeo, Wistia, Loom) or valid mp4 file.`),null)}function Pe(r){var n=r,{src:e,type:o}=n,t=g(n,["src","type"]);return jsx(o==="video"?So:Co,a({src:e},t))}var b=Do.forwardRef((i,n)=>{var l=i,{children:e,flowId:o,part:t}=l,r=g(l,["children","flowId","part"]);var d;if(o!=null)return jsx(en,a({flowId:o},r));let s=(d=r.as)!=null?d:R.Column;return jsx(s,p(a({backgroundColor:"neutral.background",borderColor:"neutral.border",borderStyle:"solid",borderRadius:"md",borderWidth:"0",gap:5,p:5,part:["card",t]},r),{ref:n,children:e}))});b.Dismiss=e=>jsx(I.Plain,p(a({"aria-label":"Dismiss",part:"dismiss",padding:0},e),{children:jsx(Be,{height:"20",fill:"currentColor"})}));b.Footer=r=>{var n=r,{children:e,part:o}=n,t=g(n,["children","part"]);return jsx(R.Row,p(a({alignItems:"center",gap:3,justifyContent:"flex-end",part:["card-footer",o]},t),{children:e}))};b.Header=l=>{var s=l,{dismissible:e,handleDismiss:o,part:t,subtitle:r,title:n}=s,i=g(s,["dismissible","handleDismiss","part","subtitle","title"]);return !e&&(n==null||(n==null?void 0:n.length)===0)&&(r==null||(r==null?void 0:r.length)===0)?null:jsxs(R.Row,p(a({alignItems:"flex-start",flexWrap:"wrap",gap:1,part:["card-header",t]},i),{children:[jsx(b.Title,{maxWidth:"calc(100% - 32px)",children:n}),e&&jsx(b.Dismiss,{onClick:o,marginLeft:"auto"}),jsx(b.Subtitle,{color:"neutral.400",flexBasis:"100%",children:r})]}))};b.Media=t=>{var r=t,{src:e}=r,o=g(r,["src"]);return e==null||(e==null?void 0:e.length)===0?null:jsx(Pe,a({borderRadius:"md",src:e},o))};b.Primary=r=>{var n=r,{onClick:e,title:o}=n,t=g(n,["onClick","title"]);return o==null||(o==null?void 0:o.length)===0?null:jsx(I.Primary,a({title:o,onClick:e},t))};b.Secondary=r=>{var n=r,{onClick:e,title:o}=n,t=g(n,["onClick","title"]);return o==null||(o==null?void 0:o.length)===0?null:jsx(I.Secondary,a({title:o,onClick:e},t))};b.Subtitle=r=>{var n=r,{children:e,part:o}=n,t=g(n,["children","part"]);return e==null?null:jsx(T.Body2,p(a({display:"block",color:"neutral.400",part:["subtitle",o]},t),{children:e}))};b.Title=r=>{var n=r,{children:e,part:o}=n,t=g(n,["children","part"]);return e==null?null:jsx(T.H4,p(a({display:"block",part:["title",o]},t),{children:e}))};var wo={content:["onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onPointerDownOutside","onInteractOutside"],root:["defaultOpen","modal","onOpenChange","open"]};function rn(e){let o=Object.fromEntries(wo.content.map(n=>[n,e[n]]).filter(n=>n[1]!==void 0)),t=Object.fromEntries(wo.root.map(n=>[n,e[n]]).filter(n=>n[1]!==void 0)),r={};for(let n of Object.keys(e))!wo.content.some(i=>i===n)&&!wo.root.some(i=>i===n)&&(r[n]=e[n]);return {contentProps:o,otherProps:r,rootProps:t}}var ms=keyframes`
|
|
68
68
|
from {
|
|
69
69
|
opacity: 0;
|
|
70
70
|
}
|
|
@@ -84,7 +84,7 @@ var dt=Object.defineProperty,un=Object.defineProperties;var mn=Object.getOwnProp
|
|
|
84
84
|
to {
|
|
85
85
|
opacity: 1;
|
|
86
86
|
}
|
|
87
|
-
`;function dn(e){return e instanceof HTMLElement?!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length):!1}function Se(u){var m=u,{anchor:e,children:o,className:t,defaultOpen:r=!0,open:n,part:i,spotlight:l=!1,style:s={}}=m,d=g(m,["anchor","children","className","defaultOpen","open","part","spotlight","style"]);let{node:f,rect:x,ref:v}=fo(),{node:S,rect:P,ref:F}=fo(),{contentProps:C,otherProps:B,rootProps:E}=ln(d,x),[h,k]=useState(r),[w,D]=useState(C.align),[H,re]=useState(C.side),[J,U]=useState(0),[Q,ee]=useState(0);function _(){return n!=null?(console.log("OVERRIDE: ",n),n):(console.log("INTERNAL: ",h),h)}if(f!==null){let W=f.getAttribute("data-align"),te=f.getAttribute("data-side");w!==W&&D(W),H!==te&&re(te);}let q=useRef(null);if(useEffect(()=>{let W=document.querySelector(e);W!=null?(F(W),q.current=W):console.debug(`[frigade] Tooltip: No anchor found for query: ${e}`);},[e]),useEffect(()=>{function W(ce){if(ce.matches(e))return dn(ce)?ce:null;let se=ce.querySelectorAll(e);return se.length>0&&dn(se[0])?se[0]:null}let te=new MutationObserver(ce=>{for(let se of ce)if(se.type==="childList"){for(let xe of se.addedNodes){if(xe.nodeType!==Node.ELEMENT_NODE)continue;let le=W(xe);if(le!=null){F(le),q.current=le,console.debug("[frigade] Tooltip: MutationObserver added anchor: ",le);break}}for(let xe of se.removedNodes){if(xe.nodeType!==Node.ELEMENT_NODE)continue;let le=W(xe);if(le!=null){F(null),q.current=null,console.debug("[frigade] Tooltip: MutationObserver removed anchor: ",le);break}}}});return te.observe(document.querySelector("body"),{childList:!0,subtree:!0}),()=>te.disconnect()},[]),useEffect(()=>{let{scrollX:W,scrollY:te}=window;U(P.left+W),ee(P.top+te);},[P.left,P.top]),S==null)return null;let j="0";typeof window!="undefined"&&(j=window.getComputedStyle(S).borderRadius);let oe=sn({props:d,alignAttr:w,sideAttr:H});return jsxs(de.Root,p(a({defaultOpen:!0},E),{children:[jsx(de.Anchor,{virtualRef:q}),jsx(de.Portal,{children:jsxs(Fragment,{children:[l&&jsx(y,a({animation:`${pn} 300ms ease-out`,boxShadow:"0 0 0 20000px rgb(0 0 0 / 0.5)",part:"tooltip-spotlight",pointerEvents:"none",position:"absolute",style:{borderRadius:j,height:P.height,left:J,top:Q,width:P.width}},d.zIndex!=null?{zIndex:d.zIndex}:{})),jsx(de.Content,p(a({},C),{ref:v,children:jsxs(Fragment,{children:[_()&&jsx(b,p(a({animation:`${pn} 300ms ease-out`,boxShadow:"md",position:"relative",className:t,maxWidth:"min(360px, calc(100vw - 25px))",part:["tooltip",i],style:s},B),{children:o})),jsx(an,{onClick:()=>{k(()=>(typeof E.onOpenChange=="function"&&E.onOpenChange(!_()),!_()));},style:oe})]})}),h)]})})]}))}Se.Close=e=>jsx(de.Close,{"aria-label":"Close",asChild:!0,children:jsx(I.Plain,p(a({css:{top:"0px",right:"-6px"},part:"close",position:"absolute"},e),{children:jsx(Be,{height:"20",fill:"currentColor"})}))});Se.Media=t=>{var r=t,{src:e}=r,o=g(r,["src"]);return e==null?null:jsx(Pe,a({aspectRatio:"2",borderRadius:"md md 0 0",borderWidth:"0",margin:"-5 -5 0",objectFit:"cover",overflowClipMargin:"unset",src:e,transform:"translate3d(0, 0, 1px)"},o))};Se.Primary=r=>{var n=r,{onClick:e,title:o}=n,t=g(n,["onClick","title"]);return o==null?null:jsx(I.Primary,a({title:o,onClick:e},t))};Se.Progress=t=>{var r=t,{children:e}=r,o=g(r,["children"]);return e==null?null:jsx(T.Body2,p(a({part:"progress"},o),{children:e}))};Se.Secondary=r=>{var n=r,{onClick:e,title:o}=n,t=g(n,["onClick","title"]);return o==null?null:jsx(I.Secondary,a({title:o,onClick:e},t))};Se.Subtitle=t=>{var r=t,{children:e}=r,o=g(r,["children"]);return e==null?null:jsx(T.Body2,p(a({part:"subtitle"},o),{children:e}))};Se.Title=t=>{var r=t,{children:e}=r,o=g(r,["children"]);return e==null?null:jsx(T.H4,p(a({part:"title"},o),{children:e}))};function vs(){let e=useContext($);(!e||!e.frigade)&&be("useUser() must be used in a child of the Frigade Provider","
|
|
87
|
+
`;function dn(e){return e instanceof HTMLElement?!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length):!1}function Se(u){var m=u,{anchor:e,children:o,className:t,defaultOpen:r=!0,open:n,part:i,spotlight:l=!1,style:s={}}=m,d=g(m,["anchor","children","className","defaultOpen","open","part","spotlight","style"]);let{node:f,rect:x,ref:v}=fo(),{node:S,rect:P,ref:F}=fo(),{contentProps:C,otherProps:B,rootProps:E}=ln(d,x),[h,k]=useState(r),[w,D]=useState(C.align),[H,re]=useState(C.side),[J,U]=useState(0),[Q,ee]=useState(0);function _(){return n!=null?(console.log("OVERRIDE: ",n),n):(console.log("INTERNAL: ",h),h)}if(f!==null){let W=f.getAttribute("data-align"),te=f.getAttribute("data-side");w!==W&&D(W),H!==te&&re(te);}let q=useRef(null);if(useEffect(()=>{let W=document.querySelector(e);W!=null?(F(W),q.current=W):console.debug(`[frigade] Tooltip: No anchor found for query: ${e}`);},[e]),useEffect(()=>{function W(ce){if(ce.matches(e))return dn(ce)?ce:null;let se=ce.querySelectorAll(e);return se.length>0&&dn(se[0])?se[0]:null}let te=new MutationObserver(ce=>{for(let se of ce)if(se.type==="childList"){for(let xe of se.addedNodes){if(xe.nodeType!==Node.ELEMENT_NODE)continue;let le=W(xe);if(le!=null){F(le),q.current=le,console.debug("[frigade] Tooltip: MutationObserver added anchor: ",le);break}}for(let xe of se.removedNodes){if(xe.nodeType!==Node.ELEMENT_NODE)continue;let le=W(xe);if(le!=null){F(null),q.current=null,console.debug("[frigade] Tooltip: MutationObserver removed anchor: ",le);break}}}});return te.observe(document.querySelector("body"),{childList:!0,subtree:!0}),()=>te.disconnect()},[]),useEffect(()=>{let{scrollX:W,scrollY:te}=window;U(P.left+W),ee(P.top+te);},[P.left,P.top]),S==null)return null;let j="0";typeof window!="undefined"&&(j=window.getComputedStyle(S).borderRadius);let oe=sn({props:d,alignAttr:w,sideAttr:H});return jsxs(de.Root,p(a({defaultOpen:!0},E),{children:[jsx(de.Anchor,{virtualRef:q}),jsx(de.Portal,{children:jsxs(Fragment,{children:[l&&jsx(y,a({animation:`${pn} 300ms ease-out`,boxShadow:"0 0 0 20000px rgb(0 0 0 / 0.5)",part:"tooltip-spotlight",pointerEvents:"none",position:"absolute",style:{borderRadius:j,height:P.height,left:J,top:Q,width:P.width}},d.zIndex!=null?{zIndex:d.zIndex}:{})),jsx(de.Content,p(a({},C),{ref:v,children:jsxs(Fragment,{children:[_()&&jsx(b,p(a({animation:`${pn} 300ms ease-out`,boxShadow:"md",position:"relative",className:t,maxWidth:"min(360px, calc(100vw - 25px))",part:["tooltip",i],style:s},B),{children:o})),jsx(an,{onClick:()=>{k(()=>(typeof E.onOpenChange=="function"&&E.onOpenChange(!_()),!_()));},style:oe})]})}),h)]})})]}))}Se.Close=e=>jsx(de.Close,{"aria-label":"Close",asChild:!0,children:jsx(I.Plain,p(a({css:{top:"0px",right:"-6px"},part:"close",position:"absolute"},e),{children:jsx(Be,{height:"20",fill:"currentColor"})}))});Se.Media=t=>{var r=t,{src:e}=r,o=g(r,["src"]);return e==null?null:jsx(Pe,a({aspectRatio:"2",borderRadius:"md md 0 0",borderWidth:"0",margin:"-5 -5 0",objectFit:"cover",overflowClipMargin:"unset",src:e,transform:"translate3d(0, 0, 1px)"},o))};Se.Primary=r=>{var n=r,{onClick:e,title:o}=n,t=g(n,["onClick","title"]);return o==null?null:jsx(I.Primary,a({title:o,onClick:e},t))};Se.Progress=t=>{var r=t,{children:e}=r,o=g(r,["children"]);return e==null?null:jsx(T.Body2,p(a({part:"progress"},o),{children:e}))};Se.Secondary=r=>{var n=r,{onClick:e,title:o}=n,t=g(n,["onClick","title"]);return o==null?null:jsx(I.Secondary,a({title:o,onClick:e},t))};Se.Subtitle=t=>{var r=t,{children:e}=r,o=g(r,["children"]);return e==null?null:jsx(T.Body2,p(a({part:"subtitle"},o),{children:e}))};Se.Title=t=>{var r=t,{children:e}=r,o=g(r,["children"]);return e==null?null:jsx(T.H4,p(a({part:"title"},o),{children:e}))};function vs(){let e=useContext($);(!e||!e.frigade)&&be("useUser() must be used in a child of the Frigade Provider","warn");let{frigade:o}=e!=null?e:{},t=o==null?void 0:o.config.userId;function r(i){return A(this,null,function*(){yield o.identify(t,i);})}function n(i,l){return A(this,null,function*(){yield o.track(i,l);})}return {userId:t,addProperties:r,track:n,isLoading:!(o!=null&&o.isReady())}}function Rs(){var l;let e=useContext($);(!e||!e.frigade)&&be("useGroup() must be used in a child of the Frigade Provider","warn");let{frigade:o}=e!=null?e:{},t=(l=o==null?void 0:o.getConfig())==null?void 0:l.groupId;function r(s){return A(this,null,function*(){if(!o.config.groupId){console.error("No Group ID is set. Cannot set properties without a Group ID.");return}yield o.group(o.config.groupId,s);})}function n(s,d){return A(this,null,function*(){yield o.track(s,d);})}function i(s,d){return A(this,null,function*(){yield o.group(s,d);})}return {groupId:t,setGroupId:i,addProperties:r,track:n,isLoading:!(o!=null&&o.isReady())}}
|
|
88
88
|
|
|
89
89
|
export { Yo as Announcement, Io as Banner, ae as BaseField, y as Box, I as Button, b as Card, io as Checklist, Zo as Collection, V as Dialog, R as Flex, z as Flow, Me as Form, Jo as Hint, Co as Image, Lo as Label, Pe as Media, ve as Progress, xs as ProgressBadge, Jr as Provider, _o as RadioField, zo as SelectField, Ko as Spotlight, uo as Survey, T as Text, Uo as TextField, Go as TextareaField, Se as Tooltip, yo as Tour, So as Video, ko as themeVariables, Ye as tokens, fo as useBoundingClientRect, Te as useFlow, ot as useFlowHandlers, Qo as useFrigade, Rs as useGroup, ge as useStepHandlers, vs as useUser };
|
|
90
90
|
//# sourceMappingURL=out.js.map
|