@wise/dynamic-flow-client 2.9.0-beta-8dbf7a.29 → 2.9.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/main.js +332 -1986
- package/build/main.min.js +1 -1
- package/build/types/{legacy/common/contexts → common}/httpClientContext/HttpClientContext.d.ts +1 -1
- package/build/types/common/httpClientContext/index.d.ts +1 -0
- package/build/types/common/messages/persist-async.messages.d.ts +8 -0
- package/build/types/common/utils/api-utils.d.ts +1 -0
- package/build/types/legacy/common/contexts/index.d.ts +0 -1
- package/build/types/legacy/common/contexts/logContext/LogContext.d.ts +1 -1
- package/build/types/legacy/common/utils/api-utils.d.ts +0 -1
- package/build/types/legacy/formControl/FormControl.d.ts +3 -2
- package/build/types/legacy/jsonSchemaForm/JsonSchemaForm.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.d.ts +2 -1
- package/build/types/revamp/domain/components/AllOfComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/BooleanInputComponent.d.ts +3 -1
- package/build/types/revamp/domain/components/DateInputComponent.d.ts +3 -1
- package/build/types/revamp/domain/components/HeadingComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/ImageComponent.d.ts +9 -0
- package/build/types/revamp/domain/components/InstructionsComponent.d.ts +11 -0
- package/build/types/revamp/domain/components/IntegerInputComponent.d.ts +3 -1
- package/build/types/revamp/domain/components/LoadingIndicatorComponent.d.ts +8 -0
- package/build/types/revamp/domain/components/MarkdownComponent.d.ts +7 -0
- package/build/types/revamp/domain/components/ModalComponent.d.ts +12 -0
- package/build/types/revamp/domain/components/NumberInputComponent.d.ts +3 -1
- package/build/types/revamp/domain/components/ObjectComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/ReviewComponent.d.ts +17 -0
- package/build/types/revamp/domain/components/SelectInputComponent.d.ts +3 -1
- package/build/types/revamp/domain/components/StatusListComponent.d.ts +8 -0
- package/build/types/revamp/domain/components/TextInputComponent.d.ts +3 -1
- package/build/types/revamp/domain/components/UploadInputComponent.d.ts +3 -1
- package/build/types/revamp/domain/components/repeatableComponent/RepeatableComponent.d.ts +2 -2
- package/build/types/revamp/domain/features/persistAsync/getComponentPersistAsync.d.ts +15 -0
- package/build/types/revamp/domain/features/persistAsync/getPerformPersistAsync.d.ts +22 -0
- package/build/types/revamp/domain/features/persistAsync/persist-async-utils.d.ts +2 -0
- package/build/types/revamp/domain/features/validation/spec-utils.d.ts +1 -0
- package/build/types/revamp/domain/features/validation/validation-functions.d.ts +7 -0
- package/build/types/revamp/domain/mappers/layout/imageLayoutToComponent.d.ts +2 -0
- package/build/types/revamp/domain/mappers/layout/infoLayoutToComponent.d.ts +2 -0
- package/build/types/revamp/domain/mappers/layout/instructionsLayoutToComponent.d.ts +2 -0
- package/build/types/revamp/domain/mappers/layout/listLayoutToComponent.d.ts +2 -0
- package/build/types/revamp/domain/mappers/layout/loadingIndicatorLayoutToComponent.d.ts +2 -0
- package/build/types/revamp/domain/mappers/layout/markdownLayoutToComponent.d.ts +2 -0
- package/build/types/revamp/domain/mappers/layout/modalLayoutToComponent.d.ts +3 -0
- package/build/types/revamp/domain/mappers/layout/reviewLayoutToComponent.d.ts +3 -0
- package/build/types/revamp/domain/mappers/layout/statusListLayoutToComponent.d.ts +2 -0
- package/build/types/revamp/domain/mappers/schema/hiddenSchemaToComponent.d.ts +7 -0
- package/build/types/revamp/domain/mappers/schema/tests/test-utils.d.ts +1 -0
- package/build/types/revamp/domain/mappers/schema/types.d.ts +2 -1
- package/build/types/revamp/domain/mappers/schema/utils/mapCommonSchemaProps.d.ts +14 -13
- package/build/types/revamp/domain/mappers/types.d.ts +3 -0
- package/build/types/revamp/domain/types.d.ts +18 -3
- package/build/types/revamp/renderers/mappers/dividerComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/imageComponentToProps.d.ts +3 -0
- package/build/types/revamp/renderers/mappers/instructionsComponentToProps.d.ts +8 -0
- package/build/types/revamp/renderers/mappers/loadingIndicatorComponentToProps.d.ts +3 -0
- package/build/types/revamp/renderers/mappers/markdownComponentToProps.d.ts +3 -0
- package/build/types/revamp/renderers/mappers/modalComponentToProps.d.ts +4 -0
- package/build/types/revamp/renderers/mappers/reviewComponentToProps.d.ts +3 -0
- package/build/types/revamp/renderers/mappers/statusListComponentToProps.d.ts +3 -0
- package/build/types/revamp/renderers/types.d.ts +60 -2
- package/build/types/revamp/utils/{getSubmittableData.d.ts → component-utils.d.ts} +1 -0
- package/build/types/revamp/utils/type-utils.d.ts +10 -1
- package/build/types/revamp/wise/renderers/ImageRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/InstructionsRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/LoadingIndicatorRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/MarkdownRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/ModalRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/ReviewRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/StatusListRenderer.d.ts +4 -0
- package/build/types/revamp/wise/renderers/components/Help.d.ts +4 -0
- package/build/types/test-utils/fetch-utils.d.ts +2 -2
- package/package.json +25 -25
- package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.d.ts +0 -8
- package/build/types/revamp/domain/features/validation/getModelValidationErrors.d.ts +0 -5
- package/build/types/revamp/domain/features/validation/validateComponents.d.ts +0 -2
- package/build/types/revamp/domain/validation/validation-functions.d.ts +0 -7
- /package/build/types/revamp/{domain/mappers/utils → utils}/type-validators.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './HttpClientContext';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isRelativePath(url?: string): boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { LogLevel, LogEventHandler } from '../../../dynamic-flow-types';
|
|
3
3
|
export type LogTitle = 'Invalid schema or model' | 'Invalid model on change' | 'Invalid response' | 'Action supressed' | 'Deprecation warning' | 'Deprecated schema' | 'Error fetching';
|
|
4
|
-
|
|
4
|
+
type LogFunction = (title: LogTitle, description: string, extra?: Record<string, unknown>) => void;
|
|
5
5
|
export declare const getLogger: (level: LogLevel, onLog: LogEventHandler, flowId?: string | undefined, stepId?: string | undefined) => LogFunction;
|
|
6
6
|
type LogProviderProps = {
|
|
7
7
|
flowId?: string;
|
|
@@ -4,6 +4,7 @@ import { AutocompleteToken } from '@wise/dynamic-flow-types';
|
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
5
|
import { PureComponent } from 'react';
|
|
6
6
|
import { FormControlType } from '../common/constants';
|
|
7
|
+
import { OnChangeProps } from '../jsonSchemaForm/JsonSchemaForm';
|
|
7
8
|
export default class FormControl extends PureComponent<FormControlProps, FormControlState> {
|
|
8
9
|
static Type: {
|
|
9
10
|
RADIO: string;
|
|
@@ -45,7 +46,7 @@ export default class FormControl extends PureComponent<FormControlProps, FormCon
|
|
|
45
46
|
value: string | number | boolean | Date | null;
|
|
46
47
|
} | null;
|
|
47
48
|
getAutocompleteValue: () => string;
|
|
48
|
-
handleOnChange: (value: string | number | boolean | null) => void;
|
|
49
|
+
handleOnChange: (value: string | number | boolean | null, metadata?: OnChangeProps['metadata']) => void;
|
|
49
50
|
handleInputOnChange: React.ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
|
50
51
|
handleOnFocus: () => void;
|
|
51
52
|
handleOnBlur: () => void;
|
|
@@ -101,7 +102,7 @@ type FormControlSelectedOption = {
|
|
|
101
102
|
};
|
|
102
103
|
type FormControlProps = {
|
|
103
104
|
name: string;
|
|
104
|
-
onChange: (value: string | number | boolean | null, type?: 'init' | 'user') => void;
|
|
105
|
+
onChange: (value: string | number | boolean | null, type?: 'init' | 'user', metadata?: OnChangeProps['metadata']) => void;
|
|
105
106
|
/** @deprecated - Use autocompleteHint instead */
|
|
106
107
|
autoComplete?: boolean;
|
|
107
108
|
autocompleteHint?: AutocompleteToken[];
|
|
@@ -8,7 +8,7 @@ type RepeatableSchemaStepProps = {
|
|
|
8
8
|
errors?: FormErrors;
|
|
9
9
|
submitted: boolean;
|
|
10
10
|
onModelChange: OnModelChange;
|
|
11
|
-
onAction: (actionType: RepeatableActionType) => void;
|
|
11
|
+
onAction: (actionType: RepeatableActionType, summaryText?: string) => void;
|
|
12
12
|
};
|
|
13
13
|
declare function RepeatableSchemaStep({ type, schema, model, errors, submitted, onModelChange, onAction, }: RepeatableSchemaStepProps): JSX.Element;
|
|
14
14
|
export default RepeatableSchemaStep;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BasicModel, Schema, StringSchema } from '@wise/dynamic-flow-types';
|
|
2
2
|
import { FormControlType } from '../../common/constants';
|
|
3
|
+
import { OnChangeProps } from '../JsonSchemaForm';
|
|
3
4
|
export declare const getControlType: (schema: Schema) => (typeof FormControlType)[keyof typeof FormControlType] | undefined;
|
|
4
5
|
export declare const getStringSchemaControlType: ({ format, control, }: StringSchema) => (typeof FormControlType)[keyof typeof FormControlType] | undefined;
|
|
5
6
|
declare function SchemaFormControl(props: SchemaFormControlProps): JSX.Element;
|
|
@@ -16,7 +17,7 @@ export type SchemaFormControlProps = {
|
|
|
16
17
|
id: string;
|
|
17
18
|
value: BasicModel | null;
|
|
18
19
|
schema: Schema;
|
|
19
|
-
onChange: (model: BasicModel | null, type?: 'init' | 'user') => void;
|
|
20
|
+
onChange: (model: BasicModel | null, type?: 'init' | 'user', metadata?: OnChangeProps['metadata']) => void;
|
|
20
21
|
onFocus?: () => void;
|
|
21
22
|
onBlur?: () => void;
|
|
22
23
|
onSearchChange?: (searchValue: string) => void;
|
|
@@ -9,7 +9,7 @@ export type AllOfComponent = BaseComponent<Model> & {
|
|
|
9
9
|
title?: string;
|
|
10
10
|
getChildren: () => StepComponent[];
|
|
11
11
|
};
|
|
12
|
-
export declare const createAllOfComponent: (allOfProps: Pick<AllOfComponent, "
|
|
12
|
+
export declare const createAllOfComponent: (allOfProps: Pick<AllOfComponent, "control" | "title" | "description" | "help" | "components"> & {
|
|
13
13
|
uid: string;
|
|
14
14
|
analyticsId?: string | undefined;
|
|
15
15
|
summariser: (value: Model | null) => RepeatableSummary;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { InputComponent, RepeatableSummary, UpdateComponent } from '../types';
|
|
2
2
|
import type { IsInvalidCheck } from '../features/validation/value-checks';
|
|
3
|
+
import type { PerformPersistAsync } from '../features/persistAsync/getPerformPersistAsync';
|
|
3
4
|
export type BooleanInputComponent = InputComponent<boolean> & {
|
|
4
5
|
type: 'boolean';
|
|
5
6
|
};
|
|
6
|
-
export declare const createBooleanInputComponent: (booleanInputProps: Pick<BooleanInputComponent, "value" | "
|
|
7
|
+
export declare const createBooleanInputComponent: (booleanInputProps: Pick<BooleanInputComponent, "value" | "control" | "title" | "description" | "id" | "disabled" | "help" | "analyticsId" | "required" | "errors" | "uid"> & {
|
|
7
8
|
checks: IsInvalidCheck<boolean | null>[];
|
|
9
|
+
performPersistAsync: PerformPersistAsync | undefined;
|
|
8
10
|
summariser: (value: boolean | null) => RepeatableSummary;
|
|
9
11
|
}, updateComponent: UpdateComponent) => BooleanInputComponent;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PerformPersistAsync } from '../features/persistAsync/getPerformPersistAsync';
|
|
1
2
|
import type { IsInvalidCheck } from '../features/validation/value-checks';
|
|
2
3
|
import type { InputComponent, RepeatableSummary, UpdateComponent } from '../types';
|
|
3
4
|
export type DateInputComponent = InputComponent<string> & {
|
|
@@ -5,7 +6,8 @@ export type DateInputComponent = InputComponent<string> & {
|
|
|
5
6
|
minimumDate?: string;
|
|
6
7
|
maximumDate?: string;
|
|
7
8
|
};
|
|
8
|
-
export declare const createDateInputComponent: (textInputProps: Pick<DateInputComponent, "value" | "control" | "title" | "
|
|
9
|
+
export declare const createDateInputComponent: (textInputProps: Pick<DateInputComponent, "value" | "control" | "title" | "description" | "id" | "disabled" | "analyticsId" | "placeholder" | "required" | "errors" | "autoComplete" | "minimumDate" | "maximumDate" | "uid"> & {
|
|
9
10
|
checks: IsInvalidCheck<string | null>[];
|
|
11
|
+
performPersistAsync: PerformPersistAsync | undefined;
|
|
10
12
|
summariser: (value: string | null) => RepeatableSummary;
|
|
11
13
|
}, updateComponent: UpdateComponent) => DateInputComponent;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Size } from '@wise/dynamic-flow-types/build/next';
|
|
2
|
+
import type { LayoutComponent } from '../types';
|
|
3
|
+
export type ImageComponent = LayoutComponent & {
|
|
4
|
+
type: 'image';
|
|
5
|
+
accessibilityDescription?: string;
|
|
6
|
+
size: Size;
|
|
7
|
+
url: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const createImageComponent: (imageProps: Pick<ImageComponent, 'uid' | 'accessibilityDescription' | 'control' | 'margin' | 'size' | 'url'>) => ImageComponent;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Context, LayoutComponent } from '../types';
|
|
2
|
+
export type InstructionsComponent = LayoutComponent & {
|
|
3
|
+
type: 'instructions';
|
|
4
|
+
items: InstructionItem[];
|
|
5
|
+
title?: string;
|
|
6
|
+
};
|
|
7
|
+
export type InstructionItem = {
|
|
8
|
+
context: Context;
|
|
9
|
+
text: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const createInstructionsComponent: (instructionsProps: Pick<InstructionsComponent, 'uid' | 'control' | 'items' | 'margin' | 'title'>) => InstructionsComponent;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { InputComponent, RepeatableSummary, UpdateComponent } from '../types';
|
|
2
2
|
import type { IsInvalidCheck } from '../features/validation/value-checks';
|
|
3
|
+
import type { PerformPersistAsync } from '../features/persistAsync/getPerformPersistAsync';
|
|
3
4
|
export type IntegerInputComponent = InputComponent<number> & {
|
|
4
5
|
type: 'integer';
|
|
5
6
|
};
|
|
6
|
-
export declare const createIntegerInputComponent: (integerInputProps: Pick<IntegerInputComponent, "value" | "
|
|
7
|
+
export declare const createIntegerInputComponent: (integerInputProps: Pick<IntegerInputComponent, "value" | "control" | "title" | "description" | "id" | "disabled" | "help" | "analyticsId" | "placeholder" | "required" | "errors" | "autoComplete" | "uid"> & {
|
|
7
8
|
checks: IsInvalidCheck<number | null>[];
|
|
9
|
+
performPersistAsync: PerformPersistAsync | undefined;
|
|
8
10
|
summariser: (value: number | null) => RepeatableSummary;
|
|
9
11
|
}, updateComponent: UpdateComponent) => IntegerInputComponent;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Size } from '@wise/dynamic-flow-types/build/next';
|
|
2
|
+
import type { LayoutComponent } from '../types';
|
|
3
|
+
export type LoadingIndicatorComponent = LayoutComponent & {
|
|
4
|
+
type: 'loading-indicator';
|
|
5
|
+
control?: string;
|
|
6
|
+
size: Size;
|
|
7
|
+
};
|
|
8
|
+
export declare const createLoadingIndicatorComponent: (loadingIndicatorProps: Pick<LoadingIndicatorComponent, 'uid' | 'control' | 'margin' | 'size'>) => LoadingIndicatorComponent;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { LayoutComponent, Align } from '../types';
|
|
2
|
+
export type MarkdownComponent = LayoutComponent & {
|
|
3
|
+
type: 'markdown';
|
|
4
|
+
align: Align;
|
|
5
|
+
content: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const createMarkdownComponent: (markdownProps: Pick<MarkdownComponent, 'uid' | 'align' | 'control' | 'content' | 'margin'>) => MarkdownComponent;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ModalLayoutTrigger } from '@wise/dynamic-flow-types/build/next/layout/ModalLayoutTrigger';
|
|
2
|
+
import type { LayoutComponent, StepComponent } from '../types';
|
|
3
|
+
export type ModalComponent = LayoutComponent & {
|
|
4
|
+
type: 'modal';
|
|
5
|
+
content: ModalContent;
|
|
6
|
+
trigger: ModalLayoutTrigger;
|
|
7
|
+
getChildren: () => StepComponent[];
|
|
8
|
+
};
|
|
9
|
+
export type ModalContent = {
|
|
10
|
+
components: StepComponent[];
|
|
11
|
+
};
|
|
12
|
+
export declare const createModalComponent: (modalProps: Pick<ModalComponent, 'uid' | 'content' | 'control' | 'margin' | 'trigger'>) => ModalComponent;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { InputComponent, RepeatableSummary, UpdateComponent } from '../types';
|
|
2
2
|
import type { IsInvalidCheck } from '../features/validation/value-checks';
|
|
3
|
+
import type { PerformPersistAsync } from '../features/persistAsync/getPerformPersistAsync';
|
|
3
4
|
export type NumberInputComponent = InputComponent<number> & {
|
|
4
5
|
type: 'number';
|
|
5
6
|
};
|
|
6
|
-
export declare const createNumberInputComponent: (numberInputProps: Pick<NumberInputComponent, "value" | "
|
|
7
|
+
export declare const createNumberInputComponent: (numberInputProps: Pick<NumberInputComponent, "value" | "control" | "title" | "description" | "id" | "disabled" | "help" | "analyticsId" | "placeholder" | "required" | "errors" | "autoComplete" | "uid"> & {
|
|
7
8
|
checks: IsInvalidCheck<number | null>[];
|
|
9
|
+
performPersistAsync: PerformPersistAsync | undefined;
|
|
8
10
|
summariser: (value: number | null) => RepeatableSummary;
|
|
9
11
|
}, updateComponent: UpdateComponent) => NumberInputComponent;
|
|
@@ -9,7 +9,7 @@ export type ObjectComponent = BaseComponent<Record<string, Model>> & {
|
|
|
9
9
|
title?: string;
|
|
10
10
|
getChildren: () => StepComponent[];
|
|
11
11
|
};
|
|
12
|
-
export declare const createObjectComponent: (objectProps: Pick<ObjectComponent, "
|
|
12
|
+
export declare const createObjectComponent: (objectProps: Pick<ObjectComponent, "control" | "title" | "description" | "help" | "componentMap"> & {
|
|
13
13
|
uid: string;
|
|
14
14
|
analyticsId?: string | undefined;
|
|
15
15
|
displayOrder: string[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { LayoutComponent } from '../types';
|
|
2
|
+
export type ReviewComponent = LayoutComponent & {
|
|
3
|
+
type: 'review';
|
|
4
|
+
fields: ReviewField[];
|
|
5
|
+
title?: string;
|
|
6
|
+
callToAction?: ReviewCallToAction;
|
|
7
|
+
};
|
|
8
|
+
export type ReviewField = {
|
|
9
|
+
help?: string;
|
|
10
|
+
label: string;
|
|
11
|
+
value: string;
|
|
12
|
+
};
|
|
13
|
+
export type ReviewCallToAction = {
|
|
14
|
+
title: string;
|
|
15
|
+
onClick: () => void;
|
|
16
|
+
};
|
|
17
|
+
export declare const createReviewComponent: (reviewProps: Pick<ReviewComponent, 'uid' | 'callToAction' | 'control' | 'fields' | 'margin' | 'title'>) => ReviewComponent;
|
|
@@ -2,6 +2,7 @@ import type { Icon, Image, Model } from '@wise/dynamic-flow-types/build/next';
|
|
|
2
2
|
import type { InputComponent, RepeatableSummary, StepComponent, UpdateComponent } from '../types';
|
|
3
3
|
import type { IsInvalidCheck } from '../features/validation/value-checks';
|
|
4
4
|
import type { AnalyticsEventDispatcher } from '../features/events';
|
|
5
|
+
import type { PerformPersistAsync } from '../features/persistAsync/getPerformPersistAsync';
|
|
5
6
|
export type SelectInputComponent = Omit<InputComponent<Model>, 'onChange'> & {
|
|
6
7
|
type: 'select';
|
|
7
8
|
selectedIndex: number | null;
|
|
@@ -19,12 +20,13 @@ export type SelectInputOption = {
|
|
|
19
20
|
keywords?: string[];
|
|
20
21
|
disabled: boolean;
|
|
21
22
|
};
|
|
22
|
-
export declare const createSelectInputComponent: (selectProps: Pick<SelectInputComponent, "
|
|
23
|
+
export declare const createSelectInputComponent: (selectProps: Pick<SelectInputComponent, "control" | "title" | "description" | "id" | "disabled" | "help" | "analyticsId" | "placeholder" | "required" | "errors" | "autoComplete" | "uid"> & {
|
|
23
24
|
initialValue: Model;
|
|
24
25
|
options: (SelectInputOption & {
|
|
25
26
|
component: StepComponent;
|
|
26
27
|
})[];
|
|
27
28
|
checks: IsInvalidCheck<Model>[];
|
|
29
|
+
performPersistAsync: PerformPersistAsync | undefined;
|
|
28
30
|
summariser: (value: Model | null) => RepeatableSummary;
|
|
29
31
|
trackEvent: AnalyticsEventDispatcher;
|
|
30
32
|
}, updateComponent: UpdateComponent) => SelectInputComponent;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { StatusListLayoutItem } from '@wise/dynamic-flow-types/build/next/layout/StatusListLayoutItem';
|
|
2
|
+
import type { LayoutComponent } from '../types';
|
|
3
|
+
export type StatusListComponent = LayoutComponent & {
|
|
4
|
+
type: 'status-list';
|
|
5
|
+
items: StatusListLayoutItem[];
|
|
6
|
+
title?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const createStatusListComponent: (statusListProps: Pick<StatusListComponent, 'uid' | 'control' | 'items' | 'margin' | 'title'>) => StatusListComponent;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { IsInvalidCheck } from '../features/validation/value-checks';
|
|
2
2
|
import type { InputComponent, RepeatableSummary, UpdateComponent } from '../types';
|
|
3
|
+
import type { PerformPersistAsync } from '../features/persistAsync/getPerformPersistAsync';
|
|
3
4
|
export type TextInputComponent = InputComponent<string> & {
|
|
4
5
|
type: 'text';
|
|
5
6
|
displayFormat?: string;
|
|
6
7
|
};
|
|
7
|
-
export declare const createTextInputComponent: (textInputProps: Pick<TextInputComponent, "value" | "
|
|
8
|
+
export declare const createTextInputComponent: (textInputProps: Pick<TextInputComponent, "value" | "control" | "title" | "description" | "id" | "disabled" | "help" | "analyticsId" | "placeholder" | "required" | "displayFormat" | "errors" | "autoComplete" | "uid"> & {
|
|
8
9
|
checks: IsInvalidCheck<string | null>[];
|
|
10
|
+
performPersistAsync: PerformPersistAsync | undefined;
|
|
9
11
|
summariser: (value: string | null) => RepeatableSummary;
|
|
10
12
|
}, updateComponent: UpdateComponent) => TextInputComponent;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { IsInvalidCheck } from '../features/validation/value-checks';
|
|
2
2
|
import type { InputComponent, RepeatableSummary, UpdateComponent } from '../types';
|
|
3
|
+
import type { PerformPersistAsync } from '../features/persistAsync/getPerformPersistAsync';
|
|
3
4
|
export type UploadInputComponent = InputComponent<string> & {
|
|
4
5
|
type: 'upload';
|
|
5
6
|
accepts?: string[];
|
|
6
7
|
};
|
|
7
|
-
export declare const createUploadInputComponent: (uploadInputProps: Pick<UploadInputComponent, "value" | "control" | "title" | "
|
|
8
|
+
export declare const createUploadInputComponent: (uploadInputProps: Pick<UploadInputComponent, "value" | "control" | "title" | "description" | "id" | "disabled" | "accepts" | "analyticsId" | "placeholder" | "required" | "errors" | "autoComplete" | "uid"> & {
|
|
8
9
|
checks: IsInvalidCheck<string | null>[];
|
|
10
|
+
performPersistAsync: PerformPersistAsync | undefined;
|
|
9
11
|
summariser: (value: string | null) => RepeatableSummary;
|
|
10
12
|
}, updateComponent: UpdateComponent) => UploadInputComponent;
|
|
@@ -16,13 +16,13 @@ export type RepeatableComponent = BaseComponent<Model[]> & {
|
|
|
16
16
|
summaryDefaults: RepeatableSummary;
|
|
17
17
|
title?: string;
|
|
18
18
|
getChildren: () => StepComponent[];
|
|
19
|
-
|
|
19
|
+
getLocalValue: () => Model[] | null;
|
|
20
20
|
onAdd: () => void;
|
|
21
21
|
onEdit: (itemIndex: number) => void;
|
|
22
22
|
onRemove: () => void;
|
|
23
23
|
onSave: () => boolean;
|
|
24
24
|
};
|
|
25
|
-
export declare const createRepeatableComponent: (repeatableProps: Pick<RepeatableComponent, "control" | "title" | "description" | "id" | "
|
|
25
|
+
export declare const createRepeatableComponent: (repeatableProps: Pick<RepeatableComponent, "control" | "title" | "description" | "id" | "components" | "addItemTitle" | "editItemTitle" | "errors" | "uid"> & {
|
|
26
26
|
analyticsId?: string | undefined;
|
|
27
27
|
checks: IsInvalidCheck<Model[] | null>[];
|
|
28
28
|
summary?: SummarySummariser | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { getInputUpdateFunction } from '../../components/utils/component-utils';
|
|
2
|
+
import type { PerformPersistAsync } from './getPerformPersistAsync';
|
|
3
|
+
import type { BooleanInputComponent } from '../../components/BooleanInputComponent';
|
|
4
|
+
import type { DateInputComponent } from '../../components/DateInputComponent';
|
|
5
|
+
import type { IntegerInputComponent } from '../../components/IntegerInputComponent';
|
|
6
|
+
import type { NumberInputComponent } from '../../components/NumberInputComponent';
|
|
7
|
+
import type { SelectInputComponent } from '../../components/SelectInputComponent';
|
|
8
|
+
import type { TextInputComponent } from '../../components/TextInputComponent';
|
|
9
|
+
import type { UploadInputComponent } from '../../components/UploadInputComponent';
|
|
10
|
+
type Persistable = BooleanInputComponent | DateInputComponent | IntegerInputComponent | NumberInputComponent | SelectInputComponent | TextInputComponent | UploadInputComponent;
|
|
11
|
+
/**
|
|
12
|
+
* Creates an onPersistAsync handler for a component.
|
|
13
|
+
*/
|
|
14
|
+
export declare const getComponentPersistAsync: <C extends Persistable>(update: (updateFn: (component: C) => void) => void, performPersistAsync: PerformPersistAsync) => (component: C) => void;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { JsonElement, Model } from '@wise/dynamic-flow-types/build/next';
|
|
2
|
+
import type { PersistAsyncConfig } from '../../mappers/types';
|
|
3
|
+
import type { HttpClient } from '../../../dynamic-flow-types';
|
|
4
|
+
import type { AnalyticsEventDispatcher } from '../events';
|
|
5
|
+
export type PerformPersistAsync = (props: PersistAsyncProps) => Promise<JsonElement>;
|
|
6
|
+
type PersistAsyncModel = Model | Blob;
|
|
7
|
+
type PersistAsyncProps = {
|
|
8
|
+
value: PersistAsyncModel;
|
|
9
|
+
signal: AbortSignal;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Takes an httpClient and schema persist async config and returns a function that can
|
|
13
|
+
* execute a persist async request.
|
|
14
|
+
*/
|
|
15
|
+
export declare const getPerformPersistAsync: ({ schemaId, httpClient, trackEvent, persistAsyncConfig, genericErrorMessage, }: {
|
|
16
|
+
schemaId?: string | undefined;
|
|
17
|
+
httpClient: HttpClient;
|
|
18
|
+
trackEvent: AnalyticsEventDispatcher;
|
|
19
|
+
persistAsyncConfig: PersistAsyncConfig;
|
|
20
|
+
genericErrorMessage: string;
|
|
21
|
+
}) => PerformPersistAsync;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { StepComponent } from '../../types';
|
|
2
|
+
import type { IsInvalidCheck } from './value-checks';
|
|
3
|
+
export declare const validateComponents: (components: StepComponent[]) => boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Returns a function that takes a model and returns an array of validation errors
|
|
6
|
+
*/
|
|
7
|
+
export declare const getModelValidator: <M extends import("@wise/dynamic-flow-types/build/next").JsonElement>(checks: IsInvalidCheck<M>[]) => (currentValue: M) => string[];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ModalLayout } from '@wise/dynamic-flow-types/build/next';
|
|
2
|
+
import type { MapperProps } from '../schema/types';
|
|
3
|
+
export declare const modalLayoutToComponent: ({ content, control, margin, trigger }: ModalLayout, mapperProps: MapperProps) => import("../../components/ModalComponent").ModalComponent;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ReviewLayout } from '@wise/dynamic-flow-types/build/next';
|
|
2
|
+
import type { MapperProps } from '../schema/types';
|
|
3
|
+
export declare const reviewLayoutToComponent: ({ fields, title, callToAction, control, margin, orientation, action }: ReviewLayout, { onAction }: MapperProps) => import("../../components/ReviewComponent").ReviewComponent;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Schema } from '@wise/dynamic-flow-types/build/next';
|
|
2
|
+
import { SchemaMapperProps } from './types';
|
|
3
|
+
export declare const hiddenSchemaToComponent: (schemaMapperProps: SchemaMapperProps & {
|
|
4
|
+
schema: Schema & {
|
|
5
|
+
hidden: true;
|
|
6
|
+
};
|
|
7
|
+
}) => import("../../components/HiddenComponent").HiddenComponent;
|
|
@@ -18,6 +18,7 @@ export declare const getMockSchemaMapperProps: <S extends Schema>(schemaMapperPr
|
|
|
18
18
|
model: import("@wise/dynamic-flow-types/build/next").JsonElement;
|
|
19
19
|
required: boolean;
|
|
20
20
|
validationErrors: import("@wise/dynamic-flow-types/build/next").JsonElement;
|
|
21
|
+
persistAsyncConfig?: import("../../types").PersistAsyncConfig | undefined;
|
|
21
22
|
};
|
|
22
23
|
export declare const mockUpdateFunction: <C extends StepComponent>(draftComponent: C) => jest.Mock<any, any, any>;
|
|
23
24
|
export declare const getUpdateFunctionMock: <C extends StepComponent>(getComponent: () => C) => jest.Mock<void, [uid: string, update: (component: StepComponent) => void], any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Step as DFStep, Model, Schema, ValidationError } from '@wise/dynamic-flow-types/build/next';
|
|
2
2
|
import type { OnAction, UpdateComponent } from '../../types';
|
|
3
|
-
import type { GetErrorMessageFunctions } from '../types';
|
|
3
|
+
import type { GetErrorMessageFunctions, PersistAsyncConfig } from '../types';
|
|
4
4
|
import type { AnalyticsEventDispatcher, LoggingEventDispatcher } from '../../features/events';
|
|
5
5
|
import type { HttpClient } from '../../../dynamic-flow-types';
|
|
6
6
|
export type MapperProps = {
|
|
@@ -17,4 +17,5 @@ export type SchemaMapperProps = {
|
|
|
17
17
|
model: Model;
|
|
18
18
|
required?: boolean;
|
|
19
19
|
validationErrors?: ValidationError;
|
|
20
|
+
persistAsyncConfig?: PersistAsyncConfig;
|
|
20
21
|
};
|
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
import type { SchemaMapperProps } from '../types';
|
|
2
|
-
export declare const mapCommonSchemaProps: (
|
|
1
|
+
import type { MapperProps, SchemaMapperProps } from '../types';
|
|
2
|
+
export declare const mapCommonSchemaProps: (schemaMapperProps: SchemaMapperProps, mapperProps: MapperProps) => {
|
|
3
|
+
placeholder?: string | undefined;
|
|
4
|
+
help?: string | undefined;
|
|
5
|
+
uid: string;
|
|
6
|
+
id: string;
|
|
7
|
+
analyticsId: string;
|
|
8
|
+
control: string | undefined;
|
|
9
|
+
description: string | undefined;
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
errors: string[];
|
|
12
|
+
keywords: string[] | undefined;
|
|
3
13
|
required: boolean;
|
|
14
|
+
title: string | undefined;
|
|
15
|
+
performPersistAsync: import("../../../features/persistAsync/getPerformPersistAsync").PerformPersistAsync | undefined;
|
|
4
16
|
summariser: (model: import("@wise/dynamic-flow-types/build/next").JsonElement) => {
|
|
5
17
|
title?: undefined;
|
|
6
18
|
description?: undefined;
|
|
@@ -12,15 +24,4 @@ export declare const mapCommonSchemaProps: ({ schema, required, validationErrors
|
|
|
12
24
|
icon: import("@wise/dynamic-flow-types/build/next").Icon | undefined;
|
|
13
25
|
image: import("@wise/dynamic-flow-types/build/next").Image | undefined;
|
|
14
26
|
};
|
|
15
|
-
title: string | undefined;
|
|
16
|
-
placeholder?: string | undefined;
|
|
17
|
-
keywords: string[] | undefined;
|
|
18
|
-
help?: string | undefined;
|
|
19
|
-
uid: string;
|
|
20
|
-
id: string;
|
|
21
|
-
analyticsId: string;
|
|
22
|
-
control: string | undefined;
|
|
23
|
-
description: string | undefined;
|
|
24
|
-
disabled: boolean;
|
|
25
|
-
errors: string[];
|
|
26
27
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PersistAsync } from '@wise/dynamic-flow-types/build/next/feature/PersistAsync';
|
|
1
2
|
export type GetErrorMessageFunctions = (validationMessages?: ValidationMessages) => ErrorMessageFunctions;
|
|
2
3
|
export type ValidationMessages = Record<string, string | undefined>;
|
|
3
4
|
export type ErrorMessageFunctions = {
|
|
@@ -11,4 +12,6 @@ export type ErrorMessageFunctions = {
|
|
|
11
12
|
minItems: (minItems: number) => string;
|
|
12
13
|
pattern: () => string;
|
|
13
14
|
required: () => string;
|
|
15
|
+
persistAsyncError: () => string;
|
|
14
16
|
};
|
|
17
|
+
export type PersistAsyncConfig = Pick<PersistAsync, 'idProperty' | 'method' | 'param' | 'url'>;
|
|
@@ -14,19 +14,27 @@ import type { DividerComponent } from './components/DividerComponent';
|
|
|
14
14
|
import type { HeadingComponent } from './components/HeadingComponent';
|
|
15
15
|
import type { IntegerInputComponent } from './components/IntegerInputComponent';
|
|
16
16
|
import type { NumberInputComponent } from './components/NumberInputComponent';
|
|
17
|
+
import type { ImageComponent } from './components/ImageComponent';
|
|
18
|
+
import type { LoadingIndicatorComponent } from './components/LoadingIndicatorComponent';
|
|
19
|
+
import type { MarkdownComponent } from './components/MarkdownComponent';
|
|
20
|
+
import type { InstructionsComponent } from './components/InstructionsComponent';
|
|
21
|
+
import type { ModalComponent } from './components/ModalComponent';
|
|
17
22
|
import type { ObjectComponent } from './components/ObjectComponent';
|
|
18
23
|
import type { ParagraphComponent } from './components/ParagraphComponent';
|
|
19
24
|
import type { RepeatableComponent } from './components/repeatableComponent/RepeatableComponent';
|
|
25
|
+
import type { ReviewComponent } from './components/ReviewComponent';
|
|
20
26
|
import type { SearchComponent } from './components/searchComponent/SearchComponent';
|
|
21
27
|
import type { SelectInputComponent } from './components/SelectInputComponent';
|
|
28
|
+
import type { StatusListComponent } from './components/StatusListComponent';
|
|
22
29
|
import type { TextInputComponent } from './components/TextInputComponent';
|
|
23
30
|
import type { UploadInputComponent } from './components/UploadInputComponent';
|
|
24
|
-
export type StepComponent = AlertComponent | AllOfComponent | BooleanInputComponent | BoxComponent | ButtonComponent | ColumnsComponent | ContainerComponent | DateInputComponent | DecisionComponent | DividerComponent | FormComponent | HeadingComponent | HiddenComponent | IntegerInputComponent | NumberInputComponent | ObjectComponent | ParagraphComponent | RepeatableComponent | SearchComponent | SelectInputComponent | TextInputComponent | UploadInputComponent;
|
|
31
|
+
export type StepComponent = AlertComponent | AllOfComponent | BooleanInputComponent | BoxComponent | ButtonComponent | ColumnsComponent | ContainerComponent | DateInputComponent | DecisionComponent | DividerComponent | FormComponent | HeadingComponent | HiddenComponent | ImageComponent | InstructionsComponent | IntegerInputComponent | LoadingIndicatorComponent | MarkdownComponent | ModalComponent | NumberInputComponent | ObjectComponent | ParagraphComponent | RepeatableComponent | ReviewComponent | SearchComponent | SelectInputComponent | StatusListComponent | TextInputComponent | UploadInputComponent;
|
|
25
32
|
export type BaseComponent<M extends Model> = {
|
|
26
33
|
type: string;
|
|
27
34
|
uid: string;
|
|
28
35
|
analyticsId?: string;
|
|
29
|
-
|
|
36
|
+
getSubmittableValue: () => M | null;
|
|
37
|
+
getLocalValue: () => M | null;
|
|
30
38
|
getSummary: () => RepeatableSummary;
|
|
31
39
|
validate: () => boolean;
|
|
32
40
|
};
|
|
@@ -46,10 +54,11 @@ export type InputComponent<M extends Model> = BaseComponent<M> & {
|
|
|
46
54
|
required: boolean;
|
|
47
55
|
title?: string;
|
|
48
56
|
value: M | null;
|
|
57
|
+
persistedState: PersistedState<M>;
|
|
49
58
|
onChange: (value: M | null) => void;
|
|
50
59
|
onBlur: () => void;
|
|
51
60
|
onFocus: () => void;
|
|
52
|
-
|
|
61
|
+
getLocalValue: () => M | null;
|
|
53
62
|
};
|
|
54
63
|
export type UpdateComponent = (id: string, update: (component: StepComponent) => void) => void;
|
|
55
64
|
export type OnAction = (action: Action) => void;
|
|
@@ -62,3 +71,9 @@ export type RepeatableSummary = {
|
|
|
62
71
|
icon?: Icon;
|
|
63
72
|
image?: Image;
|
|
64
73
|
};
|
|
74
|
+
export type PersistedState<M extends Model> = {
|
|
75
|
+
abortController: AbortController;
|
|
76
|
+
lastSubmitted: M | null;
|
|
77
|
+
submission: Promise<void>;
|
|
78
|
+
value: M | null;
|
|
79
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DividerComponent } from '../../domain/components/DividerComponent';
|
|
1
|
+
import type { DividerComponent } from '../../domain/components/DividerComponent';
|
|
2
2
|
import type { DividerRendererProps } from '../types';
|
|
3
3
|
export declare const dividerComponentToProps: ({ control, margin, }: DividerComponent) => DividerRendererProps;
|