react-native-persona 2.6.2 → 2.7.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 (53) hide show
  1. package/android/build.gradle +10 -13
  2. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  3. package/android/gradle.properties +0 -1
  4. package/android/src/main/java/com/withpersona/sdk2/reactnative/PersonaInquiryModule2.java +22 -3
  5. package/ios/PersonaInquiry2.swift +7 -0
  6. package/lib/commonjs/fields.js +9 -44
  7. package/lib/commonjs/fields.js.map +1 -1
  8. package/lib/commonjs/index.js +91 -205
  9. package/lib/commonjs/index.js.map +1 -1
  10. package/lib/commonjs/persona-tool/AndroidResourcePrinter.js +48 -83
  11. package/lib/commonjs/persona-tool/AndroidResourcePrinter.js.map +1 -1
  12. package/lib/commonjs/persona-tool/Config.js +3 -20
  13. package/lib/commonjs/persona-tool/Config.js.map +1 -1
  14. package/lib/commonjs/persona-tool/Theme.js +12 -36
  15. package/lib/commonjs/persona-tool/Theme.js.map +1 -1
  16. package/lib/commonjs/persona-tool/index.js +0 -10
  17. package/lib/commonjs/persona-tool/index.js.map +1 -1
  18. package/lib/commonjs/persona-tool/prompts.js +0 -6
  19. package/lib/commonjs/persona-tool/prompts.js.map +1 -1
  20. package/lib/commonjs/persona-tool/tools/AndroidThemeGenerator.js +2 -27
  21. package/lib/commonjs/persona-tool/tools/AndroidThemeGenerator.js.map +1 -1
  22. package/lib/commonjs/persona-tool/tools/IosThemeInstructions.js +0 -10
  23. package/lib/commonjs/persona-tool/tools/IosThemeInstructions.js.map +1 -1
  24. package/lib/commonjs/util.js +0 -6
  25. package/lib/commonjs/util.js.map +1 -1
  26. package/lib/commonjs/versions.js +0 -5
  27. package/lib/commonjs/versions.js.map +1 -1
  28. package/lib/module/fields.js +9 -43
  29. package/lib/module/fields.js.map +1 -1
  30. package/lib/module/index.js +88 -176
  31. package/lib/module/index.js.map +1 -1
  32. package/lib/module/persona-tool/AndroidResourcePrinter.js +48 -82
  33. package/lib/module/persona-tool/AndroidResourcePrinter.js.map +1 -1
  34. package/lib/module/persona-tool/Config.js +3 -15
  35. package/lib/module/persona-tool/Config.js.map +1 -1
  36. package/lib/module/persona-tool/Theme.js +10 -28
  37. package/lib/module/persona-tool/Theme.js.map +1 -1
  38. package/lib/module/persona-tool/index.js +0 -5
  39. package/lib/module/persona-tool/index.js.map +1 -1
  40. package/lib/module/persona-tool/prompts.js.map +1 -1
  41. package/lib/module/persona-tool/tools/AndroidThemeGenerator.js +2 -8
  42. package/lib/module/persona-tool/tools/AndroidThemeGenerator.js.map +1 -1
  43. package/lib/module/persona-tool/tools/IosThemeInstructions.js +0 -5
  44. package/lib/module/persona-tool/tools/IosThemeInstructions.js.map +1 -1
  45. package/lib/module/util.js +0 -5
  46. package/lib/module/util.js.map +1 -1
  47. package/lib/module/versions.js +0 -1
  48. package/lib/module/versions.js.map +1 -1
  49. package/lib/typescript/fields.d.ts +2 -2
  50. package/lib/typescript/index.d.ts +23 -12
  51. package/lib/typescript/persona-tool/Theme.d.ts +3 -3
  52. package/package.json +2 -2
  53. package/src/index.ts +47 -10
@@ -1,5 +1,6 @@
1
- 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; }
2
-
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
3
4
  import { NativeEventEmitter, NativeModules } from 'react-native';
4
5
  import { processThemeValues } from './util';
5
6
  import { Fields, InquiryField } from './fields';
@@ -8,234 +9,203 @@ import { Versions } from './versions';
8
9
  export { Versions };
9
10
  const {
10
11
  PersonaInquiry2
11
- } = NativeModules; // Using Opaque types + Smart Constructor enforces validation at
12
- // instantiation time for IDS
12
+ } = NativeModules;
13
13
 
14
+ // Using Opaque types + Smart Constructor enforces validation at
15
+ // instantiation time for IDS
14
16
  export class InvalidTemplateId extends Error {}
15
17
  export class InvalidTemplateVersion extends Error {}
16
18
  export class InvalidInquiryId extends Error {}
17
19
  export class InvalidAccountId extends Error {}
20
+
18
21
  /**
19
22
  * Run validations that the string is in proper Inquiry token format
20
23
  * and do a type conversion to InquiryId.
21
24
  *
22
25
  * @param candidate
23
26
  */
24
-
25
27
  function makeInquiryId(candidate) {
26
- if (candidate.startsWith('inq_')) return candidate;
28
+ if (candidate && candidate.startsWith('inq_')) {
29
+ return candidate;
30
+ }
27
31
  throw new InvalidInquiryId(`Valid template IDs start with "inq_". Received: ${candidate} `);
28
32
  }
33
+
29
34
  /**
30
35
  * Run validations that the string is in proper Template token format
31
36
  * and do a type conversion to TemplateId.
32
37
  *
33
38
  * @param candidate
34
39
  */
35
-
36
-
37
40
  function makeTemplateId(candidate) {
38
- if (candidate.startsWith('itmpl_')) {
41
+ if (candidate && candidate.startsWith('itmpl_')) {
39
42
  return candidate;
40
43
  }
41
-
42
44
  throw new InvalidTemplateId(`Valid template IDs start with "itmpl_". Received: ${candidate} `);
43
45
  }
46
+
44
47
  /**
45
48
  * Run validations that the string is in proper Template Version token format
46
49
  * and do a type conversion to TemplateVersion.
47
50
  *
48
51
  * @param candidate
49
52
  */
50
-
51
-
52
53
  function makeTemplateVersion(candidate) {
53
- if (candidate.startsWith('itmplv_')) {
54
+ if (candidate && candidate.startsWith('itmplv_')) {
54
55
  return candidate;
55
56
  }
56
-
57
57
  throw new InvalidTemplateVersion(`Valid template versions start with "itmplv_". Received: ${candidate} `);
58
58
  }
59
+
59
60
  /**
60
61
  * Run validations that the string is in proper Template token format
61
62
  * and do a type conversion to AccountId.
62
63
  *
63
64
  * @param candidate
64
65
  */
65
-
66
-
67
66
  function makeAccountId(candidate) {
68
- if (candidate.startsWith('act_')) {
67
+ if (candidate && candidate.startsWith('act_')) {
69
68
  return candidate;
70
69
  }
71
-
72
70
  throw new InvalidAccountId(`Valid account IDs start with "act_". Received: ${candidate} `);
73
71
  }
72
+
74
73
  /**
75
74
  * String enum for environments. These strings will be parsed
76
75
  * on the native side bridge into Kotlin / Swift enums.
77
76
  */
78
-
79
-
80
- export let Environment;
81
- /**
82
- * An enum value which determines whether this sdk should use the theme values sent from the server.
83
- */
84
-
85
- (function (Environment) {
77
+ export let Environment = /*#__PURE__*/function (Environment) {
86
78
  Environment["SANDBOX"] = "sandbox";
87
79
  Environment["PRODUCTION"] = "production";
88
- })(Environment || (Environment = {}));
80
+ return Environment;
81
+ }({});
89
82
 
90
- export let ThemeSource;
91
83
  /**
92
- * Defines the country api requests route to
84
+ * An enum value which determines whether this sdk should use the theme values sent from the server.
93
85
  */
94
-
95
- (function (ThemeSource) {
86
+ export let ThemeSource = /*#__PURE__*/function (ThemeSource) {
96
87
  ThemeSource["SERVER"] = "server";
97
88
  ThemeSource["CLIENT"] = "client";
98
- })(ThemeSource || (ThemeSource = {}));
99
-
100
- export let RoutingCountry;
89
+ return ThemeSource;
90
+ }({});
101
91
 
102
- (function (RoutingCountry) {
92
+ /**
93
+ * Defines the country api requests route to
94
+ */
95
+ export let RoutingCountry = /*#__PURE__*/function (RoutingCountry) {
103
96
  RoutingCountry["DE"] = "de";
104
97
  RoutingCountry["US"] = "us";
105
- })(RoutingCountry || (RoutingCountry = {}));
98
+ return RoutingCountry;
99
+ }({});
100
+
101
+ /**
102
+ * Type for collected data that came directly from iOS/Android.
103
+ * Needs to be translated to TS classes before returning.
104
+ */
106
105
 
107
106
  export class DocumentStepData {
108
107
  constructor() {
109
108
  _defineProperty(this, "stepName", void 0);
110
-
111
109
  _defineProperty(this, "documents", void 0);
112
-
113
110
  this.stepName = '';
114
111
  this.documents = [];
115
112
  }
116
-
117
113
  }
118
114
  export class GovernmentIdStepData {
119
115
  constructor() {
120
116
  _defineProperty(this, "stepName", void 0);
121
-
122
117
  _defineProperty(this, "captures", void 0);
123
-
124
118
  this.stepName = '';
125
119
  this.captures = [];
126
120
  }
127
-
128
121
  }
129
- export let GovernmentIdCaptureMethod;
130
-
131
- (function (GovernmentIdCaptureMethod) {
122
+ export let GovernmentIdCaptureMethod = /*#__PURE__*/function (GovernmentIdCaptureMethod) {
132
123
  GovernmentIdCaptureMethod["Manual"] = "Manual";
133
124
  GovernmentIdCaptureMethod["Auto"] = "Auto";
134
125
  GovernmentIdCaptureMethod["Upload"] = "Upload";
135
- })(GovernmentIdCaptureMethod || (GovernmentIdCaptureMethod = {}));
136
-
137
- export let GovernmentIdCaptureSide;
138
-
139
- (function (GovernmentIdCaptureSide) {
126
+ return GovernmentIdCaptureMethod;
127
+ }({});
128
+ export let GovernmentIdCaptureSide = /*#__PURE__*/function (GovernmentIdCaptureSide) {
140
129
  GovernmentIdCaptureSide["Front"] = "Front";
141
130
  GovernmentIdCaptureSide["Back"] = "Back";
142
- })(GovernmentIdCaptureSide || (GovernmentIdCaptureSide = {}));
143
-
131
+ return GovernmentIdCaptureSide;
132
+ }({});
144
133
  export class SelfieStepData {
145
134
  constructor() {
146
135
  _defineProperty(this, "stepName", void 0);
147
-
148
136
  _defineProperty(this, "centerCapture", void 0);
149
-
150
137
  _defineProperty(this, "leftCapture", void 0);
151
-
152
138
  _defineProperty(this, "rightCapture", void 0);
153
-
154
139
  this.stepName = '';
155
140
  this.centerCapture = null;
156
141
  this.leftCapture = null;
157
142
  this.rightCapture = null;
158
143
  }
159
-
160
144
  }
161
- export let SelfieCaptureMethod;
162
-
163
- (function (SelfieCaptureMethod) {
145
+ export let SelfieCaptureMethod = /*#__PURE__*/function (SelfieCaptureMethod) {
164
146
  SelfieCaptureMethod["Manual"] = "Manual";
165
147
  SelfieCaptureMethod["Auto"] = "Auto";
166
- })(SelfieCaptureMethod || (SelfieCaptureMethod = {}));
167
-
148
+ return SelfieCaptureMethod;
149
+ }({});
168
150
  export class UiStepData {
169
151
  constructor() {
170
152
  _defineProperty(this, "stepName", void 0);
171
-
172
153
  _defineProperty(this, "componentParams", void 0);
173
-
174
154
  this.stepName = '';
175
155
  this.componentParams = {};
176
156
  }
177
-
178
157
  }
179
158
  const eventEmitter = new NativeEventEmitter(PersonaInquiry2);
180
159
  export class Inquiry {
181
160
  constructor(options) {
182
161
  _defineProperty(this, "templateId", void 0);
183
-
162
+ _defineProperty(this, "templateVersion", void 0);
184
163
  _defineProperty(this, "inquiryId", void 0);
185
-
186
164
  _defineProperty(this, "referenceId", void 0);
187
-
188
165
  _defineProperty(this, "accountId", void 0);
189
-
190
166
  _defineProperty(this, "environment", void 0);
191
-
167
+ _defineProperty(this, "environmentId", void 0);
192
168
  _defineProperty(this, "sessionToken", void 0);
193
-
194
169
  _defineProperty(this, "returnCollectedData", void 0);
195
-
196
170
  _defineProperty(this, "routingCountry", void 0);
197
-
171
+ _defineProperty(this, "locale", void 0);
198
172
  _defineProperty(this, "iosThemeObject", void 0);
199
-
200
173
  _defineProperty(this, "themeSource", void 0);
201
-
202
174
  _defineProperty(this, "fields", void 0);
203
-
204
175
  _defineProperty(this, "onComplete", void 0);
205
-
206
176
  _defineProperty(this, "onCanceled", void 0);
207
-
208
177
  _defineProperty(this, "onError", void 0);
209
-
210
178
  _defineProperty(this, "onCompleteListener", void 0);
211
-
212
179
  _defineProperty(this, "onCanceledListener", void 0);
213
-
214
180
  _defineProperty(this, "onErrorListener", void 0);
215
-
216
181
  this.templateId = options.templateId;
182
+ this.templateVersion = options.templateVersion;
217
183
  this.inquiryId = options.inquiryId;
218
184
  this.referenceId = options.referenceId;
219
185
  this.accountId = options.accountId;
220
186
  this.environment = options.environment;
187
+ this.environmentId = options.environmentId;
221
188
  this.sessionToken = options.sessionToken;
222
189
  this.fields = options.fields;
223
190
  this.returnCollectedData = options.returnCollectedData;
224
- this.routingCountry = options.routingCountry; // Callbacks
191
+ this.routingCountry = options.routingCountry;
192
+ this.locale = options.locale;
225
193
 
194
+ // Callbacks
226
195
  this.onComplete = options.onComplete;
227
196
  this.onCanceled = options.onCanceled;
228
- this.onError = options.onError; // Theme object
197
+ this.onError = options.onError;
229
198
 
199
+ // Theme object
230
200
  this.iosThemeObject = options.iosThemeObject;
231
201
  this.themeSource = options.themeSource;
232
202
  }
233
-
234
203
  clearListeners() {
235
204
  if (this.onCompleteListener) this.onCompleteListener.remove();
236
205
  if (this.onCanceledListener) this.onCanceledListener.remove();
237
206
  if (this.onErrorListener) this.onErrorListener.remove();
238
207
  }
208
+
239
209
  /**
240
210
  * Create an Inquiry flow builder based on a template ID.
241
211
  *
@@ -245,11 +215,10 @@ export class Inquiry {
245
215
  * @param templateId template ID from your Persona Dashboard
246
216
  * @return builder for the Inquiry flow
247
217
  */
248
-
249
-
250
218
  static fromTemplate(templateId) {
251
219
  return new TemplateBuilder(makeTemplateId(templateId), null);
252
220
  }
221
+
253
222
  /**
254
223
  * Create an Inquiry flow builder based on a template ID version.
255
224
  *
@@ -260,11 +229,10 @@ export class Inquiry {
260
229
  * @param templateVersion template version from your Persona Dashboard
261
230
  * @return builder for the Inquiry flow
262
231
  */
263
-
264
-
265
232
  static fromTemplateVersion(templateVersion) {
266
233
  return new TemplateBuilder(null, makeTemplateVersion(templateVersion));
267
234
  }
235
+
268
236
  /**
269
237
  * Create an Inquiry flow builder based on an inquiry ID.
270
238
  *
@@ -276,88 +244,69 @@ export class Inquiry {
276
244
  * @param inquiryId inquiry ID from your server
277
245
  * @return builder for the Inquiry flow
278
246
  */
279
-
280
-
281
247
  static fromInquiry(inquiryId) {
282
248
  return new InquiryBuilder(makeInquiryId(inquiryId));
283
249
  }
250
+
284
251
  /**
285
252
  * Launch the Persona Inquiry.
286
253
  */
287
-
288
-
289
254
  start() {
290
255
  this.onCompleteListener = eventEmitter.addListener('onComplete', event => {
291
256
  if (this.onComplete) {
292
257
  var _event$collectedData;
293
-
294
258
  let fields = {};
295
-
296
259
  for (let key of Object.keys(event.fields || {})) {
297
260
  let field = event.fields[key];
298
-
299
261
  if (field == undefined) {
300
262
  fields[key] = new InquiryField.Unknown('null');
301
263
  continue;
302
264
  }
303
-
304
265
  switch (field.type) {
305
266
  case 'integer':
306
267
  fields[key] = new InquiryField.Integer(Number.parseInt(field.value));
307
268
  break;
308
-
309
269
  case 'boolean':
310
270
  fields[key] = new InquiryField.Boolean(field.value);
311
271
  break;
312
-
313
272
  case 'string':
314
273
  fields[key] = new InquiryField.String(field.value);
315
274
  break;
316
-
317
275
  default:
318
276
  fields[key] = new InquiryField.Unknown(field.type);
319
277
  break;
320
278
  }
321
279
  }
322
-
323
280
  let collectedData = null;
324
281
  let stepData = (_event$collectedData = event.collectedData) === null || _event$collectedData === void 0 ? void 0 : _event$collectedData.stepData;
325
-
326
282
  if (stepData != null) {
327
283
  // Translate the step data from JSON to actual class objects
328
284
  let translatedStepData = [];
329
-
330
285
  for (let stepDatum of stepData) {
331
286
  switch (stepDatum.type) {
332
287
  case 'DocumentStepData':
333
288
  translatedStepData.push(Object.assign(new DocumentStepData(), stepDatum));
334
289
  break;
335
-
336
290
  case 'GovernmentIdStepData':
337
291
  translatedStepData.push(Object.assign(new GovernmentIdStepData(), stepDatum));
338
292
  break;
339
-
340
293
  case 'SelfieStepData':
341
294
  translatedStepData.push(Object.assign(new SelfieStepData(), stepDatum));
342
295
  break;
343
-
344
296
  case 'UiStepData':
345
297
  translatedStepData.push(Object.assign(new UiStepData(), stepDatum));
346
298
  break;
347
299
  }
348
300
  }
349
-
350
301
  collectedData = {
351
302
  stepData: translatedStepData
352
303
  };
353
304
  }
354
-
355
305
  let extraData = {
356
306
  collectedData: collectedData
357
307
  };
358
308
  this.onComplete(event.inquiryId, event.status, fields, extraData);
359
309
  }
360
-
361
310
  this.clearListeners();
362
311
  });
363
312
  this.onCanceledListener = eventEmitter.addListener('onCanceled', event => {
@@ -370,86 +319,75 @@ export class Inquiry {
370
319
  });
371
320
  PersonaInquiry2.startInquiry({
372
321
  templateId: this.templateId,
322
+ templateVersion: this.templateVersion,
373
323
  inquiryId: this.inquiryId,
374
324
  referenceId: this.referenceId,
375
325
  accountId: this.accountId,
376
326
  environment: this.environment,
327
+ environmentId: this.environmentId,
377
328
  sessionToken: this.sessionToken,
378
329
  fields: this.fields,
379
330
  returnCollectedData: this.returnCollectedData,
380
331
  themeSource: this.themeSource,
381
332
  iosTheme: processThemeValues(this.iosThemeObject || {}),
382
- routingCountry: this.routingCountry
333
+ routingCountry: this.routingCountry,
334
+ locale: this.locale
383
335
  });
384
336
  }
385
-
386
337
  }
387
-
388
338
  class InquiryBuilder {
389
- // Callbacks
390
339
  constructor(inquiryId) {
391
340
  _defineProperty(this, "_inquiryId", void 0);
392
-
393
341
  _defineProperty(this, "_sessionToken", void 0);
394
-
342
+ // Callbacks
395
343
  _defineProperty(this, "_onComplete", void 0);
396
-
397
344
  _defineProperty(this, "_onCanceled", void 0);
398
-
399
345
  _defineProperty(this, "_onError", void 0);
400
-
401
346
  _defineProperty(this, "_iosThemeObject", void 0);
402
-
403
347
  _defineProperty(this, "_themeSource", ThemeSource.SERVER);
404
-
405
348
  _defineProperty(this, "_fields", void 0);
406
-
407
349
  _defineProperty(this, "_routingCountry", void 0);
408
-
350
+ _defineProperty(this, "_locale", void 0);
409
351
  this._inquiryId = inquiryId;
410
352
  }
411
-
412
353
  sessionToken(sessionToken) {
413
354
  this._sessionToken = sessionToken;
414
355
  return this;
415
356
  }
416
-
417
357
  onComplete(callback) {
418
358
  this._onComplete = callback;
419
359
  return this;
420
360
  }
421
-
422
361
  onCanceled(callback) {
423
362
  this._onCanceled = callback;
424
363
  return this;
425
364
  }
426
-
427
365
  onError(callback) {
428
366
  this._onError = callback;
429
367
  return this;
430
368
  }
369
+
431
370
  /**
432
371
  * @deprecated Use iosThemeToUse
433
372
  */
434
-
435
-
436
373
  iosTheme(themeObject) {
437
374
  this._iosThemeObject = themeObject;
438
375
  this._themeSource = ThemeSource.CLIENT;
439
376
  return this;
440
377
  }
441
-
442
378
  iosThemeToUse(themeObject, themeSource) {
443
379
  this._iosThemeObject = themeObject;
444
380
  this._themeSource = themeSource;
445
381
  return this;
446
382
  }
447
-
448
383
  routingCountry(routingCountry) {
449
384
  this._routingCountry = routingCountry;
450
385
  return this;
451
386
  }
452
-
387
+ locale(locale) {
388
+ this._locale = locale;
389
+ return this;
390
+ }
453
391
  build() {
454
392
  return new Inquiry({
455
393
  inquiryId: this._inquiryId,
@@ -460,44 +398,31 @@ class InquiryBuilder {
460
398
  iosThemeObject: this._iosThemeObject,
461
399
  themeSource: this._themeSource,
462
400
  fields: this._fields,
463
- routingCountry: this._routingCountry
401
+ routingCountry: this._routingCountry,
402
+ locale: this._locale
464
403
  });
465
404
  }
466
-
467
405
  }
468
-
469
406
  class TemplateBuilder {
470
- // Callbacks
471
- // Customization
472
407
  constructor(templateId, templateVersion) {
473
408
  _defineProperty(this, "_templateId", void 0);
474
-
475
409
  _defineProperty(this, "_templateVersion", void 0);
476
-
477
410
  _defineProperty(this, "_accountId", void 0);
478
-
479
411
  _defineProperty(this, "_referenceId", void 0);
480
-
481
412
  _defineProperty(this, "_environment", void 0);
482
-
413
+ _defineProperty(this, "_environmentId", void 0);
483
414
  _defineProperty(this, "_fields", void 0);
484
-
485
415
  _defineProperty(this, "_sessionToken", void 0);
486
-
487
416
  _defineProperty(this, "_returnCollectedData", void 0);
488
-
489
417
  _defineProperty(this, "_routingCountry", void 0);
490
-
418
+ _defineProperty(this, "_locale", void 0);
419
+ // Callbacks
491
420
  _defineProperty(this, "_onComplete", void 0);
492
-
493
421
  _defineProperty(this, "_onCanceled", void 0);
494
-
495
422
  _defineProperty(this, "_onError", void 0);
496
-
423
+ // Customization
497
424
  _defineProperty(this, "_iosThemeObject", void 0);
498
-
499
425
  _defineProperty(this, "_themeSource", ThemeSource.SERVER);
500
-
501
426
  if (templateId != null) {
502
427
  this._templateId = templateId;
503
428
  } else if (templateVersion != null) {
@@ -505,78 +430,72 @@ class TemplateBuilder {
505
430
  } else {
506
431
  throw new InvalidTemplateId(`Either templateId or templateVersion needs to be set.`);
507
432
  }
508
-
509
433
  return this;
510
434
  }
511
-
512
435
  returnCollectedData(returnCollectedData) {
513
436
  this._returnCollectedData = returnCollectedData;
514
437
  return this;
515
438
  }
516
-
517
439
  referenceId(referenceId) {
518
440
  this._accountId = undefined;
519
441
  this._referenceId = referenceId;
520
442
  return this;
521
443
  }
522
-
523
444
  accountId(accountId) {
524
445
  this._referenceId = undefined;
525
446
  this._accountId = makeAccountId(accountId);
526
447
  return this;
527
448
  }
528
-
529
449
  environment(environment) {
530
450
  this._environment = environment;
531
451
  return this;
532
452
  }
533
-
453
+ environmentId(environmentId) {
454
+ this._environmentId = environmentId;
455
+ return this;
456
+ }
534
457
  sessionToken(sessionToken) {
535
458
  this._sessionToken = sessionToken;
536
459
  return this;
537
460
  }
538
-
539
461
  fields(fields) {
540
462
  this._fields = fields;
541
463
  return this;
542
464
  }
543
-
544
465
  routingCountry(routingCountry) {
545
466
  this._routingCountry = routingCountry;
546
467
  return this;
547
468
  }
548
-
469
+ locale(locale) {
470
+ this._locale = locale;
471
+ return this;
472
+ }
549
473
  onComplete(callback) {
550
474
  this._onComplete = callback;
551
475
  return this;
552
476
  }
553
-
554
477
  onCanceled(callback) {
555
478
  this._onCanceled = callback;
556
479
  return this;
557
480
  }
558
-
559
481
  onError(callback) {
560
482
  this._onError = callback;
561
483
  return this;
562
484
  }
485
+
563
486
  /**
564
487
  * @deprecated Use iosThemeToUse
565
488
  */
566
-
567
-
568
489
  iosTheme(themeObject) {
569
490
  this._iosThemeObject = themeObject;
570
491
  this._themeSource = ThemeSource.CLIENT;
571
492
  return this;
572
493
  }
573
-
574
494
  iosThemeToUse(themeObject, themeSource) {
575
495
  this._iosThemeObject = themeObject;
576
496
  this._themeSource = themeSource;
577
497
  return this;
578
498
  }
579
-
580
499
  build() {
581
500
  return new Inquiry({
582
501
  templateId: this._templateId,
@@ -584,6 +503,7 @@ class TemplateBuilder {
584
503
  accountId: this._accountId,
585
504
  referenceId: this._referenceId,
586
505
  environment: this._environment,
506
+ environmentId: this._environmentId,
587
507
  sessionToken: this._sessionToken,
588
508
  fields: this._fields,
589
509
  onComplete: this._onComplete,
@@ -592,37 +512,29 @@ class TemplateBuilder {
592
512
  iosThemeObject: this._iosThemeObject,
593
513
  themeSource: this._themeSource,
594
514
  returnCollectedData: this._returnCollectedData,
595
- routingCountry: this._routingCountry
515
+ routingCountry: this._routingCountry,
516
+ locale: this._locale
596
517
  });
597
518
  }
598
-
599
519
  }
520
+
600
521
  /**
601
522
  * @deprecated Use the `Inquiry` static methods instead
602
523
  */
603
-
604
-
605
524
  let InquiryBuilders;
606
-
607
525
  (function (_InquiryBuilders) {
608
526
  function fromInquiry(inquiryId) {
609
527
  return Inquiry.fromInquiry(inquiryId);
610
528
  }
611
-
612
529
  _InquiryBuilders.fromInquiry = fromInquiry;
613
-
614
530
  function fromTemplate(templateId) {
615
531
  return Inquiry.fromTemplate(templateId);
616
532
  }
617
-
618
533
  _InquiryBuilders.fromTemplate = fromTemplate;
619
-
620
534
  function fromTemplateVersion(templateVersion) {
621
535
  return Inquiry.fromTemplateVersion(templateVersion);
622
536
  }
623
-
624
537
  _InquiryBuilders.fromTemplateVersion = fromTemplateVersion;
625
538
  })(InquiryBuilders || (InquiryBuilders = {}));
626
-
627
539
  export default InquiryBuilders;
628
540
  //# sourceMappingURL=index.js.map