@raytio/types 7.0.0 → 7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/orgs.ts ADDED
@@ -0,0 +1,86 @@
1
+ /** Types Used for Organization Related API Responses */
2
+ /** An Organisation */
3
+ export type Party = {
4
+ id: string;
5
+ start_date: string;
6
+ end_date: string;
7
+ active: boolean;
8
+ party_name: string;
9
+ party_description: string;
10
+ party_type: string;
11
+ metadata: PartyMetadata;
12
+ party_number: number;
13
+ };
14
+
15
+ /** An Organizations credentials */
16
+ export type PartyMetadata = {
17
+ gandalf: unknown;
18
+ stripe: { customer: unknown };
19
+ centrix_credentials: unknown;
20
+ };
21
+
22
+ /** An Organization Site */
23
+ export type PartySite = {
24
+ id: string;
25
+ start_date: string;
26
+ end_date: string;
27
+ active: boolean;
28
+ party_id: string;
29
+ location_number: number;
30
+ party_site_name: string;
31
+ party_site_description: string | null;
32
+ party_site_number: string | null;
33
+ party_uses: string[];
34
+ party_use_primary: string;
35
+ metadata: unknown;
36
+ };
37
+
38
+ /** An Organization Location */
39
+ export type Location = {
40
+ id: string;
41
+ start_date: string;
42
+ end_date: string;
43
+ active: boolean;
44
+ location_name: string;
45
+ location_description: string | null;
46
+ address_line_1: string | null;
47
+ address_line_2: string | null;
48
+ address_line_3: string | null;
49
+ address_line_4: string | null;
50
+ premise: string | null;
51
+ subpremise: string | null;
52
+ street_number: string | null;
53
+ administrative_area_level_1: string | null;
54
+ administrative_area_level_2: string | null;
55
+ administrative_area_level_3: string | null;
56
+ route: string | null;
57
+ locality: string | null;
58
+ postal_code: string;
59
+ postal_code_suffix: string | null;
60
+ city: string | null;
61
+ region: string | null;
62
+ country: string | null;
63
+ geolocation: string | null;
64
+ geolocation_outline: string | null;
65
+ metadata: unknown;
66
+ };
67
+
68
+ /** A Contact Point for an Organization */
69
+ export type ContactPoint = {
70
+ id: string;
71
+ start_date: string;
72
+ end_date: string;
73
+ active: boolean;
74
+ to_table: string;
75
+ uuid: string | undefined;
76
+ contact_point_purpose: string;
77
+ contact_point_type: string;
78
+ e164: string | null;
79
+ e164_suffix: string | null;
80
+ e164_type: string | null;
81
+ url: string | null;
82
+ url_type: string | null;
83
+ email_address: string;
84
+ email_address_preferred_format: string;
85
+ metadata: unknown;
86
+ };
package/src/raytio.ts CHANGED
@@ -7,22 +7,24 @@ export type StringWithIdentity<T> = string & { $$typeof$$: T };
7
7
  /** @internal */
8
8
  type Json = Record<string, any>; // TODO: (semver breaking) unknown
9
9
 
10
- /** A `p_id` is the ID of a @see Relationship */
10
+ /** A `p_id` is the ID of a {@link Relationship} */
11
11
  export type PId = StringWithIdentity<"PId">;
12
- /** An `i_id` is the ID of an @see Instance */
12
+ /** An `i_id` is the ID of an {@link Instance} */
13
13
  export type IId = StringWithIdentity<"IId">;
14
- /** An `n_id` is the ID of a @see ProfileObject */
14
+ /** An `n_id` is the ID of a {@link ProfileObject} */
15
15
  export type NId = StringWithIdentity<"NId">;
16
16
  /** A `g_id` is the ID of a group */
17
17
  export type GId = StringWithIdentity<"GId">;
18
18
  /** A `u_id` is the ID of a user */
19
19
  export type UId = StringWithIdentity<"UId">;
20
- /** An `a_id` is the ID of an @see AA */
20
+ /** An `a_id` is the ID of an {@link AA} */
21
21
  export type AId = StringWithIdentity<"AId">;
22
- /** An `o_id` is the ID of an @see Organization */
22
+ /** An `o_id` is the ID of an {@link Organization} */
23
23
  export type OId = StringWithIdentity<"OId">;
24
- /** A `wi_id` is the ID of a @see Webhook */
24
+ /** A `wi_id` is the ID of a {@link Webhook} */
25
25
  export type WId = StringWithIdentity<"WId">;
26
+ /** An `l_id` is the ID of any data stored in the KV-Store */ // e.g. StoredWizardConfig and VerBundleMetadata
27
+ export type LId = StringWithIdentity<"LId">;
26
28
 
27
29
  export type DataTypes =
28
30
  | "string"
@@ -72,17 +74,6 @@ export type ProfileObjectForUpload<Properties = Json> = {
72
74
  n_id?: NId; // only if editing an existing PO
73
75
  };
74
76
 
75
- /**
76
- * arbitrary key-values pairs stored on a Profile Object.
77
- * May contain nested JSON and @see Encrypted properties.
78
- *
79
- * There are some limits to field names: they cannot be called
80
- * `__signature` nor can they include the character sequence `<=>`.
81
- */
82
- export type Properties = {
83
- [fieldName: string]: any; // TODO: (semver breaking) unknown
84
- };
85
-
86
77
  export type UrnNodeType =
87
78
  | "user"
88
79
  | "profile_object"
@@ -92,7 +83,13 @@ export type UrnNodeType =
92
83
  | "document";
93
84
 
94
85
  /** e.g. "urn:user:..." */
95
- export type Urn = `urn:${UrnNodeType}:${string}`; // TODO: TS4.3 replace `string` with `IId | NId | GId | UId | AId`
86
+ export type Urn =
87
+ | `urn:user:${UId}`
88
+ | `urn:profile_object:${NId}`
89
+ | `urn:instance:${IId}`
90
+ | `urn:temp_object:${LId}`
91
+ | `urn:schema:${/* schemaName */ string}`
92
+ | `urn:document:${NId}`;
96
93
 
97
94
  export type Relationship = {
98
95
  start: Urn;
@@ -118,7 +115,7 @@ export type Lookup = {
118
115
  requires_2FA?: boolean;
119
116
  };
120
117
 
121
- export type AATags =
118
+ export type AATag =
122
119
  | "type:client_only"
123
120
  | "type:share_with_new_user"
124
121
  // heritage
@@ -131,11 +128,12 @@ export type AA = {
131
128
  description?: string;
132
129
  /** If a user signs up while completing this form, this message will be sent in the sign up email. */
133
130
  aa_introduction?: string;
131
+ /** @deprecated see !2101 */
134
132
  picture?: Urn;
135
- /** Easy to use AA logo url for pasting inot emails */
133
+ /** Easy to use AA logo url for pasting into emails */
136
134
  picture_url?: string;
137
135
  scopes?: string[];
138
- tags?: AATags[];
136
+ tags?: AATag[];
139
137
  callback_uri?: string[];
140
138
  /** markdown or string help information including [phoneNumber || email] */
141
139
  aa_help?: string;
@@ -155,6 +153,15 @@ export type AA = {
155
153
  /** if true, only specific email addresses can submit the form */
156
154
  auth_list_enabled?: boolean;
157
155
 
156
+ /** Currently Unused Attributes */
157
+ start_date?: Date;
158
+ end_date?: Date;
159
+ active?: boolean;
160
+ key?: string;
161
+ logout_uri?: string[];
162
+ metadata?: unknown;
163
+ secret?: unknown;
164
+
158
165
  /** @internal */
159
166
  transitions?: unknown[];
160
167
  };
@@ -179,10 +186,9 @@ export type Instance = {
179
186
  start_date: string;
180
187
  /** The status of a submission */
181
188
  state: SubmissionStatus;
182
- /** @depreacted The status of a submission */
189
+ /** @deprecated The status of a submission */
183
190
  _state?: SubmissionStatus;
184
- /** Previous status of the shared information */
185
- previous_state: SubmissionStatus;
191
+
186
192
  /** Hash of the Service Provider ID */
187
193
  sub_service_provider_hash?: string;
188
194
  /** Service provider ID */
@@ -191,8 +197,7 @@ export type Instance = {
191
197
  profile_objects: ProfileObject[];
192
198
  // TODO: (semver breaking) mark as optional since the get-shared-data API doesn't return keys
193
199
  keys: {
194
- // TODO: TS4.3 use `NId` instead of `string`
195
- [nId: string]: {
200
+ [nId: NId]: {
196
201
  [fieldName: string]: {
197
202
  data: string;
198
203
  n_id: NId;
@@ -205,6 +210,28 @@ export type Instance = {
205
210
  // Defined as `unknown` instead of `ScoreResult` because it could be nonsense,
206
211
  // or a deprected version of `ScoreResult`.
207
212
  score?: unknown;
213
+
214
+ // Currently Unused properties
215
+ /** Previous status of the shared information */
216
+ previous_state?: SubmissionStatus;
217
+ /** Device Id */
218
+ device_id?: unknown;
219
+ /** Source IP */
220
+ source_ip?: unknown;
221
+ /** Related Offers */
222
+ related_offers?: unknown;
223
+ /** Instance Version */
224
+ instance_version?: unknown;
225
+ /** Footer Html */
226
+ platform_footer_html?: unknown;
227
+ /** Related Service Types */
228
+ related_service_types?: unknown;
229
+ /** Activity Status */
230
+ active?: boolean;
231
+ /** Key (Can be used to retrieve instance) */
232
+ aack_id?: string;
233
+ /** Metadata */
234
+ metadata?: unknown;
208
235
  };
209
236
 
210
237
  /**
@@ -215,15 +242,8 @@ export type Organization = {
215
242
  id: OId;
216
243
  name: string;
217
244
  email: string;
218
- address: {
219
- locationType: string;
220
- street1: string;
221
- street2: string;
222
- city: string;
223
- region: string;
224
- country: string;
225
- };
226
- customer: Record<string, unknown>;
245
+ address: unknown; // Waiting on Backend Progress Before being properly updated (as of #1361)
246
+ customer: unknown; // Waiting on Backend Progress Before being properly updated (as of #1361) (was previously Record<string, unknown>)
227
247
  };
228
248
 
229
249
  /** @internal some APIs now return extra info */
package/src/schema.ts CHANGED
@@ -24,6 +24,7 @@ export type SchemaFieldTag =
24
24
  | "display:survey"
25
25
  | "display:quoting"
26
26
  | "display:customModal"
27
+ | `display:replace:'${string}':'${string}'`
27
28
  | "display:terms_conditions"
28
29
  | `display:main_media:${string}` // property name to determine what image to display
29
30
  // date picker components
@@ -32,6 +33,7 @@ export type SchemaFieldTag =
32
33
  | "date_component:year"
33
34
  // other
34
35
  | "action:client_upload"
36
+ | "action:require_webauthn"
35
37
  | "verify:show_if_pending"
36
38
  | "special:hide_select_behind_button"
37
39
  | "type:capture_geolocation" // triggers the wizard's GeoLocationInput field
@@ -48,6 +50,7 @@ export type SchemaTag =
48
50
  | `oauth2_component:name:${string}`
49
51
  | `oauth2_component:redirect_url:${string}`
50
52
  // misc
53
+ | `time:${/* type */ string}:${/* seconds */ number}`
51
54
  | `link_to:${/* schemaName */ string}:${/* relationshipType */ string}`
52
55
  // type
53
56
  | "type:service_provider"
@@ -68,8 +71,14 @@ export type SchemaField = {
68
71
  tags?: SchemaFieldTag[];
69
72
  type?: DataTypes;
70
73
  enum?: (string | number | boolean)[];
74
+ /** for number inputs, the maximum allowed value */
71
75
  maximum?: number;
76
+ /** for number inputs, the minimum allowed value */
72
77
  minimum?: number;
78
+ /** for number inputs, the step size used in the input or slider */
79
+ step?: number;
80
+ /** if true, the user must have encryption enabled to save this data, see #1324 */
81
+ encrypt_require?: boolean;
73
82
  /** @deprecated raytio's usage not documented */
74
83
  maxLength?: number;
75
84
  /** @deprecated raytio's usage not documented */
@@ -156,15 +165,17 @@ export type ServerSchemaField = Omit<SchemaField, "$prop">;
156
165
 
157
166
  /** not exported. Attributes that are identical in both client schema & server schema */
158
167
  export type CommonSchemaAttributes = {
159
- type?: DataTypes;
160
-
161
168
  /** these fields will always exist on schema */
162
- name: string;
163
169
  title: string;
164
170
  description: string;
171
+ /** specifies that the description is formatted in markdown */
172
+ description_decorator?: "md";
173
+
174
+ schema_type?: SchemaType;
165
175
 
166
176
  /** plural version of the title */
167
177
  title_plural?: string;
178
+
168
179
  /**
169
180
  * the group that a schema belongs to, such as "passports". This is useful for
170
181
  * forms that accept different types of similar documents.
@@ -192,6 +203,10 @@ export type CommonSchemaAttributes = {
192
203
  $loading_link_to_person: { title: string };
193
204
  $loading_delete_pending_ver: { title: string };
194
205
  $loading_pending_ver_resubmit: { title: string };
206
+ $loading_long_verification_message: {
207
+ title?: string;
208
+ description?: string;
209
+ };
195
210
 
196
211
  [fieldNameOrGroupName: string]: ServerSchemaField & {
197
212
  title_plural?: string;
@@ -284,6 +299,12 @@ export type CommonSchemaAttributes = {
284
299
  * of what the API returns.
285
300
  */
286
301
  export type Schema = CommonSchemaAttributes & {
302
+ /** added by the client, copied from {@link WrappedSchema} */
303
+ name: string; // Will always exist on schema
304
+
305
+ /** added by client */
306
+ type?: DataTypes;
307
+
287
308
  /** the localized title of the `schema_group`. added by the client */
288
309
  group_title?: string;
289
310
 
@@ -296,9 +317,9 @@ export type Schema = CommonSchemaAttributes & {
296
317
  /** added by client */
297
318
  wasExpandedByClient?: boolean;
298
319
 
299
- /** ISO Date. Copied from @see WrappedSchema */
320
+ /** ISO Date. Copied from {@link WrappedSchema} */
300
321
  start_date?: string;
301
- /** ISO Date. Copied from @see WrappedSchema If this tag exists, the schema is deprecated */
322
+ /** ISO Date. Copied from {@link WrappedSchema} If this tag exists, the schema is deprecated */
302
323
  end_date?: string;
303
324
 
304
325
  /** 🚨 Note that there are cases where properties are undefined, e.g. if the schema is a sub-object */
@@ -312,7 +333,7 @@ export type Schema = CommonSchemaAttributes & {
312
333
  /** added by the client to inform downstream components which locale from schema.i18n was used */
313
334
  clientLocale?: string;
314
335
 
315
- /** added by the client, copied from @see WrappedSchema */
336
+ /** added by the client, copied from {@link WrappedSchema} */
316
337
  version: string;
317
338
 
318
339
  /**
@@ -328,6 +349,9 @@ export type Schema = CommonSchemaAttributes & {
328
349
  isSpSchema?: boolean;
329
350
  };
330
351
 
352
+ /** Type Classification of a Schema returned by API */
353
+ export type SchemaType = "ss" | "ps" | "us";
354
+
331
355
  /** This is what's returned by the API */
332
356
  export type WrappedSchema = {
333
357
  active: true;
@@ -335,9 +359,12 @@ export type WrappedSchema = {
335
359
  start_date: string;
336
360
  /** ISO Date. If this tag exists, the schema is deprecated. */
337
361
  end_date: string;
338
- name: string;
339
- type: "ss" | "ps" | "us";
340
- version: string;
362
+
363
+ /** Schema Name Type and Version Properties */
364
+ schema_name: string;
365
+ schema_type: SchemaType;
366
+ schema_version: string;
367
+
341
368
  /** whether the \`version\` is the latest version */
342
369
  version_current: boolean;
343
370
  schema: CommonSchemaAttributes & {
@@ -347,6 +374,7 @@ export type WrappedSchema = {
347
374
  $schema?: string;
348
375
 
349
376
  definitions?: Record<string, { $ref: Urn }>;
377
+
350
378
  allOf?: {
351
379
  $ref?: string;
352
380
  if?: Partial<WrappedSchema["schema"]>;
@@ -1,10 +1,37 @@
1
1
  import { NId, ProfileObject } from "./raytio";
2
2
 
3
+ // see #659
4
+ export enum SafeHarbourCode {
5
+ /** “a match has been made on each the Full Name, Address and Date of Birth” */
6
+ M1 = "M1",
7
+ /** “a match has been made on both Full Name and Date of Birth (but not Address)” */
8
+ M2 = "M2",
9
+ /** “a match has been made on both Full Name and Address (but not Date of Birth)” */
10
+ N1 = "N1",
11
+ }
12
+
3
13
  export type VerificationPayload<WithValue extends boolean> = {
4
14
  // we deliberately haven't defined 'sub'
5
15
  field: string;
6
16
  schema?: string;
7
- metadata?: Record<string, unknown>;
17
+ metadata?: {
18
+ safeHarbourScore?: SafeHarbourCode;
19
+ status?: "pending";
20
+ pending_details?: {
21
+ /**
22
+ * for pending verifications - whether the verifier will complete fast enough that
23
+ * we can show a loading indicator. If not, the user has to come back another day.
24
+ */
25
+ pending_time: "short" | "long";
26
+ /**
27
+ * for pending verifications - whether further user interaction is required to
28
+ * complete the verification, or if it will complete silently in the background.
29
+ */
30
+ pending_type: "time" | "user";
31
+ };
32
+
33
+ [otherAttributes: string]: unknown;
34
+ };
8
35
  passed: boolean;
9
36
  request_div: string;
10
37
  /** @deprecated don't use this, it looks like the schema name but it's not */
@@ -20,9 +47,7 @@ export type VerificationPayload<WithValue extends boolean> = {
20
47
  verifier_source_id?: NId;
21
48
  verifier_service_id?: NId;
22
49
  verifier_div: string;
23
- /** ISO Date */
24
- valid_until?: string;
25
- // we are disabling the eslint rule beacuse even tho `{}` acts illogically in typescript,
50
+ // we are disabling the eslint rule because even tho `{}` acts illogically in typescript,
26
51
  // in this case it's working as expected in the intersection type, see
27
52
  // https://github.com/typescript-eslint/typescript-eslint/issues/2063#issuecomment-632833366
28
53
  // and https://github.com/typescript-eslint/typescript-eslint/issues/2063#issuecomment-645510515
@@ -47,6 +72,15 @@ export type Verification<WithValue extends boolean = false> = ProfileObject<{
47
72
  {
48
73
  signature: string;
49
74
  data: VerificationPayload<WithValue>;
75
+
76
+ /** undefined for data created before July 2023 */
77
+ key_id?: string;
78
+ /** undefined for data created before July 2023 */
79
+ key_urn?: string;
80
+ /** undefined for data created before July 2023 */
81
+ signing_algorithm?: "RSASSA_PSS_SHA_512";
82
+ /** undefined for data created before July 2023 */
83
+ hashing_algorithm?: "SHA512";
50
84
  },
51
85
  ];
52
86
  }>;
@@ -85,7 +119,7 @@ export type VerificationProvider = {
85
119
  date?: Date;
86
120
  };
87
121
 
88
- /** This is what @raytio/core exposes, which is more useable than @see Verification */
122
+ /** This is what @raytio/core exposes, which is more useable than {@link Verification} */
89
123
  export type RealVer = {
90
124
  fieldName: string;
91
125
  value: unknown;
@@ -97,7 +131,7 @@ export type RealVer = {
97
131
  */
98
132
  verified: boolean;
99
133
  /** arbitary metadata returned by the verifier */
100
- metadata?: Record<string, unknown>;
134
+ metadata?: VerificationPayload<false>["metadata"];
101
135
  /** nId of the verification */
102
136
  nID: NId;
103
137
  /** nId of the PO that the verification belongs to. Could be undefined */
package/src/wizard.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  import { AId } from "./raytio";
2
2
 
3
- /** configuration data for a single wizard page (@see WizardConfig) */
3
+ export type WizardPageTag =
4
+ // actions
5
+ "action:require_chip";
6
+
7
+ /** configuration data for a single wizard page ({@link WizardConfig}) */
4
8
  export type WizardPage = {
5
9
  /** if undefined, the schema title will be used */
6
10
  name?: string | symbol;
@@ -23,7 +27,7 @@ export type WizardPage = {
23
27
  service_provider_link?: boolean;
24
28
  /** custom text to display on the Create New button */
25
29
  create_new_text?: string;
26
- /** a URL to a preset for configuing NestedSchemaSelect. @see DeepConfig */
30
+ /** a URL to a preset for configuing NestedSchemaSelect. {@link DeepConfig} */
27
31
  selection_hierarchy_json?: string;
28
32
 
29
33
  /** whether the schema description should be shown */
@@ -60,7 +64,12 @@ export type WizardPage = {
60
64
  /** for ImageDynamicSection, the action to take if the API returns no `validation: {}` object */
61
65
  extract_threshold_null_action?: WizardPage["extract_threshold_fail_action"];
62
66
 
63
- /** if `false`, ProfileObjects created while completing the form will not be verified. `undefined` implies `true` */
67
+ /**
68
+ * if `false`, ProfileObjects created while completing the form will not be verified.
69
+ * if `true`, you can only select ProfileObjects that are partially or fully verified.
70
+ * `undefined` implies `true`.
71
+ * @default true
72
+ */
64
73
  verify_data?: boolean;
65
74
 
66
75
  /** a list of fields that should not be required, even if the schema says they're required */
@@ -72,6 +81,14 @@ export type WizardPage = {
72
81
 
73
82
  /** can you force the colour theme to change for just one page (#1066, #1074). At the moment this on pages that use WebcamImageCapture */
74
83
  display_mode?: "light" | "dark" | "default";
84
+
85
+ tags?: WizardPageTag[];
86
+
87
+ /**
88
+ * If specified, this is is a "Conditional Wizard Page", which is only shown
89
+ * if the rule passed. This field contains the ID (not name) of the rule.
90
+ */
91
+ branching_rule_name?: string;
75
92
  };
76
93
 
77
94
  /**
@@ -124,6 +141,9 @@ export type WizardConfig = {
124
141
  /** the loading message to show next to the spinner after the review screen */
125
142
  sharing_data_message?: string;
126
143
 
144
+ /** If this value is true, the form will display some data sharing information before the form (WizardPreview) */
145
+ display_sharing_preview?: boolean;
146
+
127
147
  /** a list of relationships that should be created after the wizard completes (see #987) */
128
148
  relationships?: {
129
149
  /** schema name */
@@ -135,4 +155,7 @@ export type WizardConfig = {
135
155
  /** relationship properties */
136
156
  properties?: Record<string, any>;
137
157
  }[];
158
+
159
+ /** if specified, the user must validate their WebAuthN credential before they can submit the form */
160
+ webauthn_type?: ("usb" | "nfc" | "ble" | "internal")[];
138
161
  };