@inflow_pay/sdk 0.8.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;
@@ -111,16 +105,6 @@ declare interface GeneralMessageStyles {
111
105
  borderColor?: string;
112
106
  }
113
107
 
114
- export declare interface IframeMessage {
115
- type: 'sdkData' | 'success' | 'error' | 'close' | '3ds-required' | '3ds-result' | 'iframe-ready' | 'content-height';
116
- data?: any;
117
- config?: PaymentConfig;
118
- threeDsSessionUrl?: string;
119
- paymentId?: string;
120
- success?: boolean;
121
- height?: number;
122
- }
123
-
124
108
  /**
125
109
  * InflowPayProvider - Global SDK configuration
126
110
  *
@@ -163,12 +147,8 @@ export declare class InflowPayProvider {
163
147
  }
164
148
 
165
149
  export declare interface InflowPayProviderConfig {
166
- apiKey: string;
167
- iframeUrl?: string;
168
- timeout?: number;
150
+ publicKey: string;
169
151
  locale?: Locale;
170
- /** Enable debug logging (default: false, only allowed in local/dev environments) */
171
- debug?: boolean;
172
152
  }
173
153
 
174
154
  declare interface InputContainerStyles {
@@ -188,7 +168,7 @@ declare interface InputStyles {
188
168
  }
189
169
 
190
170
  declare interface InternalSDKConfig {
191
- apiKey: string;
171
+ publicKey: string;
192
172
  iframeUrl: string;
193
173
  timeout: number;
194
174
  debug: boolean;
@@ -217,27 +197,38 @@ export declare interface PaymentConfig {
217
197
  expiry?: string;
218
198
  cvc?: string;
219
199
  };
200
+ /** Show default success UI after payment (default true). If false, only unmount iframe. */
201
+ showDefaultSuccessUI?: boolean;
220
202
  [key: string]: any;
221
203
  }
222
204
 
223
- export declare type PaymentError = {
224
- code: string;
205
+ export declare interface PaymentError {
206
+ code: PaymentResultErrorCode;
225
207
  message: string;
226
208
  retryable: boolean;
227
- };
209
+ }
228
210
 
229
- export declare type PaymentResult = {
230
- status: string;
231
- data?: any;
232
- error?: {
233
- code: string;
234
- message: string;
235
- retryable: boolean;
236
- };
237
- };
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
+ }
238
226
 
239
227
  export declare class PaymentSDK {
240
228
  private config;
229
+ private iframeUrl;
230
+ private timeout;
231
+ private debug;
241
232
  /**
242
233
  * Initialize the InflowPay Payment SDK
243
234
  *
@@ -282,11 +273,7 @@ export declare class PaymentSDK {
282
273
  expiry?: string;
283
274
  cvc?: string;
284
275
  };
285
- onComplete?: (result: {
286
- status: string;
287
- data?: any;
288
- error?: any;
289
- }) => void;
276
+ onComplete?: (result: PaymentResult) => void;
290
277
  onError?: (error: any) => void;
291
278
  onClose?: () => void;
292
279
  }): CardElement;
@@ -298,113 +285,13 @@ export declare class PaymentSDK {
298
285
  * Get the API key
299
286
  */
300
287
  getApiKey(): string;
301
- /**
302
- * Auto-detect environment from API key
303
- */
304
- private getEnvironmentFromApiKey;
305
288
  }
306
289
 
307
290
  export declare interface PaymentSDKConfig {
308
291
  /** Public API key */
309
- apiKey: string;
310
- /** Backend API URL (optional, auto-detected from API key) */
311
- iframeUrl?: string;
312
- /** Request timeout in milliseconds (default: 30000) */
313
- timeout?: number;
292
+ publicKey: string;
314
293
  /** Locale for the UI. Defaults to 'en' */
315
294
  locale?: Locale;
316
- /** Enable debug logging (default: false, only allowed in local/dev environments) */
317
- debug?: boolean;
318
- }
319
-
320
- export declare enum PaymentStatus {
321
- INITIATION = "INITIATION",
322
- CHECKOUT_PENDING = "CHECKOUT_PENDING",
323
- CHECKOUT_SUCCESS = "CHECKOUT_SUCCESS",
324
- CHECKOUT_CANCELED = "CHECKOUT_CANCELED",
325
- CANCELED = "CANCELED",
326
- PAYMENT_RECEIVED = "PAYMENT_RECEIVED",
327
- PAYMENT_SUCCESS = "PAYMENT_SUCCESS",
328
- PAYMENT_FAILED = "PAYMENT_FAILED"
329
- }
330
-
331
- export declare class SDK {
332
- private iframe;
333
- private iframeUrl;
334
- private config;
335
- private messageListener;
336
- private containerElement;
337
- private usePopup;
338
- private environment;
339
- constructor(config: SDKConfig);
340
- /**
341
- * Initialize and open the payment iframe
342
- */
343
- init(): void;
344
- /**
345
- * Create and append the iframe to the document
346
- */
347
- private createIframe;
348
- /**
349
- * Add message listener for communication with iframe
350
- */
351
- private addMessageListener;
352
- /**
353
- * Send configuration to the iframe
354
- */
355
- private sendConfigToIframe;
356
- /**
357
- * Show skeleton loader while iframe is connecting
358
- */
359
- private showLoader;
360
- /**
361
- * Hide loader
362
- */
363
- private hideLoader;
364
- /**
365
- * Close the iframe and cleanup
366
- */
367
- private close;
368
- /**
369
- * Open 3DS authentication modal
370
- * Called when iframe requests 3DS authentication
371
- */
372
- private open3DSModal;
373
- /**
374
- * Get target origin for postMessage based on environment
375
- * In production/pre-prod: use exact origin for security
376
- * In dev/sandbox: use wildcard for development flexibility
377
- */
378
- private getTargetOrigin;
379
- /**
380
- * Detect environment from API key
381
- */
382
- private getEnvironmentFromApiKey;
383
- /**
384
- * Public method to close the iframe
385
- */
386
- destroy(): void;
387
- }
388
-
389
- declare interface SDKConfig {
390
- /** URL of the payment application to load in iframe */
391
- iframeUrl?: string;
392
- /** Public API key */
393
- apiKey?: string;
394
- /** Payment configuration */
395
- config?: PaymentConfig;
396
- /** Container element or selector where to mount the iframe (if not provided, creates a popup) */
397
- container?: string | HTMLElement;
398
- /** Locale for the UI. Defaults to 'en' */
399
- locale?: Locale;
400
- /** Callback when payment succeeds */
401
- onSuccess?: (data: TransactionData) => void;
402
- /** Callback when payment fails */
403
- onError?: (error: any) => void;
404
- /** Callback when user closes the payment modal */
405
- onClose?: () => void;
406
- /** Enable debug logging (default: false, only allowed in local/dev environments) */
407
- debug?: boolean;
408
295
  }
409
296
 
410
297
  declare interface ThemeStyles {
@@ -417,18 +304,6 @@ declare interface ThemeStyles {
417
304
  generalSuccess?: GeneralMessageStyles;
418
305
  }
419
306
 
420
- export declare interface TransactionData {
421
- transaction?: {
422
- id: string;
423
- amount: number;
424
- currency: string;
425
- status: string;
426
- created_at: string;
427
- [key: string]: any;
428
- };
429
- [key: string]: any;
430
- }
431
-
432
307
  export declare const VERSION = "0.8.0";
433
308
 
434
309
  export { }
package/dist/sdk.esm.js CHANGED
@@ -1,15 +1,12 @@
1
- import { P as l } from "./payment-sdk-WqMhTy7u.mjs";
2
- import { C as f, S as m } from "./payment-sdk-WqMhTy7u.mjs";
3
- class a {
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
+ class d {
4
4
  constructor(e) {
5
- const t = {
6
- apiKey: e.config.apiKey,
7
- iframeUrl: e.config.iframeUrl,
8
- timeout: e.config.timeout,
9
- locale: e.config.locale,
10
- debug: e.config.debug
5
+ const n = {
6
+ publicKey: e.config.publicKey,
7
+ locale: e.config.locale
11
8
  };
12
- this.sdk = new l(t);
9
+ this.sdk = new l(n);
13
10
  }
14
11
  /**
15
12
  * Create a CardElement (similar to React's <CardElement />)
@@ -18,36 +15,36 @@ class a {
18
15
  * @returns CardElement instance
19
16
  */
20
17
  createCardElement(e) {
21
- let t;
18
+ let n;
22
19
  if (e.container)
23
- t = e.container;
20
+ n = e.container;
24
21
  else {
25
- const C = document.createElement("div");
26
- C.id = "inflowpay-card-element-container", document.body.appendChild(C), t = C;
22
+ const t = document.createElement("div");
23
+ t.id = "inflowpay-card-element-container", document.body.appendChild(t), n = t;
27
24
  }
28
- const o = {
29
- container: t,
25
+ const a = {
26
+ container: n,
30
27
  paymentId: e.paymentId,
31
28
  ...e.style && { style: e.style },
32
29
  ...e.buttonText && { buttonText: e.buttonText },
33
30
  ...e.placeholders && { placeholders: e.placeholders },
34
- onComplete: (C) => {
35
- e.onComplete && e.onComplete(C);
31
+ onComplete: (t) => {
32
+ e.onComplete && e.onComplete(t);
36
33
  },
37
34
  onError: e.onError,
38
35
  onClose: e.onClose
39
- }, E = this.sdk.createCardElement(o);
36
+ }, o = this.sdk.createCardElement(a);
40
37
  if (e.onReady) {
41
- const C = E.mount.bind(E);
42
- E.mount = () => {
43
- C(), setTimeout(() => {
38
+ const t = o.mount.bind(o);
39
+ o.mount = () => {
40
+ t(), setTimeout(() => {
44
41
  e.onReady && e.onReady();
45
42
  }, 100);
46
43
  };
47
44
  }
48
45
  return e.onChange && setTimeout(() => {
49
46
  e.onChange && e.onChange({ complete: !1 });
50
- }, 100), E;
47
+ }, 100), o;
51
48
  }
52
49
  /**
53
50
  * Get the underlying PaymentSDK instance
@@ -56,14 +53,13 @@ class a {
56
53
  return this.sdk;
57
54
  }
58
55
  }
59
- var i = /* @__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))(i || {});
60
- const d = "0.8.0";
56
+ const m = "0.8.0";
61
57
  export {
62
- f as CardElement,
63
- a as InflowPayProvider,
58
+ s as CardElement,
59
+ d as InflowPayProvider,
60
+ y as PaymentResultErrorCode,
61
+ f as PaymentResultStatus,
64
62
  l as PaymentSDK,
65
- i as PaymentStatus,
66
- m as SDK,
67
- d as VERSION
63
+ m as VERSION
68
64
  };
69
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 type { CardElement } from './card-element';\nimport type { CardElementOptions } from './card-element';\nimport type { Locale } from './types';\n\nexport interface InflowPayProviderConfig {\n apiKey: string;\n iframeUrl?: string;\n timeout?: number;\n locale?: Locale;\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 locale: options.config.locale,\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.8.0';\n"],"names":["InflowPayProvider","options","config","PaymentSDK","props","container","defaultContainer","cardElementOptions","result","cardElement","originalMount","PaymentStatus","VERSION"],"mappings":";;AA+DO,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,QAAQA,EAAQ,OAAO;AAAA,MACvB,OAAOA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AAa,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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