react-native-smallcase-gateway 0.5.0 → 0.9.0

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 CHANGED
@@ -2,6 +2,24 @@
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
+ ## [0.9.0](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.8.0...v0.9.0) (2022-01-03)
6
+
7
+
8
+ ### Features
9
+
10
+ * updated android SDK to 3.1.10 and iOS SDK to 3.1.5 ([69d28f5](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/commit/69d28f5b75d7280beae9dd30d5481269f93daff6))
11
+
12
+ ## [0.8.0](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.7.0...v0.8.0) (2021-11-15)
13
+
14
+ ## [0.7.0](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.6.0...v0.7.0) (2021-09-20)
15
+
16
+ ## [0.6.0](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.5.0...v0.6.0) (2021-08-17)
17
+
18
+
19
+ ### Features
20
+
21
+ * added broker name to transaction responses ([c486fc0](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/commit/c486fc0e5d2093b1345ff5c750e94a913579ea9b))
22
+
5
23
  ## [0.5.0](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.4.0...v0.5.0) (2021-08-10)
6
24
 
7
25
 
@@ -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:2.9.5'
85
+ implementation 'com.smallcase.gateway:sdk:3.1.10'
86
86
  implementation "androidx.core:core-ktx:1.3.1"
87
87
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
88
88
  }
@@ -1,6 +1,9 @@
1
1
  package com.smallcase.gateway.reactnative
2
2
 
3
+ import android.content.ClipboardManager
4
+ import android.content.Context
3
5
  import android.util.Log
6
+ import android.widget.Toast
4
7
  import com.facebook.react.bridge.*
5
8
  import com.smallcase.gateway.data.SmallcaseGatewayListeners
6
9
  import com.smallcase.gateway.data.SmallcaseLogoutListener
@@ -180,6 +183,33 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
180
183
  }
181
184
  }
182
185
 
186
+ @ReactMethod
187
+ fun triggerLeadGenWithStatus(userDetails: ReadableMap, promise: Promise) {
188
+ val activity = currentActivity;
189
+ if (activity != null) {
190
+ SmallcaseGatewaySdk.triggerLeadGen(activity,readableMapToStrHashMap(userDetails), object : TransactionResponseListener {
191
+ override fun onSuccess(transactionResult: TransactionResult) {
192
+ if (transactionResult.success) {
193
+ val res = resultToWritableMap(transactionResult)
194
+ promise.resolve(res)
195
+ } else {
196
+ val err = createErrorJSON(
197
+ transactionResult.errorCode,
198
+ transactionResult.error
199
+ )
200
+ promise.reject("error", err)
201
+ }
202
+ }
203
+
204
+ override fun onError(errorCode: Int, errorMessage: String) {
205
+ val err = createErrorJSON(errorCode, errorMessage)
206
+ promise.reject("error", err)
207
+ }
208
+
209
+ })
210
+ }
211
+ }
212
+
183
213
  private fun getProtocol(envName: String): Environment.PROTOCOL {
184
214
  return when (envName) {
185
215
  "production" -> Environment.PROTOCOL.PRODUCTION
@@ -153,15 +153,10 @@ RCT_REMAP_METHOD(triggerTransaction,
153
153
  ObjCTransactionIntentConnect *trxResponse = response;
154
154
  [responseDict setValue:@"CONNECT" forKey:@"transaction"];
155
155
 
156
- if (trxResponse.transaction != nil) {
157
- NSData *decodedStringData = [[NSData alloc] initWithBase64EncodedString:trxResponse.transaction options: 0];
158
- NSString *decodedResponse = [[NSString alloc] initWithData:decodedStringData encoding:1];
159
-
160
- [responseDict setValue:decodedResponse forKey:@"data"];
161
- } else if (trxResponse.authToken != nil) {
162
- [responseDict setValue:trxResponse.authToken forKey:@"data"];
156
+ if (trxResponse.response != nil) {
157
+ [responseDict setValue:trxResponse.response forKey:@"data"];
163
158
  }
164
-
159
+
165
160
  resolve(responseDict);
166
161
  return;
167
162
  }
@@ -174,7 +169,7 @@ RCT_REMAP_METHOD(triggerTransaction,
174
169
  NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
175
170
  [dict setValue: trxResponse.authToken forKey:@"smallcaseAuthToken"];
176
171
  [dict setValue: trxResponse.transactionId forKey:@"transactionId"];
177
-
172
+ [dict setValue: trxResponse.broker forKey:@"broker"];
178
173
 
179
174
  [responseDict setValue:dict forKey:@"data"];
180
175
  resolve(responseDict);
@@ -260,12 +255,30 @@ RCT_REMAP_METHOD(logoutUser,
260
255
  });
261
256
  }
262
257
 
258
+
259
+ RCT_REMAP_METHOD(triggerLeadGenWithStatus,
260
+ userParams: (NSDictionary *)userParams
261
+ leadGenGenWithResolver: (RCTPromiseResolveBlock)resolve
262
+ rejecter:(RCTPromiseRejectBlock)reject)
263
+ {
264
+ dispatch_async(dispatch_get_main_queue(), ^(void) {
265
+
266
+ [SCGateway.shared triggerLeadGenWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController] params:userParams
267
+ completion:^(NSString * leadGenResponse) {
268
+ resolve(leadGenResponse);
269
+ }
270
+ ];
271
+
272
+ });
273
+ }
274
+
263
275
  RCT_EXPORT_METHOD(triggerLeadGen: (NSDictionary *)userParams utmParams:(NSDictionary *)utmParams)
264
276
  {
265
277
  dispatch_async(dispatch_get_main_queue(), ^(void) {
266
278
  [SCGateway.shared triggerLeadGenWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController] params:userParams utmParams: utmParams];
267
279
  });
268
280
  }
281
+
269
282
  @end
270
283
 
271
284
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-smallcase-gateway",
3
3
  "title": "React Native Smallcase Gateway",
4
- "version": "0.5.0",
4
+ "version": "0.9.0",
5
5
  "description": "smallcase gateway bindings for react native",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -23,6 +23,6 @@ Pod::Spec.new do |s|
23
23
  s.requires_arc = true
24
24
 
25
25
  s.dependency "React-Core"
26
- s.dependency 'SCGateway', '3.0.0'
26
+ s.dependency 'SCGateway', '3.1.5'
27
27
  end
28
28
 
@@ -119,6 +119,32 @@ const triggerLeadGen = (userDetails, utmParams) => {
119
119
  return SmallcaseGatewayNative.triggerLeadGen(safeParams, safeUtm);
120
120
  };
121
121
 
122
+ // /**
123
+ // * triggers the lead gen flow
124
+ // *
125
+ // * @param {userDetails} [userDetails]
126
+ // * @param {Object} [utmParams]
127
+ // * * @returns {Promise}
128
+ // */
129
+ // const triggerLeadGen = async (userDetails, utmParams) => {
130
+ // const safeParams = safeObject(userDetails);
131
+ // const safeUtm = safeObject(utmParams);
132
+
133
+ // return SmallcaseGatewayNative.triggerLeadGen(safeParams, safeUtm)
134
+ // }
135
+
136
+ /**
137
+ * triggers the lead gen flow
138
+ *
139
+ * @param {userDetails} [userDetails]
140
+ * * @returns {Promise}
141
+ */
142
+ const triggerLeadGenWithStatus = async (userDetails) => {
143
+ const safeParams = safeObject(userDetails);
144
+
145
+ return SmallcaseGatewayNative.triggerLeadGenWithStatus(safeParams);
146
+ }
147
+
122
148
  /**
123
149
  * Marks a smallcase as archived
124
150
  *
@@ -134,6 +160,7 @@ const SmallcaseGateway = {
134
160
  init,
135
161
  logoutUser,
136
162
  triggerLeadGen,
163
+ triggerLeadGenWithStatus,
137
164
  archiveSmallcase,
138
165
  triggerTransaction,
139
166
  setConfigEnvironment,