@raytio/types 7.3.0 → 8.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/schema.ts CHANGED
@@ -1,4 +1,11 @@
1
- import type { AA, DataTypes, Organization, SchemaName, Urn } from "./raytio";
1
+ import type {
2
+ AA,
3
+ CommonFields,
4
+ DataTypes,
5
+ Json,
6
+ SchemaName,
7
+ Urn,
8
+ } from "./raytio";
2
9
  import type { WizardConfig } from "./wizard";
3
10
 
4
11
  /** should be renamed since this applies to ConditionallyVerifiable */
@@ -10,6 +17,15 @@ export type ConditionallyRequired = {
10
17
  };
11
18
  };
12
19
 
20
+ /** Schema-level conditional tags, evaluated at runtime based on form values */
21
+ export type ConditionalTags = {
22
+ tags: string[];
23
+ // see `isConditionMet` for how this syntax works
24
+ if: {
25
+ [fieldName: string]: (string | number | boolean)[];
26
+ };
27
+ };
28
+
13
29
  export type SchemaFieldTag =
14
30
  // legacy (TODO: remove these)
15
31
  | "password"
@@ -24,16 +40,28 @@ export type SchemaFieldTag =
24
40
  | "display:survey"
25
41
  | "display:quoting"
26
42
  | "display:customModal"
27
- | `display:replace:'${string}':'${string}'`
43
+ | "display:mask"
44
+ | `display:replace:('${string}', '${string}')`
28
45
  | "display:terms_conditions"
29
46
  | `display:main_media:${string}` // property name to determine what image to display
47
+ // content block variants (see ContentBlockField)
48
+ | "display:content-block"
49
+ | "display:info"
50
+ | "display:warning"
51
+ | "display:error"
30
52
  // date picker components
31
53
  | "date_component:day"
32
54
  | "date_component:month"
33
55
  | "date_component:year"
34
56
  // other
57
+ | "action:allow_copy" // adds clipboard to input field
58
+ | "action:allow_unreplace" // adds reveal button for passwords
59
+ | "action:allow_password_compromise_check" // adds check if password is breached
35
60
  | "action:client_upload"
61
+ | "action:hash" // creates hash containing specified information
36
62
  | "action:require_webauthn"
63
+ | `action:generate_pepper:` // generates a pepper length 'n'
64
+ | `action:timeout:${number}` // for a lookup field. Signifies it should expire after 'n' seconds
37
65
  | "verify:show_if_pending"
38
66
  | "special:hide_select_behind_button"
39
67
  | "type:capture_geolocation" // triggers the wizard's GeoLocationInput field
@@ -43,6 +71,8 @@ export type SchemaTag =
43
71
  // action
44
72
  | "action:experimental_pass_object_store_id"
45
73
  | "action:verify"
74
+ | `action:display_qr_code:${/* either extract or verify */ string}:${/* when to display QR */ string}`
75
+ | `action:display_global_idv_app_qr_code:${/* either extract or verify */ string}`
46
76
  // camera
47
77
  | "default_camera:rear"
48
78
  | "default_camera:front"
@@ -52,12 +82,16 @@ export type SchemaTag =
52
82
  // misc
53
83
  | `time:${/* type */ string}:${/* seconds */ number}`
54
84
  | `link_to:${/* schemaName */ string}:${/* relationshipType */ string}`
85
+ | "display:default_view:edit" // links profile POcard direct to edit menu
86
+ // bot protection
87
+ | "support_challenge"
55
88
  // type
56
- | "type:service_provider"
89
+ | "type:merchant"
57
90
  | "type:service_offer"
58
91
  | "type:marketplace"
59
92
  | "type:client_only"
60
- | "type:globally_unique_field";
93
+ | "type:globally_unique_field"
94
+ | "type:application_object";
61
95
 
62
96
  export type SchemaField = {
63
97
  /** @deprecated don't use, it's inconsistent */
@@ -79,9 +113,9 @@ export type SchemaField = {
79
113
  step?: number;
80
114
  /** if true, the user must have encryption enabled to save this data, see #1324 */
81
115
  encrypt_require?: boolean;
82
- /** @deprecated raytio's usage not documented */
116
+ /** for string inputs, the maximum character length. Also used to determine textarea rendering (maxLength > 30 renders a textarea) */
83
117
  maxLength?: number;
84
- /** @deprecated raytio's usage not documented */
118
+ /** for string inputs, the minimum character length. Not currently used anywhere in the client */
85
119
  minLength?: number;
86
120
  /** the default value */
87
121
  default?: unknown;
@@ -91,6 +125,21 @@ export type SchemaField = {
91
125
  format?: "date" | "date-time" | "uri";
92
126
  contentMediaType?: string;
93
127
  contentEncoding?: "base64";
128
+ /**
129
+ * if this field is a foreign key, i.e. it is a primary key
130
+ * of a different schema, then that other's schema name should be listed here.
131
+ * e.g.
132
+ * ```json
133
+ * {
134
+ * "name": "ss_AA",
135
+ * "properties": {
136
+ * "org_id": { "foreign_key_of": "ss_Org" }
137
+ * }
138
+ * }
139
+ * ```
140
+ */
141
+ foreign_key_of?: SchemaName;
142
+
94
143
  /** `items` is used for nested arrays, (while `properties` is used for nested objects) */
95
144
  items?: {
96
145
  type: DataTypes;
@@ -122,15 +171,47 @@ export type SchemaField = {
122
171
  content?: string;
123
172
  /** URL to a JSON file in the `Lookup` format */
124
173
  lookup?: string;
174
+ /**
175
+ * Transforms the lookup response into the expected `{ key, value }[]` format.
176
+ * Use when the API returns data in a different structure.
177
+ *
178
+ * Simple format (extract array from path, use values as both key and value):
179
+ * ```json
180
+ * "lookupTransform": "[0].scopes"
181
+ * ```
182
+ *
183
+ * Object format (specify key/value mapping):
184
+ * ```json
185
+ * "lookupTransform": {
186
+ * "path": "[0].items",
187
+ * "key": "id",
188
+ * "value": "name"
189
+ * }
190
+ * ```
191
+ */
192
+ lookupTransform?:
193
+ | string
194
+ | {
195
+ /** JSON path to extract the array (e.g., "[0].scopes", "data.items") */
196
+ path: string;
197
+ /** Property name to use as the lookup key (if omitted, uses the value itself) */
198
+ key?: string;
199
+ /** Property name to use as the lookup value (if omitted, uses the value itself) */
200
+ value?: string;
201
+ };
125
202
  /** @internal the client adds this - it's the fieldName. */
126
203
  $prop: string;
127
204
  priority?: number;
128
205
  /** @internal if supplied, it's the existing field values. Added by the client */
129
206
  subObjectRef?: unknown[];
130
- /** specifies that the description is formatted in markdown */
207
+ /** @deprecated Markdown is now rendered by default for all descriptions. This property is no longer needed. */
131
208
  description_decorator?: "md";
132
209
  /** if a `pattern` is specified, this is the error message */
133
210
  patternMessage?: string;
211
+ /** the input string for a platform_unique_id */
212
+ hash_inputs?: string;
213
+ /** determines where an image is sourced from */
214
+ content_source?: string;
134
215
 
135
216
  override?: {
136
217
  permissions: {
@@ -163,12 +244,25 @@ export type SchemaField = {
163
244
  /** the only difference between the client & server's definition is that the client adds `$prop` */
164
245
  export type ServerSchemaField = Omit<SchemaField, "$prop">;
165
246
 
247
+ /** An i18n entry from the fnd_i18n_entries API endpoint */
248
+ export type FndI18nEntry = CommonFields<never> & {
249
+ i18n_key: string;
250
+ category: string;
251
+ translations: {
252
+ [locale: string]: {
253
+ title: string;
254
+ description?: string;
255
+ title_plural?: string;
256
+ };
257
+ };
258
+ };
259
+
166
260
  /** not exported. Attributes that are identical in both client schema & server schema */
167
261
  export type CommonSchemaAttributes = {
168
262
  /** these fields will always exist on schema */
169
263
  title: string;
170
264
  description: string;
171
- /** specifies that the description is formatted in markdown */
265
+ /** @deprecated Markdown is now rendered by default for all descriptions. This property is no longer needed. */
172
266
  description_decorator?: "md";
173
267
 
174
268
  schema_type?: SchemaType;
@@ -179,11 +273,22 @@ export type CommonSchemaAttributes = {
179
273
  /**
180
274
  * the group that a schema belongs to, such as "passports". This is useful for
181
275
  * forms that accept different types of similar documents.
276
+ * Can be a single group (string) or multiple groups (string[]) to allow a schema
277
+ * to appear in multiple lists.
182
278
  */
183
- schema_group?: string;
279
+ schema_group?: string | string[];
280
+
281
+ /** Additional search terms to help users find schemas (e.g., ["license", "passport", "drivers license"]) */
282
+ search_terms?: string[];
184
283
 
185
284
  tags?: SchemaTag[];
186
285
 
286
+ /** if specified, suggests this onboarding scenario after creating a PO of this schema type */
287
+ suggest_post_create?: SchemaName;
288
+
289
+ /** Array of 2-character country codes that this schema is available for */
290
+ schema_country_codes?: string[];
291
+
187
292
  /* any overrides can be specfied per field or for the whole schema */
188
293
  i18n?: {
189
294
  [locale: string]: {
@@ -253,42 +358,154 @@ export type CommonSchemaAttributes = {
253
358
  * Array because there could be multiple expand groups
254
359
  */
255
360
  expand?: { fields: string[]; label: string }[];
256
- };
257
361
 
258
- /** only the schema used for the onboarding wizard have this property */
259
- onboard_properties?: {
260
- /** Profile Objects that should be created */
261
- profile_objects?: {
262
- schema_name: SchemaName;
263
- properties: Record<string, unknown>;
264
- }[];
362
+ /**
363
+ * By default, the admin dashboard shows columns for all fields
364
+ * in listed in `head_main`. In rare cases you can use this property
365
+ * to specify a different set of fields to show to admins by default.
366
+ */
367
+ tabular?: { fields: string[] };
265
368
 
266
- /** Relationships that should be created */
267
- relationships?: {
268
- /** will normally look like `"{n_id:profile_objects[0]}"` */
269
- from: string;
270
- to: string;
271
- type: string;
272
- properties?: Record<string, string>;
273
- }[];
369
+ /**
370
+ * determines if profile pages should display using compacted 'MiniPO'
371
+ * view or deafult view
372
+ */
373
+ compact_table?: boolean;
274
374
 
275
375
  /**
276
- * Organizations that should be created. NOTE: if multiple are specified, when the wizard
277
- * completes, the _first one_ will be selected
376
+ * Pre-defined filter presets provided by the schema author.
377
+ * These appear as "Default filters" in the admin table UI and
378
+ * cannot be deleted by users (unlike user-saved filters).
379
+ *
380
+ * Each token's `propertyKey` must match a key in `properties`.
381
+ * Valid operators: `=`, `!=`, `:`, `!:`, `>`, `<`, `>=`, `<=`
278
382
  */
279
- organizations?: {
280
- properties: Organization;
281
- /** Access Applications that should be created for this org */
282
- access_applications?: {
283
- properties: Omit<AA, "org_id">;
284
- /** Links that should be created for this AA */
285
- links?: {
286
- description: string;
287
- wizardConfig: Omit<WizardConfig, "a_id">;
288
- }[];
383
+ filters?: {
384
+ /** Display name for the filter preset */
385
+ name: string;
386
+ /** How tokens are combined: "and" = all must match, "or" = any must match */
387
+ operation: "and" | "or";
388
+ /** Filter conditions */
389
+ tokens: {
390
+ /** Must match a key in schema `properties` */
391
+ propertyKey: string;
392
+ /** Comparison operator */
393
+ operator: string;
394
+ /** Value to compare against */
395
+ value: string;
289
396
  }[];
290
397
  }[];
291
398
 
399
+ /** Kanban board configuration for admin dashboard */
400
+ kanban?: {
401
+ /** Field that determines which column a card belongs to */
402
+ column_field?: string;
403
+ /** Field displayed as the card title */
404
+ title_field?: string;
405
+ /** Additional fields displayed on each card */
406
+ card_fields?: string[];
407
+ };
408
+ };
409
+
410
+ /** only the schema used for the onboarding wizard have this property */
411
+ onboard_properties?: {
412
+ /**
413
+ * High-level actions for complex workflows.
414
+ * create_organization: Single object for creating one organization
415
+ * create_access_application_link: Array for creating multiple links
416
+ */
417
+ actions?: {
418
+ /** Creates a single organization. Use this instead of legacy 'organizations' array. */
419
+ create_organization?: Array<{
420
+ properties: Json;
421
+ store_as?: string; // alias used to reference the created organization
422
+ }>;
423
+ /** Creates access application links (can be multiple) */
424
+ create_access_application_link?: Array<{
425
+ properties: Record<string, unknown>;
426
+ store_as?: string;
427
+ }>;
428
+ /** Other actions can be defined as needed */
429
+ [key: string]: any;
430
+ };
431
+ /**
432
+ * Execution order for entity creation. If not specified, uses default order.
433
+ * Examples: ["actions.create_organization", "db.v1.xrm_merchants", "db.v1.dsm_nodes"]
434
+ */
435
+ execution_order?: string[];
436
+
437
+ /**
438
+ * Generic API endpoints organized by namespace and version.
439
+ *
440
+ * Structure: `{namespace}.{version}.{endpoint_name}` → `POST /{namespace}/{version}/{endpoint_name}`
441
+ *
442
+ * Examples:
443
+ * - `db.v1.xrm_merchants` → `POST /db/v1/xrm_merchants`
444
+ * - `db.v2.something` → `POST /db/v2/something`
445
+ * - `persist.v2.endpoint` → `POST /persist/v2/endpoint`
446
+ *
447
+ * Any namespace can be used. The `db` namespace is shown below as the primary example.
448
+ */
449
+ db?: {
450
+ v1?: {
451
+ /** Profile objects - POST /db/v1/dsm_nodes */
452
+ dsm_nodes?: Array<{
453
+ labels?: string[];
454
+ properties: Record<string, unknown>;
455
+ schema_name?: SchemaName;
456
+ }>;
457
+
458
+ /** Merchants - POST /db/v1/xrm_merchants */
459
+ xrm_merchants?: Array<Record<string, unknown>>;
460
+
461
+ /** Access Applications - POST /db/v1/dsm_access_applications */
462
+ dsm_access_applications?: Array<
463
+ Omit<AA, "org_id" | "a_id"> & {
464
+ org_id?: string;
465
+ links?: {
466
+ description: string;
467
+ wizardConfig: Omit<WizardConfig, "a_id">;
468
+ }[];
469
+ }
470
+ >;
471
+
472
+ /** Relationships - POST /db/v1/dsm_node_relationships */
473
+ dsm_node_relationships?: Array<{
474
+ from: string;
475
+ to: string;
476
+ type: string;
477
+ properties?: Record<string, unknown>;
478
+ }>;
479
+
480
+ /** Extensible for any other endpoint */
481
+ [endpoint: string]: Array<Record<string, unknown>> | undefined;
482
+ };
483
+ v2?: {
484
+ [endpoint: string]: Array<Record<string, unknown>> | undefined;
485
+ };
486
+ [version: string]:
487
+ | {
488
+ [endpoint: string]: Array<Record<string, unknown>> | undefined;
489
+ }
490
+ | undefined;
491
+ };
492
+ /**
493
+ * Additional namespaces can be added following the same structure as `db`.
494
+ * Example: persist?: { v2?: { [endpoint: string]: Array<Record<string, unknown>> } }
495
+ */
496
+ [namespace: string]:
497
+ | {
498
+ [version: string]:
499
+ | {
500
+ [endpoint: string]: Array<Record<string, unknown>> | undefined;
501
+ }
502
+ | undefined;
503
+ }
504
+ | object // for actions
505
+ | string[] // for execution_order
506
+ | string // for return_to
507
+ | undefined;
508
+
292
509
  /** The relative path in the client to redirect to once finished. May include variables */
293
510
  return_to?: string;
294
511
  };
@@ -305,6 +522,12 @@ export type Schema = CommonSchemaAttributes & {
305
522
  /** added by client */
306
523
  type?: DataTypes;
307
524
 
525
+ /**
526
+ * Schema-level conditional tags, pre-processed for runtime evaluation.
527
+ * When form values match the `if` condition, the tags are added to the schema.
528
+ */
529
+ conditionalTags?: ConditionalTags[];
530
+
308
531
  /** the localized title of the `schema_group`. added by the client */
309
532
  group_title?: string;
310
533
 
@@ -327,9 +550,52 @@ export type Schema = CommonSchemaAttributes & {
327
550
  [fieldName: string]: SchemaField;
328
551
  };
329
552
 
553
+ /**
554
+ * Some schema's represent data that is not stored as a profile object.
555
+ * In this case, this attribute defines what database table we need to use
556
+ * to fetch the corresponding data, and which field is the primary_key of that
557
+ * table (e.g. `id`, `o_id` etc.)
558
+ *
559
+ * The `path` property specifies the complete API path to use. If not provided,
560
+ * defaults to `/db/v1/{table}`. When `path` is specified, it is used directly
561
+ * without appending the table name.
562
+ * Examples:
563
+ * - `path: "/db/v1/rpc/my_function"` for RPC endpoints
564
+ * - `path: "/api/v2/custom_endpoint"` for custom API paths
565
+ *
566
+ * The optional `select` parameter supports PostgREST select syntax for nested
567
+ * objects/arrays. For example:
568
+ * `select: "id,item_id,gpm_items(id,item_key)"`
569
+ * This will return nested objects in the response.
570
+ */
571
+ database?: {
572
+ /** Table name (required when path is not specified to construct `/db/v1/{table}`) */
573
+ table?: string;
574
+ primary_key: string;
575
+ /** Complete API path. If specified, used directly instead of `/db/v1/{table}` */
576
+ path?: string;
577
+ select?: string;
578
+ /** Schema to redirect to after creating a record (for insert schemas) */
579
+ return_to?: SchemaName;
580
+ /** HTTP method override. If specified, uses this instead of the default (POST for create, PATCH for edit, DELETE for delete) */
581
+ method?: "POST" | "PATCH" | "DELETE";
582
+ /**
583
+ * PostgREST query parameters to include in requests.
584
+ * Supports variable substitution: {$context.organizationId}, {$context.userId}, {$context.tenantId}
585
+ * Example: "org_id=eq.{$context.organizationId}&active=eq.true"
586
+ * If this contains "select=", it takes precedence over the `select` property.
587
+ */
588
+ query_parameters?: string;
589
+ };
590
+
330
591
  /** the client adds this after processing the i18n property */
331
592
  groupNames?: Record<string, string>;
332
593
 
594
+ /** specifies the order in which groups should be displayed */
595
+ groups?: {
596
+ order?: string[];
597
+ };
598
+
333
599
  /** added by the client to inform downstream components which locale from schema.i18n was used */
334
600
  clientLocale?: string;
335
601
 
@@ -350,7 +616,7 @@ export type Schema = CommonSchemaAttributes & {
350
616
  };
351
617
 
352
618
  /** Type Classification of a Schema returned by API */
353
- export type SchemaType = "ss" | "ps" | "us";
619
+ export type SchemaType = "ss" | "ps" | "us" | "ms";
354
620
 
355
621
  /** This is what's returned by the API */
356
622
  export type WrappedSchema = {
@@ -367,6 +633,10 @@ export type WrappedSchema = {
367
633
 
368
634
  /** whether the \`version\` is the latest version */
369
635
  version_current: boolean;
636
+
637
+ /** Country codes that this schema is available for */
638
+ schema_country_codes?: string[];
639
+
370
640
  schema: CommonSchemaAttributes & {
371
641
  /** @deprecated don't use this */
372
642
  $id?: string;
@@ -0,0 +1,107 @@
1
+ import type {
2
+ CId,
3
+ CommonFields,
4
+ PLId,
5
+ PLLId,
6
+ PMId,
7
+ PRCId,
8
+ PRid,
9
+ PTId,
10
+ SId,
11
+ SLId,
12
+ } from "./raytio";
13
+
14
+ export type PriceList = {
15
+ id: PLId;
16
+ price_list_type: string;
17
+ price_list_currency: string;
18
+ price_list_name: string;
19
+ price_list_name_i18n?: string;
20
+ price_list_description?: string;
21
+ price_list_description_i18n?: string;
22
+ pcm_price_list_versions?: [
23
+ {
24
+ id: string;
25
+ price_list_version_name: string;
26
+ pcm_price_list_lines: PriceListLine[];
27
+ },
28
+ ];
29
+ };
30
+
31
+ export type PriceListLine = {
32
+ id: PLLId;
33
+ pcm_prices: {
34
+ id: PRCId;
35
+ amount: number;
36
+ gpm_items: {
37
+ id: string; // not sure what this is
38
+ item_key: string;
39
+ item_name: string;
40
+ primary_uom: string;
41
+ item_name_i18n: string | null;
42
+ item_description: string;
43
+ item_description_i18n: string | null;
44
+ };
45
+ price_currency: string;
46
+ billing_recurrence: string;
47
+ recurring_billing_scheme: string;
48
+ recurring_billing_interval: string | null; // null if `billing_recurrence` is set to "ONCE"
49
+ recurring_billing_usage_type: string;
50
+ recurring_billing_interval_count: number;
51
+ };
52
+ };
53
+
54
+ export type Subscription = CommonFields<SId> & {
55
+ subscribed_to_customer_id: string;
56
+ subscribed_to_customer_site_id: string | null;
57
+ subscribed_to_party_contact_point_id: string;
58
+ billing_cycle_month: number | null;
59
+ billing_cycle_day_of_month: number | null;
60
+ billing_cycle_day_of_week: number | null;
61
+ billing_cycle_hour: number | null;
62
+ billing_cycle_minute: number | null;
63
+ billing_cycle_second: number | null;
64
+ subscription_timezone_offset_minutes: number | null;
65
+ subscription_name: string;
66
+ subscription_name_i18n: string | null;
67
+ current_billing_period_start: string;
68
+ current_billing_period_end: string | null;
69
+ cancellation_request_date: string | null;
70
+ cancellation_effective_date: string | null;
71
+ cancellation_request_reason: string | null;
72
+ cancellation_final_invoice_action: string;
73
+ };
74
+
75
+ export type SubscriptionLine = CommonFields<SLId> & {
76
+ billing_subscription_id: SId;
77
+ price_id: PRCId;
78
+ subscribed_qty: number;
79
+ metadata: string | null;
80
+ };
81
+
82
+ export type PaymentMethod = CommonFields<PMId> & {
83
+ customer_id: CId;
84
+ payer_payment_method_type: string;
85
+ primary_payment_method: boolean;
86
+ payment_processor_id: string;
87
+ payment_method_country_code: string | null;
88
+ payment_method_scheme: string;
89
+ payment_method_available_networks: string[] | string;
90
+ payment_method_preferred_network?: string | null;
91
+ card_expiry_month: number;
92
+ card_expiry_year: number;
93
+ card_funding_method: string;
94
+ card_last_4_digits: string;
95
+ card_fingerprint?: string | null;
96
+ payment_processor_payment_method_id: string;
97
+ address_line1_check?: string | null;
98
+ address_postal_code_check?: string | null;
99
+ cvc_check?: string | null;
100
+ three_d_secure_usage?: string | null;
101
+ };
102
+
103
+ export type PaymentProcessor = CommonFields<PTId> & {
104
+ party_id: PRid;
105
+ payment_processor_name: string;
106
+ payment_processor_system: string;
107
+ };
package/src/tenant.ts ADDED
@@ -0,0 +1,7 @@
1
+ import type { CommonFields, TNTId } from "./raytio";
2
+
3
+ export type Tenant = CommonFields<TNTId> & {
4
+ tenant_name: string;
5
+ tenant_description: string | null;
6
+ tenant_domain_prefix: string | null;
7
+ };
package/src/theme.ts CHANGED
@@ -22,6 +22,10 @@ export type Colors = {
22
22
  feelingHugged: string;
23
23
  silverShell: string;
24
24
  blank: string;
25
+ altColoursBgLight: string;
26
+ altColoursBgMedium: string;
27
+ elevatedSurface: string;
28
+ fillNeutral: string;
25
29
  };
26
30
 
27
31
  export type CustomFonts = { header?: string; body?: string };