react-native-persona 2.6.2 → 2.7.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.
Files changed (53) hide show
  1. package/android/build.gradle +10 -13
  2. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  3. package/android/gradle.properties +0 -1
  4. package/android/src/main/java/com/withpersona/sdk2/reactnative/PersonaInquiryModule2.java +22 -3
  5. package/ios/PersonaInquiry2.swift +7 -0
  6. package/lib/commonjs/fields.js +9 -44
  7. package/lib/commonjs/fields.js.map +1 -1
  8. package/lib/commonjs/index.js +91 -205
  9. package/lib/commonjs/index.js.map +1 -1
  10. package/lib/commonjs/persona-tool/AndroidResourcePrinter.js +48 -83
  11. package/lib/commonjs/persona-tool/AndroidResourcePrinter.js.map +1 -1
  12. package/lib/commonjs/persona-tool/Config.js +3 -20
  13. package/lib/commonjs/persona-tool/Config.js.map +1 -1
  14. package/lib/commonjs/persona-tool/Theme.js +12 -36
  15. package/lib/commonjs/persona-tool/Theme.js.map +1 -1
  16. package/lib/commonjs/persona-tool/index.js +0 -10
  17. package/lib/commonjs/persona-tool/index.js.map +1 -1
  18. package/lib/commonjs/persona-tool/prompts.js +0 -6
  19. package/lib/commonjs/persona-tool/prompts.js.map +1 -1
  20. package/lib/commonjs/persona-tool/tools/AndroidThemeGenerator.js +2 -27
  21. package/lib/commonjs/persona-tool/tools/AndroidThemeGenerator.js.map +1 -1
  22. package/lib/commonjs/persona-tool/tools/IosThemeInstructions.js +0 -10
  23. package/lib/commonjs/persona-tool/tools/IosThemeInstructions.js.map +1 -1
  24. package/lib/commonjs/util.js +0 -6
  25. package/lib/commonjs/util.js.map +1 -1
  26. package/lib/commonjs/versions.js +0 -5
  27. package/lib/commonjs/versions.js.map +1 -1
  28. package/lib/module/fields.js +9 -43
  29. package/lib/module/fields.js.map +1 -1
  30. package/lib/module/index.js +88 -176
  31. package/lib/module/index.js.map +1 -1
  32. package/lib/module/persona-tool/AndroidResourcePrinter.js +48 -82
  33. package/lib/module/persona-tool/AndroidResourcePrinter.js.map +1 -1
  34. package/lib/module/persona-tool/Config.js +3 -15
  35. package/lib/module/persona-tool/Config.js.map +1 -1
  36. package/lib/module/persona-tool/Theme.js +10 -28
  37. package/lib/module/persona-tool/Theme.js.map +1 -1
  38. package/lib/module/persona-tool/index.js +0 -5
  39. package/lib/module/persona-tool/index.js.map +1 -1
  40. package/lib/module/persona-tool/prompts.js.map +1 -1
  41. package/lib/module/persona-tool/tools/AndroidThemeGenerator.js +2 -8
  42. package/lib/module/persona-tool/tools/AndroidThemeGenerator.js.map +1 -1
  43. package/lib/module/persona-tool/tools/IosThemeInstructions.js +0 -5
  44. package/lib/module/persona-tool/tools/IosThemeInstructions.js.map +1 -1
  45. package/lib/module/util.js +0 -5
  46. package/lib/module/util.js.map +1 -1
  47. package/lib/module/versions.js +0 -1
  48. package/lib/module/versions.js.map +1 -1
  49. package/lib/typescript/fields.d.ts +2 -2
  50. package/lib/typescript/index.d.ts +23 -12
  51. package/lib/typescript/persona-tool/Theme.d.ts +3 -3
  52. package/package.json +2 -2
  53. package/src/index.ts +47 -10
@@ -7,11 +7,10 @@ buildscript {
7
7
  repositories {
8
8
  google()
9
9
  mavenCentral()
10
- jcenter()
11
10
  }
12
11
 
13
12
  dependencies {
14
- classpath 'com.android.tools.build:gradle:3.6.4'
13
+ classpath 'com.android.tools.build:gradle:8.1.1'
15
14
  }
16
15
  }
17
16
  }
@@ -24,6 +23,7 @@ def safeExtGet(prop, fallback) {
24
23
 
25
24
  android {
26
25
  compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
26
+ namespace = "com.withpersona.sdk.reactnative"
27
27
  defaultConfig {
28
28
  minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
29
29
  targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
@@ -43,28 +43,25 @@ android {
43
43
  sourceCompatibility JavaVersion.VERSION_1_8
44
44
  targetCompatibility JavaVersion.VERSION_1_8
45
45
  }
46
+ dexOptions {
47
+ preDexLibraries = false
48
+ }
46
49
  }
47
50
 
48
51
  repositories {
49
- mavenLocal()
50
- maven {
51
- // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
52
- url("$rootDir/../node_modules/react-native/android")
53
- }
54
52
  google()
53
+ mavenLocal()
55
54
  mavenCentral()
56
- jcenter()
57
55
  maven {
58
56
  url "https://sdk.withpersona.com/android/releases"
57
+ url 'https://jitpack.io'
59
58
  }
60
- google()
61
- mavenCentral()
62
- maven { url 'https://jitpack.io' }
63
59
  }
64
60
 
65
61
  dependencies {
66
62
  //noinspection GradleDynamicVersion
67
- implementation 'com.facebook.react:react-native:+' // From node_modules
63
+ implementation("com.facebook.react:react-android")
68
64
 
69
- implementation 'com.withpersona.sdk2:inquiry:2.8.0'
65
+ // NB: be sure to bump `nfc-impl` in example/android/app/build.gradle as well
66
+ implementation 'com.withpersona.sdk2:inquiry:2.10.2'
70
67
  }
@@ -1,5 +1,5 @@
1
1
  distributionBase=GRADLE_USER_HOME
2
2
  distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-all.zip
4
4
  zipStoreBase=GRADLE_USER_HOME
5
5
  zipStorePath=wrapper/dists
@@ -19,4 +19,3 @@ android.useAndroidX=true
19
19
  android.enableJetifier=true
20
20
  # Kotlin code style for this project: "official" or "obsolete":
21
21
  kotlin.code.style=official
22
-
@@ -15,6 +15,7 @@ import com.facebook.react.bridge.ReadableMap;
15
15
  import com.facebook.react.bridge.WritableArray;
16
16
  import com.facebook.react.bridge.WritableMap;
17
17
  import com.facebook.react.modules.core.DeviceEventManagerModule;
18
+ import com.withpersona.sdk.reactnative.R;
18
19
  import com.withpersona.sdk2.inquiry.ClientThemeSource;
19
20
  import com.withpersona.sdk2.inquiry.Environment;
20
21
  import com.withpersona.sdk2.inquiry.Fields;
@@ -23,7 +24,6 @@ import com.withpersona.sdk2.inquiry.InquiryBuilder;
23
24
  import com.withpersona.sdk2.inquiry.InquiryField;
24
25
  import com.withpersona.sdk2.inquiry.InquiryResponse;
25
26
  import com.withpersona.sdk2.inquiry.InquiryTemplateBuilder;
26
- import com.withpersona.sdk2.inquiry.RoutingCountry;
27
27
  import com.withpersona.sdk2.inquiry.ServerThemeSource;
28
28
  import com.withpersona.sdk2.inquiry.types.collected_data.CollectedData;
29
29
  import com.withpersona.sdk2.inquiry.types.collected_data.DocumentFile;
@@ -44,15 +44,18 @@ public class PersonaInquiryModule2 extends ReactContextBaseJavaModule
44
44
  private static final int PERSONA_INQUIRY_REQUEST_CODE = 31416;
45
45
  private static final String INQUIRY_ID = "inquiryId";
46
46
  private static final String TEMPLATE_ID = "templateId";
47
+ private static final String TEMPLATE_VERSION = "templateVersion";
47
48
  private static final String ACCOUNT_ID = "accountId";
48
49
  private static final String REFERENCE_ID = "referenceId";
49
50
  private static final String ACCESS_TOKEN = "sessionToken";
50
51
  private static final String ENVIRONMENT = "environment";
52
+ private static final String ENVIRONMENT_ID = "environmentId";
51
53
  private static final String FIELDS = "fields";
52
54
  private static final String FIELD_ADDITIONAL_FIELDS = "additionalFields";
53
55
  private static final String RETURN_COLLECTED_DATA = "returnCollectedData";
54
56
  private static final String THEME_SOURCE = "themeSource";
55
57
  private static final String ROUTING_COUNTRY = "routingCountry";
58
+ private static final String LOCALE = "locale";
56
59
 
57
60
  private final ReactApplicationContext reactContext;
58
61
 
@@ -287,6 +290,7 @@ public class PersonaInquiryModule2 extends ReactContextBaseJavaModule
287
290
 
288
291
  String inquiryId = options.hasKey(INQUIRY_ID) ? options.getString(INQUIRY_ID) : null;
289
292
  String templateId = options.hasKey(TEMPLATE_ID) ? options.getString(TEMPLATE_ID) : null;
293
+ String templateVersion = options.hasKey(TEMPLATE_VERSION) ? options.getString(TEMPLATE_VERSION) : null;
290
294
 
291
295
  if (inquiryId != null) {
292
296
  InquiryBuilder builder = Inquiry.fromInquiry(inquiryId);
@@ -305,8 +309,13 @@ public class PersonaInquiryModule2 extends ReactContextBaseJavaModule
305
309
  }
306
310
  }
307
311
 
308
- if (templateId != null) {
309
- InquiryTemplateBuilder builder = Inquiry.fromTemplate(templateId);
312
+ if (templateId != null || templateVersion != null) {
313
+ InquiryTemplateBuilder builder;
314
+ if (templateId != null) {
315
+ builder = Inquiry.fromTemplate(templateId);
316
+ } else {
317
+ builder = Inquiry.fromTemplateVersion(templateVersion);
318
+ }
310
319
 
311
320
  String themeSource = options.hasKey(THEME_SOURCE) ? options.getString(THEME_SOURCE) : null;
312
321
  builder = builder.theme(themeSource != null && themeSource.equals("server") ?
@@ -329,11 +338,21 @@ public class PersonaInquiryModule2 extends ReactContextBaseJavaModule
329
338
  builder = builder.environment(environment);
330
339
  }
331
340
 
341
+ String environmentId = options.hasKey(ENVIRONMENT_ID) ? options.getString(ENVIRONMENT_ID) : null;
342
+ if (environmentId != null) {
343
+ builder = builder.environmentId(environmentId);
344
+ }
345
+
332
346
  String routingCountry = options.hasKey(ROUTING_COUNTRY) ? options.getString(ROUTING_COUNTRY) : null;
333
347
  if (routingCountry != null) {
334
348
  builder = builder.routingCountry(routingCountry);
335
349
  }
336
350
 
351
+ String locale = options.hasKey(LOCALE) ? options.getString(LOCALE) : null;
352
+ if (locale != null) {
353
+ builder = builder.locale(locale);
354
+ }
355
+
337
356
  ReadableMap fields = options.hasKey(FIELDS) ? options.getMap(FIELDS) : null;
338
357
 
339
358
  if (fields != null) {
@@ -44,12 +44,14 @@ class PersonaInquiry2: RCTEventEmitter {
44
44
  let referenceId = options["referenceId"] as? String
45
45
  let accountId = options["accountId"] as? String
46
46
  let environment = options["environment"] as? String
47
+ let environmentId = options["environmentId"] as? String
47
48
  let sessionToken = options["sessionToken"] as? String
48
49
  let themeObject = options["iosTheme"] as? [String: String]
49
50
  let themeSource = options["themeSource"] as? String
50
51
  let fieldsObject = options["fields"] as? [String: [String: Any]]
51
52
  let returnCollectedData = options["returnCollectedData"] as? Bool ?? false
52
53
  let routingCountry = options["routingCountry"] as? String
54
+ let locale = options["locale"] as? String
53
55
 
54
56
  var nfcAdapter: InquiryNfcAdapter? = nil
55
57
  #if canImport(PersonaNfc)
@@ -64,26 +66,31 @@ class PersonaInquiry2: RCTEventEmitter {
64
66
  .nfcAdapter(nfcAdapter)
65
67
  .collectionDelegate(returnCollectedData ? self : nil)
66
68
  .routingCountry(routingCountry)
69
+ .locale(locale)
67
70
  .build()
68
71
  } else if let templateId {
69
72
  inquiry = Inquiry.from(templateId: templateId, delegate: self)
70
73
  .referenceId(referenceId)
71
74
  .environment(Environment.from(rawValue: environment))
75
+ .environmentId(environmentId)
72
76
  .fields(fieldsFrom(fieldsObject))
73
77
  .theme(makeTheme(from: themeObject, themeSource: themeSource))
74
78
  .nfcAdapter(nfcAdapter)
75
79
  .collectionDelegate(returnCollectedData ? self : nil)
76
80
  .routingCountry(routingCountry)
81
+ .locale(locale)
77
82
  .build()
78
83
  } else if let templateVersion {
79
84
  inquiry = Inquiry.from(templateVersion: templateVersion, delegate: self)
80
85
  .referenceId(referenceId)
81
86
  .environment(Environment.from(rawValue: environment))
87
+ .environmentId(environmentId)
82
88
  .fields(fieldsFrom(fieldsObject))
83
89
  .theme(makeTheme(from: themeObject, themeSource: themeSource))
84
90
  .nfcAdapter(nfcAdapter)
85
91
  .collectionDelegate(returnCollectedData ? self : nil)
86
92
  .routingCountry(routingCountry)
93
+ .locale(locale)
87
94
  .build()
88
95
  }
89
96
 
@@ -4,138 +4,103 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.InquiryField = exports.Fields = void 0;
7
-
8
- 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; }
9
-
7
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
9
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
10
10
  let InquiryField;
11
11
  exports.InquiryField = InquiryField;
12
-
13
12
  (function (_InquiryField) {
14
13
  class Integer {
15
14
  constructor(value) {
16
15
  _defineProperty(this, "type", 'integer');
17
-
18
16
  _defineProperty(this, "value", void 0);
19
-
20
17
  this.value = value;
21
18
  }
22
-
23
19
  }
24
-
25
20
  _InquiryField.Integer = Integer;
26
-
27
21
  class String {
28
22
  constructor(value) {
29
23
  _defineProperty(this, "type", 'string');
30
-
31
24
  _defineProperty(this, "value", void 0);
32
-
33
25
  this.value = value;
34
26
  }
35
-
36
27
  }
37
-
38
28
  _InquiryField.String = String;
39
-
40
29
  class Boolean {
41
30
  constructor(value) {
42
31
  _defineProperty(this, "type", 'boolean');
43
-
44
32
  _defineProperty(this, "value", void 0);
45
-
46
33
  this.value = value;
47
34
  }
48
-
49
35
  }
50
-
51
36
  _InquiryField.Boolean = Boolean;
52
-
53
37
  class Unknown {
54
38
  constructor(type) {
55
39
  _defineProperty(this, "type", void 0);
56
-
57
40
  this.type = type;
58
41
  }
59
-
60
42
  }
61
-
62
43
  _InquiryField.Unknown = Unknown;
63
-
64
44
  function parse(_ref) {
65
45
  let {
66
46
  type,
67
47
  value
68
48
  } = _ref;
69
-
70
49
  if (value == null) {
71
50
  return null;
72
51
  }
73
-
74
52
  switch (type) {
75
53
  case 'integer':
76
54
  return new InquiryField.Integer(Number.parseInt(value));
77
-
78
55
  case 'string':
79
56
  return new InquiryField.String(value);
80
-
81
57
  case 'boolean':
82
58
  return new InquiryField.Boolean(JSON.parse(value));
83
-
84
59
  case 'unknown':
85
60
  return new InquiryField.Unknown(value);
86
-
87
61
  default:
88
62
  return new InquiryField.Unknown(type);
89
63
  }
90
64
  }
91
-
92
65
  _InquiryField.parse = parse;
93
66
  })(InquiryField || (exports.InquiryField = InquiryField = {}));
94
-
95
67
  let Fields;
96
68
  exports.Fields = Fields;
97
-
98
69
  (function (_Fields) {
99
70
  function builder() {
100
71
  return new Fields.Builder();
101
72
  }
102
-
103
73
  _Fields.builder = builder;
104
-
105
74
  class Builder {
106
75
  constructor() {
107
76
  _defineProperty(this, "_fields", void 0);
108
-
109
77
  this._fields = {};
110
78
  }
111
-
112
79
  integer(fieldKey, value) {
113
- this._fields = { ...this._fields,
80
+ this._fields = {
81
+ ...this._fields,
114
82
  [fieldKey]: new InquiryField.Integer(value)
115
83
  };
116
84
  return this;
117
85
  }
118
-
119
86
  boolean(fieldKey, value) {
120
- this._fields = { ...this._fields,
87
+ this._fields = {
88
+ ...this._fields,
121
89
  [fieldKey]: new InquiryField.Boolean(value)
122
90
  };
123
91
  return this;
124
92
  }
125
-
126
93
  string(fieldKey, value) {
127
- this._fields = { ...this._fields,
94
+ this._fields = {
95
+ ...this._fields,
128
96
  [fieldKey]: new InquiryField.String(value)
129
97
  };
130
98
  return this;
131
99
  }
132
-
133
100
  build() {
134
101
  return this._fields;
135
102
  }
136
-
137
103
  }
138
-
139
104
  _Fields.Builder = Builder;
140
105
  })(Fields || (exports.Fields = Fields = {}));
141
106
  //# sourceMappingURL=fields.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["fields.ts"],"names":["Integer","constructor","value","String","Boolean","Unknown","type","parse","InquiryField","Number","parseInt","JSON","builder","Fields","Builder","_fields","integer","fieldKey","boolean","string","build"],"mappings":";;;;;;;;;;;;;AAUS,QAAMA,OAAN,CAAsC;AAI3CC,IAAAA,WAAW,CAACC,KAAD,EAAiB;AAAA,oCAHJ,SAGI;;AAAA;;AAC1B,WAAKA,KAAL,GAAaA,KAAb;AACD;;AAN0C;;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Ae,EAAf;AACD;;AAEMC,IAAAA,OAAO,CAACC,QAAD,EAAmBf,KAAnB,EAAmC;AAC/C,WAAKa,OAAL,GAAe,EACb,GAAG,KAAKA,OADK;AAEb,SAACE,QAAD,GAAY,IAAIT,YAAY,CAACR,OAAjB,CAAyBE,KAAzB;AAFC,OAAf;AAKA,aAAO,IAAP;AACD;;AAEMgB,IAAAA,OAAO,CAACD,QAAD,EAAmBf,KAAnB,EAAoC;AAChD,WAAKa,OAAL,GAAe,EACb,GAAG,KAAKA,OADK;AAEb,SAACE,QAAD,GAAY,IAAIT,YAAY,CAACJ,OAAjB,CAAyBF,KAAzB;AAFC,OAAf;AAKA,aAAO,IAAP;AACD;;AAEMiB,IAAAA,MAAM,CAACF,QAAD,EAAmBf,KAAnB,EAAmC;AAC9C,WAAKa,OAAL,GAAe,EACb,GAAG,KAAKA,OADK;AAEb,SAACE,QAAD,GAAY,IAAIT,YAAY,CAACL,MAAjB,CAAwBD,KAAxB;AAFC,OAAf;AAKA,aAAO,IAAP;AACD;;AAEMkB,IAAAA,KAAK,GAAW;AACrB,aAAO,KAAKL,OAAZ;AACD;;AApCkB;;;GALNF,M,sBAAAA,M","sourcesContent":["interface InquiryField {\n readonly type: string;\n}\n\nexport type RawInquiryField = {\n type: string;\n value?: any;\n};\n\nexport namespace InquiryField {\n export class Integer implements InquiryField {\n readonly type: string = 'integer';\n readonly value?: number;\n\n constructor(value?: number) {\n this.value = value;\n }\n }\n\n export class String implements InquiryField {\n readonly type: string = 'string';\n readonly value?: string;\n\n constructor(value?: string) {\n this.value = value;\n }\n }\n\n export class Boolean implements InquiryField {\n readonly type: string = 'boolean';\n readonly value?: boolean;\n\n constructor(value?: boolean) {\n this.value = value;\n }\n }\n\n export class Unknown implements InquiryField {\n readonly type: string;\n\n constructor(type: string) {\n this.type = type;\n }\n }\n\n export function parse({ type, value }: RawInquiryField): InquiryField | null {\n if (value == null) {\n return null;\n }\n switch (type) {\n case 'integer':\n return new InquiryField.Integer(Number.parseInt(value));\n case 'string':\n return new InquiryField.String(value);\n case 'boolean':\n return new InquiryField.Boolean(JSON.parse(value));\n case 'unknown':\n return new InquiryField.Unknown(value);\n default:\n return new InquiryField.Unknown(type);\n }\n }\n}\n\nexport type Fields = Record<string, InquiryField | null>;\n\nexport namespace Fields {\n export function builder(): Builder {\n return new Fields.Builder();\n }\n\n export class Builder {\n private _fields: Record<string, InquiryField>;\n\n constructor() {\n this._fields = {};\n }\n\n public integer(fieldKey: string, value?: number) {\n this._fields = {\n ...this._fields,\n [fieldKey]: new InquiryField.Integer(value),\n };\n\n return this;\n }\n\n public boolean(fieldKey: string, value?: boolean) {\n this._fields = {\n ...this._fields,\n [fieldKey]: new InquiryField.Boolean(value),\n };\n\n return this;\n }\n\n public string(fieldKey: string, value?: string) {\n this._fields = {\n ...this._fields,\n [fieldKey]: new InquiryField.String(value),\n };\n\n return this;\n }\n\n public build(): Fields {\n return this._fields;\n }\n }\n}\n"]}
1
+ {"version":3,"names":["InquiryField","exports","_InquiryField","Integer","constructor","value","_defineProperty","String","Boolean","Unknown","type","parse","_ref","Number","parseInt","JSON","Fields","_Fields","builder","Builder","_fields","integer","fieldKey","boolean","string","build"],"sources":["fields.ts"],"sourcesContent":["interface InquiryField {\n readonly type: string;\n}\n\nexport type RawInquiryField = {\n type: string;\n value?: any;\n};\n\nexport namespace InquiryField {\n export class Integer implements InquiryField {\n readonly type: string = 'integer';\n readonly value?: number;\n\n constructor(value?: number) {\n this.value = value;\n }\n }\n\n export class String implements InquiryField {\n readonly type: string = 'string';\n readonly value?: string;\n\n constructor(value?: string) {\n this.value = value;\n }\n }\n\n export class Boolean implements InquiryField {\n readonly type: string = 'boolean';\n readonly value?: boolean;\n\n constructor(value?: boolean) {\n this.value = value;\n }\n }\n\n export class Unknown implements InquiryField {\n readonly type: string;\n\n constructor(type: string) {\n this.type = type;\n }\n }\n\n export function parse({ type, value }: RawInquiryField): InquiryField | null {\n if (value == null) {\n return null;\n }\n switch (type) {\n case 'integer':\n return new InquiryField.Integer(Number.parseInt(value));\n case 'string':\n return new InquiryField.String(value);\n case 'boolean':\n return new InquiryField.Boolean(JSON.parse(value));\n case 'unknown':\n return new InquiryField.Unknown(value);\n default:\n return new InquiryField.Unknown(type);\n }\n }\n}\n\nexport type Fields = Record<string, InquiryField | null>;\n\nexport namespace Fields {\n export function builder(): Builder {\n return new Fields.Builder();\n }\n\n export class Builder {\n private _fields: Record<string, InquiryField>;\n\n constructor() {\n this._fields = {};\n }\n\n public integer(fieldKey: string, value?: number) {\n this._fields = {\n ...this._fields,\n [fieldKey]: new InquiryField.Integer(value),\n };\n\n return this;\n }\n\n public boolean(fieldKey: string, value?: boolean) {\n this._fields = {\n ...this._fields,\n [fieldKey]: new InquiryField.Boolean(value),\n };\n\n return this;\n }\n\n public string(fieldKey: string, value?: string) {\n this._fields = {\n ...this._fields,\n [fieldKey]: new InquiryField.String(value),\n };\n\n return this;\n }\n\n public build(): Fields {\n return this._fields;\n }\n }\n}\n"],"mappings":";;;;;;;;;IASiBA,YAAY;AAAAC,OAAA,CAAAD,YAAA,GAAAA,YAAA;AAAA,WAAAE,aAAA;EACpB,MAAMC,OAAO,CAAyB;IAI3CC,WAAWA,CAACC,KAAc,EAAE;MAAAC,eAAA,eAHJ,SAAS;MAAAA,eAAA;MAI/B,IAAI,CAACD,KAAK,GAAGA,KAAK;IACpB;EACF;EAACH,aAAA,CAAAC,OAAA,GAAAA,OAAA;EAEM,MAAMI,MAAM,CAAyB;IAI1CH,WAAWA,CAACC,KAAc,EAAE;MAAAC,eAAA,eAHJ,QAAQ;MAAAA,eAAA;MAI9B,IAAI,CAACD,KAAK,GAAGA,KAAK;IACpB;EACF;EAACH,aAAA,CAAAK,MAAA,GAAAA,MAAA;EAEM,MAAMC,OAAO,CAAyB;IAI3CJ,WAAWA,CAACC,KAAe,EAAE;MAAAC,eAAA,eAHL,SAAS;MAAAA,eAAA;MAI/B,IAAI,CAACD,KAAK,GAAGA,KAAK;IACpB;EACF;EAACH,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