@yuno-payments/yuno-sdk-react-native 1.0.26 → 1.0.27

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 CHANGED
@@ -29,7 +29,7 @@ To use the Yuno React Native SDK, you need to meet the following requirements:
29
29
  | Requirement | Version |
30
30
  |-------------|---------|
31
31
  | **Node.js** | 16.0.0 or above |
32
- | **React Native** | 0.70 or above |
32
+ | **React Native** | 0.70 - 0.82+ (tested and compatible) |
33
33
 
34
34
  ## Android Requirements
35
35
 
@@ -340,7 +340,7 @@ class YunoSdkModule(private val reactContext: ReactApplicationContext) :
340
340
  true
341
341
  }
342
342
 
343
- val activity = currentActivity ?: run {
343
+ val activity = reactContext.currentActivity ?: run {
344
344
  promise.reject("NO_ACTIVITY", "Current activity is not available")
345
345
  return
346
346
  }
@@ -390,7 +390,7 @@ class YunoSdkModule(private val reactContext: ReactApplicationContext) :
390
390
  return
391
391
  }
392
392
 
393
- val activity = currentActivity ?: run {
393
+ val activity = reactContext.currentActivity ?: run {
394
394
  promise.reject("NO_ACTIVITY", "Current activity is not available")
395
395
  return
396
396
  }
@@ -436,7 +436,7 @@ class YunoSdkModule(private val reactContext: ReactApplicationContext) :
436
436
  clearLastOTT() // 🧹 Clear any previous OTT tokens before starting new flow
437
437
 
438
438
  try {
439
- val activity = currentActivity ?: run {
439
+ val activity = reactContext.currentActivity ?: run {
440
440
  promise.reject("NO_ACTIVITY", "Current activity is not available")
441
441
  return
442
442
  }
@@ -471,7 +471,7 @@ class YunoSdkModule(private val reactContext: ReactApplicationContext) :
471
471
  if (!checkInitialized(promise)) return
472
472
 
473
473
  try {
474
- val activity = currentActivity ?: run {
474
+ val activity = reactContext.currentActivity ?: run {
475
475
  promise.reject("NO_ACTIVITY", "Current activity is not available")
476
476
  return
477
477
  }
@@ -548,7 +548,7 @@ class YunoSdkModule(private val reactContext: ReactApplicationContext) :
548
548
  return
549
549
  }
550
550
 
551
- val activity = currentActivity ?: run {
551
+ val activity = reactContext.currentActivity ?: run {
552
552
  promise.reject("NO_ACTIVITY", "Current activity is not available")
553
553
  return
554
554
  }
@@ -863,7 +863,7 @@ class YunoSdkModule(private val reactContext: ReactApplicationContext) :
863
863
  try {
864
864
  Log.d(TAG, "generateToken called with checkoutSession: $checkoutSession")
865
865
 
866
- val activity = currentActivity
866
+ val activity = reactContext.currentActivity
867
867
  if (activity == null) {
868
868
  promise.reject("ACTIVITY_UNAVAILABLE", "Current activity is null. Cannot generate token.")
869
869
  return
@@ -880,7 +880,7 @@ class YunoSdkModule(private val reactContext: ReactApplicationContext) :
880
880
  val apiClient = Yuno.apiClientPayment(
881
881
  checkoutSession = checkoutSession,
882
882
  countryCode = countryCode,
883
- context = activity.applicationContext
883
+ context = reactContext.applicationContext
884
884
  )
885
885
  headlessApiClient = apiClient
886
886
 
@@ -942,7 +942,7 @@ class YunoSdkModule(private val reactContext: ReactApplicationContext) :
942
942
  try {
943
943
  Log.d(TAG, "getThreeDSecureChallenge called with checkoutSession: $checkoutSession")
944
944
 
945
- val activity = currentActivity
945
+ val activity = reactContext.currentActivity
946
946
  if (activity == null) {
947
947
  promise.reject("ACTIVITY_UNAVAILABLE", "Current activity is null. Cannot get 3DS challenge.")
948
948
  return
@@ -952,7 +952,7 @@ class YunoSdkModule(private val reactContext: ReactApplicationContext) :
952
952
  val apiClient = headlessApiClient ?: Yuno.apiClientPayment(
953
953
  checkoutSession = checkoutSession,
954
954
  countryCode = countryCode,
955
- context = activity.applicationContext
955
+ context = reactContext.applicationContext
956
956
  )
957
957
 
958
958
  val clientType = if (headlessApiClient != null) "EXISTING" else "NEW"
@@ -1003,7 +1003,7 @@ class YunoSdkModule(private val reactContext: ReactApplicationContext) :
1003
1003
  try {
1004
1004
  Log.d(TAG, "continueEnrollment called with customerSession: $customerSession")
1005
1005
 
1006
- val activity = currentActivity
1006
+ val activity = reactContext.currentActivity
1007
1007
  if (activity == null) {
1008
1008
  promise.reject("ACTIVITY_UNAVAILABLE", "Current activity is null. Cannot continue enrollment.")
1009
1009
  return
@@ -1021,7 +1021,7 @@ class YunoSdkModule(private val reactContext: ReactApplicationContext) :
1021
1021
  val apiClient = Yuno.apiClientEnroll(
1022
1022
  customerSession = customerSession,
1023
1023
  countryCode = countryCode,
1024
- context = activity
1024
+ context = reactContext.applicationContext
1025
1025
  )
1026
1026
 
1027
1027
  // Continue enrollment
@@ -1078,8 +1078,8 @@ class YunoSdkModule(private val reactContext: ReactApplicationContext) :
1078
1078
  ReadableType.Boolean -> readableMap.getBoolean(key)
1079
1079
  ReadableType.Number -> readableMap.getDouble(key)
1080
1080
  ReadableType.String -> readableMap.getString(key)
1081
- ReadableType.Map -> convertReadableMapToJsonObject(readableMap.getMap(key)!!)
1082
- ReadableType.Array -> convertReadableArrayToJsonArray(readableMap.getArray(key)!!)
1081
+ ReadableType.Map -> readableMap.getMap(key)?.let { convertReadableMapToJsonObject(it) } ?: JSONObject()
1082
+ ReadableType.Array -> readableMap.getArray(key)?.let { convertReadableArrayToJsonArray(it) } ?: JSONArray()
1083
1083
  ReadableType.Null -> JSONObject.NULL
1084
1084
  }
1085
1085
  json.put(key, value)
@@ -1098,8 +1098,8 @@ class YunoSdkModule(private val reactContext: ReactApplicationContext) :
1098
1098
  ReadableType.Boolean -> readableMap.getBoolean(key)
1099
1099
  ReadableType.Number -> readableMap.getDouble(key)
1100
1100
  ReadableType.String -> readableMap.getString(key)
1101
- ReadableType.Map -> convertReadableMapToJsonObject(readableMap.getMap(key)!!)
1102
- ReadableType.Array -> convertReadableArrayToJsonArray(readableMap.getArray(key)!!)
1101
+ ReadableType.Map -> readableMap.getMap(key)?.let { convertReadableMapToJsonObject(it) } ?: JSONObject()
1102
+ ReadableType.Array -> readableMap.getArray(key)?.let { convertReadableArrayToJsonArray(it) } ?: JSONArray()
1103
1103
  ReadableType.Null -> JSONObject.NULL
1104
1104
  }
1105
1105
  json.put(key, value)
@@ -1116,8 +1116,8 @@ class YunoSdkModule(private val reactContext: ReactApplicationContext) :
1116
1116
  ReadableType.Boolean -> readableArray.getBoolean(i)
1117
1117
  ReadableType.Number -> readableArray.getDouble(i)
1118
1118
  ReadableType.String -> readableArray.getString(i)
1119
- ReadableType.Map -> convertReadableMapToJsonObject(readableArray.getMap(i))
1120
- ReadableType.Array -> convertReadableArrayToJsonArray(readableArray.getArray(i))
1119
+ ReadableType.Map -> readableArray.getMap(i)?.let { convertReadableMapToJsonObject(it) } ?: JSONObject()
1120
+ ReadableType.Array -> readableArray.getArray(i)?.let { convertReadableArrayToJsonArray(it) } ?: JSONArray()
1121
1121
  ReadableType.Null -> JSONObject.NULL
1122
1122
  }
1123
1123
  json.put(value)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuno-payments/yuno-sdk-react-native",
3
- "version": "1.0.26",
3
+ "version": "1.0.27",
4
4
  "description": "Yuno React Native SDK empowers you to create seamless payment experiences in your native Android and iOS apps built with React Native.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",