@digiotech/react-native 2.0.11-beta.6 → 2.0.11-beta.8

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.
@@ -6,13 +6,13 @@ import DigioEsignSDK
6
6
 
7
7
  @objc(DigioReactNative)
8
8
  class DigioReactNative: RCTEventEmitter, DigioKycResponseDelegate,DigioEsignDelegate, DigioResponseDelegate {
9
-
9
+
10
10
  var result: RCTPromiseResolveBlock!
11
11
 
12
12
  override func supportedEvents() -> [String]! {
13
13
  return ["gatewayEvent"]
14
14
  }
15
-
15
+
16
16
 
17
17
  @objc(startStateless:withResolver:withRejecter:)
18
18
  func startStateless(
@@ -27,7 +27,7 @@ class DigioReactNative: RCTEventEmitter, DigioKycResponseDelegate,DigioEsignDele
27
27
  reject("Error", "Config missing", nil)
28
28
  return
29
29
  }
30
-
30
+
31
31
  launchStatelessSDK(config: config, reject: reject)
32
32
  }
33
33
 
@@ -35,8 +35,8 @@ class DigioReactNative: RCTEventEmitter, DigioKycResponseDelegate,DigioEsignDele
35
35
  config: NSDictionary,
36
36
  reject: @escaping RCTPromiseRejectBlock
37
37
  ) {
38
-
39
- DispatchQueue.main.async {
38
+
39
+ DispatchQueue.main.async {
40
40
  guard let sdkEnvironment = self.requiredString(
41
41
  "environment",
42
42
  from: config,
@@ -49,29 +49,31 @@ class DigioReactNative: RCTEventEmitter, DigioKycResponseDelegate,DigioEsignDele
49
49
  reject: reject
50
50
  ) else { return }
51
51
 
52
- guard let clientSecretKey = self.requiredString(
53
- "clientSecretKey",
54
- from: config,
55
- reject: reject
56
- )
57
- // else { return }
52
+ // guard let clientSecretKey = self.requiredString(
53
+ // "clientSecretKey",
54
+ // from: config,
55
+ // reject: reject
56
+ // )else { return }
58
57
 
59
- let clientToken = self.requiredString( "token",
60
- from: config,
61
- reject: reject
62
- )
63
-
58
+ guard let clientToken = self.requiredString( "token",
59
+ from: config,
60
+ reject: reject
61
+ )else{return}
62
+
63
+ let clientSecretKey = self.optionalString("clientSecretKey", from: config)
64
+ // let clientToken = optionalString("token", from: config)
65
+
64
66
  let logo = config["logo"] as? String
65
67
  let taskTypes = config["taskTypes"] as? [String] ?? ["SELFIE"]
66
-
68
+
67
69
  // Capture config
68
70
  var captureConfig = CaptureConfig()
69
71
  captureConfig.isImagePreview = true
70
72
  captureConfig.locationRequired = config["locationRequired"] as? Bool ?? false
71
73
  captureConfig.shouldShowInstructions = config["shouldShowInstructions"] as? Bool ?? false
72
74
  captureConfig.logoUrl = logo
73
-
74
-
75
+
76
+
75
77
  var digioTaskList = Array<DigioTaskRequest>()
76
78
 
77
79
  for task in taskTypes {
@@ -86,17 +88,26 @@ class DigioReactNative: RCTEventEmitter, DigioKycResponseDelegate,DigioEsignDele
86
88
 
87
89
  digioTaskList.append(request)
88
90
  }
89
-
91
+
90
92
  let rootViewController = UIApplication.shared.windows.filter({ (w) -> Bool in
91
93
  return w.isHidden == false
92
94
  }).first?.rootViewController
93
-
95
+
94
96
  if rootViewController != nil {
95
97
  do{
98
+
96
99
  try DigioKycBuilder()
97
100
  .withController(viewController: rootViewController!)
98
101
  .setLogo(logo: logo ?? "")
99
- .setEnvironment(environment: sdkEnvironment.elementsEqual("sandbox") ? DigioEnvironment.SANDBOX : DigioEnvironment.PRODUCTION)
102
+ // .setEnvironment(environment: sdkEnvironment.elementsEqual("sandbox") ? DigioEnvironment.SANDBOX : DigioEnvironment.PRODUCTION)
103
+ .setEnvironment(
104
+ environment:
105
+ sdkEnvironment.lowercased().elementsEqual("sandbox")
106
+ ? DigioEnvironment.SANDBOX
107
+ : sdkEnvironment.lowercased().elementsEqual("development")
108
+ ? DigioEnvironment.DEV
109
+ : DigioEnvironment.PRODUCTION
110
+ )
100
111
  .addTaskList(taskList: digioTaskList)
101
112
  .setReferenceIdUninqueRequestId(
102
113
  referenceId: "",
@@ -111,7 +122,7 @@ class DigioReactNative: RCTEventEmitter, DigioKycResponseDelegate,DigioEsignDele
111
122
  .build(token: clientToken,
112
123
  clientId: clientId
113
124
  )
114
-
125
+
115
126
  }catch {
116
127
  reject("Error", error.localizedDescription, error)
117
128
  }
@@ -120,7 +131,7 @@ class DigioReactNative: RCTEventEmitter, DigioKycResponseDelegate,DigioEsignDele
120
131
  }
121
132
  }
122
133
  }
123
-
134
+
124
135
  @objc(start:withIdentifier:withTokenId:withAdditionalData:withConfig:withResolver:withRejecter:)
125
136
  func start(documentId: String, identifier: String, tokenId: String?, additionalData: NSDictionary?, config: NSDictionary?, resolve:@escaping RCTPromiseResolveBlock,reject:@escaping RCTPromiseRejectBlock) -> Void {
126
137
  self.result = resolve;
@@ -278,23 +289,23 @@ class DigioReactNative: RCTEventEmitter, DigioKycResponseDelegate,DigioEsignDele
278
289
  print("onGatewayEvent esign \(event)")
279
290
  self.sendEvent(withName: "gatewayEvent", body: convertToDictionary(text: event))
280
291
  }
281
-
292
+
282
293
  /** stateless callbacks */
283
-
294
+
284
295
  func onDigioStatelessResponseSuccess(response: [DigiokycSDK.DigioTaskResponse]) {
285
296
  print("Success stateless \(response)")
286
297
  if self.result != nil {
287
298
  self.result(makeResultArray(from: response))
288
299
  }
289
300
  }
290
-
301
+
291
302
  func onDigioStatelessResponseFailure(response: [DigiokycSDK.DigioTaskResponse]) {
292
303
  print("Failure stateless \(response)")
293
304
  if self.result != nil {
294
305
  self.result(makeResultArray(from: response))
295
306
  }
296
307
  }
297
-
308
+
298
309
  func onDigioEventTracker(event: String) {
299
310
  print("onGatewayEvent stateless \(event)")
300
311
  self.sendEvent(withName: "gatewayEvent", body: convertToDictionary(text: event))
@@ -335,4 +346,11 @@ private func requiredString(
335
346
  return value
336
347
  }
337
348
 
349
+ func optionalString(_ key: String, from config: NSDictionary) -> String? {
350
+ guard let value = config[key] as? String else { return nil }
351
+
352
+ let trimmed = value.trimmingCharacters(in: .whitespacesAndNewlines)
353
+ return trimmed.isEmpty ? nil : trimmed
354
+ }
355
+
338
356
  }
@@ -7,6 +7,7 @@ exports.Environment = void 0;
7
7
  let Environment = exports.Environment = /*#__PURE__*/function (Environment) {
8
8
  Environment["SANDBOX"] = "sandbox";
9
9
  Environment["PRODUCTION"] = "production";
10
+ Environment["DEVELOPMENT"] = "development";
10
11
  return Environment;
11
12
  }({});
12
13
  //# sourceMappingURL=environment.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Environment","exports"],"sourceRoot":"../../../../src","sources":["types/enums/environment.ts"],"mappings":";;;;;;IAAYA,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["Environment","exports"],"sourceRoot":"../../../../src","sources":["types/enums/environment.ts"],"mappings":";;;;;;IAAYA,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA","ignoreList":[]}
@@ -1,6 +1,7 @@
1
1
  export let Environment = /*#__PURE__*/function (Environment) {
2
2
  Environment["SANDBOX"] = "sandbox";
3
3
  Environment["PRODUCTION"] = "production";
4
+ Environment["DEVELOPMENT"] = "development";
4
5
  return Environment;
5
6
  }({});
6
7
  //# sourceMappingURL=environment.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Environment"],"sourceRoot":"../../../../src","sources":["types/enums/environment.ts"],"mappings":"AAAA,WAAYA,WAAW,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["Environment"],"sourceRoot":"../../../../src","sources":["types/enums/environment.ts"],"mappings":"AAAA,WAAYA,WAAW,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA","ignoreList":[]}
@@ -1,5 +1,6 @@
1
1
  export declare enum Environment {
2
2
  SANDBOX = "sandbox",
3
- PRODUCTION = "production"
3
+ PRODUCTION = "production",
4
+ DEVELOPMENT = "development"
4
5
  }
5
6
  //# sourceMappingURL=environment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../../../src/types/enums/environment.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,OAAO,YAAY;IACnB,UAAU,eAAe;CAC1B"}
1
+ {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../../../src/types/enums/environment.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,WAAW,gBAAgB;CAC5B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digiotech/react-native",
3
- "version": "2.0.11-beta.6",
3
+ "version": "2.0.11-beta.8",
4
4
  "description": "SDK for invoking client side journey for any of Digio request",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -1,4 +1,5 @@
1
1
  export enum Environment {
2
2
  SANDBOX = 'sandbox',
3
3
  PRODUCTION = 'production',
4
+ DEVELOPMENT = 'development'
4
5
  }