@inflow_pay/sdk 0.7.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/sdk.d.ts CHANGED
@@ -37,11 +37,7 @@ export declare interface CardElementOptions {
37
37
  /** Payment ID for this transaction */
38
38
  paymentId: string;
39
39
  /** Callback when payment completes */
40
- onComplete?: (result: {
41
- status: string;
42
- data?: any;
43
- error?: any;
44
- }) => void;
40
+ onComplete?: (result: PaymentResult) => void;
45
41
  /** Callback when payment fails */
46
42
  onError?: (error: any) => void;
47
43
  /** Callback when user closes the payment */
@@ -56,16 +52,14 @@ export declare interface CardElementOptions {
56
52
  expiry?: string;
57
53
  cvc?: string;
58
54
  };
55
+ /** Show default success UI after payment (default true). If false, only unmount iframe. */
56
+ showDefaultSuccessUI?: boolean;
59
57
  }
60
58
 
61
59
  export declare interface CardElementProps {
62
60
  paymentId: string;
63
61
  container?: string | HTMLElement;
64
- onComplete?: (result: {
65
- status: string;
66
- data?: any;
67
- error?: any;
68
- }) => void;
62
+ onComplete?: (result: PaymentResult) => void;
69
63
  onError?: (error: any) => void;
70
64
  onClose?: () => void;
71
65
  onReady?: () => void;
@@ -82,9 +76,9 @@ export declare interface CardElementProps {
82
76
  };
83
77
  }
84
78
 
85
- export declare type CardElementState = {
79
+ export declare interface CardElementState {
86
80
  complete: boolean;
87
- };
81
+ }
88
82
 
89
83
  declare interface CSSProperties {
90
84
  fontFamily?: FontFamily;
@@ -99,9 +93,6 @@ declare interface CSSProperties {
99
93
  dark?: ThemeStyles;
100
94
  }
101
95
 
102
- /**
103
- * Type definitions for SDK v2
104
- */
105
96
  declare type FontFamily = 'DM Sans' | 'Inter' | 'Poppins' | 'Nunito' | 'Work Sans' | 'Manrope' | 'Rubik' | 'Karla' | 'Figtree' | 'Outfit' | 'Space Grotesk' | 'Urbanist';
106
97
 
107
98
  declare type FontWeight = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 'normal' | 'bold' | 'lighter' | 'bolder';
@@ -114,16 +105,6 @@ declare interface GeneralMessageStyles {
114
105
  borderColor?: string;
115
106
  }
116
107
 
117
- export declare interface IframeMessage {
118
- type: 'sdkData' | 'success' | 'error' | 'close' | '3ds-required' | '3ds-result' | 'iframe-ready' | 'content-height';
119
- data?: any;
120
- config?: PaymentConfig;
121
- threeDsSessionUrl?: string;
122
- paymentId?: string;
123
- success?: boolean;
124
- height?: number;
125
- }
126
-
127
108
  /**
128
109
  * InflowPayProvider - Global SDK configuration
129
110
  *
@@ -166,11 +147,8 @@ export declare class InflowPayProvider {
166
147
  }
167
148
 
168
149
  export declare interface InflowPayProviderConfig {
169
- apiKey: string;
170
- iframeUrl?: string;
171
- timeout?: number;
172
- /** Enable debug logging (default: false, only allowed in local/dev environments) */
173
- debug?: boolean;
150
+ publicKey: string;
151
+ locale?: Locale;
174
152
  }
175
153
 
176
154
  declare interface InputContainerStyles {
@@ -190,12 +168,18 @@ declare interface InputStyles {
190
168
  }
191
169
 
192
170
  declare interface InternalSDKConfig {
193
- apiKey: string;
171
+ publicKey: string;
194
172
  iframeUrl: string;
195
173
  timeout: number;
196
174
  debug: boolean;
175
+ locale?: Locale;
197
176
  }
198
177
 
178
+ /**
179
+ * Type definitions for SDK v2
180
+ */
181
+ declare type Locale = 'en' | 'de' | 'es' | 'fr' | 'it' | 'nl' | 'pl' | 'pt';
182
+
199
183
  declare type Opacity = number | string;
200
184
 
201
185
  export declare interface PaymentConfig {
@@ -213,27 +197,38 @@ export declare interface PaymentConfig {
213
197
  expiry?: string;
214
198
  cvc?: string;
215
199
  };
200
+ /** Show default success UI after payment (default true). If false, only unmount iframe. */
201
+ showDefaultSuccessUI?: boolean;
216
202
  [key: string]: any;
217
203
  }
218
204
 
219
- export declare type PaymentError = {
220
- code: string;
205
+ export declare interface PaymentError {
206
+ code: PaymentResultErrorCode;
221
207
  message: string;
222
208
  retryable: boolean;
223
- };
209
+ }
224
210
 
225
- export declare type PaymentResult = {
226
- status: string;
227
- data?: any;
228
- error?: {
229
- code: string;
230
- message: string;
231
- retryable: boolean;
232
- };
233
- };
211
+ export declare interface PaymentResult {
212
+ status: PaymentResultStatus;
213
+ paymentId: string;
214
+ error?: PaymentError;
215
+ }
216
+
217
+ export declare enum PaymentResultErrorCode {
218
+ THREE_DS_FAILED = "THREE_DS_FAILED",
219
+ PAYMENT_PROCESSING_ERROR = "PAYMENT_PROCESSING_ERROR"
220
+ }
221
+
222
+ export declare enum PaymentResultStatus {
223
+ SUCCESS = "SUCCESS",
224
+ FAILED = "FAILED"
225
+ }
234
226
 
235
227
  export declare class PaymentSDK {
236
228
  private config;
229
+ private iframeUrl;
230
+ private timeout;
231
+ private debug;
237
232
  /**
238
233
  * Initialize the InflowPay Payment SDK
239
234
  *
@@ -278,11 +273,7 @@ export declare class PaymentSDK {
278
273
  expiry?: string;
279
274
  cvc?: string;
280
275
  };
281
- onComplete?: (result: {
282
- status: string;
283
- data?: any;
284
- error?: any;
285
- }) => void;
276
+ onComplete?: (result: PaymentResult) => void;
286
277
  onError?: (error: any) => void;
287
278
  onClose?: () => void;
288
279
  }): CardElement;
@@ -294,109 +285,13 @@ export declare class PaymentSDK {
294
285
  * Get the API key
295
286
  */
296
287
  getApiKey(): string;
297
- /**
298
- * Auto-detect environment from API key
299
- */
300
- private getEnvironmentFromApiKey;
301
288
  }
302
289
 
303
290
  export declare interface PaymentSDKConfig {
304
291
  /** Public API key */
305
- apiKey: string;
306
- /** Backend API URL (optional, auto-detected from API key) */
307
- iframeUrl?: string;
308
- /** Request timeout in milliseconds (default: 30000) */
309
- timeout?: number;
310
- /** Enable debug logging (default: false, only allowed in local/dev environments) */
311
- debug?: boolean;
312
- }
313
-
314
- export declare enum PaymentStatus {
315
- INITIATION = "INITIATION",
316
- CHECKOUT_PENDING = "CHECKOUT_PENDING",
317
- CHECKOUT_SUCCESS = "CHECKOUT_SUCCESS",
318
- CHECKOUT_CANCELED = "CHECKOUT_CANCELED",
319
- CANCELED = "CANCELED",
320
- PAYMENT_RECEIVED = "PAYMENT_RECEIVED",
321
- PAYMENT_SUCCESS = "PAYMENT_SUCCESS",
322
- PAYMENT_FAILED = "PAYMENT_FAILED"
323
- }
324
-
325
- export declare class SDK {
326
- private iframe;
327
- private iframeUrl;
328
- private config;
329
- private messageListener;
330
- private containerElement;
331
- private usePopup;
332
- private environment;
333
- constructor(config: SDKConfig);
334
- /**
335
- * Initialize and open the payment iframe
336
- */
337
- init(): void;
338
- /**
339
- * Create and append the iframe to the document
340
- */
341
- private createIframe;
342
- /**
343
- * Add message listener for communication with iframe
344
- */
345
- private addMessageListener;
346
- /**
347
- * Send configuration to the iframe
348
- */
349
- private sendConfigToIframe;
350
- /**
351
- * Show skeleton loader while iframe is connecting
352
- */
353
- private showLoader;
354
- /**
355
- * Hide loader
356
- */
357
- private hideLoader;
358
- /**
359
- * Close the iframe and cleanup
360
- */
361
- private close;
362
- /**
363
- * Open 3DS authentication modal
364
- * Called when iframe requests 3DS authentication
365
- */
366
- private open3DSModal;
367
- /**
368
- * Get target origin for postMessage based on environment
369
- * In production/pre-prod: use exact origin for security
370
- * In dev/sandbox: use wildcard for development flexibility
371
- */
372
- private getTargetOrigin;
373
- /**
374
- * Detect environment from API key
375
- */
376
- private getEnvironmentFromApiKey;
377
- /**
378
- * Public method to close the iframe
379
- */
380
- destroy(): void;
381
- }
382
-
383
- declare interface SDKConfig {
384
- /** URL of the payment application to load in iframe */
385
- iframeUrl?: string;
386
- /** Public API key */
387
- apiKey?: string;
388
- /** Payment configuration */
389
- config?: PaymentConfig;
390
- /** Container element or selector where to mount the iframe (if not provided, creates a popup) */
391
- container?: string | HTMLElement;
392
- /** Callback when payment succeeds */
393
- onSuccess?: (data: TransactionData) => void;
394
- /** Callback when payment fails */
395
- onError?: (error: any) => void;
396
- /** Callback when user closes the payment modal */
397
- onClose?: () => void;
398
- /** Enable debug logging (default: false, only allowed in local/dev environments) */
399
- debug?: boolean;
292
+ publicKey: string;
293
+ /** Locale for the UI. Defaults to 'en' */
294
+ locale?: Locale;
400
295
  }
401
296
 
402
297
  declare interface ThemeStyles {
@@ -409,18 +304,6 @@ declare interface ThemeStyles {
409
304
  generalSuccess?: GeneralMessageStyles;
410
305
  }
411
306
 
412
- export declare interface TransactionData {
413
- transaction?: {
414
- id: string;
415
- amount: number;
416
- currency: string;
417
- status: string;
418
- created_at: string;
419
- [key: string]: any;
420
- };
421
- [key: string]: any;
422
- }
423
-
424
- export declare const VERSION = "0.7.0";
307
+ export declare const VERSION = "0.8.0";
425
308
 
426
309
  export { }
package/dist/sdk.esm.js CHANGED
@@ -1,14 +1,12 @@
1
- import { P as i } from "./payment-sdk-DK3VOIGL.mjs";
2
- import { C as m, S as f } from "./payment-sdk-DK3VOIGL.mjs";
1
+ import { P as l } from "./payment-sdk-oRqgQSx5.mjs";
2
+ import { C as s, a as y, b as f } from "./payment-sdk-oRqgQSx5.mjs";
3
3
  class d {
4
4
  constructor(e) {
5
- const C = {
6
- apiKey: e.config.apiKey,
7
- iframeUrl: e.config.iframeUrl,
8
- timeout: e.config.timeout,
9
- debug: e.config.debug
5
+ const n = {
6
+ publicKey: e.config.publicKey,
7
+ locale: e.config.locale
10
8
  };
11
- this.sdk = new i(C);
9
+ this.sdk = new l(n);
12
10
  }
13
11
  /**
14
12
  * Create a CardElement (similar to React's <CardElement />)
@@ -17,15 +15,15 @@ class d {
17
15
  * @returns CardElement instance
18
16
  */
19
17
  createCardElement(e) {
20
- let C;
18
+ let n;
21
19
  if (e.container)
22
- C = e.container;
20
+ n = e.container;
23
21
  else {
24
22
  const t = document.createElement("div");
25
- t.id = "inflowpay-card-element-container", document.body.appendChild(t), C = t;
23
+ t.id = "inflowpay-card-element-container", document.body.appendChild(t), n = t;
26
24
  }
27
- const o = {
28
- container: C,
25
+ const a = {
26
+ container: n,
29
27
  paymentId: e.paymentId,
30
28
  ...e.style && { style: e.style },
31
29
  ...e.buttonText && { buttonText: e.buttonText },
@@ -35,10 +33,10 @@ class d {
35
33
  },
36
34
  onError: e.onError,
37
35
  onClose: e.onClose
38
- }, E = this.sdk.createCardElement(o);
36
+ }, o = this.sdk.createCardElement(a);
39
37
  if (e.onReady) {
40
- const t = E.mount.bind(E);
41
- E.mount = () => {
38
+ const t = o.mount.bind(o);
39
+ o.mount = () => {
42
40
  t(), setTimeout(() => {
43
41
  e.onReady && e.onReady();
44
42
  }, 100);
@@ -46,7 +44,7 @@ class d {
46
44
  }
47
45
  return e.onChange && setTimeout(() => {
48
46
  e.onChange && e.onChange({ complete: !1 });
49
- }, 100), E;
47
+ }, 100), o;
50
48
  }
51
49
  /**
52
50
  * Get the underlying PaymentSDK instance
@@ -55,14 +53,13 @@ class d {
55
53
  return this.sdk;
56
54
  }
57
55
  }
58
- var l = /* @__PURE__ */ ((n) => (n.INITIATION = "INITIATION", n.CHECKOUT_PENDING = "CHECKOUT_PENDING", n.CHECKOUT_SUCCESS = "CHECKOUT_SUCCESS", n.CHECKOUT_CANCELED = "CHECKOUT_CANCELED", n.CANCELED = "CANCELED", n.PAYMENT_RECEIVED = "PAYMENT_RECEIVED", n.PAYMENT_SUCCESS = "PAYMENT_SUCCESS", n.PAYMENT_FAILED = "PAYMENT_FAILED", n))(l || {});
59
- const a = "0.7.0";
56
+ const m = "0.8.0";
60
57
  export {
61
- m as CardElement,
58
+ s as CardElement,
62
59
  d as InflowPayProvider,
63
- i as PaymentSDK,
64
- l as PaymentStatus,
65
- f as SDK,
66
- a as VERSION
60
+ y as PaymentResultErrorCode,
61
+ f as PaymentResultStatus,
62
+ l as PaymentSDK,
63
+ m as VERSION
67
64
  };
68
65
  //# sourceMappingURL=sdk.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.esm.js","sources":["../src/inflowpay-provider.ts","../src/index.ts"],"sourcesContent":["/**\n * InflowPayProvider - Compatibility layer for React SDK API\n * \n * Provides the same API structure as the original React SDK\n * but works with vanilla JavaScript\n */\n\nimport { PaymentSDK } from './payment-sdk';\nimport type { PaymentSDKConfig } from './payment-sdk';\nimport { CardElement } from './card-element';\nimport type { CardElementOptions } from './card-element';\n\nexport interface InflowPayProviderConfig {\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 CardElementProps {\n paymentId: string;\n container?: string | HTMLElement;\n onComplete?: (result: { status: string; data?: any; error?: any }) => void;\n onError?: (error: any) => void;\n onClose?: () => void;\n onReady?: () => void;\n onChange?: (state: { complete: boolean }) => void;\n buttonText?: string;\n buttonStyle?: any;\n style?: any;\n placeholders?: {\n cardNumber?: string;\n expiry?: string;\n cvc?: string;\n };\n}\n\n/**\n * InflowPayProvider - Global SDK configuration\n * \n * Similar to React's InflowPayProvider but for vanilla JS\n * \n * @example\n * ```typescript\n * const provider = new InflowPayProvider({\n * config: { apiKey: 'inflow_pub_xxx' }\n * });\n * \n * const cardElement = provider.createCardElement({\n * paymentId: 'pay_xxx',\n * onComplete: (result) => {\n * if (result.status === 'CHECKOUT_SUCCESS') {\n * window.location.href = '/success';\n * }\n * }\n * });\n * \n * cardElement.mount();\n * ```\n */\nexport class InflowPayProvider {\n private sdk: PaymentSDK;\n\n constructor(options: { config: InflowPayProviderConfig }) {\n const config: PaymentSDKConfig = {\n apiKey: options.config.apiKey,\n iframeUrl: options.config.iframeUrl,\n timeout: options.config.timeout,\n debug: options.config.debug,\n };\n\n this.sdk = new PaymentSDK(config);\n }\n\n /**\n * Create a CardElement (similar to React's <CardElement />)\n * \n * @param props - CardElement props (same as React SDK)\n * @returns CardElement instance\n */\n createCardElement(props: CardElementProps): CardElement {\n let container: string | HTMLElement;\n if (props.container) {\n container = props.container;\n } else {\n const defaultContainer = document.createElement('div');\n defaultContainer.id = 'inflowpay-card-element-container';\n document.body.appendChild(defaultContainer);\n container = defaultContainer;\n }\n\n const cardElementOptions: CardElementOptions = {\n container: container,\n paymentId: props.paymentId,\n ...(props.style && { style: props.style }),\n ...(props.buttonText && { buttonText: props.buttonText }),\n ...(props.placeholders && { placeholders: props.placeholders }),\n onComplete: (result) => {\n if (props.onComplete) {\n props.onComplete(result);\n }\n },\n onError: props.onError,\n onClose: props.onClose,\n };\n\n const cardElement = this.sdk.createCardElement(cardElementOptions);\n\n if (props.onReady) {\n const originalMount = cardElement.mount.bind(cardElement);\n cardElement.mount = () => {\n originalMount();\n setTimeout(() => {\n if (props.onReady) {\n props.onReady();\n }\n }, 100);\n };\n }\n\n if (props.onChange) {\n setTimeout(() => {\n if (props.onChange) {\n props.onChange({ complete: false });\n }\n }, 100);\n }\n\n return cardElement;\n }\n\n /**\n * Get the underlying PaymentSDK instance\n */\n getSDK(): PaymentSDK {\n return this.sdk;\n }\n}\n\n","/**\n * InflowPay SDK v2 - Entry point\n * \n * Provides the same API as the original React SDK but using iframe-based payment flow\n * Compatible with vanilla JavaScript and easy migration from React SDK\n */\n\nexport { InflowPayProvider } from './inflowpay-provider';\nexport type { InflowPayProviderConfig, CardElementProps } from './inflowpay-provider';\n\nexport { PaymentSDK } from './payment-sdk';\nexport type { PaymentSDKConfig } from './payment-sdk';\n\nexport { CardElement } from './card-element';\nexport type { CardElementOptions } from './card-element';\n\nexport { SDK } from './sdk';\n\nexport type { IframeMessage, PaymentConfig, TransactionData } from './types';\n\nexport enum PaymentStatus {\n INITIATION = 'INITIATION',\n CHECKOUT_PENDING = 'CHECKOUT_PENDING',\n CHECKOUT_SUCCESS = 'CHECKOUT_SUCCESS',\n CHECKOUT_CANCELED = 'CHECKOUT_CANCELED',\n CANCELED = 'CANCELED',\n PAYMENT_RECEIVED = 'PAYMENT_RECEIVED',\n PAYMENT_SUCCESS = 'PAYMENT_SUCCESS',\n PAYMENT_FAILED = 'PAYMENT_FAILED',\n}\n\nexport type PaymentResult = {\n status: string;\n data?: any;\n error?: {\n code: string;\n message: string;\n retryable: boolean;\n };\n};\n\nexport type PaymentError = {\n code: string;\n message: string;\n retryable: boolean;\n};\n\nexport type CardElementState = {\n complete: boolean;\n};\n\nexport const VERSION = '0.7.0';\n"],"names":["InflowPayProvider","options","config","PaymentSDK","props","container","defaultContainer","cardElementOptions","result","cardElement","originalMount","PaymentStatus","VERSION"],"mappings":";;AA6DO,MAAMA,EAAkB;AAAA,EAG7B,YAAYC,GAA8C;AACxD,UAAMC,IAA2B;AAAA,MAC/B,QAAQD,EAAQ,OAAO;AAAA,MACvB,WAAWA,EAAQ,OAAO;AAAA,MAC1B,SAASA,EAAQ,OAAO;AAAA,MACxB,OAAOA,EAAQ,OAAO;AAAA,IAAA;AAGxB,SAAK,MAAM,IAAIE,EAAWD,CAAM;AAAA,EAClC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,kBAAkBE,GAAsC;AACtD,QAAIC;AACJ,QAAID,EAAM;AACR,MAAAC,IAAYD,EAAM;AAAA,SACb;AACL,YAAME,IAAmB,SAAS,cAAc,KAAK;AACrD,MAAAA,EAAiB,KAAK,oCACtB,SAAS,KAAK,YAAYA,CAAgB,GAC1CD,IAAYC;AAAA,IACd;AAEA,UAAMC,IAAyC;AAAA,MAC7C,WAAAF;AAAA,MACA,WAAWD,EAAM;AAAA,MACjB,GAAIA,EAAM,SAAS,EAAE,OAAOA,EAAM,MAAA;AAAA,MAClC,GAAIA,EAAM,cAAc,EAAE,YAAYA,EAAM,WAAA;AAAA,MAC5C,GAAIA,EAAM,gBAAgB,EAAE,cAAcA,EAAM,aAAA;AAAA,MAChD,YAAY,CAACI,MAAW;AACtB,QAAIJ,EAAM,cACRA,EAAM,WAAWI,CAAM;AAAA,MAE3B;AAAA,MACA,SAASJ,EAAM;AAAA,MACf,SAASA,EAAM;AAAA,IAAA,GAGXK,IAAc,KAAK,IAAI,kBAAkBF,CAAkB;AAEjE,QAAIH,EAAM,SAAS;AACjB,YAAMM,IAAgBD,EAAY,MAAM,KAAKA,CAAW;AACxD,MAAAA,EAAY,QAAQ,MAAM;AACxB,QAAAC,EAAA,GACA,WAAW,MAAM;AACf,UAAIN,EAAM,WACRA,EAAM,QAAA;AAAA,QAEV,GAAG,GAAG;AAAA,MACR;AAAA,IACF;AAEA,WAAIA,EAAM,YACR,WAAW,MAAM;AACf,MAAIA,EAAM,YACRA,EAAM,SAAS,EAAE,UAAU,GAAA,CAAO;AAAA,IAEtC,GAAG,GAAG,GAGDK;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,SAAqB;AACnB,WAAO,KAAK;AAAA,EACd;AACF;ACtHO,IAAKE,sBAAAA,OACVA,EAAA,aAAa,cACbA,EAAA,mBAAmB,oBACnBA,EAAA,mBAAmB,oBACnBA,EAAA,oBAAoB,qBACpBA,EAAA,WAAW,YACXA,EAAA,mBAAmB,oBACnBA,EAAA,kBAAkB,mBAClBA,EAAA,iBAAiB,kBARPA,IAAAA,KAAA,CAAA,CAAA;AA+BL,MAAMC,IAAU;"}
1
+ {"version":3,"file":"sdk.esm.js","sources":["../src/inflowpay-provider.ts","../src/index.ts"],"sourcesContent":["/**\n * InflowPayProvider - Compatibility layer for React SDK API\n * \n * Provides the same API structure as the original React SDK\n * but works with vanilla JavaScript\n */\n\nimport type { CardElement, CardElementOptions } from './card-element';\nimport type { PaymentSDKConfig } from './payment-sdk';\nimport { PaymentSDK } from './payment-sdk';\nimport { PaymentResult } from './react';\nimport type { Locale } from './types';\n\nexport interface InflowPayProviderConfig {\n publicKey: string;\n locale?: Locale;\n}\n\nexport interface CardElementProps {\n paymentId: string;\n container?: string | HTMLElement;\n onComplete?: (result: PaymentResult) => void;\n onError?: (error: any) => void;\n onClose?: () => void;\n onReady?: () => void;\n onChange?: (state: { complete: boolean }) => void;\n buttonText?: string;\n buttonStyle?: any;\n style?: any;\n placeholders?: {\n cardNumber?: string;\n expiry?: string;\n cvc?: string;\n };\n}\n\n/**\n * InflowPayProvider - Global SDK configuration\n * \n * Similar to React's InflowPayProvider but for vanilla JS\n * \n * @example\n * ```typescript\n * const provider = new InflowPayProvider({\n * config: { apiKey: 'inflow_pub_xxx' }\n * });\n * \n * const cardElement = provider.createCardElement({\n * paymentId: 'pay_xxx',\n * onComplete: (result) => {\n * if (result.status === 'CHECKOUT_SUCCESS') {\n * window.location.href = '/success';\n * }\n * }\n * });\n * \n * cardElement.mount();\n * ```\n */\nexport class InflowPayProvider {\n private sdk: PaymentSDK;\n\n constructor(options: { config: InflowPayProviderConfig }) {\n const config: PaymentSDKConfig = {\n publicKey: options.config.publicKey,\n locale: options.config.locale,\n };\n\n this.sdk = new PaymentSDK(config);\n }\n\n /**\n * Create a CardElement (similar to React's <CardElement />)\n * \n * @param props - CardElement props (same as React SDK)\n * @returns CardElement instance\n */\n createCardElement(props: CardElementProps): CardElement {\n let container: string | HTMLElement;\n if (props.container) {\n container = props.container;\n } else {\n const defaultContainer = document.createElement('div');\n defaultContainer.id = 'inflowpay-card-element-container';\n document.body.appendChild(defaultContainer);\n container = defaultContainer;\n }\n\n const cardElementOptions: CardElementOptions = {\n container: container,\n paymentId: props.paymentId,\n ...(props.style && { style: props.style }),\n ...(props.buttonText && { buttonText: props.buttonText }),\n ...(props.placeholders && { placeholders: props.placeholders }),\n onComplete: (result) => {\n if (props.onComplete) {\n props.onComplete(result);\n }\n },\n onError: props.onError,\n onClose: props.onClose,\n };\n\n const cardElement = this.sdk.createCardElement(cardElementOptions);\n\n if (props.onReady) {\n const originalMount = cardElement.mount.bind(cardElement);\n cardElement.mount = () => {\n originalMount();\n setTimeout(() => {\n if (props.onReady) {\n props.onReady();\n }\n }, 100);\n };\n }\n\n if (props.onChange) {\n setTimeout(() => {\n if (props.onChange) {\n props.onChange({ complete: false });\n }\n }, 100);\n }\n\n return cardElement;\n }\n\n /**\n * Get the underlying PaymentSDK instance\n */\n getSDK(): PaymentSDK {\n return this.sdk;\n }\n}\n\n","/**\n * InflowPay SDK v2 - Entry point\n * \n * Provides the same API as the original React SDK but using iframe-based payment flow\n * Compatible with vanilla JavaScript and easy migration from React SDK\n */\n\nexport { InflowPayProvider } from './inflowpay-provider';\nexport type { CardElementProps, InflowPayProviderConfig } from './inflowpay-provider';\n\nexport { PaymentSDK } from './payment-sdk';\nexport type { PaymentSDKConfig } from './payment-sdk';\n\nexport { CardElement } from './card-element';\nexport type { CardElementOptions } from './card-element';\n\nexport type {\n CardElementState, PaymentConfig,\n PaymentError,\n PaymentResult\n} from './types';\n\nexport { PaymentResultErrorCode, PaymentResultStatus } from './types';\n\nexport const VERSION = '0.8.0';\n"],"names":["InflowPayProvider","options","config","PaymentSDK","props","container","defaultContainer","cardElementOptions","result","cardElement","originalMount","VERSION"],"mappings":";;AA2DO,MAAMA,EAAkB;AAAA,EAG7B,YAAYC,GAA8C;AACxD,UAAMC,IAA2B;AAAA,MAC/B,WAAWD,EAAQ,OAAO;AAAA,MAC1B,QAAQA,EAAQ,OAAO;AAAA,IAAA;AAGzB,SAAK,MAAM,IAAIE,EAAWD,CAAM;AAAA,EAClC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,kBAAkBE,GAAsC;AACtD,QAAIC;AACJ,QAAID,EAAM;AACR,MAAAC,IAAYD,EAAM;AAAA,SACb;AACL,YAAME,IAAmB,SAAS,cAAc,KAAK;AACrD,MAAAA,EAAiB,KAAK,oCACtB,SAAS,KAAK,YAAYA,CAAgB,GAC1CD,IAAYC;AAAA,IACd;AAEA,UAAMC,IAAyC;AAAA,MAC7C,WAAAF;AAAA,MACA,WAAWD,EAAM;AAAA,MACjB,GAAIA,EAAM,SAAS,EAAE,OAAOA,EAAM,MAAA;AAAA,MAClC,GAAIA,EAAM,cAAc,EAAE,YAAYA,EAAM,WAAA;AAAA,MAC5C,GAAIA,EAAM,gBAAgB,EAAE,cAAcA,EAAM,aAAA;AAAA,MAChD,YAAY,CAACI,MAAW;AACtB,QAAIJ,EAAM,cACRA,EAAM,WAAWI,CAAM;AAAA,MAE3B;AAAA,MACA,SAASJ,EAAM;AAAA,MACf,SAASA,EAAM;AAAA,IAAA,GAGXK,IAAc,KAAK,IAAI,kBAAkBF,CAAkB;AAEjE,QAAIH,EAAM,SAAS;AACjB,YAAMM,IAAgBD,EAAY,MAAM,KAAKA,CAAW;AACxD,MAAAA,EAAY,QAAQ,MAAM;AACxB,QAAAC,EAAA,GACA,WAAW,MAAM;AACf,UAAIN,EAAM,WACRA,EAAM,QAAA;AAAA,QAEV,GAAG,GAAG;AAAA,MACR;AAAA,IACF;AAEA,WAAIA,EAAM,YACR,WAAW,MAAM;AACf,MAAIA,EAAM,YACRA,EAAM,SAAS,EAAE,UAAU,GAAA,CAAO;AAAA,IAEtC,GAAG,GAAG,GAGDK;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,SAAqB;AACnB,WAAO,KAAK;AAAA,EACd;AACF;AC9GO,MAAME,IAAU;"}