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