react-native-persona 1.2.8 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/RNPersonaInquiry.podspec +1 -1
- package/android/README.md +14 -0
- package/android/build.gradle +21 -100
- package/lib/commonjs/index.js +477 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/util.js +36 -0
- package/lib/commonjs/util.js.map +1 -0
- package/lib/commonjs/util.spec.js +31 -0
- package/lib/commonjs/util.spec.js.map +1 -0
- package/lib/module/index.js +452 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/util.js +29 -0
- package/lib/module/util.js.map +1 -0
- package/lib/module/util.spec.js +28 -0
- package/lib/module/util.spec.js.map +1 -0
- package/lib/typescript/persona-tools/Config.d.ts +15 -0
- package/lib/typescript/persona-tools/Theme.d.ts +124 -0
- package/lib/typescript/persona-tools/index.d.ts +1 -0
- package/lib/typescript/persona-tools/lib/AndroidResourcePrinter.d.ts +40 -0
- package/lib/typescript/persona-tools/lib/AndroidResourcePrinter.spec.d.ts +1 -0
- package/lib/typescript/persona-tools/lib/prompts.d.ts +8 -0
- package/lib/typescript/persona-tools/tools/AndroidThemeGenerator.d.ts +5 -0
- package/lib/typescript/persona-tools/tools/IosThemeInstructions.d.ts +5 -0
- package/{generatedTypes → lib/typescript/src}/index.d.ts +67 -3
- package/lib/typescript/src/util.d.ts +3 -0
- package/lib/typescript/src/util.spec.d.ts +1 -0
- package/package.json +79 -21
- package/persona-tools/{config.ts → Config.ts} +7 -7
- package/persona-tools/Theme.ts +140 -138
- package/persona-tools/index.ts +9 -9
- package/persona-tools/lib/AndroidResourcePrinter.spec.ts +100 -101
- package/persona-tools/lib/AndroidResourcePrinter.ts +314 -278
- package/persona-tools/lib/prompts.ts +11 -11
- package/persona-tools/tools/AndroidThemeGenerator.ts +31 -32
- package/persona-tools/tools/IosThemeInstructions.ts +8 -8
- package/src/index.ts +17 -18
- package/src/util.spec.ts +14 -8
- package/src/util.ts +3 -3
- package/jest.config.js +0 -10
- package/persona-tools/Theme.js +0 -213
- package/persona-tools/config.js +0 -72
- package/persona-tools/index.js +0 -30
- package/persona-tools/lib/AndroidResourcePrinter.js +0 -832
- package/persona-tools/lib/AndroidResourcePrinter.spec.js +0 -1135
- package/persona-tools/lib/prompts.js +0 -39
- package/persona-tools/tools/AndroidThemeGenerator.js +0 -59
- package/persona-tools/tools/IosThemeInstructions.js +0 -34
- package/src/index.js +0 -307
- package/src/util.js +0 -29
- package/src/util.spec.js +0 -15
- package/tsconfig.json +0 -29
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { processThemeValues } from './util';
|
|
2
|
+
describe('processThemeValues', () => {
|
|
3
|
+
it('works', () => {
|
|
4
|
+
expect(processThemeValues({
|
|
5
|
+
testColorA: '#FFFFFF',
|
|
6
|
+
testColorB: '#zzzzzz'
|
|
7
|
+
})).toEqual({
|
|
8
|
+
testColorA: '#FFFFFF'
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
it('filters out non 6 character codes', () => {
|
|
12
|
+
expect(processThemeValues({
|
|
13
|
+
testColorA: '#FFFFFF',
|
|
14
|
+
testColorB: '#FFF'
|
|
15
|
+
})).toEqual({
|
|
16
|
+
testColorA: '#FFFFFF'
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
it('does not do anything with non colors', () => {
|
|
20
|
+
// Values are expected to be strings on the iOS side of the bridge.
|
|
21
|
+
expect(processThemeValues({
|
|
22
|
+
buttonCornerRadius: '20'
|
|
23
|
+
})).toEqual({
|
|
24
|
+
buttonCornerRadius: '20'
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=util.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["util.spec.ts"],"names":["processThemeValues","describe","it","expect","testColorA","testColorB","toEqual","buttonCornerRadius"],"mappings":"AAAA,SAASA,kBAAT,QAAmC,QAAnC;AAEAC,QAAQ,CAAC,oBAAD,EAAuB,MAAM;AACnCC,EAAAA,EAAE,CAAC,OAAD,EAAU,MAAM;AAChBC,IAAAA,MAAM,CACJH,kBAAkB,CAAC;AAAEI,MAAAA,UAAU,EAAE,SAAd;AAAyBC,MAAAA,UAAU,EAAE;AAArC,KAAD,CADd,CAAN,CAEEC,OAFF,CAEU;AAAEF,MAAAA,UAAU,EAAE;AAAd,KAFV;AAGD,GAJC,CAAF;AAMAF,EAAAA,EAAE,CAAC,mCAAD,EAAsC,MAAM;AAC5CC,IAAAA,MAAM,CACJH,kBAAkB,CAAC;AAAEI,MAAAA,UAAU,EAAE,SAAd;AAAyBC,MAAAA,UAAU,EAAE;AAArC,KAAD,CADd,CAAN,CAEEC,OAFF,CAEU;AAAEF,MAAAA,UAAU,EAAE;AAAd,KAFV;AAGD,GAJC,CAAF;AAMAF,EAAAA,EAAE,CAAC,sCAAD,EAAyC,MAAM;AAC/C;AACAC,IAAAA,MAAM,CAACH,kBAAkB,CAAC;AAAEO,MAAAA,kBAAkB,EAAE;AAAtB,KAAD,CAAnB,CAAN,CAAyDD,OAAzD,CAAiE;AAC/DC,MAAAA,kBAAkB,EAAE;AAD2C,KAAjE;AAGD,GALC,CAAF;AAMD,CAnBO,CAAR","sourcesContent":["import { processThemeValues } from './util';\n\ndescribe('processThemeValues', () => {\n it('works', () => {\n expect(\n processThemeValues({ testColorA: '#FFFFFF', testColorB: '#zzzzzz' })\n ).toEqual({ testColorA: '#FFFFFF' });\n });\n\n it('filters out non 6 character codes', () => {\n expect(\n processThemeValues({ testColorA: '#FFFFFF', testColorB: '#FFF' })\n ).toEqual({ testColorA: '#FFFFFF' });\n });\n\n it('does not do anything with non colors', () => {\n // Values are expected to be strings on the iOS side of the bridge.\n expect(processThemeValues({ buttonCornerRadius: '20' })).toEqual({\n buttonCornerRadius: '20',\n });\n });\n});\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ConfigObject {
|
|
2
|
+
androidTheme: {
|
|
3
|
+
[key: string]: string | null | undefined;
|
|
4
|
+
};
|
|
5
|
+
iosTheme: {
|
|
6
|
+
[key: string]: string | null | undefined;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
declare class Configuration {
|
|
10
|
+
config?: ConfigObject | null;
|
|
11
|
+
loadConfig(): Promise<ConfigObject | null | undefined>;
|
|
12
|
+
get(): Promise<ConfigObject>;
|
|
13
|
+
}
|
|
14
|
+
declare const _default: Configuration;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
export declare enum ANDROID_THEME_CONFIG_KEY {
|
|
2
|
+
backgroundColor = "backgroundColor",
|
|
3
|
+
primaryColor = "primaryColor",
|
|
4
|
+
darkPrimaryColor = "darkPrimaryColor",
|
|
5
|
+
accentColor = "accentColor",
|
|
6
|
+
titleTextColor = "titleTextColor",
|
|
7
|
+
titleTextFont = "titleTextFont",
|
|
8
|
+
titleTextSize = "titleTextSize",
|
|
9
|
+
bodyTextColor = "bodyTextColor",
|
|
10
|
+
bodyTextFont = "bodyTextFont",
|
|
11
|
+
bodyTextSize = "bodyTextSize",
|
|
12
|
+
footnoteTextColor = "footnoteTextColor",
|
|
13
|
+
footnoteTextFont = "footnoteTextFont",
|
|
14
|
+
footnoteTextSize = "footnoteTextSize",
|
|
15
|
+
cameraInstructionsTextColor = "cameraInstructionsTextColor",
|
|
16
|
+
cameraInstructionsTextFont = "cameraInstructionsTextFont",
|
|
17
|
+
cameraInstructionsTextSize = "cameraInstructionsTextSize",
|
|
18
|
+
cameraHintTextColor = "cameraHintTextColor",
|
|
19
|
+
cameraHintTextFont = "cameraHintTextFont",
|
|
20
|
+
cameraHintTextSize = "cameraHintTextSize",
|
|
21
|
+
cameraGuideHintTextColor = "cameraGuideHintTextColor",
|
|
22
|
+
cameraGuideHintTextFont = "cameraGuideHintTextFont",
|
|
23
|
+
cameraGuideHintTextSize = "cameraGuideHintTextSize",
|
|
24
|
+
textFieldTextColor = "textFieldTextColor",
|
|
25
|
+
textFieldTextFont = "textFieldTextFont",
|
|
26
|
+
pickerTextColor = "pickerTextColor",
|
|
27
|
+
pickerTextFont = "pickerTextFont",
|
|
28
|
+
buttonBackgroundColor = "buttonBackgroundColor",
|
|
29
|
+
buttonDisabledBackgroundColor = "buttonDisabledBackgroundColor",
|
|
30
|
+
buttonTouchedBackgroundColor = "buttonTouchedBackgroundColor",
|
|
31
|
+
buttonTextColor = "buttonTextColor",
|
|
32
|
+
buttonDisabledTextColor = "buttonDisabledTextColor",
|
|
33
|
+
buttonCornerRadius = "buttonCornerRadius",
|
|
34
|
+
buttonFont = "buttonFont",
|
|
35
|
+
buttonTextSize = "buttonTextSize",
|
|
36
|
+
progressColor = "progressColor",
|
|
37
|
+
successAsset = "successAsset",
|
|
38
|
+
failAsset = "failAsset",
|
|
39
|
+
loadingAnimationAsset = "loadingAnimationAsset",
|
|
40
|
+
loadingAnimationWidthPercent = "loadingAnimationWidthPercent",
|
|
41
|
+
selfieAnimationAsset = "selfieAnimationAsset",
|
|
42
|
+
selfieAnimationWidthPercent = "selfieAnimationWidthPercent"
|
|
43
|
+
}
|
|
44
|
+
export declare enum IOS_THEME_CONFIG_KEY {
|
|
45
|
+
backgroundColor = "backgroundColor",
|
|
46
|
+
primaryColor = "primaryColor",
|
|
47
|
+
darkPrimaryColor = "darkPrimaryColor",
|
|
48
|
+
accentColor = "accentColor",
|
|
49
|
+
progressColor = "progressColor",
|
|
50
|
+
overlayBackgroundColor = "overlayBackgroundColor",
|
|
51
|
+
titleTextColor = "titleTextColor",
|
|
52
|
+
titleTextFont = "titleTextFont",
|
|
53
|
+
titleTextSize = "titleTextSize",
|
|
54
|
+
titleTextAlignment = "titleTextAlignment",
|
|
55
|
+
bodyTextColor = "bodyTextColor",
|
|
56
|
+
bodyTextFont = "bodyTextFont",
|
|
57
|
+
bodyTextSize = "bodyTextSize",
|
|
58
|
+
bodyTextAlignment = "bodyTextAlignment",
|
|
59
|
+
footnoteTextColor = "footnoteTextColor",
|
|
60
|
+
footnoteTextFont = "footnoteTextFont",
|
|
61
|
+
footnoteTextSize = "footnoteTextSize",
|
|
62
|
+
formLabelTextColor = "formLabelTextColor",
|
|
63
|
+
formLabelTextFont = "formLabelTextFont",
|
|
64
|
+
textFieldTextColor = "textFieldTextColor",
|
|
65
|
+
textFieldBackgroundColor = "textFieldBackgroundColor",
|
|
66
|
+
textFieldBorderColor = "textFieldBorderColor",
|
|
67
|
+
pickerTextColor = "pickerTextColor",
|
|
68
|
+
pickerTextFont = "pickerTextFont",
|
|
69
|
+
cameraInstructionsTextColor = "cameraInstructionsTextColor",
|
|
70
|
+
cameraInstructionsTextFont = "cameraInstructionsTextFont",
|
|
71
|
+
cameraInstructionsTextSize = "cameraInstructionsTextFont",
|
|
72
|
+
cameraHintTextColor = "cameraHintTextColor",
|
|
73
|
+
cameraHintTextFont = "cameraHintTextFont",
|
|
74
|
+
cameraHintTextSize = "cameraHintTextSize",
|
|
75
|
+
cameraGuideHintTextColor = "cameraGuideHintTextColor",
|
|
76
|
+
cameraGuideHintTextFont = "cameraGuideHintTextFont",
|
|
77
|
+
cameraGuideHintTextSize = "cameraGuideHintTextSize",
|
|
78
|
+
buttonBackgroundColor = "buttonBackgroundColor",
|
|
79
|
+
buttonDisabledBackgroundColor = "buttonDisabledBackgroundColor",
|
|
80
|
+
buttonTouchedBackgroundColor = "buttonTouchedBackgroundColor",
|
|
81
|
+
buttonImageTintColor = "buttonImageTintColor",
|
|
82
|
+
buttonImageHidden = "buttonImageHidden",
|
|
83
|
+
buttonCornerRadius = "buttonCornerRadius",
|
|
84
|
+
buttonTextAlignment = "buttonTextAlignment",
|
|
85
|
+
buttonDisabledTextColor = "buttonDisabledTextColor",
|
|
86
|
+
buttonTextColor = "buttonTextColor",
|
|
87
|
+
buttonFont = "buttonFont",
|
|
88
|
+
buttonTextSize = "buttonTextSize",
|
|
89
|
+
selectedCellBackgroundColor = "selectedCellBackgroundColor",
|
|
90
|
+
closeButtonTintColor = "closeButtonTintColor",
|
|
91
|
+
cancelButtonBackgroundColor = "cancelButtonBackgroundColor",
|
|
92
|
+
cameraButtonBackgroundColor = "cameraButtonBackgroundColor",
|
|
93
|
+
cameraGuideCornersColor = "cameraGuideCornersColor",
|
|
94
|
+
successAssetName = "successAssetName",
|
|
95
|
+
successAssetWidth = "successAssetWidth",
|
|
96
|
+
successAssetHeight = "successAssetHeight",
|
|
97
|
+
verificationFailAssetName = "verificationFailAssetName",
|
|
98
|
+
verificationFailAssetWidth = "verificationFailAssetWidth",
|
|
99
|
+
verificationFailAssetHeight = "verificationFailAssetHeight",
|
|
100
|
+
failAssetName = "failAssetName",
|
|
101
|
+
failAssetWidth = "failAssetWidth",
|
|
102
|
+
failAssetHeight = "failAssetHeight",
|
|
103
|
+
loadingAnimationAssetName = "loadingAnimationAssetName",
|
|
104
|
+
loadingAnimationAssetWidth = "loadingAnimationAssetWidth",
|
|
105
|
+
loadingAnimationAssetHeight = "loadingAnimationAssetHeight",
|
|
106
|
+
processingAnimationAssetName = "processingAnimationAssetName",
|
|
107
|
+
processingAnimationAssetWidth = "processingAnimationAssetWidth",
|
|
108
|
+
processingAnimationAssetHeight = "processingAnimationAssetHeight",
|
|
109
|
+
selfieAnimationAssetName = "selfieAnimationAssetName",
|
|
110
|
+
selfieAnimationAssetWidth = "selfieAnimationAssetWidth",
|
|
111
|
+
selfieAnimationAssetHeight = "selfieAnimationAssetHeight"
|
|
112
|
+
}
|
|
113
|
+
export declare type AndroidThemeObject = {
|
|
114
|
+
[key in ANDROID_THEME_CONFIG_KEY]: string | null | undefined;
|
|
115
|
+
};
|
|
116
|
+
export declare type IosThemeObject = {
|
|
117
|
+
[key in IOS_THEME_CONFIG_KEY]: string | null | undefined;
|
|
118
|
+
};
|
|
119
|
+
export declare type ThemeObject = AndroidThemeObject | IosThemeObject;
|
|
120
|
+
declare class Theme {
|
|
121
|
+
print(platform?: string): Promise<void>;
|
|
122
|
+
}
|
|
123
|
+
declare const _default: Theme;
|
|
124
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { AndroidThemeObject } from '../Theme';
|
|
2
|
+
import type { XMLBuilder } from 'xmlbuilder2/lib/interfaces';
|
|
3
|
+
declare class AndroidResourcePrinter {
|
|
4
|
+
theme: AndroidThemeObject;
|
|
5
|
+
root: XMLBuilder;
|
|
6
|
+
buttonDrawable: XMLBuilder;
|
|
7
|
+
buttonSecondaryDrawable: XMLBuilder;
|
|
8
|
+
buttonColor: XMLBuilder;
|
|
9
|
+
preprintQueue: (() => void)[];
|
|
10
|
+
printQueue: (() => void)[];
|
|
11
|
+
postPrintQueue: (() => void)[];
|
|
12
|
+
constructor(theme: AndroidThemeObject);
|
|
13
|
+
process(): {
|
|
14
|
+
style: XMLBuilder;
|
|
15
|
+
buttonDrawable: XMLBuilder;
|
|
16
|
+
buttonSecondaryDrawable: XMLBuilder;
|
|
17
|
+
buttonColor: XMLBuilder;
|
|
18
|
+
};
|
|
19
|
+
private print;
|
|
20
|
+
private hasTheme;
|
|
21
|
+
private primaryColor;
|
|
22
|
+
private accentColor;
|
|
23
|
+
private darkPrimaryColor;
|
|
24
|
+
private backgroundColor;
|
|
25
|
+
private titleText;
|
|
26
|
+
private bodyText;
|
|
27
|
+
private footnoteText;
|
|
28
|
+
private cameraInstructionsText;
|
|
29
|
+
private cameraHintText;
|
|
30
|
+
private cameraGuideHintText;
|
|
31
|
+
private textField;
|
|
32
|
+
private pickerText;
|
|
33
|
+
private button;
|
|
34
|
+
private progressColor;
|
|
35
|
+
private successAsset;
|
|
36
|
+
private failAsset;
|
|
37
|
+
private loadingAnimationAsset;
|
|
38
|
+
private selfieAnimationAsset;
|
|
39
|
+
}
|
|
40
|
+
export default AndroidResourcePrinter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import inquirer from 'inquirer';
|
|
2
|
+
export declare const TOOL_CHOICE: {
|
|
3
|
+
AndroidTheme: string;
|
|
4
|
+
iosTheme: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function whatWouldYouLikePrompt(): Promise<inquirer.Answers>;
|
|
7
|
+
export declare function confirmThemeValues(): Promise<inquirer.Answers>;
|
|
8
|
+
export declare function confirmResourceFiles(): Promise<inquirer.Answers>;
|
|
@@ -2,15 +2,45 @@ declare const Unique: unique symbol;
|
|
|
2
2
|
export declare type Opaque<T, Tag> = T & {
|
|
3
3
|
[Unique]: Tag;
|
|
4
4
|
};
|
|
5
|
-
declare type TemplateId = Opaque<string,
|
|
6
|
-
declare type InquiryId = Opaque<string,
|
|
7
|
-
declare type AccountId = Opaque<string,
|
|
5
|
+
declare type TemplateId = Opaque<string, 'TemplateId'>;
|
|
6
|
+
declare type InquiryId = Opaque<string, 'InquiryId'>;
|
|
7
|
+
declare type AccountId = Opaque<string, 'AccountId'>;
|
|
8
8
|
export declare class InvalidTemplateId extends Error {
|
|
9
9
|
}
|
|
10
10
|
export declare class InvalidInquiryId extends Error {
|
|
11
11
|
}
|
|
12
12
|
export declare class InvalidAccountId extends Error {
|
|
13
13
|
}
|
|
14
|
+
export declare namespace Fields {
|
|
15
|
+
class Builder {
|
|
16
|
+
private _name?;
|
|
17
|
+
private _address?;
|
|
18
|
+
private _birthdate?;
|
|
19
|
+
private _emailAddress?;
|
|
20
|
+
private _phoneNumber?;
|
|
21
|
+
private _fields;
|
|
22
|
+
name(name: NameField): this;
|
|
23
|
+
/**
|
|
24
|
+
* Returns the Field.Builder instance
|
|
25
|
+
*
|
|
26
|
+
* @param address - The address object
|
|
27
|
+
*/
|
|
28
|
+
address(address: AddressField): this;
|
|
29
|
+
/**
|
|
30
|
+
* @param date {Date}
|
|
31
|
+
*/
|
|
32
|
+
birthdate(date: Date): this;
|
|
33
|
+
/**
|
|
34
|
+
* @param date {string}
|
|
35
|
+
*/
|
|
36
|
+
emailAddress(email: string): this;
|
|
37
|
+
phoneNumber(phoneNumber: string): this;
|
|
38
|
+
field(fieldKey: string, value: number | string | boolean): this;
|
|
39
|
+
build(): FieldsPayload;
|
|
40
|
+
}
|
|
41
|
+
export function builder(): Builder;
|
|
42
|
+
export {};
|
|
43
|
+
}
|
|
14
44
|
/**
|
|
15
45
|
* String enum for environments. These strings will be parsed
|
|
16
46
|
* on the native side bridge into Kotlin / Swift enums.
|
|
@@ -25,6 +55,8 @@ export interface InquiryOptions {
|
|
|
25
55
|
referenceId?: string;
|
|
26
56
|
accountId?: AccountId;
|
|
27
57
|
environment?: Environment;
|
|
58
|
+
accessToken?: string;
|
|
59
|
+
fields?: FieldsPayload;
|
|
28
60
|
onSuccess?: OnSuccessCallback;
|
|
29
61
|
onCancelled?: OnCancelledCallback;
|
|
30
62
|
onFailed?: OnFailedCallback;
|
|
@@ -43,6 +75,7 @@ export interface InquiryAttributes {
|
|
|
43
75
|
street2: string | null;
|
|
44
76
|
city: string | null;
|
|
45
77
|
subdivision: string | null;
|
|
78
|
+
subdivisionAbbr: string | null;
|
|
46
79
|
postalCode: string | null;
|
|
47
80
|
countryCode: string | null;
|
|
48
81
|
} | null;
|
|
@@ -59,6 +92,7 @@ export interface BridgeInquiryAttributes {
|
|
|
59
92
|
street2: string | null;
|
|
60
93
|
city: string | null;
|
|
61
94
|
subdivision: string | null;
|
|
95
|
+
subdivisionAbbr: string | null;
|
|
62
96
|
postalCode: string | null;
|
|
63
97
|
countryCode: string | null;
|
|
64
98
|
} | null;
|
|
@@ -73,7 +107,9 @@ export declare class Inquiry {
|
|
|
73
107
|
referenceId?: string;
|
|
74
108
|
accountId?: AccountId;
|
|
75
109
|
environment?: Environment;
|
|
110
|
+
accessToken?: string;
|
|
76
111
|
iosThemeObject?: Object | null;
|
|
112
|
+
fields?: FieldsPayload | null;
|
|
77
113
|
private onSuccess?;
|
|
78
114
|
private onCancelled?;
|
|
79
115
|
private onFailed?;
|
|
@@ -86,14 +122,38 @@ export declare class Inquiry {
|
|
|
86
122
|
private clearListeners;
|
|
87
123
|
start(): void;
|
|
88
124
|
}
|
|
125
|
+
interface NameField {
|
|
126
|
+
first?: string;
|
|
127
|
+
middle?: string;
|
|
128
|
+
last?: string;
|
|
129
|
+
}
|
|
130
|
+
interface AddressField {
|
|
131
|
+
street1?: string;
|
|
132
|
+
street2?: string;
|
|
133
|
+
city?: string;
|
|
134
|
+
subdivision?: string;
|
|
135
|
+
postalCode?: string;
|
|
136
|
+
countryCode?: string;
|
|
137
|
+
}
|
|
138
|
+
interface FieldsPayload {
|
|
139
|
+
name?: NameField | null;
|
|
140
|
+
address?: AddressField | null;
|
|
141
|
+
birthdate?: string | null;
|
|
142
|
+
emailAddress?: string | null;
|
|
143
|
+
phoneNumber?: string | null;
|
|
144
|
+
additionalFields?: Object | null;
|
|
145
|
+
}
|
|
89
146
|
declare class InquiryBuilder {
|
|
90
147
|
private _inquiryId;
|
|
148
|
+
private _accessToken?;
|
|
91
149
|
private _onSuccess?;
|
|
92
150
|
private _onCancelled?;
|
|
93
151
|
private _onFailed?;
|
|
94
152
|
private _onError?;
|
|
95
153
|
private _iosThemeObject?;
|
|
154
|
+
private _fields?;
|
|
96
155
|
constructor(inquiryId: InquiryId);
|
|
156
|
+
accessToken(accessToken: string): InquiryBuilder;
|
|
97
157
|
onSuccess(callback: OnSuccessCallback): InquiryBuilder;
|
|
98
158
|
onCancelled(callback: OnCancelledCallback): InquiryBuilder;
|
|
99
159
|
onFailed(callback: OnFailedCallback): InquiryBuilder;
|
|
@@ -106,6 +166,8 @@ declare class TemplateBuilder {
|
|
|
106
166
|
private _accountId?;
|
|
107
167
|
private _referenceId?;
|
|
108
168
|
private _environment?;
|
|
169
|
+
private _fields?;
|
|
170
|
+
private _accessToken?;
|
|
109
171
|
private _onSuccess?;
|
|
110
172
|
private _onCancelled?;
|
|
111
173
|
private _onFailed?;
|
|
@@ -115,6 +177,8 @@ declare class TemplateBuilder {
|
|
|
115
177
|
referenceId(referenceId: string): TemplateBuilder;
|
|
116
178
|
accountId(accountId: string): TemplateBuilder;
|
|
117
179
|
environment(environment: Environment): TemplateBuilder;
|
|
180
|
+
accessToken(accessToken: string): TemplateBuilder;
|
|
181
|
+
fields(fields: FieldsPayload): TemplateBuilder;
|
|
118
182
|
onSuccess(callback: OnSuccessCallback): TemplateBuilder;
|
|
119
183
|
onCancelled(callback: OnCancelledCallback): TemplateBuilder;
|
|
120
184
|
onFailed(callback: OnFailedCallback): TemplateBuilder;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,57 +1,76 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-persona",
|
|
3
3
|
"title": "React Native Persona",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.0",
|
|
5
5
|
"description": "Launch a mobile native implementation of the Persona inquiry flow from React Native.",
|
|
6
|
-
"main": "
|
|
6
|
+
"main": "lib/commonjs/index",
|
|
7
|
+
"module": "lib/module/index",
|
|
8
|
+
"types": "lib/typescript/src/index.d.ts",
|
|
9
|
+
"react-native": "src/index",
|
|
10
|
+
"source": "src/index",
|
|
7
11
|
"bin": {
|
|
8
12
|
"persona-tool": "./bin/persona-tool"
|
|
9
13
|
},
|
|
10
14
|
"scripts": {
|
|
11
|
-
"
|
|
12
|
-
"
|
|
15
|
+
"test": "jest",
|
|
16
|
+
"typescript": "tsc --noEmit",
|
|
17
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
18
|
+
"prepare": "bob build",
|
|
19
|
+
"example": "yarn --cwd example",
|
|
20
|
+
"pods": "cd example && pod-install --quiet",
|
|
21
|
+
"bootstrap": "yarn example && yarn && yarn pods"
|
|
13
22
|
},
|
|
14
23
|
"files": [
|
|
15
|
-
"android/build.gradle",
|
|
16
|
-
"android/gradle*",
|
|
17
|
-
"android/src",
|
|
18
|
-
"ios",
|
|
19
24
|
"src",
|
|
20
|
-
"
|
|
25
|
+
"lib",
|
|
26
|
+
"android",
|
|
27
|
+
"ios",
|
|
21
28
|
"bin",
|
|
22
29
|
"persona-tools",
|
|
23
30
|
"RNPersonaInquiry.podspec",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
31
|
+
"!lib/typescript/example",
|
|
32
|
+
"!android/build",
|
|
33
|
+
"!ios/build",
|
|
34
|
+
"!**/__tests__",
|
|
35
|
+
"!**/__fixtures__",
|
|
36
|
+
"!**/__mocks__"
|
|
27
37
|
],
|
|
28
38
|
"keywords": [
|
|
29
|
-
"react-native"
|
|
39
|
+
"react-native",
|
|
40
|
+
"persona",
|
|
41
|
+
"idv"
|
|
30
42
|
],
|
|
31
43
|
"author": {
|
|
32
44
|
"name": "Persona Identities, Inc.",
|
|
33
45
|
"email": "support@withpersona.com"
|
|
34
46
|
},
|
|
47
|
+
"homepage": "https://docs.withpersona.com/docs/react-native-sdk-v1-integration",
|
|
35
48
|
"license": "MIT",
|
|
36
49
|
"licenseFilename": "LICENSE",
|
|
37
50
|
"readmeFilename": "README.md",
|
|
38
51
|
"peerDependencies": {
|
|
39
|
-
"react": "
|
|
40
|
-
"react-native": "
|
|
52
|
+
"react": "*",
|
|
53
|
+
"react-native": "*"
|
|
41
54
|
},
|
|
42
55
|
"devDependencies": {
|
|
56
|
+
"@react-native-community/eslint-config": "^2.0.0",
|
|
43
57
|
"@types/cli-table": "^0.3.0",
|
|
44
58
|
"@types/inquirer": "^6.5.0",
|
|
45
59
|
"@types/jest": "^26.0.14",
|
|
46
60
|
"@types/node": "^13.13.4",
|
|
47
61
|
"@types/object-path": "^0.11.0",
|
|
48
62
|
"@types/react-native": "^0.62.0",
|
|
63
|
+
"eslint": "^7.2.0",
|
|
64
|
+
"eslint-config-prettier": "^7.0.0",
|
|
65
|
+
"eslint-plugin-prettier": "^3.1.3",
|
|
49
66
|
"jest": "^26.6.3",
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"react
|
|
67
|
+
"pod-install": "^0.1.0",
|
|
68
|
+
"prettier": "^2.3.2",
|
|
69
|
+
"react": "16.13.0",
|
|
70
|
+
"react-native": "^0.63.4",
|
|
71
|
+
"react-native-builder-bob": "^0.18.2",
|
|
53
72
|
"ts-jest": "^26.4.4",
|
|
54
|
-
"typescript": "^3.
|
|
73
|
+
"typescript": "^4.3.5"
|
|
55
74
|
},
|
|
56
75
|
"dependencies": {
|
|
57
76
|
"chalk": "^4.0.0",
|
|
@@ -59,8 +78,47 @@
|
|
|
59
78
|
"cosmiconfig": "^6.0.0",
|
|
60
79
|
"inquirer": "^7.1.0",
|
|
61
80
|
"minimist": "^1.2.5",
|
|
62
|
-
"object-path": "^0.11.
|
|
81
|
+
"object-path": "^0.11.8",
|
|
63
82
|
"pkg-up": "^3.1.0",
|
|
64
83
|
"xmlbuilder2": "^2.1.2"
|
|
84
|
+
},
|
|
85
|
+
"jest": {
|
|
86
|
+
"preset": "react-native",
|
|
87
|
+
"modulePathIgnorePatterns": [
|
|
88
|
+
"<rootDir>/example/node_modules",
|
|
89
|
+
"<rootDir>/lib/"
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
"eslintConfig": {
|
|
93
|
+
"root": true,
|
|
94
|
+
"extends": [
|
|
95
|
+
"@react-native-community",
|
|
96
|
+
"prettier"
|
|
97
|
+
],
|
|
98
|
+
"rules": {
|
|
99
|
+
"prettier/prettier": [
|
|
100
|
+
"error",
|
|
101
|
+
{
|
|
102
|
+
"quoteProps": "consistent",
|
|
103
|
+
"singleQuote": true,
|
|
104
|
+
"tabWidth": 2,
|
|
105
|
+
"trailingComma": "es5",
|
|
106
|
+
"useTabs": false
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"eslintIgnore": [
|
|
112
|
+
"node_modules/",
|
|
113
|
+
"lib/"
|
|
114
|
+
],
|
|
115
|
+
"react-native-builder-bob": {
|
|
116
|
+
"source": "src",
|
|
117
|
+
"output": "lib",
|
|
118
|
+
"targets": [
|
|
119
|
+
"commonjs",
|
|
120
|
+
"module",
|
|
121
|
+
"typescript"
|
|
122
|
+
]
|
|
65
123
|
}
|
|
66
|
-
}
|
|
124
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { cosmiconfig } from
|
|
2
|
-
import chalk from
|
|
3
|
-
import { ANDROID_THEME_CONFIG_KEY, IOS_THEME_CONFIG_KEY } from
|
|
1
|
+
import { cosmiconfig } from 'cosmiconfig';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { ANDROID_THEME_CONFIG_KEY, IOS_THEME_CONFIG_KEY } from './Theme';
|
|
4
4
|
|
|
5
5
|
export interface ConfigObject {
|
|
6
6
|
androidTheme: { [key: string]: string | null | undefined };
|
|
@@ -14,7 +14,7 @@ class Configuration {
|
|
|
14
14
|
if (this.config) return this.config;
|
|
15
15
|
|
|
16
16
|
try {
|
|
17
|
-
const explorer = cosmiconfig(
|
|
17
|
+
const explorer = cosmiconfig('persona', { packageProp: 'persona' });
|
|
18
18
|
const result = await explorer.search();
|
|
19
19
|
if (result == null) {
|
|
20
20
|
return null;
|
|
@@ -48,7 +48,7 @@ class Configuration {
|
|
|
48
48
|
Missing configuration.
|
|
49
49
|
|
|
50
50
|
In order to use this tool, it must be configured using a ${chalk.yellow(
|
|
51
|
-
|
|
51
|
+
'persona'
|
|
52
52
|
)} object within
|
|
53
53
|
your package.json.
|
|
54
54
|
|
|
@@ -60,12 +60,12 @@ To get started, paste the following configuration into your package.json
|
|
|
60
60
|
"persona": {
|
|
61
61
|
"androidTheme": {
|
|
62
62
|
` +
|
|
63
|
-
androidThemeLines.join(
|
|
63
|
+
androidThemeLines.join(',\n') +
|
|
64
64
|
`
|
|
65
65
|
},
|
|
66
66
|
"iosTheme": {
|
|
67
67
|
` +
|
|
68
|
-
iosThemeLines.join(
|
|
68
|
+
iosThemeLines.join(',\n') +
|
|
69
69
|
`
|
|
70
70
|
}
|
|
71
71
|
}
|