export interface Transfer3DClientConfig { /** * API base URL * @default Environment variable TRANSFER_3D_API_URL */ baseURL?: string; /** * API authentication token * @default Environment variable TRANSFER_3D_API_TOKEN */ token?: string; /** * Request timeout in milliseconds * @default 30000 */ timeout?: number; } /** * Create a configured 3D Transfer API client * * @example * ```typescript * // Using environment variables (recommended) * const client = createTransfer3DClient(); * * // With explicit configuration * const client = createTransfer3DClient({ * baseURL: 'https://api.example.com/api', * token: 'your-api-token', * }); * ``` */ export declare function createTransfer3DClient(config?: Transfer3DClientConfig): import("@hey-api/client-axios").Client; /** * Get the default product slug from environment variables * * @returns The default product slug if configured, undefined otherwise * * @example * ```typescript * const slug = getDefaultProductSlug(); * if (slug) { * const product = await getTransfer3DProduct({ client, path: { slug } }); * } * ``` */ export declare function getDefaultProductSlug(): string | undefined; /** * Get the default style from environment variables * * @returns The default style if configured, undefined otherwise * * @example * ```typescript * const style = getDefaultStyle(); * if (style) { * // Use single style mode * } * ``` */ export declare function getDefaultStyle(): string | undefined; /** * Product item to add to cart */ export interface CartProduct { /** * Type of the purchasable model * - 'product_variant': Standard product variant * - 'frontier_order': Frontier order (custom 3D model order) */ model_type: 'product_variant' | 'frontier_order'; /** * ID of the purchasable model */ model_id: number; /** * Quantity to add (default: 1) */ quantity?: number; } /** * Options for building the add-to-cart URL */ export interface AddToCartOptions { /** * Products to add to cart */ products: CartProduct[]; /** * URL to redirect after adding to cart * @default '/cart' */ redirectUrl?: string; } /** * Build the add-to-cart redirect URL * * This URL can be used to add products to the shopping cart and redirect users * to the cart page or a custom URL. Works for both logged-in users and guests. * * @param baseURL - API base URL (without /api prefix) * @param options - Add to cart options * @returns The full URL for add-to-cart redirect * * @example * ```typescript * // Add single product to cart * const url = buildAddToCartUrl('https://shop.example.com', { * products: [{ model_type: 'product_variant', model_id: 123 }], * }); * // Result: https://shop.example.com/api/3d-transfer/add-to-cart?products=[{"model_type":"product_variant","model_id":123}] * * // Add multiple products with custom redirect * const url = buildAddToCartUrl('https://shop.example.com', { * products: [ * { model_type: 'product_variant', model_id: 123, quantity: 2 }, * { model_type: 'frontier_order', model_id: 456 }, * ], * redirectUrl: '/checkout', * }); * * // Use in React/HTML * 加入購物車 * window.location.href = url; * ``` */ export declare function buildAddToCartUrl(baseURL: string, options: AddToCartOptions): string; /** * Build the add-to-cart redirect URL using environment variables * * Uses the API URL from environment variables (without the token). * * @param options - Add to cart options * @returns The full URL for add-to-cart redirect, or null if API URL is not configured * * @example * ```typescript * // Using environment variables * const url = buildAddToCartUrlFromEnv({ * products: [{ model_type: 'product_variant', model_id: 123 }], * }); * * if (url) { * window.location.href = url; * } * ``` */ export declare function buildAddToCartUrlFromEnv(options: AddToCartOptions): string | null; /** * Initialize the default SDK client with configuration * * This configures the global `client` instance that's used by all SDK functions * when no custom client is passed. Call this once at app startup. * * @param config - Client configuration options * * @example * ```typescript * // Initialize with explicit configuration * initTransfer3D({ * baseURL: 'https://api.example.com/api', * token: 'your-api-token', * }); * * // Now all SDK functions use this configuration * const styles = await getTransfer3dStyles(); * * // Or initialize from environment variables (auto-detects VITE_, NEXT_PUBLIC_, etc.) * initTransfer3D(); * ``` */ export declare function initTransfer3D(config?: Transfer3DClientConfig): void; //# sourceMappingURL=client.d.ts.map