react-native-smallcase-gateway 0.6.0 → 0.10.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,19 @@
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.10.0](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.9.0...v0.10.0) (2022-01-07)
6
+
7
+ ## [0.9.0](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.8.0...v0.9.0) (2022-01-03)
8
+
9
+
10
+ ### Features
11
+
12
+ * 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))
13
+
14
+ ## [0.8.0](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.7.0...v0.8.0) (2021-11-15)
15
+
16
+ ## [0.7.0](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.6.0...v0.7.0) (2021-09-20)
17
+
5
18
  ## [0.6.0](https://gitlab.com/scGatewayOS/react-native-smallcase-gateway/compare/v0.5.0...v0.6.0) (2021-08-17)
6
19
 
7
20
 
@@ -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.9'
85
+ implementation 'com.smallcase.gateway:sdk:3.1.13'
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
@@ -255,12 +255,30 @@ RCT_REMAP_METHOD(logoutUser,
255
255
  });
256
256
  }
257
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
+
258
275
  RCT_EXPORT_METHOD(triggerLeadGen: (NSDictionary *)userParams utmParams:(NSDictionary *)utmParams)
259
276
  {
260
277
  dispatch_async(dispatch_get_main_queue(), ^(void) {
261
278
  [SCGateway.shared triggerLeadGenWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController] params:userParams utmParams: utmParams];
262
279
  });
263
280
  }
281
+
264
282
  @end
265
283
 
266
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.6.0",
4
+ "version": "0.10.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.2'
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,