import type { ComponentProps } from 'react'; import type { RoomViewerDialog } from '@neurodyn/react-room-viewer'; import type { RoomViewerResourceType } from '@neurodyn/react-room-viewer'; import type { RoomViewerResourceTypeInput } from '@neurodyn/react-room-viewer'; /** What the reader hands a parser besides the raw value. */ declare interface AttributeParseContext { /** Full attribute name, e.g. `data-neurodyn-room-viewer-api-key`. */ attribute: string } /** * Whether an attribute must be set: always, never, or only while another * attribute holds one of the listed values (`src` while `type` is `wallart`). * `when` names a field of the same contract. */ declare type AttributeRequirement = | boolean | { readonly when: string, readonly is: readonly string[] } /** The tag that loads the self-initializing embed build from `src`. */ export declare function buildEmbedScript(src: string): string; /** A copy-paste trigger button with the given attributes, in contract order and escaped. */ export declare function buildRoomViewerTrigger(values: RoomViewerTriggerValues, options: TriggerSnippetOptions): string; /** * The rows describing a trigger built from the same values, for the table * beside the snippet; `extra` adds attributes the snippet leaves out. */ export declare function describeRoomViewerTrigger(values: RoomViewerTriggerValues, extra?: readonly (keyof RoomViewerTriggerValues)[]): RoomViewerTriggerRow[]; /** A widget option that has no attribute: callbacks, controlled state, sessions. */ declare interface OptionOnly { readonly kind: 'option' /** Why the option is programmatic only. */ readonly reason: string } /** What an attribute's parser produces. */ declare type ParsedAttributeValue = Field extends TriggerAttribute ? Value : never export declare const ROOM_VIEWER_DIMENSION_UNITS: readonly ["m", "cm", "in"]; export declare const ROOM_VIEWER_DISPLAY_UNITS: readonly ["cm", "in"]; export declare const ROOM_VIEWER_EMBED_SCRIPT_URL = "https://cdn.neurodyn.ai/@neurodyn/room-viewer/dist/room-viewer.embed.min.js"; export declare const ROOM_VIEWER_LANGUAGES: readonly ["en", "ru"]; export declare const ROOM_VIEWER_RESOURCE_TYPES: readonly ["wallart", "rugs", "flooring", "wall-panel"]; export declare const ROOM_VIEWER_SOURCES: readonly ["default", "shopify"]; /** The wall-art trigger the docs and Connect show as an example. */ export declare const ROOM_VIEWER_TRIGGER_EXAMPLE: { readonly type: "wallart"; readonly src: "https://placehold.co/800x1200.png"; readonly name: "Sample Print"; readonly width: 1; readonly height: 1.5; readonly apiKey: "..."; }; export declare const roomViewerContract: TriggerContract; readonly src: TriggerAttribute; readonly tinuuid: TriggerAttribute; readonly roomId: TriggerAttribute; readonly name: TriggerAttribute; readonly width: TriggerAttribute; readonly height: TriggerAttribute; readonly dimensionUnit: TriggerAttribute<"m" | "cm" | "in" | undefined>; readonly displayUnit: TriggerAttribute<"cm" | "in" | undefined>; readonly language: TriggerAttribute<"en" | "ru" | undefined>; readonly apiKey: TriggerAttribute; readonly source: TriggerAttribute<"default" | "shopify" | undefined>; readonly disableClose: TriggerAttribute; readonly widgetSession: OptionOnly; readonly open: OptionOnly; readonly defaultOpen: OptionOnly; readonly onOpenChange: OptionOnly; }>; /** Options of the room viewer dialog. */ export declare interface RoomViewerDialogProps extends Omit, 'rooms'> { } export declare type RoomViewerTriggerRow = TriggerSnippetRow; /** * Values for a copy-paste trigger. Snippets only use canonical Resource Types: * the legacy aliases keep working on merchant pages but are never generated. */ export declare type RoomViewerTriggerValues = Omit, 'type'> & { type?: RoomViewerResourceType; }; /** A widget option a merchant can set with a `data-*` attribute on the trigger. */ declare interface TriggerAttribute { readonly kind: 'attribute' /** Attribute name without the widget prefix, e.g. `api-key`. */ readonly name: string readonly parse: (raw: string | null, context: AttributeParseContext) => Value /** The accepted values, listed in the docs. */ readonly values?: readonly string[] /** What the docs and the cabinets' snippets ask for; the reader does not enforce it. */ readonly required: AttributeRequirement /** The default as Markdown for the docs, e.g. `` `cm` `` or `User locale`. */ readonly defaultValue?: string /** One or two sentences for the docs; accepted values are appended from `values`. */ readonly description: string /** Full attribute names read, in order, while the primary one is absent or blank. */ readonly legacyNames?: readonly string[] /** Runs an explicitly passed programmatic option through `parse` as well. */ readonly normalizesOptions?: boolean } /** Keys of the fields that are attributes. */ declare type TriggerAttributeKey = { [Key in keyof Fields]: Fields[Key] extends TriggerAttribute ? Key : never }[keyof Fields] & string declare interface TriggerContract = TriggerFields> { /** Prefix shared by the widget's option attributes, e.g. `data-neurodyn-room-viewer-`. */ readonly prefix: string /** The first marker is the one snippets use. */ readonly markers: readonly [TriggerMarker, ...TriggerMarker[]] readonly fields: Fields } /** * One entry per widget option, none optional: an option added to the widget's * props without an entry here fails type-checking until it is given an * attribute or marked option-only. */ declare type TriggerFields = { readonly [Key in keyof Options]-?: TriggerAttribute | OptionOnly } /** A marker attribute that selects trigger elements, e.g. `data-neurodyn-room-viewer-dialog`. */ declare interface TriggerMarker { readonly name: string readonly description: string } export declare interface TriggerSnippetOptions { /** The button text. */ label: string } /** One attribute of a snippet, for the table next to it. */ declare interface TriggerSnippetRow { /** The field key, or `null` for the marker attribute. */ key: Key | null attribute: string required: boolean } /** * Values for a copy-paste trigger: only the contract's attributes, each typed * as its option. Placeholders such as `PUBLIC_WIDGET_KEY` fit string options. */ declare type TriggerSnippetValues = { [Key in TriggerAttributeKey]?: Exclude, undefined | null> } export { }