@wise/dynamic-flow-client 2.8.12 → 2.8.15
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 +101 -100
- 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/utils/api-utils.d.ts +0 -1
- package/build/types/revamp/domain/components/AllOfComponent.d.ts +16 -0
- package/build/types/revamp/domain/components/BooleanInputComponent.d.ts +2 -0
- package/build/types/revamp/domain/components/DateInputComponent.d.ts +2 -0
- package/build/types/revamp/domain/components/DecisionComponent.d.ts +15 -0
- package/build/types/revamp/domain/components/DividerComponent.d.ts +5 -0
- 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 +2 -0
- 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 +2 -0
- package/build/types/revamp/domain/components/ObjectComponent.d.ts +0 -1
- package/build/types/revamp/domain/components/ReviewComponent.d.ts +17 -0
- package/build/types/revamp/domain/components/SelectInputComponent.d.ts +2 -0
- package/build/types/revamp/domain/components/TextInputComponent.d.ts +2 -0
- package/build/types/revamp/domain/components/UploadInputComponent.d.ts +2 -0
- package/build/types/revamp/domain/components/repeatableComponent/RepeatableComponent.d.ts +5 -5
- 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/features/validation/value-checks.d.ts +3 -3
- package/build/types/revamp/domain/mappers/layout/decisionLayoutToComponent.d.ts +3 -0
- package/build/types/revamp/domain/mappers/layout/dividerLayoutToComponent.d.ts +2 -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/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/schema/allOfSchemaToComponent.d.ts +5 -0
- package/build/types/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToRepeatableComponent.d.ts +2 -2
- package/build/types/revamp/domain/mappers/schema/hiddenSchemaToComponent.d.ts +7 -0
- package/build/types/revamp/domain/mappers/schema/objectSchemaToComponent/objectSchemaToComponent.d.ts +1 -1
- package/build/types/revamp/domain/mappers/schema/oneOfSchemaToComponent/oneOfSchemaToComponent.d.ts +1 -1
- package/build/types/revamp/domain/mappers/schema/tests/test-utils.d.ts +3 -2
- package/build/types/revamp/domain/mappers/schema/types.d.ts +2 -1
- package/build/types/revamp/domain/mappers/schema/utils/mapCommonSchemaProps.d.ts +27 -0
- package/build/types/revamp/domain/mappers/types.d.ts +3 -0
- package/build/types/revamp/domain/types.d.ts +24 -8
- package/build/types/revamp/renderers/mappers/allOfComponentToProps.d.ts +4 -0
- package/build/types/revamp/renderers/mappers/decisionComponentToProps.d.ts +3 -0
- package/build/types/revamp/renderers/mappers/dividerComponentToProps.d.ts +3 -0
- 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/objectComponentToProps.d.ts +2 -2
- package/build/types/revamp/renderers/mappers/reviewComponentToProps.d.ts +3 -0
- package/build/types/revamp/renderers/mappers/utils/inputComponentToProps.d.ts +1 -3
- package/build/types/revamp/renderers/types.d.ts +59 -4
- package/build/types/revamp/utils/{getSubmittableData.d.ts → component-utils.d.ts} +1 -0
- package/build/types/revamp/utils/type-utils.d.ts +16 -5
- package/build/types/revamp/wise/renderers/DecisionRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/DividerRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/FormSectionRenderer.d.ts +3 -0
- 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/SearchRenderer.d.ts +2 -1
- 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 +2 -2
- package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.d.ts +0 -8
- package/build/types/revamp/domain/features/validation/getModelValidationErrors.d.ts +0 -6
- package/build/types/revamp/domain/features/validation/validateComponents.d.ts +0 -2
- package/build/types/revamp/domain/validation/validation-functions.d.ts +0 -8
- package/build/types/revamp/stories/visual-tests/array.d.ts +0 -3
- package/build/types/revamp/wise/renderers/ObjectRenderer.d.ts +0 -3
- /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;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Model } from '@wise/dynamic-flow-types/build/next';
|
|
2
|
+
import type { BaseComponent, RepeatableSummary, StepComponent } from '../types';
|
|
3
|
+
export type AllOfComponent = BaseComponent<Model> & {
|
|
4
|
+
type: 'all-of';
|
|
5
|
+
components: StepComponent[];
|
|
6
|
+
control?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
help?: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
getChildren: () => StepComponent[];
|
|
11
|
+
};
|
|
12
|
+
export declare const createAllOfComponent: (allOfProps: Pick<AllOfComponent, "description" | "help" | "title" | "control" | "components"> & {
|
|
13
|
+
uid: string;
|
|
14
|
+
analyticsId?: string | undefined;
|
|
15
|
+
summariser: (value: Model | null) => RepeatableSummary;
|
|
16
|
+
}) => AllOfComponent;
|
|
@@ -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
7
|
export declare const createBooleanInputComponent: (booleanInputProps: Pick<BooleanInputComponent, "analyticsId" | "description" | "disabled" | "help" | "title" | "control" | "id" | "errors" | "required" | "value" | "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> & {
|
|
@@ -7,5 +8,6 @@ export type DateInputComponent = InputComponent<string> & {
|
|
|
7
8
|
};
|
|
8
9
|
export declare const createDateInputComponent: (textInputProps: Pick<DateInputComponent, "analyticsId" | "description" | "disabled" | "title" | "placeholder" | "control" | "id" | "errors" | "required" | "value" | "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,15 @@
|
|
|
1
|
+
import type { Icon, Image } from '@wise/dynamic-flow-types/build/next';
|
|
2
|
+
import type { LayoutComponent } from '../types';
|
|
3
|
+
export type DecisionComponent = LayoutComponent & {
|
|
4
|
+
type: 'decision';
|
|
5
|
+
options: DecisionOption[];
|
|
6
|
+
};
|
|
7
|
+
export type DecisionOption = {
|
|
8
|
+
description?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
icon?: Icon;
|
|
11
|
+
image?: Image;
|
|
12
|
+
title: string;
|
|
13
|
+
onClick: () => void;
|
|
14
|
+
};
|
|
15
|
+
export declare const createDecisionComponent: (decisionProps: Pick<DecisionComponent, 'uid' | 'control' | 'margin' | 'options'>) => DecisionComponent;
|
|
@@ -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
7
|
export declare const createIntegerInputComponent: (integerInputProps: Pick<IntegerInputComponent, "analyticsId" | "description" | "disabled" | "help" | "title" | "placeholder" | "control" | "id" | "errors" | "required" | "value" | "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
7
|
export declare const createNumberInputComponent: (numberInputProps: Pick<NumberInputComponent, "analyticsId" | "description" | "disabled" | "help" | "title" | "placeholder" | "control" | "id" | "errors" | "required" | "value" | "autoComplete" | "uid"> & {
|
|
7
8
|
checks: IsInvalidCheck<number | null>[];
|
|
9
|
+
performPersistAsync: PerformPersistAsync | undefined;
|
|
8
10
|
summariser: (value: number | null) => RepeatableSummary;
|
|
9
11
|
}, updateComponent: UpdateComponent) => NumberInputComponent;
|
|
@@ -8,7 +8,6 @@ export type ObjectComponent = BaseComponent<Record<string, Model>> & {
|
|
|
8
8
|
help?: string;
|
|
9
9
|
title?: string;
|
|
10
10
|
getChildren: () => StepComponent[];
|
|
11
|
-
getValue: () => Record<string, Model>;
|
|
12
11
|
};
|
|
13
12
|
export declare const createObjectComponent: (objectProps: Pick<ObjectComponent, "description" | "help" | "title" | "control" | "componentMap"> & {
|
|
14
13
|
uid: 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;
|
|
@@ -25,6 +26,7 @@ export declare const createSelectInputComponent: (selectProps: Pick<SelectInputC
|
|
|
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;
|
|
@@ -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
8
|
export declare const createTextInputComponent: (textInputProps: Pick<TextInputComponent, "analyticsId" | "description" | "disabled" | "help" | "title" | "placeholder" | "control" | "displayFormat" | "id" | "errors" | "required" | "value" | "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
8
|
export declare const createUploadInputComponent: (uploadInputProps: Pick<UploadInputComponent, "analyticsId" | "description" | "disabled" | "title" | "placeholder" | "control" | "id" | "errors" | "required" | "value" | "accepts" | "autoComplete" | "uid"> & {
|
|
8
9
|
checks: IsInvalidCheck<string | null>[];
|
|
10
|
+
performPersistAsync: PerformPersistAsync | undefined;
|
|
9
11
|
summariser: (value: string | null) => RepeatableSummary;
|
|
10
12
|
}, updateComponent: UpdateComponent) => UploadInputComponent;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Model } from '@wise/dynamic-flow-types';
|
|
2
2
|
import type { SummarySummariser } from '@wise/dynamic-flow-types/build/next/feature/SummarySummariser';
|
|
3
3
|
import type { BaseComponent, RepeatableSummary, StepComponent, UpdateComponent } from '../../types';
|
|
4
4
|
import type { IsInvalidCheck } from '../../features/validation/value-checks';
|
|
5
|
-
export type RepeatableComponent = BaseComponent<
|
|
5
|
+
export type RepeatableComponent = BaseComponent<Model[]> & {
|
|
6
6
|
id?: string;
|
|
7
7
|
type: 'repeatable';
|
|
8
8
|
addItemTitle: string;
|
|
@@ -16,7 +16,7 @@ export type RepeatableComponent = BaseComponent<ArrayModel> & {
|
|
|
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;
|
|
@@ -24,8 +24,8 @@ export type RepeatableComponent = BaseComponent<ArrayModel> & {
|
|
|
24
24
|
};
|
|
25
25
|
export declare const createRepeatableComponent: (repeatableProps: Pick<RepeatableComponent, "description" | "title" | "control" | "id" | "errors" | "components" | "addItemTitle" | "editItemTitle" | "uid"> & {
|
|
26
26
|
analyticsId?: string | undefined;
|
|
27
|
-
checks: IsInvalidCheck<
|
|
27
|
+
checks: IsInvalidCheck<Model[] | null>[];
|
|
28
28
|
summary?: SummarySummariser | undefined;
|
|
29
|
-
summariser: (value:
|
|
29
|
+
summariser: (value: Model[] | null) => RepeatableSummary;
|
|
30
30
|
createEditableComponent: (model: Model) => StepComponent;
|
|
31
31
|
}, updateComponent: UpdateComponent) => RepeatableComponent;
|
|
@@ -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[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ArraySchemaList, IntegerSchema, Model, NumberSchema, Schema, StringSchema } from '@wise/dynamic-flow-types/build/next';
|
|
2
2
|
import type { ErrorMessageFunctions } from '../../mappers/types';
|
|
3
3
|
export type IsInvalidCheck<M extends Model> = (model: M | null) => string | null;
|
|
4
4
|
type GetIsInvalidCheck<S extends Schema, M extends Model> = (schema: S, messageFunctions: ErrorMessageFunctions) => IsInvalidCheck<M>;
|
|
5
|
-
export declare const getAboveMaxItemsCheck: GetIsInvalidCheck<ArraySchemaList,
|
|
6
|
-
export declare const getBelowMinItemsCheck: GetIsInvalidCheck<ArraySchemaList,
|
|
5
|
+
export declare const getAboveMaxItemsCheck: GetIsInvalidCheck<ArraySchemaList, Model[] | null>;
|
|
6
|
+
export declare const getBelowMinItemsCheck: GetIsInvalidCheck<ArraySchemaList, Model[] | null>;
|
|
7
7
|
export declare const getAboveMaxLengthCheck: GetIsInvalidCheck<StringSchema, string | null>;
|
|
8
8
|
export declare const getBelowMinLengthCheck: GetIsInvalidCheck<StringSchema, string | null>;
|
|
9
9
|
export declare const getAboveMaximumCheck: GetIsInvalidCheck<NumberSchema | IntegerSchema, number | null>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { DecisionLayout } from '@wise/dynamic-flow-types/build/next';
|
|
2
|
+
import type { MapperProps } from '../schema/types';
|
|
3
|
+
export declare const decisionLayoutToComponent: ({ control, margin, options }: DecisionLayout, { onAction }: MapperProps) => import("../../components/DecisionComponent").DecisionComponent;
|
|
@@ -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,5 @@
|
|
|
1
|
+
import type { AllOfSchema } from '@wise/dynamic-flow-types/build/next';
|
|
2
|
+
import type { MapperProps, SchemaMapperProps } from './types';
|
|
3
|
+
export declare const allOfSchemaToComponent: (schemaMapperProps: SchemaMapperProps & {
|
|
4
|
+
schema: AllOfSchema;
|
|
5
|
+
}, mapperProps: MapperProps) => import("../../components/AllOfComponent").AllOfComponent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ArraySchemaList, Model } from '@wise/dynamic-flow-types/build/next';
|
|
2
2
|
import type { MapperProps, SchemaMapperProps } from '../types';
|
|
3
3
|
export declare const arraySchemaToRepeatableComponent: (schemaMapperProps: SchemaMapperProps & {
|
|
4
4
|
schema: ArraySchemaList;
|
|
5
|
-
model:
|
|
5
|
+
model: Model[] | null;
|
|
6
6
|
}, mapperProps: MapperProps) => import("../../../components/repeatableComponent/RepeatableComponent").RepeatableComponent;
|
|
@@ -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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ObjectSchema } from '@wise/dynamic-flow-types/build/next';
|
|
2
2
|
import type { MapperProps, SchemaMapperProps } from '../types';
|
|
3
|
-
export declare const objectSchemaToComponent: (
|
|
3
|
+
export declare const objectSchemaToComponent: (schemaMapperProps: SchemaMapperProps & {
|
|
4
4
|
schema: ObjectSchema;
|
|
5
5
|
}, mapperProps: MapperProps) => import("../../../components/ObjectComponent").ObjectComponent;
|
package/build/types/revamp/domain/mappers/schema/oneOfSchemaToComponent/oneOfSchemaToComponent.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { OneOfSchema } from '@wise/dynamic-flow-types/build/next';
|
|
2
2
|
import type { MapperProps, SchemaMapperProps } from '../types';
|
|
3
|
-
export declare const oneOfSchemaToComponent: (
|
|
3
|
+
export declare const oneOfSchemaToComponent: (schemaMapperProps: SchemaMapperProps & {
|
|
4
4
|
schema: OneOfSchema;
|
|
5
5
|
}, mapperProps: MapperProps) => import("../../../components/SelectInputComponent").SelectInputComponent;
|
|
@@ -15,9 +15,10 @@ export declare const getMockSchemaMapperProps: <S extends Schema>(schemaMapperPr
|
|
|
15
15
|
schema: S;
|
|
16
16
|
}) => {
|
|
17
17
|
schema: (Schema | undefined) & S;
|
|
18
|
-
model: import("@wise/dynamic-flow-types/build/next").
|
|
18
|
+
model: import("@wise/dynamic-flow-types/build/next").JsonElement;
|
|
19
19
|
required: boolean;
|
|
20
|
-
validationErrors: import("@wise/dynamic-flow-types/build/next").
|
|
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
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
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;
|
|
13
|
+
required: boolean;
|
|
14
|
+
title: string | undefined;
|
|
15
|
+
performPersistAsync: import("../../../features/persistAsync/getPerformPersistAsync").PerformPersistAsync | undefined;
|
|
16
|
+
summariser: (model: import("@wise/dynamic-flow-types/build/next").JsonElement) => {
|
|
17
|
+
title?: undefined;
|
|
18
|
+
description?: undefined;
|
|
19
|
+
icon?: undefined;
|
|
20
|
+
image?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
title: string | undefined;
|
|
23
|
+
description: string | undefined;
|
|
24
|
+
icon: import("@wise/dynamic-flow-types/build/next").Icon | undefined;
|
|
25
|
+
image: import("@wise/dynamic-flow-types/build/next").Image | undefined;
|
|
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'>;
|
|
@@ -1,30 +1,39 @@
|
|
|
1
1
|
import type { Action, Icon, Image, Margin, Model } from '@wise/dynamic-flow-types/build/next';
|
|
2
2
|
import type { HiddenComponent } from './components/HiddenComponent';
|
|
3
3
|
import type { AlertComponent } from './components/AlertComponent';
|
|
4
|
+
import type { AllOfComponent } from './components/AllOfComponent';
|
|
4
5
|
import type { BooleanInputComponent } from './components/BooleanInputComponent';
|
|
5
6
|
import type { BoxComponent } from './components/BoxComponent';
|
|
6
7
|
import type { ButtonComponent } from './components/ButtonComponent';
|
|
7
8
|
import type { ColumnsComponent } from './components/ColumnsComponent';
|
|
8
9
|
import type { ContainerComponent } from './components/ContainerComponent';
|
|
10
|
+
import type { DateInputComponent } from './components/DateInputComponent';
|
|
11
|
+
import type { DecisionComponent } from './components/DecisionComponent';
|
|
12
|
+
import type { FormComponent } from './components/FormComponent';
|
|
13
|
+
import type { DividerComponent } from './components/DividerComponent';
|
|
9
14
|
import type { HeadingComponent } from './components/HeadingComponent';
|
|
10
15
|
import type { IntegerInputComponent } from './components/IntegerInputComponent';
|
|
11
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';
|
|
12
22
|
import type { ObjectComponent } from './components/ObjectComponent';
|
|
13
23
|
import type { ParagraphComponent } from './components/ParagraphComponent';
|
|
24
|
+
import type { RepeatableComponent } from './components/repeatableComponent/RepeatableComponent';
|
|
25
|
+
import type { ReviewComponent } from './components/ReviewComponent';
|
|
26
|
+
import type { SearchComponent } from './components/searchComponent/SearchComponent';
|
|
14
27
|
import type { SelectInputComponent } from './components/SelectInputComponent';
|
|
15
28
|
import type { TextInputComponent } from './components/TextInputComponent';
|
|
16
|
-
import type { DateInputComponent } from './components/DateInputComponent';
|
|
17
29
|
import type { UploadInputComponent } from './components/UploadInputComponent';
|
|
18
|
-
|
|
19
|
-
import type { SearchComponent } from './components/searchComponent/SearchComponent';
|
|
20
|
-
import type { RepeatableComponent } from './components/repeatableComponent/RepeatableComponent';
|
|
21
|
-
export type StepComponent = AlertComponent | BooleanInputComponent | BoxComponent | ButtonComponent | ColumnsComponent | ContainerComponent | DateInputComponent | FormComponent | HeadingComponent | HiddenComponent | IntegerInputComponent | NumberInputComponent | ObjectComponent | ParagraphComponent | RepeatableComponent | SearchComponent | SelectInputComponent | TextInputComponent | UploadInputComponent;
|
|
22
|
-
export type HasChildren = BoxComponent | ColumnsComponent | ContainerComponent | FormComponent | RepeatableComponent | SelectInputComponent | ObjectComponent;
|
|
30
|
+
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 | TextInputComponent | UploadInputComponent;
|
|
23
31
|
export type BaseComponent<M extends Model> = {
|
|
24
32
|
type: string;
|
|
25
33
|
uid: string;
|
|
26
34
|
analyticsId?: string;
|
|
27
|
-
|
|
35
|
+
getSubmittableValue: () => M | null;
|
|
36
|
+
getLocalValue: () => M | null;
|
|
28
37
|
getSummary: () => RepeatableSummary;
|
|
29
38
|
validate: () => boolean;
|
|
30
39
|
};
|
|
@@ -44,10 +53,11 @@ export type InputComponent<M extends Model> = BaseComponent<M> & {
|
|
|
44
53
|
required: boolean;
|
|
45
54
|
title?: string;
|
|
46
55
|
value: M | null;
|
|
56
|
+
persistedState: PersistedState<M>;
|
|
47
57
|
onChange: (value: M | null) => void;
|
|
48
58
|
onBlur: () => void;
|
|
49
59
|
onFocus: () => void;
|
|
50
|
-
|
|
60
|
+
getLocalValue: () => M | null;
|
|
51
61
|
};
|
|
52
62
|
export type UpdateComponent = (id: string, update: (component: StepComponent) => void) => void;
|
|
53
63
|
export type OnAction = (action: Action) => void;
|
|
@@ -60,3 +70,9 @@ export type RepeatableSummary = {
|
|
|
60
70
|
icon?: Icon;
|
|
61
71
|
image?: Image;
|
|
62
72
|
};
|
|
73
|
+
export type PersistedState<M extends Model> = {
|
|
74
|
+
abortController: AbortController;
|
|
75
|
+
lastSubmitted: M | null;
|
|
76
|
+
submission: Promise<void>;
|
|
77
|
+
value: M | null;
|
|
78
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { AllOfComponent } from '../../domain/components/AllOfComponent';
|
|
3
|
+
import type { FormSectionRendererProps } from '../types';
|
|
4
|
+
export declare const allOfComponentToProps: ({ control, description, help, title }: AllOfComponent, children: ReactNode) => FormSectionRendererProps;
|