@wise/dynamic-flow-client 2.8.11 → 2.8.14
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 +69 -70
- 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/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/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/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/ObjectComponent.d.ts +0 -1
- package/build/types/revamp/domain/components/ReviewComponent.d.ts +17 -0
- package/build/types/revamp/domain/components/repeatableComponent/RepeatableComponent.d.ts +5 -5
- package/build/types/revamp/domain/features/validation/getModelValidationErrors.d.ts +1 -2
- 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 +2 -2
- package/build/types/revamp/domain/mappers/schema/utils/mapCommonSchemaProps.d.ts +26 -0
- package/build/types/revamp/domain/types.d.ts +14 -6
- package/build/types/revamp/domain/validation/validation-functions.d.ts +1 -2
- 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/type-utils.d.ts +10 -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/package.json +19 -19
- package/build/types/revamp/stories/visual-tests/array.d.ts +0 -3
- package/build/types/revamp/wise/renderers/ObjectRenderer.d.ts +0 -3
|
@@ -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;
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -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
|
-
getValue: () =>
|
|
19
|
+
getValue: () => 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;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { Model } from '@wise/dynamic-flow-types/build/next';
|
|
2
1
|
import type { IsInvalidCheck } from './value-checks';
|
|
3
|
-
export declare const getModelValidationErrors: <M extends
|
|
2
|
+
export declare const getModelValidationErrors: <M extends import("@wise/dynamic-flow-types/build/next").JsonElement>({ checks, model, }: {
|
|
4
3
|
checks: IsInvalidCheck<M>[];
|
|
5
4
|
model: M;
|
|
6
5
|
}) => 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,9 @@ 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
21
|
};
|
|
22
22
|
export declare const mockUpdateFunction: <C extends StepComponent>(draftComponent: C) => jest.Mock<any, any, any>;
|
|
23
23
|
export declare const getUpdateFunctionMock: <C extends StepComponent>(getComponent: () => C) => jest.Mock<void, [uid: string, update: (component: StepComponent) => void], any>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { SchemaMapperProps } from '../types';
|
|
2
|
+
export declare const mapCommonSchemaProps: ({ schema, required, validationErrors }: SchemaMapperProps) => {
|
|
3
|
+
required: boolean;
|
|
4
|
+
summariser: (model: import("@wise/dynamic-flow-types/build/next").JsonElement) => {
|
|
5
|
+
title?: undefined;
|
|
6
|
+
description?: undefined;
|
|
7
|
+
icon?: undefined;
|
|
8
|
+
image?: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
title: string | undefined;
|
|
11
|
+
description: string | undefined;
|
|
12
|
+
icon: import("@wise/dynamic-flow-types/build/next").Icon | undefined;
|
|
13
|
+
image: import("@wise/dynamic-flow-types/build/next").Image | undefined;
|
|
14
|
+
};
|
|
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
|
+
};
|
|
@@ -1,25 +1,33 @@
|
|
|
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';
|
|
15
|
+
import type { ImageComponent } from './components/ImageComponent';
|
|
16
|
+
import type { InstructionsComponent } from './components/InstructionsComponent';
|
|
10
17
|
import type { IntegerInputComponent } from './components/IntegerInputComponent';
|
|
18
|
+
import type { LoadingIndicatorComponent } from './components/LoadingIndicatorComponent';
|
|
19
|
+
import type { MarkdownComponent } from './components/MarkdownComponent';
|
|
20
|
+
import type { ModalComponent } from './components/ModalComponent';
|
|
11
21
|
import type { NumberInputComponent } from './components/NumberInputComponent';
|
|
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;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { Model } from '@wise/dynamic-flow-types/build/next';
|
|
2
1
|
import type { StepComponent } from '../types';
|
|
3
2
|
import type { IsInvalidCheck } from '../features/validation/value-checks';
|
|
4
3
|
export declare const validateComponents: (components: StepComponent[]) => boolean;
|
|
5
|
-
export declare const getModelValidationErrors: <M extends
|
|
4
|
+
export declare const getModelValidationErrors: <M extends import("@wise/dynamic-flow-types/build/next").JsonElement>({ checks, model, }: {
|
|
6
5
|
checks: IsInvalidCheck<M>[];
|
|
7
6
|
model: M;
|
|
8
7
|
}) => string[];
|
|
@@ -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;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ImageComponent } from '../../domain/components/ImageComponent';
|
|
2
|
+
import type { ImageRendererProps } from '../types';
|
|
3
|
+
export declare const imageComponentToProps: ({ accessibilityDescription, control, margin, size, url, }: ImageComponent) => ImageRendererProps;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { InstructionsComponent } from '../../domain/components/InstructionsComponent';
|
|
2
|
+
export declare const instructionsComponentToProps: ({ control, items, margin, title, }: InstructionsComponent) => {
|
|
3
|
+
type: string;
|
|
4
|
+
control: string | undefined;
|
|
5
|
+
items: import("../../domain/components/InstructionsComponent").InstructionItem[];
|
|
6
|
+
margin: import("@wise/dynamic-flow-types/build/next").Size;
|
|
7
|
+
title: string | undefined;
|
|
8
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { LoadingIndicatorComponent } from '../../domain/components/LoadingIndicatorComponent';
|
|
2
|
+
import type { LoadingIndicatorRendererProps } from '../types';
|
|
3
|
+
export declare const loadingIndicatorComponentToProps: ({ control, margin, size, }: LoadingIndicatorComponent) => LoadingIndicatorRendererProps;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ModalComponent } from '../../domain/components/ModalComponent';
|
|
3
|
+
import type { ModalRendererProps } from '../types';
|
|
4
|
+
export declare const modalComponentToProps: ({ control, margin, trigger }: ModalComponent, components: ReactNode) => ModalRendererProps;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { ObjectComponent } from '../../domain/components/ObjectComponent';
|
|
3
|
-
import type {
|
|
4
|
-
export declare const objectComponentToProps: ({ control, description, help, title }: ObjectComponent, children: ReactNode) =>
|
|
3
|
+
import type { FormSectionRendererProps } from '../types';
|
|
4
|
+
export declare const objectComponentToProps: ({ control, description, help, title }: ObjectComponent, children: ReactNode) => FormSectionRendererProps;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { Model } from '@wise/dynamic-flow-types/build/next';
|
|
2
1
|
import type { InputComponent } from '../../../domain/types';
|
|
3
|
-
export declare const inputComponentToProps: <T extends string, M extends
|
|
2
|
+
export declare const inputComponentToProps: <T extends string, M extends import("@wise/dynamic-flow-types/build/next").JsonElement>(component: Omit<InputComponent<M>, "onChange">, type: T) => {
|
|
4
3
|
type: T;
|
|
5
4
|
autoComplete: string;
|
|
6
5
|
control: string | undefined;
|
|
@@ -10,7 +9,6 @@ export declare const inputComponentToProps: <T extends string, M extends Model>(
|
|
|
10
9
|
help: string | undefined;
|
|
11
10
|
id: string;
|
|
12
11
|
label: string | undefined;
|
|
13
|
-
name: string;
|
|
14
12
|
placeholder: string | undefined;
|
|
15
13
|
required: boolean;
|
|
16
14
|
value: M | null;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { Margin as DFMargin, Size as DFSize, SearchResult as SearchResultSpec, Icon as DFIcon } from '@wise/dynamic-flow-types/build/next';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
|
+
import type { DecisionOption as DomainDecisionOption } from '../domain/components/DecisionComponent';
|
|
4
|
+
import type { InstructionItem as DomainInstructionItem } from '../domain/components/InstructionsComponent';
|
|
5
|
+
import type { ReviewCallToAction as DomainReviewCallToAction, ReviewField as DomainReviewField } from '../domain/components/ReviewComponent';
|
|
3
6
|
export type Renderer<P extends RendererProps> = {
|
|
4
7
|
canRender: (props: RendererProps) => boolean;
|
|
5
8
|
render: (props: P) => JSX.Element;
|
|
@@ -38,6 +41,16 @@ export interface ColumnsRendererProps extends RendererProps {
|
|
|
38
41
|
startChildren: ReactNode;
|
|
39
42
|
endChildren: ReactNode;
|
|
40
43
|
}
|
|
44
|
+
export interface DecisionRendererProps extends RendererProps {
|
|
45
|
+
type: 'decision';
|
|
46
|
+
options: DecisionOption[];
|
|
47
|
+
margin: Margin;
|
|
48
|
+
}
|
|
49
|
+
export type DecisionOption = DomainDecisionOption;
|
|
50
|
+
export interface DividerRendererProps extends RendererProps {
|
|
51
|
+
type: 'divider';
|
|
52
|
+
margin: Margin;
|
|
53
|
+
}
|
|
41
54
|
export interface FormRendererProps extends RendererProps {
|
|
42
55
|
type: 'form';
|
|
43
56
|
children: ReactNode;
|
|
@@ -48,10 +61,44 @@ export interface FormRendererProps extends RendererProps {
|
|
|
48
61
|
*/
|
|
49
62
|
export interface HeadingRendererProps extends RendererProps {
|
|
50
63
|
type: 'heading';
|
|
64
|
+
align: Align;
|
|
65
|
+
margin: Margin;
|
|
66
|
+
size: Size;
|
|
51
67
|
text: string;
|
|
68
|
+
}
|
|
69
|
+
export interface InstructionsRendererProps extends RendererProps {
|
|
70
|
+
items: InstructionItem[];
|
|
71
|
+
margin: Margin;
|
|
72
|
+
title?: string;
|
|
73
|
+
}
|
|
74
|
+
export type InstructionItem = DomainInstructionItem;
|
|
75
|
+
export interface LoadingIndicatorRendererProps extends RendererProps {
|
|
76
|
+
type: 'loading-indicator';
|
|
77
|
+
margin: Margin;
|
|
78
|
+
size: Size;
|
|
79
|
+
}
|
|
80
|
+
export interface MarkdownRendererProps extends RendererProps {
|
|
81
|
+
type: 'markdown';
|
|
52
82
|
align: Align;
|
|
53
83
|
margin: Margin;
|
|
84
|
+
content: string;
|
|
85
|
+
}
|
|
86
|
+
export interface ImageRendererProps extends RendererProps {
|
|
87
|
+
type: 'image';
|
|
88
|
+
accessibilityDescription?: string;
|
|
54
89
|
size: Size;
|
|
90
|
+
margin: Margin;
|
|
91
|
+
url: string;
|
|
92
|
+
}
|
|
93
|
+
export interface ModalRendererProps extends RendererProps {
|
|
94
|
+
type: 'modal';
|
|
95
|
+
content: {
|
|
96
|
+
components: ReactNode;
|
|
97
|
+
};
|
|
98
|
+
margin: Margin;
|
|
99
|
+
trigger: {
|
|
100
|
+
title: string;
|
|
101
|
+
};
|
|
55
102
|
}
|
|
56
103
|
/**
|
|
57
104
|
* Known values for "control" are: 'copyable'.
|
|
@@ -62,9 +109,18 @@ export interface ParagraphRendererProps extends RendererProps {
|
|
|
62
109
|
margin: Margin;
|
|
63
110
|
text: string;
|
|
64
111
|
}
|
|
112
|
+
export interface ReviewRendererProps extends RendererProps {
|
|
113
|
+
type: 'review';
|
|
114
|
+
fields: ReviewField[];
|
|
115
|
+
margin: Margin;
|
|
116
|
+
title?: string;
|
|
117
|
+
callToAction?: ReviewCallToAction;
|
|
118
|
+
}
|
|
119
|
+
export type ReviewCallToAction = DomainReviewCallToAction;
|
|
120
|
+
export type ReviewField = DomainReviewField;
|
|
65
121
|
export interface SearchRendererProps extends RendererProps {
|
|
66
122
|
type: 'search';
|
|
67
|
-
|
|
123
|
+
id: string;
|
|
68
124
|
emptyMessage?: string;
|
|
69
125
|
isLoading: boolean;
|
|
70
126
|
margin: Margin;
|
|
@@ -92,8 +148,8 @@ export type ResultsSearchState = {
|
|
|
92
148
|
export type SearchResult = Pick<SearchResultSpec, 'description' | 'icon' | 'image' | 'title'> & {
|
|
93
149
|
onClick: () => void;
|
|
94
150
|
};
|
|
95
|
-
export interface
|
|
96
|
-
type: '
|
|
151
|
+
export interface FormSectionRendererProps extends RendererProps {
|
|
152
|
+
type: 'form-section';
|
|
97
153
|
title?: string;
|
|
98
154
|
description?: string;
|
|
99
155
|
help?: string;
|
|
@@ -107,7 +163,6 @@ interface BaseInputRendererProps<M extends string | number | boolean | null> ext
|
|
|
107
163
|
error?: string;
|
|
108
164
|
help?: string;
|
|
109
165
|
label?: string;
|
|
110
|
-
name: string;
|
|
111
166
|
placeholder?: string;
|
|
112
167
|
required: boolean;
|
|
113
168
|
value: M | null;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import type { AllOfSchema,
|
|
2
|
-
import type {
|
|
1
|
+
import type { AllOfSchema, ArraySchema, ArraySchemaList, BooleanSchema, ConstSchema, IntegerSchema, Model, NumberSchema, ObjectSchema, OneOfSchema, Schema, StringSchema } from '@wise/dynamic-flow-types/build/next';
|
|
2
|
+
import type { StepComponent } from '../domain/types';
|
|
3
3
|
import type { ColumnsComponent } from '../domain/components/ColumnsComponent';
|
|
4
4
|
import type { RepeatableComponent } from '../domain/components/repeatableComponent/RepeatableComponent';
|
|
5
|
-
export declare const hasChildren: (component: StepComponent) => component is
|
|
5
|
+
export declare const hasChildren: (component: StepComponent) => component is StepComponent & {
|
|
6
|
+
getChildren: () => StepComponent[];
|
|
7
|
+
};
|
|
6
8
|
export declare const isColumnsComponent: (component: StepComponent) => component is ColumnsComponent;
|
|
7
9
|
export declare const isRepeatableComponent: (component: StepComponent) => component is RepeatableComponent;
|
|
8
|
-
export declare const isObjectModel: (model: Model) => model is Record<string,
|
|
9
|
-
export declare const isArrayModel: (model: Model) => model is
|
|
10
|
+
export declare const isObjectModel: (model: Model) => model is Record<string, import("@wise/dynamic-flow-types/build/next").JsonElement>;
|
|
11
|
+
export declare const isArrayModel: (model: Model) => model is import("@wise/dynamic-flow-types/build/next").JsonElement[];
|
|
10
12
|
export declare const isAllOfSchema: (schema: Schema) => schema is AllOfSchema;
|
|
11
13
|
export declare const isBooleanSchema: (schema: Schema) => schema is BooleanSchema;
|
|
12
14
|
export declare const isConstSchema: (schema: Schema) => schema is ConstSchema;
|
|
@@ -17,3 +19,6 @@ export declare const isOneOfSchema: (schema: Schema) => schema is OneOfSchema;
|
|
|
17
19
|
export declare const isArraySchema: (schema: Schema) => schema is ArraySchema;
|
|
18
20
|
export declare const isArrayListSchema: (schema: Schema) => schema is ArraySchemaList;
|
|
19
21
|
export declare const isStringSchema: (schema: Schema) => schema is StringSchema;
|
|
22
|
+
export declare const isHiddenSchema: (schema: Schema) => schema is Schema & {
|
|
23
|
+
hidden: true;
|
|
24
|
+
};
|