@wise/dynamic-flow-types 1.2.1 → 1.4.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/build/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './spec/responses';
1
2
  export * from './spec/Action';
2
3
  export * from './spec/core';
3
4
  export * from './spec/LayoutComponent';
@@ -8,4 +9,5 @@ export * from './spec/Promotion';
8
9
  export * from './spec/Schema';
9
10
  export * from './spec/Step';
10
11
  export * from './spec/ValidationAsync';
12
+ export * from './spec/Search';
11
13
  export type { FileUploadSchema, CameraDirection } from './spec/FileUploadSchema';
@@ -17,7 +17,4 @@ export type Action = CoreAction & {
17
17
  type?: 'primary' | 'secondary' | 'link' | 'positive' | 'negative';
18
18
  disabled?: boolean;
19
19
  };
20
- export type ActionResponseBody = {
21
- action: Action;
22
- };
23
20
  export {};
@@ -1,8 +1,9 @@
1
1
  import { Action } from './Action';
2
2
  import { ExternalStepPollingConfiguration, ExternalStepPollingResponseHandler } from './Polling';
3
3
  import { Schema } from './Schema';
4
+ import { SearchConfig } from './Search';
4
5
  import { Margin, Size, Icon, Image, Align, Orientation, Reference, Alert } from './core';
5
- export type LayoutComponent = AlertLayout | BoxLayout | ButtonLayout | ColumnsLayout | DecisionLayout | DividerLayout | ExternalLayout | FormLayout | HeadingLayout | ImageLayout | InfoLayout | ListLayout | LoadingIndicatorLayout | MarkdownLayout | ParagraphLayout | ReviewLayout | StatusListLayout;
6
+ export type LayoutComponent = AlertLayout | BoxLayout | ButtonLayout | ColumnsLayout | DecisionLayout | DividerLayout | ExternalLayout | FormLayout | HeadingLayout | ImageLayout | InfoLayout | InstructionsLayout | ListLayout | LoadingIndicatorLayout | MarkdownLayout | ParagraphLayout | ReviewLayout | StatusListLayout | SearchLayout;
6
7
  export type AlertLayout = {
7
8
  type: 'alert';
8
9
  } & Alert;
@@ -97,6 +98,12 @@ export type InfoLayout = {
97
98
  margin?: Margin;
98
99
  align?: Align;
99
100
  };
101
+ export type InstructionsLayout = {
102
+ type: 'instructions';
103
+ title?: string;
104
+ items: Instruction[];
105
+ margin?: Margin;
106
+ };
100
107
  /**
101
108
  * @deprecated Please use StatusListLayout instead
102
109
  */
@@ -157,8 +164,18 @@ export type ReviewLayout = {
157
164
  */
158
165
  action?: Action;
159
166
  };
167
+ export type SearchLayout = SearchConfig & {
168
+ type: 'search';
169
+ title: string;
170
+ emptyMessage: string;
171
+ margin?: Margin;
172
+ };
160
173
  type ReviewField = {
161
174
  label: string;
162
175
  value: string | number | boolean | null | undefined;
163
176
  };
177
+ type Instruction = {
178
+ text: string;
179
+ context: 'positive' | 'negative' | 'neutral' | 'warning';
180
+ };
164
181
  export {};
@@ -0,0 +1,21 @@
1
+ import { Action } from './Action';
2
+ import { HttpMethod, Icon, Image } from './core';
3
+ export type SearchConfig = {
4
+ url: string;
5
+ method: HttpMethod;
6
+ param: string;
7
+ };
8
+ export type SearchResult = {
9
+ title: string;
10
+ description?: string;
11
+ icon?: Icon;
12
+ image?: Image;
13
+ } & ({
14
+ type: 'action';
15
+ value: Action;
16
+ } | {
17
+ type: 'search';
18
+ value: SearchConfig & {
19
+ query: string;
20
+ };
21
+ });
@@ -83,15 +83,6 @@ export type DecisionStepOption = {
83
83
  };
84
84
  export type FormErrors = Record<string, unknown> | string | undefined | null;
85
85
  export type GlobalError = string | undefined | null;
86
- export type ErrorResponseBody = {
87
- error?: GlobalError;
88
- validation?: FormErrors;
89
- refreshUrl?: string;
90
- /**
91
- * @deprecated Please use refreshUrl instead
92
- */
93
- refreshFormUrl?: string;
94
- };
95
86
  /**
96
87
  * @deprecated Please use the review layout component
97
88
  */
@@ -0,0 +1,18 @@
1
+ import { Action } from './Action';
2
+ import { SearchResult } from './Search';
3
+ import { FormErrors, GlobalError } from './Step';
4
+ export type ActionResponseBody = {
5
+ action: Action;
6
+ };
7
+ export type ErrorResponseBody = {
8
+ error?: GlobalError;
9
+ validation?: FormErrors;
10
+ refreshUrl?: string;
11
+ /**
12
+ * @deprecated Please use refreshUrl instead
13
+ */
14
+ refreshFormUrl?: string;
15
+ };
16
+ export type SearchResponseBody = {
17
+ results: SearchResult[];
18
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-types",
3
- "version": "1.2.1",
3
+ "version": "1.4.0",
4
4
  "description": "Dynamic Flow TypeScript Types",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {