@raytio/types 7.2.0 → 8.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/src/schema.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { AA, DataTypes, Organization, Urn } from "./raytio";
2
- import { WizardConfig } from "./wizard";
1
+ import type { AA, DataTypes, SchemaName, Urn } from "./raytio";
2
+ import type { Organization } from "./orgs";
3
+ import type { WizardConfig } from "./wizard";
3
4
 
4
5
  /** should be renamed since this applies to ConditionallyVerifiable */
5
6
  export type ConditionallyRequired = {
@@ -24,7 +25,8 @@ export type SchemaFieldTag =
24
25
  | "display:survey"
25
26
  | "display:quoting"
26
27
  | "display:customModal"
27
- | `display:replace:'${string}':'${string}'`
28
+ | "display:mask"
29
+ | `display:replace:('${string}', '${string}')`
28
30
  | "display:terms_conditions"
29
31
  | `display:main_media:${string}` // property name to determine what image to display
30
32
  // date picker components
@@ -32,8 +34,13 @@ export type SchemaFieldTag =
32
34
  | "date_component:month"
33
35
  | "date_component:year"
34
36
  // other
37
+ | "action:allow_copy" // adds clipboard to input field
38
+ | "action:allow_unreplace" // adds reveal button for passwords
39
+ | "action:allow_password_compromise_check" // adds check if password is breached
35
40
  | "action:client_upload"
41
+ | "action:hash" // creates hash containing specified information
36
42
  | "action:require_webauthn"
43
+ | `action:generate_pepper:` // generates a pepper length 'n'
37
44
  | "verify:show_if_pending"
38
45
  | "special:hide_select_behind_button"
39
46
  | "type:capture_geolocation" // triggers the wizard's GeoLocationInput field
@@ -43,6 +50,7 @@ export type SchemaTag =
43
50
  // action
44
51
  | "action:experimental_pass_object_store_id"
45
52
  | "action:verify"
53
+ | `action:display_qr_code:${/* either extract or verify */ string}:${/* when to display QR */ string}`
46
54
  // camera
47
55
  | "default_camera:rear"
48
56
  | "default_camera:front"
@@ -52,6 +60,7 @@ export type SchemaTag =
52
60
  // misc
53
61
  | `time:${/* type */ string}:${/* seconds */ number}`
54
62
  | `link_to:${/* schemaName */ string}:${/* relationshipType */ string}`
63
+ | "display:default_view:edit" // links profile POcard direct to edit menu
55
64
  // type
56
65
  | "type:service_provider"
57
66
  | "type:service_offer"
@@ -91,6 +100,21 @@ export type SchemaField = {
91
100
  format?: "date" | "date-time" | "uri";
92
101
  contentMediaType?: string;
93
102
  contentEncoding?: "base64";
103
+ /**
104
+ * if this field is a foreign key, i.e. it is a primary key
105
+ * of a different schema, then that other's schema name should be listed here.
106
+ * e.g.
107
+ * ```json
108
+ * {
109
+ * "name": "ss_AA",
110
+ * "properties": {
111
+ * "org_id": { "foreign_key_of": "ss_Org" }
112
+ * }
113
+ * }
114
+ * ```
115
+ */
116
+ foreign_key_of?: SchemaName;
117
+
94
118
  /** `items` is used for nested arrays, (while `properties` is used for nested objects) */
95
119
  items?: {
96
120
  type: DataTypes;
@@ -104,7 +128,7 @@ export type SchemaField = {
104
128
  };
105
129
 
106
130
  /** If this field refers to a sub-object */
107
- $ref?: string;
131
+ $ref?: SchemaName;
108
132
 
109
133
  /**
110
134
  * @internal
@@ -131,6 +155,10 @@ export type SchemaField = {
131
155
  description_decorator?: "md";
132
156
  /** if a `pattern` is specified, this is the error message */
133
157
  patternMessage?: string;
158
+ /** the input string for a platform_unique_id */
159
+ hash_inputs?: string;
160
+ /** determines where an image is sourced from */
161
+ content_source?: string;
134
162
 
135
163
  override?: {
136
164
  permissions: {
@@ -221,9 +249,9 @@ export type CommonSchemaAttributes = {
221
249
  /** if required_relationship then use will be alerted in relationship menu and won't be able to share PO unless filled out */
222
250
  required_relationship?: boolean;
223
251
  /** Specify `oneOf` XOR `anyOf`. It's a list of schema names, or `"instance"` (see #784) */
224
- oneOf?: string[];
252
+ oneOf?: (SchemaName | "instance")[];
225
253
  /** Specify `oneOf` XOR `anyOf` It's a list of schema names. */
226
- anyOf?: string[];
254
+ anyOf?: SchemaName[];
227
255
 
228
256
  /** assume TRUE if not specified */
229
257
  multiple?: boolean;
@@ -253,13 +281,26 @@ export type CommonSchemaAttributes = {
253
281
  * Array because there could be multiple expand groups
254
282
  */
255
283
  expand?: { fields: string[]; label: string }[];
284
+
285
+ /**
286
+ * By default, the admin dashboard shows columns for all fields
287
+ * in listed in `head_main`. In rare cases you can use this property
288
+ * to specify a different set of fields to show to admins by default.
289
+ */
290
+ tabular?: { fields: string[] };
291
+
292
+ /**
293
+ * determines if profile pages should display using compacted 'MiniPO'
294
+ * view or deafult view
295
+ */
296
+ compact_table?: boolean;
256
297
  };
257
298
 
258
299
  /** only the schema used for the onboarding wizard have this property */
259
300
  onboard_properties?: {
260
301
  /** Profile Objects that should be created */
261
302
  profile_objects?: {
262
- schema_name: string;
303
+ schema_name: SchemaName;
263
304
  properties: Record<string, unknown>;
264
305
  }[];
265
306
 
@@ -300,7 +341,7 @@ export type CommonSchemaAttributes = {
300
341
  */
301
342
  export type Schema = CommonSchemaAttributes & {
302
343
  /** added by the client, copied from {@link WrappedSchema} */
303
- name: string; // Will always exist on schema
344
+ name: SchemaName;
304
345
 
305
346
  /** added by client */
306
347
  type?: DataTypes;
@@ -327,6 +368,14 @@ export type Schema = CommonSchemaAttributes & {
327
368
  [fieldName: string]: SchemaField;
328
369
  };
329
370
 
371
+ /**
372
+ * Some schema's represent data that is not stored as a profile object.
373
+ * In this case, this attribute defines what database table we need to use
374
+ * to fetch the corresponding data, and which field is the primary_key of that
375
+ * table (e.g. `id`, `o_id` etc.)
376
+ */
377
+ database?: { table: string; primary_key: string };
378
+
330
379
  /** the client adds this after processing the i18n property */
331
380
  groupNames?: Record<string, string>;
332
381
 
@@ -361,7 +410,7 @@ export type WrappedSchema = {
361
410
  end_date: string;
362
411
 
363
412
  /** Schema Name Type and Version Properties */
364
- schema_name: string;
413
+ schema_name: SchemaName;
365
414
  schema_type: SchemaType;
366
415
  schema_version: string;
367
416
 
@@ -0,0 +1,106 @@
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_name: string;
65
+ subscription_name_i18n: string | null;
66
+ current_billing_period_start: string;
67
+ current_billing_period_end: string | null;
68
+ cancellation_request_date: string | null;
69
+ cancellation_effective_date: string | null;
70
+ cancellation_request_reason: string | null;
71
+ cancellation_final_invoice_action: string;
72
+ };
73
+
74
+ export type SubscriptionLine = CommonFields<SLId> & {
75
+ billing_subscription_id: SId;
76
+ price_id: PRCId;
77
+ subscribed_qty: number;
78
+ metadata: string | null;
79
+ };
80
+
81
+ export type PaymentMethod = CommonFields<PMId> & {
82
+ customer_id: CId;
83
+ payer_payment_method_type: string;
84
+ primary_payment_method: boolean;
85
+ payment_processor_id: string;
86
+ payment_method_country_code: string | null;
87
+ payment_method_scheme: string;
88
+ payment_method_available_networks: string[] | string;
89
+ payment_method_preferred_network?: string | null;
90
+ card_expiry_month: number;
91
+ card_expiry_year: number;
92
+ card_funding_method: string;
93
+ card_last_4_digits: string;
94
+ card_fingerprint?: string | null;
95
+ payment_processor_payment_method_id: string;
96
+ address_line1_check?: string | null;
97
+ address_postal_code_check?: string | null;
98
+ cvc_check?: string | null;
99
+ three_d_secure_usage?: string | null;
100
+ };
101
+
102
+ export type PaymentProcessor = CommonFields<PTId> & {
103
+ party_id: PRid;
104
+ payment_processor_name: string;
105
+ payment_processor_system: string;
106
+ };
@@ -1,4 +1,11 @@
1
- import { NId, ProfileObject } from "./raytio";
1
+ import type {
2
+ CommonFields,
3
+ GPMId,
4
+ Json,
5
+ NId,
6
+ ProfileObject,
7
+ SchemaName,
8
+ } from "./raytio";
2
9
 
3
10
  // see #659
4
11
  export enum SafeHarbourCode {
@@ -13,10 +20,14 @@ export enum SafeHarbourCode {
13
20
  export type VerificationPayload<WithValue extends boolean> = {
14
21
  // we deliberately haven't defined 'sub'
15
22
  field: string;
16
- schema?: string;
23
+ schema?: SchemaName;
17
24
  metadata?: {
18
25
  safeHarbourScore?: SafeHarbourCode;
19
- status?: "pending";
26
+ status?: "pending" | "approved";
27
+ validation?: {
28
+ id: string;
29
+ url: string;
30
+ };
20
31
  pending_details?: {
21
32
  /**
22
33
  * for pending verifications - whether the verifier will complete fast enough that
@@ -42,6 +53,7 @@ export type VerificationPayload<WithValue extends boolean> = {
42
53
  source_hashed_n_id?: NId;
43
54
  type?: null;
44
55
  v_id: string;
56
+ verification_type_id: GPMId;
45
57
  verification_date: string;
46
58
  verifier_id?: NId;
47
59
  verifier_source_id?: NId;
@@ -115,6 +127,7 @@ export type VerificationProvider = {
115
127
  verifierNId?: NId;
116
128
  dataSourceNId?: NId;
117
129
  serviceProviderNId?: NId;
130
+ verificationTypeId?: GPMId;
118
131
  /** the date which the verification was verified on, or last re-verified on */
119
132
  date?: Date;
120
133
  };
@@ -141,3 +154,39 @@ export type RealVer = {
141
154
  /** If the verification has expired, it's the date that it expired on. Otherwise it's `false` */
142
155
  expired: Date | false;
143
156
  };
157
+
158
+ export type VerificationType = CommonFields<GPMId> & {
159
+ item_number: number;
160
+ org_number: number;
161
+ item_key: string;
162
+ item_key_01: string | null;
163
+ item_key_02: string | null;
164
+ item_key_03: string | null;
165
+ item_type: string | null;
166
+ item_name: string;
167
+ item_name_i18n: Json | null;
168
+ item_description: string;
169
+ item_description_i18n: Json | null;
170
+
171
+ primary_uom: string;
172
+ secondary_uom: string | null;
173
+ item_mass: number | null;
174
+ item_mass_uom: string | null;
175
+ item_volume: number | null;
176
+ item_volume_uom: string | null;
177
+ item_dimension_length: number | null;
178
+ item_dimension_width: number | null;
179
+ item_dimension_height: number | null;
180
+ item_dimension_uom: string | null;
181
+
182
+ purchased: boolean | null;
183
+ shipped: boolean | null;
184
+ stocked: boolean | null;
185
+ transacted: boolean | null;
186
+ asset: boolean | null;
187
+ returnable: boolean | null;
188
+
189
+ inventory_organization_number: number | null;
190
+ source_type: string | null;
191
+ source_organization_number: number | null;
192
+ };
package/src/wizard.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AId } from "./raytio";
1
+ import type { AId, SchemaName } from "./raytio";
2
2
 
3
3
  export type WizardPageTag =
4
4
  // actions
@@ -9,7 +9,7 @@ export type WizardPage = {
9
9
  /** if undefined, the schema title will be used */
10
10
  name?: string | symbol;
11
11
  filter: "oneOf" | "anyOf";
12
- schemas: string[];
12
+ schemas: SchemaName[];
13
13
 
14
14
  /** the fallback description, if there isn't one for the specific situation */
15
15
  description?: string;
@@ -110,9 +110,9 @@ export type WizardConfig = {
110
110
  /** number of days in the future */
111
111
  expiry_date?: number;
112
112
  /** if specified, a Wizard will be shown on the review page with this schema */
113
- terms_schema?: string;
113
+ terms_schema?: SchemaName;
114
114
  /** if specified, a Wizard will be shown on the review page with this schema */
115
- signature_schema?: string;
115
+ signature_schema?: SchemaName;
116
116
 
117
117
  // the following ones are generally not pre-configured, instead they
118
118
  // just come from the URL query params.