@inflow_pay/sdk 0.7.0 → 1.0.0
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.
- package/CHANGELOG.md +7 -0
- package/README.md +254 -587
- package/dist/payment-sdk-CC-mm-nt.js +169 -0
- package/dist/payment-sdk-CC-mm-nt.js.map +1 -0
- package/dist/payment-sdk-oRqgQSx5.mjs +821 -0
- package/dist/payment-sdk-oRqgQSx5.mjs.map +1 -0
- package/dist/react/index.d.ts +37 -39
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.esm.js +8 -89
- package/dist/react.esm.js.map +1 -1
- package/dist/react.umd.js +170 -179
- package/dist/react.umd.js.map +1 -1
- package/dist/sdk.cjs +1 -1
- package/dist/sdk.cjs.map +1 -1
- package/dist/sdk.d.ts +43 -160
- package/dist/sdk.esm.js +21 -24
- package/dist/sdk.esm.js.map +1 -1
- package/dist/sdk.umd.js +216 -176
- package/dist/sdk.umd.js.map +1 -1
- package/package.json +6 -6
- package/dist/payment-sdk-CvXfOxY6.js +0 -178
- package/dist/payment-sdk-CvXfOxY6.js.map +0 -1
- package/dist/payment-sdk-DK3VOIGL.mjs +0 -546
- package/dist/payment-sdk-DK3VOIGL.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-sdk-oRqgQSx5.mjs","sources":["../src/types.ts","../src/react/index.tsx","../src/constants/sdk-constants.ts","../src/ui/styles.ts","../src/ui/loader-manager.ts","../src/ui/modal-manager.ts","../src/ui/overlay-manager.ts","../src/utils.ts","../src/sdk.ts","../src/card-element.ts","../src/payment-sdk.ts"],"sourcesContent":["/**\n * Type definitions for SDK v2\n */\n\n// ============================================================================\n// Locale Types\n// ============================================================================\n\nexport type Locale = 'en' | 'de' | 'es' | 'fr' | 'it' | 'nl' | 'pl' | 'pt';\n\n// ============================================================================\n// Style Types\n// ============================================================================\n\nexport type FontFamily =\n | 'DM Sans'\n | 'Inter'\n | 'Poppins'\n | 'Nunito'\n | 'Work Sans'\n | 'Manrope'\n | 'Rubik'\n | 'Karla'\n | 'Figtree'\n | 'Outfit'\n | 'Space Grotesk'\n | 'Urbanist';\n\nexport type FontWeight =\n | 100\n | 200\n | 300\n | 400\n | 500\n | 600\n | 700\n | 800\n | 900\n | 'normal'\n | 'bold'\n | 'lighter'\n | 'bolder';\n\nexport type Opacity = number | string; \n\nexport interface InputContainerStyles {\n backgroundColor?: string;\n borderColor?: string;\n borderEnabled?: boolean;\n borderRadius?: string;\n}\n\nexport interface InputStyles {\n backgroundColor?: string;\n borderColor?: string;\n borderEnabled?: boolean;\n borderRadius?: string;\n textColor?: string;\n placeholderColor?: string;\n}\n\nexport interface ButtonBaseStyles {\n backgroundColor?: string;\n textColor?: string;\n borderRadius?: string;\n borderColor?: string;\n borderEnabled?: boolean;\n fontSize?: string;\n fontWeight?: FontWeight;\n opacity?: Opacity;\n}\n\nexport interface ButtonStyles extends ButtonBaseStyles {\n hover?: ButtonBaseStyles;\n disabled?: ButtonBaseStyles;\n loaderColor?: string;\n}\n\nexport interface GeneralMessageStyles {\n textColor?: string;\n backgroundColor?: string;\n borderEnabled?: boolean;\n borderRadius?: string;\n borderColor?: string;\n}\n\nexport interface ThemeStyles {\n inputContainer?: InputContainerStyles;\n input?: InputStyles;\n button?: ButtonStyles;\n disclaimerColor?: string;\n fieldErrorColor?: string;\n generalError?: GeneralMessageStyles;\n generalSuccess?: GeneralMessageStyles;\n}\n\nexport interface CSSProperties {\n fontFamily?: FontFamily;\n fillParent?: boolean;\n inputContainer?: InputContainerStyles;\n input?: InputStyles;\n button?: ButtonStyles;\n disclaimerColor?: string;\n fieldErrorColor?: string;\n generalError?: GeneralMessageStyles;\n generalSuccess?: GeneralMessageStyles;\n // Theme-specific overrides\n dark?: ThemeStyles;\n}\n\n// ============================================================================\n// SDK Config Types\n// ============================================================================\n\nexport interface SDKConfig {\n /** Public API key */\n publicKey?: string;\n /** Payment configuration */\n config?: PaymentConfig;\n /** Container element or selector where to mount the iframe (if not provided, creates a popup) */\n container?: string | HTMLElement;\n /** Locale for the UI. Defaults to 'en' */\n locale?: Locale;\n /** Callback when payment succeeds */\n onSuccess?: (data: TransactionData) => void;\n /** Callback when payment fails */\n onError?: (error: any) => void;\n /** Callback when user closes the payment modal */\n onClose?: () => void;\n /** Show default success UI after payment (default true). If false, only unmount iframe. */\n showDefaultSuccessUI?: boolean;\n}\n\nexport interface PaymentConfig {\n name?: string;\n amount?: number;\n currency?: string;\n paymentId?: string;\n /** Custom styling for the card element */\n style?: CSSProperties;\n /** Custom button text (default: \"Complete Payment\") */\n buttonText?: string;\n /** Custom placeholder text for inputs */\n placeholders?: {\n cardNumber?: string;\n expiry?: string;\n cvc?: string;\n };\n /** Show default success UI after payment (default true). If false, only unmount iframe. */\n showDefaultSuccessUI?: boolean;\n [key: string]: any;\n}\n\nexport interface IframeMessage {\n type: 'sdkData' | 'success' | 'error' | 'close' | '3ds-required' | 'iframe-ready' | 'content-height' | '3ds-failed' | '3ds-success';\n data?: any;\n config?: PaymentConfig;\n threeDsSessionUrl?: string; // URL for 3DS challenge when type is '3ds-required'\n paymentId?: string; // Payment ID for 3DS flow\n sessionId?: string; // 3DS session ID when type is '3ds-completed'\n success?: boolean; // 3DS result when type is '3ds-result'\n height?: number; // Content height when type is 'content-height'\n}\n\nexport interface TransactionData {\n transaction?: {\n id: string;\n amount: number;\n currency: string;\n status: string;\n created_at: string;\n [key: string]: any;\n };\n [key: string]: any;\n}\n\n// ============================================================================\n// Payment Result Types\n// ============================================================================\n\nexport enum PaymentResultStatus {\n SUCCESS = 'SUCCESS',\n FAILED = 'FAILED',\n}\n\nexport enum PaymentResultErrorCode {\n THREE_DS_FAILED = 'THREE_DS_FAILED',\n PAYMENT_PROCESSING_ERROR = 'PAYMENT_PROCESSING_ERROR',\n}\n\nexport interface PaymentError {\n code: PaymentResultErrorCode;\n message: string;\n retryable: boolean;\n}\n\nexport interface PaymentResult {\n status: PaymentResultStatus;\n paymentId: string;\n error?: PaymentError;\n}\n\nexport interface CardElementState {\n complete: boolean;\n}\n\n","/**\n * InflowPay React SDK v2 - React Components\n * \n * React components that use the iframe-based SDK v2\n * Same API as the original React SDK for easy migration\n */\n\nimport type { ReactNode } from 'react';\nimport { createContext, useContext, useEffect, useRef, useState } from 'react';\nimport type { CardElement as CardElementClass, CardElementOptions } from '../card-element';\nimport type { PaymentSDKConfig } from '../payment-sdk';\nimport { PaymentSDK } from '../payment-sdk';\nimport type {\n CardElementState,\n CSSProperties,\n Locale,\n PaymentError,\n PaymentResult,\n} from '../types';\nimport { PaymentResultStatus } from '../types';\n\nexport interface SDKConfig {\n publicKey: string;\n /** Locale for the payment UI. Defaults to 'en' */\n locale?: Locale;\n}\n\nexport type {\n CardElementState, PaymentError,\n PaymentResult\n} from '../types';\n\nexport { PaymentResultErrorCode, PaymentResultStatus } from '../types';\n\nexport interface CardElementProps {\n paymentId: string;\n onReady?: () => void;\n onChange?: (state: CardElementState) => void;\n onComplete?: (result: PaymentResult) => void;\n onError?: (error: PaymentError) => void;\n style?: CSSProperties;\n buttonText?: string;\n placeholders?: {\n cardNumber?: string;\n expiry?: string;\n cvc?: string;\n };\n /** Show default success UI after payment (default true). If false, only unmount iframe. */\n showDefaultSuccessUI?: boolean;\n}\n\ninterface InflowPayContextValue {\n sdk: PaymentSDK;\n}\n\nconst InflowPayContext = createContext<InflowPayContextValue | null>(null);\n\n/**\n * InflowPayProvider - React component\n * \n * Same API as the original React SDK\n * \n * @example\n * ```tsx\n * <InflowPayProvider config={{ apiKey: 'inflow_pub_xxx' }}>\n * <CardElement\n * paymentId=\"pay_xxx\"\n * onComplete={(result) => {\n * if (result.status === 'CHECKOUT_SUCCESS') {\n * window.location.href = '/success';\n * }\n * }}\n * />\n * </InflowPayProvider>\n * ```\n */\nexport function InflowPayProvider({\n config,\n children,\n}: {\n config: SDKConfig;\n children: ReactNode;\n}) {\n const [sdk] = useState(() => {\n const sdkConfig: PaymentSDKConfig = {\n publicKey: config.publicKey,\n locale: config.locale,\n };\n return new PaymentSDK(sdkConfig);\n });\n\n return (\n <InflowPayContext.Provider value={{ sdk }}>\n {children}\n </InflowPayContext.Provider>\n );\n}\n\n/**\n * useInflowPay - Hook to access InflowPay SDK instance\n * \n * @example\n * ```tsx\n * function CustomComponent() {\n * const inflow = useInflowPay();\n * \n * const checkStatus = async () => {\n * const status = await inflow.getPaymentStatus('pay_xxx');\n * console.log(status);\n * };\n * \n * return <button onClick={checkStatus}>Check Status</button>;\n * }\n * ```\n */\nexport function useInflowPay(): PaymentSDK {\n const context = useContext(InflowPayContext);\n if (!context) {\n throw new Error('useInflowPay must be used within InflowPayProvider');\n }\n return context.sdk;\n}\n\n/**\n * CardElement - React component\n * \n * Same API as the original React SDK\n * \n * @example\n * ```tsx\n * <CardElement\n * paymentId=\"pay_xxx\"\n * onComplete={(result) => {\n * if (result.status === 'CHECKOUT_SUCCESS') {\n * window.location.href = '/success';\n * }\n * }}\n * />\n * ```\n */\nexport function CardElement(props: CardElementProps & { config?: SDKConfig }) {\n const {\n paymentId,\n onReady,\n onChange,\n onComplete,\n onError,\n style,\n buttonText,\n placeholders,\n showDefaultSuccessUI,\n config: propConfig,\n } = props;\n const context = useContext(InflowPayContext);\n const containerRef = useRef<HTMLDivElement>(null);\n const cardElementRef = useRef<CardElementClass | null>(null);\n const [mounted, setMounted] = useState(false);\n\n const sdk = context?.sdk || (propConfig ? new PaymentSDK({\n publicKey: propConfig.publicKey,\n locale: propConfig.locale,\n }) : null);\n\n if (!sdk) {\n throw new Error('CardElement must be used within InflowPayProvider or have a config prop');\n }\n\n useEffect(() => {\n if (!containerRef.current) {\n return;\n }\n\n if (!containerRef.current.id) {\n containerRef.current.id = `inflowpay-card-element-${Date.now()}`;\n }\n\n const cardElementOptions: CardElementOptions = {\n container: containerRef.current,\n paymentId: paymentId,\n ...(style && { style }),\n ...(buttonText && { buttonText }),\n ...(placeholders && { placeholders }),\n ...(showDefaultSuccessUI !== undefined && { showDefaultSuccessUI }),\n onComplete: (result: PaymentResult) => {\n if (onComplete) {\n onComplete(result);\n }\n },\n onError: (error) => {\n if (onError) {\n onError(error);\n } else if (onComplete) {\n onComplete({\n status: PaymentResultStatus.FAILED,\n paymentId: paymentId,\n error: error,\n });\n }\n },\n onClose: () => {\n },\n };\n\n const cardElement = sdk.createCardElement(cardElementOptions);\n cardElementRef.current = cardElement;\n cardElement.mount();\n setMounted(true);\n\n if (onReady) {\n const timer = setTimeout(() => {\n onReady();\n }, 100);\n return () => clearTimeout(timer);\n }\n }, [paymentId, sdk, onComplete, onError, onReady, style, buttonText, placeholders, showDefaultSuccessUI]);\n\n useEffect(() => {\n if (onChange && mounted) {\n onChange({ complete: false });\n }\n }, [mounted, onChange]);\n\n useEffect(() => {\n return () => {\n if (cardElementRef.current) {\n cardElementRef.current.destroy();\n cardElementRef.current = null;\n }\n };\n }, []);\n\n return (\n <div\n ref={containerRef}\n style={{\n width: style?.fillParent ? \"100%\" : \"344px\"\n }}\n />\n );\n}\n","/**\n * SDK Constants\n * Centralized constants for z-indices, dimensions, and configuration values\n */\n\nexport const Z_INDEX = {\n OVERLAY: 999999,\n MODAL: 1000000,\n LOADER: 1000,\n} as const;\n\nexport const DIMENSIONS = {\n MIN_HEIGHT: 196,\n CONTAINER_MAX_WIDTH: '500px',\n CONTAINER_WIDTH_PERCENT: '90%',\n CONTAINER_HEIGHT_PERCENT: '90%',\n CONTAINER_MAX_HEIGHT: '600px',\n BUTTON_SIZE: 30,\n DEFAULT_IFRAME_WIDTH: '344px',\n} as const;\n\nexport const ALLOWED_3DS_ORIGINS = [\n 'https://dev.api.inflowpay.xyz',\n 'https://pre-prod.api.inflowpay.xyz',\n 'https://api.inflowpay.xyz',\n] as const;\n\nexport const ELEMENT_IDS = {\n OVERLAY: 'inflowpay-sdk-overlay',\n LOADER: 'inflowpay-loader',\n LOADER_STYLES: 'inflowpay-loader-styles',\n THREE_DS_OVERLAY: 'inflowpay-3ds-overlay',\n THREE_DS_CLOSE: 'inflowpay-3ds-close',\n} as const;\n\nexport const IFRAME_URLS = {\n PRODUCTION: 'https://iframe.inflowpay.com/iframe/checkout',\n PREPROD: 'https://preprod.iframe.inflowpay.com/iframe/checkout',\n DEVELOPMENT: 'https://dev.iframe.inflowpay.com/iframe/checkout',\n LOCAL: 'http://localhost:3010/iframe/checkout',\n} as const;\n","/**\n * UI Styles\n * Centralized CSS styles for SDK components\n */\n\nimport { Z_INDEX, DIMENSIONS } from '../constants/sdk-constants';\n\n/**\n * Color scheme for dark mode support\n */\nexport interface ColorScheme {\n inputBgColor: string;\n shimmerBase: string;\n shimmerLight: string;\n}\n\n/**\n * Get color scheme based on dark mode preference\n */\nexport function getColorScheme(isDarkMode: boolean): ColorScheme {\n return {\n inputBgColor: isDarkMode ? '#2d2d2d' : '#F5F5F5',\n shimmerBase: isDarkMode ? '#3d3d3d' : '#E5E5E5',\n shimmerLight: isDarkMode ? '#4d4d4d' : '#F0F0F0',\n };\n}\n\n/**\n * Get shimmer gradient for skeleton loader\n */\nexport function getShimmerGradient(colors: ColorScheme): string {\n return `linear-gradient(90deg, ${colors.shimmerBase} 25%, ${colors.shimmerLight} 50%, ${colors.shimmerBase} 75%)`;\n}\n\n/**\n * Overlay styles for popup mode\n */\nexport function getOverlayStyles(): string {\n return `\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: ${Z_INDEX.OVERLAY};\n `;\n}\n\n/**\n * Container styles for popup mode\n */\nexport function getContainerStyles(): string {\n return `\n position: relative;\n width: ${DIMENSIONS.CONTAINER_WIDTH_PERCENT};\n max-width: ${DIMENSIONS.CONTAINER_MAX_WIDTH};\n height: ${DIMENSIONS.CONTAINER_HEIGHT_PERCENT};\n max-height: ${DIMENSIONS.CONTAINER_MAX_HEIGHT};\n background: white;\n border-radius: 8px;\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);\n `;\n}\n\n/**\n * Close button styles\n */\nexport function getCloseButtonStyles(): string {\n return `\n position: absolute;\n top: 10px;\n right: 10px;\n width: ${DIMENSIONS.BUTTON_SIZE}px;\n height: ${DIMENSIONS.BUTTON_SIZE}px;\n border: none;\n background: transparent;\n font-size: 24px;\n cursor: pointer;\n z-index: ${Z_INDEX.MODAL};\n color: #333;\n display: flex;\n align-items: center;\n justify-content: center;\n `;\n}\n\n/**\n * Iframe styles for popup mode\n */\nexport function getPopupIframeStyles(): string {\n return `\n width: 100%;\n height: 100%;\n border: none;\n border-radius: 8px;\n `;\n}\n\n/**\n * Iframe styles for inline mode\n */\nexport function getInlineIframeStyles(fillParent: boolean): string {\n const width = fillParent ? '100%' : DIMENSIONS.DEFAULT_IFRAME_WIDTH;\n const maxWidth = fillParent ? 'none' : '100%';\n \n return `\n width: ${width};\n max-width: ${maxWidth};\n height: ${DIMENSIONS.MIN_HEIGHT}px;\n min-height: ${DIMENSIONS.MIN_HEIGHT}px;\n border: none;\n display: block;\n transition: height 0.2s ease;\n `;\n}\n\n/**\n * Loader container styles\n */\nexport function getLoaderContainerStyles(): string {\n return `\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: ${Z_INDEX.LOADER};\n padding: 20px;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n align-items: center;\n `;\n}\n\n/**\n * Skeleton card element styles\n */\nexport function getSkeletonCardStyles(fillParent: boolean): string {\n const width = fillParent ? '100%' : DIMENSIONS.DEFAULT_IFRAME_WIDTH;\n \n return `\n width: ${width};\n max-width: 100%;\n margin: 0 auto;\n `;\n}\n\n/**\n * Input wrapper styles for skeleton loader\n */\nexport function getInputWrapStyles(bgColor: string): string {\n return `\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n background-color: ${bgColor};\n padding: 8px;\n border-radius: 8px;\n margin-bottom: 20px;\n `;\n}\n\n/**\n * Skeleton element base styles\n */\nexport function getSkeletonBaseStyles(shimmerGradient: string): string {\n return `\n background: ${shimmerGradient};\n background-size: 200% 100%;\n animation: inflowpay-shimmer 1.5s infinite;\n `;\n}\n\n/**\n * Card number skeleton styles\n */\nexport function getCardNumberSkeletonStyles(shimmerGradient: string): string {\n return `\n flex: 1;\n min-width: 0;\n height: 32px;\n border-radius: 6px;\n ${getSkeletonBaseStyles(shimmerGradient)}\n `;\n}\n\n/**\n * Expiry skeleton styles\n */\nexport function getExpirySkeletonStyles(shimmerGradient: string): string {\n return `\n width: 21.5%;\n flex-shrink: 0;\n height: 32px;\n border-radius: 6px;\n ${getSkeletonBaseStyles(shimmerGradient)}\n `;\n}\n\n/**\n * CVC skeleton styles\n */\nexport function getCvcSkeletonStyles(shimmerGradient: string): string {\n return `\n width: 17.5%;\n flex-shrink: 0;\n height: 32px;\n border-radius: 6px;\n ${getSkeletonBaseStyles(shimmerGradient)}\n `;\n}\n\n/**\n * Button skeleton styles\n */\nexport function getButtonSkeletonStyles(shimmerGradient: string): string {\n return `\n width: 100%;\n height: 42px;\n border-radius: 8px;\n ${getSkeletonBaseStyles(shimmerGradient)}\n margin-bottom: 16px;\n `;\n}\n\n/**\n * Disclaimer skeleton container styles\n */\nexport function getDisclaimerSkeletonStyles(): string {\n return `\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n width: 100%;\n margin-top: 16px;\n `;\n}\n\n/**\n * Disclaimer icon skeleton styles\n */\nexport function getDisclaimerIconSkeletonStyles(shimmerGradient: string): string {\n return `\n width: 10px;\n height: 10px;\n border-radius: 50%;\n ${getSkeletonBaseStyles(shimmerGradient)}\n `;\n}\n\n/**\n * Disclaimer text skeleton styles\n */\nexport function getDisclaimerTextSkeletonStyles(shimmerGradient: string): string {\n return `\n width: 80%;\n height: 16px;\n border-radius: 4px;\n ${getSkeletonBaseStyles(shimmerGradient)}\n `;\n}\n\n/**\n * Shimmer animation keyframes\n */\nexport const SHIMMER_ANIMATION = `\n @keyframes inflowpay-shimmer {\n 0% {\n background-position: -200% 0;\n }\n 100% {\n background-position: 200% 0;\n }\n }\n`;\n\n/**\n * 3DS overlay styles\n */\nexport function get3DSOverlayStyles(): string {\n return `\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.7);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: ${Z_INDEX.OVERLAY};\n `;\n}\n\n/**\n * 3DS modal styles\n */\nexport function get3DSModalStyles(): string {\n return `\n position: relative;\n width: ${DIMENSIONS.CONTAINER_WIDTH_PERCENT};\n max-width: ${DIMENSIONS.CONTAINER_MAX_WIDTH};\n height: ${DIMENSIONS.CONTAINER_HEIGHT_PERCENT};\n max-height: ${DIMENSIONS.CONTAINER_MAX_HEIGHT};\n background: white;\n border-radius: 16px;\n overflow: hidden;\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);\n display: flex;\n flex-direction: column;\n `;\n}\n\n/**\n * 3DS header styles\n */\nexport function get3DSHeaderStyles(): string {\n return `\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 15px 20px;\n border-bottom: 1px solid #e5e5e5;\n `;\n}\n\n/**\n * 3DS content styles\n */\nexport function get3DSContentStyles(): string {\n return `\n flex: 1;\n position: relative;\n overflow-y: auto;\n overflow-x: hidden;\n `;\n}\n\n/**\n * 3DS iframe styles\n */\nexport function get3DSIframeStyles(): string {\n return `\n width: 100%;\n height: 100%;\n border: none;\n `;\n}\n","/**\n * Loader Manager\n * Handles skeleton loading UI while iframe is initializing\n */\n\nimport { ELEMENT_IDS } from '../constants/sdk-constants';\nimport {\n getColorScheme,\n getShimmerGradient,\n getLoaderContainerStyles,\n getSkeletonCardStyles,\n getInputWrapStyles,\n getCardNumberSkeletonStyles,\n getExpirySkeletonStyles,\n getCvcSkeletonStyles,\n getButtonSkeletonStyles,\n getDisclaimerSkeletonStyles,\n getDisclaimerIconSkeletonStyles,\n getDisclaimerTextSkeletonStyles,\n SHIMMER_ANIMATION,\n} from './styles';\n\nexport interface LoaderConfig {\n fillParent?: boolean;\n}\n\nexport class LoaderManager {\n private container: HTMLElement;\n private config: LoaderConfig;\n private loaderElement: HTMLElement | null = null;\n\n constructor(container: HTMLElement, config: LoaderConfig = {}) {\n this.container = container;\n this.config = config;\n }\n\n /**\n * Show skeleton loader\n */\n show(iframe?: HTMLIFrameElement): void {\n // Hide iframe while loader is showing\n if (iframe) {\n iframe.style.display = 'none';\n }\n\n // Detect dark mode\n const isDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;\n\n // Get color scheme\n const colors = getColorScheme(isDarkMode);\n const shimmerGradient = getShimmerGradient(colors);\n\n // Create loader container\n const loader = document.createElement('div');\n loader.id = ELEMENT_IDS.LOADER;\n loader.style.cssText = getLoaderContainerStyles();\n\n // Create skeleton card element\n const skeletonCard = document.createElement('div');\n skeletonCard.style.cssText = getSkeletonCardStyles(this.config.fillParent || false);\n\n // Create input wrapper\n const inputWrap = document.createElement('div');\n inputWrap.style.cssText = getInputWrapStyles(colors.inputBgColor);\n\n // Create card number skeleton\n const cardNumberSkeleton = document.createElement('div');\n cardNumberSkeleton.className = 'inflowpay-skeleton';\n cardNumberSkeleton.style.cssText = getCardNumberSkeletonStyles(shimmerGradient);\n\n // Create expiry skeleton\n const expirySkeleton = document.createElement('div');\n expirySkeleton.className = 'inflowpay-skeleton';\n expirySkeleton.style.cssText = getExpirySkeletonStyles(shimmerGradient);\n\n // Create CVC skeleton\n const cvcSkeleton = document.createElement('div');\n cvcSkeleton.className = 'inflowpay-skeleton';\n cvcSkeleton.style.cssText = getCvcSkeletonStyles(shimmerGradient);\n\n // Assemble input wrapper\n inputWrap.appendChild(cardNumberSkeleton);\n inputWrap.appendChild(expirySkeleton);\n inputWrap.appendChild(cvcSkeleton);\n\n // Create button skeleton\n const buttonSkeleton = document.createElement('div');\n buttonSkeleton.className = 'inflowpay-skeleton';\n buttonSkeleton.style.cssText = getButtonSkeletonStyles(shimmerGradient);\n\n // Create disclaimer skeleton\n const disclaimerSkeleton = document.createElement('div');\n disclaimerSkeleton.style.cssText = getDisclaimerSkeletonStyles();\n\n const disclaimerIconSkeleton = document.createElement('div');\n disclaimerIconSkeleton.className = 'inflowpay-skeleton';\n disclaimerIconSkeleton.style.cssText = getDisclaimerIconSkeletonStyles(shimmerGradient);\n\n const disclaimerTextSkeleton = document.createElement('div');\n disclaimerTextSkeleton.className = 'inflowpay-skeleton';\n disclaimerTextSkeleton.style.cssText = getDisclaimerTextSkeletonStyles(shimmerGradient);\n\n disclaimerSkeleton.appendChild(disclaimerIconSkeleton);\n disclaimerSkeleton.appendChild(disclaimerTextSkeleton);\n\n // Assemble skeleton card\n skeletonCard.appendChild(inputWrap);\n skeletonCard.appendChild(buttonSkeleton);\n skeletonCard.appendChild(disclaimerSkeleton);\n\n // Add to loader\n loader.appendChild(skeletonCard);\n\n // Inject shimmer animation styles if not already present\n this.injectShimmerStyles();\n\n // Add loader to container\n this.container.appendChild(loader);\n this.loaderElement = loader;\n }\n\n /**\n * Hide loader\n */\n hide(iframe?: HTMLIFrameElement): void {\n const loader = document.getElementById(ELEMENT_IDS.LOADER);\n if (loader) {\n loader.remove();\n }\n this.loaderElement = null;\n\n // Show iframe again when loader is hidden\n if (iframe) {\n iframe.style.display = '';\n }\n }\n\n /**\n * Inject shimmer animation styles into document head\n */\n private injectShimmerStyles(): void {\n if (!document.getElementById(ELEMENT_IDS.LOADER_STYLES)) {\n const style = document.createElement('style');\n style.id = ELEMENT_IDS.LOADER_STYLES;\n style.textContent = SHIMMER_ANIMATION;\n document.head.appendChild(style);\n }\n }\n}\n","/**\n * Modal Manager\n * Handles 3DS authentication modal\n */\n\nimport { ALLOWED_3DS_ORIGINS, DIMENSIONS, ELEMENT_IDS } from '../constants/sdk-constants';\nimport {\n get3DSContentStyles,\n get3DSHeaderStyles,\n get3DSIframeStyles,\n get3DSModalStyles,\n get3DSOverlayStyles,\n getCloseButtonStyles,\n} from './styles';\n\nexport interface ModalConfig {\n environment: 'sandbox' | 'production' | 'development' | 'preprod';\n debug?: boolean;\n}\n\nexport class ModalManager {\n private config: ModalConfig;\n private static activeModal: {\n overlay: HTMLElement;\n sessionId: string;\n paymentId: string;\n } | null = null;\n\n constructor(config: ModalConfig) {\n this.config = config;\n }\n\n /**\n * Open 3DS authentication modal\n * Returns a Promise that resolves with the authentication result\n */\n open(challengeUrl: string, sessionId: string, paymentId: string): Promise<boolean> {\n if (this.config.debug) {\n console.log('[SDK] open3DSModal called with URL:', challengeUrl);\n console.log('[SDK] Session ID:', sessionId, 'Payment ID:', paymentId);\n }\n\n // If there's already a modal open, close it first\n if (ModalManager.activeModal) {\n console.warn('[SDK] Closing existing modal before opening new one');\n ModalManager.activeModal.overlay.remove();\n ModalManager.activeModal = null;\n }\n\n return new Promise((resolve) => {\n // Create overlay\n const overlay = document.createElement('div');\n overlay.id = ELEMENT_IDS.THREE_DS_OVERLAY;\n overlay.style.cssText = get3DSOverlayStyles();\n\n // Create modal\n const modal = document.createElement('div');\n modal.style.cssText = get3DSModalStyles();\n\n // Create header\n const header = document.createElement('div');\n header.style.cssText = get3DSHeaderStyles();\n header.innerHTML = `\n <h3 style=\"margin: 0; font-size: 18px; font-weight: 600;\">Secure Payment Authentication</h3>\n `;\n\n // Create content with iframe\n const content = document.createElement('div');\n content.style.cssText = get3DSContentStyles();\n \n const iframe = document.createElement('iframe');\n iframe.src = challengeUrl;\n iframe.style.cssText = get3DSIframeStyles();\n iframe.setAttribute('allow', 'payment');\n iframe.setAttribute('sandbox', 'allow-forms allow-scripts allow-same-origin allow-popups');\n content.appendChild(iframe);\n\n // Assemble modal\n modal.appendChild(header);\n modal.appendChild(content);\n overlay.appendChild(modal);\n document.body.appendChild(overlay);\n\n // Store as THE active modal\n ModalManager.activeModal = {\n overlay,\n sessionId,\n paymentId\n };\n\n // Message handler for 3DS completion\n const messageHandler = (event: MessageEvent) => {\n if (!event.data) return;\n\n // Validate origin\n if (!this.isAllowedOrigin(event.origin)) {\n if (this.config.debug) {\n console.warn('[SDK] Rejected 3DS message from unauthorized origin:', event.origin);\n }\n return;\n }\n\n const data = event.data;\n const is3DSComplete = data.type === 'THREE_DS_COMPLETE' || data.type === '3ds-complete';\n const isSuccess = data.status === 'success';\n const isFailure = data.status === 'failed' || data.status === 'failure';\n\n // Success case\n if (is3DSComplete && isSuccess) {\n overlay.remove();\n window.removeEventListener('message', messageHandler);\n resolve(true);\n return;\n }\n\n // Also handle legacy format\n if (isSuccess && !is3DSComplete) {\n overlay.remove();\n window.removeEventListener('message', messageHandler);\n resolve(true);\n return;\n }\n\n // Failure case\n if ((is3DSComplete && isFailure) || data.type === '3ds-failed' || isFailure) {\n overlay.remove();\n window.removeEventListener('message', messageHandler);\n resolve(false);\n return;\n }\n };\n\n window.addEventListener('message', messageHandler);\n });\n }\n\n /**\n * Close 3DS modal (called from external events like WebSocket)\n * @param sessionId - Optional session ID to validate before closing\n */\n static close(sessionId?: string): void {\n if (!ModalManager.activeModal) {\n // No modal is open - nothing to do\n console.log('[SDK] No active modal to close');\n return;\n }\n\n // If sessionId is provided, validate it matches the current modal\n if (sessionId && ModalManager.activeModal.sessionId !== sessionId) {\n console.warn(\n `[SDK] Session ID mismatch: webhook for ${sessionId}, but modal is for ${ModalManager.activeModal.sessionId}. Ignoring close request.`\n );\n return;\n }\n\n // Close the modal\n console.log('[SDK] Closing modal for session:', sessionId || ModalManager.activeModal.sessionId);\n ModalManager.activeModal.overlay.remove();\n ModalManager.activeModal = null;\n }\n\n /**\n * Check if a modal is currently open\n */\n static isModalOpen(): boolean {\n return ModalManager.activeModal !== null;\n }\n\n /**\n * Get current session ID\n */\n static getCurrentSessionId(): string | null {\n return ModalManager.activeModal?.sessionId || null;\n }\n\n /**\n * Check if origin is allowed for 3DS messages\n */\n private isAllowedOrigin(origin: string): boolean {\n // Check exact match with allowed origins\n if ((ALLOWED_3DS_ORIGINS as readonly string[]).includes(origin)) {\n return true;\n }\n\n // Allow localhost in dev/sandbox environments\n if (this.config.environment === 'sandbox' || this.config.environment === 'development') {\n if (origin.includes('localhost') || origin.includes('127.0.0.1')) {\n return true;\n }\n }\n\n return false;\n }\n}\n","/**\n * Overlay Manager\n * Handles popup overlay UI for payment iframe\n */\n\nimport { ELEMENT_IDS } from '../constants/sdk-constants';\nimport {\n getOverlayStyles,\n getContainerStyles,\n getCloseButtonStyles,\n getPopupIframeStyles,\n} from './styles';\n\nexport interface OverlayElements {\n overlay: HTMLElement;\n container: HTMLElement;\n iframe: HTMLIFrameElement;\n}\n\nexport class OverlayManager {\n /**\n * Create popup overlay with iframe\n */\n static createOverlay(\n iframeSrc: string,\n onClose: () => void\n ): OverlayElements {\n // Create overlay\n const overlay = document.createElement('div');\n overlay.id = ELEMENT_IDS.OVERLAY;\n overlay.style.cssText = getOverlayStyles();\n\n // Create iframe container\n const container = document.createElement('div');\n container.style.cssText = getContainerStyles();\n\n // Create close button\n const closeButton = document.createElement('button');\n closeButton.innerHTML = '×';\n closeButton.style.cssText = getCloseButtonStyles();\n closeButton.onclick = onClose;\n\n // Create iframe\n const iframe = document.createElement('iframe');\n iframe.src = iframeSrc;\n iframe.style.cssText = getPopupIframeStyles();\n iframe.setAttribute('allow', 'payment');\n\n // Assemble structure\n container.appendChild(closeButton);\n container.appendChild(iframe);\n overlay.appendChild(container);\n\n // Close on overlay click (but not on container click)\n overlay.addEventListener('click', (e) => {\n if (e.target === overlay) {\n onClose();\n }\n });\n\n return { overlay, container, iframe };\n }\n\n /**\n * Remove overlay from DOM\n */\n static removeOverlay(): void {\n const overlay = document.getElementById(ELEMENT_IDS.OVERLAY);\n if (overlay) {\n overlay.remove();\n }\n }\n}\n","/**\n * Utility functions\n */\n\nimport { IFRAME_URLS } from './constants/sdk-constants';\nimport type { Locale } from './types';\n\nexport const SUPPORTED_LOCALES: Locale[] = ['en', 'de', 'es', 'fr', 'it', 'nl', 'pl', 'pt'];\n\n/**\n * Detects the browser's language and returns a supported locale if available.\n * Falls back to 'en' if the browser language is not supported.\n */\nexport function detectBrowserLocale(): Locale {\n if (typeof window === 'undefined') {\n return 'en';\n }\n\n try {\n const browserLang =\n navigator.language ||\n (navigator as { userLanguage?: string }).userLanguage ||\n '';\n\n const primaryLang = browserLang.split('-')[0].toLowerCase();\n\n if (SUPPORTED_LOCALES.includes(primaryLang as Locale)) {\n return primaryLang as Locale;\n }\n } catch {\n // If detection fails, fall back to default\n }\n\n return 'en';\n}\n\n/**\n * Determines the environment from the API key format\n */\nexport function getEnvironmentFromApiKey(publicKey: string): 'sandbox' | 'production' | 'development' | 'preprod' {\n if (publicKey.includes('_local_') || publicKey.startsWith('inflow_local_')) {\n return 'sandbox';\n } else if (publicKey.includes('_prod_') && !publicKey.includes('_preprod_')) {\n return 'production';\n } else if (publicKey.includes('_preprod_') || publicKey.startsWith('inflow_preprod_')) {\n return 'preprod';\n } else if (publicKey.includes('_dev_')) {\n return 'development';\n }\n return 'sandbox';\n}\n\n/**\n * Gets the iframe URL based on the API key environment\n * This function auto-detects the correct iframe URL from the API key format\n * \n * @param publicKey - The public API key\n * @returns The iframe URL for the detected environment\n * \n * @example\n * ```typescript\n * const url = getIframeUrlFromApiKey('inflow_pub_prod_xxx');\n * // Returns: 'https://api.inflowpay.xyz/iframe/checkout'\n * \n * const url = getIframeUrlFromApiKey('inflow_pub_local_xxx');\n * // Returns: 'http://localhost:3000/iframe/checkout'\n * ```\n */\nexport function getIframeUrlFromApiKey(publicKey: string): string {\n const environment = getEnvironmentFromApiKey(publicKey);\n \n switch (environment) {\n case 'production':\n return IFRAME_URLS.PRODUCTION;\n case 'preprod':\n return IFRAME_URLS.PREPROD;\n case 'development':\n return IFRAME_URLS.DEVELOPMENT;\n case 'sandbox':\n default:\n return IFRAME_URLS.LOCAL;\n }\n}\n","/**\n * InflowPay SDK v2 - Iframe-based Payment SDK\n * \n * This SDK creates an iframe and communicates with a React payment application\n * using postMessage API for secure cross-origin communication.\n */\n\nimport { DIMENSIONS } from './constants/sdk-constants';\nimport type { IframeMessage, SDKConfig, TransactionData } from './types';\nimport { LoaderManager } from './ui/loader-manager';\nimport { ModalManager } from './ui/modal-manager';\nimport { OverlayManager } from './ui/overlay-manager';\nimport { getInlineIframeStyles } from './ui/styles';\nimport { getEnvironmentFromApiKey, getIframeUrlFromApiKey } from './utils';\nexport class SDK {\n private iframe: HTMLIFrameElement | null = null;\n private iframeUrl: string;\n private config: SDKConfig & { iframeUrl?: string; debug?: boolean };\n private messageListener: ((event: MessageEvent) => void) | null = null;\n private containerElement: HTMLElement | null = null;\n private usePopup: boolean;\n private environment: 'sandbox' | 'production' | 'development' | 'preprod';\n private loaderManager: LoaderManager | null = null;\n private modalManager: ModalManager;\n\n constructor(config: SDKConfig & { iframeUrl?: string; debug?: boolean }) {\n this.config = config;\n\n // Auto-detect iframe URL from API key, or use provided iframeUrl (internal use only)\n this.iframeUrl = config.iframeUrl || getIframeUrlFromApiKey(config.publicKey || '');\n this.environment = getEnvironmentFromApiKey(config.publicKey || '');\n\n // Determine if we should use popup or inline\n this.usePopup = !config.container;\n\n // Resolve container if provided\n if (config.container) {\n if (typeof config.container === 'string') {\n this.containerElement = document.querySelector(config.container);\n if (!this.containerElement) {\n throw new Error(`Container not found: ${config.container}`);\n }\n } else {\n this.containerElement = config.container;\n }\n }\n\n // Initialize modal manager\n this.modalManager = new ModalManager({\n environment: this.environment,\n debug: this.config.debug,\n });\n }\n\n /**\n * Initialize and open the payment iframe\n */\n init(): void {\n if (this.iframe) {\n return;\n }\n\n this.createIframe();\n this.addMessageListener();\n }\n\n /**\n * Create and append the iframe to the document\n */\n private createIframe(): void {\n // Build iframe URL with API key and paymentId and locale as query parameters\n const url = new URL(this.iframeUrl);\n if (this.config.publicKey) {\n url.searchParams.set('publicKey', this.config.publicKey);\n }\n if (this.config.config?.paymentId) {\n url.searchParams.set('paymentId', this.config.config.paymentId);\n }\n if (this.config.locale) {\n url.searchParams.set('locale', this.config.locale);\n }\n const iframeSrc = url.toString();\n\n if (this.usePopup) {\n // Use OverlayManager to create popup UI\n const { overlay, container, iframe } = OverlayManager.createOverlay(\n iframeSrc,\n () => this.close()\n );\n\n this.iframe = iframe;\n document.body.appendChild(overlay);\n\n // Show loader\n this.loaderManager = new LoaderManager(container, {\n fillParent: this.config.config?.style?.fillParent,\n });\n this.loaderManager.show(this.iframe);\n } else {\n // Inline mode - mount directly in container\n if (!this.containerElement) {\n throw new Error('Container element is required for inline mode');\n }\n\n // Clear container\n this.containerElement.innerHTML = '';\n\n // Set container styles for seamless integration\n if (this.containerElement instanceof HTMLElement) {\n const currentStyle = this.containerElement.getAttribute('style') || '';\n if (!currentStyle.includes('min-height')) {\n this.containerElement.style.minHeight = `${DIMENSIONS.MIN_HEIGHT}px`;\n }\n if (!currentStyle.includes('position')) {\n this.containerElement.style.position = 'relative';\n }\n if (!currentStyle.includes('overflow')) {\n this.containerElement.style.overflow = 'hidden';\n }\n }\n\n // Create iframe\n this.iframe = document.createElement('iframe');\n this.iframe.src = iframeSrc;\n this.iframe.style.cssText = getInlineIframeStyles(\n this.config.config?.style?.fillParent || false\n );\n this.iframe.setAttribute('allow', 'payment');\n\n // Append to container\n this.containerElement.appendChild(this.iframe);\n\n // Show loader\n this.loaderManager = new LoaderManager(this.containerElement, {\n fillParent: this.config.config?.style?.fillParent,\n });\n this.loaderManager.show(this.iframe);\n }\n }\n\n /**\n * Add message listener for communication with iframe\n */\n private addMessageListener(): void {\n this.messageListener = (event: MessageEvent) => {\n const allowedOrigin = new URL(this.iframeUrl).origin;\n const isExactMatch = event.origin === allowedOrigin;\n\n let isAllowedOrigin = isExactMatch;\n\n if (!isAllowedOrigin) {\n if (this.environment === 'sandbox' || this.environment === 'development') {\n const isLocalhostDev =\n (event.origin.includes('localhost') || event.origin.includes('127.0.0.1')) &&\n (allowedOrigin.includes('localhost') || allowedOrigin.includes('127.0.0.1'));\n isAllowedOrigin = isLocalhostDev;\n }\n\n if (!isAllowedOrigin) {\n const isAllowedApiOrigin =\n event.origin === 'https://dev.iframe.inflowpay.com' ||\n event.origin === 'https://pre-prod.iframe.inflowpay.xyz' ||\n event.origin === 'https://iframe.inflowpay.xyz';\n isAllowedOrigin = isAllowedApiOrigin;\n }\n }\n\n if (!isAllowedOrigin) {\n if (this.config.debug) {\n console.warn('[SDK] Rejected message from unauthorized origin:', event.origin);\n }\n return;\n }\n\n const data = event.data as IframeMessage;\n\n if (!data || !data.type) {\n return;\n }\n\n switch (data.type) {\n case 'iframe-ready':\n // Wait for iframe's javascript to be ready before sending config\n if (this.loaderManager) {\n this.loaderManager.hide(this.iframe || undefined);\n }\n this.sendConfigToIframe();\n break;\n\n case 'content-height':\n // Adjust iframe height based on content\n if (data.height && this.iframe) {\n const height = Math.max(data.height, DIMENSIONS.MIN_HEIGHT);\n this.iframe.style.height = `${height}px`;\n if (this.containerElement) {\n this.containerElement.style.minHeight = `${height}px`;\n }\n }\n break;\n\n case 'close':\n this.close();\n break;\n\n case 'success':\n if (this.config.onSuccess) {\n this.config.onSuccess(data.data);\n }\n break;\n\n case 'error':\n if (this.config.onError) {\n this.config.onError(data.data);\n }\n break;\n\n case '3ds-required':\n // Iframe requests SDK to open 3DS popup\n if (this.config.debug) {\n console.log('[SDK] Received 3DS request:', data.threeDsSessionUrl);\n console.log('[SDK] Session ID:', data.sessionId);\n }\n if (data.threeDsSessionUrl) {\n const sessionId = data.sessionId;\n const paymentId = data.paymentId || this.config.config?.paymentId || '';\n\n if (!data.sessionId) {\n console.warn('[SDK] No session ID provided by iframe');\n }\n\n if (this.config.debug) {\n console.log('[SDK] Opening 3DS modal with session ID:', sessionId);\n }\n\n this.modalManager.open(data.threeDsSessionUrl, sessionId as string, paymentId).then((success) => {\n if (this.config.debug) {\n console.log('[SDK] 3DS modal closed, result:', success);\n }\n // No longer send message back to iframe - unidirectional flow\n });\n } else {\n if (this.config.debug) {\n console.error('[SDK] 3DS required but no threeDsSessionUrl provided');\n }\n }\n break;\n\n case '3ds-success':\n // 3DS challenge completed via WebSocket, close modal automatically\n if (this.config.debug) {\n console.log('[SDK] 3DS completed, closing modal...');\n console.log('[SDK] Session ID from webhook:', data.sessionId);\n }\n // Pass session ID to validate before closing\n ModalManager.close(data.sessionId);\n break;\n\n case '3ds-failed':\n // 3DS challenge completed via WebSocket, close modal automatically\n if (this.config.debug) {\n console.log('[SDK] 3DS failed, closing modal...');\n console.log('[SDK] Session ID from webhook:', data.sessionId);\n }\n // Pass session ID to validate before closing\n ModalManager.close(data.sessionId);\n break;\n\n default:\n if (this.config.debug) {\n console.log('SDK: Received message:', data);\n }\n\n\n }\n };\n\n window.addEventListener('message', this.messageListener);\n }\n\n /**\n * Send configuration to the iframe\n */\n private sendConfigToIframe(): void {\n if (!this.iframe || !this.iframe.contentWindow) {\n // Wait for iframe to load\n if (this.iframe) {\n this.iframe.onload = () => {\n this.sendConfigToIframe();\n };\n }\n return;\n }\n\n const message: IframeMessage = {\n type: 'sdkData',\n config: {\n ...(this.config.config || {}),\n paymentId: this.config.config?.paymentId\n },\n data: {\n publicKey: this.config.publicKey,\n },\n };\n\n const targetOrigin = this.getTargetOrigin();\n this.iframe.contentWindow.postMessage(message, targetOrigin);\n }\n\n\n /**\n * Close the iframe and cleanup\n */\n private close(): void {\n if (this.config.onClose) {\n this.config.onClose();\n }\n\n // Hide loader\n if (this.loaderManager) {\n this.loaderManager.hide(this.iframe || undefined);\n this.loaderManager = null;\n }\n\n // Remove message listener\n if (this.messageListener) {\n window.removeEventListener('message', this.messageListener);\n this.messageListener = null;\n }\n\n if (this.usePopup) {\n // Remove overlay\n OverlayManager.removeOverlay();\n } else {\n // Clear container\n if (this.containerElement) {\n this.containerElement.innerHTML = '';\n }\n }\n\n this.iframe = null;\n }\n\n /**\n * Handle success state: when showDefaultSuccessUI is true, iframe shows success UI\n * and we keep it mounted; when false, we unmount so the parent can render their own.\n */\n public switchToSuccessState(_result: TransactionData): void {\n // Hide loader and remove message listener (same as close)\n if (this.loaderManager) {\n this.loaderManager.hide(this.iframe || undefined);\n this.loaderManager = null;\n }\n if (this.messageListener) {\n window.removeEventListener('message', this.messageListener);\n this.messageListener = null;\n }\n\n if (this.usePopup) {\n OverlayManager.removeOverlay();\n this.iframe = null;\n return;\n }\n\n const showDefault = this.config.config?.showDefaultSuccessUI ?? true;\n\n if (!showDefault && this.containerElement) {\n // Parent will render their own success UI: unmount iframe\n this.containerElement.innerHTML = '';\n }\n if (!showDefault) {\n this.iframe = null;\n }\n // When showDefault is true, keep iframe mounted (success UI is shown inside iframe)\n }\n\n /**\n * Get target origin for postMessage based on environment\n * In production/pre-prod: use exact origin for security\n * In dev/sandbox: use wildcard for development flexibility\n */\n private getTargetOrigin(): string {\n if (this.environment === 'production' || this.environment === 'preprod') {\n return new URL(this.iframeUrl).origin;\n }\n return '*';\n }\n\n /**\n * Public method to close the iframe\n */\n public destroy(): void {\n this.close();\n }\n}\n\n","/**\n * CardElement - Iframe-based payment element\n * \n * Mounts an iframe with the payment checkout form\n */\n\nimport { PaymentResult, PaymentResultStatus } from './react';\nimport { SDK } from './sdk';\n\nimport type { CSSProperties, Locale } from './types';\nimport { detectBrowserLocale } from './utils';\n\nexport interface CardElementOptions {\n /** Container element or CSS selector where the iframe will be mounted */\n container: string | HTMLElement;\n /** Payment ID for this transaction */\n paymentId: string;\n /** Callback when payment completes */\n onComplete?: (result: PaymentResult) => void;\n /** Callback when payment fails */\n onError?: (error: any) => void;\n /** Callback when user closes the payment */\n onClose?: () => void;\n /** Custom styling for the card element */\n style?: CSSProperties;\n /** Custom button text (default: \"Complete Payment\") */\n buttonText?: string;\n /** Custom placeholder text for inputs */\n placeholders?: {\n cardNumber?: string;\n expiry?: string;\n cvc?: string;\n };\n /** Show default success UI after payment (default true). If false, only unmount iframe. */\n showDefaultSuccessUI?: boolean;\n}\n\ninterface InternalSDKConfig {\n publicKey: string;\n iframeUrl: string;\n timeout: number;\n debug: boolean;\n locale?: Locale;\n}\n\nexport class CardElement {\n private sdk: SDK;\n private container: HTMLElement;\n private mounted: boolean = false;\n\n constructor(\n config: InternalSDKConfig,\n options: CardElementOptions\n ) {\n let containerElement: HTMLElement | null;\n if (typeof options.container === 'string') {\n containerElement = document.querySelector(options.container);\n if (!containerElement) {\n throw new Error(`Container not found: ${options.container}`);\n }\n } else {\n containerElement = options.container;\n }\n this.container = containerElement;\n\n this.sdk = new SDK({\n publicKey: config.publicKey,\n container: this.container,\n locale: config.locale ?? detectBrowserLocale(),\n config: {\n paymentId: options.paymentId,\n ...(options.style && { style: options.style }),\n ...(options.buttonText && { buttonText: options.buttonText }),\n ...(options.placeholders && { placeholders: options.placeholders }),\n ...(options.showDefaultSuccessUI !== undefined && {\n showDefaultSuccessUI: options.showDefaultSuccessUI,\n }),\n },\n onSuccess: (data) => {\n if (options.onComplete) {\n options.onComplete({\n status: PaymentResultStatus.SUCCESS,\n paymentId: options.paymentId,\n });\n }\n // Replace iframe with success UI (default, custom, or none)\n this.sdk.switchToSuccessState(data);\n },\n onError: (error) => {\n if (options.onError) {\n options.onError(error);\n } else if (options.onComplete) {\n options.onComplete({\n status: PaymentResultStatus.FAILED,\n paymentId: options.paymentId,\n error: error,\n });\n }\n },\n onClose: () => {\n if (options.onClose) {\n options.onClose();\n }\n },\n });\n }\n\n /**\n * Mount the CardElement to the DOM\n * This will create and display the iframe\n */\n mount(): void {\n if (this.mounted) {\n throw new Error('CardElement is already mounted');\n }\n\n this.sdk.init();\n this.mounted = true;\n }\n\n /**\n * Destroy the CardElement and cleanup\n */\n destroy(): void {\n if (this.mounted) {\n this.sdk.destroy();\n this.mounted = false;\n }\n }\n}\n","/**\n * InflowPay Payment SDK v2\n * \n * Provider class that manages global SDK configuration\n * Similar to the original SDK but uses iframe-based payment flow\n */\n\nimport { CardElement } from './card-element';\nimport type { PaymentResult } from './react';\nimport type { CSSProperties, Locale } from './types';\nimport { getEnvironmentFromApiKey, getIframeUrlFromApiKey } from './utils';\n\nexport interface PaymentSDKConfig {\n /** Public API key */\n publicKey: string;\n /** Locale for the UI. Defaults to 'en' */\n locale?: Locale;\n}\n\nexport class PaymentSDK {\n private config: PaymentSDKConfig;\n private iframeUrl: string;\n private timeout: number;\n private debug: boolean;\n\n /**\n * Initialize the InflowPay Payment SDK\n * \n * @param config - SDK configuration\n * \n * @example\n * ```typescript\n * const sdk = new PaymentSDK({\n * apiKey: 'inflow_pub_local_xxx'\n * });\n * ```\n */\n constructor(config: PaymentSDKConfig) {\n // Validate API key\n if (!config.publicKey || typeof config.publicKey !== 'string') {\n throw new Error('API key is required');\n }\n\n this.config = config;\n this.timeout = 30000;\n\n // Auto-detect iframe URL from API key using utility function\n this.iframeUrl = getIframeUrlFromApiKey(config.publicKey);\n\n // Auto-enable debug in development and sandbox environments\n const environment = getEnvironmentFromApiKey(config.publicKey);\n this.debug = environment === 'sandbox' || environment === 'development';\n }\n\n /**\n * Create a CardElement for iframe-based payment UI\n * \n * @param options - CardElement configuration\n * @returns CardElement instance\n * \n * @example\n * ```typescript\n * const cardElement = sdk.createCardElement({\n * container: '#card-container',\n * paymentId: 'pay_123',\n * onComplete: (result) => {\n * if (result.status === 'CHECKOUT_SUCCESS') {\n * window.location.href = '/success';\n * }\n * }\n * });\n * \n * cardElement.mount();\n * ```\n */\n createCardElement(options: {\n container: string | HTMLElement;\n paymentId: string;\n style?: CSSProperties;\n buttonText?: string;\n placeholders?: {\n cardNumber?: string;\n expiry?: string;\n cvc?: string;\n };\n onComplete?: (result: PaymentResult) => void;\n onError?: (error: any) => void;\n onClose?: () => void;\n }): CardElement {\n return new CardElement({\n publicKey: this.config.publicKey,\n iframeUrl: this.iframeUrl,\n timeout: this.timeout,\n debug: this.debug,\n locale: this.config.locale,\n }, options);\n }\n\n /**\n * Get the iframe URL being used\n */\n getIframeUrl(): string {\n return this.iframeUrl;\n }\n\n /**\n * Get the API key\n */\n getApiKey(): string {\n return this.config.publicKey;\n }\n}\n\n"],"names":["PaymentResultStatus","PaymentResultErrorCode","InflowPayContext","createContext","InflowPayProvider","config","children","sdk","useState","sdkConfig","PaymentSDK","jsx","useInflowPay","context","useContext","CardElement","props","paymentId","onReady","onChange","onComplete","onError","style","buttonText","placeholders","showDefaultSuccessUI","propConfig","containerRef","useRef","cardElementRef","mounted","setMounted","useEffect","cardElementOptions","result","error","cardElement","timer","Z_INDEX","DIMENSIONS","ALLOWED_3DS_ORIGINS","ELEMENT_IDS","IFRAME_URLS","getColorScheme","isDarkMode","getShimmerGradient","colors","getOverlayStyles","getContainerStyles","getCloseButtonStyles","getPopupIframeStyles","getInlineIframeStyles","fillParent","getLoaderContainerStyles","getSkeletonCardStyles","getInputWrapStyles","bgColor","getSkeletonBaseStyles","shimmerGradient","getCardNumberSkeletonStyles","getExpirySkeletonStyles","getCvcSkeletonStyles","getButtonSkeletonStyles","getDisclaimerSkeletonStyles","getDisclaimerIconSkeletonStyles","getDisclaimerTextSkeletonStyles","SHIMMER_ANIMATION","get3DSOverlayStyles","get3DSModalStyles","get3DSHeaderStyles","get3DSContentStyles","get3DSIframeStyles","LoaderManager","container","iframe","loader","skeletonCard","inputWrap","cardNumberSkeleton","expirySkeleton","cvcSkeleton","buttonSkeleton","disclaimerSkeleton","disclaimerIconSkeleton","disclaimerTextSkeleton","_ModalManager","challengeUrl","sessionId","resolve","overlay","modal","header","content","messageHandler","event","data","is3DSComplete","isSuccess","isFailure","origin","ModalManager","OverlayManager","iframeSrc","onClose","closeButton","e","SUPPORTED_LOCALES","detectBrowserLocale","primaryLang","getEnvironmentFromApiKey","publicKey","getIframeUrlFromApiKey","SDK","url","currentStyle","allowedOrigin","isAllowedOrigin","height","success","message","targetOrigin","_result","showDefault","options","containerElement","environment"],"mappings":";;AAoLO,IAAKA,sBAAAA,OACVA,EAAA,UAAU,WACVA,EAAA,SAAS,UAFCA,IAAAA,KAAA,CAAA,CAAA,GAKAC,sBAAAA,OACVA,EAAA,kBAAkB,mBAClBA,EAAA,2BAA2B,4BAFjBA,IAAAA,KAAA,CAAA,CAAA;AClIZ,MAAMC,IAAmBC,EAA4C,IAAI;AAqBlE,SAASC,GAAkB;AAAA,EAChC,QAAAC;AAAA,EACA,UAAAC;AACF,GAGG;AACD,QAAM,CAACC,CAAG,IAAI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,KAAK,IAAI,QAAA,GACT,KAAK,UAAU;AAAA,EAEnB;AACF;AC9GO,MAAMjH,EAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBtB,YAAYL,GAA0B;AAEpC,QAAI,CAACA,EAAO,aAAa,OAAOA,EAAO,aAAc;AACnD,YAAM,IAAI,MAAM,qBAAqB;AAGvC,SAAK,SAASA,GACd,KAAK,UAAU,KAGf,KAAK,YAAY0G,EAAuB1G,EAAO,SAAS;AAGxD,UAAMwH,IAAchB,EAAyBxG,EAAO,SAAS;AAC7D,SAAK,QAAQwH,MAAgB,aAAaA,MAAgB;AAAA,EAC5D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuBA,kBAAkBF,GAaF;AACd,WAAO,IAAI5G,GAAY;AAAA,MACrB,WAAW,KAAK,OAAO;AAAA,MACvB,WAAW,KAAK;AAAA,MAChB,SAAS,KAAK;AAAA,MACd,OAAO,KAAK;AAAA,MACZ,QAAQ,KAAK,OAAO;AAAA,IAAA,GACnB4G,CAAO;AAAA,EACZ;AAAA;AAAA;AAAA;AAAA,EAKA,eAAuB;AACrB,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA,EAKA,YAAoB;AAClB,WAAO,KAAK,OAAO;AAAA,EACrB;AACF;"}
|
package/dist/react/index.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ declare interface ButtonStyles extends ButtonBaseStyles {
|
|
|
35
35
|
* />
|
|
36
36
|
* ```
|
|
37
37
|
*/
|
|
38
|
-
export declare function CardElement(
|
|
38
|
+
export declare function CardElement(props: CardElementProps & {
|
|
39
39
|
config?: SDKConfig;
|
|
40
40
|
}): JSX_2.Element;
|
|
41
41
|
|
|
@@ -61,11 +61,7 @@ declare interface CardElementOptions {
|
|
|
61
61
|
/** Payment ID for this transaction */
|
|
62
62
|
paymentId: string;
|
|
63
63
|
/** Callback when payment completes */
|
|
64
|
-
onComplete?: (result:
|
|
65
|
-
status: string;
|
|
66
|
-
data?: any;
|
|
67
|
-
error?: any;
|
|
68
|
-
}) => void;
|
|
64
|
+
onComplete?: (result: PaymentResult) => void;
|
|
69
65
|
/** Callback when payment fails */
|
|
70
66
|
onError?: (error: any) => void;
|
|
71
67
|
/** Callback when user closes the payment */
|
|
@@ -80,6 +76,8 @@ declare interface CardElementOptions {
|
|
|
80
76
|
expiry?: string;
|
|
81
77
|
cvc?: string;
|
|
82
78
|
};
|
|
79
|
+
/** Show default success UI after payment (default true). If false, only unmount iframe. */
|
|
80
|
+
showDefaultSuccessUI?: boolean;
|
|
83
81
|
}
|
|
84
82
|
|
|
85
83
|
export declare interface CardElementProps {
|
|
@@ -95,6 +93,8 @@ export declare interface CardElementProps {
|
|
|
95
93
|
expiry?: string;
|
|
96
94
|
cvc?: string;
|
|
97
95
|
};
|
|
96
|
+
/** Show default success UI after payment (default true). If false, only unmount iframe. */
|
|
97
|
+
showDefaultSuccessUI?: boolean;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
export declare interface CardElementState {
|
|
@@ -114,9 +114,6 @@ declare interface CSSProperties {
|
|
|
114
114
|
dark?: ThemeStyles;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
/**
|
|
118
|
-
* Type definitions for SDK v2
|
|
119
|
-
*/
|
|
120
117
|
declare type FontFamily = 'DM Sans' | 'Inter' | 'Poppins' | 'Nunito' | 'Work Sans' | 'Manrope' | 'Rubik' | 'Karla' | 'Figtree' | 'Outfit' | 'Space Grotesk' | 'Urbanist';
|
|
121
118
|
|
|
122
119
|
declare type FontWeight = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 'normal' | 'bold' | 'lighter' | 'bolder';
|
|
@@ -170,32 +167,47 @@ declare interface InputStyles {
|
|
|
170
167
|
}
|
|
171
168
|
|
|
172
169
|
declare interface InternalSDKConfig {
|
|
173
|
-
|
|
170
|
+
publicKey: string;
|
|
174
171
|
iframeUrl: string;
|
|
175
172
|
timeout: number;
|
|
176
173
|
debug: boolean;
|
|
174
|
+
locale?: Locale;
|
|
177
175
|
}
|
|
178
176
|
|
|
177
|
+
/**
|
|
178
|
+
* Type definitions for SDK v2
|
|
179
|
+
*/
|
|
180
|
+
declare type Locale = 'en' | 'de' | 'es' | 'fr' | 'it' | 'nl' | 'pl' | 'pt';
|
|
181
|
+
|
|
179
182
|
declare type Opacity = number | string;
|
|
180
183
|
|
|
181
184
|
export declare interface PaymentError {
|
|
182
|
-
code:
|
|
185
|
+
code: PaymentResultErrorCode;
|
|
183
186
|
message: string;
|
|
184
187
|
retryable: boolean;
|
|
185
188
|
}
|
|
186
189
|
|
|
187
190
|
export declare interface PaymentResult {
|
|
188
|
-
status:
|
|
189
|
-
|
|
190
|
-
error?:
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
191
|
+
status: PaymentResultStatus;
|
|
192
|
+
paymentId: string;
|
|
193
|
+
error?: PaymentError;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export declare enum PaymentResultErrorCode {
|
|
197
|
+
THREE_DS_FAILED = "THREE_DS_FAILED",
|
|
198
|
+
PAYMENT_PROCESSING_ERROR = "PAYMENT_PROCESSING_ERROR"
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export declare enum PaymentResultStatus {
|
|
202
|
+
SUCCESS = "SUCCESS",
|
|
203
|
+
FAILED = "FAILED"
|
|
195
204
|
}
|
|
196
205
|
|
|
197
206
|
declare class PaymentSDK {
|
|
198
207
|
private config;
|
|
208
|
+
private iframeUrl;
|
|
209
|
+
private timeout;
|
|
210
|
+
private debug;
|
|
199
211
|
/**
|
|
200
212
|
* Initialize the InflowPay Payment SDK
|
|
201
213
|
*
|
|
@@ -240,11 +252,7 @@ declare class PaymentSDK {
|
|
|
240
252
|
expiry?: string;
|
|
241
253
|
cvc?: string;
|
|
242
254
|
};
|
|
243
|
-
onComplete?: (result:
|
|
244
|
-
status: string;
|
|
245
|
-
data?: any;
|
|
246
|
-
error?: any;
|
|
247
|
-
}) => void;
|
|
255
|
+
onComplete?: (result: PaymentResult) => void;
|
|
248
256
|
onError?: (error: any) => void;
|
|
249
257
|
onClose?: () => void;
|
|
250
258
|
}): CardElement_2;
|
|
@@ -256,29 +264,19 @@ declare class PaymentSDK {
|
|
|
256
264
|
* Get the API key
|
|
257
265
|
*/
|
|
258
266
|
getApiKey(): string;
|
|
259
|
-
/**
|
|
260
|
-
* Auto-detect environment from API key
|
|
261
|
-
*/
|
|
262
|
-
private getEnvironmentFromApiKey;
|
|
263
267
|
}
|
|
264
268
|
|
|
265
269
|
declare interface PaymentSDKConfig {
|
|
266
270
|
/** Public API key */
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
|
|
270
|
-
/** Request timeout in milliseconds (default: 30000) */
|
|
271
|
-
timeout?: number;
|
|
272
|
-
/** Enable debug logging (default: false, only allowed in local/dev environments) */
|
|
273
|
-
debug?: boolean;
|
|
271
|
+
publicKey: string;
|
|
272
|
+
/** Locale for the UI. Defaults to 'en' */
|
|
273
|
+
locale?: Locale;
|
|
274
274
|
}
|
|
275
275
|
|
|
276
276
|
export declare interface SDKConfig {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
/** Enable debug logging (default: false, only allowed in local/dev environments) */
|
|
281
|
-
debug?: boolean;
|
|
277
|
+
publicKey: string;
|
|
278
|
+
/** Locale for the payment UI. Defaults to 'en' */
|
|
279
|
+
locale?: Locale;
|
|
282
280
|
}
|
|
283
281
|
|
|
284
282
|
declare interface ThemeStyles {
|
package/dist/react.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("react");const e=require("./payment-sdk-CC-mm-nt.js");exports.CardElement=e.CardElement$1;exports.InflowPayProvider=e.InflowPayProvider;exports.PaymentResultErrorCode=e.PaymentResultErrorCode;exports.PaymentResultStatus=e.PaymentResultStatus;exports.useInflowPay=e.useInflowPay;
|
|
2
2
|
//# sourceMappingURL=react.cjs.map
|
package/dist/react.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.cjs","sources":[
|
|
1
|
+
{"version":3,"file":"react.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/react.esm.js
CHANGED
|
@@ -1,92 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
const w = D(null);
|
|
5
|
-
function S({
|
|
6
|
-
config: e,
|
|
7
|
-
children: n
|
|
8
|
-
}) {
|
|
9
|
-
const [u] = x(() => {
|
|
10
|
-
const t = {
|
|
11
|
-
apiKey: e.apiKey,
|
|
12
|
-
iframeUrl: e.iframeUrl,
|
|
13
|
-
timeout: e.timeout,
|
|
14
|
-
debug: e.debug
|
|
15
|
-
};
|
|
16
|
-
return new k(t);
|
|
17
|
-
});
|
|
18
|
-
return /* @__PURE__ */ v(w.Provider, { value: { sdk: u }, children: n });
|
|
19
|
-
}
|
|
20
|
-
function j() {
|
|
21
|
-
const e = I(w);
|
|
22
|
-
if (!e)
|
|
23
|
-
throw new Error("useInflowPay must be used within InflowPayProvider");
|
|
24
|
-
return e.sdk;
|
|
25
|
-
}
|
|
26
|
-
function F({
|
|
27
|
-
paymentId: e,
|
|
28
|
-
onReady: n,
|
|
29
|
-
onChange: u,
|
|
30
|
-
onComplete: t,
|
|
31
|
-
onError: f,
|
|
32
|
-
style: s,
|
|
33
|
-
buttonText: a,
|
|
34
|
-
placeholders: l,
|
|
35
|
-
config: i
|
|
36
|
-
}) {
|
|
37
|
-
const K = I(w), o = y(null), c = y(null), [P, b] = x(!1), m = K?.sdk || (i ? new k({
|
|
38
|
-
apiKey: i.apiKey,
|
|
39
|
-
iframeUrl: i.iframeUrl,
|
|
40
|
-
timeout: i.timeout,
|
|
41
|
-
debug: i.debug
|
|
42
|
-
}) : null);
|
|
43
|
-
if (!m)
|
|
44
|
-
throw new Error("CardElement must be used within InflowPayProvider or have a config prop");
|
|
45
|
-
return d(() => {
|
|
46
|
-
if (!o.current)
|
|
47
|
-
return;
|
|
48
|
-
o.current.id || (o.current.id = `inflowpay-card-element-${Date.now()}`);
|
|
49
|
-
const U = {
|
|
50
|
-
container: o.current,
|
|
51
|
-
paymentId: e,
|
|
52
|
-
...s && { style: s },
|
|
53
|
-
...a && { buttonText: a },
|
|
54
|
-
...l && { placeholders: l },
|
|
55
|
-
onComplete: (r) => {
|
|
56
|
-
t && t(r);
|
|
57
|
-
},
|
|
58
|
-
onError: (r) => {
|
|
59
|
-
f ? f(r) : t && t({
|
|
60
|
-
status: "PAYMENT_FAILED",
|
|
61
|
-
error: r
|
|
62
|
-
});
|
|
63
|
-
},
|
|
64
|
-
onClose: () => {
|
|
65
|
-
}
|
|
66
|
-
}, E = m.createCardElement(U);
|
|
67
|
-
if (c.current = E, E.mount(), b(!0), n) {
|
|
68
|
-
const r = setTimeout(() => {
|
|
69
|
-
n();
|
|
70
|
-
}, 100);
|
|
71
|
-
return () => clearTimeout(r);
|
|
72
|
-
}
|
|
73
|
-
}, [e, m, t, f, n, s, a, l]), d(() => {
|
|
74
|
-
u && P && u({ complete: !1 });
|
|
75
|
-
}, [P, u]), d(() => () => {
|
|
76
|
-
c.current && (c.current.destroy(), c.current = null);
|
|
77
|
-
}, []), /* @__PURE__ */ v(
|
|
78
|
-
"div",
|
|
79
|
-
{
|
|
80
|
-
ref: o,
|
|
81
|
-
style: {
|
|
82
|
-
width: s?.fillParent ? "100%" : "344px"
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
);
|
|
86
|
-
}
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { c as o, I as s, a as m, b as l, u as n } from "./payment-sdk-oRqgQSx5.mjs";
|
|
87
4
|
export {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
5
|
+
o as CardElement,
|
|
6
|
+
s as InflowPayProvider,
|
|
7
|
+
m as PaymentResultErrorCode,
|
|
8
|
+
l as PaymentResultStatus,
|
|
9
|
+
n as useInflowPay
|
|
91
10
|
};
|
|
92
11
|
//# sourceMappingURL=react.esm.js.map
|
package/dist/react.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.esm.js","sources":[
|
|
1
|
+
{"version":3,"file":"react.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|