react-native-persona 2.2.2 → 2.2.3

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +2 -9
  3. package/bin/persona-tool +1 -2
  4. package/lib/commonjs/persona-tool/AndroidResourcePrinter.js +497 -0
  5. package/lib/commonjs/persona-tool/AndroidResourcePrinter.js.map +1 -0
  6. package/lib/commonjs/persona-tool/Config.js +95 -0
  7. package/lib/commonjs/persona-tool/Config.js.map +1 -0
  8. package/lib/commonjs/persona-tool/Theme.js +199 -0
  9. package/lib/commonjs/persona-tool/Theme.js.map +1 -0
  10. package/lib/commonjs/persona-tool/index.js +41 -0
  11. package/lib/commonjs/persona-tool/index.js.map +1 -0
  12. package/lib/commonjs/persona-tool/prompts.js +48 -0
  13. package/lib/commonjs/persona-tool/prompts.js.map +1 -0
  14. package/lib/commonjs/persona-tool/tools/AndroidThemeGenerator.js +99 -0
  15. package/lib/commonjs/persona-tool/tools/AndroidThemeGenerator.js.map +1 -0
  16. package/lib/commonjs/persona-tool/tools/IosThemeInstructions.js +50 -0
  17. package/lib/commonjs/persona-tool/tools/IosThemeInstructions.js.map +1 -0
  18. package/lib/module/persona-tool/AndroidResourcePrinter.js +489 -0
  19. package/lib/module/persona-tool/AndroidResourcePrinter.js.map +1 -0
  20. package/lib/module/persona-tool/Config.js +82 -0
  21. package/lib/module/persona-tool/Config.js.map +1 -0
  22. package/lib/module/persona-tool/Theme.js +183 -0
  23. package/lib/module/persona-tool/Theme.js.map +1 -0
  24. package/lib/module/persona-tool/index.js +33 -0
  25. package/lib/module/persona-tool/index.js.map +1 -0
  26. package/lib/module/persona-tool/prompts.js +31 -0
  27. package/lib/module/persona-tool/prompts.js.map +1 -0
  28. package/lib/module/persona-tool/tools/AndroidThemeGenerator.js +72 -0
  29. package/lib/module/persona-tool/tools/AndroidThemeGenerator.js.map +1 -0
  30. package/lib/module/persona-tool/tools/IosThemeInstructions.js +37 -0
  31. package/lib/module/persona-tool/tools/IosThemeInstructions.js.map +1 -0
  32. package/lib/typescript/{src/fields.d.ts → fields.d.ts} +0 -0
  33. package/lib/typescript/{src/index.d.ts → index.d.ts} +0 -0
  34. package/lib/typescript/{persona-tools/lib → persona-tool}/AndroidResourcePrinter.d.ts +2 -2
  35. package/lib/typescript/{persona-tools → persona-tool}/Config.d.ts +0 -0
  36. package/lib/typescript/{persona-tools → persona-tool}/Theme.d.ts +0 -0
  37. package/lib/typescript/{persona-tools → persona-tool}/index.d.ts +0 -0
  38. package/lib/typescript/{persona-tools/lib → persona-tool}/prompts.d.ts +1 -1
  39. package/lib/typescript/{persona-tools → persona-tool}/tools/AndroidThemeGenerator.d.ts +0 -0
  40. package/lib/typescript/{persona-tools → persona-tool}/tools/IosThemeInstructions.d.ts +0 -0
  41. package/lib/typescript/{src/util.d.ts → util.d.ts} +0 -0
  42. package/lib/typescript/{src/versions.d.ts → versions.d.ts} +0 -0
  43. package/package.json +2 -3
  44. package/{persona-tools/lib → src/persona-tool}/AndroidResourcePrinter.ts +182 -182
  45. package/{persona-tools → src/persona-tool}/Config.ts +0 -0
  46. package/{persona-tools → src/persona-tool}/Theme.ts +0 -0
  47. package/{persona-tools → src/persona-tool}/index.ts +1 -1
  48. package/{persona-tools/lib → src/persona-tool}/prompts.ts +11 -11
  49. package/{persona-tools → src/persona-tool}/tools/AndroidThemeGenerator.ts +2 -2
  50. package/{persona-tools → src/persona-tool}/tools/IosThemeInstructions.ts +1 -1
@@ -0,0 +1,183 @@
1
+ import Table from 'cli-table';
2
+ import chalk from 'chalk';
3
+ import Config from './Config';
4
+ const COLOR_REGEX = /^[a-zA-Z0-9]{6}$/;
5
+ export let ANDROID_THEME_CONFIG_KEY;
6
+
7
+ (function (ANDROID_THEME_CONFIG_KEY) {
8
+ ANDROID_THEME_CONFIG_KEY["backgroundColor"] = "backgroundColor";
9
+ ANDROID_THEME_CONFIG_KEY["primaryColor"] = "primaryColor";
10
+ ANDROID_THEME_CONFIG_KEY["darkPrimaryColor"] = "darkPrimaryColor";
11
+ ANDROID_THEME_CONFIG_KEY["accentColor"] = "accentColor";
12
+ ANDROID_THEME_CONFIG_KEY["titleTextColor"] = "titleTextColor";
13
+ ANDROID_THEME_CONFIG_KEY["titleTextFont"] = "titleTextFont";
14
+ ANDROID_THEME_CONFIG_KEY["bodyTextColor"] = "bodyTextColor";
15
+ ANDROID_THEME_CONFIG_KEY["bodyTextFont"] = "bodyTextFont";
16
+ ANDROID_THEME_CONFIG_KEY["footnoteTextColor"] = "footnoteTextColor";
17
+ ANDROID_THEME_CONFIG_KEY["footnoteTextFont"] = "footnoteTextFont";
18
+ ANDROID_THEME_CONFIG_KEY["textFieldTextColor"] = "textFieldTextColor";
19
+ ANDROID_THEME_CONFIG_KEY["textFieldTextFont"] = "textFieldTextFont";
20
+ ANDROID_THEME_CONFIG_KEY["pickerTextColor"] = "pickerTextColor";
21
+ ANDROID_THEME_CONFIG_KEY["pickerTextFont"] = "pickerTextFont";
22
+ ANDROID_THEME_CONFIG_KEY["buttonBackgroundColor"] = "buttonBackgroundColor";
23
+ ANDROID_THEME_CONFIG_KEY["buttonDisabledBackgroundColor"] = "buttonDisabledBackgroundColor";
24
+ ANDROID_THEME_CONFIG_KEY["buttonTouchedBackgroundColor"] = "buttonTouchedBackgroundColor";
25
+ ANDROID_THEME_CONFIG_KEY["buttonTextColor"] = "buttonTextColor";
26
+ ANDROID_THEME_CONFIG_KEY["buttonDisabledTextColor"] = "buttonDisabledTextColor";
27
+ ANDROID_THEME_CONFIG_KEY["buttonCornerRadius"] = "buttonCornerRadius";
28
+ ANDROID_THEME_CONFIG_KEY["buttonFont"] = "buttonFont";
29
+ ANDROID_THEME_CONFIG_KEY["progressColor"] = "progressColor";
30
+ ANDROID_THEME_CONFIG_KEY["successAsset"] = "successAsset";
31
+ ANDROID_THEME_CONFIG_KEY["failAsset"] = "failAsset";
32
+ ANDROID_THEME_CONFIG_KEY["loadingAnimationAsset"] = "loadingAnimationAsset";
33
+ ANDROID_THEME_CONFIG_KEY["loadingAnimationWidthPercent"] = "loadingAnimationWidthPercent";
34
+ ANDROID_THEME_CONFIG_KEY["selfieAnimationAsset"] = "selfieAnimationAsset";
35
+ ANDROID_THEME_CONFIG_KEY["selfieAnimationWidthPercent"] = "selfieAnimationWidthPercent";
36
+ })(ANDROID_THEME_CONFIG_KEY || (ANDROID_THEME_CONFIG_KEY = {}));
37
+
38
+ export let IOS_THEME_CONFIG_KEY;
39
+
40
+ (function (IOS_THEME_CONFIG_KEY) {
41
+ IOS_THEME_CONFIG_KEY["backgroundColor"] = "backgroundColor";
42
+ IOS_THEME_CONFIG_KEY["primaryColor"] = "primaryColor";
43
+ IOS_THEME_CONFIG_KEY["darkPrimaryColor"] = "darkPrimaryColor";
44
+ IOS_THEME_CONFIG_KEY["accentColor"] = "accentColor";
45
+ IOS_THEME_CONFIG_KEY["overlayBackgroundColor"] = "overlayBackgroundColor";
46
+ IOS_THEME_CONFIG_KEY["titleTextColor"] = "titleTextColor";
47
+ IOS_THEME_CONFIG_KEY["titleTextFont"] = "titleTextFont";
48
+ IOS_THEME_CONFIG_KEY["bodyTextColor"] = "bodyTextColor";
49
+ IOS_THEME_CONFIG_KEY["bodyTextFont"] = "bodyTextFont";
50
+ IOS_THEME_CONFIG_KEY["footnoteTextColor"] = "footnoteTextColor";
51
+ IOS_THEME_CONFIG_KEY["footnoteTextFont"] = "footnoteTextFont";
52
+ IOS_THEME_CONFIG_KEY["formLabelTextColor"] = "formLabelTextColor";
53
+ IOS_THEME_CONFIG_KEY["formLabelTextFont"] = "formLabelTextFont";
54
+ IOS_THEME_CONFIG_KEY["textFieldTextColor"] = "textFieldTextColor";
55
+ IOS_THEME_CONFIG_KEY["textFieldBackgroundColor"] = "textFieldBackgroundColor";
56
+ IOS_THEME_CONFIG_KEY["textFieldBorderColor"] = "textFieldBorderColor";
57
+ IOS_THEME_CONFIG_KEY["pickerTextColor"] = "pickerTextColor";
58
+ IOS_THEME_CONFIG_KEY["pickerTextFont"] = "pickerTextFont";
59
+ IOS_THEME_CONFIG_KEY["buttonBackgroundColor"] = "buttonBackgroundColor";
60
+ IOS_THEME_CONFIG_KEY["buttonDisabledBackgroundColor"] = "buttonDisabledBackgroundColor";
61
+ IOS_THEME_CONFIG_KEY["buttonTouchedBackgroundColor"] = "buttonTouchedBackgroundColor";
62
+ IOS_THEME_CONFIG_KEY["buttonImageTintColor"] = "buttonImageTintColor";
63
+ IOS_THEME_CONFIG_KEY["buttonTextColor"] = "buttonTextColor";
64
+ IOS_THEME_CONFIG_KEY["buttonDisabledTextColor"] = "buttonDisabledTextColor";
65
+ IOS_THEME_CONFIG_KEY["buttonTextAlignment"] = "buttonTextAlignment";
66
+ IOS_THEME_CONFIG_KEY["buttonCornerRadius"] = "buttonCornerRadius";
67
+ IOS_THEME_CONFIG_KEY["buttonFont"] = "buttonFont";
68
+ IOS_THEME_CONFIG_KEY["selectedCellBackgroundColor"] = "selectedCellBackgroundColor";
69
+ IOS_THEME_CONFIG_KEY["closeButtonTintColor"] = "closeButtonTintColor";
70
+ IOS_THEME_CONFIG_KEY["cancelButtonBackgroundColor"] = "cancelButtonBackgroundColor";
71
+ IOS_THEME_CONFIG_KEY["progressColor"] = "progressColor";
72
+ IOS_THEME_CONFIG_KEY["cameraGuideCornersColor"] = "cameraGuideCornersColor";
73
+ IOS_THEME_CONFIG_KEY["cameraButtonBackgroundColor"] = "cameraButtonBackgroundColor";
74
+ IOS_THEME_CONFIG_KEY["successAssetName"] = "successAssetName";
75
+ IOS_THEME_CONFIG_KEY["successAssetWidth"] = "successAssetWidth";
76
+ IOS_THEME_CONFIG_KEY["successAssetHeight"] = "successAssetHeight";
77
+ IOS_THEME_CONFIG_KEY["verificationFailAssetName"] = "verificationFailAssetName";
78
+ IOS_THEME_CONFIG_KEY["verificationFailAssetWidth"] = "verificationFailAssetWidth";
79
+ IOS_THEME_CONFIG_KEY["verificationFailAssetHeight"] = "verificationFailAssetHeight";
80
+ IOS_THEME_CONFIG_KEY["failAssetName"] = "failAssetName";
81
+ IOS_THEME_CONFIG_KEY["failAssetWidth"] = "failAssetWidth";
82
+ IOS_THEME_CONFIG_KEY["failAssetHeight"] = "failAssetHeight";
83
+ IOS_THEME_CONFIG_KEY["loadingAnimationAssetName"] = "loadingAnimationAssetName";
84
+ IOS_THEME_CONFIG_KEY["loadingAnimationAssetWidth"] = "loadingAnimationAssetWidth";
85
+ IOS_THEME_CONFIG_KEY["loadingAnimationAssetHeight"] = "loadingAnimationAssetHeight";
86
+ IOS_THEME_CONFIG_KEY["processingAnimationAssetName"] = "processingAnimationAssetName";
87
+ IOS_THEME_CONFIG_KEY["processingAnimationAssetWidth"] = "processingAnimationAssetWidth";
88
+ IOS_THEME_CONFIG_KEY["processingAnimationAssetHeight"] = "processingAnimationAssetHeight";
89
+ IOS_THEME_CONFIG_KEY["selfieAnimationAssetName"] = "selfieAnimationAssetName";
90
+ IOS_THEME_CONFIG_KEY["selfieAnimationAssetWidth"] = "selfieAnimationAssetWidth";
91
+ IOS_THEME_CONFIG_KEY["selfieAnimationAssetHeight"] = "selfieAnimationAssetHeight";
92
+ })(IOS_THEME_CONFIG_KEY || (IOS_THEME_CONFIG_KEY = {}));
93
+
94
+ class Theme {
95
+ async print() {
96
+ let platform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'android';
97
+ const config = await Config.get();
98
+ const themeConfig = platform === 'android' ? config.androidTheme : config.iosTheme;
99
+ let usesCustomFontAndroid = false;
100
+ let usesCustomFontIos = false;
101
+ const head = platform === 'android' ? ['Style Item', 'Value', 'Note'] : ['Style Item', 'Value', 'Note'];
102
+ const table = new Table({
103
+ head,
104
+ // prettier-ignore
105
+ chars: {
106
+ 'mid': '',
107
+ 'left-mid': '',
108
+ 'mid-mid': '',
109
+ 'right-mid': ''
110
+ }
111
+ });
112
+ console.log('Specified theme values:');
113
+ const keyEnum = platform === 'android' ? ANDROID_THEME_CONFIG_KEY : IOS_THEME_CONFIG_KEY;
114
+
115
+ for (const key in keyEnum) {
116
+ let override = themeConfig[key];
117
+ let colorOverride = key.includes('Color') || key.includes('color');
118
+
119
+ if (override) {
120
+ if (colorOverride) {
121
+ override = normalizeColor(override, key);
122
+ } else {
123
+ override = override.toString();
124
+ }
125
+ }
126
+
127
+ if (key.includes('Font')) {
128
+ if (platform == 'android') {
129
+ usesCustomFontAndroid = true;
130
+ } else {
131
+ usesCustomFontIos = true;
132
+ }
133
+ }
134
+
135
+ let row;
136
+ row = [key, override ? valueColor(colorOverride, override) : chalk.yellow('unspecified'), key.includes('Font') ? chalk.cyan('Fonts that are not built-in need to be installed.') : ''];
137
+ table.push(row);
138
+ }
139
+
140
+ console.log(table.toString());
141
+
142
+ if (usesCustomFontAndroid) {
143
+ console.log(chalk.yellow(' NOTE') + ': A font customization was made. If the font is not built-in to the Android platform (https://github.com/react-native-training/react-native-fonts#android), then the font(s) must first be installed. A guide to install a font can be found here: https://developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml');
144
+ }
145
+
146
+ if (usesCustomFontIos) {
147
+ console.log(chalk.yellow(' NOTE') + ': A font customization was made. If the font is not built-in iOS (https://github.com/react-native-training/react-native-ios), then the font(s) must first be installed. A guide to install a font can be found here: https://developer.apple.com/documentation/uikit/text_display_and_fonts/adding_a_custom_font_to_your_app');
148
+ } // Add newline for spacing
149
+
150
+
151
+ console.log('');
152
+ }
153
+
154
+ } // set default print color for non-color overrides
155
+
156
+
157
+ function valueColor(isColorOverride, override) {
158
+ return isColorOverride ? chalk.hex(override)(override) : chalk.magentaBright(override);
159
+ }
160
+
161
+ function normalizeColor(colorHex, themeKey) {
162
+ let hex = colorHex;
163
+
164
+ if (colorHex[0] === '#') {
165
+ hex = colorHex.slice(1);
166
+ }
167
+
168
+ if (!COLOR_REGEX.test(hex)) {
169
+ if (themeKey) {
170
+ console.error(`Received a color value of ${chalk.yellow(colorHex)} for ${chalk.red(themeKey)}.\nFormat must follow standard 6 character hexadecimal color code. Eg. ${chalk.bgHex('#FFFFFF').hex('#7E66B7')('#290087')}`);
171
+ } else {
172
+ console.error(`Received a color value of ${chalk.yellow(colorHex)}.\nFormat must follow standard 6 character hexadecimal color code. Eg. ${chalk.bgHex('#FFFFFF').hex('#7E66B7')('#290087')}`);
173
+ }
174
+
175
+ console.log('');
176
+ process.exit(1);
177
+ }
178
+
179
+ return colorHex;
180
+ }
181
+
182
+ export default new Theme();
183
+ //# sourceMappingURL=Theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["Theme.ts"],"names":["Table","chalk","Config","COLOR_REGEX","ANDROID_THEME_CONFIG_KEY","IOS_THEME_CONFIG_KEY","Theme","print","platform","config","get","themeConfig","androidTheme","iosTheme","usesCustomFontAndroid","usesCustomFontIos","head","table","chars","console","log","keyEnum","key","override","colorOverride","includes","normalizeColor","toString","row","valueColor","yellow","cyan","push","isColorOverride","hex","magentaBright","colorHex","themeKey","slice","test","error","red","bgHex","process","exit"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,WAAlB;AACA,OAAOC,KAAP,MAAkB,OAAlB;AAEA,OAAOC,MAAP,MAAmB,UAAnB;AAEA,MAAMC,WAAW,GAAG,kBAApB;AAEA,WAAYC,wBAAZ;;WAAYA,wB;AAAAA,EAAAA,wB;AAAAA,EAAAA,wB;AAAAA,EAAAA,wB;AAAAA,EAAAA,wB;AAAAA,EAAAA,wB;AAAAA,EAAAA,wB;AAAAA,EAAAA,wB;AAAAA,EAAAA,wB;AAAAA,EAAAA,wB;AAAAA,EAAAA,wB;AAAAA,EAAAA,wB;AAAAA,EAAAA,wB;AAAAA,EAAAA,wB;AAAAA,EAAAA,wB;AAAAA,EAAAA,wB;AAAAA,EAAAA,wB;AAAAA,EAAAA,wB;AAAAA,EAAAA,wB;AAAAA,EAAAA,wB;AAAAA,EAAAA,wB;AAAAA,EAAAA,wB;AAAAA,EAAAA,wB;AAAAA,EAAAA,wB;AAAAA,EAAAA,wB;AAAAA,EAAAA,wB;AAAAA,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AA4BvC,KAAK,CAAC6B,MAAN,CAAaM,QAAb,CAAuB,QAAOnC,KAAK,CAACwC,GAAN,CACzDJ,QADyD,CAEzD,0EAAyEpC,KAAK,CAC7EyC,KADwE,CAClE,SADkE,EAExER,GAFwE,CAEpE,SAFoE,EAEzD,SAFyD,CAE9C,EAL/B;AAOD,KARD,MAQO;AACLf,MAAAA,OAAO,CAACqB,KAAR,CACG,6BAA4BvC,KAAK,CAAC6B,MAAN,CAC3BM,QAD2B,CAE3B,0EAAyEnC,KAAK,CAC7EyC,KADwE,CAClE,SADkE,EAExER,GAFwE,CAEpE,SAFoE,EAEzD,SAFyD,CAE9C,EAL/B;AAOD;;AACDf,IAAAA,OAAO,CAACC,GAAR,CAAY,EAAZ;AACAuB,IAAAA,OAAO,CAACC,IAAR,CAAa,CAAb;AACD;;AAED,SAAOR,QAAP;AACD;;AAED,eAAe,IAAI9B,KAAJ,EAAf","sourcesContent":["import Table from 'cli-table';\nimport chalk from 'chalk';\n\nimport Config from './Config';\n\nconst COLOR_REGEX = /^[a-zA-Z0-9]{6}$/;\n\nexport enum ANDROID_THEME_CONFIG_KEY {\n backgroundColor = 'backgroundColor',\n primaryColor = 'primaryColor',\n darkPrimaryColor = 'darkPrimaryColor',\n accentColor = 'accentColor',\n\n titleTextColor = 'titleTextColor',\n titleTextFont = 'titleTextFont',\n\n bodyTextColor = 'bodyTextColor',\n bodyTextFont = 'bodyTextFont',\n\n footnoteTextColor = 'footnoteTextColor',\n footnoteTextFont = 'footnoteTextFont',\n\n // formLabelTextColor = \"formLabelTextColor\",\n // formLabelTextFont = \"formLabelTextFont\",\n\n textFieldTextColor = 'textFieldTextColor',\n textFieldTextFont = 'textFieldTextFont',\n\n pickerTextColor = 'pickerTextColor',\n pickerTextFont = 'pickerTextFont',\n\n buttonBackgroundColor = 'buttonBackgroundColor',\n buttonDisabledBackgroundColor = 'buttonDisabledBackgroundColor',\n buttonTouchedBackgroundColor = 'buttonTouchedBackgroundColor',\n buttonTextColor = 'buttonTextColor',\n buttonDisabledTextColor = 'buttonDisabledTextColor',\n // buttonTextAlignment = \"buttonTextAlignment\",\n buttonCornerRadius = 'buttonCornerRadius',\n buttonFont = 'buttonFont',\n progressColor = 'progressColor',\n successAsset = 'successAsset',\n failAsset = 'failAsset',\n loadingAnimationAsset = 'loadingAnimationAsset',\n loadingAnimationWidthPercent = 'loadingAnimationWidthPercent',\n selfieAnimationAsset = 'selfieAnimationAsset',\n selfieAnimationWidthPercent = 'selfieAnimationWidthPercent',\n}\n\nexport enum IOS_THEME_CONFIG_KEY {\n backgroundColor = 'backgroundColor',\n primaryColor = 'primaryColor',\n darkPrimaryColor = 'darkPrimaryColor',\n accentColor = 'accentColor',\n overlayBackgroundColor = 'overlayBackgroundColor',\n titleTextColor = 'titleTextColor',\n titleTextFont = 'titleTextFont',\n bodyTextColor = 'bodyTextColor',\n bodyTextFont = 'bodyTextFont',\n footnoteTextColor = 'footnoteTextColor',\n footnoteTextFont = 'footnoteTextFont',\n formLabelTextColor = 'formLabelTextColor',\n formLabelTextFont = 'formLabelTextFont',\n textFieldTextColor = 'textFieldTextColor',\n textFieldBackgroundColor = 'textFieldBackgroundColor',\n textFieldBorderColor = 'textFieldBorderColor',\n pickerTextColor = 'pickerTextColor',\n pickerTextFont = 'pickerTextFont',\n buttonBackgroundColor = 'buttonBackgroundColor',\n buttonDisabledBackgroundColor = 'buttonDisabledBackgroundColor',\n buttonTouchedBackgroundColor = 'buttonTouchedBackgroundColor',\n buttonImageTintColor = 'buttonImageTintColor',\n buttonTextColor = 'buttonTextColor',\n buttonDisabledTextColor = 'buttonDisabledTextColor',\n buttonTextAlignment = 'buttonTextAlignment',\n buttonCornerRadius = 'buttonCornerRadius',\n buttonFont = 'buttonFont',\n selectedCellBackgroundColor = 'selectedCellBackgroundColor',\n closeButtonTintColor = 'closeButtonTintColor',\n cancelButtonBackgroundColor = 'cancelButtonBackgroundColor',\n progressColor = 'progressColor',\n cameraGuideCornersColor = 'cameraGuideCornersColor',\n cameraButtonBackgroundColor = 'cameraButtonBackgroundColor',\n successAssetName = 'successAssetName',\n successAssetWidth = 'successAssetWidth',\n successAssetHeight = 'successAssetHeight',\n verificationFailAssetName = 'verificationFailAssetName',\n verificationFailAssetWidth = 'verificationFailAssetWidth',\n verificationFailAssetHeight = 'verificationFailAssetHeight',\n failAssetName = 'failAssetName',\n failAssetWidth = 'failAssetWidth',\n failAssetHeight = 'failAssetHeight',\n loadingAnimationAssetName = 'loadingAnimationAssetName',\n loadingAnimationAssetWidth = 'loadingAnimationAssetWidth',\n loadingAnimationAssetHeight = 'loadingAnimationAssetHeight',\n processingAnimationAssetName = 'processingAnimationAssetName',\n processingAnimationAssetWidth = 'processingAnimationAssetWidth',\n processingAnimationAssetHeight = 'processingAnimationAssetHeight',\n selfieAnimationAssetName = 'selfieAnimationAssetName',\n selfieAnimationAssetWidth = 'selfieAnimationAssetWidth',\n selfieAnimationAssetHeight = 'selfieAnimationAssetHeight',\n}\n\nexport type AndroidThemeObject = {\n [key in ANDROID_THEME_CONFIG_KEY]: string | null | undefined;\n};\n\nexport type IosThemeObject = {\n [key in IOS_THEME_CONFIG_KEY]: string | null | undefined;\n};\n\nexport type ThemeObject = AndroidThemeObject | IosThemeObject;\n\nclass Theme {\n async print(platform: string = 'android') {\n const config = await Config.get();\n const themeConfig =\n platform === 'android' ? config.androidTheme : config.iosTheme;\n let usesCustomFontAndroid = false;\n let usesCustomFontIos = false;\n\n const head =\n platform === 'android'\n ? ['Style Item', 'Value', 'Note']\n : ['Style Item', 'Value', 'Note'];\n\n const table = new Table({\n head,\n // prettier-ignore\n chars: { 'mid': '', 'left-mid': '', 'mid-mid': '', 'right-mid': '' },\n });\n\n console.log('Specified theme values:');\n const keyEnum =\n platform === 'android' ? ANDROID_THEME_CONFIG_KEY : IOS_THEME_CONFIG_KEY;\n for (const key in keyEnum) {\n let override =\n themeConfig[key as ANDROID_THEME_CONFIG_KEY | IOS_THEME_CONFIG_KEY];\n let colorOverride = key.includes('Color') || key.includes('color');\n\n if (override) {\n if (colorOverride) {\n override = normalizeColor(override, key);\n } else {\n override = override.toString();\n }\n }\n\n if (key.includes('Font')) {\n if (platform == 'android') {\n usesCustomFontAndroid = true;\n } else {\n usesCustomFontIos = true;\n }\n }\n\n let row;\n\n row = [\n key,\n override\n ? valueColor(colorOverride, override)\n : chalk.yellow('unspecified'),\n key.includes('Font')\n ? chalk.cyan('Fonts that are not built-in need to be installed.')\n : '',\n ];\n\n table.push(row);\n }\n\n console.log(table.toString());\n\n if (usesCustomFontAndroid) {\n console.log(\n chalk.yellow(' NOTE') +\n ': A font customization was made. If the font is not built-in to the Android platform (https://github.com/react-native-training/react-native-fonts#android), then the font(s) must first be installed. A guide to install a font can be found here: https://developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml'\n );\n }\n\n if (usesCustomFontIos) {\n console.log(\n chalk.yellow(' NOTE') +\n ': A font customization was made. If the font is not built-in iOS (https://github.com/react-native-training/react-native-ios), then the font(s) must first be installed. A guide to install a font can be found here: https://developer.apple.com/documentation/uikit/text_display_and_fonts/adding_a_custom_font_to_your_app'\n );\n }\n\n // Add newline for spacing\n console.log('');\n }\n}\n\n// set default print color for non-color overrides\nfunction valueColor(isColorOverride: boolean, override: string) {\n return isColorOverride\n ? chalk.hex(override)(override)\n : chalk.magentaBright(override);\n}\n\nfunction normalizeColor(colorHex: string, themeKey: string) {\n let hex = colorHex;\n if (colorHex[0] === '#') {\n hex = colorHex.slice(1);\n }\n\n if (!COLOR_REGEX.test(hex)) {\n if (themeKey) {\n console.error(\n `Received a color value of ${chalk.yellow(colorHex)} for ${chalk.red(\n themeKey\n )}.\\nFormat must follow standard 6 character hexadecimal color code. Eg. ${chalk\n .bgHex('#FFFFFF')\n .hex('#7E66B7')('#290087')}`\n );\n } else {\n console.error(\n `Received a color value of ${chalk.yellow(\n colorHex\n )}.\\nFormat must follow standard 6 character hexadecimal color code. Eg. ${chalk\n .bgHex('#FFFFFF')\n .hex('#7E66B7')('#290087')}`\n );\n }\n console.log('');\n process.exit(1);\n }\n\n return colorHex;\n}\n\nexport default new Theme();\n"]}
@@ -0,0 +1,33 @@
1
+ import Config from './Config';
2
+ import { TOOL_CHOICE, whatWouldYouLikePrompt } from './prompts';
3
+ import AndroidThemeGenerator from './tools/AndroidThemeGenerator';
4
+ import IosThemeInstructions from './tools/IosThemeInstructions';
5
+ console.log('');
6
+ console.log('============================================');
7
+ console.log('Persona React Native SDK customization tool.');
8
+ console.log('============================================');
9
+ console.log('');
10
+
11
+ const run = async () => {
12
+ // Run this once to print warning messages if it's not configured.
13
+ await Config.get();
14
+ const {
15
+ choice
16
+ } = await whatWouldYouLikePrompt();
17
+
18
+ switch (choice) {
19
+ case TOOL_CHOICE.AndroidTheme:
20
+ await AndroidThemeGenerator.run();
21
+ break;
22
+
23
+ case TOOL_CHOICE.iosTheme:
24
+ await IosThemeInstructions.run();
25
+ break;
26
+
27
+ default:
28
+ return;
29
+ }
30
+ };
31
+
32
+ run();
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"names":["Config","TOOL_CHOICE","whatWouldYouLikePrompt","AndroidThemeGenerator","IosThemeInstructions","console","log","run","get","choice","AndroidTheme","iosTheme"],"mappings":"AAAA,OAAOA,MAAP,MAAmB,UAAnB;AACA,SAASC,WAAT,EAAsBC,sBAAtB,QAAoD,WAApD;AACA,OAAOC,qBAAP,MAAkC,+BAAlC;AACA,OAAOC,oBAAP,MAAiC,8BAAjC;AAEAC,OAAO,CAACC,GAAR,CAAY,EAAZ;AACAD,OAAO,CAACC,GAAR,CAAY,8CAAZ;AACAD,OAAO,CAACC,GAAR,CAAY,8CAAZ;AACAD,OAAO,CAACC,GAAR,CAAY,8CAAZ;AACAD,OAAO,CAACC,GAAR,CAAY,EAAZ;;AAEA,MAAMC,GAAG,GAAG,YAAY;AACtB;AACA,QAAMP,MAAM,CAACQ,GAAP,EAAN;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAAa,MAAMP,sBAAsB,EAA/C;;AAEA,UAAQO,MAAR;AACE,SAAKR,WAAW,CAACS,YAAjB;AACE,YAAMP,qBAAqB,CAACI,GAAtB,EAAN;AACA;;AACF,SAAKN,WAAW,CAACU,QAAjB;AACE,YAAMP,oBAAoB,CAACG,GAArB,EAAN;AACA;;AACF;AACE;AARJ;AAUD,CAhBD;;AAkBAA,GAAG","sourcesContent":["import Config from './Config';\nimport { TOOL_CHOICE, whatWouldYouLikePrompt } from './prompts';\nimport AndroidThemeGenerator from './tools/AndroidThemeGenerator';\nimport IosThemeInstructions from './tools/IosThemeInstructions';\n\nconsole.log('');\nconsole.log('============================================');\nconsole.log('Persona React Native SDK customization tool.');\nconsole.log('============================================');\nconsole.log('');\n\nconst run = async () => {\n // Run this once to print warning messages if it's not configured.\n await Config.get();\n\n const { choice } = await whatWouldYouLikePrompt();\n\n switch (choice) {\n case TOOL_CHOICE.AndroidTheme:\n await AndroidThemeGenerator.run();\n break;\n case TOOL_CHOICE.iosTheme:\n await IosThemeInstructions.run();\n break;\n default:\n return;\n }\n};\n\nrun();\n"]}
@@ -0,0 +1,31 @@
1
+ import inquirer from 'inquirer';
2
+ export const TOOL_CHOICE = {
3
+ AndroidTheme: 'Update Android theme',
4
+ iosTheme: 'Update iOS theme'
5
+ };
6
+ export async function whatWouldYouLikePrompt() {
7
+ const questions = {
8
+ name: 'choice',
9
+ type: 'list',
10
+ choices: [TOOL_CHOICE.AndroidTheme, TOOL_CHOICE.iosTheme],
11
+ message: 'What would you like to do?'
12
+ };
13
+ return inquirer.prompt(questions);
14
+ }
15
+ export async function confirmThemeValues() {
16
+ const questions = {
17
+ name: 'isConfirmed',
18
+ type: 'confirm',
19
+ message: 'Do these values look right?'
20
+ };
21
+ return inquirer.prompt(questions);
22
+ }
23
+ export async function confirmResourceFiles() {
24
+ const questions = {
25
+ name: 'isConfirmed',
26
+ type: 'confirm',
27
+ message: `Continue?`
28
+ };
29
+ return inquirer.prompt(questions);
30
+ }
31
+ //# sourceMappingURL=prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["prompts.ts"],"names":["inquirer","TOOL_CHOICE","AndroidTheme","iosTheme","whatWouldYouLikePrompt","questions","name","type","choices","message","prompt","confirmThemeValues","confirmResourceFiles"],"mappings":"AAAA,OAAOA,QAAP,MAA6C,UAA7C;AAEA,OAAO,MAAMC,WAAW,GAAG;AACzBC,EAAAA,YAAY,EAAE,sBADW;AAEzBC,EAAAA,QAAQ,EAAE;AAFe,CAApB;AAIP,OAAO,eAAeC,sBAAf,GAAwC;AAC7C,QAAMC,SAAS,GAAG;AAChBC,IAAAA,IAAI,EAAE,QADU;AAEhBC,IAAAA,IAAI,EAAE,MAFU;AAGhBC,IAAAA,OAAO,EAAE,CAACP,WAAW,CAACC,YAAb,EAA2BD,WAAW,CAACE,QAAvC,CAHO;AAIhBM,IAAAA,OAAO,EAAE;AAJO,GAAlB;AAOA,SAAOT,QAAQ,CAACU,MAAT,CAAgBL,SAAhB,CAAP;AACD;AAED,OAAO,eAAeM,kBAAf,GAAoC;AACzC,QAAMN,SAAS,GAAG;AAChBC,IAAAA,IAAI,EAAE,aADU;AAEhBC,IAAAA,IAAI,EAAE,SAFU;AAGhBE,IAAAA,OAAO,EAAE;AAHO,GAAlB;AAMA,SAAOT,QAAQ,CAACU,MAAT,CAAgBL,SAAhB,CAAP;AACD;AAED,OAAO,eAAeO,oBAAf,GAAsC;AAC3C,QAAMP,SAAS,GAAG;AAChBC,IAAAA,IAAI,EAAE,aADU;AAEhBC,IAAAA,IAAI,EAAE,SAFU;AAGhBE,IAAAA,OAAO,EAAG;AAHM,GAAlB;AAMA,SAAOT,QAAQ,CAACU,MAAT,CAAgBL,SAAhB,CAAP;AACD","sourcesContent":["import inquirer, { QuestionCollection } from 'inquirer';\n\nexport const TOOL_CHOICE = {\n AndroidTheme: 'Update Android theme',\n iosTheme: 'Update iOS theme',\n};\nexport async function whatWouldYouLikePrompt() {\n const questions = {\n name: 'choice',\n type: 'list',\n choices: [TOOL_CHOICE.AndroidTheme, TOOL_CHOICE.iosTheme],\n message: 'What would you like to do?',\n } as QuestionCollection;\n\n return inquirer.prompt(questions);\n}\n\nexport async function confirmThemeValues() {\n const questions = {\n name: 'isConfirmed',\n type: 'confirm',\n message: 'Do these values look right?',\n } as QuestionCollection;\n\n return inquirer.prompt(questions);\n}\n\nexport async function confirmResourceFiles() {\n const questions = {\n name: 'isConfirmed',\n type: 'confirm',\n message: `Continue?`,\n } as QuestionCollection;\n\n return inquirer.prompt(questions);\n}\n"]}
@@ -0,0 +1,72 @@
1
+ import fs from 'fs';
2
+ import chalk from 'chalk';
3
+ import path from 'path';
4
+ import Theme from '../Theme';
5
+ import { confirmThemeValues, confirmResourceFiles } from '../prompts';
6
+ import AndroidResourcePrinter from '../AndroidResourcePrinter';
7
+ import Configuration from '../Config';
8
+ const ANDROID_STYLES_RESOURCE_PATH = './android/app/src/main/res/values/styles_persona.xml';
9
+ const ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH = './android/app/src/main/res/drawable/rn_persona_button.xml';
10
+ const ANDROID_BUTTON_COLOR_RESOURCE_PATH = './android/app/src/main/res/color/rn_persona_button.xml';
11
+
12
+ class ThemeGenerator {
13
+ async run() {
14
+ await Theme.print();
15
+ const {
16
+ isConfirmed: themeValuesConfirmed
17
+ } = await confirmThemeValues();
18
+
19
+ if (!themeValuesConfirmed) {
20
+ console.log(chalk.yellow('\nPlease adjust the values in package.json.\n'));
21
+ return;
22
+ }
23
+
24
+ console.log(`\n${chalk.yellow('Creating an Android Resource files for your project at:')}\n
25
+ - ${ANDROID_STYLES_RESOURCE_PATH}
26
+ - ${ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH}
27
+ - ${ANDROID_BUTTON_COLOR_RESOURCE_PATH}\n`);
28
+ console.log('Building your application with this resource file themes your Persona Inquiry flow.\n');
29
+ const config = await Configuration.get();
30
+ const theme = config.androidTheme;
31
+ const {
32
+ style,
33
+ buttonDrawable,
34
+ buttonColor
35
+ } = new AndroidResourcePrinter(theme).process();
36
+ let {
37
+ isConfirmed: confirmed
38
+ } = await confirmResourceFiles();
39
+
40
+ if (!confirmed) {
41
+ process.exit(1);
42
+ } // Add a line after confirmation
43
+
44
+
45
+ console.log('');
46
+ fs.mkdirSync(path.dirname(ANDROID_STYLES_RESOURCE_PATH), {
47
+ recursive: true
48
+ });
49
+ fs.writeFileSync(ANDROID_STYLES_RESOURCE_PATH, style.end({
50
+ prettyPrint: true
51
+ }));
52
+ console.log(`${chalk.green('Saved an Android style file at path:')} ${ANDROID_STYLES_RESOURCE_PATH}.`);
53
+ fs.mkdirSync(path.dirname(ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH), {
54
+ recursive: true
55
+ });
56
+ fs.writeFileSync(ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH, buttonDrawable.end({
57
+ prettyPrint: true
58
+ }));
59
+ console.log(`${chalk.green('Saved an Android drawable file at path:')} ${ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH}.`);
60
+ fs.mkdirSync(path.dirname(ANDROID_BUTTON_COLOR_RESOURCE_PATH), {
61
+ recursive: true
62
+ });
63
+ fs.writeFileSync(ANDROID_BUTTON_COLOR_RESOURCE_PATH, buttonColor.end({
64
+ prettyPrint: true
65
+ }));
66
+ console.log(`${chalk.green('Saved an Android color file at path:')} ${ANDROID_BUTTON_COLOR_RESOURCE_PATH}.`);
67
+ }
68
+
69
+ }
70
+
71
+ export default new ThemeGenerator();
72
+ //# sourceMappingURL=AndroidThemeGenerator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["AndroidThemeGenerator.ts"],"names":["fs","chalk","path","Theme","confirmThemeValues","confirmResourceFiles","AndroidResourcePrinter","Configuration","ANDROID_STYLES_RESOURCE_PATH","ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH","ANDROID_BUTTON_COLOR_RESOURCE_PATH","ThemeGenerator","run","print","isConfirmed","themeValuesConfirmed","console","log","yellow","config","get","theme","androidTheme","style","buttonDrawable","buttonColor","process","confirmed","exit","mkdirSync","dirname","recursive","writeFileSync","end","prettyPrint","green"],"mappings":"AAAA,OAAOA,EAAP,MAAe,IAAf;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,OAAOC,IAAP,MAAiB,MAAjB;AAEA,OAAOC,KAAP,MAA0C,UAA1C;AACA,SAASC,kBAAT,EAA6BC,oBAA7B,QAAyD,YAAzD;AACA,OAAOC,sBAAP,MAAmC,2BAAnC;AACA,OAAOC,aAAP,MAA0B,WAA1B;AAEA,MAAMC,4BAA4B,GAChC,sDADF;AAEA,MAAMC,qCAAqC,GACzC,2DADF;AAEA,MAAMC,kCAAkC,GACtC,wDADF;;AAGA,MAAMC,cAAN,CAAqB;AACV,QAAHC,GAAG,GAAG;AACV,UAAMT,KAAK,CAACU,KAAN,EAAN;AAEA,UAAM;AAAEC,MAAAA,WAAW,EAAEC;AAAf,QAAwC,MAAMX,kBAAkB,EAAtE;;AAEA,QAAI,CAACW,oBAAL,EAA2B;AACzBC,MAAAA,OAAO,CAACC,GAAR,CACEhB,KAAK,CAACiB,MAAN,CAAa,+CAAb,CADF;AAGA;AACD;;AAEDF,IAAAA,OAAO,CAACC,GAAR,CACG,KAAIhB,KAAK,CAACiB,MAAN,CACH,yDADG,CAEH;AACR,UAAUV,4BAA6B;AACvC,UAAUC,qCAAsC;AAChD,UAAUC,kCAAmC,IANzC;AAQAM,IAAAA,OAAO,CAACC,GAAR,CACE,uFADF;AAIA,UAAME,MAAM,GAAG,MAAMZ,aAAa,CAACa,GAAd,EAArB;AACA,UAAMC,KAAK,GAAGF,MAAM,CAACG,YAArB;AAEA,UAAM;AAAEC,MAAAA,KAAF;AAASC,MAAAA,cAAT;AAAyBC,MAAAA;AAAzB,QAAyC,IAAInB,sBAAJ,CAC7Ce,KAD6C,EAE7CK,OAF6C,EAA/C;AAIA,QAAI;AAAEZ,MAAAA,WAAW,EAAEa;AAAf,QAA6B,MAAMtB,oBAAoB,EAA3D;;AAEA,QAAI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D;;AAhFkB;;AAmFrB,eAAe,IAAIC,cAAJ,EAAf","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_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_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, buttonColor } = new AndroidResourcePrinter(\n theme\n ).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(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,37 @@
1
+ import Theme from '../Theme';
2
+ import { confirmThemeValues } from '../prompts';
3
+ import chalk from 'chalk';
4
+
5
+ class IosThemeInstructions {
6
+ async run() {
7
+ await Theme.print('ios');
8
+ const {
9
+ isConfirmed: themeValuesConfirmed
10
+ } = await confirmThemeValues();
11
+
12
+ if (!themeValuesConfirmed) {
13
+ console.log(chalk.yellow('\nPlease adjust the values in package.json.\n'));
14
+ return;
15
+ }
16
+
17
+ console.log(`\n${chalk.yellow('To theme the Persona Inquiry flow for iOS:')}`);
18
+ console.log('Add the theme values to the Persona Inquiry SDK client by using the `.iosTheme` builder function');
19
+ console.log(`
20
+ ${chalk.green(`+ import { persona } from '../package.json'`)}
21
+ ...
22
+ Inquiry.fromTemplate(selectedTemplateId)
23
+ .onSuccess(handleSuccess)
24
+ .onCanceled(handleCanceled)
25
+ .onFailed(handleFailed)
26
+ .onError(handleError)
27
+ ${chalk.green('+ .iosTheme(persona.iosTheme)')}
28
+ .build()
29
+ .start();
30
+ ...
31
+ `);
32
+ }
33
+
34
+ }
35
+
36
+ export default new IosThemeInstructions();
37
+ //# sourceMappingURL=IosThemeInstructions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["IosThemeInstructions.ts"],"names":["Theme","confirmThemeValues","chalk","IosThemeInstructions","run","print","isConfirmed","themeValuesConfirmed","console","log","yellow","green"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,UAAlB;AACA,SAASC,kBAAT,QAAmC,YAAnC;AACA,OAAOC,KAAP,MAAkB,OAAlB;;AAEA,MAAMC,oBAAN,CAA2B;AAChB,QAAHC,GAAG,GAAG;AACV,UAAMJ,KAAK,CAACK,KAAN,CAAY,KAAZ,CAAN;AAEA,UAAM;AAAEC,MAAAA,WAAW,EAAEC;AAAf,QAAwC,MAAMN,kBAAkB,EAAtE;;AAEA,QAAI,CAACM,oBAAL,EAA2B;AACzBC,MAAAA,OAAO,CAACC,GAAR,CACEP,KAAK,CAACQ,MAAN,CAAa,+CAAb,CADF;AAGA;AACD;;AAEDF,IAAAA,OAAO,CAACC,GAAR,CACG,KAAIP,KAAK,CAACQ,MAAN,CAAa,4CAAb,CAA2D,EADlE;AAGAF,IAAAA,OAAO,CAACC,GAAR,CACE,kGADF;AAIAD,IAAAA,OAAO,CAACC,GAAR,CAAa;AACjB,MAAMP,KAAK,CAACS,KAAN,CAAa,6CAAb,CAA2D;AACjE;AACA;AACA;AACA;AACA;AACA;AACA,MAAMT,KAAK,CAACS,KAAN,CAAY,iCAAZ,CAA+C;AACrD;AACA;AACA;AACA,KAZI;AAaD;;AAjCwB;;AAoC3B,eAAe,IAAIR,oBAAJ,EAAf","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 .onCanceled(handleCanceled)\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"]}
File without changes
File without changes
@@ -1,5 +1,5 @@
1
- import type { AndroidThemeObject } from "../Theme";
2
- import type { XMLBuilder } from "xmlbuilder2/lib/interfaces";
1
+ import type { AndroidThemeObject } from './Theme';
2
+ import type { XMLBuilder } from 'xmlbuilder2/lib/interfaces';
3
3
  declare class AndroidResourcePrinter {
4
4
  theme: AndroidThemeObject;
5
5
  root: XMLBuilder;
@@ -1,4 +1,4 @@
1
- import inquirer from "inquirer";
1
+ import inquirer from 'inquirer';
2
2
  export declare const TOOL_CHOICE: {
3
3
  AndroidTheme: string;
4
4
  iosTheme: string;
File without changes
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.2.2",
4
+ "version": "2.2.3",
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",
@@ -9,7 +9,7 @@
9
9
  "react-native": "src/index",
10
10
  "source": "src/index",
11
11
  "bin": {
12
- "persona-tool": "./bin/persona-tool"
12
+ "persona-tool": "bin/persona-tool"
13
13
  },
14
14
  "scripts": {
15
15
  "test": "jest",
@@ -26,7 +26,6 @@
26
26
  "android",
27
27
  "ios",
28
28
  "bin",
29
- "persona-tools",
30
29
  "RNPersonaInquiry2.podspec",
31
30
  "!lib/typescript/example",
32
31
  "!android/build",