@frigade/react 2.0.1 → 2.0.2
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 +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +12 -10
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
var T = require('@radix-ui/react-dialog');
|
|
4
4
|
var solid = require('@heroicons/react/24/solid');
|
|
5
|
-
var
|
|
5
|
+
var ue = require('react');
|
|
6
6
|
var clsx = require('clsx');
|
|
7
7
|
var kt = require('known-css-properties');
|
|
8
|
-
var
|
|
8
|
+
var Vt = require('dompurify');
|
|
9
9
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
10
10
|
var react = require('@emotion/react');
|
|
11
11
|
var js = require('@frigade/js');
|
|
@@ -36,14 +36,14 @@ function _interopNamespace(e) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
var T__namespace = /*#__PURE__*/_interopNamespace(T);
|
|
39
|
-
var
|
|
39
|
+
var ue__namespace = /*#__PURE__*/_interopNamespace(ue);
|
|
40
40
|
var kt__default = /*#__PURE__*/_interopDefault(kt);
|
|
41
|
-
var
|
|
41
|
+
var Vt__default = /*#__PURE__*/_interopDefault(Vt);
|
|
42
42
|
var N__namespace = /*#__PURE__*/_interopNamespace(N);
|
|
43
43
|
var S__namespace = /*#__PURE__*/_interopNamespace(S);
|
|
44
44
|
var k__namespace = /*#__PURE__*/_interopNamespace(k);
|
|
45
45
|
|
|
46
|
-
var Tt=Object.defineProperty;var wt=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,o)=>(typeof require<"u"?require:t)[o]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var Z=(e,t)=>{for(var o in t)Tt(e,o,{get:t[o],enumerable:!0});};var Se={borders:{md:"1px solid"},borderWidths:{0:"0",md:"1px"}};var Ce={black:"#000000",gray100:"#14161A",gray200:"#181B20",gray300:"#1F2329",gray400:"#2E343D",gray500:"#4C5766",gray600:"#5A6472",gray700:"#C5CBD3",gray800:"#E2E5E9",gray900:"#F1F2F4",white:"#ffffff",blue400:"#015AC6",blue500:"#0171F8",blue800:"#DBECFF",blue900:"#F5F9FF",green400:"#009E37",green500:"#00D149",green800:"#DBFFE8",transparent:"#FFFFFF00",inherit:"inherit",red500:"#c00000"};var Fe={md:"10px",lg:"20px",round:"50%"};var l=e=>`var(--fr-colors-${e})`,Te={neutral:{background:l("white"),border:l("gray800"),foreground:l("black"),surface:l("gray700"),active:{background:l("white"),border:l("gray900"),foreground:l("black"),surface:l("gray700")},focus:{background:l("white"),border:l("gray900"),foreground:l("black"),surface:l("gray700")},hover:{background:l("white"),border:l("gray900"),foreground:l("black"),surface:l("gray700")}},primary:{background:l("blue500"),border:l("blue500"),foreground:l("white"),surface:l("blue500"),active:{background:l("blue400"),border:l("blue400"),foreground:l("white"),surface:l("blue400")},focus:{background:l("blue500"),border:l("blue500"),foreground:l("white"),surface:l("blue500")},hover:{background:l("blue400"),border:l("blue400"),foreground:l("white"),surface:l("blue400")}},secondary:{background:l("white"),border:l("gray800"),foreground:l("black"),surface:l("gray900"),active:{background:l("gray900"),border:l("gray800"),foreground:l("black"),surface:l("gray800")},focus:{background:l("gray900"),border:l("gray800"),foreground:l("black"),surface:l("gray900")},hover:{background:l("gray900"),border:l("gray800"),foreground:l("black"),surface:l("gray800")}}};var we={md:"0px 4px 20px rgba(0, 0, 0, 0.1)"};var Rt="px",Bt=e=>typeof e=="number"?`${4*e}${Rt}`:e,vt=[-20,-19,-18,-17,-16,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,-.5,0,.5,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,"auto"],Re=Object.fromEntries(vt.map(e=>[e,Bt(e)]));var Be={fontFamilies:{default:"inherit"},fontSizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px",xl:"20px","2xl":"24px","3xl":"30px","4xl":"36px","5xl":"48px"},fontWeights:{thin:"100",extralight:"200",light:"300",regular:"400",medium:"500",demibold:"600",bold:"700",extrabold:"800",black:"900"},letterSpacings:{md:"0.02em"},lineHeights:{xs:"18px",sm:"22px",md:"24px",lg:"26px",xl:"30px","2xl":"38px","3xl":"46px","4xl":"60px"}};var ae={...Se,colors:{...Ce,...Te},...Be,radii:Fe,shadows:we,space:Re};function U(e,t="",o="."){return Object.keys(e).reduce((n,r)=>{let a=`${t.length?`${t}${o}`:""}${r}`,s=e[r];return typeof s=="object"&&s!==null&&!Array.isArray(s)?Object.assign(n,U(s,a,o)):n[a]=s,n},{})}function se(e){return U(e,"--fr","-")}function ve(e,t="--fr"){let o={};return Object.keys(e).forEach(n=>{let r=e[n];typeof r=="object"&&r!==null&&!Array.isArray(r)?o[n]=ve(r,`${t}-${n}`):o[n]=`var(${t}-${n})`;}),o}var le=se(ae),f=ve(ae);var Et=new Set(["alt","size","src"]),Dt=kt__default.default.all.filter(e=>e.indexOf("-")!=0&&!Et.has(e)).map(e=>[e.replace(/-([a-z])/g,(t,o)=>o.toUpperCase()),null]),Ot=Object.fromEntries(Dt),pe=U(f.colors),Mt={color:pe,backgroundColor:pe,borderColor:pe,border:f.borders,borderRadius:f.radii,borderWidth:f.borderWidths,boxShadow:f.shadows,fontFamily:f.fontFamilies,fontSize:f.fontSizes,fontWeight:f.fontWeights,gap:f.space,lineHeight:f.lineHeights,margin:f.space,marginBottom:f.space,marginLeft:f.space,marginRight:f.space,marginTop:f.space,padding:f.space,paddingBottom:f.space,paddingLeft:f.space,paddingRight:f.space,paddingTop:f.space},ke={...Ot,...Mt},Ee={bg:["backgroundColor"],m:["margin"],mt:["marginTop"],mr:["marginRight"],mb:["marginBottom"],ml:["marginLeft"],mx:["marginLeft","marginRight"],my:["marginTop","marginBottom"],p:["padding"],pt:["paddingTop"],pr:["paddingRight"],pb:["paddingBottom"],pl:["paddingLeft"],px:["paddingLeft","paddingRight"],py:["paddingTop","paddingBottom"]},De=new Set(["active","focus","focusVisible","focusWithin","hover"]);function Ht(e){return Array.isArray(e)?new Map(e.map(t=>[t,t])):typeof e=="object"&&e!==null?new Map(Object.entries(e)):typeof e=="string"||typeof e=="number"?new Map([[e,e]]):new Map}var Oe=new Map(Object.entries(ke).map(([e,t])=>[e,Ht(t)])),It=new Map(Object.entries(Ee).map(([e,t])=>[e,new Set(t)])),At=new Set(["height","width"]),Vt=new Set(["canvas","embed","iframe","img","input","object","video"]);function Me(e){let[t,o]=e.split(":");return [t,De.has(o)?o:null]}function He(e,t="div"){let o=Object.assign({},e),n={};function r(i){if(i==null)return n;let s=`&:${i.replace(/[A-Z]/g,c=>`-${c.toLocaleLowerCase()}`)}`;return n[s]==null&&(n[s]={}),n[s]}return Object.entries(o).forEach(([i,a])=>{let[s,c]=Me(i),x=It.get(s);x!=null&&(x.forEach(u=>{let d=`${u}${c?":"+c:""}`;o[d]=a;}),delete o[i]);}),Object.entries(o).forEach(([i,a])=>{let[s,c]=Me(i),x=Oe.get(s);if(x!=null){if(typeof a=="string"&&a.indexOf(" ")>-1){let u=a.split(" ");r(c)[s]=u.map(d=>x.get(d.toString())??d).join(" ");}else x.has(a.toString())?r(c)[s]=x.get(a.toString()):r(c)[s]=a;(typeof t!="string"||!Vt.has(t)||!At.has(s))&&delete o[i];}}),Object.keys(o).forEach(i=>{let a=i.substring(1);i.indexOf("_")===0&&Oe.has(a)&&(o[a]=o[i],delete o[i]);}),{cssFromProps:n,unmatchedProps:o}}function Wt(){if(typeof window>"u"){let{JSDOM:e}=wt("jsdom");return new e("<!DOCTYPE html>").window}return window}function Ie(e){return e?{__html:Lt__default.default(Wt()).sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img","code","li","ul","table","tbody","thead","tr","td","th","h1","h2","h3","h4","video"],ALLOWED_ATTR:["style","class","target","id","href","alt","src","controls","autoplay","loop","muted"]})}:{__html:""}}function _t(e){return e&&`fr-${e}`}function Le(e){return e&&(Array.isArray(e)?e.map(t=>Le(t)).join(" "):_t(e))}function zt({as:e,children:t,className:o,css:n={},part:r,...i},a){let s=e??"div",{cssFromProps:c,unmatchedProps:x}=He(i,s),u=Le(r),d=o||u?clsx.clsx(o,u):void 0,h=[{boxSizing:"border-box"},c,n];return typeof t=="string"?jsxRuntime.jsx(s,{className:d,css:h,...x,ref:a,dangerouslySetInnerHTML:Ie(t)}):jsxRuntime.jsx(s,{className:d,css:h,...x,ref:a,children:t})}var p=me__namespace.forwardRef(zt);var m={};Z(m,{Body1:()=>io,Body2:()=>ao,Caption:()=>so,Display1:()=>Zt,Display2:()=>eo,H1:()=>to,H2:()=>oo,H3:()=>ro,H4:()=>no});var de={};Z(de,{Body1:()=>Xt,Body2:()=>qt,Caption:()=>Yt,Display1:()=>jt,Display2:()=>Kt,H1:()=>Nt,H2:()=>Ut,H3:()=>Gt,H4:()=>Jt});var E={color:"neutral.foreground",fontFamily:"default",margin:"0"},jt={...E,fontSize:"5xl",fontWeight:"bold",lineHeight:"4xl"},Kt={...E,fontSize:"4xl",fontWeight:"bold",lineHeight:"3xl"},Nt={...E,fontSize:"3xl",fontWeight:"demibold",lineHeight:"2xl"},Ut={...E,fontSize:"2xl",fontWeight:"demibold",lineHeight:"xl"},Gt={...E,fontSize:"xl",fontWeight:"demibold",lineHeight:"lg"},Jt={...E,fontSize:"md",fontWeight:"demibold",lineHeight:"md"},Xt={...E,fontSize:"md",fontWeight:"regular",lineHeight:"md"},qt={...E,fontSize:"sm",fontWeight:"regular",lineHeight:"sm"},Yt={...E,fontSize:"xs",fontWeight:"regular",lineHeight:"xs"};var Qt=["Display1","Display2","H1","H2","H3","H4","Body1","Body2","Caption"],D=Object.fromEntries(Qt.map(e=>{let t=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():"span",o=me__namespace.forwardRef(({as:n=t,children:r,...i},a)=>jsxRuntime.jsx(p,{as:n,...de[e],...i,ref:a,children:r}));return o.displayName=`Text.${e}`,[e,o]})),Zt=D.Display1,eo=D.Display2,to=D.H1,oo=D.H2,ro=D.H3,no=D.H4,io=D.Body1,ao=D.Body2,so=D.Caption;var ce={};Z(ce,{Link:()=>mo,Plain:()=>uo,Primary:()=>po,Secondary:()=>co});var ee={borderWidth:"0",borderRadius:"md",display:"flex",gap:"2",padding:"2 4"},po={...ee,backgroundColor:"primary.surface",color:"primary.foreground","backgroundColor:hover":"primary.hover.surface"},co={...ee,backgroundColor:"secondary.background",borderColor:"secondary.border",borderStyle:"solid",borderWidth:"1px",color:"secondary.foreground","backgroundColor:hover":"secondary.hover.background"},mo={...ee,backgroundColor:"transparent",color:"primary.surface","color:hover":"primary.hover.surface"},uo={...ee,backgroundColor:"transparent",color:"neutral.foreground"};function $e({as:e,children:t,part:o,title:n,variant:r="Primary",...i}){let a=r.toLocaleLowerCase();return jsxRuntime.jsxs(p,{as:e??"button",part:[`button-${a}`,o],...ce[r],...i,children:[t,n&&jsxRuntime.jsx(m.Body2,{color:"inherit",flexGrow:"1",fontWeight:"demibold",css:{WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},children:n})]})}var fo=["Primary","Secondary","Link","Plain"],go=Object.fromEntries(fo.map(e=>{let t=o=>jsxRuntime.jsx($e,{...o,variant:e,children:o.children});return t.displayName=`Button.${e}`,[e,t]})),b=Object.assign($e,go);var y={};Z(y,{Column:()=>ho,Row:()=>yo});var yo=me__namespace.forwardRef((e,t)=>jsxRuntime.jsx(p,{display:"flex",flexDirection:"row",...e,ref:t})),ho=me__namespace.forwardRef((e,t)=>jsxRuntime.jsx(p,{display:"flex",flexDirection:"column",...e,ref:t}));var B=me.createContext({apiKey:"",modals:new Set,setModals:()=>{},currentModal:null,navigate:()=>{}});function Ro({children:e,navigate:t,theme:o,...n}){let r=o?se(o):{},[i,a]=me.useState(new Set),s=me.useMemo(()=>new js.Frigade(n.apiKey,{apiKey:n.apiKey,apiUrl:n.apiUrl,userId:n.userId,groupId:n.groupId,__readOnly:n.__readOnly,__flowConfigOverrides:n.__flowConfigOverrides}),[n.userId,n.groupId,n.apiKey]),c=t??((u,d="_self")=>{window.open(u,d);});me.useEffect(()=>()=>{s.destroy();},[]);let x=i.size>0?i.values().next().value:null;return jsxRuntime.jsxs(B.Provider,{value:{modals:i,setModals:a,currentModal:x,navigate:c,...n,frigade:s},children:[jsxRuntime.jsx(react.Global,{styles:{":root":{...le,...r}}}),jsxRuntime.jsx(react.ThemeProvider,{theme:f,children:e})]})}function G(e,t){let[o,n]=me.useState(),[,r]=me.useState(""),{frigade:i}=me.useContext(B),a=s=>{s.id===e&&(t!=null&&t.variables&&s.applyVariables(t.variables),n(s),r(Math.random().toString()));};return me.useEffect(()=>((async()=>{let s=await i.getFlow(e);if(!s||i.hasFailedToLoad()){n(void 0);return}t!=null&&t.variables&&s.applyVariables(t.variables),n(s);})(),i.onStateChange(a),()=>{i.removeStateChangeHandler(a);}),[]),{flow:o}}function L(e,{onComplete:t,onDismiss:o}={}){let n=me.useRef(null);return me.useEffect(()=>{e!=null&&(e.isCompleted&&n.current===!1&&(async()=>await(t==null?void 0:t(e)))(),n.current=e==null?void 0:e.isCompleted);},[e==null?void 0:e.isCompleted]),{handleDismiss:me.useCallback(async r=>{if(await(o==null?void 0:o(e,r))===!1)return r.preventDefault(),!1;await e.skip();},[e])}}function J(e,{onPrimary:t,onSecondary:o}={}){let{navigate:n}=me.useContext(B);return {handlePrimary:me.useCallback(async(r,i)=>await(t==null?void 0:t(e,r))===!1?(r.preventDefault(),!1):(await e.complete(i),e.primaryButtonUri!=null&&n(e.primaryButtonUri,e.primaryButtonUriTarget),!0),[e]),handleSecondary:me.useCallback(async(r,i)=>await(o==null?void 0:o(e,r))===!1?(r.preventDefault(),!1):(await e.complete(i),e.secondaryButtonUri!=null&&n(e.secondaryButtonUri,e.secondaryButtonUriTarget),!0),[e])}}function X(e){let{currentModal:t,modals:o,setModals:n}=me.useContext(B),[r,i]=me.useState(!1);me.useEffect(()=>{e!=null&&e.isVisible&&e&&!o.has(e.id)&&n(s=>new Set(s).add(e.id));},[e==null?void 0:e.id,e==null?void 0:e.isVisible]),me.useEffect(()=>{let s=t===(e==null?void 0:e.id);(e==null?void 0:e.id)!=null&&s!==r&&i(s);},[e==null?void 0:e.id,t]);function a(){o.has(e==null?void 0:e.id)&&n(s=>{let c=new Set(s);return c.delete(e==null?void 0:e.id),c});}return {isCurrentModal:r,removeModal:a}}function H({as:e,children:t,container:o,dismissible:n=!1,flowId:r,onComplete:i,onDismiss:a,onPrimary:s,onSecondary:c,variables:x,...u}){let{flow:d}=G(r,{variables:x}),h=d==null?void 0:d.getCurrentStep(),{handleDismiss:V}=L(d,{onComplete:i,onDismiss:a}),{handlePrimary:Y,handleSecondary:ne}=J(h,{onPrimary:s,onSecondary:c}),{isCurrentModal:K,removeModal:ie}=X(d);return me.useEffect(()=>{!(d!=null&&d.isVisible)&&K&&ie();},[d==null?void 0:d.isVisible,K]),d==null||!d.isVisible||!K?null:(d.start(),h.start(),jsxRuntime.jsx(e??p,{position:"relative",...u,children:t({flow:d,handleDismiss:V,handlePrimary:Y,handleSecondary:ne,parentProps:{container:o,dismissible:n,flowId:r,variables:x,...u},step:h})}))}function Ge(e){return jsxRuntime.jsx(H,{as:g,gap:5,borderColor:"neutral.border",borderStyle:"solid",borderWidth:"md",...e,children:({handleDismiss:t,handlePrimary:o,handleSecondary:n,parentProps:{dismissible:r},step:i})=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(y.Row,{alignItems:"center",flexWrap:"wrap",gap:1,justifyContent:"space-between",part:"card-header",children:[jsxRuntime.jsx(g.Title,{children:i.title}),r&&jsxRuntime.jsx(g.Dismiss,{onClick:t}),jsxRuntime.jsx(g.Subtitle,{flexBasis:"100%",children:i.subtitle})]}),jsxRuntime.jsx(g.Media,{src:i.imageUri,css:{objectFit:"contain",width:"100%"}}),jsxRuntime.jsxs(y.Row,{gap:3,justifyContent:"flex-end",part:"card-footer",children:[jsxRuntime.jsx(g.Secondary,{title:i.secondaryButtonTitle,onClick:n}),jsxRuntime.jsx(g.Primary,{title:i.primaryButtonTitle??"Continue",onClick:o})]})]})})}function Je({part:e,src:t,...o}){return jsxRuntime.jsx(p,{as:"img",part:["image",e],src:t,...o})}function $o(e){var t,o,n,r;if(e.includes("youtube"))return `https://www.youtube.com/embed/${(t=e.split("v=")[1])==null?void 0:t.split("&")[0]}`;if(e.includes("vimeo"))return `https://player.vimeo.com/video/${(o=e.split("vimeo.com/")[1])==null?void 0:o.split("&")[0]}`;if(e.includes("wistia"))return `https://fast.wistia.net/embed/iframe/${(n=e.split("wistia.com/medias/")[1])==null?void 0:n.split("&")[0]}`;if(e.includes("loom"))return `https://loom.com/embed/${(r=e.split("loom.com/share/")[1])==null?void 0:r.split("&")[0]}?hideEmbedTopBar=true&hide_title=true&hide_share=true&hide_owner=true`;throw new Error("Could not map videoUri to a known provider (Youtube, Vimeo, Wistia, Loom).")}function Xe({part:e,src:t,...o}){let n=$o(t);return jsxRuntime.jsx(p,{allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,as:"iframe",backgroundColor:"gray100",borderWidth:0,part:["video",e],src:n,...o})}function $({src:e,type:t,...o}){return jsxRuntime.jsx(t==="video"?Xe:Je,{src:e,...o})}var g=me__namespace.forwardRef((e,t)=>{if(e.flowId!=null)return jsxRuntime.jsx(Ge,{...e});let o=e.as??y.Column;return jsxRuntime.jsx(o,{backgroundColor:"neutral.background",borderRadius:"md",gap:5,p:5,...e,ref:t})});g.Dismiss=e=>jsxRuntime.jsx(b.Plain,{part:"dismiss",padding:0,...e,children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})});g.Media=({src:e,...t})=>e==null?null:jsxRuntime.jsx($,{borderRadius:"md",src:e,...t});g.Primary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(b.Primary,{title:t,onClick:e,...o});g.Secondary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(b.Secondary,{title:t,onClick:e,...o});g.Subtitle=({children:e,...t})=>e==null?null:jsxRuntime.jsx(m.Body2,{display:"block",part:"subtitle",...t,children:e});g.Title=({children:e,...t})=>e==null?null:jsxRuntime.jsx(m.Body1,{display:"block",fontWeight:"bold",part:"title",...t,children:e});function F({children:e,...t}){return jsxRuntime.jsx(T__namespace.Root,{defaultOpen:!0,modal:!0,children:jsxRuntime.jsx(T__namespace.Portal,{children:jsxRuntime.jsxs(p,{inset:"0",position:"fixed",zIndex:"9999",children:[jsxRuntime.jsx(T__namespace.Overlay,{asChild:!0,children:jsxRuntime.jsx(p,{background:"rgb(0 0 0 / 0.5)",part:"dialog-overlay",position:"fixed",inset:"0"})}),jsxRuntime.jsx(T__namespace.Content,{asChild:!0,onOpenAutoFocus:o=>o.preventDefault(),onPointerDownOutside:o=>o.preventDefault(),children:jsxRuntime.jsx(g,{boxShadow:"md",left:"50%",maxWidth:"430px",p:8,part:"dialog-content",position:"fixed",textAlign:"center",top:"50%",transform:"translate(-50%, -50%)",...t,children:e})})]})})})}F.Dismiss=e=>jsxRuntime.jsx(T__namespace.Close,{"aria-label":"Close",asChild:!0,children:jsxRuntime.jsx(b.Plain,{part:"close",position:"absolute",right:"-4px",top:"4px",...e,children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})})});F.Subtitle=({children:e,...t})=>jsxRuntime.jsx(T__namespace.Description,{asChild:!0,children:jsxRuntime.jsx(m.Body2,{part:"subtitle",...t,children:e})});F.Media=({src:e,...t})=>e==null?null:jsxRuntime.jsx($,{borderRadius:"md",src:e,...t});F.Primary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(b.Primary,{title:t,onClick:e,...o});F.ProgressDots=({current:e,total:t})=>{if(t==1)return null;let o=[...Array(t)].map((n,r)=>jsxRuntime.jsx("circle",{r:4,cx:4+16*r,cy:"4px",fill:e===r?f.colors.blue500:f.colors.blue800},r));return jsxRuntime.jsx(p,{as:"svg",height:"8px",marginInline:"auto",part:"progress",viewBox:`0 0 ${16*t-8} 8`,width:16*t-8,children:o})};F.Secondary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(b.Secondary,{title:t,onClick:e,...o});F.Title=({children:e,...t})=>jsxRuntime.jsx(T__namespace.Title,{asChild:!0,children:jsxRuntime.jsx(m.H3,{part:"title",...t,children:e})});function Uo(e){return jsxRuntime.jsx(H,{as:F,dismissible:!0,...e,children:({flow:t,handleDismiss:o,handlePrimary:n,handleSecondary:r,parentProps:{dismissible:i},step:a})=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[i&&jsxRuntime.jsx(F.Dismiss,{onClick:o}),jsxRuntime.jsxs(y.Column,{gap:1,part:"announcement-header",children:[jsxRuntime.jsx(F.Title,{children:a.title}),jsxRuntime.jsx(F.Subtitle,{children:a.subtitle})]}),jsxRuntime.jsx(F.Media,{src:a.videoUri??a.imageUri,type:a.videoUri?"video":"image",css:{aspectRatio:"1.5",objectFit:"cover",width:"100%"}}),jsxRuntime.jsx(F.ProgressDots,{current:t.getNumberOfCompletedSteps(),total:t.getNumberOfAvailableSteps()}),jsxRuntime.jsxs(y.Row,{css:{"& > button":{flexBasis:"50%",flexGrow:1}},gap:3,part:"announcement-footer",children:[a.secondaryButtonTitle&&jsxRuntime.jsx(F.Secondary,{onClick:r,title:a.secondaryButtonTitle}),a.primaryButtonTitle&&jsxRuntime.jsx(F.Primary,{onClick:n,title:a.primaryButtonTitle??"Continue"})]})]})})}function Jo(e){return jsxRuntime.jsx(H,{as:g,border:"md",borderColor:"neutral.border",display:"flex",flexDirection:"row",gap:3,justifyContent:"space-between",...e,children:({handleDismiss:t,handlePrimary:o,handleSecondary:n,step:r})=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(y.Row,{gap:3,children:[r.imageUri&&jsxRuntime.jsx("img",{src:r.imageUri,style:{height:40,width:40,alignSelf:"center"}}),jsxRuntime.jsxs(y.Column,{children:[jsxRuntime.jsx(m.H4,{mb:1,children:r.title}),jsxRuntime.jsx(m.Body2,{color:"gray500",children:r.subtitle})]})]}),jsxRuntime.jsxs(y.Row,{alignItems:"center",gap:3,justifyContent:"center",children:[r.secondaryButtonTitle&&jsxRuntime.jsx(b.Secondary,{title:r.secondaryButtonTitle,onClick:n}),jsxRuntime.jsx(b.Primary,{title:r.primaryButtonTitle,onClick:o}),e.dismissible&&jsxRuntime.jsx(g.Dismiss,{onClick:t})]})]})})}var Qo=new Set(["required","min","max","minLength","maxLength","pattern"]);function Zo({fieldComponent:e,control:t,fieldData:o}){o.pattern!=null&&(typeof o.pattern=="string"?o.pattern=new RegExp(o.pattern.replace(/^\/|\/$/g,"")):typeof o.pattern=="object"&&typeof o.pattern.value=="string"&&(o.pattern.value=new RegExp(o.pattern.value.replace(/^\/|\/$/g,""))));let n=Object.fromEntries(Object.entries(o).filter(([i])=>Qo.has(i))),r=reactHookForm.useController({name:o.id,control:t,rules:n});return jsxRuntime.jsx(e,{...r,fieldData:o})}function Ye({fieldTypes:e,handleDismiss:t,handlePrimary:o,handleSecondary:n,parentProps:{dismissible:r},step:i}){var d;let{control:a,handleSubmit:s}=reactHookForm.useForm({delayError:2e3,mode:"onChange"}),c=[];function x(h,V){o(V,h);}function u(h,V){n(V,h);}return (d=i.fields)==null||d.forEach(h=>{e[h.type]!=null&&c.push(jsxRuntime.jsx(Zo,{control:a,fieldComponent:e[h.type],fieldData:h},h.id));}),jsxRuntime.jsxs(y.Column,{gap:5,children:[jsxRuntime.jsxs(y.Row,{alignItems:"center",flexWrap:"wrap",gap:1,justifyContent:"space-between",part:"form-header",children:[jsxRuntime.jsx(g.Title,{children:i.title}),r&&jsxRuntime.jsx(g.Dismiss,{onClick:t}),jsxRuntime.jsx(g.Subtitle,{flexBasis:"100%",children:i.subtitle})]}),c,jsxRuntime.jsxs(y.Row,{part:"form-footer",justifyContent:"flex-end",gap:3,children:[i.secondaryButtonTitle&&jsxRuntime.jsx(b.Secondary,{title:i.secondaryButtonTitle,onClick:s(u)}),jsxRuntime.jsx(b.Primary,{title:i.primaryButtonTitle??"Submit",onClick:s(x)})]},"form-footer")]})}function Qe({error:e}){var t;return (t=e==null?void 0:e.message)!=null&&t.length?jsxRuntime.jsx(m.Caption,{color:"red500",display:"block",part:"field-error",textAlign:"end",children:e==null?void 0:e.message}):null}function Ze({children:e,id:t,required:o=!1}){return jsxRuntime.jsxs(m.H4,{as:"label",htmlFor:t,part:"field-label",children:[e,o&&" *"]})}var q={px:"4",py:"2",backgroundColor:"neutral.background",borderColor:"neutral.border",borderStyle:"solid",borderWidth:"md",borderRadius:"md",display:"block",outline:"none",width:"100%"};function A({children:e,field:t,fieldData:o,fieldState:n}){let{id:r,label:i,placeholder:a}=o,{error:s}=n,c={id:r,...t,...a?{placeholder:a}:{},...q,"aria-invalid":!!s,value:t.value??""};return jsxRuntime.jsxs(p,{part:"field",children:[jsxRuntime.jsx(Ze,{id:r,required:!!o.required,children:i}),e(c),jsxRuntime.jsx(Qe,{error:s})]})}var rr=()=>jsxRuntime.jsx(p,{as:"svg",color:"primary.foreground",width:"10px",height:"8px",viewBox:"0 0 10 8",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 4.34664L3.4618 6.99729L3.4459 6.98017L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),nr=me__namespace.forwardRef(({label:e,value:t},o)=>jsxRuntime.jsxs(p,{as:"label",backgroundColor:"neutral.background",borderColor:"neutral.border",borderRadius:"md",borderStyle:"solid",borderWidth:"md",display:"flex",htmlFor:t,justifyContent:"space-between",part:"field-radio",px:4,py:2,children:[jsxRuntime.jsx(m.Body2,{part:"field-radio-label",children:e}),jsxRuntime.jsx(N__namespace.Item,{id:t,value:t,ref:o,asChild:!0,children:jsxRuntime.jsx(p,{as:"button",backgroundColor:"inherit",borderWidth:"md",borderStyle:"solid",borderColor:"neutral.border",borderRadius:"100%",padding:"0",part:"field-radio-value",position:"relative",height:"24px",width:"24px",children:jsxRuntime.jsx(p,{as:N__namespace.Indicator,alignItems:"center",bg:"primary.surface",borderWidth:"md",borderStyle:"solid",borderColor:"primary.border",borderRadius:"100%",display:"flex",height:"calc(100% + 2px)",justifyContent:"center",left:"-1px",part:"field-radio-indicator",position:"absolute",top:"-1px",width:"calc(100% + 2px)",children:jsxRuntime.jsx(rr,{})})})})]}));function rt(e){let{field:{onChange:t,value:o},fieldData:{options:n=[]}}=e,r=n.map(({label:i,value:a})=>jsxRuntime.jsx(nr,{value:a,label:i},a));return jsxRuntime.jsx(A,{...e,children:()=>jsxRuntime.jsx(N__namespace.Root,{value:o,onValueChange:t,asChild:!0,children:jsxRuntime.jsx(y.Column,{gap:2,part:"field-radio-group",children:r})})})}var sr=me__namespace.forwardRef(({label:e,value:t},o)=>jsxRuntime.jsx(S__namespace.Item,{value:t,ref:o,asChild:!0,children:jsxRuntime.jsx(p,{"backgroundColor:hover":"blue900",borderRadius:"md",outline:"none",part:"field-select-option",px:"3",py:"2",children:jsxRuntime.jsx(S__namespace.ItemText,{asChild:!0,children:jsxRuntime.jsx(m.Body2,{part:"field-select-option-label",children:e})})})}));function at(e){let{field:{onChange:t,value:o},fieldData:{options:n=[],placeholder:r}}=e,i=n.map(({label:a,value:s})=>jsxRuntime.jsx(sr,{value:s,label:a},s));return jsxRuntime.jsx(A,{...e,children:()=>jsxRuntime.jsxs(S__namespace.Root,{value:o,onValueChange:t,children:[jsxRuntime.jsx(S__namespace.Trigger,{asChild:!0,children:jsxRuntime.jsxs(m.Body2,{...q,alignItems:"center",display:"flex",justifyContent:"space-between",part:"field-select",children:[jsxRuntime.jsx(S__namespace.Value,{placeholder:r??"Select one"}),jsxRuntime.jsx(S__namespace.Icon,{children:jsxRuntime.jsx(p,{as:outline.ChevronDownIcon,color:"gray100",display:"block",height:"24px",part:"field-select-icon",width:"24px"})})]})}),jsxRuntime.jsx(S__namespace.Portal,{children:jsxRuntime.jsx(S__namespace.Content,{position:"popper",sideOffset:4,asChild:!0,children:jsxRuntime.jsx(p,{...q,p:"1",part:"field-select-options",width:"var(--radix-popper-anchor-width)",children:jsxRuntime.jsx(S__namespace.Viewport,{children:i})})})})]})})}function lt(e){return jsxRuntime.jsx(A,{...e,children:t=>jsxRuntime.jsx(m.Body2,{as:"input",part:"field-text",type:"text",...t})})}function dt(e){return jsxRuntime.jsx(A,{...e,children:t=>jsxRuntime.jsx(m.Body2,{as:"textarea",part:"field-textarea",...t})})}var lr={radio:rt,select:at,text:lt,textarea:dt};function pr({fieldTypes:e={},...t}){let o=Object.assign({},lr,e);return jsxRuntime.jsx(H,{...t,children:n=>jsxRuntime.jsx(Ye,{fieldTypes:o,...n})})}function oe(){let e="DOMRect"in globalThis?new DOMRect:{height:0,width:0,x:0,y:0,bottom:0,top:0,right:0,left:0,toJSON:()=>{}},[t,o]=me.useState(e),[n,r]=me.useState(null),i=me.useCallback(a=>{r(a);},[]);return me.useLayoutEffect(()=>{if(!n)return;let a=()=>{let s=n.getBoundingClientRect();o(s);};return a(),window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[n]),{node:n,rect:t,ref:i}}var ur=react.keyframes({"0%":{opacity:.5,transform:"scale(0.5)"},"50%":{opacity:0,transform:"scale(1)"},"100%":{opacity:0,transform:"scale(1)"}});function ft({style:e={},part:t="",...o}){return jsxRuntime.jsxs(p,{part:`dot-wrapper ${t}`,style:{height:"48px",position:"absolute",width:"48px",...e},...o,children:[jsxRuntime.jsx(p,{backgroundColor:"primary.surface",part:"dot-pulse",css:{animation:`2s ease-out infinite ${ur}`,borderRadius:"24px",height:"48px",left:0,position:"absolute",top:0,transformOrigin:"center center",width:"48px"}}),jsxRuntime.jsx(p,{backgroundColor:"primary.surface",part:"dot",style:{borderRadius:"12px",height:"24px",left:"12px",position:"absolute",top:"12px",width:"24px"}})]})}function gt({props:e,alignAttr:t,sideAttr:o}){let n=o??"bottom",r={},i=()=>{if(["after","before"].includes(e.align)){if(t=="start")return "before";if(t=="end")return "after"}return e.align??"after"},a="-24px",s={top:"bottom",right:"left",bottom:"top",left:"right"};r[s[n]]=a;let c=i();return ["before","end"].includes(c)?["top","bottom"].includes(n)?r.right=a:r.bottom=a:["after","start"].includes(c)?["top","bottom"].includes(n)?r.left=a:r.top=a:["top","bottom"].includes(n)?r.left=`calc(50% + ${a})`:r.top=`calc(50% + ${a})`,r}var xt={content:["align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","forceMount","hideWhenDetached","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenAutoFocus","onPointerDownOutside","side","sideOffset","sticky"],root:["defaultOpen","modal","onOpenChange","open"]};function yt(e,t){let o=Object.fromEntries(xt.content.map(r=>[r,e[r]]).filter(r=>r[1]!==void 0)),n=Object.fromEntries(xt.root.map(r=>[r,e[r]]).filter(r=>r[1]!==void 0));if(o.align=o.align??"after",o.side=o.side??"bottom",["before","after"].includes(o.align)){let r={after:"end",before:"start"},i=(d,h)=>["top","bottom"].includes(h)?d=="after"?"marginLeft":"marginRight":d=="after"?"marginTop":"marginBottom",a=o.alignOffset??0,s=o.style??{},c=o.side??"bottom",x=o.align;o.style={...s,[i(x,c)]:a};let u=["top","bottom"].includes(c)?t.width:t.height;o.alignOffset=(u+a)*-1,o.align=r[x];}return {contentProps:o,rootProps:n}}function C({anchor:e,children:t,className:o,spotlight:n=!1,style:r,...i}){let{node:a,rect:s,ref:c}=oe(),{node:x,rect:u,ref:d}=oe(),{contentProps:h,rootProps:V}=yt(i,s),[Y,ne]=me.useState(h.align),[K,ie]=me.useState(h.side),[he,Pt]=me.useState(0),[St,Ct]=me.useState(0);if(a!==null){let M=a.getAttribute("data-align"),Q=a.getAttribute("data-side");Y!==M&&ne(M),K!==Q&&ie(Q);}let be=me.useRef(null);if(me.useEffect(()=>{let M=document.querySelector(e);M!=null&&(d(M),be.current=M);},[e]),me.useEffect(()=>{let{scrollX:M,scrollY:Q}=window;Pt(u.left+M),Ct(u.top+Q);},[u.left,u.top]),x==null)return null;let Pe="0";typeof window<"u"&&(Pe=window.getComputedStyle(x).borderRadius);let Ft=gt({props:i,alignAttr:Y,sideAttr:K});return jsxRuntime.jsxs(k__namespace.Root,{defaultOpen:!0,...V,children:[jsxRuntime.jsx(k__namespace.Anchor,{virtualRef:be}),jsxRuntime.jsx(k__namespace.Portal,{children:jsxRuntime.jsxs("div",{className:o,css:{bottom:0,left:0,position:"absolute",right:0,top:0,zIndex:9999,pointerEvents:"none"},children:[n&&jsxRuntime.jsx(p,{part:"tooltip-spotlight",position:"absolute",style:{borderRadius:Pe,boxShadow:"0 0 0 20000px rgb(0 0 0 / 0.5)",height:u.height,left:he,top:St,width:u.width}}),jsxRuntime.jsx(k__namespace.Content,{asChild:!0,...h,ref:c,children:jsxRuntime.jsxs(g,{boxShadow:"md",part:"tooltip-content",position:"relative",css:{maxWidth:"360px",pointerEvents:"auto",...r},children:[jsxRuntime.jsx(ft,{style:Ft}),t]})})]})})]})}C.Close=e=>jsxRuntime.jsx(k__namespace.Close,{"aria-label":"Close",asChild:!0,children:jsxRuntime.jsx(b.Plain,{css:{top:"12px",right:"4px"},part:"close",position:"absolute",...e,children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})})});C.Media=({src:e,...t})=>e==null?null:jsxRuntime.jsx($,{borderRadius:"md md 0 0",borderWidth:"0",css:{aspectRatio:"2",objectFit:"cover"},margin:"-5 -5 0",src:e,...t});C.Primary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(b.Primary,{title:t,onClick:e,...o});C.Progress=({children:e,...t})=>e==null?null:jsxRuntime.jsx(m.H4,{part:"progress",...t,children:e});C.Secondary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(b.Secondary,{title:t,onClick:e,...o});C.Subtitle=({children:e,...t})=>e==null?null:jsxRuntime.jsx(m.Body2,{part:"subtitle",...t,children:e});C.Title=({children:e,...t})=>e==null?null:jsxRuntime.jsx(m.H4,{part:"title",...t,children:e});function bt({dismissible:e=!0,flow:t,onDismiss:o,onPrimary:n,onSecondary:r,step:i,...a}){let{handleDismiss:s}=L(t,{onDismiss:o}),{handlePrimary:c,handleSecondary:x}=J(i,{onPrimary:n,onSecondary:r});return jsxRuntime.jsxs(C,{anchor:i.selector,onOpenAutoFocus:u=>u.preventDefault(),onPointerDownOutside:u=>u.preventDefault(),...a,children:[e&&jsxRuntime.jsx(C.Close,{onClick:s}),jsxRuntime.jsx(C.Media,{src:i.videoUri??i.imageUri,type:i.videoUri?"video":"image"}),jsxRuntime.jsxs(y.Column,{gap:1,part:"tooltip-header",children:[jsxRuntime.jsx(C.Title,{children:i.title}),jsxRuntime.jsx(C.Subtitle,{color:"gray500",children:i.subtitle})]}),jsxRuntime.jsxs(y.Row,{alignItems:"center",gap:3,justifyContent:"flex-end",part:"tooltip-footer",children:[jsxRuntime.jsx(C.Progress,{marginRight:"auto",transform:"translateY(1px)",children:`${t.getNumberOfCompletedSteps()+1}/${t.getNumberOfAvailableSteps()}`}),jsxRuntime.jsx(C.Secondary,{title:i.secondaryButtonTitle,onClick:x}),jsxRuntime.jsx(C.Primary,{title:i.primaryButtonTitle,onClick:c})]})]},i.id)}function hr({flowId:e,onComplete:t,variables:o,...n}){let{flow:r}=G(e,{variables:o});L(r,{onComplete:t});let{isCurrentModal:i,removeModal:a}=X(r);if(me.useEffect(()=>{!(r!=null&&r.isVisible)&&i&&a();},[r==null?void 0:r.isVisible,i]),r==null||r.isVisible===!1||!i)return null;r.start();let s=r.getCurrentStep();return s==null||s.start(),jsxRuntime.jsx(bt,{step:s,flow:r,...n})}function Sr(){let{frigade:e}=me.useContext(B);return {frigade:e,isLoading:!(e!=null&&e.isReady())}}function Fr(){let{userId:e,frigade:t}=me.useContext(B);async function o(r){await t.identify(e,r);}async function n(r,i){await t.track(r,i);}return {userId:e,addProperties:o,track:n}}function wr(){let{groupId:e,frigade:t}=me.useContext(B);async function o(r){if(!e){console.error("No Group ID is set. Cannot set properties without a Group ID.");return}await t.group(e,r);}async function n(r,i){await t.track(r,i);}return {groupId:e,addProperties:o,track:n}}
|
|
46
|
+
var Tt=Object.defineProperty;var wt=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,o)=>(typeof require<"u"?require:t)[o]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var Z=(e,t)=>{for(var o in t)Tt(e,o,{get:t[o],enumerable:!0});};var Se={borders:{md:"1px solid"},borderWidths:{0:"0",md:"1px"}};var Ce={black:"#000000",gray100:"#14161A",gray200:"#181B20",gray300:"#1F2329",gray400:"#2E343D",gray500:"#4C5766",gray600:"#5A6472",gray700:"#C5CBD3",gray800:"#E2E5E9",gray900:"#F1F2F4",white:"#ffffff",blue400:"#015AC6",blue500:"#0171F8",blue800:"#DBECFF",blue900:"#F5F9FF",green400:"#009E37",green500:"#00D149",green800:"#DBFFE8",transparent:"#FFFFFF00",inherit:"inherit",red500:"#c00000"};var Fe={md:"10px",lg:"20px",round:"50%"};var l=e=>`var(--fr-colors-${e})`,Te={neutral:{background:l("white"),border:l("gray800"),foreground:l("black"),surface:l("gray700"),active:{background:l("white"),border:l("gray900"),foreground:l("black"),surface:l("gray700")},focus:{background:l("white"),border:l("gray900"),foreground:l("black"),surface:l("gray700")},hover:{background:l("white"),border:l("gray900"),foreground:l("black"),surface:l("gray700")}},primary:{background:l("blue500"),border:l("blue500"),foreground:l("white"),surface:l("blue500"),active:{background:l("blue400"),border:l("blue400"),foreground:l("white"),surface:l("blue400")},focus:{background:l("blue500"),border:l("blue500"),foreground:l("white"),surface:l("blue500")},hover:{background:l("blue400"),border:l("blue400"),foreground:l("white"),surface:l("blue400")}},secondary:{background:l("white"),border:l("gray800"),foreground:l("black"),surface:l("gray900"),active:{background:l("gray900"),border:l("gray800"),foreground:l("black"),surface:l("gray800")},focus:{background:l("gray900"),border:l("gray800"),foreground:l("black"),surface:l("gray900")},hover:{background:l("gray900"),border:l("gray800"),foreground:l("black"),surface:l("gray800")}}};var we={md:"0px 4px 20px rgba(0, 0, 0, 0.1)"};var Rt="px",Bt=e=>typeof e=="number"?`${4*e}${Rt}`:e,vt=[-20,-19,-18,-17,-16,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,-.5,0,.5,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,"auto"],Re=Object.fromEntries(vt.map(e=>[e,Bt(e)]));var Be={fontFamilies:{default:"inherit"},fontSizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px",xl:"20px","2xl":"24px","3xl":"30px","4xl":"36px","5xl":"48px"},fontWeights:{thin:"100",extralight:"200",light:"300",regular:"400",medium:"500",demibold:"600",bold:"700",extrabold:"800",black:"900"},letterSpacings:{md:"0.02em"},lineHeights:{xs:"18px",sm:"22px",md:"24px",lg:"26px",xl:"30px","2xl":"38px","3xl":"46px","4xl":"60px"}};var ae={...Se,colors:{...Ce,...Te},...Be,radii:Fe,shadows:we,space:Re};function U(e,t="",o="."){return Object.keys(e).reduce((i,r)=>{let s=`${t.length?`${t}${o}`:""}${r}`,a=e[r];return typeof a=="object"&&a!==null&&!Array.isArray(a)?Object.assign(i,U(a,s,o)):i[s]=a,i},{})}function se(e){return U(e,"--fr","-")}function ve(e,t="--fr"){let o={};return Object.keys(e).forEach(i=>{let r=e[i];typeof r=="object"&&r!==null&&!Array.isArray(r)?o[i]=ve(r,`${t}-${i}`):o[i]=`var(${t}-${i})`;}),o}var le=se(ae),f=ve(ae);var Et=new Set(["alt","size","src"]),Dt=kt__default.default.all.filter(e=>e.indexOf("-")!=0&&!Et.has(e)).map(e=>[e.replace(/-([a-z])/g,(t,o)=>o.toUpperCase()),null]),Ot=Object.fromEntries(Dt),pe=U(f.colors),Mt={color:pe,backgroundColor:pe,borderColor:pe,border:f.borders,borderRadius:f.radii,borderWidth:f.borderWidths,boxShadow:f.shadows,fontFamily:f.fontFamilies,fontSize:f.fontSizes,fontWeight:f.fontWeights,gap:f.space,lineHeight:f.lineHeights,margin:f.space,marginBottom:f.space,marginLeft:f.space,marginRight:f.space,marginTop:f.space,padding:f.space,paddingBottom:f.space,paddingLeft:f.space,paddingRight:f.space,paddingTop:f.space},ke={...Ot,...Mt},Ee={bg:["backgroundColor"],m:["margin"],mt:["marginTop"],mr:["marginRight"],mb:["marginBottom"],ml:["marginLeft"],mx:["marginLeft","marginRight"],my:["marginTop","marginBottom"],p:["padding"],pt:["paddingTop"],pr:["paddingRight"],pb:["paddingBottom"],pl:["paddingLeft"],px:["paddingLeft","paddingRight"],py:["paddingTop","paddingBottom"]},De=new Set(["active","focus","focusVisible","focusWithin","hover"]);function Ht(e){return Array.isArray(e)?new Map(e.map(t=>[t,t])):typeof e=="object"&&e!==null?new Map(Object.entries(e)):typeof e=="string"||typeof e=="number"?new Map([[e,e]]):new Map}var Oe=new Map(Object.entries(ke).map(([e,t])=>[e,Ht(t)])),It=new Map(Object.entries(Ee).map(([e,t])=>[e,new Set(t)])),Wt=new Set(["height","width"]),At=new Set(["canvas","embed","iframe","img","input","object","video"]);function Me(e){let[t,o]=e.split(":");return [t,De.has(o)?o:null]}function He(e,t="div"){let o=Object.assign({},e),i={};function r(n){if(n==null)return i;let a=`&:${n.replace(/[A-Z]/g,c=>`-${c.toLocaleLowerCase()}`)}`;return i[a]==null&&(i[a]={}),i[a]}return Object.entries(o).forEach(([n,s])=>{let[a,c]=Me(n),x=It.get(a);x!=null&&(x.forEach(m=>{let d=`${m}${c?":"+c:""}`;o[d]=s;}),delete o[n]);}),Object.entries(o).forEach(([n,s])=>{let[a,c]=Me(n),x=Oe.get(a);if(x!=null){if(typeof s=="string"&&s.indexOf(" ")>-1){let m=s.split(" ");r(c)[a]=m.map(d=>x.get(d.toString())??d).join(" ");}else x.has(s.toString())?r(c)[a]=x.get(s.toString()):r(c)[a]=s;(typeof t!="string"||!At.has(t)||!Wt.has(a))&&delete o[n];}}),Object.keys(o).forEach(n=>{let s=n.substring(1);n.indexOf("_")===0&&Oe.has(s)&&(o[s]=o[n],delete o[n]);}),{cssFromProps:i,unmatchedProps:o}}function Lt(){if(typeof window>"u"){let{JSDOM:e}=wt("jsdom");return new e("<!DOCTYPE html>").window}return window}function Ie(e){return e?{__html:Vt__default.default(Lt()).sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img","code","li","ul","table","tbody","thead","tr","td","th","h1","h2","h3","h4","video"],ALLOWED_ATTR:["style","class","target","id","href","alt","src","controls","autoplay","loop","muted"]})}:{__html:""}}function _t(e){return e&&`fr-${e}`}function Ve(e){return e&&(Array.isArray(e)?e.map(t=>Ve(t)).join(" "):_t(e))}function zt({as:e,children:t,className:o,css:i={},part:r,...n},s){let a=e??"div",{cssFromProps:c,unmatchedProps:x}=He(n,a),m=Ve(r),d=o||m?clsx.clsx(o,m):void 0,h=[{boxSizing:"border-box"},c,i];return typeof t=="string"?jsxRuntime.jsx(a,{className:d,css:h,...x,ref:s,dangerouslySetInnerHTML:Ie(t)}):jsxRuntime.jsx(a,{className:d,css:h,...x,ref:s,children:t})}var p=ue__namespace.forwardRef(zt);var u={};Z(u,{Body1:()=>io,Body2:()=>ao,Caption:()=>so,Display1:()=>Zt,Display2:()=>eo,H1:()=>to,H2:()=>oo,H3:()=>ro,H4:()=>no});var de={};Z(de,{Body1:()=>Xt,Body2:()=>qt,Caption:()=>Yt,Display1:()=>jt,Display2:()=>Kt,H1:()=>Nt,H2:()=>Ut,H3:()=>Gt,H4:()=>Jt});var E={color:"neutral.foreground",fontFamily:"default",margin:"0"},jt={...E,fontSize:"5xl",fontWeight:"bold",lineHeight:"4xl"},Kt={...E,fontSize:"4xl",fontWeight:"bold",lineHeight:"3xl"},Nt={...E,fontSize:"3xl",fontWeight:"demibold",lineHeight:"2xl"},Ut={...E,fontSize:"2xl",fontWeight:"demibold",lineHeight:"xl"},Gt={...E,fontSize:"xl",fontWeight:"demibold",lineHeight:"lg"},Jt={...E,fontSize:"md",fontWeight:"demibold",lineHeight:"md"},Xt={...E,fontSize:"md",fontWeight:"regular",lineHeight:"md"},qt={...E,fontSize:"sm",fontWeight:"regular",lineHeight:"sm"},Yt={...E,fontSize:"xs",fontWeight:"regular",lineHeight:"xs"};var Qt=["Display1","Display2","H1","H2","H3","H4","Body1","Body2","Caption"],D=Object.fromEntries(Qt.map(e=>{let t=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():"span",o=ue__namespace.forwardRef(({as:i=t,children:r,...n},s)=>jsxRuntime.jsx(p,{as:i,...de[e],...n,ref:s,children:r}));return o.displayName=`Text.${e}`,[e,o]})),Zt=D.Display1,eo=D.Display2,to=D.H1,oo=D.H2,ro=D.H3,no=D.H4,io=D.Body1,ao=D.Body2,so=D.Caption;var ce={};Z(ce,{Link:()=>uo,Plain:()=>mo,Primary:()=>po,Secondary:()=>co});var ee={borderWidth:"0",borderRadius:"md",display:"flex",gap:"2",padding:"2 4"},po={...ee,backgroundColor:"primary.surface",color:"primary.foreground","backgroundColor:hover":"primary.hover.surface"},co={...ee,backgroundColor:"secondary.background",borderColor:"secondary.border",borderStyle:"solid",borderWidth:"1px",color:"secondary.foreground","backgroundColor:hover":"secondary.hover.background"},uo={...ee,backgroundColor:"transparent",color:"primary.surface","color:hover":"primary.hover.surface"},mo={...ee,backgroundColor:"transparent",color:"neutral.foreground"};function $e({as:e,children:t,part:o,title:i,variant:r="Primary",...n}){let s=r.toLocaleLowerCase();return jsxRuntime.jsxs(p,{as:e??"button",part:[`button-${s}`,o],...ce[r],...n,children:[t,i&&jsxRuntime.jsx(u.Body2,{color:"inherit",flexGrow:"1",fontWeight:"demibold",css:{WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},children:i})]})}var fo=["Primary","Secondary","Link","Plain"],go=Object.fromEntries(fo.map(e=>{let t=o=>jsxRuntime.jsx($e,{...o,variant:e,children:o.children});return t.displayName=`Button.${e}`,[e,t]})),b=Object.assign($e,go);var y={};Z(y,{Column:()=>ho,Row:()=>yo});var yo=ue__namespace.forwardRef((e,t)=>jsxRuntime.jsx(p,{display:"flex",flexDirection:"row",...e,ref:t})),ho=ue__namespace.forwardRef((e,t)=>jsxRuntime.jsx(p,{display:"flex",flexDirection:"column",...e,ref:t}));var B=ue.createContext({apiKey:"",modals:new Set,setModals:()=>{},currentModal:null,navigate:()=>{}});function Ro({children:e,navigate:t,theme:o,...i}){let r=o?se(o):{},[n,s]=ue.useState(new Set),a=ue.useMemo(()=>new js.Frigade(i.apiKey,{apiKey:i.apiKey,apiUrl:i.apiUrl,userId:i.userId,groupId:i.groupId,__readOnly:i.__readOnly,__flowConfigOverrides:i.__flowConfigOverrides}),[i.userId,i.groupId,i.apiKey]),c=t??((m,d="_self")=>{window.open(m,d);});ue.useEffect(()=>()=>{a.destroy();},[]);let x=n.size>0?n.values().next().value:null;return jsxRuntime.jsxs(B.Provider,{value:{modals:n,setModals:s,currentModal:x,navigate:c,...i,frigade:a},children:[jsxRuntime.jsx(react.Global,{styles:{":root":{...le,...r}}}),jsxRuntime.jsx(react.ThemeProvider,{theme:f,children:e})]})}function G(e,t){let[o,i]=ue.useState(),[,r]=ue.useState(""),{frigade:n}=ue.useContext(B),s=a=>{a.id===e&&(t!=null&&t.variables&&a.applyVariables(t.variables),i(a),r(Math.random().toString()));};return ue.useEffect(()=>((async()=>{let a=await n.getFlow(e);if(!a||n.hasFailedToLoad()){i(void 0);return}t!=null&&t.variables&&a.applyVariables(t.variables),i(a);})(),n.onStateChange(s),()=>{n.removeStateChangeHandler(s);}),[]),{flow:o}}function V(e,{onComplete:t,onDismiss:o}={}){let i=ue.useRef(null);return ue.useEffect(()=>{e!=null&&(e.isCompleted&&i.current===!1&&(async()=>await(t==null?void 0:t(e)))(),i.current=e==null?void 0:e.isCompleted);},[e==null?void 0:e.isCompleted]),{handleDismiss:ue.useCallback(async r=>{if(await(o==null?void 0:o(e,r))===!1)return r.preventDefault(),!1;await e.skip();},[e])}}function J(e,{onPrimary:t,onSecondary:o}={}){let{navigate:i}=ue.useContext(B);return {handlePrimary:ue.useCallback(async(r,n)=>await(t==null?void 0:t(e,r))===!1?(r.preventDefault(),!1):(await e.complete(n),e.primaryButtonUri!=null&&i(e.primaryButtonUri,e.primaryButtonUriTarget),!0),[e]),handleSecondary:ue.useCallback(async(r,n)=>await(o==null?void 0:o(e,r))===!1?(r.preventDefault(),!1):(await e.complete(n),e.secondaryButtonUri!=null&&i(e.secondaryButtonUri,e.secondaryButtonUriTarget),!0),[e])}}function X(e){let{currentModal:t,modals:o,setModals:i}=ue.useContext(B),[r,n]=ue.useState(!1);ue.useEffect(()=>{e!=null&&e.isVisible&&e&&!o.has(e.id)&&i(a=>new Set(a).add(e.id));},[e==null?void 0:e.id,e==null?void 0:e.isVisible]),ue.useEffect(()=>{let a=t===(e==null?void 0:e.id);(e==null?void 0:e.id)!=null&&a!==r&&n(a);},[e==null?void 0:e.id,t]);function s(){o.has(e==null?void 0:e.id)&&i(a=>{let c=new Set(a);return c.delete(e==null?void 0:e.id),c});}return {isCurrentModal:r,removeModal:s}}function H({as:e,children:t,container:o,dismissible:i=!1,flowId:r,onComplete:n,onDismiss:s,onPrimary:a,onSecondary:c,variables:x,...m}){let{flow:d}=G(r,{variables:x}),h=d==null?void 0:d.getCurrentStep(),{handleDismiss:A}=V(d,{onComplete:n,onDismiss:s}),{handlePrimary:Y,handleSecondary:ne}=J(h,{onPrimary:a,onSecondary:c}),{isCurrentModal:K,removeModal:ie}=X(d);return ue.useEffect(()=>{!(d!=null&&d.isVisible)&&K&&ie();},[d==null?void 0:d.isVisible,K]),d==null||!d.isVisible||!K?null:(d.start(),h.start(),jsxRuntime.jsx(e??p,{position:"relative",...m,children:t({flow:d,handleDismiss:A,handlePrimary:Y,handleSecondary:ne,parentProps:{container:o,dismissible:i,flowId:r,variables:x,...m},step:h})}))}function Ge(e){return jsxRuntime.jsx(H,{as:g,gap:5,borderColor:"neutral.border",borderStyle:"solid",borderWidth:"md",part:"card",...e,children:({handleDismiss:t,handlePrimary:o,handleSecondary:i,parentProps:{dismissible:r},step:n})=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(y.Row,{alignItems:"center",flexWrap:"wrap",gap:1,justifyContent:"space-between",part:"card-header",children:[jsxRuntime.jsx(g.Title,{children:n.title}),r&&jsxRuntime.jsx(g.Dismiss,{onClick:t}),jsxRuntime.jsx(g.Subtitle,{flexBasis:"100%",children:n.subtitle})]}),jsxRuntime.jsx(g.Media,{src:n.imageUri,css:{objectFit:"contain",width:"100%"}}),jsxRuntime.jsxs(y.Row,{gap:3,justifyContent:"flex-end",part:"card-footer",children:[jsxRuntime.jsx(g.Secondary,{title:n.secondaryButtonTitle,onClick:i}),jsxRuntime.jsx(g.Primary,{title:n.primaryButtonTitle??"Continue",onClick:o})]})]})})}function Je({part:e,src:t,...o}){return jsxRuntime.jsx(p,{as:"img",part:["image",e],src:t,...o})}function $o(e){var t,o,i,r;if(e.includes("youtube"))return `https://www.youtube.com/embed/${(t=e.split("v=")[1])==null?void 0:t.split("&")[0]}`;if(e.includes("vimeo"))return `https://player.vimeo.com/video/${(o=e.split("vimeo.com/")[1])==null?void 0:o.split("&")[0]}`;if(e.includes("wistia"))return `https://fast.wistia.net/embed/iframe/${(i=e.split("wistia.com/medias/")[1])==null?void 0:i.split("&")[0]}`;if(e.includes("loom"))return `https://loom.com/embed/${(r=e.split("loom.com/share/")[1])==null?void 0:r.split("&")[0]}?hideEmbedTopBar=true&hide_title=true&hide_share=true&hide_owner=true`;throw new Error("Could not map videoUri to a known provider (Youtube, Vimeo, Wistia, Loom).")}function Xe({part:e,src:t,...o}){let i=$o(t);return jsxRuntime.jsx(p,{allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,as:"iframe",backgroundColor:"gray100",borderWidth:0,part:["video",e],src:i,...o})}function $({src:e,type:t,...o}){return jsxRuntime.jsx(t==="video"?Xe:Je,{src:e,...o})}var g=ue__namespace.forwardRef(({children:e,flowId:t,...o},i)=>{if(t!=null)return jsxRuntime.jsx(Ge,{flowId:t,...o});let r=o.as??y.Column;return jsxRuntime.jsx(r,{backgroundColor:"neutral.background",borderColor:"neutral.border",borderStyle:"solid",borderRadius:"md",borderWidth:"0",gap:5,p:5,...o,ref:i,children:e})});g.Dismiss=e=>jsxRuntime.jsx(b.Plain,{part:"dismiss",padding:0,...e,children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})});g.Media=({src:e,...t})=>e==null?null:jsxRuntime.jsx($,{borderRadius:"md",src:e,...t});g.Primary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(b.Primary,{title:t,onClick:e,...o});g.Secondary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(b.Secondary,{title:t,onClick:e,...o});g.Subtitle=({children:e,...t})=>e==null?null:jsxRuntime.jsx(u.Body2,{display:"block",part:"subtitle",...t,children:e});g.Title=({children:e,...t})=>e==null?null:jsxRuntime.jsx(u.Body1,{display:"block",fontWeight:"bold",part:"title",...t,children:e});function F({children:e,...t}){return jsxRuntime.jsx(T__namespace.Root,{defaultOpen:!0,modal:!0,children:jsxRuntime.jsx(T__namespace.Portal,{children:jsxRuntime.jsxs(p,{inset:"0",position:"fixed",zIndex:"9999",children:[jsxRuntime.jsx(T__namespace.Overlay,{asChild:!0,children:jsxRuntime.jsx(p,{background:"rgb(0 0 0 / 0.5)",part:"dialog-overlay",position:"fixed",inset:"0"})}),jsxRuntime.jsx(T__namespace.Content,{asChild:!0,onOpenAutoFocus:o=>o.preventDefault(),onPointerDownOutside:o=>o.preventDefault(),children:jsxRuntime.jsx(g,{boxShadow:"md",left:"50%",maxWidth:"430px",p:8,part:"dialog",position:"fixed",textAlign:"center",top:"50%",transform:"translate(-50%, -50%)",...t,children:e})})]})})})}F.Dismiss=e=>jsxRuntime.jsx(T__namespace.Close,{"aria-label":"Close",asChild:!0,children:jsxRuntime.jsx(b.Plain,{part:"close",position:"absolute",right:"-4px",top:"4px",...e,children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})})});F.Subtitle=({children:e,...t})=>jsxRuntime.jsx(T__namespace.Description,{asChild:!0,children:jsxRuntime.jsx(u.Body2,{part:"subtitle",...t,children:e})});F.Media=({src:e,...t})=>e==null?null:jsxRuntime.jsx($,{borderRadius:"md",src:e,...t});F.Primary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(b.Primary,{title:t,onClick:e,...o});F.ProgressDots=({current:e,total:t})=>{if(t==1)return null;let o=[...Array(t)].map((i,r)=>jsxRuntime.jsx("circle",{r:4,cx:4+16*r,cy:"4px",fill:e===r?f.colors.blue500:f.colors.blue800},r));return jsxRuntime.jsx(p,{as:"svg",height:"8px",marginInline:"auto",part:"progress",viewBox:`0 0 ${16*t-8} 8`,width:16*t-8,children:o})};F.Secondary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(b.Secondary,{title:t,onClick:e,...o});F.Title=({children:e,...t})=>jsxRuntime.jsx(T__namespace.Title,{asChild:!0,children:jsxRuntime.jsx(u.H3,{part:"title",...t,children:e})});function Uo({flowId:e,...t}){return jsxRuntime.jsx(H,{as:F,dismissible:!0,flowId:e,...t,children:({flow:o,handleDismiss:i,handlePrimary:r,handleSecondary:n,parentProps:{dismissible:s},step:a})=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[s&&jsxRuntime.jsx(F.Dismiss,{onClick:i}),jsxRuntime.jsxs(y.Column,{gap:1,part:"announcement-header",children:[jsxRuntime.jsx(F.Title,{children:a.title}),jsxRuntime.jsx(F.Subtitle,{children:a.subtitle})]}),jsxRuntime.jsx(F.Media,{src:a.videoUri??a.imageUri,type:a.videoUri?"video":"image",css:{aspectRatio:"1.5",objectFit:"cover",width:"100%"}}),jsxRuntime.jsx(F.ProgressDots,{current:o.getNumberOfCompletedSteps(),total:o.getNumberOfAvailableSteps()}),jsxRuntime.jsxs(y.Row,{css:{"& > button":{flexBasis:"50%",flexGrow:1}},gap:3,part:"announcement-footer",children:[a.secondaryButtonTitle&&jsxRuntime.jsx(F.Secondary,{onClick:n,title:a.secondaryButtonTitle}),a.primaryButtonTitle&&jsxRuntime.jsx(F.Primary,{onClick:r,title:a.primaryButtonTitle??"Continue"})]})]})})}function Jo({flowId:e,...t}){return jsxRuntime.jsx(H,{as:g,borderWidth:"md",display:"flex",flexDirection:"row",flowId:e,gap:3,justifyContent:"space-between",part:"banner",...t,children:({handleDismiss:o,handlePrimary:i,handleSecondary:r,step:n})=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(y.Row,{gap:3,children:[n.imageUri&&jsxRuntime.jsx("img",{src:n.imageUri,style:{height:40,width:40,alignSelf:"center"}}),jsxRuntime.jsxs(y.Column,{children:[jsxRuntime.jsx(u.H4,{mb:1,children:n.title}),jsxRuntime.jsx(u.Body2,{color:"gray500",children:n.subtitle})]})]}),jsxRuntime.jsxs(y.Row,{alignItems:"center",gap:3,justifyContent:"center",children:[n.secondaryButtonTitle&&jsxRuntime.jsx(b.Secondary,{title:n.secondaryButtonTitle,onClick:r}),jsxRuntime.jsx(b.Primary,{title:n.primaryButtonTitle,onClick:i}),t.dismissible&&jsxRuntime.jsx(g.Dismiss,{onClick:o})]})]})})}var Qo=new Set(["required","min","max","minLength","maxLength","pattern"]);function Zo({fieldComponent:e,control:t,fieldData:o}){o.pattern!=null&&(typeof o.pattern=="string"?o.pattern=new RegExp(o.pattern.replace(/^\/|\/$/g,"")):typeof o.pattern=="object"&&typeof o.pattern.value=="string"&&(o.pattern.value=new RegExp(o.pattern.value.replace(/^\/|\/$/g,""))));let i=Object.fromEntries(Object.entries(o).filter(([n])=>Qo.has(n))),r=reactHookForm.useController({name:o.id,control:t,rules:i});return jsxRuntime.jsx(e,{...r,fieldData:o})}function Ye({fieldTypes:e,handleDismiss:t,handlePrimary:o,handleSecondary:i,parentProps:{dismissible:r},step:n}){var d;let{control:s,handleSubmit:a}=reactHookForm.useForm({delayError:2e3,mode:"onChange"}),c=[];function x(h,A){o(A,h);}function m(h,A){i(A,h);}return (d=n.fields)==null||d.forEach(h=>{e[h.type]!=null&&c.push(jsxRuntime.jsx(Zo,{control:s,fieldComponent:e[h.type],fieldData:h},h.id));}),jsxRuntime.jsxs(y.Column,{gap:5,part:"form-step",children:[jsxRuntime.jsxs(y.Row,{alignItems:"center",flexWrap:"wrap",gap:1,justifyContent:"space-between",part:"form-step-header",children:[jsxRuntime.jsx(g.Title,{children:n.title}),r&&jsxRuntime.jsx(g.Dismiss,{onClick:t}),jsxRuntime.jsx(g.Subtitle,{flexBasis:"100%",children:n.subtitle})]}),c,jsxRuntime.jsxs(y.Row,{part:"form-step-footer",justifyContent:"flex-end",gap:3,children:[n.secondaryButtonTitle&&jsxRuntime.jsx(b.Secondary,{title:n.secondaryButtonTitle,onClick:a(m)}),jsxRuntime.jsx(b.Primary,{title:n.primaryButtonTitle??"Submit",onClick:a(x)})]},"form-footer")]})}function Qe({error:e}){var t;return (t=e==null?void 0:e.message)!=null&&t.length?jsxRuntime.jsx(u.Caption,{color:"red500",display:"block",part:"field-error",textAlign:"end",children:e==null?void 0:e.message}):null}function Ze({children:e,id:t,required:o=!1}){return jsxRuntime.jsxs(u.H4,{as:"label",htmlFor:t,part:"field-label",children:[e,o&&" *"]})}var q={px:"4",py:"2",backgroundColor:"neutral.background",borderColor:"neutral.border",borderStyle:"solid",borderWidth:"md",borderRadius:"md",display:"block",outline:"none",width:"100%"};function W({children:e,field:t,fieldData:o,fieldState:i}){let{id:r,label:n,placeholder:s}=o,{error:a}=i,c={id:r,...t,...s?{placeholder:s}:{},...q,"aria-invalid":!!a,value:t.value??""};return jsxRuntime.jsxs(p,{part:"field",children:[jsxRuntime.jsx(Ze,{id:r,required:!!o.required,children:n}),e(c),jsxRuntime.jsx(Qe,{error:a})]})}var rr=()=>jsxRuntime.jsx(p,{as:"svg",color:"primary.foreground",width:"10px",height:"8px",viewBox:"0 0 10 8",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 4.34664L3.4618 6.99729L3.4459 6.98017L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),nr=ue__namespace.forwardRef(({label:e,value:t},o)=>jsxRuntime.jsxs(p,{as:"label",backgroundColor:"neutral.background",borderColor:"neutral.border",borderRadius:"md",borderStyle:"solid",borderWidth:"md",display:"flex",htmlFor:t,justifyContent:"space-between",part:"field-radio",px:4,py:2,children:[jsxRuntime.jsx(u.Body2,{part:"field-radio-label",children:e}),jsxRuntime.jsx(N__namespace.Item,{id:t,value:t,ref:o,asChild:!0,children:jsxRuntime.jsx(p,{as:"button",backgroundColor:"inherit",borderWidth:"md",borderStyle:"solid",borderColor:"neutral.border",borderRadius:"100%",padding:"0",part:"field-radio-value",position:"relative",height:"24px",width:"24px",children:jsxRuntime.jsx(p,{as:N__namespace.Indicator,alignItems:"center",bg:"primary.surface",borderWidth:"md",borderStyle:"solid",borderColor:"primary.border",borderRadius:"100%",display:"flex",height:"calc(100% + 2px)",justifyContent:"center",left:"-1px",part:"field-radio-indicator",position:"absolute",top:"-1px",width:"calc(100% + 2px)",children:jsxRuntime.jsx(rr,{})})})})]}));function rt(e){let{field:{onChange:t,value:o},fieldData:{options:i=[]}}=e,r=i.map(({label:n,value:s})=>jsxRuntime.jsx(nr,{value:s,label:n},s));return jsxRuntime.jsx(W,{...e,children:()=>jsxRuntime.jsx(N__namespace.Root,{value:o,onValueChange:t,asChild:!0,children:jsxRuntime.jsx(y.Column,{gap:2,part:"field-radio-group",children:r})})})}var sr=ue__namespace.forwardRef(({label:e,value:t},o)=>jsxRuntime.jsx(S__namespace.Item,{value:t,ref:o,asChild:!0,children:jsxRuntime.jsx(p,{"backgroundColor:hover":"blue900",borderRadius:"md",outline:"none",part:"field-select-option",px:"3",py:"2",children:jsxRuntime.jsx(S__namespace.ItemText,{asChild:!0,children:jsxRuntime.jsx(u.Body2,{part:"field-select-option-label",children:e})})})}));function at(e){let{field:{onChange:t,value:o},fieldData:{options:i=[],placeholder:r}}=e,n=i.map(({label:s,value:a})=>jsxRuntime.jsx(sr,{value:a,label:s},a));return jsxRuntime.jsx(W,{...e,children:()=>jsxRuntime.jsxs(S__namespace.Root,{value:o,onValueChange:t,children:[jsxRuntime.jsx(S__namespace.Trigger,{asChild:!0,children:jsxRuntime.jsxs(u.Body2,{...q,alignItems:"center",display:"flex",justifyContent:"space-between",part:"field-select",children:[jsxRuntime.jsx(S__namespace.Value,{placeholder:r??"Select one"}),jsxRuntime.jsx(S__namespace.Icon,{children:jsxRuntime.jsx(p,{as:outline.ChevronDownIcon,color:"gray100",display:"block",height:"24px",part:"field-select-icon",width:"24px"})})]})}),jsxRuntime.jsx(S__namespace.Portal,{children:jsxRuntime.jsx(S__namespace.Content,{position:"popper",sideOffset:4,asChild:!0,children:jsxRuntime.jsx(p,{...q,p:"1",part:"field-select-options",width:"var(--radix-popper-anchor-width)",children:jsxRuntime.jsx(S__namespace.Viewport,{children:n})})})})]})})}function lt(e){return jsxRuntime.jsx(W,{...e,children:t=>jsxRuntime.jsx(u.Body2,{as:"input",part:"field-text",type:"text",...t})})}function dt(e){return jsxRuntime.jsx(W,{...e,children:t=>jsxRuntime.jsx(u.Body2,{as:"textarea",part:"field-textarea",...t})})}var lr={radio:rt,select:at,text:lt,textarea:dt};function pr({fieldTypes:e={},flowId:t,...o}){let i=Object.assign({},lr,e);return jsxRuntime.jsx(H,{flowId:t,part:"form",...o,children:r=>jsxRuntime.jsx(Ye,{fieldTypes:i,...r})})}function oe(){let e="DOMRect"in globalThis?new DOMRect:{height:0,width:0,x:0,y:0,bottom:0,top:0,right:0,left:0,toJSON:()=>{}},[t,o]=ue.useState(e),[i,r]=ue.useState(null),n=ue.useCallback(s=>{r(s);},[]);return ue.useLayoutEffect(()=>{if(!i)return;let s=()=>{let a=i.getBoundingClientRect();o(a);};return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[i]),{node:i,rect:t,ref:n}}var mr=react.keyframes({"0%":{opacity:.5,transform:"scale(0.5)"},"50%":{opacity:0,transform:"scale(1)"},"100%":{opacity:0,transform:"scale(1)"}});function ft({style:e={},part:t="",...o}){return jsxRuntime.jsxs(p,{part:`dot-wrapper ${t}`,style:{height:"48px",position:"absolute",width:"48px",...e},...o,children:[jsxRuntime.jsx(p,{backgroundColor:"primary.surface",part:"dot-pulse",css:{animation:`2s ease-out infinite ${mr}`,borderRadius:"24px",height:"48px",left:0,position:"absolute",top:0,transformOrigin:"center center",width:"48px"}}),jsxRuntime.jsx(p,{backgroundColor:"primary.surface",part:"dot",style:{borderRadius:"12px",height:"24px",left:"12px",position:"absolute",top:"12px",width:"24px"}})]})}function gt({props:e,alignAttr:t,sideAttr:o}){let i=o??"bottom",r={},n=()=>{if(["after","before"].includes(e.align)){if(t=="start")return "before";if(t=="end")return "after"}return e.align??"after"},s="-24px",a={top:"bottom",right:"left",bottom:"top",left:"right"};r[a[i]]=s;let c=n();return ["before","end"].includes(c)?["top","bottom"].includes(i)?r.right=s:r.bottom=s:["after","start"].includes(c)?["top","bottom"].includes(i)?r.left=s:r.top=s:["top","bottom"].includes(i)?r.left=`calc(50% + ${s})`:r.top=`calc(50% + ${s})`,r}var xt={content:["align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","forceMount","hideWhenDetached","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenAutoFocus","onPointerDownOutside","side","sideOffset","sticky"],root:["defaultOpen","modal","onOpenChange","open"]};function yt(e,t){let o=Object.fromEntries(xt.content.map(r=>[r,e[r]]).filter(r=>r[1]!==void 0)),i=Object.fromEntries(xt.root.map(r=>[r,e[r]]).filter(r=>r[1]!==void 0));if(o.align=o.align??"after",o.side=o.side??"bottom",["before","after"].includes(o.align)){let r={after:"end",before:"start"},n=(d,h)=>["top","bottom"].includes(h)?d=="after"?"marginLeft":"marginRight":d=="after"?"marginTop":"marginBottom",s=o.alignOffset??0,a=o.style??{},c=o.side??"bottom",x=o.align;o.style={...a,[n(x,c)]:s};let m=["top","bottom"].includes(c)?t.width:t.height;o.alignOffset=(m+s)*-1,o.align=r[x];}return {contentProps:o,rootProps:i}}function C({anchor:e,children:t,className:o,spotlight:i=!1,style:r,...n}){let{node:s,rect:a,ref:c}=oe(),{node:x,rect:m,ref:d}=oe(),{contentProps:h,rootProps:A}=yt(n,a),[Y,ne]=ue.useState(h.align),[K,ie]=ue.useState(h.side),[he,Pt]=ue.useState(0),[St,Ct]=ue.useState(0);if(s!==null){let M=s.getAttribute("data-align"),Q=s.getAttribute("data-side");Y!==M&&ne(M),K!==Q&&ie(Q);}let be=ue.useRef(null);if(ue.useEffect(()=>{let M=document.querySelector(e);M!=null&&(d(M),be.current=M);},[e]),ue.useEffect(()=>{let{scrollX:M,scrollY:Q}=window;Pt(m.left+M),Ct(m.top+Q);},[m.left,m.top]),x==null)return null;let Pe="0";typeof window<"u"&&(Pe=window.getComputedStyle(x).borderRadius);let Ft=gt({props:n,alignAttr:Y,sideAttr:K});return jsxRuntime.jsxs(k__namespace.Root,{defaultOpen:!0,...A,children:[jsxRuntime.jsx(k__namespace.Anchor,{virtualRef:be}),jsxRuntime.jsx(k__namespace.Portal,{children:jsxRuntime.jsxs("div",{className:o,css:{bottom:0,left:0,position:"absolute",right:0,top:0,zIndex:9999,pointerEvents:"none"},children:[i&&jsxRuntime.jsx(p,{part:"tooltip-spotlight",position:"absolute",style:{borderRadius:Pe,boxShadow:"0 0 0 20000px rgb(0 0 0 / 0.5)",height:m.height,left:he,top:St,width:m.width}}),jsxRuntime.jsx(k__namespace.Content,{asChild:!0,...h,ref:c,children:jsxRuntime.jsxs(g,{boxShadow:"md",part:"tooltip",position:"relative",css:{maxWidth:"360px",pointerEvents:"auto",...r},children:[jsxRuntime.jsx(ft,{style:Ft}),t]})})]})})]})}C.Close=e=>jsxRuntime.jsx(k__namespace.Close,{"aria-label":"Close",asChild:!0,children:jsxRuntime.jsx(b.Plain,{css:{top:"12px",right:"4px"},part:"close",position:"absolute",...e,children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})})});C.Media=({src:e,...t})=>e==null?null:jsxRuntime.jsx($,{borderRadius:"md md 0 0",borderWidth:"0",css:{aspectRatio:"2",objectFit:"cover"},margin:"-5 -5 0",src:e,...t});C.Primary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(b.Primary,{title:t,onClick:e,...o});C.Progress=({children:e,...t})=>e==null?null:jsxRuntime.jsx(u.H4,{part:"progress",...t,children:e});C.Secondary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(b.Secondary,{title:t,onClick:e,...o});C.Subtitle=({children:e,...t})=>e==null?null:jsxRuntime.jsx(u.Body2,{part:"subtitle",...t,children:e});C.Title=({children:e,...t})=>e==null?null:jsxRuntime.jsx(u.H4,{part:"title",...t,children:e});function bt({dismissible:e=!0,flow:t,onDismiss:o,onPrimary:i,onSecondary:r,step:n,...s}){let{handleDismiss:a}=V(t,{onDismiss:o}),{handlePrimary:c,handleSecondary:x}=J(n,{onPrimary:i,onSecondary:r});return jsxRuntime.jsxs(C,{anchor:n.selector,onOpenAutoFocus:m=>m.preventDefault(),onPointerDownOutside:m=>m.preventDefault(),...s,children:[e&&jsxRuntime.jsx(C.Close,{onClick:a}),jsxRuntime.jsx(C.Media,{src:n.videoUri??n.imageUri,type:n.videoUri?"video":"image"}),jsxRuntime.jsxs(y.Column,{gap:1,part:"tooltip-header",children:[jsxRuntime.jsx(C.Title,{children:n.title}),jsxRuntime.jsx(C.Subtitle,{color:"gray500",children:n.subtitle})]}),jsxRuntime.jsxs(y.Row,{alignItems:"center",gap:3,justifyContent:"flex-end",part:"tooltip-footer",children:[jsxRuntime.jsx(C.Progress,{marginRight:"auto",transform:"translateY(1px)",children:`${t.getNumberOfCompletedSteps()+1}/${t.getNumberOfAvailableSteps()}`}),jsxRuntime.jsx(C.Secondary,{title:n.secondaryButtonTitle,onClick:x}),jsxRuntime.jsx(C.Primary,{title:n.primaryButtonTitle,onClick:c})]})]},n.id)}function hr({flowId:e,onComplete:t,variables:o,...i}){let{flow:r}=G(e,{variables:o});V(r,{onComplete:t});let{isCurrentModal:n,removeModal:s}=X(r);if(ue.useEffect(()=>{!(r!=null&&r.isVisible)&&n&&s();},[r==null?void 0:r.isVisible,n]),r==null||r.isVisible===!1||!n)return null;r.start();let a=r.getCurrentStep();return a==null||a.start(),jsxRuntime.jsx(bt,{step:a,flow:r,...i})}function Sr(){let{frigade:e}=ue.useContext(B);return {frigade:e,isLoading:!(e!=null&&e.isReady())}}function Fr(){let{userId:e,frigade:t}=ue.useContext(B);async function o(r){await t.identify(e,r);}async function i(r,n){await t.track(r,n);}return {userId:e,addProperties:o,track:i}}function wr(){let{groupId:e,frigade:t}=ue.useContext(B);async function o(r){if(!e){console.error("No Group ID is set. Cannot set properties without a Group ID.");return}await t.group(e,r);}async function i(r,n){await t.track(r,n);}return {groupId:e,addProperties:o,track:i}}
|
|
47
47
|
|
|
48
48
|
Object.defineProperty(exports, 'Flow', {
|
|
49
49
|
enumerable: true,
|
|
@@ -61,13 +61,13 @@ exports.Card = g;
|
|
|
61
61
|
exports.Flex = y;
|
|
62
62
|
exports.Form = pr;
|
|
63
63
|
exports.Provider = Ro;
|
|
64
|
-
exports.Text =
|
|
64
|
+
exports.Text = u;
|
|
65
65
|
exports.Tooltip = C;
|
|
66
66
|
exports.Tour = hr;
|
|
67
67
|
exports.themeVariables = le;
|
|
68
68
|
exports.useBoundingClientRect = oe;
|
|
69
69
|
exports.useFlow = G;
|
|
70
|
-
exports.useFlowHandlers =
|
|
70
|
+
exports.useFlowHandlers = V;
|
|
71
71
|
exports.useFrigade = Sr;
|
|
72
72
|
exports.useGroup = wr;
|
|
73
73
|
exports.useModal = X;
|