{"version":3,"file":"index.mjs","sources":["../src/types/index.ts","../src/index.ts"],"sourcesContent":["/**\n * InflowPay Payment SDK Type Definitions\n */\n\n// ============================================================================\n// Locale Types\n// ============================================================================\n\nexport type Locale = 'en' | 'de' | 'es' | 'fr' | 'it' | 'nl' | 'pl' | 'pt';\n\n// ============================================================================\n// SDK Configuration\n// ============================================================================\n\nexport interface SDKConfig {\n  /**\n   * InflowPay public API key (required)\n   *\n   * The environment and URLs are automatically determined from your API key:\n   * - inflow_pub_prod_xxx  → Production (https://api.inflowpay.xyz)\n   * - inflow_pub_dev_xxx   → Development (https://dev.api.inflowpay.com)\n   * - inflow_pub_local_xxx → Sandbox (http://localhost:3001)\n   */\n  apiKey: string;\n\n  /**\n   * Locale for UI text (default: auto-detected from browser, falls back to 'en')\n   * Supported: 'en', 'de', 'es', 'fr', 'it', 'nl', 'pl', 'pt'\n   */\n  locale?: Locale;\n\n  /** Request timeout in milliseconds (default: 30000) */\n  timeout?: number;\n\n  /** Enable debug logging (default: false) */\n  debug?: boolean;\n}\n\n\n// ============================================================================\n// Card Types\n// ============================================================================\n\nexport interface CardData {\n  /** Card number (without spaces or dashes) */\n  number: string;\n\n  /** Expiration month (1-12) */\n  expiration_month: string;\n\n  /** Expiration year (4 digits, e.g., 2025) */\n  expiration_year: string;\n\n  /** Card security code (CVV/CVC) */\n  cvc: string;\n}\n\n// ============================================================================\n// Payment Result Types\n// ============================================================================\n\n/**\n * Payment status enum matching the actual API values\n * Flow: INITIATION -> CHECKOUT_PENDING -> CHECKOUT_SUCCESS -> PAYMENT_RECEIVED -> PAYMENT_SUCCESS\n * Payment is considered successful from CHECKOUT_SUCCESS onwards\n */\nexport enum PaymentStatus {\n  INITIATION = 'INITIATION',\n  CHECKOUT_PENDING = 'CHECKOUT_PENDING', // when the payer is preparing the payment\n  CHECKOUT_SUCCESS = 'CHECKOUT_SUCCESS', // when the payer has successfully paid\n  CHECKOUT_CANCELED = 'CHECKOUT_CANCELED',\n  CANCELED = 'CANCELED',\n  PAYMENT_RECEIVED = 'PAYMENT_RECEIVED', // fiat funds received by the onramp provider\n  PAYMENT_SUCCESS = 'PAYMENT_SUCCESS', // the user wallet received the crypto sent by the onramp provider\n  PAYMENT_FAILED = 'PAYMENT_FAILED',\n}\n\nexport interface PaymentResult {\n  /** Payment status */\n  status: PaymentStatus;\n\n  /** Error details (if status is 'failed') */\n  error?: PaymentError;\n\n  /** Indicates if this payment was already processed (duplicate submission attempt) */\n  alreadyProcessed?: boolean;\n}\n\n// ============================================================================\n// Card Element Types\n// ============================================================================\n\n// Shared style interfaces\nexport interface InputContainerStyles {\n  backgroundColor?: string;\n  border?: string;\n  borderRadius?: string;\n}\n\nexport interface InputStyles {\n  border?: string;\n  borderRadius?: string;\n  color?: string;\n  fontWeight?: string;\n  placeholder?: {\n    color?: string;\n  };\n}\n\nexport interface ThemeStyles {\n  inputContainer?: InputContainerStyles;\n  input?: InputStyles;\n}\n\nexport interface CSSProperties {\n  // Element-based styling \n  inputContainer?: InputContainerStyles;\n  input?: InputStyles;\n  // Global styles that apply to entire card element\n  fontFamily?: string;\n  // Theme-specific overrides\n  light?: ThemeStyles;\n  dark?: ThemeStyles;\n}\n\n// ============================================================================\n// Error Types\n// ============================================================================\n\nexport interface PaymentError {\n  /** Machine-readable error code */\n  code: string;\n\n  /** Human-readable error message */\n  message: string;\n\n  /** Whether this error is retryable (user can fix and retry) */\n  retryable?: boolean;\n\n  /** HTTP status code (if applicable) */\n  statusCode?: number;\n\n  /** Field name (for validation errors) */\n  field?: string;\n\n  /** Documentation URL */\n  docs?: string;\n\n  /** Additional error details */\n  details?: Record<string, unknown>;\n}\n\n// ============================================================================\n// CardElement Options\n// ============================================================================\n\nexport interface ButtonStyle {\n  /** Base button styles */\n  base?: Partial<CSSStyleDeclaration>;\n  /** Hover state styles */\n  hover?: Partial<CSSStyleDeclaration>;\n  /** Disabled state styles */\n  disabled?: Partial<CSSStyleDeclaration>;\n  /** Loader animation color */\n  loaderColor?: string;\n}\n\nexport interface CardElementOptions {\n  /** Container element or CSS selector where the card element will be mounted */\n  container: string | HTMLElement;\n\n  /** Payment ID for this transaction */\n  paymentId: string;\n\n  /** Custom styling for the card element */\n  style?: CSSProperties;\n\n\n  /** Custom button text (default: \"Complete Payment\") */\n  buttonText?: string;\n\n  /** Custom button styling - can be flat CSS properties or structured with states */\n  buttonStyle?: Partial<CSSStyleDeclaration> | ButtonStyle;\n\n  /** Custom placeholder text for inputs */\n  placeholders?: {\n    cardNumber?: string;\n    expiry?: string;\n    cvc?: string;\n  };\n\n  /** Callback when card input state changes */\n  onChange?: (state: CardElementState) => void;\n\n  /** Callback when payment completes */\n  onComplete?: (result: PaymentResult) => void;\n\n  /** Callback when an error occurs */\n  onError?: (error: PaymentError) => void;\n}\n\nexport interface CardElementState {\n  /** Whether all card fields are valid and complete */\n  complete: boolean;\n\n  /** Whether all card fields are empty */\n  empty: boolean;\n\n  /** Field-specific error messages */\n  errors: {\n    cardNumber?: string;\n    expiry?: string;\n    cvc?: string;\n  };\n}\n\n// Re-export PaymentStatusResponse from internal types for public API\nexport type { PaymentStatusResponse } from '../ui/card-element/types';","/**\n * InflowPay Payment SDK\n *\n * Minimal CardElement SDK for embedded payment flows.\n * Provides a secure, pre-built card payment form with direct API integration.\n *\n * @packageDocumentation\n */\n\n// Main SDK class\nexport { PaymentSDK } from './core/payment-sdk';\n\n// UI Components\nexport { CardElement } from './ui/card-element';\n\n// Enums\nexport { PaymentStatus } from './types';\n\n// Types\nexport type {\n  // Configuration\n  SDKConfig,\n  Locale,\n\n  // Card\n  CardData,\n\n  // Payment Result\n  PaymentResult,\n\n  // Error\n  PaymentError,\n\n  // Card Element\n  CardElementOptions,\n  CardElementState,\n  CSSProperties,\n} from './types';\n\n/**\n * SDK version\n */\nexport const VERSION = '0.7.0';\n"],"names":["PaymentStatus","VERSION"],"mappings":";AAkEO,IAAKA,sBAAAA,OACVA,EAAA,aAAa,cACbA,EAAA,mBAAmB,oBACnBA,EAAA,mBAAmB,oBACnBA,EAAA,oBAAoB,qBACpBA,EAAA,WAAW,YACXA,EAAA,mBAAmB,oBACnBA,EAAA,kBAAkB,mBAClBA,EAAA,iBAAiB,kBARPA,IAAAA,KAAA,CAAA,CAAA;ACxBL,MAAMC,IAAU;"}