react-native-persona 1.2.10 → 1.3.1
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 +25 -0
- package/RNPersonaInquiry.podspec +1 -1
- package/android/README.md +14 -0
- package/android/build.gradle +21 -100
- package/bin/persona-tool +1 -2
- package/lib/commonjs/index.js +477 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/persona-tools/AndroidResourcePrinter.js +694 -0
- package/lib/commonjs/persona-tools/AndroidResourcePrinter.js.map +1 -0
- package/lib/commonjs/persona-tools/Config.js +95 -0
- package/lib/commonjs/persona-tools/Config.js.map +1 -0
- package/lib/commonjs/persona-tools/Theme.js +228 -0
- package/lib/commonjs/persona-tools/Theme.js.map +1 -0
- package/lib/commonjs/persona-tools/index.js +41 -0
- package/lib/commonjs/persona-tools/index.js.map +1 -0
- package/lib/commonjs/persona-tools/prompts.js +48 -0
- package/lib/commonjs/persona-tools/prompts.js.map +1 -0
- package/lib/commonjs/persona-tools/tools/AndroidThemeGenerator.js +112 -0
- package/lib/commonjs/persona-tools/tools/AndroidThemeGenerator.js.map +1 -0
- package/lib/commonjs/persona-tools/tools/IosThemeInstructions.js +50 -0
- package/lib/commonjs/persona-tools/tools/IosThemeInstructions.js.map +1 -0
- package/lib/commonjs/util.js +36 -0
- package/lib/commonjs/util.js.map +1 -0
- package/lib/module/index.js +452 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/persona-tools/AndroidResourcePrinter.js +686 -0
- package/lib/module/persona-tools/AndroidResourcePrinter.js.map +1 -0
- package/lib/module/persona-tools/Config.js +82 -0
- package/lib/module/persona-tools/Config.js.map +1 -0
- package/lib/module/persona-tools/Theme.js +212 -0
- package/lib/module/persona-tools/Theme.js.map +1 -0
- package/lib/module/persona-tools/index.js +33 -0
- package/lib/module/persona-tools/index.js.map +1 -0
- package/lib/module/persona-tools/prompts.js +31 -0
- package/lib/module/persona-tools/prompts.js.map +1 -0
- package/lib/module/persona-tools/tools/AndroidThemeGenerator.js +82 -0
- package/lib/module/persona-tools/tools/AndroidThemeGenerator.js.map +1 -0
- package/lib/module/persona-tools/tools/IosThemeInstructions.js +37 -0
- package/lib/module/persona-tools/tools/IosThemeInstructions.js.map +1 -0
- package/lib/module/util.js +29 -0
- package/lib/module/util.js.map +1 -0
- package/{generatedTypes → lib/typescript}/index.d.ts +67 -3
- package/lib/typescript/persona-tools/AndroidResourcePrinter.d.ts +40 -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/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/lib/typescript/util.d.ts +3 -0
- package/package.json +79 -22
- package/src/index.ts +17 -18
- package/{persona-tools/lib → src/persona-tools}/AndroidResourcePrinter.ts +314 -278
- package/{persona-tools/config.ts → src/persona-tools/Config.ts} +7 -7
- package/src/persona-tools/Theme.ts +262 -0
- package/src/persona-tools/index.ts +30 -0
- package/{persona-tools/lib → src/persona-tools}/prompts.ts +11 -11
- package/{persona-tools → src/persona-tools}/tools/AndroidThemeGenerator.ts +31 -32
- package/{persona-tools → src/persona-tools}/tools/IosThemeInstructions.ts +8 -8
- package/src/util.ts +3 -3
- package/jest.config.js +0 -10
- package/persona-tools/Theme.js +0 -213
- package/persona-tools/Theme.ts +0 -260
- package/persona-tools/config.js +0 -72
- package/persona-tools/index.js +0 -30
- package/persona-tools/index.ts +0 -30
- package/persona-tools/lib/AndroidResourcePrinter.js +0 -832
- package/persona-tools/lib/AndroidResourcePrinter.spec.js +0 -1135
- package/persona-tools/lib/AndroidResourcePrinter.spec.ts +0 -1229
- 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/src/util.spec.ts +0 -16
- package/tsconfig.json +0 -29
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
9
|
+
|
|
10
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
|
11
|
+
|
|
12
|
+
var _path = _interopRequireDefault(require("path"));
|
|
13
|
+
|
|
14
|
+
var _Theme = _interopRequireDefault(require("../Theme"));
|
|
15
|
+
|
|
16
|
+
var _prompts = require("../prompts");
|
|
17
|
+
|
|
18
|
+
var _AndroidResourcePrinter = _interopRequireDefault(require("../AndroidResourcePrinter"));
|
|
19
|
+
|
|
20
|
+
var _Config = _interopRequireDefault(require("../Config"));
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
24
|
+
const ANDROID_STYLES_RESOURCE_PATH = './android/app/src/main/res/values/styles_persona.xml';
|
|
25
|
+
const ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH = './android/app/src/main/res/drawable/rn_persona_button.xml';
|
|
26
|
+
const ANDROID_BUTTON_SECONDARY_DRAWABLE_RESOURCE_PATH = './android/app/src/main/res/drawable/rn_persona_button_secondary.xml';
|
|
27
|
+
const ANDROID_BUTTON_COLOR_RESOURCE_PATH = './android/app/src/main/res/color/rn_persona_button.xml';
|
|
28
|
+
|
|
29
|
+
class ThemeGenerator {
|
|
30
|
+
async run() {
|
|
31
|
+
await _Theme.default.print();
|
|
32
|
+
const {
|
|
33
|
+
isConfirmed: themeValuesConfirmed
|
|
34
|
+
} = await (0, _prompts.confirmThemeValues)();
|
|
35
|
+
|
|
36
|
+
if (!themeValuesConfirmed) {
|
|
37
|
+
console.log(_chalk.default.yellow('\nPlease adjust the values in package.json.\n'));
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
console.log(`\n${_chalk.default.yellow('Creating an Android Resource files for your project at:')}\n
|
|
42
|
+
- ${ANDROID_STYLES_RESOURCE_PATH}
|
|
43
|
+
- ${ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH}
|
|
44
|
+
- ${ANDROID_BUTTON_SECONDARY_DRAWABLE_RESOURCE_PATH}
|
|
45
|
+
- ${ANDROID_BUTTON_COLOR_RESOURCE_PATH}\n`);
|
|
46
|
+
console.log('Building your application with this resource file themes your Persona Inquiry flow.\n');
|
|
47
|
+
const config = await _Config.default.get();
|
|
48
|
+
const theme = config.androidTheme;
|
|
49
|
+
const {
|
|
50
|
+
style,
|
|
51
|
+
buttonDrawable,
|
|
52
|
+
buttonSecondaryDrawable,
|
|
53
|
+
buttonColor
|
|
54
|
+
} = new _AndroidResourcePrinter.default(theme).process();
|
|
55
|
+
let {
|
|
56
|
+
isConfirmed: confirmed
|
|
57
|
+
} = await (0, _prompts.confirmResourceFiles)();
|
|
58
|
+
|
|
59
|
+
if (!confirmed) {
|
|
60
|
+
process.exit(1);
|
|
61
|
+
} // Add a line after confirmation
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
console.log('');
|
|
65
|
+
|
|
66
|
+
_fs.default.mkdirSync(_path.default.dirname(ANDROID_STYLES_RESOURCE_PATH), {
|
|
67
|
+
recursive: true
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
_fs.default.writeFileSync(ANDROID_STYLES_RESOURCE_PATH, style.end({
|
|
71
|
+
prettyPrint: true
|
|
72
|
+
}));
|
|
73
|
+
|
|
74
|
+
console.log(`${_chalk.default.green('Saved an Android style file at path:')} ${ANDROID_STYLES_RESOURCE_PATH}.`);
|
|
75
|
+
|
|
76
|
+
_fs.default.mkdirSync(_path.default.dirname(ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH), {
|
|
77
|
+
recursive: true
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
_fs.default.writeFileSync(ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH, buttonDrawable.end({
|
|
81
|
+
prettyPrint: true
|
|
82
|
+
}));
|
|
83
|
+
|
|
84
|
+
console.log(`${_chalk.default.green('Saved an Android drawable file at path:')} ${ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH}.`);
|
|
85
|
+
|
|
86
|
+
_fs.default.mkdirSync(_path.default.dirname(ANDROID_BUTTON_SECONDARY_DRAWABLE_RESOURCE_PATH), {
|
|
87
|
+
recursive: true
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
_fs.default.writeFileSync(ANDROID_BUTTON_SECONDARY_DRAWABLE_RESOURCE_PATH, buttonSecondaryDrawable.end({
|
|
91
|
+
prettyPrint: true
|
|
92
|
+
}));
|
|
93
|
+
|
|
94
|
+
console.log(`${_chalk.default.green('Saved an Android drawable file at path:')} ${ANDROID_BUTTON_SECONDARY_DRAWABLE_RESOURCE_PATH}.`);
|
|
95
|
+
|
|
96
|
+
_fs.default.mkdirSync(_path.default.dirname(ANDROID_BUTTON_COLOR_RESOURCE_PATH), {
|
|
97
|
+
recursive: true
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
_fs.default.writeFileSync(ANDROID_BUTTON_COLOR_RESOURCE_PATH, buttonColor.end({
|
|
101
|
+
prettyPrint: true
|
|
102
|
+
}));
|
|
103
|
+
|
|
104
|
+
console.log(`${_chalk.default.green('Saved an Android color file at path:')} ${ANDROID_BUTTON_COLOR_RESOURCE_PATH}.`);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
var _default = new ThemeGenerator();
|
|
110
|
+
|
|
111
|
+
exports.default = _default;
|
|
112
|
+
//# sourceMappingURL=AndroidThemeGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["AndroidThemeGenerator.ts"],"names":["ANDROID_STYLES_RESOURCE_PATH","ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH","ANDROID_BUTTON_SECONDARY_DRAWABLE_RESOURCE_PATH","ANDROID_BUTTON_COLOR_RESOURCE_PATH","ThemeGenerator","run","Theme","print","isConfirmed","themeValuesConfirmed","console","log","chalk","yellow","config","Configuration","get","theme","androidTheme","style","buttonDrawable","buttonSecondaryDrawable","buttonColor","AndroidResourcePrinter","process","confirmed","exit","fs","mkdirSync","path","dirname","recursive","writeFileSync","end","prettyPrint","green"],"mappings":"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","sourcesContent":["import fs from 'fs';\nimport chalk from 'chalk';\nimport path from 'path';\n\nimport Theme, { AndroidThemeObject } from '../Theme';\nimport { confirmThemeValues, confirmResourceFiles } from '../prompts';\nimport AndroidResourcePrinter from '../AndroidResourcePrinter';\nimport Configuration from '../Config';\n\nconst ANDROID_STYLES_RESOURCE_PATH =\n './android/app/src/main/res/values/styles_persona.xml';\nconst ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH =\n './android/app/src/main/res/drawable/rn_persona_button.xml';\nconst ANDROID_BUTTON_SECONDARY_DRAWABLE_RESOURCE_PATH =\n './android/app/src/main/res/drawable/rn_persona_button_secondary.xml';\nconst ANDROID_BUTTON_COLOR_RESOURCE_PATH =\n './android/app/src/main/res/color/rn_persona_button.xml';\n\nclass ThemeGenerator {\n async run() {\n await Theme.print();\n\n const { isConfirmed: themeValuesConfirmed } = await confirmThemeValues();\n\n if (!themeValuesConfirmed) {\n console.log(\n chalk.yellow('\\nPlease adjust the values in package.json.\\n')\n );\n return;\n }\n\n console.log(\n `\\n${chalk.yellow(\n 'Creating an Android Resource files for your project at:'\n )}\\n\n - ${ANDROID_STYLES_RESOURCE_PATH}\n - ${ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH}\n - ${ANDROID_BUTTON_SECONDARY_DRAWABLE_RESOURCE_PATH}\n - ${ANDROID_BUTTON_COLOR_RESOURCE_PATH}\\n`\n );\n console.log(\n 'Building your application with this resource file themes your Persona Inquiry flow.\\n'\n );\n\n const config = await Configuration.get();\n const theme = config.androidTheme as AndroidThemeObject;\n\n const { style, buttonDrawable, buttonSecondaryDrawable, buttonColor } =\n new AndroidResourcePrinter(theme).process();\n\n let { isConfirmed: confirmed } = await confirmResourceFiles();\n\n if (!confirmed) {\n process.exit(1);\n }\n\n // Add a line after confirmation\n console.log('');\n\n fs.mkdirSync(path.dirname(ANDROID_STYLES_RESOURCE_PATH), {\n recursive: true,\n });\n fs.writeFileSync(\n ANDROID_STYLES_RESOURCE_PATH,\n style.end({ prettyPrint: true })\n );\n\n console.log(\n `${chalk.green(\n 'Saved an Android style file at path:'\n )} ${ANDROID_STYLES_RESOURCE_PATH}.`\n );\n\n fs.mkdirSync(path.dirname(ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH), {\n recursive: true,\n });\n fs.writeFileSync(\n ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH,\n buttonDrawable.end({ prettyPrint: true })\n );\n console.log(\n `${chalk.green(\n 'Saved an Android drawable file at path:'\n )} ${ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH}.`\n );\n\n fs.mkdirSync(\n path.dirname(ANDROID_BUTTON_SECONDARY_DRAWABLE_RESOURCE_PATH),\n {\n recursive: true,\n }\n );\n fs.writeFileSync(\n ANDROID_BUTTON_SECONDARY_DRAWABLE_RESOURCE_PATH,\n buttonSecondaryDrawable.end({ prettyPrint: true })\n );\n console.log(\n `${chalk.green(\n 'Saved an Android drawable file at path:'\n )} ${ANDROID_BUTTON_SECONDARY_DRAWABLE_RESOURCE_PATH}.`\n );\n\n fs.mkdirSync(path.dirname(ANDROID_BUTTON_COLOR_RESOURCE_PATH), {\n recursive: true,\n });\n fs.writeFileSync(\n ANDROID_BUTTON_COLOR_RESOURCE_PATH,\n buttonColor.end({ prettyPrint: true })\n );\n console.log(\n `${chalk.green(\n 'Saved an Android color file at path:'\n )} ${ANDROID_BUTTON_COLOR_RESOURCE_PATH}.`\n );\n }\n}\n\nexport default new ThemeGenerator();\n"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _Theme = _interopRequireDefault(require("../Theme"));
|
|
9
|
+
|
|
10
|
+
var _prompts = require("../prompts");
|
|
11
|
+
|
|
12
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
class IosThemeInstructions {
|
|
17
|
+
async run() {
|
|
18
|
+
await _Theme.default.print('ios');
|
|
19
|
+
const {
|
|
20
|
+
isConfirmed: themeValuesConfirmed
|
|
21
|
+
} = await (0, _prompts.confirmThemeValues)();
|
|
22
|
+
|
|
23
|
+
if (!themeValuesConfirmed) {
|
|
24
|
+
console.log(_chalk.default.yellow('\nPlease adjust the values in package.json.\n'));
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
console.log(`\n${_chalk.default.yellow('To theme the Persona Inquiry flow for iOS:')}`);
|
|
29
|
+
console.log('Add the theme values to the Persona Inquiry SDK client by using the `.iosTheme` builder function');
|
|
30
|
+
console.log(`
|
|
31
|
+
${_chalk.default.green(`+ import { persona } from '../package.json'`)}
|
|
32
|
+
...
|
|
33
|
+
Inquiry.fromTemplate(selectedTemplateId)
|
|
34
|
+
.onSuccess(handleSuccess)
|
|
35
|
+
.onCancelled(handleCancelled)
|
|
36
|
+
.onFailed(handleFailed)
|
|
37
|
+
.onError(handleError)
|
|
38
|
+
${_chalk.default.green('+ .iosTheme(persona.iosTheme)')}
|
|
39
|
+
.build()
|
|
40
|
+
.start();
|
|
41
|
+
...
|
|
42
|
+
`);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
var _default = new IosThemeInstructions();
|
|
48
|
+
|
|
49
|
+
exports.default = _default;
|
|
50
|
+
//# sourceMappingURL=IosThemeInstructions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["IosThemeInstructions.ts"],"names":["IosThemeInstructions","run","Theme","print","isConfirmed","themeValuesConfirmed","console","log","chalk","yellow","green"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;AAEA,MAAMA,oBAAN,CAA2B;AAChB,QAAHC,GAAG,GAAG;AACV,UAAMC,eAAMC,KAAN,CAAY,KAAZ,CAAN;AAEA,UAAM;AAAEC,MAAAA,WAAW,EAAEC;AAAf,QAAwC,MAAM,kCAApD;;AAEA,QAAI,CAACA,oBAAL,EAA2B;AACzBC,MAAAA,OAAO,CAACC,GAAR,CACEC,eAAMC,MAAN,CAAa,+CAAb,CADF;AAGA;AACD;;AAEDH,IAAAA,OAAO,CAACC,GAAR,CACG,KAAIC,eAAMC,MAAN,CAAa,4CAAb,CAA2D,EADlE;AAGAH,IAAAA,OAAO,CAACC,GAAR,CACE,kGADF;AAIAD,IAAAA,OAAO,CAACC,GAAR,CAAa;AACjB,MAAMC,eAAME,KAAN,CAAa,6CAAb,CAA2D;AACjE;AACA;AACA;AACA;AACA;AACA;AACA,MAAMF,eAAME,KAAN,CAAY,iCAAZ,CAA+C;AACrD;AACA;AACA;AACA,KAZI;AAaD;;AAjCwB;;eAoCZ,IAAIV,oBAAJ,E","sourcesContent":["import Theme from '../Theme';\nimport { confirmThemeValues } from '../prompts';\nimport chalk from 'chalk';\n\nclass IosThemeInstructions {\n async run() {\n await Theme.print('ios');\n\n const { isConfirmed: themeValuesConfirmed } = await confirmThemeValues();\n\n if (!themeValuesConfirmed) {\n console.log(\n chalk.yellow('\\nPlease adjust the values in package.json.\\n')\n );\n return;\n }\n\n console.log(\n `\\n${chalk.yellow('To theme the Persona Inquiry flow for iOS:')}`\n );\n console.log(\n 'Add the theme values to the Persona Inquiry SDK client by using the `.iosTheme` builder function'\n );\n\n console.log(`\n ${chalk.green(`+ import { persona } from '../package.json'`)}\n ...\n Inquiry.fromTemplate(selectedTemplateId)\n .onSuccess(handleSuccess)\n .onCancelled(handleCancelled)\n .onFailed(handleFailed)\n .onError(handleError)\n ${chalk.green('+ .iosTheme(persona.iosTheme)')}\n .build()\n .start();\n ...\n `);\n }\n}\n\nexport default new IosThemeInstructions();\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.processThemeValues = processThemeValues;
|
|
7
|
+
const HEX_REGEX = /^[a-fA-F0-9]{6}$/;
|
|
8
|
+
|
|
9
|
+
function processThemeValues(themeObject) {
|
|
10
|
+
const result = {};
|
|
11
|
+
|
|
12
|
+
for (const [key, value] of Object.entries(themeObject)) {
|
|
13
|
+
if (value === null) {
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (key.includes('Color')) {
|
|
18
|
+
let colorValue = value;
|
|
19
|
+
|
|
20
|
+
if (value[0] === '#') {
|
|
21
|
+
colorValue = value.slice(1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (HEX_REGEX.test(colorValue)) {
|
|
25
|
+
result[key] = `#${colorValue}`;
|
|
26
|
+
} else {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
} else {
|
|
30
|
+
result[key] = value.toString();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["util.ts"],"names":["HEX_REGEX","processThemeValues","themeObject","result","key","value","Object","entries","includes","colorValue","slice","test","toString"],"mappings":";;;;;;AAAA,MAAMA,SAAS,GAAG,kBAAlB;;AACO,SAASC,kBAAT,CAA4BC,WAA5B,EAAiD;AACtD,QAAMC,MAAiC,GAAG,EAA1C;;AACA,OAAK,MAAM,CAACC,GAAD,EAAMC,KAAN,CAAX,IAA2BC,MAAM,CAACC,OAAP,CAAeL,WAAf,CAA3B,EAAwD;AACtD,QAAIG,KAAK,KAAK,IAAd,EAAoB;AAClB;AACD;;AAED,QAAID,GAAG,CAACI,QAAJ,CAAa,OAAb,CAAJ,EAA2B;AACzB,UAAIC,UAAU,GAAGJ,KAAjB;;AACA,UAAIA,KAAK,CAAC,CAAD,CAAL,KAAa,GAAjB,EAAsB;AACpBI,QAAAA,UAAU,GAAGJ,KAAK,CAACK,KAAN,CAAY,CAAZ,CAAb;AACD;;AAED,UAAIV,SAAS,CAACW,IAAV,CAAeF,UAAf,CAAJ,EAAgC;AAC9BN,QAAAA,MAAM,CAACC,GAAD,CAAN,GAAe,IAAGK,UAAW,EAA7B;AACD,OAFD,MAEO;AACL;AACD;AACF,KAXD,MAWO;AACLN,MAAAA,MAAM,CAACC,GAAD,CAAN,GAAcC,KAAK,CAACO,QAAN,EAAd;AACD;AACF;;AAED,SAAOT,MAAP;AACD","sourcesContent":["const HEX_REGEX = /^[a-fA-F0-9]{6}$/;\nexport function processThemeValues(themeObject: Object) {\n const result: { [key: string]: string } = {};\n for (const [key, value] of Object.entries(themeObject)) {\n if (value === null) {\n continue;\n }\n\n if (key.includes('Color')) {\n let colorValue = value;\n if (value[0] === '#') {\n colorValue = value.slice(1);\n }\n\n if (HEX_REGEX.test(colorValue)) {\n result[key] = `#${colorValue}`;\n } else {\n continue;\n }\n } else {\n result[key] = value.toString();\n }\n }\n\n return result;\n}\n"]}
|
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
import { NativeModules, NativeEventEmitter } from 'react-native';
|
|
4
|
+
import { processThemeValues } from './util';
|
|
5
|
+
const {
|
|
6
|
+
PersonaInquiry
|
|
7
|
+
} = NativeModules; // Using Opaque types + Smart Constructor enforces validation at
|
|
8
|
+
// instantiation time for IDS
|
|
9
|
+
|
|
10
|
+
export class InvalidTemplateId extends Error {}
|
|
11
|
+
export class InvalidInquiryId extends Error {}
|
|
12
|
+
export class InvalidAccountId extends Error {}
|
|
13
|
+
/**
|
|
14
|
+
* Run validations that the string is in proper Inquiry token format
|
|
15
|
+
* and do a type conversion to InquiryId.
|
|
16
|
+
*
|
|
17
|
+
* @param candidate
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
function makeInquiryId(candidate) {
|
|
21
|
+
if (candidate.startsWith('inq_')) return candidate;
|
|
22
|
+
throw new InvalidInquiryId(`Valid template IDs start with "inq_". Received: ${candidate} `);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Run validations that the string is in proper Template token format
|
|
26
|
+
* and do a type conversion to TemplateId.
|
|
27
|
+
*
|
|
28
|
+
* @param candidate
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
function makeTemplateId(candidate) {
|
|
33
|
+
if (candidate.startsWith('tmpl_') || candidate.startsWith('blu_')) {
|
|
34
|
+
return candidate;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
throw new InvalidTemplateId(`Valid template IDs start with "tmpl_". Received: ${candidate} `);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Run validations that the string is in proper Template token format
|
|
41
|
+
* and do a type conversion to AccountId.
|
|
42
|
+
*
|
|
43
|
+
* @param candidate
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
function makeAccountId(candidate) {
|
|
48
|
+
if (candidate.startsWith('act_')) {
|
|
49
|
+
return candidate;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
throw new InvalidAccountId(`Valid account IDs start with "act_". Received: ${candidate} `);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export let Fields;
|
|
56
|
+
/**
|
|
57
|
+
* String enum for environments. These strings will be parsed
|
|
58
|
+
* on the native side bridge into Kotlin / Swift enums.
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
(function (_Fields) {
|
|
62
|
+
class Builder {
|
|
63
|
+
constructor() {
|
|
64
|
+
_defineProperty(this, "_name", null);
|
|
65
|
+
|
|
66
|
+
_defineProperty(this, "_address", null);
|
|
67
|
+
|
|
68
|
+
_defineProperty(this, "_birthdate", null);
|
|
69
|
+
|
|
70
|
+
_defineProperty(this, "_emailAddress", null);
|
|
71
|
+
|
|
72
|
+
_defineProperty(this, "_phoneNumber", null);
|
|
73
|
+
|
|
74
|
+
_defineProperty(this, "_fields", {});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
name(name) {
|
|
78
|
+
this._name = name;
|
|
79
|
+
return this;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Returns the Field.Builder instance
|
|
83
|
+
*
|
|
84
|
+
* @param address - The address object
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Returns the Field.Builder instance
|
|
90
|
+
*
|
|
91
|
+
* @param address - The address object
|
|
92
|
+
*/
|
|
93
|
+
address(address) {
|
|
94
|
+
this._address = address;
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* @param date {Date}
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @param date {Date}
|
|
104
|
+
*/
|
|
105
|
+
birthdate(date) {
|
|
106
|
+
this._birthdate = date;
|
|
107
|
+
return this;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* @param date {string}
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @param date {string}
|
|
116
|
+
*/
|
|
117
|
+
emailAddress(email) {
|
|
118
|
+
this._emailAddress = email;
|
|
119
|
+
return this;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
phoneNumber(phoneNumber) {
|
|
123
|
+
this._phoneNumber = phoneNumber;
|
|
124
|
+
return this;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
field(fieldKey, value) {
|
|
128
|
+
this._fields = { ...this._fields,
|
|
129
|
+
[fieldKey]: value
|
|
130
|
+
};
|
|
131
|
+
return this;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
build() {
|
|
135
|
+
var _this$_birthdate;
|
|
136
|
+
|
|
137
|
+
return {
|
|
138
|
+
name: this._name,
|
|
139
|
+
address: this._address,
|
|
140
|
+
emailAddress: this._emailAddress,
|
|
141
|
+
phoneNumber: this._phoneNumber,
|
|
142
|
+
birthdate: (_this$_birthdate = this._birthdate) === null || _this$_birthdate === void 0 ? void 0 : _this$_birthdate.toISOString(),
|
|
143
|
+
additionalFields: this._fields
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function builder() {
|
|
150
|
+
return new Builder();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
_Fields.builder = builder;
|
|
154
|
+
})(Fields || (Fields = {}));
|
|
155
|
+
|
|
156
|
+
export let Environment;
|
|
157
|
+
|
|
158
|
+
(function (Environment) {
|
|
159
|
+
Environment["SANDBOX"] = "sandbox";
|
|
160
|
+
Environment["PRODUCTION"] = "production";
|
|
161
|
+
})(Environment || (Environment = {}));
|
|
162
|
+
|
|
163
|
+
const eventEmitter = new NativeEventEmitter(PersonaInquiry);
|
|
164
|
+
export class Inquiry {
|
|
165
|
+
constructor(options) {
|
|
166
|
+
_defineProperty(this, "templateId", void 0);
|
|
167
|
+
|
|
168
|
+
_defineProperty(this, "inquiryId", void 0);
|
|
169
|
+
|
|
170
|
+
_defineProperty(this, "referenceId", void 0);
|
|
171
|
+
|
|
172
|
+
_defineProperty(this, "accountId", void 0);
|
|
173
|
+
|
|
174
|
+
_defineProperty(this, "environment", void 0);
|
|
175
|
+
|
|
176
|
+
_defineProperty(this, "accessToken", void 0);
|
|
177
|
+
|
|
178
|
+
_defineProperty(this, "iosThemeObject", void 0);
|
|
179
|
+
|
|
180
|
+
_defineProperty(this, "fields", void 0);
|
|
181
|
+
|
|
182
|
+
_defineProperty(this, "onSuccess", void 0);
|
|
183
|
+
|
|
184
|
+
_defineProperty(this, "onCancelled", void 0);
|
|
185
|
+
|
|
186
|
+
_defineProperty(this, "onFailed", void 0);
|
|
187
|
+
|
|
188
|
+
_defineProperty(this, "onError", void 0);
|
|
189
|
+
|
|
190
|
+
_defineProperty(this, "onSuccessListener", void 0);
|
|
191
|
+
|
|
192
|
+
_defineProperty(this, "onCancelledListener", void 0);
|
|
193
|
+
|
|
194
|
+
_defineProperty(this, "onFailedListener", void 0);
|
|
195
|
+
|
|
196
|
+
_defineProperty(this, "onErrorListener", void 0);
|
|
197
|
+
|
|
198
|
+
this.templateId = options.templateId;
|
|
199
|
+
this.inquiryId = options.inquiryId;
|
|
200
|
+
this.referenceId = options.referenceId;
|
|
201
|
+
this.accountId = options.accountId;
|
|
202
|
+
this.environment = options.environment;
|
|
203
|
+
this.accessToken = options.accessToken;
|
|
204
|
+
this.fields = options.fields; // Callbacks
|
|
205
|
+
|
|
206
|
+
this.onSuccess = options.onSuccess;
|
|
207
|
+
this.onCancelled = options.onCancelled;
|
|
208
|
+
this.onFailed = options.onFailed;
|
|
209
|
+
this.onError = options.onError; // Theme object
|
|
210
|
+
|
|
211
|
+
this.iosThemeObject = options.iosThemeObject;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
clearListeners() {
|
|
215
|
+
if (this.onSuccessListener) this.onSuccessListener.remove();
|
|
216
|
+
if (this.onCancelledListener) this.onCancelledListener.remove();
|
|
217
|
+
if (this.onFailedListener) this.onFailedListener.remove();
|
|
218
|
+
if (this.onErrorListener) this.onErrorListener.remove();
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
start() {
|
|
222
|
+
this.onSuccessListener = eventEmitter.addListener('onSuccess', _ref => {
|
|
223
|
+
let {
|
|
224
|
+
inquiryId: inquiryId,
|
|
225
|
+
attributes: attributes
|
|
226
|
+
} = _ref;
|
|
227
|
+
|
|
228
|
+
// Native Brige sends an ISO 8601 Date. Convert this to a JS Date
|
|
229
|
+
if (typeof attributes.birthdate === 'string') {
|
|
230
|
+
attributes.birthdate = new Date(attributes.birthdate);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (this.onSuccess) this.onSuccess(inquiryId, attributes);
|
|
234
|
+
this.clearListeners();
|
|
235
|
+
});
|
|
236
|
+
this.onCancelledListener = eventEmitter.addListener('onCancelled', () => {
|
|
237
|
+
if (this.onCancelled) this.onCancelled();
|
|
238
|
+
this.clearListeners();
|
|
239
|
+
});
|
|
240
|
+
this.onFailedListener = eventEmitter.addListener('onFailed', _ref2 => {
|
|
241
|
+
let {
|
|
242
|
+
inquiryId: inquiryId
|
|
243
|
+
} = _ref2;
|
|
244
|
+
if (this.onFailed) this.onFailed(inquiryId);
|
|
245
|
+
this.clearListeners();
|
|
246
|
+
});
|
|
247
|
+
this.onErrorListener = eventEmitter.addListener('onError', _ref3 => {
|
|
248
|
+
let {
|
|
249
|
+
error: errorMessage
|
|
250
|
+
} = _ref3;
|
|
251
|
+
if (this.onError) this.onError(new Error(errorMessage));
|
|
252
|
+
this.clearListeners();
|
|
253
|
+
});
|
|
254
|
+
PersonaInquiry.startInquiry({
|
|
255
|
+
templateId: this.templateId,
|
|
256
|
+
inquiryId: this.inquiryId,
|
|
257
|
+
referenceId: this.referenceId,
|
|
258
|
+
accountId: this.accountId,
|
|
259
|
+
environment: this.environment,
|
|
260
|
+
accessToken: this.accessToken,
|
|
261
|
+
fields: this.fields,
|
|
262
|
+
iosTheme: processThemeValues(this.iosThemeObject || {})
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
class InquiryBuilder {
|
|
269
|
+
// Callbacks
|
|
270
|
+
constructor(inquiryId) {
|
|
271
|
+
_defineProperty(this, "_inquiryId", void 0);
|
|
272
|
+
|
|
273
|
+
_defineProperty(this, "_accessToken", void 0);
|
|
274
|
+
|
|
275
|
+
_defineProperty(this, "_onSuccess", void 0);
|
|
276
|
+
|
|
277
|
+
_defineProperty(this, "_onCancelled", void 0);
|
|
278
|
+
|
|
279
|
+
_defineProperty(this, "_onFailed", void 0);
|
|
280
|
+
|
|
281
|
+
_defineProperty(this, "_onError", void 0);
|
|
282
|
+
|
|
283
|
+
_defineProperty(this, "_iosThemeObject", void 0);
|
|
284
|
+
|
|
285
|
+
_defineProperty(this, "_fields", void 0);
|
|
286
|
+
|
|
287
|
+
this._inquiryId = inquiryId;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
accessToken(accessToken) {
|
|
291
|
+
this._accessToken = accessToken;
|
|
292
|
+
return this;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
onSuccess(callback) {
|
|
296
|
+
this._onSuccess = callback;
|
|
297
|
+
return this;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
onCancelled(callback) {
|
|
301
|
+
this._onCancelled = callback;
|
|
302
|
+
return this;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
onFailed(callback) {
|
|
306
|
+
this._onFailed = callback;
|
|
307
|
+
return this;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
onError(callback) {
|
|
311
|
+
this._onError = callback;
|
|
312
|
+
return this;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
iosTheme(themeObject) {
|
|
316
|
+
this._iosThemeObject = themeObject;
|
|
317
|
+
return this;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
build() {
|
|
321
|
+
return new Inquiry({
|
|
322
|
+
inquiryId: this._inquiryId,
|
|
323
|
+
accessToken: this._accessToken,
|
|
324
|
+
onSuccess: this._onSuccess,
|
|
325
|
+
onCancelled: this._onCancelled,
|
|
326
|
+
onFailed: this._onFailed,
|
|
327
|
+
onError: this._onError,
|
|
328
|
+
iosThemeObject: this._iosThemeObject,
|
|
329
|
+
fields: this._fields
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
class TemplateBuilder {
|
|
336
|
+
// Callbacks
|
|
337
|
+
// Customization
|
|
338
|
+
constructor(templateId) {
|
|
339
|
+
_defineProperty(this, "_templateId", void 0);
|
|
340
|
+
|
|
341
|
+
_defineProperty(this, "_accountId", void 0);
|
|
342
|
+
|
|
343
|
+
_defineProperty(this, "_referenceId", void 0);
|
|
344
|
+
|
|
345
|
+
_defineProperty(this, "_environment", void 0);
|
|
346
|
+
|
|
347
|
+
_defineProperty(this, "_fields", void 0);
|
|
348
|
+
|
|
349
|
+
_defineProperty(this, "_accessToken", void 0);
|
|
350
|
+
|
|
351
|
+
_defineProperty(this, "_onSuccess", void 0);
|
|
352
|
+
|
|
353
|
+
_defineProperty(this, "_onCancelled", void 0);
|
|
354
|
+
|
|
355
|
+
_defineProperty(this, "_onFailed", void 0);
|
|
356
|
+
|
|
357
|
+
_defineProperty(this, "_onError", void 0);
|
|
358
|
+
|
|
359
|
+
_defineProperty(this, "_iosThemeObject", void 0);
|
|
360
|
+
|
|
361
|
+
this._templateId = templateId;
|
|
362
|
+
return this;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
referenceId(referenceId) {
|
|
366
|
+
this._accountId = undefined;
|
|
367
|
+
this._referenceId = referenceId;
|
|
368
|
+
return this;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
accountId(accountId) {
|
|
372
|
+
this._referenceId = undefined;
|
|
373
|
+
this._accountId = makeAccountId(accountId);
|
|
374
|
+
return this;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
environment(environment) {
|
|
378
|
+
this._environment = environment;
|
|
379
|
+
return this;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
accessToken(accessToken) {
|
|
383
|
+
this._accessToken = accessToken;
|
|
384
|
+
return this;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
fields(fields) {
|
|
388
|
+
this._fields = fields;
|
|
389
|
+
return this;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
onSuccess(callback) {
|
|
393
|
+
this._onSuccess = callback;
|
|
394
|
+
return this;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
onCancelled(callback) {
|
|
398
|
+
this._onCancelled = callback;
|
|
399
|
+
return this;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
onFailed(callback) {
|
|
403
|
+
this._onFailed = callback;
|
|
404
|
+
return this;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
onError(callback) {
|
|
408
|
+
this._onError = callback;
|
|
409
|
+
return this;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
iosTheme(themeObject) {
|
|
413
|
+
this._iosThemeObject = themeObject;
|
|
414
|
+
return this;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
build() {
|
|
418
|
+
return new Inquiry({
|
|
419
|
+
templateId: this._templateId,
|
|
420
|
+
accountId: this._accountId,
|
|
421
|
+
referenceId: this._referenceId,
|
|
422
|
+
environment: this._environment,
|
|
423
|
+
accessToken: this._accessToken,
|
|
424
|
+
fields: this._fields,
|
|
425
|
+
onSuccess: this._onSuccess,
|
|
426
|
+
onCancelled: this._onCancelled,
|
|
427
|
+
onFailed: this._onFailed,
|
|
428
|
+
onError: this._onError,
|
|
429
|
+
iosThemeObject: this._iosThemeObject
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
let InquiryBuilders;
|
|
436
|
+
|
|
437
|
+
(function (_InquiryBuilders) {
|
|
438
|
+
function fromInquiry(inquiryId) {
|
|
439
|
+
return new InquiryBuilder(makeInquiryId(inquiryId));
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
_InquiryBuilders.fromInquiry = fromInquiry;
|
|
443
|
+
|
|
444
|
+
function fromTemplate(templateId) {
|
|
445
|
+
return new TemplateBuilder(makeTemplateId(templateId));
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
_InquiryBuilders.fromTemplate = fromTemplate;
|
|
449
|
+
})(InquiryBuilders || (InquiryBuilders = {}));
|
|
450
|
+
|
|
451
|
+
export default InquiryBuilders;
|
|
452
|
+
//# sourceMappingURL=index.js.map
|