@velocitycareerlabs/vcl-react-native 2.10.0-rc → 2.10.0-rc.2

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/README.md CHANGED
@@ -45,6 +45,21 @@ yarn add @velocitycareerlabs/vcl-react-native
45
45
  npm install @velocitycareerlabs/vcl-react-native --save
46
46
  ```
47
47
 
48
+ ### Native SDK versions
49
+ By default, the package pins native iOS and Android SDK versions through
50
+ `vclNativeSdkVersions` in its `package.json`, falling back to the React Native
51
+ package version if no native pin is present.
52
+
53
+ ```json
54
+ {
55
+ "version": "2.10.0",
56
+ "vclNativeSdkVersions": {
57
+ "ios": "2.10.0-rc",
58
+ "android": "2.10.0-rc"
59
+ }
60
+ }
61
+ ```
62
+
48
63
  ### Usage
49
64
  To start using the VCL SDK, you’ll need to create its object and initialize it in Velocity Network™:
50
65
  ```js
@@ -66,7 +81,7 @@ vcl.initialize(initializationDescriptor).then(
66
81
  );
67
82
  ```
68
83
 
69
- SDK `2.10.0-rc` uses native taxonomy error codes by default. To temporarily
84
+ SDK `2.10.0` uses native taxonomy error codes by default. To temporarily
70
85
  preserve legacy native error-code mappings during migration, initialize with:
71
86
  ```js
72
87
  const initializationDescriptor: VCLInitializationDescriptor = {
@@ -2,6 +2,13 @@ require "json"
2
2
 
3
3
  package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
4
 
5
+ def first_present_value(*values)
6
+ values.find { |value| !value.nil? && !value.to_s.strip.empty? }
7
+ end
8
+
9
+ vcl_native_sdk_versions = package["vclNativeSdkVersions"] || {}
10
+ vcl_ios_sdk_version = first_present_value(vcl_native_sdk_versions["ios"], package["version"])
11
+
5
12
  Pod::Spec.new do |s|
6
13
  s.name = "VclReactNative"
7
14
  s.version = package["version"]
@@ -18,7 +25,7 @@ Pod::Spec.new do |s|
18
25
 
19
26
  s.swift_version = "5.0"
20
27
 
21
- s.dependency "VCL", "2.10.0-rc"
28
+ s.dependency "VCL", vcl_ios_sdk_version
22
29
 
23
30
  install_modules_dependencies(s)
24
31
  end
@@ -21,6 +21,16 @@ apply plugin: "kotlin-android"
21
21
 
22
22
  apply plugin: "com.facebook.react"
23
23
 
24
+ def packageJson = new groovy.json.JsonSlurper().parse(file("$projectDir/../package.json"))
25
+ def vclNativeSdkVersions = packageJson.vclNativeSdkVersions instanceof Map ? packageJson.vclNativeSdkVersions : [:]
26
+ def firstPresentValue = { values ->
27
+ return values.find { value -> value != null && value.toString().trim() }
28
+ }
29
+ def vclSdkVersion = firstPresentValue([
30
+ vclNativeSdkVersions.android,
31
+ packageJson.version,
32
+ ])
33
+
24
34
  def getExtOrIntegerDefault(name) {
25
35
  return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["VclReactNative_" + name]).toInteger()
26
36
  }
@@ -76,7 +86,7 @@ dependencies {
76
86
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
77
87
 
78
88
  //--------- Must: be added:
79
- implementation "io.velocitycareerlabs:vcl:2.10.0-rc"
89
+ implementation "io.velocitycareerlabs:vcl:$vclSdkVersion"
80
90
  implementation 'com.nimbusds:nimbus-jose-jwt:10.5'
81
91
  implementation "androidx.security:security-crypto:1.1.0"
82
92
  //-------------------------
@@ -504,7 +504,7 @@ func credentialManifestToDictionary(
504
504
  func dictionaryToCredentialManifest(
505
505
  _ credentialManifestDictionary: [String: Any]?
506
506
  ) -> VCLCredentialManifest {
507
- let jwt = VCLJwt(encodedJwt: (credentialManifestDictionary?["jwt"] as? [String: Any])?["encodedJwt"] as? String ?? "")
507
+ let jwt = jwtFromEncodedJwt((credentialManifestDictionary?["jwt"] as? [String: Any])?["encodedJwt"] as? String ?? "")
508
508
  let vendorOriginContext = credentialManifestDictionary?["vendorOriginContext"] as? String
509
509
  let verifiedProfileDictionary = credentialManifestDictionary?["verifiedProfile"] as? [String: Any]
510
510
  let deepLink = dictionaryToDeepLink(credentialManifestDictionary?["deepLink"] as? [String: Any])
@@ -591,7 +591,11 @@ func credentialTypesFormSchemaToDictionary(
591
591
  func dictionaryToJwt(
592
592
  _ jwtDictionary: [String: Any]?
593
593
  ) -> VCLJwt {
594
- return VCLJwt(encodedJwt: jwtDictionary?["encodedJwt"] as? String ?? "")
594
+ return jwtFromEncodedJwt(jwtDictionary?["encodedJwt"] as? String ?? "")
595
+ }
596
+
597
+ func jwtFromEncodedJwt(_ encodedJwt: String) -> VCLJwt {
598
+ return (try? VCLJwt(encodedJwt: encodedJwt)) ?? VCLJwt(header: nil, payload: nil, signature: nil, encodedJwt: encodedJwt)
595
599
  }
596
600
 
597
601
  func jwtToDictionary(_ jwt: VCLJwt) -> [String: Any?] {
package/package.json CHANGED
@@ -1,6 +1,10 @@
1
1
  {
2
2
  "name": "@velocitycareerlabs/vcl-react-native",
3
- "version": "2.10.0-rc",
3
+ "version": "2.10.0-rc.2",
4
+ "vclNativeSdkVersions": {
5
+ "ios": "2.10.0-rc",
6
+ "android": "2.10.0-rc"
7
+ },
4
8
  "description": "Velocity Career Labs React Native SDK",
5
9
  "license": "Apache-2.0",
6
10
  "publishConfig": {