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