@yuno-payments/yuno-sdk-react-native 1.0.16 → 1.0.17-rc.10
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/README.md +795 -262
- package/YunoSdk.podspec +48 -0
- package/android/src/main/java/com/yunosdkreactnative/YunoSdkModule.kt +341 -0
- package/ios/YunoPaymentMethodsViewManager.m +10 -0
- package/ios/YunoPaymentMethodsViewManager.swift +324 -0
- package/ios/YunoSdk.m +42 -5
- package/ios/YunoSdk.swift +303 -70
- package/lib/commonjs/YunoPaymentMethods.js +9 -9
- package/lib/commonjs/YunoPaymentMethods.js.map +1 -1
- package/lib/commonjs/YunoSdk.js +184 -25
- package/lib/commonjs/YunoSdk.js.map +1 -1
- package/lib/commonjs/core/types/HeadlessTypes.js +20 -0
- package/lib/commonjs/core/types/HeadlessTypes.js.map +1 -0
- package/lib/module/YunoPaymentMethods.js +9 -9
- package/lib/module/YunoPaymentMethods.js.map +1 -1
- package/lib/module/YunoSdk.js +184 -25
- package/lib/module/YunoSdk.js.map +1 -1
- package/lib/module/core/types/HeadlessTypes.js +16 -0
- package/lib/module/core/types/HeadlessTypes.js.map +1 -0
- package/package.json +1 -1
- package/src/YunoPaymentMethods.tsx +17 -15
- package/src/YunoSdk.ts +216 -39
- package/src/core/types/HeadlessTypes.ts +110 -0
- package/src/core/types/OneTimeTokenInfo.ts +0 -1
- package/src/core/types/index.ts +17 -0
package/lib/commonjs/YunoSdk.js
CHANGED
|
@@ -6,20 +6,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.YunoSdk = void 0;
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
8
|
var _enums = require("./core/enums");
|
|
9
|
-
const LINKING_ERROR = `The package '@
|
|
9
|
+
const LINKING_ERROR = `The package '@yuno/yuno-sdk-react-native' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
10
10
|
ios: "- Run 'pod install'\n",
|
|
11
11
|
default: ''
|
|
12
12
|
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Devuelve el módulo nativo YunoSdk o lanza un error de linking
|
|
16
|
+
*/
|
|
17
|
+
function getYunoNative() {
|
|
18
|
+
const native = _reactNative.NativeModules.YunoSdk;
|
|
19
|
+
if (!native) {
|
|
15
20
|
throw new Error(LINKING_ERROR);
|
|
16
21
|
}
|
|
17
|
-
|
|
22
|
+
return native;
|
|
23
|
+
}
|
|
18
24
|
|
|
19
25
|
/**
|
|
20
|
-
*
|
|
26
|
+
* Devuelve un NativeEventEmitter para el módulo YunoSdk
|
|
27
|
+
* Se crea sólo cuando hace falta (no en top-level).
|
|
21
28
|
*/
|
|
22
|
-
|
|
29
|
+
function getYunoEventEmitter() {
|
|
30
|
+
const native = getYunoNative();
|
|
31
|
+
return new _reactNative.NativeEventEmitter(native);
|
|
32
|
+
}
|
|
23
33
|
|
|
24
34
|
/**
|
|
25
35
|
* Payment state event data.
|
|
@@ -64,10 +74,10 @@ class YunoSdk {
|
|
|
64
74
|
/**
|
|
65
75
|
* Marks the SDK as initialized without calling the native initialize method.
|
|
66
76
|
* This is useful when the SDK has been initialized from the native side (e.g., in MainActivity/YunoActivity).
|
|
67
|
-
*
|
|
77
|
+
*
|
|
68
78
|
* @param countryCode - ISO country code (e.g., 'US', 'BR', 'CO')
|
|
69
79
|
* @param language - Optional language setting (defaults to EN)
|
|
70
|
-
*
|
|
80
|
+
*
|
|
71
81
|
* @internal
|
|
72
82
|
*/
|
|
73
83
|
static markAsInitialized(countryCode = 'CO', language = _enums.YunoLanguage.EN) {
|
|
@@ -125,7 +135,7 @@ class YunoSdk {
|
|
|
125
135
|
// Store country code and language
|
|
126
136
|
this.countryCode = countryCode;
|
|
127
137
|
this.language = config.lang;
|
|
128
|
-
await
|
|
138
|
+
await getYunoNative().initialize(apiKey, countryCode, config, iosConfig, androidConfig);
|
|
129
139
|
this.isInitialized = true;
|
|
130
140
|
}
|
|
131
141
|
|
|
@@ -149,7 +159,7 @@ class YunoSdk {
|
|
|
149
159
|
...params,
|
|
150
160
|
countryCode: params.countryCode ?? this.getCountryCode()
|
|
151
161
|
};
|
|
152
|
-
return
|
|
162
|
+
return getYunoNative().enrollmentPayment(args);
|
|
153
163
|
}
|
|
154
164
|
|
|
155
165
|
/**
|
|
@@ -173,7 +183,7 @@ class YunoSdk {
|
|
|
173
183
|
static async startPaymentLite(params, countryCode) {
|
|
174
184
|
this.checkInitialized();
|
|
175
185
|
const code = countryCode ?? this.getCountryCode();
|
|
176
|
-
return
|
|
186
|
+
return getYunoNative().startPaymentLite(params, code);
|
|
177
187
|
}
|
|
178
188
|
|
|
179
189
|
/**
|
|
@@ -188,7 +198,7 @@ class YunoSdk {
|
|
|
188
198
|
*/
|
|
189
199
|
static async startPayment(showPaymentStatus = true) {
|
|
190
200
|
this.checkInitialized();
|
|
191
|
-
return
|
|
201
|
+
return getYunoNative().startPayment(showPaymentStatus);
|
|
192
202
|
}
|
|
193
203
|
|
|
194
204
|
/**
|
|
@@ -206,7 +216,7 @@ class YunoSdk {
|
|
|
206
216
|
static async continuePayment(checkoutSession, countryCode, showPaymentStatus = true) {
|
|
207
217
|
this.checkInitialized();
|
|
208
218
|
const code = countryCode ?? this.getCountryCode();
|
|
209
|
-
return
|
|
219
|
+
return getYunoNative().continuePayment(checkoutSession, code, showPaymentStatus);
|
|
210
220
|
}
|
|
211
221
|
|
|
212
222
|
/**
|
|
@@ -235,7 +245,7 @@ class YunoSdk {
|
|
|
235
245
|
...params,
|
|
236
246
|
countryCode: params.countryCode ?? this.getCountryCode()
|
|
237
247
|
};
|
|
238
|
-
const statusString = await
|
|
248
|
+
const statusString = await getYunoNative().startPaymentSeamlessLite(args, this.getLanguage());
|
|
239
249
|
return statusString;
|
|
240
250
|
}
|
|
241
251
|
|
|
@@ -249,7 +259,7 @@ class YunoSdk {
|
|
|
249
259
|
*/
|
|
250
260
|
static async hideLoader() {
|
|
251
261
|
this.checkInitialized();
|
|
252
|
-
return
|
|
262
|
+
return getYunoNative().hideLoader();
|
|
253
263
|
}
|
|
254
264
|
|
|
255
265
|
/**
|
|
@@ -272,7 +282,7 @@ class YunoSdk {
|
|
|
272
282
|
return;
|
|
273
283
|
}
|
|
274
284
|
this.checkInitialized();
|
|
275
|
-
return
|
|
285
|
+
return getYunoNative().receiveDeeplink(url);
|
|
276
286
|
}
|
|
277
287
|
|
|
278
288
|
/**
|
|
@@ -292,7 +302,7 @@ class YunoSdk {
|
|
|
292
302
|
* ```
|
|
293
303
|
*/
|
|
294
304
|
static async getLastOneTimeToken() {
|
|
295
|
-
return
|
|
305
|
+
return getYunoNative().getLastOneTimeToken();
|
|
296
306
|
}
|
|
297
307
|
|
|
298
308
|
/**
|
|
@@ -309,16 +319,16 @@ class YunoSdk {
|
|
|
309
319
|
* ```
|
|
310
320
|
*/
|
|
311
321
|
static async getLastOneTimeTokenInfo() {
|
|
312
|
-
return
|
|
322
|
+
return getYunoNative().getLastOneTimeTokenInfo();
|
|
313
323
|
}
|
|
314
324
|
|
|
315
325
|
/**
|
|
316
326
|
* Clears the last OTT tokens stored by the SDK.
|
|
317
327
|
* This is useful to ensure clean state before starting a new payment flow.
|
|
318
|
-
*
|
|
328
|
+
*
|
|
319
329
|
* Note: This is automatically called at the start of each payment/enrollment flow,
|
|
320
330
|
* but you can call it manually if needed.
|
|
321
|
-
*
|
|
331
|
+
*
|
|
322
332
|
* @example
|
|
323
333
|
* ```typescript
|
|
324
334
|
* // Clear OTT before starting a new payment
|
|
@@ -326,7 +336,25 @@ class YunoSdk {
|
|
|
326
336
|
* ```
|
|
327
337
|
*/
|
|
328
338
|
static async clearLastOneTimeToken() {
|
|
329
|
-
return
|
|
339
|
+
return getYunoNative().clearLastOneTimeToken();
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Clears the last stored payment status.
|
|
344
|
+
* This should be called at the start of each new payment flow
|
|
345
|
+
* to prevent stale status from previous flows affecting new transactions.
|
|
346
|
+
*
|
|
347
|
+
* @returns Promise that resolves when the status is cleared
|
|
348
|
+
*
|
|
349
|
+
* @example
|
|
350
|
+
* ```typescript
|
|
351
|
+
* // Clear payment status before starting a new flow
|
|
352
|
+
* await YunoSdk.clearLastPaymentStatus();
|
|
353
|
+
* await YunoSdk.startPayment({ checkoutSession, countryCode });
|
|
354
|
+
* ```
|
|
355
|
+
*/
|
|
356
|
+
static async clearLastPaymentStatus() {
|
|
357
|
+
return getYunoNative().clearLastPaymentStatus();
|
|
330
358
|
}
|
|
331
359
|
|
|
332
360
|
/**
|
|
@@ -352,7 +380,8 @@ class YunoSdk {
|
|
|
352
380
|
* ```
|
|
353
381
|
*/
|
|
354
382
|
static onPaymentStatus(listener) {
|
|
355
|
-
const
|
|
383
|
+
const emitter = getYunoEventEmitter();
|
|
384
|
+
const subscription = emitter.addListener('YunoPaymentStatus', listener);
|
|
356
385
|
return {
|
|
357
386
|
remove: () => subscription.remove()
|
|
358
387
|
};
|
|
@@ -381,7 +410,8 @@ class YunoSdk {
|
|
|
381
410
|
* ```
|
|
382
411
|
*/
|
|
383
412
|
static onEnrollmentStatus(listener) {
|
|
384
|
-
const
|
|
413
|
+
const emitter = getYunoEventEmitter();
|
|
414
|
+
const subscription = emitter.addListener('YunoEnrollmentStatus', listener);
|
|
385
415
|
return {
|
|
386
416
|
remove: () => subscription.remove()
|
|
387
417
|
};
|
|
@@ -404,7 +434,8 @@ class YunoSdk {
|
|
|
404
434
|
* ```
|
|
405
435
|
*/
|
|
406
436
|
static onOneTimeToken(listener) {
|
|
407
|
-
const
|
|
437
|
+
const emitter = getYunoEventEmitter();
|
|
438
|
+
const subscription = emitter.addListener('YunoOneTimeToken', listener);
|
|
408
439
|
return {
|
|
409
440
|
remove: () => subscription.remove()
|
|
410
441
|
};
|
|
@@ -428,7 +459,8 @@ class YunoSdk {
|
|
|
428
459
|
* ```
|
|
429
460
|
*/
|
|
430
461
|
static onOneTimeTokenInfo(listener) {
|
|
431
|
-
const
|
|
462
|
+
const emitter = getYunoEventEmitter();
|
|
463
|
+
const subscription = emitter.addListener('YunoOneTimeTokenInfo', listener);
|
|
432
464
|
return {
|
|
433
465
|
remove: () => subscription.remove()
|
|
434
466
|
};
|
|
@@ -450,6 +482,133 @@ class YunoSdk {
|
|
|
450
482
|
}
|
|
451
483
|
return this.language;
|
|
452
484
|
}
|
|
485
|
+
|
|
486
|
+
// ==================== HEADLESS PAYMENT FLOW ====================
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* Generate a one-time token (OTT) from collected payment data using the headless flow.
|
|
490
|
+
* This method allows you to tokenize payment information without using the UI components.
|
|
491
|
+
*
|
|
492
|
+
* @param tokenCollectedData The payment data to tokenize
|
|
493
|
+
* @param checkoutSession The checkout session ID
|
|
494
|
+
* @param countryCode The country code for the payment (optional, uses initialized value if not provided)
|
|
495
|
+
* @returns Promise resolving to the generated token or rejecting with an error
|
|
496
|
+
*
|
|
497
|
+
* @example
|
|
498
|
+
* ```typescript
|
|
499
|
+
* import { YunoSdk, CardType } from '@yuno-payments/yuno-sdk-react-native';
|
|
500
|
+
*
|
|
501
|
+
* try {
|
|
502
|
+
* const result = await YunoSdk.generateToken({
|
|
503
|
+
* checkoutSession: '73ed16c5-4481-4dce-af42-404b68e21027',
|
|
504
|
+
* paymentMethod: {
|
|
505
|
+
* type: 'CARD',
|
|
506
|
+
* vaultedToken: null,
|
|
507
|
+
* card: {
|
|
508
|
+
* save: false,
|
|
509
|
+
* detail: {
|
|
510
|
+
* expirationMonth: 11,
|
|
511
|
+
* expirationYear: 25,
|
|
512
|
+
* number: '4000000000001091',
|
|
513
|
+
* securityCode: '123',
|
|
514
|
+
* holderName: 'John Doe',
|
|
515
|
+
* type: CardType.CREDIT,
|
|
516
|
+
* },
|
|
517
|
+
* },
|
|
518
|
+
* },
|
|
519
|
+
* }, 'checkoutSessionId', 'BR');
|
|
520
|
+
*
|
|
521
|
+
* console.log('Token:', result.token);
|
|
522
|
+
* } catch (error) {
|
|
523
|
+
* console.error('Token generation failed:', error);
|
|
524
|
+
* }
|
|
525
|
+
* ```
|
|
526
|
+
*/
|
|
527
|
+
static async generateToken(tokenCollectedData, checkoutSession, countryCode) {
|
|
528
|
+
const native = getYunoNative();
|
|
529
|
+
const country = countryCode || this.getCountryCode();
|
|
530
|
+
return native.generateToken(tokenCollectedData, checkoutSession, country);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Get the 3D Secure challenge URL for a checkout session using the headless flow.
|
|
535
|
+
* This is typically called after successfully generating a token to handle 3DS verification.
|
|
536
|
+
*
|
|
537
|
+
* @param checkoutSession The checkout session ID
|
|
538
|
+
* @param countryCode The country code for the payment (optional, uses initialized value if not provided)
|
|
539
|
+
* @returns Promise resolving to the 3DS challenge response
|
|
540
|
+
*
|
|
541
|
+
* @example
|
|
542
|
+
* ```typescript
|
|
543
|
+
* import { YunoSdk } from '@yuno-payments/yuno-sdk-react-native';
|
|
544
|
+
*
|
|
545
|
+
* try {
|
|
546
|
+
* // First generate token
|
|
547
|
+
* const tokenResult = await YunoSdk.generateToken(paymentData, checkoutSession, 'BR');
|
|
548
|
+
*
|
|
549
|
+
* // Then get 3DS challenge URL if needed
|
|
550
|
+
* const challengeResult = await YunoSdk.getThreeDSecureChallenge(checkoutSession, 'BR');
|
|
551
|
+
*
|
|
552
|
+
* if (challengeResult.type === 'URL') {
|
|
553
|
+
* console.log('3DS URL:', challengeResult.data);
|
|
554
|
+
* // Open this URL in a WebView for the user to complete 3DS verification
|
|
555
|
+
* }
|
|
556
|
+
* } catch (error) {
|
|
557
|
+
* console.error('3DS challenge failed:', error);
|
|
558
|
+
* }
|
|
559
|
+
* ```
|
|
560
|
+
*/
|
|
561
|
+
static async getThreeDSecureChallenge(checkoutSession, countryCode) {
|
|
562
|
+
const native = getYunoNative();
|
|
563
|
+
const country = countryCode || this.getCountryCode();
|
|
564
|
+
return native.getThreeDSecureChallenge(checkoutSession, country);
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
// ==================== HEADLESS ENROLLMENT FLOW ====================
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* Continue enrollment to create a vaulted token from collected payment data using the headless flow.
|
|
571
|
+
* This method allows you to save payment information without using the UI components.
|
|
572
|
+
*
|
|
573
|
+
* @param enrollmentCollectedData The enrollment data to process
|
|
574
|
+
* @param customerSession The customer session ID
|
|
575
|
+
* @param countryCode The country code for the enrollment (optional, uses initialized value if not provided)
|
|
576
|
+
* @returns Promise resolving to the vaulted token or rejecting with an error
|
|
577
|
+
*
|
|
578
|
+
* @example
|
|
579
|
+
* ```typescript
|
|
580
|
+
* import { YunoSdk, CardType } from '@yuno-payments/yuno-sdk-react-native';
|
|
581
|
+
*
|
|
582
|
+
* try {
|
|
583
|
+
* const result = await YunoSdk.continueEnrollment({
|
|
584
|
+
* customerSession: '73ed16c5-4481-4dce-af42-404b68e21027',
|
|
585
|
+
* paymentMethod: {
|
|
586
|
+
* type: 'CARD',
|
|
587
|
+
* card: {
|
|
588
|
+
* save: true,
|
|
589
|
+
* detail: {
|
|
590
|
+
* expirationMonth: 11,
|
|
591
|
+
* expirationYear: 25,
|
|
592
|
+
* number: '4000000000001091',
|
|
593
|
+
* securityCode: '123',
|
|
594
|
+
* holderName: 'John Doe',
|
|
595
|
+
* type: CardType.CREDIT,
|
|
596
|
+
* },
|
|
597
|
+
* },
|
|
598
|
+
* },
|
|
599
|
+
* }, 'customerSessionId', 'BR');
|
|
600
|
+
*
|
|
601
|
+
* console.log('Vaulted Token:', result.vaultedToken);
|
|
602
|
+
* } catch (error) {
|
|
603
|
+
* console.error('Enrollment failed:', error);
|
|
604
|
+
* }
|
|
605
|
+
* ```
|
|
606
|
+
*/
|
|
607
|
+
static async continueEnrollment(enrollmentCollectedData, customerSession, countryCode) {
|
|
608
|
+
const native = getYunoNative();
|
|
609
|
+
const country = countryCode || this.getCountryCode();
|
|
610
|
+
return native.continueEnrollment(enrollmentCollectedData, customerSession, country);
|
|
611
|
+
}
|
|
453
612
|
}
|
|
454
613
|
exports.YunoSdk = YunoSdk;
|
|
455
614
|
//# sourceMappingURL=YunoSdk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_enums","LINKING_ERROR","Platform","select","ios","default","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_enums","LINKING_ERROR","Platform","select","ios","default","getYunoNative","native","NativeModules","YunoSdk","Error","getYunoEventEmitter","NativeEventEmitter","countryCode","language","isInitialized","markAsInitialized","YunoLanguage","EN","initialize","params","apiKey","yunoConfig","iosConfig","androidConfig","config","lang","cardFlow","CardFlow","ONE_STEP","saveCardEnabled","keepLoader","isDynamicViewEnabled","cardFormDeployed","enrollmentPayment","checkInitialized","args","getCountryCode","startPaymentLite","code","startPayment","showPaymentStatus","continuePayment","checkoutSession","startPaymentSeamlessLite","statusString","getLanguage","hideLoader","receiveDeeplink","url","OS","console","warn","getLastOneTimeToken","getLastOneTimeTokenInfo","clearLastOneTimeToken","clearLastPaymentStatus","onPaymentStatus","listener","emitter","subscription","addListener","remove","onEnrollmentStatus","onOneTimeToken","onOneTimeTokenInfo","generateToken","tokenCollectedData","country","getThreeDSecureChallenge","continueEnrollment","enrollmentCollectedData","customerSession","exports"],"sourceRoot":"../../src","sources":["YunoSdk.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAeA,IAAAC,MAAA,GAAAD,OAAA;AAEA,MAAME,aAAa,GACjB,sFAAsF,GACtFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,uBAAuB;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GAC9D,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA;AACA;AACA,SAASC,aAAaA,CAAA,EAAQ;EAC5B,MAAMC,MAAM,GAAGC,0BAAa,CAACC,OAAO;EACpC,IAAI,CAACF,MAAM,EAA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A;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,aAAaE,kBAAkBA,CAC7BC,uBAAgD,EAChDC,eAAuB,EACvB3D,WAAoB,EACiB;IACrC,MAAMN,MAAM,GAAGD,aAAa,CAAC,CAAC;IAC9B,MAAM8D,OAAO,GAAGvD,WAAW,IAAI,IAAI,CAACwB,cAAc,CAAC,CAAC;IAEpD,OAAO9B,MAAM,CAAC+D,kBAAkB,CAC9BC,uBAAuB,EACvBC,eAAe,EACfJ,OACF,CAAC;EACH;AACF;AAACK,OAAA,CAAAhE,OAAA,GAAAA,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CardType = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Headless Payment Flow Types
|
|
9
|
+
* These types mirror the native SDK's TokenCollectedData structure
|
|
10
|
+
*/
|
|
11
|
+
let CardType = exports.CardType = /*#__PURE__*/function (CardType) {
|
|
12
|
+
CardType["CREDIT"] = "CREDIT";
|
|
13
|
+
CardType["DEBIT"] = "DEBIT";
|
|
14
|
+
return CardType;
|
|
15
|
+
}({});
|
|
16
|
+
/**
|
|
17
|
+
* Headless Enrollment Flow Types
|
|
18
|
+
* These types mirror the native SDK's EnrollmentCollectedData structure
|
|
19
|
+
*/
|
|
20
|
+
//# sourceMappingURL=HeadlessTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CardType","exports"],"sourceRoot":"../../../../src","sources":["core/types/HeadlessTypes.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAHA,IAKYA,QAAQ,GAAAC,OAAA,CAAAD,QAAA,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AAqFpB;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -36,11 +36,11 @@ const NativeYunoPaymentMethodsView = requireNativeComponent('YunoPaymentMethodsV
|
|
|
36
36
|
* YunoPaymentMethods Component
|
|
37
37
|
*
|
|
38
38
|
* A React Native component that displays available payment methods using the native Yuno SDK.
|
|
39
|
-
* This component embeds the native
|
|
39
|
+
* This component embeds the native payment methods list view from the Yuno SDK.
|
|
40
40
|
*
|
|
41
41
|
* **Platform Support:**
|
|
42
42
|
* - ✅ Android (using Jetpack Compose)
|
|
43
|
-
* -
|
|
43
|
+
* - ✅ iOS (using SwiftUI with UIHostingController)
|
|
44
44
|
*
|
|
45
45
|
* **Important:**
|
|
46
46
|
* - The Yuno SDK must be initialized before using this component
|
|
@@ -81,6 +81,10 @@ const NativeYunoPaymentMethodsView = requireNativeComponent('YunoPaymentMethodsV
|
|
|
81
81
|
* - User interactions and selections
|
|
82
82
|
* - Error states and loading indicators
|
|
83
83
|
*
|
|
84
|
+
* **Technical Note:** On iOS, uses `UIHostingController` to wrap the SwiftUI view from
|
|
85
|
+
* Yuno SDK's `getPaymentMethodViewAsync`, providing seamless integration with React Native.
|
|
86
|
+
* Android uses Jetpack Compose with native `PaymentMethodListViewComponent`.
|
|
87
|
+
*
|
|
84
88
|
* @public
|
|
85
89
|
*/
|
|
86
90
|
export const YunoPaymentMethods = ({
|
|
@@ -88,7 +92,8 @@ export const YunoPaymentMethods = ({
|
|
|
88
92
|
countryCode,
|
|
89
93
|
onPaymentMethodSelected,
|
|
90
94
|
onPaymentMethodError,
|
|
91
|
-
style
|
|
95
|
+
style,
|
|
96
|
+
testID
|
|
92
97
|
}) => {
|
|
93
98
|
// Set up event listeners
|
|
94
99
|
useEffect(() => {
|
|
@@ -123,13 +128,8 @@ export const YunoPaymentMethods = ({
|
|
|
123
128
|
});
|
|
124
129
|
};
|
|
125
130
|
}, [onPaymentMethodSelected, onPaymentMethodError]);
|
|
126
|
-
|
|
127
|
-
// Platform check
|
|
128
|
-
if (Platform.OS !== 'android') {
|
|
129
|
-
console.warn('YunoPaymentMethods: This component is currently only supported on Android. iOS support coming soon.');
|
|
130
|
-
return null;
|
|
131
|
-
}
|
|
132
131
|
return /*#__PURE__*/React.createElement(NativeYunoPaymentMethodsView, {
|
|
132
|
+
testID: testID,
|
|
133
133
|
checkoutSession: checkoutSession,
|
|
134
134
|
countryCode: countryCode,
|
|
135
135
|
style: style
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","requireNativeComponent","NativeModules","NativeEventEmitter","Platform","LINKING_ERROR","select","ios","default","YunoSdkNative","YunoSdk","eventEmitter","NativeYunoPaymentMethodsView","YunoPaymentMethods","checkoutSession","countryCode","onPaymentMethodSelected","onPaymentMethodError","style","console","warn","subscriptions","selectionListener","addListener","event","push","errorListener","forEach","sub","remove","
|
|
1
|
+
{"version":3,"names":["React","useEffect","requireNativeComponent","NativeModules","NativeEventEmitter","Platform","LINKING_ERROR","select","ios","default","YunoSdkNative","YunoSdk","eventEmitter","NativeYunoPaymentMethodsView","YunoPaymentMethods","checkoutSession","countryCode","onPaymentMethodSelected","onPaymentMethodError","style","testID","console","warn","subscriptions","selectionListener","addListener","event","push","errorListener","forEach","sub","remove","createElement"],"sourceRoot":"../../src","sources":["YunoPaymentMethods.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SACEC,sBAAsB,EACtBC,aAAa,EACbC,kBAAkB,EAGlBC,QAAQ,QACH,cAAc;;AAErB;AACA;AACA;;AAMA;AACA;AACA;;AAMA;AACA;AACA;;AA2BA;;AAQA,MAAMC,aAAa,GACjB,gHAAgH,GAChHD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,uBAAuB;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GAC9D,sDAA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