import { JsonValue } from 'type-fest'; import { RuleEngineProps } from './RuleEngineComponent'; import { ActionType, SchemaActionItem, SchemaConditionItem } from './utils'; /** * Configuration for a single option including its availability and constraints */ export interface OptionConfig { /** Option property name */ name: string; /** Human-readable label */ label: string; /** Array of option names that cannot coexist with this option */ mutuallyExclusiveWith: string[]; /** Type of value this option accepts */ valueType?: "boolean" | "string" | "number" | "integer" | "object" | "array"; /** Description of what this option does */ description?: string; /** Predefined values from configuration */ values?: Array<{ label: string; value: string; meta?: Record; }>; /** Whether this option is required and must always be present */ required?: boolean; } /** * Complete options configuration for the rule engine */ export interface OptionsConfig { /** Available options per action type and applyTo */ actions: Record>; /** Available options for conditions */ conditions: OptionConfig[]; } type OrderApplyTo = "" | "order.line_items.adjustment" | "order.line_items.gift_card" | "order.line_items.shipment" | "order.line_items.sku" | "order.line_items.bundle" | "order.line_items.payment_method" | "order.line_items.line_item_options" | "order.line_items" | "order"; type PriceApplyTo = "" | "price"; /** * Options that we want to manage dynamically */ declare const MANAGED_ACTION_OPTIONS: readonly ["selector", "groups", "apply_on", "round", "limit", "discount_mode", "aggregation", "bundle", "quantity", "identifiers"]; declare const MANAGED_CONDITION_OPTIONS: readonly ["group", "scope", "aggregations"]; export type ManagedActionOption = (typeof MANAGED_ACTION_OPTIONS)[number]; export type ManagedConditionOption = (typeof MANAGED_CONDITION_OPTIONS)[number]; /** * Human-readable labels for options */ export declare const OPTION_LABELS: Record; /** * Parse JSON schema to extract options configuration */ export declare function parseOptionsFromSchema(jsonSchema: JsonValue | undefined, schemaType: RuleEngineProps["schemaType"]): OptionsConfig; /** * Result of checking option availability */ interface OptionAvailability { /** Options that can be added */ available: OptionConfig[]; /** Options that are disabled due to conflicts */ disabled: OptionConfig[]; /** Options that are currently set */ current: string[]; /** Options that are required (must always be present) */ required: OptionConfig[]; } /** * Hook to determine which options are available for the current item */ export declare function useAvailableOptions(item: SchemaActionItem | SchemaConditionItem | null, optionsConfig: OptionConfig[]): OptionAvailability; export {};