@frigade/react 2.0.0-alpha.29 → 2.0.0-alpha.31
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 +20 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
var y = require('@radix-ui/react-dialog');
|
|
4
4
|
var solid = require('@heroicons/react/24/solid');
|
|
5
|
-
var
|
|
5
|
+
var U = require('react');
|
|
6
6
|
var clsx = require('clsx');
|
|
7
|
-
var
|
|
8
|
-
var
|
|
7
|
+
var qe = require('known-css-properties');
|
|
8
|
+
var it = 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');
|
|
12
|
-
var
|
|
12
|
+
var C = require('@radix-ui/react-popover');
|
|
13
13
|
|
|
14
14
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
|
|
@@ -32,27 +32,27 @@ function _interopNamespace(e) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
var y__namespace = /*#__PURE__*/_interopNamespace(y);
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
var
|
|
38
|
-
var
|
|
35
|
+
var U__namespace = /*#__PURE__*/_interopNamespace(U);
|
|
36
|
+
var qe__default = /*#__PURE__*/_interopDefault(qe);
|
|
37
|
+
var it__default = /*#__PURE__*/_interopDefault(it);
|
|
38
|
+
var C__namespace = /*#__PURE__*/_interopNamespace(C);
|
|
39
39
|
|
|
40
|
-
var je=Object.defineProperty;var _e=(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 te=(e,t)=>{for(var o in t)je(e,o,{get:t[o],enumerable:!0});};var oe={borders:{md:"1px solid"},borderWidths:{0:"0",md:"1px"}};var re={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 ne={md:"10px",lg:"20px",round:"50%"};var a=e=>`var(--fr-colors-${e})`,ie={neutral:{background:a("white"),border:a("gray500"),foreground:a("black"),surface:a("gray700"),active:{background:a("white"),border:a("gray900"),foreground:a("black"),surface:a("gray700")},focus:{background:a("white"),border:a("gray900"),foreground:a("black"),surface:a("gray700")},hover:{background:a("white"),border:a("gray900"),foreground:a("black"),surface:a("gray700")}},primary:{background:a("blue500"),border:a("blue500"),foreground:a("white"),surface:a("blue500"),active:{background:a("blue400"),border:a("blue400"),foreground:a("white"),surface:a("blue400")},focus:{background:a("blue500"),border:a("blue500"),foreground:a("white"),surface:a("blue500")},hover:{background:a("blue400"),border:a("blue400"),foreground:a("white"),surface:a("blue400")}},secondary:{background:a("gray900"),border:a("gray900"),foreground:a("black"),surface:a("gray900"),active:{background:a("gray800"),border:a("gray800"),foreground:a("black"),surface:a("gray800")},focus:{background:a("gray900"),border:a("gray900"),foreground:a("black"),surface:a("gray900")},hover:{background:a("gray800"),border:a("gray800"),foreground:a("black"),surface:a("gray800")}}};var se={md:"0px 4px 20px rgba(0, 0, 0, 0.1)"};var Ue="px",Ne=e=>typeof e=="number"?`${4*e}${Ue}`:e,Je=[-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"],ae=Object.fromEntries(Je.map(e=>[e,Ne(e)]));var le={fontFamilies:{default:"TT Interphases Pro, sans-serif"},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 z={...oe,colors:{...re,...ie},...le,radii:ne,shadows:se,space:ae};function A(e,t="",o="."){return Object.keys(e).reduce((n,r)=>{let i=`${t.length?`${t}${o}`:""}${r}`,l=e[r];return typeof l=="object"&&l!==null&&!Array.isArray(l)?Object.assign(n,A(l,i,o)):n[i]=l,n},{})}function K(e){return A(e,"--fr","-")}function pe(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]=pe(r,`${t}-${n}`):o[n]=`var(${t}-${n})`;}),o}var de=K(z),d=pe(z);var Ge=new Set(["alt","size","src"]),qe=Xe__default.default.all.filter(e=>e.indexOf("-")!=0&&!Ge.has(e)).map(e=>[e.replace(/-([a-z])/g,(t,o)=>o.toUpperCase()),null]),Ye=Object.fromEntries(qe),j=A(d.colors),Qe={color:j,backgroundColor:j,borderColor:j,border:d.borders,borderRadius:d.radii,borderWidth:d.borderWidths,boxShadow:d.shadows,fontFamily:d.fontFamilies,fontSize:d.fontSizes,fontWeight:d.fontWeights,gap:d.space,lineHeight:d.lineHeights,margin:d.space,marginBottom:d.space,marginLeft:d.space,marginRight:d.space,marginTop:d.space,padding:d.space,paddingBottom:d.space,paddingLeft:d.space,paddingRight:d.space,paddingTop:d.space},ce={...Ye,...Qe},ue={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"]};function Ze(e){return Array.isArray(e)?new Map(e.map(t=>[t,t])):typeof e=="object"&&e!==null?new Map(Object.entries(e)):["string","number"].includes(typeof e)?new Map([e,e]):new Map}var me=new Map(Object.entries(ce).map(([e,t])=>[e,Ze(t)])),et=new Map(Object.entries(ue).map(([e,t])=>[e,new Set(t)])),tt=new Set(["height","width"]),ot=new Set(["canvas","embed","iframe","img","input","object","video"]);function fe(e,t="div"){let o=Object.assign({},e),n={};return Object.entries(o).forEach(([r,s])=>{let i=et.get(r);i!=null&&(i.forEach(l=>{o[l]=s;}),delete o[r]);}),Object.entries(o).forEach(([r,s])=>{let i=me.get(r);if(i!=null){if(typeof s=="string"&&s.indexOf(" ")>-1){let l=s.split(" ");n[r]=l.map(p=>i.get(p.toString())??p).join(" ");}else i.has(s.toString())?n[r]=i.get(s.toString()):n[r]=s;(typeof t!="string"||!ot.has(t)||!tt.has(r))&&delete o[r];}}),Object.keys(o).forEach(r=>{let s=r.substring(1);r.indexOf("_")===0&&me.has(s)&&(o[s]=o[r],delete o[r]);}),{cssFromProps:n,unmatchedProps:o}}function nt(){if(typeof window>"u"){let{JSDOM:e}=_e("jsdom");return new e("<!DOCTYPE html>").window}return window}function ge(e){return e?{__html:rt__default.default(nt()).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 st(e){return e&&`fr-${e}`}function he(e){return e&&(Array.isArray(e)?e.map(t=>he(t)).join(" "):st(e))}function at({as:e,children:t,className:o,css:n,part:r,...s},i){let l=e??"div",{cssFromProps:p,unmatchedProps:c}=fe(s,l),f=he(r),R=o||f?clsx.clsx(o,f):void 0,E=[{boxSizing:"border-box"},p,n];return typeof t=="string"?jsxRuntime.jsx(l,{className:R,css:E,...c,ref:i,dangerouslySetInnerHTML:ge(t)}):jsxRuntime.jsx(l,{className:R,css:E,...c,ref:i,children:t})}var u=N__namespace.forwardRef(at);var _={};te(_,{Body1:()=>ft,Body2:()=>gt,Caption:()=>xt,Display1:()=>lt,Display2:()=>pt,H1:()=>dt,H2:()=>ct,H3:()=>ut,H4:()=>mt});var C={color:"neutral.foreground",fontFamily:"default",margin:"0"},lt={...C,fontSize:"5xl",fontWeight:"bold",lineHeight:"4xl"},pt={...C,fontSize:"4xl",fontWeight:"bold",lineHeight:"3xl"},dt={...C,fontSize:"3xl",fontWeight:"bold",lineHeight:"2xl"},ct={...C,fontSize:"2xl",fontWeight:"bold",lineHeight:"xl"},ut={...C,fontSize:"xl",fontWeight:"bold",lineHeight:"lg"},mt={...C,fontSize:"lg",fontWeight:"bold",lineHeight:"md"},ft={...C,fontSize:"md",fontWeight:"regular",lineHeight:"md"},gt={...C,fontSize:"sm",fontWeight:"regular",lineHeight:"md"},xt={...C,fontSize:"xs",fontWeight:"regular",lineHeight:"sm"};function Pe({as:e="span",children:t,variant:o="Body1",...n}){return jsxRuntime.jsx(u,{as:e,..._[o],...n,children:t})}var yt=["Display1","Display2","H1","H2","H3","H4","Body1","Body2","Caption"],ht=Object.fromEntries(yt.map(e=>{let t=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():void 0,o=n=>jsxRuntime.jsx(Pe,{as:t,...n,variant:e,children:n.children});return o.displayName=`Text.${e}`,[e,o]})),P=Object.assign(Pe,ht);var U={};te(U,{Link:()=>Tt,Plain:()=>St,Primary:()=>Pt,Secondary:()=>bt,base:()=>$});var $=({radii:e,space:t})=>({borderWidth:0,borderRadius:e.md,padding:`${t[2]} ${t[4]}`}),Pt=({colors:e})=>[$,{backgroundColor:e.primary.surface,color:e.primary.foreground,"&:hover":{backgroundColor:e.primary.hover.surface}}],bt=({colors:e})=>[$,{backgroundColor:e.secondary.surface,color:e.secondary.foreground,"&:hover":{backgroundColor:e.secondary.hover.surface}}],Tt=({colors:e})=>[$,{backgroundColor:e.transparent,color:e.primary.surface,"&:hover":{color:e.primary.hover.surface}}],St=({colors:e})=>[$,{backgroundColor:e.transparent,color:e.neutral.foreground}];function Te({as:e,children:t,part:o,title:n,variant:r="Primary",...s}){let i=r.toLocaleLowerCase();return jsxRuntime.jsxs(u,{as:e??"button",css:U[r],part:[`button-${i}`,o],...s,children:[t,n&&jsxRuntime.jsx(P.Body2,{fontWeight:"demibold",color:"inherit",children:n})]})}var Ct=["Primary","Secondary","Link","Plain"],wt=Object.fromEntries(Ct.map(e=>{let t=o=>jsxRuntime.jsx(Te,{...o,variant:e,children:o.children});return t.displayName=`Text.${e}`,[e,t]})),b=Object.assign(Te,wt);var Rt=N__namespace.forwardRef(({children:e,css:t,...o},n)=>jsxRuntime.jsx(u,{css:[{display:"flex",flexDirection:"row"},t],...o,ref:n,children:e})),vt=N__namespace.forwardRef(({children:e,css:t,...o},n)=>jsxRuntime.jsx(u,{css:[{display:"flex",flexDirection:"column"},t],...o,ref:n,children:e})),T={Column:vt,Row:Rt};var v=N__namespace.forwardRef(({as:e,children:t,...o},n)=>{let r=e??T.Column;return jsxRuntime.jsx(r,{backgroundColor:"neutral.background",borderRadius:"md",p:5,...o,ref:n,children:t})});function Be({part:e,src:t,...o}){return jsxRuntime.jsx(u,{as:"img",part:["image",e],src:t,...o})}function Dt(e){var t,o,n;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]}`;throw new Error("Could not map videoUri to a known provider (Youtube, Vimeo, Wistia).")}function Re({part:e,src:t,...o}){let n=Dt(t);return jsxRuntime.jsx(u,{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 W({src:e,type:t,...o}){return jsxRuntime.jsx(t==="video"?Re:Be,{src:e,...o})}function x({children:e,...t}){return jsxRuntime.jsx(y__namespace.Root,{defaultOpen:!0,modal:!0,children:jsxRuntime.jsxs(y__namespace.Portal,{children:[jsxRuntime.jsx(y__namespace.Overlay,{style:{background:"rgb(0 0 0 / 0.5)",position:"fixed",inset:0}}),jsxRuntime.jsx(y__namespace.Content,{asChild:!0,onOpenAutoFocus:o=>o.preventDefault(),onPointerDownOutside:o=>o.preventDefault(),children:jsxRuntime.jsx(v,{boxShadow:"md",css:{left:"50%",maxWidth:430,top:"50%",transform:"translate(-50%, -50%)"},p:8,position:"fixed",textAlign:"center",...t,children:e})})]})})}x.Close=e=>jsxRuntime.jsx(y__namespace.Close,{"aria-label":"Close",asChild:!0,children:jsxRuntime.jsx(b.Plain,{css:{top:"4px",right:"-4px"},part:"close",position:"absolute",...e,children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})})});x.Subtitle=({children:e,...t})=>jsxRuntime.jsx(y__namespace.Description,{asChild:!0,children:jsxRuntime.jsx(P.Body2,{part:"subtitle",mb:5,...t,children:e})});x.Media=({src:e,...t})=>e==null?null:jsxRuntime.jsx(W,{borderRadius:"md",src:e,...t});x.Primary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(b.Primary,{title:t,onClick:e,...o});x.ProgressDots=({current:e,total:t})=>{let o=[...Array(t)].map((n,r)=>jsxRuntime.jsx("circle",{r:4,cx:4+16*r,cy:"4px",fill:e===r?d.colors.blue500:d.colors.blue800},r));return jsxRuntime.jsx(u,{as:"svg",width:16*t-8,height:"8px",viewBox:`0 0 ${16*t-8} 8`,margin:"5 auto",children:o})};x.Secondary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(b.Secondary,{title:t,onClick:e,...o});x.Title=({children:e,...t})=>jsxRuntime.jsx(y__namespace.Title,{asChild:!0,children:jsxRuntime.jsx(P.H3,{mb:1,part:"title",...t,children:e})});var w=N.createContext({apiKey:"",modals:[],setModals:()=>{},navigate:()=>{}});function Kt({children:e,navigate:t,theme:o,...n}){let r=o?K(o):{},[s,i]=N.useState([]),l=N.useRef(new js.Frigade(n.apiKey,{apiKey:n.apiKey,apiUrl:n.apiUrl,userId:n.userId,groupId:n.groupId})),p=t??((c,f="_self")=>{window.open(c,f);});return N.useEffect(()=>()=>{var c;(c=l.current)==null||c.destroy();},[]),jsxRuntime.jsxs(w.Provider,{value:{modals:s,setModals:i,navigate:p,...n,frigade:l.current},children:[jsxRuntime.jsx(react.Global,{styles:{":root":{...de,...r}}}),jsxRuntime.jsx(react.ThemeProvider,{theme:d,children:e})]})}function F(e,t){let[o,n]=N.useState(),[r,s]=N.useState(""),{frigade:i}=N.useContext(w),l=p=>{p.id===e&&(t!=null&&t.variables&&p.applyVariables(t.variables),n(p),s(Math.random().toString()));};return N.useEffect(()=>((async()=>{let p=await i.getFlow(e);if(!p||i.hasFailedToLoad()){n(void 0);return}t!=null&&t.variables&&p.applyVariables(t.variables),n(p);})(),i.onStateChange(l),()=>{i.removeStateChangeHandler(l);}),[]),{flow:o}}function B(e,{onComplete:t,onDismiss:o}={}){let n=N.useRef(null);return N.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:N.useCallback(async r=>{if(await(o==null?void 0:o(e,r))===!1)return r.preventDefault(),!1;await e.skip();},[e])}}function k(e,{onPrimary:t,onSecondary:o}={}){let{navigate:n}=N.useContext(w);return {handlePrimary:N.useCallback(async r=>{if(await(t==null?void 0:t(e,r))===!1)return r.preventDefault(),!1;await e.complete(),e.primaryButtonUri!=null&&n(e.primaryButtonUri,e.primaryButtonUriTarget);},[e]),handleSecondary:N.useCallback(async r=>{if(await(o==null?void 0:o(e,r))===!1)return r.preventDefault(),!1;await e.complete(),e.secondaryButtonUri!=null&&n(e.secondaryButtonUri,e.secondaryButtonUriTarget);},[e])}}function qt({flowId:e,onComplete:t,onDismiss:o,onPrimary:n,onSecondary:r,variables:s}){let{flow:i}=F(e,{variables:s}),l=i==null?void 0:i.getCurrentStep(),{handleDismiss:p}=B(i,{onComplete:t,onDismiss:o}),{handlePrimary:c,handleSecondary:f}=k(l,{onPrimary:n,onSecondary:r});return i==null||i.isVisible===!1?null:(i.start(),l==null||l.start(),jsxRuntime.jsxs(x,{children:[jsxRuntime.jsx(x.Close,{onClick:p}),jsxRuntime.jsx(x.Title,{children:l.title}),jsxRuntime.jsx(x.Subtitle,{children:l.subtitle}),jsxRuntime.jsx(x.Media,{src:l.imageUri,css:{aspectRatio:"1.5",objectFit:"cover",width:"100%"}}),jsxRuntime.jsx(x.ProgressDots,{current:i.getNumberOfCompletedSteps(),total:i.getNumberOfAvailableSteps()}),jsxRuntime.jsxs(T.Row,{css:{"& > button":{flexGrow:1}},gap:3,children:[jsxRuntime.jsx(x.Secondary,{title:"Secondary",onClick:f}),jsxRuntime.jsx(x.Primary,{title:"Primary",onClick:c})]})]}))}function Qt({flowId:e,onComplete:t,onDismiss:o,onPrimary:n,onSecondary:r,...s}){let{flow:i}=F(e),l=i==null?void 0:i.getCurrentStep(),{handleDismiss:p}=B(i,{onComplete:t,onDismiss:o}),{handlePrimary:c,handleSecondary:f}=k(l,{onPrimary:n,onSecondary:r});return i==null||i.isVisible===!1?null:(i.start(),l==null||l.start(),jsxRuntime.jsxs(v,{as:T.Row,border:"md",borderColor:"gray900",justifyContent:"space-between",...s,children:[jsxRuntime.jsxs(T.Row,{gap:3,children:[jsxRuntime.jsx("img",{src:l.imageUri,style:{height:40,width:40,alignSelf:"center"}}),jsxRuntime.jsxs(T.Column,{children:[jsxRuntime.jsx(P.H4,{mb:1,children:l.title}),jsxRuntime.jsx(P.Body2,{children:l.subtitle})]})]}),jsxRuntime.jsxs(T.Row,{alignItems:"center",gap:3,children:[jsxRuntime.jsx(b.Secondary,{title:l.secondaryButtonTitle,onClick:f}),jsxRuntime.jsx(b.Primary,{title:l.primaryButtonTitle,onClick:c}),jsxRuntime.jsx(b.Plain,{part:"banner-close",onClick:p,children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})})]})]}))}function J(){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]=N.useState(e),[n,r]=N.useState(null),s=N.useCallback(i=>{r(i);},[]);return N.useLayoutEffect(()=>{n&&o(n.getBoundingClientRect());},[n]),{node:n,rect:t,ref:s}}var oo=react.keyframes({"0%":{opacity:.5,transform:"scale(0.5)"},"50%":{opacity:0,transform:"scale(1)"},"100%":{opacity:0,transform:"scale(1)"}});function Ee({style:e={},part:t="",...o}){return jsxRuntime.jsxs(u,{part:`dot-wrapper ${t}`,style:{height:"48px",position:"absolute",width:"48px",...e},...o,children:[jsxRuntime.jsx(u,{backgroundColor:"primary.surface",part:"dot-pulse",css:{animation:`2s ease-out infinite ${oo}`,borderRadius:"24px",height:"48px",left:0,position:"absolute",top:0,transformOrigin:"center center",width:"48px"}}),jsxRuntime.jsx(u,{backgroundColor:"primary.surface",part:"dot",style:{borderRadius:"12px",height:"24px",left:"12px",position:"absolute",top:"12px",width:"24px"}})]})}function Me({props:e,alignAttr:t,sideAttr:o}){let n=o??"bottom",r={},s=()=>{if(["after","before"].includes(e.align)){if(t=="start")return "before";if(t=="end")return "after"}return e.align??"after"},i="-24px",l={top:"bottom",right:"left",bottom:"top",left:"right"};r[l[n]]=i;let p=s();return ["before","end"].includes(p)?["top","bottom"].includes(n)?r.right=i:r.bottom=i:["after","start"].includes(p)?["top","bottom"].includes(n)?r.left=i:r.top=i:["top","bottom"].includes(n)?r.left=`calc(50% + ${i})`:r.top=`calc(50% + ${i})`,r}var Ae={content:["align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","forceMount","hideWhenDetached","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenAutoFocus","onPointerDownOutside","side","sideOffset","sticky"],root:["defaultOpen","modal","onOpenChange","open"]};function $e(e,t){let o=Object.fromEntries(Ae.content.map(r=>[r,e[r]]).filter(r=>r[1]!==void 0)),n=Object.fromEntries(Ae.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"},s=(R,E)=>["top","bottom"].includes(E)?R=="after"?"marginLeft":"marginRight":R=="after"?"marginTop":"marginBottom",i=o.alignOffset??0,l=o.style??{},p=o.side??"bottom",c=o.align;o.style={...l,[s(c,p)]:i};let f=["top","bottom"].includes(p)?t.width:t.height;o.alignOffset=(f+i)*-1,o.align=r[c];}return {contentProps:o,rootProps:n}}function m({anchor:e,children:t,className:o,spotlight:n=!1,style:r,...s}){let{node:i,rect:l,ref:p}=J(),{contentProps:c,rootProps:f}=$e(s,l),[R,E]=N.useState(c.align),[Y,Le]=N.useState(c.side);if(i!==null){let M=i.getAttribute("data-align"),ee=i.getAttribute("data-side");R!==M&&E(M),Y!==ee&&Le(ee);}let Q=N.useRef(null),[I,ze]=N.useState(null);if(N.useEffect(()=>{let M=document.querySelector(e);M!=null&&(Q.current=M,ze(Q));},[e]),I==null)return null;let V=I.current.getBoundingClientRect(),Z="0";typeof window<"u"&&(Z=window.getComputedStyle(I.current).borderRadius);let Ke=Me({props:s,alignAttr:R,sideAttr:Y});return jsxRuntime.jsxs(S__namespace.Root,{defaultOpen:!0,...f,children:[jsxRuntime.jsx(S__namespace.Anchor,{virtualRef:I}),jsxRuntime.jsx(S__namespace.Portal,{children:jsxRuntime.jsxs("div",{className:o,css:{bottom:0,left:0,position:"absolute",right:0,top:0,zIndex:9999},children:[n&&jsxRuntime.jsx(u,{part:"tooltip-spotlight",position:"absolute",css:{borderRadius:Z,boxShadow:"0 0 0 2000px rgb(0 0 0 / 0.5)",height:V.height,left:V.left,top:V.top,width:V.width}}),jsxRuntime.jsx(S__namespace.Content,{asChild:!0,...c,ref:p,children:jsxRuntime.jsxs(v,{boxShadow:"md",part:"tooltip-content",position:"relative",css:{maxWidth:"360px",...r},children:[jsxRuntime.jsx(Ee,{style:Ke}),t]})})]})})]})}m.Close=e=>jsxRuntime.jsx(S__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"})})});m.Media=({src:e,...t})=>e==null?null:jsxRuntime.jsx(W,{borderRadius:"md md 0 0",borderWidth:"0",css:{aspectRatio:"2"},margin:"-5 -5 5",src:e,...t});m.Primary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(b.Primary,{title:t,onClick:e,...o});m.Progress=({children:e,...t})=>e==null?null:jsxRuntime.jsx(P.Body2,{fontWeight:"demibold",part:"progress",...t,children:e});m.Secondary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(b.Secondary,{title:t,onClick:e,...o});m.Subtitle=({children:e,...t})=>e==null?null:jsxRuntime.jsx(P.Body2,{part:"subtitle",...t,children:e});m.Title=({children:e,...t})=>e==null?null:jsxRuntime.jsx(P.Body1,{fontWeight:"bold",mb:1,part:"title",...t,children:e});function q(e){let{modals:t,setModals:o}=N.useContext(w),[n,r]=N.useState(!1);return N.useEffect(()=>(o([...t,e]),()=>o(t.filter(s=>s!==e))),[]),N.useEffect(()=>{let s=t[0]===e;s!==n&&r(s);},[t]),{isCurrentModal:n}}function Ve({step:e,flow:t,onDismiss:o,onPrimary:n,onSecondary:r,...s}){let{isCurrentModal:i}=q(`${t.id}-${e.id}`),{handleDismiss:l}=B(t,{onDismiss:o}),{handlePrimary:p,handleSecondary:c}=k(e,{onPrimary:n,onSecondary:r});return i?jsxRuntime.jsxs(m,{anchor:e.selector,onOpenAutoFocus:f=>f.preventDefault(),onPointerDownOutside:f=>f.preventDefault(),...s,children:[jsxRuntime.jsx(m.Close,{onClick:l}),jsxRuntime.jsx(m.Media,{src:e.videoUri??e.imageUri,type:e.videoUri?"video":"image"}),jsxRuntime.jsx(m.Title,{children:e.title}),jsxRuntime.jsx(m.Subtitle,{children:e.subtitle}),jsxRuntime.jsxs(T.Row,{alignItems:"center",gap:3,justifyContent:"flex-end",part:"tooltip-footer",pt:4,children:[jsxRuntime.jsx(m.Progress,{children:`${t.getNumberOfCompletedSteps()+1}/${t.getNumberOfAvailableSteps()}`}),jsxRuntime.jsx(m.Secondary,{marginLeft:"auto",title:e.secondaryButtonTitle,onClick:c}),jsxRuntime.jsx(m.Primary,{title:e.primaryButtonTitle,onClick:p})]})]},e.id):null}function po({flowId:e,onComplete:t,variables:o,...n}){let{flow:r}=F(e,{variables:o});if(B(r,{onComplete:t}),r==null||r.isVisible===!1)return null;r.start();let s=r.getCurrentStep();return s==null||s.start(),jsxRuntime.jsx(Ve,{step:s,flow:r,...n})}function mo(){let{frigade:e}=N.useContext(w);return {frigade:e}}
|
|
40
|
+
var _e=Object.defineProperty;var Ue=(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 te=(e,t)=>{for(var o in t)_e(e,o,{get:t[o],enumerable:!0});};var oe={borders:{md:"1px solid"},borderWidths:{0:"0",md:"1px"}};var re={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 ne={md:"10px",lg:"20px",round:"50%"};var l=e=>`var(--fr-colors-${e})`,ie={neutral:{background:l("white"),border:l("gray500"),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("gray900"),border:l("gray900"),foreground:l("black"),surface:l("gray900"),active:{background:l("gray800"),border:l("gray800"),foreground:l("black"),surface:l("gray800")},focus:{background:l("gray900"),border:l("gray900"),foreground:l("black"),surface:l("gray900")},hover:{background:l("gray800"),border:l("gray800"),foreground:l("black"),surface:l("gray800")}}};var se={md:"0px 4px 20px rgba(0, 0, 0, 0.1)"};var Je="px",Xe=e=>typeof e=="number"?`${4*e}${Je}`:e,Ge=[-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"],ae=Object.fromEntries(Ge.map(e=>[e,Xe(e)]));var le={fontFamilies:{default:"TT Interphases Pro, sans-serif"},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 z={...oe,colors:{...re,...ie},...le,radii:ne,shadows:se,space:ae};function A(e,t="",o="."){return Object.keys(e).reduce((r,n)=>{let i=`${t.length?`${t}${o}`:""}${n}`,s=e[n];return typeof s=="object"&&s!==null&&!Array.isArray(s)?Object.assign(r,A(s,i,o)):r[i]=s,r},{})}function K(e){return A(e,"--fr","-")}function pe(e,t="--fr"){let o={};return Object.keys(e).forEach(r=>{let n=e[r];typeof n=="object"&&n!==null&&!Array.isArray(n)?o[r]=pe(n,`${t}-${r}`):o[r]=`var(${t}-${r})`;}),o}var de=K(z),c=pe(z);var Ye=new Set(["alt","size","src"]),Qe=qe__default.default.all.filter(e=>e.indexOf("-")!=0&&!Ye.has(e)).map(e=>[e.replace(/-([a-z])/g,(t,o)=>o.toUpperCase()),null]),Ze=Object.fromEntries(Qe),j=A(c.colors),et={color:j,backgroundColor:j,borderColor:j,border:c.borders,borderRadius:c.radii,borderWidth:c.borderWidths,boxShadow:c.shadows,fontFamily:c.fontFamilies,fontSize:c.fontSizes,fontWeight:c.fontWeights,gap:c.space,lineHeight:c.lineHeights,margin:c.space,marginBottom:c.space,marginLeft:c.space,marginRight:c.space,marginTop:c.space,padding:c.space,paddingBottom:c.space,paddingLeft:c.space,paddingRight:c.space,paddingTop:c.space},ce={...Ze,...et},ue={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"]},me=new Set(["active","focus","focusVisible","focusWithin","hover"]);function tt(e){return Array.isArray(e)?new Map(e.map(t=>[t,t])):typeof e=="object"&&e!==null?new Map(Object.entries(e)):["string","number"].includes(typeof e)?new Map([e,e]):new Map}var fe=new Map(Object.entries(ce).map(([e,t])=>[e,tt(t)])),ot=new Map(Object.entries(ue).map(([e,t])=>[e,new Set(t)])),rt=new Set(["height","width"]),nt=new Set(["canvas","embed","iframe","img","input","object","video"]);function ge(e){let[t,o]=e.split(":");return [t,me.has(o)?o:null]}function xe(e,t="div"){let o=Object.assign({},e),r={};function n(a){if(a==null)return r;let s=`&:${a.replace(/[A-Z]/g,p=>`-${p.toLocaleLowerCase()}`)}`;return r[s]==null&&(r[s]={}),r[s]}return Object.entries(o).forEach(([a,i])=>{let[s,p]=ge(a),d=ot.get(s);d!=null&&(d.forEach(u=>{let P=`${u}${p?":"+p:""}`;o[P]=i;}),delete o[a]);}),Object.entries(o).forEach(([a,i])=>{let[s,p]=ge(a),d=fe.get(s);if(d!=null){if(typeof i=="string"&&i.indexOf(" ")>-1){let u=i.split(" ");n(p)[s]=u.map(P=>d.get(P.toString())??P).join(" ");}else d.has(i.toString())?n(p)[s]=d.get(i.toString()):n(p)[s]=i;(typeof t!="string"||!nt.has(t)||!rt.has(s))&&delete o[a];}}),Object.keys(o).forEach(a=>{let i=a.substring(1);a.indexOf("_")===0&&fe.has(i)&&(o[i]=o[a],delete o[a]);}),{cssFromProps:r,unmatchedProps:o}}function st(){if(typeof window>"u"){let{JSDOM:e}=Ue("jsdom");return new e("<!DOCTYPE html>").window}return window}function ye(e){return e?{__html:it__default.default(st()).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 lt(e){return e&&`fr-${e}`}function be(e){return e&&(Array.isArray(e)?e.map(t=>be(t)).join(" "):lt(e))}function pt({as:e,children:t,className:o,css:r={},part:n,...a},i){let s=e??"div",{cssFromProps:p,unmatchedProps:d}=xe(a,s),u=be(n),P=o||u?clsx.clsx(o,u):void 0,E=[{boxSizing:"border-box"},p,r];return typeof t=="string"?jsxRuntime.jsx(s,{className:P,css:E,...d,ref:i,dangerouslySetInnerHTML:ye(t)}):jsxRuntime.jsx(s,{className:P,css:E,...d,ref:i,children:t})}var m=U__namespace.forwardRef(pt);var N={};te(N,{Body1:()=>xt,Body2:()=>yt,Caption:()=>ht,Display1:()=>dt,Display2:()=>ct,H1:()=>ut,H2:()=>mt,H3:()=>ft,H4:()=>gt});var w={color:"neutral.foreground",fontFamily:"default",margin:"0"},dt={...w,fontSize:"5xl",fontWeight:"bold",lineHeight:"4xl"},ct={...w,fontSize:"4xl",fontWeight:"bold",lineHeight:"3xl"},ut={...w,fontSize:"3xl",fontWeight:"bold",lineHeight:"2xl"},mt={...w,fontSize:"2xl",fontWeight:"bold",lineHeight:"xl"},ft={...w,fontSize:"xl",fontWeight:"bold",lineHeight:"lg"},gt={...w,fontSize:"lg",fontWeight:"bold",lineHeight:"md"},xt={...w,fontSize:"md",fontWeight:"regular",lineHeight:"md"},yt={...w,fontSize:"sm",fontWeight:"regular",lineHeight:"md"},ht={...w,fontSize:"xs",fontWeight:"regular",lineHeight:"sm"};function Te({as:e="span",children:t,variant:o="Body1",...r}){return jsxRuntime.jsx(m,{as:e,...N[o],...r,children:t})}var Pt=["Display1","Display2","H1","H2","H3","H4","Body1","Body2","Caption"],bt=Object.fromEntries(Pt.map(e=>{let t=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():void 0,o=r=>jsxRuntime.jsx(Te,{as:t,...r,variant:e,children:r.children});return o.displayName=`Text.${e}`,[e,o]})),b=Object.assign(Te,bt);var _={};te(_,{Link:()=>Ct,Plain:()=>wt,Primary:()=>Tt,Secondary:()=>St});var I={borderWidth:"0",borderRadius:"md",padding:"2 4"},Tt={...I,backgroundColor:"primary.surface",color:"primary.foreground","backgroundColor:hover":"primary.hover.surface"},St={...I,backgroundColor:"secondary.surface",color:"secondary.foreground","backgroundColor:hover":"secondary.hover.surface"},Ct={...I,backgroundColor:"transparent",color:"primary.surface","color:hover":"primary.hover.surface"},wt={...I,backgroundColor:"transparent",color:"neutral.foreground"};function Ce({as:e,children:t,part:o,title:r,variant:n="Primary",...a}){let i=n.toLocaleLowerCase();return jsxRuntime.jsxs(m,{as:e??"button",part:[`button-${i}`,o],..._[n],...a,children:[t,r&&jsxRuntime.jsx(b.Body2,{fontWeight:"demibold",color:"inherit",children:r})]})}var Bt=["Primary","Secondary","Link","Plain"],Rt=Object.fromEntries(Bt.map(e=>{let t=o=>jsxRuntime.jsx(Ce,{...o,variant:e,children:o.children});return t.displayName=`Text.${e}`,[e,t]})),T=Object.assign(Ce,Rt);var Ft=U__namespace.forwardRef(({children:e,css:t,...o},r)=>jsxRuntime.jsx(m,{css:[{display:"flex",flexDirection:"row"},t],...o,ref:r,children:e})),kt=U__namespace.forwardRef(({children:e,css:t,...o},r)=>jsxRuntime.jsx(m,{css:[{display:"flex",flexDirection:"column"},t],...o,ref:r,children:e})),S={Column:kt,Row:Ft};var v=U__namespace.forwardRef(({as:e,children:t,...o},r)=>{let n=e??S.Column;return jsxRuntime.jsx(n,{backgroundColor:"neutral.background",borderRadius:"md",p:5,...o,ref:r,children:t})});function ve({part:e,src:t,...o}){return jsxRuntime.jsx(m,{as:"img",part:["image",e],src:t,...o})}function Ht(e){var t,o,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/${(r=e.split("wistia.com/medias/")[1])==null?void 0:r.split("&")[0]}`;throw new Error("Could not map videoUri to a known provider (Youtube, Vimeo, Wistia).")}function Fe({part:e,src:t,...o}){let r=Ht(t);return jsxRuntime.jsx(m,{allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,as:"iframe",backgroundColor:"gray100",borderWidth:0,part:["video",e],src:r,...o})}function $({src:e,type:t,...o}){return jsxRuntime.jsx(t==="video"?Fe:ve,{src:e,...o})}function x({children:e,...t}){return jsxRuntime.jsx(y__namespace.Root,{defaultOpen:!0,modal:!0,children:jsxRuntime.jsxs(y__namespace.Portal,{children:[jsxRuntime.jsx(y__namespace.Overlay,{style:{background:"rgb(0 0 0 / 0.5)",position:"fixed",inset:0}}),jsxRuntime.jsx(y__namespace.Content,{asChild:!0,onOpenAutoFocus:o=>o.preventDefault(),onPointerDownOutside:o=>o.preventDefault(),children:jsxRuntime.jsx(v,{boxShadow:"md",css:{left:"50%",maxWidth:430,top:"50%",transform:"translate(-50%, -50%)"},p:8,position:"fixed",textAlign:"center",...t,children:e})})]})})}x.Close=e=>jsxRuntime.jsx(y__namespace.Close,{"aria-label":"Close",asChild:!0,children:jsxRuntime.jsx(T.Plain,{css:{top:"4px",right:"-4px"},part:"close",position:"absolute",...e,children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})})});x.Subtitle=({children:e,...t})=>jsxRuntime.jsx(y__namespace.Description,{asChild:!0,children:jsxRuntime.jsx(b.Body2,{part:"subtitle",mb:5,...t,children:e})});x.Media=({src:e,...t})=>e==null?null:jsxRuntime.jsx($,{borderRadius:"md",src:e,...t});x.Primary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(T.Primary,{title:t,onClick:e,...o});x.ProgressDots=({current:e,total:t})=>{let o=[...Array(t)].map((r,n)=>jsxRuntime.jsx("circle",{r:4,cx:4+16*n,cy:"4px",fill:e===n?c.colors.blue500:c.colors.blue800},n));return jsxRuntime.jsx(m,{as:"svg",width:16*t-8,height:"8px",viewBox:`0 0 ${16*t-8} 8`,margin:"5 auto",children:o})};x.Secondary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(T.Secondary,{title:t,onClick:e,...o});x.Title=({children:e,...t})=>jsxRuntime.jsx(y__namespace.Title,{asChild:!0,children:jsxRuntime.jsx(b.H3,{mb:1,part:"title",...t,children:e})});var B=U.createContext({apiKey:"",modals:[],setModals:()=>{},navigate:()=>{}});function Nt({children:e,navigate:t,theme:o,...r}){let n=o?K(o):{},[a,i]=U.useState([]),s=U.useRef(new js.Frigade(r.apiKey,{apiKey:r.apiKey,apiUrl:r.apiUrl,userId:r.userId,groupId:r.groupId})),p=t??((d,u="_self")=>{window.open(d,u);});return U.useEffect(()=>()=>{var d;(d=s.current)==null||d.destroy();},[]),jsxRuntime.jsxs(B.Provider,{value:{modals:a,setModals:i,navigate:p,...r,frigade:s.current},children:[jsxRuntime.jsx(react.Global,{styles:{":root":{...de,...n}}}),jsxRuntime.jsx(react.ThemeProvider,{theme:c,children:e})]})}function F(e,t){let[o,r]=U.useState(),[n,a]=U.useState(""),{frigade:i}=U.useContext(B),s=p=>{p.id===e&&(t!=null&&t.variables&&p.applyVariables(t.variables),r(p),a(Math.random().toString()));};return U.useEffect(()=>((async()=>{let p=await i.getFlow(e);if(!p||i.hasFailedToLoad()){r(void 0);return}t!=null&&t.variables&&p.applyVariables(t.variables),r(p);})(),i.onStateChange(s),()=>{i.removeStateChangeHandler(s);}),[]),{flow:o}}function R(e,{onComplete:t,onDismiss:o}={}){let r=U.useRef(null);return U.useEffect(()=>{e!=null&&(e.isCompleted&&r.current===!1&&(async()=>await(t==null?void 0:t(e)))(),r.current=e==null?void 0:e.isCompleted);},[e==null?void 0:e.isCompleted]),{handleDismiss:U.useCallback(async n=>{if(await(o==null?void 0:o(e,n))===!1)return n.preventDefault(),!1;await e.skip();},[e])}}function k(e,{onPrimary:t,onSecondary:o}={}){let{navigate:r}=U.useContext(B);return {handlePrimary:U.useCallback(async n=>{if(await(t==null?void 0:t(e,n))===!1)return n.preventDefault(),!1;await e.complete(),e.primaryButtonUri!=null&&r(e.primaryButtonUri,e.primaryButtonUriTarget);},[e]),handleSecondary:U.useCallback(async n=>{if(await(o==null?void 0:o(e,n))===!1)return n.preventDefault(),!1;await e.complete(),e.secondaryButtonUri!=null&&r(e.secondaryButtonUri,e.secondaryButtonUriTarget);},[e])}}function Qt({flowId:e,onComplete:t,onDismiss:o,onPrimary:r,onSecondary:n,variables:a}){let{flow:i}=F(e,{variables:a}),s=i==null?void 0:i.getCurrentStep(),{handleDismiss:p}=R(i,{onComplete:t,onDismiss:o}),{handlePrimary:d,handleSecondary:u}=k(s,{onPrimary:r,onSecondary:n});return i==null||i.isVisible===!1?null:(i.start(),s==null||s.start(),jsxRuntime.jsxs(x,{children:[jsxRuntime.jsx(x.Close,{onClick:p}),jsxRuntime.jsx(x.Title,{children:s.title}),jsxRuntime.jsx(x.Subtitle,{children:s.subtitle}),jsxRuntime.jsx(x.Media,{src:s.imageUri,css:{aspectRatio:"1.5",objectFit:"cover",width:"100%"}}),jsxRuntime.jsx(x.ProgressDots,{current:i.getNumberOfCompletedSteps(),total:i.getNumberOfAvailableSteps()}),jsxRuntime.jsxs(S.Row,{css:{"& > button":{flexGrow:1}},gap:3,children:[jsxRuntime.jsx(x.Secondary,{title:"Secondary",onClick:u}),jsxRuntime.jsx(x.Primary,{title:"Primary",onClick:d})]})]}))}function eo({flowId:e,onComplete:t,onDismiss:o,onPrimary:r,onSecondary:n,...a}){let{flow:i}=F(e),s=i==null?void 0:i.getCurrentStep(),{handleDismiss:p}=R(i,{onComplete:t,onDismiss:o}),{handlePrimary:d,handleSecondary:u}=k(s,{onPrimary:r,onSecondary:n});return i==null||i.isVisible===!1?null:(i.start(),s==null||s.start(),jsxRuntime.jsxs(v,{as:S.Row,border:"md",borderColor:"gray900",justifyContent:"space-between",...a,children:[jsxRuntime.jsxs(S.Row,{gap:3,children:[jsxRuntime.jsx("img",{src:s.imageUri,style:{height:40,width:40,alignSelf:"center"}}),jsxRuntime.jsxs(S.Column,{children:[jsxRuntime.jsx(b.H4,{mb:1,children:s.title}),jsxRuntime.jsx(b.Body2,{children:s.subtitle})]})]}),jsxRuntime.jsxs(S.Row,{alignItems:"center",gap:3,children:[jsxRuntime.jsx(T.Secondary,{title:s.secondaryButtonTitle,onClick:u}),jsxRuntime.jsx(T.Primary,{title:s.primaryButtonTitle,onClick:d}),jsxRuntime.jsx(T.Plain,{part:"banner-close",onClick:p,children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})})]})]}))}function J(){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]=U.useState(e),[r,n]=U.useState(null),a=U.useCallback(i=>{n(i);},[]);return U.useLayoutEffect(()=>{r&&o(r.getBoundingClientRect());},[r]),{node:r,rect:t,ref:a}}var no=react.keyframes({"0%":{opacity:.5,transform:"scale(0.5)"},"50%":{opacity:0,transform:"scale(1)"},"100%":{opacity:0,transform:"scale(1)"}});function Ae({style:e={},part:t="",...o}){return jsxRuntime.jsxs(m,{part:`dot-wrapper ${t}`,style:{height:"48px",position:"absolute",width:"48px",...e},...o,children:[jsxRuntime.jsx(m,{backgroundColor:"primary.surface",part:"dot-pulse",css:{animation:`2s ease-out infinite ${no}`,borderRadius:"24px",height:"48px",left:0,position:"absolute",top:0,transformOrigin:"center center",width:"48px"}}),jsxRuntime.jsx(m,{backgroundColor:"primary.surface",part:"dot",style:{borderRadius:"12px",height:"24px",left:"12px",position:"absolute",top:"12px",width:"24px"}})]})}function $e({props:e,alignAttr:t,sideAttr:o}){let r=o??"bottom",n={},a=()=>{if(["after","before"].includes(e.align)){if(t=="start")return "before";if(t=="end")return "after"}return e.align??"after"},i="-24px",s={top:"bottom",right:"left",bottom:"top",left:"right"};n[s[r]]=i;let p=a();return ["before","end"].includes(p)?["top","bottom"].includes(r)?n.right=i:n.bottom=i:["after","start"].includes(p)?["top","bottom"].includes(r)?n.left=i:n.top=i:["top","bottom"].includes(r)?n.left=`calc(50% + ${i})`:n.top=`calc(50% + ${i})`,n}var We={content:["align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","forceMount","hideWhenDetached","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenAutoFocus","onPointerDownOutside","side","sideOffset","sticky"],root:["defaultOpen","modal","onOpenChange","open"]};function Ve(e,t){let o=Object.fromEntries(We.content.map(n=>[n,e[n]]).filter(n=>n[1]!==void 0)),r=Object.fromEntries(We.root.map(n=>[n,e[n]]).filter(n=>n[1]!==void 0));if(o.align=o.align??"after",o.side=o.side??"bottom",["before","after"].includes(o.align)){let n={after:"end",before:"start"},a=(P,E)=>["top","bottom"].includes(E)?P=="after"?"marginLeft":"marginRight":P=="after"?"marginTop":"marginBottom",i=o.alignOffset??0,s=o.style??{},p=o.side??"bottom",d=o.align;o.style={...s,[a(d,p)]:i};let u=["top","bottom"].includes(p)?t.width:t.height;o.alignOffset=(u+i)*-1,o.align=n[d];}return {contentProps:o,rootProps:r}}function f({anchor:e,children:t,className:o,spotlight:r=!1,style:n,...a}){let{node:i,rect:s,ref:p}=J(),{contentProps:d,rootProps:u}=Ve(a,s),[P,E]=U.useState(d.align),[Y,Ke]=U.useState(d.side);if(i!==null){let M=i.getAttribute("data-align"),ee=i.getAttribute("data-side");P!==M&&E(M),Y!==ee&&Ke(ee);}let Q=U.useRef(null),[W,je]=U.useState(null);if(U.useEffect(()=>{let M=document.querySelector(e);M!=null&&(Q.current=M,je(Q));},[e]),W==null)return null;let V=W.current.getBoundingClientRect(),Z="0";typeof window<"u"&&(Z=window.getComputedStyle(W.current).borderRadius);let Ne=$e({props:a,alignAttr:P,sideAttr:Y});return jsxRuntime.jsxs(C__namespace.Root,{defaultOpen:!0,...u,children:[jsxRuntime.jsx(C__namespace.Anchor,{virtualRef:W}),jsxRuntime.jsx(C__namespace.Portal,{children:jsxRuntime.jsxs("div",{className:o,css:{bottom:0,left:0,position:"absolute",right:0,top:0,zIndex:9999},children:[r&&jsxRuntime.jsx(m,{part:"tooltip-spotlight",position:"absolute",css:{borderRadius:Z,boxShadow:"0 0 0 2000px rgb(0 0 0 / 0.5)",height:V.height,left:V.left,top:V.top,width:V.width}}),jsxRuntime.jsx(C__namespace.Content,{asChild:!0,...d,ref:p,children:jsxRuntime.jsxs(v,{boxShadow:"md",part:"tooltip-content",position:"relative",css:{maxWidth:"360px",...n},children:[jsxRuntime.jsx(Ae,{style:Ne}),t]})})]})})]})}f.Close=e=>jsxRuntime.jsx(C__namespace.Close,{"aria-label":"Close",asChild:!0,children:jsxRuntime.jsx(T.Plain,{css:{top:"12px",right:"4px"},part:"close",position:"absolute",...e,children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})})});f.Media=({src:e,...t})=>e==null?null:jsxRuntime.jsx($,{borderRadius:"md md 0 0",borderWidth:"0",css:{aspectRatio:"2"},margin:"-5 -5 5",src:e,...t});f.Primary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(T.Primary,{title:t,onClick:e,...o});f.Progress=({children:e,...t})=>e==null?null:jsxRuntime.jsx(b.Body2,{fontWeight:"demibold",part:"progress",...t,children:e});f.Secondary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(T.Secondary,{title:t,onClick:e,...o});f.Subtitle=({children:e,...t})=>e==null?null:jsxRuntime.jsx(b.Body2,{part:"subtitle",...t,children:e});f.Title=({children:e,...t})=>e==null?null:jsxRuntime.jsx(b.Body1,{fontWeight:"bold",mb:1,part:"title",...t,children:e});function q(e){let{modals:t,setModals:o}=U.useContext(B),[r,n]=U.useState(!1);return U.useEffect(()=>(o([...t,e]),()=>o(t.filter(a=>a!==e))),[]),U.useEffect(()=>{let a=t[0]===e;a!==r&&n(a);},[t]),{isCurrentModal:r}}function ze({step:e,flow:t,onDismiss:o,onPrimary:r,onSecondary:n,...a}){let{isCurrentModal:i}=q(`${t.id}-${e.id}`),{handleDismiss:s}=R(t,{onDismiss:o}),{handlePrimary:p,handleSecondary:d}=k(e,{onPrimary:r,onSecondary:n});return i?jsxRuntime.jsxs(f,{anchor:e.selector,onOpenAutoFocus:u=>u.preventDefault(),onPointerDownOutside:u=>u.preventDefault(),...a,children:[jsxRuntime.jsx(f.Close,{onClick:s}),jsxRuntime.jsx(f.Media,{src:e.videoUri??e.imageUri,type:e.videoUri?"video":"image"}),jsxRuntime.jsx(f.Title,{children:e.title}),jsxRuntime.jsx(f.Subtitle,{children:e.subtitle}),jsxRuntime.jsxs(S.Row,{alignItems:"center",gap:3,justifyContent:"flex-end",part:"tooltip-footer",pt:4,children:[jsxRuntime.jsx(f.Progress,{children:`${t.getNumberOfCompletedSteps()+1}/${t.getNumberOfAvailableSteps()}`}),jsxRuntime.jsx(f.Secondary,{marginLeft:"auto",title:e.secondaryButtonTitle,onClick:d}),jsxRuntime.jsx(f.Primary,{title:e.primaryButtonTitle,onClick:p})]})]},e.id):null}function uo({flowId:e,onComplete:t,variables:o,...r}){let{flow:n}=F(e,{variables:o});if(R(n,{onComplete:t}),n==null||n.isVisible===!1)return null;n.start();let a=n.getCurrentStep();return a==null||a.start(),jsxRuntime.jsx(ze,{step:a,flow:n,...r})}function go(){let{frigade:e}=U.useContext(B);return {frigade:e}}
|
|
41
41
|
|
|
42
|
-
exports.Announcement =
|
|
43
|
-
exports.Banner =
|
|
44
|
-
exports.Box =
|
|
45
|
-
exports.Button =
|
|
42
|
+
exports.Announcement = Qt;
|
|
43
|
+
exports.Banner = eo;
|
|
44
|
+
exports.Box = m;
|
|
45
|
+
exports.Button = T;
|
|
46
46
|
exports.Card = v;
|
|
47
|
-
exports.Flex =
|
|
48
|
-
exports.Provider =
|
|
49
|
-
exports.Text =
|
|
50
|
-
exports.Tooltip =
|
|
51
|
-
exports.Tour =
|
|
47
|
+
exports.Flex = S;
|
|
48
|
+
exports.Provider = Nt;
|
|
49
|
+
exports.Text = b;
|
|
50
|
+
exports.Tooltip = f;
|
|
51
|
+
exports.Tour = uo;
|
|
52
52
|
exports.useBoundingClientRect = J;
|
|
53
53
|
exports.useFlow = F;
|
|
54
|
-
exports.useFlowHandlers =
|
|
55
|
-
exports.useFrigade =
|
|
54
|
+
exports.useFlowHandlers = R;
|
|
55
|
+
exports.useFrigade = go;
|
|
56
56
|
exports.useModal = q;
|
|
57
57
|
exports.useStepHandlers = k;
|
|
58
58
|
//# sourceMappingURL=out.js.map
|