react-native-persona 2.1.3 → 2.2.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.
Files changed (72) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +156 -2
  3. package/{RNPersonaInquiry.podspec → RNPersonaInquiry2.podspec} +2 -2
  4. package/android/README.md +14 -0
  5. package/android/build.gradle +22 -99
  6. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  7. package/android/src/main/AndroidManifest.xml +1 -1
  8. package/android/src/main/java/com/withpersona/{sdk/reactnative/PersonaInquiryModule.java → sdk2/reactnative/PersonaInquiryModule2.java} +24 -14
  9. package/android/src/main/java/com/withpersona/{sdk/reactnative/PersonaInquiryPackage.java → sdk2/reactnative/PersonaInquiryPackage2.java} +3 -3
  10. package/android/src/main/java/com/withpersona/{sdk → sdk2}/reactnative/exceptions/InvalidConfiguration.java +1 -1
  11. package/android/src/main/res/values/theme.xml +2 -3
  12. package/ios/{PersonaInquiry.swift → PersonaInquiry2.swift} +17 -13
  13. package/ios/PersonaInquiryBridge.m +1 -1
  14. package/lib/commonjs/fields.js +141 -0
  15. package/lib/commonjs/fields.js.map +1 -0
  16. package/lib/commonjs/index.js +475 -0
  17. package/lib/commonjs/index.js.map +1 -0
  18. package/lib/commonjs/util.js +36 -0
  19. package/lib/commonjs/util.js.map +1 -0
  20. package/lib/commonjs/versions.js +25 -0
  21. package/lib/commonjs/versions.js.map +1 -0
  22. package/lib/module/fields.js +132 -0
  23. package/lib/module/fields.js.map +1 -0
  24. package/lib/module/index.js +435 -0
  25. package/lib/module/index.js.map +1 -0
  26. package/lib/module/util.js +29 -0
  27. package/lib/module/util.js.map +1 -0
  28. package/lib/module/versions.js +14 -0
  29. package/lib/module/versions.js.map +1 -0
  30. package/{generatedTypes/persona-tools/config.d.ts → lib/typescript/persona-tools/Config.d.ts} +0 -0
  31. package/{generatedTypes → lib/typescript}/persona-tools/Theme.d.ts +0 -0
  32. package/{generatedTypes → lib/typescript}/persona-tools/index.d.ts +0 -0
  33. package/{generatedTypes → lib/typescript}/persona-tools/lib/AndroidResourcePrinter.d.ts +2 -2
  34. package/{generatedTypes → lib/typescript}/persona-tools/lib/prompts.d.ts +0 -0
  35. package/{generatedTypes → lib/typescript}/persona-tools/tools/AndroidThemeGenerator.d.ts +0 -0
  36. package/{generatedTypes → lib/typescript}/persona-tools/tools/IosThemeInstructions.d.ts +0 -0
  37. package/{generatedTypes → lib/typescript}/src/fields.d.ts +0 -0
  38. package/{generatedTypes → lib/typescript}/src/index.d.ts +56 -5
  39. package/{generatedTypes → lib/typescript}/src/util.d.ts +0 -0
  40. package/lib/typescript/src/versions.d.ts +6 -0
  41. package/package.json +74 -18
  42. package/persona-tools/{config.ts → Config.ts} +7 -7
  43. package/persona-tools/Theme.ts +107 -107
  44. package/persona-tools/index.ts +9 -9
  45. package/persona-tools/lib/AndroidResourcePrinter.ts +4 -4
  46. package/persona-tools/tools/AndroidThemeGenerator.ts +18 -18
  47. package/persona-tools/tools/IosThemeInstructions.ts +8 -8
  48. package/src/fields.ts +7 -7
  49. package/src/index.ts +89 -26
  50. package/src/util.ts +2 -2
  51. package/src/versions.ts +12 -0
  52. package/generatedTypes/persona-tools/lib/AndroidResourcePrinter.spec.d.ts +0 -1
  53. package/generatedTypes/src/fields.spec.d.ts +0 -1
  54. package/generatedTypes/src/util.spec.d.ts +0 -1
  55. package/jest.config.js +0 -10
  56. package/persona-tools/Theme.js +0 -186
  57. package/persona-tools/config.js +0 -72
  58. package/persona-tools/index.js +0 -30
  59. package/persona-tools/lib/AndroidResourcePrinter.js +0 -573
  60. package/persona-tools/lib/AndroidResourcePrinter.spec.js +0 -914
  61. package/persona-tools/lib/AndroidResourcePrinter.spec.ts +0 -952
  62. package/persona-tools/lib/prompts.js +0 -39
  63. package/persona-tools/tools/AndroidThemeGenerator.js +0 -55
  64. package/persona-tools/tools/IosThemeInstructions.js +0 -34
  65. package/src/fields.js +0 -88
  66. package/src/fields.spec.js +0 -18
  67. package/src/fields.spec.ts +0 -17
  68. package/src/index.js +0 -271
  69. package/src/util.js +0 -29
  70. package/src/util.spec.js +0 -17
  71. package/src/util.spec.ts +0 -22
  72. package/tsconfig.json +0 -29
package/CHANGELOG.md CHANGED
@@ -7,6 +7,37 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## [v2.2.2] - 2022-02-24
11
+
12
+ ### Changed
13
+
14
+ - Upgrade to Android Inquiry SDK 2.2.8
15
+ - Upgrade to iOS Inquiry SDK 2.2.4
16
+
17
+ ## [v2.2.1] - 2022-02-17
18
+
19
+ ### Changed
20
+
21
+ - Upgrade to Android Inquiry SDK 2.2.6
22
+ - Upgrade to iOS Inquiry SDK 2.2.3
23
+
24
+ ### Added
25
+
26
+ - Expose underlying Android/iOS SDK version with `#nativeSdkVersion`
27
+ - Add `#fromInquiry`, `#fromTemplate`, and `#fromTemplateVersion` static methods to `Inquiry`
28
+
29
+ ### Deprecated
30
+
31
+ - Deprecate the default namespace and it's methods: `#fromInquiry`, `#fromTemplate`, and `#fromTemplateVersion`
32
+
33
+ ## [v2.2.0] - 2022-02-16
34
+
35
+ ### Changed
36
+
37
+ - Upgrade to iOS Inquiry SDK 2.2.2
38
+ - Upgrade to Android Inquiry SDK 2.2.4
39
+ - Update iOS and Android's namespace to allow for 1.x and 2.x implementations in parallel
40
+
10
41
  ## [v2.1.3] - 2022-01-31
11
42
 
12
43
  ### Changed
package/README.md CHANGED
@@ -1,3 +1,157 @@
1
- # react-native-persona
1
+ # Persona Android SDKs and Demo
2
+
3
+ ## Development
4
+
5
+ First, run yarn in the project root.
6
+
7
+ ```
8
+ yarn
9
+ ```
10
+
11
+ To test changes to SDK, we will use the Example App in `example` app.
12
+
13
+ ### Start Metro bundler.
14
+
15
+ This will bundle JavaScript and serve it to your React Native sample app. Keep the Metro bundler running in a terminal.
16
+
17
+ ```
18
+ yarn example start
19
+ ```
20
+
21
+ Metro bundler compiles source code and caches compiled targets to speed up incremental rebuilds. However, it's possible
22
+ that this can lead to random failures if things get out of sync. If you ever run into any weird issues, it's worth
23
+ running `yarn example start --reset-cache` again.
24
+
25
+ ### Start example app in iOS simulator
26
+
27
+ Use the built-in CLI command with Metro running.
28
+
29
+ ```
30
+ yarn example ios
31
+ ```
32
+
33
+ Or open `ios/example.xcworkspace` in XCode and build + run.
34
+
35
+ ### Start example app in Android simulator
36
+
37
+ Use the built-in CLI command with Metro running.
38
+
39
+ ```
40
+ yarn example android
41
+ ```
42
+
43
+ Or open the Android project in Android Studio and build + run.
44
+
45
+ ### Install persona-tools
46
+
47
+ Link the binary persona-tool in the example app
48
+
49
+ ```
50
+ $ cd example
51
+ $ yarn dev-only:link-bin
52
+ ```
53
+
54
+ Run the persona-tool to customize the theme
55
+
56
+ ```
57
+ $ cd example
58
+ $ yarn persona-tool
59
+ ```
60
+
61
+ # Installing in your own project
62
+
63
+ ```
64
+
65
+ yarn add react-native-persona
66
+
67
+ ```
68
+
69
+ ## Usage
70
+
71
+ ```typescript
72
+ import {Environment, Inquiry} from "react-native-persona";
73
+
74
+ // Start an inquiry.
75
+ Inquiry.fromTemplate('itmpl_Ygs16MKTkA6obnF8C3Rb17dm')
76
+ .environment(Environment.SANDBOX)
77
+ .onComplete((inquiryId, status, fields) =>
78
+ Alert.alert('Complete', `Inquiry ${inquiryId} completed with status "${status}."`,),
79
+ )
80
+ .onCanceled((inquiryId, sessionToken) =>
81
+ Alert.alert('Canceled', `Inquiry ${inquiryId} was cancelled`),
82
+ )
83
+ .onError(error => Alert.alert('Error', error.message))
84
+ .build()
85
+ .start();
86
+ ```
87
+
88
+ ### Theming
89
+
90
+ Theming can be handled universally through our persona-tools CLI provided in this repository.
91
+
92
+ To test themes, use the example app:
93
+
94
+ ```
95
+ cd example
96
+ ```
97
+
98
+ Link the `persona-tool` using the following command (only necessary during development, linked automatically when the
99
+ package is installed using `yarn add` or `npm install`).
100
+
101
+ ```
102
+ yarn dev-only:link-bin
103
+ ```
104
+
105
+ To unlink:
106
+
107
+ ```
108
+ yarn dev-only:unlink-bin
109
+ ```
110
+
111
+ Run through the tool using `yarn persona-tool` and following the instructions to add the required snippet to
112
+ your `package.json`.
113
+
114
+ Update theme colors accordingly:
115
+
116
+ - Example: Update `persona.androidTheme.backgroundColor` to `#FFFFFF`
117
+
118
+ Run `yarn persona-tool` again.
119
+
120
+ Launch the example app and launch a flow.
121
+
122
+ ### Updating SDK Versions
123
+
124
+ *Android*
125
+
126
+ Update the sdk version in `android/build.gradle`
127
+
128
+ ```
129
+ implementation 'com.withpersona.sdk2:inquiry:X.Y.Z'
130
+ ```
131
+
132
+ *iOS*
133
+
134
+ Update the sdk version in `RNPersonaInquiry2.podspec`
135
+
136
+ ```
137
+ s.dependency 'PersonaInquirySDK2', '~> X.Y.Z'
138
+ ```
139
+
140
+ Go to `example/ios` directory, update the Podfiles by running
141
+
142
+ ```
143
+ pod update PersonaInquirySDK2 --repo-update
144
+ pod install --repo-update
145
+ ```
146
+
147
+ *React Native*
148
+
149
+ Bump react native version in `package.json` if needed.
150
+
151
+ Commit and push changed files including:
152
+
153
+ - `android/build.gradle`
154
+ - `RNPersonaInquiry2.podspec`
155
+ - `package.json`
156
+ - `example/ios/Podfile.lock`
2
157
 
3
- Please refer to the docs: https://docs.withpersona.com/docs/react-native-sdk-integration
@@ -3,7 +3,7 @@ require 'json'
3
3
  package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
4
 
5
5
  Pod::Spec.new do |s|
6
- s.name = 'RNPersonaInquiry'
6
+ s.name = 'RNPersonaInquiry2'
7
7
  s.version = package['version']
8
8
  s.summary = package['description']
9
9
  s.description = <<-DESC
@@ -22,7 +22,7 @@ Pod::Spec.new do |s|
22
22
  s.requires_arc = true
23
23
 
24
24
  s.dependency 'React-Core'
25
- s.dependency 'PersonaInquirySDK', '~> 2.1.3'
25
+ s.dependency 'PersonaInquirySDK2', '2.2.4'
26
26
 
27
27
  s.static_framework = true
28
28
  end
@@ -0,0 +1,14 @@
1
+ README
2
+ ======
3
+
4
+ If you want to publish the lib as a maven dependency, follow these steps before publishing a new version to npm:
5
+
6
+ 1. Be sure to have the Android [SDK](https://developer.android.com/studio/index.html) and [NDK](https://developer.android.com/ndk/guides/index.html) installed
7
+ 2. Be sure to have a `local.properties` file in this folder that points to the Android SDK and NDK
8
+ ```
9
+ ndk.dir=/Users/{username}/Library/Android/sdk/ndk-bundle
10
+ sdk.dir=/Users/{username}/Library/Android/sdk
11
+ ```
12
+ 3. Delete the `maven` folder
13
+ 4. Run `./gradlew installArchives`
14
+ 5. Verify that latest set of generated files is in the maven folder with the correct version number
@@ -1,34 +1,15 @@
1
- // android/build.gradle
2
-
3
- // based on:
4
- //
5
- // * https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle
6
- // original location:
7
- // - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/build.gradle
8
- //
9
- // * https://github.com/facebook/react-native/blob/0.60-stable/template/android/app/build.gradle
10
- // original location:
11
- // - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle
12
-
13
1
  def DEFAULT_COMPILE_SDK_VERSION = 29
14
- def DEFAULT_BUILD_TOOLS_VERSION = '29.0.3'
15
2
  def DEFAULT_MIN_SDK_VERSION = 21
16
3
  def DEFAULT_TARGET_SDK_VERSION = 29
17
4
 
18
- def safeExtGet(prop, fallback) {
19
- rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
20
- }
21
-
22
5
  buildscript {
23
- // The Android Gradle plugin is only required when opening the android folder stand-alone.
24
- // This avoids unnecessary downloads and potential conflicts when the library is included as a
25
- // module dependency in an application project.
26
- // ref: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_script_external_dependencies
27
6
  if (project == rootProject) {
28
7
  repositories {
29
8
  google()
9
+ mavenCentral()
30
10
  jcenter()
31
11
  }
12
+
32
13
  dependencies {
33
14
  classpath 'com.android.tools.build:gradle:3.6.1'
34
15
  }
@@ -36,112 +17,54 @@ buildscript {
36
17
  }
37
18
 
38
19
  apply plugin: 'com.android.library'
39
- apply plugin: 'maven'
20
+
21
+ def safeExtGet(prop, fallback) {
22
+ rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
23
+ }
40
24
 
41
25
  android {
42
26
  compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
43
- buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
44
27
  defaultConfig {
45
28
  minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
46
29
  targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
47
30
  versionCode 1
48
31
  versionName "1.0"
49
32
  }
33
+
34
+ buildTypes {
35
+ release {
36
+ minifyEnabled false
37
+ }
38
+ }
39
+ lintOptions {
40
+ disable 'GradleCompatible'
41
+ }
50
42
  compileOptions {
51
43
  sourceCompatibility JavaVersion.VERSION_1_8
52
44
  targetCompatibility JavaVersion.VERSION_1_8
53
45
  }
54
- lintOptions {
55
- abortOnError false
56
- }
57
46
  }
58
47
 
59
48
  repositories {
60
- // ref: https://www.baeldung.com/maven-local-repository
61
49
  mavenLocal()
62
50
  maven {
63
51
  // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
64
- url "$rootDir/../node_modules/react-native/android"
65
- }
66
- maven {
67
- // Android JSC is installed from npm
68
- url "$rootDir/../node_modules/jsc-android/dist"
52
+ url("$rootDir/../node_modules/react-native/android")
69
53
  }
54
+ google()
55
+ mavenCentral()
56
+ jcenter()
70
57
  maven {
71
58
  url "https://sdk.withpersona.com/android/releases"
72
59
  }
73
60
  google()
74
- jcenter()
61
+ mavenCentral()
62
+ maven { url 'https://jitpack.io' }
75
63
  }
76
64
 
77
65
  dependencies {
78
66
  //noinspection GradleDynamicVersion
79
67
  implementation 'com.facebook.react:react-native:+' // From node_modules
80
68
 
81
- // NOTE: After updating, please update the `sdkVersions.android` in example/package.json
82
- implementation 'com.withpersona.sdk:inquiry:2.1.3'
83
- }
84
-
85
- def configureReactNativePom(def pom) {
86
- def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text)
87
-
88
- pom.project {
89
- name packageJson.title
90
- artifactId packageJson.name
91
- version = packageJson.version
92
- group = "com.withpersona.sdk.reactnative"
93
- description packageJson.description
94
-
95
- developers {
96
- developer {
97
- id packageJson.author.username
98
- name packageJson.author.name
99
- }
100
- }
101
- }
102
- }
103
-
104
- afterEvaluate { project ->
105
- // some Gradle build hooks ref:
106
- // https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html
107
- task androidJavadoc(type: Javadoc) {
108
- source = android.sourceSets.main.java.srcDirs
109
- classpath += files(android.bootClasspath)
110
- classpath += files(project.getConfigurations().getByName('compile').asList())
111
- include '**/*.java'
112
- }
113
-
114
- task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
115
- classifier = 'javadoc'
116
- from androidJavadoc.destinationDir
117
- }
118
-
119
- task androidSourcesJar(type: Jar) {
120
- classifier = 'sources'
121
- from android.sourceSets.main.java.srcDirs
122
- include '**/*.java'
123
- }
124
-
125
- android.libraryVariants.all { variant ->
126
- def name = variant.name.capitalize()
127
- def javaCompileTask = variant.javaCompileProvider.get()
128
-
129
- task "jar${name}"(type: Jar, dependsOn: javaCompileTask) {
130
- from javaCompileTask.destinationDir
131
- }
132
- }
133
-
134
- artifacts {
135
- archives androidSourcesJar
136
- archives androidJavadocJar
137
- }
138
-
139
- task installArchives(type: Upload) {
140
- configuration = configurations.archives
141
- repositories.mavenDeployer {
142
- // Deploy to react-native-event-bridge/maven, ready to publish to npm
143
- repository url: "file://${projectDir}/../android/maven"
144
- configureReactNativePom pom
145
- }
146
- }
69
+ implementation 'com.withpersona.sdk2:inquiry:2.2.8'
147
70
  }
@@ -1,5 +1,5 @@
1
1
  distributionBase=GRADLE_USER_HOME
2
2
  distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.2-all.zip
4
4
  zipStoreBase=GRADLE_USER_HOME
5
5
  zipStorePath=wrapper/dists
@@ -1 +1 @@
1
- <manifest package="com.withpersona.sdk.reactnative" />
1
+ <manifest package="com.withpersona.sdk2.reactnative" />
@@ -1,33 +1,32 @@
1
- package com.withpersona.sdk.reactnative;
1
+ package com.withpersona.sdk2.reactnative;
2
2
 
3
3
  import android.app.Activity;
4
4
  import android.content.Intent;
5
5
  import androidx.annotation.Nullable;
6
+ import com.facebook.react.ReactActivityDelegate;
6
7
  import com.facebook.react.bridge.ActivityEventListener;
7
8
  import com.facebook.react.bridge.Arguments;
8
- import com.facebook.react.bridge.JavaOnlyMap;
9
9
  import com.facebook.react.bridge.ReactApplicationContext;
10
10
  import com.facebook.react.bridge.ReactContextBaseJavaModule;
11
11
  import com.facebook.react.bridge.ReactMethod;
12
12
  import com.facebook.react.bridge.ReadableMap;
13
13
  import com.facebook.react.bridge.WritableMap;
14
14
  import com.facebook.react.modules.core.DeviceEventManagerModule;
15
- import com.withpersona.sdk.inquiry.Environment;
16
- import com.withpersona.sdk.inquiry.Fields;
17
- import com.withpersona.sdk.inquiry.Inquiry;
18
- import com.withpersona.sdk.inquiry.InquiryBuilder;
19
- import com.withpersona.sdk.inquiry.InquiryField;
20
- import com.withpersona.sdk.inquiry.InquiryResponse;
21
- import com.withpersona.sdk.inquiry.InquiryTemplateBuilder;
22
- import java.util.ArrayList;
15
+ import com.withpersona.sdk2.inquiry.Environment;
16
+ import com.withpersona.sdk2.inquiry.Fields;
17
+ import com.withpersona.sdk2.inquiry.Inquiry;
18
+ import com.withpersona.sdk2.inquiry.InquiryBuilder;
19
+ import com.withpersona.sdk2.inquiry.InquiryField;
20
+ import com.withpersona.sdk2.inquiry.InquiryResponse;
21
+ import com.withpersona.sdk2.inquiry.InquiryTemplateBuilder;
23
22
  import java.util.HashMap;
24
23
  import java.util.Map;
25
24
  import org.jetbrains.annotations.NotNull;
26
25
 
27
- public class PersonaInquiryModule extends ReactContextBaseJavaModule
26
+ public class PersonaInquiryModule2 extends ReactContextBaseJavaModule
28
27
  implements ActivityEventListener {
29
28
 
30
- private static final int PERSONA_INQUIRY_REQUEST_CODE = 31415;
29
+ private static final int PERSONA_INQUIRY_REQUEST_CODE = 31416;
31
30
  private static final String INQUIRY_ID = "inquiryId";
32
31
  private static final String TEMPLATE_ID = "templateId";
33
32
  private static final String ACCOUNT_ID = "accountId";
@@ -39,7 +38,7 @@ public class PersonaInquiryModule extends ReactContextBaseJavaModule
39
38
 
40
39
  private final ReactApplicationContext reactContext;
41
40
 
42
- public PersonaInquiryModule(ReactApplicationContext reactContext) {
41
+ public PersonaInquiryModule2(ReactApplicationContext reactContext) {
43
42
  super(reactContext);
44
43
  this.reactContext = reactContext;
45
44
  reactContext.addActivityEventListener(this);
@@ -120,7 +119,7 @@ public class PersonaInquiryModule extends ReactContextBaseJavaModule
120
119
  @NotNull
121
120
  @Override
122
121
  public String getName() {
123
- return "PersonaInquiry";
122
+ return "PersonaInquiry2";
124
123
  }
125
124
 
126
125
  /**
@@ -140,6 +139,8 @@ public class PersonaInquiryModule extends ReactContextBaseJavaModule
140
139
  if (inquiryId != null) {
141
140
  InquiryBuilder builder = Inquiry.fromInquiry(inquiryId);
142
141
 
142
+ builder = builder.theme(R.style.Persona_Inquiry2_Theme);
143
+
143
144
  String sessionToken = options.hasKey(ACCESS_TOKEN) ? options.getString(ACCESS_TOKEN) : null;
144
145
  if (sessionToken != null) {
145
146
  builder = builder.sessionToken(sessionToken);
@@ -153,6 +154,8 @@ public class PersonaInquiryModule extends ReactContextBaseJavaModule
153
154
  if (templateId != null) {
154
155
  InquiryTemplateBuilder builder = Inquiry.fromTemplate(templateId);
155
156
 
157
+ builder = builder.theme(R.style.Persona_Inquiry2_Theme);
158
+
156
159
  String referenceId = options.hasKey(REFERENCE_ID) ? options.getString(REFERENCE_ID) : null;
157
160
  if (referenceId != null) {
158
161
  builder = builder.referenceId(referenceId);
@@ -201,6 +204,13 @@ public class PersonaInquiryModule extends ReactContextBaseJavaModule
201
204
  }
202
205
  }
203
206
 
207
+ @Override
208
+ public Map<String, Object> getConstants() {
209
+ final Map<String, Object> constants = new HashMap<>();
210
+ constants.put("INQUIRY_SDK_VERSION", com.withpersona.sdk2.inquiry.BuildConfig.INQUIRY_SDK_VERSION);
211
+ return constants;
212
+ }
213
+
204
214
  private Environment environmentFromString(@Nullable String environment) {
205
215
  if (environment == null) {
206
216
  return null;
@@ -1,4 +1,4 @@
1
- package com.withpersona.sdk.reactnative;
1
+ package com.withpersona.sdk2.reactnative;
2
2
 
3
3
  import java.util.Arrays;
4
4
  import java.util.Collections;
@@ -9,10 +9,10 @@ import com.facebook.react.bridge.NativeModule;
9
9
  import com.facebook.react.bridge.ReactApplicationContext;
10
10
  import com.facebook.react.uimanager.ViewManager;
11
11
 
12
- public class PersonaInquiryPackage implements ReactPackage {
12
+ public class PersonaInquiryPackage2 implements ReactPackage {
13
13
  @Override
14
14
  public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
15
- return Arrays.<NativeModule>asList(new PersonaInquiryModule(reactContext));
15
+ return Arrays.<NativeModule>asList(new PersonaInquiryModule2(reactContext));
16
16
  }
17
17
 
18
18
  @Override
@@ -1,4 +1,4 @@
1
- package com.withpersona.sdk.reactnative.exceptions;
1
+ package com.withpersona.sdk2.reactnative.exceptions;
2
2
 
3
3
  public class InvalidConfiguration extends IllegalArgumentException {
4
4
  public InvalidConfiguration(String errorMessage) {
@@ -1,5 +1,4 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
2
  <resources>
3
- <style name="PersonaReactNativeTheme">
4
- </style>
5
- </resources>
3
+ <style name="Persona.Inquiry2.Theme" parent="@style/Base.Persona.Inquiry2.Theme" />
4
+ </resources>
@@ -1,28 +1,32 @@
1
1
  //
2
- // PersonaInquiry.swift
3
- // PersonaInquiry
2
+ // PersonaInquiry2.swift
3
+ // PersonaInquiry2
4
4
  //
5
5
  // Copyright © 2020 Persona. All rights reserved.
6
6
  //
7
7
 
8
8
  import Foundation
9
- import Persona
9
+ import Persona2
10
10
 
11
- @objc(PersonaInquiry)
12
- class PersonaInquiry: RCTEventEmitter {
11
+ @objc(PersonaInquiry2)
12
+ class PersonaInquiry2: RCTEventEmitter {
13
13
 
14
14
  override func supportedEvents() -> [String] {
15
15
  ["onComplete", "onCanceled", "onError"]
16
16
  }
17
17
 
18
18
  override static func moduleName() -> String {
19
- "PersonaInquiry"
19
+ "PersonaInquiry2"
20
20
  }
21
21
 
22
22
  override static func requiresMainQueueSetup() -> Bool {
23
23
  true
24
24
  }
25
25
 
26
+ override func constantsToExport() -> [AnyHashable : Any]! {
27
+ ["INQUIRY_SDK_VERSION": Inquiry.versionNumber]
28
+ }
29
+
26
30
  /// To keep the bridge simple, we'll expose a single method to both configure and start the inquiry. The config is
27
31
  /// validated within the React Native side of the bridge.
28
32
  @objc
@@ -68,7 +72,7 @@ class PersonaInquiry: RCTEventEmitter {
68
72
 
69
73
  // MARK: - Inquiry Delegate Methods
70
74
 
71
- extension PersonaInquiry: InquiryDelegate {
75
+ extension PersonaInquiry2: InquiryDelegate {
72
76
  func inquiryComplete(inquiryId: String, status: String, fields: [String: InquiryField]) {
73
77
  sendEvent(
74
78
  withName: "onComplete",
@@ -103,7 +107,7 @@ extension PersonaInquiry: InquiryDelegate {
103
107
 
104
108
  // MARK: - Helpers
105
109
 
106
- extension PersonaInquiry {
110
+ extension PersonaInquiry2 {
107
111
 
108
112
  enum InvalidConfiguration: Error {
109
113
  case argumentError(String)
@@ -382,7 +386,7 @@ extension PersonaInquiry {
382
386
  if let successAssetName = dictionary["successAssetName"],
383
387
  let successAssetWidth = int(from: dictionary["successAssetWidth"]),
384
388
  let successAssetHeight = int(from: dictionary["successAssetHeight"]),
385
- let successAssetPath = Bundle(for: PersonaInquiry.self).path(forResource: successAssetName, ofType: "svg") {
389
+ let successAssetPath = Bundle(for: PersonaInquiry2.self).path(forResource: successAssetName, ofType: "svg") {
386
390
  let customSuccessAsset = InquiryTheme.SVGAsset(
387
391
  path: successAssetPath,
388
392
  size: CGSize(width: successAssetWidth, height: successAssetHeight)
@@ -394,7 +398,7 @@ extension PersonaInquiry {
394
398
  if let verificationFailAssetName = dictionary["verificationFailAssetName"],
395
399
  let verificationFailAssetWidth = int(from: dictionary["verificationFailAssetWidth"]),
396
400
  let verificationFailAssetHeight = int(from: dictionary["verificationFailAssetHeight"]),
397
- let verificationFailAssetPath = Bundle(for: PersonaInquiry.self).path(forResource: verificationFailAssetName, ofType: "svg") {
401
+ let verificationFailAssetPath = Bundle(for: PersonaInquiry2.self).path(forResource: verificationFailAssetName, ofType: "svg") {
398
402
  let customVerificationFailAsset = InquiryTheme.SVGAsset(
399
403
  path: verificationFailAssetPath,
400
404
  size: CGSize(width: verificationFailAssetWidth, height: verificationFailAssetHeight)
@@ -406,7 +410,7 @@ extension PersonaInquiry {
406
410
  if let failAssetName = dictionary["failAssetName"],
407
411
  let failAssetWidth = int(from: dictionary["failAssetWidth"]),
408
412
  let failAssetHeight = int(from: dictionary["failAssetHeight"]),
409
- let failAssetPath = Bundle(for: PersonaInquiry.self).path(forResource: failAssetName, ofType: "svg") {
413
+ let failAssetPath = Bundle(for: PersonaInquiry2.self).path(forResource: failAssetName, ofType: "svg") {
410
414
  let customFailAsset = InquiryTheme.SVGAsset(
411
415
  path: failAssetPath,
412
416
  size: CGSize(width: failAssetWidth, height: failAssetHeight)
@@ -418,7 +422,7 @@ extension PersonaInquiry {
418
422
  if let loadingAnimationAssetName = dictionary["loadingAnimationAssetName"],
419
423
  let loadingAnimationAssetWidth = int(from: dictionary["loadingAnimationAssetWidth"]),
420
424
  let loadingAnimationAssetHeight = int(from: dictionary["loadingAnimationAssetHeight"]),
421
- let loadingAnimationAssetPath = Bundle(for: PersonaInquiry.self).path(forResource: loadingAnimationAssetName, ofType: "json") {
425
+ let loadingAnimationAssetPath = Bundle(for: PersonaInquiry2.self).path(forResource: loadingAnimationAssetName, ofType: "json") {
422
426
  let customLoadingAnimationAsset = InquiryTheme.AnimationAsset(
423
427
  path: loadingAnimationAssetPath,
424
428
  size: CGSize(width: loadingAnimationAssetWidth, height: loadingAnimationAssetHeight)
@@ -430,7 +434,7 @@ extension PersonaInquiry {
430
434
  if let processingAnimationAssetName = dictionary["processingAnimationAssetName"],
431
435
  let processingAnimationAssetWidth = int(from: dictionary["processingAnimationAssetWidth"]),
432
436
  let processingAnimationAssetHeight = int(from: dictionary["processingAnimationAssetHeight"]),
433
- let processingAnimationAssetPath = Bundle(for: PersonaInquiry.self).path(forResource: processingAnimationAssetName, ofType: "json") {
437
+ let processingAnimationAssetPath = Bundle(for: PersonaInquiry2.self).path(forResource: processingAnimationAssetName, ofType: "json") {
434
438
  let customProcessingAnimationAsset = InquiryTheme.AnimationAsset(
435
439
  path: processingAnimationAssetPath,
436
440
  size: CGSize(width: processingAnimationAssetWidth, height: processingAnimationAssetHeight)
@@ -1,7 +1,7 @@
1
1
  #import "React/RCTBridgeModule.h"
2
2
  #import "React/RCTEventEmitter.h"
3
3
 
4
- @interface RCT_EXTERN_MODULE(PersonaInquiry, RCTEventEmitter)
4
+ @interface RCT_EXTERN_MODULE(PersonaInquiry2, RCTEventEmitter)
5
5
 
6
6
  RCT_EXTERN_METHOD(startInquiry:(NSDictionary *)options)
7
7