react-native-persona 1.2.10 → 1.3.1

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 (77) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/RNPersonaInquiry.podspec +1 -1
  3. package/android/README.md +14 -0
  4. package/android/build.gradle +21 -100
  5. package/bin/persona-tool +1 -2
  6. package/lib/commonjs/index.js +477 -0
  7. package/lib/commonjs/index.js.map +1 -0
  8. package/lib/commonjs/persona-tools/AndroidResourcePrinter.js +694 -0
  9. package/lib/commonjs/persona-tools/AndroidResourcePrinter.js.map +1 -0
  10. package/lib/commonjs/persona-tools/Config.js +95 -0
  11. package/lib/commonjs/persona-tools/Config.js.map +1 -0
  12. package/lib/commonjs/persona-tools/Theme.js +228 -0
  13. package/lib/commonjs/persona-tools/Theme.js.map +1 -0
  14. package/lib/commonjs/persona-tools/index.js +41 -0
  15. package/lib/commonjs/persona-tools/index.js.map +1 -0
  16. package/lib/commonjs/persona-tools/prompts.js +48 -0
  17. package/lib/commonjs/persona-tools/prompts.js.map +1 -0
  18. package/lib/commonjs/persona-tools/tools/AndroidThemeGenerator.js +112 -0
  19. package/lib/commonjs/persona-tools/tools/AndroidThemeGenerator.js.map +1 -0
  20. package/lib/commonjs/persona-tools/tools/IosThemeInstructions.js +50 -0
  21. package/lib/commonjs/persona-tools/tools/IosThemeInstructions.js.map +1 -0
  22. package/lib/commonjs/util.js +36 -0
  23. package/lib/commonjs/util.js.map +1 -0
  24. package/lib/module/index.js +452 -0
  25. package/lib/module/index.js.map +1 -0
  26. package/lib/module/persona-tools/AndroidResourcePrinter.js +686 -0
  27. package/lib/module/persona-tools/AndroidResourcePrinter.js.map +1 -0
  28. package/lib/module/persona-tools/Config.js +82 -0
  29. package/lib/module/persona-tools/Config.js.map +1 -0
  30. package/lib/module/persona-tools/Theme.js +212 -0
  31. package/lib/module/persona-tools/Theme.js.map +1 -0
  32. package/lib/module/persona-tools/index.js +33 -0
  33. package/lib/module/persona-tools/index.js.map +1 -0
  34. package/lib/module/persona-tools/prompts.js +31 -0
  35. package/lib/module/persona-tools/prompts.js.map +1 -0
  36. package/lib/module/persona-tools/tools/AndroidThemeGenerator.js +82 -0
  37. package/lib/module/persona-tools/tools/AndroidThemeGenerator.js.map +1 -0
  38. package/lib/module/persona-tools/tools/IosThemeInstructions.js +37 -0
  39. package/lib/module/persona-tools/tools/IosThemeInstructions.js.map +1 -0
  40. package/lib/module/util.js +29 -0
  41. package/lib/module/util.js.map +1 -0
  42. package/{generatedTypes → lib/typescript}/index.d.ts +67 -3
  43. package/lib/typescript/persona-tools/AndroidResourcePrinter.d.ts +40 -0
  44. package/lib/typescript/persona-tools/Config.d.ts +15 -0
  45. package/lib/typescript/persona-tools/Theme.d.ts +124 -0
  46. package/lib/typescript/persona-tools/index.d.ts +1 -0
  47. package/lib/typescript/persona-tools/prompts.d.ts +8 -0
  48. package/lib/typescript/persona-tools/tools/AndroidThemeGenerator.d.ts +5 -0
  49. package/lib/typescript/persona-tools/tools/IosThemeInstructions.d.ts +5 -0
  50. package/lib/typescript/util.d.ts +3 -0
  51. package/package.json +79 -22
  52. package/src/index.ts +17 -18
  53. package/{persona-tools/lib → src/persona-tools}/AndroidResourcePrinter.ts +314 -278
  54. package/{persona-tools/config.ts → src/persona-tools/Config.ts} +7 -7
  55. package/src/persona-tools/Theme.ts +262 -0
  56. package/src/persona-tools/index.ts +30 -0
  57. package/{persona-tools/lib → src/persona-tools}/prompts.ts +11 -11
  58. package/{persona-tools → src/persona-tools}/tools/AndroidThemeGenerator.ts +31 -32
  59. package/{persona-tools → src/persona-tools}/tools/IosThemeInstructions.ts +8 -8
  60. package/src/util.ts +3 -3
  61. package/jest.config.js +0 -10
  62. package/persona-tools/Theme.js +0 -213
  63. package/persona-tools/Theme.ts +0 -260
  64. package/persona-tools/config.js +0 -72
  65. package/persona-tools/index.js +0 -30
  66. package/persona-tools/index.ts +0 -30
  67. package/persona-tools/lib/AndroidResourcePrinter.js +0 -832
  68. package/persona-tools/lib/AndroidResourcePrinter.spec.js +0 -1135
  69. package/persona-tools/lib/AndroidResourcePrinter.spec.ts +0 -1229
  70. package/persona-tools/lib/prompts.js +0 -39
  71. package/persona-tools/tools/AndroidThemeGenerator.js +0 -59
  72. package/persona-tools/tools/IosThemeInstructions.js +0 -34
  73. package/src/index.js +0 -307
  74. package/src/util.js +0 -29
  75. package/src/util.spec.js +0 -15
  76. package/src/util.spec.ts +0 -16
  77. package/tsconfig.json +0 -29
package/CHANGELOG.md CHANGED
@@ -7,14 +7,39 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## [v1.3.1] - 2022-03-02
11
+
12
+ ### Fixed
13
+
14
+ - Re-added `persona-tool` which was removed by accident in a refactor
15
+
16
+ ## [v1.3.0] - 2022-02-16
17
+
18
+ ### Changed
19
+
20
+ - Upgrade to Android Inquiry SDK 1.1.19
21
+ - Updated structure to work alongside React Native Inquiry SDK 2.2.0
22
+
23
+ ### Fixed
24
+
25
+ - Library now works with Gradle >= 7 on Android
26
+
27
+ ## [v1.2.11] - 2022-01-19
28
+
29
+ ### Changed
30
+
31
+ - Upgrade to iOS Inquiry SDK 1.1.25
32
+
10
33
  ## [v1.2.10] - 2022-01-14
11
34
 
12
35
  ### Changed
36
+
13
37
  - Upgrade to iOS Inquiry SDK 1.1.24
14
38
 
15
39
  ## [v1.2.9] - 2022-01-03
16
40
 
17
41
  ### Changed
42
+
18
43
  - Upgrade to iOS Inquiry SDK 1.1.23
19
44
 
20
45
  ## [v1.2.8] - 2021-12-07
@@ -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', '~> 1.1.24'
25
+ s.dependency 'PersonaInquirySDK', '~> 1.1.25'
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,52 @@ 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
- google()
74
- jcenter()
75
60
  }
76
61
 
77
62
  dependencies {
78
63
  //noinspection GradleDynamicVersion
79
- implementation 'com.facebook.react:react-native:+' // From node_modules
64
+ implementation "com.facebook.react:react-native:+" // From node_modules
80
65
 
81
66
  // NOTE: After updating, please update the `sdkVersions.android` in example/package.json
82
- implementation 'com.withpersona.sdk:inquiry:1.1.17'
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
- }
67
+ implementation 'com.withpersona.sdk:inquiry:1.1.19'
147
68
  }
package/bin/persona-tool CHANGED
@@ -1,4 +1,3 @@
1
1
  #! /usr/bin/env node
2
2
 
3
- // @ts-ignore
4
- require("react-native-persona/persona-tools");
3
+ require("../lib/commonjs/persona-tool");
@@ -0,0 +1,477 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.InvalidTemplateId = exports.InvalidInquiryId = exports.InvalidAccountId = exports.Inquiry = exports.Fields = exports.Environment = void 0;
7
+
8
+ var _reactNative = require("react-native");
9
+
10
+ var _util = require("./util");
11
+
12
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
+
14
+ const {
15
+ PersonaInquiry
16
+ } = _reactNative.NativeModules; // Using Opaque types + Smart Constructor enforces validation at
17
+ // instantiation time for IDS
18
+
19
+ class InvalidTemplateId extends Error {}
20
+
21
+ exports.InvalidTemplateId = InvalidTemplateId;
22
+
23
+ class InvalidInquiryId extends Error {}
24
+
25
+ exports.InvalidInquiryId = InvalidInquiryId;
26
+
27
+ class InvalidAccountId extends Error {}
28
+ /**
29
+ * Run validations that the string is in proper Inquiry token format
30
+ * and do a type conversion to InquiryId.
31
+ *
32
+ * @param candidate
33
+ */
34
+
35
+
36
+ exports.InvalidAccountId = InvalidAccountId;
37
+
38
+ function makeInquiryId(candidate) {
39
+ if (candidate.startsWith('inq_')) return candidate;
40
+ throw new InvalidInquiryId(`Valid template IDs start with "inq_". Received: ${candidate} `);
41
+ }
42
+ /**
43
+ * Run validations that the string is in proper Template token format
44
+ * and do a type conversion to TemplateId.
45
+ *
46
+ * @param candidate
47
+ */
48
+
49
+
50
+ function makeTemplateId(candidate) {
51
+ if (candidate.startsWith('tmpl_') || candidate.startsWith('blu_')) {
52
+ return candidate;
53
+ }
54
+
55
+ throw new InvalidTemplateId(`Valid template IDs start with "tmpl_". Received: ${candidate} `);
56
+ }
57
+ /**
58
+ * Run validations that the string is in proper Template token format
59
+ * and do a type conversion to AccountId.
60
+ *
61
+ * @param candidate
62
+ */
63
+
64
+
65
+ function makeAccountId(candidate) {
66
+ if (candidate.startsWith('act_')) {
67
+ return candidate;
68
+ }
69
+
70
+ throw new InvalidAccountId(`Valid account IDs start with "act_". Received: ${candidate} `);
71
+ }
72
+
73
+ let Fields;
74
+ /**
75
+ * String enum for environments. These strings will be parsed
76
+ * on the native side bridge into Kotlin / Swift enums.
77
+ */
78
+
79
+ exports.Fields = Fields;
80
+
81
+ (function (_Fields) {
82
+ class Builder {
83
+ constructor() {
84
+ _defineProperty(this, "_name", null);
85
+
86
+ _defineProperty(this, "_address", null);
87
+
88
+ _defineProperty(this, "_birthdate", null);
89
+
90
+ _defineProperty(this, "_emailAddress", null);
91
+
92
+ _defineProperty(this, "_phoneNumber", null);
93
+
94
+ _defineProperty(this, "_fields", {});
95
+ }
96
+
97
+ name(name) {
98
+ this._name = name;
99
+ return this;
100
+ }
101
+ /**
102
+ * Returns the Field.Builder instance
103
+ *
104
+ * @param address - The address object
105
+ */
106
+
107
+
108
+ /**
109
+ * Returns the Field.Builder instance
110
+ *
111
+ * @param address - The address object
112
+ */
113
+ address(address) {
114
+ this._address = address;
115
+ return this;
116
+ }
117
+ /**
118
+ * @param date {Date}
119
+ */
120
+
121
+
122
+ /**
123
+ * @param date {Date}
124
+ */
125
+ birthdate(date) {
126
+ this._birthdate = date;
127
+ return this;
128
+ }
129
+ /**
130
+ * @param date {string}
131
+ */
132
+
133
+
134
+ /**
135
+ * @param date {string}
136
+ */
137
+ emailAddress(email) {
138
+ this._emailAddress = email;
139
+ return this;
140
+ }
141
+
142
+ phoneNumber(phoneNumber) {
143
+ this._phoneNumber = phoneNumber;
144
+ return this;
145
+ }
146
+
147
+ field(fieldKey, value) {
148
+ this._fields = { ...this._fields,
149
+ [fieldKey]: value
150
+ };
151
+ return this;
152
+ }
153
+
154
+ build() {
155
+ var _this$_birthdate;
156
+
157
+ return {
158
+ name: this._name,
159
+ address: this._address,
160
+ emailAddress: this._emailAddress,
161
+ phoneNumber: this._phoneNumber,
162
+ birthdate: (_this$_birthdate = this._birthdate) === null || _this$_birthdate === void 0 ? void 0 : _this$_birthdate.toISOString(),
163
+ additionalFields: this._fields
164
+ };
165
+ }
166
+
167
+ }
168
+
169
+ function builder() {
170
+ return new Builder();
171
+ }
172
+
173
+ _Fields.builder = builder;
174
+ })(Fields || (exports.Fields = Fields = {}));
175
+
176
+ let Environment;
177
+ exports.Environment = Environment;
178
+
179
+ (function (Environment) {
180
+ Environment["SANDBOX"] = "sandbox";
181
+ Environment["PRODUCTION"] = "production";
182
+ })(Environment || (exports.Environment = Environment = {}));
183
+
184
+ const eventEmitter = new _reactNative.NativeEventEmitter(PersonaInquiry);
185
+
186
+ class Inquiry {
187
+ constructor(options) {
188
+ _defineProperty(this, "templateId", void 0);
189
+
190
+ _defineProperty(this, "inquiryId", void 0);
191
+
192
+ _defineProperty(this, "referenceId", void 0);
193
+
194
+ _defineProperty(this, "accountId", void 0);
195
+
196
+ _defineProperty(this, "environment", void 0);
197
+
198
+ _defineProperty(this, "accessToken", void 0);
199
+
200
+ _defineProperty(this, "iosThemeObject", void 0);
201
+
202
+ _defineProperty(this, "fields", void 0);
203
+
204
+ _defineProperty(this, "onSuccess", void 0);
205
+
206
+ _defineProperty(this, "onCancelled", void 0);
207
+
208
+ _defineProperty(this, "onFailed", void 0);
209
+
210
+ _defineProperty(this, "onError", void 0);
211
+
212
+ _defineProperty(this, "onSuccessListener", void 0);
213
+
214
+ _defineProperty(this, "onCancelledListener", void 0);
215
+
216
+ _defineProperty(this, "onFailedListener", void 0);
217
+
218
+ _defineProperty(this, "onErrorListener", void 0);
219
+
220
+ this.templateId = options.templateId;
221
+ this.inquiryId = options.inquiryId;
222
+ this.referenceId = options.referenceId;
223
+ this.accountId = options.accountId;
224
+ this.environment = options.environment;
225
+ this.accessToken = options.accessToken;
226
+ this.fields = options.fields; // Callbacks
227
+
228
+ this.onSuccess = options.onSuccess;
229
+ this.onCancelled = options.onCancelled;
230
+ this.onFailed = options.onFailed;
231
+ this.onError = options.onError; // Theme object
232
+
233
+ this.iosThemeObject = options.iosThemeObject;
234
+ }
235
+
236
+ clearListeners() {
237
+ if (this.onSuccessListener) this.onSuccessListener.remove();
238
+ if (this.onCancelledListener) this.onCancelledListener.remove();
239
+ if (this.onFailedListener) this.onFailedListener.remove();
240
+ if (this.onErrorListener) this.onErrorListener.remove();
241
+ }
242
+
243
+ start() {
244
+ this.onSuccessListener = eventEmitter.addListener('onSuccess', _ref => {
245
+ let {
246
+ inquiryId: inquiryId,
247
+ attributes: attributes
248
+ } = _ref;
249
+
250
+ // Native Brige sends an ISO 8601 Date. Convert this to a JS Date
251
+ if (typeof attributes.birthdate === 'string') {
252
+ attributes.birthdate = new Date(attributes.birthdate);
253
+ }
254
+
255
+ if (this.onSuccess) this.onSuccess(inquiryId, attributes);
256
+ this.clearListeners();
257
+ });
258
+ this.onCancelledListener = eventEmitter.addListener('onCancelled', () => {
259
+ if (this.onCancelled) this.onCancelled();
260
+ this.clearListeners();
261
+ });
262
+ this.onFailedListener = eventEmitter.addListener('onFailed', _ref2 => {
263
+ let {
264
+ inquiryId: inquiryId
265
+ } = _ref2;
266
+ if (this.onFailed) this.onFailed(inquiryId);
267
+ this.clearListeners();
268
+ });
269
+ this.onErrorListener = eventEmitter.addListener('onError', _ref3 => {
270
+ let {
271
+ error: errorMessage
272
+ } = _ref3;
273
+ if (this.onError) this.onError(new Error(errorMessage));
274
+ this.clearListeners();
275
+ });
276
+ PersonaInquiry.startInquiry({
277
+ templateId: this.templateId,
278
+ inquiryId: this.inquiryId,
279
+ referenceId: this.referenceId,
280
+ accountId: this.accountId,
281
+ environment: this.environment,
282
+ accessToken: this.accessToken,
283
+ fields: this.fields,
284
+ iosTheme: (0, _util.processThemeValues)(this.iosThemeObject || {})
285
+ });
286
+ }
287
+
288
+ }
289
+
290
+ exports.Inquiry = Inquiry;
291
+
292
+ class InquiryBuilder {
293
+ // Callbacks
294
+ constructor(inquiryId) {
295
+ _defineProperty(this, "_inquiryId", void 0);
296
+
297
+ _defineProperty(this, "_accessToken", void 0);
298
+
299
+ _defineProperty(this, "_onSuccess", void 0);
300
+
301
+ _defineProperty(this, "_onCancelled", void 0);
302
+
303
+ _defineProperty(this, "_onFailed", void 0);
304
+
305
+ _defineProperty(this, "_onError", void 0);
306
+
307
+ _defineProperty(this, "_iosThemeObject", void 0);
308
+
309
+ _defineProperty(this, "_fields", void 0);
310
+
311
+ this._inquiryId = inquiryId;
312
+ }
313
+
314
+ accessToken(accessToken) {
315
+ this._accessToken = accessToken;
316
+ return this;
317
+ }
318
+
319
+ onSuccess(callback) {
320
+ this._onSuccess = callback;
321
+ return this;
322
+ }
323
+
324
+ onCancelled(callback) {
325
+ this._onCancelled = callback;
326
+ return this;
327
+ }
328
+
329
+ onFailed(callback) {
330
+ this._onFailed = callback;
331
+ return this;
332
+ }
333
+
334
+ onError(callback) {
335
+ this._onError = callback;
336
+ return this;
337
+ }
338
+
339
+ iosTheme(themeObject) {
340
+ this._iosThemeObject = themeObject;
341
+ return this;
342
+ }
343
+
344
+ build() {
345
+ return new Inquiry({
346
+ inquiryId: this._inquiryId,
347
+ accessToken: this._accessToken,
348
+ onSuccess: this._onSuccess,
349
+ onCancelled: this._onCancelled,
350
+ onFailed: this._onFailed,
351
+ onError: this._onError,
352
+ iosThemeObject: this._iosThemeObject,
353
+ fields: this._fields
354
+ });
355
+ }
356
+
357
+ }
358
+
359
+ class TemplateBuilder {
360
+ // Callbacks
361
+ // Customization
362
+ constructor(templateId) {
363
+ _defineProperty(this, "_templateId", void 0);
364
+
365
+ _defineProperty(this, "_accountId", void 0);
366
+
367
+ _defineProperty(this, "_referenceId", void 0);
368
+
369
+ _defineProperty(this, "_environment", void 0);
370
+
371
+ _defineProperty(this, "_fields", void 0);
372
+
373
+ _defineProperty(this, "_accessToken", void 0);
374
+
375
+ _defineProperty(this, "_onSuccess", void 0);
376
+
377
+ _defineProperty(this, "_onCancelled", void 0);
378
+
379
+ _defineProperty(this, "_onFailed", void 0);
380
+
381
+ _defineProperty(this, "_onError", void 0);
382
+
383
+ _defineProperty(this, "_iosThemeObject", void 0);
384
+
385
+ this._templateId = templateId;
386
+ return this;
387
+ }
388
+
389
+ referenceId(referenceId) {
390
+ this._accountId = undefined;
391
+ this._referenceId = referenceId;
392
+ return this;
393
+ }
394
+
395
+ accountId(accountId) {
396
+ this._referenceId = undefined;
397
+ this._accountId = makeAccountId(accountId);
398
+ return this;
399
+ }
400
+
401
+ environment(environment) {
402
+ this._environment = environment;
403
+ return this;
404
+ }
405
+
406
+ accessToken(accessToken) {
407
+ this._accessToken = accessToken;
408
+ return this;
409
+ }
410
+
411
+ fields(fields) {
412
+ this._fields = fields;
413
+ return this;
414
+ }
415
+
416
+ onSuccess(callback) {
417
+ this._onSuccess = callback;
418
+ return this;
419
+ }
420
+
421
+ onCancelled(callback) {
422
+ this._onCancelled = callback;
423
+ return this;
424
+ }
425
+
426
+ onFailed(callback) {
427
+ this._onFailed = callback;
428
+ return this;
429
+ }
430
+
431
+ onError(callback) {
432
+ this._onError = callback;
433
+ return this;
434
+ }
435
+
436
+ iosTheme(themeObject) {
437
+ this._iosThemeObject = themeObject;
438
+ return this;
439
+ }
440
+
441
+ build() {
442
+ return new Inquiry({
443
+ templateId: this._templateId,
444
+ accountId: this._accountId,
445
+ referenceId: this._referenceId,
446
+ environment: this._environment,
447
+ accessToken: this._accessToken,
448
+ fields: this._fields,
449
+ onSuccess: this._onSuccess,
450
+ onCancelled: this._onCancelled,
451
+ onFailed: this._onFailed,
452
+ onError: this._onError,
453
+ iosThemeObject: this._iosThemeObject
454
+ });
455
+ }
456
+
457
+ }
458
+
459
+ let InquiryBuilders;
460
+
461
+ (function (_InquiryBuilders) {
462
+ function fromInquiry(inquiryId) {
463
+ return new InquiryBuilder(makeInquiryId(inquiryId));
464
+ }
465
+
466
+ _InquiryBuilders.fromInquiry = fromInquiry;
467
+
468
+ function fromTemplate(templateId) {
469
+ return new TemplateBuilder(makeTemplateId(templateId));
470
+ }
471
+
472
+ _InquiryBuilders.fromTemplate = fromTemplate;
473
+ })(InquiryBuilders || (InquiryBuilders = {}));
474
+
475
+ var _default = InquiryBuilders;
476
+ exports.default = _default;
477
+ //# sourceMappingURL=index.js.map