@wise/dynamic-flow-types 2.2.0 → 2.3.1

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/build/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export * from './spec/responses';
2
2
  export * from './spec/Action';
3
- export * from './spec/AutocompleteHint';
3
+ export * from './spec/AutocompleteToken';
4
4
  export * from './spec/core';
5
5
  export * from './spec/LayoutComponent';
6
6
  export * from './spec/Model';
@@ -1,4 +1,4 @@
1
- import { HttpMethod } from './core';
1
+ import type { HttpMethod } from './core';
2
2
  type CoreAction = {
3
3
  id?: string;
4
4
  /**
@@ -6,7 +6,7 @@
6
6
  * with autocomplete hints - i.e a common pattern is to have password control on string schemas that can be combined
7
7
  * with the PASSWORD or NEW_PASSWORD hints for the best possible user experience.
8
8
  */
9
- export type AutocompleteHint =
9
+ export type AutocompleteToken =
10
10
  /**
11
11
  * Let the user agent provide the user with autocompletion values, but do not provide any further information about
12
12
  * what kind of data the user might be expected to enter. The user agent would have to use heuristics to decide what
@@ -26,31 +26,31 @@ export type AutocompleteHint =
26
26
  *
27
27
  * For example: "Sir"
28
28
  */
29
- | 'namePrefix'
29
+ | 'name-prefix'
30
30
  /**
31
31
  * A given (or "first") name.
32
32
  *
33
33
  * For example: "Timothy"
34
34
  */
35
- | 'givenName'
35
+ | 'given-name'
36
36
  /**
37
37
  * An additional (or middle) name.
38
38
  *
39
39
  * For example: "John"
40
40
  */
41
- | 'additionalName'
41
+ | 'additional-name'
42
42
  /**
43
43
  * A family (or "last") name.
44
44
  *
45
45
  * For example: "Berners-Lee"
46
46
  */
47
- | 'familyName'
47
+ | 'family-name'
48
48
  /**
49
49
  * A name suffix, such as "Jr.", "B.Sc.", "PhD.", "MBASW", or "IV".
50
50
  *
51
51
  * For example: "OM, KBE, FRS, FREng, FRSA"
52
52
  */
53
- | 'nameSuffix'
53
+ | 'name-suffix'
54
54
  /**
55
55
  * A nickname or handle.
56
56
  *
@@ -74,13 +74,13 @@ export type AutocompleteHint =
74
74
  *
75
75
  * For example: "timblee"
76
76
  */
77
- | 'newUsername'
77
+ | 'new-username'
78
78
  /**
79
79
  * A new password.
80
80
  *
81
81
  * For example: "GUMFXbadyrS3"
82
82
  */
83
- | 'newPassword'
83
+ | 'new-password'
84
84
  /**
85
85
  * The user's current password.
86
86
  *
@@ -92,19 +92,19 @@ export type AutocompleteHint =
92
92
  *
93
93
  * For example: "1234"
94
94
  */
95
- | 'oneTimeCode'
95
+ | 'one-time-code'
96
96
  /**
97
97
  * A job title, or the title a person has within an organization.
98
98
  *
99
99
  * For example: "Professor"
100
100
  */
101
- | 'jobTitle'
101
+ | 'job-title'
102
102
  /**
103
103
  * A company or organisation name.
104
104
  *
105
105
  * For example: "World Wide Web Consortium"
106
106
  */
107
- | 'organizationName'
107
+ | 'organization-name'
108
108
  /**
109
109
  * A street address. This can be multiple lines of text, and should fully identify the location of the address
110
110
  * within its second administrative level (typically a city or town), but should not include the city name, ZIP or
@@ -113,23 +113,23 @@ export type AutocompleteHint =
113
113
  * For example: "32 Vassar Street
114
114
  * MIT Room 32-G524"
115
115
  */
116
- | 'fullStreetAddress'
116
+ | 'full-street-address'
117
117
  /**
118
118
  * Individual line of the street address. This should only be present if FULL_STREET_ADDRESS is not present.
119
119
  *
120
120
  * For example: "32 Vassar Street"
121
121
  */
122
- | 'streetAddressLine1'
122
+ | 'street-address-line-1'
123
123
  /**
124
124
  * Individual line of the street address. This should only be present if FULL_STREET_ADDRESS is not present.
125
125
  *
126
126
  * For example: "MIT Room 32-G524"
127
127
  */
128
- | 'streetAddressLine2'
128
+ | 'street-address-line-2'
129
129
  /**
130
130
  * Individual line of the street address. This should only be present if FULL_STREET_ADDRESS is not present.
131
131
  */
132
- | 'streetAddressLine3'
132
+ | 'street-address-line-3'
133
133
  /**
134
134
  * Describes the address in terms of increasing levels of precision within the country in which the address is
135
135
  * located. Each country has its own system of administrative levels, and may arrange the levels in different orders
@@ -140,7 +140,7 @@ export type AutocompleteHint =
140
140
  *
141
141
  * For example: "MA"
142
142
  */
143
- | 'addressLevel1'
143
+ | 'address-level-1'
144
144
  /**
145
145
  * The second administrative level, in addresses with two or more administrative levels; in the countries with two
146
146
  * administrative levels, this would typically be the city, town, village, or other locality within which the
@@ -148,107 +148,107 @@ export type AutocompleteHint =
148
148
  *
149
149
  * For example: "Cambridge"
150
150
  */
151
- | 'addressLevel2'
151
+ | 'address-level-2'
152
152
  /**
153
153
  * The third administrative level, in addresses with three or more administrative levels.
154
154
  */
155
- | 'addressLevel3'
155
+ | 'address-level-3'
156
156
  /**
157
157
  * The most fine-grained administrative level, in addresses with four administrative levels.
158
158
  */
159
- | 'addressLevel4'
159
+ | 'address-level-4'
160
160
  /**
161
161
  * Valid ISO3166-1-alpha-2](https://www.iso.org/iso-3166-country-codes.html) country codes.
162
162
  *
163
163
  * For example: "US"
164
164
  */
165
- | 'countryCode'
165
+ | 'country-code'
166
166
  /**
167
167
  * A country or territory name (could be the same as COUNTRY_CODE or the full name).
168
168
  *
169
169
  * For example: "United States"
170
170
  */
171
- | 'countryName'
171
+ | 'country-name'
172
172
  /**
173
173
  * Postal code, post code, ZIP code, CEDEX code (if CEDEX, append "CEDEX", and the arrondissement, if relevant, to
174
174
  * the ADDRESS_LEVEL_2 field).
175
175
  *
176
176
  * For example: "02139"
177
177
  */
178
- | 'postalCode'
178
+ | 'postal-code'
179
179
  /**
180
180
  * The full name as printed on or associated with a payment instrument such as a credit card.
181
181
  *
182
182
  * For example: "Tim Berners-Lee"
183
183
  */
184
- | 'creditCardName'
184
+ | 'credit-card-name'
185
185
  /**
186
186
  * A given (first) name as given on a payment instrument like a credit card.
187
187
  *
188
188
  * For example: "Tim"
189
189
  */
190
- | 'creditCardGivenName'
190
+ | 'credit-card-given-name'
191
191
  /**
192
192
  * A middle name as given on a payment instrument or credit card.
193
193
  *
194
194
  * For example: "John"
195
195
  */
196
- | 'creditCardMiddleName'
196
+ | 'credit-card-middle-name'
197
197
  /**
198
198
  * A family name, as given on a credit card.
199
199
  *
200
200
  * For example: "Berners-Lee"
201
201
  */
202
- | 'creditCardFamilyName'
202
+ | 'credit-card-family-name'
203
203
  /**
204
204
  * A credit card number or other number identifying a payment method, such as an account number.
205
205
  *
206
206
  * For example: "4114360123456785"
207
207
  */
208
- | 'creditCardNumber'
208
+ | 'credit-card-number'
209
209
  /**
210
210
  * A payment method expiration date.
211
211
  *
212
212
  * For example: "2014-12"
213
213
  */
214
- | 'creditCardExpiration'
214
+ | 'credit-card-expiration'
215
215
  /**
216
216
  * The month in which the payment method expires.
217
217
  *
218
218
  * For example: "12"
219
219
  */
220
- | 'creditCardExpirationMonth'
220
+ | 'credit-card-expiration-month'
221
221
  /**
222
222
  * The year in which the payment method expires.
223
223
  *
224
224
  * For example: "2023"
225
225
  */
226
- | 'creditCardExpirationYear'
226
+ | 'credit-card-expiration-year'
227
227
  /**
228
228
  * The security code for the payment instrument; on credit cards, this is the 3-digit verification number on the
229
229
  * back of the card.
230
230
  *
231
231
  * For example: "443"
232
232
  */
233
- | 'creditCardSecurityCode'
233
+ | 'credit-card-security-code'
234
234
  /**
235
235
  * The type of payment instrument.
236
236
  *
237
237
  * For example: "Visa"
238
238
  */
239
- | 'creditCardType'
239
+ | 'credit-card-type'
240
240
  /**
241
241
  * The currency in which the transaction is to take place.
242
242
  *
243
243
  * For example: "GBP"
244
244
  */
245
- | 'transactionCurrency'
245
+ | 'transaction-currency'
246
246
  /**
247
247
  * The amount, given in the currency specified by TRANSACTION_CURRENCY, of the transaction, for a payment form.
248
248
  *
249
249
  * For example: "401.95"
250
250
  */
251
- | 'transactionAmount'
251
+ | 'transaction-amount'
252
252
  /**
253
253
  * A preferred language, given as a valid BCP47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag).
254
254
  *
@@ -266,19 +266,19 @@ export type AutocompleteHint =
266
266
  *
267
267
  * For example: "8"
268
268
  */
269
- | 'birthdateDay'
269
+ | 'birthdate-day'
270
270
  /**
271
271
  * The month of the year of a birthdate.
272
272
  *
273
273
  * For example: "6"
274
274
  */
275
- | 'birthdateMonth'
275
+ | 'birthdate-month'
276
276
  /**
277
277
  * The year of a birthdate.
278
278
  *
279
279
  * For example: "1955"
280
280
  */
281
- | 'birthdateYear'
281
+ | 'birthdate-year'
282
282
  /**
283
283
  * A gender identity (e.g. "Female", "Fa'afafine" or "Nonbinary").
284
284
  *
@@ -290,54 +290,54 @@ export type AutocompleteHint =
290
290
  *
291
291
  * For example: "+1 617 253 5702"
292
292
  */
293
- | 'phoneNumber'
293
+ | 'phone-number'
294
294
  /**
295
295
  * The country code, such as "1" for the United States, Canada, and other areas in North America and parts of the
296
296
  * Caribbean.
297
297
  *
298
298
  * For example: "+1"
299
299
  */
300
- | 'phoneCountryCode'
300
+ | 'phone-country-code'
301
301
  /**
302
302
  * The entire phone number without the country code component, including a country-internal prefix. For the phone
303
303
  * number "1-855-555-6502", this field's value would be "855-555-6502".
304
304
  *
305
305
  * For example: "617 253 5702"
306
306
  */
307
- | 'phoneNational'
307
+ | 'phone-national'
308
308
  /**
309
309
  * The area code, with any country-internal prefix applied if appropriate.
310
310
  *
311
311
  * For example: "617"
312
312
  */
313
- | 'phoneAreaCode'
313
+ | 'phone-area-code'
314
314
  /**
315
315
  * The phone number without the country or area code.
316
316
  *
317
317
  * For example: "2535702"
318
318
  */
319
- | 'phoneLocal'
319
+ | 'phone-local'
320
320
  /**
321
321
  * First part of the component of the phone number that follows the area code, when that component is split into
322
322
  * two components.
323
323
  *
324
324
  * For example: "253"
325
325
  */
326
- | 'phoneLocalPrefix'
326
+ | 'phone-local-prefix'
327
327
  /**
328
328
  * Second part of the component of the phone number that follows the area code, when that component is split
329
329
  * into two components.
330
330
  *
331
331
  * For example: "5702"
332
332
  */
333
- | 'phoneLocalSuffix'
333
+ | 'phone-local-suffix'
334
334
  /**
335
335
  * A phone extension code within the phone number, such as a room or suite number in a hotel or an office
336
336
  * extension in a company.
337
337
  *
338
338
  * For example: "1000"
339
339
  */
340
- | 'phoneExtension'
340
+ | 'phone-extension'
341
341
  /**
342
342
  * A URL, such as a home page or company website address as appropriate given the context of the other fields in the
343
343
  * form.
@@ -1,5 +1,5 @@
1
- import { ImageLayout } from './LayoutComponent';
2
- import { StringSchema } from './Schema';
1
+ import type { ImageLayout } from './LayoutComponent';
2
+ import type { StringSchema } from './Schema';
3
3
  export type FileUploadSchema = Omit<StringSchema, 'type' | 'format' | 'source' | 'image' | 'cameraConfig'> & {
4
4
  type: 'string';
5
5
  format: 'base64url';
@@ -1,9 +1,9 @@
1
- import { Action } from './Action';
2
- import { ExternalStepPollingConfiguration, ExternalStepPollingResponseHandler } from './Polling';
3
- import { Schema } from './Schema';
4
- import { SearchConfig } from './Search';
5
- import { Margin, Size, Icon, Image, Align, Orientation, Reference, Alert, Help } from './core';
6
- export type LayoutComponent = AlertLayout | BoxLayout | ButtonLayout | ColumnsLayout | DecisionLayout | DividerLayout | ExternalLayout | FormLayout | HeadingLayout | ImageLayout | InfoLayout | InstructionsLayout | ListLayout | LoadingIndicatorLayout | MarkdownLayout | ParagraphLayout | ReviewLayout | StatusListLayout | SearchLayout;
1
+ import type { Action } from './Action';
2
+ import type { ExternalStepPollingConfiguration, ExternalStepPollingResponseHandler } from './Polling';
3
+ import type { Schema } from './Schema';
4
+ import type { SearchConfig } from './Search';
5
+ import type { Margin, Size, Icon, Image, Align, Orientation, Reference, Alert, Help } from './core';
6
+ export type LayoutComponent = AlertLayout | BoxLayout | ButtonLayout | ColumnsLayout | DecisionLayout | DividerLayout | ExternalLayout | FormLayout | HeadingLayout | ImageLayout | InfoLayout | InstructionsLayout | ListLayout | LoadingIndicatorLayout | MarkdownLayout | ModalLayout | ParagraphLayout | ReviewLayout | StatusListLayout | SearchLayout;
7
7
  export type AlertLayout = {
8
8
  type: 'alert';
9
9
  } & Alert;
@@ -81,6 +81,7 @@ export type HeadingLayout = {
81
81
  text: string;
82
82
  margin?: Margin;
83
83
  align?: Align;
84
+ control?: string;
84
85
  };
85
86
  export type ImageLayout = {
86
87
  type: 'image';
@@ -96,6 +97,9 @@ export type ImageLayout = {
96
97
  */
97
98
  accessibilityDescription?: string;
98
99
  };
100
+ /**
101
+ * @deprecated Please use MarkdownLayout instead
102
+ */
99
103
  export type InfoLayout = {
100
104
  type: 'info';
101
105
  markdown: string;
@@ -146,6 +150,17 @@ export type MarkdownLayout = {
146
150
  margin?: Margin;
147
151
  align?: Align;
148
152
  };
153
+ export type ModalLayout = {
154
+ type: 'modal';
155
+ control?: string;
156
+ trigger: {
157
+ title: string;
158
+ };
159
+ content: {
160
+ components: LayoutComponent[];
161
+ };
162
+ margin?: Margin;
163
+ };
149
164
  export type ParagraphLayout = {
150
165
  type: 'paragraph';
151
166
  text: string;
@@ -2,5 +2,5 @@ export type BasicModel = boolean | number | string;
2
2
  export type ObjectModel = {
3
3
  [key: string]: Model;
4
4
  };
5
- export type ArrayModel = Array<Model | null>;
5
+ export type ArrayModel = (Model | null)[];
6
6
  export type Model = BasicModel | ObjectModel | ArrayModel | null;
@@ -1,4 +1,4 @@
1
- import { Action } from './Action';
1
+ import type { Action } from './Action';
2
2
  export type Navigation = {
3
3
  back?: BackBehaviour;
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { Schema } from './Schema';
1
+ import type { Schema } from './Schema';
2
2
  export type PersistAsync = {
3
3
  idProperty: string;
4
4
  method?: 'POST' | 'PUT' | 'PATCH';
@@ -1,4 +1,4 @@
1
- import { Action } from './Action';
1
+ import type { Action } from './Action';
2
2
  export type PollingConfiguration = {
3
3
  url: string;
4
4
  interval: number;
@@ -1,4 +1,4 @@
1
- import { Icon, Image } from './core';
1
+ import type { Icon, Image } from './core';
2
2
  export type Promotion = {
3
3
  displayTwice?: boolean;
4
4
  other: {
@@ -1,10 +1,10 @@
1
- import { AutocompleteHint } from './AutocompleteHint';
2
- import { FileUploadSchema } from './FileUploadSchema';
3
- import { Model, ObjectModel } from './Model';
4
- import { PersistAsync } from './PersistAsync';
5
- import { Promotion } from './Promotion';
6
- import { ValidationAsync } from './ValidationAsync';
7
- import { Icon, Image, Alert, Help } from './core';
1
+ import type { AutocompleteToken } from './AutocompleteToken';
2
+ import type { FileUploadSchema } from './FileUploadSchema';
3
+ import type { Model, ObjectModel } from './Model';
4
+ import type { PersistAsync } from './PersistAsync';
5
+ import type { Promotion } from './Promotion';
6
+ import type { ValidationAsync } from './ValidationAsync';
7
+ import type { Icon, Image, Alert, Help } from './core';
8
8
  export type Schema = AllOfSchema | ArraySchema | BlobSchema | BooleanSchema | IntegerSchema | NumberSchema | ObjectSchema | OneOfSchema | StringSchema | ListArraySchema | TupleArraySchema | FileUploadSchema | MultipleFileUploadSchema | ConstSchema;
9
9
  type SchemaBase = {
10
10
  $id?: string;
@@ -110,7 +110,7 @@ export type IntegerSchema = Omit<SchemaBase, 'persistAsync'> & {
110
110
  minimum?: number;
111
111
  persistAsync?: PersistAsync;
112
112
  placeholder?: number;
113
- autocompleteHint?: AutocompleteHint[];
113
+ autocompleteHint?: AutocompleteToken[];
114
114
  const?: number;
115
115
  oneOf?: IntegerSchema[];
116
116
  };
@@ -137,7 +137,7 @@ export type OneOfSchema = Omit<SchemaBase, 'oneOf' | 'promotion'> & {
137
137
  required?: string[];
138
138
  default?: Model;
139
139
  placeholder?: Model;
140
- autocompleteHint?: AutocompleteHint[];
140
+ autocompleteHint?: AutocompleteToken[];
141
141
  control?: string;
142
142
  };
143
143
  export type OneOfObjectSchema = Omit<OneOfSchema, 'oneOf' | 'default'> & {
@@ -159,7 +159,7 @@ export type StringSchema = Omit<SchemaBase, 'persistAsync'> & {
159
159
  pattern?: string;
160
160
  persistAsync?: PersistAsync;
161
161
  placeholder?: string;
162
- autocompleteHint?: AutocompleteHint[];
162
+ autocompleteHint?: AutocompleteToken[];
163
163
  const?: string;
164
164
  oneOf?: StringSchema[];
165
165
  };
@@ -1,5 +1,5 @@
1
- import { Action } from './Action';
2
- import { HttpMethod, Icon, Image } from './core';
1
+ import type { Action } from './Action';
2
+ import type { HttpMethod, Icon, Image } from './core';
3
3
  export type SearchConfig = {
4
4
  url: string;
5
5
  method: HttpMethod;
@@ -1,10 +1,10 @@
1
- import { Action } from './Action';
2
- import { LayoutComponent } from './LayoutComponent';
3
- import { ObjectModel } from './Model';
4
- import { Navigation } from './Navigation';
5
- import { ExternalStepPollingConfiguration, ExternalStepPollingResponseHandler, PollingConfiguration } from './Polling';
6
- import { Schema } from './Schema';
7
- import { Image } from './core';
1
+ import type { Action } from './Action';
2
+ import type { LayoutComponent } from './LayoutComponent';
3
+ import type { ObjectModel } from './Model';
4
+ import type { Navigation } from './Navigation';
5
+ import type { ExternalStepPollingConfiguration, ExternalStepPollingResponseHandler, PollingConfiguration } from './Polling';
6
+ import type { Schema } from './Schema';
7
+ import type { Image } from './core';
8
8
  export type Step = FormStep | DecisionStep | ExternalStep | FinalStep;
9
9
  type BaseStep = {
10
10
  id?: string;
@@ -98,10 +98,10 @@ export type LegacyReviewStep = Omit<FormStep, 'actions' | 'schemas' | 'layout'>
98
98
  };
99
99
  export type LegacyReviewFields = {
100
100
  title?: string;
101
- fields: Array<{
101
+ fields: {
102
102
  title: string;
103
103
  value: string;
104
- }>;
104
+ }[];
105
105
  };
106
106
  export type LegacyFormStep = Step & {
107
107
  type?: 'form';
@@ -1,4 +1,4 @@
1
- import { HttpMethod } from './core';
1
+ import type { HttpMethod } from './core';
2
2
  export type ValidationAsync = {
3
3
  param: string;
4
4
  url: string;
@@ -1,6 +1,6 @@
1
- import { Action } from './Action';
2
- import { SearchResult } from './Search';
3
- import { FormErrors, GlobalError } from './Step';
1
+ import type { Action } from './Action';
2
+ import type { SearchResult } from './Search';
3
+ import type { FormErrors, GlobalError } from './Step';
4
4
  export type ActionResponseBody = {
5
5
  action: Action;
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-types",
3
- "version": "2.2.0",
3
+ "version": "2.3.1",
4
4
  "description": "Dynamic Flow TypeScript Types",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -13,14 +13,11 @@
13
13
  "build"
14
14
  ],
15
15
  "devDependencies": {
16
- "@formatjs/cli": "^4.8.4",
17
- "eslint": "8.53.0",
18
- "prettier": "2.8.8",
16
+ "@formatjs/cli": "^6.2.4",
19
17
  "typescript": "4.9.5"
20
18
  },
21
19
  "peerDependencies": {},
22
20
  "dependencies": {},
23
- "prettier": "@transferwise/eslint-config/.prettierrc.js",
24
21
  "scripts": {
25
22
  "dev": "pnpm tsc --noEmit --watch",
26
23
  "test": "pnpm tsc --noEmit",