import { ToolResult } from '../../types'; /** * Product interface for DOM extraction */ interface Product { id: string; title: string; price?: string; image?: string; element?: Element; } /** * Shopify Store Data Manager * Handles client-side store data operations through DOM manipulation * * @example * ```ts * const manager = new ShopifyStoreManager(); * const products = await manager.getProducts(); * await manager.addToCart('product-123', 1); * ``` */ export declare class ShopifyStoreManager { private cache; /** * Get products from the current page * Extracts product information from DOM elements * * @returns Products array */ getProducts(): Promise; /** * Extract products from current DOM * Searches for common Shopify product element patterns * * @returns Products found on current page */ private extractProductsFromDOM; /** * Extract product data from DOM element * Attempts to find product information using common patterns * * @param element - Product element * @returns Product data or null */ private extractProductFromElement; /** * Add product to cart * Simulates clicking the "Add to Cart" button * * @param productId - Product ID to add * @param quantity - Quantity to add (default: 1) * @returns Result of add operation */ addToCart(productId: string, quantity?: number): Promise<{ success: boolean; productId: string; quantity: number; error?: string; }>; /** * Search products by query * Filters products on current page by search term * * @param query - Search query * @returns Matching products */ searchProducts(query: string): Promise; /** * Navigate to collection * Uses router-based navigation to preserve voice agent connection * * @param collectionHandle - Collection handle/slug * @param navigate - Navigation function from router * @returns Navigation result */ navigateToCollection(collectionHandle: string, navigate?: NavigateFunction): Promise<{ success: boolean; navigated: boolean; url: string; }>; /** * Get store information from page * * @returns Store info */ getStoreInfo(): Promise<{ name: string; url: string; currency: string; locale: string; }>; } /** * Navigation function type */ type NavigateFunction = (path: string) => Promise; /** * Shopify Action Handler * Implements voice actions for Shopify storefront * Registers actions that can be called by the voice agent * * @example * ```ts * const handler = new ShopifyActionHandler(router.navigate.bind(router)); * * // Register with Vowel client * vowel.registerAction('searchProducts', * handler.getActionDefinition('searchProducts'), * handler.searchProducts.bind(handler) * ); * ``` */ export declare class ShopifyActionHandler { private storeManager; private navigate?; constructor(navigate?: NavigateFunction); /** * Search for products * Navigates the controlled tab to search page and extracts results * * @param params - Search parameters * @returns Search results */ searchProducts(params: { query: string; }): Promise; /** * Add product to cart * * @param params - Add to cart parameters * @returns Add result */ addToCart(params: { productId?: string; quantity?: number; }): Promise; /** * Navigate to collection * * @param params - Collection parameters * @returns Navigation result */ navigateToCollection(params: { collection: string; }): Promise; /** * Get current page context * * @returns Page context */ getCurrentPageContext(): Promise; /** * Get store information * * @param _params - Info request parameters (unused) * @returns Store information */ getStoreInfo(_params?: { info?: string; }): Promise; /** * Navigate to product page * First tries to get products from controlled tab, then searches by name * * @param params - Product parameters * @returns Navigation result */ navigateToProduct(params: { product?: string; productId?: string; }): Promise; /** * Search for elements by term using Levenshtein distance * Returns elements with spoken-word IDs (e.g., "apple_banana") * * Searches across all element properties: * - Text content * - CSS classes * - ARIA labels * - Placeholders * - Values (inputs, selects, etc.) * - Element IDs * * @param params - Search parameters * @returns Search results with spoken IDs */ /** * @deprecated This function is temporarily disabled. Use getPageSnapshot() instead. * * DEPRECATION NOTICE: searchElements is being replaced with getPageSnapshot. * The AI should always use getPageSnapshot to get a full page view, then search * within the snapshot results client-side. * * This method now redirects to getPageSnapshot() with a deprecation warning. */ searchElements(_params: { query: string; maxResults?: number; minSimilarity?: number; requireInteractive?: boolean; requireVisible?: boolean; tag?: string; }): Promise; /** * Click an element on the controlled tab * * @param params.id - Spoken ID from search results (e.g., "apple_banana") * @returns Click result */ clickElement(params: { id: string; }): Promise; /** * Type text into an element on the controlled tab * * @param params.id - Spoken ID from search results * @param params.text - Text to type * @returns Type result */ typeIntoElement(params: { id: string; text: string; }): Promise; /** * Press a key on the controlled tab * * @param params.key - Key to press (e.g., 'Enter', 'Escape') * @returns Key press result */ pressKey(params: { key: string; }): Promise; /** * Focus an element on the controlled tab * * @param params.id - Spoken ID from search results * @returns Focus result */ focusElement(params: { id: string; }): Promise; /** * Scroll to an element on the controlled tab * * @param params.id - Spoken ID from search results * @returns Scroll result */ scrollToElement(params: { id: string; }): Promise; /** * Get compressed page snapshot * Returns a highly compressed view of all interactive/visible elements * Use this when search fails to get context about what's on the page * * @returns Compressed snapshot with element IDs, tags, text, etc. */ getPageSnapshot(_params: {}): Promise; /** * Get all action definitions for registering with Vowel * * @returns Record of action names to their definitions */ getActionDefinitions(): { getCurrentPageContext: { description: string; parameters: {}; }; searchElements: { description: string; parameters: { query: { type: string; description: string; }; maxResults: { type: string; description: string; optional: boolean; }; minSimilarity: { type: string; description: string; optional: boolean; }; requireInteractive: { type: string; description: string; optional: boolean; }; requireVisible: { type: string; description: string; optional: boolean; }; tag: { type: string; description: string; optional: boolean; }; }; }; clickElement: { description: string; parameters: { id: { type: string; description: string; }; }; }; typeIntoElement: { description: string; parameters: { id: { type: string; description: string; }; text: { type: string; description: string; }; }; }; pressKey: { description: string; parameters: { key: { type: string; description: string; }; }; }; focusElement: { description: string; parameters: { id: { type: string; description: string; }; }; }; scrollToElement: { description: string; parameters: { id: { type: string; description: string; }; }; }; getPageSnapshot: { description: string; parameters: {}; }; }; } export {}; //# sourceMappingURL=actions.d.ts.map