import { Quirks, ScoreVector, Context, PersonalizedVariant, CompositionMetadata, TestVariant, EnrichmentData } from '@uniformdev/context'; import * as react from 'react'; import react__default, { ReactNode, ReactElement, HTMLAttributes, JSX } from 'react'; /** * Provides reactive access to the Uniform Context's current visitor quirks values * This can be used when you want to read current quirk values directly. */ declare function useQuirks(options?: Parameters[0]): Quirks; /** * Provides reactive access to the Uniform Context's current visitor scores values. * This can be used when you want to read current score values directly. */ declare function useScores(): ScoreVector; type VariantOutputType = 'edge' | 'standard'; interface UniformContextProps$1 { /** The configured Uniform Context instance to provide */ context: Context; /** The output type to emit. * - `standard` - Emits selected variants as HTML suitable for SSR or SSG * - `edge` - Emits all variants suitable for Edge-side personalization selection * * @default standard */ outputType?: VariantOutputType; /** * Whether to track a route change to the current URL when this component is rendered. * * @default true */ trackRouteOnRender?: boolean; /** * Whether to include Uniform transfer state tag in the page HTML. * - `always` - Always include Uniform transfer state tag in the page HTML * - `never` - Never include Uniform transfer state tag in the page HTML * - `server-only` - Only include Uniform transfer state tag in the page HTML when `window` is undefined, i.e. on the server or during SSG. * * @default server-only * */ includeTransferState?: 'always' | 'never' | 'server-only'; } /** * Registers Uniform Context with a React app (as a React Context!). * Children of this component may use the Context via hooks, such as useScores and useUniformContext. */ declare const UniformContext: react__default.FC>; type UniformContextProps = { context: Context; outputType: VariantOutputType; }; interface UseUniformContextOptions { throwOnMissingProvider?: boolean; } interface UseUniformContextThrowsOptions extends UseUniformContextOptions { throwOnMissingProvider: true; } interface UseUniformContextDoesNotThrowOptions extends UseUniformContextOptions { throwOnMissingProvider: false; } /** * Gets the current Uniform Context object (must be within a UniformContext component ancestor) * * IMPORTANT: The Context object's scores and quirks (i.e. context.scores) are NOT reactive when fetched with this hook. * If you need reactive scores or quirks use `useScores` and `useQuirks` instead. */ declare function useUniformContext(options?: UseUniformContextThrowsOptions): UniformContextProps; declare function useUniformContext(options?: UseUniformContextDoesNotThrowOptions): UniformContextProps | undefined; type PersonalizeWrapperComponent = react__default.ComponentType<{ children: ReactNode; personalizationOccurred: boolean; }>; type PersonalizedVariationComponent = react__default.ComponentType; type PersonalizeComponentProps = { /** * Name of the personalized placement. Should be unique to this placement location and set of variants. * This name is emitted to analytics after personalization executes. */ name: string; /** The algorithm to use for personalization, if not the default. */ algorithm?: string; /** The possible variations of the content to render depending on personalization conditions */ variations: TVariation[]; /** Composition metadata where the personalization is being rendered for analytics tracking */ compositionMetadata?: CompositionMetadata; /** A React component to use to render a selected variant. */ component: PersonalizedVariationComponent; /** A React component that will be used to wrap all personalized variants. If no variants match, the wrapper is not rendered. */ wrapperComponent?: PersonalizeWrapperComponent; /** The number of variations to select. Use for personalized lists where the `count` most relevant should be shown. */ count?: number; }; declare function Personalize(props: PersonalizeComponentProps): ReactElement | null; type TVariation = TestVariant; interface TestComponentProps { /** Name of the test that is running. */ name: string; /** Variation list that this test will selected from. */ variations: TVariation[]; /** Composition metadata where the A/B test is being rendered for analytics tracking */ compositionMetadata?: CompositionMetadata; /** * Determines what should be rendered if testing is in a "loading" state. * default: shows the default variation while loading * none: shows nothing while loading * React component: shows the component while loading */ loadingMode?: 'default' | 'none' | react__default.ComponentType; /** A React component to use to render the test variant. */ component: react__default.ComponentType; } declare const Test: (props: TestComponentProps) => ReactElement | null; type TrackFragmentProps = { /** Behavior that will be pushed when tracking occurs. */ behavior: EnrichmentData | EnrichmentData[] | undefined; /** Nested elements that are related to the behavior specified. */ children: ReactNode; }; /** * Tracks visitor behavior by adding enrichment score when they are shown a route with this component on it. * * NOTE: if you wish to track on the visitor seeing the content in the browser viewport instead, * use Track instead of TrackFragment. */ declare const TrackFragment: ({ behavior, children }: TrackFragmentProps) => react__default.JSX.Element; type TrackProps = TrackFragmentProps & HTMLAttributes & { /** * Element tag that will be used for tracking. * * @defaultValue div */ tagName?: keyof JSX.IntrinsicElements; /** * Disables visiblity checking on this component, will trigger behavior immediately on page load. * * @defaultValue If supported, `false`. `true` when window is undefined or when IntersectionObserver is not supported by browser. */ disableVisibilityTrigger?: boolean; /** * Trigger behavior when this element is at least `threshold` visible. * * @defaultValue 0.5 */ threshold?: number | number[]; }; /** * Tracks visitor behavior by adding enrichment score when they view content wrapped in this component. * When the Track component is sufficiently in the viewport, it will trigger the enrichment values specified * in `behavior` to the current visitor. If the browser does not support IntersectionObserver, the behavior will * be triggered immediately on page load instead. * * NOTE: this component necessarily renders a wrapping tag to attach the IntersectionObserver to; this can result * in DOM changes when personalization is added. If that's undesirable use TrackFragment instead which tracks * only on page load, but does not render a wrapping tag. */ declare const Track: ({ behavior, children, tagName, threshold, disableVisibilityTrigger, ...rest }: TrackProps) => react.DOMElement<{ ref: react.RefObject; defaultChecked?: boolean | undefined; defaultValue?: string | number | readonly string[] | undefined; suppressContentEditableWarning?: boolean | undefined; suppressHydrationWarning?: boolean | undefined; accessKey?: string | undefined; autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {}); autoFocus?: boolean | undefined; className?: string | undefined; contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined; contextMenu?: string | undefined; dir?: string | undefined; draggable?: (boolean | "true" | "false") | undefined; enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined; hidden?: boolean | undefined; id?: string | undefined; lang?: string | undefined; nonce?: string | undefined; slot?: string | undefined; spellCheck?: (boolean | "true" | "false") | undefined; style?: react.CSSProperties | undefined; tabIndex?: number | undefined; title?: string | undefined; translate?: "yes" | "no" | undefined; radioGroup?: string | undefined; role?: react.AriaRole | undefined; about?: string | undefined; content?: string | undefined; datatype?: string | undefined; inlist?: any; prefix?: string | undefined; property?: string | undefined; rel?: string | undefined; resource?: string | undefined; rev?: string | undefined; typeof?: string | undefined; vocab?: string | undefined; autoCorrect?: string | undefined; autoSave?: string | undefined; color?: string | undefined; itemProp?: string | undefined; itemScope?: boolean | undefined; itemType?: string | undefined; itemID?: string | undefined; itemRef?: string | undefined; results?: number | undefined; security?: string | undefined; unselectable?: "on" | "off" | undefined; popover?: "" | "auto" | "manual" | "hint" | undefined; popoverTargetAction?: "toggle" | "show" | "hide" | undefined; popoverTarget?: string | undefined; inert?: boolean | undefined; inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined; is?: string | undefined; exportparts?: string | undefined; part?: string | undefined; "aria-activedescendant"?: string | undefined; "aria-atomic"?: (boolean | "true" | "false") | undefined; "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined; "aria-braillelabel"?: string | undefined; "aria-brailleroledescription"?: string | undefined; "aria-busy"?: (boolean | "true" | "false") | undefined; "aria-checked"?: boolean | "false" | "mixed" | "true" | undefined; "aria-colcount"?: number | undefined; "aria-colindex"?: number | undefined; "aria-colindextext"?: string | undefined; "aria-colspan"?: number | undefined; "aria-controls"?: string | undefined; "aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined; "aria-describedby"?: string | undefined; "aria-description"?: string | undefined; "aria-details"?: string | undefined; "aria-disabled"?: (boolean | "true" | "false") | undefined; "aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined; "aria-errormessage"?: string | undefined; "aria-expanded"?: (boolean | "true" | "false") | undefined; "aria-flowto"?: string | undefined; "aria-grabbed"?: (boolean | "true" | "false") | undefined; "aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined; "aria-hidden"?: (boolean | "true" | "false") | undefined; "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined; "aria-keyshortcuts"?: string | undefined; "aria-label"?: string | undefined; "aria-labelledby"?: string | undefined; "aria-level"?: number | undefined; "aria-live"?: "off" | "assertive" | "polite" | undefined; "aria-modal"?: (boolean | "true" | "false") | undefined; "aria-multiline"?: (boolean | "true" | "false") | undefined; "aria-multiselectable"?: (boolean | "true" | "false") | undefined; "aria-orientation"?: "horizontal" | "vertical" | undefined; "aria-owns"?: string | undefined; "aria-placeholder"?: string | undefined; "aria-posinset"?: number | undefined; "aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined; "aria-readonly"?: (boolean | "true" | "false") | undefined; "aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined; "aria-required"?: (boolean | "true" | "false") | undefined; "aria-roledescription"?: string | undefined; "aria-rowcount"?: number | undefined; "aria-rowindex"?: number | undefined; "aria-rowindextext"?: string | undefined; "aria-rowspan"?: number | undefined; "aria-selected"?: (boolean | "true" | "false") | undefined; "aria-setsize"?: number | undefined; "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined; "aria-valuemax"?: number | undefined; "aria-valuemin"?: number | undefined; "aria-valuenow"?: number | undefined; "aria-valuetext"?: string | undefined; dangerouslySetInnerHTML?: { __html: string | TrustedHTML; } | undefined; onCopy?: react.ClipboardEventHandler | undefined; onCopyCapture?: react.ClipboardEventHandler | undefined; onCut?: react.ClipboardEventHandler | undefined; onCutCapture?: react.ClipboardEventHandler | undefined; onPaste?: react.ClipboardEventHandler | undefined; onPasteCapture?: react.ClipboardEventHandler | undefined; onCompositionEnd?: react.CompositionEventHandler | undefined; onCompositionEndCapture?: react.CompositionEventHandler | undefined; onCompositionStart?: react.CompositionEventHandler | undefined; onCompositionStartCapture?: react.CompositionEventHandler | undefined; onCompositionUpdate?: react.CompositionEventHandler | undefined; onCompositionUpdateCapture?: react.CompositionEventHandler | undefined; onFocus?: react.FocusEventHandler | undefined; onFocusCapture?: react.FocusEventHandler | undefined; onBlur?: react.FocusEventHandler | undefined; onBlurCapture?: react.FocusEventHandler | undefined; onChange?: react.ChangeEventHandler | undefined; onChangeCapture?: react.ChangeEventHandler | undefined; onBeforeInput?: react.InputEventHandler | undefined; onBeforeInputCapture?: react.InputEventHandler | undefined; onInput?: react.InputEventHandler | undefined; onInputCapture?: react.InputEventHandler | undefined; onReset?: react.ReactEventHandler | undefined; onResetCapture?: react.ReactEventHandler | undefined; onSubmit?: react.SubmitEventHandler | undefined; onSubmitCapture?: react.SubmitEventHandler | undefined; onInvalid?: react.ReactEventHandler | undefined; onInvalidCapture?: react.ReactEventHandler | undefined; onLoad?: react.ReactEventHandler | undefined; onLoadCapture?: react.ReactEventHandler | undefined; onError?: react.ReactEventHandler | undefined; onErrorCapture?: react.ReactEventHandler | undefined; onKeyDown?: react.KeyboardEventHandler | undefined; onKeyDownCapture?: react.KeyboardEventHandler | undefined; onKeyPress?: react.KeyboardEventHandler | undefined; onKeyPressCapture?: react.KeyboardEventHandler | undefined; onKeyUp?: react.KeyboardEventHandler | undefined; onKeyUpCapture?: react.KeyboardEventHandler | undefined; onAbort?: react.ReactEventHandler | undefined; onAbortCapture?: react.ReactEventHandler | undefined; onCanPlay?: react.ReactEventHandler | undefined; onCanPlayCapture?: react.ReactEventHandler | undefined; onCanPlayThrough?: react.ReactEventHandler | undefined; onCanPlayThroughCapture?: react.ReactEventHandler | undefined; onDurationChange?: react.ReactEventHandler | undefined; onDurationChangeCapture?: react.ReactEventHandler | undefined; onEmptied?: react.ReactEventHandler | undefined; onEmptiedCapture?: react.ReactEventHandler | undefined; onEncrypted?: react.ReactEventHandler | undefined; onEncryptedCapture?: react.ReactEventHandler | undefined; onEnded?: react.ReactEventHandler | undefined; onEndedCapture?: react.ReactEventHandler | undefined; onLoadedData?: react.ReactEventHandler | undefined; onLoadedDataCapture?: react.ReactEventHandler | undefined; onLoadedMetadata?: react.ReactEventHandler | undefined; onLoadedMetadataCapture?: react.ReactEventHandler | undefined; onLoadStart?: react.ReactEventHandler | undefined; onLoadStartCapture?: react.ReactEventHandler | undefined; onPause?: react.ReactEventHandler | undefined; onPauseCapture?: react.ReactEventHandler | undefined; onPlay?: react.ReactEventHandler | undefined; onPlayCapture?: react.ReactEventHandler | undefined; onPlaying?: react.ReactEventHandler | undefined; onPlayingCapture?: react.ReactEventHandler | undefined; onProgress?: react.ReactEventHandler | undefined; onProgressCapture?: react.ReactEventHandler | undefined; onRateChange?: react.ReactEventHandler | undefined; onRateChangeCapture?: react.ReactEventHandler | undefined; onSeeked?: react.ReactEventHandler | undefined; onSeekedCapture?: react.ReactEventHandler | undefined; onSeeking?: react.ReactEventHandler | undefined; onSeekingCapture?: react.ReactEventHandler | undefined; onStalled?: react.ReactEventHandler | undefined; onStalledCapture?: react.ReactEventHandler | undefined; onSuspend?: react.ReactEventHandler | undefined; onSuspendCapture?: react.ReactEventHandler | undefined; onTimeUpdate?: react.ReactEventHandler | undefined; onTimeUpdateCapture?: react.ReactEventHandler | undefined; onVolumeChange?: react.ReactEventHandler | undefined; onVolumeChangeCapture?: react.ReactEventHandler | undefined; onWaiting?: react.ReactEventHandler | undefined; onWaitingCapture?: react.ReactEventHandler | undefined; onAuxClick?: react.MouseEventHandler | undefined; onAuxClickCapture?: react.MouseEventHandler | undefined; onClick?: react.MouseEventHandler | undefined; onClickCapture?: react.MouseEventHandler | undefined; onContextMenu?: react.MouseEventHandler | undefined; onContextMenuCapture?: react.MouseEventHandler | undefined; onDoubleClick?: react.MouseEventHandler | undefined; onDoubleClickCapture?: react.MouseEventHandler | undefined; onDrag?: react.DragEventHandler | undefined; onDragCapture?: react.DragEventHandler | undefined; onDragEnd?: react.DragEventHandler | undefined; onDragEndCapture?: react.DragEventHandler | undefined; onDragEnter?: react.DragEventHandler | undefined; onDragEnterCapture?: react.DragEventHandler | undefined; onDragExit?: react.DragEventHandler | undefined; onDragExitCapture?: react.DragEventHandler | undefined; onDragLeave?: react.DragEventHandler | undefined; onDragLeaveCapture?: react.DragEventHandler | undefined; onDragOver?: react.DragEventHandler | undefined; onDragOverCapture?: react.DragEventHandler | undefined; onDragStart?: react.DragEventHandler | undefined; onDragStartCapture?: react.DragEventHandler | undefined; onDrop?: react.DragEventHandler | undefined; onDropCapture?: react.DragEventHandler | undefined; onMouseDown?: react.MouseEventHandler | undefined; onMouseDownCapture?: react.MouseEventHandler | undefined; onMouseEnter?: react.MouseEventHandler | undefined; onMouseLeave?: react.MouseEventHandler | undefined; onMouseMove?: react.MouseEventHandler | undefined; onMouseMoveCapture?: react.MouseEventHandler | undefined; onMouseOut?: react.MouseEventHandler | undefined; onMouseOutCapture?: react.MouseEventHandler | undefined; onMouseOver?: react.MouseEventHandler | undefined; onMouseOverCapture?: react.MouseEventHandler | undefined; onMouseUp?: react.MouseEventHandler | undefined; onMouseUpCapture?: react.MouseEventHandler | undefined; onSelect?: react.ReactEventHandler | undefined; onSelectCapture?: react.ReactEventHandler | undefined; onTouchCancel?: react.TouchEventHandler | undefined; onTouchCancelCapture?: react.TouchEventHandler | undefined; onTouchEnd?: react.TouchEventHandler | undefined; onTouchEndCapture?: react.TouchEventHandler | undefined; onTouchMove?: react.TouchEventHandler | undefined; onTouchMoveCapture?: react.TouchEventHandler | undefined; onTouchStart?: react.TouchEventHandler | undefined; onTouchStartCapture?: react.TouchEventHandler | undefined; onPointerDown?: react.PointerEventHandler | undefined; onPointerDownCapture?: react.PointerEventHandler | undefined; onPointerMove?: react.PointerEventHandler | undefined; onPointerMoveCapture?: react.PointerEventHandler | undefined; onPointerUp?: react.PointerEventHandler | undefined; onPointerUpCapture?: react.PointerEventHandler | undefined; onPointerCancel?: react.PointerEventHandler | undefined; onPointerCancelCapture?: react.PointerEventHandler | undefined; onPointerEnter?: react.PointerEventHandler | undefined; onPointerLeave?: react.PointerEventHandler | undefined; onPointerOver?: react.PointerEventHandler | undefined; onPointerOverCapture?: react.PointerEventHandler | undefined; onPointerOut?: react.PointerEventHandler | undefined; onPointerOutCapture?: react.PointerEventHandler | undefined; onGotPointerCapture?: react.PointerEventHandler | undefined; onGotPointerCaptureCapture?: react.PointerEventHandler | undefined; onLostPointerCapture?: react.PointerEventHandler | undefined; onLostPointerCaptureCapture?: react.PointerEventHandler | undefined; onScroll?: react.UIEventHandler | undefined; onScrollCapture?: react.UIEventHandler | undefined; onScrollEnd?: react.UIEventHandler | undefined; onScrollEndCapture?: react.UIEventHandler | undefined; onWheel?: react.WheelEventHandler | undefined; onWheelCapture?: react.WheelEventHandler | undefined; onAnimationStart?: react.AnimationEventHandler | undefined; onAnimationStartCapture?: react.AnimationEventHandler | undefined; onAnimationEnd?: react.AnimationEventHandler | undefined; onAnimationEndCapture?: react.AnimationEventHandler | undefined; onAnimationIteration?: react.AnimationEventHandler | undefined; onAnimationIterationCapture?: react.AnimationEventHandler | undefined; onToggle?: react.ToggleEventHandler | undefined; onBeforeToggle?: react.ToggleEventHandler | undefined; onTransitionCancel?: react.TransitionEventHandler | undefined; onTransitionCancelCapture?: react.TransitionEventHandler | undefined; onTransitionEnd?: react.TransitionEventHandler | undefined; onTransitionEndCapture?: react.TransitionEventHandler | undefined; onTransitionRun?: react.TransitionEventHandler | undefined; onTransitionRunCapture?: react.TransitionEventHandler | undefined; onTransitionStart?: react.TransitionEventHandler | undefined; onTransitionStartCapture?: react.TransitionEventHandler | undefined; 'data-track-on-view-wrapper'?: string; }, HTMLElement>; export { Personalize, type PersonalizeComponentProps, type PersonalizeWrapperComponent, type PersonalizedVariationComponent, type TVariation, Test, type TestComponentProps, Track, TrackFragment, type TrackFragmentProps, type TrackProps, UniformContext, type UniformContextProps$1 as UniformContextProps, type VariantOutputType, useQuirks, useScores, useUniformContext };