react-native-persona 2.1.3 → 2.2.2

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 (72) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +156 -2
  3. package/{RNPersonaInquiry.podspec → RNPersonaInquiry2.podspec} +2 -2
  4. package/android/README.md +14 -0
  5. package/android/build.gradle +22 -99
  6. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  7. package/android/src/main/AndroidManifest.xml +1 -1
  8. package/android/src/main/java/com/withpersona/{sdk/reactnative/PersonaInquiryModule.java → sdk2/reactnative/PersonaInquiryModule2.java} +24 -14
  9. package/android/src/main/java/com/withpersona/{sdk/reactnative/PersonaInquiryPackage.java → sdk2/reactnative/PersonaInquiryPackage2.java} +3 -3
  10. package/android/src/main/java/com/withpersona/{sdk → sdk2}/reactnative/exceptions/InvalidConfiguration.java +1 -1
  11. package/android/src/main/res/values/theme.xml +2 -3
  12. package/ios/{PersonaInquiry.swift → PersonaInquiry2.swift} +17 -13
  13. package/ios/PersonaInquiryBridge.m +1 -1
  14. package/lib/commonjs/fields.js +141 -0
  15. package/lib/commonjs/fields.js.map +1 -0
  16. package/lib/commonjs/index.js +475 -0
  17. package/lib/commonjs/index.js.map +1 -0
  18. package/lib/commonjs/util.js +36 -0
  19. package/lib/commonjs/util.js.map +1 -0
  20. package/lib/commonjs/versions.js +25 -0
  21. package/lib/commonjs/versions.js.map +1 -0
  22. package/lib/module/fields.js +132 -0
  23. package/lib/module/fields.js.map +1 -0
  24. package/lib/module/index.js +435 -0
  25. package/lib/module/index.js.map +1 -0
  26. package/lib/module/util.js +29 -0
  27. package/lib/module/util.js.map +1 -0
  28. package/lib/module/versions.js +14 -0
  29. package/lib/module/versions.js.map +1 -0
  30. package/{generatedTypes/persona-tools/config.d.ts → lib/typescript/persona-tools/Config.d.ts} +0 -0
  31. package/{generatedTypes → lib/typescript}/persona-tools/Theme.d.ts +0 -0
  32. package/{generatedTypes → lib/typescript}/persona-tools/index.d.ts +0 -0
  33. package/{generatedTypes → lib/typescript}/persona-tools/lib/AndroidResourcePrinter.d.ts +2 -2
  34. package/{generatedTypes → lib/typescript}/persona-tools/lib/prompts.d.ts +0 -0
  35. package/{generatedTypes → lib/typescript}/persona-tools/tools/AndroidThemeGenerator.d.ts +0 -0
  36. package/{generatedTypes → lib/typescript}/persona-tools/tools/IosThemeInstructions.d.ts +0 -0
  37. package/{generatedTypes → lib/typescript}/src/fields.d.ts +0 -0
  38. package/{generatedTypes → lib/typescript}/src/index.d.ts +56 -5
  39. package/{generatedTypes → lib/typescript}/src/util.d.ts +0 -0
  40. package/lib/typescript/src/versions.d.ts +6 -0
  41. package/package.json +74 -18
  42. package/persona-tools/{config.ts → Config.ts} +7 -7
  43. package/persona-tools/Theme.ts +107 -107
  44. package/persona-tools/index.ts +9 -9
  45. package/persona-tools/lib/AndroidResourcePrinter.ts +4 -4
  46. package/persona-tools/tools/AndroidThemeGenerator.ts +18 -18
  47. package/persona-tools/tools/IosThemeInstructions.ts +8 -8
  48. package/src/fields.ts +7 -7
  49. package/src/index.ts +89 -26
  50. package/src/util.ts +2 -2
  51. package/src/versions.ts +12 -0
  52. package/generatedTypes/persona-tools/lib/AndroidResourcePrinter.spec.d.ts +0 -1
  53. package/generatedTypes/src/fields.spec.d.ts +0 -1
  54. package/generatedTypes/src/util.spec.d.ts +0 -1
  55. package/jest.config.js +0 -10
  56. package/persona-tools/Theme.js +0 -186
  57. package/persona-tools/config.js +0 -72
  58. package/persona-tools/index.js +0 -30
  59. package/persona-tools/lib/AndroidResourcePrinter.js +0 -573
  60. package/persona-tools/lib/AndroidResourcePrinter.spec.js +0 -914
  61. package/persona-tools/lib/AndroidResourcePrinter.spec.ts +0 -952
  62. package/persona-tools/lib/prompts.js +0 -39
  63. package/persona-tools/tools/AndroidThemeGenerator.js +0 -55
  64. package/persona-tools/tools/IosThemeInstructions.js +0 -34
  65. package/src/fields.js +0 -88
  66. package/src/fields.spec.js +0 -18
  67. package/src/fields.spec.ts +0 -17
  68. package/src/index.js +0 -271
  69. package/src/util.js +0 -29
  70. package/src/util.spec.js +0 -17
  71. package/src/util.spec.ts +0 -22
  72. package/tsconfig.json +0 -29
@@ -1,39 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.confirmResourceFiles = exports.confirmThemeValues = exports.whatWouldYouLikePrompt = exports.TOOL_CHOICE = void 0;
7
- const inquirer_1 = __importDefault(require("inquirer"));
8
- exports.TOOL_CHOICE = {
9
- AndroidTheme: "Update Android theme",
10
- iosTheme: "Update iOS theme",
11
- };
12
- async function whatWouldYouLikePrompt() {
13
- const questions = {
14
- name: "choice",
15
- type: "list",
16
- choices: [exports.TOOL_CHOICE.AndroidTheme, exports.TOOL_CHOICE.iosTheme],
17
- message: "What would you like to do?",
18
- };
19
- return inquirer_1.default.prompt(questions);
20
- }
21
- exports.whatWouldYouLikePrompt = whatWouldYouLikePrompt;
22
- async function confirmThemeValues() {
23
- const questions = {
24
- name: "isConfirmed",
25
- type: "confirm",
26
- message: "Do these values look right?",
27
- };
28
- return inquirer_1.default.prompt(questions);
29
- }
30
- exports.confirmThemeValues = confirmThemeValues;
31
- async function confirmResourceFiles() {
32
- const questions = {
33
- name: "isConfirmed",
34
- type: "confirm",
35
- message: `Continue?`,
36
- };
37
- return inquirer_1.default.prompt(questions);
38
- }
39
- exports.confirmResourceFiles = confirmResourceFiles;
@@ -1,55 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const fs_1 = __importDefault(require("fs"));
7
- const chalk_1 = __importDefault(require("chalk"));
8
- const path_1 = __importDefault(require("path"));
9
- const Theme_1 = __importDefault(require("../Theme"));
10
- const prompts_1 = require("../lib/prompts");
11
- const AndroidResourcePrinter_1 = __importDefault(require("../lib/AndroidResourcePrinter"));
12
- const config_1 = __importDefault(require("../config"));
13
- const ANDROID_STYLES_RESOURCE_PATH = "./android/app/src/main/res/values/styles_persona.xml";
14
- const ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH = "./android/app/src/main/res/drawable/rn_persona_button.xml";
15
- const ANDROID_BUTTON_COLOR_RESOURCE_PATH = "./android/app/src/main/res/color/rn_persona_button.xml";
16
- class ThemeGenerator {
17
- async run() {
18
- await Theme_1.default.print();
19
- const { isConfirmed: themeValuesConfirmed } = await prompts_1.confirmThemeValues();
20
- if (!themeValuesConfirmed) {
21
- console.log(chalk_1.default.yellow("\nPlease adjust the values in package.json.\n"));
22
- return;
23
- }
24
- console.log(`\n${chalk_1.default.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 config_1.default.get();
30
- const theme = config["androidTheme"];
31
- const { style, buttonDrawable, buttonColor } = new AndroidResourcePrinter_1.default(theme).process();
32
- let { isConfirmed: confirmed } = await prompts_1.confirmResourceFiles();
33
- if (!confirmed) {
34
- process.exit(1);
35
- }
36
- // Add a line after confirmation
37
- console.log("");
38
- fs_1.default.mkdirSync(path_1.default.dirname(ANDROID_STYLES_RESOURCE_PATH), {
39
- recursive: true,
40
- });
41
- fs_1.default.writeFileSync(ANDROID_STYLES_RESOURCE_PATH, style.end({ prettyPrint: true }));
42
- console.log(`${chalk_1.default.green("Saved an Android style file at path:")} ${ANDROID_STYLES_RESOURCE_PATH}.`);
43
- fs_1.default.mkdirSync(path_1.default.dirname(ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH), {
44
- recursive: true,
45
- });
46
- fs_1.default.writeFileSync(ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH, buttonDrawable.end({ prettyPrint: true }));
47
- console.log(`${chalk_1.default.green("Saved an Android drawable file at path:")} ${ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH}.`);
48
- fs_1.default.mkdirSync(path_1.default.dirname(ANDROID_BUTTON_COLOR_RESOURCE_PATH), {
49
- recursive: true,
50
- });
51
- fs_1.default.writeFileSync(ANDROID_BUTTON_COLOR_RESOURCE_PATH, buttonColor.end({ prettyPrint: true }));
52
- console.log(`${chalk_1.default.green("Saved an Android color file at path:")} ${ANDROID_BUTTON_COLOR_RESOURCE_PATH}.`);
53
- }
54
- }
55
- exports.default = new ThemeGenerator();
@@ -1,34 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const Theme_1 = __importDefault(require("../Theme"));
7
- const prompts_1 = require("../lib/prompts");
8
- const chalk_1 = __importDefault(require("chalk"));
9
- class IosThemeInstructions {
10
- async run() {
11
- await Theme_1.default.print("ios");
12
- const { isConfirmed: themeValuesConfirmed } = await prompts_1.confirmThemeValues();
13
- if (!themeValuesConfirmed) {
14
- console.log(chalk_1.default.yellow("\nPlease adjust the values in package.json.\n"));
15
- return;
16
- }
17
- console.log(`\n${chalk_1.default.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_1.default.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_1.default.green("+ .iosTheme(persona.iosTheme)")}
28
- .build()
29
- .start();
30
- ...
31
- `);
32
- }
33
- }
34
- exports.default = new IosThemeInstructions();
package/src/fields.js DELETED
@@ -1,88 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Fields = exports.InquiryField = void 0;
4
- var InquiryField;
5
- (function (InquiryField) {
6
- class Integer {
7
- constructor(value) {
8
- this.type = "integer";
9
- this.value = value;
10
- }
11
- }
12
- InquiryField.Integer = Integer;
13
- class String {
14
- constructor(value) {
15
- this.type = "string";
16
- this.value = value;
17
- }
18
- }
19
- InquiryField.String = String;
20
- class Boolean {
21
- constructor(value) {
22
- this.type = "boolean";
23
- this.value = value;
24
- }
25
- }
26
- InquiryField.Boolean = Boolean;
27
- class Unknown {
28
- constructor(type) {
29
- this.type = type;
30
- }
31
- }
32
- InquiryField.Unknown = Unknown;
33
- function parse({ type, value }) {
34
- if (value == null) {
35
- return null;
36
- }
37
- switch (type) {
38
- case "integer":
39
- return new InquiryField.Integer(Number.parseInt(value));
40
- case "string":
41
- return new InquiryField.String(value);
42
- case "boolean":
43
- return new InquiryField.Boolean(JSON.parse(value));
44
- case "unknown":
45
- return new InquiryField.Unknown(value);
46
- default:
47
- return new InquiryField.Unknown(type);
48
- }
49
- }
50
- InquiryField.parse = parse;
51
- })(InquiryField = exports.InquiryField || (exports.InquiryField = {}));
52
- var Fields;
53
- (function (Fields) {
54
- function builder() {
55
- return new Fields.Builder();
56
- }
57
- Fields.builder = builder;
58
- class Builder {
59
- constructor() {
60
- this._fields = {};
61
- }
62
- integer(fieldKey, value) {
63
- this._fields = {
64
- ...this._fields,
65
- [fieldKey]: new InquiryField.Integer(value),
66
- };
67
- return this;
68
- }
69
- boolean(fieldKey, value) {
70
- this._fields = {
71
- ...this._fields,
72
- [fieldKey]: new InquiryField.Boolean(value),
73
- };
74
- return this;
75
- }
76
- string(fieldKey, value) {
77
- this._fields = {
78
- ...this._fields,
79
- [fieldKey]: new InquiryField.String(value),
80
- };
81
- return this;
82
- }
83
- build() {
84
- return this._fields;
85
- }
86
- }
87
- Fields.Builder = Builder;
88
- })(Fields = exports.Fields || (exports.Fields = {}));
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const fields_1 = require("./fields");
4
- describe("Fields", () => {
5
- it("Builder", () => {
6
- let fields = fields_1.Fields.builder()
7
- .string("party", "yeah")
8
- .boolean("isParty", true)
9
- .integer("age", 99)
10
- // TODO add float
11
- // .float('pi', 3.14159)
12
- .build();
13
- expect(fields["party"]).toEqual(new fields_1.InquiryField.String("yeah"));
14
- expect(fields["isParty"]).toEqual(new fields_1.InquiryField.Boolean(true));
15
- expect(fields["age"]).toEqual(new fields_1.InquiryField.Integer(99));
16
- // expect(fields["pi"]).toEqual(new InquiryField.Float(3.14159));
17
- });
18
- });
@@ -1,17 +0,0 @@
1
- import { Fields, InquiryField } from "./fields";
2
-
3
- describe("Fields", () => {
4
- it("Builder", () => {
5
- let fields = Fields.builder()
6
- .string("party", "yeah")
7
- .boolean("isParty", true)
8
- .integer("age", 99)
9
- // TODO add float
10
- // .float('pi', 3.14159)
11
- .build();
12
- expect(fields["party"]).toEqual(new InquiryField.String("yeah"));
13
- expect(fields["isParty"]).toEqual(new InquiryField.Boolean(true));
14
- expect(fields["age"]).toEqual(new InquiryField.Integer(99));
15
- // expect(fields["pi"]).toEqual(new InquiryField.Float(3.14159));
16
- });
17
- });
package/src/index.js DELETED
@@ -1,271 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Inquiry = exports.Environment = exports.InvalidAccountId = exports.InvalidInquiryId = exports.InvalidTemplateVersion = exports.InvalidTemplateId = void 0;
4
- const react_native_1 = require("react-native");
5
- const util_1 = require("./util");
6
- const fields_1 = require("./fields");
7
- const { PersonaInquiry } = react_native_1.NativeModules;
8
- class InvalidTemplateId extends Error {
9
- }
10
- exports.InvalidTemplateId = InvalidTemplateId;
11
- class InvalidTemplateVersion extends Error {
12
- }
13
- exports.InvalidTemplateVersion = InvalidTemplateVersion;
14
- class InvalidInquiryId extends Error {
15
- }
16
- exports.InvalidInquiryId = InvalidInquiryId;
17
- class InvalidAccountId extends Error {
18
- }
19
- exports.InvalidAccountId = InvalidAccountId;
20
- /**
21
- * Run validations that the string is in proper Inquiry token format
22
- * and do a type conversion to InquiryId.
23
- *
24
- * @param candidate
25
- */
26
- function makeInquiryId(candidate) {
27
- if (candidate.startsWith("inq_"))
28
- return candidate;
29
- throw new InvalidInquiryId(`Valid template IDs start with "inq_". Received: ${candidate} `);
30
- }
31
- /**
32
- * Run validations that the string is in proper Template token format
33
- * and do a type conversion to TemplateId.
34
- *
35
- * @param candidate
36
- */
37
- function makeTemplateId(candidate) {
38
- if (candidate.startsWith("itmpl_")) {
39
- return candidate;
40
- }
41
- throw new InvalidTemplateId(`Valid template IDs start with "itmpl_". Received: ${candidate} `);
42
- }
43
- /**
44
- * Run validations that the string is in proper Template Version token format
45
- * and do a type conversion to TemplateVersion.
46
- *
47
- * @param candidate
48
- */
49
- function makeTemplateVersion(candidate) {
50
- if (candidate.startsWith("itmplv_")) {
51
- return candidate;
52
- }
53
- throw new InvalidTemplateVersion(`Valid template versions start with "itmplv_". Received: ${candidate} `);
54
- }
55
- /**
56
- * Run validations that the string is in proper Template token format
57
- * and do a type conversion to AccountId.
58
- *
59
- * @param candidate
60
- */
61
- function makeAccountId(candidate) {
62
- if (candidate.startsWith("act_")) {
63
- return candidate;
64
- }
65
- throw new InvalidAccountId(`Valid account IDs start with "act_". Received: ${candidate} `);
66
- }
67
- /**
68
- * String enum for environments. These strings will be parsed
69
- * on the native side bridge into Kotlin / Swift enums.
70
- */
71
- var Environment;
72
- (function (Environment) {
73
- Environment["SANDBOX"] = "sandbox";
74
- Environment["PRODUCTION"] = "production";
75
- })(Environment = exports.Environment || (exports.Environment = {}));
76
- const eventEmitter = new react_native_1.NativeEventEmitter(PersonaInquiry);
77
- class Inquiry {
78
- constructor(options) {
79
- this.templateId = options.templateId;
80
- this.inquiryId = options.inquiryId;
81
- this.referenceId = options.referenceId;
82
- this.accountId = options.accountId;
83
- this.environment = options.environment;
84
- this.sessionToken = options.sessionToken;
85
- this.fields = options.fields;
86
- // Callbacks
87
- this.onComplete = options.onComplete;
88
- this.onCanceled = options.onCanceled;
89
- this.onError = options.onError;
90
- // Theme object
91
- this.iosThemeObject = options.iosThemeObject;
92
- }
93
- clearListeners() {
94
- if (this.onCompleteListener)
95
- this.onCompleteListener.remove();
96
- if (this.onCanceledListener)
97
- this.onCanceledListener.remove();
98
- if (this.onErrorListener)
99
- this.onErrorListener.remove();
100
- }
101
- start() {
102
- this.onCompleteListener = eventEmitter.addListener("onComplete", (event) => {
103
- if (this.onComplete) {
104
- let fields = {};
105
- for (let key of Object.keys(event.fields || {})) {
106
- let field = event.fields[key];
107
- if (field == undefined) {
108
- fields[key] = new fields_1.InquiryField.Unknown("null");
109
- continue;
110
- }
111
- switch (field.type) {
112
- case "integer":
113
- fields[key] = new fields_1.InquiryField.Integer(Number.parseInt(field.value));
114
- break;
115
- case "boolean":
116
- fields[key] = new fields_1.InquiryField.Boolean(field.value);
117
- break;
118
- case "string":
119
- fields[key] = new fields_1.InquiryField.String(field.value);
120
- break;
121
- default:
122
- fields[key] = new fields_1.InquiryField.Unknown(field.type);
123
- break;
124
- }
125
- }
126
- this.onComplete(event.inquiryId, event.status, fields);
127
- }
128
- this.clearListeners();
129
- });
130
- this.onCanceledListener = eventEmitter.addListener("onCanceled", (event) => {
131
- if (this.onCanceled)
132
- this.onCanceled(event.inquiryId, event.sessionToken);
133
- this.clearListeners();
134
- });
135
- this.onErrorListener = eventEmitter.addListener("onError", (event) => {
136
- if (this.onError)
137
- this.onError(new Error(event.debugMessage));
138
- this.clearListeners();
139
- });
140
- PersonaInquiry.startInquiry({
141
- templateId: this.templateId,
142
- inquiryId: this.inquiryId,
143
- referenceId: this.referenceId,
144
- accountId: this.accountId,
145
- environment: this.environment,
146
- sessionToken: this.sessionToken,
147
- fields: this.fields,
148
- iosTheme: util_1.processThemeValues(this.iosThemeObject || {}),
149
- });
150
- }
151
- }
152
- exports.Inquiry = Inquiry;
153
- class InquiryBuilder {
154
- constructor(inquiryId) {
155
- this._inquiryId = inquiryId;
156
- }
157
- sessionToken(sessionToken) {
158
- this._sessionToken = sessionToken;
159
- return this;
160
- }
161
- onComplete(callback) {
162
- this._onComplete = callback;
163
- return this;
164
- }
165
- onCanceled(callback) {
166
- this._onCanceled = callback;
167
- return this;
168
- }
169
- onError(callback) {
170
- this._onError = callback;
171
- return this;
172
- }
173
- iosTheme(themeObject) {
174
- this._iosThemeObject = themeObject;
175
- return this;
176
- }
177
- build() {
178
- return new Inquiry({
179
- inquiryId: this._inquiryId,
180
- sessionToken: this._sessionToken,
181
- onComplete: this._onComplete,
182
- onCanceled: this._onCanceled,
183
- onError: this._onError,
184
- iosThemeObject: this._iosThemeObject,
185
- fields: this._fields,
186
- });
187
- }
188
- }
189
- class TemplateBuilder {
190
- constructor(templateId, templateVersion) {
191
- if (templateId != null) {
192
- this._templateId = templateId;
193
- }
194
- else if (templateVersion != null) {
195
- this._templateVersion = templateVersion;
196
- }
197
- else {
198
- throw new InvalidTemplateId(`Either templateId or templateVersion needs to be set.`);
199
- }
200
- return this;
201
- }
202
- referenceId(referenceId) {
203
- this._accountId = undefined;
204
- this._referenceId = referenceId;
205
- return this;
206
- }
207
- accountId(accountId) {
208
- this._referenceId = undefined;
209
- this._accountId = makeAccountId(accountId);
210
- return this;
211
- }
212
- environment(environment) {
213
- this._environment = environment;
214
- return this;
215
- }
216
- sessionToken(sessionToken) {
217
- this._sessionToken = sessionToken;
218
- return this;
219
- }
220
- fields(fields) {
221
- this._fields = fields;
222
- return this;
223
- }
224
- onComplete(callback) {
225
- this._onComplete = callback;
226
- return this;
227
- }
228
- onCanceled(callback) {
229
- this._onCanceled = callback;
230
- return this;
231
- }
232
- onError(callback) {
233
- this._onError = callback;
234
- return this;
235
- }
236
- iosTheme(themeObject) {
237
- this._iosThemeObject = themeObject;
238
- return this;
239
- }
240
- build() {
241
- return new Inquiry({
242
- templateId: this._templateId,
243
- templateVersion: this._templateVersion,
244
- accountId: this._accountId,
245
- referenceId: this._referenceId,
246
- environment: this._environment,
247
- sessionToken: this._sessionToken,
248
- fields: this._fields,
249
- onComplete: this._onComplete,
250
- onCanceled: this._onCanceled,
251
- onError: this._onError,
252
- iosThemeObject: this._iosThemeObject,
253
- });
254
- }
255
- }
256
- var InquiryBuilders;
257
- (function (InquiryBuilders) {
258
- function fromInquiry(inquiryId) {
259
- return new InquiryBuilder(makeInquiryId(inquiryId));
260
- }
261
- InquiryBuilders.fromInquiry = fromInquiry;
262
- function fromTemplate(templateId) {
263
- return new TemplateBuilder(makeTemplateId(templateId), null);
264
- }
265
- InquiryBuilders.fromTemplate = fromTemplate;
266
- function fromTemplateVersion(templateVersion) {
267
- return new TemplateBuilder(null, makeTemplateVersion(templateVersion));
268
- }
269
- InquiryBuilders.fromTemplateVersion = fromTemplateVersion;
270
- })(InquiryBuilders || (InquiryBuilders = {}));
271
- exports.default = InquiryBuilders;
package/src/util.js DELETED
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.processThemeValues = void 0;
4
- const HEX_REGEX = /^[a-fA-F0-9]{6}$/;
5
- function processThemeValues(themeObject) {
6
- const result = {};
7
- for (const [key, value] of Object.entries(themeObject)) {
8
- if (value === null) {
9
- continue;
10
- }
11
- if (key.includes("Color")) {
12
- let colorValue = value;
13
- if (value[0] === "#") {
14
- colorValue = value.slice(1);
15
- }
16
- if (HEX_REGEX.test(colorValue)) {
17
- result[key] = `#${colorValue}`;
18
- }
19
- else {
20
- continue;
21
- }
22
- }
23
- else {
24
- result[key] = value.toString();
25
- }
26
- }
27
- return result;
28
- }
29
- exports.processThemeValues = processThemeValues;
package/src/util.spec.js DELETED
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const util_1 = require("./util");
4
- describe("processThemeValues", () => {
5
- it("works", () => {
6
- expect(util_1.processThemeValues({ testColorA: "#FFFFFF", testColorB: "#zzzzzz" })).toEqual({ testColorA: "#FFFFFF" });
7
- });
8
- it("filters out non 6 character codes", () => {
9
- expect(util_1.processThemeValues({ testColorA: "#FFFFFF", testColorB: "#FFF" })).toEqual({ testColorA: "#FFFFFF" });
10
- });
11
- it("does not do anything with non colors", () => {
12
- // Values are expected to be strings on the iOS side of the bridge.
13
- expect(util_1.processThemeValues({ buttonCornerRadius: "20" })).toEqual({
14
- buttonCornerRadius: "20",
15
- });
16
- });
17
- });
package/src/util.spec.ts DELETED
@@ -1,22 +0,0 @@
1
- import { processThemeValues } from "./util";
2
-
3
- describe("processThemeValues", () => {
4
- it("works", () => {
5
- expect(
6
- processThemeValues({ testColorA: "#FFFFFF", testColorB: "#zzzzzz" })
7
- ).toEqual({ testColorA: "#FFFFFF" });
8
- });
9
-
10
- it("filters out non 6 character codes", () => {
11
- expect(
12
- processThemeValues({ testColorA: "#FFFFFF", testColorB: "#FFF" })
13
- ).toEqual({ testColorA: "#FFFFFF" });
14
- });
15
-
16
- it("does not do anything with non colors", () => {
17
- // Values are expected to be strings on the iOS side of the bridge.
18
- expect(processThemeValues({ buttonCornerRadius: "20" })).toEqual({
19
- buttonCornerRadius: "20",
20
- });
21
- });
22
- });
package/tsconfig.json DELETED
@@ -1,29 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "lib": [
4
- "ES2019"
5
- ],
6
- "target": "ES2019",
7
- "module": "commonjs",
8
- "esModuleInterop": true,
9
- "moduleResolution": "node",
10
- "jsx": "react-native",
11
- "skipLibCheck": true,
12
- "strict": true,
13
- "noUnusedLocals": true,
14
- "noUnusedParameters": true,
15
- "allowJs": true,
16
- "allowSyntheticDefaultImports": true,
17
- "isolatedModules": true,
18
- "declaration": true,
19
- "declarationDir": "./generatedTypes"
20
- },
21
- "include": [
22
- "src/**/*",
23
- "persona-tools/**/*"
24
- ],
25
- "exclude": [
26
- "node_modules",
27
- "example/"
28
- ]
29
- }