@frigade/react 2.9.2 → 2.9.3

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/Icon/XMarkIcon.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/Button/Button.tsx","../src/components/Text/Text.tsx","../src/components/Text/Text.styles.ts","../src/components/Button/Button.styles.ts","../src/components/Card/index.tsx","../src/components/Flex/Flex.tsx","../src/components/Flow/index.tsx","../src/hooks/useFlow.ts","../src/components/Provider/Provider.tsx","../src/components/Banner/index.tsx","../src/components/Checklist/index.tsx","../src/components/Checklist/CarouselEmblaWrapper.tsx","../src/components/Progress/index.tsx","../src/components/Progress/Bar.tsx","../src/components/Progress/Dots.tsx","../src/components/Progress/Fraction.tsx","../src/components/Progress/Ring.tsx","../src/components/Progress/Segments.tsx","../src/components/Icon/LockClosedIcon.tsx","../src/components/CheckIndicator/index.tsx","../src/hooks/useStepHandlers.ts","../src/components/Checklist/CarouselStep.tsx","../src/components/Icon/ArrowRightIcon.tsx","../src/components/Icon/ArrowLeftIcon.tsx","../src/components/Checklist/Carousel.tsx","../src/components/Checklist/Collapsible.tsx","../src/components/Checklist/CollapsibleStep.tsx","../src/components/Icon/ChevronDownIcon.tsx","../src/components/Media/videoProps.ts","../src/components/Checklist/Floating.tsx","../src/components/Popover/index.tsx","../src/components/Popover/Root.tsx","../src/components/Spotlight/index.tsx","../src/components/Overlay/index.tsx","../src/hooks/useAutoScroll.ts","../src/hooks/useFloating.ts","../src/components/Hint/useMutationAwareAnchor.ts","../src/components/Popover/Content.tsx","../src/hooks/useVisibility.ts","../src/hooks/useBoundingClientRect.ts","../src/components/Popover/Trigger.tsx","../src/components/Checklist/FloatingStep.tsx","../src/components/Checklist/Floating.styles.ts","../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/Icon/CheckIcon.tsx","../src/components/Form/fields/SelectField.tsx","../src/components/Icon/ChevronDownMiniIcon.tsx","../src/components/Form/fields/SelectMultipleField.tsx","../src/components/Form/fields/TextField.tsx","../src/components/Form/fields/TextareaField.tsx","../src/components/Form/fields/CheckboxField.tsx","../src/components/Form/index.tsx","../src/components/Survey/index.tsx","../src/components/Survey/NPSField.tsx","../src/components/Survey/NPS.tsx","../src/hooks/useClientPortal.ts","../src/components/ClientPortal/ClientPortal.tsx","../src/components/Tour/TourStep.tsx","../src/components/Hint/index.tsx","../src/components/Ping/index.tsx","../src/components/Hint/getPingPosition.ts","../src/components/Tour/Tour.tsx","../src/hooks/useCollection.ts","../src/hooks/useCollections.ts","../src/hooks/useSyncExternalStore.ts","../src/components/Collection/index.tsx","../src/components/Provider/DefaultCollection.tsx","../src/components/Provider/FrigadeContext.ts","../src/components/Provider/ImagePreloader.tsx","../src/hooks/useFrigade.ts","../src/shared/log.ts","../src/version.ts","../src/hooks/useFlowHandlers.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/Dialog/mapDialogProps.ts","../src/components/Announcement/index.tsx","../src/shared/deepmerge.ts","../src/components/ProgressBadge/index.tsx","../src/components/Tooltip/index.tsx","../src/components/Tooltip/Dot.tsx","../src/components/Tooltip/getDotPosition.ts","../src/components/Tooltip/mapTooltipPropsToPopoverProps.ts","../src/index.ts","../src/hooks/useUser.ts","../src/hooks/useGroup.ts"],"names":["keyframes","RadixDialog","jsx","XMarkIcon","props","__spreadProps","__spreadValues","React","clsx","kcp","borders","defaultScale","coolScale","warmScale","hues","scaledColors","name","h","s","scale","l","i","palette","radii","colorVar","colorName","semantic","shadows","SPACE_UNIT","spaceValue","key","spaceKeys","space","typography","tokens","flattenObject","obj","path","separator","acc","k","currentPath","currentValue","createThemeVariables","flattenedTokens","value","cssSafeKey","mapTokensToThemeVariables","newObj","themeVariables","theme","omittedCSSProperties","filteredCSSProperties","prop","_","char","defaultCSSProperties","colorTokens","themedStyleProps","styleProps","stylePropShorthands","pseudoStyleProps","prepValue","v","stylePropsMap","propName","stylePropShorthandsMap","shorthand","targetProps","preservedProps","elementsWithPreservedProps","getPseudoClass","pseudo","stylePropsToCss","element","unmatchedProps","cssFromProps","getTargetObject","pseudoSelector","match","propValue","matchedShorthand","p","fullPropName","styleProp","splitPropValues","_a","clippedPropName","DOMPurify","getWindow","JSDOM","sanitize","dirty","prefixPart","part","processPart","BoxWithRef","ref","_b","as","children","className","css","__objRest","Component","processedPart","classNameWithPart","cssProp","Box","Button_exports","__export","Link","Plain","Primary","Secondary","Text_exports","Body1","Body2","Caption","Display1","Display2","H1","H2","H3","H4","Text_styles_exports","base","textVariantNames","textVariants","variant","defaultAs","component","Button_styles_exports","loadingCSSStyle","rotate","jsxs","BaseButton","title","variantPart","Flex_exports","Column","Row","Fragment","FlowType","useCallback","useContext","useEffect","useState","Frigade","useMemo","useRef","Global","ThemeProvider","Banner","flowId","Flow","handleDismiss","handlePrimary","handleSecondary","containerProps","dismissible","step","_c","_d","primaryButtonTitle","secondaryButtonTitle","disabled","Card","Checklist_exports","Carousel","Collapsible","CollapsibleStep_exports","Floating","useLayoutEffect","useEmblaCarousel","Progress_exports","Bar","Dots","Fraction","Ring","Segments","current","total","progressPercent","barWidth","dots","height","showLabel","strokeWidth","width","segments","LockClosedIcon","CheckIcon","CheckIndicator","checked","size","useStepHandlers","onPrimary","onSecondary","navigate","FrigadeContext","stepActions","properties","optimistic","e","__async","primaryAction","secondaryAction","CarouselStep","blocked","completed","skipped","topRightIcon","ArrowRightIcon","ArrowLeftIcon","fadeIn","CarouselEmblaWrapper","flow","sort","stepOrder","setStepOrder","emblaOptions","emblaRef","emblaApi","hasNext","setHasNext","hasPrev","setHasPrev","steps","completedOrSkippedSteps","a","b","nonCompletedOrSkippedSteps","completedSteps","availableSteps","flowChildrenProps","createContext","Content","Root","Trigger","ChevronDownIcon","slideDown","slideUp","onOpenChange","open","isCompleted","isBlocked","VIDEO_PROP_NAMES","getVideoProps","videoProps","otherProps","CollapsibleContext","DefaultCollapsibleStep","_e","_f","subtitle","stepProps","defaultStepTypes","StepWrapper","openStepId","setOpenStepId","stepTypes","StepComponent","isOpening","mergedStepTypes","childrenProps","stepList","currentSteps","FloatingTree","Popover_exports","useFloatingNodeId","autoUpdate","useFloating","RemoveScroll","OverlayWithRef","lockScroll","opacity","hasScrolled","setHasScrolled","handleScroll","Overlay","getClipPath","maxX","maxY","radius","x1","x2","y1","y2","getComputedRadius","computedRadius","Spotlight","anchor","style","clipPathCoords","setClipPathCoords","refs","elements","rects","anchorQuery","invalidSelector","useAutoScroll","enabled","scrollComplete","setScrollComplete","scrollOptions","scrollTimeout","scrollHandler","flip","offset","shift","useClick","useDismiss","useFloatingUI","useFocus","useInteractions","useRole","useTransitionStatus","checkElementForAnchor","isVisible","anchorSelector","useMutationAwareAnchor","anchorElement","setAnchorElement","observer","mutations","mutation","node","maybeAnchor","getOriginalAlign","align","alignOffset","nodeId","side","sideOffset","placement","offsetMiddleware","offsets","context","floatingStyles","computedPlacement","floatingReturn","clickHandler","dismissHandler","focusProps","roleProps","status","getFloatingProps","getReferenceProps","finalPlacement","PopoverContext","autoScroll","defaultOpen","modal","spotlight","floatingProps","internalOpen","setInternalOpen","canonicalOpen","floatingNodeId","floating","newOpen","FloatingNode","EmptyDOMRect","useBoundingClientRect","initialRect","rect","setRect","setNode","handleResize","newRect","useVisibility","isIntersecting","setIsIntersecting","clientRect","setClientRect","hasDimensions","entries","el","isAnchorVisible","setIsOpen","prev","floatingTransitionCSS","FloatingStep","anchorPointerEnterTimeout","isStepOpen","wrappedHandlePrimary","args","wrappedHandleSecondary","handlePointerEnter","handlePointerLeave","pointerLeaveTimeout","resetOpenStep","isOpen","anchorContent","FormProvider","useController","useForm","useFormContext","ruleProps","FieldWrapper","FieldComponent","control","fieldData","submit","formContext","rules","controller","FormStep","fieldTypes","__readOnly","fieldDatas","field","data","isSubmitting","setIsSubmitting","fields","handleSubmit","onPrimarySubmit","RadioGroup","Error","error","Label","id","required","box","input","checkContainer","BaseField","fieldState","label","placeholder","fieldProps","RadioItem","forwardedRef","RadioField","onChange","options","radioItems","Select","ChevronDownMiniIcon","Checkbox","SelectMultipleField","valueArray","setValueArray","setValueInArray","updatedValueArray","SelectItem","SelectField","selectItems","TextField","TextareaField","CheckboxField","defaultFieldTypes","Form","mergedFieldTypes","childProps","Survey_exports","NPS","NPSField","positiveLabel","negativeLabel","buttons","option","Dialog","useFlow","defaultOptions","npsOptions","createPortal","useClientPortal","container","mounted","setMounted","containerRef","ClientPortal","pulse","Ping","clickable","hasMounted","setHasMounted","getPingPosition","pingOffset","oppositeSides","Hint","onMount","setInteralOpen","finalSide","finalAlign","referenceProps","isMounted","TourStep","TourWrapper","Tour","onDismiss","parentProps","sequential","zIndex","sequentialStepProps","tourSteps","currentStep","visible","handleDismissStep","shouldShowSpotlight","currentStepZIndex","nonSequentialStepProps","UseSyncExternalStoreShim","useSyncExternalStore","useCollections","frigade","setForceRender","debounceTimeout","subscribe","cb","handler","forceRender","getSnapshot","result","noGlobalStateYet","useCollection","collectionId","collections","collection","flowInCollection","item","Collection","variables","flowTypeMap","Announcement","currentFlow","FlowComponent","DefaultCollection","entry","logOnce","message","type","useFrigade","ImagePreloader","img","SDK_VERSION","Provider","defaultCollection","themeSelector","themeOverrides","registeredComponents","intervalRef","hasInitialized","setHasInitialized","currentModal","setCurrentModal","config","batchRegistration","batchedFlowIds","registerComponent","callback","unregisterComponent","navigateHandler","url","target","_event","updatedFlow","useFlowHandlers","onComplete","lastCompleted","callHandler","useCheckForModalCollision","isModal","claimLock","releaseLock","isDialog","autoStart","initialStepProps","forceMount","mergedProps","hasModalCollision","handleEscapeKeyDown","shouldForceMount","ContainerElement","FlowCard","Image","src","getVideoEmbedSrc","videoUri","Video","autoPlay","controls","controlsList","crossOrigin","disablePictureInPicture","disableRemotePlayback","loop","muted","playsInline","poster","preload","videoEmbedSrc","Media","onClick","RADIX_PROPS","mapDialogProps","contentProps","propEntry","rootProps","isObject","deepmerge","source","firstNonEmptyString","strings","str","ProgressBadge","derivedTitle","isClickable","Popover","Dot","getDotPosition","alignAttr","sideAttr","currentSide","dotProps","getCurrentAlign","dotOffset","currentAlign","mapTooltipPropsToPopoverProps","contentRect","mapToOriginalAlignValues","mapAlignOffsetToMargin","originalOffset","originalStyleProp","lengthOfCurrentSide","elem","Tooltip","contentNode","contentRef","anchorNode","anchorRect","anchorRef","setAlignAttr","setSideAttr","spotlightLeft","setSpotlightLeft","spotlightTop","setSpotlightTop","currentAlignAttr","currentSideAttr","anchorVirtualRef","scrollX","scrollY","anchorRadius","dotPosition","FrigadeJS","useUser","userId","addProperties","track","eventName","useGroup","groupId","setGroupId","FloatingUI"],"mappings":"kpCAAA,OAAS,aAAAA,OAAiB,iBAC1B,UAAYC,MAAiB,yBCQvB,cAAAC,OAAA,6BATC,SAASC,GAAUC,EAAsC,CAC9D,OACEF,GAAC,MAAAG,EAAAC,EAAA,CACC,MAAM,6BACN,QAAQ,YACR,KAAK,eACL,UAAU,UACNF,GALL,CAOC,SAAAF,GAAC,QAAK,EAAE,qLAAqL,GAC/L,CAEJ,CCZA,UAAYK,OAAW,QACvB,OAAS,QAAAC,OAAY,OCDrB,OAAOC,OAAS,uBCAT,IAAMC,GAAU,CACrB,aAAc,CACZ,GAAI,KACN,CACF,ECJA,IAAMC,GAAe,CAAC,EAAG,GAAI,GAAI,GAAI,GAAI,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U,CACzC,GAEA,MAAO,CACL,QAAAqc,EACA,WAAAC,EACA,cAAAL,EACA,MAAAC,EACA,UAAW,EAAChJ,GAAA,MAAAA,EAAS,UACvB,CACF,CFmBA,UAAYqJ,OAAgB","sourcesContent":["import { keyframes } from '@emotion/react'\nimport * as RadixDialog from '@radix-ui/react-dialog'\nimport { XMarkIcon } from '@/components/Icon/XMarkIcon'\n\nimport { Box } from '@/components/Box'\nimport { Button, ButtonProps } from '@/components/Button'\nimport { Card } from '@/components/Card'\nimport { Media, MediaProps } from '@/components/Media'\nimport { Text, TextProps } from '@/components/Text'\n\nimport { mapDialogProps } from './mapDialogProps'\n\nimport { theme } from '@/shared/theme'\nimport { BoxPropsWithoutChildren } from '@/components/Flow/FlowProps'\n\nconst fadeIn = keyframes`\n from {\n opacity: 0;\n }\n 25% {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n`\n\nexport interface DialogContentProps\n extends Pick<\n RadixDialog.DialogContentProps,\n | 'onOpenAutoFocus'\n | 'onCloseAutoFocus'\n | 'onEscapeKeyDown'\n | 'onPointerDownOutside'\n | 'onInteractOutside'\n > {}\n\nexport interface DialogRootProps extends RadixDialog.DialogProps {}\n\nexport interface DialogProps extends BoxPropsWithoutChildren, DialogRootProps, DialogContentProps {\n /**\n * The modality of the dialog. When set to `true`, interaction with outside elements will be disabled and only dialog content will be visible to screen readers.\n */\n modal?: boolean\n}\n\nexport function Dialog({ children, className, modal = true, ...props }: DialogProps) {\n const {\n rootProps,\n contentProps,\n otherProps: { zIndex, ...otherProps },\n } = mapDialogProps(props)\n\n return (\n <RadixDialog.Root defaultOpen={true} modal={modal} {...rootProps}>\n <RadixDialog.Portal>\n <Box\n animation={`${fadeIn} 300ms ease-out`}\n className={className}\n display=\"grid\"\n inset=\"0\"\n padding=\"6\"\n part=\"dialog-wrapper\"\n pointerEvents=\"none\"\n position=\"fixed\"\n zIndex={zIndex ?? 10}\n >\n {modal && (\n <RadixDialog.Overlay asChild>\n <Box\n background=\"rgb(0 0 0 / 0.5)\"\n inset=\"0\"\n part=\"dialog-overlay\"\n position=\"absolute\"\n />\n </RadixDialog.Overlay>\n )}\n <RadixDialog.Content\n asChild\n onOpenAutoFocus={(e) => e.preventDefault()}\n onPointerDownOutside={(e) => e.preventDefault()}\n onInteractOutside={(e) => e.preventDefault()}\n {...contentProps}\n >\n <Card\n alignSelf=\"center\"\n boxShadow=\"md\"\n justifySelf=\"center\"\n maxHeight=\"100%\"\n maxWidth=\"430px\"\n overflowY=\"auto\"\n padding={8}\n part=\"dialog\"\n pointerEvents=\"auto\"\n position=\"relative\"\n {...otherProps}\n >\n {children}\n </Card>\n </RadixDialog.Content>\n </Box>\n </RadixDialog.Portal>\n </RadixDialog.Root>\n )\n}\n\nDialog.Dismiss = (props: ButtonProps) => {\n return (\n <RadixDialog.Close aria-label=\"Close\" asChild>\n <Button.Plain part=\"close\" position=\"absolute\" right=\"2px\" top=\"2px\" {...props}>\n <XMarkIcon height=\"20\" 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 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 <Box\n as=\"circle\"\n key={i}\n r={4}\n cx={4 + 16 * i}\n cy=\"4px\"\n fill={current === i ? theme.colors.primary.surface : theme.colors.neutral['700']}\n part={current === i ? 'progress-dot-selected' : 'progress-dot'}\n />\n )\n })\n\n return (\n <Box\n as=\"svg\"\n height=\"8px\"\n marginInline=\"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.H4 part=\"title\" {...props}>\n {children}\n </Text.H4>\n </RadixDialog.Title>\n )\n}\n\nDialog.displayName = 'Dialog'\n","export function XMarkIcon(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className=\"size-5\"\n {...props}\n >\n <path d=\"M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z\" />\n </svg>\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)\n ? part\n .filter((p) => p != null)\n .map((p) => processPart(p))\n .join(' ')\n : 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.borderWidths, ...colorTokens },\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([\n 'active',\n 'disabled',\n 'focus',\n 'focusVisible',\n 'focusWithin',\n 'hover',\n])\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 borderWidths: {\n md: '1px',\n },\n}\n","const defaultScale = [5, 10, 20, 35, 50, 65, 80, 95, 98]\nconst coolScale = [...defaultScale]\nconst warmScale = [...defaultScale]\n\ncoolScale[4] = 40\nwarmScale[4] = 60\n\nconst hues = {\n blue: {\n h: 213,\n s: 100,\n l: defaultScale,\n },\n gray: {\n h: 220,\n s: 10,\n l: defaultScale,\n },\n green: {\n h: 141,\n s: 90,\n l: coolScale,\n },\n red: {\n h: 9,\n s: 90,\n l: warmScale,\n },\n yellow: {\n h: 50,\n s: 90,\n l: warmScale,\n },\n} as const\n\nexport const colorScaleDegrees = [\n '100',\n '200',\n '300',\n '400',\n '500',\n '600',\n '700',\n '800',\n '900',\n] as const\n\nexport type ColorNames = keyof typeof hues\nexport type ColorScaleDegrees = (typeof colorScaleDegrees)[number]\n\nexport type ScaledColors = {\n [K in ColorNames]: {\n [L in ColorScaleDegrees]: string\n }\n}\n\nconst scaledColors = {} as ScaledColors\n\nfor (const [name, { h, s, l: scale }] of Object.entries(hues)) {\n scaledColors[name] = Object.fromEntries(\n scale.map((l, i) => [`${(i + 1) * 100}`, `hsl(${h} ${s}% ${l}%)`])\n )\n}\n\nexport const palette = {\n black: 'hsl(0 0% 0%)',\n white: 'hsl(0 0% 100%)',\n\n ...(scaledColors as ScaledColors),\n\n // TEMP: Backwards compat for existing colors\n gray100: scaledColors.gray['100'],\n gray200: scaledColors.gray['200'],\n gray300: scaledColors.gray['300'],\n gray400: scaledColors.gray['400'],\n gray500: scaledColors.gray['500'],\n gray600: scaledColors.gray['600'],\n gray700: scaledColors.gray['700'],\n gray800: scaledColors.gray['800'],\n gray900: scaledColors.gray['900'],\n blue400: scaledColors.blue['400'],\n blue500: scaledColors.blue['500'],\n blue800: scaledColors.blue['800'],\n blue900: scaledColors.blue['900'],\n green400: scaledColors.green['400'],\n green500: scaledColors.green['500'],\n green800: scaledColors.green['800'],\n red500: scaledColors.red['500'],\n\n // TODO: Remove these, they were only needed when style props didn't have the ability to fall back to CSS values\n transparent: '#FFFFFF00',\n inherit: 'inherit',\n}\n","export const radii = {\n md: '8px',\n lg: '20px',\n round: '50%',\n}\n","import type { ColorScaleDegrees } from './palette'\n\nexport interface SemanticColorUsage {\n background: string\n border: string\n foreground: string\n surface: string\n}\n\nexport type SemanticColorScale = {\n [Degree in ColorScaleDegrees]: string\n}\n\nexport type SemanticColorIntent = 'negative' | 'neutral' | 'positive' | 'primary' | 'secondary'\n\nexport type SemanticColorState = 'active' | 'focus' | 'hover'\n\nexport type SemanticColor = SemanticColorScale &\n SemanticColorUsage & {\n [State in SemanticColorState]: {\n [Usage in keyof SemanticColorUsage]: string\n }\n }\n\nexport type SemanticColors = {\n [Intent in SemanticColorIntent]: SemanticColor\n}\n\nconst colorVar = (colorName: string) => `var(--fr-colors-${colorName})`\n\nexport const semantic: SemanticColors = {\n negative: {\n '100': colorVar('red-100'),\n '200': colorVar('red-200'),\n '300': colorVar('red-300'),\n '400': colorVar('red-400'),\n '500': colorVar('red-500'),\n '600': colorVar('red-600'),\n '700': colorVar('red-700'),\n '800': colorVar('red-800'),\n '900': colorVar('red-900'),\n\n background: colorVar('negative-500'),\n border: colorVar('negative-500'),\n foreground: colorVar('white'),\n surface: colorVar('negative-500'),\n\n active: {\n background: colorVar('negative-400'),\n border: colorVar('negative-400'),\n foreground: colorVar('white'),\n surface: colorVar('negative-400'),\n },\n focus: {\n background: colorVar('negative-500'),\n border: colorVar('negative-500'),\n foreground: colorVar('white'),\n surface: colorVar('negative-500'),\n },\n hover: {\n background: colorVar('negative-400'),\n border: colorVar('negative-400'),\n foreground: colorVar('white'),\n surface: colorVar('negative-400'),\n },\n },\n\n neutral: {\n '100': colorVar('gray-100'),\n '200': colorVar('gray-200'),\n '300': colorVar('gray-300'),\n '400': colorVar('gray-400'),\n '500': colorVar('gray-500'),\n '600': colorVar('gray-600'),\n '700': colorVar('gray-700'),\n '800': colorVar('gray-800'),\n '900': colorVar('gray-900'),\n\n background: colorVar('white'),\n border: colorVar('neutral-800'),\n foreground: colorVar('black'),\n surface: colorVar('neutral-700'),\n\n active: {\n background: colorVar('white'),\n border: colorVar('neutral-900'),\n foreground: colorVar('black'),\n surface: colorVar('neutral-700'),\n },\n focus: {\n background: colorVar('white'),\n border: colorVar('neutral-900'),\n foreground: colorVar('black'),\n surface: colorVar('neutral-700'),\n },\n hover: {\n background: colorVar('neutral-900'),\n border: colorVar('neutral-800'),\n foreground: colorVar('black'),\n surface: colorVar('neutral-700'),\n },\n },\n\n positive: {\n '100': colorVar('green-100'),\n '200': colorVar('green-200'),\n '300': colorVar('green-300'),\n '400': colorVar('green-400'),\n '500': colorVar('green-500'),\n '600': colorVar('green-600'),\n '700': colorVar('green-700'),\n '800': colorVar('green-800'),\n '900': colorVar('green-900'),\n\n background: colorVar('positive-500'),\n border: colorVar('positive-500'),\n foreground: colorVar('white'),\n surface: colorVar('positive-500'),\n\n active: {\n background: colorVar('positive-400'),\n border: colorVar('positive-400'),\n foreground: colorVar('white'),\n surface: colorVar('positive-400'),\n },\n focus: {\n background: colorVar('positive-500'),\n border: colorVar('positive-500'),\n foreground: colorVar('white'),\n surface: colorVar('positive-500'),\n },\n hover: {\n background: colorVar('positive-400'),\n border: colorVar('positive-400'),\n foreground: colorVar('white'),\n surface: colorVar('positive-400'),\n },\n },\n\n primary: {\n '100': colorVar('blue-100'),\n '200': colorVar('blue-200'),\n '300': colorVar('blue-300'),\n '400': colorVar('blue-400'),\n '500': colorVar('blue-500'),\n '600': colorVar('blue-600'),\n '700': colorVar('blue-700'),\n '800': colorVar('blue-800'),\n '900': colorVar('blue-900'),\n\n background: colorVar('primary-500'),\n border: colorVar('primary-500'),\n foreground: colorVar('white'),\n surface: colorVar('primary-500'),\n\n active: {\n background: colorVar('primary-300'),\n border: colorVar('primary-300'),\n foreground: colorVar('white'),\n surface: colorVar('primary-300'),\n },\n focus: {\n background: colorVar('primary-500'),\n border: colorVar('primary-500'),\n foreground: colorVar('white'),\n surface: colorVar('primary-500'),\n },\n hover: {\n background: colorVar('primary-400'),\n border: colorVar('primary-400'),\n foreground: colorVar('white'),\n surface: colorVar('primary-400'),\n },\n },\n\n secondary: {\n '100': colorVar('gray-100'),\n '200': colorVar('gray-200'),\n '300': colorVar('gray-300'),\n '400': colorVar('gray-400'),\n '500': colorVar('gray-500'),\n '600': colorVar('gray-600'),\n '700': colorVar('gray-700'),\n '800': colorVar('gray-800'),\n '900': colorVar('gray-900'),\n\n background: colorVar('white'),\n border: colorVar('secondary-800'),\n foreground: colorVar('black'),\n surface: colorVar('secondary-900'),\n\n active: {\n background: colorVar('secondary-900'),\n border: colorVar('secondary-800'),\n foreground: colorVar('black'),\n surface: colorVar('secondary-800'),\n },\n focus: {\n background: colorVar('secondary-900'),\n border: colorVar('secondary-800'),\n foreground: colorVar('black'),\n surface: colorVar('secondary-900'),\n },\n hover: {\n background: colorVar('secondary-900'),\n border: colorVar('secondary-800'),\n foreground: colorVar('black'),\n surface: colorVar('secondary-800'),\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 '@/shared/tokens'\nimport { flattenObject } from '@/shared/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 const flattenedTokens = flattenObject(tokens, '--fr', '-')\n\n for (const [key, value] of Object.entries(flattenedTokens)) {\n if (key.indexOf('.') > -1) {\n const cssSafeKey = key.replace(/\\./g, '-')\n\n flattenedTokens[cssSafeKey] = value\n delete flattenedTokens[key]\n }\n }\n\n return flattenedTokens\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 const cssSafeKey = key.replace(/\\./g, '-')\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}-${cssSafeKey})`\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 // Remove null / undefined style props\n if (propValue == null) {\n delete unmatchedProps[fullPropName]\n }\n\n // Split space-separated values out and process them individually\n else 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 'strong',\n 'i',\n 'em',\n 'a',\n 'span',\n 'div',\n 'p',\n 'pre',\n 's',\n 'u',\n 'br',\n 'img',\n 'code',\n 'li',\n 'ol',\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 'p',\n 'style',\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 'playsinline',\n ],\n }),\n }\n}\n","import { Box, type BoxProps } from '@/components/Box'\nimport { Text } from '@/components/Text'\n\nimport * as styles from './Button.styles'\nimport { loadingCSSStyle } from './Button.styles'\n\nexport type ButtonVariant = 'Primary' | 'Secondary' | 'Link' | 'Plain'\n\nexport interface ButtonProps extends BoxProps {\n title?: string\n variant?: ButtonVariant\n loading?: boolean\n}\n\nfunction BaseButton({ as, children, part, title, variant = 'Primary', ...props }: ButtonProps) {\n const variantPart = variant.toLocaleLowerCase()\n\n return (\n <Box\n as={as ?? 'button'}\n part={[`button-${variantPart}`, part]}\n {...styles[variant]}\n css={{\n ...(props.css ?? {}),\n ...(props.loading ? loadingCSSStyle : {}),\n }}\n {...props}\n loading={undefined}\n >\n {children}\n {title && (\n <Text.Body2\n color=\"inherit\"\n css={{\n WebkitFontSmoothing: 'antialiased',\n MozOsxFontSmoothing: 'grayscale',\n }}\n flexGrow=\"1\"\n fontWeight=\"medium\"\n lineHeight=\"20px\"\n part=\"button-title\"\n textWrap=\"nowrap\"\n >\n {title}\n </Text.Body2>\n )}\n </Box>\n )\n}\n\nexport function Primary({ children, ...props }: ButtonProps) {\n return (\n <BaseButton {...props} variant=\"Primary\">\n {children}\n </BaseButton>\n )\n}\n\nexport function Secondary({ children, ...props }: ButtonProps) {\n return (\n <BaseButton {...props} variant=\"Secondary\">\n {children}\n </BaseButton>\n )\n}\n\nexport function Link({ children, ...props }: ButtonProps) {\n return (\n <BaseButton {...props} variant=\"Link\">\n {children}\n </BaseButton>\n )\n}\n\nexport function Plain({ children, ...props }: ButtonProps) {\n return (\n <BaseButton {...props} variant=\"Plain\">\n {children}\n </BaseButton>\n )\n}\n","import * as React from 'react'\n\nimport { Box, type BoxProps } from '@/components/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: 'demibold',\n lineHeight: '2xl',\n}\n\nexport const H2 = {\n ...base,\n fontSize: '2xl',\n fontWeight: 'demibold',\n lineHeight: 'xl',\n}\n\nexport const H3 = {\n ...base,\n fontSize: 'xl',\n fontWeight: 'demibold',\n lineHeight: 'lg',\n}\n\nexport const H4 = {\n ...base,\n fontSize: 'md',\n fontWeight: 'demibold',\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: 'sm',\n}\n\nexport const Caption = {\n ...base,\n fontSize: 'xs',\n fontWeight: 'regular',\n lineHeight: 'xs',\n}\n","import { keyframes } from '@emotion/react'\n\nconst base = {\n alignItems: 'center',\n borderWidth: 'md',\n borderRadius: 'md',\n borderStyle: 'solid',\n 'cursor:disabled': 'not-allowed',\n display: 'flex',\n gap: '2',\n padding: '2 4',\n fontFamily: 'inherit',\n\n 'opacity:disabled': '0.6',\n 'pointerEvents:disabled': 'none',\n}\n\nexport const Primary = {\n ...base,\n backgroundColor: 'primary.surface',\n borderColor: 'primary.border',\n color: 'primary.foreground',\n\n 'backgroundColor:hover': 'primary.hover.surface',\n 'backgroundColor:active': 'primary.active.surface',\n 'backgroundColor:disabled': 'primary.surface',\n}\n\nexport const Secondary = {\n ...base,\n\n backgroundColor: 'secondary.background',\n borderColor: 'secondary.border',\n color: 'secondary.foreground',\n\n 'backgroundColor:hover': 'secondary.hover.background',\n 'backgroundColor:active': 'secondary.active.surface',\n 'backgroundColor:disabled': 'secondary.background',\n}\n\nexport const Link = {\n ...base,\n\n backgroundColor: 'transparent',\n borderColor: 'transparent',\n color: 'primary.surface',\n\n 'color:hover': 'primary.hover.surface',\n 'color:active': 'primary.active.surface',\n}\n\nexport const Plain = {\n ...base,\n\n backgroundColor: 'transparent',\n borderColor: 'transparent',\n color: 'neutral.foreground',\n}\n\nconst rotate = keyframes({\n from: {\n transform: 'rotate(0turn)',\n },\n to: {\n transform: 'rotate(1turn)',\n },\n})\n\nexport const loadingCSSStyle = {\n position: 'relative',\n color: 'transparent',\n '&:after': {\n content: '\"\"',\n position: 'absolute',\n width: '16px',\n height: '16px',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n margin: 'auto',\n border: '4px solid transparent',\n borderTopColor: 'var(--fr-colors-primary-foreground)',\n borderRadius: '50%',\n animation: rotate + ' 1s ease infinite',\n },\n}\n","import type { ForwardRefExoticComponent, RefAttributes } from 'react'\nimport * as React from 'react'\nimport type { JSX } from '@emotion/react/jsx-runtime'\n\nimport type { BoxProps } from '@/components/Box'\nimport { Button, type ButtonProps } from '@/components/Button'\nimport { Flex } from '@/components/Flex'\nimport { type FlowPropsWithoutChildren } from '@/components/Flow'\nimport { FlowCard } from './FlowCard'\nimport { Media, type MediaProps } from '@/components/Media'\nimport { Text, type TextProps } from '@/components/Text'\n\nimport type { DismissHandler } from '@/hooks/useFlowHandlers'\nimport { XMarkIcon } from '@/components/Icon/XMarkIcon'\n\nexport interface CardHeaderProps extends BoxProps {\n dismissible?: boolean\n handleDismiss?: DismissHandler\n subtitle?: string\n title?: string\n}\n\nexport interface CardComponent\n extends ForwardRefExoticComponent<\n Omit<FlowPropsWithoutChildren, 'ref'> & RefAttributes<unknown>\n > {\n Dismiss: (props: ButtonProps) => JSX.Element\n Header: (props: CardHeaderProps) => JSX.Element\n Footer: (props: BoxProps) => JSX.Element\n Media: (props: MediaProps) => JSX.Element\n Primary: (props: ButtonProps) => JSX.Element\n Secondary: (props: ButtonProps) => JSX.Element\n Subtitle: (props: TextProps) => JSX.Element\n Title: (props: TextProps) => JSX.Element\n}\n\nexport interface CardProps extends FlowPropsWithoutChildren {\n children: React.ReactNode\n}\n\nexport const Card = React.forwardRef(({ children, flowId, part, ...props }: CardProps, ref) => {\n // If props.flowId is set, render FlowCard instead\n if (flowId != null) {\n return <FlowCard flowId={flowId} {...props} />\n }\n\n const Component = props.as ?? Flex.Column\n return (\n <Component\n backgroundColor=\"neutral.background\"\n borderColor=\"neutral.border\"\n borderStyle=\"solid\"\n borderRadius=\"md\"\n borderWidth=\"0\"\n gap={5}\n p={5}\n part={['card', part]}\n {...props}\n ref={ref}\n >\n {children}\n </Component>\n )\n}) as CardComponent\n\nCard.Dismiss = (props: ButtonProps) => {\n return (\n <Button.Plain aria-label=\"Dismiss\" part=\"dismiss\" padding={0} {...props}>\n <XMarkIcon height=\"20\" fill=\"currentColor\" />\n </Button.Plain>\n )\n}\n\nCard.Footer = ({ children, part, ...props }: BoxProps) => {\n return (\n <Flex.Row\n alignItems=\"center\"\n gap={3}\n justifyContent=\"flex-end\"\n part={['card-footer', part]}\n {...props}\n >\n {children}\n </Flex.Row>\n )\n}\n\nCard.Header = ({ dismissible, handleDismiss, part, subtitle, title, ...props }) => {\n if (\n !dismissible &&\n (title == null || title?.length === 0) &&\n (subtitle == null || subtitle?.length === 0)\n ) {\n return null\n }\n\n return (\n <Flex.Row\n alignItems=\"flex-start\"\n flexWrap=\"wrap\"\n gap={1}\n part={['card-header', part]}\n {...props}\n >\n <Card.Title maxWidth=\"calc(100% - 32px)\">{title}</Card.Title>\n {dismissible && <Card.Dismiss onClick={handleDismiss} marginLeft=\"auto\" />}\n <Card.Subtitle color=\"neutral.400\" flexBasis=\"100%\">\n {subtitle}\n </Card.Subtitle>\n </Flex.Row>\n )\n}\n\nCard.Media = ({ src, ...props }: MediaProps) => {\n if (src == null || src?.length === 0) return null\n\n return <Media borderRadius=\"md\" src={src} {...props} />\n}\n\nCard.Primary = ({ onClick, title, ...props }: ButtonProps) => {\n if (title == null || title?.length === 0) return null\n\n return <Button.Primary title={title} onClick={onClick} {...props} />\n}\n\nCard.Secondary = ({ onClick, title, ...props }: ButtonProps) => {\n if (title == null || title?.length === 0) return null\n\n return <Button.Secondary title={title} onClick={onClick} {...props} />\n}\n\nCard.Subtitle = ({ children, part, ...props }: TextProps) => {\n if (children == null) return null\n\n return (\n <Text.Body2 display=\"block\" color=\"neutral.400\" part={['subtitle', part]} {...props}>\n {children}\n </Text.Body2>\n )\n}\n\nCard.Title = ({ children, part, ...props }: TextProps) => {\n if (children == null) return null\n\n return (\n <Text.H4 display=\"block\" part={['title', part]} {...props}>\n {children}\n </Text.H4>\n )\n}\n","import * as React from 'react'\nimport { Box, BoxProps } from '@/components/Box'\n\nexport const Row = React.forwardRef((props: BoxProps, ref) => (\n <Box display=\"flex\" flexDirection=\"row\" {...props} ref={ref} />\n))\n\nexport const Column = React.forwardRef((props: BoxProps, ref) => (\n <Box display=\"flex\" flexDirection=\"column\" {...props} ref={ref} />\n))\n","import { Fragment } from 'react'\nimport { FlowType } from '@frigade/js'\n\nimport { Box } from '@/components/Box'\n\nimport { useFlow } from '@/hooks/useFlow'\nimport { useFlowHandlers } from '@/hooks/useFlowHandlers'\nimport { useStepHandlers } from '@/hooks/useStepHandlers'\nimport { useCheckForModalCollision } from '@/hooks/useModal'\n\nimport type { FlowProps } from '@/components/Flow/FlowProps'\nimport { getVideoProps } from '@/components/Media/videoProps'\n// import { FrigadeContext } from '@/components/Provider'\n\nexport type {\n FlowChildrenProps,\n FlowProps,\n FlowPropsWithoutChildren,\n} from '@/components/Flow/FlowProps'\n\nfunction isDialog(component) {\n return typeof component === 'function' && component.displayName === 'Dialog'\n}\n\nexport function Flow({\n as,\n autoStart = true,\n children,\n flowId,\n onComplete,\n onDismiss,\n onPrimary,\n onSecondary,\n variables,\n ...props\n}: FlowProps) {\n // const [hasProcessedRules, setHasProcessedRules] = useState(false)\n\n const { flow } = useFlow(flowId, {\n variables,\n })\n\n const step = flow?.getCurrentStep()\n\n const initialStepProps = step?.props ?? {}\n\n // Discard video props when merging step props onto top-level container\n const { otherProps: stepProps } = getVideoProps(initialStepProps)\n\n const {\n dismissible = isDialog(as) ? true : false,\n forceMount = false,\n ...mergedProps\n } = {\n ...props,\n ...(flow?.props ?? {}),\n ...(flow?.rawData?.flowType === FlowType.CHECKLIST ? {} : stepProps),\n }\n\n // const { hasInitialized, registerComponent, unregisterComponent } = useContext(FrigadeContext)\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 isModal =\n mergedProps?.modal ||\n isDialog(as) ||\n [FlowType.ANNOUNCEMENT, FlowType.TOUR].includes(flow?.rawData?.flowType)\n\n const { hasModalCollision } = useCheckForModalCollision(flow, isModal)\n\n function handleEscapeKeyDown(e) {\n if (dismissible === false) {\n e.preventDefault()\n return\n }\n\n if (typeof props.onEscapeKeyDown === 'function') {\n props.onEscapeKeyDown(e)\n }\n\n if (!e.defaultPrevented) {\n handleDismiss(e)\n }\n }\n\n // useEffect(() => {\n // return () => {\n // unregisterComponent(flowId)\n // }\n // }, [])\n\n // useEffect(() => {\n // if (flow?.isCompleted || flow?.isSkipped) {\n // unregisterComponent(flowId)\n // }\n // }, [flow?.isCompleted, flow?.isSkipped])\n\n const shouldForceMount = forceMount && (flow?.isCompleted || flow?.isSkipped)\n\n if (!flow) {\n return null\n }\n\n // registerComponent(flowId, () => {\n // if (!hasProcessedRules) {\n // setHasProcessedRules(true)\n // }\n // })\n\n if ((!flow.isVisible || hasModalCollision) && !shouldForceMount) {\n return null\n }\n\n // if (!hasInitialized || !hasProcessedRules) {\n // return null\n // }\n\n if (shouldForceMount || (!flow.isCompleted && !flow.isSkipped && autoStart)) {\n step?.start()\n }\n\n const ContainerElement = as === null ? Fragment : as ?? Box\n\n const containerProps: Record<string, unknown> = {\n ...mergedProps,\n 'data-flow-id': flow.id,\n }\n\n if (isDialog(as)) {\n containerProps.onEscapeKeyDown = handleEscapeKeyDown\n }\n\n return (\n <ContainerElement {...(as === null ? {} : containerProps)}>\n {children({\n flow,\n handleDismiss,\n handlePrimary,\n handleSecondary,\n parentProps: {\n as,\n dismissible,\n flowId,\n variables,\n containerProps,\n },\n step,\n })}\n </ContainerElement>\n )\n}\n","import { FlowChangeEvent, type Flow } from '@frigade/js'\nimport { useCallback, useContext, useEffect, useState } from 'react'\n\nimport { FrigadeContext } from '@/components/Provider'\nimport { useSyncExternalStore } from '@/hooks/useSyncExternalStore'\nimport { logOnce } from '@/shared/log'\n\nexport interface FlowConfig {\n variables?: Record<string, unknown>\n}\n\nexport function useFlow(\n flowId: string | null,\n config?: FlowConfig\n): {\n flow: Flow | undefined\n isLoading: boolean\n} {\n const context = useContext(FrigadeContext)\n if (!context || !context.frigade) {\n logOnce(`useFlow('${flowId}') must be used in a child of the Frigade Provider`, 'warn')\n }\n const { frigade, variables } = context ?? {}\n const [, setForceRender] = useState<boolean>(false)\n\n const subscribe = useCallback(\n (cb: () => void) => {\n // TODO: Why is there a noticeable delay when this is commented out?\n frigade?.getFlow(flowId).then(() => {\n cb()\n })\n\n const handler = (_event: FlowChangeEvent, updatedFlow: Flow) => {\n if (updatedFlow.id !== flowId) {\n return\n }\n\n /*\n * NOTE: Since React doesn't re-render on deep object diffs,\n * we need to gently prod it here by creating a state update.\n */\n setTimeout(() => {\n setForceRender((forceRender) => !forceRender)\n\n cb()\n }, 0)\n }\n\n frigade?.on('flow.any', handler)\n\n return () => {\n frigade?.off('flow.any', handler)\n }\n },\n [flowId, frigade]\n )\n\n const flow = useSyncExternalStore<Flow | undefined>(\n subscribe,\n () => frigade?.getFlowSync(flowId),\n () => frigade?.getFlowSync(flowId)\n )\n\n useEffect(() => {\n flow?.applyVariables({\n ...variables,\n ...config?.variables,\n })\n }, [config?.variables, flow, flowId, variables])\n\n return {\n flow,\n isLoading: frigade?.hasFailedToLoad() ? false : !flow,\n }\n}\n","import {\n CollectionsRegistryBatch,\n type CollectionsRegistryCallback,\n type Flow,\n Frigade,\n FrigadeConfig,\n PropertyPayload,\n StatefulFlow,\n} from '@frigade/js'\nimport { useEffect, useMemo, useRef, useState } from 'react'\nimport { Global, ThemeProvider } from '@emotion/react'\n\nimport { DefaultCollection } from '@/components/Provider/DefaultCollection'\n\nimport {\n createThemeVariables,\n theme as themeTokens,\n type Theme,\n themeVariables,\n} from '@/shared/theme'\n\nimport { FrigadeContext } from './FrigadeContext'\nimport { ImagePreloader } from '@/components/Provider/ImagePreloader'\nimport { SDK_VERSION } from '@/version'\n\nexport type NavigateHandler = (url: string, target?: string) => void\nexport type RegisteredComponents = Map<\n string,\n {\n callback?: CollectionsRegistryCallback\n }\n>\n\n// TODO: type theme something like Partial<typeof themeTokens>, but allow any value for those keys\nexport interface ProviderProps {\n /**\n * Your public API key from the Frigade dashboard. Do not ever use your private API key here.\n */\n apiKey: string\n\n /**\n * The URL prefix of the API to use. By default, Frigade will use the production API: https://api.frigade.com/v1/public\n */\n apiUrl?: string\n\n children?: React.ReactNode\n\n /**\n * Global CSS properties to attach to the :root element.\n * @see https://emotion.sh/docs/css-prop#object-styles\n */\n css?: Record<string, unknown>\n\n /**\n * By default, Frigade.Provider will render a built-in Collection to allow no-code deploys of Announcements and other floating Components. Set this to `false` if you want to manually control the rendering of the default Collection.\n */\n defaultCollection?: boolean\n\n /**\n * Whether to generate a Guest ID and session if no userId is provided at render time.\n * If set to false, Frigade will not initialize or render any Flows until a userId is provided.\n * Defaults to true.\n */\n generateGuestId?: boolean\n\n /**\n * Whether to sync state with Frigade on URL or focus change. Defaults to true.\n */\n syncOnWindowUpdates?: boolean\n\n /**\n * The group ID to use for this context (optional).\n */\n groupId?: string\n\n /**\n * Optional group properties to attach to the groupId on initialization.\n */\n groupProperties?: PropertyPayload\n\n /**\n * A function to handle navigation. By default, Frigade will use `window.open` if not provided.\n * https://docs.frigade.com/v2/sdk/navigation\n */\n navigate?: NavigateHandler\n\n /**\n * The global theme to use across components. See docs on styling: https://docs.frigade.com/v2/sdk/styling/theming\n */\n theme?: Theme\n\n /**\n * CSS selector to scope Frigade CSS variables into. Defaults to `:root`.\n */\n themeSelector?: string\n\n /**\n * The user ID of the user who is interacting with Frigade. If not provided, Frigade will generate a random guest ID and persist it in local storage.\n */\n userId?: string\n\n /**\n * Optional user properties to attach to the userId on initialization.\n */\n userProperties?: PropertyPayload\n\n /**\n * Whether to preload images in Flows. Defaults to true.\n */\n preloadImages?: boolean\n\n /**\n * Global variables to apply to all Flows, including Collections.\n * If the individual Collection or Flow has its own variables, the two objects will be merged, with the Flow/Collection having high priority.\n * Example:\n * ```tsx\n * variables={{\n * name: \"Bobby Nerves\",\n * occupation: \"Vocalist\",\n * }}\n * ```\n * This prop can conveniently be used to pass entire i18n objects as well, which will allow all Flows to access i18n strings as needed.\n */\n variables?: Record<string, unknown>\n\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 State for all flows in the app that should be mocked.\n */\n __flowStateOverrides?: Record<string, StatefulFlow>\n}\n\nexport function Provider({\n children,\n css = {},\n defaultCollection = true,\n navigate,\n theme,\n themeSelector = ':root',\n ...props\n}: ProviderProps) {\n const themeOverrides = theme ? createThemeVariables(theme) : {}\n const registeredComponents = useRef<RegisteredComponents>(new Map())\n const intervalRef = useRef<NodeJS.Timeout>()\n const [hasInitialized, setHasInitialized] = useState(false)\n const [currentModal, setCurrentModal] = useState<string | null>(null)\n\n const frigade = useMemo<Frigade>(() => {\n setHasInitialized(false)\n intervalRef.current = undefined\n\n return new Frigade(props.apiKey, {\n apiKey: props.apiKey,\n apiUrl: props.apiUrl,\n userId: props.userId,\n groupId: props.groupId,\n userProperties: props.userProperties,\n groupProperties: props.groupProperties,\n generateGuestId: props.generateGuestId,\n syncOnWindowUpdates: props.syncOnWindowUpdates,\n __readOnly: props.__readOnly,\n __flowStateOverrides: props.__flowStateOverrides,\n __platformVersion: SDK_VERSION,\n __platformName: 'React',\n } as FrigadeConfig)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [props.userId, props.groupId, props.apiKey])\n\n useEffect(() => {\n if (props.__flowStateOverrides) {\n const config = frigade.getConfig()\n config.__flowStateOverrides = props.__flowStateOverrides\n frigade.reload(config)\n }\n }, [frigade, props.__flowStateOverrides])\n\n function batchRegistration() {\n const batchedFlowIds = [...registeredComponents.current.entries()].map(([flowId, options]) => [\n flowId,\n options.callback,\n ]) as CollectionsRegistryBatch\n\n frigade.batchRegister(batchedFlowIds)\n\n setHasInitialized(true)\n }\n\n function registerComponent(flowId: string, callback?: CollectionsRegistryCallback) {\n if (intervalRef.current) {\n clearTimeout(intervalRef.current)\n }\n\n if (hasInitialized) {\n if (!registeredComponents.current.has(flowId)) {\n frigade.getFlow(flowId).then((flow: Flow) => flow.register(callback))\n\n registeredComponents.current.set(flowId, {\n callback: callback,\n })\n } else {\n // If component is already registered, fire its callback to let the downstream consumer know its current state\n frigade.getFlow(flowId).then((flow: Flow) => callback(flow.isVisible))\n }\n\n return\n }\n\n if (!registeredComponents.current.has(flowId)) {\n registeredComponents.current.set(flowId, {\n callback,\n })\n }\n\n if (intervalRef.current) {\n clearTimeout(intervalRef.current)\n }\n\n intervalRef.current = setTimeout(() => batchRegistration(), 0)\n }\n\n function unregisterComponent(flowId: string) {\n if (registeredComponents.current.has(flowId)) {\n frigade.getFlow(flowId).then((flow: Flow) => {\n registeredComponents.current.delete(flowId)\n flow?.unregister()\n })\n }\n }\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 }, [frigade])\n\n return (\n <FrigadeContext.Provider\n value={{\n currentModal,\n setCurrentModal,\n navigate: navigateHandler,\n ...props,\n frigade: frigade,\n registerComponent,\n unregisterComponent,\n hasInitialized,\n variables: props.variables || {},\n }}\n >\n <Global styles={{ [themeSelector]: { ...themeVariables, ...themeOverrides, ...css } }} />\n <ThemeProvider theme={themeTokens}>\n {defaultCollection && <DefaultCollection />}\n {children}\n </ThemeProvider>\n {props.preloadImages !== false && <ImagePreloader />}\n </FrigadeContext.Provider>\n )\n}\n","import { Card } from '@/components/Card'\nimport { Flex } from '@/components/Flex'\nimport { Flow, type FlowPropsWithoutChildren } from '@/components/Flow'\nimport { Box } from '@/components/Box'\n\nexport interface BannerProps extends FlowPropsWithoutChildren {}\n\nexport function Banner({ flowId, ...props }: BannerProps) {\n return (\n <Flow as={null} flowId={flowId} {...props}>\n {({\n handleDismiss,\n handlePrimary,\n handleSecondary,\n parentProps: { containerProps, dismissible },\n step,\n }) => {\n const primaryButtonTitle = step.primaryButton?.title ?? step.primaryButtonTitle\n const secondaryButtonTitle = step.secondaryButton?.title ?? step.secondaryButtonTitle\n\n const disabled = step.$state.blocked\n\n return (\n <Card\n alignItems=\"center\"\n aria-label=\"Banner\"\n borderWidth=\"md\"\n data-step-id={step.id}\n display=\"flex\"\n flexDirection=\"row\"\n gap={3}\n justifyContent=\"flex-start\"\n part=\"banner\"\n role=\"complementary\"\n {...containerProps}\n >\n {step.imageUri && (\n <Box\n as=\"img\"\n part=\"image\"\n src={step.imageUri}\n style={{ height: 40, width: 40, alignSelf: 'center' }}\n />\n )}\n\n <Flex.Column marginInlineEnd=\"auto\" part=\"banner-title-wrapper\">\n <Card.Title part=\"title\">{step.title}</Card.Title>\n <Card.Subtitle part=\"subtitle\">{step.subtitle}</Card.Subtitle>\n </Flex.Column>\n\n <Card.Secondary\n disabled={disabled}\n title={secondaryButtonTitle}\n onClick={handleSecondary}\n />\n <Card.Primary disabled={disabled} title={primaryButtonTitle} onClick={handlePrimary} />\n {dismissible && <Card.Dismiss onClick={handleDismiss} />}\n </Card>\n )\n }}\n </Flow>\n )\n}\n","export { Carousel } from './Carousel'\nexport { Collapsible, type CollapsibleProps, type CollapsibleStepProps } from './Collapsible'\n// eslint-disable-next-line react-refresh/only-export-components\nexport * as CollapsibleStep from './CollapsibleStep'\nexport { Floating } from './Floating'\n","import { useEffect, useLayoutEffect, useState } from 'react'\nimport { keyframes } from '@emotion/react'\nimport useEmblaCarousel from 'embla-carousel-react'\nimport type { EmblaOptionsType } from 'embla-carousel'\n\nimport { Box } from '@/components/Box'\nimport { Button } from '@/components/Button'\nimport { Flex } from '@/components/Flex'\nimport type { FlowChildrenProps } from '@/components/Flow'\nimport * as Progress from '@/components/Progress'\nimport { Text } from '@/components/Text'\n\nimport { CarouselStep } from '@/components/Checklist/CarouselStep'\n\nimport { theme } from '@/shared/theme'\nimport { CarouselProps } from '@/components/Checklist/Carousel'\nimport { ArrowRightIcon } from '@/components/Icon/ArrowRightIcon'\nimport { ArrowLeftIcon } from '@/components/Icon/ArrowLeftIcon'\n\nconst fadeIn = keyframes`\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n`\n\nexport function CarouselEmblaWrapper({\n flow,\n sort,\n onPrimary,\n onSecondary,\n}: FlowChildrenProps & CarouselProps) {\n const [stepOrder, setStepOrder] = useState<string[]>()\n\n const [emblaOptions] = useState<Partial<EmblaOptionsType>>({\n align: 'start',\n container: '.fr-carousel-content',\n skipSnaps: true,\n slides: '.fr-carousel-step',\n startIndex:\n sort == 'completed-last'\n ? 0\n : Array.from(flow.steps.values()).find(\n (step) => !step.$state.completed && !step.$state.skipped\n )?.order ?? 0,\n })\n\n const [emblaRef, emblaApi] = useEmblaCarousel(emblaOptions)\n\n const [hasNext, setHasNext] = useState<boolean>()\n const [hasPrev, setHasPrev] = useState<boolean>()\n\n useLayoutEffect(() => {\n if (!emblaApi) {\n return\n }\n\n if (hasNext == null) {\n setHasNext(emblaApi.canScrollNext())\n }\n\n if (hasPrev == null) {\n setHasPrev(emblaApi.canScrollPrev())\n }\n\n emblaApi.on('select', () => {\n setHasNext(emblaApi.canScrollNext())\n setHasPrev(emblaApi.canScrollPrev())\n })\n }, [emblaApi, hasNext, hasPrev])\n\n useEffect(() => {\n // check if hasCompletedInitialSort. If not then sort the steps from not completed not skipped to completed/skipped\n if (!stepOrder) {\n const steps = Array.from(flow.steps.values())\n const completedOrSkippedSteps = steps\n .filter((step) => step.$state.completed || step.$state.skipped)\n .sort((a, b) => a.order - b.order)\n\n const nonCompletedOrSkippedSteps = steps\n .filter((step) => !step.$state.completed && !step.$state.skipped)\n .sort((a, b) => a.order - b.order)\n\n if (sort === 'completed-last') {\n setStepOrder(\n [...nonCompletedOrSkippedSteps, ...completedOrSkippedSteps].map((step) => step.id)\n )\n } else {\n setStepOrder(steps.map((step) => step.id))\n }\n }\n }, [flow.steps, sort, stepOrder])\n\n const completedSteps = flow.getNumberOfCompletedSteps()\n const availableSteps = flow.getNumberOfAvailableSteps()\n\n if (!stepOrder) {\n return null\n }\n\n return (\n <>\n <Flex.Row\n css={{\n '@container (max-width: 750px)': {\n flexDirection: 'column',\n gap: theme.space[5],\n },\n }}\n justifyContent=\"space-between\"\n part=\"carousel-header\"\n >\n <Flex.Column part=\"carousel-header-content\">\n <Text.H3>{flow.title}</Text.H3>\n <Text.Body2 color=\"neutral.400\">{flow.subtitle}</Text.Body2>\n </Flex.Column>\n <Flex.Row alignItems=\"center\" gap={2} part=\"progress\">\n <Text.Body2 fontWeight=\"demibold\" part=\"progress-text\">\n {completedSteps}/{availableSteps}\n </Text.Body2>\n <Progress.Bar current={completedSteps} total={availableSteps} minWidth=\"200px\" />\n </Flex.Row>\n </Flex.Row>\n\n <Box\n margin={`0 ${theme.space[-4]}`}\n overflow=\"hidden\"\n part=\"carousel-wrapper\"\n px=\"4\"\n position=\"relative\"\n ref={emblaRef}\n >\n <Flex.Row gap={4} part=\"carousel-content\">\n {Array.from(flow.steps.values())\n .filter((step) => step.$state.visible)\n .sort((a, b) => stepOrder.indexOf(a.id) - stepOrder.indexOf(b.id))\n .map((step) => (\n <CarouselStep\n key={step.id}\n onPrimary={onPrimary}\n onSecondary={onSecondary}\n step={step}\n />\n ))}\n </Flex.Row>\n\n {hasPrev && (\n <Flex.Column\n animation={`${fadeIn} 300ms ease-out`}\n background=\"linear-gradient(to right, rgba(255, 255, 255, 0.5), transparent 50%)\"\n bottom=\"0\"\n left=\"0\"\n justifyContent=\"center\"\n paddingLeft=\"3\"\n part=\"carousel-prev-wrapper\"\n position=\"absolute\"\n top=\"0\"\n >\n <Button.Plain\n border=\"1px solid neutral.border\"\n borderRadius=\"100%\"\n boxShadow=\"md\"\n backgroundColor=\"neutral.background\"\n color=\"primary.surface\"\n onClick={() => emblaApi.scrollPrev()}\n padding=\"2\"\n >\n <ArrowLeftIcon height=\"24px\" width=\"24px\" />\n </Button.Plain>\n </Flex.Column>\n )}\n\n {hasNext && (\n <Flex.Column\n animation={`${fadeIn} 300ms ease-out`}\n background=\"linear-gradient(to left, rgba(255, 255, 255, 0.5), transparent 50%)\"\n bottom=\"0\"\n justifyContent=\"center\"\n paddingRight=\"3\"\n part=\"carousel-next-wrapper\"\n position=\"absolute\"\n right=\"0\"\n top=\"0\"\n >\n <Button.Plain\n border=\"1px solid neutral.border\"\n borderRadius=\"100%\"\n boxShadow=\"md\"\n backgroundColor=\"neutral.background\"\n color=\"primary.surface\"\n onClick={() => emblaApi.scrollNext()}\n padding=\"2\"\n >\n <ArrowRightIcon height=\"24px\" width=\"24px\" />\n </Button.Plain>\n </Flex.Column>\n )}\n </Box>\n </>\n )\n}\n","export { Bar } from './Bar'\nexport { Dots } from './Dots'\nexport { Fraction } from './Fraction'\nexport { Ring } from './Ring'\nexport { Segments } from './Segments'\nexport type { ProgressProps } from './ProgressProps'\n","import { Box } from '@/components/Box'\n\nimport type { ProgressProps } from './ProgressProps'\n\nexport function Bar({ current, total, ...props }: ProgressProps) {\n const progressPercent = total > 0 ? Math.min(current / total, 1) : 0\n\n const barWidth = progressPercent === 0 ? '10px' : `${100 * progressPercent}%`\n\n return (\n <Box\n aria-description=\"Progress represented as a bar\"\n aria-label=\"Progress Bar\"\n aria-valuemin=\"0\"\n aria-valuemax={total}\n aria-valuenow={current}\n backgroundColor=\"neutral.800\"\n borderRadius=\"md\"\n height=\"10px\"\n part=\"progress-bar\"\n role=\"meter\"\n {...props}\n >\n <Box\n backgroundColor=\"primary.surface\"\n part=\"progress-bar-fill\"\n borderRadius=\"md\"\n height=\"100%\"\n style={{\n width: barWidth,\n }}\n transition=\"width 300ms ease-out\"\n />\n </Box>\n )\n}\n","import { Box } from '@/components/Box'\n\nimport { theme } from '@/shared/theme'\n\nimport type { ProgressProps } from './ProgressProps'\n\nexport function Dots({ current, total, ...props }: ProgressProps) {\n if (total == 1) {\n return null\n }\n\n const dots = [...Array(total)].map((_, i) => {\n return (\n <Box\n as=\"circle\"\n cx={4 + 16 * i}\n cy=\"4px\"\n fill={current - 1 === i ? theme.colors.blue500 : theme.colors.blue800}\n key={i}\n part={['progress-dot', current - 1 === i ? 'progress-dot-filled' : null]}\n r={4}\n />\n )\n })\n\n return (\n <Box\n aria-description=\"Progress represented as dots\"\n aria-label=\"Progress Dots\"\n aria-valuemin=\"0\"\n aria-valuemax={total}\n aria-valuenow={current}\n as=\"svg\"\n height=\"8px\"\n part=\"progress-dots\"\n role=\"meter\"\n viewBox={`0 0 ${16 * total - 8} 8`}\n width={16 * total - 8}\n {...props}\n >\n {dots}\n </Box>\n )\n}\n","import { Text } from '@/components/Text'\n\nimport type { ProgressProps } from './ProgressProps'\n\nexport function Fraction({ current, total, ...props }: ProgressProps) {\n return (\n <Text.Body2\n aria-description=\"Progress represented as a fraction of a total\"\n aria-label=\"Progress Fraction\"\n aria-valuemin=\"0\"\n aria-valuemax={total}\n aria-valuenow={current}\n part=\"progress-fraction\"\n role=\"meter\"\n {...props}\n >\n {`${current}/${total}`}\n </Text.Body2>\n )\n}\n","import { Box } from '@/components/Box'\nimport { Text } from '@/components/Text'\n\nimport { theme } from '@/shared/theme'\n\nimport type { ProgressProps } from './ProgressProps'\n\nexport function Ring({\n css,\n current,\n height = '48px',\n showLabel = false,\n strokeWidth = '8px',\n total,\n width = '48px',\n ...props\n}: ProgressProps) {\n if (total == 1) {\n return null\n }\n\n const progressPercent = total > 0 ? Math.min(Math.round((current / total) * 100) / 100, 1) : 0\n\n // TODO: Configurable size\n return (\n <Box\n aria-description=\"Progress represented as a ring\"\n aria-label=\"Progress Ring\"\n aria-valuemin=\"0\"\n aria-valuemax={total}\n aria-valuenow={current}\n as=\"svg\"\n css={{\n '--progress-percent': progressPercent,\n '--radius': `calc((min(${height}, ${width}) - ${strokeWidth}) / 2)`,\n '--circumference': `calc(var(--radius) * pi * 2)`,\n '--dash-length': 'calc(var(--circumference) * var(--progress-percent))',\n '--gap-length': 'calc(var(--circumference) - var(--dash-length))',\n ...css,\n }}\n height={height}\n part=\"progress-ring\"\n position=\"relative\"\n role=\"meter\"\n width={width}\n {...props}\n >\n <Box\n as=\"circle\"\n cx=\"50%\"\n cy=\"50%\"\n fill=\"transparent\"\n part=\"progress-ring-track\"\n r=\"var(--radius)\"\n stroke={theme.colors.primary['800']}\n strokeWidth={strokeWidth}\n />\n <Box\n as=\"circle\"\n cx=\"50%\"\n cy=\"50%\"\n fill=\"transparent\"\n part=\"progress-ring-filled\"\n r=\"var(--radius)\"\n stroke={theme.colors.primary.surface}\n strokeWidth={strokeWidth}\n style={{\n strokeDasharray: `var(--dash-length) var(--gap-length)`,\n }}\n transform=\"rotate(-90deg)\"\n transformOrigin=\"50% 50%\"\n transition=\"stroke-dasharray 0.2s ease-out\"\n />\n {showLabel && (\n <Text.Caption\n as=\"text\"\n dominantBaseline=\"middle\"\n fontWeight=\"medium\"\n textAnchor=\"middle\"\n _x=\"50%\"\n _y=\"52%\"\n >\n {progressPercent * 100}\n </Text.Caption>\n )}\n </Box>\n )\n}\n","import { Box } from '@/components/Box'\nimport { Flex } from '@/components/Flex'\n\nimport type { ProgressProps } from './ProgressProps'\n\nexport function Segments({ current, total, ...props }: ProgressProps) {\n const segments = [...Array(total)].map((_, i) => (\n <Box\n backgroundColor={current - 1 >= i ? 'primary.surface' : 'blue800'}\n borderRadius=\"md\"\n flexGrow={1}\n height=\"100%\"\n key={i}\n minWidth=\"10px\"\n part={['progress-segment', current - 1 === i ? 'progress-segment-filled' : null]}\n />\n ))\n\n return (\n <Flex.Row\n aria-description=\"Progress represented as a segmented bar\"\n aria-label=\"Progress Segments\"\n aria-valuemin=\"0\"\n aria-valuemax={total}\n aria-valuenow={current}\n gap={1}\n height=\"10px\"\n part=\"progress-segments\"\n role=\"meter\"\n {...props}\n >\n {segments}\n </Flex.Row>\n )\n}\n","export function LockClosedIcon(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 16 16\"\n fill=\"currentColor\"\n className=\"size-4\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n d=\"M8 1a3.5 3.5 0 0 0-3.5 3.5V7A1.5 1.5 0 0 0 3 8.5v5A1.5 1.5 0 0 0 4.5 15h7a1.5 1.5 0 0 0 1.5-1.5v-5A1.5 1.5 0 0 0 11.5 7V4.5A3.5 3.5 0 0 0 8 1Zm2 6V4.5a2 2 0 1 0-4 0V7h4Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n )\n}\n","import { Box, type BoxProps } from '@/components/Box'\n\nfunction CheckIcon() {\n return (\n <Box\n as=\"svg\"\n color=\"primary.foreground\"\n fill=\"none\"\n height=\"8px\"\n part=\"check-icon\"\n viewBox=\"0 0 10 8\"\n width=\"10px\"\n >\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}\n\ninterface CheckIndicatorProps extends BoxProps {\n checked?: boolean\n size?: string\n}\n\nexport function CheckIndicator({ checked = false, size = '22px', ...props }: CheckIndicatorProps) {\n return (\n <Box\n backgroundColor=\"inherit\"\n borderWidth=\"md\"\n borderStyle=\"solid\"\n borderColor=\"neutral.border\"\n borderRadius=\"100%\"\n padding=\"0\"\n part=\"check-indicator\"\n position=\"relative\"\n height={size}\n width={size}\n {...props}\n >\n {checked && (\n <Box\n alignItems=\"center\"\n bg=\"green500\"\n borderWidth=\"md\"\n borderStyle=\"solid\"\n borderColor=\"green500\"\n borderRadius=\"100%\"\n display=\"flex\"\n height=\"calc(100% + 2px)\"\n justifyContent=\"center\"\n left=\"-1px\"\n part=\"check-indicator-checked\"\n position=\"absolute\"\n top=\"-1px\"\n width=\"calc(100% + 2px)\"\n >\n <CheckIcon />\n </Box>\n )}\n </Box>\n )\n}\n","import { type SyntheticEvent, useCallback, useContext, useMemo } from 'react'\n\nimport type { FlowStep, PropertyPayload } from '@frigade/js'\n\nimport { FrigadeContext } from '@/components/Provider'\n\n// TODO: Fix order of args\nexport type StepHandlerProp = (\n step: FlowStep,\n event?: SyntheticEvent<object, unknown>,\n properties?: PropertyPayload\n) => Promise<boolean | void> | (boolean | void)\n\nexport interface StepHandlerProps {\n onPrimary?: StepHandlerProp\n onSecondary?: StepHandlerProp\n}\n\nexport type StepHandler = (\n /**\n * The native event that triggered this handler.\n */\n event: SyntheticEvent<object, unknown>,\n /**\n * Additional properties to pass to the step.\n */\n properties?: PropertyPayload,\n /**\n * If true, the step will be marked as completed without waiting for the API and validation of any targeting rules.\n * @default true\n */\n optimistic?: boolean\n) => Promise<boolean>\n\nexport function useStepHandlers(step: FlowStep, { onPrimary, onSecondary }: StepHandlerProps = {}) {\n const { navigate } = useContext(FrigadeContext)\n\n const stepActions = useMemo(\n () =>\n step == null\n ? {}\n : {\n 'flow.back': (properties?: PropertyPayload) => step.flow.back(properties),\n 'flow.complete': (properties?: PropertyPayload) => step.flow.complete(properties),\n 'flow.forward': (properties?: PropertyPayload) => step.flow.forward(properties),\n 'flow.restart': () => step.flow.restart(),\n 'flow.skip': (properties?: PropertyPayload) => step.flow.skip(properties),\n 'flow.start': (properties?: PropertyPayload) => step.flow.start(properties),\n 'step.complete': (properties?: PropertyPayload, optimistic?: boolean) =>\n step.complete(properties, optimistic),\n 'step.skip': (properties?: PropertyPayload, optimistic?: boolean) =>\n step.skip(properties, optimistic),\n 'step.reset': () => step.reset(),\n 'step.start': (properties?: PropertyPayload) => step.start(properties),\n },\n [step]\n )\n\n return {\n handlePrimary: useCallback<StepHandler>(\n async (e, properties, optimistic = true) => {\n const continueDefault = await onPrimary?.(step, e, properties)\n if (continueDefault === false) {\n e.preventDefault()\n return false\n }\n\n if (step.primaryButton != null) {\n const primaryAction =\n step.primaryButton.action === false ? false : stepActions[step.primaryButton.action]\n\n if (typeof primaryAction === 'function') {\n await primaryAction(properties, optimistic)\n } else if (primaryAction !== false) {\n await step.complete(properties, optimistic)\n }\n\n if (step.primaryButton.uri != null) {\n navigate(step.primaryButton.uri, step.primaryButton.target)\n }\n } else {\n await step.complete(properties, optimistic)\n\n if (step.primaryButtonUri != null) {\n navigate(step.primaryButtonUri, step.primaryButtonUriTarget)\n }\n }\n\n return true\n },\n [navigate, onPrimary, step, stepActions]\n ),\n\n handleSecondary: useCallback<StepHandler>(\n async (e, properties) => {\n const continueDefault = await onSecondary?.(step, e, properties)\n\n if (continueDefault === false) {\n e.preventDefault()\n return false\n }\n\n if (step.secondaryButton != null) {\n const secondaryAction =\n step.secondaryButton.action === false ? false : stepActions[step.secondaryButton.action]\n\n if (typeof secondaryAction === 'function') {\n secondaryAction()\n } else if (secondaryAction !== false) {\n step.complete(properties)\n }\n\n if (step.secondaryButton.uri != null) {\n navigate(step.secondaryButton.uri, step.secondaryButton.target)\n }\n } else {\n // Should there be a step.skip method?\n step.complete(properties)\n\n if (step.secondaryButtonUri != null) {\n navigate(step.secondaryButtonUri, step.secondaryButtonUriTarget)\n }\n }\n\n return true\n },\n [navigate, onSecondary, step, stepActions]\n ),\n }\n}\n","import type { FlowStep } from '@frigade/js'\nimport { LockClosedIcon } from '@/components/Icon/LockClosedIcon'\n\nimport { Box } from '@/components/Box'\nimport { CheckIndicator } from '@/components/CheckIndicator'\nimport { Flex } from '@/components/Flex'\nimport { Card } from '@/components/Card'\n\nimport { type StepHandlerProp, useStepHandlers } from '@/hooks/useStepHandlers'\n\ninterface CarouselStepProps {\n onPrimary: StepHandlerProp\n onSecondary: StepHandlerProp\n step: FlowStep\n}\n\nexport function CarouselStep({ onPrimary, onSecondary, step }: CarouselStepProps) {\n const { handlePrimary, handleSecondary } = useStepHandlers(step, { onPrimary, onSecondary })\n\n const { blocked, completed, skipped } = step.$state\n\n const topRightIcon =\n // TODO: Consider adding a specific UI state for Skipped\n completed || skipped || !blocked ? (\n <CheckIndicator checked={completed || skipped} marginLeft=\"auto\" />\n ) : (\n <Box as={LockClosedIcon} height=\"22px\" marginLeft=\"auto\" width=\"22px\" />\n )\n\n return (\n <Card\n borderWidth={1}\n containerType=\"inline-size\"\n css={{\n '@container (max-width: 600px)': {\n flexBasis: '85%',\n },\n '@container (min-width: 601px) and (max-width: 900px)': {\n flexBasis: '45%',\n },\n '@container (min-width: 1200px)': {\n flexBasis: '25%',\n },\n }}\n data-step-id={step.id}\n flex=\"0 0 30%\"\n gap=\"2\"\n p=\"4\"\n part=\"carousel-step\"\n userSelect=\"none\"\n disabled={blocked}\n opacity={blocked ? 0.5 : 1}\n >\n <Flex.Row marginBottom=\"2\" part=\"carousel-step-header\">\n {step.iconUri && (\n <Card.Media borderRadius=\"0\" height=\"24px\" src={step.iconUri} width=\"24px\" />\n )}\n {topRightIcon}\n </Flex.Row>\n <Card.Title>{step.title}</Card.Title>\n <Card.Subtitle>{step.subtitle}</Card.Subtitle>\n\n <Flex.Row\n css={{\n '@container (max-width: 200px)': {\n '& > button': {\n flexBasis: '50%',\n flexGrow: 1,\n },\n\n flexDirection: 'column-reverse',\n },\n }}\n gap=\"2\"\n marginTop=\"auto\"\n paddingTop=\"3\"\n part=\"carousel-step-footer\"\n >\n <Card.Secondary\n disabled={blocked}\n onClick={handleSecondary}\n title={step.secondaryButton?.title}\n />\n <Card.Primary\n disabled={blocked}\n onClick={handlePrimary}\n title={step.primaryButton?.title}\n />\n </Flex.Row>\n </Card>\n )\n}\n","export function ArrowRightIcon(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className=\"size-5\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n d=\"M3 10a.75.75 0 0 1 .75-.75h10.638L10.23 5.29a.75.75 0 1 1 1.04-1.08l5.5 5.25a.75.75 0 0 1 0 1.08l-5.5 5.25a.75.75 0 1 1-1.04-1.08l4.158-3.96H3.75A.75.75 0 0 1 3 10Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n )\n}\n","export function ArrowLeftIcon(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className=\"size-5\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n d=\"M17 10a.75.75 0 0 1-.75.75H5.612l4.158 3.96a.75.75 0 1 1-1.04 1.08l-5.5-5.25a.75.75 0 0 1 0-1.08l5.5-5.25a.75.75 0 1 1 1.04 1.08L5.612 9.25H16.25A.75.75 0 0 1 17 10Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n )\n}\n","import { Card } from '@/components/Card'\nimport { Flow, FlowChildrenProps, type FlowPropsWithoutChildren } from '@/components/Flow'\n\nimport { CarouselEmblaWrapper } from '@/components/Checklist/CarouselEmblaWrapper'\n\nexport interface CarouselProps extends FlowPropsWithoutChildren {\n /**\n * @ignore\n */\n children?: React.ReactNode\n /**\n * How to sort the default the completed steps of the carousel.\n * - `completed-last` will sort the completed/skips steps to the end of the carousel.\n * - `default` will keep the order of the steps as they are in the flow.\n */\n sort?: 'completed-last' | 'default'\n}\n\nexport function Carousel({ ...props }: CarouselProps) {\n return (\n <Flow as={Card} borderWidth={1} containerType=\"inline-size\" p=\"4\" part=\"carousel\" {...props}>\n {(flowChildrenProps: FlowChildrenProps) => (\n <CarouselEmblaWrapper {...props} {...flowChildrenProps} />\n )}\n </Flow>\n )\n}\n","import type { JSX } from '@emotion/react/jsx-runtime'\nimport { createContext, type Dispatch, type SetStateAction, useContext, useState } from 'react'\n\nimport { Card } from '@/components/Card'\nimport * as CollapsibleStep from '@/components/Checklist/CollapsibleStep'\nimport { Flex } from '@/components/Flex'\nimport { Flow, type FlowChildrenProps, type FlowPropsWithoutChildren } from '@/components/Flow'\nimport * as Progress from '@/components/Progress'\nimport { Text } from '@/components/Text'\n\nimport { type StepHandlerProp, useStepHandlers } from '@/hooks/useStepHandlers'\n\nimport { getVideoProps } from '@/components/Media/videoProps'\n\nexport interface CollapsibleStepProps extends FlowChildrenProps {\n onOpenChange: (isOpening: boolean) => void\n open: boolean\n}\n\nexport type StepTypes = Record<string, (props: CollapsibleStepProps) => JSX.Element>\n\nexport interface CollapsibleContextType {\n onPrimary: StepHandlerProp\n onSecondary: StepHandlerProp\n openStepId: string | null\n setOpenStepId: Dispatch<SetStateAction<string>>\n stepTypes: StepTypes\n}\n\nconst CollapsibleContext = createContext<CollapsibleContextType>({\n onPrimary: () => {},\n onSecondary: () => {},\n openStepId: null,\n setOpenStepId: () => {},\n stepTypes: {},\n})\n\nexport interface CollapsibleProps extends FlowPropsWithoutChildren {\n /**\n * Map of step types to their respective components.\n * Use this to build custom step components. The `type` defined on the step in the Flow YAML config should match the key in this object.\n * For instance, if you have a step with `type: 'custom'`, you should provide a component for it like so:\n * ```\n * <Checklist.Collapsible stepTypes={{ custom: CustomStepComponent }} />\n * ```\n * The corresponding YAML config would look like:\n * ```\n * steps:\n * - id: custom-step\n * type: custom\n * ```\n */\n stepTypes?: StepTypes\n}\n\nfunction DefaultCollapsibleStep({\n handlePrimary,\n handleSecondary,\n open,\n onOpenChange,\n step,\n}: CollapsibleStepProps) {\n const {\n $state: { blocked, completed, skipped },\n subtitle,\n title,\n } = step\n\n const primaryButtonTitle = step.primaryButton?.title ?? step.primaryButtonTitle\n const secondaryButtonTitle = step.secondaryButton?.title ?? step.secondaryButtonTitle\n\n const stepProps = step.props ?? {}\n\n const disabled = blocked ? true : false\n\n const { videoProps } = getVideoProps(stepProps)\n\n return (\n <CollapsibleStep.Root\n data-step-id={step.id}\n open={open}\n onOpenChange={onOpenChange}\n {...stepProps}\n >\n <CollapsibleStep.Trigger\n isBlocked={step.$state.blocked}\n isCompleted={completed || skipped}\n title={title}\n />\n\n <CollapsibleStep.Content>\n <Card.Media\n aspectRatio={2.5}\n objectFit=\"cover\"\n overflowClipMargin=\"unset\"\n src={step.videoUri ?? step.imageUri}\n transform=\"translate3d(0, 0, 1px)\"\n type={step.videoUri ? 'video' : 'image'}\n {...videoProps}\n />\n <Card.Subtitle color=\"neutral.400\">{subtitle}</Card.Subtitle>\n <Flex.Row gap={3} part=\"collapsible-footer\">\n <Card.Secondary title={secondaryButtonTitle} onClick={handleSecondary} />\n <Card.Primary disabled={disabled} title={primaryButtonTitle} onClick={handlePrimary} />\n </Flex.Row>\n </CollapsibleStep.Content>\n </CollapsibleStep.Root>\n )\n}\n\nconst defaultStepTypes = {\n default: DefaultCollapsibleStep,\n}\n\nfunction StepWrapper({ flow, step, ...props }: FlowChildrenProps) {\n const { onPrimary, onSecondary, openStepId, setOpenStepId, stepTypes } =\n useContext(CollapsibleContext)\n const { handlePrimary, handleSecondary } = useStepHandlers(step, { onPrimary, onSecondary })\n\n const open = (openStepId ?? flow.getCurrentStep().id) === step.id\n\n const StepComponent = stepTypes[step.type as string] ?? DefaultCollapsibleStep\n\n async function onOpenChange(isOpening: boolean) {\n setOpenStepId(isOpening ? step.id : '')\n\n if (isOpening && !step.$state.completed) {\n await step.start()\n setOpenStepId(null)\n }\n }\n\n // TODO: Allow user override of onOpenChange w/ same behavior as other handlers\n return (\n <StepComponent\n flow={flow}\n key={step.id}\n onOpenChange={onOpenChange}\n open={open}\n step={step}\n {...props}\n handlePrimary={handlePrimary}\n handleSecondary={handleSecondary}\n />\n )\n}\n\nexport function Collapsible({\n flowId,\n onPrimary,\n onSecondary,\n part,\n stepTypes = {},\n ...props\n}: CollapsibleProps) {\n const [openStepId, setOpenStepId] = useState(null)\n\n const mergedStepTypes: StepTypes = {\n ...defaultStepTypes,\n ...stepTypes,\n }\n\n return (\n <CollapsibleContext.Provider\n value={{ openStepId, setOpenStepId, onPrimary, onSecondary, stepTypes: mergedStepTypes }}\n >\n <Flow as={Card} borderWidth=\"md\" flowId={flowId} part={['checklist', part]} {...props}>\n {({ flow, handleDismiss, ...childrenProps }) => {\n const visibleSteps = Array.from(flow.steps.entries()).filter(\n ([, step]) => step.$state.visible === true\n )\n\n const stepList = visibleSteps.map(([, s]) => (\n <StepWrapper\n key={s.id}\n flow={flow}\n handleDismiss={handleDismiss}\n {...childrenProps}\n step={s}\n />\n ))\n\n const currentSteps = flow.getNumberOfCompletedSteps()\n const availableSteps = flow.getNumberOfAvailableSteps()\n\n // Note: Ignore merged props from step here, Checklist steps don't control flow dismissibility\n const dismissible = props.dismissible || !!flow?.props?.dismissible\n\n return (\n <>\n <Flex.Column gap={2} part=\"checklist-header\">\n <Card.Header\n dismissible={dismissible}\n handleDismiss={handleDismiss}\n subtitle={flow.subtitle}\n title={flow.title}\n />\n\n <Flex.Row alignItems=\"center\" gap={2} part=\"checklist-progress\">\n <Text.Body2 fontWeight=\"demibold\" part=\"progress-text\">\n {currentSteps}/{availableSteps}\n </Text.Body2>\n <Progress.Bar current={currentSteps} total={availableSteps} flexGrow={1} />\n </Flex.Row>\n </Flex.Column>\n\n {stepList}\n </>\n )\n }}\n </Flow>\n </CollapsibleContext.Provider>\n )\n}\n","import { keyframes } from '@emotion/react'\nimport { ChevronDownIcon } from '@/components/Icon/ChevronDownIcon'\nimport * as Collapsible from '@radix-ui/react-collapsible'\n\nimport { Box, type BoxProps } from '@/components/Box'\nimport { Card } from '@/components/Card'\nimport { Flex } from '@/components/Flex'\nimport { Text } from '@/components/Text'\n\nconst slideDown = keyframes`\n from {\n height: 0;\n opacity: 0;\n }\n to {\n height: var(--radix-collapsible-content-height);\n opacity: 1;\n }\n`\n\nconst slideUp = keyframes`\n from {\n height: var(--radix-collapsible-content-height);\n opacity: 1;\n }\n to {\n height: 0;\n opacity: 0;\n }\n`\n// TODO: CheckIcon and CheckIndicator are copypasta from RadioField.tsx. Clean this up.\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\nfunction CheckIndicator({ checked = false }) {\n return (\n <Box\n backgroundColor=\"inherit\"\n borderWidth=\"md\"\n borderStyle=\"solid\"\n borderColor=\"neutral.border\"\n borderRadius=\"100%\"\n marginRight=\"2\"\n padding=\"0\"\n part=\"field-radio-value\"\n position=\"relative\"\n height=\"22px\"\n width=\"22px\"\n >\n {checked && (\n <Box\n alignItems=\"center\"\n bg=\"green500\"\n borderWidth=\"md\"\n borderStyle=\"solid\"\n borderColor=\"green500\"\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 )}\n </Box>\n )\n}\n\nexport function Content({ children }) {\n return (\n <Collapsible.Content asChild>\n <Flex.Column\n css={{\n '&[data-state=\"open\"]': {\n animation: `${slideDown} 300ms ease-out`,\n },\n '&[data-state=\"closed\"]': {\n animation: `${slideUp} 300ms ease-out`,\n },\n overflow: 'hidden',\n }}\n gap={5}\n part=\"collapsible-content\"\n >\n {/*\n This humble box is doing yeoman's work, don't remove it.\n It creates a flex gap at the top of this column, which animates smoothly.\n Other forms of whitespace like margin or padding? Not so smooth!\n */}\n <Box part=\"checklist-spacer\" />\n\n {children}\n </Flex.Column>\n </Collapsible.Content>\n )\n}\n\nexport function Root({\n children,\n disabled = false,\n onOpenChange = () => {},\n open = false,\n ...props\n}: Collapsible.CollapsibleProps & BoxProps) {\n return (\n <Collapsible.Root asChild disabled={disabled} open={open} onOpenChange={onOpenChange}>\n <Card\n borderWidth=\"md\"\n css={{\n '&[data-state=\"open\"] .fr-collapsible-step-icon': {\n transform: 'rotate(180deg)',\n },\n }}\n gap={0}\n part=\"collapsible-step\"\n {...props}\n >\n {children}\n </Card>\n </Collapsible.Root>\n )\n}\n\nexport function Trigger({ isCompleted, isBlocked, title }) {\n return (\n <Collapsible.Trigger asChild>\n <Flex.Row\n alignItems=\"center\"\n justifyContent=\"flex-start\"\n margin={-5}\n padding={5}\n zIndex={1}\n opacity={isBlocked ? 0.4 : 1}\n disabled={isBlocked}\n pointerEvents={isBlocked ? 'none' : 'auto'}\n cursor={isBlocked ? 'not-allowed' : 'pointer'}\n part=\"collapsible-header\"\n >\n <CheckIndicator checked={isCompleted} />\n <Text.Body2 fontWeight=\"demibold\" userSelect=\"none\" part=\"collapsible-title\">\n {title}\n </Text.Body2>\n\n <Box\n as={ChevronDownIcon}\n color=\"neutral.100\"\n css={{\n '& path': {\n vectorEffect: 'non-scaling-stroke',\n },\n }}\n display=\"block\"\n height=\"16px\"\n marginLeft=\"auto\"\n order={2}\n part=\"collapsible-step-icon\"\n width=\"16px\"\n />\n </Flex.Row>\n </Collapsible.Trigger>\n )\n}\n","export function ChevronDownIcon(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth={1.5}\n stroke=\"currentColor\"\n className=\"size-6\"\n {...props}\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"m19.5 8.25-7.5 7.5-7.5-7.5\" />\n </svg>\n )\n}\n","export const VIDEO_PROP_NAMES = [\n 'autoPlay',\n 'controls',\n 'controlsList',\n 'crossOrigin',\n 'disablePictureInPicture',\n 'disableRemotePlayback',\n 'loop',\n 'muted',\n 'playsInline',\n 'poster',\n 'preload',\n 'src',\n] as const\n\nexport type VideoPropName = (typeof VIDEO_PROP_NAMES)[number]\n\nexport function getVideoProps(props: Record<string, unknown>) {\n const videoProps = {}\n const otherProps = {}\n\n for (const [propName, propValue] of Object.entries(props)) {\n if (VIDEO_PROP_NAMES.some((name) => name === propName)) {\n videoProps[propName] = propValue\n } else {\n otherProps[propName] = propValue\n }\n }\n\n return {\n otherProps,\n videoProps,\n }\n}\n","import { useRef, useState } from 'react'\nimport { FloatingTree } from '@floating-ui/react'\n\nimport { Card } from '@/components/Card'\nimport { Flex } from '@/components/Flex'\nimport { Flow, type FlowPropsWithoutChildren } from '@/components/Flow'\nimport * as Popover from '@/components/Popover'\nimport * as Progress from '@/components/Progress'\nimport { Text } from '@/components/Text'\n\nimport { FloatingStep } from '@/components/Checklist/FloatingStep'\nimport { floatingTransitionCSS } from '@/components/Checklist/Floating.styles'\n\nexport interface FloatingChecklistProps\n extends Popover.PopoverRootProps,\n FlowPropsWithoutChildren {}\n\n// TODO: Fix props here (split popover and flow props and pass them to Flow / Popover.Root)\nexport function Floating({\n children,\n flowId,\n onPrimary,\n onSecondary,\n part,\n ...props\n}: FloatingChecklistProps) {\n const [openStepId, setOpenStepId] = useState(null)\n const pointerLeaveTimeout = useRef<ReturnType<typeof setTimeout>>()\n\n function handlePointerEnter() {\n clearTimeout(pointerLeaveTimeout.current)\n }\n\n function handlePointerLeave() {\n clearTimeout(pointerLeaveTimeout.current)\n\n if (openStepId != null) {\n pointerLeaveTimeout.current = setTimeout(() => setOpenStepId(null), 300)\n }\n }\n\n function resetOpenStep(isOpen: boolean) {\n if (!isOpen && openStepId != null) {\n setOpenStepId(null)\n }\n }\n\n return (\n <Flow flowId={flowId} part={['floating-checklist', part]} {...props}>\n {({ flow }) => {\n const currentSteps = flow.getNumberOfCompletedSteps()\n const availableSteps = flow.getNumberOfAvailableSteps()\n\n const anchorContent = children ?? (\n <Flex.Row\n alignItems=\"center\"\n backgroundColor=\"neutral.background\"\n border=\"md solid neutral.border\"\n borderRadius=\"md\"\n cursor=\"pointer\"\n gap=\"2\"\n padding=\"1 2\"\n part=\"floating-checklist-anchor\"\n userSelect=\"none\"\n >\n <Text.Body2 fontWeight=\"medium\" part=\"floating-checklist-title\">\n {flow.title}\n </Text.Body2>\n <Progress.Ring\n current={currentSteps}\n height=\"24px\"\n strokeWidth=\"4px\"\n total={availableSteps}\n width=\"24px\"\n />\n </Flex.Row>\n )\n\n return (\n <FloatingTree>\n <Popover.Root align=\"start\" onOpenChange={resetOpenStep} sideOffset={4}>\n <Popover.Trigger display=\"inline-block\">{anchorContent}</Popover.Trigger>\n\n <Popover.Content\n css={{\n ...floatingTransitionCSS,\n '&[data-status=\"initial\"]': {\n opacity: 0.3,\n },\n '& .fr-popover-transition-container': {\n transformOrigin: 'top left',\n transition: 'transform 0.2s ease-out',\n },\n '&[data-placement^=\"top\"] .fr-popover-transition-container': {\n transformOrigin: 'bottom left',\n },\n }}\n >\n <Card\n backgroundColor=\"neutral.background\"\n border=\"md solid neutral.border\"\n borderRadius=\"md\"\n gap=\"0\"\n onPointerEnter={handlePointerEnter}\n onPointerLeave={handlePointerLeave}\n p=\"0 1 1\"\n part=\"floating-checklist-step-list\"\n >\n <Progress.Bar\n borderRadius=\"md md 0 0\"\n clipPath=\"border-box\"\n css={{\n '& .fr-progress-bar-fill': {\n borderRadius: 0,\n },\n }}\n current={currentSteps}\n height=\"5px\"\n total={availableSteps}\n flexGrow={1}\n margin=\"0 -1 2\"\n />\n {Array.from(flow.steps.values()).map((step) => (\n <FloatingStep\n key={step.id}\n onPrimary={onPrimary}\n onSecondary={onSecondary}\n openStepId={openStepId}\n setOpenStepId={setOpenStepId}\n step={step}\n />\n ))}\n </Card>\n </Popover.Content>\n </Popover.Root>\n </FloatingTree>\n )\n }}\n </Flow>\n )\n}\n","export { Root } from './Root'\nexport { Content } from './Content'\nexport { Trigger } from './Trigger'\nexport type { PopoverRootProps } from './Root'\nexport type { PopoverContentProps } from './Content'\nexport type { PopoverTriggerProps } from './Trigger'\n","import { createContext, type Dispatch, type SetStateAction, useState } from 'react'\nimport { useFloatingNodeId } from '@floating-ui/react'\n\nimport { Spotlight } from '@/components/Spotlight'\nimport { Overlay } from '@/components/Overlay'\n\nimport { useAutoScroll } from '@/hooks/useAutoScroll'\nimport { type FloatingProps, type FloatingReturn, useFloating } from '@/hooks/useFloating'\n\nexport interface PopoverContextValue {\n floating?: FloatingReturn\n floatingNodeId: string | null\n isOpen: boolean\n setIsOpen: Dispatch<SetStateAction<boolean>>\n}\n\nexport const PopoverContext = createContext<PopoverContextValue>({\n floatingNodeId: null,\n isOpen: false,\n setIsOpen: () => {},\n})\n\nexport interface PopoverRootProps extends FloatingProps {\n autoScroll?: ScrollIntoViewOptions | boolean\n children?: React.ReactNode\n defaultOpen?: boolean\n modal?: boolean\n spotlight?: boolean\n}\n\nexport function Root({\n align = 'center',\n alignOffset = 0,\n anchor,\n autoScroll = false,\n children,\n defaultOpen = false,\n modal = false,\n onOpenChange = () => {},\n open,\n side = 'bottom',\n sideOffset = 0,\n spotlight = false,\n ...floatingProps\n}: PopoverRootProps) {\n const [internalOpen, setInternalOpen] = useState(defaultOpen)\n\n // Defer to controlled open prop, otherwise manage open state internally\n const canonicalOpen = open ?? internalOpen\n const floatingNodeId = useFloatingNodeId()\n\n const floating = useFloating({\n align,\n alignOffset,\n anchor,\n nodeId: floatingNodeId,\n onOpenChange: (newOpen) => {\n onOpenChange(newOpen)\n if (open == null) {\n setInternalOpen(newOpen)\n }\n },\n open: canonicalOpen,\n side,\n sideOffset,\n ...floatingProps,\n })\n\n const { refs } = floating\n\n useAutoScroll(refs.reference.current as Element, autoScroll)\n\n return (\n <PopoverContext.Provider\n value={{\n floating,\n floatingNodeId,\n isOpen: canonicalOpen,\n setIsOpen: setInternalOpen,\n }}\n >\n {spotlight && canonicalOpen && <Spotlight anchor={anchor} />}\n {modal && !spotlight && canonicalOpen && <Overlay lockScroll />}\n {children}\n </PopoverContext.Provider>\n )\n}\n","import { useEffect, useState } from 'react'\nimport { autoUpdate, type Placement, type ReferenceElement, useFloating } from '@floating-ui/react'\n\nimport { Overlay, type OverlayProps } from '@/components/Overlay'\n\nexport interface ClipPathCoords {\n maxX: number\n maxY: number\n radius: number\n x1: number\n x2: number\n y1: number\n y2: number\n}\n\nfunction getClipPath({ maxX, maxY, radius, x1, x2, y1, y2 }: ClipPathCoords) {\n if (radius > 0) {\n const instructions = [\n `M${x1 + radius},${y1}`,\n `H${x2 - radius}`,\n `A${radius} ${radius} 0,0,1 ${x2} ${y1 + radius}`,\n `V${y2 - radius}`,\n `A${radius} ${radius} 0,0,1 ${x2 - radius} ${y2}`,\n `H${x1 + radius}`,\n `A${radius} ${radius} 0,0,1 ${x1} ${y2 - radius}`,\n `V${maxY}`,\n `H${maxX}`,\n `V0`,\n `H0`,\n `V${maxY}`,\n `H${x1}`,\n `V${y1 + radius}`,\n `A${radius} ${radius} 0,0,1 ${x1 + radius} ${y1}`,\n `Z`,\n ]\n\n return `path(\"${instructions.join(' ')}\")`\n }\n\n return `path(\"M${x1},${y1} H${x2} V${y2} H${x1} V${maxY} H${maxX} V0 H0 V${maxY} H${x1} Z\")`\n}\n\nfunction getComputedRadius(element: ReferenceElement) {\n // Short circuit if we're not in a browser or if element is a VirtualElement\n if (!window || !('nodeType' in element)) {\n return 0\n }\n\n // NOTE: We currently only support single pixel lengths for radius\n // TODO: Allow complex radius syntax like 5px 5px 5px 5px, 5px / 10px, etc.\n const computedRadius = Number(window.getComputedStyle(element).borderRadius.replace(/\\D/g, ''))\n\n return !Number.isNaN(computedRadius) ? computedRadius : 0\n}\n\nexport interface SpotlightProps extends OverlayProps {\n anchor: string\n lockScroll?: boolean\n}\n\nexport function Spotlight({\n anchor,\n lockScroll = true,\n part,\n style = {},\n ...props\n}: SpotlightProps) {\n const [clipPathCoords, setClipPathCoords] = useState<ClipPathCoords>({\n maxX: 0,\n maxY: 0,\n radius: 0,\n x1: 0,\n x2: 0,\n y1: 0,\n y2: 0,\n })\n\n const { refs } = useFloating({\n middleware: [\n {\n name: 'clipPath',\n fn({ elements, rects }) {\n setClipPathCoords({\n maxX: elements.floating.clientWidth,\n maxY: elements.floating.clientHeight,\n radius: getComputedRadius(elements.reference),\n x1: rects.reference.x,\n x2: rects.reference.x + rects.reference.width,\n y1: rects.reference.y,\n y2: rects.reference.y + rects.reference.height,\n })\n\n return {}\n },\n },\n ],\n open: true,\n placement: 'top-center' as Placement,\n transform: false,\n whileElementsMounted: autoUpdate,\n })\n\n useEffect(() => {\n try {\n const anchorQuery = document.querySelector(anchor)\n\n if (anchorQuery != null) {\n refs.setReference(anchorQuery)\n } else {\n console.debug(`[frigade] Spotlight: No anchor found for selector: ${anchor}`)\n }\n } catch (invalidSelector) {\n /* no-op */\n }\n }, [anchor, refs])\n\n return (\n <Overlay\n lockScroll={lockScroll}\n part={['spotlight', part]}\n ref={refs.setFloating}\n style={{\n clipPath: getClipPath(clipPathCoords),\n ...style,\n }}\n {...props}\n />\n )\n}\n","import * as React from 'react'\nimport { keyframes } from '@emotion/react'\n\nimport { Box, type BoxProps } from '@/components/Box'\n\nimport { RemoveScroll } from 'react-remove-scroll'\nimport { useEffect, useState } from 'react'\n\nexport interface OverlayProps extends BoxProps {\n lockScroll?: boolean\n}\n\nfunction OverlayWithRef(\n { children, lockScroll = true, part, opacity = 0.5, ...props }: OverlayProps,\n ref: React.ForwardedRef<HTMLDivElement>\n) {\n const fadeIn = keyframes`\n from {\n opacity: 0;\n }\n to {\n opacity: ${opacity}\n }\n `\n\n const [hasScrolled, setHasScrolled] = useState(false)\n\n useEffect(() => {\n if (!lockScroll) {\n const handleScroll = () => {\n if (!hasScrolled) {\n setHasScrolled(true)\n window.removeEventListener('scroll', handleScroll)\n }\n }\n\n window.addEventListener('scroll', handleScroll)\n\n return () => {\n window.removeEventListener('scroll', handleScroll)\n }\n }\n }, [lockScroll, hasScrolled])\n\n if (!lockScroll && hasScrolled) {\n return <>{children}</>\n }\n\n return (\n <RemoveScroll forwardProps ref={ref} enabled={lockScroll}>\n <Box\n animation={`${fadeIn} 300ms ease-out`}\n backgroundColor=\"black\"\n inset=\"0\"\n opacity=\"0.5\"\n part={['overlay', part]}\n position=\"fixed\"\n {...props}\n >\n {children}\n </Box>\n </RemoveScroll>\n )\n}\n\nexport const Overlay = React.forwardRef(OverlayWithRef)\n","import { useEffect, useState } from 'react'\n\nexport function useAutoScroll(\n element: Element | null | undefined,\n enabled: boolean | ScrollIntoViewOptions = true\n) {\n const [scrollComplete, setScrollComplete] = useState(false)\n\n useEffect(() => {\n if (!scrollComplete && enabled && element instanceof Element) {\n const scrollOptions: ScrollIntoViewOptions =\n typeof enabled !== 'boolean' ? enabled : { behavior: 'smooth', block: 'center' }\n\n /*\n * NOTE: \"scrollend\" event isn't supported widely enough yet :(\n *\n * We'll listen to a capture-phase \"scroll\" instead, and when it stops\n * bouncing, we can infer that the scroll we initiated is over.\n */\n let scrollTimeout: ReturnType<typeof setTimeout>\n window.addEventListener(\n 'scroll',\n function scrollHandler() {\n clearTimeout(scrollTimeout)\n scrollTimeout = setTimeout(() => {\n window.removeEventListener('scroll', scrollHandler)\n setScrollComplete(true)\n }, 100)\n },\n true\n )\n\n element.scrollIntoView(scrollOptions)\n } else if (!enabled) {\n setScrollComplete(true)\n }\n }, [enabled, element, scrollComplete])\n}\n","import { useEffect } from 'react'\n\nimport {\n autoUpdate,\n flip,\n offset,\n type Placement,\n shift,\n useClick,\n useDismiss,\n useFloating as useFloatingUI,\n type UseFloatingOptions,\n type UseFloatingReturn,\n useFocus,\n useInteractions,\n type UseInteractionsReturn,\n useRole,\n useTransitionStatus,\n} from '@floating-ui/react'\n\nimport { useMutationAwareAnchor } from '@/components/Hint/useMutationAwareAnchor'\n\nexport type AlignValue = 'after' | 'before' | 'center' | 'end' | 'start'\nexport type SideValue = 'bottom' | 'left' | 'right' | 'top'\nexport type ExtendedPlacement = `${SideValue}-${AlignValue}`\n\nexport interface FloatingProps extends UseFloatingOptions {\n align?: AlignValue\n alignOffset?: number\n anchor?: string\n side?: SideValue\n sideOffset?: number\n}\n\nexport interface FloatingReturn extends Omit<UseFloatingReturn, 'placement'> {\n placement: ExtendedPlacement\n getFloatingProps: UseInteractionsReturn['getFloatingProps']\n getReferenceProps: UseInteractionsReturn['getReferenceProps']\n status: ReturnType<typeof useTransitionStatus>\n}\n\nfunction getOriginalAlign(align: AlignValue) {\n switch (align) {\n case 'after':\n return 'end'\n break\n case 'before':\n return 'start'\n break\n default:\n return align\n }\n}\n\nexport function useFloating({\n align,\n alignOffset,\n anchor,\n nodeId,\n onOpenChange = () => {},\n open,\n side,\n sideOffset,\n}: FloatingProps): FloatingReturn {\n const placement = `${side}-${getOriginalAlign(align)}` as Placement\n\n // Handle our added \"after\" and \"before\" alignments\n function offsetMiddleware({ rects }) {\n const offsets = {\n alignmentAxis: alignOffset,\n mainAxis: sideOffset,\n }\n\n if (['after', 'before'].includes(align)) {\n if (['bottom', 'top'].includes(side)) {\n // Offset horizontally\n offsets.alignmentAxis = alignOffset - rects.floating.width\n } else {\n // Offset vertically\n offsets.alignmentAxis = alignOffset - rects.floating.height\n }\n }\n\n return offsets\n }\n\n const {\n context,\n floatingStyles,\n placement: computedPlacement,\n refs,\n ...floatingReturn\n } = useFloatingUI({\n middleware: [offset(offsetMiddleware, [align, alignOffset, side, sideOffset]), flip(), shift()],\n nodeId,\n onOpenChange,\n open,\n placement,\n whileElementsMounted: autoUpdate,\n })\n\n const clickHandler = useClick(context)\n const dismissHandler = useDismiss(context, {\n outsidePress: false,\n })\n const focusProps = useFocus(context)\n const roleProps = useRole(context)\n const status = useTransitionStatus(context)\n\n const { getFloatingProps, getReferenceProps } = useInteractions([\n clickHandler,\n dismissHandler,\n focusProps,\n roleProps,\n ])\n\n /*\n * Note: If anchor is passed in as a selector, we'll automatically pass it\n * through to refs.setReference If not, we assume that the floating reference\n * element is being set manually elsewhere (e.g. Popover.Trigger)\n */\n const { anchorElement } = useMutationAwareAnchor(anchor)\n\n useEffect(() => {\n if (anchorElement != null) {\n refs.setReference(anchorElement)\n }\n }, [anchor, anchorElement, refs])\n\n // The flip() middleware might reverse the align prop\n const finalPlacement = computedPlacement.split('-')\n\n // Check and flip after/before alignment\n if (align === 'before') {\n finalPlacement[1] = finalPlacement[1] === 'end' ? 'after' : 'before'\n } else if (align === 'after') {\n finalPlacement[1] = finalPlacement[1] === 'start' ? 'before' : 'after'\n }\n\n return {\n context,\n getFloatingProps,\n getReferenceProps,\n floatingStyles,\n placement: finalPlacement.join('-') as ExtendedPlacement,\n refs,\n status,\n ...floatingReturn,\n }\n}\n","import { useEffect, useState } from 'react'\n\nfunction checkElementForAnchor(element: Element, anchor: string) {\n try {\n if (element.matches(anchor) && isVisible(element)) {\n return element\n }\n\n const anchorSelector = element.querySelectorAll(anchor)\n\n if (anchorSelector.length > 0 && isVisible(anchorSelector[0])) {\n return anchorSelector[0]\n }\n } catch (invalidSelector) {\n return null\n }\n}\n\nfunction isVisible(element: Element) {\n if (!(element instanceof HTMLElement)) {\n return false\n }\n\n return !!(element.offsetWidth || element.offsetHeight || element.getClientRects().length)\n}\n\nexport function useMutationAwareAnchor(anchor: string) {\n const [anchorElement, setAnchorElement] = useState(null)\n\n useEffect(() => {\n if (typeof anchor !== 'string') {\n return\n }\n\n try {\n const element = document.querySelector(anchor)\n\n if (element != null) {\n console.debug(`[frigade] Found anchor: ${anchor}`)\n setAnchorElement(element)\n } else {\n console.debug(`[frigade] No anchor found for selector: ${anchor}`)\n }\n } catch (invalidSelector) {\n console.debug(`[frigade] Invalid selector for anchor: ${anchor}`)\n }\n }, [anchor])\n\n useEffect(() => {\n if (typeof anchor !== 'string') {\n return\n }\n\n const observer = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (mutation.type !== 'childList') {\n continue\n }\n\n for (const node of mutation.addedNodes) {\n if (node.nodeType !== Node.ELEMENT_NODE) {\n continue\n }\n\n const maybeAnchor = checkElementForAnchor(node as Element, anchor)\n\n if (maybeAnchor != null) {\n console.debug(`[frigade] Found anchor: ${anchor}`)\n setAnchorElement(maybeAnchor)\n break\n }\n }\n\n for (const node of mutation.removedNodes) {\n if (node.nodeType !== Node.ELEMENT_NODE) {\n continue\n }\n\n const maybeAnchor = checkElementForAnchor(node as Element, anchor)\n\n if (maybeAnchor != null) {\n console.debug(`[frigade] Removed anchor: ${anchor}`)\n setAnchorElement(null)\n break\n }\n }\n }\n })\n\n observer.observe(document.querySelector('body'), { childList: true, subtree: true })\n\n return () => observer.disconnect()\n }, [anchor])\n\n return {\n anchorElement,\n }\n}\n","import { useContext } from 'react'\nimport { FloatingNode } from '@floating-ui/react'\nimport { Box, type BoxProps } from '@/components/Box'\nimport { PopoverContext } from './Root'\nimport { useVisibility } from '@/hooks/useVisibility'\n\nexport interface PopoverContentProps extends BoxProps {}\n\nexport function Content({ children, css, part, style, ...props }: BoxProps) {\n const { floating, floatingNodeId } = useContext(PopoverContext)\n\n const { isVisible: isAnchorVisible } = useVisibility(\n floating?.refs.reference.current as Element | null\n )\n\n if (floating == null) {\n return null\n }\n\n const { floatingStyles, getFloatingProps, placement, refs, status } = floating\n\n if (refs.reference.current == null || !isAnchorVisible || status?.isMounted === false) {\n return null\n }\n\n return (\n <FloatingNode id={floatingNodeId}>\n <Box\n autoFocus\n css={{\n '&[data-status=\"unmounted\"]': {\n display: 'none',\n },\n ...css,\n }}\n data-placement={placement}\n data-status={status.status}\n part={['popover-content', part]}\n ref={refs.setFloating}\n style={{\n ...floatingStyles,\n ...style,\n }}\n {...getFloatingProps()}\n {...props}\n >\n <Box part=\"popover-transition-container\">{children}</Box>\n </Box>\n </FloatingNode>\n )\n}\n","import { ClientRectObject } from '@floating-ui/react'\nimport { useEffect, useState } from 'react'\n\nimport { EmptyDOMRect } from '@/hooks/useBoundingClientRect'\n\nexport function useVisibility(element: Element | null) {\n const [isIntersecting, setIsIntersecting] = useState(false)\n const [clientRect, setClientRect] = useState<ClientRectObject>(EmptyDOMRect)\n\n const hasDimensions = clientRect.height > 0 && clientRect.width > 0\n\n useEffect(() => {\n if (element == null) {\n return\n }\n\n const observer = new IntersectionObserver(\n (entries) => {\n const el = entries[0]\n\n setClientRect(el.boundingClientRect)\n setIsIntersecting(el.isIntersecting)\n },\n { root: null }\n )\n\n observer.observe(element)\n\n return () => {\n observer.disconnect()\n }\n }, [element])\n\n return {\n isVisible: isIntersecting && hasDimensions,\n }\n}\n","import { useCallback, useLayoutEffect, useState } from 'react'\n\nexport const EmptyDOMRect = {\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\nexport function useBoundingClientRect() {\n const initialRect = 'DOMRect' in globalThis ? new DOMRect() : EmptyDOMRect\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 { useContext } from 'react'\nimport { Box, type BoxProps } from '@/components/Box'\nimport { PopoverContext } from './Root'\n\nexport interface PopoverTriggerProps extends BoxProps {}\n\nexport function Trigger({ children, part, ...props }: BoxProps) {\n const {\n floating: { getReferenceProps, refs },\n setIsOpen,\n } = useContext(PopoverContext)\n\n return (\n <Box\n ref={refs?.setReference}\n onClick={() => setIsOpen((prev) => !prev)}\n part={['popover-trigger', part]}\n {...props}\n {...(getReferenceProps?.() ?? {})}\n >\n {children}\n </Box>\n )\n}\n","import { useRef } from 'react'\nimport * as Popover from '@/components/Popover'\n\nimport { Card } from '@/components/Card'\nimport { CheckIndicator } from '@/components/CheckIndicator'\nimport { Flex } from '@/components/Flex'\nimport { getVideoProps } from '@/components/Media/videoProps'\nimport { Text } from '@/components/Text'\n\nimport { useStepHandlers } from '@/hooks/useStepHandlers'\n\nimport { floatingTransitionCSS } from '@/components/Checklist/Floating.styles'\n\nexport function FloatingStep({ onPrimary, onSecondary, openStepId, setOpenStepId, step }) {\n const anchorPointerEnterTimeout = useRef<ReturnType<typeof setTimeout>>()\n const { handlePrimary, handleSecondary } = useStepHandlers(step, { onPrimary, onSecondary })\n\n const isStepOpen = openStepId === step.id\n\n async function wrappedHandlePrimary(...args: Parameters<typeof handlePrimary>) {\n const primaryReturnValue = await handlePrimary(...args)\n\n if (primaryReturnValue) {\n setOpenStepId(null)\n }\n }\n\n async function wrappedHandleSecondary(...args: Parameters<typeof handleSecondary>) {\n const secondaryReturnValue = await handleSecondary(...args)\n\n if (secondaryReturnValue) {\n setOpenStepId(null)\n }\n }\n\n function handlePointerEnter() {\n clearTimeout(anchorPointerEnterTimeout.current)\n\n if (!isStepOpen) {\n anchorPointerEnterTimeout.current = setTimeout(() => setOpenStepId(step.id), 300)\n }\n }\n\n function handlePointerLeave() {\n clearTimeout(anchorPointerEnterTimeout.current)\n }\n\n const primaryButtonTitle = step.primaryButton?.title ?? step.primaryButtonTitle\n const secondaryButtonTitle = step.secondaryButton?.title ?? step.secondaryButtonTitle\n\n const { videoProps } = getVideoProps(step.props ?? {})\n\n return (\n <Popover.Root align=\"start\" open={isStepOpen} side=\"right\" sideOffset={8}>\n <Popover.Trigger\n as={Flex.Row}\n alignItems=\"center\"\n borderRadius=\"md\"\n gap=\"2\"\n justifyContent=\"space-between\"\n onPointerEnter={handlePointerEnter}\n onPointerLeave={handlePointerLeave}\n padding=\"1 2\"\n part=\"floating-checklist-step-list-item\"\n style={{\n backgroundColor: isStepOpen ? 'var(--fr-colors-neutral-800)' : 'transparent',\n }}\n userSelect=\"none\"\n >\n <Text.Body2 part=\"floating-checklist-step-title\">{step.title}</Text.Body2>\n <CheckIndicator checked={step.$state.completed || step.$state.skipped} size=\"18px\" />\n </Popover.Trigger>\n <Popover.Content css={floatingTransitionCSS} part=\"floating-step\">\n <Card\n backgroundColor=\"neutral.background\"\n border=\"md solid neutral.border\"\n borderRadius=\"md\"\n gap=\"3\"\n minWidth=\"400px\"\n p=\"2\"\n >\n <Card.Media\n src={step.videoUri ?? step.imageUri}\n type={step.videoUri ? 'video' : 'image'}\n css={{ objectFit: 'contain', width: '100%' }}\n {...videoProps}\n />\n <Card.Header dismissible={false} padding=\"0 1\" subtitle={step.subtitle} />\n\n <Flex.Row gap={3} justifyContent=\"flex-end\" part=\"card-footer\">\n <Card.Secondary\n disabled={step.$state.blocked}\n onClick={wrappedHandleSecondary}\n padding=\"1 2\"\n title={secondaryButtonTitle}\n />\n <Card.Primary\n disabled={step.$state.blocked}\n onClick={wrappedHandlePrimary}\n padding=\"1 2\"\n title={primaryButtonTitle}\n />\n </Flex.Row>\n </Card>\n </Popover.Content>\n </Popover.Root>\n )\n}\n","export const floatingTransitionCSS = {\n '&[data-status=\"open\"]': {\n opacity: 1,\n zIndex: 1,\n },\n '&[data-status=\"close\"]': {\n opacity: 0,\n zIndex: 0,\n\n '& [data-status=\"close\"]': {\n display: 'none',\n },\n },\n '&[data-status=\"initial\"]': {\n opacity: 0.8,\n },\n '&[data-status=\"open\"], &[data-status=\"close\"]': {\n transition: 'transform 0.2s ease-out, opacity 0.2s ease-out',\n },\n '&[data-status=\"initial\"] .fr-popover-transition-container': {\n transform: 'scale(0.8)',\n },\n '&[data-status=\"close\"] .fr-popover-transition-container': {\n transform: 'scale(0.3)',\n },\n '&[data-status=\"open\"] .fr-popover-transition-container': {\n transform: 'scale(1)',\n },\n '& .fr-popover-transition-container': {\n transformOrigin: 'left',\n transition: 'transform 0.2s ease-out',\n },\n}\n","import { SyntheticEvent, useContext, useEffect, useMemo, useState } from 'react'\nimport { FormProvider, useController, useForm, useFormContext } from 'react-hook-form'\n\nimport { Button } from '@/components/Button'\nimport { Card } from '@/components/Card'\nimport { Flex } from '@/components/Flex'\n\nimport { type FlowChildrenProps } from '@/components/Flow'\nimport type { FieldTypes, FormFieldData, ValidationRules } from '@/components/Form'\nimport { PropertyPayload } from '@frigade/js'\nimport { FrigadeContext } from '@/components/Provider'\n\nexport interface FormStepProps extends FlowChildrenProps {\n fieldTypes?: FieldTypes\n}\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, submit }) {\n const formContext = useFormContext()\n\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 (\n <FieldComponent\n {...controller}\n fieldData={fieldData}\n formContext={formContext}\n submit={submit}\n />\n )\n}\n\nexport function FormStep({\n fieldTypes,\n handleDismiss,\n handlePrimary,\n handleSecondary,\n parentProps: { dismissible },\n step,\n}: FormStepProps) {\n const { __readOnly } = useContext(FrigadeContext)\n\n const fieldDatas = useMemo(\n () =>\n // @ts-expect-error TODO: Add type to step.fields\n (step.fields?.filter(\n (field: FormFieldData) => fieldTypes[field.type] != null && field.id\n ) as FormFieldData[]) ?? [],\n [step.fields, fieldTypes]\n )\n\n const formContext = useForm({\n delayError: 2000,\n mode: 'onChange',\n\n defaultValues: fieldDatas.reduce((acc, field) => {\n acc[field.id] = field.value ?? ''\n return acc\n }, {}),\n })\n\n useEffect(() => {\n // if the form is updated reset it if not dirty\n if (!formContext.formState.isDirty) {\n formContext.reset(\n fieldDatas.reduce((acc, field) => {\n acc[field.id] = field.value ?? ''\n return acc\n }, {})\n )\n }\n }, [fieldDatas, formContext])\n\n useEffect(() => {\n if (\n Object.keys(formContext.formState.dirtyFields).some((field) =>\n fieldDatas.some((data) => data.id === field)\n )\n ) {\n formContext.trigger()\n }\n }, [fieldDatas, formContext, step.id])\n\n const [isSubmitting, setIsSubmitting] = useState(false)\n\n const fields = []\n\n const { control, handleSubmit } = formContext\n\n function onPrimarySubmit(properties: PropertyPayload, e: SyntheticEvent<object, unknown>) {\n setIsSubmitting(true)\n handlePrimary(e, properties, __readOnly === true).then(() => setIsSubmitting(false))\n }\n\n fieldDatas.forEach((fieldData: FormFieldData) => {\n if (fieldTypes[fieldData.type] != null) {\n fields.push(\n <FieldWrapper\n key={`${step.flow.id}-${fieldData.id}`}\n control={control}\n fieldComponent={fieldTypes[fieldData.type]}\n fieldData={fieldData}\n submit={handleSubmit(onPrimarySubmit)}\n />\n )\n }\n })\n\n const primaryButtonTitle = step.primaryButton?.title ?? step.primaryButtonTitle\n const secondaryButtonTitle = step.secondaryButton?.title ?? step.secondaryButtonTitle\n\n const disabled = step.$state.blocked || !formContext.formState.isValid ? true : false\n\n useEffect(() => {\n formContext.clearErrors()\n }, [formContext, step])\n\n return (\n <>\n <Card.Header\n dismissible={dismissible}\n handleDismiss={handleDismiss}\n part=\"form-step-header\"\n subtitle={step.subtitle}\n title={step.title}\n />\n\n <FormProvider {...formContext}>{fields}</FormProvider>\n\n <Flex.Row\n key={`form-footer-${step.id}`}\n part=\"form-step-footer\"\n justifyContent=\"flex-end\"\n gap={3}\n >\n {secondaryButtonTitle && (\n <Button.Secondary onClick={handleSecondary} title={secondaryButtonTitle} />\n )}\n <Button.Primary\n disabled={disabled || isSubmitting}\n onClick={handleSubmit(onPrimarySubmit)}\n title={primaryButtonTitle ?? 'Submit'}\n loading={isSubmitting}\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'\nimport { CheckIcon } from '@/components/Icon/CheckIcon'\nimport * as baseStyles from '@/components/Form/fields/BaseField.styles'\n\nexport interface SelectItemProps {\n label: string\n value: string\n}\n\nconst RadioItem = React.forwardRef<HTMLButtonElement, SelectItemProps>(\n ({ label, value }, forwardedRef) => (\n <Box\n as=\"label\"\n backgroundColor=\"neutral.background\"\n borderColor=\"neutral.border\"\n borderRadius=\"md\"\n borderStyle=\"solid\"\n borderWidth=\"md\"\n display=\"flex\"\n htmlFor={value}\n justifyContent=\"space-between\"\n part=\"field-radio\"\n px={4}\n py={2}\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=\"inherit\"\n borderWidth=\"md\"\n borderStyle=\"solid\"\n borderColor=\"neutral.border\"\n borderRadius=\"100%\"\n flex=\"0 0 auto\"\n padding=\"0\"\n part=\"field-radio-value\"\n position=\"relative\"\n height=\"24px\"\n width=\"24px\"\n >\n <Box as={RadioGroup.Indicator} {...baseStyles.checkContainer}>\n <CheckIcon height=\"14\" width=\"14\" />\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\" mt=\"1\" textAlign=\"end\">\n {error?.message}\n </Text.Caption>\n )\n}\n","import { Text } from '@/components/Text'\nimport React from 'react'\nimport { Box } from '@/components/Box'\n\nexport function Label({ children, id, required = false }) {\n return (\n <Text.Body2\n as=\"label\"\n htmlFor={id}\n part=\"field-label\"\n fontWeight=\"medium\"\n mb=\"2\"\n display=\"block\"\n >\n {children}\n <Box part=\"field-label-required\" display=\"inline\">\n {required && '*'}\n </Box>\n </Text.Body2>\n )\n}\n","export const box = {\n backgroundColor: 'neutral.background',\n borderColor: 'neutral.border',\n borderStyle: 'solid',\n borderWidth: 'md',\n borderRadius: 'md',\n}\n\nexport const input = {\n ...box,\n px: '4',\n py: '2',\n display: 'block',\n outline: 'none',\n width: '100%',\n}\n\nexport const checkContainer = {\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 position: <const>'absolute',\n top: '-1px',\n width: 'calc(100% + 2px)',\n color: 'primary.foreground',\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\nexport interface FieldProps {\n value: string\n onChange: (value: string) => void\n [key: string]: unknown\n}\n\ninterface BaseFieldProps extends FormFieldProps {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO: Tighten up fieldProps type\n children: (fieldProps?: FieldProps) => React.ReactNode\n}\n\nexport function BaseField({ children, field, fieldData, fieldState }: BaseFieldProps) {\n const { id, label, placeholder, props } = 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 ...props,\n }\n\n return (\n <Box 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","export function CheckIcon(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className=\"size-5\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n d=\"M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n )\n}\n","import * as React from 'react'\nimport * as Select from '@radix-ui/react-select'\nimport { ChevronDownMiniIcon } from '@/components/Icon/ChevronDownMiniIcon'\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'\nimport { SelectMultipleField } from '@/components/Form/fields/SelectMultipleField'\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=\"neutral.900\"\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 if (props.fieldData.multiple) {\n return <SelectMultipleField {...props} />\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={ChevronDownMiniIcon}\n color=\"neutral.100\"\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 boxShadow=\"md\"\n maxHeight=\"var(--radix-select-content-available-height)\"\n p=\"1\"\n part=\"field-select-options\"\n width=\"var(--radix-popper-anchor-width)\"\n zIndex=\"99999\"\n >\n <Select.Viewport>{selectItems}</Select.Viewport>\n </Box>\n </Select.Content>\n </Select.Portal>\n </Select.Root>\n )}\n </BaseField>\n )\n}\n","export function ChevronDownMiniIcon(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className=\"size-5\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n d=\"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n )\n}\n","import * as React from 'react'\n\nimport { type FormFieldProps } from '..'\nimport { BaseField } from './BaseField'\nimport { Flex } from '@/components/Flex'\nimport * as Checkbox from '@radix-ui/react-checkbox'\nimport { Box } from '@/components/Box'\nimport { CheckIcon } from '@/components/Icon/CheckIcon'\nimport { Text } from '@/components/Text'\nimport * as baseStyles from '@/components/Form/fields/BaseField.styles'\n\nexport function SelectMultipleField(props: FormFieldProps) {\n const {\n field: { onChange },\n fieldData: { options = [] },\n } = props\n\n const [valueArray, setValueArray] = React.useState<string[]>([])\n\n function setValueInArray(value: string) {\n let updatedValueArray = []\n if (valueArray.includes(value)) {\n updatedValueArray = [...valueArray.filter((v) => v !== value)]\n } else {\n updatedValueArray = [...valueArray, value]\n }\n setValueArray(updatedValueArray)\n onChange(updatedValueArray)\n }\n\n return (\n <BaseField {...props}>\n {() => (\n <Flex.Column gap={2} part=\"field-select-multiple\">\n {options.map(({ label, value }) => (\n <Checkbox.Root\n value={valueArray.includes(value) ? value : undefined}\n onCheckedChange={() => setValueInArray(value)}\n key={value}\n asChild\n >\n <Box\n as=\"button\"\n backgroundColor=\"neutral.background\"\n borderColor=\"neutral.border\"\n borderRadius=\"md\"\n borderStyle=\"solid\"\n borderWidth=\"md\"\n display=\"flex\"\n justifyContent=\"space-between\"\n part=\"field-check\"\n px={4}\n py={2}\n >\n <Text.Body2 part=\"field-check-label\">{label}</Text.Body2>\n\n <Box\n backgroundColor=\"inherit\"\n borderWidth=\"md\"\n borderStyle=\"solid\"\n borderColor=\"neutral.border\"\n borderRadius=\"100%\"\n flex=\"0 0 auto\"\n id={value}\n padding=\"0\"\n part=\"field-check-value\"\n position=\"relative\"\n height=\"24px\"\n width=\"24px\"\n >\n <Checkbox.Indicator asChild>\n <Box {...baseStyles.checkContainer}>\n <CheckIcon height=\"14\" width=\"14\" />\n </Box>\n </Checkbox.Indicator>\n </Box>\n </Box>\n </Checkbox.Root>\n ))}\n </Flex.Column>\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 * as React from 'react'\nimport * as Checkbox from '@radix-ui/react-checkbox'\n\nimport { Box } from '@/components/Box'\nimport { Text } from '@/components/Text'\n\nimport { type FormFieldProps } from '..'\nimport { CheckIcon } from '@/components/Icon/CheckIcon'\nimport * as baseStyles from '@/components/Form/fields/BaseField.styles'\n\nexport function CheckboxField(props: FormFieldProps) {\n const {\n field: { onChange, value },\n fieldData: { label, id = [] },\n } = props\n\n return (\n <Box part=\"field\" display=\"flex\" gap={2} alignItems=\"center\">\n <Checkbox.Root\n defaultChecked\n onCheckedChange={onChange}\n value={value}\n checked={value === true}\n asChild\n >\n <Box\n {...baseStyles.box}\n as=\"button\"\n width=\"25px\"\n minWidth=\"25px\"\n height=\"25px\"\n justifyContent=\"center\"\n alignItems=\"center\"\n display=\"flex\"\n // @ts-expect-error :hover type isn't in style props yet\n backgroundColor:hover=\"neutral.900\"\n part=\"field-checkbox\"\n id={id as string}\n >\n <Checkbox.Indicator asChild>\n <Box\n width=\"20px\"\n height=\"20px\"\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n >\n <CheckIcon height=\"14\" fill=\"currentColor\" />\n </Box>\n </Checkbox.Indicator>\n </Box>\n </Checkbox.Root>\n <Text.Body2 part=\"field-checkbox-label\" as=\"label\" htmlFor={id}>\n {label}\n </Text.Body2>\n </Box>\n )\n}\n","import { FlowStep } from '@frigade/js'\nimport type { ControllerFieldState, Message, UseFormReturn, ValidationRule } from 'react-hook-form'\n\nimport { Card } from '@/components/Card'\nimport { Flow, type FlowPropsWithoutChildren } from '@/components/Flow'\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'\nimport { CheckboxField } from '@/components/Form/fields/CheckboxField'\n\nexport type FieldTypes = Record<string, React.ComponentType<FormFieldProps>>\n\nconst defaultFieldTypes: FieldTypes = {\n checkbox: CheckboxField,\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 value?: string\n multiple?: boolean\n props?: Record<string, string | number | boolean | undefined>\n // allow any other custom properties\n [key: string]: unknown\n}\n\n// TODO: Wire UseControllerReturn into this type\nexport interface FormFieldProps {\n /**\n * React Hook Form's controller for the field. Use field.onChange() to update the field value.\n * See https://react-hook-form.com/api/usecontroller for more.\n */\n field: any // eslint-disable-line @typescript-eslint/no-explicit-any\n /**\n * Form-specific data for decorating the field.\n */\n fieldData: FormFieldData\n /**\n * React Hook Form's form context. See https://react-hook-form.com/api/useformcontext for more.\n */\n formContext: UseFormReturn\n /**\n * Function for submitting the current field.\n * @ignore\n */\n fieldState: ControllerFieldState\n /**\n * Function for submitting the current step of the form.\n * @ignore\n */\n submit: () => void\n}\n\nexport interface FormProps extends FlowPropsWithoutChildren {\n /**\n * Custom field types to be used in the Form.\n * You can use this to build your own custom form fields in a `Form`.\n *\n * For example, if you want to use a custom field type called `calendar`:\n *\n * ```tsx\n * import { Form, FormFieldProps } from '@frigade/react'\n *\n * function CalendarField({ field, submit }: FormFieldProps) {\n * return (\n * <div>\n * <input type=\"date\" onChange={field.onChange} value={field.value} />\n * </div>\n * )\n * }\n *\n * // ...\n *\n * <Form flowId=\"my-flow-id\" fieldTypes={{ calendar: CalendarField }} />\n *\n * ```\n *\n */\n fieldTypes?: FieldTypes\n}\n\nexport function Form({ fieldTypes = {}, flowId, part, ...props }: FormProps) {\n const mergedFieldTypes = Object.assign({}, defaultFieldTypes, fieldTypes)\n\n return (\n <Flow as={Card} flowId={flowId} part={['form', part]} {...props}>\n {(childProps) => <FormStep fieldTypes={mergedFieldTypes} {...childProps} />}\n </Flow>\n )\n}\n","// eslint-disable-next-line react-refresh/only-export-components -- NPS is a valid component name\nexport { NPS, type NPSProps } from './NPS'\n","import { Button } from '@/components/Button'\nimport { Flex } from '@/components/Flex'\nimport { FormFieldProps } from '@/components/Form'\nimport { Text } from '@/components/Text'\n\nexport function NPSField({\n field,\n fieldData,\n submit,\n options,\n positiveLabel,\n negativeLabel,\n}: FormFieldProps & {\n options: { label: string; value: string }[]\n positiveLabel?: string\n negativeLabel?: string\n}) {\n const buttons = options.map((option) => {\n const Component = field.value === option.value ? Button.Primary : Button.Secondary\n return (\n <Component\n borderWidth=\"1px\"\n key={option.value}\n onClick={() => {\n field.onChange(option.value)\n submit()\n }}\n title={option.label}\n css={{\n '.fr-button-title': {\n fontSize: '15px',\n },\n }}\n />\n )\n })\n return (\n <Flex.Column gap={2}>\n <Flex.Row\n gap={2}\n part=\"field-nps\"\n css={{\n '@media (min-width: 660px)': {\n flexWrap: 'nowrap',\n justifyContent: 'space-between',\n },\n flexWrap: 'wrap',\n justifyContent: 'center',\n }}\n >\n {buttons}\n </Flex.Row>\n <Flex.Row justifyContent=\"space-between\" part=\"field-nps-label\">\n <Text.Caption part=\"field-nps-left-label\" color=\"neutral.400\">\n {fieldData.negativeLabel ?? negativeLabel}\n </Text.Caption>\n <Text.Caption part=\"field-nps-right-label\" color=\"neutral.400\">\n {fieldData.positiveLabel ?? positiveLabel}\n </Text.Caption>\n </Flex.Row>\n </Flex.Column>\n )\n}\n","import { Dialog } from '@/components/Dialog'\nimport { Form, type FormProps } from '@/components/Form'\n\nimport { NPSField } from './NPSField'\nimport { useFlow } from '@/hooks/useFlow'\n\ntype NPSOptions = { label: string; value: string }[]\n\nexport interface NPSProps extends FormProps {\n /**\n * The options to display in the NPS field.\n * If not provided, the default NPS numbers from 0 to 10 will be used.\n */\n options?: NPSOptions\n\n /**\n * The label to display for the positive end of the NPS scale.\n * If not provided, the default label \"Extremely likely\" will be used.\n */\n positiveLabel?: string\n\n /**\n * The label to display for the negative end of the NPS scale.\n * If not provided, the default label \"Not likely at all\" will be used.\n */\n negativeLabel?: string\n}\n\nexport function NPS({\n as = Dialog,\n flowId,\n fieldTypes,\n part,\n options,\n positiveLabel,\n negativeLabel,\n ...props\n}: NPSProps) {\n const { flow } = useFlow(flowId)\n\n const defaultOptions =\n (flow?.props?.options as NPSOptions) ??\n [...Array(11)].map((_, i) => ({ label: `${i}`, value: `${i}` }))\n const npsOptions = options || defaultOptions\n\n return (\n <Form\n alignSelf=\"end\"\n as={as}\n flowId={flowId}\n fieldTypes={{\n nps: (fieldProps) => (\n <NPSField\n {...fieldProps}\n options={npsOptions}\n positiveLabel={\n (flow?.props?.positiveLabel as string) ?? positiveLabel ?? 'Extremely likely'\n }\n negativeLabel={\n (flow?.props?.negativeLabel as string) ?? negativeLabel ?? 'Not likely at all'\n }\n />\n ),\n ...fieldTypes,\n }}\n modal={false}\n onEscapeKeyDown={(e: KeyboardEvent) => {\n if (typeof props.onEscapeKeyDown === 'function') {\n props.onEscapeKeyDown(e)\n }\n\n if (!e.defaultPrevented) {\n flow.skip()\n }\n }}\n part={['nps', part]}\n {...props}\n css={{\n ...{\n // Hides the submit button on the first page\n ...(!flow || flow.getCurrentStepIndex() == 0\n ? { '.fr-form-step-footer': { display: 'none' } }\n : {\n '.fr-card-header': {\n // Heuristic to prevent width jumpiness between first and second step\n minWidth: npsOptions.length * 51,\n },\n }),\n '.fr-form': {\n padding: '20px',\n '@media (max-width: 660px)': {\n minWidth: '100%',\n },\n },\n '.fr-nps-field': {\n '@media (min-width: 660px)': {\n minWidth: 'fit-content',\n },\n minWidth: '100%',\n },\n '.fr-form-step': {\n gap: '14px',\n '@media (min-width: 660px)': {\n gap: '1',\n },\n },\n '.fr-nps': {\n maxWidth: 'min-content',\n },\n ...((props.css as object) ?? {}),\n },\n }}\n />\n )\n}\n","import { useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nexport function useClientPortal(\n children: React.ReactNode,\n container: Element | DocumentFragment | string,\n key?: null | string\n) {\n const [mounted, setMounted] = useState(false)\n const containerRef = useRef<Element | DocumentFragment>()\n\n useEffect(() => {\n containerRef.current =\n typeof container === 'string' ? document.querySelector(container) : container\n setMounted(true)\n }, [container])\n\n return mounted ? createPortal(children, containerRef.current, key) : null\n}\n","import { useClientPortal } from '@/hooks/useClientPortal'\n\nexport interface ClientPortalProps {\n children?: React.ReactNode\n container?: Parameters<typeof useClientPortal>[1]\n}\n\nexport function ClientPortal({ children, container = 'body' }: ClientPortalProps) {\n return useClientPortal(children, container)\n}\n","import { keyframes } from '@emotion/react'\n\nimport { Card } from '@/components/Card'\nimport type { FlowProps, FlowChildrenProps } from '@/components/Flow'\nimport { Hint, type HintProps } from '@/components/Hint'\nimport * as Progress from '@/components/Progress'\n\nimport { useStepHandlers } from '@/hooks/useStepHandlers'\n\nimport { getVideoProps } from '@/components/Media/videoProps'\n\nconst fadeIn = keyframes`\n from {\n opacity: 0;\n }\n 25% {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n`\n\nexport interface TourStepProps\n extends Omit<HintProps, 'anchor'>,\n Pick<FlowProps, 'dismissible' | 'onPrimary' | 'onSecondary'>,\n Pick<FlowChildrenProps, 'flow' | 'handleDismiss' | 'step'> {}\n\nexport function TourStep({\n align,\n alignOffset,\n autoScroll,\n defaultOpen,\n dismissible,\n flow,\n handleDismiss,\n lockScroll,\n modal,\n onPrimary,\n onSecondary,\n part,\n side,\n sideOffset,\n spotlight,\n step,\n ...props\n}: TourStepProps) {\n const { handlePrimary, handleSecondary } = useStepHandlers(step, {\n onPrimary,\n onSecondary,\n })\n\n const { videoProps, otherProps } = getVideoProps(props)\n\n const primaryButtonTitle = step.primaryButton?.title ?? step.primaryButtonTitle\n const secondaryButtonTitle = step.secondaryButton?.title ?? step.secondaryButtonTitle\n const disabled = !!step.$state.blocked\n\n return (\n <Hint\n align={align}\n alignOffset={alignOffset}\n anchor={step.selector as string}\n autoScroll={autoScroll}\n data-step-id={step.id}\n defaultOpen={defaultOpen}\n lockScroll={lockScroll}\n modal={modal}\n part={part}\n side={side}\n sideOffset={sideOffset}\n spotlight={spotlight}\n onMount={() => {\n if (defaultOpen && !disabled) {\n step?.start()\n }\n }}\n {...otherProps}\n >\n <Card\n animation={`${fadeIn} 300ms ease-out`}\n boxShadow=\"md\"\n maxWidth=\"min(360px, calc(100vw - 25px))\"\n >\n <Card.Media\n aspectRatio=\"2\"\n borderRadius=\"md md 0 0\"\n borderWidth=\"0\"\n margin=\"-5 -5 0\"\n objectFit=\"cover\"\n overflowClipMargin=\"unset\"\n src={step.videoUri ?? step.imageUri}\n transform=\"translate3d(0, 0, 1px)\"\n type={step.videoUri ? 'video' : 'image'}\n {...videoProps}\n />\n\n <Card.Header\n css={{\n '.fr-dismiss': {\n position: 'absolute',\n right: '12px',\n top: '12px',\n },\n }}\n dismissible={dismissible}\n handleDismiss={handleDismiss}\n subtitle={step.subtitle}\n title={step.title}\n />\n <Card.Footer>\n {flow.getNumberOfAvailableSteps() > 1 && (\n <Progress.Fraction\n current={flow.getCurrentStepOrder() + 1}\n marginRight=\"auto\"\n total={flow.getNumberOfAvailableSteps()}\n />\n )}\n <Card.Secondary\n disabled={disabled}\n onClick={handleSecondary}\n title={secondaryButtonTitle}\n />\n <Card.Primary disabled={disabled} onClick={handlePrimary} title={primaryButtonTitle} />\n </Card.Footer>\n </Card>\n </Hint>\n )\n}\n","import { useRef, useState } from 'react'\n\nimport { Box, type BoxProps } from '@/components/Box'\nimport { Overlay } from '@/components/Overlay'\nimport { Ping } from '@/components/Ping'\nimport { Spotlight } from '@/components/Spotlight'\n\nimport { getPingPosition } from '@/components/Hint/getPingPosition'\nimport { useAutoScroll } from '@/hooks/useAutoScroll'\nimport { useFloating } from '@/hooks/useFloating'\nimport { useVisibility } from '@/hooks/useVisibility'\n\nexport type AlignValue = 'after' | 'before' | 'center' | 'end' | 'start'\nexport type SideValue = 'bottom' | 'left' | 'right' | 'top'\nexport type ExtendedPlacement = `${SideValue}-${AlignValue}`\n\nexport interface HintProps extends BoxProps {\n align?: AlignValue\n alignOffset?: number\n anchor: string\n autoScroll?: ScrollIntoViewOptions | boolean\n children?: React.ReactNode\n defaultOpen?: boolean\n lockScroll?: boolean\n modal?: boolean\n onMount?: () => void\n onOpenChange?: (open: boolean) => void\n open?: boolean\n side?: SideValue\n sideOffset?: number\n spotlight?: boolean\n}\n\nexport function Hint({\n align = 'center',\n alignOffset = 0,\n anchor,\n autoScroll = false,\n children,\n css = {},\n defaultOpen = true,\n lockScroll = true,\n modal = false,\n onMount,\n onOpenChange = () => {},\n open,\n part,\n side = 'bottom',\n sideOffset = 0,\n spotlight = false,\n style = {},\n ...props\n}: HintProps) {\n const [internalOpen, setInteralOpen] = useState(defaultOpen)\n\n // Defer to controlled open prop, otherwise manage open state internally\n const canonicalOpen = open ?? internalOpen\n\n const { getFloatingProps, getReferenceProps, floatingStyles, placement, refs, status } =\n useFloating({\n align,\n alignOffset,\n anchor,\n onOpenChange: (newOpen) => {\n onOpenChange(newOpen)\n\n if (open == null) {\n setInteralOpen(newOpen)\n }\n },\n open: canonicalOpen,\n side,\n sideOffset,\n })\n\n const [finalSide, finalAlign] = placement.split('-')\n const referenceProps = getReferenceProps()\n\n const { isVisible } = useVisibility(refs.reference.current as Element | null)\n const isMounted = useRef(false)\n\n useAutoScroll(refs.reference.current as Element, autoScroll)\n\n const shouldMount = refs.reference.current !== null && isVisible\n\n if (!shouldMount) {\n isMounted.current = false\n return null\n } else if (isMounted.current === false) {\n isMounted.current = true\n onMount?.()\n }\n\n return (\n <>\n {spotlight && canonicalOpen && <Spotlight anchor={anchor} lockScroll={lockScroll} />}\n {modal && !spotlight && canonicalOpen && <Overlay lockScroll={lockScroll} />}\n\n <Box\n css={{\n '&[data-status=\"open\"]': {\n transition: 'transform 0.2s ease-out',\n },\n ...css,\n }}\n data-placement={placement}\n data-status={status.status}\n part={['hint', part]}\n ref={refs.setFloating}\n style={{\n ...floatingStyles,\n ...style,\n }}\n {...getFloatingProps()}\n {...props}\n >\n {canonicalOpen && children}\n\n <Ping\n {...referenceProps}\n position=\"absolute\"\n style={getPingPosition({ align: finalAlign, side: finalSide })}\n clickable={defaultOpen === false}\n />\n </Box>\n </>\n )\n}\n","import { keyframes } from '@emotion/react'\nimport { useEffect, useState } from 'react'\n\nimport { Box, type BoxProps } from '@/components/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 PingProps extends BoxProps {\n clickable?: boolean\n}\n\nexport function Ping({ clickable = false, part = '', style = {}, ...props }: PingProps) {\n const [hasMounted, setHasMounted] = useState(false)\n\n useEffect(() => {\n setHasMounted(true)\n }, [])\n\n return (\n <Box\n borderRadius=\"24px\"\n height=\"24px\"\n part={`ping-wrapper ${part}`}\n position=\"relative\"\n width=\"24px\"\n cursor={clickable ? 'pointer' : undefined}\n style={{\n opacity: hasMounted ? 1 : 0,\n ...style,\n }}\n transition={'opacity 0.2s ease-out'}\n {...props}\n >\n <Box\n backgroundColor=\"primary.surface\"\n animation={`2s ease-out infinite ${pulse}`}\n borderRadius=\"24px\"\n height=\"48px\"\n left=\"-12px\"\n part=\"ping-pulse\"\n pointerEvents=\"none\"\n position=\"absolute\"\n top=\"-12px\"\n transformOrigin=\"center center\"\n width=\"48px\"\n />\n <Box\n backgroundColor=\"primary.surface\"\n borderRadius=\"12px\"\n height=\"24px\"\n left=\"0\"\n part=\"ping\"\n position=\"absolute\"\n top=\"0\"\n width=\"24px\"\n backgroundColor:hover={clickable ? 'primary.hover.surface' : undefined}\n />\n </Box>\n )\n}\n","export function getPingPosition({ align, side }) {\n const style = {}\n const pingOffset = '-12px'\n\n const oppositeSides = {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right',\n }\n\n /* \n Rules:\n - Ping is opposite to side prop (e.g. side=left -> ping=right)\n - align=before|end -> Ping goes to highest extent (right/bottom) of align-axis\n - align=after|start -> Ping goes to lowest extent (left/top) of align-axis\n - align=center -> Ping goes to the center\n */\n\n style[oppositeSides[side]] = pingOffset\n\n if (['before', 'end'].includes(align)) {\n if (['top', 'bottom'].includes(side)) {\n style['right'] = pingOffset\n } else {\n style['bottom'] = pingOffset\n }\n } else if (['after', 'start'].includes(align)) {\n if (['top', 'bottom'].includes(side)) {\n style['left'] = pingOffset\n } else {\n style['top'] = pingOffset\n }\n } else {\n // The only option left is align=center\n if (['top', 'bottom'].includes(side)) {\n style['left'] = `calc(50% + ${pingOffset})`\n } else {\n style['top'] = `calc(50% + ${pingOffset})`\n }\n }\n\n return style\n}\n","import { Box } from '@/components/Box'\nimport { ClientPortal, type ClientPortalProps } from '@/components/ClientPortal/ClientPortal'\nimport { Flow, type FlowPropsWithoutChildren } from '@/components/Flow'\nimport { AlignValue, SideValue, type HintProps } from '@/components/Hint'\nimport { TourStep } from '@/components/Tour/TourStep'\n\nexport interface TourProps extends FlowPropsWithoutChildren, Omit<HintProps, 'anchor'> {\n /**\n * The alignment of the tooltip relative to the anchor.\n * Possible values: `after`, `before`, `center`, `end`, `start`.\n */\n align?: AlignValue\n /**\n * The offset of the tooltip relative to the anchor along the alignment axis.\n */\n alignOffset?: number\n /**\n * Automatically scroll to the anchor element of the current Step\n */\n autoScroll?: boolean\n /**\n * Specify a container in the DOM render the Tour into.\n * Use this to render the Tour into a different container/scrollable ancestor.\n */\n container?: ClientPortalProps['container']\n /**\n * Whether the tooltip should be open by default.\n */\n defaultOpen?: boolean\n /**\n * Whether to lock the scroll of the container when the Spotlight is enabled.\n * Defaults to `true`.\n */\n lockScroll?: boolean\n /**\n * Whether to render a modal overlay behind the tooltip.\n */\n modal?: boolean\n /**\n * Callback function triggered when the open state of the tooltip changes.\n */\n onOpenChange?: (open: boolean) => void\n /**\n * Controls the open state of the tooltip. Use this for controlled components.\n */\n open?: boolean\n /**\n * Whether the Tour should be completed by the end-user in sequential order.\n * If `false`, all steps will be rendered at once.\n * Defaults to `true`, which means only one step will be rendered at a time in sequential order.\n */\n sequential?: boolean\n /**\n * The preferred side of the anchor to render the tooltip.\n * Possible values: `top`, `right`, `bottom`, `left`.\n */\n side?: SideValue\n /**\n * The distance in pixels from the tooltip to the anchor element.\n */\n sideOffset?: number\n /**\n * Whether to highlight the anchor element with a spotlight/scrim effect.\n */\n spotlight?: boolean\n}\n\nfunction TourWrapper({ children, container, flowId, ...props }: Partial<TourProps>) {\n return (\n <ClientPortal container={container}>\n <Box data-flow-id={flowId} part=\"tour\" {...props}>\n {children}\n </Box>\n </ClientPortal>\n )\n}\n\nexport function Tour({ as, flowId, ...props }: TourProps) {\n const { onDismiss, onPrimary, onSecondary } = props\n\n return (\n <Flow as={null} flowId={flowId} autoStart={false} {...props}>\n {({ flow, handleDismiss, parentProps, step }) => {\n const {\n align = 'after',\n alignOffset = 0,\n autoScroll = false,\n container = 'body',\n defaultOpen,\n lockScroll = true,\n modal,\n onOpenChange,\n open,\n part,\n sequential = true,\n side = 'bottom',\n sideOffset = 0,\n spotlight,\n zIndex = 9999,\n ...containerProps\n } = parentProps.containerProps as Partial<TourProps>\n\n const { dismissible } = parentProps\n\n const sequentialStepProps = {\n align,\n alignOffset,\n autoScroll,\n dismissible,\n flow,\n handleDismiss,\n modal,\n onPrimary,\n onSecondary,\n onOpenChange,\n open,\n part,\n side,\n sideOffset,\n spotlight,\n step,\n zIndex,\n ...(step.props ?? {}),\n }\n\n if (sequential) {\n return (\n <TourWrapper\n as={as}\n container={container}\n flowId={flowId}\n part=\"tour\"\n zIndex={zIndex}\n {...containerProps}\n >\n <TourStep\n defaultOpen={defaultOpen ?? true}\n key={step.id}\n lockScroll={lockScroll}\n {...sequentialStepProps}\n />\n </TourWrapper>\n )\n }\n\n // TODO: Only render spotlight if current step\n // TODO: Only render modal overlay once\n const tourSteps = Array.from(flow.steps.values())\n .filter((currentStep) => {\n const { blocked, completed, skipped, visible } = currentStep.$state\n\n return !blocked && !completed && !skipped && visible\n })\n .map((currentStep) => {\n /*\n * Bit of a weird case here:\n * When sequential == false, we're only dismissing currentStep, not the whole Flow\n */\n async function handleDismissStep(e: MouseEvent | KeyboardEvent) {\n const continueDefault = await onDismiss?.(flow, e)\n\n if (continueDefault === false) {\n e.preventDefault()\n return false\n }\n\n currentStep.skip()\n\n return true\n }\n\n const shouldShowSpotlight = spotlight && currentStep.id === step.id\n\n const currentStepZIndex = currentStep.props?.zIndex ?? zIndex\n\n const nonSequentialStepProps = {\n align,\n alignOffset,\n dismissible,\n flow,\n handleDismiss: handleDismissStep,\n onPrimary,\n onSecondary,\n onOpenChange,\n open,\n part,\n side,\n sideOffset,\n spotlight,\n zIndex: currentStepZIndex,\n ...(currentStep.props ?? {}),\n }\n\n return (\n <TourStep\n css={{\n '&:has([aria-expanded=true])': {\n zIndex: Number(currentStepZIndex) + 2,\n },\n\n // NOTE: Selector does not currently apply due to rearranged component structure\n '.fr-overlay': {\n zIndex: Number(currentStepZIndex) + 1,\n },\n\n '.fr-progress-fraction': {\n display: 'none',\n },\n }}\n defaultOpen={(defaultOpen || shouldShowSpotlight) ?? false}\n key={`${currentStep.id}-${shouldShowSpotlight}`}\n lockScroll={lockScroll}\n step={currentStep}\n {...nonSequentialStepProps}\n />\n )\n })\n\n return (\n <TourWrapper\n as={as}\n container={container}\n flowId={flowId}\n part=\"tour\"\n zIndex={zIndex}\n {...containerProps}\n >\n {tourSteps}\n </TourWrapper>\n )\n }}\n </Flow>\n )\n}\n","import { useContext, useEffect } from 'react'\n\nimport { FrigadeContext } from '@/components/Provider'\n\nimport { useFlow } from '@/hooks/useFlow'\nimport { useCollections } from './useCollections'\nimport { Collection, Flow } from '@frigade/js'\n\nexport function useCollection(collectionId?: string): {\n collection: Collection | undefined\n currentFlow: Flow | undefined\n} {\n const { frigade } = useContext(FrigadeContext)\n const { collections } = useCollections()\n\n const collection = collections?.get(collectionId)\n\n const enrichedFlows =\n collections\n ?.get(collectionId)\n ?.flows?.filter((flowInCollection) => flowInCollection.visible)\n .map((item) => ({\n ...item,\n flow: frigade?.getFlowSync(item.flowId),\n })) ?? []\n\n const flowId = enrichedFlows.find(({ flow }) => flow.isVisible)?.flowId\n\n const { flow } = useFlow(flowId)\n\n useEffect(() => {\n frigade?.registerCollection(collectionId)\n }, [collectionId, frigade])\n\n return {\n collection,\n currentFlow: flow,\n }\n}\n","import { useCallback, useContext, useRef, useState } from 'react'\nimport { CollectionsList } from '@frigade/js'\n\nimport { FrigadeContext } from '@/components/Provider'\nimport { useSyncExternalStore } from '@/hooks/useSyncExternalStore'\n\nexport function useCollections() {\n const { frigade } = useContext(FrigadeContext)\n const [, setForceRender] = useState<boolean>(false)\n\n const debounceTimeout = useRef<ReturnType<typeof setTimeout>>()\n\n const subscribe = useCallback(\n (cb: () => void) => {\n // TODO: Why is there a noticeable delay when this is commented out?\n frigade?.getCollections().then(() => {\n cb()\n })\n\n const handler = () => {\n clearTimeout(debounceTimeout.current)\n\n /*\n * NOTE: Since React doesn't re-render on deep object diffs,\n * we need to gently prod it here by creating a state update.\n */\n debounceTimeout.current = setTimeout(() => {\n setForceRender((forceRender) => !forceRender)\n\n cb()\n }, 0)\n }\n\n frigade?.on('flow.any', handler)\n\n return () => {\n frigade?.off('flow.any', handler)\n }\n },\n [frigade]\n )\n\n const getSnapshot = () => {\n let result = undefined\n\n try {\n result = frigade?.getCollectionsSync()\n } catch (noGlobalStateYet) {\n // no-op\n }\n\n return result\n }\n\n const collections = useSyncExternalStore<CollectionsList | undefined>(\n subscribe,\n getSnapshot,\n getSnapshot\n )\n\n return {\n collections,\n }\n}\n","import * as React from 'react'\nimport * as UseSyncExternalStoreShim from 'use-sync-external-store/shim/index.js'\n\n// useSyncExternalStore doesn't exist in React 17, so shim it if necessary\nconst useSyncExternalStore =\n 'useSyncExternalStore' in React\n ? React.useSyncExternalStore\n : UseSyncExternalStoreShim.useSyncExternalStore\n\nexport { useSyncExternalStore }\n","import type { JSX } from '@emotion/react/jsx-runtime'\n\nimport { Announcement } from '@/components/Announcement'\nimport { Banner } from '@/components/Banner'\nimport { Box, type BoxProps } from '@/components/Box'\nimport { Card } from '@/components/Card'\nimport * as Checklist from '@/components/Checklist'\nimport type { FlowProps } from '@/components/Flow'\nimport { Form } from '@/components/Form'\nimport * as Survey from '@/components/Survey'\nimport { Tour } from '@/components/Tour'\n\nimport { useCollection } from '@/hooks/useCollection'\nimport { FlowType } from '@frigade/js'\nimport { Dialog } from '@/components/Dialog'\n\nexport interface CollectionProps extends BoxProps {\n /**\n * The unique ID of the Collection to render. You can find the Collection ID in the Frigade dashboard.\n */\n collectionId: string\n\n /**\n * A map of variables to pass to Flows in this Collection.\n * Example:\n * ```tsx\n * variables={{\n * name: \"Bobby Nerves\",\n * occupation: \"Vocalist\",\n * }}\n * ```\n */\n variables?: FlowProps['variables']\n}\n\nexport function Collection({ collectionId, part, variables = {}, ...props }: CollectionProps) {\n const flowTypeMap = {\n ANNOUNCEMENT: Announcement,\n BANNER: Banner,\n CARD: Card,\n CHECKLIST: Checklist.Collapsible,\n EMBEDDED_TIP: Card,\n FORM: Form,\n NPS_SURVEY: Survey.NPS,\n SURVEY: Survey.NPS,\n TOUR: Tour,\n }\n\n const { currentFlow } = useCollection(collectionId)\n\n const FlowComponent: JSX.ElementType = flowTypeMap[currentFlow?.rawData?.flowType] ?? null\n\n if (currentFlow == null || FlowComponent == null) {\n return null\n }\n\n if (currentFlow?.rawData?.flowType === FlowType.FORM) {\n return (\n <Box part={['collection', part]} data-collection-id={collectionId} {...props}>\n <Form flowId={currentFlow.id} key={currentFlow.id} as={Dialog} variables={variables} />\n </Box>\n )\n }\n\n return (\n <Box part={['collection', part]} data-collection-id={collectionId} {...props}>\n <FlowComponent flowId={currentFlow.id} key={currentFlow.id} variables={variables} />\n </Box>\n )\n}\n","import { Collection } from '@/components/Collection'\nimport { useCollection } from '@/hooks/useCollection'\nimport { useCollections } from '@/hooks/useCollections'\n\nexport function DefaultCollection() {\n const { collections } = useCollections()\n\n const collectionId = Array.from(collections?.entries() ?? []).find(\n (entry) => entry[1].collectionType === 'DEFAULT'\n )?.[0]\n\n useCollection(collectionId)\n\n if (collectionId == null) {\n return null\n }\n\n return <Collection as={null} collectionId={collectionId} />\n}\n","import type { CollectionsRegistryCallback, Frigade } from '@frigade/js'\nimport { createContext, type Dispatch, type SetStateAction } from 'react'\n\nimport type { ProviderProps } from './Provider'\n\nexport interface ProviderContext extends Omit<ProviderProps, 'children' | 'theme'> {\n currentModal: string | null\n setCurrentModal: Dispatch<SetStateAction<string | null>>\n frigade?: Frigade\n hasInitialized: boolean\n registerComponent: (flowId: string, callback?: CollectionsRegistryCallback) => void\n unregisterComponent: (flowId: string) => void\n variables: Record<string, unknown>\n}\n\nexport const FrigadeContext = createContext<ProviderContext>({\n apiKey: '',\n currentModal: null,\n setCurrentModal: () => {},\n navigate: () => {},\n hasInitialized: false,\n registerComponent: () => {},\n unregisterComponent: () => {},\n variables: {},\n})\n","import { useEffect } from 'react'\nimport { useFrigade } from '@/hooks/useFrigade'\n\nexport function ImagePreloader() {\n const { frigade } = useFrigade()\n\n useEffect(() => {\n ;(async () => {\n const flows = await frigade.getFlows()\n flows.forEach((flow) => {\n flow.steps.forEach((step) => {\n if (step.imageUri) {\n const img = new Image()\n img.src = step.imageUri\n }\n })\n })\n })()\n }, [frigade])\n\n return null\n}\n","import { useContext } from 'react'\n\nimport { FrigadeContext } from '@/components/Provider'\nimport { logOnce } from '../shared/log'\n\nexport function useFrigade() {\n const context = useContext(FrigadeContext)\n if (!context || !context.frigade) {\n logOnce('useFrigade() must be used in a child of the Frigade Provider', 'warn')\n }\n\n const { frigade } = context\n\n return { frigade, isLoading: !frigade?.isReady() }\n}\n","const logOnce = (message: string, type: 'log' | 'warn' | 'error' = 'log') => {\n const key = `__frigade_logged_${message}`\n\n if (globalThis[key as keyof typeof globalThis]) {\n return\n }\n\n // @ts-expect-error: globalThis is not typed\n globalThis[key as keyof typeof globalThis] = true\n console[type](message)\n}\n\nexport { logOnce }\n","export const SDK_VERSION = '2.9.2';","import { useCallback, useEffect, useRef } from 'react'\n\nimport { Flow } from '@frigade/js'\n\n/**\n * A function that handles a Flow event.\n * If the function returns a promise that evaluates to `false`, the Flow's state will not be updated for the current user (e.g. a Flow will not be marked as completed or dismissed).\n */\nexport type FlowHandlerProp = (\n /**\n * The Flow that the handler is being called on\n */\n flow: Flow,\n /**\n * The event that triggered the handler\n */\n event?: MouseEvent | KeyboardEvent\n) => Promise<boolean | void> | (boolean | void)\n\nexport interface FlowHandlerProps {\n onComplete?: FlowHandlerProp\n onDismiss?: FlowHandlerProp\n}\n\nexport type DismissHandler = (e: MouseEvent | KeyboardEvent) => 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 async function callHandler() {\n if (flow.isCompleted && lastCompleted.current === false) {\n lastCompleted.current = true\n await onComplete?.(flow)\n }\n }\n\n callHandler()\n lastCompleted.current = flow?.isCompleted\n return () => {\n callHandler()\n }\n }, [flow, flow?.isCompleted, onComplete])\n\n return {\n handleDismiss: useCallback<DismissHandler>(\n async (e: MouseEvent | KeyboardEvent) => {\n const continueDefault = await onDismiss?.(flow, e)\n\n if (continueDefault === false) {\n e.preventDefault()\n return false\n }\n\n flow.skip()\n },\n [flow, onDismiss]\n ),\n }\n}\n","import { useCallback, useContext, useEffect } from 'react'\nimport type { Flow } from '@frigade/js'\n\nimport { FrigadeContext } from '@/components/Provider'\n\nexport function useCheckForModalCollision(flow: Flow, isModal = true) {\n const { currentModal, setCurrentModal } = useContext(FrigadeContext)\n\n const claimLock = useCallback(\n (flowId: string) => {\n if (isModal && flow?.isVisible) {\n setCurrentModal(flowId)\n }\n },\n [isModal, flow?.isVisible, setCurrentModal]\n )\n\n const releaseLock = useCallback(() => {\n if (flow != null && currentModal === flow?.id) {\n setCurrentModal(null)\n }\n }, [currentModal, flow, setCurrentModal])\n\n useEffect(() => {\n if (flow != null && currentModal === null && flow.isVisible) {\n claimLock(flow.id)\n }\n\n return releaseLock\n }, [claimLock, currentModal, flow, releaseLock])\n\n // Edge case: The current modal may become non-modal while still mounted\n useEffect(() => {\n if (flow != null && (!isModal || !flow.isVisible)) {\n releaseLock()\n }\n }, [flow, isModal, releaseLock])\n\n // No flow? No problem.\n if (flow == null) {\n return {\n hasModalCollision: false,\n }\n }\n\n // Non-modal and hidden components, by definition, can't collide with modals\n if (!isModal || !flow.isVisible) {\n return {\n hasModalCollision: false,\n }\n }\n\n // We already have the lock, send it\n if (currentModal === flow.id) {\n return {\n hasModalCollision: false,\n }\n }\n\n if (currentModal === null) {\n return {\n hasModalCollision: false,\n }\n }\n\n // If we didn't short circuit and didn't have the lock, assume that we're out of lock luck.\n return {\n hasModalCollision: true,\n }\n}\n","import { Card } from '@/components/Card'\nimport { Flex } from '@/components/Flex'\nimport { Flow, type FlowProps } from '@/components/Flow'\n\nimport { getVideoProps } from '@/components/Media/videoProps'\n\nexport function FlowCard({ part, ...props }: FlowProps) {\n return (\n <Flow\n as={Card}\n gap={5}\n borderColor=\"neutral.border\"\n borderStyle=\"solid\"\n borderWidth=\"md\"\n part={['card', part]}\n {...props}\n >\n {({ handleDismiss, handlePrimary, handleSecondary, parentProps: { dismissible }, step }) => {\n const primaryButtonTitle = step.primaryButton?.title ?? step.primaryButtonTitle\n const secondaryButtonTitle = step.secondaryButton?.title ?? step.secondaryButtonTitle\n\n const { videoProps } = getVideoProps(step.props ?? {})\n\n return (\n <>\n <Card.Header\n dismissible={dismissible}\n handleDismiss={handleDismiss}\n subtitle={step.subtitle}\n title={step.title}\n />\n\n <Card.Media\n src={step.videoUri ?? step.imageUri}\n type={step.videoUri ? 'video' : 'image'}\n css={{ objectFit: 'contain', width: '100%' }}\n {...videoProps}\n />\n\n <Flex.Row gap={3} justifyContent=\"flex-end\" part=\"card-footer\">\n <Card.Secondary title={secondaryButtonTitle} onClick={handleSecondary} />\n <Card.Primary title={primaryButtonTitle} onClick={handlePrimary} />\n </Flex.Row>\n </>\n )\n }}\n </Flow>\n )\n}\n","import { Box, BoxProps } from '@/components/Box'\n\nexport interface ImageProps extends BoxProps {\n src: string\n}\n\nexport function Image({ part, src, ...props }: ImageProps) {\n return <Box as=\"img\" maxWidth=\"unset\" part={['image', part]} src={src} {...props} />\n}\n","import * as React from 'react'\nimport { Box, BoxProps } from '@/components/Box'\n\nimport type { VideoPropName } from '@/components/Media/videoProps'\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('youtu.be')) {\n const videoId = videoUri.split('youtu.be/')[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 return null\n}\n\nexport interface VideoProps\n extends BoxProps,\n Pick<React.VideoHTMLAttributes<HTMLVideoElement>, VideoPropName> {}\n\nexport function Video({\n autoPlay,\n controls,\n controlsList,\n crossOrigin,\n disablePictureInPicture,\n disableRemotePlayback,\n loop,\n muted,\n playsInline,\n poster,\n preload,\n part,\n src,\n ...props\n}: VideoProps) {\n const videoEmbedSrc = getVideoEmbedSrc(src)\n\n if (!videoEmbedSrc) {\n // Check if it's a url that ends in .mp4\n if (src?.endsWith('.mp4')) {\n return (\n <Box\n as=\"video\"\n part={['video', part]}\n src={src}\n {...{\n autoPlay,\n controls: controls ?? true,\n controlsList,\n crossOrigin,\n disablePictureInPicture,\n disableRemotePlayback,\n loop,\n muted: muted ?? autoPlay,\n playsInline,\n poster,\n preload,\n }}\n {...props}\n />\n )\n }\n\n console.error(\n `Could not map videoUri ${src} to a known provider (Youtube, Vimeo, Wistia, Loom) or valid mp4 file.`\n )\n return null\n }\n\n return (\n <Box\n allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture\"\n allowFullScreen\n as=\"iframe\"\n backgroundColor=\"neutral.100\"\n borderWidth=\"0\"\n part={['video', part]}\n src={videoEmbedSrc}\n {...props}\n ></Box>\n )\n}\n","import { Image } from './Image'\nimport { Video, type VideoProps } from './Video'\n\nexport interface MediaProps extends VideoProps {\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 type { BoxProps } from '@/components/Box'\nimport type { DialogProps, DialogContentProps, DialogRootProps } from '.'\n\nconst RADIX_PROPS = {\n content: [\n 'onOpenAutoFocus',\n 'onCloseAutoFocus',\n 'onEscapeKeyDown',\n 'onPointerDownOutside',\n 'onInteractOutside',\n ],\n root: ['defaultOpen', 'modal', 'onOpenChange', 'open'],\n} as const\n\nexport function mapDialogProps(props: DialogProps) {\n const contentProps: DialogContentProps = Object.fromEntries(\n RADIX_PROPS.content\n .map((propName) => [propName, props[propName]])\n .filter((propEntry) => propEntry[1] !== undefined)\n )\n const rootProps: DialogRootProps = Object.fromEntries(\n RADIX_PROPS.root\n .map((propName) => [propName, props[propName]])\n .filter((propEntry) => propEntry[1] !== undefined)\n )\n\n const otherProps = {} as BoxProps\n\n for (const propName of Object.keys(props)) {\n if (\n !RADIX_PROPS.content.some((p) => p === propName) &&\n !RADIX_PROPS.root.some((p) => p === propName)\n ) {\n otherProps[propName] = props[propName]\n }\n }\n\n return {\n contentProps,\n otherProps,\n rootProps,\n }\n}\n","import { Dialog, type DialogProps } from '@/components/Dialog'\nimport { Flex } from '@/components/Flex'\nimport { Flow, type FlowPropsWithoutChildren } from '@/components/Flow'\n\nimport { getVideoProps } from '@/components/Media/videoProps'\n\nexport interface AnnouncementProps extends FlowPropsWithoutChildren, DialogProps {\n /**\n * @ignore\n */\n children?: React.ReactNode\n /**\n * @ignore\n */\n open?: boolean\n /**\n * @ignore\n */\n defaultOpen?: boolean\n}\n\nexport function Announcement({ flowId, ...props }: AnnouncementProps) {\n return (\n <Flow as={null} flowId={flowId} {...props}>\n {({\n flow,\n handleDismiss,\n handlePrimary,\n handleSecondary,\n parentProps: { containerProps, dismissible },\n step,\n }) => {\n const primaryButtonTitle = step.primaryButton?.title ?? step.primaryButtonTitle\n const secondaryButtonTitle = step.secondaryButton?.title ?? step.secondaryButtonTitle\n\n const disabled = step.$state.blocked\n\n const { videoProps } = getVideoProps(step.props ?? {})\n\n return (\n <Dialog\n data-step-id={step.id}\n display=\"flex\"\n flexDirection=\"column\"\n gap={5}\n part=\"announcement\"\n textAlign=\"center\"\n {...containerProps}\n >\n {dismissible && <Dialog.Dismiss onClick={handleDismiss} />}\n <Flex.Column gap={1} part=\"announcement-header\">\n <Dialog.Title>{step.title}</Dialog.Title>\n <Dialog.Subtitle>{step.subtitle}</Dialog.Subtitle>\n </Flex.Column>\n\n <Dialog.Media\n aspectRatio=\"1.5\"\n objectFit=\"cover\"\n overflowClipMargin=\"unset\"\n src={step.videoUri ?? step.imageUri}\n transform=\"translate3d(0, 0, 1px)\"\n type={step.videoUri ? 'video' : 'image'}\n width=\"100%\"\n {...videoProps}\n />\n\n <Dialog.ProgressDots\n current={flow.getCurrentStepIndex()}\n total={flow.getNumberOfAvailableSteps()}\n />\n\n <Flex.Row\n css={{\n '& > button': {\n flexBasis: '50%',\n flexGrow: 1,\n },\n }}\n gap={3}\n part=\"announcement-footer\"\n >\n {secondaryButtonTitle && (\n <Dialog.Secondary\n disabled={disabled}\n onClick={handleSecondary}\n title={secondaryButtonTitle}\n />\n )}\n {primaryButtonTitle && (\n <Dialog.Primary\n disabled={disabled}\n onClick={handlePrimary}\n title={primaryButtonTitle}\n />\n )}\n </Flex.Row>\n </Dialog>\n )\n }}\n </Flow>\n )\n}\n","function isObject(obj) {\n return typeof obj === 'object' && obj !== null && !Array.isArray(obj)\n}\n\nexport function deepmerge(...args) {\n const target = args.shift()\n\n // Recurse to the right until we've merged all the way back to a single target and source\n const source = args.length === 1 ? args[0] : deepmerge(...args)\n\n if (!isObject(target) || !isObject(source)) {\n throw new Error('deepmerge can only merge Objects')\n }\n\n const result = structuredClone(target)\n\n Object.entries(source).forEach(([key, value]) => {\n // Is value an Object, i.e. are we at risk of passing by reference?\n if (isObject(value)) {\n // Does key already exist in result?\n if (result[key] !== undefined) {\n // Deepmerge it on\n Object.assign(result, { [key]: deepmerge(result[key], structuredClone(value)) })\n } else {\n // Else clone value onto result\n Object.assign(result, { [key]: structuredClone(value) })\n }\n } else if (Array.isArray(value)) {\n // Does key already exist in result?\n if (result[key] !== undefined) {\n // Clone and spread onto existing\n // TODO: This only shallow-merges arrays. Add ability to deep merge here, so nested structures aren't overwritten\n Object.assign(result, { [key]: [...result[key], ...structuredClone(value)] })\n } else {\n // Else spread array onto result\n Object.assign(result, { [key]: structuredClone(value) })\n }\n } else {\n // Assign value onto result\n Object.assign(result, { [key]: value })\n }\n })\n\n return result\n}\n","import { Box } from '@/components/Box'\nimport { Card } from '@/components/Card'\nimport { ChevronDownMiniIcon } from '@/components/Icon/ChevronDownMiniIcon'\nimport { Flex } from '@/components/Flex'\nimport { Flow, type FlowPropsWithoutChildren } from '@/components/Flow'\nimport * as Progress from '@/components/Progress'\n\nimport { deepmerge } from '@/shared/deepmerge'\n\nexport interface ProgressBadgeProps extends FlowPropsWithoutChildren {\n /**\n * Override the title displayed on the ProgressBadge. Defaults to the title of the associated Flow, or the title of that Flow's first Step.\n */\n title?: string\n}\n\nfunction firstNonEmptyString(...strings: string[]) {\n for (const str of strings) {\n if (str != null && str.length > 0) {\n return str\n }\n }\n\n return null\n}\n\nexport function ProgressBadge({ title, ...props }: ProgressBadgeProps) {\n return (\n <Flow as={null} {...props}>\n {({ flow, parentProps: { containerProps }, step }) => {\n const derivedTitle = firstNonEmptyString(title, flow.title, step.title)\n\n const completedSteps = flow?.getNumberOfCompletedSteps() ?? 0\n const availableSteps = flow?.getNumberOfAvailableSteps() ?? 1\n\n const isClickable = containerProps.onClick != null\n\n if (isClickable) {\n containerProps.css = deepmerge(\n {\n '&:hover': {\n backgroundColor: 'var(--fr-colors-neutral-hover-background)',\n },\n },\n containerProps.css ?? {}\n )\n }\n\n return (\n <Card\n aria-label=\"Progress Badge\"\n borderWidth=\"md\"\n cursor={isClickable ? 'pointer' : 'auto'}\n gap=\"1\"\n p=\"3\"\n part=\"progress-badge\"\n role=\"complementary\"\n {...containerProps}\n >\n <Flex.Row alignItems=\"center\" gap=\"2\" part=\"progress-badge-header\">\n <Card.Title fontSize=\"sm\" lineHeight=\"sm\">\n {derivedTitle}\n </Card.Title>\n\n <Box\n as={ChevronDownMiniIcon}\n height=\"20px\"\n marginLeft=\"auto\"\n marginRight=\"-1\"\n transform=\"rotate(-90deg)\"\n width=\"20px\"\n />\n </Flex.Row>\n\n <Flex.Row alignItems=\"center\" gap=\"2\" part=\"progress-badge-footer\">\n <Progress.Fraction\n current={completedSteps}\n fontSize=\"xs\"\n fontWeight=\"medium\"\n lineHeight=\"xs\"\n total={availableSteps}\n />\n\n <Progress.Segments current={completedSteps} flexGrow=\"1\" total={availableSteps} />\n </Flex.Row>\n </Card>\n )\n }}\n </Flow>\n )\n}\n","import { keyframes } from '@emotion/react'\nimport React, { useEffect, useRef, useState } from 'react'\n\nimport { XMarkIcon } from '@/components/Icon/XMarkIcon'\nimport * as Popover from '@radix-ui/react-popover'\n\nimport { useBoundingClientRect } from '@/hooks/useBoundingClientRect'\nimport { Box } from '@/components/Box'\nimport { Button, ButtonProps } from '@/components/Button'\nimport { Card } from '@/components/Card'\nimport { Dot } from './Dot'\nimport { Media, MediaProps } from '@/components/Media'\nimport { Text, TextProps } from '@/components/Text'\nimport { getDotPosition } from './getDotPosition'\nimport { mapTooltipPropsToPopoverProps } from './mapTooltipPropsToPopoverProps'\nimport { BoxPropsWithoutChildren } from '@/components/Flow/FlowProps'\n\nconst fadeIn = keyframes`\n from {\n opacity: 0;\n }\n 25% {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n`\n\nfunction isVisible(elem: Element) {\n if (!(elem instanceof HTMLElement)) {\n return false\n }\n return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length)\n}\n\nexport interface MergedRadixPopoverProps\n extends Pick<Popover.PopoverProps, 'defaultOpen' | 'modal' | 'onOpenChange' | 'open'>,\n Omit<\n Popover.PopoverContentProps,\n 'align' | 'asChild' | 'color' | 'content' | 'translate' | 'forceMount'\n > {}\nexport interface TooltipProps\n extends BoxPropsWithoutChildren,\n Omit<MergedRadixPopoverProps, 'children'> {\n /**\n * How to align the Tooltip relative to the anchor.\n * Uses the same notation as the `align` property in [Radix Popover](https://www.radix-ui.com/primitives/docs/components/popover).\n */\n align?: Popover.PopoverContentProps['align'] | 'before' | 'after'\n /**\n * @ignore\n */\n anchor?: string\n /**\n * Whether to show a spotlight behind the anchor. This will darken the rest of the page and highlight the anchor.\n */\n spotlight?: boolean\n /**\n * The Z-index of the tooltip. Defaults to auto.\n */\n zIndex?: number | string\n style?: React.CSSProperties\n}\n\nexport function Tooltip({\n anchor,\n children,\n className,\n defaultOpen = true,\n open,\n part,\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, otherProps, rootProps } = mapTooltipPropsToPopoverProps(props, contentRect)\n\n const [internalOpen, setInternalOpen] = useState(defaultOpen)\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 function isOpen() {\n // External override via props\n if (open != null) {\n console.log('OVERRIDE: ', open)\n return open\n }\n\n console.log('INTERNAL: ', internalOpen)\n\n // Internal open state\n return internalOpen\n }\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 } else {\n console.debug(`[frigade] Tooltip: No anchor found for query: ${anchor}`)\n }\n }, [anchor, anchorRef])\n\n useEffect(() => {\n function checkElementForAnchor(element: Element) {\n if (element.matches(anchor)) {\n if (isVisible(element)) {\n return element\n } else {\n return null\n }\n }\n\n const anchorSelector = element.querySelectorAll(anchor)\n\n if (anchorSelector.length > 0) {\n if (isVisible(anchorSelector[0])) {\n return anchorSelector[0]\n } else {\n return null\n }\n }\n\n return null\n }\n\n const observer = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (mutation.type !== 'childList') {\n continue\n }\n\n for (const node of mutation.addedNodes) {\n if (node.nodeType !== Node.ELEMENT_NODE) {\n continue\n }\n\n const maybeAnchor = checkElementForAnchor(node as Element)\n\n if (maybeAnchor != null) {\n anchorRef(maybeAnchor)\n anchorVirtualRef.current = maybeAnchor\n\n console.debug('[frigade] Tooltip: MutationObserver added anchor: ', maybeAnchor)\n\n break\n }\n }\n\n for (const node of mutation.removedNodes) {\n if (node.nodeType !== Node.ELEMENT_NODE) {\n continue\n }\n\n const maybeAnchor = checkElementForAnchor(node as Element)\n\n if (maybeAnchor != null) {\n anchorRef(null)\n anchorVirtualRef.current = null\n\n console.debug('[frigade] Tooltip: MutationObserver removed anchor: ', maybeAnchor)\n\n break\n }\n }\n }\n })\n\n observer.observe(document.querySelector('body'), { childList: true, subtree: true })\n\n return () => observer.disconnect()\n }, [anchor, anchorRef])\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 <>\n {spotlight && (\n <Box\n animation={`${fadeIn} 300ms ease-out`}\n boxShadow=\"0 0 0 20000px rgb(0 0 0 / 0.5)\"\n part=\"tooltip-spotlight\"\n pointerEvents=\"none\"\n position=\"absolute\"\n style={{\n borderRadius: anchorRadius,\n height: anchorRect.height,\n left: spotlightLeft,\n top: spotlightTop,\n width: anchorRect.width,\n }}\n {...(props.zIndex != null\n ? {\n zIndex: props.zIndex,\n }\n : {})}\n />\n )}\n <Popover.Content key={internalOpen} {...contentProps} ref={contentRef}>\n <>\n {isOpen() && (\n <Card\n animation={`${fadeIn} 300ms ease-out`}\n boxShadow=\"md\"\n position=\"relative\"\n className={className}\n maxWidth=\"min(360px, calc(100vw - 25px))\"\n part={['tooltip', part]}\n style={style}\n {...otherProps}\n >\n {children}\n </Card>\n )}\n <Dot\n onClick={() => {\n setInternalOpen(() => {\n if (typeof rootProps.onOpenChange === 'function') {\n rootProps.onOpenChange(!isOpen())\n }\n\n return !isOpen()\n })\n }}\n style={dotPosition}\n />\n </>\n </Popover.Content>\n </>\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: '0px',\n right: '-6px',\n }}\n part=\"close\"\n position=\"absolute\"\n {...props}\n >\n <XMarkIcon height=\"20\" 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 aspectRatio=\"2\"\n borderRadius=\"md md 0 0\"\n borderWidth=\"0\"\n margin=\"-5 -5 0\"\n objectFit=\"cover\"\n overflowClipMargin=\"unset\"\n src={src}\n transform=\"translate3d(0, 0, 1px)\"\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 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.H4 part=\"title\" {...props}>\n {children}\n </Text.H4>\n )\n}\n","import { keyframes } from '@emotion/react'\n\nimport { Box, type BoxProps } from '@/components/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: ['modal', 'onOpenChange'],\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 const otherProps: Partial<TooltipProps> = {}\n\n for (const propName of Object.keys(props)) {\n if (!RADIX_PROPS.content.includes(propName) && !RADIX_PROPS.root.includes(propName)) {\n otherProps[propName] = props[propName]\n }\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 otherProps,\n rootProps,\n }\n}\n","/// <reference types=\"@emotion/react/types/css-prop\" />\n\nexport { Announcement, type AnnouncementProps } from './components/Announcement'\nexport { Banner, type BannerProps } from './components/Banner'\nexport { Box, type BoxProps } from './components/Box'\nexport { Button, type ButtonProps } from './components/Button'\nexport { Card, type CardProps, type CardHeaderProps } from './components/Card'\nexport * as Checklist from './components/Checklist'\nexport * from './components/ClientPortal'\nexport type { CollapsibleProps, CollapsibleStepProps } from './components/Checklist'\nexport { Collection } from './components/Collection'\nexport { Dialog, type DialogProps } from './components/Dialog'\nexport { Flex } from './components/Flex'\nexport {\n type FieldTypes,\n Form,\n type FormProps,\n type FormFieldData,\n type FormFieldProps,\n} from './components/Form'\nexport { Hint } from '@/components/Hint'\nexport { SelectField } from './components/Form/fields/SelectField'\nexport { TextareaField } from './components/Form/fields/TextareaField'\nexport { TextField } from './components/Form/fields/TextField'\nexport { RadioField } from './components/Form/fields/RadioField'\nexport { Label } from './components/Form/fields/Label'\nexport { BaseField } from './components/Form/fields/BaseField'\nexport { Media, Image, Video } from './components/Media'\nexport { type NPSProps } from './components/Survey/NPS'\nexport { Ping } from './components/Ping'\nexport * as Popover from './components/Popover'\nexport * as Progress from './components/Progress'\nexport { ProgressBadge, type ProgressBadgeProps } from './components/ProgressBadge'\nexport { Provider, type ProviderProps } from './components/Provider'\nexport { Spotlight } from './components/Spotlight'\nexport * as Survey from './components/Survey'\nexport { Text, type TextProps } from './components/Text'\nexport { Tooltip, type TooltipProps } from './components/Tooltip'\nexport { Tour, type TourProps } from './components/Tour'\nexport {\n Flow,\n type FlowChildrenProps,\n type FlowProps,\n type FlowPropsWithoutChildren,\n} from './components/Flow'\nexport * as FrigadeJS from '@frigade/js'\nexport { themeVariables, type Theme } from './shared/theme'\nexport { tokens, type Tokens } from './shared/tokens'\n\nexport { useAutoScroll } from './hooks/useAutoScroll'\nexport { useBoundingClientRect } from './hooks/useBoundingClientRect'\nexport { useFlow, type FlowConfig } from './hooks/useFlow'\nexport {\n useFlowHandlers,\n type DismissHandler,\n type FlowHandlerProp,\n type FlowHandlerProps,\n} from './hooks/useFlowHandlers'\nexport {\n useStepHandlers,\n type StepHandler,\n type StepHandlerProp,\n type StepHandlerProps,\n} from './hooks/useStepHandlers'\nexport { useFrigade } from './hooks/useFrigade'\nexport { useUser } from './hooks/useUser'\nexport { useGroup } from './hooks/useGroup'\n\n// TEMP: Remove this, used for testing Storybook\nexport * as FloatingUI from '@floating-ui/react'\n","import { useContext } from 'react'\n\nimport { FrigadeContext } from '@/components/Provider'\nimport { logOnce } from '../shared/log'\n\nexport function useUser() {\n const context = useContext(FrigadeContext)\n if (!context || !context.frigade) {\n logOnce('useUser() must be used in a child of the Frigade Provider', 'warn')\n }\n const { frigade } = context ?? {}\n const userId = frigade?.config.userId\n\n /**\n * Adds properties for the current user\n * @param properties\n */\n async function addProperties(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, addProperties, track, isLoading: !frigade?.isReady() }\n}\n","import { useContext } from 'react'\n\nimport { FrigadeContext } from '@/components/Provider'\nimport { logOnce } from '../shared/log'\n\nexport function useGroup() {\n const context = useContext(FrigadeContext)\n if (!context || !context.frigade) {\n logOnce('useGroup() must be used in a child of the Frigade Provider', 'warn')\n }\n const { frigade } = context ?? {}\n const groupId = frigade?.getConfig()?.groupId\n\n /**\n * Sets properties for the current group\n * @param properties\n */\n async function addProperties(properties: Record<string, unknown>) {\n if (!frigade.config.groupId) {\n console.error('No Group ID is set. Cannot set properties without a Group ID.')\n return\n }\n await frigade.group(frigade.config.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 /**\n * Sets the current group. Note that this can cause issues if separately setting the group in the FrigadeProvider.\n * @param groupId\n * @param properties Optional properties to set for the group\n */\n async function setGroupId(groupId: string, properties?: Record<string, unknown>) {\n await frigade.group(groupId, properties)\n }\n\n return {\n groupId,\n setGroupId,\n addProperties,\n track,\n isLoading: !frigade?.isReady(),\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/components/Dialog/index.tsx","../src/components/Icon/XMarkIcon.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/Button/Button.tsx","../src/components/Text/Text.tsx","../src/components/Text/Text.styles.ts","../src/components/Button/Button.styles.ts","../src/components/Card/index.tsx","../src/components/Flex/Flex.tsx","../src/components/Flow/index.tsx","../src/hooks/useFlow.ts","../src/components/Provider/Provider.tsx","../src/components/Banner/index.tsx","../src/components/Checklist/index.tsx","../src/components/Checklist/CarouselEmblaWrapper.tsx","../src/components/Progress/index.tsx","../src/components/Progress/Bar.tsx","../src/components/Progress/Dots.tsx","../src/components/Progress/Fraction.tsx","../src/components/Progress/Ring.tsx","../src/components/Progress/Segments.tsx","../src/components/Icon/LockClosedIcon.tsx","../src/components/CheckIndicator/index.tsx","../src/hooks/useStepHandlers.ts","../src/components/Checklist/CarouselStep.tsx","../src/components/Icon/ArrowRightIcon.tsx","../src/components/Icon/ArrowLeftIcon.tsx","../src/components/Checklist/Carousel.tsx","../src/components/Checklist/Collapsible.tsx","../src/components/Checklist/CollapsibleStep.tsx","../src/components/Icon/ChevronDownIcon.tsx","../src/components/Media/videoProps.ts","../src/components/Checklist/Floating.tsx","../src/components/Popover/index.tsx","../src/components/Popover/Root.tsx","../src/components/Spotlight/index.tsx","../src/components/Overlay/index.tsx","../src/hooks/useAutoScroll.ts","../src/hooks/useFloating.ts","../src/components/Hint/useMutationAwareAnchor.ts","../src/components/Popover/Content.tsx","../src/hooks/useVisibility.ts","../src/hooks/useBoundingClientRect.ts","../src/components/Popover/Trigger.tsx","../src/components/Checklist/FloatingStep.tsx","../src/components/Checklist/Floating.styles.ts","../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/Icon/CheckIcon.tsx","../src/components/Form/fields/SelectField.tsx","../src/components/Icon/ChevronDownMiniIcon.tsx","../src/components/Form/fields/SelectMultipleField.tsx","../src/components/Form/fields/TextField.tsx","../src/components/Form/fields/TextareaField.tsx","../src/components/Form/fields/CheckboxField.tsx","../src/components/Form/index.tsx","../src/components/Survey/index.tsx","../src/components/Survey/NPSField.tsx","../src/components/Survey/NPS.tsx","../src/hooks/useClientPortal.ts","../src/components/ClientPortal/ClientPortal.tsx","../src/components/Tour/TourStep.tsx","../src/components/Hint/index.tsx","../src/components/Ping/index.tsx","../src/components/Hint/getPingPosition.ts","../src/components/Tour/Tour.tsx","../src/hooks/useCollection.ts","../src/hooks/useCollections.ts","../src/hooks/useSyncExternalStore.ts","../src/components/Collection/index.tsx","../src/components/Provider/DefaultCollection.tsx","../src/components/Provider/FrigadeContext.ts","../src/components/Provider/ImagePreloader.tsx","../src/hooks/useFrigade.ts","../src/shared/log.ts","../src/version.ts","../src/hooks/useFlowHandlers.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/Dialog/mapDialogProps.ts","../src/components/Announcement/index.tsx","../src/shared/deepmerge.ts","../src/components/ProgressBadge/index.tsx","../src/components/Tooltip/index.tsx","../src/components/Tooltip/Dot.tsx","../src/components/Tooltip/getDotPosition.ts","../src/components/Tooltip/mapTooltipPropsToPopoverProps.ts","../src/index.ts","../src/hooks/useUser.ts","../src/hooks/useGroup.ts"],"names":["keyframes","RadixDialog","jsx","XMarkIcon","props","__spreadProps","__spreadValues","React","clsx","kcp","borders","defaultScale","coolScale","warmScale","hues","scaledColors","name","h","s","scale","l","i","palette","radii","colorVar","colorName","semantic","shadows","SPACE_UNIT","spaceValue","key","spaceKeys","space","typography","tokens","flattenObject","obj","path","separator","acc","k","currentPath","currentValue","createThemeVariables","flattenedTokens","value","cssSafeKey","mapTokensToThemeVariables","newObj","themeVariables","theme","omittedCSSProperties","filteredCSSProperties","prop","_","char","defaultCSSProperties","colorTokens","themedStyleProps","styleProps","stylePropShorthands","pseudoStyleProps","prepValue","v","stylePropsMap","propName","stylePropShorthandsMap","shorthand","targetProps","preservedProps","elementsWithPreservedProps","getPseudoClass","pseudo","stylePropsToCss","element","unmatchedProps","cssFromProps","getTargetObject","pseudoSelector","match","propValue","matchedShorthand","p","fullPropName","styleProp","splitPropValues","_a","clippedPropName","DOMPurify","getWindow","JSDOM","sanitize","dirty","prefixPart","part","processPart","BoxWithRef","ref","_b","as","children","className","css","__objRest","Component","processedPart","classNameWithPart","cssProp","Box","Button_exports","__export","Link","Plain","Primary","Secondary","Text_exports","Body1","Body2","Caption","Display1","Display2","H1","H2","H3","H4","Text_styles_exports","base","textVariantNames","textVariants","variant","defaultAs","component","Button_styles_exports","loadingCSSStyle","rotate","jsxs","BaseButton","title","variantPart","Flex_exports","Column","Row","Fragment","FlowType","useCallback","useContext","useEffect","useState","Frigade","useMemo","useRef","Global","ThemeProvider","Banner","flowId","Flow","handleDismiss","handlePrimary","handleSecondary","containerProps","dismissible","step","_c","_d","primaryButtonTitle","secondaryButtonTitle","disabled","Card","Checklist_exports","Carousel","Collapsible","CollapsibleStep_exports","Floating","useLayoutEffect","useEmblaCarousel","Progress_exports","Bar","Dots","Fraction","Ring","Segments","current","total","progressPercent","barWidth","dots","height","showLabel","strokeWidth","width","segments","LockClosedIcon","CheckIcon","CheckIndicator","checked","size","useStepHandlers","onPrimary","onSecondary","navigate","FrigadeContext","stepActions","properties","optimistic","e","__async","primaryAction","secondaryAction","CarouselStep","blocked","completed","skipped","topRightIcon","ArrowRightIcon","ArrowLeftIcon","fadeIn","CarouselEmblaWrapper","flow","sort","stepOrder","setStepOrder","emblaOptions","emblaRef","emblaApi","hasNext","setHasNext","hasPrev","setHasPrev","steps","completedOrSkippedSteps","a","b","nonCompletedOrSkippedSteps","completedSteps","availableSteps","flowChildrenProps","createContext","Content","Root","Trigger","ChevronDownIcon","slideDown","slideUp","onOpenChange","open","isCompleted","isBlocked","VIDEO_PROP_NAMES","getVideoProps","videoProps","otherProps","CollapsibleContext","DefaultCollapsibleStep","_e","_f","subtitle","stepProps","defaultStepTypes","StepWrapper","openStepId","setOpenStepId","stepTypes","StepComponent","isOpening","mergedStepTypes","childrenProps","stepList","currentSteps","FloatingTree","Popover_exports","useFloatingNodeId","autoUpdate","useFloating","RemoveScroll","OverlayWithRef","lockScroll","opacity","hasScrolled","setHasScrolled","handleScroll","Overlay","getClipPath","maxX","maxY","radius","x1","x2","y1","y2","getComputedRadius","computedRadius","Spotlight","anchor","style","clipPathCoords","setClipPathCoords","refs","elements","rects","anchorQuery","invalidSelector","useAutoScroll","enabled","scrollComplete","setScrollComplete","scrollOptions","scrollTimeout","scrollHandler","flip","offset","shift","useClick","useDismiss","useFloatingUI","useFocus","useInteractions","useRole","useTransitionStatus","checkElementForAnchor","isVisible","anchorSelector","useMutationAwareAnchor","anchorElement","setAnchorElement","observer","mutations","mutation","node","maybeAnchor","getOriginalAlign","align","alignOffset","nodeId","side","sideOffset","placement","offsetMiddleware","offsets","context","floatingStyles","computedPlacement","floatingReturn","clickHandler","dismissHandler","focusProps","roleProps","status","getFloatingProps","getReferenceProps","finalPlacement","PopoverContext","autoScroll","defaultOpen","modal","spotlight","floatingProps","internalOpen","setInternalOpen","canonicalOpen","floatingNodeId","floating","newOpen","FloatingNode","EmptyDOMRect","useBoundingClientRect","initialRect","rect","setRect","setNode","handleResize","newRect","useVisibility","isIntersecting","setIsIntersecting","clientRect","setClientRect","hasDimensions","entries","el","isAnchorVisible","setIsOpen","prev","floatingTransitionCSS","FloatingStep","anchorPointerEnterTimeout","isStepOpen","wrappedHandlePrimary","args","wrappedHandleSecondary","handlePointerEnter","handlePointerLeave","pointerLeaveTimeout","resetOpenStep","isOpen","anchorContent","FormProvider","useController","useForm","useFormContext","ruleProps","FieldWrapper","FieldComponent","control","fieldData","submit","formContext","rules","controller","FormStep","fieldTypes","__readOnly","fieldDatas","field","data","isSubmitting","setIsSubmitting","fields","handleSubmit","onPrimarySubmit","RadioGroup","Error","error","Label","id","required","box","input","checkContainer","BaseField","fieldState","label","placeholder","fieldProps","RadioItem","forwardedRef","RadioField","onChange","options","radioItems","Select","ChevronDownMiniIcon","Checkbox","SelectMultipleField","valueArray","setValueArray","setValueInArray","updatedValueArray","SelectItem","SelectField","selectItems","TextField","TextareaField","CheckboxField","defaultFieldTypes","Form","mergedFieldTypes","childProps","Survey_exports","NPS","NPSField","positiveLabel","negativeLabel","buttons","option","Dialog","useFlow","defaultOptions","npsOptions","createPortal","useClientPortal","container","mounted","setMounted","containerRef","ClientPortal","pulse","Ping","clickable","hasMounted","setHasMounted","getPingPosition","pingOffset","oppositeSides","Hint","onMount","setInteralOpen","finalSide","finalAlign","referenceProps","isMounted","TourStep","TourWrapper","Tour","onDismiss","parentProps","sequential","zIndex","sequentialStepProps","tourSteps","currentStep","visible","handleDismissStep","shouldShowSpotlight","currentStepZIndex","nonSequentialStepProps","UseSyncExternalStoreShim","useSyncExternalStore","useCollections","frigade","setForceRender","debounceTimeout","subscribe","cb","handler","forceRender","getSnapshot","result","noGlobalStateYet","useCollection","collectionId","collections","collection","flowInCollection","item","Collection","variables","flowTypeMap","Announcement","currentFlow","FlowComponent","DefaultCollection","entry","logOnce","message","type","useFrigade","ImagePreloader","img","SDK_VERSION","Provider","defaultCollection","themeSelector","themeOverrides","registeredComponents","intervalRef","hasInitialized","setHasInitialized","currentModal","setCurrentModal","config","batchRegistration","batchedFlowIds","registerComponent","callback","unregisterComponent","navigateHandler","url","target","_event","updatedFlow","useFlowHandlers","onComplete","lastCompleted","callHandler","useCheckForModalCollision","isModal","claimLock","releaseLock","isDialog","autoStart","initialStepProps","forceMount","mergedProps","hasModalCollision","handleEscapeKeyDown","shouldForceMount","ContainerElement","FlowCard","Image","src","getVideoEmbedSrc","videoUri","Video","autoPlay","controls","controlsList","crossOrigin","disablePictureInPicture","disableRemotePlayback","loop","muted","playsInline","poster","preload","videoEmbedSrc","Media","onClick","RADIX_PROPS","mapDialogProps","contentProps","propEntry","rootProps","isObject","deepmerge","source","firstNonEmptyString","strings","str","ProgressBadge","derivedTitle","isClickable","Popover","Dot","getDotPosition","alignAttr","sideAttr","currentSide","dotProps","getCurrentAlign","dotOffset","currentAlign","mapTooltipPropsToPopoverProps","contentRect","mapToOriginalAlignValues","mapAlignOffsetToMargin","originalOffset","originalStyleProp","lengthOfCurrentSide","elem","Tooltip","contentNode","contentRef","anchorNode","anchorRect","anchorRef","setAlignAttr","setSideAttr","spotlightLeft","setSpotlightLeft","spotlightTop","setSpotlightTop","currentAlignAttr","currentSideAttr","anchorVirtualRef","scrollX","scrollY","anchorRadius","dotPosition","FrigadeJS","useUser","userId","addProperties","track","eventName","useGroup","groupId","setGroupId","FloatingUI"],"mappings":"kpCAAA,OAAS,aAAAA,OAAiB,iBAC1B,UAAYC,MAAiB,yBCQvB,cAAAC,OAAA,6BATC,SAASC,GAAUC,EAAsC,CAC9D,OACEF,GAAC,MAAAG,EAAAC,EAAA,CACC,MAAM,6BACN,QAAQ,YACR,KAAK,eACL,UAAU,UACNF,GALL,CAOC,SAAAF,GAAC,QAAK,EAAE,qLAAqL,GAC/L,CAEJ,CCZA,UAAYK,OAAW,QACvB,OAAS,QAAAC,OAAY,OCDrB,OAAOC,OAAS,uBCAT,IAAMC,GAAU,CACrB,aAAc,CACZ,GAAI,KACN,CACF,ECJA,IAAMC,GAAe,CAAC,EAAG,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,EAAE,EACjDC,GAAY,CAAC,GAAGD,EAAY,EAC5BE,GAAY,CAAC,GAAGF,EAAY,EAElCC,GAAU,CAAC,EAAI,GACfC,GAAU,CAAC,EAAI,GAEf,IAAMC,GAAO,CACX,KAAM,CACJ,EAAG,IACH,EAAG,IACH,EAAGH,EACL,EACA,KAAM,CACJ,EAAG,IACH,EAAG,GACH,E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{ Box } from '@/components/Box'\nimport { Button, ButtonProps } from '@/components/Button'\nimport { Card } from '@/components/Card'\nimport { Media, MediaProps } from '@/components/Media'\nimport { Text, TextProps } from '@/components/Text'\n\nimport { mapDialogProps } from './mapDialogProps'\n\nimport { theme } from '@/shared/theme'\nimport { BoxPropsWithoutChildren } from '@/components/Flow/FlowProps'\n\nconst fadeIn = keyframes`\n from {\n opacity: 0;\n }\n 25% {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n`\n\nexport interface DialogContentProps\n extends Pick<\n RadixDialog.DialogContentProps,\n | 'onOpenAutoFocus'\n | 'onCloseAutoFocus'\n | 'onEscapeKeyDown'\n | 'onPointerDownOutside'\n | 'onInteractOutside'\n > {}\n\nexport interface DialogRootProps extends RadixDialog.DialogProps {}\n\nexport interface DialogProps extends BoxPropsWithoutChildren, DialogRootProps, DialogContentProps {\n /**\n * The modality of the dialog. When set to `true`, interaction with outside elements will be disabled and only dialog content will be visible to screen readers.\n */\n modal?: boolean\n}\n\nexport function Dialog({ children, className, modal = true, ...props }: DialogProps) {\n const {\n rootProps,\n contentProps,\n otherProps: { zIndex, ...otherProps },\n } = mapDialogProps(props)\n\n return (\n <RadixDialog.Root defaultOpen={true} modal={modal} {...rootProps}>\n <RadixDialog.Portal>\n <Box\n animation={`${fadeIn} 300ms ease-out`}\n className={className}\n display=\"grid\"\n inset=\"0\"\n padding=\"6\"\n part=\"dialog-wrapper\"\n pointerEvents=\"none\"\n position=\"fixed\"\n zIndex={zIndex ?? 10}\n >\n {modal && (\n <RadixDialog.Overlay asChild>\n <Box\n background=\"rgb(0 0 0 / 0.5)\"\n inset=\"0\"\n part=\"dialog-overlay\"\n position=\"absolute\"\n />\n </RadixDialog.Overlay>\n )}\n <RadixDialog.Content\n asChild\n onOpenAutoFocus={(e) => e.preventDefault()}\n onPointerDownOutside={(e) => e.preventDefault()}\n onInteractOutside={(e) => e.preventDefault()}\n {...contentProps}\n >\n <Card\n alignSelf=\"center\"\n boxShadow=\"md\"\n justifySelf=\"center\"\n maxHeight=\"100%\"\n maxWidth=\"430px\"\n overflowY=\"auto\"\n padding={8}\n part=\"dialog\"\n pointerEvents=\"auto\"\n position=\"relative\"\n {...otherProps}\n >\n {children}\n </Card>\n </RadixDialog.Content>\n </Box>\n </RadixDialog.Portal>\n </RadixDialog.Root>\n )\n}\n\nDialog.Dismiss = (props: ButtonProps) => {\n return (\n <RadixDialog.Close aria-label=\"Close\" asChild>\n <Button.Plain part=\"close\" position=\"absolute\" right=\"2px\" top=\"2px\" {...props}>\n <XMarkIcon height=\"20\" 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 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 <Box\n as=\"circle\"\n key={i}\n r={4}\n cx={4 + 16 * i}\n cy=\"4px\"\n fill={current === i ? theme.colors.primary.surface : theme.colors.neutral['700']}\n part={current === i ? 'progress-dot-selected' : 'progress-dot'}\n />\n )\n })\n\n return (\n <Box\n as=\"svg\"\n height=\"8px\"\n marginInline=\"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.H4 part=\"title\" {...props}>\n {children}\n </Text.H4>\n </RadixDialog.Title>\n )\n}\n\nDialog.displayName = 'Dialog'\n","export function XMarkIcon(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className=\"size-5\"\n {...props}\n >\n <path d=\"M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z\" />\n </svg>\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)\n ? part\n .filter((p) => p != null)\n .map((p) => processPart(p))\n .join(' ')\n : 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.borderWidths, ...colorTokens },\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([\n 'active',\n 'disabled',\n 'focus',\n 'focusVisible',\n 'focusWithin',\n 'hover',\n])\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 borderWidths: {\n md: '1px',\n },\n}\n","const defaultScale = [5, 10, 20, 35, 50, 65, 80, 95, 98]\nconst coolScale = [...defaultScale]\nconst warmScale = [...defaultScale]\n\ncoolScale[4] = 40\nwarmScale[4] = 60\n\nconst hues = {\n blue: {\n h: 213,\n s: 100,\n l: defaultScale,\n },\n gray: {\n h: 220,\n s: 10,\n l: defaultScale,\n },\n green: {\n h: 141,\n s: 90,\n l: coolScale,\n },\n red: {\n h: 9,\n s: 90,\n l: warmScale,\n },\n yellow: {\n h: 50,\n s: 90,\n l: warmScale,\n },\n} as const\n\nexport const colorScaleDegrees = [\n '100',\n '200',\n '300',\n '400',\n '500',\n '600',\n '700',\n '800',\n '900',\n] as const\n\nexport type ColorNames = keyof typeof hues\nexport type ColorScaleDegrees = (typeof colorScaleDegrees)[number]\n\nexport type ScaledColors = {\n [K in ColorNames]: {\n [L in ColorScaleDegrees]: string\n }\n}\n\nconst scaledColors = {} as ScaledColors\n\nfor (const [name, { h, s, l: scale }] of Object.entries(hues)) {\n scaledColors[name] = Object.fromEntries(\n scale.map((l, i) => [`${(i + 1) * 100}`, `hsl(${h} ${s}% ${l}%)`])\n )\n}\n\nexport const palette = {\n black: 'hsl(0 0% 0%)',\n white: 'hsl(0 0% 100%)',\n\n ...(scaledColors as ScaledColors),\n\n // TEMP: Backwards compat for existing colors\n gray100: scaledColors.gray['100'],\n gray200: scaledColors.gray['200'],\n gray300: scaledColors.gray['300'],\n gray400: scaledColors.gray['400'],\n gray500: scaledColors.gray['500'],\n gray600: scaledColors.gray['600'],\n gray700: scaledColors.gray['700'],\n gray800: scaledColors.gray['800'],\n gray900: scaledColors.gray['900'],\n blue400: scaledColors.blue['400'],\n blue500: scaledColors.blue['500'],\n blue800: scaledColors.blue['800'],\n blue900: scaledColors.blue['900'],\n green400: scaledColors.green['400'],\n green500: scaledColors.green['500'],\n green800: scaledColors.green['800'],\n red500: scaledColors.red['500'],\n\n // TODO: Remove these, they were only needed when style props didn't have the ability to fall back to CSS values\n transparent: '#FFFFFF00',\n inherit: 'inherit',\n}\n","export const radii = {\n md: '8px',\n lg: '20px',\n round: '50%',\n}\n","import type { ColorScaleDegrees } from './palette'\n\nexport interface SemanticColorUsage {\n background: string\n border: string\n foreground: string\n surface: string\n}\n\nexport type SemanticColorScale = {\n [Degree in ColorScaleDegrees]: string\n}\n\nexport type SemanticColorIntent = 'negative' | 'neutral' | 'positive' | 'primary' | 'secondary'\n\nexport type SemanticColorState = 'active' | 'focus' | 'hover'\n\nexport type SemanticColor = SemanticColorScale &\n SemanticColorUsage & {\n [State in SemanticColorState]: {\n [Usage in keyof SemanticColorUsage]: string\n }\n }\n\nexport type SemanticColors = {\n [Intent in SemanticColorIntent]: SemanticColor\n}\n\nconst colorVar = (colorName: string) => `var(--fr-colors-${colorName})`\n\nexport const semantic: SemanticColors = {\n negative: {\n '100': colorVar('red-100'),\n '200': colorVar('red-200'),\n '300': colorVar('red-300'),\n '400': colorVar('red-400'),\n '500': colorVar('red-500'),\n '600': colorVar('red-600'),\n '700': colorVar('red-700'),\n '800': colorVar('red-800'),\n '900': colorVar('red-900'),\n\n background: colorVar('negative-500'),\n border: colorVar('negative-500'),\n foreground: colorVar('white'),\n surface: colorVar('negative-500'),\n\n active: {\n background: colorVar('negative-400'),\n border: colorVar('negative-400'),\n foreground: colorVar('white'),\n surface: colorVar('negative-400'),\n },\n focus: {\n background: colorVar('negative-500'),\n border: colorVar('negative-500'),\n foreground: colorVar('white'),\n surface: colorVar('negative-500'),\n },\n hover: {\n background: colorVar('negative-400'),\n border: colorVar('negative-400'),\n foreground: colorVar('white'),\n surface: colorVar('negative-400'),\n },\n },\n\n neutral: {\n '100': colorVar('gray-100'),\n '200': colorVar('gray-200'),\n '300': colorVar('gray-300'),\n '400': colorVar('gray-400'),\n '500': colorVar('gray-500'),\n '600': colorVar('gray-600'),\n '700': colorVar('gray-700'),\n '800': colorVar('gray-800'),\n '900': colorVar('gray-900'),\n\n background: colorVar('white'),\n border: colorVar('neutral-800'),\n foreground: colorVar('black'),\n surface: colorVar('neutral-700'),\n\n active: {\n background: colorVar('white'),\n border: colorVar('neutral-900'),\n foreground: colorVar('black'),\n surface: colorVar('neutral-700'),\n },\n focus: {\n background: colorVar('white'),\n border: colorVar('neutral-900'),\n foreground: colorVar('black'),\n surface: colorVar('neutral-700'),\n },\n hover: {\n background: colorVar('neutral-900'),\n border: colorVar('neutral-800'),\n foreground: colorVar('black'),\n surface: colorVar('neutral-700'),\n },\n },\n\n positive: {\n '100': colorVar('green-100'),\n '200': colorVar('green-200'),\n '300': colorVar('green-300'),\n '400': colorVar('green-400'),\n '500': colorVar('green-500'),\n '600': colorVar('green-600'),\n '700': colorVar('green-700'),\n '800': colorVar('green-800'),\n '900': colorVar('green-900'),\n\n background: colorVar('positive-500'),\n border: colorVar('positive-500'),\n foreground: colorVar('white'),\n surface: colorVar('positive-500'),\n\n active: {\n background: colorVar('positive-400'),\n border: colorVar('positive-400'),\n foreground: colorVar('white'),\n surface: colorVar('positive-400'),\n },\n focus: {\n background: colorVar('positive-500'),\n border: colorVar('positive-500'),\n foreground: colorVar('white'),\n surface: colorVar('positive-500'),\n },\n hover: {\n background: colorVar('positive-400'),\n border: colorVar('positive-400'),\n foreground: colorVar('white'),\n surface: colorVar('positive-400'),\n },\n },\n\n primary: {\n '100': colorVar('blue-100'),\n '200': colorVar('blue-200'),\n '300': colorVar('blue-300'),\n '400': colorVar('blue-400'),\n '500': colorVar('blue-500'),\n '600': colorVar('blue-600'),\n '700': colorVar('blue-700'),\n '800': colorVar('blue-800'),\n '900': colorVar('blue-900'),\n\n background: colorVar('primary-500'),\n border: colorVar('primary-500'),\n foreground: colorVar('white'),\n surface: colorVar('primary-500'),\n\n active: {\n background: colorVar('primary-300'),\n border: colorVar('primary-300'),\n foreground: colorVar('white'),\n surface: colorVar('primary-300'),\n },\n focus: {\n background: colorVar('primary-500'),\n border: colorVar('primary-500'),\n foreground: colorVar('white'),\n surface: colorVar('primary-500'),\n },\n hover: {\n background: colorVar('primary-400'),\n border: colorVar('primary-400'),\n foreground: colorVar('white'),\n surface: colorVar('primary-400'),\n },\n },\n\n secondary: {\n '100': colorVar('gray-100'),\n '200': colorVar('gray-200'),\n '300': colorVar('gray-300'),\n '400': colorVar('gray-400'),\n '500': colorVar('gray-500'),\n '600': colorVar('gray-600'),\n '700': colorVar('gray-700'),\n '800': colorVar('gray-800'),\n '900': colorVar('gray-900'),\n\n background: colorVar('white'),\n border: colorVar('secondary-800'),\n foreground: colorVar('black'),\n surface: colorVar('secondary-900'),\n\n active: {\n background: colorVar('secondary-900'),\n border: colorVar('secondary-800'),\n foreground: colorVar('black'),\n surface: colorVar('secondary-800'),\n },\n focus: {\n background: colorVar('secondary-900'),\n border: colorVar('secondary-800'),\n foreground: colorVar('black'),\n surface: colorVar('secondary-900'),\n },\n hover: {\n background: colorVar('secondary-900'),\n border: colorVar('secondary-800'),\n foreground: colorVar('black'),\n surface: colorVar('secondary-800'),\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 '@/shared/tokens'\nimport { flattenObject } from '@/shared/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 const flattenedTokens = flattenObject(tokens, '--fr', '-')\n\n for (const [key, value] of Object.entries(flattenedTokens)) {\n if (key.indexOf('.') > -1) {\n const cssSafeKey = key.replace(/\\./g, '-')\n\n flattenedTokens[cssSafeKey] = value\n delete flattenedTokens[key]\n }\n }\n\n return flattenedTokens\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 const cssSafeKey = key.replace(/\\./g, '-')\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}-${cssSafeKey})`\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 // Remove null / undefined style props\n if (propValue == null) {\n delete unmatchedProps[fullPropName]\n }\n\n // Split space-separated values out and process them individually\n else 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 'strong',\n 'i',\n 'em',\n 'a',\n 'span',\n 'div',\n 'p',\n 'pre',\n 's',\n 'u',\n 'br',\n 'img',\n 'code',\n 'li',\n 'ol',\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 'p',\n 'style',\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 'playsinline',\n ],\n }),\n }\n}\n","import { Box, type BoxProps } from '@/components/Box'\nimport { Text } from '@/components/Text'\n\nimport * as styles from './Button.styles'\nimport { loadingCSSStyle } from './Button.styles'\n\nexport type ButtonVariant = 'Primary' | 'Secondary' | 'Link' | 'Plain'\n\nexport interface ButtonProps extends BoxProps {\n title?: string\n variant?: ButtonVariant\n loading?: boolean\n}\n\nfunction BaseButton({ as, children, part, title, variant = 'Primary', ...props }: ButtonProps) {\n const variantPart = variant.toLocaleLowerCase()\n\n return (\n <Box\n as={as ?? 'button'}\n part={[`button-${variantPart}`, part]}\n {...styles[variant]}\n css={{\n ...(props.css ?? {}),\n ...(props.loading ? loadingCSSStyle : {}),\n }}\n {...props}\n loading={undefined}\n >\n {children}\n {title && (\n <Text.Body2\n color=\"inherit\"\n css={{\n WebkitFontSmoothing: 'antialiased',\n MozOsxFontSmoothing: 'grayscale',\n }}\n flexGrow=\"1\"\n fontWeight=\"medium\"\n lineHeight=\"20px\"\n part=\"button-title\"\n textWrap=\"nowrap\"\n >\n {title}\n </Text.Body2>\n )}\n </Box>\n )\n}\n\nexport function Primary({ children, ...props }: ButtonProps) {\n return (\n <BaseButton {...props} variant=\"Primary\">\n {children}\n </BaseButton>\n )\n}\n\nexport function Secondary({ children, ...props }: ButtonProps) {\n return (\n <BaseButton {...props} variant=\"Secondary\">\n {children}\n </BaseButton>\n )\n}\n\nexport function Link({ children, ...props }: ButtonProps) {\n return (\n <BaseButton {...props} variant=\"Link\">\n {children}\n </BaseButton>\n )\n}\n\nexport function Plain({ children, ...props }: ButtonProps) {\n return (\n <BaseButton {...props} variant=\"Plain\">\n {children}\n </BaseButton>\n )\n}\n","import * as React from 'react'\n\nimport { Box, type BoxProps } from '@/components/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: 'demibold',\n lineHeight: '2xl',\n}\n\nexport const H2 = {\n ...base,\n fontSize: '2xl',\n fontWeight: 'demibold',\n lineHeight: 'xl',\n}\n\nexport const H3 = {\n ...base,\n fontSize: 'xl',\n fontWeight: 'demibold',\n lineHeight: 'lg',\n}\n\nexport const H4 = {\n ...base,\n fontSize: 'md',\n fontWeight: 'demibold',\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: 'sm',\n}\n\nexport const Caption = {\n ...base,\n fontSize: 'xs',\n fontWeight: 'regular',\n lineHeight: 'xs',\n}\n","import { keyframes } from '@emotion/react'\n\nconst base = {\n alignItems: 'center',\n borderWidth: 'md',\n borderRadius: 'md',\n borderStyle: 'solid',\n 'cursor:disabled': 'not-allowed',\n display: 'flex',\n gap: '2',\n padding: '2 4',\n fontFamily: 'inherit',\n\n 'opacity:disabled': '0.6',\n 'pointerEvents:disabled': 'none',\n}\n\nexport const Primary = {\n ...base,\n backgroundColor: 'primary.surface',\n borderColor: 'primary.border',\n color: 'primary.foreground',\n\n 'backgroundColor:hover': 'primary.hover.surface',\n 'backgroundColor:active': 'primary.active.surface',\n 'backgroundColor:disabled': 'primary.surface',\n}\n\nexport const Secondary = {\n ...base,\n\n backgroundColor: 'secondary.background',\n borderColor: 'secondary.border',\n color: 'secondary.foreground',\n\n 'backgroundColor:hover': 'secondary.hover.background',\n 'backgroundColor:active': 'secondary.active.surface',\n 'backgroundColor:disabled': 'secondary.background',\n}\n\nexport const Link = {\n ...base,\n\n backgroundColor: 'transparent',\n borderColor: 'transparent',\n color: 'primary.surface',\n\n 'color:hover': 'primary.hover.surface',\n 'color:active': 'primary.active.surface',\n}\n\nexport const Plain = {\n ...base,\n\n backgroundColor: 'transparent',\n borderColor: 'transparent',\n color: 'neutral.foreground',\n}\n\nconst rotate = keyframes({\n from: {\n transform: 'rotate(0turn)',\n },\n to: {\n transform: 'rotate(1turn)',\n },\n})\n\nexport const loadingCSSStyle = {\n position: 'relative',\n color: 'transparent',\n '&:after': {\n content: '\"\"',\n position: 'absolute',\n width: '16px',\n height: '16px',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n margin: 'auto',\n border: '4px solid transparent',\n borderTopColor: 'var(--fr-colors-primary-foreground)',\n borderRadius: '50%',\n animation: rotate + ' 1s ease infinite',\n },\n}\n","import type { ForwardRefExoticComponent, RefAttributes } from 'react'\nimport * as React from 'react'\nimport type { JSX } from '@emotion/react/jsx-runtime'\n\nimport type { BoxProps } from '@/components/Box'\nimport { Button, type ButtonProps } from '@/components/Button'\nimport { Flex } from '@/components/Flex'\nimport { type FlowPropsWithoutChildren } from '@/components/Flow'\nimport { FlowCard } from './FlowCard'\nimport { Media, type MediaProps } from '@/components/Media'\nimport { Text, type TextProps } from '@/components/Text'\n\nimport type { DismissHandler } from '@/hooks/useFlowHandlers'\nimport { XMarkIcon } from '@/components/Icon/XMarkIcon'\n\nexport interface CardHeaderProps extends BoxProps {\n dismissible?: boolean\n handleDismiss?: DismissHandler\n subtitle?: string\n title?: string\n}\n\nexport interface CardComponent\n extends ForwardRefExoticComponent<\n Omit<FlowPropsWithoutChildren, 'ref'> & RefAttributes<unknown>\n > {\n Dismiss: (props: ButtonProps) => JSX.Element\n Header: (props: CardHeaderProps) => JSX.Element\n Footer: (props: BoxProps) => JSX.Element\n Media: (props: MediaProps) => JSX.Element\n Primary: (props: ButtonProps) => JSX.Element\n Secondary: (props: ButtonProps) => JSX.Element\n Subtitle: (props: TextProps) => JSX.Element\n Title: (props: TextProps) => JSX.Element\n}\n\nexport interface CardProps extends FlowPropsWithoutChildren {\n children: React.ReactNode\n}\n\nexport const Card = React.forwardRef(({ children, flowId, part, ...props }: CardProps, ref) => {\n // If props.flowId is set, render FlowCard instead\n if (flowId != null) {\n return <FlowCard flowId={flowId} {...props} />\n }\n\n const Component = props.as ?? Flex.Column\n return (\n <Component\n backgroundColor=\"neutral.background\"\n borderColor=\"neutral.border\"\n borderStyle=\"solid\"\n borderRadius=\"md\"\n borderWidth=\"0\"\n gap={5}\n p={5}\n part={['card', part]}\n {...props}\n ref={ref}\n >\n {children}\n </Component>\n )\n}) as CardComponent\n\nCard.Dismiss = (props: ButtonProps) => {\n return (\n <Button.Plain aria-label=\"Dismiss\" part=\"dismiss\" padding={0} {...props}>\n <XMarkIcon height=\"20\" fill=\"currentColor\" />\n </Button.Plain>\n )\n}\n\nCard.Footer = ({ children, part, ...props }: BoxProps) => {\n return (\n <Flex.Row\n alignItems=\"center\"\n gap={3}\n justifyContent=\"flex-end\"\n part={['card-footer', part]}\n {...props}\n >\n {children}\n </Flex.Row>\n )\n}\n\nCard.Header = ({ dismissible, handleDismiss, part, subtitle, title, ...props }) => {\n if (\n !dismissible &&\n (title == null || title?.length === 0) &&\n (subtitle == null || subtitle?.length === 0)\n ) {\n return null\n }\n\n return (\n <Flex.Row\n alignItems=\"flex-start\"\n flexWrap=\"wrap\"\n gap={1}\n part={['card-header', part]}\n {...props}\n >\n <Card.Title maxWidth=\"calc(100% - 32px)\">{title}</Card.Title>\n {dismissible && <Card.Dismiss onClick={handleDismiss} marginLeft=\"auto\" />}\n <Card.Subtitle color=\"neutral.400\" flexBasis=\"100%\">\n {subtitle}\n </Card.Subtitle>\n </Flex.Row>\n )\n}\n\nCard.Media = ({ src, ...props }: MediaProps) => {\n if (src == null || src?.length === 0) return null\n\n return <Media borderRadius=\"md\" src={src} {...props} />\n}\n\nCard.Primary = ({ onClick, title, ...props }: ButtonProps) => {\n if (title == null || title?.length === 0) return null\n\n return <Button.Primary title={title} onClick={onClick} {...props} />\n}\n\nCard.Secondary = ({ onClick, title, ...props }: ButtonProps) => {\n if (title == null || title?.length === 0) return null\n\n return <Button.Secondary title={title} onClick={onClick} {...props} />\n}\n\nCard.Subtitle = ({ children, part, ...props }: TextProps) => {\n if (children == null) return null\n\n return (\n <Text.Body2 display=\"block\" color=\"neutral.400\" part={['subtitle', part]} {...props}>\n {children}\n </Text.Body2>\n )\n}\n\nCard.Title = ({ children, part, ...props }: TextProps) => {\n if (children == null) return null\n\n return (\n <Text.H4 display=\"block\" part={['title', part]} {...props}>\n {children}\n </Text.H4>\n )\n}\n","import * as React from 'react'\nimport { Box, BoxProps } from '@/components/Box'\n\nexport const Row = React.forwardRef((props: BoxProps, ref) => (\n <Box display=\"flex\" flexDirection=\"row\" {...props} ref={ref} />\n))\n\nexport const Column = React.forwardRef((props: BoxProps, ref) => (\n <Box display=\"flex\" flexDirection=\"column\" {...props} ref={ref} />\n))\n","import { Fragment } from 'react'\nimport { FlowType } from '@frigade/js'\n\nimport { Box } from '@/components/Box'\n\nimport { useFlow } from '@/hooks/useFlow'\nimport { useFlowHandlers } from '@/hooks/useFlowHandlers'\nimport { useStepHandlers } from '@/hooks/useStepHandlers'\nimport { useCheckForModalCollision } from '@/hooks/useModal'\n\nimport type { FlowProps } from '@/components/Flow/FlowProps'\nimport { getVideoProps } from '@/components/Media/videoProps'\n// import { FrigadeContext } from '@/components/Provider'\n\nexport type {\n FlowChildrenProps,\n FlowProps,\n FlowPropsWithoutChildren,\n} from '@/components/Flow/FlowProps'\n\nfunction isDialog(component) {\n return typeof component === 'function' && component.displayName === 'Dialog'\n}\n\nexport function Flow({\n as,\n autoStart = true,\n children,\n flowId,\n onComplete,\n onDismiss,\n onPrimary,\n onSecondary,\n variables,\n ...props\n}: FlowProps) {\n // const [hasProcessedRules, setHasProcessedRules] = useState(false)\n\n const { flow } = useFlow(flowId, {\n variables,\n })\n\n const step = flow?.getCurrentStep()\n\n const initialStepProps = step?.props ?? {}\n\n // Discard video props when merging step props onto top-level container\n const { otherProps: stepProps } = getVideoProps(initialStepProps)\n\n const {\n dismissible = isDialog(as) ? true : false,\n forceMount = false,\n ...mergedProps\n } = {\n ...props,\n ...(flow?.props ?? {}),\n ...(flow?.rawData?.flowType === FlowType.CHECKLIST ? {} : stepProps),\n }\n\n // const { hasInitialized, registerComponent, unregisterComponent } = useContext(FrigadeContext)\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 isModal =\n mergedProps?.modal ||\n isDialog(as) ||\n [FlowType.ANNOUNCEMENT, FlowType.TOUR].includes(flow?.rawData?.flowType)\n\n const { hasModalCollision } = useCheckForModalCollision(flow, isModal)\n\n function handleEscapeKeyDown(e) {\n if (dismissible === false) {\n e.preventDefault()\n return\n }\n\n if (typeof props.onEscapeKeyDown === 'function') {\n props.onEscapeKeyDown(e)\n }\n\n if (!e.defaultPrevented) {\n handleDismiss(e)\n }\n }\n\n // useEffect(() => {\n // return () => {\n // unregisterComponent(flowId)\n // }\n // }, [])\n\n // useEffect(() => {\n // if (flow?.isCompleted || flow?.isSkipped) {\n // unregisterComponent(flowId)\n // }\n // }, [flow?.isCompleted, flow?.isSkipped])\n\n const shouldForceMount = forceMount && (flow?.isCompleted || flow?.isSkipped)\n\n if (!flow) {\n return null\n }\n\n // registerComponent(flowId, () => {\n // if (!hasProcessedRules) {\n // setHasProcessedRules(true)\n // }\n // })\n\n if ((!flow.isVisible || hasModalCollision) && !shouldForceMount) {\n return null\n }\n\n // if (!hasInitialized || !hasProcessedRules) {\n // return null\n // }\n\n if (shouldForceMount || (!flow.isCompleted && !flow.isSkipped && autoStart)) {\n step?.start()\n }\n\n const ContainerElement = as === null ? Fragment : as ?? Box\n\n const containerProps: Record<string, unknown> = {\n ...mergedProps,\n 'data-flow-id': flow.id,\n }\n\n if (isDialog(as)) {\n containerProps.onEscapeKeyDown = handleEscapeKeyDown\n }\n\n return (\n <ContainerElement {...(as === null ? {} : containerProps)}>\n {children({\n flow,\n handleDismiss,\n handlePrimary,\n handleSecondary,\n parentProps: {\n as,\n dismissible,\n flowId,\n variables,\n containerProps,\n },\n step,\n })}\n </ContainerElement>\n )\n}\n","import { FlowChangeEvent, type Flow } from '@frigade/js'\nimport { useCallback, useContext, useEffect, useState } from 'react'\n\nimport { FrigadeContext } from '@/components/Provider'\nimport { useSyncExternalStore } from '@/hooks/useSyncExternalStore'\nimport { logOnce } from '@/shared/log'\n\nexport interface FlowConfig {\n variables?: Record<string, unknown>\n}\n\nexport function useFlow(\n flowId: string | null,\n config?: FlowConfig\n): {\n flow: Flow | undefined\n isLoading: boolean\n} {\n const context = useContext(FrigadeContext)\n if (!context || !context.frigade) {\n logOnce(`useFlow('${flowId}') must be used in a child of the Frigade Provider`, 'warn')\n }\n const { frigade, variables } = context ?? {}\n const [, setForceRender] = useState<boolean>(false)\n\n const subscribe = useCallback(\n (cb: () => void) => {\n // TODO: Why is there a noticeable delay when this is commented out?\n frigade?.getFlow(flowId).then(() => {\n cb()\n })\n\n const handler = (_event: FlowChangeEvent, updatedFlow: Flow) => {\n if (updatedFlow.id !== flowId) {\n return\n }\n\n /*\n * NOTE: Since React doesn't re-render on deep object diffs,\n * we need to gently prod it here by creating a state update.\n */\n setTimeout(() => {\n setForceRender((forceRender) => !forceRender)\n\n cb()\n }, 0)\n }\n\n frigade?.on('flow.any', handler)\n\n return () => {\n frigade?.off('flow.any', handler)\n }\n },\n [flowId, frigade]\n )\n\n const flow = useSyncExternalStore<Flow | undefined>(\n subscribe,\n () => frigade?.getFlowSync(flowId),\n () => frigade?.getFlowSync(flowId)\n )\n\n useEffect(() => {\n flow?.applyVariables({\n ...variables,\n ...config?.variables,\n })\n }, [config?.variables, flow, flowId, variables])\n\n return {\n flow,\n isLoading: frigade?.hasFailedToLoad() ? false : !flow,\n }\n}\n","import {\n CollectionsRegistryBatch,\n type CollectionsRegistryCallback,\n type Flow,\n Frigade,\n FrigadeConfig,\n PropertyPayload,\n StatefulFlow,\n} from '@frigade/js'\nimport { useEffect, useMemo, useRef, useState } from 'react'\nimport { Global, ThemeProvider } from '@emotion/react'\n\nimport { DefaultCollection } from '@/components/Provider/DefaultCollection'\n\nimport {\n createThemeVariables,\n theme as themeTokens,\n type Theme,\n themeVariables,\n} from '@/shared/theme'\n\nimport { FrigadeContext } from './FrigadeContext'\nimport { ImagePreloader } from '@/components/Provider/ImagePreloader'\nimport { SDK_VERSION } from '@/version'\n\nexport type NavigateHandler = (url: string, target?: string) => void\nexport type RegisteredComponents = Map<\n string,\n {\n callback?: CollectionsRegistryCallback\n }\n>\n\n// TODO: type theme something like Partial<typeof themeTokens>, but allow any value for those keys\nexport interface ProviderProps {\n /**\n * Your public API key from the Frigade dashboard. Do not ever use your private API key here.\n */\n apiKey: string\n\n /**\n * The URL prefix of the API to use. By default, Frigade will use the production API: https://api.frigade.com/v1/public\n */\n apiUrl?: string\n\n children?: React.ReactNode\n\n /**\n * Global CSS properties to attach to the :root element.\n * @see https://emotion.sh/docs/css-prop#object-styles\n */\n css?: Record<string, unknown>\n\n /**\n * By default, Frigade.Provider will render a built-in Collection to allow no-code deploys of Announcements and other floating Components. Set this to `false` if you want to manually control the rendering of the default Collection.\n */\n defaultCollection?: boolean\n\n /**\n * Whether to generate a Guest ID and session if no userId is provided at render time.\n * If set to false, Frigade will not initialize or render any Flows until a userId is provided.\n * Defaults to true.\n */\n generateGuestId?: boolean\n\n /**\n * Whether to sync state with Frigade on URL or focus change. Defaults to true.\n */\n syncOnWindowUpdates?: boolean\n\n /**\n * The group ID to use for this context (optional).\n */\n groupId?: string\n\n /**\n * Optional group properties to attach to the groupId on initialization.\n */\n groupProperties?: PropertyPayload\n\n /**\n * A function to handle navigation. By default, Frigade will use `window.open` if not provided.\n * https://docs.frigade.com/v2/sdk/navigation\n */\n navigate?: NavigateHandler\n\n /**\n * The global theme to use across components. See docs on styling: https://docs.frigade.com/v2/sdk/styling/theming\n */\n theme?: Theme\n\n /**\n * CSS selector to scope Frigade CSS variables into. Defaults to `:root`.\n */\n themeSelector?: string\n\n /**\n * The user ID of the user who is interacting with Frigade. If not provided, Frigade will generate a random guest ID and persist it in local storage.\n */\n userId?: string\n\n /**\n * Optional user properties to attach to the userId on initialization.\n */\n userProperties?: PropertyPayload\n\n /**\n * Whether to preload images in Flows. Defaults to true.\n */\n preloadImages?: boolean\n\n /**\n * Global variables to apply to all Flows, including Collections.\n * If the individual Collection or Flow has its own variables, the two objects will be merged, with the Flow/Collection having high priority.\n * Example:\n * ```tsx\n * variables={{\n * name: \"Bobby Nerves\",\n * occupation: \"Vocalist\",\n * }}\n * ```\n * This prop can conveniently be used to pass entire i18n objects as well, which will allow all Flows to access i18n strings as needed.\n */\n variables?: Record<string, unknown>\n\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 State for all flows in the app that should be mocked.\n */\n __flowStateOverrides?: Record<string, StatefulFlow>\n}\n\nexport function Provider({\n children,\n css = {},\n defaultCollection = true,\n navigate,\n theme,\n themeSelector = ':root',\n ...props\n}: ProviderProps) {\n const themeOverrides = theme ? createThemeVariables(theme) : {}\n const registeredComponents = useRef<RegisteredComponents>(new Map())\n const intervalRef = useRef<NodeJS.Timeout>()\n const [hasInitialized, setHasInitialized] = useState(false)\n const [currentModal, setCurrentModal] = useState<string | null>(null)\n\n const frigade = useMemo<Frigade>(() => {\n setHasInitialized(false)\n intervalRef.current = undefined\n\n return new Frigade(props.apiKey, {\n apiKey: props.apiKey,\n apiUrl: props.apiUrl,\n userId: props.userId,\n groupId: props.groupId,\n userProperties: props.userProperties,\n groupProperties: props.groupProperties,\n generateGuestId: props.generateGuestId,\n syncOnWindowUpdates: props.syncOnWindowUpdates,\n __readOnly: props.__readOnly,\n __flowStateOverrides: props.__flowStateOverrides,\n __platformVersion: SDK_VERSION,\n __platformName: 'React',\n } as FrigadeConfig)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [props.userId, props.groupId, props.apiKey])\n\n useEffect(() => {\n if (props.__flowStateOverrides) {\n const config = frigade.getConfig()\n config.__flowStateOverrides = props.__flowStateOverrides\n frigade.reload(config)\n }\n }, [frigade, props.__flowStateOverrides])\n\n function batchRegistration() {\n const batchedFlowIds = [...registeredComponents.current.entries()].map(([flowId, options]) => [\n flowId,\n options.callback,\n ]) as CollectionsRegistryBatch\n\n frigade.batchRegister(batchedFlowIds)\n\n setHasInitialized(true)\n }\n\n function registerComponent(flowId: string, callback?: CollectionsRegistryCallback) {\n if (intervalRef.current) {\n clearTimeout(intervalRef.current)\n }\n\n if (hasInitialized) {\n if (!registeredComponents.current.has(flowId)) {\n frigade.getFlow(flowId).then((flow: Flow) => flow.register(callback))\n\n registeredComponents.current.set(flowId, {\n callback: callback,\n })\n } else {\n // If component is already registered, fire its callback to let the downstream consumer know its current state\n frigade.getFlow(flowId).then((flow: Flow) => callback(flow.isVisible))\n }\n\n return\n }\n\n if (!registeredComponents.current.has(flowId)) {\n registeredComponents.current.set(flowId, {\n callback,\n })\n }\n\n if (intervalRef.current) {\n clearTimeout(intervalRef.current)\n }\n\n intervalRef.current = setTimeout(() => batchRegistration(), 0)\n }\n\n function unregisterComponent(flowId: string) {\n if (registeredComponents.current.has(flowId)) {\n frigade.getFlow(flowId).then((flow: Flow) => {\n registeredComponents.current.delete(flowId)\n flow?.unregister()\n })\n }\n }\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 }, [frigade])\n\n return (\n <FrigadeContext.Provider\n value={{\n currentModal,\n setCurrentModal,\n navigate: navigateHandler,\n ...props,\n frigade: frigade,\n registerComponent,\n unregisterComponent,\n hasInitialized,\n variables: props.variables || {},\n }}\n >\n <Global styles={{ [themeSelector]: { ...themeVariables, ...themeOverrides, ...css } }} />\n <ThemeProvider theme={themeTokens}>\n {defaultCollection && <DefaultCollection />}\n {children}\n </ThemeProvider>\n {props.preloadImages !== false && <ImagePreloader />}\n </FrigadeContext.Provider>\n )\n}\n","import { Card } from '@/components/Card'\nimport { Flex } from '@/components/Flex'\nimport { Flow, type FlowPropsWithoutChildren } from '@/components/Flow'\nimport { Box } from '@/components/Box'\n\nexport interface BannerProps extends FlowPropsWithoutChildren {}\n\nexport function Banner({ flowId, ...props }: BannerProps) {\n return (\n <Flow as={null} flowId={flowId} {...props}>\n {({\n handleDismiss,\n handlePrimary,\n handleSecondary,\n parentProps: { containerProps, dismissible },\n step,\n }) => {\n const primaryButtonTitle = step.primaryButton?.title ?? step.primaryButtonTitle\n const secondaryButtonTitle = step.secondaryButton?.title ?? step.secondaryButtonTitle\n\n const disabled = step.$state.blocked\n\n return (\n <Card\n alignItems=\"center\"\n aria-label=\"Banner\"\n borderWidth=\"md\"\n data-step-id={step.id}\n display=\"flex\"\n flexDirection=\"row\"\n gap={3}\n justifyContent=\"flex-start\"\n part=\"banner\"\n role=\"complementary\"\n {...containerProps}\n >\n {step.imageUri && (\n <Box\n as=\"img\"\n part=\"image\"\n src={step.imageUri}\n style={{ height: 40, width: 40, alignSelf: 'center' }}\n />\n )}\n\n <Flex.Column marginInlineEnd=\"auto\" part=\"banner-title-wrapper\">\n <Card.Title part=\"title\">{step.title}</Card.Title>\n <Card.Subtitle part=\"subtitle\">{step.subtitle}</Card.Subtitle>\n </Flex.Column>\n\n <Card.Secondary\n disabled={disabled}\n title={secondaryButtonTitle}\n onClick={handleSecondary}\n />\n <Card.Primary disabled={disabled} title={primaryButtonTitle} onClick={handlePrimary} />\n {dismissible && <Card.Dismiss onClick={handleDismiss} />}\n </Card>\n )\n }}\n </Flow>\n )\n}\n","export { Carousel } from './Carousel'\nexport { Collapsible, type CollapsibleProps, type CollapsibleStepProps } from './Collapsible'\n// eslint-disable-next-line react-refresh/only-export-components\nexport * as CollapsibleStep from './CollapsibleStep'\nexport { Floating } from './Floating'\n","import { useEffect, useLayoutEffect, useState } from 'react'\nimport { keyframes } from '@emotion/react'\nimport useEmblaCarousel from 'embla-carousel-react'\nimport type { EmblaOptionsType } from 'embla-carousel'\n\nimport { Box } from '@/components/Box'\nimport { Button } from '@/components/Button'\nimport { Flex } from '@/components/Flex'\nimport type { FlowChildrenProps } from '@/components/Flow'\nimport * as Progress from '@/components/Progress'\nimport { Text } from '@/components/Text'\n\nimport { CarouselStep } from '@/components/Checklist/CarouselStep'\n\nimport { theme } from '@/shared/theme'\nimport { CarouselProps } from '@/components/Checklist/Carousel'\nimport { ArrowRightIcon } from '@/components/Icon/ArrowRightIcon'\nimport { ArrowLeftIcon } from '@/components/Icon/ArrowLeftIcon'\n\nconst fadeIn = keyframes`\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n`\n\nexport function CarouselEmblaWrapper({\n flow,\n sort,\n onPrimary,\n onSecondary,\n}: FlowChildrenProps & CarouselProps) {\n const [stepOrder, setStepOrder] = useState<string[]>()\n\n const [emblaOptions] = useState<Partial<EmblaOptionsType>>({\n align: 'start',\n container: '.fr-carousel-content',\n skipSnaps: true,\n slides: '.fr-carousel-step',\n startIndex:\n sort == 'completed-last'\n ? 0\n : Array.from(flow.steps.values()).find(\n (step) => !step.$state.completed && !step.$state.skipped\n )?.order ?? 0,\n })\n\n const [emblaRef, emblaApi] = useEmblaCarousel(emblaOptions)\n\n const [hasNext, setHasNext] = useState<boolean>()\n const [hasPrev, setHasPrev] = useState<boolean>()\n\n useLayoutEffect(() => {\n if (!emblaApi) {\n return\n }\n\n if (hasNext == null) {\n setHasNext(emblaApi.canScrollNext())\n }\n\n if (hasPrev == null) {\n setHasPrev(emblaApi.canScrollPrev())\n }\n\n emblaApi.on('select', () => {\n setHasNext(emblaApi.canScrollNext())\n setHasPrev(emblaApi.canScrollPrev())\n })\n }, [emblaApi, hasNext, hasPrev])\n\n useEffect(() => {\n // check if hasCompletedInitialSort. If not then sort the steps from not completed not skipped to completed/skipped\n if (!stepOrder) {\n const steps = Array.from(flow.steps.values())\n const completedOrSkippedSteps = steps\n .filter((step) => step.$state.completed || step.$state.skipped)\n .sort((a, b) => a.order - b.order)\n\n const nonCompletedOrSkippedSteps = steps\n .filter((step) => !step.$state.completed && !step.$state.skipped)\n .sort((a, b) => a.order - b.order)\n\n if (sort === 'completed-last') {\n setStepOrder(\n [...nonCompletedOrSkippedSteps, ...completedOrSkippedSteps].map((step) => step.id)\n )\n } else {\n setStepOrder(steps.map((step) => step.id))\n }\n }\n }, [flow.steps, sort, stepOrder])\n\n const completedSteps = flow.getNumberOfCompletedSteps()\n const availableSteps = flow.getNumberOfAvailableSteps()\n\n if (!stepOrder) {\n return null\n }\n\n return (\n <>\n <Flex.Row\n css={{\n '@container (max-width: 750px)': {\n flexDirection: 'column',\n gap: theme.space[5],\n },\n }}\n justifyContent=\"space-between\"\n part=\"carousel-header\"\n >\n <Flex.Column part=\"carousel-header-content\">\n <Text.H3>{flow.title}</Text.H3>\n <Text.Body2 color=\"neutral.400\">{flow.subtitle}</Text.Body2>\n </Flex.Column>\n <Flex.Row alignItems=\"center\" gap={2} part=\"progress\">\n <Text.Body2 fontWeight=\"demibold\" part=\"progress-text\">\n {completedSteps}/{availableSteps}\n </Text.Body2>\n <Progress.Bar current={completedSteps} total={availableSteps} minWidth=\"200px\" />\n </Flex.Row>\n </Flex.Row>\n\n <Box\n margin={`0 ${theme.space[-4]}`}\n overflow=\"hidden\"\n part=\"carousel-wrapper\"\n px=\"4\"\n position=\"relative\"\n ref={emblaRef}\n >\n <Flex.Row gap={4} part=\"carousel-content\">\n {Array.from(flow.steps.values())\n .filter((step) => step.$state.visible)\n .sort((a, b) => stepOrder.indexOf(a.id) - stepOrder.indexOf(b.id))\n .map((step) => (\n <CarouselStep\n key={step.id}\n onPrimary={onPrimary}\n onSecondary={onSecondary}\n step={step}\n />\n ))}\n </Flex.Row>\n\n {hasPrev && (\n <Flex.Column\n animation={`${fadeIn} 300ms ease-out`}\n background=\"linear-gradient(to right, rgba(255, 255, 255, 0.5), transparent 50%)\"\n bottom=\"0\"\n left=\"0\"\n justifyContent=\"center\"\n paddingLeft=\"3\"\n part=\"carousel-prev-wrapper\"\n position=\"absolute\"\n top=\"0\"\n >\n <Button.Plain\n border=\"1px solid neutral.border\"\n borderRadius=\"100%\"\n boxShadow=\"md\"\n backgroundColor=\"neutral.background\"\n color=\"primary.surface\"\n onClick={() => emblaApi.scrollPrev()}\n padding=\"2\"\n >\n <ArrowLeftIcon height=\"24px\" width=\"24px\" />\n </Button.Plain>\n </Flex.Column>\n )}\n\n {hasNext && (\n <Flex.Column\n animation={`${fadeIn} 300ms ease-out`}\n background=\"linear-gradient(to left, rgba(255, 255, 255, 0.5), transparent 50%)\"\n bottom=\"0\"\n justifyContent=\"center\"\n paddingRight=\"3\"\n part=\"carousel-next-wrapper\"\n position=\"absolute\"\n right=\"0\"\n top=\"0\"\n >\n <Button.Plain\n border=\"1px solid neutral.border\"\n borderRadius=\"100%\"\n boxShadow=\"md\"\n backgroundColor=\"neutral.background\"\n color=\"primary.surface\"\n onClick={() => emblaApi.scrollNext()}\n padding=\"2\"\n >\n <ArrowRightIcon height=\"24px\" width=\"24px\" />\n </Button.Plain>\n </Flex.Column>\n )}\n </Box>\n </>\n )\n}\n","export { Bar } from './Bar'\nexport { Dots } from './Dots'\nexport { Fraction } from './Fraction'\nexport { Ring } from './Ring'\nexport { Segments } from './Segments'\nexport type { ProgressProps } from './ProgressProps'\n","import { Box } from '@/components/Box'\n\nimport type { ProgressProps } from './ProgressProps'\n\nexport function Bar({ current, total, ...props }: ProgressProps) {\n const progressPercent = total > 0 ? Math.min(current / total, 1) : 0\n\n const barWidth = progressPercent === 0 ? '10px' : `${100 * progressPercent}%`\n\n return (\n <Box\n aria-description=\"Progress represented as a bar\"\n aria-label=\"Progress Bar\"\n aria-valuemin=\"0\"\n aria-valuemax={total}\n aria-valuenow={current}\n backgroundColor=\"neutral.800\"\n borderRadius=\"md\"\n height=\"10px\"\n part=\"progress-bar\"\n role=\"meter\"\n {...props}\n >\n <Box\n backgroundColor=\"primary.surface\"\n part=\"progress-bar-fill\"\n borderRadius=\"md\"\n height=\"100%\"\n style={{\n width: barWidth,\n }}\n transition=\"width 300ms ease-out\"\n />\n </Box>\n )\n}\n","import { Box } from '@/components/Box'\n\nimport { theme } from '@/shared/theme'\n\nimport type { ProgressProps } from './ProgressProps'\n\nexport function Dots({ current, total, ...props }: ProgressProps) {\n if (total == 1) {\n return null\n }\n\n const dots = [...Array(total)].map((_, i) => {\n return (\n <Box\n as=\"circle\"\n cx={4 + 16 * i}\n cy=\"4px\"\n fill={current - 1 === i ? theme.colors.blue500 : theme.colors.blue800}\n key={i}\n part={['progress-dot', current - 1 === i ? 'progress-dot-filled' : null]}\n r={4}\n />\n )\n })\n\n return (\n <Box\n aria-description=\"Progress represented as dots\"\n aria-label=\"Progress Dots\"\n aria-valuemin=\"0\"\n aria-valuemax={total}\n aria-valuenow={current}\n as=\"svg\"\n height=\"8px\"\n part=\"progress-dots\"\n role=\"meter\"\n viewBox={`0 0 ${16 * total - 8} 8`}\n width={16 * total - 8}\n {...props}\n >\n {dots}\n </Box>\n )\n}\n","import { Text } from '@/components/Text'\n\nimport type { ProgressProps } from './ProgressProps'\n\nexport function Fraction({ current, total, ...props }: ProgressProps) {\n return (\n <Text.Body2\n aria-description=\"Progress represented as a fraction of a total\"\n aria-label=\"Progress Fraction\"\n aria-valuemin=\"0\"\n aria-valuemax={total}\n aria-valuenow={current}\n part=\"progress-fraction\"\n role=\"meter\"\n {...props}\n >\n {`${current}/${total}`}\n </Text.Body2>\n )\n}\n","import { Box } from '@/components/Box'\nimport { Text } from '@/components/Text'\n\nimport { theme } from '@/shared/theme'\n\nimport type { ProgressProps } from './ProgressProps'\n\nexport function Ring({\n css,\n current,\n height = '48px',\n showLabel = false,\n strokeWidth = '8px',\n total,\n width = '48px',\n ...props\n}: ProgressProps) {\n if (total == 1) {\n return null\n }\n\n const progressPercent = total > 0 ? Math.min(Math.round((current / total) * 100) / 100, 1) : 0\n\n // TODO: Configurable size\n return (\n <Box\n aria-description=\"Progress represented as a ring\"\n aria-label=\"Progress Ring\"\n aria-valuemin=\"0\"\n aria-valuemax={total}\n aria-valuenow={current}\n as=\"svg\"\n css={{\n '--progress-percent': progressPercent,\n '--radius': `calc((min(${height}, ${width}) - ${strokeWidth}) / 2)`,\n '--circumference': `calc(var(--radius) * pi * 2)`,\n '--dash-length': 'calc(var(--circumference) * var(--progress-percent))',\n '--gap-length': 'calc(var(--circumference) - var(--dash-length))',\n ...css,\n }}\n height={height}\n part=\"progress-ring\"\n position=\"relative\"\n role=\"meter\"\n width={width}\n {...props}\n >\n <Box\n as=\"circle\"\n cx=\"50%\"\n cy=\"50%\"\n fill=\"transparent\"\n part=\"progress-ring-track\"\n r=\"var(--radius)\"\n stroke={theme.colors.primary['800']}\n strokeWidth={strokeWidth}\n />\n <Box\n as=\"circle\"\n cx=\"50%\"\n cy=\"50%\"\n fill=\"transparent\"\n part=\"progress-ring-filled\"\n r=\"var(--radius)\"\n stroke={theme.colors.primary.surface}\n strokeWidth={strokeWidth}\n style={{\n strokeDasharray: `var(--dash-length) var(--gap-length)`,\n }}\n transform=\"rotate(-90deg)\"\n transformOrigin=\"50% 50%\"\n transition=\"stroke-dasharray 0.2s ease-out\"\n />\n {showLabel && (\n <Text.Caption\n as=\"text\"\n dominantBaseline=\"middle\"\n fontWeight=\"medium\"\n textAnchor=\"middle\"\n _x=\"50%\"\n _y=\"52%\"\n >\n {progressPercent * 100}\n </Text.Caption>\n )}\n </Box>\n )\n}\n","import { Box } from '@/components/Box'\nimport { Flex } from '@/components/Flex'\n\nimport type { ProgressProps } from './ProgressProps'\n\nexport function Segments({ current, total, ...props }: ProgressProps) {\n const segments = [...Array(total)].map((_, i) => (\n <Box\n backgroundColor={current - 1 >= i ? 'primary.surface' : 'blue800'}\n borderRadius=\"md\"\n flexGrow={1}\n height=\"100%\"\n key={i}\n minWidth=\"10px\"\n part={['progress-segment', current - 1 === i ? 'progress-segment-filled' : null]}\n />\n ))\n\n return (\n <Flex.Row\n aria-description=\"Progress represented as a segmented bar\"\n aria-label=\"Progress Segments\"\n aria-valuemin=\"0\"\n aria-valuemax={total}\n aria-valuenow={current}\n gap={1}\n height=\"10px\"\n part=\"progress-segments\"\n role=\"meter\"\n {...props}\n >\n {segments}\n </Flex.Row>\n )\n}\n","export function LockClosedIcon(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 16 16\"\n fill=\"currentColor\"\n className=\"size-4\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n d=\"M8 1a3.5 3.5 0 0 0-3.5 3.5V7A1.5 1.5 0 0 0 3 8.5v5A1.5 1.5 0 0 0 4.5 15h7a1.5 1.5 0 0 0 1.5-1.5v-5A1.5 1.5 0 0 0 11.5 7V4.5A3.5 3.5 0 0 0 8 1Zm2 6V4.5a2 2 0 1 0-4 0V7h4Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n )\n}\n","import { Box, type BoxProps } from '@/components/Box'\n\nfunction CheckIcon() {\n return (\n <Box\n as=\"svg\"\n color=\"primary.foreground\"\n fill=\"none\"\n height=\"8px\"\n part=\"check-icon\"\n viewBox=\"0 0 10 8\"\n width=\"10px\"\n >\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}\n\ninterface CheckIndicatorProps extends BoxProps {\n checked?: boolean\n size?: string\n}\n\nexport function CheckIndicator({ checked = false, size = '22px', ...props }: CheckIndicatorProps) {\n return (\n <Box\n backgroundColor=\"inherit\"\n borderWidth=\"md\"\n borderStyle=\"solid\"\n borderColor=\"neutral.border\"\n borderRadius=\"100%\"\n padding=\"0\"\n part=\"check-indicator\"\n position=\"relative\"\n height={size}\n width={size}\n {...props}\n >\n {checked && (\n <Box\n alignItems=\"center\"\n bg=\"green500\"\n borderWidth=\"md\"\n borderStyle=\"solid\"\n borderColor=\"green500\"\n borderRadius=\"100%\"\n display=\"flex\"\n height=\"calc(100% + 2px)\"\n justifyContent=\"center\"\n left=\"-1px\"\n part=\"check-indicator-checked\"\n position=\"absolute\"\n top=\"-1px\"\n width=\"calc(100% + 2px)\"\n >\n <CheckIcon />\n </Box>\n )}\n </Box>\n )\n}\n","import { type SyntheticEvent, useCallback, useContext, useMemo } from 'react'\n\nimport type { FlowStep, PropertyPayload } from '@frigade/js'\n\nimport { FrigadeContext } from '@/components/Provider'\n\n// TODO: Fix order of args\nexport type StepHandlerProp = (\n step: FlowStep,\n event?: SyntheticEvent<object, unknown>,\n properties?: PropertyPayload\n) => Promise<boolean | void> | (boolean | void)\n\nexport interface StepHandlerProps {\n onPrimary?: StepHandlerProp\n onSecondary?: StepHandlerProp\n}\n\nexport type StepHandler = (\n /**\n * The native event that triggered this handler.\n */\n event: SyntheticEvent<object, unknown>,\n /**\n * Additional properties to pass to the step.\n */\n properties?: PropertyPayload,\n /**\n * If true, the step will be marked as completed without waiting for the API and validation of any targeting rules.\n * @default true\n */\n optimistic?: boolean\n) => Promise<boolean>\n\nexport function useStepHandlers(step: FlowStep, { onPrimary, onSecondary }: StepHandlerProps = {}) {\n const { navigate } = useContext(FrigadeContext)\n\n const stepActions = useMemo(\n () =>\n step == null\n ? {}\n : {\n 'flow.back': (properties?: PropertyPayload) => step.flow.back(properties),\n 'flow.complete': (properties?: PropertyPayload) => step.flow.complete(properties),\n 'flow.forward': (properties?: PropertyPayload) => step.flow.forward(properties),\n 'flow.restart': () => step.flow.restart(),\n 'flow.skip': (properties?: PropertyPayload) => step.flow.skip(properties),\n 'flow.start': (properties?: PropertyPayload) => step.flow.start(properties),\n 'step.complete': (properties?: PropertyPayload, optimistic?: boolean) =>\n step.complete(properties, optimistic),\n 'step.skip': (properties?: PropertyPayload, optimistic?: boolean) =>\n step.skip(properties, optimistic),\n 'step.reset': () => step.reset(),\n 'step.start': (properties?: PropertyPayload) => step.start(properties),\n },\n [step]\n )\n\n return {\n handlePrimary: useCallback<StepHandler>(\n async (e, properties, optimistic = true) => {\n const continueDefault = await onPrimary?.(step, e, properties)\n if (continueDefault === false) {\n e.preventDefault()\n return false\n }\n\n if (step.primaryButton != null) {\n const primaryAction =\n step.primaryButton.action === false ? false : stepActions[step.primaryButton.action]\n\n if (typeof primaryAction === 'function') {\n await primaryAction(properties, optimistic)\n } else if (primaryAction !== false) {\n await step.complete(properties, optimistic)\n }\n\n if (step.primaryButton.uri != null) {\n navigate(step.primaryButton.uri, step.primaryButton.target)\n }\n } else {\n await step.complete(properties, optimistic)\n\n if (step.primaryButtonUri != null) {\n navigate(step.primaryButtonUri, step.primaryButtonUriTarget)\n }\n }\n\n return true\n },\n [navigate, onPrimary, step, stepActions]\n ),\n\n handleSecondary: useCallback<StepHandler>(\n async (e, properties) => {\n const continueDefault = await onSecondary?.(step, e, properties)\n\n if (continueDefault === false) {\n e.preventDefault()\n return false\n }\n\n if (step.secondaryButton != null) {\n const secondaryAction =\n step.secondaryButton.action === false ? false : stepActions[step.secondaryButton.action]\n\n if (typeof secondaryAction === 'function') {\n secondaryAction()\n } else if (secondaryAction !== false) {\n step.complete(properties)\n }\n\n if (step.secondaryButton.uri != null) {\n navigate(step.secondaryButton.uri, step.secondaryButton.target)\n }\n } else {\n // Should there be a step.skip method?\n step.complete(properties)\n\n if (step.secondaryButtonUri != null) {\n navigate(step.secondaryButtonUri, step.secondaryButtonUriTarget)\n }\n }\n\n return true\n },\n [navigate, onSecondary, step, stepActions]\n ),\n }\n}\n","import type { FlowStep } from '@frigade/js'\nimport { LockClosedIcon } from '@/components/Icon/LockClosedIcon'\n\nimport { Box } from '@/components/Box'\nimport { CheckIndicator } from '@/components/CheckIndicator'\nimport { Flex } from '@/components/Flex'\nimport { Card } from '@/components/Card'\n\nimport { type StepHandlerProp, useStepHandlers } from '@/hooks/useStepHandlers'\n\ninterface CarouselStepProps {\n onPrimary: StepHandlerProp\n onSecondary: StepHandlerProp\n step: FlowStep\n}\n\nexport function CarouselStep({ onPrimary, onSecondary, step }: CarouselStepProps) {\n const { handlePrimary, handleSecondary } = useStepHandlers(step, { onPrimary, onSecondary })\n\n const { blocked, completed, skipped } = step.$state\n\n const topRightIcon =\n // TODO: Consider adding a specific UI state for Skipped\n completed || skipped || !blocked ? (\n <CheckIndicator checked={completed || skipped} marginLeft=\"auto\" />\n ) : (\n <Box as={LockClosedIcon} height=\"22px\" marginLeft=\"auto\" width=\"22px\" />\n )\n\n return (\n <Card\n borderWidth={1}\n containerType=\"inline-size\"\n css={{\n '@container (max-width: 600px)': {\n flexBasis: '85%',\n },\n '@container (min-width: 601px) and (max-width: 900px)': {\n flexBasis: '45%',\n },\n '@container (min-width: 1200px)': {\n flexBasis: '25%',\n },\n }}\n data-step-id={step.id}\n flex=\"0 0 30%\"\n gap=\"2\"\n p=\"4\"\n part=\"carousel-step\"\n userSelect=\"none\"\n disabled={blocked}\n opacity={blocked ? 0.5 : 1}\n >\n <Flex.Row marginBottom=\"2\" part=\"carousel-step-header\">\n {step.iconUri && (\n <Card.Media borderRadius=\"0\" height=\"24px\" src={step.iconUri} width=\"24px\" />\n )}\n {topRightIcon}\n </Flex.Row>\n <Card.Title>{step.title}</Card.Title>\n <Card.Subtitle>{step.subtitle}</Card.Subtitle>\n\n <Flex.Row\n css={{\n '@container (max-width: 200px)': {\n '& > button': {\n flexBasis: '50%',\n flexGrow: 1,\n },\n\n flexDirection: 'column-reverse',\n },\n }}\n gap=\"2\"\n marginTop=\"auto\"\n paddingTop=\"3\"\n part=\"carousel-step-footer\"\n >\n <Card.Secondary\n disabled={blocked}\n onClick={handleSecondary}\n title={step.secondaryButton?.title}\n />\n <Card.Primary\n disabled={blocked}\n onClick={handlePrimary}\n title={step.primaryButton?.title}\n />\n </Flex.Row>\n </Card>\n )\n}\n","export function ArrowRightIcon(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className=\"size-5\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n d=\"M3 10a.75.75 0 0 1 .75-.75h10.638L10.23 5.29a.75.75 0 1 1 1.04-1.08l5.5 5.25a.75.75 0 0 1 0 1.08l-5.5 5.25a.75.75 0 1 1-1.04-1.08l4.158-3.96H3.75A.75.75 0 0 1 3 10Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n )\n}\n","export function ArrowLeftIcon(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className=\"size-5\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n d=\"M17 10a.75.75 0 0 1-.75.75H5.612l4.158 3.96a.75.75 0 1 1-1.04 1.08l-5.5-5.25a.75.75 0 0 1 0-1.08l5.5-5.25a.75.75 0 1 1 1.04 1.08L5.612 9.25H16.25A.75.75 0 0 1 17 10Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n )\n}\n","import { Card } from '@/components/Card'\nimport { Flow, FlowChildrenProps, type FlowPropsWithoutChildren } from '@/components/Flow'\n\nimport { CarouselEmblaWrapper } from '@/components/Checklist/CarouselEmblaWrapper'\n\nexport interface CarouselProps extends FlowPropsWithoutChildren {\n /**\n * @ignore\n */\n children?: React.ReactNode\n /**\n * How to sort the default the completed steps of the carousel.\n * - `completed-last` will sort the completed/skips steps to the end of the carousel.\n * - `default` will keep the order of the steps as they are in the flow.\n */\n sort?: 'completed-last' | 'default'\n}\n\nexport function Carousel({ ...props }: CarouselProps) {\n return (\n <Flow as={Card} borderWidth={1} containerType=\"inline-size\" p=\"4\" part=\"carousel\" {...props}>\n {(flowChildrenProps: FlowChildrenProps) => (\n <CarouselEmblaWrapper {...props} {...flowChildrenProps} />\n )}\n </Flow>\n )\n}\n","import type { JSX } from '@emotion/react/jsx-runtime'\nimport { createContext, type Dispatch, type SetStateAction, useContext, useState } from 'react'\n\nimport { Card } from '@/components/Card'\nimport * as CollapsibleStep from '@/components/Checklist/CollapsibleStep'\nimport { Flex } from '@/components/Flex'\nimport { Flow, type FlowChildrenProps, type FlowPropsWithoutChildren } from '@/components/Flow'\nimport * as Progress from '@/components/Progress'\nimport { Text } from '@/components/Text'\n\nimport { type StepHandlerProp, useStepHandlers } from '@/hooks/useStepHandlers'\n\nimport { getVideoProps } from '@/components/Media/videoProps'\n\nexport interface CollapsibleStepProps extends FlowChildrenProps {\n onOpenChange: (isOpening: boolean) => void\n open: boolean\n}\n\nexport type StepTypes = Record<string, (props: CollapsibleStepProps) => JSX.Element>\n\nexport interface CollapsibleContextType {\n onPrimary: StepHandlerProp\n onSecondary: StepHandlerProp\n openStepId: string | null\n setOpenStepId: Dispatch<SetStateAction<string>>\n stepTypes: StepTypes\n}\n\nconst CollapsibleContext = createContext<CollapsibleContextType>({\n onPrimary: () => {},\n onSecondary: () => {},\n openStepId: null,\n setOpenStepId: () => {},\n stepTypes: {},\n})\n\nexport interface CollapsibleProps extends FlowPropsWithoutChildren {\n /**\n * Map of step types to their respective components.\n * Use this to build custom step components. The `type` defined on the step in the Flow YAML config should match the key in this object.\n * For instance, if you have a step with `type: 'custom'`, you should provide a component for it like so:\n * ```\n * <Checklist.Collapsible stepTypes={{ custom: CustomStepComponent }} />\n * ```\n * The corresponding YAML config would look like:\n * ```\n * steps:\n * - id: custom-step\n * type: custom\n * ```\n */\n stepTypes?: StepTypes\n}\n\nfunction DefaultCollapsibleStep({\n handlePrimary,\n handleSecondary,\n open,\n onOpenChange,\n step,\n}: CollapsibleStepProps) {\n const {\n $state: { blocked, completed, skipped },\n subtitle,\n title,\n } = step\n\n const primaryButtonTitle = step.primaryButton?.title ?? step.primaryButtonTitle\n const secondaryButtonTitle = step.secondaryButton?.title ?? step.secondaryButtonTitle\n\n const stepProps = step.props ?? {}\n\n const disabled = blocked ? true : false\n\n const { videoProps } = getVideoProps(stepProps)\n\n return (\n <CollapsibleStep.Root\n data-step-id={step.id}\n open={open}\n onOpenChange={onOpenChange}\n {...stepProps}\n >\n <CollapsibleStep.Trigger\n isBlocked={step.$state.blocked}\n isCompleted={completed || skipped}\n title={title}\n />\n\n <CollapsibleStep.Content>\n <Card.Media\n aspectRatio={2.5}\n objectFit=\"cover\"\n overflowClipMargin=\"unset\"\n src={step.videoUri ?? step.imageUri}\n transform=\"translate3d(0, 0, 1px)\"\n type={step.videoUri ? 'video' : 'image'}\n {...videoProps}\n />\n <Card.Subtitle color=\"neutral.400\">{subtitle}</Card.Subtitle>\n <Flex.Row gap={3} part=\"collapsible-footer\">\n <Card.Secondary title={secondaryButtonTitle} onClick={handleSecondary} />\n <Card.Primary disabled={disabled} title={primaryButtonTitle} onClick={handlePrimary} />\n </Flex.Row>\n </CollapsibleStep.Content>\n </CollapsibleStep.Root>\n )\n}\n\nconst defaultStepTypes = {\n default: DefaultCollapsibleStep,\n}\n\nfunction StepWrapper({ flow, step, ...props }: FlowChildrenProps) {\n const { onPrimary, onSecondary, openStepId, setOpenStepId, stepTypes } =\n useContext(CollapsibleContext)\n const { handlePrimary, handleSecondary } = useStepHandlers(step, { onPrimary, onSecondary })\n\n const open = (openStepId ?? flow.getCurrentStep().id) === step.id\n\n const StepComponent = stepTypes[step.type as string] ?? DefaultCollapsibleStep\n\n async function onOpenChange(isOpening: boolean) {\n setOpenStepId(isOpening ? step.id : '')\n\n if (isOpening && !step.$state.completed) {\n await step.start()\n setOpenStepId(null)\n }\n }\n\n // TODO: Allow user override of onOpenChange w/ same behavior as other handlers\n return (\n <StepComponent\n flow={flow}\n key={step.id}\n onOpenChange={onOpenChange}\n open={open}\n step={step}\n {...props}\n handlePrimary={handlePrimary}\n handleSecondary={handleSecondary}\n />\n )\n}\n\nexport function Collapsible({\n flowId,\n onPrimary,\n onSecondary,\n part,\n stepTypes = {},\n ...props\n}: CollapsibleProps) {\n const [openStepId, setOpenStepId] = useState(null)\n\n const mergedStepTypes: StepTypes = {\n ...defaultStepTypes,\n ...stepTypes,\n }\n\n return (\n <CollapsibleContext.Provider\n value={{ openStepId, setOpenStepId, onPrimary, onSecondary, stepTypes: mergedStepTypes }}\n >\n <Flow as={Card} borderWidth=\"md\" flowId={flowId} part={['checklist', part]} {...props}>\n {({ flow, handleDismiss, ...childrenProps }) => {\n const visibleSteps = Array.from(flow.steps.entries()).filter(\n ([, step]) => step.$state.visible === true\n )\n\n const stepList = visibleSteps.map(([, s]) => (\n <StepWrapper\n key={s.id}\n flow={flow}\n handleDismiss={handleDismiss}\n {...childrenProps}\n step={s}\n />\n ))\n\n const currentSteps = flow.getNumberOfCompletedSteps()\n const availableSteps = flow.getNumberOfAvailableSteps()\n\n // Note: Ignore merged props from step here, Checklist steps don't control flow dismissibility\n const dismissible = props.dismissible || !!flow?.props?.dismissible\n\n return (\n <>\n <Flex.Column gap={2} part=\"checklist-header\">\n <Card.Header\n dismissible={dismissible}\n handleDismiss={handleDismiss}\n subtitle={flow.subtitle}\n title={flow.title}\n />\n\n <Flex.Row alignItems=\"center\" gap={2} part=\"checklist-progress\">\n <Text.Body2 fontWeight=\"demibold\" part=\"progress-text\">\n {currentSteps}/{availableSteps}\n </Text.Body2>\n <Progress.Bar current={currentSteps} total={availableSteps} flexGrow={1} />\n </Flex.Row>\n </Flex.Column>\n\n {stepList}\n </>\n )\n }}\n </Flow>\n </CollapsibleContext.Provider>\n )\n}\n","import { keyframes } from '@emotion/react'\nimport { ChevronDownIcon } from '@/components/Icon/ChevronDownIcon'\nimport * as Collapsible from '@radix-ui/react-collapsible'\n\nimport { Box, type BoxProps } from '@/components/Box'\nimport { Card } from '@/components/Card'\nimport { Flex } from '@/components/Flex'\nimport { Text } from '@/components/Text'\n\nconst slideDown = keyframes`\n from {\n height: 0;\n opacity: 0;\n }\n to {\n height: var(--radix-collapsible-content-height);\n opacity: 1;\n }\n`\n\nconst slideUp = keyframes`\n from {\n height: var(--radix-collapsible-content-height);\n opacity: 1;\n }\n to {\n height: 0;\n opacity: 0;\n }\n`\n// TODO: CheckIcon and CheckIndicator are copypasta from RadioField.tsx. Clean this up.\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\nfunction CheckIndicator({ checked = false }) {\n return (\n <Box\n backgroundColor=\"inherit\"\n borderWidth=\"md\"\n borderStyle=\"solid\"\n borderColor=\"neutral.border\"\n borderRadius=\"100%\"\n marginRight=\"2\"\n padding=\"0\"\n part=\"field-radio-value\"\n position=\"relative\"\n height=\"22px\"\n width=\"22px\"\n >\n {checked && (\n <Box\n alignItems=\"center\"\n bg=\"green500\"\n borderWidth=\"md\"\n borderStyle=\"solid\"\n borderColor=\"green500\"\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 )}\n </Box>\n )\n}\n\nexport function Content({ children }) {\n return (\n <Collapsible.Content asChild>\n <Flex.Column\n css={{\n '&[data-state=\"open\"]': {\n animation: `${slideDown} 300ms ease-out`,\n },\n '&[data-state=\"closed\"]': {\n animation: `${slideUp} 300ms ease-out`,\n },\n overflow: 'hidden',\n }}\n gap={5}\n part=\"collapsible-content\"\n >\n {/*\n This humble box is doing yeoman's work, don't remove it.\n It creates a flex gap at the top of this column, which animates smoothly.\n Other forms of whitespace like margin or padding? Not so smooth!\n */}\n <Box part=\"checklist-spacer\" />\n\n {children}\n </Flex.Column>\n </Collapsible.Content>\n )\n}\n\nexport function Root({\n children,\n disabled = false,\n onOpenChange = () => {},\n open = false,\n ...props\n}: Collapsible.CollapsibleProps & BoxProps) {\n return (\n <Collapsible.Root asChild disabled={disabled} open={open} onOpenChange={onOpenChange}>\n <Card\n borderWidth=\"md\"\n css={{\n '&[data-state=\"open\"] .fr-collapsible-step-icon': {\n transform: 'rotate(180deg)',\n },\n }}\n gap={0}\n part=\"collapsible-step\"\n {...props}\n >\n {children}\n </Card>\n </Collapsible.Root>\n )\n}\n\nexport function Trigger({ isCompleted, isBlocked, title }) {\n return (\n <Collapsible.Trigger asChild>\n <Flex.Row\n alignItems=\"center\"\n justifyContent=\"flex-start\"\n margin={-5}\n padding={5}\n zIndex={1}\n opacity={isBlocked ? 0.4 : 1}\n disabled={isBlocked}\n pointerEvents={isBlocked ? 'none' : 'auto'}\n cursor={isBlocked ? 'not-allowed' : 'pointer'}\n part=\"collapsible-header\"\n >\n <CheckIndicator checked={isCompleted} />\n <Text.Body2 fontWeight=\"demibold\" userSelect=\"none\" part=\"collapsible-title\">\n {title}\n </Text.Body2>\n\n <Box\n as={ChevronDownIcon}\n color=\"neutral.100\"\n css={{\n '& path': {\n vectorEffect: 'non-scaling-stroke',\n },\n }}\n display=\"block\"\n height=\"16px\"\n marginLeft=\"auto\"\n order={2}\n part=\"collapsible-step-icon\"\n width=\"16px\"\n />\n </Flex.Row>\n </Collapsible.Trigger>\n )\n}\n","export function ChevronDownIcon(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth={1.5}\n stroke=\"currentColor\"\n className=\"size-6\"\n {...props}\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"m19.5 8.25-7.5 7.5-7.5-7.5\" />\n </svg>\n )\n}\n","export const VIDEO_PROP_NAMES = [\n 'autoPlay',\n 'controls',\n 'controlsList',\n 'crossOrigin',\n 'disablePictureInPicture',\n 'disableRemotePlayback',\n 'loop',\n 'muted',\n 'playsInline',\n 'poster',\n 'preload',\n 'src',\n] as const\n\nexport type VideoPropName = (typeof VIDEO_PROP_NAMES)[number]\n\nexport function getVideoProps(props: Record<string, unknown>) {\n const videoProps = {}\n const otherProps = {}\n\n for (const [propName, propValue] of Object.entries(props)) {\n if (VIDEO_PROP_NAMES.some((name) => name === propName)) {\n videoProps[propName] = propValue\n } else {\n otherProps[propName] = propValue\n }\n }\n\n return {\n otherProps,\n videoProps,\n }\n}\n","import { useRef, useState } from 'react'\nimport { FloatingTree } from '@floating-ui/react'\n\nimport { Card } from '@/components/Card'\nimport { Flex } from '@/components/Flex'\nimport { Flow, type FlowPropsWithoutChildren } from '@/components/Flow'\nimport * as Popover from '@/components/Popover'\nimport * as Progress from '@/components/Progress'\nimport { Text } from '@/components/Text'\n\nimport { FloatingStep } from '@/components/Checklist/FloatingStep'\nimport { floatingTransitionCSS } from '@/components/Checklist/Floating.styles'\n\nexport interface FloatingChecklistProps\n extends Popover.PopoverRootProps,\n FlowPropsWithoutChildren {}\n\n// TODO: Fix props here (split popover and flow props and pass them to Flow / Popover.Root)\nexport function Floating({\n children,\n flowId,\n onPrimary,\n onSecondary,\n part,\n ...props\n}: FloatingChecklistProps) {\n const [openStepId, setOpenStepId] = useState(null)\n const pointerLeaveTimeout = useRef<ReturnType<typeof setTimeout>>()\n\n function handlePointerEnter() {\n clearTimeout(pointerLeaveTimeout.current)\n }\n\n function handlePointerLeave() {\n clearTimeout(pointerLeaveTimeout.current)\n\n if (openStepId != null) {\n pointerLeaveTimeout.current = setTimeout(() => setOpenStepId(null), 300)\n }\n }\n\n function resetOpenStep(isOpen: boolean) {\n if (!isOpen && openStepId != null) {\n setOpenStepId(null)\n }\n }\n\n return (\n <Flow flowId={flowId} part={['floating-checklist', part]} {...props}>\n {({ flow }) => {\n const currentSteps = flow.getNumberOfCompletedSteps()\n const availableSteps = flow.getNumberOfAvailableSteps()\n\n const anchorContent = children ?? (\n <Flex.Row\n alignItems=\"center\"\n backgroundColor=\"neutral.background\"\n border=\"md solid neutral.border\"\n borderRadius=\"md\"\n cursor=\"pointer\"\n gap=\"2\"\n padding=\"1 2\"\n part=\"floating-checklist-anchor\"\n userSelect=\"none\"\n >\n <Text.Body2 fontWeight=\"medium\" part=\"floating-checklist-title\">\n {flow.title}\n </Text.Body2>\n <Progress.Ring\n current={currentSteps}\n height=\"24px\"\n strokeWidth=\"4px\"\n total={availableSteps}\n width=\"24px\"\n />\n </Flex.Row>\n )\n\n return (\n <FloatingTree>\n <Popover.Root align=\"start\" onOpenChange={resetOpenStep} sideOffset={4}>\n <Popover.Trigger display=\"inline-block\">{anchorContent}</Popover.Trigger>\n\n <Popover.Content\n css={{\n ...floatingTransitionCSS,\n '&[data-status=\"initial\"]': {\n opacity: 0.3,\n },\n '& .fr-popover-transition-container': {\n transformOrigin: 'top left',\n transition: 'transform 0.2s ease-out',\n },\n '&[data-placement^=\"top\"] .fr-popover-transition-container': {\n transformOrigin: 'bottom left',\n },\n }}\n >\n <Card\n backgroundColor=\"neutral.background\"\n border=\"md solid neutral.border\"\n borderRadius=\"md\"\n gap=\"0\"\n onPointerEnter={handlePointerEnter}\n onPointerLeave={handlePointerLeave}\n p=\"0 1 1\"\n part=\"floating-checklist-step-list\"\n >\n <Progress.Bar\n borderRadius=\"md md 0 0\"\n clipPath=\"border-box\"\n css={{\n '& .fr-progress-bar-fill': {\n borderRadius: 0,\n },\n }}\n current={currentSteps}\n height=\"5px\"\n total={availableSteps}\n flexGrow={1}\n margin=\"0 -1 2\"\n />\n {Array.from(flow.steps.values()).map((step) => (\n <FloatingStep\n key={step.id}\n onPrimary={onPrimary}\n onSecondary={onSecondary}\n openStepId={openStepId}\n setOpenStepId={setOpenStepId}\n step={step}\n />\n ))}\n </Card>\n </Popover.Content>\n </Popover.Root>\n </FloatingTree>\n )\n }}\n </Flow>\n )\n}\n","export { Root } from './Root'\nexport { Content } from './Content'\nexport { Trigger } from './Trigger'\nexport type { PopoverRootProps } from './Root'\nexport type { PopoverContentProps } from './Content'\nexport type { PopoverTriggerProps } from './Trigger'\n","import { createContext, type Dispatch, type SetStateAction, useState } from 'react'\nimport { useFloatingNodeId } from '@floating-ui/react'\n\nimport { Spotlight } from '@/components/Spotlight'\nimport { Overlay } from '@/components/Overlay'\n\nimport { useAutoScroll } from '@/hooks/useAutoScroll'\nimport { type FloatingProps, type FloatingReturn, useFloating } from '@/hooks/useFloating'\n\nexport interface PopoverContextValue {\n floating?: FloatingReturn\n floatingNodeId: string | null\n isOpen: boolean\n setIsOpen: Dispatch<SetStateAction<boolean>>\n}\n\nexport const PopoverContext = createContext<PopoverContextValue>({\n floatingNodeId: null,\n isOpen: false,\n setIsOpen: () => {},\n})\n\nexport interface PopoverRootProps extends FloatingProps {\n autoScroll?: ScrollIntoViewOptions | boolean\n children?: React.ReactNode\n defaultOpen?: boolean\n modal?: boolean\n spotlight?: boolean\n}\n\nexport function Root({\n align = 'center',\n alignOffset = 0,\n anchor,\n autoScroll = false,\n children,\n defaultOpen = false,\n modal = false,\n onOpenChange = () => {},\n open,\n side = 'bottom',\n sideOffset = 0,\n spotlight = false,\n ...floatingProps\n}: PopoverRootProps) {\n const [internalOpen, setInternalOpen] = useState(defaultOpen)\n\n // Defer to controlled open prop, otherwise manage open state internally\n const canonicalOpen = open ?? internalOpen\n const floatingNodeId = useFloatingNodeId()\n\n const floating = useFloating({\n align,\n alignOffset,\n anchor,\n nodeId: floatingNodeId,\n onOpenChange: (newOpen) => {\n onOpenChange(newOpen)\n if (open == null) {\n setInternalOpen(newOpen)\n }\n },\n open: canonicalOpen,\n side,\n sideOffset,\n ...floatingProps,\n })\n\n const { refs } = floating\n\n useAutoScroll(refs.reference.current as Element, autoScroll)\n\n return (\n <PopoverContext.Provider\n value={{\n floating,\n floatingNodeId,\n isOpen: canonicalOpen,\n setIsOpen: setInternalOpen,\n }}\n >\n {spotlight && canonicalOpen && <Spotlight anchor={anchor} />}\n {modal && !spotlight && canonicalOpen && <Overlay lockScroll />}\n {children}\n </PopoverContext.Provider>\n )\n}\n","import { useEffect, useState } from 'react'\nimport { autoUpdate, type Placement, type ReferenceElement, useFloating } from '@floating-ui/react'\n\nimport { Overlay, type OverlayProps } from '@/components/Overlay'\n\nexport interface ClipPathCoords {\n maxX: number\n maxY: number\n radius: number\n x1: number\n x2: number\n y1: number\n y2: number\n}\n\nfunction getClipPath({ maxX, maxY, radius, x1, x2, y1, y2 }: ClipPathCoords) {\n if (radius > 0) {\n const instructions = [\n `M${x1 + radius},${y1}`,\n `H${x2 - radius}`,\n `A${radius} ${radius} 0,0,1 ${x2} ${y1 + radius}`,\n `V${y2 - radius}`,\n `A${radius} ${radius} 0,0,1 ${x2 - radius} ${y2}`,\n `H${x1 + radius}`,\n `A${radius} ${radius} 0,0,1 ${x1} ${y2 - radius}`,\n `V${maxY}`,\n `H${maxX}`,\n `V0`,\n `H0`,\n `V${maxY}`,\n `H${x1}`,\n `V${y1 + radius}`,\n `A${radius} ${radius} 0,0,1 ${x1 + radius} ${y1}`,\n `Z`,\n ]\n\n return `path(\"${instructions.join(' ')}\")`\n }\n\n return `path(\"M${x1},${y1} H${x2} V${y2} H${x1} V${maxY} H${maxX} V0 H0 V${maxY} H${x1} Z\")`\n}\n\nfunction getComputedRadius(element: ReferenceElement) {\n // Short circuit if we're not in a browser or if element is a VirtualElement\n if (!window || !('nodeType' in element)) {\n return 0\n }\n\n // NOTE: We currently only support single pixel lengths for radius\n // TODO: Allow complex radius syntax like 5px 5px 5px 5px, 5px / 10px, etc.\n const computedRadius = Number(window.getComputedStyle(element).borderRadius.replace(/\\D/g, ''))\n\n return !Number.isNaN(computedRadius) ? computedRadius : 0\n}\n\nexport interface SpotlightProps extends OverlayProps {\n anchor: string\n lockScroll?: boolean\n}\n\nexport function Spotlight({\n anchor,\n lockScroll = true,\n part,\n style = {},\n ...props\n}: SpotlightProps) {\n const [clipPathCoords, setClipPathCoords] = useState<ClipPathCoords>({\n maxX: 0,\n maxY: 0,\n radius: 0,\n x1: 0,\n x2: 0,\n y1: 0,\n y2: 0,\n })\n\n const { refs } = useFloating({\n middleware: [\n {\n name: 'clipPath',\n fn({ elements, rects }) {\n setClipPathCoords({\n maxX: elements.floating.clientWidth,\n maxY: elements.floating.clientHeight,\n radius: getComputedRadius(elements.reference),\n x1: rects.reference.x,\n x2: rects.reference.x + rects.reference.width,\n y1: rects.reference.y,\n y2: rects.reference.y + rects.reference.height,\n })\n\n return {}\n },\n },\n ],\n open: true,\n placement: 'top-center' as Placement,\n transform: false,\n whileElementsMounted: autoUpdate,\n })\n\n useEffect(() => {\n try {\n const anchorQuery = document.querySelector(anchor)\n\n if (anchorQuery != null) {\n refs.setReference(anchorQuery)\n } else {\n console.debug(`[frigade] Spotlight: No anchor found for selector: ${anchor}`)\n }\n } catch (invalidSelector) {\n /* no-op */\n }\n }, [anchor, refs])\n\n return (\n <Overlay\n lockScroll={lockScroll}\n part={['spotlight', part]}\n ref={refs.setFloating}\n style={{\n clipPath: getClipPath(clipPathCoords),\n ...style,\n }}\n {...props}\n />\n )\n}\n","import * as React from 'react'\nimport { keyframes } from '@emotion/react'\n\nimport { Box, type BoxProps } from '@/components/Box'\n\nimport { RemoveScroll } from 'react-remove-scroll'\nimport { useEffect, useState } from 'react'\n\nexport interface OverlayProps extends BoxProps {\n lockScroll?: boolean\n}\n\nfunction OverlayWithRef(\n { children, lockScroll = true, part, opacity = 0.5, ...props }: OverlayProps,\n ref: React.ForwardedRef<HTMLDivElement>\n) {\n const fadeIn = keyframes`\n from {\n opacity: 0;\n }\n to {\n opacity: ${opacity}\n }\n `\n\n const [hasScrolled, setHasScrolled] = useState(false)\n\n useEffect(() => {\n if (!lockScroll) {\n const handleScroll = () => {\n if (!hasScrolled) {\n setHasScrolled(true)\n window.removeEventListener('scroll', handleScroll)\n }\n }\n\n window.addEventListener('scroll', handleScroll)\n\n return () => {\n window.removeEventListener('scroll', handleScroll)\n }\n }\n }, [lockScroll, hasScrolled])\n\n if (!lockScroll && hasScrolled) {\n return <>{children}</>\n }\n\n return (\n <RemoveScroll forwardProps ref={ref} enabled={lockScroll}>\n <Box\n animation={`${fadeIn} 300ms ease-out`}\n backgroundColor=\"black\"\n inset=\"0\"\n opacity=\"0.5\"\n part={['overlay', part]}\n position=\"fixed\"\n {...props}\n >\n {children}\n </Box>\n </RemoveScroll>\n )\n}\n\nexport const Overlay = React.forwardRef(OverlayWithRef)\n","import { useEffect, useState } from 'react'\n\nexport function useAutoScroll(\n element: Element | null | undefined,\n enabled: boolean | ScrollIntoViewOptions = true\n) {\n const [scrollComplete, setScrollComplete] = useState(false)\n\n useEffect(() => {\n if (!scrollComplete && enabled && element instanceof Element) {\n const scrollOptions: ScrollIntoViewOptions =\n typeof enabled !== 'boolean' ? enabled : { behavior: 'smooth', block: 'center' }\n\n /*\n * NOTE: \"scrollend\" event isn't supported widely enough yet :(\n *\n * We'll listen to a capture-phase \"scroll\" instead, and when it stops\n * bouncing, we can infer that the scroll we initiated is over.\n */\n let scrollTimeout: ReturnType<typeof setTimeout>\n window.addEventListener(\n 'scroll',\n function scrollHandler() {\n clearTimeout(scrollTimeout)\n scrollTimeout = setTimeout(() => {\n window.removeEventListener('scroll', scrollHandler)\n setScrollComplete(true)\n }, 100)\n },\n true\n )\n\n element.scrollIntoView(scrollOptions)\n } else if (!enabled) {\n setScrollComplete(true)\n }\n }, [enabled, element, scrollComplete])\n}\n","import { useEffect } from 'react'\n\nimport {\n autoUpdate,\n flip,\n offset,\n type Placement,\n shift,\n useClick,\n useDismiss,\n useFloating as useFloatingUI,\n type UseFloatingOptions,\n type UseFloatingReturn,\n useFocus,\n useInteractions,\n type UseInteractionsReturn,\n useRole,\n useTransitionStatus,\n} from '@floating-ui/react'\n\nimport { useMutationAwareAnchor } from '@/components/Hint/useMutationAwareAnchor'\n\nexport type AlignValue = 'after' | 'before' | 'center' | 'end' | 'start'\nexport type SideValue = 'bottom' | 'left' | 'right' | 'top'\nexport type ExtendedPlacement = `${SideValue}-${AlignValue}`\n\nexport interface FloatingProps extends UseFloatingOptions {\n align?: AlignValue\n alignOffset?: number\n anchor?: string\n side?: SideValue\n sideOffset?: number\n}\n\nexport interface FloatingReturn extends Omit<UseFloatingReturn, 'placement'> {\n placement: ExtendedPlacement\n getFloatingProps: UseInteractionsReturn['getFloatingProps']\n getReferenceProps: UseInteractionsReturn['getReferenceProps']\n status: ReturnType<typeof useTransitionStatus>\n}\n\nfunction getOriginalAlign(align: AlignValue) {\n switch (align) {\n case 'after':\n return 'end'\n break\n case 'before':\n return 'start'\n break\n default:\n return align\n }\n}\n\nexport function useFloating({\n align,\n alignOffset,\n anchor,\n nodeId,\n onOpenChange = () => {},\n open,\n side,\n sideOffset,\n}: FloatingProps): FloatingReturn {\n const placement = `${side}-${getOriginalAlign(align)}` as Placement\n\n // Handle our added \"after\" and \"before\" alignments\n function offsetMiddleware({ rects }) {\n const offsets = {\n alignmentAxis: alignOffset,\n mainAxis: sideOffset,\n }\n\n if (['after', 'before'].includes(align)) {\n if (['bottom', 'top'].includes(side)) {\n // Offset horizontally\n offsets.alignmentAxis = alignOffset - rects.floating.width\n } else {\n // Offset vertically\n offsets.alignmentAxis = alignOffset - rects.floating.height\n }\n }\n\n return offsets\n }\n\n const {\n context,\n floatingStyles,\n placement: computedPlacement,\n refs,\n ...floatingReturn\n } = useFloatingUI({\n middleware: [offset(offsetMiddleware, [align, alignOffset, side, sideOffset]), flip(), shift()],\n nodeId,\n onOpenChange,\n open,\n placement,\n whileElementsMounted: autoUpdate,\n })\n\n const clickHandler = useClick(context)\n const dismissHandler = useDismiss(context, {\n outsidePress: false,\n })\n const focusProps = useFocus(context)\n const roleProps = useRole(context)\n const status = useTransitionStatus(context)\n\n const { getFloatingProps, getReferenceProps } = useInteractions([\n clickHandler,\n dismissHandler,\n focusProps,\n roleProps,\n ])\n\n /*\n * Note: If anchor is passed in as a selector, we'll automatically pass it\n * through to refs.setReference If not, we assume that the floating reference\n * element is being set manually elsewhere (e.g. Popover.Trigger)\n */\n const { anchorElement } = useMutationAwareAnchor(anchor)\n\n useEffect(() => {\n if (anchorElement != null) {\n refs.setReference(anchorElement)\n }\n }, [anchor, anchorElement, refs])\n\n // The flip() middleware might reverse the align prop\n const finalPlacement = computedPlacement.split('-')\n\n // Check and flip after/before alignment\n if (align === 'before') {\n finalPlacement[1] = finalPlacement[1] === 'end' ? 'after' : 'before'\n } else if (align === 'after') {\n finalPlacement[1] = finalPlacement[1] === 'start' ? 'before' : 'after'\n }\n\n return {\n context,\n getFloatingProps,\n getReferenceProps,\n floatingStyles,\n placement: finalPlacement.join('-') as ExtendedPlacement,\n refs,\n status,\n ...floatingReturn,\n }\n}\n","import { useEffect, useState } from 'react'\n\nfunction checkElementForAnchor(element: Element, anchor: string) {\n try {\n if (element.matches(anchor) && isVisible(element)) {\n return element\n }\n\n const anchorSelector = element.querySelectorAll(anchor)\n\n if (anchorSelector.length > 0 && isVisible(anchorSelector[0])) {\n return anchorSelector[0]\n }\n } catch (invalidSelector) {\n return null\n }\n}\n\nfunction isVisible(element: Element) {\n if (!(element instanceof HTMLElement)) {\n return false\n }\n\n return !!(element.offsetWidth || element.offsetHeight || element.getClientRects().length)\n}\n\nexport function useMutationAwareAnchor(anchor: string) {\n const [anchorElement, setAnchorElement] = useState(null)\n\n useEffect(() => {\n if (typeof anchor !== 'string') {\n return\n }\n\n try {\n const element = document.querySelector(anchor)\n\n if (element != null) {\n console.debug(`[frigade] Found anchor: ${anchor}`)\n setAnchorElement(element)\n } else {\n console.debug(`[frigade] No anchor found for selector: ${anchor}`)\n }\n } catch (invalidSelector) {\n console.debug(`[frigade] Invalid selector for anchor: ${anchor}`)\n }\n }, [anchor])\n\n useEffect(() => {\n if (typeof anchor !== 'string') {\n return\n }\n\n const observer = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (mutation.type !== 'childList') {\n continue\n }\n\n for (const node of mutation.addedNodes) {\n if (node.nodeType !== Node.ELEMENT_NODE) {\n continue\n }\n\n const maybeAnchor = checkElementForAnchor(node as Element, anchor)\n\n if (maybeAnchor != null) {\n console.debug(`[frigade] Found anchor: ${anchor}`)\n setAnchorElement(maybeAnchor)\n break\n }\n }\n\n for (const node of mutation.removedNodes) {\n if (node.nodeType !== Node.ELEMENT_NODE) {\n continue\n }\n\n const maybeAnchor = checkElementForAnchor(node as Element, anchor)\n\n if (maybeAnchor != null) {\n console.debug(`[frigade] Removed anchor: ${anchor}`)\n setAnchorElement(null)\n break\n }\n }\n }\n })\n\n observer.observe(document.querySelector('body'), { childList: true, subtree: true })\n\n return () => observer.disconnect()\n }, [anchor])\n\n return {\n anchorElement,\n }\n}\n","import { useContext } from 'react'\nimport { FloatingNode } from '@floating-ui/react'\nimport { Box, type BoxProps } from '@/components/Box'\nimport { PopoverContext } from './Root'\nimport { useVisibility } from '@/hooks/useVisibility'\n\nexport interface PopoverContentProps extends BoxProps {}\n\nexport function Content({ children, css, part, style, ...props }: BoxProps) {\n const { floating, floatingNodeId } = useContext(PopoverContext)\n\n const { isVisible: isAnchorVisible } = useVisibility(\n floating?.refs.reference.current as Element | null\n )\n\n if (floating == null) {\n return null\n }\n\n const { floatingStyles, getFloatingProps, placement, refs, status } = floating\n\n if (refs.reference.current == null || !isAnchorVisible || status?.isMounted === false) {\n return null\n }\n\n return (\n <FloatingNode id={floatingNodeId}>\n <Box\n autoFocus\n css={{\n '&[data-status=\"unmounted\"]': {\n display: 'none',\n },\n ...css,\n }}\n data-placement={placement}\n data-status={status.status}\n part={['popover-content', part]}\n ref={refs.setFloating}\n style={{\n ...floatingStyles,\n ...style,\n }}\n {...getFloatingProps()}\n {...props}\n >\n <Box part=\"popover-transition-container\">{children}</Box>\n </Box>\n </FloatingNode>\n )\n}\n","import { ClientRectObject } from '@floating-ui/react'\nimport { useEffect, useState } from 'react'\n\nimport { EmptyDOMRect } from '@/hooks/useBoundingClientRect'\n\nexport function useVisibility(element: Element | null) {\n const [isIntersecting, setIsIntersecting] = useState(false)\n const [clientRect, setClientRect] = useState<ClientRectObject>(EmptyDOMRect)\n\n const hasDimensions = clientRect.height > 0 && clientRect.width > 0\n\n useEffect(() => {\n if (element == null) {\n return\n }\n\n const observer = new IntersectionObserver(\n (entries) => {\n const el = entries[0]\n\n setClientRect(el.boundingClientRect)\n setIsIntersecting(el.isIntersecting)\n },\n { root: null }\n )\n\n observer.observe(element)\n\n return () => {\n observer.disconnect()\n }\n }, [element])\n\n return {\n isVisible: isIntersecting && hasDimensions,\n }\n}\n","import { useCallback, useLayoutEffect, useState } from 'react'\n\nexport const EmptyDOMRect = {\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\nexport function useBoundingClientRect() {\n const initialRect = 'DOMRect' in globalThis ? new DOMRect() : EmptyDOMRect\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 { useContext } from 'react'\nimport { Box, type BoxProps } from '@/components/Box'\nimport { PopoverContext } from './Root'\n\nexport interface PopoverTriggerProps extends BoxProps {}\n\nexport function Trigger({ children, part, ...props }: BoxProps) {\n const {\n floating: { getReferenceProps, refs },\n setIsOpen,\n } = useContext(PopoverContext)\n\n return (\n <Box\n ref={refs?.setReference}\n onClick={() => setIsOpen((prev) => !prev)}\n part={['popover-trigger', part]}\n {...props}\n {...(getReferenceProps?.() ?? {})}\n >\n {children}\n </Box>\n )\n}\n","import { useRef } from 'react'\nimport * as Popover from '@/components/Popover'\n\nimport { Card } from '@/components/Card'\nimport { CheckIndicator } from '@/components/CheckIndicator'\nimport { Flex } from '@/components/Flex'\nimport { getVideoProps } from '@/components/Media/videoProps'\nimport { Text } from '@/components/Text'\n\nimport { useStepHandlers } from '@/hooks/useStepHandlers'\n\nimport { floatingTransitionCSS } from '@/components/Checklist/Floating.styles'\n\nexport function FloatingStep({ onPrimary, onSecondary, openStepId, setOpenStepId, step }) {\n const anchorPointerEnterTimeout = useRef<ReturnType<typeof setTimeout>>()\n const { handlePrimary, handleSecondary } = useStepHandlers(step, { onPrimary, onSecondary })\n\n const isStepOpen = openStepId === step.id\n\n async function wrappedHandlePrimary(...args: Parameters<typeof handlePrimary>) {\n const primaryReturnValue = await handlePrimary(...args)\n\n if (primaryReturnValue) {\n setOpenStepId(null)\n }\n }\n\n async function wrappedHandleSecondary(...args: Parameters<typeof handleSecondary>) {\n const secondaryReturnValue = await handleSecondary(...args)\n\n if (secondaryReturnValue) {\n setOpenStepId(null)\n }\n }\n\n function handlePointerEnter() {\n clearTimeout(anchorPointerEnterTimeout.current)\n\n if (!isStepOpen) {\n anchorPointerEnterTimeout.current = setTimeout(() => setOpenStepId(step.id), 300)\n }\n }\n\n function handlePointerLeave() {\n clearTimeout(anchorPointerEnterTimeout.current)\n }\n\n const primaryButtonTitle = step.primaryButton?.title ?? step.primaryButtonTitle\n const secondaryButtonTitle = step.secondaryButton?.title ?? step.secondaryButtonTitle\n\n const { videoProps } = getVideoProps(step.props ?? {})\n\n return (\n <Popover.Root align=\"start\" open={isStepOpen} side=\"right\" sideOffset={8}>\n <Popover.Trigger\n as={Flex.Row}\n alignItems=\"center\"\n borderRadius=\"md\"\n gap=\"2\"\n justifyContent=\"space-between\"\n onPointerEnter={handlePointerEnter}\n onPointerLeave={handlePointerLeave}\n padding=\"1 2\"\n part=\"floating-checklist-step-list-item\"\n style={{\n backgroundColor: isStepOpen ? 'var(--fr-colors-neutral-800)' : 'transparent',\n }}\n userSelect=\"none\"\n >\n <Text.Body2 part=\"floating-checklist-step-title\">{step.title}</Text.Body2>\n <CheckIndicator checked={step.$state.completed || step.$state.skipped} size=\"18px\" />\n </Popover.Trigger>\n <Popover.Content css={floatingTransitionCSS} part=\"floating-step\">\n <Card\n backgroundColor=\"neutral.background\"\n border=\"md solid neutral.border\"\n borderRadius=\"md\"\n gap=\"3\"\n minWidth=\"400px\"\n p=\"2\"\n >\n <Card.Media\n src={step.videoUri ?? step.imageUri}\n type={step.videoUri ? 'video' : 'image'}\n css={{ objectFit: 'contain', width: '100%' }}\n {...videoProps}\n />\n <Card.Header dismissible={false} padding=\"0 1\" subtitle={step.subtitle} />\n\n <Flex.Row gap={3} justifyContent=\"flex-end\" part=\"card-footer\">\n <Card.Secondary\n disabled={step.$state.blocked}\n onClick={wrappedHandleSecondary}\n padding=\"1 2\"\n title={secondaryButtonTitle}\n />\n <Card.Primary\n disabled={step.$state.blocked}\n onClick={wrappedHandlePrimary}\n padding=\"1 2\"\n title={primaryButtonTitle}\n />\n </Flex.Row>\n </Card>\n </Popover.Content>\n </Popover.Root>\n )\n}\n","export const floatingTransitionCSS = {\n '&[data-status=\"open\"]': {\n opacity: 1,\n zIndex: 1,\n },\n '&[data-status=\"close\"]': {\n opacity: 0,\n zIndex: 0,\n\n '& [data-status=\"close\"]': {\n display: 'none',\n },\n },\n '&[data-status=\"initial\"]': {\n opacity: 0.8,\n },\n '&[data-status=\"open\"], &[data-status=\"close\"]': {\n transition: 'transform 0.2s ease-out, opacity 0.2s ease-out',\n },\n '&[data-status=\"initial\"] .fr-popover-transition-container': {\n transform: 'scale(0.8)',\n },\n '&[data-status=\"close\"] .fr-popover-transition-container': {\n transform: 'scale(0.3)',\n },\n '&[data-status=\"open\"] .fr-popover-transition-container': {\n transform: 'scale(1)',\n },\n '& .fr-popover-transition-container': {\n transformOrigin: 'left',\n transition: 'transform 0.2s ease-out',\n },\n}\n","import { SyntheticEvent, useContext, useEffect, useMemo, useState } from 'react'\nimport { FormProvider, useController, useForm, useFormContext } from 'react-hook-form'\n\nimport { Button } from '@/components/Button'\nimport { Card } from '@/components/Card'\nimport { Flex } from '@/components/Flex'\n\nimport { type FlowChildrenProps } from '@/components/Flow'\nimport type { FieldTypes, FormFieldData, ValidationRules } from '@/components/Form'\nimport { PropertyPayload } from '@frigade/js'\nimport { FrigadeContext } from '@/components/Provider'\n\nexport interface FormStepProps extends FlowChildrenProps {\n fieldTypes?: FieldTypes\n}\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, submit }) {\n const formContext = useFormContext()\n\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 (\n <FieldComponent\n {...controller}\n fieldData={fieldData}\n formContext={formContext}\n submit={submit}\n />\n )\n}\n\nexport function FormStep({\n fieldTypes,\n handleDismiss,\n handlePrimary,\n handleSecondary,\n parentProps: { dismissible },\n step,\n}: FormStepProps) {\n const { __readOnly } = useContext(FrigadeContext)\n\n const fieldDatas = useMemo(\n () =>\n // @ts-expect-error TODO: Add type to step.fields\n (step.fields?.filter(\n (field: FormFieldData) => fieldTypes[field.type] != null && field.id\n ) as FormFieldData[]) ?? [],\n [step.fields, fieldTypes]\n )\n\n const formContext = useForm({\n delayError: 2000,\n mode: 'onChange',\n\n defaultValues: fieldDatas.reduce((acc, field) => {\n acc[field.id] = field.value ?? ''\n return acc\n }, {}),\n })\n\n useEffect(() => {\n // if the form is updated reset it if not dirty\n if (!formContext.formState.isDirty) {\n formContext.reset(\n fieldDatas.reduce((acc, field) => {\n acc[field.id] = field.value ?? ''\n return acc\n }, {})\n )\n }\n }, [fieldDatas, formContext])\n\n useEffect(() => {\n if (\n Object.keys(formContext.formState.dirtyFields).some((field) =>\n fieldDatas.some((data) => data.id === field)\n )\n ) {\n formContext.trigger()\n }\n }, [fieldDatas, formContext, step.id])\n\n const [isSubmitting, setIsSubmitting] = useState(false)\n\n const fields = []\n\n const { control, handleSubmit } = formContext\n\n function onPrimarySubmit(properties: PropertyPayload, e: SyntheticEvent<object, unknown>) {\n setIsSubmitting(true)\n handlePrimary(e, properties, __readOnly === true).then(() => setIsSubmitting(false))\n }\n\n fieldDatas.forEach((fieldData: FormFieldData) => {\n if (fieldTypes[fieldData.type] != null) {\n fields.push(\n <FieldWrapper\n key={`${step.flow.id}-${fieldData.id}`}\n control={control}\n fieldComponent={fieldTypes[fieldData.type]}\n fieldData={fieldData}\n submit={handleSubmit(onPrimarySubmit)}\n />\n )\n }\n })\n\n const primaryButtonTitle = step.primaryButton?.title ?? step.primaryButtonTitle\n const secondaryButtonTitle = step.secondaryButton?.title ?? step.secondaryButtonTitle\n\n const disabled = step.$state.blocked || !formContext.formState.isValid ? true : false\n\n useEffect(() => {\n formContext.clearErrors()\n }, [formContext, step])\n\n return (\n <>\n <Card.Header\n dismissible={dismissible}\n handleDismiss={handleDismiss}\n part=\"form-step-header\"\n subtitle={step.subtitle}\n title={step.title}\n />\n\n <FormProvider {...formContext}>{fields}</FormProvider>\n\n <Flex.Row\n key={`form-footer-${step.id}`}\n part=\"form-step-footer\"\n justifyContent=\"flex-end\"\n gap={3}\n >\n {secondaryButtonTitle && (\n <Button.Secondary onClick={handleSecondary} title={secondaryButtonTitle} />\n )}\n <Button.Primary\n disabled={disabled || isSubmitting}\n onClick={handleSubmit(onPrimarySubmit)}\n title={primaryButtonTitle ?? 'Submit'}\n loading={isSubmitting}\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'\nimport { CheckIcon } from '@/components/Icon/CheckIcon'\nimport * as baseStyles from '@/components/Form/fields/BaseField.styles'\n\nexport interface SelectItemProps {\n label: string\n value: string\n}\n\nconst RadioItem = React.forwardRef<HTMLButtonElement, SelectItemProps>(\n ({ label, value }, forwardedRef) => (\n <Box\n as=\"label\"\n backgroundColor=\"neutral.background\"\n borderColor=\"neutral.border\"\n borderRadius=\"md\"\n borderStyle=\"solid\"\n borderWidth=\"md\"\n display=\"flex\"\n htmlFor={value}\n justifyContent=\"space-between\"\n part=\"field-radio\"\n px={4}\n py={2}\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=\"inherit\"\n borderWidth=\"md\"\n borderStyle=\"solid\"\n borderColor=\"neutral.border\"\n borderRadius=\"100%\"\n flex=\"0 0 auto\"\n padding=\"0\"\n part=\"field-radio-value\"\n position=\"relative\"\n height=\"24px\"\n width=\"24px\"\n >\n <Box as={RadioGroup.Indicator} {...baseStyles.checkContainer}>\n <CheckIcon height=\"14\" width=\"14\" />\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\" mt=\"1\" textAlign=\"end\">\n {error?.message}\n </Text.Caption>\n )\n}\n","import { Text } from '@/components/Text'\nimport React from 'react'\nimport { Box } from '@/components/Box'\n\nexport function Label({ children, id, required = false }) {\n return (\n <Text.Body2\n as=\"label\"\n htmlFor={id}\n part=\"field-label\"\n fontWeight=\"medium\"\n mb=\"2\"\n display=\"block\"\n >\n {children}\n <Box part=\"field-label-required\" display=\"inline\">\n {required && '*'}\n </Box>\n </Text.Body2>\n )\n}\n","export const box = {\n backgroundColor: 'neutral.background',\n borderColor: 'neutral.border',\n borderStyle: 'solid',\n borderWidth: 'md',\n borderRadius: 'md',\n}\n\nexport const input = {\n ...box,\n px: '4',\n py: '2',\n display: 'block',\n outline: 'none',\n width: '100%',\n}\n\nexport const checkContainer = {\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 position: <const>'absolute',\n top: '-1px',\n width: 'calc(100% + 2px)',\n color: 'primary.foreground',\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\nexport interface FieldProps {\n value: string\n onChange: (value: string) => void\n [key: string]: unknown\n}\n\ninterface BaseFieldProps extends FormFieldProps {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO: Tighten up fieldProps type\n children: (fieldProps?: FieldProps) => React.ReactNode\n}\n\nexport function BaseField({ children, field, fieldData, fieldState }: BaseFieldProps) {\n const { id, label, placeholder, props } = 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 ...props,\n }\n\n return (\n <Box 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","export function CheckIcon(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className=\"size-5\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n d=\"M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n )\n}\n","import * as React from 'react'\nimport * as Select from '@radix-ui/react-select'\nimport { ChevronDownMiniIcon } from '@/components/Icon/ChevronDownMiniIcon'\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'\nimport { SelectMultipleField } from '@/components/Form/fields/SelectMultipleField'\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=\"neutral.900\"\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 if (props.fieldData.multiple) {\n return <SelectMultipleField {...props} />\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={ChevronDownMiniIcon}\n color=\"neutral.100\"\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 boxShadow=\"md\"\n maxHeight=\"var(--radix-select-content-available-height)\"\n p=\"1\"\n part=\"field-select-options\"\n width=\"var(--radix-popper-anchor-width)\"\n zIndex=\"99999\"\n >\n <Select.Viewport>{selectItems}</Select.Viewport>\n </Box>\n </Select.Content>\n </Select.Portal>\n </Select.Root>\n )}\n </BaseField>\n )\n}\n","export function ChevronDownMiniIcon(props: React.SVGProps<SVGSVGElement>) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n className=\"size-5\"\n {...props}\n >\n <path\n fillRule=\"evenodd\"\n d=\"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n )\n}\n","import * as React from 'react'\n\nimport { type FormFieldProps } from '..'\nimport { BaseField } from './BaseField'\nimport { Flex } from '@/components/Flex'\nimport * as Checkbox from '@radix-ui/react-checkbox'\nimport { Box } from '@/components/Box'\nimport { CheckIcon } from '@/components/Icon/CheckIcon'\nimport { Text } from '@/components/Text'\nimport * as baseStyles from '@/components/Form/fields/BaseField.styles'\n\nexport function SelectMultipleField(props: FormFieldProps) {\n const {\n field: { onChange },\n fieldData: { options = [] },\n } = props\n\n const [valueArray, setValueArray] = React.useState<string[]>([])\n\n function setValueInArray(value: string) {\n let updatedValueArray = []\n if (valueArray.includes(value)) {\n updatedValueArray = [...valueArray.filter((v) => v !== value)]\n } else {\n updatedValueArray = [...valueArray, value]\n }\n setValueArray(updatedValueArray)\n onChange(updatedValueArray)\n }\n\n return (\n <BaseField {...props}>\n {() => (\n <Flex.Column gap={2} part=\"field-select-multiple\">\n {options.map(({ label, value }) => (\n <Checkbox.Root\n value={valueArray.includes(value) ? value : undefined}\n onCheckedChange={() => setValueInArray(value)}\n key={value}\n asChild\n >\n <Box\n as=\"button\"\n backgroundColor=\"neutral.background\"\n borderColor=\"neutral.border\"\n borderRadius=\"md\"\n borderStyle=\"solid\"\n borderWidth=\"md\"\n display=\"flex\"\n justifyContent=\"space-between\"\n part=\"field-check\"\n px={4}\n py={2}\n >\n <Text.Body2 part=\"field-check-label\">{label}</Text.Body2>\n\n <Box\n backgroundColor=\"inherit\"\n borderWidth=\"md\"\n borderStyle=\"solid\"\n borderColor=\"neutral.border\"\n borderRadius=\"100%\"\n flex=\"0 0 auto\"\n id={value}\n padding=\"0\"\n part=\"field-check-value\"\n position=\"relative\"\n height=\"24px\"\n width=\"24px\"\n >\n <Checkbox.Indicator asChild>\n <Box {...baseStyles.checkContainer}>\n <CheckIcon height=\"14\" width=\"14\" />\n </Box>\n </Checkbox.Indicator>\n </Box>\n </Box>\n </Checkbox.Root>\n ))}\n </Flex.Column>\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 * as React from 'react'\nimport * as Checkbox from '@radix-ui/react-checkbox'\n\nimport { Box } from '@/components/Box'\nimport { Text } from '@/components/Text'\n\nimport { type FormFieldProps } from '..'\nimport { CheckIcon } from '@/components/Icon/CheckIcon'\nimport * as baseStyles from '@/components/Form/fields/BaseField.styles'\n\nexport function CheckboxField(props: FormFieldProps) {\n const {\n field: { onChange, value },\n fieldData: { label, id = [] },\n } = props\n\n return (\n <Box part=\"field\" display=\"flex\" gap={2} alignItems=\"center\">\n <Checkbox.Root\n defaultChecked\n onCheckedChange={onChange}\n value={value}\n checked={value === true}\n asChild\n >\n <Box\n {...baseStyles.box}\n as=\"button\"\n width=\"25px\"\n minWidth=\"25px\"\n height=\"25px\"\n justifyContent=\"center\"\n alignItems=\"center\"\n display=\"flex\"\n // @ts-expect-error :hover type isn't in style props yet\n backgroundColor:hover=\"neutral.900\"\n part=\"field-checkbox\"\n id={id as string}\n >\n <Checkbox.Indicator asChild>\n <Box\n width=\"20px\"\n height=\"20px\"\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n >\n <CheckIcon height=\"14\" fill=\"currentColor\" />\n </Box>\n </Checkbox.Indicator>\n </Box>\n </Checkbox.Root>\n <Text.Body2 part=\"field-checkbox-label\" as=\"label\" htmlFor={id}>\n {label}\n </Text.Body2>\n </Box>\n )\n}\n","import { FlowStep } from '@frigade/js'\nimport type { ControllerFieldState, Message, UseFormReturn, ValidationRule } from 'react-hook-form'\n\nimport { Card } from '@/components/Card'\nimport { Flow, type FlowPropsWithoutChildren } from '@/components/Flow'\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'\nimport { CheckboxField } from '@/components/Form/fields/CheckboxField'\n\nexport type FieldTypes = Record<string, React.ComponentType<FormFieldProps>>\n\nconst defaultFieldTypes: FieldTypes = {\n checkbox: CheckboxField,\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 value?: string\n multiple?: boolean\n props?: Record<string, string | number | boolean | undefined>\n // allow any other custom properties\n [key: string]: unknown\n}\n\n// TODO: Wire UseControllerReturn into this type\nexport interface FormFieldProps {\n /**\n * React Hook Form's controller for the field. Use field.onChange() to update the field value.\n * See https://react-hook-form.com/api/usecontroller for more.\n */\n field: any // eslint-disable-line @typescript-eslint/no-explicit-any\n /**\n * Form-specific data for decorating the field.\n */\n fieldData: FormFieldData\n /**\n * React Hook Form's form context. See https://react-hook-form.com/api/useformcontext for more.\n */\n formContext: UseFormReturn\n /**\n * Function for submitting the current field.\n * @ignore\n */\n fieldState: ControllerFieldState\n /**\n * Function for submitting the current step of the form.\n * @ignore\n */\n submit: () => void\n}\n\nexport interface FormProps extends FlowPropsWithoutChildren {\n /**\n * Custom field types to be used in the Form.\n * You can use this to build your own custom form fields in a `Form`.\n *\n * For example, if you want to use a custom field type called `calendar`:\n *\n * ```tsx\n * import { Form, FormFieldProps } from '@frigade/react'\n *\n * function CalendarField({ field, submit }: FormFieldProps) {\n * return (\n * <div>\n * <input type=\"date\" onChange={field.onChange} value={field.value} />\n * </div>\n * )\n * }\n *\n * // ...\n *\n * <Form flowId=\"my-flow-id\" fieldTypes={{ calendar: CalendarField }} />\n *\n * ```\n *\n */\n fieldTypes?: FieldTypes\n}\n\nexport function Form({ fieldTypes = {}, flowId, part, ...props }: FormProps) {\n const mergedFieldTypes = Object.assign({}, defaultFieldTypes, fieldTypes)\n\n return (\n <Flow as={Card} flowId={flowId} part={['form', part]} {...props}>\n {(childProps) => <FormStep fieldTypes={mergedFieldTypes} {...childProps} />}\n </Flow>\n )\n}\n","// eslint-disable-next-line react-refresh/only-export-components -- NPS is a valid component name\nexport { NPS, type NPSProps } from './NPS'\n","import { Button } from '@/components/Button'\nimport { Flex } from '@/components/Flex'\nimport { FormFieldProps } from '@/components/Form'\nimport { Text } from '@/components/Text'\n\nexport function NPSField({\n field,\n fieldData,\n submit,\n options,\n positiveLabel,\n negativeLabel,\n}: FormFieldProps & {\n options: { label: string; value: string }[]\n positiveLabel?: string\n negativeLabel?: string\n}) {\n const buttons = options.map((option) => {\n const Component = field.value === option.value ? Button.Primary : Button.Secondary\n return (\n <Component\n borderWidth=\"1px\"\n key={option.value}\n onClick={() => {\n field.onChange(option.value)\n submit()\n }}\n title={option.label}\n css={{\n '.fr-button-title': {\n fontSize: '15px',\n },\n }}\n />\n )\n })\n return (\n <Flex.Column gap={2}>\n <Flex.Row\n gap={2}\n part=\"field-nps\"\n css={{\n '@media (min-width: 660px)': {\n flexWrap: 'nowrap',\n justifyContent: 'space-between',\n },\n flexWrap: 'wrap',\n justifyContent: 'center',\n }}\n >\n {buttons}\n </Flex.Row>\n <Flex.Row justifyContent=\"space-between\" part=\"field-nps-label\">\n <Text.Caption part=\"field-nps-left-label\" color=\"neutral.400\">\n {fieldData.negativeLabel ?? negativeLabel}\n </Text.Caption>\n <Text.Caption part=\"field-nps-right-label\" color=\"neutral.400\">\n {fieldData.positiveLabel ?? positiveLabel}\n </Text.Caption>\n </Flex.Row>\n </Flex.Column>\n )\n}\n","import { Dialog } from '@/components/Dialog'\nimport { Form, type FormProps } from '@/components/Form'\n\nimport { NPSField } from './NPSField'\nimport { useFlow } from '@/hooks/useFlow'\n\ntype NPSOptions = { label: string; value: string }[]\n\nexport interface NPSProps extends FormProps {\n /**\n * The options to display in the NPS field.\n * If not provided, the default NPS numbers from 0 to 10 will be used.\n */\n options?: NPSOptions\n\n /**\n * The label to display for the positive end of the NPS scale.\n * If not provided, the default label \"Extremely likely\" will be used.\n */\n positiveLabel?: string\n\n /**\n * The label to display for the negative end of the NPS scale.\n * If not provided, the default label \"Not likely at all\" will be used.\n */\n negativeLabel?: string\n}\n\nexport function NPS({\n as = Dialog,\n flowId,\n fieldTypes,\n part,\n options,\n positiveLabel,\n negativeLabel,\n ...props\n}: NPSProps) {\n const { flow } = useFlow(flowId)\n\n const defaultOptions =\n (flow?.props?.options as NPSOptions) ??\n [...Array(11)].map((_, i) => ({ label: `${i}`, value: `${i}` }))\n const npsOptions = options || defaultOptions\n\n return (\n <Form\n alignSelf=\"end\"\n as={as}\n flowId={flowId}\n fieldTypes={{\n nps: (fieldProps) => (\n <NPSField\n {...fieldProps}\n options={npsOptions}\n positiveLabel={\n (flow?.props?.positiveLabel as string) ?? positiveLabel ?? 'Extremely likely'\n }\n negativeLabel={\n (flow?.props?.negativeLabel as string) ?? negativeLabel ?? 'Not likely at all'\n }\n />\n ),\n ...fieldTypes,\n }}\n modal={false}\n onEscapeKeyDown={(e: KeyboardEvent) => {\n if (typeof props.onEscapeKeyDown === 'function') {\n props.onEscapeKeyDown(e)\n }\n\n if (!e.defaultPrevented) {\n flow.skip()\n }\n }}\n part={['nps', part]}\n {...props}\n css={{\n ...{\n // Hides the submit button on the first page\n ...(!flow || flow.getCurrentStepIndex() == 0\n ? { '.fr-form-step-footer': { display: 'none' } }\n : {\n '.fr-card-header': {\n // Heuristic to prevent width jumpiness between first and second step\n minWidth: npsOptions.length * 51,\n },\n }),\n '.fr-form': {\n padding: '20px',\n '@media (max-width: 660px)': {\n minWidth: '100%',\n },\n },\n '.fr-nps-field': {\n '@media (min-width: 660px)': {\n minWidth: 'fit-content',\n },\n minWidth: '100%',\n },\n '.fr-form-step': {\n gap: '14px',\n '@media (min-width: 660px)': {\n gap: '1',\n },\n },\n '.fr-nps': {\n maxWidth: 'min-content',\n },\n ...((props.css as object) ?? {}),\n },\n }}\n />\n )\n}\n","import { useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nexport function useClientPortal(\n children: React.ReactNode,\n container: Element | DocumentFragment | string,\n key?: null | string\n) {\n const [mounted, setMounted] = useState(false)\n const containerRef = useRef<Element | DocumentFragment>()\n\n useEffect(() => {\n containerRef.current =\n typeof container === 'string' ? document.querySelector(container) : container\n setMounted(true)\n }, [container])\n\n return mounted ? createPortal(children, containerRef.current, key) : null\n}\n","import { useClientPortal } from '@/hooks/useClientPortal'\n\nexport interface ClientPortalProps {\n children?: React.ReactNode\n container?: Parameters<typeof useClientPortal>[1]\n}\n\nexport function ClientPortal({ children, container = 'body' }: ClientPortalProps) {\n return useClientPortal(children, container)\n}\n","import { keyframes } from '@emotion/react'\n\nimport { Card } from '@/components/Card'\nimport type { FlowProps, FlowChildrenProps } from '@/components/Flow'\nimport { Hint, type HintProps } from '@/components/Hint'\nimport * as Progress from '@/components/Progress'\n\nimport { useStepHandlers } from '@/hooks/useStepHandlers'\n\nimport { getVideoProps } from '@/components/Media/videoProps'\n\nconst fadeIn = keyframes`\n from {\n opacity: 0;\n }\n 25% {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n`\n\nexport interface TourStepProps\n extends Omit<HintProps, 'anchor'>,\n Pick<FlowProps, 'dismissible' | 'onPrimary' | 'onSecondary'>,\n Pick<FlowChildrenProps, 'flow' | 'handleDismiss' | 'step'> {}\n\nexport function TourStep({\n align,\n alignOffset,\n autoScroll,\n defaultOpen,\n dismissible,\n flow,\n handleDismiss,\n lockScroll,\n modal,\n onPrimary,\n onSecondary,\n part,\n side,\n sideOffset,\n spotlight,\n step,\n ...props\n}: TourStepProps) {\n const { handlePrimary, handleSecondary } = useStepHandlers(step, {\n onPrimary,\n onSecondary,\n })\n\n const { videoProps, otherProps } = getVideoProps(props)\n\n const primaryButtonTitle = step.primaryButton?.title ?? step.primaryButtonTitle\n const secondaryButtonTitle = step.secondaryButton?.title ?? step.secondaryButtonTitle\n const disabled = !!step.$state.blocked\n\n return (\n <Hint\n align={align}\n alignOffset={alignOffset}\n anchor={step.selector as string}\n autoScroll={autoScroll}\n data-step-id={step.id}\n defaultOpen={defaultOpen}\n lockScroll={lockScroll}\n modal={modal}\n part={part}\n side={side}\n sideOffset={sideOffset}\n spotlight={spotlight}\n onMount={() => {\n if (defaultOpen && !disabled) {\n step?.start()\n }\n }}\n {...otherProps}\n >\n <Card\n animation={`${fadeIn} 300ms ease-out`}\n boxShadow=\"md\"\n maxWidth=\"min(360px, calc(100vw - 25px))\"\n >\n <Card.Media\n aspectRatio=\"2\"\n borderRadius=\"md md 0 0\"\n borderWidth=\"0\"\n margin=\"-5 -5 0\"\n objectFit=\"cover\"\n overflowClipMargin=\"unset\"\n src={step.videoUri ?? step.imageUri}\n transform=\"translate3d(0, 0, 1px)\"\n type={step.videoUri ? 'video' : 'image'}\n {...videoProps}\n />\n\n <Card.Header\n css={{\n '.fr-dismiss': {\n position: 'absolute',\n right: '12px',\n top: '12px',\n },\n }}\n dismissible={dismissible}\n handleDismiss={handleDismiss}\n subtitle={step.subtitle}\n title={step.title}\n />\n <Card.Footer>\n {flow.getNumberOfAvailableSteps() > 1 && (\n <Progress.Fraction\n current={flow.getCurrentStepOrder() + 1}\n marginRight=\"auto\"\n total={flow.getNumberOfAvailableSteps()}\n />\n )}\n <Card.Secondary\n disabled={disabled}\n onClick={handleSecondary}\n title={secondaryButtonTitle}\n />\n <Card.Primary disabled={disabled} onClick={handlePrimary} title={primaryButtonTitle} />\n </Card.Footer>\n </Card>\n </Hint>\n )\n}\n","import { useRef, useState } from 'react'\n\nimport { Box, type BoxProps } from '@/components/Box'\nimport { Overlay } from '@/components/Overlay'\nimport { Ping } from '@/components/Ping'\nimport { Spotlight } from '@/components/Spotlight'\n\nimport { getPingPosition } from '@/components/Hint/getPingPosition'\nimport { useAutoScroll } from '@/hooks/useAutoScroll'\nimport { useFloating } from '@/hooks/useFloating'\nimport { useVisibility } from '@/hooks/useVisibility'\n\nexport type AlignValue = 'after' | 'before' | 'center' | 'end' | 'start'\nexport type SideValue = 'bottom' | 'left' | 'right' | 'top'\nexport type ExtendedPlacement = `${SideValue}-${AlignValue}`\n\nexport interface HintProps extends BoxProps {\n align?: AlignValue\n alignOffset?: number\n anchor: string\n autoScroll?: ScrollIntoViewOptions | boolean\n children?: React.ReactNode\n defaultOpen?: boolean\n lockScroll?: boolean\n modal?: boolean\n onMount?: () => void\n onOpenChange?: (open: boolean) => void\n open?: boolean\n side?: SideValue\n sideOffset?: number\n spotlight?: boolean\n}\n\nexport function Hint({\n align = 'center',\n alignOffset = 0,\n anchor,\n autoScroll = false,\n children,\n css = {},\n defaultOpen = true,\n lockScroll = true,\n modal = false,\n onMount,\n onOpenChange = () => {},\n open,\n part,\n side = 'bottom',\n sideOffset = 0,\n spotlight = false,\n style = {},\n ...props\n}: HintProps) {\n const [internalOpen, setInteralOpen] = useState(defaultOpen)\n\n // Defer to controlled open prop, otherwise manage open state internally\n const canonicalOpen = open ?? internalOpen\n\n const { getFloatingProps, getReferenceProps, floatingStyles, placement, refs, status } =\n useFloating({\n align,\n alignOffset,\n anchor,\n onOpenChange: (newOpen) => {\n onOpenChange(newOpen)\n\n if (open == null) {\n setInteralOpen(newOpen)\n }\n },\n open: canonicalOpen,\n side,\n sideOffset,\n })\n\n const [finalSide, finalAlign] = placement.split('-')\n const referenceProps = getReferenceProps()\n\n const { isVisible } = useVisibility(refs.reference.current as Element | null)\n const isMounted = useRef(false)\n\n useAutoScroll(refs.reference.current as Element, autoScroll)\n\n const shouldMount = refs.reference.current !== null && isVisible\n\n if (!shouldMount) {\n isMounted.current = false\n return null\n } else if (isMounted.current === false) {\n isMounted.current = true\n onMount?.()\n }\n\n return (\n <>\n {spotlight && canonicalOpen && <Spotlight anchor={anchor} lockScroll={lockScroll} />}\n {modal && !spotlight && canonicalOpen && <Overlay lockScroll={lockScroll} />}\n\n <Box\n css={{\n '&[data-status=\"open\"]': {\n transition: 'transform 0.2s ease-out',\n },\n ...css,\n }}\n data-placement={placement}\n data-status={status.status}\n part={['hint', part]}\n ref={refs.setFloating}\n style={{\n ...floatingStyles,\n ...style,\n }}\n {...getFloatingProps()}\n {...props}\n >\n {canonicalOpen && children}\n\n <Ping\n {...referenceProps}\n position=\"absolute\"\n style={getPingPosition({ align: finalAlign, side: finalSide })}\n clickable={defaultOpen === false}\n />\n </Box>\n </>\n )\n}\n","import { keyframes } from '@emotion/react'\nimport { useEffect, useState } from 'react'\n\nimport { Box, type BoxProps } from '@/components/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 PingProps extends BoxProps {\n clickable?: boolean\n}\n\nexport function Ping({ clickable = false, part = '', style = {}, ...props }: PingProps) {\n const [hasMounted, setHasMounted] = useState(false)\n\n useEffect(() => {\n setHasMounted(true)\n }, [])\n\n return (\n <Box\n borderRadius=\"24px\"\n height=\"24px\"\n part={`ping-wrapper ${part}`}\n position=\"relative\"\n width=\"24px\"\n cursor={clickable ? 'pointer' : undefined}\n style={{\n opacity: hasMounted ? 1 : 0,\n ...style,\n }}\n transition={'opacity 0.2s ease-out'}\n {...props}\n >\n <Box\n backgroundColor=\"primary.surface\"\n animation={`2s ease-out infinite ${pulse}`}\n borderRadius=\"24px\"\n height=\"48px\"\n left=\"-12px\"\n part=\"ping-pulse\"\n pointerEvents=\"none\"\n position=\"absolute\"\n top=\"-12px\"\n transformOrigin=\"center center\"\n width=\"48px\"\n />\n <Box\n backgroundColor=\"primary.surface\"\n borderRadius=\"12px\"\n height=\"24px\"\n left=\"0\"\n part=\"ping\"\n position=\"absolute\"\n top=\"0\"\n width=\"24px\"\n backgroundColor:hover={clickable ? 'primary.hover.surface' : undefined}\n />\n </Box>\n )\n}\n","export function getPingPosition({ align, side }) {\n const style = {}\n const pingOffset = '-12px'\n\n const oppositeSides = {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right',\n }\n\n /* \n Rules:\n - Ping is opposite to side prop (e.g. side=left -> ping=right)\n - align=before|end -> Ping goes to highest extent (right/bottom) of align-axis\n - align=after|start -> Ping goes to lowest extent (left/top) of align-axis\n - align=center -> Ping goes to the center\n */\n\n style[oppositeSides[side]] = pingOffset\n\n if (['before', 'end'].includes(align)) {\n if (['top', 'bottom'].includes(side)) {\n style['right'] = pingOffset\n } else {\n style['bottom'] = pingOffset\n }\n } else if (['after', 'start'].includes(align)) {\n if (['top', 'bottom'].includes(side)) {\n style['left'] = pingOffset\n } else {\n style['top'] = pingOffset\n }\n } else {\n // The only option left is align=center\n if (['top', 'bottom'].includes(side)) {\n style['left'] = `calc(50% + ${pingOffset})`\n } else {\n style['top'] = `calc(50% + ${pingOffset})`\n }\n }\n\n return style\n}\n","import { Box } from '@/components/Box'\nimport { ClientPortal, type ClientPortalProps } from '@/components/ClientPortal/ClientPortal'\nimport { Flow, type FlowPropsWithoutChildren } from '@/components/Flow'\nimport { AlignValue, SideValue, type HintProps } from '@/components/Hint'\nimport { TourStep } from '@/components/Tour/TourStep'\n\nexport interface TourProps extends FlowPropsWithoutChildren, Omit<HintProps, 'anchor'> {\n /**\n * The alignment of the tooltip relative to the anchor.\n * Possible values: `after`, `before`, `center`, `end`, `start`.\n */\n align?: AlignValue\n /**\n * The offset of the tooltip relative to the anchor along the alignment axis.\n */\n alignOffset?: number\n /**\n * Automatically scroll to the anchor element of the current Step\n */\n autoScroll?: boolean\n /**\n * Specify a container in the DOM render the Tour into.\n * Use this to render the Tour into a different container/scrollable ancestor.\n */\n container?: ClientPortalProps['container']\n /**\n * Whether the tooltip should be open by default.\n */\n defaultOpen?: boolean\n /**\n * Whether to lock the scroll of the container when the Spotlight is enabled.\n * Defaults to `true`.\n */\n lockScroll?: boolean\n /**\n * Whether to render a modal overlay behind the tooltip.\n */\n modal?: boolean\n /**\n * Callback function triggered when the open state of the tooltip changes.\n */\n onOpenChange?: (open: boolean) => void\n /**\n * Controls the open state of the tooltip. Use this for controlled components.\n */\n open?: boolean\n /**\n * Whether the Tour should be completed by the end-user in sequential order.\n * If `false`, all steps will be rendered at once.\n * Defaults to `true`, which means only one step will be rendered at a time in sequential order.\n */\n sequential?: boolean\n /**\n * The preferred side of the anchor to render the tooltip.\n * Possible values: `top`, `right`, `bottom`, `left`.\n */\n side?: SideValue\n /**\n * The distance in pixels from the tooltip to the anchor element.\n */\n sideOffset?: number\n /**\n * Whether to highlight the anchor element with a spotlight/scrim effect.\n */\n spotlight?: boolean\n}\n\nfunction TourWrapper({ children, container, flowId, ...props }: Partial<TourProps>) {\n return (\n <ClientPortal container={container}>\n <Box data-flow-id={flowId} part=\"tour\" {...props}>\n {children}\n </Box>\n </ClientPortal>\n )\n}\n\nexport function Tour({ as, flowId, ...props }: TourProps) {\n const { onDismiss, onPrimary, onSecondary } = props\n\n return (\n <Flow as={null} flowId={flowId} autoStart={false} {...props}>\n {({ flow, handleDismiss, parentProps, step }) => {\n const {\n align = 'after',\n alignOffset = 0,\n autoScroll = false,\n container = 'body',\n defaultOpen,\n lockScroll = true,\n modal,\n onOpenChange,\n open,\n part,\n sequential = true,\n side = 'bottom',\n sideOffset = 0,\n spotlight,\n zIndex = 9999,\n ...containerProps\n } = parentProps.containerProps as Partial<TourProps>\n\n const { dismissible } = parentProps\n\n const sequentialStepProps = {\n align,\n alignOffset,\n autoScroll,\n dismissible,\n flow,\n handleDismiss,\n modal,\n onPrimary,\n onSecondary,\n onOpenChange,\n open,\n part,\n side,\n sideOffset,\n spotlight,\n step,\n zIndex,\n ...(step.props ?? {}),\n }\n\n if (sequential) {\n return (\n <TourWrapper\n as={as}\n container={container}\n flowId={flowId}\n part=\"tour\"\n zIndex={zIndex}\n {...containerProps}\n >\n <TourStep\n defaultOpen={defaultOpen ?? true}\n key={step.id}\n lockScroll={lockScroll}\n {...sequentialStepProps}\n />\n </TourWrapper>\n )\n }\n\n // TODO: Only render spotlight if current step\n // TODO: Only render modal overlay once\n const tourSteps = Array.from(flow.steps.values())\n .filter((currentStep) => {\n const { blocked, completed, skipped, visible } = currentStep.$state\n\n return !blocked && !completed && !skipped && visible\n })\n .map((currentStep) => {\n /*\n * Bit of a weird case here:\n * When sequential == false, we're only dismissing currentStep, not the whole Flow\n */\n async function handleDismissStep(e: MouseEvent | KeyboardEvent) {\n const continueDefault = await onDismiss?.(flow, e)\n\n if (continueDefault === false) {\n e.preventDefault()\n return false\n }\n\n currentStep.skip()\n\n return true\n }\n\n const shouldShowSpotlight = spotlight && currentStep.id === step.id\n\n const currentStepZIndex = currentStep.props?.zIndex ?? zIndex\n\n const nonSequentialStepProps = {\n align,\n alignOffset,\n dismissible,\n flow,\n handleDismiss: handleDismissStep,\n onPrimary,\n onSecondary,\n onOpenChange,\n open,\n part,\n side,\n sideOffset,\n spotlight,\n zIndex: currentStepZIndex,\n ...(currentStep.props ?? {}),\n }\n\n return (\n <TourStep\n css={{\n '&:has([aria-expanded=true])': {\n zIndex: Number(currentStepZIndex) + 2,\n },\n\n // NOTE: Selector does not currently apply due to rearranged component structure\n '.fr-overlay': {\n zIndex: Number(currentStepZIndex) + 1,\n },\n\n '.fr-progress-fraction': {\n display: 'none',\n },\n }}\n defaultOpen={(defaultOpen || shouldShowSpotlight) ?? false}\n key={`${currentStep.id}-${shouldShowSpotlight}`}\n lockScroll={lockScroll}\n step={currentStep}\n {...nonSequentialStepProps}\n />\n )\n })\n\n return (\n <TourWrapper\n as={as}\n container={container}\n flowId={flowId}\n part=\"tour\"\n zIndex={zIndex}\n {...containerProps}\n >\n {tourSteps}\n </TourWrapper>\n )\n }}\n </Flow>\n )\n}\n","import { useContext, useEffect } from 'react'\n\nimport { FrigadeContext } from '@/components/Provider'\n\nimport { useFlow } from '@/hooks/useFlow'\nimport { useCollections } from './useCollections'\nimport { Collection, Flow } from '@frigade/js'\n\nexport function useCollection(collectionId?: string): {\n collection: Collection | undefined\n currentFlow: Flow | undefined\n} {\n const { frigade } = useContext(FrigadeContext)\n const { collections } = useCollections()\n\n const collection = collections?.get(collectionId)\n\n const enrichedFlows =\n collections\n ?.get(collectionId)\n ?.flows?.filter((flowInCollection) => flowInCollection.visible)\n .map((item) => ({\n ...item,\n flow: frigade?.getFlowSync(item.flowId),\n })) ?? []\n\n const flowId = enrichedFlows.find(({ flow }) => flow.isVisible)?.flowId\n\n const { flow } = useFlow(flowId)\n\n useEffect(() => {\n frigade?.registerCollection(collectionId)\n }, [collectionId, frigade])\n\n return {\n collection,\n currentFlow: flow,\n }\n}\n","import { useCallback, useContext, useRef, useState } from 'react'\nimport { CollectionsList } from '@frigade/js'\n\nimport { FrigadeContext } from '@/components/Provider'\nimport { useSyncExternalStore } from '@/hooks/useSyncExternalStore'\n\nexport function useCollections() {\n const { frigade } = useContext(FrigadeContext)\n const [, setForceRender] = useState<boolean>(false)\n\n const debounceTimeout = useRef<ReturnType<typeof setTimeout>>()\n\n const subscribe = useCallback(\n (cb: () => void) => {\n // TODO: Why is there a noticeable delay when this is commented out?\n frigade?.getCollections().then(() => {\n cb()\n })\n\n const handler = () => {\n clearTimeout(debounceTimeout.current)\n\n /*\n * NOTE: Since React doesn't re-render on deep object diffs,\n * we need to gently prod it here by creating a state update.\n */\n debounceTimeout.current = setTimeout(() => {\n setForceRender((forceRender) => !forceRender)\n\n cb()\n }, 0)\n }\n\n frigade?.on('flow.any', handler)\n\n return () => {\n frigade?.off('flow.any', handler)\n }\n },\n [frigade]\n )\n\n const getSnapshot = () => {\n let result = undefined\n\n try {\n result = frigade?.getCollectionsSync()\n } catch (noGlobalStateYet) {\n // no-op\n }\n\n return result\n }\n\n const collections = useSyncExternalStore<CollectionsList | undefined>(\n subscribe,\n getSnapshot,\n getSnapshot\n )\n\n return {\n collections,\n }\n}\n","import * as React from 'react'\nimport * as UseSyncExternalStoreShim from 'use-sync-external-store/shim/index.js'\n\n// useSyncExternalStore doesn't exist in React 17, so shim it if necessary\nconst useSyncExternalStore =\n 'useSyncExternalStore' in React\n ? React.useSyncExternalStore\n : UseSyncExternalStoreShim.useSyncExternalStore\n\nexport { useSyncExternalStore }\n","import type { JSX } from '@emotion/react/jsx-runtime'\n\nimport { Announcement } from '@/components/Announcement'\nimport { Banner } from '@/components/Banner'\nimport { Box, type BoxProps } from '@/components/Box'\nimport { Card } from '@/components/Card'\nimport * as Checklist from '@/components/Checklist'\nimport type { FlowProps } from '@/components/Flow'\nimport { Form } from '@/components/Form'\nimport * as Survey from '@/components/Survey'\nimport { Tour } from '@/components/Tour'\n\nimport { useCollection } from '@/hooks/useCollection'\nimport { FlowType } from '@frigade/js'\nimport { Dialog } from '@/components/Dialog'\n\nexport interface CollectionProps extends BoxProps {\n /**\n * The unique ID of the Collection to render. You can find the Collection ID in the Frigade dashboard.\n */\n collectionId: string\n\n /**\n * A map of variables to pass to Flows in this Collection.\n * Example:\n * ```tsx\n * variables={{\n * name: \"Bobby Nerves\",\n * occupation: \"Vocalist\",\n * }}\n * ```\n */\n variables?: FlowProps['variables']\n}\n\nexport function Collection({ collectionId, part, variables = {}, ...props }: CollectionProps) {\n const flowTypeMap = {\n ANNOUNCEMENT: Announcement,\n BANNER: Banner,\n CARD: Card,\n CHECKLIST: Checklist.Collapsible,\n EMBEDDED_TIP: Card,\n FORM: Form,\n NPS_SURVEY: Survey.NPS,\n SURVEY: Survey.NPS,\n TOUR: Tour,\n }\n\n const { currentFlow } = useCollection(collectionId)\n\n const FlowComponent: JSX.ElementType = flowTypeMap[currentFlow?.rawData?.flowType] ?? null\n\n if (currentFlow == null || FlowComponent == null) {\n return null\n }\n\n if (currentFlow?.rawData?.flowType === FlowType.FORM) {\n return (\n <Box part={['collection', part]} data-collection-id={collectionId} {...props}>\n <Form flowId={currentFlow.id} key={currentFlow.id} as={Dialog} variables={variables} />\n </Box>\n )\n }\n\n return (\n <Box part={['collection', part]} data-collection-id={collectionId} {...props}>\n <FlowComponent flowId={currentFlow.id} key={currentFlow.id} variables={variables} />\n </Box>\n )\n}\n","import { Collection } from '@/components/Collection'\nimport { useCollection } from '@/hooks/useCollection'\nimport { useCollections } from '@/hooks/useCollections'\n\nexport function DefaultCollection() {\n const { collections } = useCollections()\n\n const collectionId = Array.from(collections?.entries() ?? []).find(\n (entry) => entry[1].collectionType === 'DEFAULT'\n )?.[0]\n\n useCollection(collectionId)\n\n if (collectionId == null) {\n return null\n }\n\n return <Collection as={null} collectionId={collectionId} />\n}\n","import type { CollectionsRegistryCallback, Frigade } from '@frigade/js'\nimport { createContext, type Dispatch, type SetStateAction } from 'react'\n\nimport type { ProviderProps } from './Provider'\n\nexport interface ProviderContext extends Omit<ProviderProps, 'children' | 'theme'> {\n currentModal: string | null\n setCurrentModal: Dispatch<SetStateAction<string | null>>\n frigade?: Frigade\n hasInitialized: boolean\n registerComponent: (flowId: string, callback?: CollectionsRegistryCallback) => void\n unregisterComponent: (flowId: string) => void\n variables: Record<string, unknown>\n}\n\nexport const FrigadeContext = createContext<ProviderContext>({\n apiKey: '',\n currentModal: null,\n setCurrentModal: () => {},\n navigate: () => {},\n hasInitialized: false,\n registerComponent: () => {},\n unregisterComponent: () => {},\n variables: {},\n})\n","import { useEffect } from 'react'\nimport { useFrigade } from '@/hooks/useFrigade'\n\nexport function ImagePreloader() {\n const { frigade } = useFrigade()\n\n useEffect(() => {\n ;(async () => {\n const flows = await frigade.getFlows()\n flows.forEach((flow) => {\n flow.steps.forEach((step) => {\n if (step.imageUri) {\n const img = new Image()\n img.src = step.imageUri\n }\n })\n })\n })()\n }, [frigade])\n\n return null\n}\n","import { useContext } from 'react'\n\nimport { FrigadeContext } from '@/components/Provider'\nimport { logOnce } from '../shared/log'\n\nexport function useFrigade() {\n const context = useContext(FrigadeContext)\n if (!context || !context.frigade) {\n logOnce('useFrigade() must be used in a child of the Frigade Provider', 'warn')\n }\n\n const { frigade } = context\n\n return { frigade, isLoading: !frigade?.isReady() }\n}\n","const logOnce = (message: string, type: 'log' | 'warn' | 'error' = 'log') => {\n const key = `__frigade_logged_${message}`\n\n if (globalThis[key as keyof typeof globalThis]) {\n return\n }\n\n // @ts-expect-error: globalThis is not typed\n globalThis[key as keyof typeof globalThis] = true\n console[type](message)\n}\n\nexport { logOnce }\n","export const SDK_VERSION = '2.9.3';","import { useCallback, useEffect, useRef } from 'react'\n\nimport { Flow } from '@frigade/js'\n\n/**\n * A function that handles a Flow event.\n * If the function returns a promise that evaluates to `false`, the Flow's state will not be updated for the current user (e.g. a Flow will not be marked as completed or dismissed).\n */\nexport type FlowHandlerProp = (\n /**\n * The Flow that the handler is being called on\n */\n flow: Flow,\n /**\n * The event that triggered the handler\n */\n event?: MouseEvent | KeyboardEvent\n) => Promise<boolean | void> | (boolean | void)\n\nexport interface FlowHandlerProps {\n onComplete?: FlowHandlerProp\n onDismiss?: FlowHandlerProp\n}\n\nexport type DismissHandler = (e: MouseEvent | KeyboardEvent) => 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 async function callHandler() {\n if (flow.isCompleted && lastCompleted.current === false) {\n lastCompleted.current = true\n await onComplete?.(flow)\n }\n }\n\n callHandler()\n lastCompleted.current = flow?.isCompleted\n return () => {\n callHandler()\n }\n }, [flow, flow?.isCompleted, onComplete])\n\n return {\n handleDismiss: useCallback<DismissHandler>(\n async (e: MouseEvent | KeyboardEvent) => {\n const continueDefault = await onDismiss?.(flow, e)\n\n if (continueDefault === false) {\n e.preventDefault()\n return false\n }\n\n flow.skip()\n },\n [flow, onDismiss]\n ),\n }\n}\n","import { useCallback, useContext, useEffect } from 'react'\nimport type { Flow } from '@frigade/js'\n\nimport { FrigadeContext } from '@/components/Provider'\n\nexport function useCheckForModalCollision(flow: Flow, isModal = true) {\n const { currentModal, setCurrentModal } = useContext(FrigadeContext)\n\n const claimLock = useCallback(\n (flowId: string) => {\n if (isModal && flow?.isVisible) {\n setCurrentModal(flowId)\n }\n },\n [isModal, flow?.isVisible, setCurrentModal]\n )\n\n const releaseLock = useCallback(() => {\n if (flow != null && currentModal === flow?.id) {\n setCurrentModal(null)\n }\n }, [currentModal, flow, setCurrentModal])\n\n useEffect(() => {\n if (flow != null && currentModal === null && flow.isVisible) {\n claimLock(flow.id)\n }\n\n return releaseLock\n }, [claimLock, currentModal, flow, releaseLock])\n\n // Edge case: The current modal may become non-modal while still mounted\n useEffect(() => {\n if (flow != null && (!isModal || !flow.isVisible)) {\n releaseLock()\n }\n }, [flow, isModal, releaseLock])\n\n // No flow? No problem.\n if (flow == null) {\n return {\n hasModalCollision: false,\n }\n }\n\n // Non-modal and hidden components, by definition, can't collide with modals\n if (!isModal || !flow.isVisible) {\n return {\n hasModalCollision: false,\n }\n }\n\n // We already have the lock, send it\n if (currentModal === flow.id) {\n return {\n hasModalCollision: false,\n }\n }\n\n if (currentModal === null) {\n return {\n hasModalCollision: false,\n }\n }\n\n // If we didn't short circuit and didn't have the lock, assume that we're out of lock luck.\n return {\n hasModalCollision: true,\n }\n}\n","import { Card } from '@/components/Card'\nimport { Flex } from '@/components/Flex'\nimport { Flow, type FlowProps } from '@/components/Flow'\n\nimport { getVideoProps } from '@/components/Media/videoProps'\n\nexport function FlowCard({ part, ...props }: FlowProps) {\n return (\n <Flow\n as={Card}\n gap={5}\n borderColor=\"neutral.border\"\n borderStyle=\"solid\"\n borderWidth=\"md\"\n part={['card', part]}\n {...props}\n >\n {({ handleDismiss, handlePrimary, handleSecondary, parentProps: { dismissible }, step }) => {\n const primaryButtonTitle = step.primaryButton?.title ?? step.primaryButtonTitle\n const secondaryButtonTitle = step.secondaryButton?.title ?? step.secondaryButtonTitle\n\n const { videoProps } = getVideoProps(step.props ?? {})\n\n return (\n <>\n <Card.Header\n dismissible={dismissible}\n handleDismiss={handleDismiss}\n subtitle={step.subtitle}\n title={step.title}\n />\n\n <Card.Media\n src={step.videoUri ?? step.imageUri}\n type={step.videoUri ? 'video' : 'image'}\n css={{ objectFit: 'contain', width: '100%' }}\n {...videoProps}\n />\n\n <Flex.Row gap={3} justifyContent=\"flex-end\" part=\"card-footer\">\n <Card.Secondary title={secondaryButtonTitle} onClick={handleSecondary} />\n <Card.Primary title={primaryButtonTitle} onClick={handlePrimary} />\n </Flex.Row>\n </>\n )\n }}\n </Flow>\n )\n}\n","import { Box, BoxProps } from '@/components/Box'\n\nexport interface ImageProps extends BoxProps {\n src: string\n}\n\nexport function Image({ part, src, ...props }: ImageProps) {\n return <Box as=\"img\" maxWidth=\"unset\" part={['image', part]} src={src} {...props} />\n}\n","import * as React from 'react'\nimport { Box, BoxProps } from '@/components/Box'\n\nimport type { VideoPropName } from '@/components/Media/videoProps'\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('youtu.be')) {\n const videoId = videoUri.split('youtu.be/')[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 return null\n}\n\nexport interface VideoProps\n extends BoxProps,\n Pick<React.VideoHTMLAttributes<HTMLVideoElement>, VideoPropName> {}\n\nexport function Video({\n autoPlay,\n controls,\n controlsList,\n crossOrigin,\n disablePictureInPicture,\n disableRemotePlayback,\n loop,\n muted,\n playsInline,\n poster,\n preload,\n part,\n src,\n ...props\n}: VideoProps) {\n const videoEmbedSrc = getVideoEmbedSrc(src)\n\n if (!videoEmbedSrc) {\n // Check if it's a url that ends in .mp4\n if (src?.endsWith('.mp4')) {\n return (\n <Box\n as=\"video\"\n part={['video', part]}\n src={src}\n {...{\n autoPlay,\n controls: controls ?? true,\n controlsList,\n crossOrigin,\n disablePictureInPicture,\n disableRemotePlayback,\n loop,\n muted: muted ?? autoPlay,\n playsInline,\n poster,\n preload,\n }}\n {...props}\n />\n )\n }\n\n console.error(\n `Could not map videoUri ${src} to a known provider (Youtube, Vimeo, Wistia, Loom) or valid mp4 file.`\n )\n return null\n }\n\n return (\n <Box\n allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture\"\n allowFullScreen\n as=\"iframe\"\n backgroundColor=\"neutral.100\"\n borderWidth=\"0\"\n part={['video', part]}\n src={videoEmbedSrc}\n {...props}\n ></Box>\n )\n}\n","import { Image } from './Image'\nimport { Video, type VideoProps } from './Video'\n\nexport interface MediaProps extends VideoProps {\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 type { BoxProps } from '@/components/Box'\nimport type { DialogProps, DialogContentProps, DialogRootProps } from '.'\n\nconst RADIX_PROPS = {\n content: [\n 'onOpenAutoFocus',\n 'onCloseAutoFocus',\n 'onEscapeKeyDown',\n 'onPointerDownOutside',\n 'onInteractOutside',\n ],\n root: ['defaultOpen', 'modal', 'onOpenChange', 'open'],\n} as const\n\nexport function mapDialogProps(props: DialogProps) {\n const contentProps: DialogContentProps = Object.fromEntries(\n RADIX_PROPS.content\n .map((propName) => [propName, props[propName]])\n .filter((propEntry) => propEntry[1] !== undefined)\n )\n const rootProps: DialogRootProps = Object.fromEntries(\n RADIX_PROPS.root\n .map((propName) => [propName, props[propName]])\n .filter((propEntry) => propEntry[1] !== undefined)\n )\n\n const otherProps = {} as BoxProps\n\n for (const propName of Object.keys(props)) {\n if (\n !RADIX_PROPS.content.some((p) => p === propName) &&\n !RADIX_PROPS.root.some((p) => p === propName)\n ) {\n otherProps[propName] = props[propName]\n }\n }\n\n return {\n contentProps,\n otherProps,\n rootProps,\n }\n}\n","import { Dialog, type DialogProps } from '@/components/Dialog'\nimport { Flex } from '@/components/Flex'\nimport { Flow, type FlowPropsWithoutChildren } from '@/components/Flow'\n\nimport { getVideoProps } from '@/components/Media/videoProps'\n\nexport interface AnnouncementProps extends FlowPropsWithoutChildren, DialogProps {\n /**\n * @ignore\n */\n children?: React.ReactNode\n /**\n * @ignore\n */\n open?: boolean\n /**\n * @ignore\n */\n defaultOpen?: boolean\n}\n\nexport function Announcement({ flowId, ...props }: AnnouncementProps) {\n return (\n <Flow as={null} flowId={flowId} {...props}>\n {({\n flow,\n handleDismiss,\n handlePrimary,\n handleSecondary,\n parentProps: { containerProps, dismissible },\n step,\n }) => {\n const primaryButtonTitle = step.primaryButton?.title ?? step.primaryButtonTitle\n const secondaryButtonTitle = step.secondaryButton?.title ?? step.secondaryButtonTitle\n\n const disabled = step.$state.blocked\n\n const { videoProps } = getVideoProps(step.props ?? {})\n\n return (\n <Dialog\n data-step-id={step.id}\n display=\"flex\"\n flexDirection=\"column\"\n gap={5}\n part=\"announcement\"\n textAlign=\"center\"\n {...containerProps}\n >\n {dismissible && <Dialog.Dismiss onClick={handleDismiss} />}\n <Flex.Column gap={1} part=\"announcement-header\">\n <Dialog.Title>{step.title}</Dialog.Title>\n <Dialog.Subtitle>{step.subtitle}</Dialog.Subtitle>\n </Flex.Column>\n\n <Dialog.Media\n aspectRatio=\"1.5\"\n objectFit=\"cover\"\n overflowClipMargin=\"unset\"\n src={step.videoUri ?? step.imageUri}\n transform=\"translate3d(0, 0, 1px)\"\n type={step.videoUri ? 'video' : 'image'}\n width=\"100%\"\n {...videoProps}\n />\n\n <Dialog.ProgressDots\n current={flow.getCurrentStepIndex()}\n total={flow.getNumberOfAvailableSteps()}\n />\n\n <Flex.Row\n css={{\n '& > button': {\n flexBasis: '50%',\n flexGrow: 1,\n },\n }}\n gap={3}\n part=\"announcement-footer\"\n >\n {secondaryButtonTitle && (\n <Dialog.Secondary\n disabled={disabled}\n onClick={handleSecondary}\n title={secondaryButtonTitle}\n />\n )}\n {primaryButtonTitle && (\n <Dialog.Primary\n disabled={disabled}\n onClick={handlePrimary}\n title={primaryButtonTitle}\n />\n )}\n </Flex.Row>\n </Dialog>\n )\n }}\n </Flow>\n )\n}\n","function isObject(obj) {\n return typeof obj === 'object' && obj !== null && !Array.isArray(obj)\n}\n\nexport function deepmerge(...args) {\n const target = args.shift()\n\n // Recurse to the right until we've merged all the way back to a single target and source\n const source = args.length === 1 ? args[0] : deepmerge(...args)\n\n if (!isObject(target) || !isObject(source)) {\n throw new Error('deepmerge can only merge Objects')\n }\n\n const result = structuredClone(target)\n\n Object.entries(source).forEach(([key, value]) => {\n // Is value an Object, i.e. are we at risk of passing by reference?\n if (isObject(value)) {\n // Does key already exist in result?\n if (result[key] !== undefined) {\n // Deepmerge it on\n Object.assign(result, { [key]: deepmerge(result[key], structuredClone(value)) })\n } else {\n // Else clone value onto result\n Object.assign(result, { [key]: structuredClone(value) })\n }\n } else if (Array.isArray(value)) {\n // Does key already exist in result?\n if (result[key] !== undefined) {\n // Clone and spread onto existing\n // TODO: This only shallow-merges arrays. Add ability to deep merge here, so nested structures aren't overwritten\n Object.assign(result, { [key]: [...result[key], ...structuredClone(value)] })\n } else {\n // Else spread array onto result\n Object.assign(result, { [key]: structuredClone(value) })\n }\n } else {\n // Assign value onto result\n Object.assign(result, { [key]: value })\n }\n })\n\n return result\n}\n","import { Box } from '@/components/Box'\nimport { Card } from '@/components/Card'\nimport { ChevronDownMiniIcon } from '@/components/Icon/ChevronDownMiniIcon'\nimport { Flex } from '@/components/Flex'\nimport { Flow, type FlowPropsWithoutChildren } from '@/components/Flow'\nimport * as Progress from '@/components/Progress'\n\nimport { deepmerge } from '@/shared/deepmerge'\n\nexport interface ProgressBadgeProps extends FlowPropsWithoutChildren {\n /**\n * Override the title displayed on the ProgressBadge. Defaults to the title of the associated Flow, or the title of that Flow's first Step.\n */\n title?: string\n}\n\nfunction firstNonEmptyString(...strings: string[]) {\n for (const str of strings) {\n if (str != null && str.length > 0) {\n return str\n }\n }\n\n return null\n}\n\nexport function ProgressBadge({ title, ...props }: ProgressBadgeProps) {\n return (\n <Flow as={null} {...props}>\n {({ flow, parentProps: { containerProps }, step }) => {\n const derivedTitle = firstNonEmptyString(title, flow.title, step.title)\n\n const completedSteps = flow?.getNumberOfCompletedSteps() ?? 0\n const availableSteps = flow?.getNumberOfAvailableSteps() ?? 1\n\n const isClickable = containerProps.onClick != null\n\n if (isClickable) {\n containerProps.css = deepmerge(\n {\n '&:hover': {\n backgroundColor: 'var(--fr-colors-neutral-hover-background)',\n },\n },\n containerProps.css ?? {}\n )\n }\n\n return (\n <Card\n aria-label=\"Progress Badge\"\n borderWidth=\"md\"\n cursor={isClickable ? 'pointer' : 'auto'}\n gap=\"1\"\n p=\"3\"\n part=\"progress-badge\"\n role=\"complementary\"\n {...containerProps}\n >\n <Flex.Row alignItems=\"center\" gap=\"2\" part=\"progress-badge-header\">\n <Card.Title fontSize=\"sm\" lineHeight=\"sm\">\n {derivedTitle}\n </Card.Title>\n\n <Box\n as={ChevronDownMiniIcon}\n height=\"20px\"\n marginLeft=\"auto\"\n marginRight=\"-1\"\n transform=\"rotate(-90deg)\"\n width=\"20px\"\n />\n </Flex.Row>\n\n <Flex.Row alignItems=\"center\" gap=\"2\" part=\"progress-badge-footer\">\n <Progress.Fraction\n current={completedSteps}\n fontSize=\"xs\"\n fontWeight=\"medium\"\n lineHeight=\"xs\"\n total={availableSteps}\n />\n\n <Progress.Segments current={completedSteps} flexGrow=\"1\" total={availableSteps} />\n </Flex.Row>\n </Card>\n )\n }}\n </Flow>\n )\n}\n","import { keyframes } from '@emotion/react'\nimport React, { useEffect, useRef, useState } from 'react'\n\nimport { XMarkIcon } from '@/components/Icon/XMarkIcon'\nimport * as Popover from '@radix-ui/react-popover'\n\nimport { useBoundingClientRect } from '@/hooks/useBoundingClientRect'\nimport { Box } from '@/components/Box'\nimport { Button, ButtonProps } from '@/components/Button'\nimport { Card } from '@/components/Card'\nimport { Dot } from './Dot'\nimport { Media, MediaProps } from '@/components/Media'\nimport { Text, TextProps } from '@/components/Text'\nimport { getDotPosition } from './getDotPosition'\nimport { mapTooltipPropsToPopoverProps } from './mapTooltipPropsToPopoverProps'\nimport { BoxPropsWithoutChildren } from '@/components/Flow/FlowProps'\n\nconst fadeIn = keyframes`\n from {\n opacity: 0;\n }\n 25% {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n`\n\nfunction isVisible(elem: Element) {\n if (!(elem instanceof HTMLElement)) {\n return false\n }\n return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length)\n}\n\nexport interface MergedRadixPopoverProps\n extends Pick<Popover.PopoverProps, 'defaultOpen' | 'modal' | 'onOpenChange' | 'open'>,\n Omit<\n Popover.PopoverContentProps,\n 'align' | 'asChild' | 'color' | 'content' | 'translate' | 'forceMount'\n > {}\nexport interface TooltipProps\n extends BoxPropsWithoutChildren,\n Omit<MergedRadixPopoverProps, 'children'> {\n /**\n * How to align the Tooltip relative to the anchor.\n * Uses the same notation as the `align` property in [Radix Popover](https://www.radix-ui.com/primitives/docs/components/popover).\n */\n align?: Popover.PopoverContentProps['align'] | 'before' | 'after'\n /**\n * @ignore\n */\n anchor?: string\n /**\n * Whether to show a spotlight behind the anchor. This will darken the rest of the page and highlight the anchor.\n */\n spotlight?: boolean\n /**\n * The Z-index of the tooltip. Defaults to auto.\n */\n zIndex?: number | string\n style?: React.CSSProperties\n}\n\nexport function Tooltip({\n anchor,\n children,\n className,\n defaultOpen = true,\n open,\n part,\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, otherProps, rootProps } = mapTooltipPropsToPopoverProps(props, contentRect)\n\n const [internalOpen, setInternalOpen] = useState(defaultOpen)\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 function isOpen() {\n // External override via props\n if (open != null) {\n console.log('OVERRIDE: ', open)\n return open\n }\n\n console.log('INTERNAL: ', internalOpen)\n\n // Internal open state\n return internalOpen\n }\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 } else {\n console.debug(`[frigade] Tooltip: No anchor found for query: ${anchor}`)\n }\n }, [anchor, anchorRef])\n\n useEffect(() => {\n function checkElementForAnchor(element: Element) {\n if (element.matches(anchor)) {\n if (isVisible(element)) {\n return element\n } else {\n return null\n }\n }\n\n const anchorSelector = element.querySelectorAll(anchor)\n\n if (anchorSelector.length > 0) {\n if (isVisible(anchorSelector[0])) {\n return anchorSelector[0]\n } else {\n return null\n }\n }\n\n return null\n }\n\n const observer = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (mutation.type !== 'childList') {\n continue\n }\n\n for (const node of mutation.addedNodes) {\n if (node.nodeType !== Node.ELEMENT_NODE) {\n continue\n }\n\n const maybeAnchor = checkElementForAnchor(node as Element)\n\n if (maybeAnchor != null) {\n anchorRef(maybeAnchor)\n anchorVirtualRef.current = maybeAnchor\n\n console.debug('[frigade] Tooltip: MutationObserver added anchor: ', maybeAnchor)\n\n break\n }\n }\n\n for (const node of mutation.removedNodes) {\n if (node.nodeType !== Node.ELEMENT_NODE) {\n continue\n }\n\n const maybeAnchor = checkElementForAnchor(node as Element)\n\n if (maybeAnchor != null) {\n anchorRef(null)\n anchorVirtualRef.current = null\n\n console.debug('[frigade] Tooltip: MutationObserver removed anchor: ', maybeAnchor)\n\n break\n }\n }\n }\n })\n\n observer.observe(document.querySelector('body'), { childList: true, subtree: true })\n\n return () => observer.disconnect()\n }, [anchor, anchorRef])\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 <>\n {spotlight && (\n <Box\n animation={`${fadeIn} 300ms ease-out`}\n boxShadow=\"0 0 0 20000px rgb(0 0 0 / 0.5)\"\n part=\"tooltip-spotlight\"\n pointerEvents=\"none\"\n position=\"absolute\"\n style={{\n borderRadius: anchorRadius,\n height: anchorRect.height,\n left: spotlightLeft,\n top: spotlightTop,\n width: anchorRect.width,\n }}\n {...(props.zIndex != null\n ? {\n zIndex: props.zIndex,\n }\n : {})}\n />\n )}\n <Popover.Content key={internalOpen} {...contentProps} ref={contentRef}>\n <>\n {isOpen() && (\n <Card\n animation={`${fadeIn} 300ms ease-out`}\n boxShadow=\"md\"\n position=\"relative\"\n className={className}\n maxWidth=\"min(360px, calc(100vw - 25px))\"\n part={['tooltip', part]}\n style={style}\n {...otherProps}\n >\n {children}\n </Card>\n )}\n <Dot\n onClick={() => {\n setInternalOpen(() => {\n if (typeof rootProps.onOpenChange === 'function') {\n rootProps.onOpenChange(!isOpen())\n }\n\n return !isOpen()\n })\n }}\n style={dotPosition}\n />\n </>\n </Popover.Content>\n </>\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: '0px',\n right: '-6px',\n }}\n part=\"close\"\n position=\"absolute\"\n {...props}\n >\n <XMarkIcon height=\"20\" 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 aspectRatio=\"2\"\n borderRadius=\"md md 0 0\"\n borderWidth=\"0\"\n margin=\"-5 -5 0\"\n objectFit=\"cover\"\n overflowClipMargin=\"unset\"\n src={src}\n transform=\"translate3d(0, 0, 1px)\"\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 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.H4 part=\"title\" {...props}>\n {children}\n </Text.H4>\n )\n}\n","import { keyframes } from '@emotion/react'\n\nimport { Box, type BoxProps } from '@/components/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: ['modal', 'onOpenChange'],\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 const otherProps: Partial<TooltipProps> = {}\n\n for (const propName of Object.keys(props)) {\n if (!RADIX_PROPS.content.includes(propName) && !RADIX_PROPS.root.includes(propName)) {\n otherProps[propName] = props[propName]\n }\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 otherProps,\n rootProps,\n }\n}\n","/// <reference types=\"@emotion/react/types/css-prop\" />\n\nexport { Announcement, type AnnouncementProps } from './components/Announcement'\nexport { Banner, type BannerProps } from './components/Banner'\nexport { Box, type BoxProps } from './components/Box'\nexport { Button, type ButtonProps } from './components/Button'\nexport { Card, type CardProps, type CardHeaderProps } from './components/Card'\nexport * as Checklist from './components/Checklist'\nexport * from './components/ClientPortal'\nexport type { CollapsibleProps, CollapsibleStepProps } from './components/Checklist'\nexport { Collection } from './components/Collection'\nexport { Dialog, type DialogProps } from './components/Dialog'\nexport { Flex } from './components/Flex'\nexport {\n type FieldTypes,\n Form,\n type FormProps,\n type FormFieldData,\n type FormFieldProps,\n} from './components/Form'\nexport { Hint } from '@/components/Hint'\nexport { SelectField } from './components/Form/fields/SelectField'\nexport { TextareaField } from './components/Form/fields/TextareaField'\nexport { TextField } from './components/Form/fields/TextField'\nexport { RadioField } from './components/Form/fields/RadioField'\nexport { Label } from './components/Form/fields/Label'\nexport { BaseField } from './components/Form/fields/BaseField'\nexport { Media, Image, Video } from './components/Media'\nexport { type NPSProps } from './components/Survey/NPS'\nexport { Ping } from './components/Ping'\nexport * as Popover from './components/Popover'\nexport * as Progress from './components/Progress'\nexport { ProgressBadge, type ProgressBadgeProps } from './components/ProgressBadge'\nexport { Provider, type ProviderProps } from './components/Provider'\nexport { Spotlight } from './components/Spotlight'\nexport * as Survey from './components/Survey'\nexport { Text, type TextProps } from './components/Text'\nexport { Tooltip, type TooltipProps } from './components/Tooltip'\nexport { Tour, type TourProps } from './components/Tour'\nexport {\n Flow,\n type FlowChildrenProps,\n type FlowProps,\n type FlowPropsWithoutChildren,\n} from './components/Flow'\nexport * as FrigadeJS from '@frigade/js'\nexport { themeVariables, type Theme } from './shared/theme'\nexport { tokens, type Tokens } from './shared/tokens'\n\nexport { useAutoScroll } from './hooks/useAutoScroll'\nexport { useBoundingClientRect } from './hooks/useBoundingClientRect'\nexport { useFlow, type FlowConfig } from './hooks/useFlow'\nexport {\n useFlowHandlers,\n type DismissHandler,\n type FlowHandlerProp,\n type FlowHandlerProps,\n} from './hooks/useFlowHandlers'\nexport {\n useStepHandlers,\n type StepHandler,\n type StepHandlerProp,\n type StepHandlerProps,\n} from './hooks/useStepHandlers'\nexport { useFrigade } from './hooks/useFrigade'\nexport { useUser } from './hooks/useUser'\nexport { useGroup } from './hooks/useGroup'\n\n// TEMP: Remove this, used for testing Storybook\nexport * as FloatingUI from '@floating-ui/react'\n","import { useContext } from 'react'\n\nimport { FrigadeContext } from '@/components/Provider'\nimport { logOnce } from '../shared/log'\n\nexport function useUser() {\n const context = useContext(FrigadeContext)\n if (!context || !context.frigade) {\n logOnce('useUser() must be used in a child of the Frigade Provider', 'warn')\n }\n const { frigade } = context ?? {}\n const userId = frigade?.config.userId\n\n /**\n * Adds properties for the current user\n * @param properties\n */\n async function addProperties(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, addProperties, track, isLoading: !frigade?.isReady() }\n}\n","import { useContext } from 'react'\n\nimport { FrigadeContext } from '@/components/Provider'\nimport { logOnce } from '../shared/log'\n\nexport function useGroup() {\n const context = useContext(FrigadeContext)\n if (!context || !context.frigade) {\n logOnce('useGroup() must be used in a child of the Frigade Provider', 'warn')\n }\n const { frigade } = context ?? {}\n const groupId = frigade?.getConfig()?.groupId\n\n /**\n * Sets properties for the current group\n * @param properties\n */\n async function addProperties(properties: Record<string, unknown>) {\n if (!frigade.config.groupId) {\n console.error('No Group ID is set. Cannot set properties without a Group ID.')\n return\n }\n await frigade.group(frigade.config.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 /**\n * Sets the current group. Note that this can cause issues if separately setting the group in the FrigadeProvider.\n * @param groupId\n * @param properties Optional properties to set for the group\n */\n async function setGroupId(groupId: string, properties?: Record<string, unknown>) {\n await frigade.group(groupId, properties)\n }\n\n return {\n groupId,\n setGroupId,\n addProperties,\n track,\n isLoading: !frigade?.isReady(),\n }\n}\n"]}