@raytio/types 5.2.1 → 6.0.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/README.md CHANGED
@@ -33,6 +33,7 @@ Hovering over the type in VSCode will display documentation and available proper
33
33
  - [AId](#aid)
34
34
  - [Colors](#colors)
35
35
  - [ConditionallyRequired](#conditionallyrequired)
36
+ - [CustomFonts](#customfonts)
36
37
  - [DataTypes](#datatypes)
37
38
  - [Encrypted](#encrypted)
38
39
  - [GId](#gid)
@@ -57,6 +58,7 @@ Hovering over the type in VSCode will display documentation and available proper
57
58
  - [UrnNodeType](#urnnodetype)
58
59
  - [Validation](#validation)
59
60
  - [Verification](#verification)
61
+ - [VerificationPayload](#verificationpayload)
60
62
  - [VerificationProvider](#verificationprovider)
61
63
  - [WizardConfig](#wizardconfig)
62
64
  - [WizardPage](#wizardpage)
@@ -80,11 +82,13 @@ Hovering over the type in VSCode will display documentation and available proper
80
82
  | `org_id` | `string` | the id of the associated organisation |
81
83
  | `picture?` | [`Urn`](#urn) | - |
82
84
  | `picture_url?` | `string` | Easy to use AA logo url for pasting inot emails |
85
+ | `ruleset?` | `unknown` | configuration for the submission rules |
83
86
  | `scopes?` | `string`[] | - |
84
87
  | `service_provider_n_id?` | [`NId`](#nid) | the n_id of the associated service provider |
85
88
  | `tags?` | `string`[] | - |
86
89
  | `theme?` | `Object` | - |
87
- | `theme.colors` | [`Colors`](#colors) | - |
90
+ | `theme.colors?` | [`Colors`](#colors) | - |
91
+ | `theme.font?` | [`CustomFonts`](#customfonts) | - |
88
92
 
89
93
  ___
90
94
 
@@ -145,6 +149,19 @@ should be renamed since this applies to ConditionallyVerifiable
145
149
 
146
150
  ___
147
151
 
152
+ ### CustomFonts
153
+
154
+ Ƭ **CustomFonts**: `Object`
155
+
156
+ #### Type declaration
157
+
158
+ | Name | Type |
159
+ | :------ | :------ |
160
+ | `body?` | `string` |
161
+ | `header?` | `string` |
162
+
163
+ ___
164
+
148
165
  ### DataTypes
149
166
 
150
167
  Ƭ **DataTypes**: ``"string"`` \| ``"number"`` \| ``"boolean"`` \| ``"object"`` \| ``"integer"`` \| ``"array"`` \| ``"null"``
@@ -153,13 +170,13 @@ ___
153
170
 
154
171
  ### Encrypted
155
172
 
156
- Ƭ **Encrypted**<`Data`\>: `Object`
173
+ Ƭ **Encrypted**<`_Data`\>: `Object`
157
174
 
158
175
  #### Type parameters
159
176
 
160
177
  | Name | Type |
161
178
  | :------ | :------ |
162
- | `Data` | `string` |
179
+ | `_Data` | `string` |
163
180
 
164
181
  #### Type declaration
165
182
 
@@ -167,7 +184,7 @@ ___
167
184
  | :------ | :------ |
168
185
  | `encrypted_data` | `Object` |
169
186
  | `encrypted_data.algorithm` | `AesKeyAlgorithm` |
170
- | `encrypted_data.data` | `Data` |
187
+ | `encrypted_data.data` | `string` |
171
188
  | `encrypted_data.iv` | `string` |
172
189
  | `encrypted_key` | `Object` |
173
190
  | `encrypted_key.encrypted_key` | `string` |
@@ -286,7 +303,7 @@ You can supply an option type argument if you know exactly what the properties w
286
303
 
287
304
  | Name | Type |
288
305
  | :------ | :------ |
289
- | `Properties` | `any` |
306
+ | `Properties` | `Json` |
290
307
 
291
308
  #### Type declaration
292
309
 
@@ -331,7 +348,7 @@ This is what @raytio/core exposes, which is more useable than @see Verification
331
348
  | `nID` | [`NId`](#nid) | nId of the verification |
332
349
  | `provider` | [`VerificationProvider`](#verificationprovider) | - |
333
350
  | `signature` | `string` | - |
334
- | `value` | `string` \| `number` | - |
351
+ | `value` | `unknown` | - |
335
352
  | `verified` | `boolean` | whether the `fieldName`/`value` pair is verified, as confirmed by the API. This should be the single source of truth. |
336
353
  | `xId` | `string` | this will be a unique id to group verifications from the same PO. Doesn't work yet |
337
354
 
@@ -380,6 +397,7 @@ Raytio's variant of JSON Schema. All props marked as optional except
380
397
  | `display.head_sub?` | `Object` | list of fields to be considered the subheader of the PO fields joined with a space unless `format` format string is supplied |
381
398
  | `display.head_sub.fields` | `string`[] | - |
382
399
  | `display.head_sub.format?` | `string` | - |
400
+ | `end_date?` | `string` | If this tag exists, the schema is deprecated. ISO Date. |
383
401
  | `group_title?` | `string` | the localized title of the `schema_group`. added by the client |
384
402
  | `i18n?` | `Object` | - |
385
403
  | `n_id?` | [`NId`](#nid) | - |
@@ -395,6 +413,7 @@ Raytio's variant of JSON Schema. All props marked as optional except
395
413
  | `schema_group?` | `string` | the group that a schema belongs to, such as "passports". This is useful for forms that accept different types of similar documents. |
396
414
  | `tags?` | [`SchemaTag`](#schematag)[] | - |
397
415
  | `title` | `string` | - |
416
+ | `title_plural?` | `string` | plural version of the title |
398
417
  | `type?` | [`DataTypes`](#datatypes) | - |
399
418
  | `verified_fields?` | (`string` \| [`ConditionallyRequired`](#conditionallyrequired))[] | originally `string[]`, the client modifies this |
400
419
  | `wasExpandedByClient?` | `boolean` | - |
@@ -416,7 +435,7 @@ ___
416
435
  | `content?` | `string` | only checkbox uses this prop |
417
436
  | `contentEncoding?` | ``"base64"`` | - |
418
437
  | `contentMediaType?` | `string` | - |
419
- | `default?` | `unknown` | - |
438
+ | `default?` | `unknown` | the default value |
420
439
  | `default_signature_name?` | `string` | used on fields that are a signature file picker, see !849 also used to determine if the MediaPicker should be shown inline |
421
440
  | `description?` | `string` | - |
422
441
  | `description_decorator?` | ``"md"`` | specifies that the description is formatted in markdown |
@@ -425,7 +444,7 @@ ___
425
444
  | `examples?` | `unknown`[] | - |
426
445
  | `format?` | ``"date"`` \| ``"date-time"`` | - |
427
446
  | `image_silhouette?` | `string` | If this schema requires a photo of a document, you can specify a URL to a silhouette image which will be overlaid on top of the camera. For best results, the image should have a transparent background + minimal white foreground |
428
- | `items?` | `Object` | for nested JSON |
447
+ | `items?` | `Object` | `items` is used for nested arrays, (while `properties` is used for nested objects) |
429
448
  | `items.properties` | `Object` | - |
430
449
  | `items.type` | [`DataTypes`](#datatypes) | - |
431
450
  | `lookup?` | `string` | URL to a JSON file in the `Lookup` format |
@@ -439,22 +458,25 @@ ___
439
458
  | `pattern?` | `string` | - |
440
459
  | `patternMessage?` | `string` | if a `pattern` is specified, this is the error message |
441
460
  | `priority?` | `number` | - |
461
+ | `properties?` | `Object` | `properties` is used for nested objects, (while `items` is used for nested arrays) |
442
462
  | `readOnly?` | `boolean` | readOnly means the Wizard won't show this field |
463
+ | `table_empty_message?` | `string` | if this field is a table input, this determines the text to show if the table is empty |
443
464
  | `tags?` | [`SchemaFieldTag`](#schemafieldtag)[] | - |
444
465
  | `title?` | `string` | - |
466
+ | `title_plural?` | `string` | - |
445
467
  | `type?` | [`DataTypes`](#datatypes) | - |
446
468
 
447
469
  ___
448
470
 
449
471
  ### SchemaFieldTag
450
472
 
451
- Ƭ **SchemaFieldTag**: ``"password"`` \| \`group:${string}\` \| \`upload-group:${string}\` \| ``"display:stars"`` \| ``"display:no_autofill"`` \| ``"display:currency"`` \| ``"display:cascade"`` \| ``"display:survey"`` \| ``"display:quoting"`` \| ``"display:customModal"`` \| ``"display:showOnWizard"`` \| \`display:main\_media:${string}\` \| ``"action:client_upload"`` \| ``"verify:show_if_pending"`` \| ``"special:hide_select_behind_button"`` \| ``"type:extract_required"``
473
+ Ƭ **SchemaFieldTag**: ``"password"`` \| \`group:${string}\` \| \`upload-group:${string}\` \| ``"display:stars"`` \| ``"display:no_autofill"`` \| ``"display:currency"`` \| ``"display:cascade"`` \| ``"display:survey"`` \| ``"display:quoting"`` \| ``"display:customModal"`` \| ``"display:terms_conditions"`` \| ``"display:showOnWizard"`` \| \`display:main\_media:${string}\` \| ``"action:client_upload"`` \| ``"verify:show_if_pending"`` \| ``"special:hide_select_behind_button"`` \| ``"type:extract_required"``
452
474
 
453
475
  ___
454
476
 
455
477
  ### SchemaMetadata
456
478
 
457
- Ƭ **SchemaMetadata**: `Pick`<[`Schema`](#schema), ``"name"`` \| ``"title"`` \| ``"description"`` \| ``"schema_group"`` \| ``"i18n"`` \| ``"display"`` \| ``"clientLocale"`` \| ``"groupNames"`` \| ``"group_title"``\> & { `__typeof__`: ``"You cannot supply SchemaMetadata to a function that expects Schema"`` ; `isProfileSchema`: `boolean` ; `isSpSchema`: `boolean` }
479
+ Ƭ **SchemaMetadata**: `Pick`<[`Schema`](#schema), ``"name"`` \| ``"title"`` \| ``"description"`` \| ``"schema_group"`` \| ``"end_date"`` \| ``"i18n"`` \| ``"display"`` \| ``"tags"`` \| ``"clientLocale"`` \| ``"groupNames"`` \| ``"title_plural"`` \| ``"group_title"``\> & { `__typeof__`: ``"You cannot supply SchemaMetadata to a function that expects Schema"`` ; `isProfileSchema`: `boolean` ; `isSpSchema`: `boolean` }
458
480
 
459
481
  Only certain properties from the schema
460
482
 
@@ -462,7 +484,7 @@ ___
462
484
 
463
485
  ### SchemaTag
464
486
 
465
- Ƭ **SchemaTag**: ``"action:experimental_pass_object_store_id"`` \| ``"action:verify"`` \| ``"default_camera:rear"`` \| ``"default_camera:front"`` \| ``"type:service_provider"`` \| ``"type:service_offer"`` \| ``"type:marketplace"`` \| ``"type:client_only"`` \| ``"type:globally_unique_field"``
487
+ Ƭ **SchemaTag**: ``"action:experimental_pass_object_store_id"`` \| ``"action:verify"`` \| ``"default_camera:rear"`` \| ``"default_camera:front"`` \| \`link\_to:${string}:${string}\` \| ``"type:service_provider"`` \| ``"type:service_offer"`` \| ``"type:marketplace"`` \| ``"type:client_only"`` \| ``"type:globally_unique_field"``
466
488
 
467
489
  ___
468
490
 
@@ -526,6 +548,18 @@ the DataContext don't have the value.
526
548
 
527
549
  ___
528
550
 
551
+ ### VerificationPayload
552
+
553
+ Ƭ **VerificationPayload**<`WithValue`\>: { `field`: `string` ; `metadata?`: `Record`<`string`, `unknown`\> ; `passed`: `boolean` ; `request_div`: `string` ; `schema?`: `string` ; `source`: `string` ; `source_hashed_n_id?`: [`NId`](#nid) ; `source_n_id?`: [`NId`](modules.md#nid) ; `type?`: ``null`` ; `v_id`: `string` ; `valid_until?`: `string` ; `verification_date`: `string` ; `verifier_div`: `string` ; `verifier_id?`: [`NId`](modules.md#nid) ; `verifier_service_id?`: [`NId`](modules.md#nid) ; `verifier_source_id?`: [`NId`](modules.md#nid) } & `WithValue` extends ``true`` ? { `value`: `string` \| `number` } : {}
554
+
555
+ #### Type parameters
556
+
557
+ | Name | Type |
558
+ | :------ | :------ |
559
+ | `WithValue` | extends `boolean` |
560
+
561
+ ___
562
+
529
563
  ### VerificationProvider
530
564
 
531
565
  Ƭ **VerificationProvider**: `Object`
@@ -559,7 +593,7 @@ in the query parameters, it needs to be base64 and/or url encoded.
559
593
  | `emails?` | `string`[] | if specified, the email addresses that a submission should be sent to |
560
594
  | `expiry_date?` | `number` | number of days in the future |
561
595
  | `pages` | [`WizardPage`](#wizardpage)[] | - |
562
- | `quick_onboard?` | `boolean` | whether the "quick onboard" process should be used if the user visits this form, and they are not logged in. If false, the standard sign-up process will be used |
596
+ | `quick_onboard?` | `boolean` | whether the passwordless-signup process should be used if the user visits this form, and they are not logged in. If false, the standard sign-up process will be used |
563
597
  | `reference?` | `string` | - |
564
598
  | `relationships?` | { `from`: `string` ; `properties?`: `Record`<`string`, `any`\> ; `to`: `string` ; `type`: `string` }[] | a list of relationships that should be created after the wizard completes (see #987) |
565
599
  | `return_to?` | `string` | the callback url to redirect to once complete. Must be in the AA's list of authorized callback urls |
@@ -585,9 +619,13 @@ configuration data for a single wizard page (@see WizardConfig)
585
619
  | :------ | :------ | :------ |
586
620
  | `allow_upload?` | `boolean` | do not allow uploading in ImageDynamicSection if this is explictly false |
587
621
  | `create_new_text?` | `string` | custom text to display on the Create New button |
588
- | `description?` | `string` | - |
622
+ | `description?` | `string` | the fallback description, if there isn't one for the specific situation |
623
+ | `description_create?` | `string` | - |
624
+ | `description_select?` | `string` | - |
625
+ | `description_update?` | `string` | - |
589
626
  | `display_field_description?` | `boolean` | whether the field descriptions should be shown |
590
627
  | `display_field_title?` | `boolean` | whether the field titles should be shown |
628
+ | `display_mode?` | ``"light"`` \| ``"dark"`` \| ``"default"`` | can you force the colour theme to change for just one page (#1066, #1074). At the moment this on pages that use WebcamImageCapture |
591
629
  | `display_schema_description?` | `boolean` | whether the schema description should be shown |
592
630
  | `extract_threshold?` | `number` | for ImageDynamicSection, the minimum score to be treated as a pass |
593
631
  | `extract_threshold_fail_action?` | ``"capture"`` \| ``"capture_review"`` \| ``"recapture_or_next_step"`` \| ``"review"`` \| ``"next_step"`` | for ImageDynamicSection, the action to take if pre-verify fails |
@@ -605,5 +643,5 @@ configuration data for a single wizard page (@see WizardConfig)
605
643
  | `schemas` | `string`[] | - |
606
644
  | `selection_hierarchy_json?` | `string` | a URL to a preset for configuing NestedSchemaSelect. @see DeepConfig |
607
645
  | `service_provider_link?` | `boolean` | see #463 |
608
- | `share?` | ``"profile"`` \| ``"verification"`` \| ``"both"`` | the infomation to share. undefined implies both. |
646
+ | `share?` | ``"profile"`` \| ``"verification"`` \| ``"both"`` | the information to share. undefined implies both. |
609
647
  | `verify_data?` | `boolean` | if `false`, ProfileObjects created while completing the form will not be verified. `undefined` implies `true` |
package/dist/crypto.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export declare type Encrypted<Data = string> = {
1
+ export declare type Encrypted<_Data = string> = {
2
2
  encrypted_key: {
3
3
  encrypted_key: string;
4
4
  };
5
5
  encrypted_data: {
6
6
  iv: string;
7
- data: Data;
7
+ data: string;
8
8
  algorithm: AesKeyAlgorithm;
9
9
  };
10
10
  };
package/dist/raytio.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import { Encrypted } from "./crypto";
2
- import { Colors } from "./theme";
2
+ import { Colors, CustomFonts } from "./theme";
3
3
  /** @internal see Microsoft/TypeScript#202 */
4
4
  export declare type StringWithIdentity<T> = string & {
5
5
  $$typeof$$: T;
6
6
  };
7
+ /** @internal */
8
+ declare type Json = Record<string, any>;
7
9
  /** A `p_id` is the ID of a @see Relationship */
8
10
  export declare type PId = StringWithIdentity<"PId">;
9
11
  /** An `i_id` is the ID of an @see Instance */
@@ -19,7 +21,7 @@ export declare type AId = StringWithIdentity<"AId">;
19
21
  export declare type DataTypes = "string" | "number" | "boolean" | "object" | "integer" | "array" | "null";
20
22
  export declare type SubmissionStatus = "Submitted" | "Processing" | "Rejected" | "Expired" | "Completed" | "DataChanged" | "Received" | "Accepted";
21
23
  /** You can supply an option type argument if you know exactly what the properties will be */
22
- export declare type ProfileObject<Properties = any> = {
24
+ export declare type ProfileObject<Properties = Json> = {
23
25
  n_id: NId;
24
26
  properties: Properties;
25
27
  labels: string[];
@@ -29,10 +31,10 @@ export declare type ProfileObject<Properties = any> = {
29
31
  * @internal the client adds this, if this PO doesn't actually belong to the current user,
30
32
  * i.e. it's actually from a submission. If truthy, it's the `[aId, iId]` of the submission.
31
33
  */
32
- isFromSubmission?: [aId: string, iId: string];
34
+ isFromSubmission?: [aId: AId, iId: IId];
33
35
  };
34
36
  /** @internal This is what we send the API */
35
- export declare type ProfileObjectForUpload<Properties = any> = {
37
+ export declare type ProfileObjectForUpload<Properties = Json> = {
36
38
  properties: Properties;
37
39
  document?: {
38
40
  content?: string | Encrypted;
@@ -91,12 +93,15 @@ export declare type AA = {
91
93
  /** markdown or string help information including [phoneNumber || email] */
92
94
  aa_help?: string;
93
95
  theme?: {
94
- colors: Colors;
96
+ font?: CustomFonts;
97
+ colors?: Colors;
95
98
  };
96
99
  /** the n_id of the associated service provider */
97
100
  service_provider_n_id?: NId;
98
101
  /** the id of the associated organisation */
99
102
  org_id: string;
103
+ /** configuration for the submission rules */
104
+ ruleset?: unknown;
100
105
  /** @internal */
101
106
  _transitions?: unknown[];
102
107
  };
@@ -174,3 +179,4 @@ export declare type Validation = {
174
179
  };
175
180
  };
176
181
  };
182
+ export {};
package/dist/schema.d.ts CHANGED
@@ -7,12 +7,13 @@ export declare type ConditionallyRequired = {
7
7
  [fieldName: string]: string[];
8
8
  };
9
9
  };
10
- export declare type SchemaFieldTag = "password" | `group:${string}` | `upload-group:${string}` | "display:stars" | "display:no_autofill" | "display:currency" | "display:cascade" | "display:survey" | "display:quoting" | "display:customModal" | "display:showOnWizard" | `display:main_media:${string}` | "action:client_upload" | "verify:show_if_pending" | "special:hide_select_behind_button" | "type:extract_required";
11
- export declare type SchemaTag = "action:experimental_pass_object_store_id" | "action:verify" | "default_camera:rear" | "default_camera:front" | "type:service_provider" | "type:service_offer" | "type:marketplace" | "type:client_only" | "type:globally_unique_field";
10
+ export declare type SchemaFieldTag = "password" | `group:${string}` | `upload-group:${string}` | "display:stars" | "display:no_autofill" | "display:currency" | "display:cascade" | "display:survey" | "display:quoting" | "display:customModal" | "display:terms_conditions" | "display:showOnWizard" | `display:main_media:${string}` | "action:client_upload" | "verify:show_if_pending" | "special:hide_select_behind_button" | "type:extract_required";
11
+ export declare type SchemaTag = "action:experimental_pass_object_store_id" | "action:verify" | "default_camera:rear" | "default_camera:front" | `link_to:${string}:${string}` | "type:service_provider" | "type:service_offer" | "type:marketplace" | "type:client_only" | "type:globally_unique_field";
12
12
  export declare type SchemaField = {
13
13
  /** @deprecated don't use, it's inconsistent */
14
14
  $id?: string;
15
15
  title?: string;
16
+ title_plural?: string;
16
17
  description?: string;
17
18
  /** readOnly means the Wizard won't show this field */
18
19
  readOnly?: boolean;
@@ -26,8 +27,7 @@ export declare type SchemaField = {
26
27
  maxLength?: number;
27
28
  /** @deprecated raytio's usage not documented */
28
29
  minLength?: number;
29
- /** @internal added by the client. It's the default value based on the existing values from subschema on their profile */
30
- defaultValue?: unknown;
30
+ /** the default value */
31
31
  default?: unknown;
32
32
  pattern?: string;
33
33
  /** whether the field should be encrypted */
@@ -35,13 +35,17 @@ export declare type SchemaField = {
35
35
  format?: "date" | "date-time";
36
36
  contentMediaType?: string;
37
37
  contentEncoding?: "base64";
38
- /** for nested JSON */
38
+ /** `items` is used for nested arrays, (while `properties` is used for nested objects) */
39
39
  items?: {
40
40
  type: DataTypes;
41
41
  properties: {
42
42
  [subFieldName: string]: SchemaField;
43
43
  };
44
44
  };
45
+ /** `properties` is used for nested objects, (while `items` is used for nested arrays) */
46
+ properties?: {
47
+ [subFieldName: string]: SchemaField;
48
+ };
45
49
  /** If this field refers to a sub-object */
46
50
  $ref?: string;
47
51
  /**
@@ -61,10 +65,10 @@ export declare type SchemaField = {
61
65
  /** URL to a JSON file in the `Lookup` format */
62
66
  lookup?: string;
63
67
  /** @internal the client adds this - it's the fieldName. */
64
- $prop?: string;
68
+ $prop: string;
65
69
  priority?: number;
66
70
  /** @internal if supplied, it's the existing field values. Added by the client */
67
- subObjectRef?: (string | number)[];
71
+ subObjectRef?: unknown[];
68
72
  /** specifies that the description is formatted in markdown */
69
73
  description_decorator?: "md";
70
74
  /** if a `pattern` is specified, this is the error message */
@@ -80,6 +84,8 @@ export declare type SchemaField = {
80
84
  };
81
85
  /** if this field is a table input, this determines the text to show on the "Add Row" btn */
82
86
  add_row_btn_label?: string;
87
+ /** if this field is a table input, this determines the text to show if the table is empty */
88
+ table_empty_message?: string;
83
89
  /**
84
90
  * used on fields that are a signature file picker, see !849
85
91
  * also used to determine if the MediaPicker should be shown inline
@@ -105,6 +111,8 @@ export declare type Schema = {
105
111
  name: string;
106
112
  title: string;
107
113
  description: string;
114
+ /** plural version of the title */
115
+ title_plural?: string;
108
116
  /**
109
117
  * the group that a schema belongs to, such as "passports". This is useful for
110
118
  * forms that accept different types of similar documents.
@@ -129,6 +137,8 @@ export declare type Schema = {
129
137
  if?: Schema;
130
138
  then?: Schema;
131
139
  }[];
140
+ /** If this tag exists, the schema is deprecated. ISO Date. */
141
+ end_date?: string;
132
142
  /** 🚨 Note that there are cases where properties are undefined, e.g. if the schema is a sub-object */
133
143
  properties: {
134
144
  [fieldName: string]: SchemaField;
@@ -166,7 +176,7 @@ export declare type Schema = {
166
176
  $loading_pending_ver_resubmit: {
167
177
  title: string;
168
178
  };
169
- [fieldNameOrGroupName: string]: SchemaField & {
179
+ [fieldNameOrGroupName: string]: Omit<SchemaField, "$prop"> & {
170
180
  title_plural?: string;
171
181
  };
172
182
  };
@@ -266,7 +276,7 @@ export declare type Schema = {
266
276
  };
267
277
  };
268
278
  /** Only certain properties from the schema */
269
- export declare type SchemaMetadata = Pick<Schema, "name" | "title" | "description" | "schema_group" | "i18n" | "display" | "clientLocale" | "groupNames" | "group_title"> & {
279
+ export declare type SchemaMetadata = Pick<Schema, "name" | "title" | "description" | "schema_group" | "end_date" | "i18n" | "display" | "tags" | "clientLocale" | "groupNames" | "title_plural" | "group_title"> & {
270
280
  /**
271
281
  * @deprecated this prop exists so that SchemaMetadata does not extend Schema.
272
282
  * use `getSchema(schemaName)` to fetch the full schema
@@ -275,3 +285,5 @@ export declare type SchemaMetadata = Pick<Schema, "name" | "title" | "descriptio
275
285
  isProfileSchema: boolean;
276
286
  isSpSchema: boolean;
277
287
  };
288
+ /** @ignore */
289
+ export declare type RelationDefinition = NonNullable<Schema["relationships"]>[number];
package/dist/theme.d.ts CHANGED
@@ -24,3 +24,7 @@ export declare type Colors = {
24
24
  blankBackground: string;
25
25
  blank: string;
26
26
  };
27
+ export declare type CustomFonts = {
28
+ header?: string;
29
+ body?: string;
30
+ };
@@ -1,4 +1,28 @@
1
1
  import { NId, ProfileObject } from "./raytio";
2
+ export declare type VerificationPayload<WithValue extends boolean> = {
3
+ field: string;
4
+ schema?: string;
5
+ metadata?: Record<string, unknown>;
6
+ passed: boolean;
7
+ request_div: string;
8
+ /** @deprecated don't use this, it looks like the schema name but it's not */
9
+ source: string;
10
+ /** the n_id of the parent profile object that this ver belongs (NOT the n_id of the field) */
11
+ source_n_id?: NId;
12
+ /** like `source_n_id` */
13
+ source_hashed_n_id?: NId;
14
+ type?: null;
15
+ v_id: string;
16
+ verification_date: string;
17
+ verifier_id?: NId;
18
+ verifier_source_id?: NId;
19
+ verifier_service_id?: NId;
20
+ verifier_div: string;
21
+ /** ISO Date */
22
+ valid_until?: string;
23
+ } & (WithValue extends true ? {
24
+ value: string | number;
25
+ } : {});
2
26
  /**
3
27
  * Different APIs inconsistently include the `value` prop. If you know it exists,
4
28
  * use `Verification<true>`, otherwise just `Verification`. Verifications from
@@ -16,24 +40,7 @@ export declare type Verification<WithValue extends boolean = false> = ProfileObj
16
40
  verifications: [
17
41
  {
18
42
  signature: string;
19
- data: {
20
- field: string;
21
- metadata?: Record<string, unknown>;
22
- passed: boolean;
23
- request_div: string;
24
- /** @deprecated don't use this, it looks like the schema name but it's not */
25
- source: string;
26
- /** the n_id of the parent profile object that this ver belongs (NOT the n_id of the field) */
27
- source_n_id: NId;
28
- v_id: string;
29
- verification_date: string;
30
- verifier_id?: NId;
31
- verifier_source_id?: NId;
32
- verifier_service_id?: NId;
33
- verifier_div: string;
34
- } & (WithValue extends true ? {
35
- value: string | number;
36
- } : {});
43
+ data: VerificationPayload<WithValue>;
37
44
  }
38
45
  ];
39
46
  }>;
@@ -67,7 +74,7 @@ export declare type VerificationProvider = {
67
74
  /** This is what @raytio/core exposes, which is more useable than @see Verification */
68
75
  export declare type RealVer = {
69
76
  fieldName: string;
70
- value: string | number;
77
+ value: unknown;
71
78
  provider: VerificationProvider;
72
79
  signature: string;
73
80
  /**
@@ -5,6 +5,8 @@ exports.POVerification = exports.FieldVerification = void 0;
5
5
  * "Not Verified" means show no badge, cf. "Verified False" means the
6
6
  * verifier revealed that the data was wrong. So show a ❌
7
7
  */
8
+ // We cannot change the enum values, since ScoreRules have been generated
9
+ // with the enum values hardcoded. The enum value are also used to find the "best" or "worst" verification (lower=better)
8
10
  var FieldVerification;
9
11
  (function (FieldVerification) {
10
12
  FieldVerification[FieldVerification["Verified"] = 60001] = "Verified";
@@ -12,6 +14,8 @@ var FieldVerification;
12
14
  FieldVerification[FieldVerification["VerifiedFalse"] = 60003] = "VerifiedFalse";
13
15
  FieldVerification[FieldVerification["Expired"] = 60004] = "Expired";
14
16
  })(FieldVerification = exports.FieldVerification || (exports.FieldVerification = {}));
17
+ // We cannot change the enum values, since ScoreRules have been generated
18
+ // with the enum values hardcoded.
15
19
  var POVerification;
16
20
  (function (POVerification) {
17
21
  POVerification[POVerification["FullyVerified"] = 70001] = "FullyVerified";
package/dist/wizard.d.ts CHANGED
@@ -5,7 +5,11 @@ export declare type WizardPage = {
5
5
  name?: string | symbol;
6
6
  filter: "oneOf" | "anyOf";
7
7
  schemas: string[];
8
+ /** the fallback description, if there isn't one for the specific situation */
8
9
  description?: string;
10
+ description_select?: string;
11
+ description_create?: string;
12
+ description_update?: string;
9
13
  /** if explictly == false, then it's an AO (not a PO), in which case there can only be one schema */
10
14
  profile?: boolean;
11
15
  /** if true this page can be skipped. The PageResult wil be undefined */
@@ -43,8 +47,10 @@ export declare type WizardPage = {
43
47
  verify_data?: boolean;
44
48
  /** a list of fields that should not be required, even if the schema says they're required */
45
49
  optional_fields?: string[];
46
- /** the infomation to share. undefined implies both. */
50
+ /** the information to share. undefined implies both. */
47
51
  share?: "profile" | "verification" | "both";
52
+ /** can you force the colour theme to change for just one page (#1066, #1074). At the moment this on pages that use WebcamImageCapture */
53
+ display_mode?: "light" | "dark" | "default";
48
54
  };
49
55
  /**
50
56
  * when a form link is generated, this is what gets saved on the API.
@@ -77,7 +83,7 @@ export declare type WizardConfig = {
77
83
  /** if specified, the email addresses that a submission should be sent to */
78
84
  emails?: string[];
79
85
  /**
80
- * whether the "quick onboard" process should be used if the user visits
86
+ * whether the passwordless-signup process should be used if the user visits
81
87
  * this form, and they are not logged in. If false, the standard sign-up
82
88
  * process will be used
83
89
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raytio/types",
3
- "version": "5.2.1",
3
+ "version": "6.0.0",
4
4
  "license": "MIT",
5
5
  "main": "index",
6
6
  "types": "index",
package/src/crypto.ts CHANGED
@@ -1,10 +1,11 @@
1
- export type Encrypted<Data = string> = {
1
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
+ export type Encrypted<_Data = string> = {
2
3
  encrypted_key: {
3
4
  encrypted_key: string;
4
5
  };
5
6
  encrypted_data: {
6
7
  iv: string;
7
- data: Data;
8
+ data: string;
8
9
  algorithm: AesKeyAlgorithm;
9
10
  };
10
11
  };
package/src/raytio.ts CHANGED
@@ -1,9 +1,12 @@
1
1
  import { Encrypted } from "./crypto";
2
- import { Colors } from "./theme";
2
+ import { Colors, CustomFonts } from "./theme";
3
3
 
4
4
  /** @internal see Microsoft/TypeScript#202 */
5
5
  export type StringWithIdentity<T> = string & { $$typeof$$: T };
6
6
 
7
+ /** @internal */
8
+ type Json = Record<string, any>; // TODO: (semver breaking) unknown
9
+
7
10
  /** A `p_id` is the ID of a @see Relationship */
8
11
  export type PId = StringWithIdentity<"PId">;
9
12
  /** An `i_id` is the ID of an @see Instance */
@@ -37,7 +40,7 @@ export type SubmissionStatus =
37
40
  | "Accepted";
38
41
 
39
42
  /** You can supply an option type argument if you know exactly what the properties will be */
40
- export type ProfileObject<Properties = any> = {
43
+ export type ProfileObject<Properties = Json> = {
41
44
  n_id: NId;
42
45
  properties: Properties;
43
46
  labels: string[];
@@ -47,11 +50,11 @@ export type ProfileObject<Properties = any> = {
47
50
  * @internal the client adds this, if this PO doesn't actually belong to the current user,
48
51
  * i.e. it's actually from a submission. If truthy, it's the `[aId, iId]` of the submission.
49
52
  */
50
- isFromSubmission?: [aId: string, iId: string]; // TODO: do NOT use nominal types here, see microsoft/TypeScript#42773
53
+ isFromSubmission?: [aId: AId, iId: IId];
51
54
  };
52
55
 
53
56
  /** @internal This is what we send the API */
54
- export type ProfileObjectForUpload<Properties = any> = {
57
+ export type ProfileObjectForUpload<Properties = Json> = {
55
58
  properties: Properties;
56
59
  document?: {
57
60
  content?: string | Encrypted;
@@ -125,12 +128,18 @@ export type AA = {
125
128
  /** markdown or string help information including [phoneNumber || email] */
126
129
  aa_help?: string;
127
130
  theme?: {
128
- colors: Colors;
131
+ font?: CustomFonts;
132
+ colors?: Colors;
129
133
  };
130
134
  /** the n_id of the associated service provider */
131
135
  service_provider_n_id?: NId;
132
136
  /** the id of the associated organisation */
133
137
  org_id: string;
138
+
139
+ /** configuration for the submission rules */
140
+ // we know the type should be `ScoreConfig`, but we can't rely that it's valid, or the right version
141
+ ruleset?: unknown;
142
+
134
143
  /** @internal */
135
144
  _transitions?: unknown[];
136
145
  };
package/src/schema.ts CHANGED
@@ -23,6 +23,7 @@ export type SchemaFieldTag =
23
23
  | "display:survey"
24
24
  | "display:quoting"
25
25
  | "display:customModal"
26
+ | "display:terms_conditions"
26
27
  | "display:showOnWizard" // added by #837, TODO: document
27
28
  | `display:main_media:${string}` // property name to determine what image to display
28
29
  // other
@@ -38,6 +39,8 @@ export type SchemaTag =
38
39
  // camera
39
40
  | "default_camera:rear"
40
41
  | "default_camera:front"
42
+ // misc
43
+ | `link_to:${/* schemaName */ string}:${/* relationshipType */ string}`
41
44
  // type
42
45
  | "type:service_provider"
43
46
  | "type:service_offer"
@@ -49,6 +52,7 @@ export type SchemaField = {
49
52
  /** @deprecated don't use, it's inconsistent */
50
53
  $id?: string;
51
54
  title?: string;
55
+ title_plural?: string;
52
56
  description?: string;
53
57
  /** readOnly means the Wizard won't show this field */
54
58
  readOnly?: boolean;
@@ -62,8 +66,7 @@ export type SchemaField = {
62
66
  maxLength?: number;
63
67
  /** @deprecated raytio's usage not documented */
64
68
  minLength?: number;
65
- /** @internal added by the client. It's the default value based on the existing values from subschema on their profile */
66
- defaultValue?: unknown;
69
+ /** the default value */
67
70
  default?: unknown;
68
71
  pattern?: string;
69
72
  /** whether the field should be encrypted */
@@ -71,13 +74,17 @@ export type SchemaField = {
71
74
  format?: "date" | "date-time";
72
75
  contentMediaType?: string;
73
76
  contentEncoding?: "base64";
74
- /** for nested JSON */
77
+ /** `items` is used for nested arrays, (while `properties` is used for nested objects) */
75
78
  items?: {
76
79
  type: DataTypes;
77
80
  properties: {
78
81
  [subFieldName: string]: SchemaField;
79
82
  };
80
83
  };
84
+ /** `properties` is used for nested objects, (while `items` is used for nested arrays) */
85
+ properties?: {
86
+ [subFieldName: string]: SchemaField;
87
+ };
81
88
 
82
89
  /** If this field refers to a sub-object */
83
90
  $ref?: string;
@@ -99,10 +106,10 @@ export type SchemaField = {
99
106
  /** URL to a JSON file in the `Lookup` format */
100
107
  lookup?: string;
101
108
  /** @internal the client adds this - it's the fieldName. */
102
- $prop?: string;
109
+ $prop: string;
103
110
  priority?: number;
104
111
  /** @internal if supplied, it's the existing field values. Added by the client */
105
- subObjectRef?: (string | number)[]; //
112
+ subObjectRef?: unknown[];
106
113
  /** specifies that the description is formatted in markdown */
107
114
  description_decorator?: "md";
108
115
  /** if a `pattern` is specified, this is the error message */
@@ -119,6 +126,8 @@ export type SchemaField = {
119
126
  };
120
127
  /** if this field is a table input, this determines the text to show on the "Add Row" btn */
121
128
  add_row_btn_label?: string;
129
+ /** if this field is a table input, this determines the text to show if the table is empty */
130
+ table_empty_message?: string;
122
131
 
123
132
  /**
124
133
  * used on fields that are a signature file picker, see !849
@@ -149,6 +158,8 @@ export type Schema = {
149
158
  title: string;
150
159
  description: string;
151
160
 
161
+ /** plural version of the title */
162
+ title_plural?: string;
152
163
  /**
153
164
  * the group that a schema belongs to, such as "passports". This is useful for
154
165
  * forms that accept different types of similar documents.
@@ -177,6 +188,9 @@ export type Schema = {
177
188
  then?: Schema;
178
189
  }[];
179
190
 
191
+ /** If this tag exists, the schema is deprecated. ISO Date. */
192
+ end_date?: string;
193
+
180
194
  /** 🚨 Note that there are cases where properties are undefined, e.g. if the schema is a sub-object */
181
195
  properties: {
182
196
  [fieldName: string]: SchemaField;
@@ -188,6 +202,7 @@ export type Schema = {
188
202
  // @ts-expect-error I don't understand what's wrong
189
203
  $schema: Schema;
190
204
  // not that for entries that start in "group:" or $loading_, only the title field will be used.
205
+ // ^ the exception is `group:{GROUP_NAME}:{SUB_GROUP}.field` which is used for the combined field title/desc
191
206
  // normal fields can specify any field attributes to override.
192
207
 
193
208
  // see !1796 for where these are used
@@ -202,7 +217,9 @@ export type Schema = {
202
217
  $loading_delete_pending_ver: { title: string };
203
218
  $loading_pending_ver_resubmit: { title: string };
204
219
 
205
- [fieldNameOrGroupName: string]: SchemaField & { title_plural?: string };
220
+ [fieldNameOrGroupName: string]: Omit<SchemaField, "$prop"> & {
221
+ title_plural?: string;
222
+ };
206
223
  };
207
224
  };
208
225
  /** @internal the client adds this after processing the i18n property */
@@ -311,11 +328,14 @@ export type SchemaMetadata = Pick<
311
328
  | "title"
312
329
  | "description"
313
330
  | "schema_group"
331
+ | "end_date"
314
332
  | "i18n"
315
333
  | "display"
334
+ | "tags"
316
335
  // added by the client
317
336
  | "clientLocale"
318
337
  | "groupNames"
338
+ | "title_plural"
319
339
  | "group_title"
320
340
  > & {
321
341
  /**
@@ -327,3 +347,6 @@ export type SchemaMetadata = Pick<
327
347
  isProfileSchema: boolean;
328
348
  isSpSchema: boolean;
329
349
  };
350
+
351
+ /** @ignore */
352
+ export type RelationDefinition = NonNullable<Schema["relationships"]>[number];
package/src/theme.ts CHANGED
@@ -24,3 +24,5 @@ export type Colors = {
24
24
  blankBackground: string;
25
25
  blank: string;
26
26
  };
27
+
28
+ export type CustomFonts = { header?: string; body?: string };
@@ -1,5 +1,34 @@
1
1
  import { NId, ProfileObject } from "./raytio";
2
2
 
3
+ export type VerificationPayload<WithValue extends boolean> = {
4
+ // we deliberately haven't defined 'sub'
5
+ field: string;
6
+ schema?: string;
7
+ metadata?: Record<string, unknown>;
8
+ passed: boolean;
9
+ request_div: string;
10
+ /** @deprecated don't use this, it looks like the schema name but it's not */
11
+ source: string;
12
+ /** the n_id of the parent profile object that this ver belongs (NOT the n_id of the field) */
13
+ source_n_id?: NId;
14
+ /** like `source_n_id` */
15
+ source_hashed_n_id?: NId;
16
+ type?: null;
17
+ v_id: string;
18
+ verification_date: string;
19
+ verifier_id?: NId;
20
+ verifier_source_id?: NId;
21
+ verifier_service_id?: NId;
22
+ verifier_div: string;
23
+ /** ISO Date */
24
+ valid_until?: string;
25
+ // we are disabling the eslint rule beacuse even tho `{}` acts illogically in typescript,
26
+ // in this case it's working as expected in the intersection type, see
27
+ // https://github.com/typescript-eslint/typescript-eslint/issues/2063#issuecomment-632833366
28
+ // and https://github.com/typescript-eslint/typescript-eslint/issues/2063#issuecomment-645510515
29
+ // eslint-disable-next-line @typescript-eslint/ban-types
30
+ } & (WithValue extends true ? { value: string | number } : {});
31
+
3
32
  /**
4
33
  * Different APIs inconsistently include the `value` prop. If you know it exists,
5
34
  * use `Verification<true>`, otherwise just `Verification`. Verifications from
@@ -17,27 +46,7 @@ export type Verification<WithValue extends boolean = false> = ProfileObject<{
17
46
  verifications: [
18
47
  {
19
48
  signature: string;
20
- data: {
21
- field: string;
22
- metadata?: Record<string, unknown>;
23
- passed: boolean;
24
- request_div: string;
25
- /** @deprecated don't use this, it looks like the schema name but it's not */
26
- source: string;
27
- /** the n_id of the parent profile object that this ver belongs (NOT the n_id of the field) */
28
- source_n_id: NId;
29
- v_id: string;
30
- verification_date: string;
31
- verifier_id?: NId;
32
- verifier_source_id?: NId;
33
- verifier_service_id?: NId;
34
- verifier_div: string;
35
- // we are disabling the eslint rule beacuse even tho `{}` acts illogically in typescript,
36
- // in this case it's working as expected in the intersection type, see
37
- // https://github.com/typescript-eslint/typescript-eslint/issues/2063#issuecomment-632833366
38
- // and https://github.com/typescript-eslint/typescript-eslint/issues/2063#issuecomment-645510515
39
- // eslint-disable-next-line @typescript-eslint/ban-types
40
- } & (WithValue extends true ? { value: string | number } : {});
49
+ data: VerificationPayload<WithValue>;
41
50
  },
42
51
  ];
43
52
  }>;
@@ -46,6 +55,8 @@ export type Verification<WithValue extends boolean = false> = ProfileObject<{
46
55
  * "Not Verified" means show no badge, cf. "Verified False" means the
47
56
  * verifier revealed that the data was wrong. So show a ❌
48
57
  */
58
+ // We cannot change the enum values, since ScoreRules have been generated
59
+ // with the enum values hardcoded. The enum value are also used to find the "best" or "worst" verification (lower=better)
49
60
  export enum FieldVerification {
50
61
  Verified = 60_001,
51
62
  NotVerified,
@@ -53,6 +64,8 @@ export enum FieldVerification {
53
64
  Expired,
54
65
  }
55
66
 
67
+ // We cannot change the enum values, since ScoreRules have been generated
68
+ // with the enum values hardcoded.
56
69
  export enum POVerification {
57
70
  FullyVerified = 70_001,
58
71
  PartiallyVerified,
@@ -75,7 +88,7 @@ export type VerificationProvider = {
75
88
  /** This is what @raytio/core exposes, which is more useable than @see Verification */
76
89
  export type RealVer = {
77
90
  fieldName: string;
78
- value: string | number;
91
+ value: unknown;
79
92
  provider: VerificationProvider;
80
93
  signature: string;
81
94
  /**
package/src/wizard.ts CHANGED
@@ -7,7 +7,12 @@ export type WizardPage = {
7
7
  filter: "oneOf" | "anyOf";
8
8
  schemas: string[];
9
9
 
10
+ /** the fallback description, if there isn't one for the specific situation */
10
11
  description?: string;
12
+ description_select?: string;
13
+ description_create?: string;
14
+ description_update?: string;
15
+
11
16
  /** if explictly == false, then it's an AO (not a PO), in which case there can only be one schema */
12
17
  profile?: boolean;
13
18
  /** if true this page can be skipped. The PageResult wil be undefined */
@@ -61,9 +66,12 @@ export type WizardPage = {
61
66
  /** a list of fields that should not be required, even if the schema says they're required */
62
67
  optional_fields?: string[];
63
68
 
64
- /** the infomation to share. undefined implies both. */
69
+ /** the information to share. undefined implies both. */
65
70
  // TODO: 'profile' is not supported yet
66
71
  share?: "profile" | "verification" | "both";
72
+
73
+ /** can you force the colour theme to change for just one page (#1066, #1074). At the moment this on pages that use WebcamImageCapture */
74
+ display_mode?: "light" | "dark" | "default";
67
75
  };
68
76
 
69
77
  /**
@@ -107,7 +115,7 @@ export type WizardConfig = {
107
115
  emails?: string[];
108
116
 
109
117
  /**
110
- * whether the "quick onboard" process should be used if the user visits
118
+ * whether the passwordless-signup process should be used if the user visits
111
119
  * this form, and they are not logged in. If false, the standard sign-up
112
120
  * process will be used
113
121
  */