@wise/dynamic-flow-client 1.1.0 → 1.2.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.
@@ -1,7 +1,3 @@
1
1
  import { Schema, Step } from '../../types';
2
- export declare const stepType: {
3
- LAYOUT: string;
4
- CAMERA: string;
5
- };
2
+ export declare const isCameraStep: (step: Step) => boolean;
6
3
  export declare const filterHiddenSchemas: (schemas: Schema[]) => Schema[];
7
- export declare const getStepType: (step: Step) => string;
@@ -13,5 +13,5 @@ type ParsedBody = {
13
13
  };
14
14
  export declare const parseFetchResponse: (response: Response) => Promise<ParsedBody>;
15
15
  export declare const parseErrorResponse: (response: Response) => Promise<ErrorResponseBody>;
16
- export declare const parseExitResponse: (response: Response) => Promise<Parameters<DynamicFlowProps['onCompletion']>[0]>;
16
+ export declare const getJsonObjectOrNull: (response: Response) => Promise<Parameters<DynamicFlowProps['onCompletion']>[0]>;
17
17
  export {};
@@ -1,5 +1,5 @@
1
- import { Action, Schema } from '../../../types';
1
+ import { Schema } from '../../../types';
2
2
  import { ETag } from '../../DynamicFlowTypes';
3
- type FetchRefresh = (action: Action, data: unknown, etag: ETag | undefined) => Promise<void | null>;
4
- export declare function useDebouncedRefresh(fetchRefresh: FetchRefresh): (action: Action, data: unknown, etag: ETag | undefined, schema: Schema) => void;
3
+ type FetchRefresh = (url: string, data: unknown, etag: ETag | undefined) => Promise<void | null>;
4
+ export declare function useDebouncedRefresh(fetchRefresh: FetchRefresh): (url: string, data: unknown, etag: ETag | undefined, schema: Schema) => void;
5
5
  export {};
@@ -2,7 +2,7 @@
2
2
  import { DynamicFlowProps } from '../DynamicFlowTypes';
3
3
  type LoadingState = 'idle' | 'initial' | 'refresh' | 'submission';
4
4
  export declare function useLoader(loaderConfig: DynamicFlowProps['loaderConfig'], initialState: LoadingState): {
5
- loadingState: "initial" | "idle" | "refresh" | "submission";
5
+ isLoading: boolean;
6
6
  setLoadingState: import("react").Dispatch<import("react").SetStateAction<"initial" | "idle" | "refresh" | "submission">>;
7
7
  loader: JSX.Element | null;
8
8
  };
@@ -10,6 +10,8 @@ export declare const fixtures: {
10
10
  numberAndInteger: import("../types").FormStep;
11
11
  oneOf: import("../types").FormStep;
12
12
  stringFormats: import("../types").FormStep;
13
+ boolean: import("../types").FormStep;
14
+ allOf: import("../types").FormStep;
13
15
  actionResponse: import("../types").FormStep;
14
16
  external: import("../types").FormStep;
15
17
  persistAsync: import("../types").FormStep;
@@ -0,0 +1,3 @@
1
+ import { FormStep } from '../../types';
2
+ declare const step: FormStep;
3
+ export default step;
@@ -0,0 +1,3 @@
1
+ import { FormStep } from '../../types';
2
+ declare const step: FormStep;
3
+ export default step;
@@ -2,3 +2,5 @@ export { default as simpleForm } from './basic-form';
2
2
  export { default as numberAndInteger } from './number-and-integer';
3
3
  export { default as oneOf } from './one-of';
4
4
  export { default as stringFormats } from './string-formats';
5
+ export { default as boolean } from './boolean';
6
+ export { default as allOf } from './all-of';
@@ -1,7 +1,6 @@
1
1
  import { FormControlType } from '../../common/constants';
2
- import { useLogger } from '../../common/contexts';
3
2
  import { BasicModel, Schema } from '../../types';
4
- export declare const getControlType: (schema: Schema, log: ReturnType<typeof useLogger>) => (typeof FormControlType)[keyof typeof FormControlType] | undefined;
3
+ export declare const getControlType: (schema: Schema) => (typeof FormControlType)[keyof typeof FormControlType] | undefined;
5
4
  declare const SchemaFormControl: {
6
5
  (props: SchemaFormControlProps): JSX.Element;
7
6
  defaultProps: {
@@ -0,0 +1,5 @@
1
+ import { ButtonLayout } from '../../types';
2
+ import { Size } from '../../types';
3
+ export declare const getButtonPriority: (component: ButtonLayout) => "primary" | "secondary" | "tertiary";
4
+ export declare const getButtonType: (component: ButtonLayout) => "positive" | "negative" | "accent";
5
+ export declare const getButtonSize: (size: Size | undefined) => "sm" | "md" | "lg";
@@ -8,7 +8,7 @@ export { default as DynamicExternal } from './external/DynamicExternal';
8
8
  export { default as DynamicForm } from './form/DynamicForm';
9
9
  export { default as DynamicHeading } from './heading/DynamicHeading';
10
10
  export { default as DynamicIcon } from './icon/DynamicIcon';
11
- export { default as DynamicInfo } from './info/DynamicInfo';
11
+ export { DynamicInfo, DynamicMarkdown } from './markdown/DynamicMarkdown';
12
12
  export { default as DynamicImage } from './image/DynamicImage';
13
13
  export { default as DynamicLayout } from './DynamicLayout';
14
14
  export { default as DynamicList } from './list/DynamicList';
@@ -0,0 +1,10 @@
1
+ import { InfoLayout, MarkdownLayout } from '../../types';
2
+ type DynamicMarkdownProps = {
3
+ component: MarkdownLayout;
4
+ };
5
+ export declare const DynamicMarkdown: ({ component }: DynamicMarkdownProps) => JSX.Element;
6
+ type DynamicInfoProps = {
7
+ component: InfoLayout;
8
+ };
9
+ export declare const DynamicInfo: ({ component }: DynamicInfoProps) => JSX.Element;
10
+ export {};
@@ -2,7 +2,7 @@ import { ExternalStepPollingConfiguration } from '../../common/hooks';
2
2
  import { Action } from './Action';
3
3
  import { Schema } from './Schema';
4
4
  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 | ParagraphLayout | ReviewLayout;
5
+ export type LayoutComponent = AlertLayout | BoxLayout | ButtonLayout | ColumnsLayout | DecisionLayout | DividerLayout | ExternalLayout | FormLayout | HeadingLayout | ImageLayout | InfoLayout | ListLayout | LoadingIndicatorLayout | MarkdownLayout | ParagraphLayout | ReviewLayout;
6
6
  export type AlertLayout = {
7
7
  type: 'alert';
8
8
  } & Alert;
@@ -16,6 +16,10 @@ export type BoxLayout = {
16
16
  export type ButtonLayout = {
17
17
  type: 'button';
18
18
  action: Action | Reference;
19
+ title?: string;
20
+ control?: 'primary' | 'secondary' | 'tertiary';
21
+ context?: 'neutral' | 'positive' | 'negative';
22
+ disabled?: boolean;
19
23
  margin?: Margin;
20
24
  /**
21
25
  * @deprecated Only supported on web client
@@ -104,6 +108,12 @@ export type LoadingIndicatorLayout = {
104
108
  margin?: Margin;
105
109
  size?: Size;
106
110
  };
111
+ export type MarkdownLayout = {
112
+ type: 'markdown';
113
+ content: string;
114
+ margin?: Margin;
115
+ align?: Align;
116
+ };
107
117
  export type ParagraphLayout = {
108
118
  type: 'paragraph';
109
119
  text: string;
@@ -4,11 +4,15 @@ import { LayoutComponent } from './LayoutComponent';
4
4
  import { ObjectModel } from './Model';
5
5
  import { PollingConfiguration } from './Polling';
6
6
  import { Schema } from './Schema';
7
- import { Image, HttpMethod } from './core';
8
- export type Step = FormStep | DecisionStep | ExternalStep | WebStep | FinalStep;
7
+ import { Image } from './core';
8
+ export type Step = FormStep | DecisionStep | ExternalStep | FinalStep;
9
9
  type BaseStep = {
10
+ id?: string;
11
+ /**
12
+ * @deprecated Please use id instead
13
+ */
10
14
  key?: string;
11
- type: string;
15
+ type?: string;
12
16
  title?: string;
13
17
  description?: string;
14
18
  analytics?: Record<string, unknown>;
@@ -27,10 +31,9 @@ type BaseStep = {
27
31
  };
28
32
  };
29
33
  export type FormStep = BaseStep & {
30
- type: 'form';
34
+ type?: 'form';
31
35
  title: string;
32
36
  layout: LayoutComponent[];
33
- actions: Action[];
34
37
  schemas: Schema[];
35
38
  errors?: unknown;
36
39
  };
@@ -59,26 +62,6 @@ export type ExternalStep = BaseStep & {
59
62
  retryTitle?: string;
60
63
  title: string;
61
64
  };
62
- /**
63
- * @deprecated Please use the external feature set instead
64
- */
65
- type WebStep = BaseStep & {
66
- type: 'web';
67
- hideBackButton?: boolean;
68
- initialRequest: {
69
- body?: string;
70
- headers?: Record<string, string>;
71
- method: HttpMethod;
72
- url: string;
73
- };
74
- interceptablePatterns: {
75
- action?: Action;
76
- regexPattern: string;
77
- threshold?: number;
78
- type: 'submit' | 'cancel' | 'redirect' | 'abort-load' | 'log';
79
- }[];
80
- javaScriptMessageHandler?: unknown;
81
- };
82
65
  /**
83
66
  * @deprecated Please use DecisionLayout instead
84
67
  */
@@ -118,7 +101,7 @@ export type LegacyReviewFields = {
118
101
  }>;
119
102
  };
120
103
  export type LegacyFormStep = Step & {
121
- type: 'form';
104
+ type?: 'form';
122
105
  reviewFields?: LegacyReviewFields;
123
106
  schemas?: Schema[];
124
107
  actions?: Action[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.min.js",
@@ -106,6 +106,7 @@
106
106
  "test:coverage": "jest --config jest.config.js --env=jsdom --coverage",
107
107
  "test:tz": "TZ=US/Pacific jest ./src/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.errors.spec.js ./src/formControl/FormControl.spec.js",
108
108
  "test:watch": "pnpm test:once --watch",
109
+ "types": "pnpm tsc",
109
110
  "lint": "npm-run-all lint:ts lint:css",
110
111
  "lint:ts": "eslint 'src/**/*.{js,jsx,ts,tsx}' --quiet",
111
112
  "lint:css": "stylelint './src/**/*.css'",
@@ -1,6 +0,0 @@
1
- import { InfoLayout } from '../../types';
2
- type Props = {
3
- component: InfoLayout;
4
- };
5
- declare const DynamicInfo: ({ component }: Props) => JSX.Element;
6
- export default DynamicInfo;