@prodact.ai/sdk 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/react/index.ts","../src/react/ProduckProvider.tsx","../src/core.ts","../src/react/context.ts","../src/react/ProduckChat.tsx","../src/react/hooks.ts","../src/react/ProduckTarget.tsx"],"sourcesContent":["// React components and hooks\nexport { ProduckProvider } from './ProduckProvider';\nexport type { ProduckProviderProps } from './ProduckProvider';\n\nexport { ProduckChat } from './ProduckChat';\nexport type { ProduckChatProps, ProduckChatAppearance } from './ProduckChat';\n\nexport { ProduckTarget } from './ProduckTarget';\nexport type { ProduckTargetProps } from './ProduckTarget';\n\nexport {\n useProduck,\n useProduckAction,\n useProduckReady,\n useProduckMessages,\n useProduckFlow,\n} from './hooks';\n\nexport { ProduckContext } from './context';\nexport type { ProduckContextValue } from './context';\n\n// Re-export types from core\nexport type {\n ProduckConfig,\n ActionPayload,\n ChatMessage,\n ActionHandler,\n FlowPayload,\n FlowStep,\n FlowResult,\n FlowStepResult,\n} from '../core';\n","'use client';\n\nimport React, { useState, useEffect, useCallback, useRef, ReactNode } from 'react';\nimport { ProduckSDK, ProduckConfig, ChatMessage, ActionPayload, FlowPayload, FlowResult, FlowStepResult } from '../core';\nimport { ProduckContext, ProduckContextValue } from './context';\n\nexport interface ProduckProviderProps {\n config: Omit<ProduckConfig, 'onAction' | 'onMessage' | 'onError' | 'onFlowStart' | 'onFlowStepComplete' | 'onFlowComplete'>;\n children: ReactNode;\n onAction?: (actionKey: string, payload: ActionPayload) => void;\n onError?: (error: Error) => void;\n onFlowStart?: (flow: FlowPayload) => void;\n onFlowStepComplete?: (step: FlowStepResult, flow: FlowPayload) => void;\n onFlowComplete?: (result: FlowResult) => void;\n}\n\nexport function ProduckProvider({\n config,\n children,\n onAction,\n onError,\n onFlowStart,\n onFlowStepComplete,\n onFlowComplete,\n}: ProduckProviderProps) {\n const [sdk, setSdk] = useState<ProduckSDK | null>(null);\n const [isReady, setIsReady] = useState(false);\n const [sessionToken, setSessionToken] = useState<string | null>(null);\n const [messages, setMessages] = useState<ChatMessage[]>([]);\n const [isLoading, setIsLoading] = useState(false);\n const [activeFlow, setActiveFlow] = useState<FlowPayload | null>(null);\n const [flowResult, setFlowResult] = useState<FlowResult | null>(null);\n const [isExecutingFlow, setIsExecutingFlow] = useState(false);\n const actionsRef = useRef<Map<string, (payload: ActionPayload) => void>>(new Map());\n const initAttempted = useRef(false);\n\n // Initialize SDK\n useEffect(() => {\n // Prevent double initialization in React strict mode\n if (initAttempted.current) return;\n initAttempted.current = true;\n\n const produckSdk = new ProduckSDK({\n ...config,\n onAction: (key, payload) => {\n // Call registered action handler\n const handler = actionsRef.current.get(key);\n if (handler) {\n handler(payload);\n }\n onAction?.(key, payload);\n },\n onError,\n // Flow event handlers\n onFlowStart: (flow) => {\n setActiveFlow(flow);\n setIsExecutingFlow(true);\n setFlowResult(null);\n onFlowStart?.(flow);\n },\n onFlowStepComplete: (step, flow) => {\n onFlowStepComplete?.(step, flow);\n },\n onFlowComplete: (result) => {\n setFlowResult(result);\n setIsExecutingFlow(false);\n onFlowComplete?.(result);\n },\n });\n\n setSdk(produckSdk);\n\n produckSdk.init().then(() => {\n setIsReady(true);\n setSessionToken(produckSdk.getSessionToken());\n }).catch((err) => {\n console.error('Failed to initialize Produck SDK:', err);\n // Still set ready to true so the chat can show an error state\n // rather than being stuck on loading forever\n setIsReady(true);\n onError?.(err);\n });\n\n return () => {\n produckSdk.destroy();\n initAttempted.current = false;\n };\n }, [config.guiderId, config.apiUrl, config.sdkKey]);\n\n // Send message handler\n const sendMessage = useCallback(async (message: string) => {\n if (!sdk || !isReady) return;\n\n setIsLoading(true);\n setMessages(prev => [...prev, { role: 'user', content: message }]);\n\n try {\n const response = await sdk.sendMessage(message);\n setMessages(prev => [...prev, response]);\n } catch (error) {\n console.error('Failed to send message:', error);\n onError?.(error as Error);\n } finally {\n setIsLoading(false);\n }\n }, [sdk, isReady, onError]);\n\n // Register action handler\n const register = useCallback((actionKey: string, handler: (payload: ActionPayload) => void) => {\n console.log('%cšŸ“ [Provider] register called', 'background: #0f0; color: #000;', {\n actionKey,\n sdkExists: !!sdk,\n isReady,\n });\n actionsRef.current.set(actionKey, handler);\n if (sdk) {\n sdk.register(actionKey, handler);\n console.log('%cāœ… [Provider] Registered with SDK', 'background: #0f0; color: #000;', {\n actionKey,\n sdkRegisteredActions: sdk.getRegisteredActions(),\n });\n } else {\n console.log('%cā³ [Provider] SDK not ready, stored in actionsRef only', 'background: #ff0; color: #000;', { actionKey });\n }\n }, [sdk, isReady]);\n\n // Re-register all actions when SDK becomes available\n useEffect(() => {\n if (sdk && actionsRef.current.size > 0) {\n console.log('%cšŸ”„ [Provider] SDK ready, re-registering actions', 'background: #0ff; color: #000;', {\n actionsToRegister: Array.from(actionsRef.current.keys()),\n });\n actionsRef.current.forEach((handler, key) => {\n sdk.register(key, handler);\n });\n console.log('%cāœ… [Provider] All actions re-registered', 'background: #0f0; color: #000;', {\n registeredActions: sdk.getRegisteredActions(),\n });\n }\n }, [sdk]);\n\n // Unregister action handler\n const unregister = useCallback((actionKey: string) => {\n actionsRef.current.delete(actionKey);\n sdk?.unregister(actionKey);\n }, [sdk]);\n\n const contextValue: ProduckContextValue = {\n sdk,\n isReady,\n sessionToken,\n messages,\n isLoading,\n sendMessage,\n register,\n unregister,\n // Flow-related state\n activeFlow,\n flowResult,\n isExecutingFlow,\n };\n\n return (\n <ProduckContext.Provider value={contextValue}>\n {children}\n </ProduckContext.Provider>\n );\n}\n","// Types\nexport interface ProduckConfig {\n guiderId?: string; // Legacy support\n sdkKey?: string; // New SDK key approach\n apiUrl?: string;\n onAction?: (actionKey: string, action: ActionPayload) => void;\n onMessage?: (message: ChatMessage) => void;\n onError?: (error: Error) => void;\n onFlowStart?: (flow: FlowPayload) => void;\n onFlowStepComplete?: (step: FlowStepResult, flow: FlowPayload) => void;\n onFlowComplete?: (result: FlowResult) => void;\n}\n\nexport interface ActionPayload {\n actionKey: string;\n name: string;\n actionType: string;\n actionConfig: Record<string, any>;\n responseMessage?: string;\n}\n\n// Flow types\nexport interface FlowStep {\n operationId: string;\n order: number;\n condition?: Record<string, any>;\n inputMapping?: Record<string, any>;\n}\n\nexport interface FlowPayload {\n flowId: string;\n name: string;\n description: string;\n steps: FlowStep[];\n}\n\nexport interface FlowStepResult {\n operationId: string;\n order: number;\n success: boolean;\n data?: any;\n error?: string;\n}\n\nexport interface FlowResult {\n flowId: string;\n name: string;\n steps: FlowStepResult[];\n completed: boolean;\n totalSteps: number;\n successfulSteps: number;\n}\n\nexport interface ChatMessage {\n role: 'user' | 'assistant';\n content: string;\n action?: ActionPayload;\n flow?: FlowPayload;\n flowResult?: FlowResult;\n}\n\nexport interface ActionHandler {\n (payload: ActionPayload): void | Promise<void>;\n}\n\nexport interface RegisteredAction {\n key: string;\n handler: ActionHandler;\n}\n\nexport type ProduckEventType = 'action' | 'message' | 'error' | 'ready' | 'flowStart' | 'flowStepComplete' | 'flowComplete';\n\nexport interface ProduckEvent {\n type: ProduckEventType;\n data: any;\n}\n\n// Core SDK Class\nexport class ProduckSDK {\n private config: ProduckConfig;\n private actions: Map<string, ActionHandler> = new Map();\n private eventListeners: Map<ProduckEventType, Set<Function>> = new Map();\n private sessionToken: string | null = null;\n private isReady: boolean = false;\n\n constructor(config: ProduckConfig) {\n // Determine API URL - use custom if provided, otherwise use smart defaults\n let apiUrl = config.apiUrl;\n \n if (!apiUrl) {\n // Check if we're in a browser environment and running on localhost\n if (typeof window !== 'undefined') {\n apiUrl = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1'\n ? 'http://localhost:4001/api/v1'\n : `${window.location.protocol}//${window.location.host}/api/v1`;\n } else {\n // Server-side default\n apiUrl = 'http://localhost:4001/api/v1';\n }\n }\n \n this.config = {\n apiUrl,\n ...config,\n };\n }\n\n /**\n * Initialize the SDK and create a chat session\n */\n async init(): Promise<void> {\n await this.log('info', 'SDK Initializing', {\n apiUrl: this.config.apiUrl,\n hasSDKKey: !!this.config.sdkKey,\n hasGuiderId: !!this.config.guiderId,\n });\n \n try {\n let endpoint: string;\n \n if (this.config.sdkKey) {\n // New SDK key approach\n endpoint = `${this.config.apiUrl}/sdk/session`;\n await this.log('info', 'Using SDK key authentication');\n } else if (this.config.guiderId) {\n // Legacy guider approach\n endpoint = `${this.config.apiUrl}/chat/${this.config.guiderId}/session`;\n await this.log('info', 'Using guider ID authentication');\n } else {\n throw new Error('Either sdkKey or guiderId must be provided');\n }\n\n await this.log('info', 'Creating session', { endpoint });\n\n const headers: Record<string, string> = { 'Content-Type': 'application/json' };\n if (this.config.sdkKey) {\n headers['X-SDK-Key'] = this.config.sdkKey;\n }\n\n const response = await fetch(endpoint, {\n method: 'POST',\n headers,\n });\n\n if (!response.ok) {\n await this.log('error', 'Failed to create session', { status: response.status });\n throw new Error(`Failed to create session: ${response.status}`);\n }\n\n const session = await response.json();\n this.sessionToken = session.session_token;\n this.isReady = true;\n \n await this.log('info', 'SDK initialized successfully', { hasSessionToken: !!this.sessionToken });\n \n this.emit('ready', { sessionToken: this.sessionToken });\n } catch (error) {\n await this.log('error', 'SDK initialization failed', { error: error instanceof Error ? error.message : String(error) });\n this.emit('error', error);\n throw error;\n }\n }\n\n /**\n * Register an action handler\n */\n register(actionKey: string, handler: ActionHandler): void {\n this.actions.set(actionKey, handler);\n this.log('info', 'Action handler registered', { actionKey, totalActions: this.actions.size });\n }\n\n /**\n * Unregister an action handler\n */\n unregister(actionKey: string): void {\n this.actions.delete(actionKey);\n this.log('info', 'Action handler unregistered', { actionKey, remainingActions: this.actions.size });\n }\n\n /**\n * Send a message and handle potential action or flow triggers\n */\n async sendMessage(message: string): Promise<ChatMessage> {\n if (!this.isReady || !this.sessionToken) {\n throw new Error('SDK not initialized. Call init() first.');\n }\n\n const startTime = Date.now();\n await this.log('info', 'sendMessage called', { message });\n\n try {\n // First, check if message matches any SDK action or flow\n let intentEndpoint: string;\n const headers: Record<string, string> = { 'Content-Type': 'application/json' };\n \n if (this.config.sdkKey) {\n intentEndpoint = `${this.config.apiUrl}/sdk/match-intent`;\n headers['X-SDK-Key'] = this.config.sdkKey;\n } else {\n intentEndpoint = `${this.config.apiUrl}/sdk/public/${this.config.guiderId}/match-intent`;\n }\n\n const intentResponse = await fetch(intentEndpoint, {\n method: 'POST',\n headers,\n body: JSON.stringify({ userMessage: message }),\n });\n\n await this.log('info', 'Match-intent response received', { status: intentResponse.status });\n\n if (intentResponse.ok) {\n const intentResult = await intentResponse.json();\n \n // Handle FLOW match\n if (intentResult.matched && intentResult.type === 'flow' && intentResult.flow) {\n await this.log('info', 'Flow matched', {\n flowId: intentResult.flow.flowId,\n name: intentResult.flow.name,\n stepCount: intentResult.flow.steps?.length,\n });\n \n // Send log to backend\n await this.sendLogToBackend({\n userMessage: message,\n matched: true,\n actionKey: `flow:${intentResult.flow.flowId}`,\n responseMessage: intentResult.responseMessage,\n executionTimeMs: Date.now() - startTime,\n });\n \n // Execute the flow\n const flowResult = await this.executeFlow(intentResult.flow);\n \n const flowMessage: ChatMessage = {\n role: 'assistant',\n content: intentResult.responseMessage || `I've completed the \"${intentResult.flow.name}\" flow for you.`,\n flow: intentResult.flow,\n flowResult,\n };\n \n this.emit('message', flowMessage);\n return flowMessage;\n }\n \n // Handle OPERATION match (existing behavior)\n if (intentResult.matched && (intentResult.type === 'operation' || intentResult.action)) {\n const action = intentResult.action;\n await this.log('info', 'Action matched', {\n actionKey: action.actionKey,\n actionType: action.actionType,\n responseMessage: action.responseMessage,\n });\n \n // Send log to backend\n await this.sendLogToBackend({\n userMessage: message,\n matched: true,\n actionKey: action.actionKey,\n responseMessage: action.responseMessage,\n executionTimeMs: Date.now() - startTime,\n });\n \n // Execute the action\n await this.executeAction(action);\n \n const actionMessage: ChatMessage = {\n role: 'assistant',\n content: action.responseMessage || `I've triggered the \"${action.name}\" action for you.`,\n action: action,\n };\n \n this.emit('message', actionMessage);\n return actionMessage;\n } else {\n \n // Send log for no match\n await this.sendLogToBackend({\n userMessage: message,\n matched: false,\n executionTimeMs: Date.now() - startTime,\n });\n }\n }\n\n // No action matched, send to regular chat\n const sessionResponse = await fetch(\n `${this.config.apiUrl}/chat/sessions/${this.sessionToken}/message`,\n {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ message }),\n }\n );\n\n if (!sessionResponse.ok) {\n throw new Error(`Failed to send message: ${sessionResponse.status}`);\n }\n\n const result = await sessionResponse.json();\n const chatMessage: ChatMessage = {\n role: 'assistant',\n content: result.message?.content || result.response || '',\n };\n\n await this.log('info', 'Chat response received');\n this.emit('message', chatMessage);\n return chatMessage;\n } catch (error) {\n await this.log('error', 'Error in sendMessage', { error: error instanceof Error ? error.message : String(error) });\n this.emit('error', error);\n throw error;\n }\n }\n\n /**\n * Execute a flow by running each step's operation sequentially\n */\n async executeFlow(flow: FlowPayload): Promise<FlowResult> {\n await this.log('info', 'executeFlow started', {\n flowId: flow.flowId,\n name: flow.name,\n stepCount: flow.steps.length,\n });\n\n // Emit flow start event\n this.emit('flowStart', flow);\n if (this.config.onFlowStart) {\n this.config.onFlowStart(flow);\n }\n\n const stepResults: FlowStepResult[] = [];\n let context: Record<string, any> = {};\n\n // Sort steps by order\n const sortedSteps = [...flow.steps].sort((a, b) => a.order - b.order);\n\n for (const step of sortedSteps) {\n await this.log('info', 'Executing flow step', {\n flowId: flow.flowId,\n operationId: step.operationId,\n order: step.order,\n });\n\n const stepResult: FlowStepResult = {\n operationId: step.operationId,\n order: step.order,\n success: false,\n };\n\n try {\n // Get the handler for this operation\n const handler = this.actions.get(step.operationId);\n \n if (handler) {\n // Create action payload for the step\n const actionPayload: ActionPayload = {\n actionKey: step.operationId,\n name: step.operationId,\n actionType: 'callback',\n actionConfig: {\n flowContext: context,\n inputMapping: step.inputMapping,\n },\n };\n\n // Execute the handler\n const result = await handler(actionPayload);\n \n stepResult.success = true;\n stepResult.data = result;\n \n // Update context with result for next step\n context = {\n ...context,\n [`step_${step.order}`]: result,\n previousResult: result,\n };\n\n await this.log('info', 'Flow step completed successfully', {\n flowId: flow.flowId,\n operationId: step.operationId,\n order: step.order,\n });\n } else {\n // No handler registered - log warning but continue\n await this.log('warn', 'No handler registered for flow step', {\n flowId: flow.flowId,\n operationId: step.operationId,\n });\n stepResult.success = true; // Consider it \"success\" if no handler needed\n stepResult.data = { skipped: true, reason: 'No handler registered' };\n }\n } catch (error) {\n stepResult.success = false;\n stepResult.error = error instanceof Error ? error.message : String(error);\n \n await this.log('error', 'Flow step failed', {\n flowId: flow.flowId,\n operationId: step.operationId,\n error: stepResult.error,\n });\n }\n\n stepResults.push(stepResult);\n\n // Emit step complete event\n this.emit('flowStepComplete', { step: stepResult, flow });\n if (this.config.onFlowStepComplete) {\n this.config.onFlowStepComplete(stepResult, flow);\n }\n }\n\n const flowResult: FlowResult = {\n flowId: flow.flowId,\n name: flow.name,\n steps: stepResults,\n completed: true,\n totalSteps: flow.steps.length,\n successfulSteps: stepResults.filter(s => s.success).length,\n };\n\n await this.log('info', 'Flow execution completed', {\n flowId: flow.flowId,\n totalSteps: flowResult.totalSteps,\n successfulSteps: flowResult.successfulSteps,\n });\n\n // Emit flow complete event\n this.emit('flowComplete', flowResult);\n if (this.config.onFlowComplete) {\n this.config.onFlowComplete(flowResult);\n }\n\n return flowResult;\n }\n\n /**\n * Send log data to backend for analytics\n */\n private async sendLogToBackend(logData: {\n userMessage: string;\n matched: boolean;\n actionKey?: string;\n responseMessage?: string;\n executionTimeMs?: number;\n error?: string;\n }): Promise<void> {\n try {\n const headers: Record<string, string> = { 'Content-Type': 'application/json' };\n if (this.config.sdkKey) {\n headers['X-SDK-Key'] = this.config.sdkKey;\n }\n\n const logEndpoint = `${this.config.apiUrl}/sdk-logs/client`;\n \n await fetch(logEndpoint, {\n method: 'POST',\n headers,\n body: JSON.stringify({\n ...logData,\n timestamp: new Date().toISOString(),\n sessionToken: this.sessionToken,\n }),\n });\n } catch (error) {\n // Silently fail - don't block operations due to logging failures\n }\n }\n\n /**\n * Send detailed log to backend\n */\n private async log(level: 'info' | 'warn' | 'error', message: string, data?: any): Promise<void> {\n try {\n const headers: Record<string, string> = { 'Content-Type': 'application/json' };\n if (this.config.sdkKey) {\n headers['X-SDK-Key'] = this.config.sdkKey;\n }\n\n const logEndpoint = `${this.config.apiUrl}/sdk-logs/client`;\n \n await fetch(logEndpoint, {\n method: 'POST',\n headers,\n body: JSON.stringify({\n level,\n message,\n data,\n timestamp: new Date().toISOString(),\n sessionToken: this.sessionToken,\n }),\n });\n } catch (error) {\n // Silently fail\n }\n }\n\n /**\n * Execute a registered action\n */\n private async executeAction(action: ActionPayload): Promise<void> {\n const registeredKeys = Array.from(this.actions.keys());\n \n // Very visible debug - will show popup in browser\n if (typeof window !== 'undefined') {\n console.log('%cšŸŽÆ SDK executeAction', 'background: #ff0; color: #000; font-size: 20px; padding: 10px;', {\n actionKey: action.actionKey,\n totalRegistered: this.actions.size,\n registeredKeys,\n });\n }\n \n await this.log('info', 'executeAction called', {\n actionKey: action.actionKey,\n actionType: typeof action.actionKey,\n totalRegistered: this.actions.size,\n registeredKeys,\n keyComparisons: registeredKeys.map(key => ({\n key,\n matches: key === action.actionKey,\n keyLength: key.length,\n actionKeyLength: action.actionKey.length,\n })),\n });\n \n const handler = this.actions.get(action.actionKey);\n \n if (typeof window !== 'undefined') {\n console.log('%cšŸ” SDK Handler Lookup', 'background: #0ff; color: #000; font-size: 16px; padding: 5px;', {\n actionKey: action.actionKey,\n found: !!handler,\n hasConfigOnAction: !!this.config.onAction,\n registeredKeys: Array.from(this.actions.keys()),\n });\n }\n \n if (handler) {\n try {\n const startTime = Date.now();\n await handler(action);\n const executionTime = Date.now() - startTime;\n \n await this.log('info', 'Handler executed successfully', {\n actionKey: action.actionKey,\n executionTime,\n });\n \n await this.sendLogToBackend({\n userMessage: `Action executed: ${action.actionKey}`,\n matched: true,\n actionKey: action.actionKey,\n responseMessage: action.responseMessage || `Executed ${action.name}`,\n executionTimeMs: executionTime,\n });\n \n this.emit('action', action);\n this.config.onAction?.(action.actionKey, action);\n } catch (error) {\n await this.log('error', 'Handler execution failed', {\n actionKey: action.actionKey,\n error: error instanceof Error ? error.message : String(error),\n stack: error instanceof Error ? error.stack : undefined,\n });\n \n await this.sendLogToBackend({\n userMessage: `Action execution failed: ${action.actionKey}`,\n matched: true,\n actionKey: action.actionKey,\n error: error instanceof Error ? error.message : String(error),\n });\n \n this.emit('error', error);\n }\n } else {\n // No handler in SDK's internal registry, but try the config callback\n // (ProduckProvider registers handlers there via actionsRef)\n if (this.config.onAction) {\n await this.log('info', 'No internal handler, trying config.onAction callback', {\n actionKey: action.actionKey,\n });\n \n try {\n this.config.onAction(action.actionKey, action);\n this.emit('action', action);\n \n await this.log('info', 'Action dispatched via config.onAction', {\n actionKey: action.actionKey,\n });\n \n await this.sendLogToBackend({\n userMessage: `Action dispatched: ${action.actionKey}`,\n matched: true,\n actionKey: action.actionKey,\n responseMessage: action.responseMessage || `Dispatched ${action.name}`,\n });\n return;\n } catch (error) {\n await this.log('error', 'config.onAction callback failed', {\n actionKey: action.actionKey,\n error: error instanceof Error ? error.message : String(error),\n });\n }\n }\n \n await this.log('warn', 'No handler registered for action', {\n actionKey: action.actionKey,\n registeredActions: Array.from(this.actions.keys()),\n });\n \n await this.sendLogToBackend({\n userMessage: `No handler for action: ${action.actionKey}`,\n matched: false,\n actionKey: action.actionKey,\n error: `Handler not registered. Available: ${Array.from(this.actions.keys()).join(', ')}`,\n });\n }\n }\n\n /**\n * Add event listener\n */\n on(event: ProduckEventType, callback: Function): void {\n if (!this.eventListeners.has(event)) {\n this.eventListeners.set(event, new Set());\n }\n this.eventListeners.get(event)!.add(callback);\n }\n\n /**\n * Remove event listener\n */\n off(event: ProduckEventType, callback: Function): void {\n this.eventListeners.get(event)?.delete(callback);\n }\n\n /**\n * Emit event\n */\n private emit(event: ProduckEventType, data: any): void {\n this.eventListeners.get(event)?.forEach(callback => callback(data));\n }\n\n /**\n * Get session token\n */\n getSessionToken(): string | null {\n return this.sessionToken;\n }\n\n /**\n * Check if SDK is ready\n */\n getIsReady(): boolean {\n return this.isReady;\n }\n\n /**\n * Get registered action keys\n */\n getRegisteredActions(): string[] {\n return Array.from(this.actions.keys());\n }\n\n /**\n * Destroy the SDK instance\n */\n destroy(): void {\n this.actions.clear();\n this.eventListeners.clear();\n this.sessionToken = null;\n this.isReady = false;\n }\n}\n\n// Factory function\nexport function createProduck(config: ProduckConfig): ProduckSDK {\n return new ProduckSDK(config);\n}\n\n// Default export\nexport default ProduckSDK;\n","'use client';\n\nimport { createContext, useContext } from 'react';\nimport { ProduckSDK, ChatMessage, ActionPayload, FlowPayload, FlowResult, FlowStepResult } from '../core';\n\nexport interface ProduckContextValue {\n sdk: ProduckSDK | null;\n isReady: boolean;\n sessionToken: string | null;\n messages: ChatMessage[];\n isLoading: boolean;\n sendMessage: (message: string) => Promise<void>;\n register: (actionKey: string, handler: (payload: ActionPayload) => void) => void;\n unregister: (actionKey: string) => void;\n // Flow-related state\n activeFlow: FlowPayload | null;\n flowResult: FlowResult | null;\n isExecutingFlow: boolean;\n}\n\nexport const ProduckContext = createContext<ProduckContextValue | null>(null);\n\nexport function useProduckContext(): ProduckContextValue {\n const context = useContext(ProduckContext);\n if (!context) {\n throw new Error('useProduck must be used within a ProduckProvider');\n }\n return context;\n}\n","'use client';\n\nimport React, { useState, useRef, useEffect, CSSProperties } from 'react';\nimport { useProduckMessages, useProduckReady } from './hooks';\n\nexport interface ProduckChatAppearance {\n // Container\n width?: string | number;\n height?: string | number;\n borderRadius?: string | number;\n \n // Colors\n backgroundColor?: string;\n headerBackgroundColor?: string;\n headerTextColor?: string;\n inputBackgroundColor?: string;\n inputTextColor?: string;\n inputBorderColor?: string;\n userMessageBackgroundColor?: string;\n userMessageTextColor?: string;\n assistantMessageBackgroundColor?: string;\n assistantMessageTextColor?: string;\n \n // Button\n buttonBackgroundColor?: string;\n buttonTextColor?: string;\n buttonBorderRadius?: string | number;\n floatingButtonSize?: string | number;\n \n // Fonts\n fontFamily?: string;\n fontSize?: string | number;\n headerFontSize?: string | number;\n \n // Borders & Shadows\n border?: string;\n boxShadow?: string;\n \n // Floating button icon\n floatingButtonIcon?: React.ReactNode;\n floatingButtonLoadingIcon?: React.ReactNode;\n \n // Header\n showCloseButton?: boolean;\n headerIcon?: React.ReactNode;\n \n // Input\n sendButtonText?: string;\n sendButtonIcon?: React.ReactNode;\n \n // Empty state\n emptyStateIcon?: React.ReactNode;\n emptyStateTitle?: string;\n emptyStateSubtitle?: string;\n}\n\nexport interface ProduckChatProps {\n placeholder?: string;\n title?: string;\n position?: 'bottom-right' | 'bottom-left' | 'inline';\n theme?: 'light' | 'dark';\n primaryColor?: string;\n className?: string;\n style?: CSSProperties;\n defaultOpen?: boolean;\n appearance?: ProduckChatAppearance;\n}\n\nexport function ProduckChat({\n placeholder = 'Ask a question...',\n title = 'Chat Assistant',\n position = 'bottom-right',\n theme = 'light',\n primaryColor = '#f97316',\n className = '',\n style = {},\n defaultOpen = false,\n appearance = {},\n}: ProduckChatProps) {\n const { messages, isLoading, sendMessage } = useProduckMessages();\n const isReady = useProduckReady();\n const [input, setInput] = useState('');\n // For inline position, always open. Otherwise respect defaultOpen prop (default: false)\n const [isOpen, setIsOpen] = useState(position === 'inline' ? true : defaultOpen);\n const [isHovering, setIsHovering] = useState(false);\n const messagesEndRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n\n // Auto-scroll to bottom when messages change\n useEffect(() => {\n if (messagesEndRef.current) {\n messagesEndRef.current.scrollIntoView({ behavior: 'smooth' });\n }\n }, [messages]);\n\n // Focus input when chat opens\n useEffect(() => {\n if (isOpen && inputRef.current) {\n setTimeout(() => inputRef.current?.focus(), 100);\n }\n }, [isOpen]);\n\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n if (!input.trim() || isLoading) return;\n\n const message = input;\n setInput('');\n await sendMessage(message);\n };\n\n const isDark = theme === 'dark';\n \n // Merge appearance with defaults\n const {\n width = position === 'inline' ? '100%' : '380px',\n height = position === 'inline' ? '100%' : '520px',\n borderRadius: containerBorderRadius = '16px',\n backgroundColor = isDark ? '#1f2937' : '#ffffff',\n headerBackgroundColor = primaryColor,\n headerTextColor = '#ffffff',\n inputBackgroundColor = isDark ? '#1f2937' : '#ffffff',\n inputTextColor = isDark ? '#f3f4f6' : '#1f2937',\n inputBorderColor = isDark ? '#374151' : '#e5e7eb',\n userMessageBackgroundColor = primaryColor,\n userMessageTextColor = '#ffffff',\n assistantMessageBackgroundColor = isDark ? '#374151' : '#f3f4f6',\n assistantMessageTextColor = isDark ? '#f3f4f6' : '#1f2937',\n buttonBackgroundColor = primaryColor,\n buttonTextColor = '#ffffff',\n buttonBorderRadius = '12px',\n floatingButtonSize = '60px',\n fontFamily = 'system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n fontSize = '14px',\n headerFontSize = '16px',\n border = `1px solid ${isDark ? '#374151' : '#e5e7eb'}`,\n boxShadow = '0 10px 40px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.05)',\n floatingButtonIcon = 'šŸ’¬',\n floatingButtonLoadingIcon = 'ā³',\n showCloseButton = true,\n headerIcon = 'šŸ’¬',\n sendButtonText = 'Send',\n sendButtonIcon,\n emptyStateIcon = 'šŸ‘‹',\n emptyStateTitle = 'Hi! How can I help you today?',\n emptyStateSubtitle = 'Type a message below to get started.',\n } = appearance;\n\n const containerStyles: CSSProperties = {\n fontFamily,\n ...(position !== 'inline' && {\n position: 'fixed',\n bottom: '20px',\n [position === 'bottom-right' ? 'right' : 'left']: '20px',\n zIndex: 9999,\n }),\n ...style,\n };\n\n const chatWindowStyles: CSSProperties = {\n width,\n height,\n maxHeight: position === 'inline' ? '100%' : '80vh',\n backgroundColor,\n borderRadius: containerBorderRadius,\n boxShadow,\n display: 'flex',\n flexDirection: 'column',\n overflow: 'hidden',\n border,\n };\n\n const headerStyles: CSSProperties = {\n padding: '16px 20px',\n backgroundColor: headerBackgroundColor,\n color: headerTextColor,\n fontWeight: 600,\n fontSize: headerFontSize,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n flexShrink: 0,\n };\n\n const messagesContainerStyles: CSSProperties = {\n flex: 1,\n overflowY: 'auto',\n padding: '16px',\n display: 'flex',\n flexDirection: 'column',\n gap: '12px',\n minHeight: 0,\n };\n\n const inputContainerStyles: CSSProperties = {\n padding: '16px',\n borderTop: `1px solid ${inputBorderColor}`,\n backgroundColor: isDark ? '#111827' : '#f9fafb',\n flexShrink: 0,\n };\n\n // Floating button\n const renderFloatingButton = () => (\n <div style={containerStyles} className={className}>\n <button\n onClick={() => setIsOpen(true)}\n onMouseEnter={() => setIsHovering(true)}\n onMouseLeave={() => setIsHovering(false)}\n disabled={!isReady}\n aria-label=\"Open chat\"\n style={{\n width: typeof floatingButtonSize === 'number' ? `${floatingButtonSize}px` : floatingButtonSize,\n height: typeof floatingButtonSize === 'number' ? `${floatingButtonSize}px` : floatingButtonSize,\n borderRadius: '50%',\n backgroundColor: buttonBackgroundColor,\n color: buttonTextColor,\n border: 'none',\n cursor: isReady ? 'pointer' : 'wait',\n boxShadow: isHovering \n ? '0 6px 24px rgba(0,0,0,0.3)' \n : '0 4px 20px rgba(0,0,0,0.2)',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n fontSize: '26px',\n transition: 'all 0.2s ease',\n transform: isHovering ? 'scale(1.05)' : 'scale(1)',\n opacity: isReady ? 1 : 0.7,\n }}\n >\n {isReady ? floatingButtonIcon : floatingButtonLoadingIcon}\n </button>\n </div>\n );\n\n // For non-inline positions, show floating button when closed\n if (position !== 'inline' && !isOpen) {\n return renderFloatingButton();\n }\n\n // For inline position when not ready, show loading state\n if (position === 'inline' && !isReady) {\n return (\n <div style={containerStyles} className={className}>\n <div style={chatWindowStyles}>\n <div style={{ ...headerStyles, justifyContent: 'center' }}>\n <span style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>\n <span style={{ animation: 'spin 1s linear infinite' }}>{floatingButtonLoadingIcon}</span>\n Loading...\n </span>\n </div>\n <div style={{ \n flex: 1, \n display: 'flex', \n alignItems: 'center', \n justifyContent: 'center',\n color: isDark ? '#9ca3af' : '#6b7280',\n }}>\n Connecting to chat...\n </div>\n </div>\n </div>\n );\n }\n\n return (\n <div style={containerStyles} className={className}>\n <div style={chatWindowStyles}>\n {/* Header */}\n <div style={headerStyles}>\n <span style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>\n <span>{headerIcon}</span>\n <span>{title}</span>\n </span>\n {position !== 'inline' && showCloseButton && (\n <button\n onClick={() => setIsOpen(false)}\n aria-label=\"Close chat\"\n style={{\n background: 'rgba(255,255,255,0.2)',\n border: 'none',\n color: '#ffffff',\n cursor: 'pointer',\n fontSize: '16px',\n padding: '4px 8px',\n borderRadius: '6px',\n lineHeight: 1,\n transition: 'background 0.2s ease',\n }}\n onMouseEnter={(e) => (e.currentTarget.style.background = 'rgba(255,255,255,0.3)')}\n onMouseLeave={(e) => (e.currentTarget.style.background = 'rgba(255,255,255,0.2)')}\n >\n āœ•\n </button>\n )}\n </div>\n\n {/* Messages */}\n <div style={messagesContainerStyles}>\n {messages.length === 0 && (\n <div\n style={{\n textAlign: 'center',\n color: isDark ? '#9ca3af' : '#6b7280',\n padding: '40px 20px',\n }}\n >\n <div style={{ fontSize: '40px', marginBottom: '16px' }}>{emptyStateIcon}</div>\n <div style={{ fontSize: typeof fontSize === 'number' ? `${fontSize + 2}px` : fontSize, fontWeight: 500 }}>{emptyStateTitle}</div>\n <div style={{ fontSize: typeof fontSize === 'number' ? `${fontSize}px` : fontSize, marginTop: '8px', opacity: 0.8 }}>\n {emptyStateSubtitle}\n </div>\n </div>\n )}\n\n {messages.map((msg, idx) => (\n <div\n key={idx}\n style={{\n display: 'flex',\n justifyContent: msg.role === 'user' ? 'flex-end' : 'flex-start',\n }}\n >\n <div\n style={{\n maxWidth: '85%',\n padding: '12px 16px',\n borderRadius: msg.role === 'user' \n ? '16px 16px 4px 16px' \n : '16px 16px 16px 4px',\n backgroundColor:\n msg.role === 'user'\n ? userMessageBackgroundColor\n : assistantMessageBackgroundColor,\n color:\n msg.role === 'user'\n ? userMessageTextColor\n : assistantMessageTextColor,\n fontSize: typeof fontSize === 'number' ? `${fontSize}px` : fontSize,\n lineHeight: '1.5',\n wordBreak: 'break-word',\n }}\n >\n {msg.content}\n {msg.action && (\n <div\n style={{\n marginTop: '8px',\n padding: '8px 12px',\n backgroundColor: 'rgba(0,0,0,0.1)',\n borderRadius: '8px',\n fontSize: '12px',\n display: 'flex',\n alignItems: 'center',\n gap: '6px',\n }}\n >\n <span>⚔</span>\n <span>Action triggered: {msg.action.name}</span>\n </div>\n )}\n </div>\n </div>\n ))}\n\n {isLoading && (\n <div style={{ display: 'flex', justifyContent: 'flex-start' }}>\n <div\n style={{\n padding: '12px 16px',\n borderRadius: '16px 16px 16px 4px',\n backgroundColor: assistantMessageBackgroundColor,\n color: isDark ? '#9ca3af' : '#6b7280',\n fontSize: typeof fontSize === 'number' ? `${fontSize}px` : fontSize,\n }}\n >\n <span style={{ \n display: 'inline-block',\n animation: 'pulse 1.5s ease-in-out infinite',\n }}>\n Thinking...\n </span>\n </div>\n </div>\n )}\n\n <div ref={messagesEndRef} />\n </div>\n\n {/* Input */}\n <form onSubmit={handleSubmit} style={inputContainerStyles}>\n <div style={{ display: 'flex', gap: '10px', alignItems: 'center' }}>\n <input\n ref={inputRef}\n type=\"text\"\n value={input}\n onChange={(e) => setInput(e.target.value)}\n placeholder={placeholder}\n disabled={isLoading || !isReady}\n style={{\n flex: 1,\n padding: '14px 18px',\n borderRadius: typeof buttonBorderRadius === 'number' ? `${buttonBorderRadius}px` : buttonBorderRadius,\n border: `2px solid ${inputBorderColor}`,\n backgroundColor: inputBackgroundColor,\n color: inputTextColor,\n fontSize: typeof fontSize === 'number' ? `${fontSize + 1}px` : fontSize,\n outline: 'none',\n transition: 'border-color 0.2s ease, box-shadow 0.2s ease',\n boxSizing: 'border-box',\n }}\n onFocus={(e) => {\n e.currentTarget.style.borderColor = primaryColor;\n e.currentTarget.style.boxShadow = `0 0 0 3px ${primaryColor}22`;\n }}\n onBlur={(e) => {\n e.currentTarget.style.borderColor = inputBorderColor;\n e.currentTarget.style.boxShadow = 'none';\n }}\n />\n <button\n type=\"submit\"\n disabled={isLoading || !input.trim() || !isReady}\n style={{\n padding: '14px 24px',\n borderRadius: typeof buttonBorderRadius === 'number' ? `${buttonBorderRadius}px` : buttonBorderRadius,\n backgroundColor: buttonBackgroundColor,\n color: buttonTextColor,\n border: 'none',\n cursor: (isLoading || !input.trim() || !isReady) ? 'not-allowed' : 'pointer',\n opacity: (isLoading || !input.trim() || !isReady) ? 0.5 : 1,\n fontWeight: 600,\n fontSize: typeof fontSize === 'number' ? `${fontSize + 1}px` : fontSize,\n transition: 'all 0.2s ease',\n flexShrink: 0,\n display: 'flex',\n alignItems: 'center',\n gap: '6px',\n }}\n onMouseEnter={(e) => {\n if (!isLoading && input.trim() && isReady) {\n e.currentTarget.style.transform = 'scale(1.02)';\n e.currentTarget.style.boxShadow = '0 4px 12px rgba(0,0,0,0.2)';\n }\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.transform = 'scale(1)';\n e.currentTarget.style.boxShadow = 'none';\n }}\n >\n {sendButtonIcon && <span>{sendButtonIcon}</span>}\n {sendButtonText}\n </button>\n </div>\n </form>\n </div>\n\n {/* Inline styles for animations */}\n <style>{`\n @keyframes pulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.5; }\n }\n @keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n `}</style>\n </div>\n );\n}\n","'use client';\n\nimport { useEffect, useCallback } from 'react';\nimport { ActionPayload } from '../core';\nimport { useProduckContext } from './context';\n\n/**\n * Hook to access Produck SDK functionality\n */\nexport function useProduck() {\n const context = useProduckContext();\n return context;\n}\n\n/**\n * Hook to register an action handler\n */\nexport function useProduckAction(\n actionKey: string,\n handler: (payload: ActionPayload) => void,\n deps: any[] = []\n) {\n const { register, unregister } = useProduckContext();\n\n const memoizedHandler = useCallback(handler, deps);\n\n useEffect(() => {\n console.log('šŸŽ£ [React Hook] useProduckAction - Registering action');\n console.log(' Action Key:', actionKey);\n register(actionKey, memoizedHandler);\n \n return () => {\n console.log('šŸŽ£ [React Hook] useProduckAction - Cleanup, unregistering action');\n console.log(' Action Key:', actionKey);\n unregister(actionKey);\n };\n }, [actionKey, memoizedHandler, register, unregister]);\n}\n\n/**\n * Hook to check if SDK is ready\n */\nexport function useProduckReady(): boolean {\n const { isReady } = useProduckContext();\n return isReady;\n}\n\n/**\n * Hook to get chat messages\n */\nexport function useProduckMessages() {\n const { messages, isLoading, sendMessage } = useProduckContext();\n return { messages, isLoading, sendMessage };\n}\n\n/**\n * Hook to get flow execution status\n */\nexport function useProduckFlow() {\n const { activeFlow, flowResult, isExecutingFlow } = useProduckContext();\n return { activeFlow, flowResult, isExecutingFlow };\n}\n","'use client';\n\nimport React, { ReactNode, useEffect, useRef } from 'react';\nimport { useProduckAction } from './hooks';\nimport { ActionPayload } from '../core';\n\nexport interface ProduckTargetProps {\n actionKey: string;\n children: ReactNode;\n onTrigger?: (payload: ActionPayload) => void;\n highlightStyle?: React.CSSProperties;\n highlightDuration?: number;\n scrollIntoView?: boolean;\n}\n\n/**\n * Wrapper component that registers an action and can highlight/scroll to the target\n */\nexport function ProduckTarget({\n actionKey,\n children,\n onTrigger,\n highlightStyle = {\n outline: '3px solid #f97316',\n outlineOffset: '2px',\n borderRadius: '8px',\n transition: 'outline 0.3s ease',\n },\n highlightDuration = 3000,\n scrollIntoView = true,\n}: ProduckTargetProps) {\n const ref = useRef<HTMLDivElement>(null);\n const [isHighlighted, setIsHighlighted] = React.useState(false);\n\n useProduckAction(\n actionKey,\n (payload) => {\n // Scroll into view\n if (scrollIntoView && ref.current) {\n ref.current.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n });\n }\n\n // Highlight\n setIsHighlighted(true);\n setTimeout(() => setIsHighlighted(false), highlightDuration);\n\n // Call custom handler\n onTrigger?.(payload);\n },\n [scrollIntoView, highlightDuration, onTrigger]\n );\n\n return (\n <div\n ref={ref}\n style={isHighlighted ? highlightStyle : undefined}\n data-produck-target={actionKey}\n >\n {children}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,IAAAA,gBAA2E;;;AC4EpE,IAAM,aAAN,MAAiB;AAAA,EAOtB,YAAY,QAAuB;AALnC,SAAQ,UAAsC,oBAAI,IAAI;AACtD,SAAQ,iBAAuD,oBAAI,IAAI;AACvE,SAAQ,eAA8B;AACtC,SAAQ,UAAmB;AAIzB,QAAI,SAAS,OAAO;AAEpB,QAAI,CAAC,QAAQ;AAEX,UAAI,OAAO,WAAW,aAAa;AACjC,iBAAS,OAAO,SAAS,aAAa,eAAe,OAAO,SAAS,aAAa,cAC9E,iCACA,GAAG,OAAO,SAAS,QAAQ,KAAK,OAAO,SAAS,IAAI;AAAA,MAC1D,OAAO;AAEL,iBAAS;AAAA,MACX;AAAA,IACF;AAEA,SAAK,SAAS;AAAA,MACZ;AAAA,MACA,GAAG;AAAA,IACL;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,OAAsB;AAC1B,UAAM,KAAK,IAAI,QAAQ,oBAAoB;AAAA,MACzC,QAAQ,KAAK,OAAO;AAAA,MACpB,WAAW,CAAC,CAAC,KAAK,OAAO;AAAA,MACzB,aAAa,CAAC,CAAC,KAAK,OAAO;AAAA,IAC7B,CAAC;AAED,QAAI;AACF,UAAI;AAEJ,UAAI,KAAK,OAAO,QAAQ;AAEtB,mBAAW,GAAG,KAAK,OAAO,MAAM;AAChC,cAAM,KAAK,IAAI,QAAQ,8BAA8B;AAAA,MACvD,WAAW,KAAK,OAAO,UA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,SAAS;AAAA,EAC/C;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,OAAO,gBAAgB,iBAAiB;AAAA,MACxC,uBAAqB;AAAA,MAEpB;AAAA;AAAA,EACH;AAEJ;","names":["import_react","import_react","import_react","import_jsx_runtime","import_react","import_jsx_runtime","React"]}