@frigade/react 2.0.0-alpha.7 → 2.0.0-alpha.8
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/README.md +541 -4
- package/dist/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +203 -6
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -29,19 +29,216 @@ declare const Flex: {
|
|
|
29
29
|
Row: React$1.ForwardRefExoticComponent<Omit<any, "ref"> & React$1.RefAttributes<unknown>>;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
+
declare const tokens: {
|
|
33
|
+
radii: {
|
|
34
|
+
md: string;
|
|
35
|
+
lg: string;
|
|
36
|
+
round: string;
|
|
37
|
+
};
|
|
38
|
+
shadows: {
|
|
39
|
+
md: string;
|
|
40
|
+
};
|
|
41
|
+
space: {
|
|
42
|
+
0: string;
|
|
43
|
+
4: string;
|
|
44
|
+
20: string;
|
|
45
|
+
[-20]: string;
|
|
46
|
+
19: string;
|
|
47
|
+
[-19]: string;
|
|
48
|
+
18: string;
|
|
49
|
+
[-18]: string;
|
|
50
|
+
17: string;
|
|
51
|
+
[-17]: string;
|
|
52
|
+
16: string;
|
|
53
|
+
[-16]: string;
|
|
54
|
+
15: string;
|
|
55
|
+
[-15]: string;
|
|
56
|
+
14: string;
|
|
57
|
+
[-14]: string;
|
|
58
|
+
13: string;
|
|
59
|
+
[-13]: string;
|
|
60
|
+
12: string;
|
|
61
|
+
[-12]: string;
|
|
62
|
+
11: string;
|
|
63
|
+
[-11]: string;
|
|
64
|
+
10: string;
|
|
65
|
+
[-10]: string;
|
|
66
|
+
9: string;
|
|
67
|
+
[-9]: string;
|
|
68
|
+
8: string;
|
|
69
|
+
[-8]: string;
|
|
70
|
+
7: string;
|
|
71
|
+
[-7]: string;
|
|
72
|
+
6: string;
|
|
73
|
+
[-6]: string;
|
|
74
|
+
5: string;
|
|
75
|
+
[-5]: string;
|
|
76
|
+
[-4]: string;
|
|
77
|
+
3: string;
|
|
78
|
+
[-3]: string;
|
|
79
|
+
2: string;
|
|
80
|
+
[-2]: string;
|
|
81
|
+
1: string;
|
|
82
|
+
[-1]: string;
|
|
83
|
+
0.5: string;
|
|
84
|
+
[-0.5]: string;
|
|
85
|
+
auto: string;
|
|
86
|
+
};
|
|
87
|
+
fontFamilies: {
|
|
88
|
+
default: string;
|
|
89
|
+
};
|
|
90
|
+
fontSizes: {
|
|
91
|
+
xs: string;
|
|
92
|
+
sm: string;
|
|
93
|
+
md: string;
|
|
94
|
+
lg: string;
|
|
95
|
+
xl: string;
|
|
96
|
+
'2xl': string;
|
|
97
|
+
'3xl': string;
|
|
98
|
+
'4xl': string;
|
|
99
|
+
'5xl': string;
|
|
100
|
+
};
|
|
101
|
+
fontWeights: {
|
|
102
|
+
thin: string;
|
|
103
|
+
extralight: string;
|
|
104
|
+
light: string;
|
|
105
|
+
regular: string;
|
|
106
|
+
medium: string;
|
|
107
|
+
demibold: string;
|
|
108
|
+
bold: string;
|
|
109
|
+
extrabold: string;
|
|
110
|
+
black: string;
|
|
111
|
+
};
|
|
112
|
+
letterSpacings: {
|
|
113
|
+
md: string;
|
|
114
|
+
};
|
|
115
|
+
lineHeights: {
|
|
116
|
+
xs: string;
|
|
117
|
+
sm: string;
|
|
118
|
+
md: string;
|
|
119
|
+
lg: string;
|
|
120
|
+
xl: string;
|
|
121
|
+
'2xl': string;
|
|
122
|
+
'3xl': string;
|
|
123
|
+
'4xl': string;
|
|
124
|
+
};
|
|
125
|
+
colors: {
|
|
126
|
+
neutral: {
|
|
127
|
+
background: string;
|
|
128
|
+
border: string;
|
|
129
|
+
foreground: string;
|
|
130
|
+
surface: string;
|
|
131
|
+
active: {
|
|
132
|
+
background: string;
|
|
133
|
+
border: string;
|
|
134
|
+
foreground: string;
|
|
135
|
+
surface: string;
|
|
136
|
+
};
|
|
137
|
+
focus: {
|
|
138
|
+
background: string;
|
|
139
|
+
border: string;
|
|
140
|
+
foreground: string;
|
|
141
|
+
surface: string;
|
|
142
|
+
};
|
|
143
|
+
hover: {
|
|
144
|
+
background: string;
|
|
145
|
+
border: string;
|
|
146
|
+
foreground: string;
|
|
147
|
+
surface: string;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
primary: {
|
|
151
|
+
background: string;
|
|
152
|
+
border: string;
|
|
153
|
+
foreground: string;
|
|
154
|
+
surface: string;
|
|
155
|
+
active: {
|
|
156
|
+
background: string;
|
|
157
|
+
border: string;
|
|
158
|
+
foreground: string;
|
|
159
|
+
surface: string;
|
|
160
|
+
};
|
|
161
|
+
focus: {
|
|
162
|
+
background: string;
|
|
163
|
+
border: string;
|
|
164
|
+
foreground: string;
|
|
165
|
+
surface: string;
|
|
166
|
+
};
|
|
167
|
+
hover: {
|
|
168
|
+
background: string;
|
|
169
|
+
border: string;
|
|
170
|
+
foreground: string;
|
|
171
|
+
surface: string;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
secondary: {
|
|
175
|
+
background: string;
|
|
176
|
+
border: string;
|
|
177
|
+
foreground: string;
|
|
178
|
+
surface: string;
|
|
179
|
+
active: {
|
|
180
|
+
background: string;
|
|
181
|
+
border: string;
|
|
182
|
+
foreground: string;
|
|
183
|
+
surface: string;
|
|
184
|
+
};
|
|
185
|
+
focus: {
|
|
186
|
+
background: string;
|
|
187
|
+
border: string;
|
|
188
|
+
foreground: string;
|
|
189
|
+
surface: string;
|
|
190
|
+
};
|
|
191
|
+
hover: {
|
|
192
|
+
background: string;
|
|
193
|
+
border: string;
|
|
194
|
+
foreground: string;
|
|
195
|
+
surface: string;
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
black: string;
|
|
199
|
+
gray100: string;
|
|
200
|
+
gray200: string;
|
|
201
|
+
gray300: string;
|
|
202
|
+
gray400: string;
|
|
203
|
+
gray500: string;
|
|
204
|
+
gray600: string;
|
|
205
|
+
gray700: string;
|
|
206
|
+
gray800: string;
|
|
207
|
+
gray900: string;
|
|
208
|
+
white: string;
|
|
209
|
+
blue400: string;
|
|
210
|
+
blue500: string;
|
|
211
|
+
blue800: string;
|
|
212
|
+
blue900: string;
|
|
213
|
+
green400: string;
|
|
214
|
+
green500: string;
|
|
215
|
+
green800: string;
|
|
216
|
+
transparent: string;
|
|
217
|
+
inherit: string;
|
|
218
|
+
red500: string;
|
|
219
|
+
};
|
|
220
|
+
borders: {
|
|
221
|
+
md: string;
|
|
222
|
+
};
|
|
223
|
+
borderWidths: {
|
|
224
|
+
0: string;
|
|
225
|
+
md: string;
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
type Tokens = typeof tokens;
|
|
229
|
+
|
|
230
|
+
type Theme = Partial<Tokens>;
|
|
231
|
+
|
|
32
232
|
type NavigateHandler = (url: string, target?: string) => void;
|
|
33
233
|
interface ProviderProps {
|
|
34
234
|
apiKey: string;
|
|
235
|
+
apiUrl?: string;
|
|
35
236
|
children?: React.ReactNode;
|
|
36
|
-
config?: ProviderConfig;
|
|
37
237
|
navigate?: NavigateHandler;
|
|
38
|
-
theme?:
|
|
39
|
-
}
|
|
40
|
-
interface ProviderConfig {
|
|
41
|
-
apiUrl?: string;
|
|
238
|
+
theme?: Theme;
|
|
42
239
|
userId?: string;
|
|
43
240
|
}
|
|
44
|
-
declare function Provider({
|
|
241
|
+
declare function Provider({ children, navigate, theme, ...props }: ProviderProps): react_jsx_runtime.JSX.Element;
|
|
45
242
|
|
|
46
243
|
type TextVariant = 'Display1' | 'Display2' | 'H1' | 'H2' | 'H3' | 'H4' | 'Body1' | 'Body2' | 'Caption';
|
|
47
244
|
interface TextProps extends BoxProps {
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import * as
|
|
2
|
+
import * as _ from 'react';
|
|
3
3
|
import { createContext, useState, useRef, useEffect, useCallback, useLayoutEffect, useContext } from 'react';
|
|
4
4
|
import { clsx } from 'clsx';
|
|
5
5
|
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
@@ -8,8 +8,8 @@ import { XMarkIcon } from '@heroicons/react/24/solid';
|
|
|
8
8
|
import * as v from '@radix-ui/react-popover';
|
|
9
9
|
import { Frigade } from '@frigade/js';
|
|
10
10
|
|
|
11
|
-
var ee=Object.defineProperty,Ie=Object.defineProperties;var Ve=Object.getOwnPropertyDescriptors;var $=Object.getOwnPropertySymbols;var te=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable;var Z=(e,t,o)=>t in e?ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,s=(e,t)=>{for(var o in t||(t={}))te.call(t,o)&&Z(e,o,t[o]);if($)for(var o of $(t))oe.call(t,o)&&Z(e,o,t[o]);return e},p=(e,t)=>Ie(e,Ve(t));var f=(e,t)=>{var o={};for(var r in e)te.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&$)for(var r of $(e))t.indexOf(r)<0&&oe.call(e,r)&&(o[r]=e[r]);return o};var re=(e,t)=>{for(var o in t)ee(e,o,{get:t[o],enumerable:!0});};var T=(e,t,o)=>new Promise((r,n)=>{var i=u=>{try{d(o.next(u));}catch(c){n(c);}},l=u=>{try{d(o.throw(u));}catch(c){n(c);}},d=u=>u.done?r(u.value):Promise.resolve(u.value).then(i,l);d((o=o.apply(e,t)).next());});var We="px",$e=e=>typeof e=="number"?`${4*e}${We}`: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"],Le=Object.fromEntries(je.map(e=>[e,$e(e)])),ze={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"},L={borders:{md:"1px solid"},borderWidths:{0:"0",md:"1px"},colors:s({},ze),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"},radii:{md:"10px",lg:"20px",round:"50%"},shadows:{md:"0px 4px 20px rgba(0, 0, 0, 0.1)"},space:Le};var a=e=>`var(--fr-colors-${e})`,ne={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 z=p(s({},L),{colors:s(s({},L.colors),ne)});function k(e,t="",o="."){return Object.keys(e).reduce((r,n)=>{let l=`${t.length?`${t}${o}`:""}${n}`,d=e[n];return typeof d=="object"&&d!==null&&!Array.isArray(d)?Object.assign(r,k(d,l,o)):r[l]=d,r},{})}function K(e){return k(e,"--fr","-")}function ie(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]=ie(n,`${t}-${r}`):o[r]=`var(${t}-${r})`;}),o}var se=K(z),m=ie(z);var U=k(m.colors),ae={color:U,backgroundColor:U,borderColor:U,border:m.borders,borderRadius:m.radii,borderWidth:m.borderWidths,fontFamily:m.fontFamilies,fontSize:m.fontSizes,fontWeight:m.fontWeights,gap:m.space,lineHeight:m.lineHeights,margin:m.space,marginTop:m.space,marginRight:m.space,marginBottom:m.space,marginLeft:m.space,padding:m.space,paddingTop:m.space,paddingRight:m.space,paddingBottom:m.space,paddingLeft:m.space,alignContent:["center","start","end","flex-start","flex-end","normal","baseline","first baseline","last baseline","space-between","space-around","space-evenly","stretch","safe center","unsafe center","inherit","initial","revert","revert-layer","unset"],alignItems:["normal","stretch","center","start","end","flex-start","flex-end","self-start","self-end","baseline","first baseline","last baseline","safe center","unsafe center","inherit","initial","revert","revert-layer","unset"],alignSelf:["auto","normal","center","start","end","self-start","self-end","flex-start","flex-end","baseline","first baseline","last baseline","stretch","safe center","unsafe center","inherit","initial","revert","revert-layer","unset"],flexDirection:["row","row-reverse","column","column-reverse","inherit","initial","revert","revert-layer","unset"],flexWrap:["nowrap","wrap","wrap-reverse","inherit","initial","revert","revert-layer","unset"],justifyContent:["center","start","end","flex-start","flex-end","left","right","normal","space-between","space-around","space-evenly","stretch","safe center","unsafe center","inherit","initial","revert","revert-layer","unset"],justifyItems:["normal","stretch","center","start","end","flex-start","flex-end","self-start","self-end","left","right","baseline","first baseline","last baseline","safe center","unsafe center","legacy right","legacy left","legacy center","inherit","initial","revert","revert-layer","unset"],boxSizing:["border-box","content-box","inherit","initial","revert","revert-layer","unset"],position:["static","relative","absolute","fixed","sticky","inherit","initial","revert","revert-layer","unset"],display:["block","block flex","block flow","block flow-root","block grid","contents","flex","flow-root","grid","inherit","initial","inline","inline flex","inline flow","inline flow-root","inline grid","inline-block","inline-flex","inline-grid","list-item","none","revert","revert-layer","table","table-row-group","table-header-group","table-footer-group","table-row","table-cell","table-column-group","table-column","table-caption","unset"]},le={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 Ke(e){if(Array.isArray(e))return new Map(e.map(t=>[t,t]));if(typeof e=="object"&&e!==null)return new Map(Object.entries(e));if(["string","number"].includes(typeof e))return new Map([e,e]);throw new Error("Invalid entry in styleProps")}var Ue=new Map(Object.entries(ae).map(([e,t])=>[e,Ke(t)])),Ne=new Map(Object.entries(le).map(([e,t])=>[e,new Set(t)]));function pe(e){let t=Object.assign({},e),o={};return Object.entries(t).forEach(([r,n])=>{let i=Ne.get(r);i!=null&&(i.forEach(l=>{t[l]=n;}),delete t[r]);}),Object.entries(t).forEach(([r,n])=>{let i=Ue.get(r);if(i!=null)if(typeof n=="string"&&n.indexOf(" ")>-1){let l=n.split(" ");o[r]=l.map(d=>{var u;return (u=i.get(d.toString()))!=null?u:d}).join(" "),delete t[r];}else i.has(n.toString())&&(o[r]=i.get(n.toString()),delete t[r]);}),{cssFromProps:o,unmatchedProps:t}}function ce(e){return e&&`fr-${e}`}function Xe(e){return e&&(Array.isArray(e)?e.map(t=>ce(t)).join(" "):ce(e))}function qe(l,i){var d=l,{as:e,children:t,className:o,part:r}=d,n=f(d,["as","children","className","part"]);let u=e!=null?e:"div",{cssFromProps:c,unmatchedProps:y}=pe(n),h=Xe(r),w=o||h?clsx(o,h):void 0;return jsx(u,p(s({className:w,css:[{boxSizing:"border-box"},c]},y),{ref:i,children:t}))}var g=X.forwardRef(qe);var N={};re(N,{Body1:()=>ot,Body2:()=>rt,Caption:()=>nt,Display1:()=>Je,Display2:()=>Qe,H1:()=>Ye,H2:()=>Ze,H3:()=>et,H4:()=>tt});var C={color:"neutral.foreground",fontFamily:"default",margin:0},Je=p(s({},C),{fontSize:"5xl",fontWeight:"bold",lineHeight:"4xl"}),Qe=p(s({},C),{fontSize:"4xl",fontWeight:"bold",lineHeight:"3xl"}),Ye=p(s({},C),{fontSize:"3xl",fontWeight:"bold",lineHeight:"2xl"}),Ze=p(s({},C),{fontSize:"2xl",fontWeight:"bold",lineHeight:"xl"}),et=p(s({},C),{fontSize:"xl",fontWeight:"bold",lineHeight:"lg"}),tt=p(s({},C),{fontSize:"lg",fontWeight:"bold",lineHeight:"md"}),ot=p(s({},C),{fontSize:"md",fontWeight:"regular",lineHeight:"md"}),rt=p(s({},C),{fontSize:"sm",fontWeight:"regular",lineHeight:"md"}),nt=p(s({},C),{fontSize:"xs",fontWeight:"regular",lineHeight:"sm"});function fe(n){var i=n,{as:e="span",children:t,variant:o="Body1"}=i,r=f(i,["as","children","variant"]);return jsx(g,p(s(s({as:e},N[o]),r),{children:t}))}var it=["Display1","Display2","H1","H2","H3","H4","Body1","Body2","Caption"],st=Object.fromEntries(it.map(e=>{let t=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():void 0,o=r=>jsx(fe,p(s({as:t},r),{variant:e,children:r.children}));return o.displayName=`Text.${e}`,[e,o]})),S=Object.assign(fe,st);var _={};re(_,{Link:()=>pt,Plain:()=>ct,Primary:()=>at,Secondary:()=>lt,base:()=>O});var O=({radii:e,space:t})=>({borderWidth:0,borderRadius:e.md,padding:`${t[2]} ${t[4]}`}),at=({colors:e})=>[O,{backgroundColor:e.primary.surface,color:e.primary.foreground,"&:hover":{backgroundColor:e.primary.hover.surface}}],lt=({colors:e})=>[O,{backgroundColor:e.secondary.surface,color:e.secondary.foreground,"&:hover":{backgroundColor:e.secondary.hover.surface}}],pt=({colors:e})=>[O,{backgroundColor:e.transparent,color:e.primary.surface,"&:hover":{color:e.primary.hover.surface}}],ct=({colors:e})=>[O,{backgroundColor:e.transparent,color:e.neutral.foreground}];function me(i){var l=i,{as:e,children:t,title:o,variant:r="Primary"}=l,n=f(l,["as","children","title","variant"]);return jsxs(g,p(s({as:e!=null?e:"button",css:_[r]},n),{children:[t,o&&jsx(S.Body2,{fontWeight:"demibold",color:"inherit",children:o})]}))}var dt=["Primary","Secondary","Link","Plain"],ft=Object.fromEntries(dt.map(e=>{let t=e.toLocaleLowerCase(),o=i=>{var l=i,{part:r}=l,n=f(l,["part"]);return jsx(me,p(s({part:[`button-${t}`,r]},n),{variant:e,children:n.children}))};return o.displayName=`Text.${e}`,[e,o]})),H=Object.assign(me,ft);var mt=X.forwardRef((n,r)=>{var i=n,{children:e,css:t}=i,o=f(i,["children","css"]);return jsx(g,p(s({css:[{display:"flex",flexDirection:"row"},t]},o),{ref:r,children:e}))}),gt=X.forwardRef((n,r)=>{var i=n,{children:e,css:t}=i,o=f(i,["children","css"]);return jsx(g,p(s({css:[{display:"flex",flexDirection:"column"},t]},o),{ref:r,children:e}))}),E={Column:gt,Row:mt};var B=createContext({apiKey:"",config:{},modals:[],setModals:()=>{},navigate:()=>{}});function Pt({apiKey:e,children:t,config:o={},navigate:r,theme:n}){let i=n?K(n):{},[l,d]=useState([]),u=r!=null?r:(c,y="_self")=>{window.open(c,y);};return jsxs(B.Provider,{value:{apiKey:e,config:o,modals:l,setModals:d,navigate:u},children:[jsx(Global,{styles:{":root":s(s({},se),i)}}),jsx(ThemeProvider,{theme:m,children:t})]})}function he(){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]=useState(e),[r,n]=useState(null),i=useCallback(l=>{n(l);},[]);return useLayoutEffect(()=>{r&&o(r.getBoundingClientRect());},[r]),{node:r,rect:t,ref:i}}var St=keyframes({"0%":{opacity:.5,transform:"scale(0.5)"},"50%":{opacity:0,transform:"scale(1)"},"100%":{opacity:0,transform:"scale(1)"}});function ve(r){var n=r,{style:e={},part:t=""}=n,o=f(n,["style","part"]);return jsxs(g,p(s({part:`dot-wrapper ${t}`,style:s({height:"48px",position:"absolute",width:"48px"},e)},o),{children:[jsx(g,{backgroundColor:"primary.surface",part:"dot-pulse",css:{animation:`2s ease-out infinite ${St}`,borderRadius:"24px",height:"48px",left:0,position:"absolute",top:0,transformOrigin:"center center",width:"48px"}}),jsx(g,{backgroundColor:"primary.surface",part:"dot",style:{borderRadius:"12px",height:"24px",left:"12px",position:"absolute",top:"12px",width:"24px"}})]}))}function Ce(r){var n=r,{part:e,src:t}=n,o=f(n,["part","src"]);return jsx(g,s({as:"img",part:["image",e],src:t},o))}function Ft(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 we(r){var n=r,{part:e,src:t}=n,o=f(n,["part","src"]);let i=Ft(t);return jsx(g,s({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 q(r){var n=r,{src:e,type:t}=n,o=f(n,["src","type"]);return jsx(t==="video"?we:Ce,s({src:e},o))}function Te({props:e,alignAttr:t,sideAttr:o}){let r=o!=null?o:"bottom",n={},i=()=>{var c;if(["after","before"].includes(e.align)){if(t=="start")return "before";if(t=="end")return "after"}return (c=e.align)!=null?c:"after"},l="-24px",d={top:"bottom",right:"left",bottom:"top",left:"right"};n[d[r]]=l;let u=i();return ["before","end"].includes(u)?["top","bottom"].includes(r)?n.right=l:n.bottom=l:["after","start"].includes(u)?["top","bottom"].includes(r)?n.left=l:n.top=l:["top","bottom"].includes(r)?n.left=`calc(50% + ${l})`:n.top=`calc(50% + ${l})`,n}var Se={content:["align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","forceMount","hideWhenDetached","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenAutoFocus","onPointerDownOutside","side","sideOffset","sticky"],root:["defaultOpen","modal","onOpenChange","open"]};function Be(e,t){var n,i,l,d,u;let o=Object.fromEntries(Se.content.map(c=>[c,e[c]]).filter(c=>c[1]!==void 0)),r=Object.fromEntries(Se.root.map(c=>[c,e[c]]).filter(c=>c[1]!==void 0));if(o.align=(n=o.align)!=null?n:"after",o.side=(i=o.side)!=null?i:"bottom",["before","after"].includes(o.align)){let c={after:"end",before:"start"},y=(A,I)=>["top","bottom"].includes(I)?A=="after"?"marginLeft":"marginRight":A=="after"?"marginTop":"marginBottom",h=(l=o.alignOffset)!=null?l:0,w=(d=o.style)!=null?d:{},P=(u=o.side)!=null?u:"bottom",M=o.align;o.style=p(s({},w),{[y(M,P)]:h});let D=["top","bottom"].includes(P)?t.width:t.height;o.alignOffset=(D+h)*-1,o.align=c[M];}return {contentProps:o,rootProps:r}}function x(l){var d=l,{anchor:e,children:t,className:o,spotlight:r=!1,style:n}=d,i=f(d,["anchor","children","className","spotlight","style"]);let{node:u,rect:c,ref:y}=he(),{contentProps:h,rootProps:w}=Be(i,c),[P,M]=useState(h.align),[D,A]=useState(h.side);if(u!==null){let F=u.getAttribute("data-align"),Y=u.getAttribute("data-side");P!==F&&M(F),D!==Y&&A(Y);}let I=useRef(null),[V,De]=useState(null);if(useEffect(()=>{let F=document.querySelector(e);F!=null&&(I.current=F,De(I));},[e]),V==null)return null;let W=V.current.getBoundingClientRect(),Q="0";typeof window!="undefined"&&(Q=window.getComputedStyle(V.current).borderRadius);let Ae=Te({props:i,alignAttr:P,sideAttr:D});return jsxs(v.Root,p(s({defaultOpen:!0},w),{children:[jsx(v.Anchor,{virtualRef:V}),jsx(v.Portal,{children:jsxs("div",{className:o,css:{position:"absolute",zIndex:9999},children:[r&&jsx(g,{borderRadius:Q,part:"tooltip-spotlight",position:"absolute",css:{boxShadow:"0 0 0 2000px rgb(0 0 0 / 0.5)",height:W.height,left:W.left,top:W.top,width:W.width}}),jsx(v.Content,p(s({asChild:!0},h),{ref:y,children:jsxs(E.Column,{backgroundColor:"neutral.background",borderRadius:"md",p:5,part:"tooltip-content",position:"relative",css:s({boxShadow:"0px 4px 20px rgba(0, 0, 0, 0.1)",maxWidth:"360px"},n),children:[jsx(ve,{style:Ae}),t]})}))]})})]}))}x.Close=e=>jsx(v.Close,{"aria-label":"Close",asChild:!0,children:jsx(H.Plain,p(s({css:{top:"12px",right:"4px"},part:"tooltip-close",position:"absolute"},e),{children:jsx(XMarkIcon,{height:"24",fill:"currentColor"})}))});x.Media=o=>{var r=o,{src:e}=r,t=f(r,["src"]);return e==null?null:jsx(q,s({borderRadius:"md md 0 0",borderWidth:"0",css:{aspectRatio:"2"},margin:"-5 -5 5",src:e},t))};x.Primary=r=>{var n=r,{onClick:e,title:t}=n,o=f(n,["onClick","title"]);return t==null?null:jsx(H.Primary,s({title:t,onClick:e},o))};x.Progress=o=>{var r=o,{children:e}=r,t=f(r,["children"]);return e==null?null:jsx(S.Body2,p(s({fontWeight:"demibold",part:"progress"},t),{children:e}))};x.Secondary=r=>{var n=r,{onClick:e,title:t}=n,o=f(n,["onClick","title"]);return t==null?null:jsx(H.Secondary,s({title:t,onClick:e},o))};x.Subtitle=o=>{var r=o,{children:e}=r,t=f(r,["children"]);return e==null?null:jsx(S.Body2,p(s({part:"subtitle"},t),{children:e}))};x.Title=o=>{var r=o,{children:e}=r,t=f(r,["children"]);return e==null?null:jsx(S.Body1,p(s({fontWeight:"bold",mb:1,part:"title"},t),{children:e}))};function Re(e){let[t,o]=useState(),{apiKey:r,config:n}=useContext(B),i=Object.fromEntries(Object.entries(n).filter(([c,y])=>["apiUrl","userId"].includes(c)&&y!=null)),d=useRef(new Frigade(r,i)).current,u=c=>{if(c.id!==e)return;let y=Object.assign(Object.create(Object.getPrototypeOf(c)),c);o(y);};return useEffect(()=>(T(this,null,function*(){let c=yield d.getFlow(e);o(c);}),d.onStateChange(u),()=>{d.removeStateChangeHandler(u);}),[]),{flow:t}}function ke(e){let{modals:t,setModals:o}=useContext(B),[r,n]=useState(!1);return useEffect(()=>(o([...t,e]),()=>o(t.filter(i=>i!==e))),[]),useEffect(()=>{let i=t[0]===e;i!==r&&n(i);},[t]),{isCurrentModal:r}}function j(e,{onComplete:t,onDismiss:o}={}){let r=useRef(null);return useEffect(()=>{e!=null&&(e.isCompleted&&r.current===!1&&t(e),r.current=e==null?void 0:e.isCompleted);},[e==null?void 0:e.isCompleted]),{handleDismiss:useCallback(n=>T(this,null,function*(){if((o==null?void 0:o(e,n))===!1)return n.preventDefault(),!1;yield e.skip();}),[e])}}function He(e,{onPrimary:t,onSecondary:o}={}){let{navigate:r}=useContext(B);return {handlePrimary:useCallback(n=>T(this,null,function*(){if((t==null?void 0:t(e,n))===!1)return n.preventDefault(),!1;yield e.complete(),e.primaryButtonUri!=null&&r(e.primaryButtonUri,e.primaryButtonUriTarget);}),[e]),handleSecondary:useCallback(n=>T(this,null,function*(){if((o==null?void 0:o(e,n))===!1)return n.preventDefault(),!1;yield e.complete(),e.secondaryButtonUri!=null&&r(e.secondaryButtonUri,e.secondaryButtonUriTarget);}),[e])}}function Me(l){var d=l,{step:e,flow:t,onDismiss:o,onPrimary:r,onSecondary:n}=d,i=f(d,["step","flow","onDismiss","onPrimary","onSecondary"]);var w;let{isCurrentModal:u}=ke(`${t.id}-${e.id}`),{handleDismiss:c}=j(t,{onDismiss:o}),{handlePrimary:y,handleSecondary:h}=He(e,{onPrimary:r,onSecondary:n});return u?jsxs(x,p(s({anchor:e.selector,onOpenAutoFocus:P=>P.preventDefault(),onPointerDownOutside:P=>P.preventDefault()},i),{children:[jsx(x.Close,{onClick:c}),jsx(x.Media,{src:(w=e.videoUri)!=null?w:e.imageUri,type:e.videoUri?"video":"image"}),jsx(x.Title,{children:e.title}),jsx(x.Subtitle,{children:e.subtitle}),jsxs(E.Row,{alignItems:"center",gap:3,justifyContent:"flex-end",part:"tooltip-footer",pt:4,children:[jsx(x.Progress,{children:`${(e==null?void 0:e.order)+1}/${t.steps.size}`}),jsx(x.Secondary,{marginLeft:"auto",title:e.secondaryButtonTitle,onClick:h}),jsx(x.Primary,{title:e.primaryButtonTitle,onClick:y})]})]}),e.id):null}function Nt(r){var n=r,{flowId:e,onComplete:t}=n,o=f(n,["flowId","onComplete"]);let{flow:i}=Re(e);if(j(i,{onComplete:t}),i==null||i.isVisible===!1)return null;i.start();let l=i.getCurrentStep();return l==null||l.start(),jsx(Me,s({step:l,flow:i},o))}
|
|
11
|
+
var Z=Object.defineProperty,Le=Object.defineProperties;var ze=Object.getOwnPropertyDescriptors;var $=Object.getOwnPropertySymbols;var ee=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable;var Y=(e,t,o)=>t in e?Z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,s=(e,t)=>{for(var o in t||(t={}))ee.call(t,o)&&Y(e,o,t[o]);if($)for(var o of $(t))te.call(t,o)&&Y(e,o,t[o]);return e},p=(e,t)=>Le(e,ze(t));var f=(e,t)=>{var o={};for(var r in e)ee.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&$)for(var r of $(e))t.indexOf(r)<0&&te.call(e,r)&&(o[r]=e[r]);return o};var oe=(e,t)=>{for(var o in t)Z(e,o,{get:t[o],enumerable:!0});};var C=(e,t,o)=>new Promise((r,n)=>{var i=u=>{try{c(o.next(u));}catch(d){n(d);}},l=u=>{try{c(o.throw(u));}catch(d){n(d);}},c=u=>u.done?r(u.value):Promise.resolve(u.value).then(i,l);c((o=o.apply(e,t)).next());});var re={borders:{md:"1px solid"},borderWidths:{0:"0",md:"1px"}};var ne={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 ie={md:"10px",lg:"20px",round:"50%"};var a=e=>`var(--fr-colors-${e})`,se={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 ae={md:"0px 4px 20px rgba(0, 0, 0, 0.1)"};var Ke="px",Ue=e=>typeof e=="number"?`${4*e}${Ke}`:e,Ne=[-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"],le=Object.fromEntries(Ne.map(e=>[e,Ue(e)]));var pe={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 L=p(s(p(s({},re),{colors:s(s({},ne),se)}),pe),{radii:ie,shadows:ae,space:le});function F(e,t="",o="."){return Object.keys(e).reduce((r,n)=>{let l=`${t.length?`${t}${o}`:""}${n}`,c=e[n];return typeof c=="object"&&c!==null&&!Array.isArray(c)?Object.assign(r,F(c,l,o)):r[l]=c,r},{})}function z(e){return F(e,"--fr","-")}function ce(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]=ce(n,`${t}-${r}`):o[r]=`var(${t}-${r})`;}),o}var de=z(L),m=ce(L);var K=F(m.colors),fe={color:K,backgroundColor:K,borderColor:K,border:m.borders,borderRadius:m.radii,borderWidth:m.borderWidths,fontFamily:m.fontFamilies,fontSize:m.fontSizes,fontWeight:m.fontWeights,gap:m.space,lineHeight:m.lineHeights,margin:m.space,marginTop:m.space,marginRight:m.space,marginBottom:m.space,marginLeft:m.space,padding:m.space,paddingTop:m.space,paddingRight:m.space,paddingBottom:m.space,paddingLeft:m.space,alignContent:["center","start","end","flex-start","flex-end","normal","baseline","first baseline","last baseline","space-between","space-around","space-evenly","stretch","safe center","unsafe center","inherit","initial","revert","revert-layer","unset"],alignItems:["normal","stretch","center","start","end","flex-start","flex-end","self-start","self-end","baseline","first baseline","last baseline","safe center","unsafe center","inherit","initial","revert","revert-layer","unset"],alignSelf:["auto","normal","center","start","end","self-start","self-end","flex-start","flex-end","baseline","first baseline","last baseline","stretch","safe center","unsafe center","inherit","initial","revert","revert-layer","unset"],flexDirection:["row","row-reverse","column","column-reverse","inherit","initial","revert","revert-layer","unset"],flexWrap:["nowrap","wrap","wrap-reverse","inherit","initial","revert","revert-layer","unset"],justifyContent:["center","start","end","flex-start","flex-end","left","right","normal","space-between","space-around","space-evenly","stretch","safe center","unsafe center","inherit","initial","revert","revert-layer","unset"],justifyItems:["normal","stretch","center","start","end","flex-start","flex-end","self-start","self-end","left","right","baseline","first baseline","last baseline","safe center","unsafe center","legacy right","legacy left","legacy center","inherit","initial","revert","revert-layer","unset"],boxSizing:["border-box","content-box","inherit","initial","revert","revert-layer","unset"],position:["static","relative","absolute","fixed","sticky","inherit","initial","revert","revert-layer","unset"],display:["block","block flex","block flow","block flow-root","block grid","contents","flex","flow-root","grid","inherit","initial","inline","inline flex","inline flow","inline flow-root","inline grid","inline-block","inline-flex","inline-grid","list-item","none","revert","revert-layer","table","table-row-group","table-header-group","table-footer-group","table-row","table-cell","table-column-group","table-column","table-caption","unset"]},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 _e(e){if(Array.isArray(e))return new Map(e.map(t=>[t,t]));if(typeof e=="object"&&e!==null)return new Map(Object.entries(e));if(["string","number"].includes(typeof e))return new Map([e,e]);throw new Error("Invalid entry in styleProps")}var Xe=new Map(Object.entries(fe).map(([e,t])=>[e,_e(t)])),qe=new Map(Object.entries(ue).map(([e,t])=>[e,new Set(t)]));function me(e){let t=Object.assign({},e),o={};return Object.entries(t).forEach(([r,n])=>{let i=qe.get(r);i!=null&&(i.forEach(l=>{t[l]=n;}),delete t[r]);}),Object.entries(t).forEach(([r,n])=>{let i=Xe.get(r);if(i!=null)if(typeof n=="string"&&n.indexOf(" ")>-1){let l=n.split(" ");o[r]=l.map(c=>{var u;return (u=i.get(c.toString()))!=null?u:c}).join(" "),delete t[r];}else i.has(n.toString())&&(o[r]=i.get(n.toString()),delete t[r]);}),{cssFromProps:o,unmatchedProps:t}}function ge(e){return e&&`fr-${e}`}function Je(e){return e&&(Array.isArray(e)?e.map(t=>ge(t)).join(" "):ge(e))}function Qe(l,i){var c=l,{as:e,children:t,className:o,part:r}=c,n=f(c,["as","children","className","part"]);let u=e!=null?e:"div",{cssFromProps:d,unmatchedProps:h}=me(n),y=Je(r),w=o||y?clsx(o,y):void 0;return jsx(u,p(s({className:w,css:[{boxSizing:"border-box"},d]},h),{ref:i,children:t}))}var g=_.forwardRef(Qe);var U={};oe(U,{Body1:()=>it,Body2:()=>st,Caption:()=>at,Display1:()=>Ze,Display2:()=>et,H1:()=>tt,H2:()=>ot,H3:()=>rt,H4:()=>nt});var T={color:"neutral.foreground",fontFamily:"default",margin:0},Ze=p(s({},T),{fontSize:"5xl",fontWeight:"bold",lineHeight:"4xl"}),et=p(s({},T),{fontSize:"4xl",fontWeight:"bold",lineHeight:"3xl"}),tt=p(s({},T),{fontSize:"3xl",fontWeight:"bold",lineHeight:"2xl"}),ot=p(s({},T),{fontSize:"2xl",fontWeight:"bold",lineHeight:"xl"}),rt=p(s({},T),{fontSize:"xl",fontWeight:"bold",lineHeight:"lg"}),nt=p(s({},T),{fontSize:"lg",fontWeight:"bold",lineHeight:"md"}),it=p(s({},T),{fontSize:"md",fontWeight:"regular",lineHeight:"md"}),st=p(s({},T),{fontSize:"sm",fontWeight:"regular",lineHeight:"md"}),at=p(s({},T),{fontSize:"xs",fontWeight:"regular",lineHeight:"sm"});function be(n){var i=n,{as:e="span",children:t,variant:o="Body1"}=i,r=f(i,["as","children","variant"]);return jsx(g,p(s(s({as:e},U[o]),r),{children:t}))}var lt=["Display1","Display2","H1","H2","H3","H4","Body1","Body2","Caption"],pt=Object.fromEntries(lt.map(e=>{let t=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():void 0,o=r=>jsx(be,p(s({as:t},r),{variant:e,children:r.children}));return o.displayName=`Text.${e}`,[e,o]})),B=Object.assign(be,pt);var N={};oe(N,{Link:()=>ft,Plain:()=>ut,Primary:()=>ct,Secondary:()=>dt,base:()=>O});var O=({radii:e,space:t})=>({borderWidth:0,borderRadius:e.md,padding:`${t[2]} ${t[4]}`}),ct=({colors:e})=>[O,{backgroundColor:e.primary.surface,color:e.primary.foreground,"&:hover":{backgroundColor:e.primary.hover.surface}}],dt=({colors:e})=>[O,{backgroundColor:e.secondary.surface,color:e.secondary.foreground,"&:hover":{backgroundColor:e.secondary.hover.surface}}],ft=({colors:e})=>[O,{backgroundColor:e.transparent,color:e.primary.surface,"&:hover":{color:e.primary.hover.surface}}],ut=({colors:e})=>[O,{backgroundColor:e.transparent,color:e.neutral.foreground}];function he(i){var l=i,{as:e,children:t,title:o,variant:r="Primary"}=l,n=f(l,["as","children","title","variant"]);return jsxs(g,p(s({as:e!=null?e:"button",css:N[r]},n),{children:[t,o&&jsx(B.Body2,{fontWeight:"demibold",color:"inherit",children:o})]}))}var mt=["Primary","Secondary","Link","Plain"],gt=Object.fromEntries(mt.map(e=>{let t=e.toLocaleLowerCase(),o=i=>{var l=i,{part:r}=l,n=f(l,["part"]);return jsx(he,p(s({part:[`button-${t}`,r]},n),{variant:e,children:n.children}))};return o.displayName=`Text.${e}`,[e,o]})),H=Object.assign(he,gt);var bt=_.forwardRef((n,r)=>{var i=n,{children:e,css:t}=i,o=f(i,["children","css"]);return jsx(g,p(s({css:[{display:"flex",flexDirection:"row"},t]},o),{ref:r,children:e}))}),yt=_.forwardRef((n,r)=>{var i=n,{children:e,css:t}=i,o=f(i,["children","css"]);return jsx(g,p(s({css:[{display:"flex",flexDirection:"column"},t]},o),{ref:r,children:e}))}),E={Column:yt,Row:bt};var S=createContext({apiKey:"",modals:[],setModals:()=>{},navigate:()=>{}});function wt(n){var i=n,{children:e,navigate:t,theme:o}=i,r=f(i,["children","navigate","theme"]);let l=o?z(o):{},[c,u]=useState([]),d=t!=null?t:(h,y="_self")=>{window.open(h,y);};return jsxs(S.Provider,{value:s({modals:c,setModals:u,navigate:d},r),children:[jsx(Global,{styles:{":root":s(s({},de),l)}}),jsx(ThemeProvider,{theme:m,children:e})]})}function Ce(){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]=useState(e),[r,n]=useState(null),i=useCallback(l=>{n(l);},[]);return useLayoutEffect(()=>{r&&o(r.getBoundingClientRect());},[r]),{node:r,rect:t,ref:i}}var kt=keyframes({"0%":{opacity:.5,transform:"scale(0.5)"},"50%":{opacity:0,transform:"scale(1)"},"100%":{opacity:0,transform:"scale(1)"}});function Se(r){var n=r,{style:e={},part:t=""}=n,o=f(n,["style","part"]);return jsxs(g,p(s({part:`dot-wrapper ${t}`,style:s({height:"48px",position:"absolute",width:"48px"},e)},o),{children:[jsx(g,{backgroundColor:"primary.surface",part:"dot-pulse",css:{animation:`2s ease-out infinite ${kt}`,borderRadius:"24px",height:"48px",left:0,position:"absolute",top:0,transformOrigin:"center center",width:"48px"}}),jsx(g,{backgroundColor:"primary.surface",part:"dot",style:{borderRadius:"12px",height:"24px",left:"12px",position:"absolute",top:"12px",width:"24px"}})]}))}function Re(r){var n=r,{part:e,src:t}=n,o=f(n,["part","src"]);return jsx(g,s({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 ke(r){var n=r,{part:e,src:t}=n,o=f(n,["part","src"]);let i=Ht(t);return jsx(g,s({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 X(r){var n=r,{src:e,type:t}=n,o=f(n,["src","type"]);return jsx(t==="video"?ke:Re,s({src:e},o))}function Fe({props:e,alignAttr:t,sideAttr:o}){let r=o!=null?o:"bottom",n={},i=()=>{var d;if(["after","before"].includes(e.align)){if(t=="start")return "before";if(t=="end")return "after"}return (d=e.align)!=null?d:"after"},l="-24px",c={top:"bottom",right:"left",bottom:"top",left:"right"};n[c[r]]=l;let u=i();return ["before","end"].includes(u)?["top","bottom"].includes(r)?n.right=l:n.bottom=l:["after","start"].includes(u)?["top","bottom"].includes(r)?n.left=l:n.top=l:["top","bottom"].includes(r)?n.left=`calc(50% + ${l})`:n.top=`calc(50% + ${l})`,n}var Oe={content:["align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","forceMount","hideWhenDetached","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenAutoFocus","onPointerDownOutside","side","sideOffset","sticky"],root:["defaultOpen","modal","onOpenChange","open"]};function He(e,t){var n,i,l,c,u;let o=Object.fromEntries(Oe.content.map(d=>[d,e[d]]).filter(d=>d[1]!==void 0)),r=Object.fromEntries(Oe.root.map(d=>[d,e[d]]).filter(d=>d[1]!==void 0));if(o.align=(n=o.align)!=null?n:"after",o.side=(i=o.side)!=null?i:"bottom",["before","after"].includes(o.align)){let d={after:"end",before:"start"},h=(A,I)=>["top","bottom"].includes(I)?A=="after"?"marginLeft":"marginRight":A=="after"?"marginTop":"marginBottom",y=(l=o.alignOffset)!=null?l:0,w=(c=o.style)!=null?c:{},P=(u=o.side)!=null?u:"bottom",M=o.align;o.style=p(s({},w),{[h(M,P)]:y});let D=["top","bottom"].includes(P)?t.width:t.height;o.alignOffset=(D+y)*-1,o.align=d[M];}return {contentProps:o,rootProps:r}}function x(l){var c=l,{anchor:e,children:t,className:o,spotlight:r=!1,style:n}=c,i=f(c,["anchor","children","className","spotlight","style"]);let{node:u,rect:d,ref:h}=Ce(),{contentProps:y,rootProps:w}=He(i,d),[P,M]=useState(y.align),[D,A]=useState(y.side);if(u!==null){let k=u.getAttribute("data-align"),Q=u.getAttribute("data-side");P!==k&&M(k),D!==Q&&A(Q);}let I=useRef(null),[V,$e]=useState(null);if(useEffect(()=>{let k=document.querySelector(e);k!=null&&(I.current=k,$e(I));},[e]),V==null)return null;let W=V.current.getBoundingClientRect(),J="0";typeof window!="undefined"&&(J=window.getComputedStyle(V.current).borderRadius);let je=Fe({props:i,alignAttr:P,sideAttr:D});return jsxs(v.Root,p(s({defaultOpen:!0},w),{children:[jsx(v.Anchor,{virtualRef:V}),jsx(v.Portal,{children:jsxs("div",{className:o,css:{position:"absolute",zIndex:9999},children:[r&&jsx(g,{borderRadius:J,part:"tooltip-spotlight",position:"absolute",css:{boxShadow:"0 0 0 2000px rgb(0 0 0 / 0.5)",height:W.height,left:W.left,top:W.top,width:W.width}}),jsx(v.Content,p(s({asChild:!0},y),{ref:h,children:jsxs(E.Column,{backgroundColor:"neutral.background",borderRadius:"md",p:5,part:"tooltip-content",position:"relative",css:s({boxShadow:"0px 4px 20px rgba(0, 0, 0, 0.1)",maxWidth:"360px"},n),children:[jsx(Se,{style:je}),t]})}))]})})]}))}x.Close=e=>jsx(v.Close,{"aria-label":"Close",asChild:!0,children:jsx(H.Plain,p(s({css:{top:"12px",right:"4px"},part:"tooltip-close",position:"absolute"},e),{children:jsx(XMarkIcon,{height:"24",fill:"currentColor"})}))});x.Media=o=>{var r=o,{src:e}=r,t=f(r,["src"]);return e==null?null:jsx(X,s({borderRadius:"md md 0 0",borderWidth:"0",css:{aspectRatio:"2"},margin:"-5 -5 5",src:e},t))};x.Primary=r=>{var n=r,{onClick:e,title:t}=n,o=f(n,["onClick","title"]);return t==null?null:jsx(H.Primary,s({title:t,onClick:e},o))};x.Progress=o=>{var r=o,{children:e}=r,t=f(r,["children"]);return e==null?null:jsx(B.Body2,p(s({fontWeight:"demibold",part:"progress"},t),{children:e}))};x.Secondary=r=>{var n=r,{onClick:e,title:t}=n,o=f(n,["onClick","title"]);return t==null?null:jsx(H.Secondary,s({title:t,onClick:e},o))};x.Subtitle=o=>{var r=o,{children:e}=r,t=f(r,["children"]);return e==null?null:jsx(B.Body2,p(s({part:"subtitle"},t),{children:e}))};x.Title=o=>{var r=o,{children:e}=r,t=f(r,["children"]);return e==null?null:jsx(B.Body1,p(s({fontWeight:"bold",mb:1,part:"title"},t),{children:e}))};function Ee(e){let[t,o]=useState(),{apiKey:r,apiUrl:n,userId:i}=useContext(S),c=useRef(new Frigade(r,{apiUrl:n,userId:i})).current,u=d=>{if(d.id!==e)return;let h=Object.assign(Object.create(Object.getPrototypeOf(d)),d);o(h);};return useEffect(()=>(C(this,null,function*(){let d=yield c.getFlow(e);o(d);}),c.onStateChange(u),()=>{c.removeStateChangeHandler(u);}),[]),{flow:t}}function De(e){let{modals:t,setModals:o}=useContext(S),[r,n]=useState(!1);return useEffect(()=>(o([...t,e]),()=>o(t.filter(i=>i!==e))),[]),useEffect(()=>{let i=t[0]===e;i!==r&&n(i);},[t]),{isCurrentModal:r}}function j(e,{onComplete:t,onDismiss:o}={}){let r=useRef(null);return useEffect(()=>{e!=null&&(e.isCompleted&&r.current===!1&&t(e),r.current=e==null?void 0:e.isCompleted);},[e==null?void 0:e.isCompleted]),{handleDismiss:useCallback(n=>C(this,null,function*(){if((o==null?void 0:o(e,n))===!1)return n.preventDefault(),!1;yield e.skip();}),[e])}}function Ie(e,{onPrimary:t,onSecondary:o}={}){let{navigate:r}=useContext(S);return {handlePrimary:useCallback(n=>C(this,null,function*(){if((t==null?void 0:t(e,n))===!1)return n.preventDefault(),!1;yield e.complete(),e.primaryButtonUri!=null&&r(e.primaryButtonUri,e.primaryButtonUriTarget);}),[e]),handleSecondary:useCallback(n=>C(this,null,function*(){if((o==null?void 0:o(e,n))===!1)return n.preventDefault(),!1;yield e.complete(),e.secondaryButtonUri!=null&&r(e.secondaryButtonUri,e.secondaryButtonUriTarget);}),[e])}}function We(l){var c=l,{step:e,flow:t,onDismiss:o,onPrimary:r,onSecondary:n}=c,i=f(c,["step","flow","onDismiss","onPrimary","onSecondary"]);var w;let{isCurrentModal:u}=De(`${t.id}-${e.id}`),{handleDismiss:d}=j(t,{onDismiss:o}),{handlePrimary:h,handleSecondary:y}=Ie(e,{onPrimary:r,onSecondary:n});return u?jsxs(x,p(s({anchor:e.selector,onOpenAutoFocus:P=>P.preventDefault(),onPointerDownOutside:P=>P.preventDefault()},i),{children:[jsx(x.Close,{onClick:d}),jsx(x.Media,{src:(w=e.videoUri)!=null?w:e.imageUri,type:e.videoUri?"video":"image"}),jsx(x.Title,{children:e.title}),jsx(x.Subtitle,{children:e.subtitle}),jsxs(E.Row,{alignItems:"center",gap:3,justifyContent:"flex-end",part:"tooltip-footer",pt:4,children:[jsx(x.Progress,{children:`${(e==null?void 0:e.order)+1}/${t.steps.size}`}),jsx(x.Secondary,{marginLeft:"auto",title:e.secondaryButtonTitle,onClick:y}),jsx(x.Primary,{title:e.primaryButtonTitle,onClick:h})]})]}),e.id):null}function qt(r){var n=r,{flowId:e,onComplete:t}=n,o=f(n,["flowId","onComplete"]);let{flow:i}=Ee(e);if(j(i,{onComplete:t}),i==null||i.isVisible===!1)return null;i.start();let l=i.getCurrentStep();return l==null||l.start(),jsx(We,s({step:l,flow:i},o))}
|
|
12
12
|
|
|
13
|
-
export { g as Box, H as Button, E as Flex,
|
|
13
|
+
export { g as Box, H as Button, E as Flex, wt as Provider, B as Text, x as Tooltip, qt as Tour };
|
|
14
14
|
//# sourceMappingURL=out.js.map
|
|
15
15
|
//# sourceMappingURL=index.js.map
|