react-native-smallcase-gateway 1.3.2 → 1.4.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 +21 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/smallcase/gateway/reactnative/SmallcaseGatewayModule.kt +103 -86
- package/ios/SmallcaseGateway.m +55 -0
- package/package.json +1 -1
- package/react-native-smallcase-gateway.podspec +2 -1
- package/src/SmallcaseGateway.js +50 -4
- package/src/util.js +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
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.4.1](https://github.com/smallcase/react-native-smallcase-gateway/compare/v1.4.0...v1.4.1) (2022-06-27)
|
|
6
|
+
|
|
7
|
+
## [1.4.0](https://github.com/smallcase/react-native-smallcase-gateway/compare/v1.3.3...v1.4.0) (2022-06-23)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* android native module for dmbranding ([df816f6](https://github.com/smallcase/react-native-smallcase-gateway/commit/df816f6dfa987dfdfc6297aec362fdb2c7d1e3c3))
|
|
13
|
+
* dm partner branding ([78fb73f](https://github.com/smallcase/react-native-smallcase-gateway/commit/78fb73f56055c74eecebcff03c7560a794c06c7f))
|
|
14
|
+
* iOS null issue & Android def val ([a852397](https://github.com/smallcase/react-native-smallcase-gateway/commit/a852397e2aa4e0ffc6669f0345cbd93f2e63a6b8))
|
|
15
|
+
* method signature for ios native dm ([daedabc](https://github.com/smallcase/react-native-smallcase-gateway/commit/daedabca1180b16c3eacd2c956a51b8d63457435))
|
|
16
|
+
* Platform check for dm branding ([0d80e79](https://github.com/smallcase/react-native-smallcase-gateway/commit/0d80e797b80e4c92e940b2763da81299ba05c9c6))
|
|
17
|
+
* type error ([e2b1394](https://github.com/smallcase/react-native-smallcase-gateway/commit/e2b139426a488a94bfe514265a8599c81ffb31b8))
|
|
18
|
+
|
|
19
|
+
### [1.3.3](https://github.com/smallcase/react-native-smallcase-gateway/compare/v1.3.2...v1.3.3) (2022-06-02)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* Login Fallback Fragment UI ([36f2285](https://github.com/smallcase/react-native-smallcase-gateway/commit/36f228594b20c57310d6391f38a796a4ba242b6e))
|
|
25
|
+
|
|
5
26
|
### [1.3.2](https://github.com/smallcase/react-native-smallcase-gateway/compare/v1.3.1...v1.3.2) (2022-06-02)
|
|
6
27
|
|
|
7
28
|
|
package/android/build.gradle
CHANGED
|
@@ -82,7 +82,7 @@ repositories {
|
|
|
82
82
|
dependencies {
|
|
83
83
|
//noinspection GradleDynamicVersion
|
|
84
84
|
implementation 'com.facebook.react:react-native:+' // From node_modules
|
|
85
|
-
implementation 'com.smallcase.gateway:sdk:3.
|
|
85
|
+
implementation 'com.smallcase.gateway:sdk:3.4.1'
|
|
86
86
|
implementation "androidx.core:core-ktx:1.3.1"
|
|
87
87
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
88
88
|
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
package com.smallcase.gateway.reactnative
|
|
2
2
|
|
|
3
|
-
import android.content.ClipboardManager
|
|
4
|
-
import android.content.Context
|
|
5
3
|
import android.util.Log
|
|
6
|
-
import android.widget.Toast
|
|
7
4
|
import com.facebook.react.bridge.*
|
|
8
5
|
import com.smallcase.gateway.data.SmallcaseGatewayListeners
|
|
9
6
|
import com.smallcase.gateway.data.SmallcaseLogoutListener
|
|
@@ -14,6 +11,8 @@ import com.smallcase.gateway.data.models.*
|
|
|
14
11
|
import com.smallcase.gateway.data.requests.InitRequest
|
|
15
12
|
import com.smallcase.gateway.portal.SmallcaseGatewaySdk
|
|
16
13
|
import com.smallcase.gateway.data.listeners.LeadGenResponseListener
|
|
14
|
+
import com.smallcase.gateway.portal.SmallplugPartnerProps
|
|
15
|
+
import kotlin.Error
|
|
17
16
|
|
|
18
17
|
|
|
19
18
|
class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactContextBaseJavaModule(reactContext!!) {
|
|
@@ -26,13 +25,7 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
|
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
@ReactMethod
|
|
29
|
-
fun setConfigEnvironment(
|
|
30
|
-
envName: String,
|
|
31
|
-
gateway: String,
|
|
32
|
-
isLeprechaunActive: Boolean,
|
|
33
|
-
isAmoEnabled: Boolean,
|
|
34
|
-
preProvidedBrokers: ReadableArray,
|
|
35
|
-
promise: Promise) {
|
|
28
|
+
fun setConfigEnvironment(envName: String, gateway: String, isLeprechaunActive: Boolean, isAmoEnabled: Boolean, preProvidedBrokers: ReadableArray, promise: Promise) {
|
|
36
29
|
|
|
37
30
|
try {
|
|
38
31
|
val brokerList = ArrayList<String>()
|
|
@@ -45,25 +38,17 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
|
|
|
45
38
|
|
|
46
39
|
val protocol = getProtocol(envName)
|
|
47
40
|
|
|
48
|
-
val env = Environment(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
override fun onGatewaySetupSuccessfull() {
|
|
60
|
-
promise.resolve(true)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
override fun onGatewaySetupFailed(error: String) {
|
|
64
|
-
promise.reject(Throwable(error))
|
|
65
|
-
}
|
|
66
|
-
})
|
|
41
|
+
val env = Environment(gateway = gateway, buildType = protocol, isAmoEnabled = isAmoEnabled, preProvidedBrokers = brokerList, isLeprachaunActive = isLeprechaunActive)
|
|
42
|
+
|
|
43
|
+
SmallcaseGatewaySdk.setConfigEnvironment(environment = env, smallcaseGatewayListeners = object : SmallcaseGatewayListeners {
|
|
44
|
+
override fun onGatewaySetupSuccessfull() {
|
|
45
|
+
promise.resolve(true)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
override fun onGatewaySetupFailed(error: String) {
|
|
49
|
+
promise.reject(Throwable(error))
|
|
50
|
+
}
|
|
51
|
+
})
|
|
67
52
|
} catch (e: Exception) {
|
|
68
53
|
promise.reject(e)
|
|
69
54
|
}
|
|
@@ -86,19 +71,17 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
|
|
|
86
71
|
Log.d(TAG, "init: start")
|
|
87
72
|
|
|
88
73
|
val initReq = InitRequest(sdkToken)
|
|
89
|
-
SmallcaseGatewaySdk.init(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
promise.reject("error", err)
|
|
95
|
-
}
|
|
74
|
+
SmallcaseGatewaySdk.init(authRequest = initReq, gatewayInitialisationListener = object : DataListener<InitialisationResponse> {
|
|
75
|
+
override fun onFailure(errorCode: Int, errorMessage: String) {
|
|
76
|
+
val err = createErrorJSON(errorCode, errorMessage, null)
|
|
77
|
+
promise.reject("error", err)
|
|
78
|
+
}
|
|
96
79
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
80
|
+
override fun onSuccess(response: InitialisationResponse) {
|
|
81
|
+
promise.resolve(true)
|
|
82
|
+
}
|
|
100
83
|
|
|
101
|
-
|
|
84
|
+
})
|
|
102
85
|
}
|
|
103
86
|
|
|
104
87
|
@ReactMethod
|
|
@@ -115,22 +98,21 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
|
|
|
115
98
|
val activity = currentActivity;
|
|
116
99
|
if (activity != null) {
|
|
117
100
|
val utm = readableMapToStrHashMap(utmParams)
|
|
118
|
-
SmallcaseGatewaySdk.triggerTransaction(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
})
|
|
101
|
+
SmallcaseGatewaySdk.triggerTransaction(utmParams = utm,
|
|
102
|
+
activity = activity,
|
|
103
|
+
transactionId = transactionId,
|
|
104
|
+
preProvidedBrokers = safeBrokerList,
|
|
105
|
+
transactionResponseListener = object : TransactionResponseListener {
|
|
106
|
+
override fun onSuccess(transactionResult: TransactionResult) {
|
|
107
|
+
val res = resultToWritableMap(transactionResult, true)
|
|
108
|
+
promise.resolve(res)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
override fun onError(errorCode: Int, errorMessage: String, data: String?) {
|
|
112
|
+
val err = createErrorJSON(errorCode, errorMessage, data)
|
|
113
|
+
promise.reject("error", err)
|
|
114
|
+
}
|
|
115
|
+
})
|
|
134
116
|
} else {
|
|
135
117
|
promise.reject(Throwable("no activity"))
|
|
136
118
|
}
|
|
@@ -140,19 +122,16 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
|
|
|
140
122
|
fun showOrders(promise: Promise) {
|
|
141
123
|
val activity = currentActivity;
|
|
142
124
|
if (activity != null) {
|
|
143
|
-
SmallcaseGatewaySdk.showOrders(
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
promise.resolve(true)
|
|
148
|
-
}
|
|
125
|
+
SmallcaseGatewaySdk.showOrders(activity = activity, showOrdersResponseListener = object : DataListener<Any> {
|
|
126
|
+
override fun onSuccess(response: Any) {
|
|
127
|
+
promise.resolve(true)
|
|
128
|
+
}
|
|
149
129
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
130
|
+
override fun onFailure(errorCode: Int, errorMessage: String) {
|
|
131
|
+
val err = createErrorJSON(errorCode, errorMessage, null)
|
|
132
|
+
promise.reject("error", err)
|
|
154
133
|
}
|
|
155
|
-
)
|
|
134
|
+
})
|
|
156
135
|
}
|
|
157
136
|
}
|
|
158
137
|
|
|
@@ -172,7 +151,51 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
|
|
|
172
151
|
promise.resolve(res)
|
|
173
152
|
}
|
|
174
153
|
|
|
175
|
-
})
|
|
154
|
+
}, smallplugPartnerProps = SmallplugPartnerProps(headerColor = "#2F363F", backIconColor = "ffffff"))
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@ReactMethod
|
|
158
|
+
fun launchSmallplugWithBranding(targetEndpoint: String, params: String, readableMap: ReadableMap?, promise: Promise) {
|
|
159
|
+
|
|
160
|
+
fun getColorValue(value: Any?, defaultValue: String): String {
|
|
161
|
+
return when (value) {
|
|
162
|
+
is String -> {
|
|
163
|
+
if (value.length < 6) defaultValue else if (!value.contains("#")) "#$value" else value
|
|
164
|
+
}
|
|
165
|
+
else -> {
|
|
166
|
+
defaultValue
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
Log.d(TAG, "launchSmallplugWithBranding: start")
|
|
171
|
+
|
|
172
|
+
var partnerProps: SmallplugPartnerProps? = SmallplugPartnerProps(headerColor = "#2F363F", backIconColor = "ffffff")
|
|
173
|
+
|
|
174
|
+
try {
|
|
175
|
+
partnerProps = readableMap?.toHashMap()?.let { map ->
|
|
176
|
+
val hc = getColorValue(map["headerColor"], "#2F363F")
|
|
177
|
+
val ho = map["headerOpacity"]?.let { if (it is Double) it else 1.0 } ?: 1.0
|
|
178
|
+
val bc = getColorValue(map["backIconColor"], "#ffffff")
|
|
179
|
+
val bo = map["backIconOpacity"]?.let { if (it is Double) it else 1.0 } ?: 1.0
|
|
180
|
+
SmallplugPartnerProps(headerColor = hc, headerOpacity = ho, backIconColor = bc, backIconOpacity = bo)
|
|
181
|
+
}
|
|
182
|
+
} catch (e: Throwable) {
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
SmallcaseGatewaySdk.launchSmallPlug(currentActivity!!, SmallplugData(targetEndpoint, params), object : SmallPlugResponseListener {
|
|
187
|
+
override fun onFailure(errorCode: Int, errorMessage: String) {
|
|
188
|
+
val err = createErrorJSON(errorCode, errorMessage, null)
|
|
189
|
+
|
|
190
|
+
promise.reject("error", err)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
override fun onSuccess(smallPlugResult: SmallPlugResult) {
|
|
194
|
+
val res = resultToWritableMap(smallPlugResult)
|
|
195
|
+
promise.resolve(res)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
}, partnerProps)
|
|
176
199
|
}
|
|
177
200
|
|
|
178
201
|
@ReactMethod
|
|
@@ -196,18 +219,16 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
|
|
|
196
219
|
fun logoutUser(promise: Promise) {
|
|
197
220
|
val activity = currentActivity;
|
|
198
221
|
if (activity != null) {
|
|
199
|
-
SmallcaseGatewaySdk.logoutUser(
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
210
|
-
})
|
|
222
|
+
SmallcaseGatewaySdk.logoutUser(activity = activity, logoutListener = object : SmallcaseLogoutListener {
|
|
223
|
+
override fun onLogoutSuccessfull() {
|
|
224
|
+
promise.resolve(true)
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
override fun onLogoutFailed(errorCode: Int, error: String) {
|
|
228
|
+
val err = createErrorJSON(errorCode, error, null)
|
|
229
|
+
promise.reject("error", err)
|
|
230
|
+
}
|
|
231
|
+
})
|
|
211
232
|
}
|
|
212
233
|
}
|
|
213
234
|
|
|
@@ -215,11 +236,7 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
|
|
|
215
236
|
fun triggerLeadGen(userDetails: ReadableMap, utmData: ReadableMap) {
|
|
216
237
|
val activity = currentActivity;
|
|
217
238
|
if (activity != null) {
|
|
218
|
-
SmallcaseGatewaySdk.triggerLeadGen(
|
|
219
|
-
activity=activity,
|
|
220
|
-
utmParams = readableMapToStrHashMap(utmData),
|
|
221
|
-
params = readableMapToStrHashMap(userDetails)
|
|
222
|
-
)
|
|
239
|
+
SmallcaseGatewaySdk.triggerLeadGen(activity = activity, utmParams = readableMapToStrHashMap(utmData), params = readableMapToStrHashMap(userDetails))
|
|
223
240
|
}
|
|
224
241
|
}
|
|
225
242
|
|
|
@@ -228,7 +245,7 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
|
|
|
228
245
|
val activity = currentActivity
|
|
229
246
|
if (activity != null) {
|
|
230
247
|
|
|
231
|
-
SmallcaseGatewaySdk.triggerLeadGen(activity, readableMapToStrHashMap(userDetails), object: LeadGenResponseListener {
|
|
248
|
+
SmallcaseGatewaySdk.triggerLeadGen(activity, readableMapToStrHashMap(userDetails), object : LeadGenResponseListener {
|
|
232
249
|
override fun onSuccess(leadResponse: String) {
|
|
233
250
|
promise.resolve(leadResponse)
|
|
234
251
|
}
|
package/ios/SmallcaseGateway.m
CHANGED
|
@@ -299,6 +299,61 @@ RCT_REMAP_METHOD(launchSmallplug,
|
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
+
RCT_REMAP_METHOD(launchSmallplugWithBranding,
|
|
303
|
+
targetEndpoint:(NSString *)targetEndpoint
|
|
304
|
+
params:(NSString *)params
|
|
305
|
+
headerColor:(NSString *)headerColor
|
|
306
|
+
headerOpacity:(nonnull NSNumber *)headerOpacity
|
|
307
|
+
backIconColor:(NSString *)backIconColor
|
|
308
|
+
backIconOpacity:(nonnull NSNumber *)backIconOpacity
|
|
309
|
+
launchSmallplugWithResolver:(RCTPromiseResolveBlock)resolve
|
|
310
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
311
|
+
{
|
|
312
|
+
dispatch_async(dispatch_get_main_queue(), ^(void) {
|
|
313
|
+
|
|
314
|
+
SmallplugData *smallplugData = [[SmallplugData alloc] init:targetEndpoint :params];
|
|
315
|
+
SmallplugUiConfig *smallplugUiConfig = [[SmallplugUiConfig alloc] initWithSmallplugHeaderColor:headerColor headerColorOpacity:headerOpacity backIconColor:backIconColor backIconColorOpacity:backIconOpacity];
|
|
316
|
+
|
|
317
|
+
[SCGateway.shared launchSmallPlugWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController] smallplugData:smallplugData smallplugUiConfig:smallplugUiConfig completion:^(id smallplugResponse, NSError * error) {
|
|
318
|
+
|
|
319
|
+
NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
|
|
320
|
+
|
|
321
|
+
if (error != nil) {
|
|
322
|
+
NSLog(@"%@", error.domain);
|
|
323
|
+
double delayInSeconds = 0.5;
|
|
324
|
+
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
|
|
325
|
+
dispatch_after(popTime, dispatch_get_main_queue(), ^(void) {
|
|
326
|
+
NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
|
|
327
|
+
[responseDict setValue:[NSNumber numberWithBool:false] forKey:@"success"];
|
|
328
|
+
[responseDict setValue:[NSNumber numberWithInteger:error.code] forKey:@"errorCode"];
|
|
329
|
+
[responseDict setValue:error.domain forKey:@"error"];
|
|
330
|
+
|
|
331
|
+
resolve(responseDict);
|
|
332
|
+
return;
|
|
333
|
+
});
|
|
334
|
+
} else {
|
|
335
|
+
|
|
336
|
+
if ([smallplugResponse isKindOfClass: [NSString class]]) {
|
|
337
|
+
NSLog(@"%@", smallplugResponse);
|
|
338
|
+
|
|
339
|
+
[responseDict setValue:[NSNumber numberWithBool: true] forKey:@"success"];
|
|
340
|
+
[responseDict setValue:smallplugResponse forKey:@"smallcaseAuthToken"];
|
|
341
|
+
|
|
342
|
+
double delayInSeconds = 0.5;
|
|
343
|
+
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
|
|
344
|
+
dispatch_after(popTime, dispatch_get_main_queue(), ^(void) {
|
|
345
|
+
|
|
346
|
+
resolve(responseDict);
|
|
347
|
+
return;
|
|
348
|
+
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
}];
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
|
|
302
357
|
RCT_REMAP_METHOD(archiveSmallcase,
|
|
303
358
|
iscid:(NSString *)iscid
|
|
304
359
|
initWithResolver:(RCTPromiseResolveBlock)resolve
|
package/package.json
CHANGED
package/src/SmallcaseGateway.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NativeModules } from "react-native";
|
|
1
|
+
import { NativeModules, Platform } from "react-native";
|
|
2
2
|
import { ENV } from "./constants";
|
|
3
|
-
import { safeObject } from "./util";
|
|
3
|
+
import { safeObject, platformSpecificColorHex } from "./util";
|
|
4
4
|
import { version } from "../package.json";
|
|
5
5
|
const { SmallcaseGateway: SmallcaseGatewayNative } = NativeModules;
|
|
6
6
|
|
|
@@ -24,6 +24,12 @@ const { SmallcaseGateway: SmallcaseGatewayNative } = NativeModules;
|
|
|
24
24
|
* @property {String} email - email of user
|
|
25
25
|
* @property {String} contact - contact of user
|
|
26
26
|
* @property {String} pinCode - pin-code of user
|
|
27
|
+
*
|
|
28
|
+
* @typedef {Object} SmallplugUiConfig
|
|
29
|
+
* @property {String} headerColor - color of the header background
|
|
30
|
+
* @property {Number} headerOpacity - opacity of the header background
|
|
31
|
+
* @property {String} backIconColor - color of the back icon
|
|
32
|
+
* @property {Number} backIconOpacity - opacity of the back icon
|
|
27
33
|
*/
|
|
28
34
|
|
|
29
35
|
let defaultBrokerList = [];
|
|
@@ -36,7 +42,7 @@ const setConfigEnvironment = async (envConfig) => {
|
|
|
36
42
|
const safeConfig = safeObject(envConfig);
|
|
37
43
|
|
|
38
44
|
await SmallcaseGatewayNative.setHybridSdkVersion(version);
|
|
39
|
-
|
|
45
|
+
|
|
40
46
|
const {
|
|
41
47
|
brokerList,
|
|
42
48
|
gatewayName,
|
|
@@ -115,6 +121,45 @@ const launchSmallplug = async (targetEndpoint, params) => {
|
|
|
115
121
|
|
|
116
122
|
}
|
|
117
123
|
|
|
124
|
+
const safeGatewayName = typeof gatewayName === "string" ? gatewayName : "";
|
|
125
|
+
/**
|
|
126
|
+
* launches smallcases module
|
|
127
|
+
*
|
|
128
|
+
* @param {string} targetEndpoint
|
|
129
|
+
* @param {string} params
|
|
130
|
+
* @param {string} headerColor
|
|
131
|
+
* @param {number} headerOpacity
|
|
132
|
+
* @param {string} backIconColor
|
|
133
|
+
* @param {number} backIconOpacity
|
|
134
|
+
*/
|
|
135
|
+
const launchSmallplugWithBranding = async (targetEndpoint, params, headerColor, headerOpacity, backIconColor, backIconOpacity) => {
|
|
136
|
+
const safeEndpoint = typeof targetEndpoint === "string" ? targetEndpoint : ""
|
|
137
|
+
const safeParams = typeof params === "string" ? params : ""
|
|
138
|
+
const safeHeaderColor = typeof headerColor === "string" ? headerColor : platformSpecificColorHex("2F363F")
|
|
139
|
+
const safeHeaderOpacity = typeof headerOpacity === "number" ? headerOpacity : 1
|
|
140
|
+
const safeBackIconColor = typeof backIconColor === "string" ? backIconColor : platformSpecificColorHex("FFFFFF")
|
|
141
|
+
const safeBackIconOpacity = typeof backIconOpacity === "number" ? backIconOpacity : 1
|
|
142
|
+
|
|
143
|
+
return Platform.OS === 'android' ?
|
|
144
|
+
SmallcaseGatewayNative.launchSmallplugWithBranding(
|
|
145
|
+
safeEndpoint, safeParams,
|
|
146
|
+
{
|
|
147
|
+
headerColor: safeHeaderColor,
|
|
148
|
+
headerOpacity: safeHeaderOpacity,
|
|
149
|
+
backIconColor: safeBackIconColor,
|
|
150
|
+
backIconOpacity: safeBackIconOpacity
|
|
151
|
+
})
|
|
152
|
+
: SmallcaseGatewayNative.launchSmallplugWithBranding(
|
|
153
|
+
safeEndpoint,
|
|
154
|
+
safeParams,
|
|
155
|
+
safeHeaderColor,
|
|
156
|
+
safeHeaderOpacity,
|
|
157
|
+
safeBackIconColor,
|
|
158
|
+
safeBackIconOpacity
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
}
|
|
162
|
+
|
|
118
163
|
/**
|
|
119
164
|
* Logs the user out and removes the web session.
|
|
120
165
|
*
|
|
@@ -154,7 +199,7 @@ const triggerLeadGen = (userDetails, utmParams) => {
|
|
|
154
199
|
* @param {userDetails} [userDetails]
|
|
155
200
|
* * @returns {Promise}
|
|
156
201
|
*/
|
|
157
|
-
|
|
202
|
+
const triggerLeadGenWithStatus = async (userDetails) => {
|
|
158
203
|
const safeParams = safeObject(userDetails);
|
|
159
204
|
|
|
160
205
|
return SmallcaseGatewayNative.triggerLeadGenWithStatus(safeParams);
|
|
@@ -189,6 +234,7 @@ const SmallcaseGateway = {
|
|
|
189
234
|
triggerTransaction,
|
|
190
235
|
setConfigEnvironment,
|
|
191
236
|
launchSmallplug,
|
|
237
|
+
launchSmallplugWithBranding,
|
|
192
238
|
getSdkVersion,
|
|
193
239
|
showOrders
|
|
194
240
|
};
|