@raytio/types 6.0.2 → 7.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
@@ -30,8 +30,10 @@ Hovering over the type in VSCode will display documentation and available proper
30
30
  ### Type aliases
31
31
 
32
32
  - [AA](#aa)
33
+ - [AATags](#aatags)
33
34
  - [AId](#aid)
34
35
  - [Colors](#colors)
36
+ - [CommonSchemaAttributes](#commonschemaattributes)
35
37
  - [ConditionallyRequired](#conditionallyrequired)
36
38
  - [CustomFonts](#customfonts)
37
39
  - [DataTypes](#datatypes)
@@ -51,8 +53,8 @@ Hovering over the type in VSCode will display documentation and available proper
51
53
  - [Schema](#schema)
52
54
  - [SchemaField](#schemafield)
53
55
  - [SchemaFieldTag](#schemafieldtag)
54
- - [SchemaMetadata](#schemametadata)
55
56
  - [SchemaTag](#schematag)
57
+ - [ServerSchemaField](#serverschemafield)
56
58
  - [SubmissionStatus](#submissionstatus)
57
59
  - [UId](#uid)
58
60
  - [Urn](#urn)
@@ -63,8 +65,10 @@ Hovering over the type in VSCode will display documentation and available proper
63
65
  - [VerificationProvider](#verificationprovider)
64
66
  - [WId](#wid)
65
67
  - [Webhook](#webhook)
68
+ - [WebhookStatus](#webhookstatus)
66
69
  - [WizardConfig](#wizardconfig)
67
70
  - [WizardPage](#wizardpage)
71
+ - [WrappedSchema](#wrappedschema)
68
72
 
69
73
  ## Type aliases
70
74
 
@@ -83,19 +87,25 @@ Hovering over the type in VSCode will display documentation and available proper
83
87
  | `callback_uri?` | `string`[] | - |
84
88
  | `description?` | `string` | - |
85
89
  | `name` | `string` | - |
86
- | `org_id` | [`OId`](#oid) | the id of the associated organisation |
90
+ | `org_id` | [`OId`](#oid) | the id of the associated organization |
87
91
  | `picture?` | [`Urn`](#urn) | - |
88
92
  | `picture_url?` | `string` | Easy to use AA logo url for pasting inot emails |
89
93
  | `ruleset?` | `unknown` | configuration for the submission rules |
90
94
  | `scopes?` | `string`[] | - |
91
95
  | `service_provider_n_id?` | [`NId`](#nid) | the n_id of the associated service provider |
92
- | `tags?` | `string`[] | - |
96
+ | `tags?` | [`AATags`](#aatags)[] | - |
93
97
  | `theme?` | `Object` | - |
94
98
  | `theme.colors?` | [`Colors`](#colors) | - |
95
99
  | `theme.font?` | [`CustomFonts`](#customfonts) | - |
96
100
 
97
101
  ___
98
102
 
103
+ ### AATags
104
+
105
+ Ƭ **AATags**: ``"type:client_only"`` \| ``"type:share_with_new_user"`` \| \`related\_service\_provider:n\_id:${NId}\` \| ``"ServiceProvider"``
106
+
107
+ ___
108
+
99
109
  ### AId
100
110
 
101
111
  Ƭ **AId**: `StringWithIdentity`<``"AId"``\>
@@ -121,7 +131,7 @@ ___
121
131
  | `poolblueText` | `string` | - |
122
132
  | `poolblueUi` | `string` | - |
123
133
  | `raytioOrangeHover` | `string` | - |
124
- | `raytioOrangeShade` | `string` | only used by the fancy layout on the login screen |
134
+ | `raytioOrangeShade` | `string` | |
125
135
  | `raytioOrangeText` | `string` | - |
126
136
  | `raytioOrangeUi` | `string` | - |
127
137
  | `sariShade` | `string` | - |
@@ -137,6 +147,41 @@ ___
137
147
 
138
148
  ___
139
149
 
150
+ ### CommonSchemaAttributes
151
+
152
+ Ƭ **CommonSchemaAttributes**: `Object`
153
+
154
+ not exported. Attributes that are identical in both client schema & server schema
155
+
156
+ #### Type declaration
157
+
158
+ | Name | Type | Description |
159
+ | :------ | :------ | :------ |
160
+ | `description` | `string` | - |
161
+ | `display?` | `Object` | - |
162
+ | `display.expand?` | { `fields`: `string`[] ; `label`: `string` }[] | list of fields that should not be shown by default, unless you expand a collpase section which has a name from the label property. Array because there could be multiple expand groups |
163
+ | `display.head_main?` | `Object` | list of fields to be considered the header/name of the PO fields joined with a space unless `format` format string is supplied |
164
+ | `display.head_main.fields` | `string`[] | - |
165
+ | `display.head_main.format?` | `string` | - |
166
+ | `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 |
167
+ | `display.head_sub.fields` | `string`[] | - |
168
+ | `display.head_sub.format?` | `string` | - |
169
+ | `i18n?` | `Object` | - |
170
+ | `name` | `string` | these fields will always exist on schema |
171
+ | `onboard_properties?` | `Object` | only the schema used for the onboarding wizard have this property |
172
+ | `onboard_properties.organizations?` | { `access_applications?`: { `links?`: { `description`: `string` ; `wizardConfig`: `Omit`<[`WizardConfig`](#wizardconfig), ``"a_id"``\> }[] ; `properties`: `Omit`<[`AA`](modules.md#aa), ``"org_id"``\> }[] ; `properties`: [`Organization`](modules.md#organization) }[] | Organizations that should be created. NOTE: if multiple are specified, when the wizard completes, the _first one_ will be selected |
173
+ | `onboard_properties.profile_objects?` | { `properties`: `Record`<`string`, `unknown`\> ; `schema_name`: `string` }[] | Profile Objects that should be created |
174
+ | `onboard_properties.relationships?` | { `from`: `string` ; `properties?`: `Record`<`string`, `string`\> ; `to`: `string` ; `type`: `string` }[] | Relationships that should be created |
175
+ | `onboard_properties.return_to?` | `string` | The relative path in the client to redirect to once finished. May include variables |
176
+ | `relationships?` | { `anyOf?`: `string`[] ; `direction`: ``"from"`` ; `multiple?`: `boolean` ; `oneOf?`: `string`[] ; `properties?`: { [fieldName: string]: [`SchemaField`](#schemafield); } ; `relationship_name`: `string` ; `required?`: `string`[] ; `required_relationship?`: `boolean` ; `type`: `string` }[] | - |
177
+ | `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. |
178
+ | `tags?` | [`SchemaTag`](#schematag)[] | - |
179
+ | `title` | `string` | - |
180
+ | `title_plural?` | `string` | plural version of the title |
181
+ | `type?` | [`DataTypes`](#datatypes) | - |
182
+
183
+ ___
184
+
140
185
  ### ConditionallyRequired
141
186
 
142
187
  Ƭ **ConditionallyRequired**: `Object`
@@ -386,51 +431,10 @@ ___
386
431
 
387
432
  ### Schema
388
433
 
389
- Ƭ **Schema**: `Object`
390
-
391
- Raytio's variant of JSON Schema. All props marked as optional except
392
- `name`. This type can be used for both the schema and for individual fields.
434
+ Ƭ **Schema**: [`CommonSchemaAttributes`](#commonschemaattributes) & { `clientLocale?`: `string` ; `end_date?`: `string` ; `groupNames?`: `Record`<`string`, `string`\> ; `group_title?`: `string` ; `isProfileSchema?`: `boolean` ; `isSpSchema?`: `boolean` ; `properties`: { [fieldName: string]: [`SchemaField`](modules.md#schemafield); } ; `required?`: (`string` \| [`ConditionallyRequired`](modules.md#conditionallyrequired))[] ; `start_date?`: `string` ; `timing?`: `Record`<``"extract"`` \| ``"live_person"`` \| ``"verify_pending_delay"``, `number`\> ; `verified_fields?`: (`string` \| [`ConditionallyRequired`](modules.md#conditionallyrequired))[] ; `version`: `string` ; `wasExpandedByClient?`: `boolean` }
393
435
 
394
- #### Type declaration
395
-
396
- | Name | Type | Description |
397
- | :------ | :------ | :------ |
398
- | `$id?` | `string` | **`deprecated`** don't use this |
399
- | `$ref?` | `string` | **`deprecated`** not sure why a schema would have this, only fields should |
400
- | `$schema?` | `string` | - |
401
- | `allOf?` | { `$ref?`: `string` ; `if?`: [`Schema`](#schema) ; `then?`: [`Schema`](modules.md#schema) }[] | - |
402
- | `definitions?` | `Record`<`string`, `Object`\> | - |
403
- | `description` | `string` | - |
404
- | `display?` | `Object` | - |
405
- | `display.expand?` | { `fields`: `string`[] ; `label`: `string` }[] | list of fields that should not be shown by default, unless you expand a collpase section which has a name from the label property. Array because there could be multiple expand groups |
406
- | `display.head_main?` | `Object` | list of fields to be considered the header/name of the PO fields joined with a space unless `format` format string is supplied |
407
- | `display.head_main.fields` | `string`[] | - |
408
- | `display.head_main.format?` | `string` | - |
409
- | `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 |
410
- | `display.head_sub.fields` | `string`[] | - |
411
- | `display.head_sub.format?` | `string` | - |
412
- | `end_date?` | `string` | If this tag exists, the schema is deprecated. ISO Date. |
413
- | `group_title?` | `string` | the localized title of the `schema_group`. added by the client |
414
- | `i18n?` | `Object` | - |
415
- | `n_id?` | [`NId`](#nid) | - |
416
- | `name` | `string` | these fields will always exist on schema |
417
- | `onboard_properties?` | `Object` | only the schema used for the onboarding wizard have this property |
418
- | `onboard_properties.organizations?` | { `access_applications?`: { `links?`: { `description`: `string` ; `wizardConfig`: `Omit`<[`WizardConfig`](#wizardconfig), ``"a_id"``\> }[] ; `properties`: `Omit`<[`AA`](modules.md#aa), ``"org_id"``\> }[] ; `properties`: [`Organization`](modules.md#organization) }[] | Organizations that should be created. NOTE: if multiple are specified, when the wizard completes, the _first one_ will be selected |
419
- | `onboard_properties.profile_objects?` | { `properties`: `Record`<`string`, `unknown`\> ; `schema_name`: `string` }[] | Profile Objects that should be created |
420
- | `onboard_properties.relationships?` | { `from`: `string` ; `properties?`: `Record`<`string`, `string`\> ; `to`: `string` ; `type`: `string` }[] | Relationships that should be created |
421
- | `onboard_properties.return_to?` | `string` | The relative path in the client to redirect to once finished. May include variables |
422
- | `properties` | `Object` | 🚨 Note that there are cases where properties are undefined, e.g. if the schema is a sub-object |
423
- | `relationships?` | { `anyOf?`: `string`[] ; `direction`: ``"from"`` ; `multiple?`: `boolean` ; `oneOf?`: `string`[] ; `properties?`: { [fieldName: string]: [`SchemaField`](#schemafield); } ; `relationship_name`: `string` ; `required?`: `string`[] ; `required_relationship?`: `boolean` ; `type`: `string` }[] | - |
424
- | `required?` | (`string` \| [`ConditionallyRequired`](#conditionallyrequired))[] | added by client |
425
- | `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. |
426
- | `tags?` | [`SchemaTag`](#schematag)[] | - |
427
- | `title` | `string` | - |
428
- | `title_plural?` | `string` | plural version of the title |
429
- | `type?` | [`DataTypes`](#datatypes) | - |
430
- | `verified_fields?` | (`string` \| [`ConditionallyRequired`](#conditionallyrequired))[] | originally `string[]`, the client modifies this |
431
- | `version?` | `string` | - |
432
- | `version_current?` | `boolean` | whether the `version` is the latest version |
433
- | `wasExpandedByClient?` | `boolean` | - |
436
+ Raytio's variant of JSON Schema, as used by the client. It is a modified version
437
+ of what the API returns.
434
438
 
435
439
  ___
436
440
 
@@ -445,7 +449,7 @@ ___
445
449
  | `$id?` | `string` | **`deprecated`** don't use, it's inconsistent |
446
450
  | `$ref?` | `string` | If this field refers to a sub-object |
447
451
  | `add_row_btn_label?` | `string` | if this field is a table input, this determines the text to show on the "Add Row" btn |
448
- | `allOf?` | [{ `$ref`: `string` }, [`SchemaField`](#schemafield)] | - |
452
+ | `allOf?` | [{ `$ref`: `string` }, [`ServerSchemaField`](#serverschemafield)] | - |
449
453
  | `content?` | `string` | only checkbox uses this prop |
450
454
  | `contentEncoding?` | ``"base64"`` | - |
451
455
  | `contentMediaType?` | `string` | - |
@@ -454,7 +458,7 @@ ___
454
458
  | `description?` | `string` | - |
455
459
  | `description_decorator?` | ``"md"`` | specifies that the description is formatted in markdown |
456
460
  | `encrypt?` | `boolean` | whether the field should be encrypted |
457
- | `enum?` | `string`[] | - |
461
+ | `enum?` | (`string` \| `number` \| `boolean`)[] | - |
458
462
  | `examples?` | `unknown`[] | - |
459
463
  | `format?` | ``"date"`` \| ``"date-time"`` \| ``"uri"`` | - |
460
464
  | `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 |
@@ -484,21 +488,21 @@ ___
484
488
 
485
489
  ### SchemaFieldTag
486
490
 
487
- Ƭ **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}\` \| ``"date_component:day"`` \| ``"date_component:month"`` \| ``"date_component:year"`` \| ``"action:client_upload"`` \| ``"verify:show_if_pending"`` \| ``"special:hide_select_behind_button"`` \| ``"type:capture_geolocation"`` \| ``"type:extract_required"``
491
+ Ƭ **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:main\_media:${string}\` \| ``"date_component:day"`` \| ``"date_component:month"`` \| ``"date_component:year"`` \| ``"action:client_upload"`` \| ``"verify:show_if_pending"`` \| ``"special:hide_select_behind_button"`` \| ``"type:capture_geolocation"`` \| ``"type:extract_required"``
488
492
 
489
493
  ___
490
494
 
491
- ### SchemaMetadata
492
-
493
- Ƭ **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` }
495
+ ### SchemaTag
494
496
 
495
- Only certain properties from the schema
497
+ Ƭ **SchemaTag**: ``"action:experimental_pass_object_store_id"`` \| ``"action:verify"`` \| ``"default_camera:rear"`` \| ``"default_camera:front"`` \| \`oauth2\_component:name:${string}\` \| \`oauth2\_component:redirect\_url:${string}\` \| \`link\_to:${string}:${string}\` \| ``"type:service_provider"`` \| ``"type:service_offer"`` \| ``"type:marketplace"`` \| ``"type:client_only"`` \| ``"type:globally_unique_field"``
496
498
 
497
499
  ___
498
500
 
499
- ### SchemaTag
501
+ ### ServerSchemaField
500
502
 
501
- Ƭ **SchemaTag**: ``"action:experimental_pass_object_store_id"`` \| ``"action:verify"`` \| ``"default_camera:rear"`` \| ``"default_camera:front"`` \| \`oauth2\_component:name:${string}\` \| \`oauth2\_component:redirect\_url:${string}\` \| \`link\_to:${string}:${string}\` \| ``"type:service_provider"`` \| ``"type:service_offer"`` \| ``"type:marketplace"`` \| ``"type:client_only"`` \| ``"type:globally_unique_field"``
503
+ Ƭ **ServerSchemaField**: `Omit`<[`SchemaField`](#schemafield), ``"$prop"``\>
504
+
505
+ the only difference between the client & server's definition is that the client adds `$prop`
502
506
 
503
507
  ___
504
508
 
@@ -526,7 +530,7 @@ ___
526
530
 
527
531
  ### UrnNodeType
528
532
 
529
- Ƭ **UrnNodeType**: ``"user"`` \| ``"profile_object"`` \| ``"instance"`` \| ``"temp_object"`` \| ``"document"``
533
+ Ƭ **UrnNodeType**: ``"user"`` \| ``"profile_object"`` \| ``"instance"`` \| ``"schema"`` \| ``"temp_object"`` \| ``"document"``
530
534
 
531
535
  ___
532
536
 
@@ -609,9 +613,13 @@ ___
609
613
  | :------ | :------ | :------ |
610
614
  | `date_created` | `string` | ISO Date |
611
615
  | `date_updated` | `string` | ISO Date |
616
+ | `provider_signature_check_enabled` | `boolean` | - |
617
+ | `provider_signature_credentials` | `unknown` | - |
612
618
  | `provider_subscription_credentials` | `unknown` | - |
613
619
  | `provider_webhook_id` | [`NId`](#nid) | n_id of "the webhook provider which can be set up against a service provider" |
614
- | `status` | `unknown` | - |
620
+ | `provider_webhook_subscription_id` | [`NId`](#nid) | not sure what this is |
621
+ | `status` | [`WebhookStatus`](#webhookstatus) | - |
622
+ | `subscribe_log?` | { `date`: `string` ; `response_payload`: `Json` ; `response_status_code`: `number` }[] | - |
615
623
  | `webhook_action` | { `webhook_action_type`: `string` }[] | - |
616
624
  | `webhook_field_mapping_schema` | `Object` | - |
617
625
  | `webhook_filter_schema` | `Object` | - |
@@ -619,16 +627,23 @@ ___
619
627
  | `webhook_filter_schema.field_value` | `string` | - |
620
628
  | `webhook_filter_schema.operator` | `string` | - |
621
629
  | `webhook_filter_source` | `string` | - |
630
+ | `webhook_processing_rules` | `unknown` | - |
622
631
  | `wi_id` | [`WId`](#wid) | - |
623
632
 
624
633
  ___
625
634
 
635
+ ### WebhookStatus
636
+
637
+ Ƭ **WebhookStatus**: ``"subscribed"`` \| ``"pending"`` \| ``"unsubscribe_failed"``
638
+
639
+ ___
640
+
626
641
  ### WizardConfig
627
642
 
628
643
  Ƭ **WizardConfig**: `Object`
629
644
 
630
645
  when a form link is generated, this is what gets saved on the API.
631
- Each value can be overriden in the query parameters. If specified
646
+ Each value can be overridden in the query parameters. If specified
632
647
  in the query parameters, it needs to be base64 and/or url encoded.
633
648
 
634
649
  #### Type declaration
@@ -691,3 +706,24 @@ configuration data for a single wizard page (@see WizardConfig)
691
706
  | `service_provider_link?` | `boolean` | see #463 |
692
707
  | `share?` | ``"profile"`` \| ``"verification"`` \| ``"both"`` | the information to share. undefined implies both. |
693
708
  | `verify_data?` | `boolean` | if `false`, ProfileObjects created while completing the form will not be verified. `undefined` implies `true` |
709
+
710
+ ___
711
+
712
+ ### WrappedSchema
713
+
714
+ Ƭ **WrappedSchema**: `Object`
715
+
716
+ This is what's returned by the API
717
+
718
+ #### Type declaration
719
+
720
+ | Name | Type | Description |
721
+ | :------ | :------ | :------ |
722
+ | `active` | ``true`` | - |
723
+ | `end_date` | `string` | ISO Date. If this tag exists, the schema is deprecated. |
724
+ | `name` | `string` | - |
725
+ | `schema` | [`CommonSchemaAttributes`](#commonschemaattributes) & { `$id?`: `string` ; `$schema?`: `string` ; `allOf?`: { `$ref?`: `string` ; `if?`: `Partial`<[`WrappedSchema`](modules.md#wrappedschema)[``"schema"``]\> ; `then?`: `Partial`<[`WrappedSchema`](modules.md#wrappedschema)[``"schema"``]\> }[] ; `definitions?`: `Record`<`string`, `Object`\> ; `properties`: { [fieldName: string]: [`ServerSchemaField`](modules.md#serverschemafield); } ; `required?`: `string`[] ; `verified_fields?`: `string`[] } | - |
726
+ | `start_date` | `string` | ISO Date |
727
+ | `type` | ``"ss"`` \| ``"ps"`` \| ``"us"`` | - |
728
+ | `version` | `string` | - |
729
+ | `version_current` | `boolean` | whether the \`version\` is the latest version |
package/dist/crypto.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare type Encrypted<_Data = string> = {
1
+ export type Encrypted<_Data = string> = {
2
2
  encrypted_key: {
3
3
  encrypted_key: string;
4
4
  };
package/dist/raytio.d.ts CHANGED
@@ -1,31 +1,31 @@
1
1
  import { Encrypted } from "./crypto";
2
2
  import { Colors, CustomFonts } from "./theme";
3
3
  /** @internal see Microsoft/TypeScript#202 */
4
- export declare type StringWithIdentity<T> = string & {
4
+ export type StringWithIdentity<T> = string & {
5
5
  $$typeof$$: T;
6
6
  };
7
7
  /** @internal */
8
- declare type Json = Record<string, any>;
8
+ type Json = Record<string, any>;
9
9
  /** A `p_id` is the ID of a @see Relationship */
10
- export declare type PId = StringWithIdentity<"PId">;
10
+ export type PId = StringWithIdentity<"PId">;
11
11
  /** An `i_id` is the ID of an @see Instance */
12
- export declare type IId = StringWithIdentity<"IId">;
12
+ export type IId = StringWithIdentity<"IId">;
13
13
  /** An `n_id` is the ID of a @see ProfileObject */
14
- export declare type NId = StringWithIdentity<"NId">;
14
+ export type NId = StringWithIdentity<"NId">;
15
15
  /** A `g_id` is the ID of a group */
16
- export declare type GId = StringWithIdentity<"GId">;
16
+ export type GId = StringWithIdentity<"GId">;
17
17
  /** A `u_id` is the ID of a user */
18
- export declare type UId = StringWithIdentity<"UId">;
18
+ export type UId = StringWithIdentity<"UId">;
19
19
  /** An `a_id` is the ID of an @see AA */
20
- export declare type AId = StringWithIdentity<"AId">;
20
+ export type AId = StringWithIdentity<"AId">;
21
21
  /** An `o_id` is the ID of an @see Organization */
22
- export declare type OId = StringWithIdentity<"OId">;
22
+ export type OId = StringWithIdentity<"OId">;
23
23
  /** A `wi_id` is the ID of a @see Webhook */
24
- export declare type WId = StringWithIdentity<"WId">;
25
- export declare type DataTypes = "string" | "number" | "boolean" | "object" | "integer" | "array" | "null";
26
- export declare type SubmissionStatus = "Submitted" | "Processing" | "Rejected" | "Expired" | "Completed" | "DataChanged" | "Received" | "Accepted";
24
+ export type WId = StringWithIdentity<"WId">;
25
+ export type DataTypes = "string" | "number" | "boolean" | "object" | "integer" | "array" | "null";
26
+ export type SubmissionStatus = "Submitted" | "Processing" | "Rejected" | "Expired" | "Completed" | "DataChanged" | "Received" | "Accepted";
27
27
  /** You can supply an option type argument if you know exactly what the properties will be */
28
- export declare type ProfileObject<Properties = Json> = {
28
+ export type ProfileObject<Properties = Json> = {
29
29
  n_id: NId;
30
30
  properties: Properties;
31
31
  labels: string[];
@@ -38,7 +38,7 @@ export declare type ProfileObject<Properties = Json> = {
38
38
  isFromSubmission?: [aId: AId, iId: IId];
39
39
  };
40
40
  /** @internal This is what we send the API */
41
- export declare type ProfileObjectForUpload<Properties = Json> = {
41
+ export type ProfileObjectForUpload<Properties = Json> = {
42
42
  properties: Properties;
43
43
  document?: {
44
44
  content?: string | Encrypted;
@@ -55,13 +55,13 @@ export declare type ProfileObjectForUpload<Properties = Json> = {
55
55
  * There are some limits to field names: they cannot be called
56
56
  * `__signature` nor can they include the character sequence `<=>`.
57
57
  */
58
- export declare type Properties = {
58
+ export type Properties = {
59
59
  [fieldName: string]: any;
60
60
  };
61
- export declare type UrnNodeType = "user" | "profile_object" | "instance" | "temp_object" | "document";
61
+ export type UrnNodeType = "user" | "profile_object" | "instance" | "schema" | "temp_object" | "document";
62
62
  /** e.g. "urn:user:..." */
63
- export declare type Urn = `urn:${UrnNodeType}:${string}`;
64
- export declare type Relationship = {
63
+ export type Urn = `urn:${UrnNodeType}:${string}`;
64
+ export type Relationship = {
65
65
  start: Urn;
66
66
  end: Urn;
67
67
  p_id: PId;
@@ -72,7 +72,7 @@ export declare type Relationship = {
72
72
  [fieldName: string]: unknown;
73
73
  };
74
74
  };
75
- export declare type Lookup = {
75
+ export type Lookup = {
76
76
  key: string | number;
77
77
  value: string | number;
78
78
  /** Used in Antd Cascader */
@@ -82,7 +82,8 @@ export declare type Lookup = {
82
82
  /** used in AkahuDynamicSection only */
83
83
  requires_2FA?: boolean;
84
84
  };
85
- export declare type AA = {
85
+ export type AATags = "type:client_only" | "type:share_with_new_user" | `related_service_provider:n_id:${NId}` | "ServiceProvider";
86
+ export type AA = {
86
87
  a_id: AId;
87
88
  name: string;
88
89
  description?: string;
@@ -92,7 +93,7 @@ export declare type AA = {
92
93
  /** Easy to use AA logo url for pasting inot emails */
93
94
  picture_url?: string;
94
95
  scopes?: string[];
95
- tags?: string[];
96
+ tags?: AATags[];
96
97
  callback_uri?: string[];
97
98
  /** markdown or string help information including [phoneNumber || email] */
98
99
  aa_help?: string;
@@ -102,16 +103,16 @@ export declare type AA = {
102
103
  };
103
104
  /** the n_id of the associated service provider */
104
105
  service_provider_n_id?: NId;
105
- /** the id of the associated organisation */
106
+ /** the id of the associated organization */
106
107
  org_id: OId;
107
108
  /** configuration for the submission rules */
108
109
  ruleset?: unknown;
109
110
  /** if true, only specific email addresses can submit the form */
110
111
  auth_list_enabled?: boolean;
111
112
  /** @internal */
112
- _transitions?: unknown[];
113
+ transitions?: unknown[];
113
114
  };
114
- export declare type Instance = {
115
+ export type Instance = {
115
116
  /** Access application instance ID */
116
117
  i_id: IId;
117
118
  /** ID of the access application this submission was made to */
@@ -157,7 +158,7 @@ export declare type Instance = {
157
158
  * An organization.
158
159
  * NOTE: this is different to how the schema defines an Organization. **The schema is wrong (see #468)**
159
160
  */
160
- export declare type Organization = {
161
+ export type Organization = {
161
162
  id: OId;
162
163
  name: string;
163
164
  email: string;
@@ -171,8 +172,19 @@ export declare type Organization = {
171
172
  };
172
173
  customer: Record<string, unknown>;
173
174
  };
175
+ /** @internal some APIs now return extra info */
176
+ export type FullOrg = {
177
+ id: OId;
178
+ organization: Omit<Organization, "id">;
179
+ /** 🧙‍♂️ */
180
+ gandalf: unknown;
181
+ stripe: {
182
+ customer: unknown;
183
+ };
184
+ centrix_credentials: unknown;
185
+ };
174
186
  /** validation data returned by preVerify (part of the extract&map API) */
175
- export declare type Validation = {
187
+ export type Validation = {
176
188
  score: number;
177
189
  warning?: string[];
178
190
  breakdown: {
@@ -187,11 +199,14 @@ export declare type Validation = {
187
199
  };
188
200
  };
189
201
  };
190
- export declare type Webhook = {
202
+ export type WebhookStatus = "subscribed" | "pending" | "unsubscribe_failed";
203
+ export type Webhook = {
191
204
  wi_id: WId;
192
205
  /** n_id of "the webhook provider which can be set up against a service provider" */
193
206
  provider_webhook_id: NId;
194
- status: unknown;
207
+ /** not sure what this is */
208
+ provider_webhook_subscription_id: NId;
209
+ status: WebhookStatus;
195
210
  /** ISO Date */
196
211
  date_created: string;
197
212
  /** ISO Date */
@@ -204,10 +219,18 @@ export declare type Webhook = {
204
219
  webhook_action: {
205
220
  webhook_action_type: string;
206
221
  }[];
207
- provider_subscription_credentials: unknown;
208
222
  webhook_filter_source: string;
209
223
  webhook_field_mapping_schema: {
210
224
  [key: string]: string;
211
225
  };
226
+ webhook_processing_rules: unknown;
227
+ provider_subscription_credentials: unknown;
228
+ provider_signature_check_enabled: boolean;
229
+ provider_signature_credentials: unknown;
230
+ subscribe_log?: {
231
+ date: string;
232
+ response_status_code: number;
233
+ response_payload: Json;
234
+ }[];
212
235
  };
213
236
  export {};
package/dist/schema.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- import { AA, DataTypes, NId, Organization, Urn } from "./raytio";
1
+ import { AA, DataTypes, Organization, Urn } from "./raytio";
2
2
  import { WizardConfig } from "./wizard";
3
3
  /** should be renamed since this applies to ConditionallyVerifiable */
4
- export declare type ConditionallyRequired = {
4
+ export type ConditionallyRequired = {
5
5
  field: string;
6
6
  if: {
7
- [fieldName: string]: string[];
7
+ [fieldName: string]: (string | number | boolean)[];
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:terms_conditions" | "display:showOnWizard" | `display:main_media:${string}` | "date_component:day" | "date_component:month" | "date_component:year" | "action:client_upload" | "verify:show_if_pending" | "special:hide_select_behind_button" | "type:capture_geolocation" | "type:extract_required";
11
- export declare type SchemaTag = "action:experimental_pass_object_store_id" | "action:verify" | "default_camera:rear" | "default_camera:front" | `oauth2_component:name:${string}` | `oauth2_component:redirect_url:${string}` | `link_to:${string}:${string}` | "type:service_provider" | "type:service_offer" | "type:marketplace" | "type:client_only" | "type:globally_unique_field";
12
- export declare type SchemaField = {
10
+ export 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:main_media:${string}` | "date_component:day" | "date_component:month" | "date_component:year" | "action:client_upload" | "verify:show_if_pending" | "special:hide_select_behind_button" | "type:capture_geolocation" | "type:extract_required";
11
+ export type SchemaTag = "action:experimental_pass_object_store_id" | "action:verify" | "default_camera:rear" | "default_camera:front" | `oauth2_component:name:${string}` | `oauth2_component:redirect_url:${string}` | `link_to:${string}:${string}` | "type:service_provider" | "type:service_offer" | "type:marketplace" | "type:client_only" | "type:globally_unique_field";
12
+ export type SchemaField = {
13
13
  /** @deprecated don't use, it's inconsistent */
14
14
  $id?: string;
15
15
  title?: string;
@@ -20,7 +20,7 @@ export declare type SchemaField = {
20
20
  examples?: unknown[];
21
21
  tags?: SchemaFieldTag[];
22
22
  type?: DataTypes;
23
- enum?: string[];
23
+ enum?: (string | number | boolean)[];
24
24
  maximum?: number;
25
25
  minimum?: number;
26
26
  /** @deprecated raytio's usage not documented */
@@ -59,7 +59,7 @@ export declare type SchemaField = {
59
59
  };
60
60
  allOf?: [{
61
61
  $ref: string;
62
- }, SchemaField];
62
+ }, ServerSchemaField];
63
63
  /** only checkbox uses this prop */
64
64
  content?: string;
65
65
  /** URL to a JSON file in the `Lookup` format */
@@ -98,15 +98,11 @@ export declare type SchemaField = {
98
98
  */
99
99
  image_silhouette?: string;
100
100
  };
101
- /**
102
- * Raytio's variant of JSON Schema. All props marked as optional except
103
- * `name`. This type can be used for both the schema and for individual fields.
104
- */
105
- export declare type Schema = {
106
- /** @deprecated don't use this */
107
- $id?: string;
108
- $schema?: string;
109
- n_id?: NId;
101
+ /** the only difference between the client & server's definition is that the client adds `$prop` */
102
+ export type ServerSchemaField = Omit<SchemaField, "$prop">;
103
+ /** not exported. Attributes that are identical in both client schema & server schema */
104
+ export type CommonSchemaAttributes = {
105
+ type?: DataTypes;
110
106
  /** these fields will always exist on schema */
111
107
  name: string;
112
108
  title: string;
@@ -118,37 +114,14 @@ export declare type Schema = {
118
114
  * forms that accept different types of similar documents.
119
115
  */
120
116
  schema_group?: string;
121
- /** the localized title of the `schema_group`. added by the client */
122
- group_title?: string;
123
- /** @deprecated not sure why a schema would have this, only fields should */
124
- $ref?: string;
125
- version?: string;
126
- /** whether the `version` is the latest version */
127
- version_current?: boolean;
128
117
  tags?: SchemaTag[];
129
- /** originally `string[]`, the client modifies this */
130
- verified_fields?: (string | ConditionallyRequired)[];
131
- wasExpandedByClient?: boolean;
132
- /** added by client */
133
- required?: (string | ConditionallyRequired)[];
134
- type?: DataTypes;
135
- definitions?: Record<string, {
136
- $ref: Urn;
137
- }>;
138
- allOf?: {
139
- $ref?: string;
140
- if?: Schema;
141
- then?: Schema;
142
- }[];
143
- /** If this tag exists, the schema is deprecated. ISO Date. */
144
- end_date?: string;
145
- /** 🚨 Note that there are cases where properties are undefined, e.g. if the schema is a sub-object */
146
- properties: {
147
- [fieldName: string]: SchemaField;
148
- };
149
118
  i18n?: {
150
119
  [locale: string]: {
151
- $schema: Schema;
120
+ $schema: {
121
+ title: string;
122
+ title_plural?: string;
123
+ description?: string;
124
+ };
152
125
  $loading_extract: {
153
126
  title: string;
154
127
  };
@@ -179,21 +152,11 @@ export declare type Schema = {
179
152
  $loading_pending_ver_resubmit: {
180
153
  title: string;
181
154
  };
182
- [fieldNameOrGroupName: string]: Omit<SchemaField, "$prop"> & {
155
+ [fieldNameOrGroupName: string]: ServerSchemaField & {
183
156
  title_plural?: string;
184
157
  };
185
158
  };
186
159
  };
187
- /** @internal the client adds this after processing the i18n property */
188
- groupNames?: Record<string, string>;
189
- /** @internal added by the client to inform downstream components which locale from schema.i18n was used */
190
- clientLocale?: string;
191
- /**
192
- * @internal
193
- * the estimated loading times in seconds for various API calls. The client adds
194
- * this field after processing the schema tags.
195
- */
196
- timing?: Record<"extract" | "live_person" | "verify_pending_delay", number>;
197
160
  relationships?: {
198
161
  relationship_name: string;
199
162
  direction: "from";
@@ -239,10 +202,6 @@ export declare type Schema = {
239
202
  label: string;
240
203
  }[];
241
204
  };
242
- /** @internal @deprecated do not use */
243
- unexpanded_allOf?: never;
244
- /** @internal @deprecated do not use */
245
- unexpanded_properties?: never;
246
205
  /** only the schema used for the onboarding wizard have this property */
247
206
  onboard_properties?: {
248
207
  /** Profile Objects that should be created */
@@ -278,15 +237,74 @@ export declare type Schema = {
278
237
  return_to?: string;
279
238
  };
280
239
  };
281
- /** Only certain properties from the schema */
282
- export declare type SchemaMetadata = Pick<Schema, "name" | "title" | "description" | "schema_group" | "end_date" | "i18n" | "display" | "tags" | "clientLocale" | "groupNames" | "title_plural" | "group_title"> & {
240
+ /**
241
+ * Raytio's variant of JSON Schema, as used by the client. It is a modified version
242
+ * of what the API returns.
243
+ */
244
+ export type Schema = CommonSchemaAttributes & {
245
+ /** the localized title of the `schema_group`. added by the client */
246
+ group_title?: string;
247
+ /** originally `string[]`, the client modifies this */
248
+ verified_fields?: (string | ConditionallyRequired)[];
249
+ /** originally `string[]`, the client modifies this */
250
+ required?: (string | ConditionallyRequired)[];
251
+ /** added by client */
252
+ wasExpandedByClient?: boolean;
253
+ /** ISO Date. Copied from @see WrappedSchema */
254
+ start_date?: string;
255
+ /** ISO Date. Copied from @see WrappedSchema If this tag exists, the schema is deprecated */
256
+ end_date?: string;
257
+ /** 🚨 Note that there are cases where properties are undefined, e.g. if the schema is a sub-object */
258
+ properties: {
259
+ [fieldName: string]: SchemaField;
260
+ };
261
+ /** the client adds this after processing the i18n property */
262
+ groupNames?: Record<string, string>;
263
+ /** added by the client to inform downstream components which locale from schema.i18n was used */
264
+ clientLocale?: string;
265
+ /** added by the client, copied from @see WrappedSchema */
266
+ version: string;
283
267
  /**
284
- * @deprecated this prop exists so that SchemaMetadata does not extend Schema.
285
- * use `getSchema(schemaName)` to fetch the full schema
268
+ * the estimated loading times in seconds for various API calls. The client adds
269
+ * this field after processing the schema tags.
286
270
  */
287
- __typeof__: "You cannot supply SchemaMetadata to a function that expects Schema";
288
- isProfileSchema: boolean;
289
- isSpSchema: boolean;
271
+ timing?: Record<"extract" | "live_person" | "verify_pending_delay", number>;
272
+ /** added by the client. If true, this should be shown to the client */
273
+ isProfileSchema?: boolean;
274
+ /** added by the client. If true, this schema somehow relates to legacy service providers */
275
+ isSpSchema?: boolean;
276
+ };
277
+ /** This is what's returned by the API */
278
+ export type WrappedSchema = {
279
+ active: true;
280
+ /** ISO Date */
281
+ start_date: string;
282
+ /** ISO Date. If this tag exists, the schema is deprecated. */
283
+ end_date: string;
284
+ name: string;
285
+ type: "ss" | "ps" | "us";
286
+ version: string;
287
+ /** whether the \`version\` is the latest version */
288
+ version_current: boolean;
289
+ schema: CommonSchemaAttributes & {
290
+ /** @deprecated don't use this */
291
+ $id?: string;
292
+ /** @deprecated don't use this */
293
+ $schema?: string;
294
+ definitions?: Record<string, {
295
+ $ref: Urn;
296
+ }>;
297
+ allOf?: {
298
+ $ref?: string;
299
+ if?: Partial<WrappedSchema["schema"]>;
300
+ then?: Partial<WrappedSchema["schema"]>;
301
+ }[];
302
+ properties: {
303
+ [fieldName: string]: ServerSchemaField;
304
+ };
305
+ required?: string[];
306
+ verified_fields?: string[];
307
+ };
290
308
  };
291
309
  /** @ignore */
292
- export declare type RelationDefinition = NonNullable<Schema["relationships"]>[number];
310
+ export type RelationDefinition = NonNullable<Schema["relationships"]>[number];
package/dist/theme.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare type Colors = {
1
+ export type Colors = {
2
2
  sirPinklyText: string;
3
3
  sirPinklyUi: string;
4
4
  violaPerpetuoText: string;
@@ -10,7 +10,7 @@ export declare type Colors = {
10
10
  raytioOrangeText: string;
11
11
  raytioOrangeUi: string;
12
12
  raytioOrangeHover: string;
13
- /** only used by the fancy layout on the login screen */
13
+ /** */
14
14
  raytioOrangeShade: string;
15
15
  successGreen: string;
16
16
  loadingYellow: string;
@@ -23,7 +23,7 @@ export declare type Colors = {
23
23
  silverShell: string;
24
24
  blank: string;
25
25
  };
26
- export declare type CustomFonts = {
26
+ export type CustomFonts = {
27
27
  header?: string;
28
28
  body?: string;
29
29
  };
@@ -1,5 +1,5 @@
1
1
  import { NId, ProfileObject } from "./raytio";
2
- export declare type VerificationPayload<WithValue extends boolean> = {
2
+ export type VerificationPayload<WithValue extends boolean> = {
3
3
  field: string;
4
4
  schema?: string;
5
5
  metadata?: Record<string, unknown>;
@@ -28,7 +28,7 @@ export declare type VerificationPayload<WithValue extends boolean> = {
28
28
  * use `Verification<true>`, otherwise just `Verification`. Verifications from
29
29
  * the DataContext don't have the value.
30
30
  */
31
- export declare type Verification<WithValue extends boolean = false> = ProfileObject<{
31
+ export type Verification<WithValue extends boolean = false> = ProfileObject<{
32
32
  field: string;
33
33
  n_id: NId;
34
34
  /**
@@ -64,7 +64,7 @@ export declare enum POVerification {
64
64
  Loading = 70007
65
65
  }
66
66
  /** These `n_id`s point to service provider profile objects */
67
- export declare type VerificationProvider = {
67
+ export type VerificationProvider = {
68
68
  verifierNId?: NId;
69
69
  dataSourceNId?: NId;
70
70
  serviceProviderNId?: NId;
@@ -72,7 +72,7 @@ export declare type VerificationProvider = {
72
72
  date?: Date;
73
73
  };
74
74
  /** This is what @raytio/core exposes, which is more useable than @see Verification */
75
- export declare type RealVer = {
75
+ export type RealVer = {
76
76
  fieldName: string;
77
77
  value: unknown;
78
78
  provider: VerificationProvider;
package/dist/wizard.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AId } from "./raytio";
2
2
  /** configuration data for a single wizard page (@see WizardConfig) */
3
- export declare type WizardPage = {
3
+ export type WizardPage = {
4
4
  /** if undefined, the schema title will be used */
5
5
  name?: string | symbol;
6
6
  filter: "oneOf" | "anyOf";
@@ -54,10 +54,10 @@ export declare type WizardPage = {
54
54
  };
55
55
  /**
56
56
  * when a form link is generated, this is what gets saved on the API.
57
- * Each value can be overriden in the query parameters. If specified
57
+ * Each value can be overridden in the query parameters. If specified
58
58
  * in the query parameters, it needs to be base64 and/or url encoded.
59
59
  */
60
- export declare type WizardConfig = {
60
+ export type WizardConfig = {
61
61
  a_id: AId;
62
62
  pages: WizardPage[];
63
63
  /** whether the user can change the reference, if there is one in the QP */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raytio/types",
3
- "version": "6.0.2",
3
+ "version": "7.0.0",
4
4
  "license": "MIT",
5
5
  "main": "index",
6
6
  "types": "index",
@@ -13,6 +13,6 @@
13
13
  "scripts": {
14
14
  "docs": "sh ../../scripts/generate-docs.sh",
15
15
  "test": "npm run build",
16
- "build": "tsc && rm -rf dist/__tests__"
16
+ "build": "tsc && rimraf dist/__tests__"
17
17
  }
18
18
  }
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable fp/no-let, @typescript-eslint/no-unused-vars */
2
- import { Schema, SchemaField, SchemaMetadata } from "..";
2
+ import { Schema, SchemaField, WrappedSchema } from "..";
3
3
 
4
4
  /**
5
5
  * this file is not run, it is just compiled by tsc
@@ -8,7 +8,7 @@ import { Schema, SchemaField, SchemaMetadata } from "..";
8
8
 
9
9
  let schema: Schema;
10
10
  let schemaField: SchemaField;
11
- let schemaMetadata: SchemaMetadata;
11
+ let wrappedSchema: WrappedSchema;
12
12
 
13
13
  function f() {
14
14
  // @ts-expect-error SchemaField should not extend Schema
@@ -16,8 +16,8 @@ function f() {
16
16
  // @ts-expect-error Schema should not extend SchemaField
17
17
  const test2: Schema = schemaField;
18
18
 
19
- // @ts-expect-error SchemaMetadata should not extend Schema
20
- const test3: SchemaMetadata = schema;
21
- // @ts-expect-error Schema should not extend SchemaMetadata
22
- const test4: Schema = schemaMetadata;
19
+ // @ts-expect-error WrappedSchema should not extend Schema
20
+ const test3: WrappedSchema = schema;
21
+ // @ts-expect-error Schema should not extend WrappedSchema
22
+ const test4: Schema = wrappedSchema;
23
23
  }
package/src/raytio.ts CHANGED
@@ -87,6 +87,7 @@ export type UrnNodeType =
87
87
  | "user"
88
88
  | "profile_object"
89
89
  | "instance"
90
+ | "schema"
90
91
  | "temp_object" // this will only be encountered in backend environments which lack access to an applicationDecryptor, or from RapidShare
91
92
  | "document";
92
93
 
@@ -117,6 +118,13 @@ export type Lookup = {
117
118
  requires_2FA?: boolean;
118
119
  };
119
120
 
121
+ export type AATags =
122
+ | "type:client_only"
123
+ | "type:share_with_new_user"
124
+ // heritage
125
+ | `related_service_provider:n_id:${NId}`
126
+ | "ServiceProvider"; // TODO: document or delete
127
+
120
128
  export type AA = {
121
129
  a_id: AId;
122
130
  name: string;
@@ -127,7 +135,7 @@ export type AA = {
127
135
  /** Easy to use AA logo url for pasting inot emails */
128
136
  picture_url?: string;
129
137
  scopes?: string[];
130
- tags?: string[];
138
+ tags?: AATags[];
131
139
  callback_uri?: string[];
132
140
  /** markdown or string help information including [phoneNumber || email] */
133
141
  aa_help?: string;
@@ -137,7 +145,7 @@ export type AA = {
137
145
  };
138
146
  /** the n_id of the associated service provider */
139
147
  service_provider_n_id?: NId;
140
- /** the id of the associated organisation */
148
+ /** the id of the associated organization */
141
149
  org_id: OId;
142
150
 
143
151
  /** configuration for the submission rules */
@@ -148,7 +156,7 @@ export type AA = {
148
156
  auth_list_enabled?: boolean;
149
157
 
150
158
  /** @internal */
151
- _transitions?: unknown[];
159
+ transitions?: unknown[];
152
160
  };
153
161
 
154
162
  export type Instance = {
@@ -218,6 +226,16 @@ export type Organization = {
218
226
  customer: Record<string, unknown>;
219
227
  };
220
228
 
229
+ /** @internal some APIs now return extra info */
230
+ export type FullOrg = {
231
+ id: OId;
232
+ organization: Omit<Organization, "id">;
233
+ /** 🧙‍♂️ */
234
+ gandalf: unknown;
235
+ stripe: { customer: unknown };
236
+ centrix_credentials: unknown;
237
+ };
238
+
221
239
  /** validation data returned by preVerify (part of the extract&map API) */
222
240
  export type Validation = {
223
241
  score: number;
@@ -235,11 +253,15 @@ export type Validation = {
235
253
  };
236
254
  };
237
255
 
256
+ export type WebhookStatus = "subscribed" | "pending" | "unsubscribe_failed";
257
+
238
258
  export type Webhook = {
239
259
  wi_id: WId;
240
260
  /** n_id of "the webhook provider which can be set up against a service provider" */
241
261
  provider_webhook_id: NId;
242
- status: unknown;
262
+ /** not sure what this is */
263
+ provider_webhook_subscription_id: NId;
264
+ status: WebhookStatus;
243
265
  /** ISO Date */
244
266
  date_created: string;
245
267
  /** ISO Date */
@@ -251,9 +273,19 @@ export type Webhook = {
251
273
  field_name: string;
252
274
  };
253
275
  webhook_action: { webhook_action_type: string }[];
254
- provider_subscription_credentials: unknown;
255
276
  webhook_filter_source: string;
256
277
  webhook_field_mapping_schema: {
257
278
  [key: string]: string;
258
279
  };
280
+ webhook_processing_rules: unknown;
281
+
282
+ provider_subscription_credentials: unknown;
283
+ provider_signature_check_enabled: boolean;
284
+ provider_signature_credentials: unknown;
285
+
286
+ subscribe_log?: {
287
+ date: string;
288
+ response_status_code: number;
289
+ response_payload: Json;
290
+ }[];
259
291
  };
package/src/schema.ts CHANGED
@@ -1,11 +1,12 @@
1
- import { AA, DataTypes, NId, Organization, Urn } from "./raytio";
1
+ import { AA, DataTypes, Organization, Urn } from "./raytio";
2
2
  import { WizardConfig } from "./wizard";
3
3
 
4
4
  /** should be renamed since this applies to ConditionallyVerifiable */
5
5
  export type ConditionallyRequired = {
6
6
  field: string;
7
+ // see `isConditionMet` for how this syntax works
7
8
  if: {
8
- [fieldName: string]: string[];
9
+ [fieldName: string]: (string | number | boolean)[];
9
10
  };
10
11
  };
11
12
 
@@ -24,7 +25,6 @@ export type SchemaFieldTag =
24
25
  | "display:quoting"
25
26
  | "display:customModal"
26
27
  | "display:terms_conditions"
27
- | "display:showOnWizard" // added by #837, TODO: document
28
28
  | `display:main_media:${string}` // property name to determine what image to display
29
29
  // date picker components
30
30
  | "date_component:day"
@@ -67,7 +67,7 @@ export type SchemaField = {
67
67
  examples?: unknown[];
68
68
  tags?: SchemaFieldTag[];
69
69
  type?: DataTypes;
70
- enum?: string[];
70
+ enum?: (string | number | boolean)[];
71
71
  maximum?: number;
72
72
  minimum?: number;
73
73
  /** @deprecated raytio's usage not documented */
@@ -107,7 +107,7 @@ export type SchemaField = {
107
107
  [fieldName: string]: string[];
108
108
  };
109
109
 
110
- allOf?: [{ $ref: string }, SchemaField];
110
+ allOf?: [{ $ref: string }, ServerSchemaField];
111
111
 
112
112
  /** only checkbox uses this prop */
113
113
  content?: string;
@@ -151,15 +151,12 @@ export type SchemaField = {
151
151
  image_silhouette?: string;
152
152
  };
153
153
 
154
- /**
155
- * Raytio's variant of JSON Schema. All props marked as optional except
156
- * `name`. This type can be used for both the schema and for individual fields.
157
- */
158
- export type Schema = {
159
- /** @deprecated don't use this */
160
- $id?: string;
161
- $schema?: string;
162
- n_id?: NId;
154
+ /** the only difference between the client & server's definition is that the client adds `$prop` */
155
+ export type ServerSchemaField = Omit<SchemaField, "$prop">;
156
+
157
+ /** not exported. Attributes that are identical in both client schema & server schema */
158
+ export type CommonSchemaAttributes = {
159
+ type?: DataTypes;
163
160
 
164
161
  /** these fields will always exist on schema */
165
162
  name: string;
@@ -173,47 +170,14 @@ export type Schema = {
173
170
  * forms that accept different types of similar documents.
174
171
  */
175
172
  schema_group?: string;
176
- /** the localized title of the `schema_group`. added by the client */
177
- group_title?: string;
178
-
179
- /** @deprecated not sure why a schema would have this, only fields should */
180
- $ref?: string;
181
-
182
- version?: string;
183
- /** whether the `version` is the latest version */
184
- version_current?: boolean;
185
173
 
186
174
  tags?: SchemaTag[];
187
- /** originally `string[]`, the client modifies this */
188
- verified_fields?: (string | ConditionallyRequired)[];
189
-
190
- wasExpandedByClient?: boolean;
191
- /** added by client */
192
- required?: (string | ConditionallyRequired)[];
193
-
194
- type?: DataTypes;
195
- definitions?: Record<string, { $ref: Urn }>;
196
- allOf?: {
197
- $ref?: string;
198
- if?: Schema;
199
- // we don't suport else (yet)
200
- then?: Schema;
201
- }[];
202
-
203
- /** If this tag exists, the schema is deprecated. ISO Date. */
204
- end_date?: string;
205
-
206
- /** 🚨 Note that there are cases where properties are undefined, e.g. if the schema is a sub-object */
207
- properties: {
208
- [fieldName: string]: SchemaField;
209
- };
210
175
 
211
176
  /* any overrides can be specfied per field or for the whole schema */
212
177
  i18n?: {
213
178
  [locale: string]: {
214
- // @ts-expect-error I don't understand what's wrong
215
- $schema: Schema;
216
- // not that for entries that start in "group:" or $loading_, only the title field will be used.
179
+ $schema: { title: string; title_plural?: string; description?: string };
180
+ // note that for entries that start in "group:" or $loading_, only the title field will be used.
217
181
  // ^ the exception is `group:{GROUP_NAME}:{SUB_GROUP}.field` which is used for the combined field title/desc
218
182
  // normal fields can specify any field attributes to override.
219
183
 
@@ -229,22 +193,11 @@ export type Schema = {
229
193
  $loading_delete_pending_ver: { title: string };
230
194
  $loading_pending_ver_resubmit: { title: string };
231
195
 
232
- [fieldNameOrGroupName: string]: Omit<SchemaField, "$prop"> & {
196
+ [fieldNameOrGroupName: string]: ServerSchemaField & {
233
197
  title_plural?: string;
234
198
  };
235
199
  };
236
200
  };
237
- /** @internal the client adds this after processing the i18n property */
238
- groupNames?: Record<string, string>;
239
- /** @internal added by the client to inform downstream components which locale from schema.i18n was used */
240
- clientLocale?: string;
241
-
242
- /**
243
- * @internal
244
- * the estimated loading times in seconds for various API calls. The client adds
245
- * this field after processing the schema tags.
246
- */
247
- timing?: Record<"extract" | "live_person" | "verify_pending_delay", number>;
248
201
 
249
202
  relationships?: {
250
203
  relationship_name: string;
@@ -287,12 +240,6 @@ export type Schema = {
287
240
  expand?: { fields: string[]; label: string }[];
288
241
  };
289
242
 
290
- /** @internal @deprecated do not use */
291
- unexpanded_allOf?: never;
292
-
293
- /** @internal @deprecated do not use */
294
- unexpanded_properties?: never;
295
-
296
243
  /** only the schema used for the onboarding wizard have this property */
297
244
  onboard_properties?: {
298
245
  /** Profile Objects that should be created */
@@ -332,32 +279,88 @@ export type Schema = {
332
279
  };
333
280
  };
334
281
 
335
- /** Only certain properties from the schema */
336
- export type SchemaMetadata = Pick<
337
- Schema,
338
- // if you update this list, also update SCHEMA_METADATA_FIELDS
339
- | "name"
340
- | "title"
341
- | "description"
342
- | "schema_group"
343
- | "end_date"
344
- | "i18n"
345
- | "display"
346
- | "tags"
347
- // added by the client
348
- | "clientLocale"
349
- | "groupNames"
350
- | "title_plural"
351
- | "group_title"
352
- > & {
282
+ /**
283
+ * Raytio's variant of JSON Schema, as used by the client. It is a modified version
284
+ * of what the API returns.
285
+ */
286
+ export type Schema = CommonSchemaAttributes & {
287
+ /** the localized title of the `schema_group`. added by the client */
288
+ group_title?: string;
289
+
290
+ /** originally `string[]`, the client modifies this */
291
+ verified_fields?: (string | ConditionallyRequired)[];
292
+
293
+ /** originally `string[]`, the client modifies this */
294
+ required?: (string | ConditionallyRequired)[];
295
+
296
+ /** added by client */
297
+ wasExpandedByClient?: boolean;
298
+
299
+ /** ISO Date. Copied from @see WrappedSchema */
300
+ start_date?: string;
301
+ /** ISO Date. Copied from @see WrappedSchema If this tag exists, the schema is deprecated */
302
+ end_date?: string;
303
+
304
+ /** 🚨 Note that there are cases where properties are undefined, e.g. if the schema is a sub-object */
305
+ properties: {
306
+ [fieldName: string]: SchemaField;
307
+ };
308
+
309
+ /** the client adds this after processing the i18n property */
310
+ groupNames?: Record<string, string>;
311
+
312
+ /** added by the client to inform downstream components which locale from schema.i18n was used */
313
+ clientLocale?: string;
314
+
315
+ /** added by the client, copied from @see WrappedSchema */
316
+ version: string;
317
+
353
318
  /**
354
- * @deprecated this prop exists so that SchemaMetadata does not extend Schema.
355
- * use `getSchema(schemaName)` to fetch the full schema
319
+ * the estimated loading times in seconds for various API calls. The client adds
320
+ * this field after processing the schema tags.
356
321
  */
357
- __typeof__: "You cannot supply SchemaMetadata to a function that expects Schema";
322
+ timing?: Record<"extract" | "live_person" | "verify_pending_delay", number>;
358
323
 
359
- isProfileSchema: boolean;
360
- isSpSchema: boolean;
324
+ /** added by the client. If true, this should be shown to the client */
325
+ isProfileSchema?: boolean;
326
+
327
+ /** added by the client. If true, this schema somehow relates to legacy service providers */
328
+ isSpSchema?: boolean;
329
+ };
330
+
331
+ /** This is what's returned by the API */
332
+ export type WrappedSchema = {
333
+ active: true;
334
+ /** ISO Date */
335
+ start_date: string;
336
+ /** ISO Date. If this tag exists, the schema is deprecated. */
337
+ end_date: string;
338
+ name: string;
339
+ type: "ss" | "ps" | "us";
340
+ version: string;
341
+ /** whether the \`version\` is the latest version */
342
+ version_current: boolean;
343
+ schema: CommonSchemaAttributes & {
344
+ /** @deprecated don't use this */
345
+ $id?: string;
346
+ /** @deprecated don't use this */
347
+ $schema?: string;
348
+
349
+ definitions?: Record<string, { $ref: Urn }>;
350
+ allOf?: {
351
+ $ref?: string;
352
+ if?: Partial<WrappedSchema["schema"]>;
353
+ // we don't suport else (yet)
354
+ then?: Partial<WrappedSchema["schema"]>;
355
+ }[];
356
+
357
+ properties: {
358
+ [fieldName: string]: ServerSchemaField;
359
+ };
360
+
361
+ required?: string[];
362
+ verified_fields?: string[];
363
+ };
361
364
  };
362
365
 
363
366
  /** @ignore */
package/src/theme.ts CHANGED
@@ -10,7 +10,7 @@ export type Colors = {
10
10
  raytioOrangeText: string;
11
11
  raytioOrangeUi: string;
12
12
  raytioOrangeHover: string;
13
- /** only used by the fancy layout on the login screen */
13
+ /** */
14
14
  raytioOrangeShade: string;
15
15
  successGreen: string;
16
16
  loadingYellow: string;
package/src/wizard.ts CHANGED
@@ -76,7 +76,7 @@ export type WizardPage = {
76
76
 
77
77
  /**
78
78
  * when a form link is generated, this is what gets saved on the API.
79
- * Each value can be overriden in the query parameters. If specified
79
+ * Each value can be overridden in the query parameters. If specified
80
80
  * in the query parameters, it needs to be base64 and/or url encoded.
81
81
  */
82
82
  export type WizardConfig = {