react-native-smallcase-gateway 1.5.4 → 1.6.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/CHANGELOG.md +10 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/smallcase/gateway/reactnative/SmallcaseGatewayModule.kt +44 -4
- package/ios/SmallcaseGateway.m +15 -0
- package/package.json +1 -1
- package/react-native-smallcase-gateway.podspec +1 -1
- package/src/SmallcaseGateway.js +35 -0
- package/src/constants.js +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.6.1](https://github.com/smallcase/react-native-smallcase-gateway/compare/v1.5.4...v1.6.1) (2022-10-19)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* 1014 err msg added ([04bc4de](https://github.com/smallcase/react-native-smallcase-gateway/commit/04bc4de8dcd3a7a37d6f0d15eee5aeeb34419195))
|
|
11
|
+
* add bridge method for mf holdings ([b68b570](https://github.com/smallcase/react-native-smallcase-gateway/commit/b68b57062ed514dc46404f94191c3ee438f184dc))
|
|
12
|
+
|
|
13
|
+
## [1.6.0](https://github.com/smallcase/react-native-smallcase-gateway/compare/v1.5.4...v1.6.0) (2022-09-23)
|
|
14
|
+
|
|
5
15
|
### [1.5.4](https://github.com/smallcase/react-native-smallcase-gateway/compare/v1.5.2...v1.5.4) (2022-09-08)
|
|
6
16
|
|
|
7
17
|
|
package/android/build.gradle
CHANGED
|
@@ -81,7 +81,7 @@ repositories {
|
|
|
81
81
|
dependencies {
|
|
82
82
|
//noinspection GradleDynamicVersion
|
|
83
83
|
implementation 'com.facebook.react:react-native:+' // From node_modules
|
|
84
|
-
implementation 'com.smallcase.gateway:sdk:3.
|
|
84
|
+
implementation 'com.smallcase.gateway:sdk:3.6.4'
|
|
85
85
|
implementation "androidx.core:core-ktx:1.3.1"
|
|
86
86
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
87
87
|
}
|
|
@@ -4,13 +4,10 @@ import android.util.Log
|
|
|
4
4
|
import com.facebook.react.bridge.*
|
|
5
5
|
import com.smallcase.gateway.data.SmallcaseGatewayListeners
|
|
6
6
|
import com.smallcase.gateway.data.SmallcaseLogoutListener
|
|
7
|
-
import com.smallcase.gateway.data.listeners
|
|
8
|
-
import com.smallcase.gateway.data.listeners.SmallPlugResponseListener
|
|
9
|
-
import com.smallcase.gateway.data.listeners.TransactionResponseListener
|
|
7
|
+
import com.smallcase.gateway.data.listeners.*
|
|
10
8
|
import com.smallcase.gateway.data.models.*
|
|
11
9
|
import com.smallcase.gateway.data.requests.InitRequest
|
|
12
10
|
import com.smallcase.gateway.portal.SmallcaseGatewaySdk
|
|
13
|
-
import com.smallcase.gateway.data.listeners.LeadGenResponseListener
|
|
14
11
|
import com.smallcase.gateway.portal.SmallplugPartnerProps
|
|
15
12
|
import kotlin.Error
|
|
16
13
|
|
|
@@ -118,6 +115,31 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
|
|
|
118
115
|
}
|
|
119
116
|
}
|
|
120
117
|
|
|
118
|
+
@ReactMethod
|
|
119
|
+
fun triggerMfTransaction(transactionId: String, promise: Promise) {
|
|
120
|
+
|
|
121
|
+
if(currentActivity != null) {
|
|
122
|
+
|
|
123
|
+
SmallcaseGatewaySdk.triggerMfTransaction(
|
|
124
|
+
activity = currentActivity!!,
|
|
125
|
+
transactionId = transactionId,
|
|
126
|
+
listener = object : MFHoldingsResponseListener {
|
|
127
|
+
|
|
128
|
+
override fun onSuccess(transactionResult: TransactionResult) {
|
|
129
|
+
val res = resultToWritableMap(transactionResult, true)
|
|
130
|
+
promise.resolve(res)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
override fun onError(errorCode: Int, errorMessage: String, data: String?) {
|
|
134
|
+
val err = createErrorJSON(errorCode, errorMessage, data)
|
|
135
|
+
promise.reject("error", err)
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
} else {
|
|
139
|
+
promise.reject(Throwable("no activity"))
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
121
143
|
@ReactMethod
|
|
122
144
|
fun showOrders(promise: Promise) {
|
|
123
145
|
val activity = currentActivity;
|
|
@@ -253,6 +275,24 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
|
|
|
253
275
|
}
|
|
254
276
|
}
|
|
255
277
|
|
|
278
|
+
@ReactMethod
|
|
279
|
+
fun triggerLeadGenWithLoginCta(userDetails: ReadableMap, utmData: ReadableMap, showLoginCta: Boolean, promise: Promise) {
|
|
280
|
+
if(currentActivity != null) {
|
|
281
|
+
|
|
282
|
+
SmallcaseGatewaySdk.triggerLeadGen(
|
|
283
|
+
activity = currentActivity!!,
|
|
284
|
+
params = readableMapToStrHashMap(userDetails),
|
|
285
|
+
utmParams = readableMapToStrHashMap(utmData),
|
|
286
|
+
retargeting = null,
|
|
287
|
+
showLoginCta = showLoginCta,
|
|
288
|
+
leadStatusListener = object : LeadGenResponseListener {
|
|
289
|
+
override fun onSuccess(leadResponse: String) {
|
|
290
|
+
promise.resolve(leadResponse)
|
|
291
|
+
}
|
|
292
|
+
})
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
256
296
|
private fun getProtocol(envName: String): Environment.PROTOCOL {
|
|
257
297
|
return when (envName) {
|
|
258
298
|
"production" -> Environment.PROTOCOL.PRODUCTION
|
package/ios/SmallcaseGateway.m
CHANGED
|
@@ -410,6 +410,21 @@ RCT_EXPORT_METHOD(triggerLeadGen: (NSDictionary *)userParams utmParams:(NSDictio
|
|
|
410
410
|
});
|
|
411
411
|
}
|
|
412
412
|
|
|
413
|
+
RCT_REMAP_METHOD(triggerLeadGenWithLoginCta,
|
|
414
|
+
userParams: (NSDictionary *)userParams
|
|
415
|
+
utmParams:(NSDictionary *)utmParams
|
|
416
|
+
showLoginCta:(BOOL *)showLoginCta
|
|
417
|
+
leadGenGenWithResolver: (RCTPromiseResolveBlock)resolve
|
|
418
|
+
rejecter:(RCTPromiseRejectBlock)reject
|
|
419
|
+
) {
|
|
420
|
+
dispatch_async(dispatch_get_main_queue(), ^(void) {
|
|
421
|
+
[SCGateway.shared
|
|
422
|
+
triggerLeadGenWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController] params:userParams utmParams:utmParams retargeting:false showLoginCta:showLoginCta completion:^(NSString * leadGenResponse) {
|
|
423
|
+
resolve(leadGenResponse);
|
|
424
|
+
}];
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
|
|
413
428
|
//MARK: User logout
|
|
414
429
|
RCT_REMAP_METHOD(logoutUser,
|
|
415
430
|
logoutUserWithResolver:(RCTPromiseResolveBlock)resolve
|
package/package.json
CHANGED
package/src/SmallcaseGateway.js
CHANGED
|
@@ -104,6 +104,20 @@ const triggerTransaction = async (transactionId, utmParams, brokerList) => {
|
|
|
104
104
|
);
|
|
105
105
|
};
|
|
106
106
|
|
|
107
|
+
/**
|
|
108
|
+
* triggers a transaction with a transaction id
|
|
109
|
+
*
|
|
110
|
+
* @param {string} transactionId
|
|
111
|
+
* @returns {Promise<transactionRes>}
|
|
112
|
+
*/
|
|
113
|
+
const triggerMfTransaction = async (transactionId) => {
|
|
114
|
+
const safeTransactionId = typeof transactionId === "string" ? transactionId : "";
|
|
115
|
+
|
|
116
|
+
return SmallcaseGatewayNative.triggerMfTransaction(
|
|
117
|
+
safeTransactionId
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
107
121
|
/**
|
|
108
122
|
* launches smallcases module
|
|
109
123
|
*
|
|
@@ -205,6 +219,26 @@ const triggerLeadGenWithStatus = async (userDetails) => {
|
|
|
205
219
|
return SmallcaseGatewayNative.triggerLeadGenWithStatus(safeParams);
|
|
206
220
|
}
|
|
207
221
|
|
|
222
|
+
/**
|
|
223
|
+
* triggers the lead gen flow with an option of "login here" cta
|
|
224
|
+
*
|
|
225
|
+
* @param {userDetails} [userDetails]
|
|
226
|
+
* @param {Object} [utmParams]
|
|
227
|
+
* @param {boolean} [showLoginCta]
|
|
228
|
+
* @returns {Promise}
|
|
229
|
+
*/
|
|
230
|
+
const triggerLeadGenWithLoginCta = async (userDetails, utmParams, showLoginCta) => {
|
|
231
|
+
const safeParams = safeObject(userDetails);
|
|
232
|
+
const safeUtm = safeObject(utmParams);
|
|
233
|
+
const safeShowLoginCta = Boolean(showLoginCta);
|
|
234
|
+
|
|
235
|
+
return SmallcaseGatewayNative.triggerLeadGenWithLoginCta(
|
|
236
|
+
safeParams,
|
|
237
|
+
safeUtm,
|
|
238
|
+
safeShowLoginCta
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
|
|
208
242
|
/**
|
|
209
243
|
* Marks a smallcase as archived
|
|
210
244
|
*
|
|
@@ -230,6 +264,7 @@ const SmallcaseGateway = {
|
|
|
230
264
|
logoutUser,
|
|
231
265
|
triggerLeadGen,
|
|
232
266
|
triggerLeadGenWithStatus,
|
|
267
|
+
triggerLeadGenWithLoginCta,
|
|
233
268
|
archiveSmallcase,
|
|
234
269
|
triggerTransaction,
|
|
235
270
|
setConfigEnvironment,
|
package/src/constants.js
CHANGED
|
@@ -11,6 +11,7 @@ export const TRANSACTION_TYPE = {
|
|
|
11
11
|
transaction: "TRANSACTION",
|
|
12
12
|
holdingsImport: "HOLDINGS_IMPORT",
|
|
13
13
|
authorizeHoldings: "AUTHORISE_HOLDINGS",
|
|
14
|
+
mfHoldingsImport: "MF_HOLDINGS_IMPORT"
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
export const ERROR_MSG = {
|
|
@@ -30,4 +31,5 @@ export const ERROR_MSG = {
|
|
|
30
31
|
invalid_transactionId: "invalid_transactionId",
|
|
31
32
|
insufficient_holdings: "insufficient_holdings",
|
|
32
33
|
transaction_in_process: "transaction_in_process",
|
|
34
|
+
no_compatible_browser: "no_compatible_browser"
|
|
33
35
|
};
|