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