react-native-persona 2.2.0 → 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 (64) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +149 -2
  3. package/RNPersonaInquiry2.podspec +1 -1
  4. package/android/build.gradle +1 -2
  5. package/android/src/main/java/com/withpersona/sdk2/reactnative/PersonaInquiryModule2.java +8 -2
  6. package/bin/persona-tool +1 -2
  7. package/ios/PersonaInquiry2.swift +4 -0
  8. package/lib/commonjs/index.js +66 -4
  9. package/lib/commonjs/index.js.map +1 -1
  10. package/lib/commonjs/persona-tool/AndroidResourcePrinter.js +497 -0
  11. package/lib/commonjs/persona-tool/AndroidResourcePrinter.js.map +1 -0
  12. package/lib/commonjs/persona-tool/Config.js +95 -0
  13. package/lib/commonjs/persona-tool/Config.js.map +1 -0
  14. package/lib/commonjs/persona-tool/Theme.js +199 -0
  15. package/lib/commonjs/persona-tool/Theme.js.map +1 -0
  16. package/lib/commonjs/persona-tool/index.js +41 -0
  17. package/lib/commonjs/persona-tool/index.js.map +1 -0
  18. package/lib/commonjs/persona-tool/prompts.js +48 -0
  19. package/lib/commonjs/persona-tool/prompts.js.map +1 -0
  20. package/lib/commonjs/persona-tool/tools/AndroidThemeGenerator.js +99 -0
  21. package/lib/commonjs/persona-tool/tools/AndroidThemeGenerator.js.map +1 -0
  22. package/lib/commonjs/persona-tool/tools/IosThemeInstructions.js +50 -0
  23. package/lib/commonjs/persona-tool/tools/IosThemeInstructions.js.map +1 -0
  24. package/lib/commonjs/versions.js +25 -0
  25. package/lib/commonjs/versions.js.map +1 -0
  26. package/lib/module/index.js +58 -3
  27. package/lib/module/index.js.map +1 -1
  28. package/lib/module/persona-tool/AndroidResourcePrinter.js +489 -0
  29. package/lib/module/persona-tool/AndroidResourcePrinter.js.map +1 -0
  30. package/lib/module/persona-tool/Config.js +82 -0
  31. package/lib/module/persona-tool/Config.js.map +1 -0
  32. package/lib/module/persona-tool/Theme.js +183 -0
  33. package/lib/module/persona-tool/Theme.js.map +1 -0
  34. package/lib/module/persona-tool/index.js +33 -0
  35. package/lib/module/persona-tool/index.js.map +1 -0
  36. package/lib/module/persona-tool/prompts.js +31 -0
  37. package/lib/module/persona-tool/prompts.js.map +1 -0
  38. package/lib/module/persona-tool/tools/AndroidThemeGenerator.js +72 -0
  39. package/lib/module/persona-tool/tools/AndroidThemeGenerator.js.map +1 -0
  40. package/lib/module/persona-tool/tools/IosThemeInstructions.js +37 -0
  41. package/lib/module/persona-tool/tools/IosThemeInstructions.js.map +1 -0
  42. package/lib/module/versions.js +14 -0
  43. package/lib/module/versions.js.map +1 -0
  44. package/lib/typescript/{src/fields.d.ts → fields.d.ts} +0 -0
  45. package/lib/typescript/{src/index.d.ts → index.d.ts} +50 -0
  46. package/lib/typescript/{persona-tools/lib → persona-tool}/AndroidResourcePrinter.d.ts +2 -2
  47. package/lib/typescript/{persona-tools → persona-tool}/Config.d.ts +0 -0
  48. package/lib/typescript/{persona-tools → persona-tool}/Theme.d.ts +0 -0
  49. package/lib/typescript/{persona-tools → persona-tool}/index.d.ts +0 -0
  50. package/lib/typescript/{persona-tools/lib → persona-tool}/prompts.d.ts +1 -1
  51. package/lib/typescript/{persona-tools → persona-tool}/tools/AndroidThemeGenerator.d.ts +0 -0
  52. package/lib/typescript/{persona-tools → persona-tool}/tools/IosThemeInstructions.d.ts +0 -0
  53. package/lib/typescript/{src/util.d.ts → util.d.ts} +0 -0
  54. package/lib/typescript/versions.d.ts +6 -0
  55. package/package.json +4 -5
  56. package/src/index.ts +65 -3
  57. package/{persona-tools/lib → src/persona-tool}/AndroidResourcePrinter.ts +182 -182
  58. package/{persona-tools → src/persona-tool}/Config.ts +0 -0
  59. package/{persona-tools → src/persona-tool}/Theme.ts +0 -0
  60. package/{persona-tools → src/persona-tool}/index.ts +1 -1
  61. package/{persona-tools/lib → src/persona-tool}/prompts.ts +11 -11
  62. package/{persona-tools → src/persona-tool}/tools/AndroidThemeGenerator.ts +2 -2
  63. package/{persona-tools → src/persona-tool}/tools/IosThemeInstructions.ts +1 -1
  64. package/src/versions.ts +12 -0
@@ -1,5 +1,7 @@
1
1
  import { Fields } from './fields';
2
2
  export { Fields };
3
+ import { Versions } from './versions';
4
+ export { Versions };
3
5
  declare const Unique: unique symbol;
4
6
  export declare type Opaque<T, Tag> = T & {
5
7
  [Unique]: Tag;
@@ -58,6 +60,42 @@ export declare class Inquiry {
58
60
  private onErrorListener?;
59
61
  constructor(options: InquiryOptions);
60
62
  private clearListeners;
63
+ /**
64
+ * Create an Inquiry flow builder based on a template ID.
65
+ *
66
+ * You can find your template ID on the Dashboard under Inquiries > Templates.
67
+ * {@link https://app.withpersona.com/dashboard/inquiry-templates}
68
+ *
69
+ * @param templateId template ID from your Persona Dashboard
70
+ * @return builder for the Inquiry flow
71
+ */
72
+ static fromTemplate(templateId: string): TemplateBuilder;
73
+ /**
74
+ * Create an Inquiry flow builder based on a template ID version.
75
+ *
76
+ * You can find your template ID version on the Dashboard under the
77
+ * settings view of a specific template.
78
+ * {@link https://app.withpersona.com/dashboard/inquiry-templates}
79
+ *
80
+ * @param templateVersion template version from your Persona Dashboard
81
+ * @return builder for the Inquiry flow
82
+ */
83
+ static fromTemplateVersion(templateVersion: string): TemplateBuilder;
84
+ /**
85
+ * Create an Inquiry flow builder based on an inquiry ID.
86
+ *
87
+ * You will need to generate the inquiry ID on the server. To try it out, you can create an
88
+ * inquiry from the Persona Dashboard under "Inquiries". Click on the "Create Inquiry" button
89
+ * and copy the inquiry ID from the URL.
90
+ * {@link https://app.withpersona.com/dashboard/inquiries}
91
+ *
92
+ * @param inquiryId inquiry ID from your server
93
+ * @return builder for the Inquiry flow
94
+ */
95
+ static fromInquiry(inquiryId: string): InquiryBuilder;
96
+ /**
97
+ * Launch the Persona Inquiry.
98
+ */
61
99
  start(): void;
62
100
  }
63
101
  declare class InquiryBuilder {
@@ -100,9 +138,21 @@ declare class TemplateBuilder {
100
138
  iosTheme(themeObject: Object): TemplateBuilder;
101
139
  build(): Inquiry;
102
140
  }
141
+ /**
142
+ * @deprecated Use the `Inquiry` static methods instead
143
+ */
103
144
  declare namespace InquiryBuilders {
145
+ /**
146
+ * @deprecated Use {@link Inquiry#fromInquiry} instead
147
+ */
104
148
  function fromInquiry(inquiryId: string): InquiryBuilder;
149
+ /**
150
+ * @deprecated Use {@link Inquiry#fromTemplate} instead
151
+ */
105
152
  function fromTemplate(templateId: string): TemplateBuilder;
153
+ /**
154
+ * @deprecated Use {@link Inquiry#fromTemplateVersion} instead
155
+ */
106
156
  function fromTemplateVersion(templateVersion: string): TemplateBuilder;
107
157
  }
108
158
  export default InquiryBuilders;
@@ -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
@@ -0,0 +1,6 @@
1
+ export declare class Versions {
2
+ /**
3
+ * @return version of the underlying Android/iOS Inquiry SDK
4
+ */
5
+ static nativeSdkVersion(): String;
6
+ }
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.0",
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",
@@ -44,10 +43,10 @@
44
43
  "name": "Persona Identities, Inc.",
45
44
  "email": "support@withpersona.com"
46
45
  },
47
- "homepage": "https://docs.withpersona.com/docs/react-native-sdk-v1-integration",
46
+ "homepage": "https://docs.withpersona.com/docs/react-native-sdk-integration",
48
47
  "license": "MIT",
49
48
  "licenseFilename": "LICENSE",
50
- "readmeFilename": "README.md",
49
+ "readmeFilename": "PUBLIC.md",
51
50
  "peerDependencies": {
52
51
  "react": "*",
53
52
  "react-native": "*"
package/src/index.ts CHANGED
@@ -5,8 +5,13 @@ import {
5
5
  } from 'react-native';
6
6
  import { processThemeValues } from './util';
7
7
  import { Fields, InquiryField, RawInquiryField } from './fields';
8
+
8
9
  export { Fields };
9
10
 
11
+ import { Versions } from './versions';
12
+
13
+ export { Versions };
14
+
10
15
  const { PersonaInquiry2 } = NativeModules;
11
16
 
12
17
  // Using Opaque types + Smart Constructor enforces validation at
@@ -174,6 +179,51 @@ export class Inquiry {
174
179
  if (this.onErrorListener) this.onErrorListener.remove();
175
180
  }
176
181
 
182
+ /**
183
+ * Create an Inquiry flow builder based on a template ID.
184
+ *
185
+ * You can find your template ID on the Dashboard under Inquiries > Templates.
186
+ * {@link https://app.withpersona.com/dashboard/inquiry-templates}
187
+ *
188
+ * @param templateId template ID from your Persona Dashboard
189
+ * @return builder for the Inquiry flow
190
+ */
191
+ static fromTemplate(templateId: string) {
192
+ return new TemplateBuilder(makeTemplateId(templateId), null);
193
+ }
194
+
195
+ /**
196
+ * Create an Inquiry flow builder based on a template ID version.
197
+ *
198
+ * You can find your template ID version on the Dashboard under the
199
+ * settings view of a specific template.
200
+ * {@link https://app.withpersona.com/dashboard/inquiry-templates}
201
+ *
202
+ * @param templateVersion template version from your Persona Dashboard
203
+ * @return builder for the Inquiry flow
204
+ */
205
+ static fromTemplateVersion(templateVersion: string) {
206
+ return new TemplateBuilder(null, makeTemplateVersion(templateVersion));
207
+ }
208
+
209
+ /**
210
+ * Create an Inquiry flow builder based on an inquiry ID.
211
+ *
212
+ * You will need to generate the inquiry ID on the server. To try it out, you can create an
213
+ * inquiry from the Persona Dashboard under "Inquiries". Click on the "Create Inquiry" button
214
+ * and copy the inquiry ID from the URL.
215
+ * {@link https://app.withpersona.com/dashboard/inquiries}
216
+ *
217
+ * @param inquiryId inquiry ID from your server
218
+ * @return builder for the Inquiry flow
219
+ */
220
+ static fromInquiry(inquiryId: string) {
221
+ return new InquiryBuilder(makeInquiryId(inquiryId));
222
+ }
223
+
224
+ /**
225
+ * Launch the Persona Inquiry.
226
+ */
177
227
  start() {
178
228
  this.onCompleteListener = eventEmitter.addListener(
179
229
  'onComplete',
@@ -407,17 +457,29 @@ class TemplateBuilder {
407
457
  }
408
458
  }
409
459
 
460
+ /**
461
+ * @deprecated Use the `Inquiry` static methods instead
462
+ */
410
463
  namespace InquiryBuilders {
464
+ /**
465
+ * @deprecated Use {@link Inquiry#fromInquiry} instead
466
+ */
411
467
  export function fromInquiry(inquiryId: string) {
412
- return new InquiryBuilder(makeInquiryId(inquiryId));
468
+ return Inquiry.fromInquiry(inquiryId);
413
469
  }
414
470
 
471
+ /**
472
+ * @deprecated Use {@link Inquiry#fromTemplate} instead
473
+ */
415
474
  export function fromTemplate(templateId: string) {
416
- return new TemplateBuilder(makeTemplateId(templateId), null);
475
+ return Inquiry.fromTemplate(templateId);
417
476
  }
418
477
 
478
+ /**
479
+ * @deprecated Use {@link Inquiry#fromTemplateVersion} instead
480
+ */
419
481
  export function fromTemplateVersion(templateVersion: string) {
420
- return new TemplateBuilder(null, makeTemplateVersion(templateVersion));
482
+ return Inquiry.fromTemplateVersion(templateVersion);
421
483
  }
422
484
  }
423
485