react-native-persona 2.4.4 → 2.6.0
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 +10 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/withpersona/sdk2/reactnative/PersonaInquiryModule2.java +24 -0
- package/ios/PersonaInquiry.xcodeproj/project.pbxproj +8 -8
- package/ios/PersonaInquiry2.swift +49 -28
- package/lib/commonjs/index.js +37 -5
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +34 -4
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/index.d.ts +19 -0
- package/package.json +4 -13
- package/src/index.ts +34 -0
- package/CHANGELOG.md +0 -347
|
@@ -22,5 +22,14 @@ Pod::Spec.new do |s|
|
|
|
22
22
|
s.requires_arc = true
|
|
23
23
|
|
|
24
24
|
s.dependency 'React-Core'
|
|
25
|
-
|
|
25
|
+
|
|
26
|
+
s.default_subspec = 'Core'
|
|
27
|
+
s.subspec 'Core' do |ss|
|
|
28
|
+
ss.dependency 'PersonaInquirySDK2', '2.10.0'
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
s.subspec 'Nfc' do |ss|
|
|
32
|
+
ss.dependency 'PersonaNfc', '2.10.0'
|
|
33
|
+
ss.dependency 'OpenSSL-Universal', '1.1.180'
|
|
34
|
+
end
|
|
26
35
|
end
|
package/android/build.gradle
CHANGED
|
@@ -23,6 +23,7 @@ import com.withpersona.sdk2.inquiry.InquiryBuilder;
|
|
|
23
23
|
import com.withpersona.sdk2.inquiry.InquiryField;
|
|
24
24
|
import com.withpersona.sdk2.inquiry.InquiryResponse;
|
|
25
25
|
import com.withpersona.sdk2.inquiry.InquiryTemplateBuilder;
|
|
26
|
+
import com.withpersona.sdk2.inquiry.RoutingCountry;
|
|
26
27
|
import com.withpersona.sdk2.inquiry.ServerThemeSource;
|
|
27
28
|
import com.withpersona.sdk2.inquiry.types.collected_data.CollectedData;
|
|
28
29
|
import com.withpersona.sdk2.inquiry.types.collected_data.DocumentFile;
|
|
@@ -51,6 +52,7 @@ public class PersonaInquiryModule2 extends ReactContextBaseJavaModule
|
|
|
51
52
|
private static final String FIELD_ADDITIONAL_FIELDS = "additionalFields";
|
|
52
53
|
private static final String RETURN_COLLECTED_DATA = "returnCollectedData";
|
|
53
54
|
private static final String THEME_SOURCE = "themeSource";
|
|
55
|
+
private static final String ROUTING_COUNTRY = "routingCountry";
|
|
54
56
|
|
|
55
57
|
private final ReactApplicationContext reactContext;
|
|
56
58
|
|
|
@@ -327,6 +329,13 @@ public class PersonaInquiryModule2 extends ReactContextBaseJavaModule
|
|
|
327
329
|
builder = builder.environment(environment);
|
|
328
330
|
}
|
|
329
331
|
|
|
332
|
+
RoutingCountry routingCountry = routingCountryFromString(
|
|
333
|
+
options.hasKey(ROUTING_COUNTRY) ? options.getString(ROUTING_COUNTRY) : null
|
|
334
|
+
);
|
|
335
|
+
if (routingCountry != null) {
|
|
336
|
+
builder = builder.routingCountry(routingCountry);
|
|
337
|
+
}
|
|
338
|
+
|
|
330
339
|
ReadableMap fields = options.hasKey(FIELDS) ? options.getMap(FIELDS) : null;
|
|
331
340
|
|
|
332
341
|
if (fields != null) {
|
|
@@ -386,4 +395,19 @@ public class PersonaInquiryModule2 extends ReactContextBaseJavaModule
|
|
|
386
395
|
return null;
|
|
387
396
|
}
|
|
388
397
|
}
|
|
398
|
+
|
|
399
|
+
private RoutingCountry routingCountryFromString(@Nullable String routingCountry) {
|
|
400
|
+
if (routingCountry == null) {
|
|
401
|
+
return null;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
switch (routingCountry) {
|
|
405
|
+
case "de":
|
|
406
|
+
return RoutingCountry.DE;
|
|
407
|
+
case "us":
|
|
408
|
+
return RoutingCountry.US;
|
|
409
|
+
default:
|
|
410
|
+
return null;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
389
413
|
}
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
objects = {
|
|
8
8
|
|
|
9
9
|
/* Begin PBXBuildFile section */
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
16D866A42A1575D800721E31 /* PersonaInquiryBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 16D866A22A1575D800721E31 /* PersonaInquiryBridge.m */; };
|
|
11
|
+
16D866A52A1575D800721E31 /* PersonaInquiry2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16D866A32A1575D800721E31 /* PersonaInquiry2.swift */; };
|
|
12
12
|
/* End PBXBuildFile section */
|
|
13
13
|
|
|
14
14
|
/* Begin PBXCopyFilesBuildPhase section */
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
|
|
26
26
|
/* Begin PBXFileReference section */
|
|
27
27
|
134814201AA4EA6300B7C361 /* libPersonaInquiry.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPersonaInquiry.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
28
|
-
|
|
28
|
+
16D866A22A1575D800721E31 /* PersonaInquiryBridge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PersonaInquiryBridge.m; sourceTree = "<group>"; };
|
|
29
|
+
16D866A32A1575D800721E31 /* PersonaInquiry2.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PersonaInquiry2.swift; sourceTree = "<group>"; };
|
|
29
30
|
F618109E242AD27000CF7049 /* PersonaInquiry-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "PersonaInquiry-Bridging-Header.h"; sourceTree = "<group>"; };
|
|
30
|
-
F618109F242AD27000CF7049 /* PersonaInquiry.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersonaInquiry.swift; sourceTree = "<group>"; };
|
|
31
31
|
/* End PBXFileReference section */
|
|
32
32
|
|
|
33
33
|
/* Begin PBXFrameworksBuildPhase section */
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
58B511D21A9E6C8500147676 = {
|
|
53
53
|
isa = PBXGroup;
|
|
54
54
|
children = (
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
16D866A32A1575D800721E31 /* PersonaInquiry2.swift */,
|
|
56
|
+
16D866A22A1575D800721E31 /* PersonaInquiryBridge.m */,
|
|
57
57
|
134814211AA4EA7D00B7C361 /* Products */,
|
|
58
58
|
F618109E242AD27000CF7049 /* PersonaInquiry-Bridging-Header.h */,
|
|
59
59
|
);
|
|
@@ -117,8 +117,8 @@
|
|
|
117
117
|
isa = PBXSourcesBuildPhase;
|
|
118
118
|
buildActionMask = 2147483647;
|
|
119
119
|
files = (
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
16D866A42A1575D800721E31 /* PersonaInquiryBridge.m in Sources */,
|
|
121
|
+
16D866A52A1575D800721E31 /* PersonaInquiry2.swift in Sources */,
|
|
122
122
|
);
|
|
123
123
|
runOnlyForDeploymentPostprocessing = 0;
|
|
124
124
|
};
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
import Foundation
|
|
9
9
|
import Persona2
|
|
10
10
|
|
|
11
|
+
#if canImport(PersonaNfc)
|
|
12
|
+
import PersonaNfc
|
|
13
|
+
#endif
|
|
14
|
+
|
|
11
15
|
// file private for this variable avoids clang module linker bug
|
|
12
16
|
private var collectedData: InquiryData? = nil
|
|
13
17
|
|
|
@@ -45,20 +49,48 @@ class PersonaInquiry2: RCTEventEmitter {
|
|
|
45
49
|
let themeSource = options["themeSource"] as? String
|
|
46
50
|
let fieldsObject = options["fields"] as? [String: [String: Any]]
|
|
47
51
|
let returnCollectedData = options["returnCollectedData"] as? Bool ?? false
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
let routingCountry = options["routingCountry"] as? String
|
|
53
|
+
|
|
54
|
+
var nfcAdapter: InquiryNfcAdapter? = nil
|
|
55
|
+
#if canImport(PersonaNfc)
|
|
56
|
+
nfcAdapter = PersonaNfcAdapter()
|
|
57
|
+
#endif
|
|
58
|
+
|
|
59
|
+
var inquiry: Inquiry? = nil
|
|
60
|
+
if let inquiryId {
|
|
61
|
+
inquiry = Inquiry.from(inquiryId: inquiryId, delegate: self)
|
|
62
|
+
.sessionToken(sessionToken)
|
|
63
|
+
.theme(makeTheme(from: themeObject, themeSource: themeSource))
|
|
64
|
+
.nfcAdapter(nfcAdapter)
|
|
65
|
+
.collectionDelegate(returnCollectedData ? self : nil)
|
|
66
|
+
// fix(jake): implement StringConstructable in iOS sdk then use RoutingCountry.from(rawValue)
|
|
67
|
+
.routingCountry(routingCountry == "de" ? .de : .us)
|
|
68
|
+
.build()
|
|
69
|
+
} else if let templateId {
|
|
70
|
+
inquiry = Inquiry.from(templateId: templateId, delegate: self)
|
|
71
|
+
.referenceId(referenceId)
|
|
72
|
+
.environment(Environment.from(rawValue: environment))
|
|
73
|
+
.fields(fieldsFrom(fieldsObject))
|
|
74
|
+
.theme(makeTheme(from: themeObject, themeSource: themeSource))
|
|
75
|
+
.nfcAdapter(nfcAdapter)
|
|
76
|
+
.collectionDelegate(returnCollectedData ? self : nil)
|
|
77
|
+
// fix(jake): implement StringConstructable in iOS sdk then use RoutingCountry.from(rawValue)
|
|
78
|
+
.routingCountry(routingCountry == "de" ? .de : .us)
|
|
79
|
+
.build()
|
|
80
|
+
} else if let templateVersion {
|
|
81
|
+
inquiry = Inquiry.from(templateVersion: templateVersion, delegate: self)
|
|
82
|
+
.referenceId(referenceId)
|
|
83
|
+
.environment(Environment.from(rawValue: environment))
|
|
84
|
+
.fields(fieldsFrom(fieldsObject))
|
|
85
|
+
.theme(makeTheme(from: themeObject, themeSource: themeSource))
|
|
86
|
+
.nfcAdapter(nfcAdapter)
|
|
87
|
+
.collectionDelegate(returnCollectedData ? self : nil)
|
|
88
|
+
// fix(jake): implement StringConstructable in iOS sdk then use RoutingCountry.from(rawValue)
|
|
89
|
+
.routingCountry(routingCountry == "de" ? .de : .us)
|
|
90
|
+
.build()
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
guard let inquiry else {
|
|
62
94
|
print("An error occurred while starting the Inquiry, invalid config.")
|
|
63
95
|
return
|
|
64
96
|
}
|
|
@@ -73,10 +105,7 @@ class PersonaInquiry2: RCTEventEmitter {
|
|
|
73
105
|
return
|
|
74
106
|
}
|
|
75
107
|
|
|
76
|
-
|
|
77
|
-
config: config,
|
|
78
|
-
delegate: self
|
|
79
|
-
).start(from: viewController)
|
|
108
|
+
inquiry.start(from: viewController)
|
|
80
109
|
}
|
|
81
110
|
}
|
|
82
111
|
|
|
@@ -101,8 +130,8 @@ extension PersonaInquiry2: InquiryDelegate {
|
|
|
101
130
|
"inquiryId": inquiryId,
|
|
102
131
|
"status": status,
|
|
103
132
|
"fields": fieldsToDictionary(fields: fields),
|
|
104
|
-
"collectedData": collectedData?.toDictionary()
|
|
105
|
-
]
|
|
133
|
+
"collectedData": collectedData?.toDictionary() as Any
|
|
134
|
+
] as [String : Any]
|
|
106
135
|
)
|
|
107
136
|
}
|
|
108
137
|
|
|
@@ -544,14 +573,6 @@ extension PersonaInquiry2 {
|
|
|
544
573
|
theme.cancelButtonAlternateTextColor = color
|
|
545
574
|
}
|
|
546
575
|
|
|
547
|
-
if let color = color(from: dictionary["cameraGuideCornersColor"]) {
|
|
548
|
-
theme.cameraGuideCornersColor = color
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
if let color = color(from: dictionary["cameraButtonBackgroundColor"]) {
|
|
552
|
-
theme.cameraButtonBackgroundColor = color
|
|
553
|
-
}
|
|
554
|
-
|
|
555
576
|
if let loadingAnimationAssetName = dictionary["loadingAnimationAssetName"],
|
|
556
577
|
let loadingAnimationAssetWidth = int(from: dictionary["loadingAnimationAssetWidth"]),
|
|
557
578
|
let loadingAnimationAssetHeight = int(from: dictionary["loadingAnimationAssetHeight"]),
|
package/lib/commonjs/index.js
CHANGED
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "Fields", {
|
|
|
10
10
|
return _fields.Fields;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
exports.UiStepData = exports.ThemeSource = exports.SelfieStepData = exports.SelfieCaptureMethod = exports.InvalidTemplateVersion = exports.InvalidTemplateId = exports.InvalidInquiryId = exports.InvalidAccountId = exports.Inquiry = exports.GovernmentIdStepData = exports.GovernmentIdCaptureSide = exports.GovernmentIdCaptureMethod = void 0;
|
|
13
|
+
exports.UiStepData = exports.ThemeSource = exports.SelfieStepData = exports.SelfieCaptureMethod = exports.RoutingCountry = exports.InvalidTemplateVersion = exports.InvalidTemplateId = exports.InvalidInquiryId = exports.InvalidAccountId = exports.Inquiry = exports.GovernmentIdStepData = exports.GovernmentIdCaptureSide = exports.GovernmentIdCaptureMethod = void 0;
|
|
14
14
|
Object.defineProperty(exports, "Versions", {
|
|
15
15
|
enumerable: true,
|
|
16
16
|
get: function () {
|
|
@@ -125,6 +125,10 @@ exports.Environment = Environment;
|
|
|
125
125
|
})(Environment || (exports.Environment = Environment = {}));
|
|
126
126
|
|
|
127
127
|
let ThemeSource;
|
|
128
|
+
/**
|
|
129
|
+
* Defines the country api requests route to
|
|
130
|
+
*/
|
|
131
|
+
|
|
128
132
|
exports.ThemeSource = ThemeSource;
|
|
129
133
|
|
|
130
134
|
(function (ThemeSource) {
|
|
@@ -132,6 +136,14 @@ exports.ThemeSource = ThemeSource;
|
|
|
132
136
|
ThemeSource["CLIENT"] = "client";
|
|
133
137
|
})(ThemeSource || (exports.ThemeSource = ThemeSource = {}));
|
|
134
138
|
|
|
139
|
+
let RoutingCountry;
|
|
140
|
+
exports.RoutingCountry = RoutingCountry;
|
|
141
|
+
|
|
142
|
+
(function (RoutingCountry) {
|
|
143
|
+
RoutingCountry["DE"] = "de";
|
|
144
|
+
RoutingCountry["US"] = "us";
|
|
145
|
+
})(RoutingCountry || (exports.RoutingCountry = RoutingCountry = {}));
|
|
146
|
+
|
|
135
147
|
class DocumentStepData {
|
|
136
148
|
constructor() {
|
|
137
149
|
_defineProperty(this, "stepName", void 0);
|
|
@@ -234,6 +246,8 @@ class Inquiry {
|
|
|
234
246
|
|
|
235
247
|
_defineProperty(this, "returnCollectedData", void 0);
|
|
236
248
|
|
|
249
|
+
_defineProperty(this, "routingCountry", void 0);
|
|
250
|
+
|
|
237
251
|
_defineProperty(this, "iosThemeObject", void 0);
|
|
238
252
|
|
|
239
253
|
_defineProperty(this, "themeSource", void 0);
|
|
@@ -259,7 +273,8 @@ class Inquiry {
|
|
|
259
273
|
this.environment = options.environment;
|
|
260
274
|
this.sessionToken = options.sessionToken;
|
|
261
275
|
this.fields = options.fields;
|
|
262
|
-
this.returnCollectedData = options.returnCollectedData;
|
|
276
|
+
this.returnCollectedData = options.returnCollectedData;
|
|
277
|
+
this.routingCountry = options.routingCountry; // Callbacks
|
|
263
278
|
|
|
264
279
|
this.onComplete = options.onComplete;
|
|
265
280
|
this.onCanceled = options.onCanceled;
|
|
@@ -416,7 +431,8 @@ class Inquiry {
|
|
|
416
431
|
fields: this.fields,
|
|
417
432
|
returnCollectedData: this.returnCollectedData,
|
|
418
433
|
themeSource: this.themeSource,
|
|
419
|
-
iosTheme: (0, _util.processThemeValues)(this.iosThemeObject || {})
|
|
434
|
+
iosTheme: (0, _util.processThemeValues)(this.iosThemeObject || {}),
|
|
435
|
+
routingCountry: this.routingCountry
|
|
420
436
|
});
|
|
421
437
|
}
|
|
422
438
|
|
|
@@ -443,6 +459,8 @@ class InquiryBuilder {
|
|
|
443
459
|
|
|
444
460
|
_defineProperty(this, "_fields", void 0);
|
|
445
461
|
|
|
462
|
+
_defineProperty(this, "_routingCountry", void 0);
|
|
463
|
+
|
|
446
464
|
this._inquiryId = inquiryId;
|
|
447
465
|
}
|
|
448
466
|
|
|
@@ -482,6 +500,11 @@ class InquiryBuilder {
|
|
|
482
500
|
return this;
|
|
483
501
|
}
|
|
484
502
|
|
|
503
|
+
routingCountry(routingCountry) {
|
|
504
|
+
this._routingCountry = routingCountry;
|
|
505
|
+
return this;
|
|
506
|
+
}
|
|
507
|
+
|
|
485
508
|
build() {
|
|
486
509
|
return new Inquiry({
|
|
487
510
|
inquiryId: this._inquiryId,
|
|
@@ -491,7 +514,8 @@ class InquiryBuilder {
|
|
|
491
514
|
onError: this._onError,
|
|
492
515
|
iosThemeObject: this._iosThemeObject,
|
|
493
516
|
themeSource: this._themeSource,
|
|
494
|
-
fields: this._fields
|
|
517
|
+
fields: this._fields,
|
|
518
|
+
routingCountry: this._routingCountry
|
|
495
519
|
});
|
|
496
520
|
}
|
|
497
521
|
|
|
@@ -517,6 +541,8 @@ class TemplateBuilder {
|
|
|
517
541
|
|
|
518
542
|
_defineProperty(this, "_returnCollectedData", void 0);
|
|
519
543
|
|
|
544
|
+
_defineProperty(this, "_routingCountry", void 0);
|
|
545
|
+
|
|
520
546
|
_defineProperty(this, "_onComplete", void 0);
|
|
521
547
|
|
|
522
548
|
_defineProperty(this, "_onCanceled", void 0);
|
|
@@ -570,6 +596,11 @@ class TemplateBuilder {
|
|
|
570
596
|
return this;
|
|
571
597
|
}
|
|
572
598
|
|
|
599
|
+
routingCountry(routingCountry) {
|
|
600
|
+
this._routingCountry = routingCountry;
|
|
601
|
+
return this;
|
|
602
|
+
}
|
|
603
|
+
|
|
573
604
|
onComplete(callback) {
|
|
574
605
|
this._onComplete = callback;
|
|
575
606
|
return this;
|
|
@@ -615,7 +646,8 @@ class TemplateBuilder {
|
|
|
615
646
|
onError: this._onError,
|
|
616
647
|
iosThemeObject: this._iosThemeObject,
|
|
617
648
|
themeSource: this._themeSource,
|
|
618
|
-
returnCollectedData: this._returnCollectedData
|
|
649
|
+
returnCollectedData: this._returnCollectedData,
|
|
650
|
+
routingCountry: this._routingCountry
|
|
619
651
|
});
|
|
620
652
|
}
|
|
621
653
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["PersonaInquiry2","NativeModules","InvalidTemplateId","Error","InvalidTemplateVersion","InvalidInquiryId","InvalidAccountId","makeInquiryId","candidate","startsWith","makeTemplateId","makeTemplateVersion","makeAccountId","Environment","ThemeSource","DocumentStepData","constructor","stepName","documents","GovernmentIdStepData","captures","GovernmentIdCaptureMethod","GovernmentIdCaptureSide","SelfieStepData","centerCapture","leftCapture","rightCapture","SelfieCaptureMethod","UiStepData","componentParams","eventEmitter","NativeEventEmitter","Inquiry","options","templateId","inquiryId","referenceId","accountId","environment","sessionToken","fields","returnCollectedData","onComplete","onCanceled","onError","iosThemeObject","themeSource","clearListeners","onCompleteListener","remove","onCanceledListener","onErrorListener","fromTemplate","TemplateBuilder","fromTemplateVersion","templateVersion","fromInquiry","InquiryBuilder","start","addListener","event","key","Object","keys","field","undefined","InquiryField","Unknown","type","Integer","Number","parseInt","value","Boolean","String","collectedData","stepData","translatedStepData","stepDatum","push","assign","extraData","status","debugMessage","startInquiry","iosTheme","SERVER","_inquiryId","_sessionToken","callback","_onComplete","_onCanceled","_onError","themeObject","_iosThemeObject","_themeSource","CLIENT","iosThemeToUse","build","_fields","_templateId","_templateVersion","_returnCollectedData","_accountId","_referenceId","_environment","InquiryBuilders"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AAKA;;AACA;;AAIA;;;;AAIA,MAAM;AAAEA,EAAAA;AAAF,IAAsBC,0BAA5B,C,CAEA;AACA;;AASO,MAAMC,iBAAN,SAAgCC,KAAhC,CAAsC;;;;AAEtC,MAAMC,sBAAN,SAAqCD,KAArC,CAA2C;;;;AAE3C,MAAME,gBAAN,SAA+BF,KAA/B,CAAqC;;;;AAErC,MAAMG,gBAAN,SAA+BH,KAA/B,CAAqC;AAE5C;AACA;AACA;AACA;AACA;AACA;;;;;AACA,SAASI,aAAT,CAAuBC,SAAvB,EAAqD;AACnD,MAAIA,SAAS,CAACC,UAAV,CAAqB,MAArB,CAAJ,EAAkC,OAAOD,S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D;;AAEDoD,EAAAA,KAAK,GAAY;AACf,WAAO,IAAIlE,OAAJ,CAAY;AACjBE,MAAAA,UAAU,EAAE,KAAKkE,WADA;AAEjB7C,MAAAA,eAAe,EAAE,KAAK8C,gBAFL;AAGjBhE,MAAAA,SAAS,EAAE,KAAKkE,UAHC;AAIjBnE,MAAAA,WAAW,EAAE,KAAKoE,YAJD;AAKjBlE,MAAAA,WAAW,EAAE,KAAKmE,YALD;AAMjBlE,MAAAA,YAAY,EAAE,KAAKiD,aANF;AAOjBhD,MAAAA,MAAM,EAAE,KAAK2D,OAPI;AAQjBzD,MAAAA,UAAU,EAAE,KAAKgD,WARA;AASjB/C,MAAAA,UAAU,EAAE,KAAKgD,WATA;AAUjB/C,MAAAA,OAAO,EAAE,KAAKgD,QAVG;AAWjB/C,MAAAA,cAAc,EAAE,KAAKiD,eAXJ;AAYjBhD,MAAAA,WAAW,EAAE,KAAKiD,YAZD;AAajBtD,MAAAA,mBAAmB,EAAE,KAAK6D;AAbT,KAAZ,CAAP;AAeD;;AA/HmB;AAkItB;AACA;AACA;;;;;;AAKS,WAAS9C,WAAT,CAAqBrB,SAArB,EAAwC;AAC7C,WAAOH,OAAO,CAACwB,WAAR,CAAoBrB,SAApB,CAAP;AACD;;;;AAKM,WAASiB,YAAT,CAAsBlB,UAAtB,EAA0C;AAC/C,WAAOF,OAAO,CAACoB,YAAR,CAAqBlB,UAArB,CAAP;AACD;;;;AAKM,WAASoB,mBAAT,CAA6BC,eAA7B,EAAsD;AAC3D,WAAOvB,OAAO,CAACsB,mBAAR,CAA4BC,eAA5B,CAAP;AACD;;;GApBOmD,e,KAAAA,e;;eAuBKA,e","sourcesContent":["import {\n EventSubscription,\n NativeEventEmitter,\n NativeModules,\n} from 'react-native';\nimport { processThemeValues } from './util';\nimport { Fields, InquiryField, RawInquiryField } from './fields';\n\nexport { Fields };\n\nimport { Versions } from './versions';\n\nexport { Versions };\n\nconst { PersonaInquiry2 } = NativeModules;\n\n// Using Opaque types + Smart Constructor enforces validation at\n// instantiation time for IDS\ndeclare const Unique: unique symbol;\nexport type Opaque<T, Tag> = T & { [Unique]: Tag };\n\ntype TemplateId = Opaque<string, 'TemplateId'>;\ntype TemplateVersion = Opaque<string, 'TemplateVersion'>;\ntype InquiryId = Opaque<string, 'InquiryId'>;\ntype AccountId = Opaque<string, 'AccountId'>;\n\nexport class InvalidTemplateId extends Error {}\n\nexport class InvalidTemplateVersion extends Error {}\n\nexport class InvalidInquiryId extends Error {}\n\nexport class InvalidAccountId extends Error {}\n\n/**\n * Run validations that the string is in proper Inquiry token format\n * and do a type conversion to InquiryId.\n *\n * @param candidate\n */\nfunction makeInquiryId(candidate: string): InquiryId {\n if (candidate.startsWith('inq_')) return candidate as InquiryId;\n\n throw new InvalidInquiryId(\n `Valid template IDs start with \"inq_\". Received: ${candidate} `\n );\n}\n\n/**\n * Run validations that the string is in proper Template token format\n * and do a type conversion to TemplateId.\n *\n * @param candidate\n */\nfunction makeTemplateId(candidate: string): TemplateId {\n if (candidate.startsWith('itmpl_')) {\n return candidate as TemplateId;\n }\n\n throw new InvalidTemplateId(\n `Valid template IDs start with \"itmpl_\". Received: ${candidate} `\n );\n}\n\n/**\n * Run validations that the string is in proper Template Version token format\n * and do a type conversion to TemplateVersion.\n *\n * @param candidate\n */\nfunction makeTemplateVersion(candidate: string): TemplateVersion {\n if (candidate.startsWith('itmplv_')) {\n return candidate as TemplateVersion;\n }\n\n throw new InvalidTemplateVersion(\n `Valid template versions start with \"itmplv_\". Received: ${candidate} `\n );\n}\n\n/**\n * Run validations that the string is in proper Template token format\n * and do a type conversion to AccountId.\n *\n * @param candidate\n */\nfunction makeAccountId(candidate: string): AccountId {\n if (candidate.startsWith('act_')) {\n return candidate as AccountId;\n }\n\n throw new InvalidAccountId(\n `Valid account IDs start with \"act_\". Received: ${candidate} `\n );\n}\n\n/**\n * String enum for environments. These strings will be parsed\n * on the native side bridge into Kotlin / Swift enums.\n */\nexport enum Environment {\n SANDBOX = 'sandbox',\n PRODUCTION = 'production',\n}\n\n/**\n * An enum value which determines whether this sdk should use the theme values sent from the server.\n */\nexport enum ThemeSource {\n SERVER = 'server',\n /**\n * @deprecated Client side theming is deprecated, please configure your theme inside\n * the Persona Dashboard and use SERVER as the theme source.\n */\n CLIENT = 'client',\n}\n\nexport interface InquiryOptions {\n templateId?: TemplateId;\n templateVersion?: TemplateVersion;\n inquiryId?: InquiryId;\n referenceId?: string;\n accountId?: AccountId;\n environment?: Environment;\n sessionToken?: string;\n returnCollectedData?: boolean;\n\n // Fields\n fields?: Fields;\n\n // Callbacks\n onComplete?: OnCompleteCallback;\n onCanceled?: OnCanceledCallback;\n onError?: OnErrorCallback;\n\n // Customization\n iosThemeObject?: Object | null;\n themeSource?: ThemeSource | null;\n}\n\ntype OnCompleteCallback = (\n inquiryId: string,\n status: string,\n fields: Fields,\n extraData: ExtraData\n) => void;\n\n/**\n * Type for collected data that came directly from iOS/Android.\n * Needs to be translated to TS classes before returning.\n */\ninterface ExternalCollectedData {\n stepData: any[];\n}\n\nexport interface ExtraData {\n collectedData: CollectedData | null;\n}\nexport interface CollectedData {\n stepData: StepData[];\n}\n\nexport interface StepData {\n stepName: string;\n}\n\nexport class DocumentStepData implements StepData {\n stepName: string;\n documents: Document[];\n\n constructor() {\n this.stepName = '';\n this.documents = [];\n }\n}\n\nexport interface Document {\n absoluteFilePath: string;\n}\n\nexport class GovernmentIdStepData implements StepData {\n stepName: string;\n captures: GovernmentIdCapture[];\n\n constructor() {\n this.stepName = '';\n this.captures = [];\n }\n}\n\nexport interface GovernmentIdCapture {\n idClass: string;\n captureMethod: GovernmentIdCaptureMethod;\n side: GovernmentIdCaptureSide;\n frames: GovernmentIdCaptureFrames[];\n}\n\nexport enum GovernmentIdCaptureMethod {\n Manual = 'Manual',\n Auto = 'Auto',\n Upload = 'Upload',\n}\n\nexport enum GovernmentIdCaptureSide {\n Front = 'Front',\n Back = 'Back',\n}\n\nexport interface GovernmentIdCaptureFrames {\n absoluteFilePath: string;\n}\n\nexport class SelfieStepData implements StepData {\n stepName: string;\n centerCapture: SelfieCapture | null;\n leftCapture: SelfieCapture | null;\n rightCapture: SelfieCapture | null;\n\n constructor() {\n this.stepName = '';\n this.centerCapture = null;\n this.leftCapture = null;\n this.rightCapture = null;\n }\n}\n\nexport interface SelfieCapture {\n captureMethod: SelfieCaptureMethod;\n absoluteFilePath: string;\n}\n\nexport enum SelfieCaptureMethod {\n Manual = 'Manual',\n Auto = 'Auto',\n}\n\nexport class UiStepData implements StepData {\n stepName: string;\n componentParams: { [key: string]: any };\n\n constructor() {\n this.stepName = '';\n this.componentParams = {};\n }\n}\n\ntype OnCanceledCallback = (inquiryId?: string, sessionToken?: string) => void;\n\ntype OnErrorCallback = (error: Error) => void;\n\nconst eventEmitter = new NativeEventEmitter(PersonaInquiry2);\n\nexport class Inquiry {\n templateId?: TemplateId;\n inquiryId?: InquiryId;\n referenceId?: string;\n accountId?: AccountId;\n environment?: Environment;\n sessionToken?: string;\n returnCollectedData?: boolean;\n\n iosThemeObject?: Object | null;\n themeSource?: ThemeSource | null;\n fields?: Fields | null;\n\n private readonly onComplete?: OnCompleteCallback;\n private readonly onCanceled?: OnCanceledCallback;\n private readonly onError?: OnErrorCallback;\n\n private onCompleteListener?: EventSubscription;\n private onCanceledListener?: EventSubscription;\n private onErrorListener?: EventSubscription;\n\n constructor(options: InquiryOptions) {\n this.templateId = options.templateId;\n this.inquiryId = options.inquiryId;\n this.referenceId = options.referenceId;\n this.accountId = options.accountId;\n this.environment = options.environment;\n this.sessionToken = options.sessionToken;\n this.fields = options.fields;\n this.returnCollectedData = options.returnCollectedData;\n\n // Callbacks\n this.onComplete = options.onComplete;\n this.onCanceled = options.onCanceled;\n this.onError = options.onError;\n\n // Theme object\n this.iosThemeObject = options.iosThemeObject;\n this.themeSource = options.themeSource;\n }\n\n private clearListeners() {\n if (this.onCompleteListener) this.onCompleteListener.remove();\n if (this.onCanceledListener) this.onCanceledListener.remove();\n if (this.onErrorListener) this.onErrorListener.remove();\n }\n\n /**\n * Create an Inquiry flow builder based on a template ID.\n *\n * You can find your template ID on the Dashboard under Inquiries > Templates.\n * {@link https://app.withpersona.com/dashboard/inquiry-templates}\n *\n * @param templateId template ID from your Persona Dashboard\n * @return builder for the Inquiry flow\n */\n static fromTemplate(templateId: string) {\n return new TemplateBuilder(makeTemplateId(templateId), null);\n }\n\n /**\n * Create an Inquiry flow builder based on a template ID version.\n *\n * You can find your template ID version on the Dashboard under the\n * settings view of a specific template.\n * {@link https://app.withpersona.com/dashboard/inquiry-templates}\n *\n * @param templateVersion template version from your Persona Dashboard\n * @return builder for the Inquiry flow\n */\n static fromTemplateVersion(templateVersion: string) {\n return new TemplateBuilder(null, makeTemplateVersion(templateVersion));\n }\n\n /**\n * Create an Inquiry flow builder based on an inquiry ID.\n *\n * You will need to generate the inquiry ID on the server. To try it out, you can create an\n * inquiry from the Persona Dashboard under \"Inquiries\". Click on the \"Create Inquiry\" button\n * and copy the inquiry ID from the URL.\n * {@link https://app.withpersona.com/dashboard/inquiries}\n *\n * @param inquiryId inquiry ID from your server\n * @return builder for the Inquiry flow\n */\n static fromInquiry(inquiryId: string) {\n return new InquiryBuilder(makeInquiryId(inquiryId));\n }\n\n /**\n * Launch the Persona Inquiry.\n */\n start() {\n this.onCompleteListener = eventEmitter.addListener(\n 'onComplete',\n (event: {\n inquiryId: string;\n status: string;\n fields: Record<string, RawInquiryField>;\n collectedData: ExternalCollectedData | null;\n }) => {\n if (this.onComplete) {\n let fields: Fields = {};\n for (let key of Object.keys(event.fields || {})) {\n let field = event.fields[key];\n if (field == undefined) {\n fields[key] = new InquiryField.Unknown('null');\n continue;\n }\n switch (field.type) {\n case 'integer':\n fields[key] = new InquiryField.Integer(\n Number.parseInt(field.value)\n );\n break;\n case 'boolean':\n fields[key] = new InquiryField.Boolean(field.value);\n break;\n case 'string':\n fields[key] = new InquiryField.String(field.value);\n break;\n default:\n fields[key] = new InquiryField.Unknown(field.type);\n break;\n }\n }\n\n let collectedData: CollectedData | null = null;\n\n let stepData = event.collectedData?.stepData;\n if (stepData != null) {\n // Translate the step data from JSON to actual class objects\n let translatedStepData = [];\n\n for (let stepDatum of stepData) {\n switch (stepDatum.type) {\n case 'DocumentStepData':\n translatedStepData.push(\n Object.assign(new DocumentStepData(), stepDatum)\n );\n break;\n case 'GovernmentIdStepData':\n translatedStepData.push(\n Object.assign(new GovernmentIdStepData(), stepDatum)\n );\n break;\n case 'SelfieStepData':\n translatedStepData.push(\n Object.assign(new SelfieStepData(), stepDatum)\n );\n break;\n case 'UiStepData':\n translatedStepData.push(\n Object.assign(new UiStepData(), stepDatum)\n );\n break;\n }\n }\n\n collectedData = {\n stepData: translatedStepData,\n };\n }\n\n let extraData: ExtraData = {\n collectedData: collectedData,\n };\n\n this.onComplete(event.inquiryId, event.status, fields, extraData);\n }\n this.clearListeners();\n }\n );\n\n this.onCanceledListener = eventEmitter.addListener(\n 'onCanceled',\n (event: { inquiryId?: string; sessionToken?: string }) => {\n if (this.onCanceled)\n this.onCanceled(event.inquiryId, event.sessionToken);\n this.clearListeners();\n }\n );\n\n this.onErrorListener = eventEmitter.addListener(\n 'onError',\n (event: { debugMessage: string }) => {\n if (this.onError) this.onError(new Error(event.debugMessage));\n this.clearListeners();\n }\n );\n\n PersonaInquiry2.startInquiry({\n templateId: this.templateId,\n inquiryId: this.inquiryId,\n referenceId: this.referenceId,\n accountId: this.accountId,\n environment: this.environment,\n sessionToken: this.sessionToken,\n fields: this.fields,\n returnCollectedData: this.returnCollectedData,\n themeSource: this.themeSource,\n iosTheme: processThemeValues(this.iosThemeObject || {}),\n });\n }\n}\n\nclass InquiryBuilder {\n private _inquiryId: InquiryId;\n private _sessionToken?: string;\n\n // Callbacks\n private _onComplete?: OnCompleteCallback;\n private _onCanceled?: OnCanceledCallback;\n private _onError?: OnErrorCallback;\n private _iosThemeObject?: Object;\n private _themeSource: ThemeSource = ThemeSource.SERVER;\n private _fields?: Fields;\n\n constructor(inquiryId: InquiryId) {\n this._inquiryId = inquiryId;\n }\n\n sessionToken(sessionToken: string): InquiryBuilder {\n this._sessionToken = sessionToken;\n\n return this;\n }\n\n onComplete(callback: OnCompleteCallback): InquiryBuilder {\n this._onComplete = callback;\n\n return this;\n }\n\n onCanceled(callback: OnCanceledCallback): InquiryBuilder {\n this._onCanceled = callback;\n\n return this;\n }\n\n onError(callback: OnErrorCallback): InquiryBuilder {\n this._onError = callback;\n\n return this;\n }\n\n /**\n * @deprecated Use iosThemeToUse\n */\n iosTheme(themeObject: Object): InquiryBuilder {\n this._iosThemeObject = themeObject;\n this._themeSource = ThemeSource.CLIENT;\n\n return this;\n }\n\n iosThemeToUse(themeObject: Object, themeSource: ThemeSource): InquiryBuilder {\n this._iosThemeObject = themeObject;\n this._themeSource = themeSource;\n\n return this;\n }\n\n build(): Inquiry {\n return new Inquiry({\n inquiryId: this._inquiryId,\n sessionToken: this._sessionToken,\n onComplete: this._onComplete,\n onCanceled: this._onCanceled,\n onError: this._onError,\n iosThemeObject: this._iosThemeObject,\n themeSource: this._themeSource,\n fields: this._fields,\n });\n }\n}\n\nclass TemplateBuilder {\n private readonly _templateId?: TemplateId;\n private readonly _templateVersion?: TemplateVersion;\n private _accountId?: AccountId;\n private _referenceId?: string;\n private _environment?: Environment;\n private _fields?: Fields;\n private _sessionToken?: string;\n private _returnCollectedData?: boolean;\n\n // Callbacks\n private _onComplete?: OnCompleteCallback;\n private _onCanceled?: OnCanceledCallback;\n private _onError?: OnErrorCallback;\n\n // Customization\n private _iosThemeObject?: Object;\n private _themeSource: ThemeSource = ThemeSource.SERVER;\n\n constructor(\n templateId?: TemplateId | null,\n templateVersion?: TemplateVersion | null\n ) {\n if (templateId != null) {\n this._templateId = templateId;\n } else if (templateVersion != null) {\n this._templateVersion = templateVersion;\n } else {\n throw new InvalidTemplateId(\n `Either templateId or templateVersion needs to be set.`\n );\n }\n return this;\n }\n\n returnCollectedData(returnCollectedData: boolean) {\n this._returnCollectedData = returnCollectedData;\n\n return this;\n }\n\n referenceId(referenceId: string): TemplateBuilder {\n this._accountId = undefined;\n this._referenceId = referenceId;\n\n return this;\n }\n\n accountId(accountId: string): TemplateBuilder {\n this._referenceId = undefined;\n this._accountId = makeAccountId(accountId);\n\n return this;\n }\n\n environment(environment: Environment): TemplateBuilder {\n this._environment = environment;\n\n return this;\n }\n\n sessionToken(sessionToken: string): TemplateBuilder {\n this._sessionToken = sessionToken;\n\n return this;\n }\n\n fields(fields: Fields): TemplateBuilder {\n this._fields = fields;\n\n return this;\n }\n\n onComplete(callback: OnCompleteCallback): TemplateBuilder {\n this._onComplete = callback;\n\n return this;\n }\n\n onCanceled(callback: OnCanceledCallback): TemplateBuilder {\n this._onCanceled = callback;\n\n return this;\n }\n\n onError(callback: OnErrorCallback): TemplateBuilder {\n this._onError = callback;\n\n return this;\n }\n\n /**\n * @deprecated Use iosThemeToUse\n */\n iosTheme(themeObject: Object): TemplateBuilder {\n this._iosThemeObject = themeObject;\n this._themeSource = ThemeSource.CLIENT;\n\n return this;\n }\n\n iosThemeToUse(\n themeObject: Object,\n themeSource: ThemeSource\n ): TemplateBuilder {\n this._iosThemeObject = themeObject;\n this._themeSource = themeSource;\n\n return this;\n }\n\n build(): Inquiry {\n return new Inquiry({\n templateId: this._templateId,\n templateVersion: this._templateVersion,\n accountId: this._accountId,\n referenceId: this._referenceId,\n environment: this._environment,\n sessionToken: this._sessionToken,\n fields: this._fields,\n onComplete: this._onComplete,\n onCanceled: this._onCanceled,\n onError: this._onError,\n iosThemeObject: this._iosThemeObject,\n themeSource: this._themeSource,\n returnCollectedData: this._returnCollectedData,\n });\n }\n}\n\n/**\n * @deprecated Use the `Inquiry` static methods instead\n */\nnamespace InquiryBuilders {\n /**\n * @deprecated Use {@link Inquiry#fromInquiry} instead\n */\n export function fromInquiry(inquiryId: string) {\n return Inquiry.fromInquiry(inquiryId);\n }\n\n /**\n * @deprecated Use {@link Inquiry#fromTemplate} instead\n */\n export function fromTemplate(templateId: string) {\n return Inquiry.fromTemplate(templateId);\n }\n\n /**\n * @deprecated Use {@link Inquiry#fromTemplateVersion} instead\n */\n export function fromTemplateVersion(templateVersion: string) {\n return Inquiry.fromTemplateVersion(templateVersion);\n }\n}\n\nexport default InquiryBuilders;\n"]}
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":["PersonaInquiry2","NativeModules","InvalidTemplateId","Error","InvalidTemplateVersion","InvalidInquiryId","InvalidAccountId","makeInquiryId","candidate","startsWith","makeTemplateId","makeTemplateVersion","makeAccountId","Environment","ThemeSource","RoutingCountry","DocumentStepData","constructor","stepName","documents","GovernmentIdStepData","captures","GovernmentIdCaptureMethod","GovernmentIdCaptureSide","SelfieStepData","centerCapture","leftCapture","rightCapture","SelfieCaptureMethod","UiStepData","componentParams","eventEmitter","NativeEventEmitter","Inquiry","options","templateId","inquiryId","referenceId","accountId","environment","sessionToken","fields","returnCollectedData","routingCountry","onComplete","onCanceled","onError","iosThemeObject","themeSource","clearListeners","onCompleteListener","remove","onCanceledListener","onErrorListener","fromTemplate","TemplateBuilder","fromTemplateVersion","templateVersion","fromInquiry","InquiryBuilder","start","addListener","event","key","Object","keys","field","undefined","InquiryField","Unknown","type","Integer","Number","parseInt","value","Boolean","String","collectedData","stepData","translatedStepData","stepDatum","push","assign","extraData","status","debugMessage","startInquiry","iosTheme","SERVER","_inquiryId","_sessionToken","callback","_onComplete","_onCanceled","_onError","themeObject","_iosThemeObject","_themeSource","CLIENT","iosThemeToUse","_routingCountry","build","_fields","_templateId","_templateVersion","_returnCollectedData","_accountId","_referenceId","_environment","InquiryBuilders"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AAKA;;AACA;;AAIA;;;;AAIA,MAAM;AAAEA,EAAAA;AAAF,IAAsBC,0BAA5B,C,CAEA;AACA;;AASO,MAAMC,iBAAN,SAAgCC,KAAhC,CAAsC;;;;AAEtC,MAAMC,sBAAN,SAAqCD,KAArC,CAA2C;;;;AAE3C,MAAME,gBAAN,SAA+BF,KAA/B,CAAqC;;;;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AAAA,mBAAmB,EAAE,KAAK+D,oBAbT;AAcjB9D,MAAAA,cAAc,EAAE,KAAKyD;AAdJ,KAAZ,CAAP;AAgBD;;AAvImB;AA0ItB;AACA;AACA;;;;;;AAKS,WAAS1C,WAAT,CAAqBtB,SAArB,EAAwC;AAC7C,WAAOH,OAAO,CAACyB,WAAR,CAAoBtB,SAApB,CAAP;AACD;;;;AAKM,WAASkB,YAAT,CAAsBnB,UAAtB,EAA0C;AAC/C,WAAOF,OAAO,CAACqB,YAAR,CAAqBnB,UAArB,CAAP;AACD;;;;AAKM,WAASqB,mBAAT,CAA6BC,eAA7B,EAAsD;AAC3D,WAAOxB,OAAO,CAACuB,mBAAR,CAA4BC,eAA5B,CAAP;AACD;;;GApBOoD,e,KAAAA,e;;eAuBKA,e","sourcesContent":["import {\n EventSubscription,\n NativeEventEmitter,\n NativeModules,\n} from 'react-native';\nimport { processThemeValues } from './util';\nimport { Fields, InquiryField, RawInquiryField } from './fields';\n\nexport { Fields };\n\nimport { Versions } from './versions';\n\nexport { Versions };\n\nconst { PersonaInquiry2 } = NativeModules;\n\n// Using Opaque types + Smart Constructor enforces validation at\n// instantiation time for IDS\ndeclare const Unique: unique symbol;\nexport type Opaque<T, Tag> = T & { [Unique]: Tag };\n\ntype TemplateId = Opaque<string, 'TemplateId'>;\ntype TemplateVersion = Opaque<string, 'TemplateVersion'>;\ntype InquiryId = Opaque<string, 'InquiryId'>;\ntype AccountId = Opaque<string, 'AccountId'>;\n\nexport class InvalidTemplateId extends Error {}\n\nexport class InvalidTemplateVersion extends Error {}\n\nexport class InvalidInquiryId extends Error {}\n\nexport class InvalidAccountId extends Error {}\n\n/**\n * Run validations that the string is in proper Inquiry token format\n * and do a type conversion to InquiryId.\n *\n * @param candidate\n */\nfunction makeInquiryId(candidate: string): InquiryId {\n if (candidate.startsWith('inq_')) return candidate as InquiryId;\n\n throw new InvalidInquiryId(\n `Valid template IDs start with \"inq_\". Received: ${candidate} `\n );\n}\n\n/**\n * Run validations that the string is in proper Template token format\n * and do a type conversion to TemplateId.\n *\n * @param candidate\n */\nfunction makeTemplateId(candidate: string): TemplateId {\n if (candidate.startsWith('itmpl_')) {\n return candidate as TemplateId;\n }\n\n throw new InvalidTemplateId(\n `Valid template IDs start with \"itmpl_\". Received: ${candidate} `\n );\n}\n\n/**\n * Run validations that the string is in proper Template Version token format\n * and do a type conversion to TemplateVersion.\n *\n * @param candidate\n */\nfunction makeTemplateVersion(candidate: string): TemplateVersion {\n if (candidate.startsWith('itmplv_')) {\n return candidate as TemplateVersion;\n }\n\n throw new InvalidTemplateVersion(\n `Valid template versions start with \"itmplv_\". Received: ${candidate} `\n );\n}\n\n/**\n * Run validations that the string is in proper Template token format\n * and do a type conversion to AccountId.\n *\n * @param candidate\n */\nfunction makeAccountId(candidate: string): AccountId {\n if (candidate.startsWith('act_')) {\n return candidate as AccountId;\n }\n\n throw new InvalidAccountId(\n `Valid account IDs start with \"act_\". Received: ${candidate} `\n );\n}\n\n/**\n * String enum for environments. These strings will be parsed\n * on the native side bridge into Kotlin / Swift enums.\n */\nexport enum Environment {\n SANDBOX = 'sandbox',\n PRODUCTION = 'production',\n}\n\n/**\n * An enum value which determines whether this sdk should use the theme values sent from the server.\n */\nexport enum ThemeSource {\n SERVER = 'server',\n /**\n * @deprecated Client side theming is deprecated, please configure your theme inside\n * the Persona Dashboard and use SERVER as the theme source.\n */\n CLIENT = 'client',\n}\n\n/**\n * Defines the country api requests route to\n */\nexport enum RoutingCountry {\n /**\n * Route api requests to germany servers\n */\n DE = 'de',\n /**\n * Route api requests to us servers\n */\n US = 'us',\n}\n\nexport interface InquiryOptions {\n templateId?: TemplateId;\n templateVersion?: TemplateVersion;\n inquiryId?: InquiryId;\n referenceId?: string;\n accountId?: AccountId;\n environment?: Environment;\n sessionToken?: string;\n returnCollectedData?: boolean;\n routingCountry?: RoutingCountry;\n\n // Fields\n fields?: Fields;\n\n // Callbacks\n onComplete?: OnCompleteCallback;\n onCanceled?: OnCanceledCallback;\n onError?: OnErrorCallback;\n\n // Customization\n iosThemeObject?: Object | null;\n themeSource?: ThemeSource | null;\n}\n\ntype OnCompleteCallback = (\n inquiryId: string,\n status: string,\n fields: Fields,\n extraData: ExtraData\n) => void;\n\n/**\n * Type for collected data that came directly from iOS/Android.\n * Needs to be translated to TS classes before returning.\n */\ninterface ExternalCollectedData {\n stepData: any[];\n}\n\nexport interface ExtraData {\n collectedData: CollectedData | null;\n}\nexport interface CollectedData {\n stepData: StepData[];\n}\n\nexport interface StepData {\n stepName: string;\n}\n\nexport class DocumentStepData implements StepData {\n stepName: string;\n documents: Document[];\n\n constructor() {\n this.stepName = '';\n this.documents = [];\n }\n}\n\nexport interface Document {\n absoluteFilePath: string;\n}\n\nexport class GovernmentIdStepData implements StepData {\n stepName: string;\n captures: GovernmentIdCapture[];\n\n constructor() {\n this.stepName = '';\n this.captures = [];\n }\n}\n\nexport interface GovernmentIdCapture {\n idClass: string;\n captureMethod: GovernmentIdCaptureMethod;\n side: GovernmentIdCaptureSide;\n frames: GovernmentIdCaptureFrames[];\n}\n\nexport enum GovernmentIdCaptureMethod {\n Manual = 'Manual',\n Auto = 'Auto',\n Upload = 'Upload',\n}\n\nexport enum GovernmentIdCaptureSide {\n Front = 'Front',\n Back = 'Back',\n}\n\nexport interface GovernmentIdCaptureFrames {\n absoluteFilePath: string;\n}\n\nexport class SelfieStepData implements StepData {\n stepName: string;\n centerCapture: SelfieCapture | null;\n leftCapture: SelfieCapture | null;\n rightCapture: SelfieCapture | null;\n\n constructor() {\n this.stepName = '';\n this.centerCapture = null;\n this.leftCapture = null;\n this.rightCapture = null;\n }\n}\n\nexport interface SelfieCapture {\n captureMethod: SelfieCaptureMethod;\n absoluteFilePath: string;\n}\n\nexport enum SelfieCaptureMethod {\n Manual = 'Manual',\n Auto = 'Auto',\n}\n\nexport class UiStepData implements StepData {\n stepName: string;\n componentParams: { [key: string]: any };\n\n constructor() {\n this.stepName = '';\n this.componentParams = {};\n }\n}\n\ntype OnCanceledCallback = (inquiryId?: string, sessionToken?: string) => void;\n\ntype OnErrorCallback = (error: Error) => void;\n\nconst eventEmitter = new NativeEventEmitter(PersonaInquiry2);\n\nexport class Inquiry {\n templateId?: TemplateId;\n inquiryId?: InquiryId;\n referenceId?: string;\n accountId?: AccountId;\n environment?: Environment;\n sessionToken?: string;\n returnCollectedData?: boolean;\n routingCountry?: RoutingCountry;\n\n iosThemeObject?: Object | null;\n themeSource?: ThemeSource | null;\n fields?: Fields | null;\n\n private readonly onComplete?: OnCompleteCallback;\n private readonly onCanceled?: OnCanceledCallback;\n private readonly onError?: OnErrorCallback;\n\n private onCompleteListener?: EventSubscription;\n private onCanceledListener?: EventSubscription;\n private onErrorListener?: EventSubscription;\n\n constructor(options: InquiryOptions) {\n this.templateId = options.templateId;\n this.inquiryId = options.inquiryId;\n this.referenceId = options.referenceId;\n this.accountId = options.accountId;\n this.environment = options.environment;\n this.sessionToken = options.sessionToken;\n this.fields = options.fields;\n this.returnCollectedData = options.returnCollectedData;\n this.routingCountry = options.routingCountry;\n\n // Callbacks\n this.onComplete = options.onComplete;\n this.onCanceled = options.onCanceled;\n this.onError = options.onError;\n\n // Theme object\n this.iosThemeObject = options.iosThemeObject;\n this.themeSource = options.themeSource;\n }\n\n private clearListeners() {\n if (this.onCompleteListener) this.onCompleteListener.remove();\n if (this.onCanceledListener) this.onCanceledListener.remove();\n if (this.onErrorListener) this.onErrorListener.remove();\n }\n\n /**\n * Create an Inquiry flow builder based on a template ID.\n *\n * You can find your template ID on the Dashboard under Inquiries > Templates.\n * {@link https://app.withpersona.com/dashboard/inquiry-templates}\n *\n * @param templateId template ID from your Persona Dashboard\n * @return builder for the Inquiry flow\n */\n static fromTemplate(templateId: string) {\n return new TemplateBuilder(makeTemplateId(templateId), null);\n }\n\n /**\n * Create an Inquiry flow builder based on a template ID version.\n *\n * You can find your template ID version on the Dashboard under the\n * settings view of a specific template.\n * {@link https://app.withpersona.com/dashboard/inquiry-templates}\n *\n * @param templateVersion template version from your Persona Dashboard\n * @return builder for the Inquiry flow\n */\n static fromTemplateVersion(templateVersion: string) {\n return new TemplateBuilder(null, makeTemplateVersion(templateVersion));\n }\n\n /**\n * Create an Inquiry flow builder based on an inquiry ID.\n *\n * You will need to generate the inquiry ID on the server. To try it out, you can create an\n * inquiry from the Persona Dashboard under \"Inquiries\". Click on the \"Create Inquiry\" button\n * and copy the inquiry ID from the URL.\n * {@link https://app.withpersona.com/dashboard/inquiries}\n *\n * @param inquiryId inquiry ID from your server\n * @return builder for the Inquiry flow\n */\n static fromInquiry(inquiryId: string) {\n return new InquiryBuilder(makeInquiryId(inquiryId));\n }\n\n /**\n * Launch the Persona Inquiry.\n */\n start() {\n this.onCompleteListener = eventEmitter.addListener(\n 'onComplete',\n (event: {\n inquiryId: string;\n status: string;\n fields: Record<string, RawInquiryField>;\n collectedData: ExternalCollectedData | null;\n }) => {\n if (this.onComplete) {\n let fields: Fields = {};\n for (let key of Object.keys(event.fields || {})) {\n let field = event.fields[key];\n if (field == undefined) {\n fields[key] = new InquiryField.Unknown('null');\n continue;\n }\n switch (field.type) {\n case 'integer':\n fields[key] = new InquiryField.Integer(\n Number.parseInt(field.value)\n );\n break;\n case 'boolean':\n fields[key] = new InquiryField.Boolean(field.value);\n break;\n case 'string':\n fields[key] = new InquiryField.String(field.value);\n break;\n default:\n fields[key] = new InquiryField.Unknown(field.type);\n break;\n }\n }\n\n let collectedData: CollectedData | null = null;\n\n let stepData = event.collectedData?.stepData;\n if (stepData != null) {\n // Translate the step data from JSON to actual class objects\n let translatedStepData = [];\n\n for (let stepDatum of stepData) {\n switch (stepDatum.type) {\n case 'DocumentStepData':\n translatedStepData.push(\n Object.assign(new DocumentStepData(), stepDatum)\n );\n break;\n case 'GovernmentIdStepData':\n translatedStepData.push(\n Object.assign(new GovernmentIdStepData(), stepDatum)\n );\n break;\n case 'SelfieStepData':\n translatedStepData.push(\n Object.assign(new SelfieStepData(), stepDatum)\n );\n break;\n case 'UiStepData':\n translatedStepData.push(\n Object.assign(new UiStepData(), stepDatum)\n );\n break;\n }\n }\n\n collectedData = {\n stepData: translatedStepData,\n };\n }\n\n let extraData: ExtraData = {\n collectedData: collectedData,\n };\n\n this.onComplete(event.inquiryId, event.status, fields, extraData);\n }\n this.clearListeners();\n }\n );\n\n this.onCanceledListener = eventEmitter.addListener(\n 'onCanceled',\n (event: { inquiryId?: string; sessionToken?: string }) => {\n if (this.onCanceled)\n this.onCanceled(event.inquiryId, event.sessionToken);\n this.clearListeners();\n }\n );\n\n this.onErrorListener = eventEmitter.addListener(\n 'onError',\n (event: { debugMessage: string }) => {\n if (this.onError) this.onError(new Error(event.debugMessage));\n this.clearListeners();\n }\n );\n\n PersonaInquiry2.startInquiry({\n templateId: this.templateId,\n inquiryId: this.inquiryId,\n referenceId: this.referenceId,\n accountId: this.accountId,\n environment: this.environment,\n sessionToken: this.sessionToken,\n fields: this.fields,\n returnCollectedData: this.returnCollectedData,\n themeSource: this.themeSource,\n iosTheme: processThemeValues(this.iosThemeObject || {}),\n routingCountry: this.routingCountry,\n });\n }\n}\n\nclass InquiryBuilder {\n private _inquiryId: InquiryId;\n private _sessionToken?: string;\n\n // Callbacks\n private _onComplete?: OnCompleteCallback;\n private _onCanceled?: OnCanceledCallback;\n private _onError?: OnErrorCallback;\n private _iosThemeObject?: Object;\n private _themeSource: ThemeSource = ThemeSource.SERVER;\n private _fields?: Fields;\n private _routingCountry?: RoutingCountry;\n\n constructor(inquiryId: InquiryId) {\n this._inquiryId = inquiryId;\n }\n\n sessionToken(sessionToken: string): InquiryBuilder {\n this._sessionToken = sessionToken;\n\n return this;\n }\n\n onComplete(callback: OnCompleteCallback): InquiryBuilder {\n this._onComplete = callback;\n\n return this;\n }\n\n onCanceled(callback: OnCanceledCallback): InquiryBuilder {\n this._onCanceled = callback;\n\n return this;\n }\n\n onError(callback: OnErrorCallback): InquiryBuilder {\n this._onError = callback;\n\n return this;\n }\n\n /**\n * @deprecated Use iosThemeToUse\n */\n iosTheme(themeObject: Object): InquiryBuilder {\n this._iosThemeObject = themeObject;\n this._themeSource = ThemeSource.CLIENT;\n\n return this;\n }\n\n iosThemeToUse(themeObject: Object, themeSource: ThemeSource): InquiryBuilder {\n this._iosThemeObject = themeObject;\n this._themeSource = themeSource;\n\n return this;\n }\n\n routingCountry(routingCountry: RoutingCountry): InquiryBuilder {\n this._routingCountry = routingCountry;\n\n return this;\n }\n\n build(): Inquiry {\n return new Inquiry({\n inquiryId: this._inquiryId,\n sessionToken: this._sessionToken,\n onComplete: this._onComplete,\n onCanceled: this._onCanceled,\n onError: this._onError,\n iosThemeObject: this._iosThemeObject,\n themeSource: this._themeSource,\n fields: this._fields,\n routingCountry: this._routingCountry,\n });\n }\n}\n\nclass TemplateBuilder {\n private readonly _templateId?: TemplateId;\n private readonly _templateVersion?: TemplateVersion;\n private _accountId?: AccountId;\n private _referenceId?: string;\n private _environment?: Environment;\n private _fields?: Fields;\n private _sessionToken?: string;\n private _returnCollectedData?: boolean;\n private _routingCountry?: RoutingCountry;\n\n // Callbacks\n private _onComplete?: OnCompleteCallback;\n private _onCanceled?: OnCanceledCallback;\n private _onError?: OnErrorCallback;\n\n // Customization\n private _iosThemeObject?: Object;\n private _themeSource: ThemeSource = ThemeSource.SERVER;\n\n constructor(\n templateId?: TemplateId | null,\n templateVersion?: TemplateVersion | null\n ) {\n if (templateId != null) {\n this._templateId = templateId;\n } else if (templateVersion != null) {\n this._templateVersion = templateVersion;\n } else {\n throw new InvalidTemplateId(\n `Either templateId or templateVersion needs to be set.`\n );\n }\n return this;\n }\n\n returnCollectedData(returnCollectedData: boolean) {\n this._returnCollectedData = returnCollectedData;\n\n return this;\n }\n\n referenceId(referenceId: string): TemplateBuilder {\n this._accountId = undefined;\n this._referenceId = referenceId;\n\n return this;\n }\n\n accountId(accountId: string): TemplateBuilder {\n this._referenceId = undefined;\n this._accountId = makeAccountId(accountId);\n\n return this;\n }\n\n environment(environment: Environment): TemplateBuilder {\n this._environment = environment;\n\n return this;\n }\n\n sessionToken(sessionToken: string): TemplateBuilder {\n this._sessionToken = sessionToken;\n\n return this;\n }\n\n fields(fields: Fields): TemplateBuilder {\n this._fields = fields;\n\n return this;\n }\n\n routingCountry(routingCountry: RoutingCountry): TemplateBuilder {\n this._routingCountry = routingCountry;\n\n return this;\n }\n\n onComplete(callback: OnCompleteCallback): TemplateBuilder {\n this._onComplete = callback;\n\n return this;\n }\n\n onCanceled(callback: OnCanceledCallback): TemplateBuilder {\n this._onCanceled = callback;\n\n return this;\n }\n\n onError(callback: OnErrorCallback): TemplateBuilder {\n this._onError = callback;\n\n return this;\n }\n\n /**\n * @deprecated Use iosThemeToUse\n */\n iosTheme(themeObject: Object): TemplateBuilder {\n this._iosThemeObject = themeObject;\n this._themeSource = ThemeSource.CLIENT;\n\n return this;\n }\n\n iosThemeToUse(\n themeObject: Object,\n themeSource: ThemeSource\n ): TemplateBuilder {\n this._iosThemeObject = themeObject;\n this._themeSource = themeSource;\n\n return this;\n }\n\n build(): Inquiry {\n return new Inquiry({\n templateId: this._templateId,\n templateVersion: this._templateVersion,\n accountId: this._accountId,\n referenceId: this._referenceId,\n environment: this._environment,\n sessionToken: this._sessionToken,\n fields: this._fields,\n onComplete: this._onComplete,\n onCanceled: this._onCanceled,\n onError: this._onError,\n iosThemeObject: this._iosThemeObject,\n themeSource: this._themeSource,\n returnCollectedData: this._returnCollectedData,\n routingCountry: this._routingCountry,\n });\n }\n}\n\n/**\n * @deprecated Use the `Inquiry` static methods instead\n */\nnamespace InquiryBuilders {\n /**\n * @deprecated Use {@link Inquiry#fromInquiry} instead\n */\n export function fromInquiry(inquiryId: string) {\n return Inquiry.fromInquiry(inquiryId);\n }\n\n /**\n * @deprecated Use {@link Inquiry#fromTemplate} instead\n */\n export function fromTemplate(templateId: string) {\n return Inquiry.fromTemplate(templateId);\n }\n\n /**\n * @deprecated Use {@link Inquiry#fromTemplateVersion} instead\n */\n export function fromTemplateVersion(templateVersion: string) {\n return Inquiry.fromTemplateVersion(templateVersion);\n }\n}\n\nexport default InquiryBuilders;\n"]}
|
package/lib/module/index.js
CHANGED
|
@@ -88,12 +88,22 @@ export let Environment;
|
|
|
88
88
|
})(Environment || (Environment = {}));
|
|
89
89
|
|
|
90
90
|
export let ThemeSource;
|
|
91
|
+
/**
|
|
92
|
+
* Defines the country api requests route to
|
|
93
|
+
*/
|
|
91
94
|
|
|
92
95
|
(function (ThemeSource) {
|
|
93
96
|
ThemeSource["SERVER"] = "server";
|
|
94
97
|
ThemeSource["CLIENT"] = "client";
|
|
95
98
|
})(ThemeSource || (ThemeSource = {}));
|
|
96
99
|
|
|
100
|
+
export let RoutingCountry;
|
|
101
|
+
|
|
102
|
+
(function (RoutingCountry) {
|
|
103
|
+
RoutingCountry["DE"] = "de";
|
|
104
|
+
RoutingCountry["US"] = "us";
|
|
105
|
+
})(RoutingCountry || (RoutingCountry = {}));
|
|
106
|
+
|
|
97
107
|
export class DocumentStepData {
|
|
98
108
|
constructor() {
|
|
99
109
|
_defineProperty(this, "stepName", void 0);
|
|
@@ -183,6 +193,8 @@ export class Inquiry {
|
|
|
183
193
|
|
|
184
194
|
_defineProperty(this, "returnCollectedData", void 0);
|
|
185
195
|
|
|
196
|
+
_defineProperty(this, "routingCountry", void 0);
|
|
197
|
+
|
|
186
198
|
_defineProperty(this, "iosThemeObject", void 0);
|
|
187
199
|
|
|
188
200
|
_defineProperty(this, "themeSource", void 0);
|
|
@@ -208,7 +220,8 @@ export class Inquiry {
|
|
|
208
220
|
this.environment = options.environment;
|
|
209
221
|
this.sessionToken = options.sessionToken;
|
|
210
222
|
this.fields = options.fields;
|
|
211
|
-
this.returnCollectedData = options.returnCollectedData;
|
|
223
|
+
this.returnCollectedData = options.returnCollectedData;
|
|
224
|
+
this.routingCountry = options.routingCountry; // Callbacks
|
|
212
225
|
|
|
213
226
|
this.onComplete = options.onComplete;
|
|
214
227
|
this.onCanceled = options.onCanceled;
|
|
@@ -365,7 +378,8 @@ export class Inquiry {
|
|
|
365
378
|
fields: this.fields,
|
|
366
379
|
returnCollectedData: this.returnCollectedData,
|
|
367
380
|
themeSource: this.themeSource,
|
|
368
|
-
iosTheme: processThemeValues(this.iosThemeObject || {})
|
|
381
|
+
iosTheme: processThemeValues(this.iosThemeObject || {}),
|
|
382
|
+
routingCountry: this.routingCountry
|
|
369
383
|
});
|
|
370
384
|
}
|
|
371
385
|
|
|
@@ -390,6 +404,8 @@ class InquiryBuilder {
|
|
|
390
404
|
|
|
391
405
|
_defineProperty(this, "_fields", void 0);
|
|
392
406
|
|
|
407
|
+
_defineProperty(this, "_routingCountry", void 0);
|
|
408
|
+
|
|
393
409
|
this._inquiryId = inquiryId;
|
|
394
410
|
}
|
|
395
411
|
|
|
@@ -429,6 +445,11 @@ class InquiryBuilder {
|
|
|
429
445
|
return this;
|
|
430
446
|
}
|
|
431
447
|
|
|
448
|
+
routingCountry(routingCountry) {
|
|
449
|
+
this._routingCountry = routingCountry;
|
|
450
|
+
return this;
|
|
451
|
+
}
|
|
452
|
+
|
|
432
453
|
build() {
|
|
433
454
|
return new Inquiry({
|
|
434
455
|
inquiryId: this._inquiryId,
|
|
@@ -438,7 +459,8 @@ class InquiryBuilder {
|
|
|
438
459
|
onError: this._onError,
|
|
439
460
|
iosThemeObject: this._iosThemeObject,
|
|
440
461
|
themeSource: this._themeSource,
|
|
441
|
-
fields: this._fields
|
|
462
|
+
fields: this._fields,
|
|
463
|
+
routingCountry: this._routingCountry
|
|
442
464
|
});
|
|
443
465
|
}
|
|
444
466
|
|
|
@@ -464,6 +486,8 @@ class TemplateBuilder {
|
|
|
464
486
|
|
|
465
487
|
_defineProperty(this, "_returnCollectedData", void 0);
|
|
466
488
|
|
|
489
|
+
_defineProperty(this, "_routingCountry", void 0);
|
|
490
|
+
|
|
467
491
|
_defineProperty(this, "_onComplete", void 0);
|
|
468
492
|
|
|
469
493
|
_defineProperty(this, "_onCanceled", void 0);
|
|
@@ -517,6 +541,11 @@ class TemplateBuilder {
|
|
|
517
541
|
return this;
|
|
518
542
|
}
|
|
519
543
|
|
|
544
|
+
routingCountry(routingCountry) {
|
|
545
|
+
this._routingCountry = routingCountry;
|
|
546
|
+
return this;
|
|
547
|
+
}
|
|
548
|
+
|
|
520
549
|
onComplete(callback) {
|
|
521
550
|
this._onComplete = callback;
|
|
522
551
|
return this;
|
|
@@ -562,7 +591,8 @@ class TemplateBuilder {
|
|
|
562
591
|
onError: this._onError,
|
|
563
592
|
iosThemeObject: this._iosThemeObject,
|
|
564
593
|
themeSource: this._themeSource,
|
|
565
|
-
returnCollectedData: this._returnCollectedData
|
|
594
|
+
returnCollectedData: this._returnCollectedData,
|
|
595
|
+
routingCountry: this._routingCountry
|
|
566
596
|
});
|
|
567
597
|
}
|
|
568
598
|
|