nimbbl-mobile-react-native-sdk 1.3.0 → 1.3.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.
- package/README.md +9 -3
- package/android/build.gradle +4 -4
- package/android/src/main/java/com/nimbbl/reactnative/NimbblCheckoutActivity.kt +7 -3
- package/android/src/main/java/com/nimbbl/reactnative/NimbblReactNativeSDKModule.kt +7 -0
- package/ios/NimbblReactNativeSDK.swift +5 -0
- package/lib/constants.d.ts +1 -0
- package/lib/constants.js +1 -0
- package/lib/types.d.ts +2 -0
- package/nimbbl-mobile-react-native-sdk.podspec +1 -1
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ A comprehensive React Native SDK for integrating Nimbbl payment gateway into you
|
|
|
14
14
|
- 🛡️ **Type Safety** - Comprehensive TypeScript definitions for better development experience
|
|
15
15
|
- 📊 **Production Ready** - Built-in analytics, logging, and error handling
|
|
16
16
|
- 🔄 **Unified Event Handling** - Single callback system for all payment responses
|
|
17
|
-
- 🎯 **Latest Native SDKs** - Built on iOS 2.0.
|
|
17
|
+
- 🎯 **Latest Native SDKs** - Built on iOS 2.0.7 and Android 4.0.4
|
|
18
18
|
|
|
19
19
|
## 🚀 Quick Start
|
|
20
20
|
|
|
@@ -101,7 +101,7 @@ await nimbblSDK.checkout({
|
|
|
101
101
|
- ✅ **First Release**: Built from the ground up with modern React Native best practices
|
|
102
102
|
- ✅ **Production Ready**: Thoroughly tested and optimized for production environments
|
|
103
103
|
- ✅ **Cross-Platform Consistency**: Identical behavior on iOS and Android
|
|
104
|
-
- ✅ **Latest Native SDKs**: Built on the most recent iOS (2.0.
|
|
104
|
+
- ✅ **Latest Native SDKs**: Built on the most recent iOS (2.0.7) and Android (4.0.4) SDKs
|
|
105
105
|
- ✅ **TypeScript First**: Full TypeScript support with comprehensive type definitions
|
|
106
106
|
- ✅ **Simple Integration**: Get started in minutes with our straightforward API
|
|
107
107
|
|
|
@@ -122,6 +122,12 @@ const nimbblSDK = NimbblSDK.getSharedInstance();
|
|
|
122
122
|
|
|
123
123
|
// Initialize with default production configuration
|
|
124
124
|
await nimbblSDK.initialize();
|
|
125
|
+
|
|
126
|
+
// OR initialize with custom configuration
|
|
127
|
+
await nimbblSDK.initialize({
|
|
128
|
+
api_base_url: 'https://api.nimbbl.tech/',
|
|
129
|
+
app_code: 'your_custom_app_code' // Optional: defaults to 'reactnative_webview_sdk'
|
|
130
|
+
});
|
|
125
131
|
```
|
|
126
132
|
|
|
127
133
|
|
|
@@ -466,7 +472,7 @@ For production applications, consider locking to specific versions:
|
|
|
466
472
|
|
|
467
473
|
#### ✨ Features
|
|
468
474
|
- **Unified API**: Single API for both iOS and Android platforms
|
|
469
|
-
- **Latest Native SDKs**: Built on iOS 2.0.
|
|
475
|
+
- **Latest Native SDKs**: Built on iOS 2.0.7 and Android 4.0.4
|
|
470
476
|
- **TypeScript Support**: Full TypeScript definitions for better development experience
|
|
471
477
|
- **Cross-Platform Consistency**: Identical behavior on iOS and Android
|
|
472
478
|
- **Production Ready**: Optimized for production environments with comprehensive error handling
|
package/android/build.gradle
CHANGED
|
@@ -24,7 +24,7 @@ allprojects {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
group = 'com.nimbbl.reactnative'
|
|
27
|
-
version = '1.
|
|
27
|
+
version = '1.3.1'
|
|
28
28
|
|
|
29
29
|
android {
|
|
30
30
|
namespace 'com.nimbbl.reactnative'
|
|
@@ -35,7 +35,7 @@ android {
|
|
|
35
35
|
minSdkVersion 24
|
|
36
36
|
targetSdkVersion 36
|
|
37
37
|
versionCode 1
|
|
38
|
-
versionName "1.
|
|
38
|
+
versionName "1.3.1"
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
buildTypes {
|
|
@@ -65,7 +65,7 @@ dependencies {
|
|
|
65
65
|
implementation 'androidx.appcompat:appcompat:1.6.1'
|
|
66
66
|
|
|
67
67
|
// Nimbbl WebView SDK dependency (includes all necessary dependencies)
|
|
68
|
-
implementation '
|
|
68
|
+
implementation 'com.github.nimbbl-tech:nimbbl_mobile_kit_android_webview_sdk:v4.0.4'
|
|
69
69
|
|
|
70
70
|
// Add Retrofit and Coroutines dependencies for Android SDK
|
|
71
71
|
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
|
@@ -79,7 +79,7 @@ afterEvaluate {
|
|
|
79
79
|
from components.release
|
|
80
80
|
groupId = 'com.nimbbl.reactnative'
|
|
81
81
|
artifactId = 'nimbbl-react-native-sdk'
|
|
82
|
-
version = '1.
|
|
82
|
+
version = '1.3.1'
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -38,6 +38,7 @@ class NimbblCheckoutActivity : Activity(), NimbblCheckoutPaymentListener {
|
|
|
38
38
|
const val EXTRA_BANK_CODE = "bank_code"
|
|
39
39
|
const val EXTRA_WALLET_CODE = "wallet_code"
|
|
40
40
|
const val EXTRA_PAYMENT_FLOW = "payment_flow"
|
|
41
|
+
const val EXTRA_APP_CODE = "app_code"
|
|
41
42
|
|
|
42
43
|
fun startCheckout(
|
|
43
44
|
activity: Activity,
|
|
@@ -45,7 +46,8 @@ class NimbblCheckoutActivity : Activity(), NimbblCheckoutPaymentListener {
|
|
|
45
46
|
paymentModeCode: String = "",
|
|
46
47
|
bankCode: String = "",
|
|
47
48
|
walletCode: String = "",
|
|
48
|
-
paymentFlow: String = ""
|
|
49
|
+
paymentFlow: String = "",
|
|
50
|
+
appCode: String = ""
|
|
49
51
|
) {
|
|
50
52
|
val intent = Intent(activity, NimbblCheckoutActivity::class.java).apply {
|
|
51
53
|
putExtra(EXTRA_ORDER_TOKEN, orderToken)
|
|
@@ -53,6 +55,7 @@ class NimbblCheckoutActivity : Activity(), NimbblCheckoutPaymentListener {
|
|
|
53
55
|
putExtra(EXTRA_BANK_CODE, bankCode)
|
|
54
56
|
putExtra(EXTRA_WALLET_CODE, walletCode)
|
|
55
57
|
putExtra(EXTRA_PAYMENT_FLOW, paymentFlow)
|
|
58
|
+
putExtra(EXTRA_APP_CODE, appCode)
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
activity.startActivity(intent)
|
|
@@ -70,6 +73,7 @@ class NimbblCheckoutActivity : Activity(), NimbblCheckoutPaymentListener {
|
|
|
70
73
|
val bankCode = intent.getStringExtra(EXTRA_BANK_CODE) ?: ""
|
|
71
74
|
val walletCode = intent.getStringExtra(EXTRA_WALLET_CODE) ?: ""
|
|
72
75
|
val paymentFlow = intent.getStringExtra(EXTRA_PAYMENT_FLOW) ?: ""
|
|
76
|
+
val appCode = intent.getStringExtra(EXTRA_APP_CODE) ?: ""
|
|
73
77
|
|
|
74
78
|
|
|
75
79
|
if (orderToken.isNullOrEmpty()) {
|
|
@@ -87,8 +91,8 @@ class NimbblCheckoutActivity : Activity(), NimbblCheckoutPaymentListener {
|
|
|
87
91
|
.setWalletCode(walletCode)
|
|
88
92
|
.build()
|
|
89
93
|
|
|
90
|
-
// Initialize SDK and start checkout
|
|
91
|
-
NimbblCheckoutSDK.getInstance().init(this)
|
|
94
|
+
// Initialize SDK with app code and start checkout
|
|
95
|
+
NimbblCheckoutSDK.getInstance().init(this, appCode)
|
|
92
96
|
NimbblCheckoutSDK.getInstance().checkout(checkoutOptions)
|
|
93
97
|
|
|
94
98
|
} catch (e: Exception) {
|
|
@@ -143,6 +143,7 @@ class NimbblReactNativeSDKModule(private val reactContext: ReactApplicationConte
|
|
|
143
143
|
// Extract configuration
|
|
144
144
|
this.config.clear()
|
|
145
145
|
this.config["api_base_url"] = config.getString("api_base_url") ?: "https://api.nimbbl.tech"
|
|
146
|
+
this.config["app_code"] = config.getString("app_code") ?: "reactnative_webview_sdk"
|
|
146
147
|
|
|
147
148
|
// Set environment URL on the native SDK during initialization
|
|
148
149
|
val apiBaseUrl = this.config["api_base_url"] as? String
|
|
@@ -151,6 +152,10 @@ class NimbblReactNativeSDKModule(private val reactContext: ReactApplicationConte
|
|
|
151
152
|
val normalizedUrl = if (apiBaseUrl.endsWith("/")) apiBaseUrl else apiBaseUrl + "/"
|
|
152
153
|
NimbblCheckoutSDK.getInstance().setEnvironmentUrl(normalizedUrl)
|
|
153
154
|
}
|
|
155
|
+
|
|
156
|
+
// Store appCode for later use during checkout
|
|
157
|
+
val appCode = this.config["app_code"] as? String ?: "reactnative_webview_sdk"
|
|
158
|
+
this.config["app_code"] = appCode
|
|
154
159
|
|
|
155
160
|
isInitialized = true
|
|
156
161
|
|
|
@@ -392,12 +397,14 @@ class NimbblReactNativeSDKModule(private val reactContext: ReactApplicationConte
|
|
|
392
397
|
// Add a small delay to ensure callback is properly set up
|
|
393
398
|
android.os.Handler(android.os.Looper.getMainLooper()).postDelayed({
|
|
394
399
|
// Start the NimbblCheckoutActivity
|
|
400
|
+
val appCode = this.config["app_code"] as? String ?: "reactnative_webview_sdk"
|
|
395
401
|
val intent = Intent(currentActivity, NimbblCheckoutActivity::class.java).apply {
|
|
396
402
|
putExtra(NimbblCheckoutActivity.EXTRA_ORDER_TOKEN, orderToken)
|
|
397
403
|
putExtra(NimbblCheckoutActivity.EXTRA_PAYMENT_MODE_CODE, paymentModeCode)
|
|
398
404
|
putExtra(NimbblCheckoutActivity.EXTRA_BANK_CODE, bankCode)
|
|
399
405
|
putExtra(NimbblCheckoutActivity.EXTRA_WALLET_CODE, walletCode)
|
|
400
406
|
putExtra(NimbblCheckoutActivity.EXTRA_PAYMENT_FLOW, paymentFlow)
|
|
407
|
+
putExtra(NimbblCheckoutActivity.EXTRA_APP_CODE, appCode)
|
|
401
408
|
}
|
|
402
409
|
|
|
403
410
|
currentActivity.startActivity(intent)
|
|
@@ -43,6 +43,7 @@ class NimbblReactNativeSDK: RCTEventEmitter, NimbblCheckoutSDKDelegate {
|
|
|
43
43
|
// Extract configuration
|
|
44
44
|
self.config.removeAll()
|
|
45
45
|
self.config["api_base_url"] = config["api_base_url"] as? String ?? "https://api.nimbbl.tech"
|
|
46
|
+
self.config["app_code"] = config["app_code"] as? String ?? "reactnative_webview_sdk"
|
|
46
47
|
|
|
47
48
|
// Set environment URL on the native SDK during initialization
|
|
48
49
|
let apiBaseUrl = self.config["api_base_url"] as? String
|
|
@@ -52,6 +53,10 @@ class NimbblReactNativeSDK: RCTEventEmitter, NimbblCheckoutSDKDelegate {
|
|
|
52
53
|
NimbblCheckoutSDK.shared.environmentUrl = normalizedUrl
|
|
53
54
|
}
|
|
54
55
|
|
|
56
|
+
// Initialize the native SDK with appCode
|
|
57
|
+
let appCode = self.config["app_code"] as? String
|
|
58
|
+
NimbblCheckoutSDK.shared.initialize(appCode: appCode)
|
|
59
|
+
|
|
55
60
|
isInitialized = true
|
|
56
61
|
|
|
57
62
|
let result: [String: Any] = [
|
package/lib/constants.d.ts
CHANGED
package/lib/constants.js
CHANGED
package/lib/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nimbbl-mobile-react-native-sdk",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Nimbbl React Native SDK for payment integration",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -71,15 +71,14 @@
|
|
|
71
71
|
"react": "18.2.0",
|
|
72
72
|
"react-native": "0.76.0",
|
|
73
73
|
"ts-jest": "^29.1.0",
|
|
74
|
-
"typescript": "^5.0.0"
|
|
75
|
-
},
|
|
76
|
-
"dependencies": {
|
|
74
|
+
"typescript": "^5.0.0",
|
|
77
75
|
"@react-navigation/native": "^7.1.18",
|
|
78
76
|
"@react-navigation/stack": "^7.4.9",
|
|
79
77
|
"react-native-gesture-handler": "^2.28.0",
|
|
80
78
|
"react-native-safe-area-context": "^5.6.1",
|
|
81
79
|
"react-native-screens": "^4.16.0"
|
|
82
80
|
},
|
|
81
|
+
"dependencies": {},
|
|
83
82
|
"files": [
|
|
84
83
|
"lib/constants.js",
|
|
85
84
|
"lib/constants.d.ts",
|