@inflow_pay/sdk 0.0.1

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,"file":"react.esm.js","sources":["../node_modules/react/cjs/react-jsx-runtime.production.js","../node_modules/react/cjs/react-jsx-runtime.development.js","../node_modules/react/jsx-runtime.js","../src/sdk.ts","../src/card-element.ts","../src/payment-sdk.ts","../src/react/index.tsx"],"sourcesContent":["/**\n * @license React\n * react-jsx-runtime.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\");\nfunction jsxProd(type, config, maybeKey) {\n var key = null;\n void 0 !== maybeKey && (key = \"\" + maybeKey);\n void 0 !== config.key && (key = \"\" + config.key);\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n config = maybeKey.ref;\n return {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n ref: void 0 !== config ? config : null,\n props: maybeKey\n };\n}\nexports.Fragment = REACT_FRAGMENT_TYPE;\nexports.jsx = jsxProd;\nexports.jsxs = jsxProd;\n","/**\n * @license React\n * react-jsx-runtime.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function getComponentNameFromType(type) {\n if (null == type) return null;\n if (\"function\" === typeof type)\n return type.$$typeof === REACT_CLIENT_REFERENCE\n ? null\n : type.displayName || type.name || null;\n if (\"string\" === typeof type) return type;\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return \"Fragment\";\n case REACT_PROFILER_TYPE:\n return \"Profiler\";\n case REACT_STRICT_MODE_TYPE:\n return \"StrictMode\";\n case REACT_SUSPENSE_TYPE:\n return \"Suspense\";\n case REACT_SUSPENSE_LIST_TYPE:\n return \"SuspenseList\";\n case REACT_ACTIVITY_TYPE:\n return \"Activity\";\n }\n if (\"object\" === typeof type)\n switch (\n (\"number\" === typeof type.tag &&\n console.error(\n \"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.\"\n ),\n type.$$typeof)\n ) {\n case REACT_PORTAL_TYPE:\n return \"Portal\";\n case REACT_CONTEXT_TYPE:\n return type.displayName || \"Context\";\n case REACT_CONSUMER_TYPE:\n return (type._context.displayName || \"Context\") + \".Consumer\";\n case REACT_FORWARD_REF_TYPE:\n var innerType = type.render;\n type = type.displayName;\n type ||\n ((type = innerType.displayName || innerType.name || \"\"),\n (type = \"\" !== type ? \"ForwardRef(\" + type + \")\" : \"ForwardRef\"));\n return type;\n case REACT_MEMO_TYPE:\n return (\n (innerType = type.displayName || null),\n null !== innerType\n ? innerType\n : getComponentNameFromType(type.type) || \"Memo\"\n );\n case REACT_LAZY_TYPE:\n innerType = type._payload;\n type = type._init;\n try {\n return getComponentNameFromType(type(innerType));\n } catch (x) {}\n }\n return null;\n }\n function testStringCoercion(value) {\n return \"\" + value;\n }\n function checkKeyStringCoercion(value) {\n try {\n testStringCoercion(value);\n var JSCompiler_inline_result = !1;\n } catch (e) {\n JSCompiler_inline_result = !0;\n }\n if (JSCompiler_inline_result) {\n JSCompiler_inline_result = console;\n var JSCompiler_temp_const = JSCompiler_inline_result.error;\n var JSCompiler_inline_result$jscomp$0 =\n (\"function\" === typeof Symbol &&\n Symbol.toStringTag &&\n value[Symbol.toStringTag]) ||\n value.constructor.name ||\n \"Object\";\n JSCompiler_temp_const.call(\n JSCompiler_inline_result,\n \"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.\",\n JSCompiler_inline_result$jscomp$0\n );\n return testStringCoercion(value);\n }\n }\n function getTaskName(type) {\n if (type === REACT_FRAGMENT_TYPE) return \"<>\";\n if (\n \"object\" === typeof type &&\n null !== type &&\n type.$$typeof === REACT_LAZY_TYPE\n )\n return \"<...>\";\n try {\n var name = getComponentNameFromType(type);\n return name ? \"<\" + name + \">\" : \"<...>\";\n } catch (x) {\n return \"<...>\";\n }\n }\n function getOwner() {\n var dispatcher = ReactSharedInternals.A;\n return null === dispatcher ? null : dispatcher.getOwner();\n }\n function UnknownOwner() {\n return Error(\"react-stack-top-frame\");\n }\n function hasValidKey(config) {\n if (hasOwnProperty.call(config, \"key\")) {\n var getter = Object.getOwnPropertyDescriptor(config, \"key\").get;\n if (getter && getter.isReactWarning) return !1;\n }\n return void 0 !== config.key;\n }\n function defineKeyPropWarningGetter(props, displayName) {\n function warnAboutAccessingKey() {\n specialPropKeyWarningShown ||\n ((specialPropKeyWarningShown = !0),\n console.error(\n \"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)\",\n displayName\n ));\n }\n warnAboutAccessingKey.isReactWarning = !0;\n Object.defineProperty(props, \"key\", {\n get: warnAboutAccessingKey,\n configurable: !0\n });\n }\n function elementRefGetterWithDeprecationWarning() {\n var componentName = getComponentNameFromType(this.type);\n didWarnAboutElementRef[componentName] ||\n ((didWarnAboutElementRef[componentName] = !0),\n console.error(\n \"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.\"\n ));\n componentName = this.props.ref;\n return void 0 !== componentName ? componentName : null;\n }\n function ReactElement(type, key, props, owner, debugStack, debugTask) {\n var refProp = props.ref;\n type = {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n props: props,\n _owner: owner\n };\n null !== (void 0 !== refProp ? refProp : null)\n ? Object.defineProperty(type, \"ref\", {\n enumerable: !1,\n get: elementRefGetterWithDeprecationWarning\n })\n : Object.defineProperty(type, \"ref\", { enumerable: !1, value: null });\n type._store = {};\n Object.defineProperty(type._store, \"validated\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: 0\n });\n Object.defineProperty(type, \"_debugInfo\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: null\n });\n Object.defineProperty(type, \"_debugStack\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugStack\n });\n Object.defineProperty(type, \"_debugTask\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugTask\n });\n Object.freeze && (Object.freeze(type.props), Object.freeze(type));\n return type;\n }\n function jsxDEVImpl(\n type,\n config,\n maybeKey,\n isStaticChildren,\n debugStack,\n debugTask\n ) {\n var children = config.children;\n if (void 0 !== children)\n if (isStaticChildren)\n if (isArrayImpl(children)) {\n for (\n isStaticChildren = 0;\n isStaticChildren < children.length;\n isStaticChildren++\n )\n validateChildKeys(children[isStaticChildren]);\n Object.freeze && Object.freeze(children);\n } else\n console.error(\n \"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.\"\n );\n else validateChildKeys(children);\n if (hasOwnProperty.call(config, \"key\")) {\n children = getComponentNameFromType(type);\n var keys = Object.keys(config).filter(function (k) {\n return \"key\" !== k;\n });\n isStaticChildren =\n 0 < keys.length\n ? \"{key: someKey, \" + keys.join(\": ..., \") + \": ...}\"\n : \"{key: someKey}\";\n didWarnAboutKeySpread[children + isStaticChildren] ||\n ((keys =\n 0 < keys.length ? \"{\" + keys.join(\": ..., \") + \": ...}\" : \"{}\"),\n console.error(\n 'A props object containing a \"key\" prop is being spread into JSX:\\n let props = %s;\\n <%s {...props} />\\nReact keys must be passed directly to JSX without using spread:\\n let props = %s;\\n <%s key={someKey} {...props} />',\n isStaticChildren,\n children,\n keys,\n children\n ),\n (didWarnAboutKeySpread[children + isStaticChildren] = !0));\n }\n children = null;\n void 0 !== maybeKey &&\n (checkKeyStringCoercion(maybeKey), (children = \"\" + maybeKey));\n hasValidKey(config) &&\n (checkKeyStringCoercion(config.key), (children = \"\" + config.key));\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n children &&\n defineKeyPropWarningGetter(\n maybeKey,\n \"function\" === typeof type\n ? type.displayName || type.name || \"Unknown\"\n : type\n );\n return ReactElement(\n type,\n children,\n maybeKey,\n getOwner(),\n debugStack,\n debugTask\n );\n }\n function validateChildKeys(node) {\n isValidElement(node)\n ? node._store && (node._store.validated = 1)\n : \"object\" === typeof node &&\n null !== node &&\n node.$$typeof === REACT_LAZY_TYPE &&\n (\"fulfilled\" === node._payload.status\n ? isValidElement(node._payload.value) &&\n node._payload.value._store &&\n (node._payload.value._store.validated = 1)\n : node._store && (node._store.validated = 1));\n }\n function isValidElement(object) {\n return (\n \"object\" === typeof object &&\n null !== object &&\n object.$$typeof === REACT_ELEMENT_TYPE\n );\n }\n var React = require(\"react\"),\n REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_PORTAL_TYPE = Symbol.for(\"react.portal\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\"),\n REACT_STRICT_MODE_TYPE = Symbol.for(\"react.strict_mode\"),\n REACT_PROFILER_TYPE = Symbol.for(\"react.profiler\"),\n REACT_CONSUMER_TYPE = Symbol.for(\"react.consumer\"),\n REACT_CONTEXT_TYPE = Symbol.for(\"react.context\"),\n REACT_FORWARD_REF_TYPE = Symbol.for(\"react.forward_ref\"),\n REACT_SUSPENSE_TYPE = Symbol.for(\"react.suspense\"),\n REACT_SUSPENSE_LIST_TYPE = Symbol.for(\"react.suspense_list\"),\n REACT_MEMO_TYPE = Symbol.for(\"react.memo\"),\n REACT_LAZY_TYPE = Symbol.for(\"react.lazy\"),\n REACT_ACTIVITY_TYPE = Symbol.for(\"react.activity\"),\n REACT_CLIENT_REFERENCE = Symbol.for(\"react.client.reference\"),\n ReactSharedInternals =\n React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,\n hasOwnProperty = Object.prototype.hasOwnProperty,\n isArrayImpl = Array.isArray,\n createTask = console.createTask\n ? console.createTask\n : function () {\n return null;\n };\n React = {\n react_stack_bottom_frame: function (callStackForError) {\n return callStackForError();\n }\n };\n var specialPropKeyWarningShown;\n var didWarnAboutElementRef = {};\n var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(\n React,\n UnknownOwner\n )();\n var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));\n var didWarnAboutKeySpread = {};\n exports.Fragment = REACT_FRAGMENT_TYPE;\n exports.jsx = function (type, config, maybeKey) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !1,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n exports.jsxs = function (type, config, maybeKey) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !0,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n })();\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\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 type { SDKConfig, IframeMessage } from './types';\n\nexport class SDK {\n private iframe: HTMLIFrameElement | null = null;\n private iframeUrl: string;\n private config: SDKConfig;\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\n constructor(config: SDKConfig) {\n this.config = config;\n this.iframeUrl = config.iframeUrl || 'http://localhost:3000/iframe/checkout';\n this.environment = this.getEnvironmentFromApiKey(config.apiKey || '');\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\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 this.sendConfigToIframe();\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 as query parameters\n const url = new URL(this.iframeUrl);\n if (this.config.apiKey) {\n url.searchParams.set('apiKey', this.config.apiKey);\n }\n if (this.config.config?.paymentId) {\n url.searchParams.set('paymentId', this.config.config.paymentId);\n }\n const iframeSrc = url.toString();\n\n if (this.usePopup) {\n // Create overlay for popup mode\n const overlay = document.createElement('div');\n overlay.id = 'inflowpay-sdk-overlay';\n overlay.style.cssText = `\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: 999999;\n `;\n\n // Create iframe container\n const container = document.createElement('div');\n container.style.cssText = `\n position: relative;\n width: 90%;\n max-width: 500px;\n height: 90%;\n max-height: 600px;\n background: white;\n border-radius: 8px;\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);\n `;\n\n // Create close button\n const closeButton = document.createElement('button');\n closeButton.innerHTML = '×';\n closeButton.style.cssText = `\n position: absolute;\n top: 10px;\n right: 10px;\n width: 30px;\n height: 30px;\n border: none;\n background: transparent;\n font-size: 24px;\n cursor: pointer;\n z-index: 1000000;\n color: #333;\n display: flex;\n align-items: center;\n justify-content: center;\n `;\n closeButton.onclick = () => this.close();\n\n // Create iframe\n this.iframe = document.createElement('iframe');\n this.iframe.src = iframeSrc;\n this.iframe.style.cssText = `\n width: 100%;\n height: 100%;\n border: none;\n border-radius: 8px;\n `;\n this.iframe.setAttribute('allow', 'payment');\n\n // Assemble structure\n container.appendChild(closeButton);\n container.appendChild(this.iframe);\n overlay.appendChild(container);\n document.body.appendChild(overlay);\n\n // Close on overlay click (but not on container click)\n overlay.addEventListener('click', (e) => {\n if (e.target === overlay) {\n this.close();\n }\n });\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 = '300px';\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 = `\n width: 100%;\n height: 100%;\n min-height: 300px;\n border: none;\n display: block;\n `;\n this.iframe.setAttribute('allow', 'payment');\n\n // Append to container\n this.containerElement.appendChild(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.api.inflowpay.com' ||\n event.origin === 'https://pre-prod.api.inflowpay.xyz' ||\n event.origin === 'https://api.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 '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 }\n if (data.threeDsSessionUrl) {\n if (this.config.debug) {\n console.log('[SDK] Opening 3DS modal...');\n }\n this.open3DSModal(data.threeDsSessionUrl).then((success) => {\n if (this.config.debug) {\n console.log('[SDK] 3DS modal closed, result:', success);\n }\n if (this.iframe && this.iframe.contentWindow) {\n const targetOrigin = this.getTargetOrigin();\n this.iframe.contentWindow.postMessage({\n type: '3ds-result',\n success: success,\n paymentId: data.paymentId || this.config.config?.paymentId,\n }, targetOrigin);\n }\n });\n } else {\n if (this.config.debug) {\n console.error('[SDK] 3DS required but no threeDsSessionUrl provided');\n }\n }\n break;\n \n default:\n if (this.config.debug) {\n console.log('SDK: Received message:', data);\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 apiKey: this.config.apiKey,\n },\n };\n\n const targetOrigin = this.getTargetOrigin();\n this.iframe.contentWindow.postMessage(message, targetOrigin);\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 // 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 const overlay = document.getElementById('inflowpay-sdk-overlay');\n if (overlay) {\n overlay.remove();\n }\n } else {\n // Clear container\n if (this.containerElement && this.iframe) {\n this.containerElement.removeChild(this.iframe);\n }\n }\n\n this.iframe = null;\n }\n\n /**\n * Open 3DS authentication modal\n * Called when iframe requests 3DS authentication\n */\n private open3DSModal(challengeUrl: string): Promise<boolean> {\n if (this.config.debug) {\n console.log('[SDK] open3DSModal called with URL:', challengeUrl);\n }\n return new Promise((resolve) => {\n // Create overlay\n const overlay = document.createElement('div');\n overlay.id = 'inflowpay-3ds-overlay';\n overlay.style.cssText = `\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: 999999;\n `;\n\n // Create modal\n const modal = document.createElement('div');\n modal.style.cssText = `\n position: relative;\n width: 90%;\n max-width: 500px;\n height: 90%;\n max-height: 600px;\n background: white;\n border-radius: 8px;\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);\n display: flex;\n flex-direction: column;\n `;\n\n // Create header\n const header = document.createElement('div');\n header.style.cssText = `\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 15px 20px;\n border-bottom: 1px solid #e5e5e5;\n `;\n header.innerHTML = `\n <h3 style=\"margin: 0; font-size: 18px; font-weight: 600;\">Secure Payment Authentication</h3>\n <button id=\"inflowpay-3ds-close\" style=\"background: none; border: none; font-size: 24px; cursor: pointer; padding: 0; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; color: #333;\">×</button>\n `;\n\n // Create content with iframe\n const content = document.createElement('div');\n content.style.cssText = `\n flex: 1;\n position: relative;\n overflow: hidden;\n `;\n const iframe = document.createElement('iframe');\n iframe.src = challengeUrl;\n iframe.style.cssText = `\n width: 100%;\n height: 100%;\n border: none;\n `;\n iframe.setAttribute('allow', 'payment');\n iframe.setAttribute('sandbox', 'allow-forms allow-scripts allow-same-origin allow-popups');\n content.appendChild(iframe);\n\n modal.appendChild(header);\n modal.appendChild(content);\n overlay.appendChild(modal);\n document.body.appendChild(overlay);\n\n // Close button handler\n const closeBtn = overlay.querySelector('#inflowpay-3ds-close');\n const closeHandler = () => {\n overlay.remove();\n window.removeEventListener('message', messageHandler);\n resolve(false);\n };\n closeBtn?.addEventListener('click', closeHandler);\n\n const messageHandler = (event: MessageEvent) => {\n if (!event.data) return;\n\n const allowed3DSOrigins = [\n 'https://dev.api.inflowpay.com',\n 'https://pre-prod.api.inflowpay.xyz',\n 'https://api.inflowpay.xyz',\n ];\n \n if (this.environment === 'sandbox' || this.environment === 'development') {\n if (event.origin.includes('localhost') || event.origin.includes('127.0.0.1')) {\n // Allow localhost in dev/sandbox\n } else if (!allowed3DSOrigins.includes(event.origin)) {\n if (this.config.debug) {\n console.warn('[SDK] Rejected 3DS message from unauthorized origin:', event.origin);\n }\n return;\n }\n } else {\n if (!allowed3DSOrigins.includes(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\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 * 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 * Detect environment from API key\n */\n private getEnvironmentFromApiKey(apiKey: string): 'sandbox' | 'production' | 'development' | 'preprod' {\n if (!apiKey) return 'sandbox';\n if (apiKey.includes('_local_') || apiKey.startsWith('inflow_local_')) {\n return 'sandbox';\n } else if (apiKey.includes('_prod_') && !apiKey.includes('_preprod_')) {\n return 'production';\n } else if (apiKey.includes('_preprod_') || apiKey.startsWith('inflow_preprod_')) {\n return 'preprod';\n } else if (apiKey.includes('_dev_')) {\n return 'development';\n }\n return 'sandbox';\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 type { SDKConfig } from './types';\nimport { SDK } from './sdk';\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: { status: string; data?: any; error?: any }) => void;\n /** Callback when payment fails */\n onError?: (error: any) => void;\n /** Callback when user closes the payment */\n onClose?: () => void;\n}\n\ninterface InternalSDKConfig {\n apiKey: string;\n iframeUrl: string;\n timeout: number;\n debug: boolean;\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 iframeUrl: config.iframeUrl,\n apiKey: config.apiKey,\n container: this.container,\n config: {\n paymentId: options.paymentId,\n },\n onSuccess: (data) => {\n if (options.onComplete) {\n options.onComplete({\n status: data?.data?.transaction?.status || 'CHECKOUT_SUCCESS',\n data: data,\n });\n }\n },\n onError: (error) => {\n if (options.onError) {\n options.onError(error);\n } else if (options.onComplete) {\n options.onComplete({\n status: 'PAYMENT_FAILED',\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 type { SDKConfig, PaymentConfig } from './types';\nimport { CardElement } from './card-element';\n\nexport interface PaymentSDKConfig {\n /** Public API key */\n apiKey: string;\n /** Backend API URL (optional, auto-detected from API key) */\n iframeUrl?: string;\n /** Request timeout in milliseconds (default: 30000) */\n timeout?: number;\n /** Enable debug logging (default: false, only allowed in local/dev environments) */\n debug?: boolean;\n}\n\nexport class PaymentSDK {\n private config: PaymentSDKConfig & { iframeUrl: string; timeout: number; 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.apiKey || typeof config.apiKey !== 'string') {\n throw new Error('API key is required');\n }\n\n // Auto-detect iframe URL from API key if not provided\n let iframeUrl = config.iframeUrl;\n const environment = this.getEnvironmentFromApiKey(config.apiKey);\n \n if (!iframeUrl) {\n if (environment === 'production') {\n iframeUrl = 'https://api.inflowpay.xyz/iframe/checkout';\n } else if (environment === 'preprod') {\n iframeUrl = 'https://pre-prod.api.inflowpay.xyz/iframe/checkout';\n } else if (environment === 'development') {\n iframeUrl = 'https://dev.api.inflowpay.com/iframe/checkout';\n } else {\n // sandbox/local\n iframeUrl = 'http://localhost:3000/iframe/checkout';\n }\n }\n\n // Validate debug mode - only allowed in local/dev environments\n const requestedDebug = config.debug ?? false;\n if (requestedDebug && (environment === 'production' || environment === 'preprod')) {\n console.warn('[InflowPay SDK] Debug mode is not allowed in production/pre-prod environments. Debug mode disabled.');\n }\n const debug = requestedDebug && (environment === 'sandbox' || environment === 'development');\n\n this.config = {\n apiKey: config.apiKey,\n iframeUrl,\n timeout: config.timeout ?? 30000,\n debug,\n };\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 onComplete?: (result: { status: string; data?: any; error?: any }) => void;\n onError?: (error: any) => void;\n onClose?: () => void;\n }): CardElement {\n return new CardElement(this.config, options);\n }\n\n /**\n * Get the iframe URL being used\n */\n getIframeUrl(): string {\n return this.config.iframeUrl;\n }\n\n /**\n * Get the API key\n */\n getApiKey(): string {\n return this.config.apiKey;\n }\n\n /**\n * Auto-detect environment from API key\n */\n private getEnvironmentFromApiKey(apiKey: string): 'sandbox' | 'production' | 'development' | 'preprod' {\n if (apiKey.includes('_local_') || apiKey.startsWith('inflow_local_')) {\n return 'sandbox';\n } else if (apiKey.includes('_prod_') && !apiKey.includes('_preprod_')) {\n return 'production';\n } else if (apiKey.includes('_preprod_') || apiKey.startsWith('inflow_preprod_')) {\n return 'preprod';\n } else if (apiKey.includes('_dev_')) {\n return 'development';\n }\n return 'sandbox';\n }\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 React, { createContext, ReactNode, useContext, useEffect, useRef, useState } from 'react';\nimport type { CardElementOptions } from '../card-element';\nimport { CardElement as CardElementClass } from '../card-element';\nimport type { PaymentSDKConfig } from '../payment-sdk';\nimport { PaymentSDK } from '../payment-sdk';\n\nexport interface SDKConfig {\n apiKey: string;\n iframeUrl?: string;\n timeout?: number;\n /** Enable debug logging (default: false, only allowed in local/dev environments) */\n debug?: boolean;\n}\n\nexport interface PaymentResult {\n status: string;\n data?: any;\n alreadyProcessed?: boolean;\n error?: {\n code: string;\n message: string;\n retryable: boolean;\n };\n}\n\nexport interface PaymentError {\n code: string;\n message: string;\n retryable: boolean;\n}\n\nexport interface CardElementState {\n complete: boolean;\n}\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 buttonText?: string;\n buttonStyle?: any;\n style?: any;\n placeholders?: {\n cardNumber?: string;\n expiry?: string;\n cvc?: string;\n };\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 apiKey: config.apiKey,\n iframeUrl: config.iframeUrl,\n timeout: config.timeout,\n debug: config.debug,\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({\n paymentId,\n onReady,\n onChange,\n onComplete,\n onError,\n buttonText,\n buttonStyle,\n style,\n placeholders,\n config: propConfig,\n}: CardElementProps & { config?: SDKConfig }) {\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 apiKey: propConfig.apiKey,\n iframeUrl: propConfig.iframeUrl,\n timeout: propConfig.timeout,\n debug: propConfig.debug,\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 || mounted) {\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 onComplete: (result) => {\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: 'PAYMENT_FAILED',\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, mounted, onComplete, onError, onReady]);\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: '100%',\n minHeight: '300px',\n position: 'relative',\n ...style,\n }}\n />\n );\n}\n"],"names":["REACT_ELEMENT_TYPE","REACT_FRAGMENT_TYPE","jsxProd","type","config","maybeKey","key","propName","reactJsxRuntime_production","getComponentNameFromType","REACT_CLIENT_REFERENCE","REACT_PROFILER_TYPE","REACT_STRICT_MODE_TYPE","REACT_SUSPENSE_TYPE","REACT_SUSPENSE_LIST_TYPE","REACT_ACTIVITY_TYPE","REACT_PORTAL_TYPE","REACT_CONTEXT_TYPE","REACT_CONSUMER_TYPE","REACT_FORWARD_REF_TYPE","innerType","REACT_MEMO_TYPE","REACT_LAZY_TYPE","testStringCoercion","value","checkKeyStringCoercion","JSCompiler_inline_result","JSCompiler_temp_const","JSCompiler_inline_result$jscomp$0","getTaskName","name","getOwner","dispatcher","ReactSharedInternals","UnknownOwner","hasValidKey","hasOwnProperty","getter","defineKeyPropWarningGetter","props","displayName","warnAboutAccessingKey","specialPropKeyWarningShown","elementRefGetterWithDeprecationWarning","componentName","didWarnAboutElementRef","ReactElement","owner","debugStack","debugTask","refProp","jsxDEVImpl","isStaticChildren","children","isArrayImpl","validateChildKeys","keys","k","didWarnAboutKeySpread","node","isValidElement","object","React","require$$0","createTask","callStackForError","unknownOwnerDebugStack","unknownOwnerDebugTask","reactJsxRuntime_development","trackActualOwner","jsxRuntimeModule","require$$1","SDK","url","iframeSrc","overlay","container","closeButton","e","currentStyle","event","allowedOrigin","isAllowedOrigin","data","success","targetOrigin","message","challengeUrl","resolve","modal","header","content","iframe","closeBtn","closeHandler","messageHandler","allowed3DSOrigins","is3DSComplete","isSuccess","isFailure","apiKey","CardElement$1","options","containerElement","error","PaymentSDK","iframeUrl","environment","requestedDebug","debug","CardElement","InflowPayContext","createContext","InflowPayProvider","sdk","useState","sdkConfig","jsx","useInflowPay","context","useContext","paymentId","onReady","onChange","onComplete","onError","buttonText","buttonStyle","style","placeholders","propConfig","containerRef","useRef","cardElementRef","mounted","setMounted","useEffect","cardElementOptions","result","cardElement","timer"],"mappings":";;;;;;AAWA,MAAIA,IAAqB,OAAO,IAAI,4BAA4B,GAC9DC,IAAsB,OAAO,IAAI,gBAAgB;AACnD,WAASC,EAAQC,GAAMC,GAAQC,GAAU;AACvC,QAAIC,IAAM;AAGV,QAFWD,MAAX,WAAwBC,IAAM,KAAKD,IACxBD,EAAO,QAAlB,WAA0BE,IAAM,KAAKF,EAAO,MACxC,SAASA,GAAQ;AACnB,MAAAC,IAAW,CAAA;AACX,eAASE,KAAYH;AACnB,QAAUG,MAAV,UAAuBF,EAASE,CAAQ,IAAIH,EAAOG,CAAQ;AAAA,IACjE,MAAS,CAAAF,IAAWD;AAClB,WAAAA,IAASC,EAAS,KACX;AAAA,MACL,UAAUL;AAAA,MACV,MAAMG;AAAA,MACN,KAAKG;AAAA,MACL,KAAgBF,MAAX,SAAoBA,IAAS;AAAA,MAClC,OAAOC;AAAA;EAEX;AACA,SAAAG,EAAA,WAAmBP,GACnBO,EAAA,MAAcN,GACdM,EAAA,OAAeN;;;;;sBCtBE,QAAQ,IAAI,aAA7B,iBACG,WAAY;AACX,aAASO,EAAyBN,GAAM;AACtC,UAAYA,KAAR,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E,UAAMM,IAAyC;AAAA,MAC7C,WAAWN,EAAa;AAAA,MACxB,WAAAV;AAAA,MACA,YAAY,CAACiB,MAAW;AACtB,QAAId,KACFA,EAAWc,CAAM;AAAA,MAErB;AAAA,MACA,SAAS,CAAClC,MAAU;AAClB,QAAIqB,IACFA,EAAQrB,CAAK,IACJoB,KACTA,EAAW;AAAA,UACT,QAAQ;AAAA,UACR,OAAApB;AAAA,QAAA,CACD;AAAA,MAEL;AAAA,MACA,SAAS,MAAM;AAAA,MACf;AAAA,IAAA,GAGImC,IAAczB,EAAI,kBAAkBuB,CAAkB;AAK5D,QAJAJ,EAAe,UAAUM,GACzBA,EAAY,MAAA,GACZJ,EAAW,EAAI,GAEXb,GAAS;AACX,YAAMkB,IAAQ,WAAW,MAAM;AAC7B,QAAAlB,EAAA;AAAA,MACF,GAAG,GAAG;AACN,aAAO,MAAM,aAAakB,CAAK;AAAA,IACjC;AAAA,EACF,GAAG,CAACnB,GAAWP,GAAKoB,GAASV,GAAYC,GAASH,CAAO,CAAC,GAE1Dc,EAAU,MAAM;AACd,IAAIb,KAAYW,KACdX,EAAS,EAAE,UAAU,IAAO;AAAA,EAEhC,GAAG,CAACW,GAASX,CAAQ,CAAC,GAEtBa,EAAU,MACD,MAAM;AACX,IAAIH,EAAe,YACjBA,EAAe,QAAQ,QAAA,GACvBA,EAAe,UAAU;AAAA,EAE7B,GACC,CAAA,CAAE,GAGHhB,gBAAAA,EAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAKc;AAAA,MACL,OAAO;AAAA,QACL,OAAO;AAAA,QACP,WAAW;AAAA,QACX,UAAU;AAAA,QACV,GAAGH;AAAA,MAAA;AAAA,IACL;AAAA,EAAA;AAGN;","x_google_ignoreList":[0,1,2]}
@@ -0,0 +1,92 @@
1
+ (function(E,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],h):(E=typeof globalThis<"u"?globalThis:E||self,h(E.InflowPaySDKReact={},E.React))})(this,(function(E,h){"use strict";var k={exports:{}},S={};var N;function G(){if(N)return S;N=1;var l=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,i,s){var d=null;if(s!==void 0&&(d=""+s),i.key!==void 0&&(d=""+i.key),"key"in i){s={};for(var p in i)p!=="key"&&(s[p]=i[p])}else s=i;return i=s.ref,{$$typeof:l,type:r,key:d,ref:i!==void 0?i:null,props:s}}return S.Fragment=t,S.jsx=n,S.jsxs=n,S}var R={};var M;function B(){return M||(M=1,process.env.NODE_ENV!=="production"&&(function(){function l(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ce?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case x:return"Fragment";case _:return"Profiler";case A:return"StrictMode";case oe:return"Suspense";case se:return"SuspenseList";case le:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case v:return"Portal";case ne:return e.displayName||"Context";case re:return(e._context.displayName||"Context")+".Consumer";case ie:var o=e.render;return e=e.displayName,e||(e=o.displayName||o.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ae:return o=e.displayName||null,o!==null?o:l(e.type)||"Memo";case D:o=e._payload,e=e._init;try{return l(e(o))}catch{}}return null}function t(e){return""+e}function n(e){try{t(e);var o=!1}catch{o=!0}if(o){o=console;var a=o.error,c=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return a.call(o,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",c),t(e)}}function r(e){if(e===x)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===D)return"<...>";try{var o=l(e);return o?"<"+o+">":"<...>"}catch{return"<...>"}}function i(){var e=j.A;return e===null?null:e.getOwner()}function s(){return Error("react-stack-top-frame")}function d(e){if(F.call(e,"key")){var o=Object.getOwnPropertyDescriptor(e,"key").get;if(o&&o.isReactWarning)return!1}return e.key!==void 0}function p(e,o){function a(){W||(W=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",o))}a.isReactWarning=!0,Object.defineProperty(e,"key",{get:a,configurable:!0})}function P(){var e=l(this.type);return H[e]||(H[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function w(e,o,a,c,C,L){var u=a.ref;return e={$$typeof:b,type:e,key:o,props:a,_owner:c},(u!==void 0?u:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:P}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:C}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:L}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function g(e,o,a,c,C,L){var u=o.children;if(u!==void 0)if(c)if(ue(u)){for(c=0;c<u.length;c++)f(u[c]);Object.freeze&&Object.freeze(u)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else f(u);if(F.call(o,"key")){u=l(e);var T=Object.keys(o).filter(function(de){return de!=="key"});c=0<T.length?"{key: someKey, "+T.join(": ..., ")+": ...}":"{key: someKey}",q[u+c]||(T=0<T.length?"{"+T.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
+ let props = %s;
3
+ <%s {...props} />
4
+ React keys must be passed directly to JSX without using spread:
5
+ let props = %s;
6
+ <%s key={someKey} {...props} />`,c,u,T,u),q[u+c]=!0)}if(u=null,a!==void 0&&(n(a),u=""+a),d(o)&&(n(o.key),u=""+o.key),"key"in o){a={};for(var U in o)U!=="key"&&(a[U]=o[U])}else a=o;return u&&p(a,typeof e=="function"?e.displayName||e.name||"Unknown":e),w(e,u,a,i(),C,L)}function f(e){y(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===D&&(e._payload.status==="fulfilled"?y(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function y(e){return typeof e=="object"&&e!==null&&e.$$typeof===b}var m=h,b=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),re=Symbol.for("react.consumer"),ne=Symbol.for("react.context"),ie=Symbol.for("react.forward_ref"),oe=Symbol.for("react.suspense"),se=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),le=Symbol.for("react.activity"),ce=Symbol.for("react.client.reference"),j=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,ue=Array.isArray,I=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var W,H={},J=m.react_stack_bottom_frame.bind(m,s)(),V=I(r(s)),q={};R.Fragment=x,R.jsx=function(e,o,a){var c=1e4>j.recentlyCreatedOwnerStacks++;return g(e,o,a,!1,c?Error("react-stack-top-frame"):J,c?I(r(e)):V)},R.jsxs=function(e,o,a){var c=1e4>j.recentlyCreatedOwnerStacks++;return g(e,o,a,!0,c?Error("react-stack-top-frame"):J,c?I(r(e)):V)}})()),R}var z;function X(){return z||(z=1,process.env.NODE_ENV==="production"?k.exports=G():k.exports=B()),k.exports}var K=X();class Z{constructor(t){if(this.iframe=null,this.messageListener=null,this.containerElement=null,this.config=t,this.iframeUrl=t.iframeUrl||"http://localhost:3000/iframe/checkout",this.environment=this.getEnvironmentFromApiKey(t.apiKey||""),this.usePopup=!t.container,t.container)if(typeof t.container=="string"){if(this.containerElement=document.querySelector(t.container),!this.containerElement)throw new Error(`Container not found: ${t.container}`)}else this.containerElement=t.container}init(){this.iframe||(this.createIframe(),this.addMessageListener(),this.sendConfigToIframe())}createIframe(){const t=new URL(this.iframeUrl);this.config.apiKey&&t.searchParams.set("apiKey",this.config.apiKey),this.config.config?.paymentId&&t.searchParams.set("paymentId",this.config.config.paymentId);const n=t.toString();if(this.usePopup){const r=document.createElement("div");r.id="inflowpay-sdk-overlay",r.style.cssText=`
7
+ position: fixed;
8
+ top: 0;
9
+ left: 0;
10
+ width: 100%;
11
+ height: 100%;
12
+ background-color: rgba(0, 0, 0, 0.5);
13
+ display: flex;
14
+ align-items: center;
15
+ justify-content: center;
16
+ z-index: 999999;
17
+ `;const i=document.createElement("div");i.style.cssText=`
18
+ position: relative;
19
+ width: 90%;
20
+ max-width: 500px;
21
+ height: 90%;
22
+ max-height: 600px;
23
+ background: white;
24
+ border-radius: 8px;
25
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
26
+ `;const s=document.createElement("button");s.innerHTML="×",s.style.cssText=`
27
+ position: absolute;
28
+ top: 10px;
29
+ right: 10px;
30
+ width: 30px;
31
+ height: 30px;
32
+ border: none;
33
+ background: transparent;
34
+ font-size: 24px;
35
+ cursor: pointer;
36
+ z-index: 1000000;
37
+ color: #333;
38
+ display: flex;
39
+ align-items: center;
40
+ justify-content: center;
41
+ `,s.onclick=()=>this.close(),this.iframe=document.createElement("iframe"),this.iframe.src=n,this.iframe.style.cssText=`
42
+ width: 100%;
43
+ height: 100%;
44
+ border: none;
45
+ border-radius: 8px;
46
+ `,this.iframe.setAttribute("allow","payment"),i.appendChild(s),i.appendChild(this.iframe),r.appendChild(i),document.body.appendChild(r),r.addEventListener("click",d=>{d.target===r&&this.close()})}else{if(!this.containerElement)throw new Error("Container element is required for inline mode");if(this.containerElement.innerHTML="",this.containerElement instanceof HTMLElement){const r=this.containerElement.getAttribute("style")||"";r.includes("min-height")||(this.containerElement.style.minHeight="300px"),r.includes("position")||(this.containerElement.style.position="relative"),r.includes("overflow")||(this.containerElement.style.overflow="hidden")}this.iframe=document.createElement("iframe"),this.iframe.src=n,this.iframe.style.cssText=`
47
+ width: 100%;
48
+ height: 100%;
49
+ min-height: 300px;
50
+ border: none;
51
+ display: block;
52
+ `,this.iframe.setAttribute("allow","payment"),this.containerElement.appendChild(this.iframe)}}addMessageListener(){this.messageListener=t=>{const n=new URL(this.iframeUrl).origin;let i=t.origin===n;if(i||((this.environment==="sandbox"||this.environment==="development")&&(i=(t.origin.includes("localhost")||t.origin.includes("127.0.0.1"))&&(n.includes("localhost")||n.includes("127.0.0.1"))),i||(i=t.origin==="https://dev.api.inflowpay.com"||t.origin==="https://pre-prod.api.inflowpay.xyz"||t.origin==="https://api.inflowpay.xyz")),!i){this.config.debug&&console.warn("[SDK] Rejected message from unauthorized origin:",t.origin);return}const s=t.data;if(!(!s||!s.type))switch(s.type){case"close":this.close();break;case"success":this.config.onSuccess&&this.config.onSuccess(s.data);break;case"error":this.config.onError&&this.config.onError(s.data);break;case"3ds-required":this.config.debug&&console.log("[SDK] Received 3DS request:",s.threeDsSessionUrl),s.threeDsSessionUrl?(this.config.debug&&console.log("[SDK] Opening 3DS modal..."),this.open3DSModal(s.threeDsSessionUrl).then(d=>{if(this.config.debug&&console.log("[SDK] 3DS modal closed, result:",d),this.iframe&&this.iframe.contentWindow){const p=this.getTargetOrigin();this.iframe.contentWindow.postMessage({type:"3ds-result",success:d,paymentId:s.paymentId||this.config.config?.paymentId},p)}})):this.config.debug&&console.error("[SDK] 3DS required but no threeDsSessionUrl provided");break;default:this.config.debug&&console.log("SDK: Received message:",s)}},window.addEventListener("message",this.messageListener)}sendConfigToIframe(){if(!this.iframe||!this.iframe.contentWindow){this.iframe&&(this.iframe.onload=()=>{this.sendConfigToIframe()});return}const t={type:"sdkData",config:{...this.config.config||{},paymentId:this.config.config?.paymentId},data:{apiKey:this.config.apiKey}},n=this.getTargetOrigin();this.iframe.contentWindow.postMessage(t,n)}close(){if(this.config.onClose&&this.config.onClose(),this.messageListener&&(window.removeEventListener("message",this.messageListener),this.messageListener=null),this.usePopup){const t=document.getElementById("inflowpay-sdk-overlay");t&&t.remove()}else this.containerElement&&this.iframe&&this.containerElement.removeChild(this.iframe);this.iframe=null}open3DSModal(t){return this.config.debug&&console.log("[SDK] open3DSModal called with URL:",t),new Promise(n=>{const r=document.createElement("div");r.id="inflowpay-3ds-overlay",r.style.cssText=`
53
+ position: fixed;
54
+ top: 0;
55
+ left: 0;
56
+ width: 100%;
57
+ height: 100%;
58
+ background-color: rgba(0, 0, 0, 0.7);
59
+ display: flex;
60
+ align-items: center;
61
+ justify-content: center;
62
+ z-index: 999999;
63
+ `;const i=document.createElement("div");i.style.cssText=`
64
+ position: relative;
65
+ width: 90%;
66
+ max-width: 500px;
67
+ height: 90%;
68
+ max-height: 600px;
69
+ background: white;
70
+ border-radius: 8px;
71
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
72
+ display: flex;
73
+ flex-direction: column;
74
+ `;const s=document.createElement("div");s.style.cssText=`
75
+ display: flex;
76
+ align-items: center;
77
+ justify-content: space-between;
78
+ padding: 15px 20px;
79
+ border-bottom: 1px solid #e5e5e5;
80
+ `,s.innerHTML=`
81
+ <h3 style="margin: 0; font-size: 18px; font-weight: 600;">Secure Payment Authentication</h3>
82
+ <button id="inflowpay-3ds-close" style="background: none; border: none; font-size: 24px; cursor: pointer; padding: 0; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; color: #333;">×</button>
83
+ `;const d=document.createElement("div");d.style.cssText=`
84
+ flex: 1;
85
+ position: relative;
86
+ overflow: hidden;
87
+ `;const p=document.createElement("iframe");p.src=t,p.style.cssText=`
88
+ width: 100%;
89
+ height: 100%;
90
+ border: none;
91
+ `,p.setAttribute("allow","payment"),p.setAttribute("sandbox","allow-forms allow-scripts allow-same-origin allow-popups"),d.appendChild(p),i.appendChild(s),i.appendChild(d),r.appendChild(i),document.body.appendChild(r);const P=r.querySelector("#inflowpay-3ds-close"),w=()=>{r.remove(),window.removeEventListener("message",g),n(!1)};P?.addEventListener("click",w);const g=f=>{if(!f.data)return;const y=["https://dev.api.inflowpay.com","https://pre-prod.api.inflowpay.xyz","https://api.inflowpay.xyz"];if(this.environment==="sandbox"||this.environment==="development"){if(!(f.origin.includes("localhost")||f.origin.includes("127.0.0.1"))){if(!y.includes(f.origin)){this.config.debug&&console.warn("[SDK] Rejected 3DS message from unauthorized origin:",f.origin);return}}}else if(!y.includes(f.origin)){this.config.debug&&console.warn("[SDK] Rejected 3DS message from unauthorized origin:",f.origin);return}const m=f.data,b=m.type==="THREE_DS_COMPLETE"||m.type==="3ds-complete",v=m.status==="success",x=m.status==="failed"||m.status==="failure";if(b&&v){r.remove(),window.removeEventListener("message",g),n(!0);return}if(v&&!b){r.remove(),window.removeEventListener("message",g),n(!0);return}if(b&&x||m.type==="3ds-failed"||x){r.remove(),window.removeEventListener("message",g),n(!1);return}};window.addEventListener("message",g)})}getTargetOrigin(){return this.environment==="production"||this.environment==="preprod"?new URL(this.iframeUrl).origin:"*"}getEnvironmentFromApiKey(t){return!t||t.includes("_local_")||t.startsWith("inflow_local_")?"sandbox":t.includes("_prod_")&&!t.includes("_preprod_")?"production":t.includes("_preprod_")||t.startsWith("inflow_preprod_")?"preprod":t.includes("_dev_")?"development":"sandbox"}destroy(){this.close()}}let Q=class{constructor(t,n){this.mounted=!1;let r;if(typeof n.container=="string"){if(r=document.querySelector(n.container),!r)throw new Error(`Container not found: ${n.container}`)}else r=n.container;this.container=r,this.sdk=new Z({iframeUrl:t.iframeUrl,apiKey:t.apiKey,container:this.container,config:{paymentId:n.paymentId},onSuccess:i=>{n.onComplete&&n.onComplete({status:i?.data?.transaction?.status||"CHECKOUT_SUCCESS",data:i})},onError:i=>{n.onError?n.onError(i):n.onComplete&&n.onComplete({status:"PAYMENT_FAILED",error:i})},onClose:()=>{n.onClose&&n.onClose()}})}mount(){if(this.mounted)throw new Error("CardElement is already mounted");this.sdk.init(),this.mounted=!0}destroy(){this.mounted&&(this.sdk.destroy(),this.mounted=!1)}};class Y{constructor(t){if(!t.apiKey||typeof t.apiKey!="string")throw new Error("API key is required");let n=t.iframeUrl;const r=this.getEnvironmentFromApiKey(t.apiKey);n||(r==="production"?n="https://api.inflowpay.xyz/iframe/checkout":r==="preprod"?n="https://pre-prod.api.inflowpay.xyz/iframe/checkout":r==="development"?n="https://dev.api.inflowpay.com/iframe/checkout":n="http://localhost:3000/iframe/checkout");const i=t.debug??!1;i&&(r==="production"||r==="preprod")&&console.warn("[InflowPay SDK] Debug mode is not allowed in production/pre-prod environments. Debug mode disabled.");const s=i&&(r==="sandbox"||r==="development");this.config={apiKey:t.apiKey,iframeUrl:n,timeout:t.timeout??3e4,debug:s}}createCardElement(t){return new Q(this.config,t)}getIframeUrl(){return this.config.iframeUrl}getApiKey(){return this.config.apiKey}getEnvironmentFromApiKey(t){return t.includes("_local_")||t.startsWith("inflow_local_")?"sandbox":t.includes("_prod_")&&!t.includes("_preprod_")?"production":t.includes("_preprod_")||t.startsWith("inflow_preprod_")?"preprod":t.includes("_dev_")?"development":"sandbox"}}const O=h.createContext(null);function $({config:l,children:t}){const[n]=h.useState(()=>{const r={apiKey:l.apiKey,iframeUrl:l.iframeUrl,timeout:l.timeout,debug:l.debug};return new Y(r)});return K.jsx(O.Provider,{value:{sdk:n},children:t})}function ee(){const l=h.useContext(O);if(!l)throw new Error("useInflowPay must be used within InflowPayProvider");return l.sdk}function te({paymentId:l,onReady:t,onChange:n,onComplete:r,onError:i,buttonText:s,buttonStyle:d,style:p,placeholders:P,config:w}){const g=h.useContext(O),f=h.useRef(null),y=h.useRef(null),[m,b]=h.useState(!1),v=g?.sdk||(w?new Y({apiKey:w.apiKey,iframeUrl:w.iframeUrl,timeout:w.timeout,debug:w.debug}):null);if(!v)throw new Error("CardElement must be used within InflowPayProvider or have a config prop");return h.useEffect(()=>{if(!f.current||m)return;f.current.id||(f.current.id=`inflowpay-card-element-${Date.now()}`);const x={container:f.current,paymentId:l,onComplete:_=>{r&&r(_)},onError:_=>{i?i(_):r&&r({status:"PAYMENT_FAILED",error:_})},onClose:()=>{}},A=v.createCardElement(x);if(y.current=A,A.mount(),b(!0),t){const _=setTimeout(()=>{t()},100);return()=>clearTimeout(_)}},[l,v,m,r,i,t]),h.useEffect(()=>{n&&m&&n({complete:!1})},[m,n]),h.useEffect(()=>()=>{y.current&&(y.current.destroy(),y.current=null)},[]),K.jsx("div",{ref:f,style:{width:"100%",minHeight:"300px",position:"relative",...p}})}E.CardElement=te,E.InflowPayProvider=$,E.useInflowPay=ee,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})}));
92
+ //# sourceMappingURL=react.umd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.umd.js","sources":["../node_modules/react/cjs/react-jsx-runtime.production.js","../node_modules/react/cjs/react-jsx-runtime.development.js","../node_modules/react/jsx-runtime.js","../src/sdk.ts","../src/card-element.ts","../src/payment-sdk.ts","../src/react/index.tsx"],"sourcesContent":["/**\n * @license React\n * react-jsx-runtime.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\");\nfunction jsxProd(type, config, maybeKey) {\n var key = null;\n void 0 !== maybeKey && (key = \"\" + maybeKey);\n void 0 !== config.key && (key = \"\" + config.key);\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n config = maybeKey.ref;\n return {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n ref: void 0 !== config ? config : null,\n props: maybeKey\n };\n}\nexports.Fragment = REACT_FRAGMENT_TYPE;\nexports.jsx = jsxProd;\nexports.jsxs = jsxProd;\n","/**\n * @license React\n * react-jsx-runtime.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function getComponentNameFromType(type) {\n if (null == type) return null;\n if (\"function\" === typeof type)\n return type.$$typeof === REACT_CLIENT_REFERENCE\n ? null\n : type.displayName || type.name || null;\n if (\"string\" === typeof type) return type;\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return \"Fragment\";\n case REACT_PROFILER_TYPE:\n return \"Profiler\";\n case REACT_STRICT_MODE_TYPE:\n return \"StrictMode\";\n case REACT_SUSPENSE_TYPE:\n return \"Suspense\";\n case REACT_SUSPENSE_LIST_TYPE:\n return \"SuspenseList\";\n case REACT_ACTIVITY_TYPE:\n return \"Activity\";\n }\n if (\"object\" === typeof type)\n switch (\n (\"number\" === typeof type.tag &&\n console.error(\n \"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.\"\n ),\n type.$$typeof)\n ) {\n case REACT_PORTAL_TYPE:\n return \"Portal\";\n case REACT_CONTEXT_TYPE:\n return type.displayName || \"Context\";\n case REACT_CONSUMER_TYPE:\n return (type._context.displayName || \"Context\") + \".Consumer\";\n case REACT_FORWARD_REF_TYPE:\n var innerType = type.render;\n type = type.displayName;\n type ||\n ((type = innerType.displayName || innerType.name || \"\"),\n (type = \"\" !== type ? \"ForwardRef(\" + type + \")\" : \"ForwardRef\"));\n return type;\n case REACT_MEMO_TYPE:\n return (\n (innerType = type.displayName || null),\n null !== innerType\n ? innerType\n : getComponentNameFromType(type.type) || \"Memo\"\n );\n case REACT_LAZY_TYPE:\n innerType = type._payload;\n type = type._init;\n try {\n return getComponentNameFromType(type(innerType));\n } catch (x) {}\n }\n return null;\n }\n function testStringCoercion(value) {\n return \"\" + value;\n }\n function checkKeyStringCoercion(value) {\n try {\n testStringCoercion(value);\n var JSCompiler_inline_result = !1;\n } catch (e) {\n JSCompiler_inline_result = !0;\n }\n if (JSCompiler_inline_result) {\n JSCompiler_inline_result = console;\n var JSCompiler_temp_const = JSCompiler_inline_result.error;\n var JSCompiler_inline_result$jscomp$0 =\n (\"function\" === typeof Symbol &&\n Symbol.toStringTag &&\n value[Symbol.toStringTag]) ||\n value.constructor.name ||\n \"Object\";\n JSCompiler_temp_const.call(\n JSCompiler_inline_result,\n \"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.\",\n JSCompiler_inline_result$jscomp$0\n );\n return testStringCoercion(value);\n }\n }\n function getTaskName(type) {\n if (type === REACT_FRAGMENT_TYPE) return \"<>\";\n if (\n \"object\" === typeof type &&\n null !== type &&\n type.$$typeof === REACT_LAZY_TYPE\n )\n return \"<...>\";\n try {\n var name = getComponentNameFromType(type);\n return name ? \"<\" + name + \">\" : \"<...>\";\n } catch (x) {\n return \"<...>\";\n }\n }\n function getOwner() {\n var dispatcher = ReactSharedInternals.A;\n return null === dispatcher ? null : dispatcher.getOwner();\n }\n function UnknownOwner() {\n return Error(\"react-stack-top-frame\");\n }\n function hasValidKey(config) {\n if (hasOwnProperty.call(config, \"key\")) {\n var getter = Object.getOwnPropertyDescriptor(config, \"key\").get;\n if (getter && getter.isReactWarning) return !1;\n }\n return void 0 !== config.key;\n }\n function defineKeyPropWarningGetter(props, displayName) {\n function warnAboutAccessingKey() {\n specialPropKeyWarningShown ||\n ((specialPropKeyWarningShown = !0),\n console.error(\n \"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)\",\n displayName\n ));\n }\n warnAboutAccessingKey.isReactWarning = !0;\n Object.defineProperty(props, \"key\", {\n get: warnAboutAccessingKey,\n configurable: !0\n });\n }\n function elementRefGetterWithDeprecationWarning() {\n var componentName = getComponentNameFromType(this.type);\n didWarnAboutElementRef[componentName] ||\n ((didWarnAboutElementRef[componentName] = !0),\n console.error(\n \"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.\"\n ));\n componentName = this.props.ref;\n return void 0 !== componentName ? componentName : null;\n }\n function ReactElement(type, key, props, owner, debugStack, debugTask) {\n var refProp = props.ref;\n type = {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n props: props,\n _owner: owner\n };\n null !== (void 0 !== refProp ? refProp : null)\n ? Object.defineProperty(type, \"ref\", {\n enumerable: !1,\n get: elementRefGetterWithDeprecationWarning\n })\n : Object.defineProperty(type, \"ref\", { enumerable: !1, value: null });\n type._store = {};\n Object.defineProperty(type._store, \"validated\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: 0\n });\n Object.defineProperty(type, \"_debugInfo\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: null\n });\n Object.defineProperty(type, \"_debugStack\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugStack\n });\n Object.defineProperty(type, \"_debugTask\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugTask\n });\n Object.freeze && (Object.freeze(type.props), Object.freeze(type));\n return type;\n }\n function jsxDEVImpl(\n type,\n config,\n maybeKey,\n isStaticChildren,\n debugStack,\n debugTask\n ) {\n var children = config.children;\n if (void 0 !== children)\n if (isStaticChildren)\n if (isArrayImpl(children)) {\n for (\n isStaticChildren = 0;\n isStaticChildren < children.length;\n isStaticChildren++\n )\n validateChildKeys(children[isStaticChildren]);\n Object.freeze && Object.freeze(children);\n } else\n console.error(\n \"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.\"\n );\n else validateChildKeys(children);\n if (hasOwnProperty.call(config, \"key\")) {\n children = getComponentNameFromType(type);\n var keys = Object.keys(config).filter(function (k) {\n return \"key\" !== k;\n });\n isStaticChildren =\n 0 < keys.length\n ? \"{key: someKey, \" + keys.join(\": ..., \") + \": ...}\"\n : \"{key: someKey}\";\n didWarnAboutKeySpread[children + isStaticChildren] ||\n ((keys =\n 0 < keys.length ? \"{\" + keys.join(\": ..., \") + \": ...}\" : \"{}\"),\n console.error(\n 'A props object containing a \"key\" prop is being spread into JSX:\\n let props = %s;\\n <%s {...props} />\\nReact keys must be passed directly to JSX without using spread:\\n let props = %s;\\n <%s key={someKey} {...props} />',\n isStaticChildren,\n children,\n keys,\n children\n ),\n (didWarnAboutKeySpread[children + isStaticChildren] = !0));\n }\n children = null;\n void 0 !== maybeKey &&\n (checkKeyStringCoercion(maybeKey), (children = \"\" + maybeKey));\n hasValidKey(config) &&\n (checkKeyStringCoercion(config.key), (children = \"\" + config.key));\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n children &&\n defineKeyPropWarningGetter(\n maybeKey,\n \"function\" === typeof type\n ? type.displayName || type.name || \"Unknown\"\n : type\n );\n return ReactElement(\n type,\n children,\n maybeKey,\n getOwner(),\n debugStack,\n debugTask\n );\n }\n function validateChildKeys(node) {\n isValidElement(node)\n ? node._store && (node._store.validated = 1)\n : \"object\" === typeof node &&\n null !== node &&\n node.$$typeof === REACT_LAZY_TYPE &&\n (\"fulfilled\" === node._payload.status\n ? isValidElement(node._payload.value) &&\n node._payload.value._store &&\n (node._payload.value._store.validated = 1)\n : node._store && (node._store.validated = 1));\n }\n function isValidElement(object) {\n return (\n \"object\" === typeof object &&\n null !== object &&\n object.$$typeof === REACT_ELEMENT_TYPE\n );\n }\n var React = require(\"react\"),\n REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_PORTAL_TYPE = Symbol.for(\"react.portal\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\"),\n REACT_STRICT_MODE_TYPE = Symbol.for(\"react.strict_mode\"),\n REACT_PROFILER_TYPE = Symbol.for(\"react.profiler\"),\n REACT_CONSUMER_TYPE = Symbol.for(\"react.consumer\"),\n REACT_CONTEXT_TYPE = Symbol.for(\"react.context\"),\n REACT_FORWARD_REF_TYPE = Symbol.for(\"react.forward_ref\"),\n REACT_SUSPENSE_TYPE = Symbol.for(\"react.suspense\"),\n REACT_SUSPENSE_LIST_TYPE = Symbol.for(\"react.suspense_list\"),\n REACT_MEMO_TYPE = Symbol.for(\"react.memo\"),\n REACT_LAZY_TYPE = Symbol.for(\"react.lazy\"),\n REACT_ACTIVITY_TYPE = Symbol.for(\"react.activity\"),\n REACT_CLIENT_REFERENCE = Symbol.for(\"react.client.reference\"),\n ReactSharedInternals =\n React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,\n hasOwnProperty = Object.prototype.hasOwnProperty,\n isArrayImpl = Array.isArray,\n createTask = console.createTask\n ? console.createTask\n : function () {\n return null;\n };\n React = {\n react_stack_bottom_frame: function (callStackForError) {\n return callStackForError();\n }\n };\n var specialPropKeyWarningShown;\n var didWarnAboutElementRef = {};\n var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(\n React,\n UnknownOwner\n )();\n var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));\n var didWarnAboutKeySpread = {};\n exports.Fragment = REACT_FRAGMENT_TYPE;\n exports.jsx = function (type, config, maybeKey) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !1,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n exports.jsxs = function (type, config, maybeKey) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !0,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n })();\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\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 type { SDKConfig, IframeMessage } from './types';\n\nexport class SDK {\n private iframe: HTMLIFrameElement | null = null;\n private iframeUrl: string;\n private config: SDKConfig;\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\n constructor(config: SDKConfig) {\n this.config = config;\n this.iframeUrl = config.iframeUrl || 'http://localhost:3000/iframe/checkout';\n this.environment = this.getEnvironmentFromApiKey(config.apiKey || '');\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\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 this.sendConfigToIframe();\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 as query parameters\n const url = new URL(this.iframeUrl);\n if (this.config.apiKey) {\n url.searchParams.set('apiKey', this.config.apiKey);\n }\n if (this.config.config?.paymentId) {\n url.searchParams.set('paymentId', this.config.config.paymentId);\n }\n const iframeSrc = url.toString();\n\n if (this.usePopup) {\n // Create overlay for popup mode\n const overlay = document.createElement('div');\n overlay.id = 'inflowpay-sdk-overlay';\n overlay.style.cssText = `\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: 999999;\n `;\n\n // Create iframe container\n const container = document.createElement('div');\n container.style.cssText = `\n position: relative;\n width: 90%;\n max-width: 500px;\n height: 90%;\n max-height: 600px;\n background: white;\n border-radius: 8px;\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);\n `;\n\n // Create close button\n const closeButton = document.createElement('button');\n closeButton.innerHTML = '×';\n closeButton.style.cssText = `\n position: absolute;\n top: 10px;\n right: 10px;\n width: 30px;\n height: 30px;\n border: none;\n background: transparent;\n font-size: 24px;\n cursor: pointer;\n z-index: 1000000;\n color: #333;\n display: flex;\n align-items: center;\n justify-content: center;\n `;\n closeButton.onclick = () => this.close();\n\n // Create iframe\n this.iframe = document.createElement('iframe');\n this.iframe.src = iframeSrc;\n this.iframe.style.cssText = `\n width: 100%;\n height: 100%;\n border: none;\n border-radius: 8px;\n `;\n this.iframe.setAttribute('allow', 'payment');\n\n // Assemble structure\n container.appendChild(closeButton);\n container.appendChild(this.iframe);\n overlay.appendChild(container);\n document.body.appendChild(overlay);\n\n // Close on overlay click (but not on container click)\n overlay.addEventListener('click', (e) => {\n if (e.target === overlay) {\n this.close();\n }\n });\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 = '300px';\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 = `\n width: 100%;\n height: 100%;\n min-height: 300px;\n border: none;\n display: block;\n `;\n this.iframe.setAttribute('allow', 'payment');\n\n // Append to container\n this.containerElement.appendChild(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.api.inflowpay.com' ||\n event.origin === 'https://pre-prod.api.inflowpay.xyz' ||\n event.origin === 'https://api.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 '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 }\n if (data.threeDsSessionUrl) {\n if (this.config.debug) {\n console.log('[SDK] Opening 3DS modal...');\n }\n this.open3DSModal(data.threeDsSessionUrl).then((success) => {\n if (this.config.debug) {\n console.log('[SDK] 3DS modal closed, result:', success);\n }\n if (this.iframe && this.iframe.contentWindow) {\n const targetOrigin = this.getTargetOrigin();\n this.iframe.contentWindow.postMessage({\n type: '3ds-result',\n success: success,\n paymentId: data.paymentId || this.config.config?.paymentId,\n }, targetOrigin);\n }\n });\n } else {\n if (this.config.debug) {\n console.error('[SDK] 3DS required but no threeDsSessionUrl provided');\n }\n }\n break;\n \n default:\n if (this.config.debug) {\n console.log('SDK: Received message:', data);\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 apiKey: this.config.apiKey,\n },\n };\n\n const targetOrigin = this.getTargetOrigin();\n this.iframe.contentWindow.postMessage(message, targetOrigin);\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 // 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 const overlay = document.getElementById('inflowpay-sdk-overlay');\n if (overlay) {\n overlay.remove();\n }\n } else {\n // Clear container\n if (this.containerElement && this.iframe) {\n this.containerElement.removeChild(this.iframe);\n }\n }\n\n this.iframe = null;\n }\n\n /**\n * Open 3DS authentication modal\n * Called when iframe requests 3DS authentication\n */\n private open3DSModal(challengeUrl: string): Promise<boolean> {\n if (this.config.debug) {\n console.log('[SDK] open3DSModal called with URL:', challengeUrl);\n }\n return new Promise((resolve) => {\n // Create overlay\n const overlay = document.createElement('div');\n overlay.id = 'inflowpay-3ds-overlay';\n overlay.style.cssText = `\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: 999999;\n `;\n\n // Create modal\n const modal = document.createElement('div');\n modal.style.cssText = `\n position: relative;\n width: 90%;\n max-width: 500px;\n height: 90%;\n max-height: 600px;\n background: white;\n border-radius: 8px;\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);\n display: flex;\n flex-direction: column;\n `;\n\n // Create header\n const header = document.createElement('div');\n header.style.cssText = `\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 15px 20px;\n border-bottom: 1px solid #e5e5e5;\n `;\n header.innerHTML = `\n <h3 style=\"margin: 0; font-size: 18px; font-weight: 600;\">Secure Payment Authentication</h3>\n <button id=\"inflowpay-3ds-close\" style=\"background: none; border: none; font-size: 24px; cursor: pointer; padding: 0; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; color: #333;\">×</button>\n `;\n\n // Create content with iframe\n const content = document.createElement('div');\n content.style.cssText = `\n flex: 1;\n position: relative;\n overflow: hidden;\n `;\n const iframe = document.createElement('iframe');\n iframe.src = challengeUrl;\n iframe.style.cssText = `\n width: 100%;\n height: 100%;\n border: none;\n `;\n iframe.setAttribute('allow', 'payment');\n iframe.setAttribute('sandbox', 'allow-forms allow-scripts allow-same-origin allow-popups');\n content.appendChild(iframe);\n\n modal.appendChild(header);\n modal.appendChild(content);\n overlay.appendChild(modal);\n document.body.appendChild(overlay);\n\n // Close button handler\n const closeBtn = overlay.querySelector('#inflowpay-3ds-close');\n const closeHandler = () => {\n overlay.remove();\n window.removeEventListener('message', messageHandler);\n resolve(false);\n };\n closeBtn?.addEventListener('click', closeHandler);\n\n const messageHandler = (event: MessageEvent) => {\n if (!event.data) return;\n\n const allowed3DSOrigins = [\n 'https://dev.api.inflowpay.com',\n 'https://pre-prod.api.inflowpay.xyz',\n 'https://api.inflowpay.xyz',\n ];\n \n if (this.environment === 'sandbox' || this.environment === 'development') {\n if (event.origin.includes('localhost') || event.origin.includes('127.0.0.1')) {\n // Allow localhost in dev/sandbox\n } else if (!allowed3DSOrigins.includes(event.origin)) {\n if (this.config.debug) {\n console.warn('[SDK] Rejected 3DS message from unauthorized origin:', event.origin);\n }\n return;\n }\n } else {\n if (!allowed3DSOrigins.includes(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\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 * 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 * Detect environment from API key\n */\n private getEnvironmentFromApiKey(apiKey: string): 'sandbox' | 'production' | 'development' | 'preprod' {\n if (!apiKey) return 'sandbox';\n if (apiKey.includes('_local_') || apiKey.startsWith('inflow_local_')) {\n return 'sandbox';\n } else if (apiKey.includes('_prod_') && !apiKey.includes('_preprod_')) {\n return 'production';\n } else if (apiKey.includes('_preprod_') || apiKey.startsWith('inflow_preprod_')) {\n return 'preprod';\n } else if (apiKey.includes('_dev_')) {\n return 'development';\n }\n return 'sandbox';\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 type { SDKConfig } from './types';\nimport { SDK } from './sdk';\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: { status: string; data?: any; error?: any }) => void;\n /** Callback when payment fails */\n onError?: (error: any) => void;\n /** Callback when user closes the payment */\n onClose?: () => void;\n}\n\ninterface InternalSDKConfig {\n apiKey: string;\n iframeUrl: string;\n timeout: number;\n debug: boolean;\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 iframeUrl: config.iframeUrl,\n apiKey: config.apiKey,\n container: this.container,\n config: {\n paymentId: options.paymentId,\n },\n onSuccess: (data) => {\n if (options.onComplete) {\n options.onComplete({\n status: data?.data?.transaction?.status || 'CHECKOUT_SUCCESS',\n data: data,\n });\n }\n },\n onError: (error) => {\n if (options.onError) {\n options.onError(error);\n } else if (options.onComplete) {\n options.onComplete({\n status: 'PAYMENT_FAILED',\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 type { SDKConfig, PaymentConfig } from './types';\nimport { CardElement } from './card-element';\n\nexport interface PaymentSDKConfig {\n /** Public API key */\n apiKey: string;\n /** Backend API URL (optional, auto-detected from API key) */\n iframeUrl?: string;\n /** Request timeout in milliseconds (default: 30000) */\n timeout?: number;\n /** Enable debug logging (default: false, only allowed in local/dev environments) */\n debug?: boolean;\n}\n\nexport class PaymentSDK {\n private config: PaymentSDKConfig & { iframeUrl: string; timeout: number; 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.apiKey || typeof config.apiKey !== 'string') {\n throw new Error('API key is required');\n }\n\n // Auto-detect iframe URL from API key if not provided\n let iframeUrl = config.iframeUrl;\n const environment = this.getEnvironmentFromApiKey(config.apiKey);\n \n if (!iframeUrl) {\n if (environment === 'production') {\n iframeUrl = 'https://api.inflowpay.xyz/iframe/checkout';\n } else if (environment === 'preprod') {\n iframeUrl = 'https://pre-prod.api.inflowpay.xyz/iframe/checkout';\n } else if (environment === 'development') {\n iframeUrl = 'https://dev.api.inflowpay.com/iframe/checkout';\n } else {\n // sandbox/local\n iframeUrl = 'http://localhost:3000/iframe/checkout';\n }\n }\n\n // Validate debug mode - only allowed in local/dev environments\n const requestedDebug = config.debug ?? false;\n if (requestedDebug && (environment === 'production' || environment === 'preprod')) {\n console.warn('[InflowPay SDK] Debug mode is not allowed in production/pre-prod environments. Debug mode disabled.');\n }\n const debug = requestedDebug && (environment === 'sandbox' || environment === 'development');\n\n this.config = {\n apiKey: config.apiKey,\n iframeUrl,\n timeout: config.timeout ?? 30000,\n debug,\n };\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 onComplete?: (result: { status: string; data?: any; error?: any }) => void;\n onError?: (error: any) => void;\n onClose?: () => void;\n }): CardElement {\n return new CardElement(this.config, options);\n }\n\n /**\n * Get the iframe URL being used\n */\n getIframeUrl(): string {\n return this.config.iframeUrl;\n }\n\n /**\n * Get the API key\n */\n getApiKey(): string {\n return this.config.apiKey;\n }\n\n /**\n * Auto-detect environment from API key\n */\n private getEnvironmentFromApiKey(apiKey: string): 'sandbox' | 'production' | 'development' | 'preprod' {\n if (apiKey.includes('_local_') || apiKey.startsWith('inflow_local_')) {\n return 'sandbox';\n } else if (apiKey.includes('_prod_') && !apiKey.includes('_preprod_')) {\n return 'production';\n } else if (apiKey.includes('_preprod_') || apiKey.startsWith('inflow_preprod_')) {\n return 'preprod';\n } else if (apiKey.includes('_dev_')) {\n return 'development';\n }\n return 'sandbox';\n }\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 React, { createContext, ReactNode, useContext, useEffect, useRef, useState } from 'react';\nimport type { CardElementOptions } from '../card-element';\nimport { CardElement as CardElementClass } from '../card-element';\nimport type { PaymentSDKConfig } from '../payment-sdk';\nimport { PaymentSDK } from '../payment-sdk';\n\nexport interface SDKConfig {\n apiKey: string;\n iframeUrl?: string;\n timeout?: number;\n /** Enable debug logging (default: false, only allowed in local/dev environments) */\n debug?: boolean;\n}\n\nexport interface PaymentResult {\n status: string;\n data?: any;\n alreadyProcessed?: boolean;\n error?: {\n code: string;\n message: string;\n retryable: boolean;\n };\n}\n\nexport interface PaymentError {\n code: string;\n message: string;\n retryable: boolean;\n}\n\nexport interface CardElementState {\n complete: boolean;\n}\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 buttonText?: string;\n buttonStyle?: any;\n style?: any;\n placeholders?: {\n cardNumber?: string;\n expiry?: string;\n cvc?: string;\n };\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 apiKey: config.apiKey,\n iframeUrl: config.iframeUrl,\n timeout: config.timeout,\n debug: config.debug,\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({\n paymentId,\n onReady,\n onChange,\n onComplete,\n onError,\n buttonText,\n buttonStyle,\n style,\n placeholders,\n config: propConfig,\n}: CardElementProps & { config?: SDKConfig }) {\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 apiKey: propConfig.apiKey,\n iframeUrl: propConfig.iframeUrl,\n timeout: propConfig.timeout,\n debug: propConfig.debug,\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 || mounted) {\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 onComplete: (result) => {\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: 'PAYMENT_FAILED',\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, mounted, onComplete, onError, onReady]);\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: '100%',\n minHeight: '300px',\n position: 'relative',\n ...style,\n }}\n />\n );\n}\n"],"names":["REACT_ELEMENT_TYPE","REACT_FRAGMENT_TYPE","jsxProd","type","config","maybeKey","key","propName","reactJsxRuntime_production","getComponentNameFromType","REACT_CLIENT_REFERENCE","REACT_PROFILER_TYPE","REACT_STRICT_MODE_TYPE","REACT_SUSPENSE_TYPE","REACT_SUSPENSE_LIST_TYPE","REACT_ACTIVITY_TYPE","REACT_PORTAL_TYPE","REACT_CONTEXT_TYPE","REACT_CONSUMER_TYPE","REACT_FORWARD_REF_TYPE","innerType","REACT_MEMO_TYPE","REACT_LAZY_TYPE","testStringCoercion","value","checkKeyStringCoercion","JSCompiler_inline_result","JSCompiler_temp_const","JSCompiler_inline_result$jscomp$0","getTaskName","name","getOwner","dispatcher","ReactSharedInternals","UnknownOwner","hasValidKey","hasOwnProperty","getter","defineKeyPropWarningGetter","props","displayName","warnAboutAccessingKey","specialPropKeyWarningShown","elementRefGetterWithDeprecationWarning","componentName","didWarnAboutElementRef","ReactElement","owner","debugStack","debugTask","refProp","jsxDEVImpl","isStaticChildren","children","isArrayImpl","validateChildKeys","keys","k","didWarnAboutKeySpread","node","isValidElement","object","React","require$$0","createTask","callStackForError","unknownOwnerDebugStack","unknownOwnerDebugTask","reactJsxRuntime_development","trackActualOwner","jsxRuntimeModule","require$$1","SDK","url","iframeSrc","overlay","container","closeButton","e","currentStyle","event","allowedOrigin","isAllowedOrigin","data","success","targetOrigin","message","challengeUrl","resolve","modal","header","content","iframe","closeBtn","closeHandler","messageHandler","allowed3DSOrigins","is3DSComplete","isSuccess","isFailure","apiKey","CardElement$1","options","containerElement","error","PaymentSDK","iframeUrl","environment","requestedDebug","debug","CardElement","InflowPayContext","createContext","InflowPayProvider","sdk","useState","sdkConfig","jsx","useInflowPay","context","useContext","paymentId","onReady","onChange","onComplete","onError","buttonText","buttonStyle","style","placeholders","propConfig","containerRef","useRef","cardElementRef","mounted","setMounted","useEffect","cardElementOptions","result","cardElement","timer"],"mappings":"0UAWA,IAAIA,EAAqB,OAAO,IAAI,4BAA4B,EAC9DC,EAAsB,OAAO,IAAI,gBAAgB,EACnD,SAASC,EAAQC,EAAMC,EAAQC,EAAU,CACvC,IAAIC,EAAM,KAGV,GAFWD,IAAX,SAAwBC,EAAM,GAAKD,GACxBD,EAAO,MAAlB,SAA0BE,EAAM,GAAKF,EAAO,KACxC,QAASA,EAAQ,CACnBC,EAAW,CAAA,EACX,QAASE,KAAYH,EACTG,IAAV,QAAuBF,EAASE,CAAQ,EAAIH,EAAOG,CAAQ,EACjE,MAAS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OACP,UAAW,QACX,SAAU,WACV,GAAGH,CAAA,CACL,CAAA,CAGN","x_google_ignoreList":[0,1,2]}
package/dist/sdk.d.ts ADDED
@@ -0,0 +1,93 @@
1
+ declare interface PaymentConfig {
2
+ name?: string;
3
+ amount?: number;
4
+ currency?: string;
5
+ paymentId?: string;
6
+ [key: string]: any;
7
+ }
8
+
9
+ export declare class SDK {
10
+ private iframe;
11
+ private iframeUrl;
12
+ private config;
13
+ private messageListener;
14
+ private containerElement;
15
+ private usePopup;
16
+ private environment;
17
+ constructor(config: SDKConfig);
18
+ /**
19
+ * Initialize and open the payment iframe
20
+ */
21
+ init(): void;
22
+ /**
23
+ * Create and append the iframe to the document
24
+ */
25
+ private createIframe;
26
+ /**
27
+ * Add message listener for communication with iframe
28
+ */
29
+ private addMessageListener;
30
+ /**
31
+ * Send configuration to the iframe
32
+ */
33
+ private sendConfigToIframe;
34
+ /**
35
+ * Close the iframe and cleanup
36
+ */
37
+ private close;
38
+ /**
39
+ * Open 3DS authentication modal
40
+ * Called when iframe requests 3DS authentication
41
+ */
42
+ private open3DSModal;
43
+ /**
44
+ * Get target origin for postMessage based on environment
45
+ * In production/pre-prod: use exact origin for security
46
+ * In dev/sandbox: use wildcard for development flexibility
47
+ */
48
+ private getTargetOrigin;
49
+ /**
50
+ * Detect environment from API key
51
+ */
52
+ private getEnvironmentFromApiKey;
53
+ /**
54
+ * Public method to close the iframe
55
+ */
56
+ destroy(): void;
57
+ }
58
+
59
+ /**
60
+ * Type definitions for SDK v2
61
+ */
62
+ declare interface SDKConfig {
63
+ /** URL of the payment application to load in iframe */
64
+ iframeUrl?: string;
65
+ /** Public API key */
66
+ apiKey?: string;
67
+ /** Payment configuration */
68
+ config?: PaymentConfig;
69
+ /** Container element or selector where to mount the iframe (if not provided, creates a popup) */
70
+ container?: string | HTMLElement;
71
+ /** Callback when payment succeeds */
72
+ onSuccess?: (data: TransactionData) => void;
73
+ /** Callback when payment fails */
74
+ onError?: (error: any) => void;
75
+ /** Callback when user closes the payment modal */
76
+ onClose?: () => void;
77
+ /** Enable debug logging (default: false, only allowed in local/dev environments) */
78
+ debug?: boolean;
79
+ }
80
+
81
+ declare interface TransactionData {
82
+ transaction?: {
83
+ id: string;
84
+ amount: number;
85
+ currency: string;
86
+ status: string;
87
+ created_at: string;
88
+ [key: string]: any;
89
+ };
90
+ [key: string]: any;
91
+ }
92
+
93
+ export { }