@yuno-payments/yuno-sdk-react-native 1.0.16
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/LICENSE +22 -0
- package/README.md +621 -0
- package/android/build.gradle +131 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/yunosdkreactnative/YunoPaymentMethodsViewManager.kt +194 -0
- package/android/src/main/java/com/yunosdkreactnative/YunoSdkModule.kt +777 -0
- package/android/src/main/java/com/yunosdkreactnative/YunoSdkPackage.kt +24 -0
- package/ios/YunoSdk.m +65 -0
- package/ios/YunoSdk.podspec +48 -0
- package/ios/YunoSdk.swift +442 -0
- package/lib/commonjs/YunoPaymentMethods.js +145 -0
- package/lib/commonjs/YunoPaymentMethods.js.map +1 -0
- package/lib/commonjs/YunoSdk.js +455 -0
- package/lib/commonjs/YunoSdk.js.map +1 -0
- package/lib/commonjs/core/enums/CardFlow.js +26 -0
- package/lib/commonjs/core/enums/CardFlow.js.map +1 -0
- package/lib/commonjs/core/enums/YunoLanguage.js +58 -0
- package/lib/commonjs/core/enums/YunoLanguage.js.map +1 -0
- package/lib/commonjs/core/enums/YunoStatus.js +40 -0
- package/lib/commonjs/core/enums/YunoStatus.js.map +1 -0
- package/lib/commonjs/core/enums/index.js +27 -0
- package/lib/commonjs/core/enums/index.js.map +1 -0
- package/lib/commonjs/core/index.js +28 -0
- package/lib/commonjs/core/index.js.map +1 -0
- package/lib/commonjs/core/types/AndroidConfig.js +2 -0
- package/lib/commonjs/core/types/AndroidConfig.js.map +1 -0
- package/lib/commonjs/core/types/EnrollmentArguments.js +2 -0
- package/lib/commonjs/core/types/EnrollmentArguments.js.map +1 -0
- package/lib/commonjs/core/types/IosConfig.js +2 -0
- package/lib/commonjs/core/types/IosConfig.js.map +1 -0
- package/lib/commonjs/core/types/OneTimeTokenInfo.js +2 -0
- package/lib/commonjs/core/types/OneTimeTokenInfo.js.map +1 -0
- package/lib/commonjs/core/types/SeamlessArguments.js +6 -0
- package/lib/commonjs/core/types/SeamlessArguments.js.map +1 -0
- package/lib/commonjs/core/types/StartPayment.js +2 -0
- package/lib/commonjs/core/types/StartPayment.js.map +1 -0
- package/lib/commonjs/core/types/YunoConfig.js +6 -0
- package/lib/commonjs/core/types/YunoConfig.js.map +1 -0
- package/lib/commonjs/core/types/index.js +2 -0
- package/lib/commonjs/core/types/index.js.map +1 -0
- package/lib/commonjs/index.js +36 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/YunoPaymentMethods.js +138 -0
- package/lib/module/YunoPaymentMethods.js.map +1 -0
- package/lib/module/YunoSdk.js +448 -0
- package/lib/module/YunoSdk.js.map +1 -0
- package/lib/module/core/enums/CardFlow.js +20 -0
- package/lib/module/core/enums/CardFlow.js.map +1 -0
- package/lib/module/core/enums/YunoLanguage.js +52 -0
- package/lib/module/core/enums/YunoLanguage.js.map +1 -0
- package/lib/module/core/enums/YunoStatus.js +34 -0
- package/lib/module/core/enums/YunoStatus.js.map +1 -0
- package/lib/module/core/enums/index.js +4 -0
- package/lib/module/core/enums/index.js.map +1 -0
- package/lib/module/core/index.js +3 -0
- package/lib/module/core/index.js.map +1 -0
- package/lib/module/core/types/AndroidConfig.js +2 -0
- package/lib/module/core/types/AndroidConfig.js.map +1 -0
- package/lib/module/core/types/EnrollmentArguments.js +2 -0
- package/lib/module/core/types/EnrollmentArguments.js.map +1 -0
- package/lib/module/core/types/IosConfig.js +2 -0
- package/lib/module/core/types/IosConfig.js.map +1 -0
- package/lib/module/core/types/OneTimeTokenInfo.js +2 -0
- package/lib/module/core/types/OneTimeTokenInfo.js.map +1 -0
- package/lib/module/core/types/SeamlessArguments.js +2 -0
- package/lib/module/core/types/SeamlessArguments.js.map +1 -0
- package/lib/module/core/types/StartPayment.js +2 -0
- package/lib/module/core/types/StartPayment.js.map +1 -0
- package/lib/module/core/types/YunoConfig.js +2 -0
- package/lib/module/core/types/YunoConfig.js.map +1 -0
- package/lib/module/core/types/index.js +2 -0
- package/lib/module/core/types/index.js.map +1 -0
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -0
- package/package.json +142 -0
- package/src/YunoPaymentMethods.tsx +196 -0
- package/src/YunoSdk.ts +518 -0
- package/src/core/enums/CardFlow.ts +18 -0
- package/src/core/enums/YunoLanguage.ts +50 -0
- package/src/core/enums/YunoStatus.ts +32 -0
- package/src/core/enums/index.ts +3 -0
- package/src/core/index.ts +2 -0
- package/src/core/types/AndroidConfig.ts +17 -0
- package/src/core/types/EnrollmentArguments.ts +32 -0
- package/src/core/types/IosConfig.ts +17 -0
- package/src/core/types/OneTimeTokenInfo.ts +207 -0
- package/src/core/types/SeamlessArguments.ts +42 -0
- package/src/core/types/StartPayment.ts +59 -0
- package/src/core/types/YunoConfig.ts +55 -0
- package/src/core/types/index.ts +7 -0
- package/src/index.ts +17 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.YunoLanguage = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Enum representing the languages supported by the Yuno SDK.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { YunoLanguage } from '@y.uno/yuno-sdk-react-native';
|
|
13
|
+
*
|
|
14
|
+
* const language = YunoLanguage.ES;
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
let YunoLanguage = exports.YunoLanguage = /*#__PURE__*/function (YunoLanguage) {
|
|
18
|
+
/** English language */
|
|
19
|
+
YunoLanguage["EN"] = "EN";
|
|
20
|
+
/** Spanish language */
|
|
21
|
+
YunoLanguage["ES"] = "ES";
|
|
22
|
+
/** Portuguese language */
|
|
23
|
+
YunoLanguage["PT"] = "PT";
|
|
24
|
+
/** Indonesian language */
|
|
25
|
+
YunoLanguage["ID"] = "ID";
|
|
26
|
+
/** Malay language */
|
|
27
|
+
YunoLanguage["MY"] = "MY";
|
|
28
|
+
/** Malaysian language */
|
|
29
|
+
YunoLanguage["MS"] = "MS";
|
|
30
|
+
/** French language */
|
|
31
|
+
YunoLanguage["FR"] = "FR";
|
|
32
|
+
/** Polish language */
|
|
33
|
+
YunoLanguage["PL"] = "PL";
|
|
34
|
+
/** Italian language */
|
|
35
|
+
YunoLanguage["IT"] = "IT";
|
|
36
|
+
/** German language */
|
|
37
|
+
YunoLanguage["DE"] = "DE";
|
|
38
|
+
/** Russian language */
|
|
39
|
+
YunoLanguage["RU"] = "RU";
|
|
40
|
+
/** Turkish language */
|
|
41
|
+
YunoLanguage["TR"] = "TR";
|
|
42
|
+
/** Dutch language */
|
|
43
|
+
YunoLanguage["NL"] = "NL";
|
|
44
|
+
/** Swedish language */
|
|
45
|
+
YunoLanguage["SV"] = "SV";
|
|
46
|
+
/** Thai language */
|
|
47
|
+
YunoLanguage["TH"] = "TH";
|
|
48
|
+
/** Filipino language */
|
|
49
|
+
YunoLanguage["FIL"] = "FIL";
|
|
50
|
+
/** Vietnamese language */
|
|
51
|
+
YunoLanguage["VI"] = "VI";
|
|
52
|
+
/** Chinese Simplified language */
|
|
53
|
+
YunoLanguage["ZH_CN"] = "ZH-CN";
|
|
54
|
+
/** Chinese Traditional language */
|
|
55
|
+
YunoLanguage["ZH_TW"] = "ZH-TW";
|
|
56
|
+
return YunoLanguage;
|
|
57
|
+
}({});
|
|
58
|
+
//# sourceMappingURL=YunoLanguage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["YunoLanguage","exports"],"sourceRoot":"../../../../src","sources":["core/enums/YunoLanguage.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATA,IAUYA,YAAY,GAAAC,OAAA,CAAAD,YAAA,0BAAZA,YAAY;EACtB;EADUA,YAAY;EAGtB;EAHUA,YAAY;EAKtB;EALUA,YAAY;EAOtB;EAPUA,YAAY;EAStB;EATUA,YAAY;EAWtB;EAXUA,YAAY;EAatB;EAbUA,YAAY;EAetB;EAfUA,YAAY;EAiBtB;EAjBUA,YAAY;EAmBtB;EAnBUA,YAAY;EAqBtB;EArBUA,YAAY;EAuBtB;EAvBUA,YAAY;EAyBtB;EAzBUA,YAAY;EA2BtB;EA3BUA,YAAY;EA6BtB;EA7BUA,YAAY;EA+BtB;EA/BUA,YAAY;EAiCtB;EAjCUA,YAAY;EAmCtB;EAnCUA,YAAY;EAqCtB;EArCUA,YAAY;EAAA,OAAZA,YAAY;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.YunoStatus = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Enum representing the possible statuses of a Yuno payment or enrollment operation.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { YunoStatus } from '@y.uno/yuno-sdk-react-native';
|
|
13
|
+
*
|
|
14
|
+
* function handlePaymentStatus(status: YunoStatus) {
|
|
15
|
+
* switch (status) {
|
|
16
|
+
* case YunoStatus.SUCCEEDED:
|
|
17
|
+
* break;
|
|
18
|
+
* case YunoStatus.REJECTED:
|
|
19
|
+
* break;
|
|
20
|
+
* // ... handle other cases
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
let YunoStatus = exports.YunoStatus = /*#__PURE__*/function (YunoStatus) {
|
|
26
|
+
/** Payment/operation was rejected */
|
|
27
|
+
YunoStatus["REJECTED"] = "REJECTED";
|
|
28
|
+
/** Payment/operation succeeded */
|
|
29
|
+
YunoStatus["SUCCEEDED"] = "SUCCEEDED";
|
|
30
|
+
/** Payment/operation failed */
|
|
31
|
+
YunoStatus["FAILED"] = "FAILED";
|
|
32
|
+
/** Payment/operation is being processed */
|
|
33
|
+
YunoStatus["PROCESSING"] = "PROCESSING";
|
|
34
|
+
/** An internal error occurred */
|
|
35
|
+
YunoStatus["INTERNAL_ERROR"] = "INTERNAL_ERROR";
|
|
36
|
+
/** Operation was cancelled by the user */
|
|
37
|
+
YunoStatus["CANCELLED_BY_USER"] = "CANCELLED_BY_USER";
|
|
38
|
+
return YunoStatus;
|
|
39
|
+
}({});
|
|
40
|
+
//# sourceMappingURL=YunoStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["YunoStatus","exports"],"sourceRoot":"../../../../src","sources":["core/enums/YunoStatus.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAjBA,IAkBYA,UAAU,GAAAC,OAAA,CAAAD,UAAA,0BAAVA,UAAU;EACpB;EADUA,UAAU;EAGpB;EAHUA,UAAU;EAKpB;EALUA,UAAU;EAOpB;EAPUA,UAAU;EASpB;EATUA,UAAU;EAWpB;EAXUA,UAAU;EAAA,OAAVA,UAAU;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "CardFlow", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _CardFlow.CardFlow;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "YunoLanguage", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _YunoLanguage.YunoLanguage;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "YunoStatus", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _YunoStatus.YunoStatus;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var _YunoLanguage = require("./YunoLanguage");
|
|
25
|
+
var _YunoStatus = require("./YunoStatus");
|
|
26
|
+
var _CardFlow = require("./CardFlow");
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_YunoLanguage","require","_YunoStatus","_CardFlow"],"sourceRoot":"../../../../src","sources":["core/enums/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _enums = require("./enums");
|
|
7
|
+
Object.keys(_enums).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _enums[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _enums[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _types = require("./types");
|
|
18
|
+
Object.keys(_types).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _types[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _types[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_enums","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_types"],"sourceRoot":"../../../src","sources":["core/index.ts"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,MAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,MAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,MAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,MAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["core/types/AndroidConfig.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["core/types/EnrollmentArguments.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["core/types/IosConfig.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["core/types/OneTimeTokenInfo.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["core/types/SeamlessArguments.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["core/types/StartPayment.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["core/types/YunoConfig.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["core/types/index.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
YunoSdk: true,
|
|
8
|
+
YunoPaymentMethods: true
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "YunoPaymentMethods", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _YunoPaymentMethods.YunoPaymentMethods;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "YunoSdk", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
return _YunoSdk.YunoSdk;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
var _YunoSdk = require("./YunoSdk");
|
|
23
|
+
var _YunoPaymentMethods = require("./YunoPaymentMethods");
|
|
24
|
+
var _core = require("./core");
|
|
25
|
+
Object.keys(_core).forEach(function (key) {
|
|
26
|
+
if (key === "default" || key === "__esModule") return;
|
|
27
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
28
|
+
if (key in exports && exports[key] === _core[key]) return;
|
|
29
|
+
Object.defineProperty(exports, key, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () {
|
|
32
|
+
return _core[key];
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_YunoSdk","require","_YunoPaymentMethods","_core","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,mBAAA,GAAAD,OAAA;AAMA,IAAAE,KAAA,GAAAF,OAAA;AAAAG,MAAA,CAAAC,IAAA,CAAAF,KAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,KAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,KAAA,CAAAI,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { requireNativeComponent, NativeModules, NativeEventEmitter, Platform } from 'react-native';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Event emitted when a payment method is selected or deselected.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Event emitted when an error occurs in the payment methods view.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Props for the YunoPaymentMethods component.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
// Native component interface
|
|
17
|
+
|
|
18
|
+
const LINKING_ERROR = `The package '@yuno/yuno-sdk-react-native' doesn't seem to be linked correctly for native views. Make sure:\n\n` + Platform.select({
|
|
19
|
+
ios: "- Run 'pod install'\n",
|
|
20
|
+
default: ''
|
|
21
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n' + '- The Yuno SDK is properly initialized\n';
|
|
22
|
+
|
|
23
|
+
// Get native module for event emitter
|
|
24
|
+
const YunoSdkNative = NativeModules.YunoSdk;
|
|
25
|
+
|
|
26
|
+
// Create event emitter
|
|
27
|
+
let eventEmitter = null;
|
|
28
|
+
if (YunoSdkNative) {
|
|
29
|
+
eventEmitter = new NativeEventEmitter(YunoSdkNative);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Require the native component
|
|
33
|
+
const NativeYunoPaymentMethodsView = requireNativeComponent('YunoPaymentMethodsView');
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* YunoPaymentMethods Component
|
|
37
|
+
*
|
|
38
|
+
* A React Native component that displays available payment methods using the native Yuno SDK.
|
|
39
|
+
* This component embeds the native `PaymentMethodListViewComponent` from the Yuno Android SDK.
|
|
40
|
+
*
|
|
41
|
+
* **Platform Support:**
|
|
42
|
+
* - ✅ Android (using Jetpack Compose)
|
|
43
|
+
* - ⚠️ iOS (coming soon)
|
|
44
|
+
*
|
|
45
|
+
* **Important:**
|
|
46
|
+
* - The Yuno SDK must be initialized before using this component
|
|
47
|
+
* - Requires a valid `checkoutSession` from the Yuno API
|
|
48
|
+
* - The component will automatically update the checkout session in the native SDK
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```tsx
|
|
52
|
+
* import { YunoPaymentMethods } from '@yuno/yuno-sdk-react-native';
|
|
53
|
+
*
|
|
54
|
+
* function MyPaymentScreen() {
|
|
55
|
+
* const [checkoutSession, setCheckoutSession] = useState('your_checkout_session_id');
|
|
56
|
+
* const [isMethodSelected, setIsMethodSelected] = useState(false);
|
|
57
|
+
*
|
|
58
|
+
* return (
|
|
59
|
+
* <YunoPaymentMethods
|
|
60
|
+
* checkoutSession={checkoutSession}
|
|
61
|
+
* countryCode="BR"
|
|
62
|
+
* onPaymentMethodSelected={(event) => {
|
|
63
|
+
* setIsMethodSelected(event.isSelected);
|
|
64
|
+
* }}
|
|
65
|
+
* onPaymentMethodError={(event) => {
|
|
66
|
+
* console.error('Error loading payment methods:', event.message);
|
|
67
|
+
* }}
|
|
68
|
+
* style={{ height: 400 }}
|
|
69
|
+
* />
|
|
70
|
+
* );
|
|
71
|
+
* }
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* @remarks
|
|
75
|
+
* This component is similar to Flutter's `YunoPaymentMethods` widget.
|
|
76
|
+
* It provides a native UI experience consistent with apps that use the Yuno SDK directly.
|
|
77
|
+
*
|
|
78
|
+
* The native component handles:
|
|
79
|
+
* - Loading available payment methods
|
|
80
|
+
* - Displaying saved payment methods
|
|
81
|
+
* - User interactions and selections
|
|
82
|
+
* - Error states and loading indicators
|
|
83
|
+
*
|
|
84
|
+
* @public
|
|
85
|
+
*/
|
|
86
|
+
export const YunoPaymentMethods = ({
|
|
87
|
+
checkoutSession,
|
|
88
|
+
countryCode,
|
|
89
|
+
onPaymentMethodSelected,
|
|
90
|
+
onPaymentMethodError,
|
|
91
|
+
style
|
|
92
|
+
}) => {
|
|
93
|
+
// Set up event listeners
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
if (!eventEmitter) {
|
|
96
|
+
console.warn(LINKING_ERROR);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const subscriptions = [];
|
|
100
|
+
|
|
101
|
+
// Listen for payment method selection events
|
|
102
|
+
if (onPaymentMethodSelected) {
|
|
103
|
+
const selectionListener = eventEmitter.addListener('onPaymentMethodSelected', event => {
|
|
104
|
+
onPaymentMethodSelected(event);
|
|
105
|
+
});
|
|
106
|
+
subscriptions.push(selectionListener);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Listen for error events
|
|
110
|
+
if (onPaymentMethodError) {
|
|
111
|
+
const errorListener = eventEmitter.addListener('onPaymentMethodError', event => {
|
|
112
|
+
onPaymentMethodError(event);
|
|
113
|
+
});
|
|
114
|
+
subscriptions.push(errorListener);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Cleanup listeners on unmount
|
|
118
|
+
return () => {
|
|
119
|
+
subscriptions.forEach(sub => {
|
|
120
|
+
if (sub && sub.remove) {
|
|
121
|
+
sub.remove();
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
}, [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
|
+
return /*#__PURE__*/React.createElement(NativeYunoPaymentMethodsView, {
|
|
133
|
+
checkoutSession: checkoutSession,
|
|
134
|
+
countryCode: countryCode,
|
|
135
|
+
style: style
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
//# sourceMappingURL=YunoPaymentMethods.js.map
|
|
@@ -0,0 +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","OS","createElement"],"sourceRoot":"../../src","sources":["YunoPaymentMethods.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAqB,OAAO;AACrD,SACEC,sBAAsB,EACtBC,aAAa,EACbC,kBAAkB,EAGlBC,QAAQ,QACH,cAAc;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