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

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,
@@ -53,25 +53,25 @@ class DigioReactNative: RCTEventEmitter, DigioKycResponseDelegate,DigioEsignDele
53
53
  "clientSecretKey",
54
54
  from: config,
55
55
  reject: reject
56
- )
56
+ )
57
57
  // else { return }
58
58
 
59
59
  let clientToken = self.requiredString( "token",
60
60
  from: config,
61
61
  reject: reject
62
- )
63
-
62
+ )
63
+
64
64
  let logo = config["logo"] as? String
65
65
  let taskTypes = config["taskTypes"] as? [String] ?? ["SELFIE"]
66
-
66
+
67
67
  // Capture config
68
68
  var captureConfig = CaptureConfig()
69
69
  captureConfig.isImagePreview = true
70
70
  captureConfig.locationRequired = config["locationRequired"] as? Bool ?? false
71
71
  captureConfig.shouldShowInstructions = config["shouldShowInstructions"] as? Bool ?? false
72
72
  captureConfig.logoUrl = logo
73
-
74
-
73
+
74
+
75
75
  var digioTaskList = Array<DigioTaskRequest>()
76
76
 
77
77
  for task in taskTypes {
@@ -86,17 +86,25 @@ class DigioReactNative: RCTEventEmitter, DigioKycResponseDelegate,DigioEsignDele
86
86
 
87
87
  digioTaskList.append(request)
88
88
  }
89
-
89
+
90
90
  let rootViewController = UIApplication.shared.windows.filter({ (w) -> Bool in
91
91
  return w.isHidden == false
92
92
  }).first?.rootViewController
93
-
93
+
94
94
  if rootViewController != nil {
95
95
  do{
96
+ let env = sdkEnvironment.trimmingCharacters(in: .whitespacesAndNewlines).lowercased()
97
+
98
+ let digioEnv: DigioEnvironment =
99
+ env == "sandbox" ? DigioEnvironment.SANDBOX :
100
+ env == "development" ? DigioEnvironment.DEV :
101
+ DigioEnvironment.PRODUCTION
102
+
96
103
  try DigioKycBuilder()
97
104
  .withController(viewController: rootViewController!)
98
105
  .setLogo(logo: logo ?? "")
99
- .setEnvironment(environment: sdkEnvironment.elementsEqual("sandbox") ? DigioEnvironment.SANDBOX : DigioEnvironment.PRODUCTION)
106
+ // .setEnvironment(environment: sdkEnvironment.elementsEqual("sandbox") ? DigioEnvironment.SANDBOX : DigioEnvironment.PRODUCTION)
107
+ .setEnvironment(environment: digioEnv)
100
108
  .addTaskList(taskList: digioTaskList)
101
109
  .setReferenceIdUninqueRequestId(
102
110
  referenceId: "",
@@ -111,7 +119,7 @@ class DigioReactNative: RCTEventEmitter, DigioKycResponseDelegate,DigioEsignDele
111
119
  .build(token: clientToken,
112
120
  clientId: clientId
113
121
  )
114
-
122
+
115
123
  }catch {
116
124
  reject("Error", error.localizedDescription, error)
117
125
  }
@@ -120,7 +128,7 @@ class DigioReactNative: RCTEventEmitter, DigioKycResponseDelegate,DigioEsignDele
120
128
  }
121
129
  }
122
130
  }
123
-
131
+
124
132
  @objc(start:withIdentifier:withTokenId:withAdditionalData:withConfig:withResolver:withRejecter:)
125
133
  func start(documentId: String, identifier: String, tokenId: String?, additionalData: NSDictionary?, config: NSDictionary?, resolve:@escaping RCTPromiseResolveBlock,reject:@escaping RCTPromiseRejectBlock) -> Void {
126
134
  self.result = resolve;
@@ -278,23 +286,23 @@ class DigioReactNative: RCTEventEmitter, DigioKycResponseDelegate,DigioEsignDele
278
286
  print("onGatewayEvent esign \(event)")
279
287
  self.sendEvent(withName: "gatewayEvent", body: convertToDictionary(text: event))
280
288
  }
281
-
289
+
282
290
  /** stateless callbacks */
283
-
291
+
284
292
  func onDigioStatelessResponseSuccess(response: [DigiokycSDK.DigioTaskResponse]) {
285
293
  print("Success stateless \(response)")
286
294
  if self.result != nil {
287
295
  self.result(makeResultArray(from: response))
288
296
  }
289
297
  }
290
-
298
+
291
299
  func onDigioStatelessResponseFailure(response: [DigiokycSDK.DigioTaskResponse]) {
292
300
  print("Failure stateless \(response)")
293
301
  if self.result != nil {
294
302
  self.result(makeResultArray(from: response))
295
303
  }
296
304
  }
297
-
305
+
298
306
  func onDigioEventTracker(event: String) {
299
307
  print("onGatewayEvent stateless \(event)")
300
308
  self.sendEvent(withName: "gatewayEvent", body: convertToDictionary(text: event))
@@ -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.7",
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
  }