react-native-persona 2.6.3 → 2.6.4
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/android/build.gradle +1 -1
- package/android/src/main/java/com/withpersona/sdk2/reactnative/PersonaInquiryModule2.java +6 -0
- package/ios/PersonaInquiry2.swift +4 -0
- package/lib/commonjs/index.js +24 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +24 -4
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/index.d.ts +6 -0
- package/package.json +1 -1
- package/src/index.ts +20 -0
package/android/build.gradle
CHANGED
|
@@ -53,6 +53,7 @@ public class PersonaInquiryModule2 extends ReactContextBaseJavaModule
|
|
|
53
53
|
private static final String RETURN_COLLECTED_DATA = "returnCollectedData";
|
|
54
54
|
private static final String THEME_SOURCE = "themeSource";
|
|
55
55
|
private static final String ROUTING_COUNTRY = "routingCountry";
|
|
56
|
+
private static final String LOCALE = "locale";
|
|
56
57
|
|
|
57
58
|
private final ReactApplicationContext reactContext;
|
|
58
59
|
|
|
@@ -334,6 +335,11 @@ public class PersonaInquiryModule2 extends ReactContextBaseJavaModule
|
|
|
334
335
|
builder = builder.routingCountry(routingCountry);
|
|
335
336
|
}
|
|
336
337
|
|
|
338
|
+
String locale = options.hasKey(LOCALE) ? options.getString(LOCALE) : null;
|
|
339
|
+
if (locale != null) {
|
|
340
|
+
builder = builder.locale(locale);
|
|
341
|
+
}
|
|
342
|
+
|
|
337
343
|
ReadableMap fields = options.hasKey(FIELDS) ? options.getMap(FIELDS) : null;
|
|
338
344
|
|
|
339
345
|
if (fields != null) {
|
|
@@ -50,6 +50,7 @@ class PersonaInquiry2: RCTEventEmitter {
|
|
|
50
50
|
let fieldsObject = options["fields"] as? [String: [String: Any]]
|
|
51
51
|
let returnCollectedData = options["returnCollectedData"] as? Bool ?? false
|
|
52
52
|
let routingCountry = options["routingCountry"] as? String
|
|
53
|
+
let locale = options["locale"] as? String
|
|
53
54
|
|
|
54
55
|
var nfcAdapter: InquiryNfcAdapter? = nil
|
|
55
56
|
#if canImport(PersonaNfc)
|
|
@@ -64,6 +65,7 @@ class PersonaInquiry2: RCTEventEmitter {
|
|
|
64
65
|
.nfcAdapter(nfcAdapter)
|
|
65
66
|
.collectionDelegate(returnCollectedData ? self : nil)
|
|
66
67
|
.routingCountry(routingCountry)
|
|
68
|
+
.locale(locale)
|
|
67
69
|
.build()
|
|
68
70
|
} else if let templateId {
|
|
69
71
|
inquiry = Inquiry.from(templateId: templateId, delegate: self)
|
|
@@ -74,6 +76,7 @@ class PersonaInquiry2: RCTEventEmitter {
|
|
|
74
76
|
.nfcAdapter(nfcAdapter)
|
|
75
77
|
.collectionDelegate(returnCollectedData ? self : nil)
|
|
76
78
|
.routingCountry(routingCountry)
|
|
79
|
+
.locale(locale)
|
|
77
80
|
.build()
|
|
78
81
|
} else if let templateVersion {
|
|
79
82
|
inquiry = Inquiry.from(templateVersion: templateVersion, delegate: self)
|
|
@@ -84,6 +87,7 @@ class PersonaInquiry2: RCTEventEmitter {
|
|
|
84
87
|
.nfcAdapter(nfcAdapter)
|
|
85
88
|
.collectionDelegate(returnCollectedData ? self : nil)
|
|
86
89
|
.routingCountry(routingCountry)
|
|
90
|
+
.locale(locale)
|
|
87
91
|
.build()
|
|
88
92
|
}
|
|
89
93
|
|
package/lib/commonjs/index.js
CHANGED
|
@@ -248,6 +248,8 @@ class Inquiry {
|
|
|
248
248
|
|
|
249
249
|
_defineProperty(this, "routingCountry", void 0);
|
|
250
250
|
|
|
251
|
+
_defineProperty(this, "locale", void 0);
|
|
252
|
+
|
|
251
253
|
_defineProperty(this, "iosThemeObject", void 0);
|
|
252
254
|
|
|
253
255
|
_defineProperty(this, "themeSource", void 0);
|
|
@@ -274,7 +276,8 @@ class Inquiry {
|
|
|
274
276
|
this.sessionToken = options.sessionToken;
|
|
275
277
|
this.fields = options.fields;
|
|
276
278
|
this.returnCollectedData = options.returnCollectedData;
|
|
277
|
-
this.routingCountry = options.routingCountry;
|
|
279
|
+
this.routingCountry = options.routingCountry;
|
|
280
|
+
this.locale = options.locale; // Callbacks
|
|
278
281
|
|
|
279
282
|
this.onComplete = options.onComplete;
|
|
280
283
|
this.onCanceled = options.onCanceled;
|
|
@@ -432,7 +435,8 @@ class Inquiry {
|
|
|
432
435
|
returnCollectedData: this.returnCollectedData,
|
|
433
436
|
themeSource: this.themeSource,
|
|
434
437
|
iosTheme: (0, _util.processThemeValues)(this.iosThemeObject || {}),
|
|
435
|
-
routingCountry: this.routingCountry
|
|
438
|
+
routingCountry: this.routingCountry,
|
|
439
|
+
locale: this.locale
|
|
436
440
|
});
|
|
437
441
|
}
|
|
438
442
|
|
|
@@ -461,6 +465,8 @@ class InquiryBuilder {
|
|
|
461
465
|
|
|
462
466
|
_defineProperty(this, "_routingCountry", void 0);
|
|
463
467
|
|
|
468
|
+
_defineProperty(this, "_locale", void 0);
|
|
469
|
+
|
|
464
470
|
this._inquiryId = inquiryId;
|
|
465
471
|
}
|
|
466
472
|
|
|
@@ -505,6 +511,11 @@ class InquiryBuilder {
|
|
|
505
511
|
return this;
|
|
506
512
|
}
|
|
507
513
|
|
|
514
|
+
locale(locale) {
|
|
515
|
+
this._locale = locale;
|
|
516
|
+
return this;
|
|
517
|
+
}
|
|
518
|
+
|
|
508
519
|
build() {
|
|
509
520
|
return new Inquiry({
|
|
510
521
|
inquiryId: this._inquiryId,
|
|
@@ -515,7 +526,8 @@ class InquiryBuilder {
|
|
|
515
526
|
iosThemeObject: this._iosThemeObject,
|
|
516
527
|
themeSource: this._themeSource,
|
|
517
528
|
fields: this._fields,
|
|
518
|
-
routingCountry: this._routingCountry
|
|
529
|
+
routingCountry: this._routingCountry,
|
|
530
|
+
locale: this._locale
|
|
519
531
|
});
|
|
520
532
|
}
|
|
521
533
|
|
|
@@ -543,6 +555,8 @@ class TemplateBuilder {
|
|
|
543
555
|
|
|
544
556
|
_defineProperty(this, "_routingCountry", void 0);
|
|
545
557
|
|
|
558
|
+
_defineProperty(this, "_locale", void 0);
|
|
559
|
+
|
|
546
560
|
_defineProperty(this, "_onComplete", void 0);
|
|
547
561
|
|
|
548
562
|
_defineProperty(this, "_onCanceled", void 0);
|
|
@@ -601,6 +615,11 @@ class TemplateBuilder {
|
|
|
601
615
|
return this;
|
|
602
616
|
}
|
|
603
617
|
|
|
618
|
+
locale(locale) {
|
|
619
|
+
this._locale = locale;
|
|
620
|
+
return this;
|
|
621
|
+
}
|
|
622
|
+
|
|
604
623
|
onComplete(callback) {
|
|
605
624
|
this._onComplete = callback;
|
|
606
625
|
return this;
|
|
@@ -647,7 +666,8 @@ class TemplateBuilder {
|
|
|
647
666
|
iosThemeObject: this._iosThemeObject,
|
|
648
667
|
themeSource: this._themeSource,
|
|
649
668
|
returnCollectedData: this._returnCollectedData,
|
|
650
|
-
routingCountry: this._routingCountry
|
|
669
|
+
routingCountry: this._routingCountry,
|
|
670
|
+
locale: this._locale
|
|
651
671
|
});
|
|
652
672
|
}
|
|
653
673
|
|
|
@@ -1 +1 @@
|
|
|
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;;;;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,SAAP;AAElC,QAAM,IAAIH,gBAAJ,CACH,mDAAkDG,SAAU,GADzD,CAAN;AAGD;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASE,cAAT,CAAwBF,SAAxB,EAAuD;AACrD,MAAIA,SAAS,CAACC,UAAV,CAAqB,QAArB,CAAJ,EAAoC;AAClC,WAAOD,SAAP;AACD;;AAED,QAAM,IAAIN,iBAAJ,CACH,qDAAoDM,SAAU,GAD3D,CAAN;AAGD;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASG,mBAAT,CAA6BH,SAA7B,EAAiE;AAC/D,MAAIA,SAAS,CAACC,UAAV,CAAqB,SAArB,CAAJ,EAAqC;AACnC,WAAOD,SAAP;AACD;;AAED,QAAM,IAAIJ,sBAAJ,CACH,2DAA0DI,SAAU,GADjE,CAAN;AAGD;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,S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KoE,WADA;AAEjB9C,MAAAA,eAAe,EAAE,KAAK+C,gBAFL;AAGjBlE,MAAAA,SAAS,EAAE,KAAKoE,UAHC;AAIjBrE,MAAAA,WAAW,EAAE,KAAKsE,YAJD;AAKjBpE,MAAAA,WAAW,EAAE,KAAKqE,YALD;AAMjBpE,MAAAA,YAAY,EAAE,KAAKkD,aANF;AAOjBjD,MAAAA,MAAM,EAAE,KAAK6D,OAPI;AAQjB1D,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;AAajBvD,MAAAA,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"]}
|
|
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","locale","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","_locale","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,SAAP;AAElC,QAAM,IAAIH,gBAAJ,CACH,mDAAkDG,SAAU,GADzD,CAAN;AAGD;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASE,cAAT,CAAwBF,SAAxB,EAAuD;AACrD,MAAIA,SAAS,CAACC,UAAV,CAAqB,QAArB,CAAJ,EAAoC;AAClC,WAAOD,SAAP;AACD;;AAED,QAAM,IAAIN,iBAAJ,CACH,qDAAoDM,SAAU,GAD3D,CAAN;AAGD;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASG,mBAAT,CAA6BH,SAA7B,EAAiE;AAC/D,MAAIA,SAAS,CAACC,UAAV,CAAqB,SAArB,CAAJ,EAAqC;AACnC,WAAOD,SAAP;AACD;;AAED,QAAM,IAAIJ,sBAAJ,CACH,2DAA0DI,SAAU,GADjE,CAAN;AAGD;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASI,aAAT,CAAuBJ,SAAvB,EAAqD;AACnD,MAAIA,SAAS,CAACC,UAAV,CAAqB,MAArB,CAAJ,EAAkC;AAChC,WAAOD,S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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 locale?: String;\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 locale?: String;\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 this.locale = options.locale;\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 locale: this.locale,\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 private _locale?: string;\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 locale(locale: string): InquiryBuilder {\n this._locale = locale;\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 locale: this._locale,\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 private _locale?: string;\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 locale(locale: string): TemplateBuilder {\n this._locale = locale;\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 locale: this._locale,\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
|
@@ -195,6 +195,8 @@ export class Inquiry {
|
|
|
195
195
|
|
|
196
196
|
_defineProperty(this, "routingCountry", void 0);
|
|
197
197
|
|
|
198
|
+
_defineProperty(this, "locale", void 0);
|
|
199
|
+
|
|
198
200
|
_defineProperty(this, "iosThemeObject", void 0);
|
|
199
201
|
|
|
200
202
|
_defineProperty(this, "themeSource", void 0);
|
|
@@ -221,7 +223,8 @@ export class Inquiry {
|
|
|
221
223
|
this.sessionToken = options.sessionToken;
|
|
222
224
|
this.fields = options.fields;
|
|
223
225
|
this.returnCollectedData = options.returnCollectedData;
|
|
224
|
-
this.routingCountry = options.routingCountry;
|
|
226
|
+
this.routingCountry = options.routingCountry;
|
|
227
|
+
this.locale = options.locale; // Callbacks
|
|
225
228
|
|
|
226
229
|
this.onComplete = options.onComplete;
|
|
227
230
|
this.onCanceled = options.onCanceled;
|
|
@@ -379,7 +382,8 @@ export class Inquiry {
|
|
|
379
382
|
returnCollectedData: this.returnCollectedData,
|
|
380
383
|
themeSource: this.themeSource,
|
|
381
384
|
iosTheme: processThemeValues(this.iosThemeObject || {}),
|
|
382
|
-
routingCountry: this.routingCountry
|
|
385
|
+
routingCountry: this.routingCountry,
|
|
386
|
+
locale: this.locale
|
|
383
387
|
});
|
|
384
388
|
}
|
|
385
389
|
|
|
@@ -406,6 +410,8 @@ class InquiryBuilder {
|
|
|
406
410
|
|
|
407
411
|
_defineProperty(this, "_routingCountry", void 0);
|
|
408
412
|
|
|
413
|
+
_defineProperty(this, "_locale", void 0);
|
|
414
|
+
|
|
409
415
|
this._inquiryId = inquiryId;
|
|
410
416
|
}
|
|
411
417
|
|
|
@@ -450,6 +456,11 @@ class InquiryBuilder {
|
|
|
450
456
|
return this;
|
|
451
457
|
}
|
|
452
458
|
|
|
459
|
+
locale(locale) {
|
|
460
|
+
this._locale = locale;
|
|
461
|
+
return this;
|
|
462
|
+
}
|
|
463
|
+
|
|
453
464
|
build() {
|
|
454
465
|
return new Inquiry({
|
|
455
466
|
inquiryId: this._inquiryId,
|
|
@@ -460,7 +471,8 @@ class InquiryBuilder {
|
|
|
460
471
|
iosThemeObject: this._iosThemeObject,
|
|
461
472
|
themeSource: this._themeSource,
|
|
462
473
|
fields: this._fields,
|
|
463
|
-
routingCountry: this._routingCountry
|
|
474
|
+
routingCountry: this._routingCountry,
|
|
475
|
+
locale: this._locale
|
|
464
476
|
});
|
|
465
477
|
}
|
|
466
478
|
|
|
@@ -488,6 +500,8 @@ class TemplateBuilder {
|
|
|
488
500
|
|
|
489
501
|
_defineProperty(this, "_routingCountry", void 0);
|
|
490
502
|
|
|
503
|
+
_defineProperty(this, "_locale", void 0);
|
|
504
|
+
|
|
491
505
|
_defineProperty(this, "_onComplete", void 0);
|
|
492
506
|
|
|
493
507
|
_defineProperty(this, "_onCanceled", void 0);
|
|
@@ -546,6 +560,11 @@ class TemplateBuilder {
|
|
|
546
560
|
return this;
|
|
547
561
|
}
|
|
548
562
|
|
|
563
|
+
locale(locale) {
|
|
564
|
+
this._locale = locale;
|
|
565
|
+
return this;
|
|
566
|
+
}
|
|
567
|
+
|
|
549
568
|
onComplete(callback) {
|
|
550
569
|
this._onComplete = callback;
|
|
551
570
|
return this;
|
|
@@ -592,7 +611,8 @@ class TemplateBuilder {
|
|
|
592
611
|
iosThemeObject: this._iosThemeObject,
|
|
593
612
|
themeSource: this._themeSource,
|
|
594
613
|
returnCollectedData: this._returnCollectedData,
|
|
595
|
-
routingCountry: this._routingCountry
|
|
614
|
+
routingCountry: this._routingCountry,
|
|
615
|
+
locale: this._locale
|
|
596
616
|
});
|
|
597
617
|
}
|
|
598
618
|
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":["NativeEventEmitter","NativeModules","processThemeValues","Fields","InquiryField","Versions","PersonaInquiry2","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","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","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,SAEEA,kBAFF,EAGEC,aAHF,QAIO,cAJP;AAKA,SAASC,kBAAT,QAAmC,QAAnC;AACA,SAASC,MAAT,EAAiBC,YAAjB,QAAsD,UAAtD;AAEA,SAASD,MAAT;AAEA,SAASE,QAAT,QAAyB,YAAzB;AAEA,SAASA,QAAT;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAsBL,aAA5B,C,CAEA;AACA;;AASA,OAAO,MAAMM,iBAAN,SAAgCC,KAAhC,CAAsC;AAE7C,OAAO,MAAMC,sBAAN,SAAqCD,KAArC,CAA2C;AAElD,OAAO,MAAME,gBAAN,SAA+BF,KAA/B,CAAqC;AAE5C,OAAO,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,SAAP;AAElC,QAAM,IAAIH,gBAAJ,CACH,mDAAkDG,SAAU,GADzD,CAAN;AAGD;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASE,cAAT,CAAwBF,SAAxB,EAAuD;AACrD,MAAIA,SAAS,CAACC,UAAV,CAAqB,QAArB,CAAJ,EAAoC;AACl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O,CAACqB,YAAR,CAAqBnB,UAArB,CAAP;AACD;;;;AAKM,WAASqB,mBAAT,CAA6BC,eAA7B,EAAsD;AAC3D,WAAOxB,OAAO,CAACuB,mBAAR,CAA4BC,eAA5B,CAAP;AACD;;;GApBOmD,e,KAAAA,e;;AAuBV,eAAeA,eAAf","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"]}
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":["NativeEventEmitter","NativeModules","processThemeValues","Fields","InquiryField","Versions","PersonaInquiry2","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","Inquiry","options","templateId","inquiryId","referenceId","accountId","environment","sessionToken","fields","returnCollectedData","routingCountry","locale","onComplete","onCanceled","onError","iosThemeObject","themeSource","clearListeners","onCompleteListener","remove","onCanceledListener","onErrorListener","fromTemplate","TemplateBuilder","fromTemplateVersion","templateVersion","fromInquiry","InquiryBuilder","start","addListener","event","key","Object","keys","field","undefined","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","_locale","build","_fields","_templateId","_templateVersion","_returnCollectedData","_accountId","_referenceId","_environment","InquiryBuilders"],"mappings":";;AAAA,SAEEA,kBAFF,EAGEC,aAHF,QAIO,cAJP;AAKA,SAASC,kBAAT,QAAmC,QAAnC;AACA,SAASC,MAAT,EAAiBC,YAAjB,QAAsD,UAAtD;AAEA,SAASD,MAAT;AAEA,SAASE,QAAT,QAAyB,YAAzB;AAEA,SAASA,QAAT;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAsBL,aAA5B,C,CAEA;AACA;;AASA,OAAO,MAAMM,iBAAN,SAAgCC,KAAhC,CAAsC;AAE7C,OAAO,MAAMC,sBAAN,SAAqCD,KAArC,CAA2C;AAElD,OAAO,MAAME,gBAAN,SAA+BF,KAA/B,CAAqC;AAE5C,OAAO,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,SAAP;AAElC,QAAM,IAAIH,gBAAJ,CACH,mDAAkDG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AA,UAAU,EAAE,KAAK+C,WARA;AASjB9C,MAAAA,UAAU,EAAE,KAAK+C,WATA;AAUjB9C,MAAAA,OAAO,EAAE,KAAK+C,QAVG;AAWjB9C,MAAAA,cAAc,EAAE,KAAKgD,eAXJ;AAYjB/C,MAAAA,WAAW,EAAE,KAAKgD,YAZD;AAajBvD,MAAAA,mBAAmB,EAAE,KAAKgE,oBAbT;AAcjB/D,MAAAA,cAAc,EAAE,KAAKyD,eAdJ;AAejBxD,MAAAA,MAAM,EAAE,KAAKyD;AAfI,KAAZ,CAAP;AAiBD;;AA/ImB;AAkJtB;AACA;AACA;;;;;;AAKS,WAAS1C,WAAT,CAAqBvB,SAArB,EAAwC;AAC7C,WAAOH,OAAO,CAAC0B,WAAR,CAAoBvB,SAApB,CAAP;AACD;;;;AAKM,WAASmB,YAAT,CAAsBpB,UAAtB,EAA0C;AAC/C,WAAOF,OAAO,CAACsB,YAAR,CAAqBpB,UAArB,CAAP;AACD;;;;AAKM,WAASsB,mBAAT,CAA6BC,eAA7B,EAAsD;AAC3D,WAAOzB,OAAO,CAACwB,mBAAR,CAA4BC,eAA5B,CAAP;AACD;;;GApBOoD,e,KAAAA,e;;AAuBV,eAAeA,eAAf","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 locale?: String;\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 locale?: String;\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 this.locale = options.locale;\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 locale: this.locale,\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 private _locale?: string;\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 locale(locale: string): InquiryBuilder {\n this._locale = locale;\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 locale: this._locale,\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 private _locale?: string;\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 locale(locale: string): TemplateBuilder {\n this._locale = locale;\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 locale: this._locale,\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"]}
|
|
@@ -60,6 +60,7 @@ export interface InquiryOptions {
|
|
|
60
60
|
sessionToken?: string;
|
|
61
61
|
returnCollectedData?: boolean;
|
|
62
62
|
routingCountry?: RoutingCountry;
|
|
63
|
+
locale?: String;
|
|
63
64
|
fields?: Fields;
|
|
64
65
|
onComplete?: OnCompleteCallback;
|
|
65
66
|
onCanceled?: OnCanceledCallback;
|
|
@@ -141,6 +142,7 @@ export declare class Inquiry {
|
|
|
141
142
|
sessionToken?: string;
|
|
142
143
|
returnCollectedData?: boolean;
|
|
143
144
|
routingCountry?: RoutingCountry;
|
|
145
|
+
locale?: String;
|
|
144
146
|
iosThemeObject?: Object | null;
|
|
145
147
|
themeSource?: ThemeSource | null;
|
|
146
148
|
fields?: Fields | null;
|
|
@@ -200,6 +202,7 @@ declare class InquiryBuilder {
|
|
|
200
202
|
private _themeSource;
|
|
201
203
|
private _fields?;
|
|
202
204
|
private _routingCountry?;
|
|
205
|
+
private _locale?;
|
|
203
206
|
constructor(inquiryId: InquiryId);
|
|
204
207
|
sessionToken(sessionToken: string): InquiryBuilder;
|
|
205
208
|
onComplete(callback: OnCompleteCallback): InquiryBuilder;
|
|
@@ -211,6 +214,7 @@ declare class InquiryBuilder {
|
|
|
211
214
|
iosTheme(themeObject: Object): InquiryBuilder;
|
|
212
215
|
iosThemeToUse(themeObject: Object, themeSource: ThemeSource): InquiryBuilder;
|
|
213
216
|
routingCountry(routingCountry: RoutingCountry): InquiryBuilder;
|
|
217
|
+
locale(locale: string): InquiryBuilder;
|
|
214
218
|
build(): Inquiry;
|
|
215
219
|
}
|
|
216
220
|
declare class TemplateBuilder {
|
|
@@ -223,6 +227,7 @@ declare class TemplateBuilder {
|
|
|
223
227
|
private _sessionToken?;
|
|
224
228
|
private _returnCollectedData?;
|
|
225
229
|
private _routingCountry?;
|
|
230
|
+
private _locale?;
|
|
226
231
|
private _onComplete?;
|
|
227
232
|
private _onCanceled?;
|
|
228
233
|
private _onError?;
|
|
@@ -236,6 +241,7 @@ declare class TemplateBuilder {
|
|
|
236
241
|
sessionToken(sessionToken: string): TemplateBuilder;
|
|
237
242
|
fields(fields: Fields): TemplateBuilder;
|
|
238
243
|
routingCountry(routingCountry: RoutingCountry): TemplateBuilder;
|
|
244
|
+
locale(locale: string): TemplateBuilder;
|
|
239
245
|
onComplete(callback: OnCompleteCallback): TemplateBuilder;
|
|
240
246
|
onCanceled(callback: OnCanceledCallback): TemplateBuilder;
|
|
241
247
|
onError(callback: OnErrorCallback): TemplateBuilder;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-persona",
|
|
3
3
|
"title": "React Native Persona",
|
|
4
|
-
"version": "2.6.
|
|
4
|
+
"version": "2.6.4",
|
|
5
5
|
"description": "Launch a mobile native implementation of the Persona inquiry flow from React Native.",
|
|
6
6
|
"main": "lib/commonjs/index",
|
|
7
7
|
"module": "lib/module/index",
|
package/src/index.ts
CHANGED
|
@@ -139,6 +139,7 @@ export interface InquiryOptions {
|
|
|
139
139
|
sessionToken?: string;
|
|
140
140
|
returnCollectedData?: boolean;
|
|
141
141
|
routingCountry?: RoutingCountry;
|
|
142
|
+
locale?: String;
|
|
142
143
|
|
|
143
144
|
// Fields
|
|
144
145
|
fields?: Fields;
|
|
@@ -274,6 +275,7 @@ export class Inquiry {
|
|
|
274
275
|
sessionToken?: string;
|
|
275
276
|
returnCollectedData?: boolean;
|
|
276
277
|
routingCountry?: RoutingCountry;
|
|
278
|
+
locale?: String;
|
|
277
279
|
|
|
278
280
|
iosThemeObject?: Object | null;
|
|
279
281
|
themeSource?: ThemeSource | null;
|
|
@@ -297,6 +299,7 @@ export class Inquiry {
|
|
|
297
299
|
this.fields = options.fields;
|
|
298
300
|
this.returnCollectedData = options.returnCollectedData;
|
|
299
301
|
this.routingCountry = options.routingCountry;
|
|
302
|
+
this.locale = options.locale;
|
|
300
303
|
|
|
301
304
|
// Callbacks
|
|
302
305
|
this.onComplete = options.onComplete;
|
|
@@ -470,6 +473,7 @@ export class Inquiry {
|
|
|
470
473
|
themeSource: this.themeSource,
|
|
471
474
|
iosTheme: processThemeValues(this.iosThemeObject || {}),
|
|
472
475
|
routingCountry: this.routingCountry,
|
|
476
|
+
locale: this.locale,
|
|
473
477
|
});
|
|
474
478
|
}
|
|
475
479
|
}
|
|
@@ -486,6 +490,7 @@ class InquiryBuilder {
|
|
|
486
490
|
private _themeSource: ThemeSource = ThemeSource.SERVER;
|
|
487
491
|
private _fields?: Fields;
|
|
488
492
|
private _routingCountry?: RoutingCountry;
|
|
493
|
+
private _locale?: string;
|
|
489
494
|
|
|
490
495
|
constructor(inquiryId: InquiryId) {
|
|
491
496
|
this._inquiryId = inquiryId;
|
|
@@ -538,6 +543,12 @@ class InquiryBuilder {
|
|
|
538
543
|
return this;
|
|
539
544
|
}
|
|
540
545
|
|
|
546
|
+
locale(locale: string): InquiryBuilder {
|
|
547
|
+
this._locale = locale;
|
|
548
|
+
|
|
549
|
+
return this;
|
|
550
|
+
}
|
|
551
|
+
|
|
541
552
|
build(): Inquiry {
|
|
542
553
|
return new Inquiry({
|
|
543
554
|
inquiryId: this._inquiryId,
|
|
@@ -549,6 +560,7 @@ class InquiryBuilder {
|
|
|
549
560
|
themeSource: this._themeSource,
|
|
550
561
|
fields: this._fields,
|
|
551
562
|
routingCountry: this._routingCountry,
|
|
563
|
+
locale: this._locale,
|
|
552
564
|
});
|
|
553
565
|
}
|
|
554
566
|
}
|
|
@@ -563,6 +575,7 @@ class TemplateBuilder {
|
|
|
563
575
|
private _sessionToken?: string;
|
|
564
576
|
private _returnCollectedData?: boolean;
|
|
565
577
|
private _routingCountry?: RoutingCountry;
|
|
578
|
+
private _locale?: string;
|
|
566
579
|
|
|
567
580
|
// Callbacks
|
|
568
581
|
private _onComplete?: OnCompleteCallback;
|
|
@@ -633,6 +646,12 @@ class TemplateBuilder {
|
|
|
633
646
|
return this;
|
|
634
647
|
}
|
|
635
648
|
|
|
649
|
+
locale(locale: string): TemplateBuilder {
|
|
650
|
+
this._locale = locale;
|
|
651
|
+
|
|
652
|
+
return this;
|
|
653
|
+
}
|
|
654
|
+
|
|
636
655
|
onComplete(callback: OnCompleteCallback): TemplateBuilder {
|
|
637
656
|
this._onComplete = callback;
|
|
638
657
|
|
|
@@ -687,6 +706,7 @@ class TemplateBuilder {
|
|
|
687
706
|
themeSource: this._themeSource,
|
|
688
707
|
returnCollectedData: this._returnCollectedData,
|
|
689
708
|
routingCountry: this._routingCountry,
|
|
709
|
+
locale: this._locale,
|
|
690
710
|
});
|
|
691
711
|
}
|
|
692
712
|
}
|