@frigade/react 2.0.0-alpha.43 → 2.0.0-alpha.44

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Dialog/index.tsx","../src/components/Box/index.tsx","../src/components/Box/styleProps.ts","../src/shared/tokens/borders.ts","../src/shared/tokens/palette.ts","../src/shared/tokens/radii.ts","../src/shared/tokens/semantic.ts","../src/shared/tokens/shadows.ts","../src/shared/tokens/space.ts","../src/shared/tokens/typography.ts","../src/shared/tokens/index.ts","../src/shared/flattenObject.ts","../src/shared/theme/index.ts","../src/components/Box/stylePropsToCss.ts","../src/shared/sanitize.ts","../src/components/Text/Text.tsx","../src/components/Text/Text.styles.ts","../src/components/Button/Button.styles.ts","../src/components/Button/index.tsx","../src/components/Card/index.tsx","../src/components/Flex/Flex.tsx","../src/hooks/useFlowComponent.tsx","../src/hooks/useFlow.ts","../src/components/Provider/index.tsx","../src/hooks/useFlowHandlers.ts","../src/hooks/useStepHandlers.ts","../src/hooks/useModal.ts","../src/components/Card/FlowCard.tsx","../src/components/Media/Image.tsx","../src/components/Media/Video.tsx","../src/components/Media/Media.tsx","../src/components/Announcement/index.tsx","../src/components/Banner/index.tsx","../src/components/Form/FormStep.tsx","../src/components/Form/fields/RadioField.tsx","../src/components/Form/fields/Error.tsx","../src/components/Form/fields/Label.tsx","../src/components/Form/fields/BaseField.styles.ts","../src/components/Form/fields/BaseField.tsx","../src/components/Form/fields/SelectField.tsx","../src/components/Form/fields/TextField.tsx","../src/components/Form/fields/TextareaField.tsx","../src/components/Form/index.tsx","../src/components/Tooltip/index.tsx","../src/hooks/useBoundingClientRect.ts","../src/components/Tooltip/Dot.tsx","../src/components/Tooltip/getDotPosition.ts","../src/components/Tooltip/mapTooltipPropsToPopoverProps.ts","../src/components/Tour/index.tsx","../src/components/Tour/TourStep.tsx","../src/index.ts","../src/hooks/useFrigade.ts","../src/hooks/useUser.ts","../src/hooks/useGroup.ts"],"names":["RadixDialog","XMarkIcon","React","clsx","kcp","borders","palette","radii","colorVar","colorName","semantic","shadows","SPACE_UNIT","spaceValue","key","spaceKeys","space","typography","tokens","flattenObject","obj","path","separator","acc","k","currentPath","currentValue","createThemeVariables","mapTokensToThemeVariables","newObj","themeVariables","theme","omittedCSSProperties","filteredCSSProperties","prop","_","char","defaultCSSProperties","colorTokens","themedStyleProps","styleProps","stylePropShorthands","pseudoStyleProps","prepValue","value","v","stylePropsMap","propName","stylePropShorthandsMap","shorthand","targetProps","preservedProps","elementsWithPreservedProps","getPseudoClass","name","pseudo","stylePropsToCss","props","element","unmatchedProps","cssFromProps","getTargetObject","pseudoSelector","match","propValue","matchedShorthand","p","fullPropName","styleProp","splitPropValues","clippedPropName","DOMPurify","getWindow","JSDOM","sanitize","dirty","jsx","prefixPart","part","processPart","BoxWithRef","as","children","className","css","ref","Component","processedPart","classNameWithPart","cssProp","Box","Text_exports","__export","Body1","Body2","Caption","Display1","Display2","H1","H2","H3","H4","Text_styles_exports","base","textVariantNames","textVariants","variant","defaultAs","component","Button_styles_exports","Link","Plain","Primary","Secondary","jsxs","BaseButton","title","variantPart","buttonVariantNames","buttonVariantComponents","Button","Flex_exports","Column","Row","useEffect","useMemo","useContext","useState","createContext","Global","ThemeProvider","Frigade","FrigadeContext","Provider","navigate","themeOverrides","modals","setModals","frigade","navigateHandler","url","target","currentModal","useFlow","flowId","config","flow","setFlow","setRandomString","handler","updatedFlow","flowInstance","useCallback","useRef","useFlowHandlers","onComplete","onDismiss","lastCompleted","e","useStepHandlers","step","onPrimary","onSecondary","useModal","isCurrentModal","setIsCurrentModal","prevModals","newIsCurrentModal","removeModal","nextModals","CloseButton","useFlowComponent","container","dismissible","variables","ContainerElement","Dialog","DismissElement","FlowComponent","flowComponentProps","handleDismiss","handlePrimary","handleSecondary","Fragment","FlowCard","Card","Image","src","getVideoEmbedSrc","videoUri","_a","_b","_c","Video","videoEmbedSrc","Media","type","onClick","current","total","dots","i","Announcement","Banner","useController","useForm","ruleProps","FieldWrapper","FieldComponent","control","fieldData","rules","controller","FormStep","fieldTypes","handleSubmit","fields","onSubmit","data","RadioGroup","Error","error","Label","id","required","field","input","BaseField","fieldState","label","placeholder","fieldProps","CheckIcon","RadioItem","forwardedRef","RadioField","onChange","options","radioItems","Select","ChevronDownIcon","SelectItem","SelectField","selectItems","TextField","TextareaField","defaultFieldTypes","Form","mergedFieldTypes","Popover","useLayoutEffect","useBoundingClientRect","initialRect","rect","setRect","node","setNode","handleResize","newRect","keyframes","pulse","Dot","style","getDotPosition","alignAttr","sideAttr","currentSide","dotProps","getCurrentAlign","dotOffset","oppositeSides","currentAlign","RADIX_PROPS","mapTooltipPropsToPopoverProps","contentRect","contentProps","propEntry","rootProps","mapToOriginalAlignValues","mapAlignOffsetToMargin","align","side","originalOffset","originalStyleProp","lengthOfCurrentSide","Tooltip","anchor","spotlight","contentNode","contentRef","anchorNode","anchorRect","anchorRef","setAlignAttr","setSideAttr","spotlightLeft","setSpotlightLeft","spotlightTop","setSpotlightTop","currentAlignAttr","currentSideAttr","anchorVirtualRef","anchorQuery","scrollX","scrollY","anchorRadius","dotPosition","TourStep","Tour","Flow","useFrigade","useUser","userId","setProperties","properties","track","eventName","useGroup","groupId"],"mappings":"2VAAA,UAAYA,MAAiB,yBAC7B,OAAS,aAAAC,OAAiB,4BCD1B,UAAYC,OAAW,QACvB,OAAS,QAAAC,OAAY,OCDrB,OAAOC,OAAS,uBCAT,IAAMC,GAAU,CACrB,QAAS,CACP,GAAI,WACN,EACA,aAAc,CACZ,EAAG,IACH,GAAI,KACN,CACF,ECRO,IAAMC,GAAU,CACrB,MAAO,UACP,QAAS,UACT,QAAS,UACT,QAAS,UACT,QAAS,UACT,QAAS,UACT,QAAS,UACT,QAAS,UACT,QAAS,UACT,QAAS,UACT,MAAO,UACP,QAAS,UACT,QAAS,UACT,QAAS,UACT,QAAS,UACT,SAAU,UACV,SAAU,UACV,SAAU,UACV,YAAa,YACb,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og'\nimport { XMarkIcon } from '@heroicons/react/24/solid'\n\nimport { Box, type BoxProps } from '../Box'\nimport { Button, ButtonProps } from '../Button'\nimport { Card } from '../Card'\nimport { Media, MediaProps } from '../Media'\nimport { Text, TextProps } from '../Text'\n\nimport { theme } from '../../shared/theme'\n\nexport interface DialogProps extends BoxProps {}\n\n// TODO: Add any RadixDialog props we want to support here\nexport function Dialog({ children, ...props }: DialogProps) {\n return (\n <RadixDialog.Root defaultOpen={true} modal={true}>\n <RadixDialog.Portal>\n <Box inset=\"0\" position=\"fixed\" zIndex=\"9999\">\n <RadixDialog.Overlay asChild>\n <Box background=\"rgb(0 0 0 / 0.5)\" part=\"dialog-overlay\" position=\"fixed\" inset=\"0\" />\n </RadixDialog.Overlay>\n <RadixDialog.Content\n asChild\n onOpenAutoFocus={(e) => e.preventDefault()}\n onPointerDownOutside={(e) => e.preventDefault()}\n >\n <Card\n boxShadow=\"md\"\n left=\"50%\"\n maxWidth=\"430px\"\n p={8}\n part=\"dialog-content\"\n position=\"fixed\"\n textAlign=\"center\"\n top=\"50%\"\n transform=\"translate(-50%, -50%)\"\n {...props}\n >\n {children}\n </Card>\n </RadixDialog.Content>\n </Box>\n </RadixDialog.Portal>\n </RadixDialog.Root>\n )\n}\n\nDialog.Close = (props: ButtonProps) => {\n return (\n <RadixDialog.Close aria-label=\"Close\" asChild>\n <Button.Plain part=\"close\" position=\"absolute\" right=\"-4px\" top=\"4px\" {...props}>\n <XMarkIcon height=\"24\" fill=\"currentColor\" />\n </Button.Plain>\n </RadixDialog.Close>\n )\n}\n\nDialog.Subtitle = ({ children, ...props }: TextProps) => {\n return (\n <RadixDialog.Description asChild>\n <Text.Body2 mb={5} part=\"subtitle\" {...props}>\n {children}\n </Text.Body2>\n </RadixDialog.Description>\n )\n}\n\nDialog.Media = ({ src, ...props }: MediaProps) => {\n if (src == null) return null\n\n return <Media borderRadius=\"md\" src={src} {...props} />\n}\n\nDialog.Primary = ({ onClick, title, ...props }: ButtonProps) => {\n if (title == null) return null\n\n return <Button.Primary title={title} onClick={onClick} {...props} />\n}\n\nDialog.ProgressDots = ({ current, total }: { current: number; total: number }) => {\n if (total == 1) {\n return null\n }\n\n const dots = [...Array(total)].map((_, i) => {\n return (\n <circle\n key={i}\n r={4}\n cx={4 + 16 * i}\n cy=\"4px\"\n fill={current === i ? theme.colors.blue500 : theme.colors.blue800}\n />\n )\n })\n\n return (\n <Box\n as=\"svg\"\n height=\"8px\"\n margin=\"5 auto\"\n part=\"progress\"\n viewBox={`0 0 ${16 * total - 8} 8`}\n width={16 * total - 8}\n >\n {dots}\n </Box>\n )\n}\n\nDialog.Secondary = ({ onClick, title, ...props }: ButtonProps) => {\n if (title == null) return null\n\n return <Button.Secondary title={title} onClick={onClick} {...props} />\n}\n\nDialog.Title = ({ children, ...props }: TextProps) => {\n return (\n <RadixDialog.Title asChild>\n <Text.H3 mb={1} part=\"title\" {...props}>\n {children}\n </Text.H3>\n </RadixDialog.Title>\n )\n}\n","import * as React from 'react'\nimport { clsx } from 'clsx'\n\nimport { type StyleProps } from './styleProps'\nimport { stylePropsToCss } from './stylePropsToCss'\nimport { sanitize } from '../../shared/sanitize'\n\nfunction prefixPart(part: string | undefined) {\n return part ? `fr-${part}` : part\n}\n\nfunction processPart(part: Part | undefined) {\n if (!part) return part\n\n return Array.isArray(part) ? part.map((p) => processPart(p)).join(' ') : prefixPart(part)\n}\n\ntype Part = string | Part[]\n\nexport type BoxProps<T extends React.ElementType = React.ElementType> = {\n as?: T\n part?: Part\n} & StyleProps &\n React.ComponentPropsWithoutRef<T>\n\nfunction BoxWithRef<T extends React.ElementType = React.ElementType>(\n { as, children, className, css = {}, part, ...props }: BoxProps<T>,\n ref: React.ForwardedRef<HTMLDivElement>\n) {\n const Component = as ?? 'div'\n\n const { cssFromProps, unmatchedProps } = stylePropsToCss(props, Component)\n\n const processedPart = processPart(part)\n const classNameWithPart = className || processedPart ? clsx(className, processedPart) : undefined\n const cssProp = [{ boxSizing: 'border-box' }, cssFromProps, css]\n\n if (typeof children === 'string') {\n return (\n <Component\n className={classNameWithPart}\n css={cssProp}\n {...unmatchedProps}\n ref={ref}\n dangerouslySetInnerHTML={sanitize(children)}\n />\n )\n }\n\n return (\n <Component className={classNameWithPart} css={cssProp} {...unmatchedProps} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const Box = React.forwardRef(BoxWithRef) as <\n T extends React.ElementType = React.ElementType\n>(\n props: BoxProps<T>\n) => React.ReactElement\n","import kcp from 'known-css-properties'\nimport type { CSSProperties } from 'react'\n\nimport { theme } from '../../shared/theme'\nimport { flattenObject } from '../../shared/flattenObject'\n\n// Don't use these as CSS props, pass them through to HTML\nconst omittedCSSProperties = new Set([\n 'alt', // Mozilla doesn't have this listed as a valid CSS property ¯\\_(ツ)_/¯\n 'size', // Only applies to @page, not used for styling components. Breaks <input>\n 'src', // Only applies to @font-face, not used for styling components. Breaks <img>, <video>, et al\n])\n\nconst filteredCSSProperties = kcp.all\n .filter((prop) => prop.indexOf('-') != 0 && !omittedCSSProperties.has(prop))\n .map((prop) => [prop.replace(/-([a-z])/g, (_, char) => char.toUpperCase()), null])\n\nconst defaultCSSProperties: Record<string, null> = Object.fromEntries(filteredCSSProperties)\n\n// Recursive type for flattened color names\n// SEE: https://stackoverflow.com/a/47058976\ntype PathsToStringProps<T> = T extends string\n ? []\n : {\n [K in Extract<keyof T, string>]: [K, ...PathsToStringProps<T[K]>]\n }[Extract<keyof T, string>]\n\ntype Join<T extends string[], D extends string> = T extends []\n ? never\n : T extends [infer F]\n ? F\n : T extends [infer F, ...infer R]\n ? F extends string\n ? `${F}${D}${Join<Extract<R, string[]>, D>}`\n : never\n : string\n\ntype ColorName = Join<PathsToStringProps<typeof theme.colors>, '.'>\n\nconst colorTokens = flattenObject(theme.colors) as Record<ColorName, string>\n\nconst themedStyleProps = {\n color: colorTokens,\n backgroundColor: colorTokens,\n borderColor: colorTokens,\n\n border: theme.borders,\n borderRadius: theme.radii,\n borderWidth: theme.borderWidths,\n boxShadow: theme.shadows,\n\n fontFamily: theme.fontFamilies,\n fontSize: theme.fontSizes,\n fontWeight: theme.fontWeights,\n\n gap: theme.space,\n\n lineHeight: theme.lineHeights,\n\n margin: theme.space,\n marginBottom: theme.space,\n marginLeft: theme.space,\n marginRight: theme.space,\n marginTop: theme.space,\n\n padding: theme.space,\n paddingBottom: theme.space,\n paddingLeft: theme.space,\n paddingRight: theme.space,\n paddingTop: theme.space,\n} as const\n\nexport const styleProps = {\n ...defaultCSSProperties,\n ...themedStyleProps,\n}\n\nexport const stylePropShorthands = {\n bg: ['backgroundColor'],\n\n m: ['margin'],\n mt: ['marginTop'],\n mr: ['marginRight'],\n mb: ['marginBottom'],\n ml: ['marginLeft'],\n mx: ['marginLeft', 'marginRight'],\n my: ['marginTop', 'marginBottom'],\n\n p: ['padding'],\n pt: ['paddingTop'],\n pr: ['paddingRight'],\n pb: ['paddingBottom'],\n pl: ['paddingLeft'],\n px: ['paddingLeft', 'paddingRight'],\n py: ['paddingTop', 'paddingBottom'],\n} as const\n\nexport const pseudoStyleProps = new Set(['active', 'focus', 'focusVisible', 'focusWithin', 'hover'])\n\ntype ThemedStyleProps = {\n [K in keyof typeof themedStyleProps]: keyof (typeof themedStyleProps)[K]\n}\n\ntype FilteredCSSProps = Omit<\n {\n [key in keyof CSSProperties]: CSSProperties[key]\n },\n | `-${string}`\n | `Moz${string}`\n | `ms${string}`\n | `Webkit${string}`\n | `Khtml${string}`\n | `O${string}`\n>\n\n// eslint-disable-next-line @typescript-eslint/ban-types -- the (string & {}) type is intentionally fucky to assist with IDE prop completion\nexport type ThemedStyleProp<K extends keyof ThemedStyleProps> = ThemedStyleProps[K] | (string & {})\n\nexport type StylePropShorthands = {\n [K in keyof typeof stylePropShorthands]?: ThemedStyleProp<(typeof stylePropShorthands)[K][0]>\n}\n\nexport interface StyleProps extends FilteredCSSProps, StylePropShorthands {\n backgroundColor?: ThemedStyleProp<'backgroundColor'>\n border?: ThemedStyleProp<'border'>\n borderColor?: ThemedStyleProp<'borderColor'>\n borderRadius?: ThemedStyleProp<'borderRadius'>\n borderWidth?: ThemedStyleProp<'borderWidth'>\n boxShadow?: ThemedStyleProp<'boxShadow'>\n color?: ThemedStyleProp<'color'>\n fontFamily?: ThemedStyleProp<'fontFamily'>\n fontSize?: ThemedStyleProp<'fontSize'>\n fontWeight?: ThemedStyleProp<'fontWeight'>\n gap?: ThemedStyleProp<'gap'>\n lineHeight?: ThemedStyleProp<'lineHeight'>\n margin?: ThemedStyleProp<'margin'>\n marginBottom?: ThemedStyleProp<'marginBottom'>\n marginLeft?: ThemedStyleProp<'marginLeft'>\n marginRight?: ThemedStyleProp<'marginRight'>\n marginTop?: ThemedStyleProp<'marginTop'>\n padding?: ThemedStyleProp<'padding'>\n paddingBottom?: ThemedStyleProp<'paddingBottom'>\n paddingLeft?: ThemedStyleProp<'paddingLeft'>\n paddingRight?: ThemedStyleProp<'paddingRight'>\n paddingTop?: ThemedStyleProp<'paddingTop'>\n}\n","export const borders = {\n borders: {\n md: '1px solid',\n },\n borderWidths: {\n 0: '0',\n md: '1px',\n },\n}\n","export const palette = {\n black: '#000000',\n gray100: '#14161A',\n gray200: '#181B20',\n gray300: '#1F2329',\n gray400: '#2E343D',\n gray500: '#4C5766',\n gray600: '#5A6472',\n gray700: '#C5CBD3',\n gray800: '#E2E5E9',\n gray900: '#F1F2F4',\n white: '#ffffff',\n blue400: '#015AC6',\n blue500: '#0171F8',\n blue800: '#DBECFF',\n blue900: '#F5F9FF',\n green400: '#009E37',\n green500: '#00D149',\n green800: '#DBFFE8',\n transparent: '#FFFFFF00',\n inherit: 'inherit',\n\n // This color isn't in the Design System yet, but it's used in old components\n red500: '#c00000',\n}\n","export const radii = {\n md: '10px',\n lg: '20px',\n round: '50%',\n}\n","const colorVar = (colorName: string) => `var(--fr-colors-${colorName})`\n\nexport const semantic = {\n neutral: {\n background: colorVar('white'),\n border: colorVar('gray800'),\n foreground: colorVar('black'),\n surface: colorVar('gray700'),\n\n active: {\n background: colorVar('white'),\n border: colorVar('gray900'),\n foreground: colorVar('black'),\n surface: colorVar('gray700'),\n },\n focus: {\n background: colorVar('white'),\n border: colorVar('gray900'),\n foreground: colorVar('black'),\n surface: colorVar('gray700'),\n },\n hover: {\n background: colorVar('white'),\n border: colorVar('gray900'),\n foreground: colorVar('black'),\n surface: colorVar('gray700'),\n },\n },\n\n primary: {\n background: colorVar('blue500'),\n border: colorVar('blue500'),\n foreground: colorVar('white'),\n surface: colorVar('blue500'),\n\n active: {\n background: colorVar('blue400'),\n border: colorVar('blue400'),\n foreground: colorVar('white'),\n surface: colorVar('blue400'),\n },\n focus: {\n background: colorVar('blue500'),\n border: colorVar('blue500'),\n foreground: colorVar('white'),\n surface: colorVar('blue500'),\n },\n hover: {\n background: colorVar('blue400'),\n border: colorVar('blue400'),\n foreground: colorVar('white'),\n surface: colorVar('blue400'),\n },\n },\n\n secondary: {\n background: colorVar('white'),\n border: colorVar('gray800'),\n foreground: colorVar('black'),\n surface: colorVar('gray900'),\n\n active: {\n background: colorVar('gray900'),\n border: colorVar('gray800'),\n foreground: colorVar('black'),\n surface: colorVar('gray800'),\n },\n focus: {\n background: colorVar('gray900'),\n border: colorVar('gray800'),\n foreground: colorVar('black'),\n surface: colorVar('gray900'),\n },\n hover: {\n background: colorVar('gray900'),\n border: colorVar('gray800'),\n foreground: colorVar('black'),\n surface: colorVar('gray800'),\n },\n },\n}\n","export const shadows = {\n md: '0px 4px 20px rgba(0, 0, 0, 0.1)',\n}\n","const SPACE_VALUE = 4\nconst SPACE_UNIT = 'px'\n\nconst spaceValue = (key: SpaceKeys[number]) =>\n typeof key === 'number' ? `${SPACE_VALUE * key}${SPACE_UNIT}` : key\n\nconst spaceKeys = [\n -20,\n -19,\n -18,\n -17,\n -16,\n -15,\n -14,\n -13,\n -12,\n -11,\n -10,\n -9,\n -8,\n -7,\n -6,\n -5,\n -4,\n -3,\n -2,\n -1,\n -0.5,\n 0,\n 0.5,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 'auto',\n] as const\n\ntype SpaceKeys = typeof spaceKeys\n\ntype SpaceTokens = {\n [K in SpaceKeys[number]]: string\n}\nexport const space = Object.fromEntries(\n spaceKeys.map((key) => [key, spaceValue(key)])\n) as SpaceTokens\n","export const typography = {\n fontFamilies: {\n default: 'TT Interphases Pro, sans-serif',\n },\n fontSizes: {\n xs: '12px',\n sm: '14px',\n md: '16px',\n lg: '18px',\n xl: '20px',\n '2xl': '24px',\n '3xl': '30px',\n '4xl': '36px',\n '5xl': '48px',\n },\n fontWeights: {\n thin: '100',\n extralight: '200',\n light: '300',\n regular: '400',\n medium: '500',\n demibold: '600',\n bold: '700',\n extrabold: '800',\n black: '900',\n },\n letterSpacings: {\n md: '0.02em',\n },\n lineHeights: {\n xs: '18px',\n sm: '22px',\n md: '24px',\n lg: '26px',\n xl: '30px',\n '2xl': '38px',\n '3xl': '46px',\n '4xl': '60px',\n },\n}\n","import { borders } from './borders'\nimport { palette } from './palette'\nimport { radii } from './radii'\nimport { semantic } from './semantic'\nimport { shadows } from './shadows'\nimport { space } from './space'\nimport { typography } from './typography'\n\n// Package up everything everywhere all at once for convenience\nexport const tokens = {\n ...borders,\n\n colors: {\n ...palette,\n ...semantic,\n },\n\n ...typography,\n\n radii,\n shadows,\n space,\n}\n\nexport type Tokens = typeof tokens\n","export function flattenObject(obj: object, path = '', separator = '.') {\n return Object.keys(obj).reduce((acc, k) => {\n const prefix = path.length ? `${path}${separator}` : ''\n const currentPath = `${prefix}${k}`\n const currentValue = obj[k]\n\n if (typeof currentValue === 'object' && currentValue !== null && !Array.isArray(currentValue)) {\n Object.assign(acc, flattenObject(currentValue, currentPath, separator))\n } else {\n acc[currentPath] = currentValue\n }\n\n return acc\n }, {})\n}\n","import { tokens, Tokens } from '../tokens'\nimport { flattenObject } from '../flattenObject'\n\nexport type Theme = Partial<Tokens>\n\n// Transform tokens to a flat list of CSS variables and values to inject into the page\n// IN: { colors: { black: '#000' } }, OUT: { '--fr-colors-black': '#000' }\nexport function createThemeVariables(tokens: Theme) {\n return flattenObject(tokens, '--fr', '-')\n}\n\n// Swap token values out and replace them with the CSS variables we defined\n// IN: { colors: { black: '#000' } }, OUT: { colors: { black: 'var(--fr-colors-black)' } }\nfunction mapTokensToThemeVariables(tokens: Tokens, path = '--fr'): Theme {\n const newObj: Theme = {}\n\n Object.keys(tokens).forEach((key) => {\n const currentValue = tokens[key]\n\n if (typeof currentValue === 'object' && currentValue !== null && !Array.isArray(currentValue)) {\n newObj[key] = mapTokensToThemeVariables(currentValue, `${path}-${key}`)\n } else {\n newObj[key] = `var(${path}-${key})`\n }\n })\n\n return newObj\n}\n\nexport const themeVariables = createThemeVariables(tokens)\n\nexport const theme = mapTokensToThemeVariables(tokens)\n","import { pseudoStyleProps, styleProps, stylePropShorthands } from './styleProps'\n\n/*\nPrefix these props to allow for usage in CSS & HTML:\n color\n - HTML: obsolete\n\n background\n - HTML: obsolete\n\n border\n - HTML: obsolete\n\n content\n - HTML: only used in <meta>, not relevant to components\n\n translate\n - used by both. Prefix _translate to force pass-through to HTML?\n\n\n height\n width\n - HTML: used by <canvas>, <embed>, <iframe>, <img>, <input>, <object>, <video>\n - Can automatically send these to both HTML and CSS for those elements and allow manual prefixing just in case (like if you want to set HTML width to something different that CSS width)\n\n*/\n\nfunction prepValue(value: unknown) {\n if (Array.isArray(value)) {\n return new Map(value.map((v) => [v, v]))\n } else if (typeof value === 'object' && value !== null) {\n return new Map(Object.entries(value))\n } else if (typeof value === 'string' || typeof value === 'number') {\n return new Map([[value, value]])\n }\n\n return new Map()\n}\n\nconst stylePropsMap = new Map(\n Object.entries(styleProps).map(([propName, value]) => {\n return [propName, prepValue(value)]\n })\n)\n\nconst stylePropShorthandsMap = new Map(\n Object.entries(stylePropShorthands).map(([shorthand, targetProps]) => {\n return [shorthand, new Set(targetProps)]\n })\n)\n\n// TL;DR: Replaced elements should always have width & height HTML attrs set because intrinsic height / width = aspect ratio\nconst preservedProps = new Set(['height', 'width'])\nconst elementsWithPreservedProps = new Set([\n 'canvas',\n 'embed',\n 'iframe',\n 'img',\n 'input',\n 'object',\n 'video',\n])\n\nfunction getPseudoClass(propName: string) {\n // We're intentionally only grabbing the initial name and first pseudo class for now\n // We can support styleProp:hover:focus easily enough by running through the whole array\n const [name, pseudo] = propName.split(':')\n\n return [name, pseudoStyleProps.has(pseudo) ? pseudo : null]\n}\n\nexport function stylePropsToCss(\n props: Record<string, unknown>,\n element: React.ElementType = 'div'\n) {\n const unmatchedProps = Object.assign({}, props)\n const cssFromProps = {}\n\n function getTargetObject(pseudo: string | null) {\n if (pseudo == null) {\n return cssFromProps\n }\n\n const hyphenatedPseudo = pseudo.replace(/[A-Z]/g, (match) => `-${match.toLocaleLowerCase()}`)\n\n const pseudoSelector = `&:${hyphenatedPseudo}`\n\n if (cssFromProps[pseudoSelector] == null) {\n cssFromProps[pseudoSelector] = {}\n }\n\n return cssFromProps[pseudoSelector]\n }\n\n // Convert shorthand styleProps to full versions\n Object.entries(unmatchedProps).forEach(([propName, propValue]) => {\n const [name, pseudo] = getPseudoClass(propName)\n\n const matchedShorthand = stylePropShorthandsMap.get(name)\n if (matchedShorthand != null) {\n matchedShorthand.forEach((p) => {\n const fullPropName = `${p}${pseudo ? ':' + pseudo : ''}`\n unmatchedProps[fullPropName] = propValue\n })\n\n delete unmatchedProps[propName]\n }\n })\n\n // Convert styleProps to style object\n Object.entries(unmatchedProps).forEach(([fullPropName, propValue]) => {\n const [propName, pseudo] = getPseudoClass(fullPropName)\n const styleProp = stylePropsMap.get(propName)\n\n if (styleProp != null) {\n // Split space-separated values out and process them individually\n if (typeof propValue === 'string' && propValue.indexOf(' ') > -1) {\n const splitPropValues = propValue.split(' ')\n\n getTargetObject(pseudo)[propName] = splitPropValues\n .map((v) => styleProp.get(v.toString()) ?? v)\n .join(' ')\n }\n\n // Replace known token values (e.g. lineHeight=\"xl\")\n else if (styleProp.has(propValue.toString())) {\n getTargetObject(pseudo)[propName] = styleProp.get(propValue.toString())\n }\n\n // Pass value through, we trust TypeScript to catch invalid values, right?\n else {\n getTargetObject(pseudo)[propName] = propValue\n }\n\n // Don't delete the special props that get passed through to certain tags by default\n if (\n typeof element !== 'string' ||\n !elementsWithPreservedProps.has(element) ||\n !preservedProps.has(propName)\n ) {\n delete unmatchedProps[fullPropName]\n }\n }\n })\n\n // Remove prefix from prefixed style props and pass them through\n Object.keys(unmatchedProps).forEach((propName) => {\n const clippedPropName = propName.substring(1)\n\n if (propName.indexOf('_') === 0 && stylePropsMap.has(clippedPropName)) {\n unmatchedProps[clippedPropName] = unmatchedProps[propName]\n\n delete unmatchedProps[propName]\n }\n })\n\n return { cssFromProps, unmatchedProps }\n}\n","import DOMPurify from 'dompurify'\n\nfunction getWindow() {\n if (typeof window === 'undefined') {\n // eslint-disable-next-line @typescript-eslint/no-var-requires -- JSDOM is required inline because it has import side effects that depend on node\n const { JSDOM } = require('jsdom')\n return new JSDOM('<!DOCTYPE html>').window\n }\n\n return window\n}\n\nexport function sanitize(dirty?: string) {\n if (!dirty) {\n return { __html: '' }\n }\n\n return {\n __html: DOMPurify(getWindow()).sanitize(dirty, {\n ALLOWED_TAGS: [\n 'b',\n 'i',\n 'a',\n 'span',\n 'div',\n 'p',\n 'pre',\n 'u',\n 'br',\n 'img',\n 'code',\n 'li',\n 'ul',\n 'table',\n 'tbody',\n 'thead',\n 'tr',\n 'td',\n 'th',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'video',\n ],\n ALLOWED_ATTR: [\n 'style',\n 'class',\n 'target',\n 'id',\n 'href',\n 'alt',\n 'src',\n 'controls',\n 'autoplay',\n 'loop',\n 'muted',\n ],\n }),\n }\n}\n","import * as React from 'react'\n\nimport { Box, BoxProps } from '../Box'\n\nimport * as styles from './Text.styles'\n\nconst textVariantNames = [\n 'Display1',\n 'Display2',\n 'H1',\n 'H2',\n 'H3',\n 'H4',\n 'Body1',\n 'Body2',\n 'Caption',\n] as const\n\nexport interface TextProps extends BoxProps {}\n\nconst textVariants = Object.fromEntries(\n textVariantNames.map((variant) => {\n const defaultAs = ['H1', 'H2', 'H3', 'H4'].includes(variant)\n ? (variant.toLowerCase() as 'h1' | 'h2' | 'h3' | 'h4')\n : 'span'\n\n const component = React.forwardRef(\n (\n { as = defaultAs, children, ...props }: BoxProps,\n ref: React.ForwardedRef<HTMLDivElement>\n ) => (\n <Box as={as} {...styles[variant]} {...props} ref={ref}>\n {children}\n </Box>\n )\n ) as React.ForwardRefExoticComponent<BoxProps>\n\n component.displayName = `Text.${variant}`\n\n return [variant, component]\n })\n)\n\nexport const Display1 = textVariants['Display1']\nexport const Display2 = textVariants['Display2']\n\n/* eslint-disable react-refresh/only-export-components -- False positive on H# components, see: https://github.com/ArnaudBarre/eslint-plugin-react-refresh/blob/main/src/only-export-components.ts#L9 */\nexport const H1 = textVariants['H1']\nexport const H2 = textVariants['H2']\nexport const H3 = textVariants['H3']\nexport const H4 = textVariants['H4']\n/* eslint-enable react-refresh/only-export-components */\n\nexport const Body1 = textVariants['Body1']\nexport const Body2 = textVariants['Body2']\nexport const Caption = textVariants['Caption']\n","const base = {\n color: 'neutral.foreground',\n fontFamily: 'default',\n margin: '0',\n}\n\nexport const Display1 = {\n ...base,\n fontSize: '5xl',\n fontWeight: 'bold',\n lineHeight: '4xl',\n}\n\nexport const Display2 = {\n ...base,\n fontSize: '4xl',\n fontWeight: 'bold',\n lineHeight: '3xl',\n}\n\nexport const H1 = {\n ...base,\n fontSize: '3xl',\n fontWeight: 'bold',\n lineHeight: '2xl',\n}\n\nexport const H2 = {\n ...base,\n fontSize: '2xl',\n fontWeight: 'bold',\n lineHeight: 'xl',\n}\n\nexport const H3 = {\n ...base,\n fontSize: 'xl',\n fontWeight: 'bold',\n lineHeight: 'lg',\n}\n\nexport const H4 = {\n ...base,\n fontSize: 'lg',\n fontWeight: 'bold',\n lineHeight: 'md',\n}\n\nexport const Body1 = {\n ...base,\n fontSize: 'md',\n fontWeight: 'regular',\n lineHeight: 'md',\n}\n\nexport const Body2 = {\n ...base,\n fontSize: 'sm',\n fontWeight: 'regular',\n lineHeight: 'md',\n}\n\nexport const Caption = {\n ...base,\n fontSize: 'xs',\n fontWeight: 'regular',\n lineHeight: 'sm',\n}\n","const base = {\n borderWidth: '0',\n borderRadius: 'md',\n display: 'flex',\n gap: '2',\n padding: '2 4',\n}\n\nexport const Primary = {\n ...base,\n backgroundColor: 'primary.surface',\n color: 'primary.foreground',\n\n 'backgroundColor:hover': 'primary.hover.surface',\n}\n\nexport const Secondary = {\n ...base,\n\n backgroundColor: 'secondary.background',\n borderColor: 'secondary.border',\n borderStyle: 'solid',\n borderWidth: '1px',\n color: 'secondary.foreground',\n\n 'backgroundColor:hover': 'secondary.hover.background',\n}\n\nexport const Link = {\n ...base,\n\n backgroundColor: 'transparent',\n color: 'primary.surface',\n\n 'color:hover': 'primary.hover.surface',\n}\n\nexport const Plain = {\n ...base,\n\n backgroundColor: 'transparent',\n color: 'neutral.foreground',\n}\n","import { Box, BoxProps } from '../Box'\nimport { Text } from '../Text'\n\nimport * as styles from './Button.styles'\n\n// TODO: Generate this type from buttonVariantNames\ntype ButtonVariant = 'Primary' | 'Secondary' | 'Link' | 'Plain'\n\nexport interface ButtonProps extends BoxProps {\n title?: string\n variant?: ButtonVariant\n}\n\nfunction BaseButton({ as, children, part, title, variant = 'Primary', ...props }: ButtonProps) {\n const variantPart = variant.toLocaleLowerCase()\n\n return (\n <Box as={as ?? 'button'} part={[`button-${variantPart}`, part]} {...styles[variant]} {...props}>\n {children}\n {title && (\n <Text.Body2 flexGrow=\"1\" fontWeight=\"demibold\" color=\"inherit\">\n {title}\n </Text.Body2>\n )}\n </Box>\n )\n}\n\nconst buttonVariantNames: ButtonVariant[] = ['Primary', 'Secondary', 'Link', 'Plain']\n\nconst buttonVariantComponents = Object.fromEntries(\n buttonVariantNames.map((variant) => {\n const component = (props: ButtonProps) => {\n return (\n <BaseButton {...props} variant={variant}>\n {props.children}\n </BaseButton>\n )\n }\n\n component.displayName = `Text.${variant}`\n\n return [variant, component]\n })\n)\n\nexport const Button = Object.assign(BaseButton, buttonVariantComponents)\n","import * as React from 'react'\nimport type { ForwardRefExoticComponent, RefAttributes } from 'react'\nimport { EmotionJSX } from '@emotion/react/types/jsx-namespace'\n\nimport { Button, type ButtonProps } from '../Button'\nimport { Flex } from '../Flex'\nimport { FlowCard } from './FlowCard'\nimport { Media, type MediaProps } from '../Media'\nimport { Text, type TextProps } from '../Text'\n\nimport { type FlowComponentProps } from '@/shared/types'\n\ninterface CardComponent\n extends ForwardRefExoticComponent<Omit<FlowComponentProps, 'ref'> & RefAttributes<unknown>> {\n Media: (props: MediaProps) => EmotionJSX.Element\n Primary: (props: ButtonProps) => EmotionJSX.Element\n Secondary: (props: ButtonProps) => EmotionJSX.Element\n Subtitle: (props: TextProps) => EmotionJSX.Element\n Title: (props: TextProps) => EmotionJSX.Element\n}\n\nexport const Card = React.forwardRef(({ as, children, ...props }: FlowComponentProps, ref) => {\n // If props.flowId is set, render FlowCard instead\n if (props.flowId != null) {\n return <FlowCard as={as} {...props} />\n }\n\n const Component = as ?? Flex.Column\n return (\n <Component\n backgroundColor=\"neutral.background\"\n borderRadius=\"md\"\n gap={5}\n p={5}\n {...props}\n ref={ref}\n >\n {children}\n </Component>\n )\n}) as CardComponent\n\nCard.Media = ({ src, ...props }: MediaProps) => {\n if (src == null) return null\n\n return <Media borderRadius=\"md\" src={src} {...props} />\n}\n\nCard.Primary = ({ onClick, title, ...props }: ButtonProps) => {\n if (title == null) return null\n\n return <Button.Primary title={title} onClick={onClick} {...props} />\n}\n\nCard.Secondary = ({ onClick, title, ...props }: ButtonProps) => {\n if (title == null) return null\n\n return <Button.Secondary title={title} onClick={onClick} {...props} />\n}\n\nCard.Subtitle = ({ children, ...props }: TextProps) => {\n if (children == null) return null\n\n return (\n <Text.Body2 display=\"block\" part=\"subtitle\" mt={1} {...props}>\n {children}\n </Text.Body2>\n )\n}\n\nCard.Title = ({ children, ...props }: TextProps) => {\n if (children == null) return null\n\n return (\n <Text.Body1 display=\"block\" fontWeight=\"bold\" part=\"title\" {...props}>\n {children}\n </Text.Body1>\n )\n}\n","import * as React from 'react'\nimport { Box, BoxProps } from '../Box'\n\nexport const Row = React.forwardRef(({ children, css, ...props }: BoxProps, ref) => {\n return (\n <Box css={[{ display: 'flex', flexDirection: 'row' }, css]} {...props} ref={ref}>\n {children}\n </Box>\n )\n})\n\nexport const Column = React.forwardRef(({ children, css, ...props }: BoxProps, ref) => {\n return (\n <Box css={[{ display: 'flex', flexDirection: 'column' }, css]} {...props} ref={ref}>\n {children}\n </Box>\n )\n})\n","import { type ReactNode, useEffect, useMemo } from 'react'\nimport { type Flow, type FlowStep } from '@frigade/js'\nimport { XMarkIcon } from '@heroicons/react/24/solid'\n\nimport { Box, type BoxProps } from '@/components/Box'\nimport { Button, type ButtonProps } from '@/components/Button'\nimport { Dialog } from '@/components/Dialog'\n\nimport { type FlowComponentProps } from '@/shared/types'\n\nimport { useFlow } from './useFlow'\nimport { type DismissHandler, useFlowHandlers } from './useFlowHandlers'\nimport { type StepHandler, useStepHandlers } from './useStepHandlers'\nimport { useModal } from './useModal'\n\nexport interface FlowComponentChildrenProps {\n flow: Flow\n handleDismiss: DismissHandler\n handlePrimary: StepHandler\n handleSecondary: StepHandler\n step: FlowStep\n}\n\nexport interface FlowComponentChildren extends BoxProps {\n children: (props: FlowComponentChildrenProps) => ReactNode\n}\n\nexport function CloseButton(props: ButtonProps) {\n return (\n <Button.Plain part=\"close\" position=\"absolute\" right=\"-4px\" top=\"4px\" {...props}>\n <XMarkIcon height=\"24\" fill=\"currentColor\" />\n </Button.Plain>\n )\n}\n\nexport function useFlowComponent({\n as,\n container,\n dismissible = true,\n flowId,\n onComplete,\n onDismiss,\n onPrimary,\n onSecondary,\n variables,\n ...props\n}: FlowComponentProps) {\n const ContainerElement = container === 'dialog' ? Dialog : as ?? Box\n const DismissElement = ContainerElement.Close ?? CloseButton\n\n // useMemo this component so it isn't recreated on every render\n const FlowComponent = function FlowComponent({\n children,\n ...flowComponentProps\n }: FlowComponentChildren) {\n const { flow } = useFlow(flowId, {\n variables,\n })\n const step = flow?.getCurrentStep()\n\n const { handleDismiss } = useFlowHandlers(flow, {\n onComplete,\n onDismiss,\n })\n\n const { handlePrimary, handleSecondary } = useStepHandlers(step, {\n onPrimary,\n onSecondary,\n })\n\n const { isCurrentModal, removeModal } = useModal(flow)\n\n useEffect(() => {\n if (!flow?.isVisible && isCurrentModal) {\n removeModal()\n }\n }, [flow?.isVisible, isCurrentModal])\n\n if (flow == null || !flow.isVisible || !isCurrentModal) {\n return null\n }\n\n flow.start()\n step.start()\n\n return (\n <ContainerElement position=\"relative\" {...flowComponentProps} {...props}>\n {dismissible && <DismissElement onClick={handleDismiss} />}\n\n {children({\n flow,\n handleDismiss,\n handlePrimary,\n handleSecondary,\n step,\n })}\n </ContainerElement>\n )\n }\n\n const MemoizedFlowComponent = useMemo(() => FlowComponent, [])\n\n return {\n FlowComponent: MemoizedFlowComponent,\n }\n}\n","import { type Flow } from '@frigade/js'\nimport { useContext, useEffect, useState } from 'react'\n\nimport { FrigadeContext } from '../components/Provider'\n\nexport interface FlowConfig {\n variables?: Record<string, unknown>\n}\n\nexport function useFlow(flowId: string, config?: FlowConfig) {\n const [flow, setFlow] = useState<Flow>()\n const [, setRandomString] = useState<string>('')\n const { frigade } = useContext(FrigadeContext)\n\n const handler = (updatedFlow: Flow) => {\n if (updatedFlow.id !== flowId) {\n return\n }\n\n if (config?.variables) {\n updatedFlow.applyVariables(config.variables)\n }\n\n setFlow(updatedFlow)\n setRandomString(Math.random().toString())\n }\n\n useEffect(() => {\n ;(async () => {\n const flowInstance: Flow = await frigade.getFlow(flowId)\n if (!flowInstance || frigade.hasFailedToLoad()) {\n setFlow(undefined)\n return\n }\n if (config?.variables) {\n flowInstance.applyVariables(config.variables)\n }\n\n setFlow(flowInstance)\n })()\n\n frigade.onStateChange(handler)\n\n return () => {\n frigade.removeStateChangeHandler(handler)\n }\n }, [])\n\n return { flow }\n}\n","import {\n createContext,\n type Dispatch,\n type SetStateAction,\n useEffect,\n useMemo,\n useState,\n} from 'react'\nimport { Global, ThemeProvider } from '@emotion/react'\n\nimport {\n createThemeVariables,\n theme as themeTokens,\n type Theme,\n themeVariables,\n} from '../../shared/theme'\nimport { Frigade } from '@frigade/js'\n\ntype NavigateHandler = (url: string, target?: string) => void\n\n// TODO: type theme something like Partial<typeof themeTokens>, but allow any value for those keys\nexport interface ProviderProps {\n apiKey: string\n apiUrl?: string\n children?: React.ReactNode\n navigate?: NavigateHandler\n theme?: Theme\n userId?: string\n groupId?: string\n /**\n * @ignore Internal use only.\n * If enabled, Frigade will not send any data to the API. A user's state will be reset on page refresh.\n */\n __readOnly?: boolean\n\n /**\n * @ignore Internal use only.\n * Map of Flow ID to Flow Config for all flows in the app.\n * Configs will have to be provided in serialized JSON format rather than YAML.\n */\n __flowConfigOverrides?: Record<string, string>\n}\n\ninterface ProviderContext extends Omit<ProviderProps, 'children' | 'theme'> {\n modals: Set<string>\n setModals: Dispatch<SetStateAction<Set<string>>>\n currentModal: string | null\n frigade?: Frigade\n}\n\nexport const FrigadeContext = createContext<ProviderContext>({\n apiKey: '',\n modals: new Set(),\n setModals: () => {},\n currentModal: null,\n navigate: () => {},\n})\n\nexport function Provider({ children, navigate, theme, ...props }: ProviderProps) {\n const themeOverrides = theme ? createThemeVariables(theme) : {}\n const [modals, setModals] = useState(new Set<string>())\n const frigade = useMemo<Frigade>(() => {\n return new Frigade(props.apiKey, {\n apiKey: props.apiKey,\n apiUrl: props.apiUrl,\n userId: props.userId,\n groupId: props.groupId,\n __readOnly: props.__readOnly,\n __flowConfigOverrides: props.__flowConfigOverrides,\n })\n }, [props.userId, props.groupId, props.apiKey])\n\n const navigateHandler =\n navigate ??\n ((url, target = '_self') => {\n window.open(url, target)\n })\n\n useEffect(() => {\n return () => {\n frigade.destroy()\n }\n }, [])\n\n const currentModal = modals.size > 0 ? modals.values().next().value : null\n\n return (\n <FrigadeContext.Provider\n value={{\n modals,\n setModals,\n currentModal,\n navigate: navigateHandler,\n ...props,\n frigade: frigade,\n }}\n >\n <Global styles={{ ':root': { ...themeVariables, ...themeOverrides } }} />\n <ThemeProvider theme={themeTokens}>{children}</ThemeProvider>\n </FrigadeContext.Provider>\n )\n}\n","import { MouseEvent, useCallback, useEffect, useRef } from 'react'\n\nimport { Flow } from '@frigade/js'\n\nexport type FlowHandlerProp = (\n flow: Flow,\n event?: React.MouseEvent<unknown>\n) => Promise<boolean | void> | (boolean | void)\n\nexport interface FlowHandlerProps {\n onComplete?: FlowHandlerProp\n onDismiss?: FlowHandlerProp\n}\n\nexport type DismissHandler = (e: React.MouseEvent<unknown>) => Promise<boolean | void>\n\nexport function useFlowHandlers(flow: Flow, { onComplete, onDismiss }: FlowHandlerProps = {}) {\n const lastCompleted = useRef(null)\n\n useEffect(() => {\n if (flow == null) return\n\n if (flow.isCompleted && lastCompleted.current === false) {\n ;(async () => {\n await onComplete?.(flow)\n })()\n }\n\n lastCompleted.current = flow?.isCompleted\n }, [flow?.isCompleted])\n\n return {\n handleDismiss: useCallback<DismissHandler>(\n async (e: React.MouseEvent<unknown>) => {\n const continueDefault = await onDismiss?.(flow, e)\n\n if (continueDefault === false) {\n e.preventDefault()\n return false\n }\n\n await flow.skip()\n },\n [flow]\n ),\n }\n}\n","import { MouseEvent, useCallback, useContext } from 'react'\n\nimport type { FlowStep } from '@frigade/js'\n\nimport { FrigadeContext } from '../components/Provider'\n\nexport type StepHandlerProp = (\n step: FlowStep,\n event?: React.MouseEvent<unknown>\n) => Promise<boolean | void> | (boolean | void)\n\nexport interface StepHandlerProps {\n onPrimary?: StepHandlerProp\n onSecondary?: StepHandlerProp\n}\n\nexport type StepHandler = (e: React.MouseEvent<unknown>) => Promise<boolean | void>\n\nexport function useStepHandlers(step: FlowStep, { onPrimary, onSecondary }: StepHandlerProps = {}) {\n const { navigate } = useContext(FrigadeContext)\n\n return {\n handlePrimary: useCallback<StepHandler>(\n async (e: React.MouseEvent<unknown>) => {\n const continueDefault = await onPrimary?.(step, e)\n\n if (continueDefault === false) {\n e.preventDefault()\n return false\n }\n\n await step.complete()\n\n if (step.primaryButtonUri != null) {\n navigate(step.primaryButtonUri, step.primaryButtonUriTarget)\n }\n },\n [step]\n ),\n\n handleSecondary: useCallback<StepHandler>(\n async (e: React.MouseEvent<unknown>) => {\n const continueDefault = await onSecondary?.(step, e)\n\n if (continueDefault === false) {\n e.preventDefault()\n return false\n }\n\n // Should there be a step.skip method?\n await step.complete()\n\n if (step.secondaryButtonUri != null) {\n navigate(step.secondaryButtonUri, step.secondaryButtonUriTarget)\n }\n },\n [step]\n ),\n }\n}\n","import { useContext, useEffect, useState } from 'react'\n\nimport { FrigadeContext } from '../components/Provider'\nimport { Flow } from '@frigade/js'\n\nexport function useModal(flow: Flow) {\n const { currentModal, modals, setModals } = useContext(FrigadeContext)\n const [isCurrentModal, setIsCurrentModal] = useState(false)\n\n useEffect(() => {\n if (flow?.isVisible && flow && !modals.has(flow.id)) {\n setModals((prevModals) => new Set(prevModals).add(flow.id))\n }\n }, [flow?.id, flow?.isVisible])\n\n useEffect(() => {\n const newIsCurrentModal = currentModal === flow?.id\n\n if (flow?.id != null && newIsCurrentModal !== isCurrentModal) {\n setIsCurrentModal(newIsCurrentModal)\n }\n }, [flow?.id, currentModal])\n\n function removeModal() {\n if (modals.has(flow?.id)) {\n setModals((prevModals) => {\n const nextModals = new Set(prevModals)\n nextModals.delete(flow?.id)\n\n return nextModals\n })\n }\n }\n\n return {\n isCurrentModal,\n removeModal,\n }\n}\n","import { useFlowComponent } from '@/hooks/useFlowComponent'\nimport { type FlowComponentProps } from '@/shared/types'\n\nimport { Card } from './'\nimport { Flex } from '../Flex'\n\nexport function FlowCard(props: FlowComponentProps) {\n const { FlowComponent } = useFlowComponent(props)\n\n return (\n <FlowComponent as={Card} gap={5}>\n {({ handlePrimary, handleSecondary, step }) => (\n <>\n <Card.Title>{step.title}</Card.Title>\n <Card.Subtitle>{step.subtitle}</Card.Subtitle>\n\n <Card.Media src={step.imageUri} css={{ objectFit: 'contain', width: '100%' }} />\n\n <Flex.Row gap={3} justifyContent=\"flex-end\">\n <Card.Secondary title={step.secondaryButtonTitle} onClick={handleSecondary} />\n <Card.Primary title={step.primaryButtonTitle ?? 'Continue'} onClick={handlePrimary} />\n </Flex.Row>\n </>\n )}\n </FlowComponent>\n )\n}\n","import { Box, BoxProps } from '../Box'\n\nexport interface ImageProps extends BoxProps {\n src: string\n}\n\nexport function Image({ part, src, ...props }: ImageProps) {\n return <Box as=\"img\" part={['image', part]} src={src} {...props} />\n}\n","import { Box, BoxProps } from '../Box'\n\nfunction getVideoEmbedSrc(videoUri: string) {\n if (videoUri.includes('youtube')) {\n const videoId = videoUri.split('v=')[1]?.split('&')[0]\n\n return `https://www.youtube.com/embed/${videoId}`\n } else if (videoUri.includes('vimeo')) {\n const videoId = videoUri.split('vimeo.com/')[1]?.split('&')[0]\n\n return `https://player.vimeo.com/video/${videoId}`\n } else if (videoUri.includes('wistia')) {\n const videoId = videoUri.split('wistia.com/medias/')[1]?.split('&')[0]\n\n return `https://fast.wistia.net/embed/iframe/${videoId}`\n }\n\n throw new Error('Could not map videoUri to a known provider (Youtube, Vimeo, Wistia).')\n}\n\nexport interface VideoProps extends BoxProps {\n src: string\n}\n\nexport function Video({ part, src, ...props }: VideoProps) {\n const videoEmbedSrc = getVideoEmbedSrc(src)\n\n // TODO: Add play button overtop?\n return (\n <Box\n allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\"\n allowFullScreen\n as=\"iframe\"\n backgroundColor=\"gray100\"\n borderWidth={0}\n part={['video', part]}\n src={videoEmbedSrc}\n {...props}\n ></Box>\n )\n}\n","import { Image } from './Image'\nimport { Video } from './Video'\nimport { BoxProps } from '../Box'\n\nexport interface MediaProps extends BoxProps {\n src: string\n type?: 'image' | 'video'\n}\n\nexport function Media({ src, type, ...props }: MediaProps) {\n const Component = type === 'video' ? Video : Image\n\n return <Component src={src} {...props} />\n}\n","import { Dialog, type DialogProps } from '../Dialog'\nimport { Flex } from '../Flex'\nimport { type FlowComponentProps } from '@/shared/types'\nimport { useFlowComponent } from '@/hooks/useFlowComponent'\n\nexport interface AnnouncementProps extends FlowComponentProps, Omit<DialogProps, 'container'> {}\n\nexport function Announcement(props: AnnouncementProps) {\n // TODO: Make Dialog subcomponents agnostic once Card is fleshed out, remove forced container='dialog'\n const { FlowComponent } = useFlowComponent({ ...props, container: 'dialog' })\n\n return (\n <FlowComponent>\n {({ flow, handlePrimary, handleSecondary, step }) => (\n <>\n <Dialog.Title>{step.title}</Dialog.Title>\n <Dialog.Subtitle>{step.subtitle}</Dialog.Subtitle>\n\n <Dialog.Media\n src={step.imageUri}\n css={{ aspectRatio: '1.5', objectFit: 'cover', width: '100%' }}\n />\n\n <Dialog.ProgressDots\n current={flow.getNumberOfCompletedSteps()}\n total={flow.getNumberOfAvailableSteps()}\n />\n\n <Flex.Row\n css={{\n '& > button': {\n flexGrow: 1,\n },\n }}\n gap={3}\n >\n {step.secondaryButtonTitle && (\n <Dialog.Secondary title={step.secondaryButtonTitle} onClick={handleSecondary} />\n )}\n <Dialog.Primary title={step.primaryButtonTitle ?? 'Continue'} onClick={handlePrimary} />\n </Flex.Row>\n </>\n )}\n </FlowComponent>\n )\n}\n","import { Button } from '@/components/Button'\nimport { Card } from '@/components/Card'\nimport { Flex } from '@/components/Flex'\nimport { Text } from '@/components/Text'\n\nimport { XMarkIcon } from '@heroicons/react/24/solid'\n\nimport { useFlowComponent } from '@/hooks/useFlowComponent'\n\nimport type { FlowComponentProps } from '@/shared/types'\n\ninterface BannerProps extends FlowComponentProps {}\n\nexport function Banner(props: BannerProps) {\n const { FlowComponent } = useFlowComponent(props)\n\n return (\n <FlowComponent\n as={Card}\n border=\"md\"\n borderColor=\"gray900\"\n display=\"flex\"\n flexDirection=\"row\"\n gap={3}\n justifyContent=\"space-between\"\n >\n {({ handleDismiss, handlePrimary, handleSecondary, step }) => (\n <>\n <Flex.Row gap={3}>\n {step.imageUri && (\n <img src={step.imageUri} style={{ height: 40, width: 40, alignSelf: 'center' }} />\n )}\n <Flex.Column>\n <Text.H4 mb={1}>{step.title}</Text.H4>\n <Text.Body2>{step.subtitle}</Text.Body2>\n </Flex.Column>\n </Flex.Row>\n\n <Flex.Row alignItems=\"center\" gap={3} justifyContent=\"center\">\n {step.secondaryButtonTitle && (\n <Button.Secondary title={step.secondaryButtonTitle} onClick={handleSecondary} />\n )}\n <Button.Primary title={step.primaryButtonTitle} onClick={handlePrimary} />\n {props.dismissible && props.container != 'dialog' && (\n <Button.Plain part=\"banner-close\" onClick={handleDismiss}>\n <XMarkIcon height=\"24\" fill=\"currentColor\" />\n </Button.Plain>\n )}\n </Flex.Row>\n </>\n )}\n </FlowComponent>\n )\n}\n","import { useController, useForm } from 'react-hook-form'\n\nimport { Button } from '@/components/Button'\nimport { Flex } from '@/components/Flex'\n\nimport { type FormFieldData, type FormProps, type ValidationRules } from '.'\n\n// See: https://react-hook-form.com/get-started#Applyvalidation\n// NOTE: \"validate\" is intentionally omitted\nconst ruleProps = new Set(['required', 'min', 'max', 'minLength', 'maxLength', 'pattern'])\n\nfunction FieldWrapper({ fieldComponent: FieldComponent, control, fieldData }) {\n // pattern validator comes as a string from YAML, convert it to RegExp\n if (fieldData.pattern != null) {\n if (typeof fieldData.pattern === 'string') {\n fieldData.pattern = new RegExp(fieldData.pattern.replace(/^\\/|\\/$/g, ''))\n } else if (\n typeof fieldData.pattern === 'object' &&\n typeof fieldData.pattern.value === 'string'\n ) {\n fieldData.pattern.value = new RegExp(fieldData.pattern.value.replace(/^\\/|\\/$/g, ''))\n }\n }\n\n const rules = Object.fromEntries(\n Object.entries(fieldData).filter(([key]) => ruleProps.has(key))\n ) as ValidationRules\n\n const controller = useController({\n name: fieldData.id,\n control,\n rules,\n })\n\n return <FieldComponent {...controller} fieldData={fieldData} />\n}\n\nexport function FormStep({ fieldTypes, step }: Pick<FormProps, 'fieldTypes' | 'step'>) {\n const { control, handleSubmit } = useForm({\n delayError: 2000,\n mode: 'onChange',\n })\n const fields = []\n\n // TODO: Type for data\n function onSubmit(data: unknown) {\n step.complete(data)\n }\n\n step.fields?.forEach((fieldData: FormFieldData) => {\n if (fieldTypes[fieldData.type] != null) {\n fields.push(\n <FieldWrapper\n key={fieldData.id}\n control={control}\n fieldComponent={fieldTypes[fieldData.type]}\n fieldData={fieldData}\n />\n )\n }\n })\n\n return (\n <>\n {fields}\n <Flex.Row key=\"form-footer\" justifyContent=\"flex-end\">\n <Button.Primary\n title={step.primaryButtonTitle ?? 'Submit'}\n onClick={handleSubmit(onSubmit)}\n />\n </Flex.Row>\n </>\n )\n}\n","import * as React from 'react'\nimport * as RadioGroup from '@radix-ui/react-radio-group'\n\nimport { Box } from '@/components/Box'\nimport { Flex } from '@/components/Flex'\nimport { Text } from '@/components/Text'\n\nimport { type FormFieldProps } from '..'\nimport { BaseField } from './BaseField'\n\nexport interface SelectItemProps {\n label: string\n value: string\n}\n\n// NOTE: This isn't quite exactly the same as the HeroIcons checkmark\nconst CheckIcon = () => (\n <Box as=\"svg\" color=\"primary.foreground\" width=\"10px\" height=\"8px\" viewBox=\"0 0 10 8\" fill=\"none\">\n <path\n d=\"M1 4.34664L3.4618 6.99729L3.4459 6.98017L9 1\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </Box>\n)\n\nconst RadioItem = React.forwardRef<HTMLButtonElement, SelectItemProps>(\n ({ label, value }, forwardedRef) => (\n <Box\n as=\"label\"\n htmlFor={value}\n display=\"flex\"\n justifyContent=\"space-between\"\n part=\"field-radio\"\n px={4}\n py={2}\n borderWidth=\"md\"\n borderStyle=\"solid\"\n borderColor=\"neutral.border\"\n borderRadius=\"md\"\n >\n <Text.Body2 part=\"field-radio-label\">{label}</Text.Body2>\n\n <RadioGroup.Item id={value} value={value} ref={forwardedRef} asChild>\n <Box\n as=\"button\"\n backgroundColor=\"neutral.background\"\n borderWidth=\"md\"\n borderStyle=\"solid\"\n borderColor=\"neutral.border\"\n borderRadius=\"100%\"\n padding=\"0\"\n part=\"field-radio-value\"\n position=\"relative\"\n height=\"24px\"\n width=\"24px\"\n >\n <Box\n as={RadioGroup.Indicator}\n alignItems=\"center\"\n bg=\"primary.surface\"\n borderWidth=\"md\"\n borderStyle=\"solid\"\n borderColor=\"primary.border\"\n borderRadius=\"100%\"\n display=\"flex\"\n height=\"calc(100% + 2px)\"\n justifyContent=\"center\"\n left=\"-1px\"\n part=\"field-radio-indicator\"\n position=\"absolute\"\n top=\"-1px\"\n width=\"calc(100% + 2px)\"\n >\n <CheckIcon />\n </Box>\n </Box>\n </RadioGroup.Item>\n </Box>\n )\n)\n\nexport function RadioField(props: FormFieldProps) {\n const {\n field: { onChange, value },\n fieldData: { options = [] },\n } = props\n\n const radioItems = options.map(({ label, value }) => (\n <RadioItem key={value} value={value} label={label} />\n ))\n\n return (\n <BaseField {...props}>\n {() => (\n <RadioGroup.Root value={value} onValueChange={onChange} asChild>\n <Flex.Column gap={2} part=\"field-radio-group\">\n {radioItems}\n </Flex.Column>\n </RadioGroup.Root>\n )}\n </BaseField>\n )\n}\n","import { type FieldError } from 'react-hook-form'\n\nimport { Text } from '@/components/Text'\n\nexport interface ErrorProps {\n error: FieldError\n}\n\nexport function Error({ error }: ErrorProps) {\n if (!error?.message?.length) {\n return null\n }\n\n return (\n <Text.Caption color=\"red500\" display=\"block\" part=\"field-error\" textAlign=\"end\">\n {error?.message}\n </Text.Caption>\n )\n}\n","import { Text } from '@/components/Text'\n\nexport function Label({ children, id, required = false }) {\n return (\n <Text.Body2 as=\"label\" htmlFor={id} fontWeight=\"demibold\" part=\"field-label\">\n {children}\n {required && ' *'}\n </Text.Body2>\n )\n}\n","export const field = {\n marginBottom: '5',\n}\n\nexport const input = {\n px: '4',\n py: '2',\n backgroundColor: 'neutral.background',\n borderColor: 'neutral.border',\n borderStyle: 'solid',\n borderWidth: 'md',\n borderRadius: 'md',\n display: 'block',\n outline: 'none',\n width: '100%',\n}\n","import { Box } from '@/components/Box'\n\nimport { type FormFieldProps } from '..'\nimport { Error } from './Error'\nimport { Label } from './Label'\nimport * as styles from './BaseField.styles'\n\ninterface BaseFieldProps extends FormFieldProps {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO: Tighten up fieldProps type\n children: (fieldProps?: any) => React.ReactNode\n}\n\nexport function BaseField({ children, field, fieldData, fieldState }: BaseFieldProps) {\n const { id, label, placeholder } = fieldData\n const { error } = fieldState\n\n const fieldProps = {\n id,\n ...field,\n ...(placeholder ? { placeholder } : {}),\n ...styles.input,\n 'aria-invalid': !!error,\n value: field.value ?? '',\n }\n\n return (\n <Box {...styles.field} part=\"field\">\n <Label id={id} required={!!fieldData.required}>\n {label}\n </Label>\n\n {children(fieldProps)}\n\n <Error error={error} />\n </Box>\n )\n}\n","import * as React from 'react'\nimport * as Select from '@radix-ui/react-select'\nimport { ChevronDownIcon } from '@heroicons/react/24/outline'\n\nimport { Box } from '@/components/Box'\nimport { Text } from '@/components/Text'\n\nimport { type FormFieldProps } from '..'\nimport { BaseField } from './BaseField'\nimport * as baseStyles from './BaseField.styles'\n\nexport interface SelectItemProps {\n label: string\n value: string\n}\n\nconst SelectItem = React.forwardRef<HTMLDivElement, SelectItemProps>(\n ({ label, value }, forwardedRef) => (\n <Select.Item value={value} ref={forwardedRef} asChild>\n <Box\n backgroundColor:hover=\"blue900\"\n borderRadius=\"md\"\n outline=\"none\"\n part=\"field-select-option\"\n px=\"3\"\n py=\"2\"\n >\n <Select.ItemText asChild>\n <Text.Body2 part=\"field-select-option-label\">{label}</Text.Body2>\n </Select.ItemText>\n </Box>\n </Select.Item>\n )\n)\n\nexport function SelectField(props: FormFieldProps) {\n // TODO: Label doesn't open select automatically. Need to wire that in.\n const {\n field: { onChange, value },\n fieldData: { options = [], placeholder },\n } = props\n\n const selectItems = options.map(({ label, value }) => (\n <SelectItem key={value} value={value} label={label} />\n ))\n\n return (\n <BaseField {...props}>\n {() => (\n <Select.Root value={value} onValueChange={onChange}>\n <Select.Trigger asChild>\n <Text.Body2\n {...baseStyles.input}\n alignItems=\"center\"\n display=\"flex\"\n justifyContent=\"space-between\"\n part=\"field-select\"\n >\n <Select.Value placeholder={placeholder ?? 'Select one'} />\n\n <Select.Icon>\n <Box\n as={ChevronDownIcon}\n color=\"gray100\"\n display=\"block\"\n height=\"24px\"\n part=\"field-select-icon\"\n width=\"24px\"\n />\n </Select.Icon>\n </Text.Body2>\n </Select.Trigger>\n\n <Select.Portal>\n <Select.Content position=\"popper\" sideOffset={4} asChild>\n <Box\n {...baseStyles.input}\n p=\"1\"\n part=\"field-select-options\"\n width=\"var(--radix-popper-anchor-width)\"\n >\n <Select.Viewport>{selectItems}</Select.Viewport>\n </Box>\n </Select.Content>\n </Select.Portal>\n </Select.Root>\n )}\n </BaseField>\n )\n}\n","import { Text } from '@/components/Text'\n\nimport { type FormFieldProps } from '..'\nimport { BaseField } from './BaseField'\n\nexport function TextField(props: FormFieldProps) {\n return (\n <BaseField {...props}>\n {(fieldProps) => <Text.Body2 as=\"input\" part=\"field-text\" type=\"text\" {...fieldProps} />}\n </BaseField>\n )\n}\n","import { Text } from '@/components/Text'\n\nimport { type FormFieldProps } from '..'\nimport { BaseField } from './BaseField'\n\nexport function TextareaField(props: FormFieldProps) {\n return (\n <BaseField {...props}>\n {(fieldProps) => (\n <Text.Body2 as=\"textarea\" part=\"field-textarea\" {...fieldProps}></Text.Body2>\n )}\n </BaseField>\n )\n}\n","import { FlowStep } from '@frigade/js'\nimport { type ControllerFieldState, type ValidationRule, type Message } from 'react-hook-form'\n\nimport { type FlowComponentProps } from '@/shared/types'\nimport { useFlowComponent } from '@/hooks/useFlowComponent'\n\nimport { FormStep } from './FormStep'\nimport { RadioField } from './fields/RadioField'\nimport { SelectField } from './fields/SelectField'\nimport { TextField } from './fields/TextField'\nimport { TextareaField } from './fields/TextareaField'\n\n// stepComponent prop -> can make this global across the SDK\n\n// TODO: Fix center alignment in Dialog component\n\nexport type FieldTypes = Record<string, React.ComponentType<FormFieldProps>>\n\nconst defaultFieldTypes: FieldTypes = {\n radio: RadioField,\n select: SelectField,\n text: TextField,\n textarea: TextareaField,\n}\n\nexport interface ValidationRules {\n required?: Message | ValidationRule<boolean>\n min?: ValidationRule<number | string>\n max?: ValidationRule<number | string>\n maxLength?: ValidationRule<number>\n minLength?: ValidationRule<number>\n pattern?: ValidationRule<RegExp>\n}\n\n// TODO: We should get this interface from JS-API\nexport interface FormFlowStep extends FlowStep {\n fields: FormFieldData[]\n}\n\n// TODO: We should get this interface from JS-API\n// TODO: Add validation properties to this type\nexport interface FormFieldData extends ValidationRules {\n id: string\n options?: { label: string; value: string }[]\n placeholder?: string\n label?: string\n type: string\n}\n\n// TODO: Wire UseControllerReturn into this type\nexport interface FormFieldProps {\n field: any // eslint-disable-line @typescript-eslint/no-explicit-any\n fieldData: FormFieldData\n formState: any // eslint-disable-line @typescript-eslint/no-explicit-any\n fieldState: ControllerFieldState\n}\n\nexport interface FormProps extends FlowComponentProps {\n fieldTypes?: FieldTypes\n}\n\nexport function Form({ fieldTypes = {}, ...props }: FormProps) {\n const { FlowComponent } = useFlowComponent(props)\n\n const mergedFieldTypes = Object.assign({}, defaultFieldTypes, fieldTypes)\n\n return (\n <FlowComponent>\n {({ step }) => <FormStep fieldTypes={mergedFieldTypes} step={step} {...props} />}\n </FlowComponent>\n )\n}\n","import React, { useEffect, useRef, useState } from 'react'\n\nimport { XMarkIcon } from '@heroicons/react/24/solid'\nimport * as Popover from '@radix-ui/react-popover'\n\nimport { useBoundingClientRect } from '../../hooks/useBoundingClientRect'\nimport { Box } from '../Box'\nimport { Button, ButtonProps } from '../Button'\nimport { Card } from '../Card'\nimport { Dot } from './Dot'\nimport { Media, MediaProps } from '../Media'\nimport { Text, TextProps } from '../Text'\nimport { getDotPosition } from './getDotPosition'\nimport { mapTooltipPropsToPopoverProps } from './mapTooltipPropsToPopoverProps'\n\ninterface MergedRadixPopoverProps\n extends Pick<Popover.PopoverProps, 'defaultOpen' | 'modal' | 'onOpenChange' | 'open'>,\n Omit<Popover.PopoverContentProps, 'align' | 'asChild'> {}\nexport interface TooltipProps extends MergedRadixPopoverProps {\n align?: Popover.PopoverContentProps['align'] | 'before' | 'after'\n anchor?: string\n spotlight?: boolean\n style?: React.CSSProperties\n}\n\nexport function Tooltip({\n anchor,\n children,\n className,\n spotlight = false,\n style,\n ...props\n}: TooltipProps) {\n const { node: contentNode, rect: contentRect, ref: contentRef } = useBoundingClientRect()\n const { node: anchorNode, rect: anchorRect, ref: anchorRef } = useBoundingClientRect()\n const { contentProps, rootProps } = mapTooltipPropsToPopoverProps(props, contentRect)\n\n const [alignAttr, setAlignAttr] = useState(contentProps.align)\n const [sideAttr, setSideAttr] = useState(contentProps.side)\n const [spotlightLeft, setSpotlightLeft] = useState(0)\n const [spotlightTop, setSpotlightTop] = useState(0)\n\n // Radix will update data attrs to let us know if Popover.Content has collided\n if (contentNode !== null) {\n const currentAlignAttr = contentNode.getAttribute('data-align')\n const currentSideAttr = contentNode.getAttribute('data-side')\n\n if (alignAttr !== currentAlignAttr) {\n setAlignAttr(currentAlignAttr)\n }\n\n if (sideAttr !== currentSideAttr) {\n setSideAttr(currentSideAttr)\n }\n }\n\n // Radix requires a separate ref to pass anchor through into Popover.Anchor\n const anchorVirtualRef = useRef(null)\n\n useEffect(() => {\n const anchorQuery = document.querySelector(anchor)\n\n if (anchorQuery != null) {\n anchorRef(anchorQuery)\n anchorVirtualRef.current = anchorQuery\n }\n }, [anchor])\n\n useEffect(() => {\n const { scrollX, scrollY } = window\n\n setSpotlightLeft(anchorRect.left + scrollX)\n setSpotlightTop(anchorRect.top + scrollY)\n }, [anchorRect.left, anchorRect.top])\n\n if (anchorNode == null) {\n return null\n }\n\n let anchorRadius = '0'\n if (typeof window !== 'undefined') {\n anchorRadius = window.getComputedStyle(anchorNode).borderRadius\n }\n\n const dotPosition = getDotPosition({ props, alignAttr, sideAttr })\n\n return (\n <Popover.Root defaultOpen={true} {...rootProps}>\n <Popover.Anchor virtualRef={anchorVirtualRef} />\n <Popover.Portal>\n <div\n className={className}\n css={{ bottom: 0, left: 0, position: 'absolute', right: 0, top: 0, zIndex: 9999 }}\n >\n {spotlight && (\n <Box\n part=\"tooltip-spotlight\"\n position=\"absolute\"\n style={{\n borderRadius: anchorRadius,\n boxShadow: '0 0 0 20000px rgb(0 0 0 / 0.5)',\n height: anchorRect.height,\n left: spotlightLeft,\n top: spotlightTop,\n width: anchorRect.width,\n }}\n />\n )}\n <Popover.Content asChild {...contentProps} ref={contentRef}>\n <Card\n boxShadow=\"md\"\n part=\"tooltip-content\"\n position=\"relative\"\n css={{\n maxWidth: '360px',\n ...style,\n }}\n >\n <Dot style={dotPosition} />\n\n {children}\n </Card>\n </Popover.Content>\n </div>\n </Popover.Portal>\n </Popover.Root>\n )\n}\n\nTooltip.Close = (props: ButtonProps) => {\n return (\n <Popover.Close aria-label=\"Close\" asChild>\n <Button.Plain\n css={{\n top: '12px',\n right: '4px',\n }}\n part=\"close\"\n position=\"absolute\"\n {...props}\n >\n <XMarkIcon height=\"24\" fill=\"currentColor\" />\n </Button.Plain>\n </Popover.Close>\n )\n}\n\nTooltip.Media = ({ src, ...props }: MediaProps) => {\n if (src == null) return null\n\n return (\n <Media\n borderRadius=\"md md 0 0\"\n borderWidth=\"0\"\n css={{\n aspectRatio: '2',\n }}\n margin=\"-5 -5 5\"\n src={src}\n {...props}\n />\n )\n}\n\nTooltip.Primary = ({ onClick, title, ...props }: ButtonProps) => {\n if (title == null) return null\n\n return <Button.Primary title={title} onClick={onClick} {...props} />\n}\n\nTooltip.Progress = ({ children, ...props }: TextProps) => {\n if (children == null) return null\n\n return (\n <Text.Body2 fontWeight=\"demibold\" part=\"progress\" {...props}>\n {children}\n </Text.Body2>\n )\n}\n\nTooltip.Secondary = ({ onClick, title, ...props }: ButtonProps) => {\n if (title == null) return null\n\n return <Button.Secondary title={title} onClick={onClick} {...props} />\n}\n\nTooltip.Subtitle = ({ children, ...props }: TextProps) => {\n if (children == null) return null\n\n return (\n <Text.Body2 part=\"subtitle\" {...props}>\n {children}\n </Text.Body2>\n )\n}\n\nTooltip.Title = ({ children, ...props }: TextProps) => {\n if (children == null) return null\n\n return (\n <Text.Body1 fontWeight=\"bold\" mb={1} part=\"title\" {...props}>\n {children}\n </Text.Body1>\n )\n}\n","import { useCallback, useLayoutEffect, useState } from 'react'\n\nexport function useBoundingClientRect() {\n const initialRect =\n 'DOMRect' in globalThis\n ? new DOMRect()\n : {\n height: 0,\n width: 0,\n x: 0,\n y: 0,\n bottom: 0,\n top: 0,\n right: 0,\n left: 0,\n toJSON: () => {},\n }\n const [rect, setRect] = useState(initialRect)\n const [node, setNode] = useState(null)\n\n const ref = useCallback((node: Element) => {\n setNode(node)\n }, [])\n\n useLayoutEffect(() => {\n if (!node) return\n\n const handleResize = () => {\n const newRect = node.getBoundingClientRect()\n setRect(newRect)\n }\n\n handleResize()\n\n window.addEventListener('resize', handleResize)\n\n return () => window.removeEventListener('resize', handleResize)\n }, [node])\n\n return {\n node,\n rect,\n ref,\n }\n}\n","import { keyframes } from '@emotion/react'\nimport { Box, BoxProps } from '../Box'\n\nconst pulse = keyframes({\n '0%': {\n opacity: 0.5,\n transform: 'scale(0.5)',\n },\n '50%': {\n opacity: 0,\n transform: 'scale(1)',\n },\n '100%': {\n opacity: 0,\n transform: 'scale(1)',\n },\n})\n\nexport interface DotProps extends BoxProps {}\n\nexport function Dot({ style = {}, part = '', ...props }: DotProps) {\n return (\n <Box\n part={`dot-wrapper ${part}`}\n style={{\n height: '48px',\n position: 'absolute',\n width: '48px',\n ...style,\n }}\n {...props}\n >\n <Box\n backgroundColor=\"primary.surface\"\n part=\"dot-pulse\"\n css={{\n animation: `2s ease-out infinite ${pulse}`,\n borderRadius: '24px',\n height: '48px',\n left: 0,\n position: 'absolute',\n top: 0,\n transformOrigin: 'center center',\n width: '48px',\n }}\n />\n <Box\n backgroundColor=\"primary.surface\"\n part=\"dot\"\n style={{\n borderRadius: '12px',\n height: '24px',\n left: '12px',\n position: 'absolute',\n top: '12px',\n width: '24px',\n }}\n />\n </Box>\n )\n}\n","export function getDotPosition({ props, alignAttr, sideAttr }) {\n const currentSide = sideAttr ?? 'bottom'\n const dotProps = {}\n\n // Radix's collision system isn't aware of our custom before|after align\n const getCurrentAlign = () => {\n if (['after', 'before'].includes(props.align)) {\n if (alignAttr == 'start') {\n return 'before'\n } else if (alignAttr == 'end') {\n return 'after'\n }\n }\n\n return props.align ?? 'after'\n }\n\n const dotOffset = '-24px'\n\n const oppositeSides = {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right',\n }\n\n /* \n Rules:\n - Dot is opposite to side prop (e.g. side=left -> dot=right)\n - align=before|end -> Dot goes to highest extent (right/bottom) of align-axis\n - align=after|start -> Dot goes to lowest extent (left/top) of align-axis\n - align=center -> Dot goes to the center\n */\n\n dotProps[oppositeSides[currentSide]] = dotOffset\n\n const currentAlign = getCurrentAlign()\n\n if (['before', 'end'].includes(currentAlign)) {\n if (['top', 'bottom'].includes(currentSide)) {\n dotProps['right'] = dotOffset\n } else {\n dotProps['bottom'] = dotOffset\n }\n } else if (['after', 'start'].includes(currentAlign)) {\n if (['top', 'bottom'].includes(currentSide)) {\n dotProps['left'] = dotOffset\n } else {\n dotProps['top'] = dotOffset\n }\n } else {\n // The only option left is align=center\n if (['top', 'bottom'].includes(currentSide)) {\n dotProps['left'] = `calc(50% + ${dotOffset})`\n } else {\n dotProps['top'] = `calc(50% + ${dotOffset})`\n }\n }\n\n return dotProps\n}\n","import { TooltipProps } from '.'\n\nconst RADIX_PROPS = {\n content: [\n 'align',\n 'alignOffset',\n 'arrowPadding',\n 'avoidCollisions',\n 'collisionBoundary',\n 'collisionPadding',\n 'forceMount',\n 'hideWhenDetached',\n 'onCloseAutoFocus',\n 'onEscapeKeyDown',\n 'onFocusOutside',\n 'onInteractOutside',\n 'onOpenAutoFocus',\n 'onPointerDownOutside',\n 'side',\n 'sideOffset',\n 'sticky',\n ],\n root: ['defaultOpen', 'modal', 'onOpenChange', 'open'],\n}\n\nexport function mapTooltipPropsToPopoverProps(props: TooltipProps, contentRect: DOMRect) {\n const contentProps = Object.fromEntries(\n RADIX_PROPS.content\n .map((propName) => [propName, props[propName]])\n .filter((propEntry) => propEntry[1] !== undefined)\n )\n const rootProps = Object.fromEntries(\n RADIX_PROPS.root\n .map((propName) => [propName, props[propName]])\n .filter((propEntry) => propEntry[1] !== undefined)\n )\n\n // Default to align=after, side=bottom\n contentProps.align = contentProps.align ?? 'after'\n contentProps.side = contentProps.side ?? 'bottom'\n\n /*\n Here we're extending Popover.Content's align prop to accept 'before' and\n 'after' in addition to its existing values.\n\n TL;DR:\n 1. Use existing alignOffset prop to push Content to be before/after the\n corresponding edge of the element it's attached to.\n 2. Add a CSS margin to patch alignOffset back onto Content, as Popover\n has a bug that prevents alignOffset from extending past the edge of\n its Trigger/Anchor.\n\n SEE: https://github.com/radix-ui/primitives/issues/2457\n */\n if (['before', 'after'].includes(contentProps.align)) {\n const mapToOriginalAlignValues = {\n after: 'end',\n before: 'start',\n }\n\n const mapAlignOffsetToMargin = (align, side) => {\n /*\n Translate alignOffset to CSS margin based on align and side props:\n bottom || top\n after: marginLeft\n before: marginRight\n left || right\n after: marginTop\n before: marginBottom\n */\n if (['top', 'bottom'].includes(side)) {\n if (align == 'after') {\n return 'marginLeft'\n } else {\n return 'marginRight'\n }\n } else {\n if (align == 'after') {\n return 'marginTop'\n } else {\n return 'marginBottom'\n }\n }\n }\n\n const originalOffset = contentProps.alignOffset ?? 0\n const originalStyleProp = contentProps.style ?? {}\n const currentSide = contentProps.side ?? 'bottom'\n const currentAlign = contentProps.align\n\n // Copy alignOffset value to CSS margin\n contentProps['style'] = {\n ...originalStyleProp,\n [mapAlignOffsetToMargin(currentAlign, currentSide)]: originalOffset,\n }\n\n const lengthOfCurrentSide = ['top', 'bottom'].includes(currentSide)\n ? contentRect.width\n : contentRect.height\n\n // Change alignOffset to be at the end of the positioned side\n contentProps.alignOffset = (lengthOfCurrentSide + originalOffset) * -1\n\n // Flip align prop back to valid Radix option, or default to 'after'\n contentProps['align'] = mapToOriginalAlignValues[currentAlign]\n }\n\n return {\n contentProps,\n rootProps,\n }\n}\n","import { useEffect } from 'react'\n\nimport { type FlowComponentProps } from '../../shared/types'\nimport { type TooltipProps } from '../Tooltip'\nimport { TourStep } from './TourStep'\nimport { useFlow } from '../../hooks/useFlow'\nimport { useFlowHandlers } from '../../hooks/useFlowHandlers'\nimport { useModal } from '../../hooks/useModal'\n\nexport interface TourProps extends TooltipProps, FlowComponentProps {}\n\nexport function Tour({ flowId, onComplete, variables, ...props }: TourProps) {\n const { flow } = useFlow(flowId, {\n variables,\n })\n useFlowHandlers(flow, { onComplete })\n\n const { isCurrentModal, removeModal } = useModal(flow)\n\n useEffect(() => {\n if (!flow?.isVisible && isCurrentModal) {\n removeModal()\n }\n }, [flow?.isVisible, isCurrentModal])\n\n if (flow == null || flow.isVisible === false || !isCurrentModal) {\n return null\n }\n\n flow.start()\n\n const step = flow.getCurrentStep()\n step?.start()\n\n return <TourStep step={step} flow={flow} {...props} />\n}\n","import type { Flow, FlowStep } from '@frigade/js'\n\nimport { TourProps } from '.'\nimport { useFlowHandlers } from '../../hooks/useFlowHandlers'\nimport { useStepHandlers } from '../../hooks/useStepHandlers'\n\nimport { Flex } from '../Flex'\nimport { Tooltip } from '../Tooltip'\n\nexport interface TourStepProps extends Omit<TourProps, 'flowId'> {\n step: FlowStep\n flow: Flow\n}\n\nexport function TourStep({\n dismissible = true,\n flow,\n onDismiss,\n onPrimary,\n onSecondary,\n step,\n ...props\n}: TourStepProps) {\n const { handleDismiss } = useFlowHandlers(flow, {\n onDismiss,\n })\n\n const { handlePrimary, handleSecondary } = useStepHandlers(step, {\n onPrimary,\n onSecondary,\n })\n\n return (\n <Tooltip\n key={step.id}\n anchor={step.selector as string}\n onOpenAutoFocus={(e) => e.preventDefault()}\n onPointerDownOutside={(e) => e.preventDefault()}\n {...props}\n >\n {dismissible && <Tooltip.Close onClick={handleDismiss} />}\n\n <Tooltip.Media\n src={step.videoUri ?? step.imageUri}\n type={step.videoUri ? 'video' : 'image'}\n />\n\n <Tooltip.Title>{step.title}</Tooltip.Title>\n <Tooltip.Subtitle>{step.subtitle}</Tooltip.Subtitle>\n\n <Flex.Row alignItems=\"center\" gap={3} justifyContent=\"flex-end\" part=\"tooltip-footer\" pt={4}>\n <Tooltip.Progress>{`${\n flow.getNumberOfCompletedSteps() + 1\n }/${flow.getNumberOfAvailableSteps()}`}</Tooltip.Progress>\n\n <Tooltip.Secondary\n marginLeft=\"auto\"\n title={step.secondaryButtonTitle}\n onClick={handleSecondary}\n />\n <Tooltip.Primary title={step.primaryButtonTitle} onClick={handlePrimary} />\n </Flex.Row>\n </Tooltip>\n )\n}\n","/// <reference types=\"@emotion/react/types/css-prop\" />\n\nexport { Announcement, type AnnouncementProps } from './components/Announcement'\nexport { Banner } from './components/Banner'\nexport { Box, type BoxProps } from './components/Box'\nexport { Card } from './components/Card'\nexport { Button, type ButtonProps } from './components/Button'\nexport { Flex } from './components/Flex'\nexport { Form } from './components/Form'\nexport { Provider, type ProviderProps } from './components/Provider'\nexport { Text, type TextProps } from './components/Text'\nexport { Tooltip, type TooltipProps } from './components/Tooltip'\nexport { Tour, type TourProps } from './components/Tour'\n\nexport { Flow, Frigade } from '@frigade/js'\n\nexport { useBoundingClientRect } from './hooks/useBoundingClientRect'\nexport { useFlow, type FlowConfig } from './hooks/useFlow'\nexport { useFlowHandlers } from './hooks/useFlowHandlers'\nexport { useModal } from './hooks/useModal'\nexport { useStepHandlers } from './hooks/useStepHandlers'\nexport { useFrigade } from './hooks/useFrigade'\nexport { useUser } from './hooks/useUser'\nexport { useGroup } from './hooks/useGroup'\n","import { useContext } from 'react'\n\nimport { FrigadeContext } from '../components/Provider'\n\nexport function useFrigade() {\n const { frigade } = useContext(FrigadeContext)\n\n return { frigade, isLoading: !Boolean(frigade?.isReady()) }\n}\n","import { useContext } from 'react'\n\nimport { FrigadeContext } from '../components/Provider'\n\nexport function useUser() {\n const { userId, frigade } = useContext(FrigadeContext)\n\n /**\n * Sets properties for the current user\n * @param properties\n */\n async function setProperties(properties?: Record<string, unknown>) {\n await frigade.identify(userId, properties)\n }\n\n /**\n * Tracks an event for the current user\n * @param eventName\n * @param properties\n */\n async function track(eventName: string, properties?: Record<string, unknown>) {\n await frigade.track(eventName, properties)\n }\n\n return { userId, setProperties, track }\n}\n","import { useContext } from 'react'\n\nimport { FrigadeContext } from '../components/Provider'\n\nexport function useGroup() {\n const { groupId, frigade } = useContext(FrigadeContext)\n\n /**\n * Sets properties for the current group\n * @param properties\n */\n async function setProperties(properties?: Record<string, unknown>) {\n if (!groupId) {\n console.error('No Group ID is set. Cannot set properties without a Group ID.')\n return\n }\n await frigade.group(groupId, properties)\n }\n\n /**\n * Tracks an event for the current group\n * @param eventName\n * @param properties\n */\n async function track(eventName: string, properties?: Record<string, unknown>) {\n await frigade.track(eventName, properties)\n }\n\n return { groupId, setProperties, track }\n}\n"]}
1
+ {"version":3,"sources":["../src/components/Dialog/index.tsx","../src/components/Box/index.tsx","../src/components/Box/styleProps.ts","../src/shared/tokens/borders.ts","../src/shared/tokens/palette.ts","../src/shared/tokens/radii.ts","../src/shared/tokens/semantic.ts","../src/shared/tokens/shadows.ts","../src/shared/tokens/space.ts","../src/shared/tokens/typography.ts","../src/shared/tokens/index.ts","../src/shared/flattenObject.ts","../src/shared/theme/index.ts","../src/components/Box/stylePropsToCss.ts","../src/shared/sanitize.ts","../src/components/Text/Text.tsx","../src/components/Text/Text.styles.ts","../src/components/Button/Button.styles.ts","../src/components/Button/index.tsx","../src/components/Card/index.tsx","../src/components/Flex/Flex.tsx","../src/hooks/useFlowComponent.tsx","../src/hooks/useFlow.ts","../src/components/Provider/index.tsx","../src/hooks/useFlowHandlers.ts","../src/hooks/useStepHandlers.ts","../src/hooks/useModal.ts","../src/components/Card/FlowCard.tsx","../src/components/Media/Image.tsx","../src/components/Media/Video.tsx","../src/components/Media/Media.tsx","../src/components/Announcement/index.tsx","../src/components/Banner/index.tsx","../src/components/Form/FormStep.tsx","../src/components/Form/fields/RadioField.tsx","../src/components/Form/fields/Error.tsx","../src/components/Form/fields/Label.tsx","../src/components/Form/fields/BaseField.styles.ts","../src/components/Form/fields/BaseField.tsx","../src/components/Form/fields/SelectField.tsx","../src/components/Form/fields/TextField.tsx","../src/components/Form/fields/TextareaField.tsx","../src/components/Form/index.tsx","../src/components/Tooltip/index.tsx","../src/hooks/useBoundingClientRect.ts","../src/components/Tooltip/Dot.tsx","../src/components/Tooltip/getDotPosition.ts","../src/components/Tooltip/mapTooltipPropsToPopoverProps.ts","../src/components/Tour/index.tsx","../src/components/Tour/TourStep.tsx","../src/index.ts","../src/hooks/useFrigade.ts","../src/hooks/useUser.ts","../src/hooks/useGroup.ts"],"names":["RadixDialog","XMarkIcon","React","clsx","kcp","borders","palette","radii","colorVar","colorName","semantic","shadows","SPACE_UNIT","spaceValue","key","spaceKeys","space","typography","tokens","flattenObject","obj","path","separator","acc","k","currentPath","currentValue","createThemeVariables","mapTokensToThemeVariables","newObj","themeVariables","theme","omittedCSSProperties","filteredCSSProperties","prop","_","char","defaultCSSProperties","colorTokens","themedStyleProps","styleProps","stylePropShorthands","pseudoStyleProps","prepValue","value","v","stylePropsMap","propName","stylePropShorthandsMap","shorthand","targetProps","preservedProps","elementsWithPreservedProps","getPseudoClass","name","pseudo","stylePropsToCss","props","element","unmatchedProps","cssFromProps","getTargetObject","pseudoSelector","match","propValue","matchedShorthand","p","fullPropName","styleProp","splitPropValues","clippedPropName","DOMPurify","getWindow","JSDOM","sanitize","dirty","jsx","prefixPart","part","processPart","BoxWithRef","as","children","className","css","ref","Component","processedPart","classNameWithPart","cssProp","Box","Text_exports","__export","Body1","Body2","Caption","Display1","Display2","H1","H2","H3","H4","Text_styles_exports","base","textVariantNames","textVariants","variant","defaultAs","component","Button_styles_exports","Link","Plain","Primary","Secondary","jsxs","BaseButton","title","variantPart","buttonVariantNames","buttonVariantComponents","Button","Flex_exports","Column","Row","useEffect","useMemo","useContext","useState","createContext","Global","ThemeProvider","Frigade","FrigadeContext","Provider","navigate","themeOverrides","modals","setModals","frigade","navigateHandler","url","target","currentModal","useFlow","flowId","config","flow","setFlow","setRandomString","handler","updatedFlow","flowInstance","useCallback","useRef","useFlowHandlers","onComplete","onDismiss","lastCompleted","e","useStepHandlers","step","onPrimary","onSecondary","useModal","isCurrentModal","setIsCurrentModal","prevModals","newIsCurrentModal","removeModal","nextModals","CloseButton","useFlowComponent","container","dismissible","variables","ContainerElement","Dialog","DismissElement","FlowComponent","flowComponentProps","handleDismiss","handlePrimary","handleSecondary","Fragment","FlowCard","Card","Image","src","getVideoEmbedSrc","videoUri","_a","_b","_c","_d","Video","videoEmbedSrc","Media","type","onClick","current","total","dots","i","Announcement","Banner","useController","useForm","ruleProps","FieldWrapper","FieldComponent","control","fieldData","rules","controller","FormStep","fieldTypes","handleSubmit","fields","onSubmit","data","RadioGroup","Error","error","Label","id","required","field","input","BaseField","fieldState","label","placeholder","fieldProps","CheckIcon","RadioItem","forwardedRef","RadioField","onChange","options","radioItems","Select","ChevronDownIcon","SelectItem","SelectField","selectItems","TextField","TextareaField","defaultFieldTypes","Form","mergedFieldTypes","Popover","useLayoutEffect","useBoundingClientRect","initialRect","rect","setRect","node","setNode","handleResize","newRect","keyframes","pulse","Dot","style","getDotPosition","alignAttr","sideAttr","currentSide","dotProps","getCurrentAlign","dotOffset","oppositeSides","currentAlign","RADIX_PROPS","mapTooltipPropsToPopoverProps","contentRect","contentProps","propEntry","rootProps","mapToOriginalAlignValues","mapAlignOffsetToMargin","align","side","originalOffset","originalStyleProp","lengthOfCurrentSide","Tooltip","anchor","spotlight","contentNode","contentRef","anchorNode","anchorRect","anchorRef","setAlignAttr","setSideAttr","spotlightLeft","setSpotlightLeft","spotlightTop","setSpotlightTop","currentAlignAttr","currentSideAttr","anchorVirtualRef","anchorQuery","scrollX","scrollY","anchorRadius","dotPosition","TourStep","Tour","Flow","useFrigade","useUser","userId","setProperties","properties","track","eventName","useGroup","groupId"],"mappings":"2VAAA,UAAYA,MAAiB,yBAC7B,OAAS,aAAAC,OAAiB,4BCD1B,UAAYC,OAAW,QACvB,OAAS,QAAAC,OAAY,OCDrB,OAAOC,OAAS,uBCAT,IAAMC,GAAU,CACrB,QAAS,CACP,GAAI,WACN,EACA,aAAc,CACZ,EAAG,IACH,GAAI,KACN,CACF,ECRO,IAAMC,GAAU,CACrB,MAAO,UACP,QAAS,UACT,QAAS,UACT,QAAS,UACT,QAAS,UACT,QAAS,UACT,QAAS,UACT,QAAS,UACT,QAAS,UACT,QAAS,UACT,MAAO,UACP,QAAS,UACT,QAAS,UACT,QAAS,UACT,QAAS,UACT,SAAU,UACV,SAAU,UACV,SAAU,UACV,YAAa,YACb,QAAS,UAGT,OAAQ,SACV,ECxBO,IAAMC,GAAQ,CACnB,GAAI,OACJ,GAAI,OACJ,MAAO,KACT,ECJA,IAAMC,EAAYC,GAAsB,mBAAmBA,KAE9CC,GAAW,CACtB,QAAS,CACP,WAAYF,EAAS,OAAO,EAC5B,OAAQA,EAAS,SAAS,EAC1B,WAAYA,EAAS,OAAO,EAC5B,QAASA,EAAS,SAAS,EAE3B,OAAQ,CACN,WAAYA,EAAS,OAAO,EAC5B,OAAQA,EAAS,SAAS,EAC1B,WAAYA,EAAS,OAAO,EAC5B,QAASA,EAAS,SAAS,CAC7B,EACA,MAAO,CACL,WAAYA,EAAS,OAAO,EAC5B,OAAQA,EAAS,SAAS,EAC1B,WAAYA,EAAS,OAAO,EAC5B,QAASA,EAAS,SAAS,CAC7B,EACA,MAAO,CACL,WAAYA,EAAS,OAAO,EAC5B,OAAQA,EAAS,SAAS,EAC1B,WAAYA,EAAS,OAAO,EAC5B,QAASA,E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GAAA,MAAAA,EAAS,UAAW,CAC5D,CCRA,OAAS,cAAAZ,OAAkB,QAIpB,SAAS0L,IAAU,CACxB,GAAM,CAAE,OAAAC,EAAQ,QAAA/K,CAAQ,EAAIZ,GAAWM,CAAc,EAMrD,eAAesL,EAAcC,EAAsC,CACjE,MAAMjL,EAAQ,SAAS+K,EAAQE,CAAU,CAC3C,CAOA,eAAeC,EAAMC,EAAmBF,EAAsC,CAC5E,MAAMjL,EAAQ,MAAMmL,EAAWF,CAAU,CAC3C,CAEA,MAAO,CAAE,OAAAF,EAAQ,cAAAC,EAAe,MAAAE,CAAM,CACxC,CCzBA,OAAS,cAAA9L,OAAkB,QAIpB,SAASgM,IAAW,CACzB,GAAM,CAAE,QAAAC,EAAS,QAAArL,CAAQ,EAAIZ,GAAWM,CAAc,EAMtD,eAAesL,EAAcC,EAAsC,CACjE,GAAI,CAACI,EAAS,CACZ,QAAQ,MAAM,+DAA+D,EAC7E,OAEF,MAAMrL,EAAQ,MAAMqL,EAASJ,CAAU,CACzC,CAOA,eAAeC,EAAMC,EAAmBF,EAAsC,CAC5E,MAAMjL,EAAQ,MAAMmL,EAAWF,CAAU,CAC3C,CAEA,MAAO,CAAE,QAAAI,EAAS,cAAAL,EAAe,MAAAE,CAAM,CACzC","sourcesContent":["import * as RadixDialog from '@radix-ui/react-dialog'\nimport { XMarkIcon } from '@heroicons/react/24/solid'\n\nimport { Box, type BoxProps } from '../Box'\nimport { Button, ButtonProps } from '../Button'\nimport { Card } from '../Card'\nimport { Media, MediaProps } from '../Media'\nimport { Text, TextProps } from '../Text'\n\nimport { theme } from '../../shared/theme'\n\nexport interface DialogProps extends BoxProps {}\n\n// TODO: Add any RadixDialog props we want to support here\nexport function Dialog({ children, ...props }: DialogProps) {\n return (\n <RadixDialog.Root defaultOpen={true} modal={true}>\n <RadixDialog.Portal>\n <Box inset=\"0\" position=\"fixed\" zIndex=\"9999\">\n <RadixDialog.Overlay asChild>\n <Box background=\"rgb(0 0 0 / 0.5)\" part=\"dialog-overlay\" position=\"fixed\" inset=\"0\" />\n </RadixDialog.Overlay>\n <RadixDialog.Content\n asChild\n onOpenAutoFocus={(e) => e.preventDefault()}\n onPointerDownOutside={(e) => e.preventDefault()}\n >\n <Card\n boxShadow=\"md\"\n left=\"50%\"\n maxWidth=\"430px\"\n p={8}\n part=\"dialog-content\"\n position=\"fixed\"\n textAlign=\"center\"\n top=\"50%\"\n transform=\"translate(-50%, -50%)\"\n {...props}\n >\n {children}\n </Card>\n </RadixDialog.Content>\n </Box>\n </RadixDialog.Portal>\n </RadixDialog.Root>\n )\n}\n\nDialog.Close = (props: ButtonProps) => {\n return (\n <RadixDialog.Close aria-label=\"Close\" asChild>\n <Button.Plain part=\"close\" position=\"absolute\" right=\"-4px\" top=\"4px\" {...props}>\n <XMarkIcon height=\"24\" fill=\"currentColor\" />\n </Button.Plain>\n </RadixDialog.Close>\n )\n}\n\nDialog.Subtitle = ({ children, ...props }: TextProps) => {\n return (\n <RadixDialog.Description asChild>\n <Text.Body2 mb={5} part=\"subtitle\" {...props}>\n {children}\n </Text.Body2>\n </RadixDialog.Description>\n )\n}\n\nDialog.Media = ({ src, ...props }: MediaProps) => {\n if (src == null) return null\n\n return <Media borderRadius=\"md\" src={src} {...props} />\n}\n\nDialog.Primary = ({ onClick, title, ...props }: ButtonProps) => {\n if (title == null) return null\n\n return <Button.Primary title={title} onClick={onClick} {...props} />\n}\n\nDialog.ProgressDots = ({ current, total }: { current: number; total: number }) => {\n if (total == 1) {\n return null\n }\n\n const dots = [...Array(total)].map((_, i) => {\n return (\n <circle\n key={i}\n r={4}\n cx={4 + 16 * i}\n cy=\"4px\"\n fill={current === i ? theme.colors.blue500 : theme.colors.blue800}\n />\n )\n })\n\n return (\n <Box\n as=\"svg\"\n height=\"8px\"\n margin=\"5 auto\"\n part=\"progress\"\n viewBox={`0 0 ${16 * total - 8} 8`}\n width={16 * total - 8}\n >\n {dots}\n </Box>\n )\n}\n\nDialog.Secondary = ({ onClick, title, ...props }: ButtonProps) => {\n if (title == null) return null\n\n return <Button.Secondary title={title} onClick={onClick} {...props} />\n}\n\nDialog.Title = ({ children, ...props }: TextProps) => {\n return (\n <RadixDialog.Title asChild>\n <Text.H3 mb={1} part=\"title\" {...props}>\n {children}\n </Text.H3>\n </RadixDialog.Title>\n )\n}\n","import * as React from 'react'\nimport { clsx } from 'clsx'\n\nimport { type StyleProps } from './styleProps'\nimport { stylePropsToCss } from './stylePropsToCss'\nimport { sanitize } from '../../shared/sanitize'\n\nfunction prefixPart(part: string | undefined) {\n return part ? `fr-${part}` : part\n}\n\nfunction processPart(part: Part | undefined) {\n if (!part) return part\n\n return Array.isArray(part) ? part.map((p) => processPart(p)).join(' ') : prefixPart(part)\n}\n\ntype Part = string | Part[]\n\nexport type BoxProps<T extends React.ElementType = React.ElementType> = {\n as?: T\n part?: Part\n} & StyleProps &\n React.ComponentPropsWithoutRef<T>\n\nfunction BoxWithRef<T extends React.ElementType = React.ElementType>(\n { as, children, className, css = {}, part, ...props }: BoxProps<T>,\n ref: React.ForwardedRef<HTMLDivElement>\n) {\n const Component = as ?? 'div'\n\n const { cssFromProps, unmatchedProps } = stylePropsToCss(props, Component)\n\n const processedPart = processPart(part)\n const classNameWithPart = className || processedPart ? clsx(className, processedPart) : undefined\n const cssProp = [{ boxSizing: 'border-box' }, cssFromProps, css]\n\n if (typeof children === 'string') {\n return (\n <Component\n className={classNameWithPart}\n css={cssProp}\n {...unmatchedProps}\n ref={ref}\n dangerouslySetInnerHTML={sanitize(children)}\n />\n )\n }\n\n return (\n <Component className={classNameWithPart} css={cssProp} {...unmatchedProps} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const Box = React.forwardRef(BoxWithRef) as <\n T extends React.ElementType = React.ElementType\n>(\n props: BoxProps<T>\n) => React.ReactElement\n","import kcp from 'known-css-properties'\nimport type { CSSProperties } from 'react'\n\nimport { theme } from '../../shared/theme'\nimport { flattenObject } from '../../shared/flattenObject'\n\n// Don't use these as CSS props, pass them through to HTML\nconst omittedCSSProperties = new Set([\n 'alt', // Mozilla doesn't have this listed as a valid CSS property ¯\\_(ツ)_/¯\n 'size', // Only applies to @page, not used for styling components. Breaks <input>\n 'src', // Only applies to @font-face, not used for styling components. Breaks <img>, <video>, et al\n])\n\nconst filteredCSSProperties = kcp.all\n .filter((prop) => prop.indexOf('-') != 0 && !omittedCSSProperties.has(prop))\n .map((prop) => [prop.replace(/-([a-z])/g, (_, char) => char.toUpperCase()), null])\n\nconst defaultCSSProperties: Record<string, null> = Object.fromEntries(filteredCSSProperties)\n\n// Recursive type for flattened color names\n// SEE: https://stackoverflow.com/a/47058976\ntype PathsToStringProps<T> = T extends string\n ? []\n : {\n [K in Extract<keyof T, string>]: [K, ...PathsToStringProps<T[K]>]\n }[Extract<keyof T, string>]\n\ntype Join<T extends string[], D extends string> = T extends []\n ? never\n : T extends [infer F]\n ? F\n : T extends [infer F, ...infer R]\n ? F extends string\n ? `${F}${D}${Join<Extract<R, string[]>, D>}`\n : never\n : string\n\ntype ColorName = Join<PathsToStringProps<typeof theme.colors>, '.'>\n\nconst colorTokens = flattenObject(theme.colors) as Record<ColorName, string>\n\nconst themedStyleProps = {\n color: colorTokens,\n backgroundColor: colorTokens,\n borderColor: colorTokens,\n\n border: theme.borders,\n borderRadius: theme.radii,\n borderWidth: theme.borderWidths,\n boxShadow: theme.shadows,\n\n fontFamily: theme.fontFamilies,\n fontSize: theme.fontSizes,\n fontWeight: theme.fontWeights,\n\n gap: theme.space,\n\n lineHeight: theme.lineHeights,\n\n margin: theme.space,\n marginBottom: theme.space,\n marginLeft: theme.space,\n marginRight: theme.space,\n marginTop: theme.space,\n\n padding: theme.space,\n paddingBottom: theme.space,\n paddingLeft: theme.space,\n paddingRight: theme.space,\n paddingTop: theme.space,\n} as const\n\nexport const styleProps = {\n ...defaultCSSProperties,\n ...themedStyleProps,\n}\n\nexport const stylePropShorthands = {\n bg: ['backgroundColor'],\n\n m: ['margin'],\n mt: ['marginTop'],\n mr: ['marginRight'],\n mb: ['marginBottom'],\n ml: ['marginLeft'],\n mx: ['marginLeft', 'marginRight'],\n my: ['marginTop', 'marginBottom'],\n\n p: ['padding'],\n pt: ['paddingTop'],\n pr: ['paddingRight'],\n pb: ['paddingBottom'],\n pl: ['paddingLeft'],\n px: ['paddingLeft', 'paddingRight'],\n py: ['paddingTop', 'paddingBottom'],\n} as const\n\nexport const pseudoStyleProps = new Set(['active', 'focus', 'focusVisible', 'focusWithin', 'hover'])\n\ntype ThemedStyleProps = {\n [K in keyof typeof themedStyleProps]: keyof (typeof themedStyleProps)[K]\n}\n\ntype FilteredCSSProps = Omit<\n {\n [key in keyof CSSProperties]: CSSProperties[key]\n },\n | `-${string}`\n | `Moz${string}`\n | `ms${string}`\n | `Webkit${string}`\n | `Khtml${string}`\n | `O${string}`\n>\n\n// eslint-disable-next-line @typescript-eslint/ban-types -- the (string & {}) type is intentionally fucky to assist with IDE prop completion\nexport type ThemedStyleProp<K extends keyof ThemedStyleProps> = ThemedStyleProps[K] | (string & {})\n\nexport type StylePropShorthands = {\n [K in keyof typeof stylePropShorthands]?: ThemedStyleProp<(typeof stylePropShorthands)[K][0]>\n}\n\nexport interface StyleProps extends FilteredCSSProps, StylePropShorthands {\n backgroundColor?: ThemedStyleProp<'backgroundColor'>\n border?: ThemedStyleProp<'border'>\n borderColor?: ThemedStyleProp<'borderColor'>\n borderRadius?: ThemedStyleProp<'borderRadius'>\n borderWidth?: ThemedStyleProp<'borderWidth'>\n boxShadow?: ThemedStyleProp<'boxShadow'>\n color?: ThemedStyleProp<'color'>\n fontFamily?: ThemedStyleProp<'fontFamily'>\n fontSize?: ThemedStyleProp<'fontSize'>\n fontWeight?: ThemedStyleProp<'fontWeight'>\n gap?: ThemedStyleProp<'gap'>\n lineHeight?: ThemedStyleProp<'lineHeight'>\n margin?: ThemedStyleProp<'margin'>\n marginBottom?: ThemedStyleProp<'marginBottom'>\n marginLeft?: ThemedStyleProp<'marginLeft'>\n marginRight?: ThemedStyleProp<'marginRight'>\n marginTop?: ThemedStyleProp<'marginTop'>\n padding?: ThemedStyleProp<'padding'>\n paddingBottom?: ThemedStyleProp<'paddingBottom'>\n paddingLeft?: ThemedStyleProp<'paddingLeft'>\n paddingRight?: ThemedStyleProp<'paddingRight'>\n paddingTop?: ThemedStyleProp<'paddingTop'>\n}\n","export const borders = {\n borders: {\n md: '1px solid',\n },\n borderWidths: {\n 0: '0',\n md: '1px',\n },\n}\n","export const palette = {\n black: '#000000',\n gray100: '#14161A',\n gray200: '#181B20',\n gray300: '#1F2329',\n gray400: '#2E343D',\n gray500: '#4C5766',\n gray600: '#5A6472',\n gray700: '#C5CBD3',\n gray800: '#E2E5E9',\n gray900: '#F1F2F4',\n white: '#ffffff',\n blue400: '#015AC6',\n blue500: '#0171F8',\n blue800: '#DBECFF',\n blue900: '#F5F9FF',\n green400: '#009E37',\n green500: '#00D149',\n green800: '#DBFFE8',\n transparent: '#FFFFFF00',\n inherit: 'inherit',\n\n // This color isn't in the Design System yet, but it's used in old components\n red500: '#c00000',\n}\n","export const radii = {\n md: '10px',\n lg: '20px',\n round: '50%',\n}\n","const colorVar = (colorName: string) => `var(--fr-colors-${colorName})`\n\nexport const semantic = {\n neutral: {\n background: colorVar('white'),\n border: colorVar('gray800'),\n foreground: colorVar('black'),\n surface: colorVar('gray700'),\n\n active: {\n background: colorVar('white'),\n border: colorVar('gray900'),\n foreground: colorVar('black'),\n surface: colorVar('gray700'),\n },\n focus: {\n background: colorVar('white'),\n border: colorVar('gray900'),\n foreground: colorVar('black'),\n surface: colorVar('gray700'),\n },\n hover: {\n background: colorVar('white'),\n border: colorVar('gray900'),\n foreground: colorVar('black'),\n surface: colorVar('gray700'),\n },\n },\n\n primary: {\n background: colorVar('blue500'),\n border: colorVar('blue500'),\n foreground: colorVar('white'),\n surface: colorVar('blue500'),\n\n active: {\n background: colorVar('blue400'),\n border: colorVar('blue400'),\n foreground: colorVar('white'),\n surface: colorVar('blue400'),\n },\n focus: {\n background: colorVar('blue500'),\n border: colorVar('blue500'),\n foreground: colorVar('white'),\n surface: colorVar('blue500'),\n },\n hover: {\n background: colorVar('blue400'),\n border: colorVar('blue400'),\n foreground: colorVar('white'),\n surface: colorVar('blue400'),\n },\n },\n\n secondary: {\n background: colorVar('white'),\n border: colorVar('gray800'),\n foreground: colorVar('black'),\n surface: colorVar('gray900'),\n\n active: {\n background: colorVar('gray900'),\n border: colorVar('gray800'),\n foreground: colorVar('black'),\n surface: colorVar('gray800'),\n },\n focus: {\n background: colorVar('gray900'),\n border: colorVar('gray800'),\n foreground: colorVar('black'),\n surface: colorVar('gray900'),\n },\n hover: {\n background: colorVar('gray900'),\n border: colorVar('gray800'),\n foreground: colorVar('black'),\n surface: colorVar('gray800'),\n },\n },\n}\n","export const shadows = {\n md: '0px 4px 20px rgba(0, 0, 0, 0.1)',\n}\n","const SPACE_VALUE = 4\nconst SPACE_UNIT = 'px'\n\nconst spaceValue = (key: SpaceKeys[number]) =>\n typeof key === 'number' ? `${SPACE_VALUE * key}${SPACE_UNIT}` : key\n\nconst spaceKeys = [\n -20,\n -19,\n -18,\n -17,\n -16,\n -15,\n -14,\n -13,\n -12,\n -11,\n -10,\n -9,\n -8,\n -7,\n -6,\n -5,\n -4,\n -3,\n -2,\n -1,\n -0.5,\n 0,\n 0.5,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n 12,\n 13,\n 14,\n 15,\n 16,\n 17,\n 18,\n 19,\n 20,\n 'auto',\n] as const\n\ntype SpaceKeys = typeof spaceKeys\n\ntype SpaceTokens = {\n [K in SpaceKeys[number]]: string\n}\nexport const space = Object.fromEntries(\n spaceKeys.map((key) => [key, spaceValue(key)])\n) as SpaceTokens\n","export const typography = {\n fontFamilies: {\n default: 'inherit',\n },\n fontSizes: {\n xs: '12px',\n sm: '14px',\n md: '16px',\n lg: '18px',\n xl: '20px',\n '2xl': '24px',\n '3xl': '30px',\n '4xl': '36px',\n '5xl': '48px',\n },\n fontWeights: {\n thin: '100',\n extralight: '200',\n light: '300',\n regular: '400',\n medium: '500',\n demibold: '600',\n bold: '700',\n extrabold: '800',\n black: '900',\n },\n letterSpacings: {\n md: '0.02em',\n },\n lineHeights: {\n xs: '18px',\n sm: '22px',\n md: '24px',\n lg: '26px',\n xl: '30px',\n '2xl': '38px',\n '3xl': '46px',\n '4xl': '60px',\n },\n}\n","import { borders } from './borders'\nimport { palette } from './palette'\nimport { radii } from './radii'\nimport { semantic } from './semantic'\nimport { shadows } from './shadows'\nimport { space } from './space'\nimport { typography } from './typography'\n\n// Package up everything everywhere all at once for convenience\nexport const tokens = {\n ...borders,\n\n colors: {\n ...palette,\n ...semantic,\n },\n\n ...typography,\n\n radii,\n shadows,\n space,\n}\n\nexport type Tokens = typeof tokens\n","export function flattenObject(obj: object, path = '', separator = '.') {\n return Object.keys(obj).reduce((acc, k) => {\n const prefix = path.length ? `${path}${separator}` : ''\n const currentPath = `${prefix}${k}`\n const currentValue = obj[k]\n\n if (typeof currentValue === 'object' && currentValue !== null && !Array.isArray(currentValue)) {\n Object.assign(acc, flattenObject(currentValue, currentPath, separator))\n } else {\n acc[currentPath] = currentValue\n }\n\n return acc\n }, {})\n}\n","import { tokens, Tokens } from '../tokens'\nimport { flattenObject } from '../flattenObject'\n\nimport type { DeepPartial } from '@/shared/types'\n\nexport type Theme = DeepPartial<Tokens>\n\n// Transform tokens to a flat list of CSS variables and values to inject into the page\n// IN: { colors: { black: '#000' } }, OUT: { '--fr-colors-black': '#000' }\nexport function createThemeVariables(tokens: Theme) {\n return flattenObject(tokens, '--fr', '-')\n}\n\n// Swap token values out and replace them with the CSS variables we defined\n// IN: { colors: { black: '#000' } }, OUT: { colors: { black: 'var(--fr-colors-black)' } }\nfunction mapTokensToThemeVariables(tokens: Tokens, path = '--fr'): Theme {\n const newObj: Theme = {}\n\n Object.keys(tokens).forEach((key) => {\n const currentValue = tokens[key]\n\n if (typeof currentValue === 'object' && currentValue !== null && !Array.isArray(currentValue)) {\n newObj[key] = mapTokensToThemeVariables(currentValue, `${path}-${key}`)\n } else {\n newObj[key] = `var(${path}-${key})`\n }\n })\n\n return newObj\n}\n\nexport const themeVariables = createThemeVariables(tokens)\n\nexport const theme = mapTokensToThemeVariables(tokens)\n","import { pseudoStyleProps, styleProps, stylePropShorthands } from './styleProps'\n\n/*\nPrefix these props to allow for usage in CSS & HTML:\n color\n - HTML: obsolete\n\n background\n - HTML: obsolete\n\n border\n - HTML: obsolete\n\n content\n - HTML: only used in <meta>, not relevant to components\n\n translate\n - used by both. Prefix _translate to force pass-through to HTML?\n\n\n height\n width\n - HTML: used by <canvas>, <embed>, <iframe>, <img>, <input>, <object>, <video>\n - Can automatically send these to both HTML and CSS for those elements and allow manual prefixing just in case (like if you want to set HTML width to something different that CSS width)\n\n*/\n\nfunction prepValue(value: unknown) {\n if (Array.isArray(value)) {\n return new Map(value.map((v) => [v, v]))\n } else if (typeof value === 'object' && value !== null) {\n return new Map(Object.entries(value))\n } else if (typeof value === 'string' || typeof value === 'number') {\n return new Map([[value, value]])\n }\n\n return new Map()\n}\n\nconst stylePropsMap = new Map(\n Object.entries(styleProps).map(([propName, value]) => {\n return [propName, prepValue(value)]\n })\n)\n\nconst stylePropShorthandsMap = new Map(\n Object.entries(stylePropShorthands).map(([shorthand, targetProps]) => {\n return [shorthand, new Set(targetProps)]\n })\n)\n\n// TL;DR: Replaced elements should always have width & height HTML attrs set because intrinsic height / width = aspect ratio\nconst preservedProps = new Set(['height', 'width'])\nconst elementsWithPreservedProps = new Set([\n 'canvas',\n 'embed',\n 'iframe',\n 'img',\n 'input',\n 'object',\n 'video',\n])\n\nfunction getPseudoClass(propName: string) {\n // We're intentionally only grabbing the initial name and first pseudo class for now\n // We can support styleProp:hover:focus easily enough by running through the whole array\n const [name, pseudo] = propName.split(':')\n\n return [name, pseudoStyleProps.has(pseudo) ? pseudo : null]\n}\n\nexport function stylePropsToCss(\n props: Record<string, unknown>,\n element: React.ElementType = 'div'\n) {\n const unmatchedProps = Object.assign({}, props)\n const cssFromProps = {}\n\n function getTargetObject(pseudo: string | null) {\n if (pseudo == null) {\n return cssFromProps\n }\n\n const hyphenatedPseudo = pseudo.replace(/[A-Z]/g, (match) => `-${match.toLocaleLowerCase()}`)\n\n const pseudoSelector = `&:${hyphenatedPseudo}`\n\n if (cssFromProps[pseudoSelector] == null) {\n cssFromProps[pseudoSelector] = {}\n }\n\n return cssFromProps[pseudoSelector]\n }\n\n // Convert shorthand styleProps to full versions\n Object.entries(unmatchedProps).forEach(([propName, propValue]) => {\n const [name, pseudo] = getPseudoClass(propName)\n\n const matchedShorthand = stylePropShorthandsMap.get(name)\n if (matchedShorthand != null) {\n matchedShorthand.forEach((p) => {\n const fullPropName = `${p}${pseudo ? ':' + pseudo : ''}`\n unmatchedProps[fullPropName] = propValue\n })\n\n delete unmatchedProps[propName]\n }\n })\n\n // Convert styleProps to style object\n Object.entries(unmatchedProps).forEach(([fullPropName, propValue]) => {\n const [propName, pseudo] = getPseudoClass(fullPropName)\n const styleProp = stylePropsMap.get(propName)\n\n if (styleProp != null) {\n // Split space-separated values out and process them individually\n if (typeof propValue === 'string' && propValue.indexOf(' ') > -1) {\n const splitPropValues = propValue.split(' ')\n\n getTargetObject(pseudo)[propName] = splitPropValues\n .map((v) => styleProp.get(v.toString()) ?? v)\n .join(' ')\n }\n\n // Replace known token values (e.g. lineHeight=\"xl\")\n else if (styleProp.has(propValue.toString())) {\n getTargetObject(pseudo)[propName] = styleProp.get(propValue.toString())\n }\n\n // Pass value through, we trust TypeScript to catch invalid values, right?\n else {\n getTargetObject(pseudo)[propName] = propValue\n }\n\n // Don't delete the special props that get passed through to certain tags by default\n if (\n typeof element !== 'string' ||\n !elementsWithPreservedProps.has(element) ||\n !preservedProps.has(propName)\n ) {\n delete unmatchedProps[fullPropName]\n }\n }\n })\n\n // Remove prefix from prefixed style props and pass them through\n Object.keys(unmatchedProps).forEach((propName) => {\n const clippedPropName = propName.substring(1)\n\n if (propName.indexOf('_') === 0 && stylePropsMap.has(clippedPropName)) {\n unmatchedProps[clippedPropName] = unmatchedProps[propName]\n\n delete unmatchedProps[propName]\n }\n })\n\n return { cssFromProps, unmatchedProps }\n}\n","import DOMPurify from 'dompurify'\n\nfunction getWindow() {\n if (typeof window === 'undefined') {\n // eslint-disable-next-line @typescript-eslint/no-var-requires -- JSDOM is required inline because it has import side effects that depend on node\n const { JSDOM } = require('jsdom')\n return new JSDOM('<!DOCTYPE html>').window\n }\n\n return window\n}\n\nexport function sanitize(dirty?: string) {\n if (!dirty) {\n return { __html: '' }\n }\n\n return {\n __html: DOMPurify(getWindow()).sanitize(dirty, {\n ALLOWED_TAGS: [\n 'b',\n 'i',\n 'a',\n 'span',\n 'div',\n 'p',\n 'pre',\n 'u',\n 'br',\n 'img',\n 'code',\n 'li',\n 'ul',\n 'table',\n 'tbody',\n 'thead',\n 'tr',\n 'td',\n 'th',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'video',\n ],\n ALLOWED_ATTR: [\n 'style',\n 'class',\n 'target',\n 'id',\n 'href',\n 'alt',\n 'src',\n 'controls',\n 'autoplay',\n 'loop',\n 'muted',\n ],\n }),\n }\n}\n","import * as React from 'react'\n\nimport { Box, BoxProps } from '../Box'\n\nimport * as styles from './Text.styles'\n\nconst textVariantNames = [\n 'Display1',\n 'Display2',\n 'H1',\n 'H2',\n 'H3',\n 'H4',\n 'Body1',\n 'Body2',\n 'Caption',\n] as const\n\nexport interface TextProps extends BoxProps {}\n\nconst textVariants = Object.fromEntries(\n textVariantNames.map((variant) => {\n const defaultAs = ['H1', 'H2', 'H3', 'H4'].includes(variant)\n ? (variant.toLowerCase() as 'h1' | 'h2' | 'h3' | 'h4')\n : 'span'\n\n const component = React.forwardRef(\n (\n { as = defaultAs, children, ...props }: BoxProps,\n ref: React.ForwardedRef<HTMLDivElement>\n ) => (\n <Box as={as} {...styles[variant]} {...props} ref={ref}>\n {children}\n </Box>\n )\n ) as React.ForwardRefExoticComponent<BoxProps>\n\n component.displayName = `Text.${variant}`\n\n return [variant, component]\n })\n)\n\nexport const Display1 = textVariants['Display1']\nexport const Display2 = textVariants['Display2']\n\n/* eslint-disable react-refresh/only-export-components -- False positive on H# components, see: https://github.com/ArnaudBarre/eslint-plugin-react-refresh/blob/main/src/only-export-components.ts#L9 */\nexport const H1 = textVariants['H1']\nexport const H2 = textVariants['H2']\nexport const H3 = textVariants['H3']\nexport const H4 = textVariants['H4']\n/* eslint-enable react-refresh/only-export-components */\n\nexport const Body1 = textVariants['Body1']\nexport const Body2 = textVariants['Body2']\nexport const Caption = textVariants['Caption']\n","const base = {\n color: 'neutral.foreground',\n fontFamily: 'default',\n margin: '0',\n}\n\nexport const Display1 = {\n ...base,\n fontSize: '5xl',\n fontWeight: 'bold',\n lineHeight: '4xl',\n}\n\nexport const Display2 = {\n ...base,\n fontSize: '4xl',\n fontWeight: 'bold',\n lineHeight: '3xl',\n}\n\nexport const H1 = {\n ...base,\n fontSize: '3xl',\n fontWeight: 'bold',\n lineHeight: '2xl',\n}\n\nexport const H2 = {\n ...base,\n fontSize: '2xl',\n fontWeight: 'bold',\n lineHeight: 'xl',\n}\n\nexport const H3 = {\n ...base,\n fontSize: 'xl',\n fontWeight: 'bold',\n lineHeight: 'lg',\n}\n\nexport const H4 = {\n ...base,\n fontSize: 'lg',\n fontWeight: 'bold',\n lineHeight: 'md',\n}\n\nexport const Body1 = {\n ...base,\n fontSize: 'md',\n fontWeight: 'regular',\n lineHeight: 'md',\n}\n\nexport const Body2 = {\n ...base,\n fontSize: 'sm',\n fontWeight: 'regular',\n lineHeight: 'md',\n}\n\nexport const Caption = {\n ...base,\n fontSize: 'xs',\n fontWeight: 'regular',\n lineHeight: 'sm',\n}\n","const base = {\n borderWidth: '0',\n borderRadius: 'md',\n display: 'flex',\n gap: '2',\n padding: '2 4',\n}\n\nexport const Primary = {\n ...base,\n backgroundColor: 'primary.surface',\n color: 'primary.foreground',\n\n 'backgroundColor:hover': 'primary.hover.surface',\n}\n\nexport const Secondary = {\n ...base,\n\n backgroundColor: 'secondary.background',\n borderColor: 'secondary.border',\n borderStyle: 'solid',\n borderWidth: '1px',\n color: 'secondary.foreground',\n\n 'backgroundColor:hover': 'secondary.hover.background',\n}\n\nexport const Link = {\n ...base,\n\n backgroundColor: 'transparent',\n color: 'primary.surface',\n\n 'color:hover': 'primary.hover.surface',\n}\n\nexport const Plain = {\n ...base,\n\n backgroundColor: 'transparent',\n color: 'neutral.foreground',\n}\n","import { Box, BoxProps } from '../Box'\nimport { Text } from '../Text'\n\nimport * as styles from './Button.styles'\n\n// TODO: Generate this type from buttonVariantNames\ntype ButtonVariant = 'Primary' | 'Secondary' | 'Link' | 'Plain'\n\nexport interface ButtonProps extends BoxProps {\n title?: string\n variant?: ButtonVariant\n}\n\nfunction BaseButton({ as, children, part, title, variant = 'Primary', ...props }: ButtonProps) {\n const variantPart = variant.toLocaleLowerCase()\n\n return (\n <Box as={as ?? 'button'} part={[`button-${variantPart}`, part]} {...styles[variant]} {...props}>\n {children}\n {title && (\n <Text.Body2 flexGrow=\"1\" fontWeight=\"demibold\" color=\"inherit\">\n {title}\n </Text.Body2>\n )}\n </Box>\n )\n}\n\nconst buttonVariantNames: ButtonVariant[] = ['Primary', 'Secondary', 'Link', 'Plain']\n\nconst buttonVariantComponents = Object.fromEntries(\n buttonVariantNames.map((variant) => {\n const component = (props: ButtonProps) => {\n return (\n <BaseButton {...props} variant={variant}>\n {props.children}\n </BaseButton>\n )\n }\n\n component.displayName = `Text.${variant}`\n\n return [variant, component]\n })\n)\n\nexport const Button = Object.assign(BaseButton, buttonVariantComponents)\n","import * as React from 'react'\nimport type { ForwardRefExoticComponent, RefAttributes } from 'react'\nimport { EmotionJSX } from '@emotion/react/types/jsx-namespace'\n\nimport { Button, type ButtonProps } from '../Button'\nimport { Flex } from '../Flex'\nimport { FlowCard } from './FlowCard'\nimport { Media, type MediaProps } from '../Media'\nimport { Text, type TextProps } from '../Text'\n\nimport { type FlowComponentProps } from '@/shared/types'\n\ninterface CardComponent\n extends ForwardRefExoticComponent<Omit<FlowComponentProps, 'ref'> & RefAttributes<unknown>> {\n Media: (props: MediaProps) => EmotionJSX.Element\n Primary: (props: ButtonProps) => EmotionJSX.Element\n Secondary: (props: ButtonProps) => EmotionJSX.Element\n Subtitle: (props: TextProps) => EmotionJSX.Element\n Title: (props: TextProps) => EmotionJSX.Element\n}\n\nexport const Card = React.forwardRef(({ as, children, ...props }: FlowComponentProps, ref) => {\n // If props.flowId is set, render FlowCard instead\n if (props.flowId != null) {\n return <FlowCard as={as} {...props} />\n }\n\n const Component = as ?? Flex.Column\n return (\n <Component\n backgroundColor=\"neutral.background\"\n borderRadius=\"md\"\n gap={5}\n p={5}\n {...props}\n ref={ref}\n >\n {children}\n </Component>\n )\n}) as CardComponent\n\nCard.Media = ({ src, ...props }: MediaProps) => {\n if (src == null) return null\n\n return <Media borderRadius=\"md\" src={src} {...props} />\n}\n\nCard.Primary = ({ onClick, title, ...props }: ButtonProps) => {\n if (title == null) return null\n\n return <Button.Primary title={title} onClick={onClick} {...props} />\n}\n\nCard.Secondary = ({ onClick, title, ...props }: ButtonProps) => {\n if (title == null) return null\n\n return <Button.Secondary title={title} onClick={onClick} {...props} />\n}\n\nCard.Subtitle = ({ children, ...props }: TextProps) => {\n if (children == null) return null\n\n return (\n <Text.Body2 display=\"block\" part=\"subtitle\" mt={1} {...props}>\n {children}\n </Text.Body2>\n )\n}\n\nCard.Title = ({ children, ...props }: TextProps) => {\n if (children == null) return null\n\n return (\n <Text.Body1 display=\"block\" fontWeight=\"bold\" part=\"title\" {...props}>\n {children}\n </Text.Body1>\n )\n}\n","import * as React from 'react'\nimport { Box, BoxProps } from '../Box'\n\nexport const Row = React.forwardRef(({ children, css, ...props }: BoxProps, ref) => {\n return (\n <Box css={[{ display: 'flex', flexDirection: 'row' }, css]} {...props} ref={ref}>\n {children}\n </Box>\n )\n})\n\nexport const Column = React.forwardRef(({ children, css, ...props }: BoxProps, ref) => {\n return (\n <Box css={[{ display: 'flex', flexDirection: 'column' }, css]} {...props} ref={ref}>\n {children}\n </Box>\n )\n})\n","import { type ReactNode, useEffect, useMemo } from 'react'\nimport { type Flow, type FlowStep } from '@frigade/js'\nimport { XMarkIcon } from '@heroicons/react/24/solid'\n\nimport { Box, type BoxProps } from '@/components/Box'\nimport { Button, type ButtonProps } from '@/components/Button'\nimport { Dialog } from '@/components/Dialog'\n\nimport { type FlowComponentProps } from '@/shared/types'\n\nimport { useFlow } from './useFlow'\nimport { type DismissHandler, useFlowHandlers } from './useFlowHandlers'\nimport { type StepHandler, useStepHandlers } from './useStepHandlers'\nimport { useModal } from './useModal'\n\nexport interface FlowComponentChildrenProps {\n flow: Flow\n handleDismiss: DismissHandler\n handlePrimary: StepHandler\n handleSecondary: StepHandler\n step: FlowStep\n}\n\nexport interface FlowComponentChildren extends BoxProps {\n children: (props: FlowComponentChildrenProps) => ReactNode\n}\n\nexport function CloseButton(props: ButtonProps) {\n return (\n <Button.Plain part=\"close\" position=\"absolute\" right=\"-4px\" top=\"4px\" {...props}>\n <XMarkIcon height=\"24\" fill=\"currentColor\" />\n </Button.Plain>\n )\n}\n\nexport function useFlowComponent({\n as,\n container,\n dismissible = true,\n flowId,\n onComplete,\n onDismiss,\n onPrimary,\n onSecondary,\n variables,\n ...props\n}: FlowComponentProps) {\n const ContainerElement = container === 'dialog' ? Dialog : as ?? Box\n const DismissElement = ContainerElement.Close ?? CloseButton\n\n // useMemo this component so it isn't recreated on every render\n const FlowComponent = function FlowComponent({\n children,\n ...flowComponentProps\n }: FlowComponentChildren) {\n const { flow } = useFlow(flowId, {\n variables,\n })\n const step = flow?.getCurrentStep()\n\n const { handleDismiss } = useFlowHandlers(flow, {\n onComplete,\n onDismiss,\n })\n\n const { handlePrimary, handleSecondary } = useStepHandlers(step, {\n onPrimary,\n onSecondary,\n })\n\n const { isCurrentModal, removeModal } = useModal(flow)\n\n useEffect(() => {\n if (!flow?.isVisible && isCurrentModal) {\n removeModal()\n }\n }, [flow?.isVisible, isCurrentModal])\n\n if (flow == null || !flow.isVisible || !isCurrentModal) {\n return null\n }\n\n flow.start()\n step.start()\n\n return (\n <ContainerElement position=\"relative\" {...flowComponentProps} {...props}>\n {dismissible && <DismissElement onClick={handleDismiss} />}\n\n {children({\n flow,\n handleDismiss,\n handlePrimary,\n handleSecondary,\n step,\n })}\n </ContainerElement>\n )\n }\n\n const MemoizedFlowComponent = useMemo(() => FlowComponent, [])\n\n return {\n FlowComponent: MemoizedFlowComponent,\n }\n}\n","import { type Flow } from '@frigade/js'\nimport { useContext, useEffect, useState } from 'react'\n\nimport { FrigadeContext } from '../components/Provider'\n\nexport interface FlowConfig {\n variables?: Record<string, unknown>\n}\n\nexport function useFlow(flowId: string, config?: FlowConfig) {\n const [flow, setFlow] = useState<Flow>()\n const [, setRandomString] = useState<string>('')\n const { frigade } = useContext(FrigadeContext)\n\n const handler = (updatedFlow: Flow) => {\n if (updatedFlow.id !== flowId) {\n return\n }\n\n if (config?.variables) {\n updatedFlow.applyVariables(config.variables)\n }\n\n setFlow(updatedFlow)\n setRandomString(Math.random().toString())\n }\n\n useEffect(() => {\n ;(async () => {\n const flowInstance: Flow = await frigade.getFlow(flowId)\n if (!flowInstance || frigade.hasFailedToLoad()) {\n setFlow(undefined)\n return\n }\n if (config?.variables) {\n flowInstance.applyVariables(config.variables)\n }\n\n setFlow(flowInstance)\n })()\n\n frigade.onStateChange(handler)\n\n return () => {\n frigade.removeStateChangeHandler(handler)\n }\n }, [])\n\n return { flow }\n}\n","import {\n createContext,\n type Dispatch,\n type SetStateAction,\n useEffect,\n useMemo,\n useState,\n} from 'react'\nimport { Global, ThemeProvider } from '@emotion/react'\n\nimport {\n createThemeVariables,\n theme as themeTokens,\n type Theme,\n themeVariables,\n} from '../../shared/theme'\nimport { Frigade } from '@frigade/js'\n\ntype NavigateHandler = (url: string, target?: string) => void\n\n// TODO: type theme something like Partial<typeof themeTokens>, but allow any value for those keys\nexport interface ProviderProps {\n apiKey: string\n apiUrl?: string\n children?: React.ReactNode\n navigate?: NavigateHandler\n theme?: Theme\n userId?: string\n groupId?: string\n /**\n * @ignore Internal use only.\n * If enabled, Frigade will not send any data to the API. A user's state will be reset on page refresh.\n */\n __readOnly?: boolean\n\n /**\n * @ignore Internal use only.\n * Map of Flow ID to Flow Config for all flows in the app.\n * Configs will have to be provided in serialized JSON format rather than YAML.\n */\n __flowConfigOverrides?: Record<string, string>\n}\n\ninterface ProviderContext extends Omit<ProviderProps, 'children' | 'theme'> {\n modals: Set<string>\n setModals: Dispatch<SetStateAction<Set<string>>>\n currentModal: string | null\n frigade?: Frigade\n}\n\nexport const FrigadeContext = createContext<ProviderContext>({\n apiKey: '',\n modals: new Set(),\n setModals: () => {},\n currentModal: null,\n navigate: () => {},\n})\n\nexport function Provider({ children, navigate, theme, ...props }: ProviderProps) {\n const themeOverrides = theme ? createThemeVariables(theme) : {}\n const [modals, setModals] = useState(new Set<string>())\n const frigade = useMemo<Frigade>(() => {\n return new Frigade(props.apiKey, {\n apiKey: props.apiKey,\n apiUrl: props.apiUrl,\n userId: props.userId,\n groupId: props.groupId,\n __readOnly: props.__readOnly,\n __flowConfigOverrides: props.__flowConfigOverrides,\n })\n }, [props.userId, props.groupId, props.apiKey])\n\n const navigateHandler =\n navigate ??\n ((url, target = '_self') => {\n window.open(url, target)\n })\n\n useEffect(() => {\n return () => {\n frigade.destroy()\n }\n }, [])\n\n const currentModal = modals.size > 0 ? modals.values().next().value : null\n\n return (\n <FrigadeContext.Provider\n value={{\n modals,\n setModals,\n currentModal,\n navigate: navigateHandler,\n ...props,\n frigade: frigade,\n }}\n >\n <Global styles={{ ':root': { ...themeVariables, ...themeOverrides } }} />\n <ThemeProvider theme={themeTokens}>{children}</ThemeProvider>\n </FrigadeContext.Provider>\n )\n}\n","import { MouseEvent, useCallback, useEffect, useRef } from 'react'\n\nimport { Flow } from '@frigade/js'\n\nexport type FlowHandlerProp = (\n flow: Flow,\n event?: React.MouseEvent<unknown>\n) => Promise<boolean | void> | (boolean | void)\n\nexport interface FlowHandlerProps {\n onComplete?: FlowHandlerProp\n onDismiss?: FlowHandlerProp\n}\n\nexport type DismissHandler = (e: React.MouseEvent<unknown>) => Promise<boolean | void>\n\nexport function useFlowHandlers(flow: Flow, { onComplete, onDismiss }: FlowHandlerProps = {}) {\n const lastCompleted = useRef(null)\n\n useEffect(() => {\n if (flow == null) return\n\n if (flow.isCompleted && lastCompleted.current === false) {\n ;(async () => {\n await onComplete?.(flow)\n })()\n }\n\n lastCompleted.current = flow?.isCompleted\n }, [flow?.isCompleted])\n\n return {\n handleDismiss: useCallback<DismissHandler>(\n async (e: React.MouseEvent<unknown>) => {\n const continueDefault = await onDismiss?.(flow, e)\n\n if (continueDefault === false) {\n e.preventDefault()\n return false\n }\n\n await flow.skip()\n },\n [flow]\n ),\n }\n}\n","import { MouseEvent, useCallback, useContext } from 'react'\n\nimport type { FlowStep } from '@frigade/js'\n\nimport { FrigadeContext } from '../components/Provider'\n\nexport type StepHandlerProp = (\n step: FlowStep,\n event?: React.MouseEvent<unknown>\n) => Promise<boolean | void> | (boolean | void)\n\nexport interface StepHandlerProps {\n onPrimary?: StepHandlerProp\n onSecondary?: StepHandlerProp\n}\n\nexport type StepHandler = (e: React.MouseEvent<unknown>) => Promise<boolean | void>\n\nexport function useStepHandlers(step: FlowStep, { onPrimary, onSecondary }: StepHandlerProps = {}) {\n const { navigate } = useContext(FrigadeContext)\n\n return {\n handlePrimary: useCallback<StepHandler>(\n async (e: React.MouseEvent<unknown>) => {\n const continueDefault = await onPrimary?.(step, e)\n\n if (continueDefault === false) {\n e.preventDefault()\n return false\n }\n\n await step.complete()\n\n if (step.primaryButtonUri != null) {\n navigate(step.primaryButtonUri, step.primaryButtonUriTarget)\n }\n },\n [step]\n ),\n\n handleSecondary: useCallback<StepHandler>(\n async (e: React.MouseEvent<unknown>) => {\n const continueDefault = await onSecondary?.(step, e)\n\n if (continueDefault === false) {\n e.preventDefault()\n return false\n }\n\n // Should there be a step.skip method?\n await step.complete()\n\n if (step.secondaryButtonUri != null) {\n navigate(step.secondaryButtonUri, step.secondaryButtonUriTarget)\n }\n },\n [step]\n ),\n }\n}\n","import { useContext, useEffect, useState } from 'react'\n\nimport { FrigadeContext } from '../components/Provider'\nimport { Flow } from '@frigade/js'\n\nexport function useModal(flow: Flow) {\n const { currentModal, modals, setModals } = useContext(FrigadeContext)\n const [isCurrentModal, setIsCurrentModal] = useState(false)\n\n useEffect(() => {\n if (flow?.isVisible && flow && !modals.has(flow.id)) {\n setModals((prevModals) => new Set(prevModals).add(flow.id))\n }\n }, [flow?.id, flow?.isVisible])\n\n useEffect(() => {\n const newIsCurrentModal = currentModal === flow?.id\n\n if (flow?.id != null && newIsCurrentModal !== isCurrentModal) {\n setIsCurrentModal(newIsCurrentModal)\n }\n }, [flow?.id, currentModal])\n\n function removeModal() {\n if (modals.has(flow?.id)) {\n setModals((prevModals) => {\n const nextModals = new Set(prevModals)\n nextModals.delete(flow?.id)\n\n return nextModals\n })\n }\n }\n\n return {\n isCurrentModal,\n removeModal,\n }\n}\n","import { useFlowComponent } from '@/hooks/useFlowComponent'\nimport { type FlowComponentProps } from '@/shared/types'\n\nimport { Card } from './'\nimport { Flex } from '../Flex'\n\nexport function FlowCard(props: FlowComponentProps) {\n const { FlowComponent } = useFlowComponent(props)\n\n return (\n <FlowComponent as={Card} gap={5}>\n {({ handlePrimary, handleSecondary, step }) => (\n <>\n <Card.Title>{step.title}</Card.Title>\n <Card.Subtitle>{step.subtitle}</Card.Subtitle>\n\n <Card.Media src={step.imageUri} css={{ objectFit: 'contain', width: '100%' }} />\n\n <Flex.Row gap={3} justifyContent=\"flex-end\">\n <Card.Secondary title={step.secondaryButtonTitle} onClick={handleSecondary} />\n <Card.Primary title={step.primaryButtonTitle ?? 'Continue'} onClick={handlePrimary} />\n </Flex.Row>\n </>\n )}\n </FlowComponent>\n )\n}\n","import { Box, BoxProps } from '../Box'\n\nexport interface ImageProps extends BoxProps {\n src: string\n}\n\nexport function Image({ part, src, ...props }: ImageProps) {\n return <Box as=\"img\" part={['image', part]} src={src} {...props} />\n}\n","import { Box, BoxProps } from '../Box'\n\nfunction getVideoEmbedSrc(videoUri: string) {\n if (videoUri.includes('youtube')) {\n const videoId = videoUri.split('v=')[1]?.split('&')[0]\n\n return `https://www.youtube.com/embed/${videoId}`\n } else if (videoUri.includes('vimeo')) {\n const videoId = videoUri.split('vimeo.com/')[1]?.split('&')[0]\n\n return `https://player.vimeo.com/video/${videoId}`\n } else if (videoUri.includes('wistia')) {\n const videoId = videoUri.split('wistia.com/medias/')[1]?.split('&')[0]\n\n return `https://fast.wistia.net/embed/iframe/${videoId}`\n } else if (videoUri.includes('loom')) {\n const videoId = videoUri.split('loom.com/share/')[1]?.split('&')[0]\n\n return `https://loom.com/embed/${videoId}?hideEmbedTopBar=true&hide_title=true&hide_share=true&hide_owner=true`\n }\n\n throw new Error('Could not map videoUri to a known provider (Youtube, Vimeo, Wistia, Loom).')\n}\n\nexport interface VideoProps extends BoxProps {\n src: string\n}\n\nexport function Video({ part, src, ...props }: VideoProps) {\n const videoEmbedSrc = getVideoEmbedSrc(src)\n\n // TODO: Add play button overtop?\n return (\n <Box\n allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\"\n allowFullScreen\n as=\"iframe\"\n backgroundColor=\"gray100\"\n borderWidth={0}\n part={['video', part]}\n src={videoEmbedSrc}\n {...props}\n ></Box>\n )\n}\n","import { Image } from './Image'\nimport { Video } from './Video'\nimport { BoxProps } from '../Box'\n\nexport interface MediaProps extends BoxProps {\n src: string\n type?: 'image' | 'video'\n}\n\nexport function Media({ src, type, ...props }: MediaProps) {\n const Component = type === 'video' ? Video : Image\n\n return <Component src={src} {...props} />\n}\n","import { Dialog, type DialogProps } from '../Dialog'\nimport { Flex } from '../Flex'\nimport { type FlowComponentProps } from '@/shared/types'\nimport { useFlowComponent } from '@/hooks/useFlowComponent'\n\nexport interface AnnouncementProps extends FlowComponentProps, Omit<DialogProps, 'container'> {}\n\nexport function Announcement(props: AnnouncementProps) {\n // TODO: Make Dialog subcomponents agnostic once Card is fleshed out, remove forced container='dialog'\n const { FlowComponent } = useFlowComponent({ ...props, container: 'dialog' })\n\n return (\n <FlowComponent>\n {({ flow, handlePrimary, handleSecondary, step }) => (\n <>\n <Dialog.Title>{step.title}</Dialog.Title>\n <Dialog.Subtitle>{step.subtitle}</Dialog.Subtitle>\n\n <Dialog.Media\n src={step.videoUri ?? step.imageUri}\n type={step.videoUri ? 'video' : 'image'}\n css={{ aspectRatio: '1.5', objectFit: 'cover', width: '100%' }}\n />\n\n <Dialog.ProgressDots\n current={flow.getNumberOfCompletedSteps()}\n total={flow.getNumberOfAvailableSteps()}\n />\n\n <Flex.Row\n css={{\n '& > button': {\n flexGrow: 1,\n },\n }}\n gap={3}\n >\n {step.secondaryButtonTitle && (\n <Dialog.Secondary title={step.secondaryButtonTitle} onClick={handleSecondary} />\n )}\n <Dialog.Primary title={step.primaryButtonTitle ?? 'Continue'} onClick={handlePrimary} />\n </Flex.Row>\n </>\n )}\n </FlowComponent>\n )\n}\n","import { Button } from '@/components/Button'\nimport { Card } from '@/components/Card'\nimport { Flex } from '@/components/Flex'\nimport { Text } from '@/components/Text'\n\nimport { XMarkIcon } from '@heroicons/react/24/solid'\n\nimport { useFlowComponent } from '@/hooks/useFlowComponent'\n\nimport type { FlowComponentProps } from '@/shared/types'\n\ninterface BannerProps extends FlowComponentProps {}\n\nexport function Banner(props: BannerProps) {\n const { FlowComponent } = useFlowComponent(props)\n\n return (\n <FlowComponent\n as={Card}\n border=\"md\"\n borderColor=\"gray900\"\n display=\"flex\"\n flexDirection=\"row\"\n gap={3}\n justifyContent=\"space-between\"\n >\n {({ handleDismiss, handlePrimary, handleSecondary, step }) => (\n <>\n <Flex.Row gap={3}>\n {step.imageUri && (\n <img src={step.imageUri} style={{ height: 40, width: 40, alignSelf: 'center' }} />\n )}\n <Flex.Column>\n <Text.H4 mb={1}>{step.title}</Text.H4>\n <Text.Body2>{step.subtitle}</Text.Body2>\n </Flex.Column>\n </Flex.Row>\n\n <Flex.Row alignItems=\"center\" gap={3} justifyContent=\"center\">\n {step.secondaryButtonTitle && (\n <Button.Secondary title={step.secondaryButtonTitle} onClick={handleSecondary} />\n )}\n <Button.Primary title={step.primaryButtonTitle} onClick={handlePrimary} />\n {props.dismissible && props.container != 'dialog' && (\n <Button.Plain part=\"banner-close\" onClick={handleDismiss}>\n <XMarkIcon height=\"24\" fill=\"currentColor\" />\n </Button.Plain>\n )}\n </Flex.Row>\n </>\n )}\n </FlowComponent>\n )\n}\n","import { useController, useForm } from 'react-hook-form'\n\nimport { Button } from '@/components/Button'\nimport { Flex } from '@/components/Flex'\n\nimport { type FormFieldData, type FormProps, type ValidationRules } from '.'\n\n// See: https://react-hook-form.com/get-started#Applyvalidation\n// NOTE: \"validate\" is intentionally omitted\nconst ruleProps = new Set(['required', 'min', 'max', 'minLength', 'maxLength', 'pattern'])\n\nfunction FieldWrapper({ fieldComponent: FieldComponent, control, fieldData }) {\n // pattern validator comes as a string from YAML, convert it to RegExp\n if (fieldData.pattern != null) {\n if (typeof fieldData.pattern === 'string') {\n fieldData.pattern = new RegExp(fieldData.pattern.replace(/^\\/|\\/$/g, ''))\n } else if (\n typeof fieldData.pattern === 'object' &&\n typeof fieldData.pattern.value === 'string'\n ) {\n fieldData.pattern.value = new RegExp(fieldData.pattern.value.replace(/^\\/|\\/$/g, ''))\n }\n }\n\n const rules = Object.fromEntries(\n Object.entries(fieldData).filter(([key]) => ruleProps.has(key))\n ) as ValidationRules\n\n const controller = useController({\n name: fieldData.id,\n control,\n rules,\n })\n\n return <FieldComponent {...controller} fieldData={fieldData} />\n}\n\nexport function FormStep({ fieldTypes, step }: Pick<FormProps, 'fieldTypes' | 'step'>) {\n const { control, handleSubmit } = useForm({\n delayError: 2000,\n mode: 'onChange',\n })\n const fields = []\n\n // TODO: Type for data\n function onSubmit(data: unknown) {\n step.complete(data)\n }\n\n step.fields?.forEach((fieldData: FormFieldData) => {\n if (fieldTypes[fieldData.type] != null) {\n fields.push(\n <FieldWrapper\n key={fieldData.id}\n control={control}\n fieldComponent={fieldTypes[fieldData.type]}\n fieldData={fieldData}\n />\n )\n }\n })\n\n return (\n <>\n {fields}\n <Flex.Row key=\"form-footer\" justifyContent=\"flex-end\">\n <Button.Primary\n title={step.primaryButtonTitle ?? 'Submit'}\n onClick={handleSubmit(onSubmit)}\n />\n </Flex.Row>\n </>\n )\n}\n","import * as React from 'react'\nimport * as RadioGroup from '@radix-ui/react-radio-group'\n\nimport { Box } from '@/components/Box'\nimport { Flex } from '@/components/Flex'\nimport { Text } from '@/components/Text'\n\nimport { type FormFieldProps } from '..'\nimport { BaseField } from './BaseField'\n\nexport interface SelectItemProps {\n label: string\n value: string\n}\n\n// NOTE: This isn't quite exactly the same as the HeroIcons checkmark\nconst CheckIcon = () => (\n <Box as=\"svg\" color=\"primary.foreground\" width=\"10px\" height=\"8px\" viewBox=\"0 0 10 8\" fill=\"none\">\n <path\n d=\"M1 4.34664L3.4618 6.99729L3.4459 6.98017L9 1\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </Box>\n)\n\nconst RadioItem = React.forwardRef<HTMLButtonElement, SelectItemProps>(\n ({ label, value }, forwardedRef) => (\n <Box\n as=\"label\"\n htmlFor={value}\n display=\"flex\"\n justifyContent=\"space-between\"\n part=\"field-radio\"\n px={4}\n py={2}\n borderWidth=\"md\"\n borderStyle=\"solid\"\n borderColor=\"neutral.border\"\n borderRadius=\"md\"\n >\n <Text.Body2 part=\"field-radio-label\">{label}</Text.Body2>\n\n <RadioGroup.Item id={value} value={value} ref={forwardedRef} asChild>\n <Box\n as=\"button\"\n backgroundColor=\"neutral.background\"\n borderWidth=\"md\"\n borderStyle=\"solid\"\n borderColor=\"neutral.border\"\n borderRadius=\"100%\"\n padding=\"0\"\n part=\"field-radio-value\"\n position=\"relative\"\n height=\"24px\"\n width=\"24px\"\n >\n <Box\n as={RadioGroup.Indicator}\n alignItems=\"center\"\n bg=\"primary.surface\"\n borderWidth=\"md\"\n borderStyle=\"solid\"\n borderColor=\"primary.border\"\n borderRadius=\"100%\"\n display=\"flex\"\n height=\"calc(100% + 2px)\"\n justifyContent=\"center\"\n left=\"-1px\"\n part=\"field-radio-indicator\"\n position=\"absolute\"\n top=\"-1px\"\n width=\"calc(100% + 2px)\"\n >\n <CheckIcon />\n </Box>\n </Box>\n </RadioGroup.Item>\n </Box>\n )\n)\n\nexport function RadioField(props: FormFieldProps) {\n const {\n field: { onChange, value },\n fieldData: { options = [] },\n } = props\n\n const radioItems = options.map(({ label, value }) => (\n <RadioItem key={value} value={value} label={label} />\n ))\n\n return (\n <BaseField {...props}>\n {() => (\n <RadioGroup.Root value={value} onValueChange={onChange} asChild>\n <Flex.Column gap={2} part=\"field-radio-group\">\n {radioItems}\n </Flex.Column>\n </RadioGroup.Root>\n )}\n </BaseField>\n )\n}\n","import { type FieldError } from 'react-hook-form'\n\nimport { Text } from '@/components/Text'\n\nexport interface ErrorProps {\n error: FieldError\n}\n\nexport function Error({ error }: ErrorProps) {\n if (!error?.message?.length) {\n return null\n }\n\n return (\n <Text.Caption color=\"red500\" display=\"block\" part=\"field-error\" textAlign=\"end\">\n {error?.message}\n </Text.Caption>\n )\n}\n","import { Text } from '@/components/Text'\n\nexport function Label({ children, id, required = false }) {\n return (\n <Text.Body2 as=\"label\" htmlFor={id} fontWeight=\"demibold\" part=\"field-label\">\n {children}\n {required && ' *'}\n </Text.Body2>\n )\n}\n","export const field = {\n marginBottom: '5',\n}\n\nexport const input = {\n px: '4',\n py: '2',\n backgroundColor: 'neutral.background',\n borderColor: 'neutral.border',\n borderStyle: 'solid',\n borderWidth: 'md',\n borderRadius: 'md',\n display: 'block',\n outline: 'none',\n width: '100%',\n}\n","import { Box } from '@/components/Box'\n\nimport { type FormFieldProps } from '..'\nimport { Error } from './Error'\nimport { Label } from './Label'\nimport * as styles from './BaseField.styles'\n\ninterface BaseFieldProps extends FormFieldProps {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO: Tighten up fieldProps type\n children: (fieldProps?: any) => React.ReactNode\n}\n\nexport function BaseField({ children, field, fieldData, fieldState }: BaseFieldProps) {\n const { id, label, placeholder } = fieldData\n const { error } = fieldState\n\n const fieldProps = {\n id,\n ...field,\n ...(placeholder ? { placeholder } : {}),\n ...styles.input,\n 'aria-invalid': !!error,\n value: field.value ?? '',\n }\n\n return (\n <Box {...styles.field} part=\"field\">\n <Label id={id} required={!!fieldData.required}>\n {label}\n </Label>\n\n {children(fieldProps)}\n\n <Error error={error} />\n </Box>\n )\n}\n","import * as React from 'react'\nimport * as Select from '@radix-ui/react-select'\nimport { ChevronDownIcon } from '@heroicons/react/24/outline'\n\nimport { Box } from '@/components/Box'\nimport { Text } from '@/components/Text'\n\nimport { type FormFieldProps } from '..'\nimport { BaseField } from './BaseField'\nimport * as baseStyles from './BaseField.styles'\n\nexport interface SelectItemProps {\n label: string\n value: string\n}\n\nconst SelectItem = React.forwardRef<HTMLDivElement, SelectItemProps>(\n ({ label, value }, forwardedRef) => (\n <Select.Item value={value} ref={forwardedRef} asChild>\n <Box\n backgroundColor:hover=\"blue900\"\n borderRadius=\"md\"\n outline=\"none\"\n part=\"field-select-option\"\n px=\"3\"\n py=\"2\"\n >\n <Select.ItemText asChild>\n <Text.Body2 part=\"field-select-option-label\">{label}</Text.Body2>\n </Select.ItemText>\n </Box>\n </Select.Item>\n )\n)\n\nexport function SelectField(props: FormFieldProps) {\n // TODO: Label doesn't open select automatically. Need to wire that in.\n const {\n field: { onChange, value },\n fieldData: { options = [], placeholder },\n } = props\n\n const selectItems = options.map(({ label, value }) => (\n <SelectItem key={value} value={value} label={label} />\n ))\n\n return (\n <BaseField {...props}>\n {() => (\n <Select.Root value={value} onValueChange={onChange}>\n <Select.Trigger asChild>\n <Text.Body2\n {...baseStyles.input}\n alignItems=\"center\"\n display=\"flex\"\n justifyContent=\"space-between\"\n part=\"field-select\"\n >\n <Select.Value placeholder={placeholder ?? 'Select one'} />\n\n <Select.Icon>\n <Box\n as={ChevronDownIcon}\n color=\"gray100\"\n display=\"block\"\n height=\"24px\"\n part=\"field-select-icon\"\n width=\"24px\"\n />\n </Select.Icon>\n </Text.Body2>\n </Select.Trigger>\n\n <Select.Portal>\n <Select.Content position=\"popper\" sideOffset={4} asChild>\n <Box\n {...baseStyles.input}\n p=\"1\"\n part=\"field-select-options\"\n width=\"var(--radix-popper-anchor-width)\"\n >\n <Select.Viewport>{selectItems}</Select.Viewport>\n </Box>\n </Select.Content>\n </Select.Portal>\n </Select.Root>\n )}\n </BaseField>\n )\n}\n","import { Text } from '@/components/Text'\n\nimport { type FormFieldProps } from '..'\nimport { BaseField } from './BaseField'\n\nexport function TextField(props: FormFieldProps) {\n return (\n <BaseField {...props}>\n {(fieldProps) => <Text.Body2 as=\"input\" part=\"field-text\" type=\"text\" {...fieldProps} />}\n </BaseField>\n )\n}\n","import { Text } from '@/components/Text'\n\nimport { type FormFieldProps } from '..'\nimport { BaseField } from './BaseField'\n\nexport function TextareaField(props: FormFieldProps) {\n return (\n <BaseField {...props}>\n {(fieldProps) => (\n <Text.Body2 as=\"textarea\" part=\"field-textarea\" {...fieldProps}></Text.Body2>\n )}\n </BaseField>\n )\n}\n","import { FlowStep } from '@frigade/js'\nimport { type ControllerFieldState, type ValidationRule, type Message } from 'react-hook-form'\n\nimport { type FlowComponentProps } from '@/shared/types'\nimport { useFlowComponent } from '@/hooks/useFlowComponent'\n\nimport { FormStep } from './FormStep'\nimport { RadioField } from './fields/RadioField'\nimport { SelectField } from './fields/SelectField'\nimport { TextField } from './fields/TextField'\nimport { TextareaField } from './fields/TextareaField'\n\n// stepComponent prop -> can make this global across the SDK\n\n// TODO: Fix center alignment in Dialog component\n\nexport type FieldTypes = Record<string, React.ComponentType<FormFieldProps>>\n\nconst defaultFieldTypes: FieldTypes = {\n radio: RadioField,\n select: SelectField,\n text: TextField,\n textarea: TextareaField,\n}\n\nexport interface ValidationRules {\n required?: Message | ValidationRule<boolean>\n min?: ValidationRule<number | string>\n max?: ValidationRule<number | string>\n maxLength?: ValidationRule<number>\n minLength?: ValidationRule<number>\n pattern?: ValidationRule<RegExp>\n}\n\n// TODO: We should get this interface from JS-API\nexport interface FormFlowStep extends FlowStep {\n fields: FormFieldData[]\n}\n\n// TODO: We should get this interface from JS-API\n// TODO: Add validation properties to this type\nexport interface FormFieldData extends ValidationRules {\n id: string\n options?: { label: string; value: string }[]\n placeholder?: string\n label?: string\n type: string\n}\n\n// TODO: Wire UseControllerReturn into this type\nexport interface FormFieldProps {\n field: any // eslint-disable-line @typescript-eslint/no-explicit-any\n fieldData: FormFieldData\n formState: any // eslint-disable-line @typescript-eslint/no-explicit-any\n fieldState: ControllerFieldState\n}\n\nexport interface FormProps extends FlowComponentProps {\n fieldTypes?: FieldTypes\n}\n\nexport function Form({ fieldTypes = {}, ...props }: FormProps) {\n const { FlowComponent } = useFlowComponent(props)\n\n const mergedFieldTypes = Object.assign({}, defaultFieldTypes, fieldTypes)\n\n return (\n <FlowComponent>\n {({ step }) => <FormStep fieldTypes={mergedFieldTypes} step={step} {...props} />}\n </FlowComponent>\n )\n}\n","import React, { useEffect, useRef, useState } from 'react'\n\nimport { XMarkIcon } from '@heroicons/react/24/solid'\nimport * as Popover from '@radix-ui/react-popover'\n\nimport { useBoundingClientRect } from '../../hooks/useBoundingClientRect'\nimport { Box } from '../Box'\nimport { Button, ButtonProps } from '../Button'\nimport { Card } from '../Card'\nimport { Dot } from './Dot'\nimport { Media, MediaProps } from '../Media'\nimport { Text, TextProps } from '../Text'\nimport { getDotPosition } from './getDotPosition'\nimport { mapTooltipPropsToPopoverProps } from './mapTooltipPropsToPopoverProps'\n\ninterface MergedRadixPopoverProps\n extends Pick<Popover.PopoverProps, 'defaultOpen' | 'modal' | 'onOpenChange' | 'open'>,\n Omit<Popover.PopoverContentProps, 'align' | 'asChild'> {}\nexport interface TooltipProps extends MergedRadixPopoverProps {\n align?: Popover.PopoverContentProps['align'] | 'before' | 'after'\n anchor?: string\n spotlight?: boolean\n style?: React.CSSProperties\n}\n\nexport function Tooltip({\n anchor,\n children,\n className,\n spotlight = false,\n style,\n ...props\n}: TooltipProps) {\n const { node: contentNode, rect: contentRect, ref: contentRef } = useBoundingClientRect()\n const { node: anchorNode, rect: anchorRect, ref: anchorRef } = useBoundingClientRect()\n const { contentProps, rootProps } = mapTooltipPropsToPopoverProps(props, contentRect)\n\n const [alignAttr, setAlignAttr] = useState(contentProps.align)\n const [sideAttr, setSideAttr] = useState(contentProps.side)\n const [spotlightLeft, setSpotlightLeft] = useState(0)\n const [spotlightTop, setSpotlightTop] = useState(0)\n\n // Radix will update data attrs to let us know if Popover.Content has collided\n if (contentNode !== null) {\n const currentAlignAttr = contentNode.getAttribute('data-align')\n const currentSideAttr = contentNode.getAttribute('data-side')\n\n if (alignAttr !== currentAlignAttr) {\n setAlignAttr(currentAlignAttr)\n }\n\n if (sideAttr !== currentSideAttr) {\n setSideAttr(currentSideAttr)\n }\n }\n\n // Radix requires a separate ref to pass anchor through into Popover.Anchor\n const anchorVirtualRef = useRef(null)\n\n useEffect(() => {\n const anchorQuery = document.querySelector(anchor)\n\n if (anchorQuery != null) {\n anchorRef(anchorQuery)\n anchorVirtualRef.current = anchorQuery\n }\n }, [anchor])\n\n useEffect(() => {\n const { scrollX, scrollY } = window\n\n setSpotlightLeft(anchorRect.left + scrollX)\n setSpotlightTop(anchorRect.top + scrollY)\n }, [anchorRect.left, anchorRect.top])\n\n if (anchorNode == null) {\n return null\n }\n\n let anchorRadius = '0'\n if (typeof window !== 'undefined') {\n anchorRadius = window.getComputedStyle(anchorNode).borderRadius\n }\n\n const dotPosition = getDotPosition({ props, alignAttr, sideAttr })\n\n return (\n <Popover.Root defaultOpen={true} {...rootProps}>\n <Popover.Anchor virtualRef={anchorVirtualRef} />\n <Popover.Portal>\n <div\n className={className}\n css={{ bottom: 0, left: 0, position: 'absolute', right: 0, top: 0, zIndex: 9999 }}\n >\n {spotlight && (\n <Box\n part=\"tooltip-spotlight\"\n position=\"absolute\"\n style={{\n borderRadius: anchorRadius,\n boxShadow: '0 0 0 20000px rgb(0 0 0 / 0.5)',\n height: anchorRect.height,\n left: spotlightLeft,\n top: spotlightTop,\n width: anchorRect.width,\n }}\n />\n )}\n <Popover.Content asChild {...contentProps} ref={contentRef}>\n <Card\n boxShadow=\"md\"\n part=\"tooltip-content\"\n position=\"relative\"\n css={{\n maxWidth: '360px',\n ...style,\n }}\n >\n <Dot style={dotPosition} />\n\n {children}\n </Card>\n </Popover.Content>\n </div>\n </Popover.Portal>\n </Popover.Root>\n )\n}\n\nTooltip.Close = (props: ButtonProps) => {\n return (\n <Popover.Close aria-label=\"Close\" asChild>\n <Button.Plain\n css={{\n top: '12px',\n right: '4px',\n }}\n part=\"close\"\n position=\"absolute\"\n {...props}\n >\n <XMarkIcon height=\"24\" fill=\"currentColor\" />\n </Button.Plain>\n </Popover.Close>\n )\n}\n\nTooltip.Media = ({ src, ...props }: MediaProps) => {\n if (src == null) return null\n\n return (\n <Media\n borderRadius=\"md md 0 0\"\n borderWidth=\"0\"\n css={{\n aspectRatio: '2',\n }}\n margin=\"-5 -5 5\"\n src={src}\n {...props}\n />\n )\n}\n\nTooltip.Primary = ({ onClick, title, ...props }: ButtonProps) => {\n if (title == null) return null\n\n return <Button.Primary title={title} onClick={onClick} {...props} />\n}\n\nTooltip.Progress = ({ children, ...props }: TextProps) => {\n if (children == null) return null\n\n return (\n <Text.Body2 fontWeight=\"demibold\" part=\"progress\" {...props}>\n {children}\n </Text.Body2>\n )\n}\n\nTooltip.Secondary = ({ onClick, title, ...props }: ButtonProps) => {\n if (title == null) return null\n\n return <Button.Secondary title={title} onClick={onClick} {...props} />\n}\n\nTooltip.Subtitle = ({ children, ...props }: TextProps) => {\n if (children == null) return null\n\n return (\n <Text.Body2 part=\"subtitle\" {...props}>\n {children}\n </Text.Body2>\n )\n}\n\nTooltip.Title = ({ children, ...props }: TextProps) => {\n if (children == null) return null\n\n return (\n <Text.Body1 fontWeight=\"bold\" mb={1} part=\"title\" {...props}>\n {children}\n </Text.Body1>\n )\n}\n","import { useCallback, useLayoutEffect, useState } from 'react'\n\nexport function useBoundingClientRect() {\n const initialRect =\n 'DOMRect' in globalThis\n ? new DOMRect()\n : {\n height: 0,\n width: 0,\n x: 0,\n y: 0,\n bottom: 0,\n top: 0,\n right: 0,\n left: 0,\n toJSON: () => {},\n }\n const [rect, setRect] = useState(initialRect)\n const [node, setNode] = useState(null)\n\n const ref = useCallback((node: Element) => {\n setNode(node)\n }, [])\n\n useLayoutEffect(() => {\n if (!node) return\n\n const handleResize = () => {\n const newRect = node.getBoundingClientRect()\n setRect(newRect)\n }\n\n handleResize()\n\n window.addEventListener('resize', handleResize)\n\n return () => window.removeEventListener('resize', handleResize)\n }, [node])\n\n return {\n node,\n rect,\n ref,\n }\n}\n","import { keyframes } from '@emotion/react'\nimport { Box, BoxProps } from '../Box'\n\nconst pulse = keyframes({\n '0%': {\n opacity: 0.5,\n transform: 'scale(0.5)',\n },\n '50%': {\n opacity: 0,\n transform: 'scale(1)',\n },\n '100%': {\n opacity: 0,\n transform: 'scale(1)',\n },\n})\n\nexport interface DotProps extends BoxProps {}\n\nexport function Dot({ style = {}, part = '', ...props }: DotProps) {\n return (\n <Box\n part={`dot-wrapper ${part}`}\n style={{\n height: '48px',\n position: 'absolute',\n width: '48px',\n ...style,\n }}\n {...props}\n >\n <Box\n backgroundColor=\"primary.surface\"\n part=\"dot-pulse\"\n css={{\n animation: `2s ease-out infinite ${pulse}`,\n borderRadius: '24px',\n height: '48px',\n left: 0,\n position: 'absolute',\n top: 0,\n transformOrigin: 'center center',\n width: '48px',\n }}\n />\n <Box\n backgroundColor=\"primary.surface\"\n part=\"dot\"\n style={{\n borderRadius: '12px',\n height: '24px',\n left: '12px',\n position: 'absolute',\n top: '12px',\n width: '24px',\n }}\n />\n </Box>\n )\n}\n","export function getDotPosition({ props, alignAttr, sideAttr }) {\n const currentSide = sideAttr ?? 'bottom'\n const dotProps = {}\n\n // Radix's collision system isn't aware of our custom before|after align\n const getCurrentAlign = () => {\n if (['after', 'before'].includes(props.align)) {\n if (alignAttr == 'start') {\n return 'before'\n } else if (alignAttr == 'end') {\n return 'after'\n }\n }\n\n return props.align ?? 'after'\n }\n\n const dotOffset = '-24px'\n\n const oppositeSides = {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right',\n }\n\n /* \n Rules:\n - Dot is opposite to side prop (e.g. side=left -> dot=right)\n - align=before|end -> Dot goes to highest extent (right/bottom) of align-axis\n - align=after|start -> Dot goes to lowest extent (left/top) of align-axis\n - align=center -> Dot goes to the center\n */\n\n dotProps[oppositeSides[currentSide]] = dotOffset\n\n const currentAlign = getCurrentAlign()\n\n if (['before', 'end'].includes(currentAlign)) {\n if (['top', 'bottom'].includes(currentSide)) {\n dotProps['right'] = dotOffset\n } else {\n dotProps['bottom'] = dotOffset\n }\n } else if (['after', 'start'].includes(currentAlign)) {\n if (['top', 'bottom'].includes(currentSide)) {\n dotProps['left'] = dotOffset\n } else {\n dotProps['top'] = dotOffset\n }\n } else {\n // The only option left is align=center\n if (['top', 'bottom'].includes(currentSide)) {\n dotProps['left'] = `calc(50% + ${dotOffset})`\n } else {\n dotProps['top'] = `calc(50% + ${dotOffset})`\n }\n }\n\n return dotProps\n}\n","import { TooltipProps } from '.'\n\nconst RADIX_PROPS = {\n content: [\n 'align',\n 'alignOffset',\n 'arrowPadding',\n 'avoidCollisions',\n 'collisionBoundary',\n 'collisionPadding',\n 'forceMount',\n 'hideWhenDetached',\n 'onCloseAutoFocus',\n 'onEscapeKeyDown',\n 'onFocusOutside',\n 'onInteractOutside',\n 'onOpenAutoFocus',\n 'onPointerDownOutside',\n 'side',\n 'sideOffset',\n 'sticky',\n ],\n root: ['defaultOpen', 'modal', 'onOpenChange', 'open'],\n}\n\nexport function mapTooltipPropsToPopoverProps(props: TooltipProps, contentRect: DOMRect) {\n const contentProps = Object.fromEntries(\n RADIX_PROPS.content\n .map((propName) => [propName, props[propName]])\n .filter((propEntry) => propEntry[1] !== undefined)\n )\n const rootProps = Object.fromEntries(\n RADIX_PROPS.root\n .map((propName) => [propName, props[propName]])\n .filter((propEntry) => propEntry[1] !== undefined)\n )\n\n // Default to align=after, side=bottom\n contentProps.align = contentProps.align ?? 'after'\n contentProps.side = contentProps.side ?? 'bottom'\n\n /*\n Here we're extending Popover.Content's align prop to accept 'before' and\n 'after' in addition to its existing values.\n\n TL;DR:\n 1. Use existing alignOffset prop to push Content to be before/after the\n corresponding edge of the element it's attached to.\n 2. Add a CSS margin to patch alignOffset back onto Content, as Popover\n has a bug that prevents alignOffset from extending past the edge of\n its Trigger/Anchor.\n\n SEE: https://github.com/radix-ui/primitives/issues/2457\n */\n if (['before', 'after'].includes(contentProps.align)) {\n const mapToOriginalAlignValues = {\n after: 'end',\n before: 'start',\n }\n\n const mapAlignOffsetToMargin = (align, side) => {\n /*\n Translate alignOffset to CSS margin based on align and side props:\n bottom || top\n after: marginLeft\n before: marginRight\n left || right\n after: marginTop\n before: marginBottom\n */\n if (['top', 'bottom'].includes(side)) {\n if (align == 'after') {\n return 'marginLeft'\n } else {\n return 'marginRight'\n }\n } else {\n if (align == 'after') {\n return 'marginTop'\n } else {\n return 'marginBottom'\n }\n }\n }\n\n const originalOffset = contentProps.alignOffset ?? 0\n const originalStyleProp = contentProps.style ?? {}\n const currentSide = contentProps.side ?? 'bottom'\n const currentAlign = contentProps.align\n\n // Copy alignOffset value to CSS margin\n contentProps['style'] = {\n ...originalStyleProp,\n [mapAlignOffsetToMargin(currentAlign, currentSide)]: originalOffset,\n }\n\n const lengthOfCurrentSide = ['top', 'bottom'].includes(currentSide)\n ? contentRect.width\n : contentRect.height\n\n // Change alignOffset to be at the end of the positioned side\n contentProps.alignOffset = (lengthOfCurrentSide + originalOffset) * -1\n\n // Flip align prop back to valid Radix option, or default to 'after'\n contentProps['align'] = mapToOriginalAlignValues[currentAlign]\n }\n\n return {\n contentProps,\n rootProps,\n }\n}\n","import { useEffect } from 'react'\n\nimport { type FlowComponentProps } from '../../shared/types'\nimport { type TooltipProps } from '../Tooltip'\nimport { TourStep } from './TourStep'\nimport { useFlow } from '../../hooks/useFlow'\nimport { useFlowHandlers } from '../../hooks/useFlowHandlers'\nimport { useModal } from '../../hooks/useModal'\n\nexport interface TourProps extends TooltipProps, FlowComponentProps {}\n\nexport function Tour({ flowId, onComplete, variables, ...props }: TourProps) {\n const { flow } = useFlow(flowId, {\n variables,\n })\n useFlowHandlers(flow, { onComplete })\n\n const { isCurrentModal, removeModal } = useModal(flow)\n\n useEffect(() => {\n if (!flow?.isVisible && isCurrentModal) {\n removeModal()\n }\n }, [flow?.isVisible, isCurrentModal])\n\n if (flow == null || flow.isVisible === false || !isCurrentModal) {\n return null\n }\n\n flow.start()\n\n const step = flow.getCurrentStep()\n step?.start()\n\n return <TourStep step={step} flow={flow} {...props} />\n}\n","import type { Flow, FlowStep } from '@frigade/js'\n\nimport { TourProps } from '.'\nimport { useFlowHandlers } from '../../hooks/useFlowHandlers'\nimport { useStepHandlers } from '../../hooks/useStepHandlers'\n\nimport { Flex } from '../Flex'\nimport { Tooltip } from '../Tooltip'\n\nexport interface TourStepProps extends Omit<TourProps, 'flowId'> {\n step: FlowStep\n flow: Flow\n}\n\nexport function TourStep({\n dismissible = true,\n flow,\n onDismiss,\n onPrimary,\n onSecondary,\n step,\n ...props\n}: TourStepProps) {\n const { handleDismiss } = useFlowHandlers(flow, {\n onDismiss,\n })\n\n const { handlePrimary, handleSecondary } = useStepHandlers(step, {\n onPrimary,\n onSecondary,\n })\n\n return (\n <Tooltip\n key={step.id}\n anchor={step.selector as string}\n onOpenAutoFocus={(e) => e.preventDefault()}\n onPointerDownOutside={(e) => e.preventDefault()}\n {...props}\n >\n {dismissible && <Tooltip.Close onClick={handleDismiss} />}\n\n <Tooltip.Media\n src={step.videoUri ?? step.imageUri}\n type={step.videoUri ? 'video' : 'image'}\n />\n\n <Tooltip.Title>{step.title}</Tooltip.Title>\n <Tooltip.Subtitle>{step.subtitle}</Tooltip.Subtitle>\n\n <Flex.Row alignItems=\"center\" gap={3} justifyContent=\"flex-end\" part=\"tooltip-footer\" pt={4}>\n <Tooltip.Progress>{`${\n flow.getNumberOfCompletedSteps() + 1\n }/${flow.getNumberOfAvailableSteps()}`}</Tooltip.Progress>\n\n <Tooltip.Secondary\n marginLeft=\"auto\"\n title={step.secondaryButtonTitle}\n onClick={handleSecondary}\n />\n <Tooltip.Primary title={step.primaryButtonTitle} onClick={handlePrimary} />\n </Flex.Row>\n </Tooltip>\n )\n}\n","/// <reference types=\"@emotion/react/types/css-prop\" />\n\nexport { Announcement, type AnnouncementProps } from './components/Announcement'\nexport { Banner } from './components/Banner'\nexport { Box, type BoxProps } from './components/Box'\nexport { Card } from './components/Card'\nexport { Button, type ButtonProps } from './components/Button'\nexport { Flex } from './components/Flex'\nexport { Form } from './components/Form'\nexport { Provider, type ProviderProps } from './components/Provider'\nexport { Text, type TextProps } from './components/Text'\nexport { Tooltip, type TooltipProps } from './components/Tooltip'\nexport { Tour, type TourProps } from './components/Tour'\n\nexport { Flow, Frigade } from '@frigade/js'\n\nexport { useBoundingClientRect } from './hooks/useBoundingClientRect'\nexport { useFlow, type FlowConfig } from './hooks/useFlow'\nexport { useFlowHandlers } from './hooks/useFlowHandlers'\nexport { useModal } from './hooks/useModal'\nexport { useStepHandlers } from './hooks/useStepHandlers'\nexport { useFrigade } from './hooks/useFrigade'\nexport { useUser } from './hooks/useUser'\nexport { useGroup } from './hooks/useGroup'\n","import { useContext } from 'react'\n\nimport { FrigadeContext } from '../components/Provider'\n\nexport function useFrigade() {\n const { frigade } = useContext(FrigadeContext)\n\n return { frigade, isLoading: !Boolean(frigade?.isReady()) }\n}\n","import { useContext } from 'react'\n\nimport { FrigadeContext } from '../components/Provider'\n\nexport function useUser() {\n const { userId, frigade } = useContext(FrigadeContext)\n\n /**\n * Sets properties for the current user\n * @param properties\n */\n async function setProperties(properties?: Record<string, unknown>) {\n await frigade.identify(userId, properties)\n }\n\n /**\n * Tracks an event for the current user\n * @param eventName\n * @param properties\n */\n async function track(eventName: string, properties?: Record<string, unknown>) {\n await frigade.track(eventName, properties)\n }\n\n return { userId, setProperties, track }\n}\n","import { useContext } from 'react'\n\nimport { FrigadeContext } from '../components/Provider'\n\nexport function useGroup() {\n const { groupId, frigade } = useContext(FrigadeContext)\n\n /**\n * Sets properties for the current group\n * @param properties\n */\n async function setProperties(properties?: Record<string, unknown>) {\n if (!groupId) {\n console.error('No Group ID is set. Cannot set properties without a Group ID.')\n return\n }\n await frigade.group(groupId, properties)\n }\n\n /**\n * Tracks an event for the current group\n * @param eventName\n * @param properties\n */\n async function track(eventName: string, properties?: Record<string, unknown>) {\n await frigade.track(eventName, properties)\n }\n\n return { groupId, setProperties, track }\n}\n"]}